single-file-cli 1.1.51 → 1.1.53

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.
@@ -21,7 +21,7 @@
21
21
  * Source.
22
22
  */
23
23
 
24
- /* global singlefile, require, exports */
24
+ /* global singlefile, require, exports, setTimeout */
25
25
 
26
26
  const puppeteer = require("puppeteer-core");
27
27
  const scripts = require("./common/scripts.js");
@@ -108,13 +108,13 @@ async function getPageData(browser, page, options) {
108
108
  const injectedScript = await scripts.get(options);
109
109
  await page.evaluateOnNewDocument(injectedScript);
110
110
  if (options.browserDebug) {
111
- await page.waitForTimeout(3000);
111
+ await new Promise(resolve => setTimeout(resolve, 3000));
112
112
  }
113
113
  await pageGoto(page, options);
114
114
  try {
115
115
  await page.evaluate(injectedScript);
116
116
  if (options.browserWaitDelay) {
117
- await page.waitForTimeout(options.browserWaitDelay);
117
+ await new Promise(resolve => setTimeout(resolve, options.browserWaitDelay));
118
118
  }
119
119
  const pageData = await page.evaluate(async options => await singlefile.getPageData(options), options);
120
120
  if (options.compressContent) {
@@ -21,7 +21,7 @@
21
21
  * Source.
22
22
  */
23
23
 
24
- /* global singlefile, require, exports */
24
+ /* global singlefile, require, exports, setTimeout */
25
25
 
26
26
  const puppeteer = require("puppeteer-core");
27
27
  const scripts = require("./common/scripts.js");
@@ -49,7 +49,7 @@ exports.getPageData = async (options, page) => {
49
49
  if (options.httpProxyServer) {
50
50
  contextOptions.proxyServer = options.httpProxyServer;
51
51
  }
52
- context = await browser.createIncognitoBrowserContext(contextOptions);
52
+ context = await browser.createBrowserContext(contextOptions);
53
53
  page = await context.newPage();
54
54
  }
55
55
  await setPageOptions(page, options);
@@ -129,7 +129,7 @@ async function getPageData(context, page, options) {
129
129
  const injectedScript = await scripts.get(options);
130
130
  await page.evaluateOnNewDocument(injectedScript);
131
131
  if (options.browserDebug) {
132
- await page.waitForTimeout(3000);
132
+ await new Promise(resolve => setTimeout(resolve, 3000));
133
133
  }
134
134
  try {
135
135
  await pageGoto(page, options);
@@ -148,7 +148,7 @@ async function getPageData(context, page, options) {
148
148
  }
149
149
  try {
150
150
  if (options.browserWaitDelay) {
151
- await page.waitForTimeout(options.browserWaitDelay);
151
+ await new Promise(resolve => setTimeout(resolve, options.browserWaitDelay));
152
152
  }
153
153
  const pageData = await page.evaluate(async options => await singlefile.getPageData(options), options);
154
154
  if (options.compressContent) {
@@ -60,7 +60,7 @@ function getBrowserOptions(options) {
60
60
  const chromeOptions = new chrome.Options();
61
61
  const optionHeadless = (options.browserHeadless === undefined || options.browserHeadless) && !options.browserDebug;
62
62
  if (optionHeadless) {
63
- chromeOptions.headless();
63
+ chromeOptions.addArguments("--headless");
64
64
  }
65
65
  if (options.browserExecutablePath) {
66
66
  chromeOptions.setChromeBinaryPath(options.browserExecutablePath);