@@ -245,6 +245,90 @@ describe("check-openclaw-package-tarball", () => {
245245 ) ;
246246 } ) ;
247247
248+ it ( "rejects dist files with missing import.meta.url URL dependencies" , ( ) => {
249+ withTarball (
250+ [ "dist/index.js" ] ,
251+ { "dist/index.js" : 'const worker = new URL("./worker.js", import.meta.url);\n' } ,
252+ ( tarball ) => {
253+ const result = spawnSync ( "node" , [ CHECK_SCRIPT , tarball ] , { encoding : "utf8" } ) ;
254+
255+ expect ( result . status ) . not . toBe ( 0 ) ;
256+ expect ( result . stderr ) . toContain ( "dist/index.js imports missing dist/worker.js" ) ;
257+ } ,
258+ "2026.4.27" ,
259+ ) ;
260+ } ) ;
261+
262+ it ( "rejects formatted import.meta.url URL dependencies" , ( ) => {
263+ withTarball (
264+ [ "dist/index.js" ] ,
265+ {
266+ "dist/index.js" : [
267+ "const worker = new URL(" ,
268+ ' "./worker.js",' ,
269+ " import.meta.url," ,
270+ ");" ,
271+ "" ,
272+ ] . join ( "\n" ) ,
273+ } ,
274+ ( tarball ) => {
275+ const result = spawnSync ( "node" , [ CHECK_SCRIPT , tarball ] , { encoding : "utf8" } ) ;
276+
277+ expect ( result . status ) . not . toBe ( 0 ) ;
278+ expect ( result . stderr ) . toContain ( "dist/index.js imports missing dist/worker.js" ) ;
279+ } ,
280+ "2026.4.27" ,
281+ ) ;
282+ } ) ;
283+
284+ it ( "rejects import.meta.url URL dependencies omitted from the postinstall inventory" , ( ) => {
285+ withTarball (
286+ [ "dist/index.js" ] ,
287+ {
288+ "dist/index.js" : 'const worker = new URL("./worker.js", import.meta.url);\n' ,
289+ "dist/worker.js" : "export {};\n" ,
290+ } ,
291+ ( tarball ) => {
292+ const result = spawnSync ( "node" , [ CHECK_SCRIPT , tarball ] , { encoding : "utf8" } ) ;
293+
294+ expect ( result . status ) . not . toBe ( 0 ) ;
295+ expect ( result . stderr ) . toContain ( "inventory omits imported dist file dist/worker.js" ) ;
296+ } ,
297+ "2026.4.27" ,
298+ ) ;
299+ } ) ;
300+
301+ it ( "allows import.meta.url package-root probes" , ( ) => {
302+ withTarball (
303+ [ "dist/index.js" ] ,
304+ { "dist/index.js" : 'const root = new URL("../..", import.meta.url);\n' } ,
305+ ( tarball ) => {
306+ const result = spawnSync ( "node" , [ CHECK_SCRIPT , tarball ] , { encoding : "utf8" } ) ;
307+
308+ expect ( result . status , result . stderr ) . toBe ( 0 ) ;
309+ expect ( result . stdout ) . toContain ( "OpenClaw package tarball integrity passed." ) ;
310+ } ,
311+ "2026.4.27" ,
312+ ) ;
313+ } ) ;
314+
315+ it ( "allows import.meta.url source helper probes" , ( ) => {
316+ withTarball (
317+ [ "dist/index.js" ] ,
318+ {
319+ "dist/index.js" :
320+ 'const shim = new URL("./capability-runtime-vitest-shims/config-runtime.ts", import.meta.url);\n' ,
321+ } ,
322+ ( tarball ) => {
323+ const result = spawnSync ( "node" , [ CHECK_SCRIPT , tarball ] , { encoding : "utf8" } ) ;
324+
325+ expect ( result . status , result . stderr ) . toBe ( 0 ) ;
326+ expect ( result . stdout ) . toContain ( "OpenClaw package tarball integrity passed." ) ;
327+ } ,
328+ "2026.4.27" ,
329+ ) ;
330+ } ) ;
331+
248332 it ( "rejects missing Control UI assets" , ( ) => {
249333 withTarball (
250334 [ "dist/index.js" ] ,
0 commit comments