single-file-cli 2.9.2 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.sh CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  set -e
4
4
 
5
- CORE_PACKAGE="npm:single-file-core@1.5.123"
5
+ CORE_PACKAGE="npm:single-file-core@1.5.126"
6
6
  ESBUILD_PACKAGE="npm:esbuild@0.27.7"
7
7
  WEB_STREAMS_PACKAGE="npm:web-streams-polyfill@4.3.0"
8
8
 
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@single-file/single-file-cli",
3
- "version": "2.9.2",
3
+ "version": "2.10.0",
4
4
  "description": "SingleFile CLI",
5
5
  "exports": {
6
6
  ".": "./single-file-cli-api.js"
@@ -67,8 +67,7 @@ const PRINT_TO_PDF_FUNCTION_NAME = "printToPDF";
67
67
  const SET_SCREENSHOT_FUNCTION_NAME = "setScreenshot";
68
68
  const SET_PDF_FUNCTION_NAME = "setPDF";
69
69
  const SET_PAGE_DATA_FUNCTION_NAME = "setPageData";
70
- const SINGLE_FILE_GLOBAL_DECLARATION = /var singlefile\s*=\s*/;
71
- const SINGLE_FILE_GLOBAL_ASSIGNMENT = "globalThis.singlefile=window.singlefile=";
70
+ const SINGLE_FILE_GLOBAL_ASSIGNMENT = "globalThis.singlefile=window.singlefile=singlefile;";
72
71
  const SERVER_CONNECT_TIMEOUT = 30000;
73
72
  const SESSION_TIMEOUT = 120000;
74
73
  const SERVER_SESSION_PATH = "/session";
@@ -406,7 +405,7 @@ async function setupCookies(pageContext) {
406
405
 
407
406
  async function setupScriptInjection(pageContext) {
408
407
  const { options, context, preloadScripts } = pageContext;
409
- const scriptSource = (await getScriptSource(options)).replace(SINGLE_FILE_GLOBAL_DECLARATION, SINGLE_FILE_GLOBAL_ASSIGNMENT);
408
+ const scriptSource = await getScriptSource(options, SINGLE_FILE_GLOBAL_ASSIGNMENT);
410
409
  const hookScript = await session.send("script.addPreloadScript", {
411
410
  functionDeclaration: "() => {" + getHookScriptSource() + "}",
412
411
  contexts: [context]