@@ -67,8 +67,10 @@ const lookupScriptlet = (rawToken, mainMap, isolatedMap, debug = false) => {
67
67
const details = reng . contentFromName ( token , 'text/javascript' ) ;
68
68
if ( details === undefined ) { return ; }
69
69
const targetWorldMap = details . world !== 'ISOLATED' ? mainMap : isolatedMap ;
70
- targetWorldMap . set ( token , details . js ) ;
71
70
const content = patchScriptlet ( details . js , args . slice ( 1 ) ) ;
71
+ if ( content . startsWith ( '(function(' ) === false ) {
72
+ targetWorldMap . set ( token , details . js ) ;
73
+ }
72
74
const dependencies = details . dependencies || [ ] ;
73
75
while ( dependencies . length !== 0 ) {
74
76
const token = dependencies . shift ( ) ;
@@ -291,7 +293,7 @@ export class ScriptletFilteringEngine {
291
293
options . debugScriptlets ? 'debugger;' : ';' ,
292
294
'' ,
293
295
// For use by scriptlets to share local data among themselves
294
- `const scriptletGlobals = ${ JSON . stringify ( scriptletGlobals , null , 4 ) } ` ,
296
+ `const scriptletGlobals = ${ JSON . stringify ( scriptletGlobals , null , 4 ) } ; ` ,
295
297
'' ,
296
298
scriptletDetails . mainWorld ,
297
299
'' ,
@@ -305,7 +307,7 @@ export class ScriptletFilteringEngine {
305
307
options . debugScriptlets ? 'debugger;' : ';' ,
306
308
'' ,
307
309
// For use by scriptlets to share local data among themselves
308
- `const scriptletGlobals = ${ JSON . stringify ( scriptletGlobals , null , 4 ) } ` ,
310
+ `const scriptletGlobals = ${ JSON . stringify ( scriptletGlobals , null , 4 ) } ; ` ,
309
311
'' ,
310
312
scriptletDetails . isolatedWorld ,
311
313
'' ,
0 commit comments