mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +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 FAILURE_OUTPUT_TAIL_LINES = 40;
|
||||
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) {
|
||||
const modeArg = argv.find((arg) => arg.startsWith("--mode="));
|
||||
@@ -636,7 +639,12 @@ async function runCanaryCheck(extensionIds) {
|
||||
try {
|
||||
writeFileSync(
|
||||
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",
|
||||
);
|
||||
writeFileSync(
|
||||
@@ -666,7 +674,7 @@ async function runCanaryCheck(extensionIds) {
|
||||
error instanceof Error && typeof error.fullOutput === "string"
|
||||
? error.fullOutput
|
||||
: 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;
|
||||
}
|
||||
} 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",
|
||||
[
|
||||
"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}`);",
|
||||
"console.error('TS6059');",
|
||||
"process.exit(2);",
|
||||
@@ -309,7 +309,7 @@ describe("check-extension-package-tsc-boundary", () => {
|
||||
),
|
||||
).rejects.toMatchObject({
|
||||
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",
|
||||
elapsedMs: expect.any(Number),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user