Skip to content

Commit

Permalink
docs: add comment for script setup #56
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Weber committed Jul 19, 2021
1 parent 274e678 commit 66fc159
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/actions/javascriptAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export async function executeScript(context: ScriptContext): Promise<Variables>
scriptRequire.resolve = (req: unknown) => (Module as any)._resolveFilename(req, scriptModule);

const vars = Object.entries(context.variables).map(([key]) => key).join(', ').trim();

// function call and content needs to be in one line for correct line number on error,
// end of function needs to be in separated line, because of comments in last line of script
const wrappedFunction = `(function userJS(exports, require, module, __filename, __dirname${vars.length > 0 ? `, ${vars}` : ''}){${context.script}
})`;

Expand Down

0 comments on commit 66fc159

Please sign in to comment.