single-file-cli 2.9.2 → 2.11.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 +1 -1
- package/deno.json +1 -1
- package/lib/bidi-client.js +3 -4
- package/lib/cdp-client.js +1 -1
- package/lib/single-file-archive.js +6 -5
- package/lib/single-file-bundle.js +1 -1
- package/lib/single-file-script.js +6 -5
- package/lib/version.js +1 -1
- package/options.js +5 -2
- package/package.json +1 -1
- package/single-file-cli-api.js +42 -22
- package/test/e2e/browser-script.test.js +40 -0
- package/test/e2e/canvas-round-trip.test.js +5 -1
- package/test/e2e/dump-json.test.js +111 -0
- package/test/e2e/font-face-source-order.test.js +137 -0
- package/test/e2e/html-at-media-url.test.js +3 -1
- package/test/e2e/insert-head-elements.test.js +71 -0
- package/test/e2e/max-appended-data-length.test.js +100 -0
- package/test/unit/archive-options.test.js +51 -0
package/build.sh
CHANGED
package/deno.json
CHANGED
package/lib/bidi-client.js
CHANGED
|
@@ -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
|
|
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";
|
|
@@ -316,7 +315,7 @@ async function setupNetwork(pageContext) {
|
|
|
316
315
|
}
|
|
317
316
|
}, pageContext));
|
|
318
317
|
}
|
|
319
|
-
if (options.outputJson) {
|
|
318
|
+
if (options.outputJson || options.dumpJson) {
|
|
320
319
|
setupHttpInfoCapture(pageContext);
|
|
321
320
|
}
|
|
322
321
|
if (options.browserCookies && options.browserCookies.length) {
|
|
@@ -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 =
|
|
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]
|
package/lib/cdp-client.js
CHANGED
|
@@ -388,7 +388,7 @@ function captureHttpInfo(params, urlState, { options, debugMessages, httpInfo })
|
|
|
388
388
|
const LOCATION_HEADER_NAME = "location";
|
|
389
389
|
const { request, resourceType, responseHeaders, responseStatusCode, responseStatusText } = params;
|
|
390
390
|
const shouldCapture = resourceType === DOCUMENT_RESOURCE_TYPE &&
|
|
391
|
-
options.outputJson &&
|
|
391
|
+
(options.outputJson || options.dumpJson) &&
|
|
392
392
|
!httpInfo.request &&
|
|
393
393
|
responseStatusCode !== undefined &&
|
|
394
394
|
(request.url === urlState.url || request.url === urlState.alternativeUrl);
|