File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,6 +131,14 @@ function getScriptletCode(source: Source): string {
131131
132132 const scriptletFunctionString = scriptletFunction . toString ( ) ;
133133
134+ /**
135+ * `corelibs` (and `test`) environments expect a function definition
136+ * that they will invoke later with their own injection mechanism,
137+ * so we wrap the scriptlet in an anonymous function that accepts parameters — source and args.
138+ *
139+ * `extension` environment need the scriptlet to execute immediately upon injection,
140+ * so we wrap it in an IIFE with the source configuration and arguments passed directly.
141+ */
134142 const result = source . engine === 'corelibs' || source . engine === 'test'
135143 ? wrapInNonameFunc ( scriptletFunctionString )
136144 : passSourceAndProps ( source , scriptletFunctionString ) ;
You can’t perform that action at this time.
0 commit comments