mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 21:40:21 +00:00
perf(plugins): slim boundary canary target
This commit is contained in:
@@ -24,6 +24,9 @@ const prepareBoundaryArtifactsBin = resolve(
|
|||||||
const extensionPackageBoundaryBaseConfig = "../tsconfig.package-boundary.base.json";
|
const extensionPackageBoundaryBaseConfig = "../tsconfig.package-boundary.base.json";
|
||||||
const FAILURE_OUTPUT_TAIL_LINES = 40;
|
const FAILURE_OUTPUT_TAIL_LINES = 40;
|
||||||
const COMPILE_INPUT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".json"]);
|
const COMPILE_INPUT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".json"]);
|
||||||
|
const ROOTDIR_BOUNDARY_CANARY_IMPORT_PATH =
|
||||||
|
"../../src/plugins/contracts/rootdir-boundary-canary.ts";
|
||||||
|
const ROOTDIR_BOUNDARY_CANARY_OUTPUT_HINT = "src/plugins/contracts/rootdir-boundary-canary.ts";
|
||||||
|
|
||||||
function parseMode(argv) {
|
function parseMode(argv) {
|
||||||
const modeArg = argv.find((arg) => arg.startsWith("--mode="));
|
const modeArg = argv.find((arg) => arg.startsWith("--mode="));
|
||||||
@@ -636,7 +639,12 @@ async function runCanaryCheck(extensionIds) {
|
|||||||
try {
|
try {
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
canaryPath,
|
canaryPath,
|
||||||
'import * as foo from "../../src/cli/acp-cli.ts";\nvoid foo;\nexport {};\n',
|
[
|
||||||
|
`import { ROOTDIR_BOUNDARY_CANARY } from "${ROOTDIR_BOUNDARY_CANARY_IMPORT_PATH}";`,
|
||||||
|
"void ROOTDIR_BOUNDARY_CANARY;",
|
||||||
|
"export {};",
|
||||||
|
"",
|
||||||
|
].join("\n"),
|
||||||
"utf8",
|
"utf8",
|
||||||
);
|
);
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
@@ -666,7 +674,7 @@ async function runCanaryCheck(extensionIds) {
|
|||||||
error instanceof Error && typeof error.fullOutput === "string"
|
error instanceof Error && typeof error.fullOutput === "string"
|
||||||
? error.fullOutput
|
? error.fullOutput
|
||||||
: String(error);
|
: String(error);
|
||||||
if (!output.includes("TS6059") || !output.includes("src/cli/acp-cli.ts")) {
|
if (!output.includes("TS6059") || !output.includes(ROOTDIR_BOUNDARY_CANARY_OUTPUT_HINT)) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
1
src/plugins/contracts/rootdir-boundary-canary.ts
Normal file
1
src/plugins/contracts/rootdir-boundary-canary.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export const ROOTDIR_BOUNDARY_CANARY = true;
|
||||||
@@ -299,7 +299,7 @@ describe("check-extension-package-tsc-boundary", () => {
|
|||||||
[
|
[
|
||||||
"--eval",
|
"--eval",
|
||||||
[
|
[
|
||||||
"console.log('src/cli/acp-cli.ts');",
|
"console.log('src/plugins/contracts/rootdir-boundary-canary.ts');",
|
||||||
"for (let index = 1; index <= 45; index += 1) console.log(`stdout ${index}`);",
|
"for (let index = 1; index <= 45; index += 1) console.log(`stdout ${index}`);",
|
||||||
"console.error('TS6059');",
|
"console.error('TS6059');",
|
||||||
"process.exit(2);",
|
"process.exit(2);",
|
||||||
@@ -309,7 +309,7 @@ describe("check-extension-package-tsc-boundary", () => {
|
|||||||
),
|
),
|
||||||
).rejects.toMatchObject({
|
).rejects.toMatchObject({
|
||||||
message: expect.stringContaining("[... 6 earlier lines omitted ...]"),
|
message: expect.stringContaining("[... 6 earlier lines omitted ...]"),
|
||||||
fullOutput: expect.stringContaining("src/cli/acp-cli.ts"),
|
fullOutput: expect.stringContaining("src/plugins/contracts/rootdir-boundary-canary.ts"),
|
||||||
kind: "nonzero-exit",
|
kind: "nonzero-exit",
|
||||||
elapsedMs: expect.any(Number),
|
elapsedMs: expect.any(Number),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user