@@ -12,6 +12,7 @@ import {
1212 createPrefixedOutputWriter ,
1313 isArtifactSetFresh ,
1414 parseMode ,
15+ resolveBoundaryEntryShimRequiredOutputs ,
1516 resolveBoundaryRootShimsTimeoutMs ,
1617 runNodeStep ,
1718 runNodeSteps ,
@@ -404,6 +405,67 @@ describe("prepare-extension-package-boundary-artifacts", () => {
404405 ) . toBe ( false ) ;
405406 } ) ;
406407
408+ it ( "requires generated entry-shim outputs in addition to the freshness stamp" , ( ) => {
409+ const rootDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "openclaw-boundary-entry-shims-" ) ) ;
410+ tempRoots . add ( rootDir ) ;
411+ const inputPath = path . join ( rootDir , "scripts" , "write-plugin-sdk-entry-dts.ts" ) ;
412+ const stampPath = path . join ( rootDir , "dist" , "plugin-sdk" , ".boundary-entry-shims.stamp" ) ;
413+ const rootDtsPath = path . join ( rootDir , "dist" , "plugin-sdk" , "index.d.ts" ) ;
414+ const packageDtsPath = path . join (
415+ rootDir ,
416+ "packages" ,
417+ "plugin-sdk" ,
418+ "dist" ,
419+ "src" ,
420+ "plugin-sdk" ,
421+ "index.d.ts" ,
422+ ) ;
423+
424+ fs . mkdirSync ( path . dirname ( inputPath ) , { recursive : true } ) ;
425+ fs . mkdirSync ( path . dirname ( stampPath ) , { recursive : true } ) ;
426+ fs . mkdirSync ( path . dirname ( rootDtsPath ) , { recursive : true } ) ;
427+ fs . mkdirSync ( path . dirname ( packageDtsPath ) , { recursive : true } ) ;
428+ fs . writeFileSync ( inputPath , "export {};\n" , "utf8" ) ;
429+ fs . writeFileSync ( stampPath , "ok\n" , "utf8" ) ;
430+ fs . writeFileSync ( rootDtsPath , "export {};\n" , "utf8" ) ;
431+ fs . writeFileSync ( packageDtsPath , "export {};\n" , "utf8" ) ;
432+
433+ fs . utimesSync ( inputPath , new Date ( 1_000 ) , new Date ( 1_000 ) ) ;
434+ fs . utimesSync ( stampPath , new Date ( 2_000 ) , new Date ( 2_000 ) ) ;
435+ fs . utimesSync ( rootDtsPath , new Date ( 2_000 ) , new Date ( 2_000 ) ) ;
436+ fs . utimesSync ( packageDtsPath , new Date ( 2_000 ) , new Date ( 2_000 ) ) ;
437+
438+ expect (
439+ isArtifactSetFresh ( {
440+ rootDir,
441+ inputPaths : [ "scripts/write-plugin-sdk-entry-dts.ts" ] ,
442+ outputPaths : [
443+ "dist/plugin-sdk/.boundary-entry-shims.stamp" ,
444+ "dist/plugin-sdk/index.d.ts" ,
445+ "packages/plugin-sdk/dist/src/plugin-sdk/index.d.ts" ,
446+ ] ,
447+ } ) ,
448+ ) . toBe ( true ) ;
449+
450+ fs . rmSync ( packageDtsPath ) ;
451+
452+ expect (
453+ isArtifactSetFresh ( {
454+ rootDir,
455+ inputPaths : [ "scripts/write-plugin-sdk-entry-dts.ts" ] ,
456+ outputPaths : [
457+ "dist/plugin-sdk/.boundary-entry-shims.stamp" ,
458+ "dist/plugin-sdk/index.d.ts" ,
459+ "packages/plugin-sdk/dist/src/plugin-sdk/index.d.ts" ,
460+ ] ,
461+ } ) ,
462+ ) . toBe ( false ) ;
463+ expect ( resolveBoundaryEntryShimRequiredOutputs ( { } ) ) . toContain ( "dist/plugin-sdk/index.d.ts" ) ;
464+ expect ( resolveBoundaryEntryShimRequiredOutputs ( { } ) ) . toContain (
465+ "packages/plugin-sdk/dist/src/plugin-sdk/index.d.ts" ,
466+ ) ;
467+ } ) ;
468+
407469 it ( "parses prep mode and rejects unknown values" , ( ) => {
408470 expect ( parseMode ( [ ] ) ) . toBe ( "all" ) ;
409471 expect ( parseMode ( [ "--mode=package-boundary" ] ) ) . toBe ( "package-boundary" ) ;
0 commit comments