single-file-core 1.5.45 → 1.5.46
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/core/helper.js +12 -2
- package/core/index.js +10 -2
- package/core/infobar.js +1 -1
- package/core/lib/processor-helper-common.js +6 -2
- package/core/lib/processor-helper-inline.js +9 -6
- package/core/lib/processor-helper.js +9 -6
- package/core/util.js +8 -2
- package/eslint.config.mjs +31 -0
- package/modules/css-fonts-minifier.js +2 -2
- package/modules/css-matched-rules.js +1 -0
- package/modules/html-images-alt-minifier.js +1 -0
- package/modules/html-minifier.js +2 -1
- package/modules/template-formatter.js +10 -2
- package/package.json +6 -3
- package/processors/compression/compression.js +1 -1
- package/processors/frame-tree/content/content-frame-tree.js +7 -2
- package/processors/hooks/content/content-hooks-frames-web.js +4 -1
- package/processors/hooks/content/content-hooks-frames.js +1 -1
- package/processors/lazy/content/content-lazy-loader.js +3 -2
- package/single-file-infobar.js +2 -1
- package/single-file.js +0 -2
- package/vendor/css-media-query-parser.js +1 -1
- package/vendor/css-minifier.js +4 -3
- package/vendor/css-tree.js +10 -10
- package/vendor/css-unescape.js +0 -1
- package/vendor/html-srcset-parser.js +2 -2
- package/vendor/mime-type-parser.js +2 -2
- package/.eslintrc.js +0 -40
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/* global globalThis */
|
|
25
|
-
|
|
26
24
|
import * as lazy from "./../../lazy/content/content-lazy-loader.js";
|
|
27
25
|
import {
|
|
28
26
|
ON_BEFORE_CAPTURE_EVENT_NAME,
|
|
@@ -293,6 +291,7 @@ function processFramesAsync(doc, frameElements, options, parentWindowId, session
|
|
|
293
291
|
const windowId = parentWindowId + WINDOW_ID_SEPARATOR + frameIndex;
|
|
294
292
|
try {
|
|
295
293
|
sendMessage(frameElement.contentWindow, { method: INIT_REQUEST_MESSAGE, windowId, sessionId, options, scrolling: frameElement.scrolling });
|
|
294
|
+
// eslint-disable-next-line no-unused-vars
|
|
296
295
|
} catch (error) {
|
|
297
296
|
// ignored
|
|
298
297
|
}
|
|
@@ -310,6 +309,7 @@ function processFramesSync(doc, frameElements, options, parentWindowId, sessionI
|
|
|
310
309
|
frameDoc = frameElement.contentDocument;
|
|
311
310
|
frameWindow = frameElement.contentWindow;
|
|
312
311
|
frameWindow.stop();
|
|
312
|
+
// eslint-disable-next-line no-unused-vars
|
|
313
313
|
} catch (error) {
|
|
314
314
|
// ignored
|
|
315
315
|
}
|
|
@@ -324,6 +324,7 @@ function processFramesSync(doc, frameElements, options, parentWindowId, sessionI
|
|
|
324
324
|
clearFrameTimeout("requestTimeouts", sessionId, windowId);
|
|
325
325
|
processFrames(frameDoc, options, windowId, sessionId);
|
|
326
326
|
frames.push(getFrameData(frameDoc, frameWindow, windowId, options, frameElement.scrolling));
|
|
327
|
+
// eslint-disable-next-line no-unused-vars
|
|
327
328
|
} catch (error) {
|
|
328
329
|
frames.push({ windowId, processed: true });
|
|
329
330
|
}
|
|
@@ -357,6 +358,7 @@ function cleanupFrames(frameElements, parentWindowId, sessionId) {
|
|
|
357
358
|
frameElement.removeAttribute(helper.WIN_ID_ATTRIBUTE_NAME);
|
|
358
359
|
try {
|
|
359
360
|
sendMessage(frameElement.contentWindow, { method: CLEANUP_REQUEST_MESSAGE, windowId, sessionId });
|
|
361
|
+
// eslint-disable-next-line no-unused-vars
|
|
360
362
|
} catch (error) {
|
|
361
363
|
// ignored
|
|
362
364
|
}
|
|
@@ -366,12 +368,14 @@ function cleanupFrames(frameElements, parentWindowId, sessionId) {
|
|
|
366
368
|
let frameDoc;
|
|
367
369
|
try {
|
|
368
370
|
frameDoc = frameElement.contentDocument;
|
|
371
|
+
// eslint-disable-next-line no-unused-vars
|
|
369
372
|
} catch (error) {
|
|
370
373
|
// ignored
|
|
371
374
|
}
|
|
372
375
|
if (frameDoc) {
|
|
373
376
|
try {
|
|
374
377
|
cleanupFrames(getFrames(frameDoc), windowId, sessionId);
|
|
378
|
+
// eslint-disable-next-line no-unused-vars
|
|
375
379
|
} catch (error) {
|
|
376
380
|
// ignored
|
|
377
381
|
}
|
|
@@ -383,6 +387,7 @@ function sendInitResponse(message) {
|
|
|
383
387
|
message.method = INIT_RESPONSE_MESSAGE;
|
|
384
388
|
try {
|
|
385
389
|
top.singlefile.processors.frameTree.initResponse(message);
|
|
390
|
+
// eslint-disable-next-line no-unused-vars
|
|
386
391
|
} catch (error) {
|
|
387
392
|
sendMessage(top, message, true);
|
|
388
393
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/* global
|
|
24
|
+
/* global window */
|
|
25
25
|
|
|
26
26
|
(globalThis => {
|
|
27
27
|
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
document.addEventListener(BLOCK_COOKIES_START_EVENT, () => {
|
|
110
110
|
try {
|
|
111
111
|
document.__defineGetter__("cookie", () => { throw new Error("document.cookie temporary blocked by SingleFile"); });
|
|
112
|
+
// eslint-disable-next-line no-unused-vars
|
|
112
113
|
} catch (error) {
|
|
113
114
|
// ignored
|
|
114
115
|
}
|
|
@@ -155,6 +156,7 @@
|
|
|
155
156
|
if (globalThis.bootstrap && event.detail.data) {
|
|
156
157
|
globalThis.bootstrap(event.detail.data);
|
|
157
158
|
}
|
|
159
|
+
// eslint-disable-next-line no-unused-vars
|
|
158
160
|
} catch (error) {
|
|
159
161
|
// ignored
|
|
160
162
|
}
|
|
@@ -438,6 +440,7 @@
|
|
|
438
440
|
if (dispatchScrollEvent) {
|
|
439
441
|
globalThis.dispatchEvent(new UIEvent("scroll"));
|
|
440
442
|
}
|
|
443
|
+
// eslint-disable-next-line no-unused-vars
|
|
441
444
|
} catch (error) {
|
|
442
445
|
// ignored
|
|
443
446
|
}
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/* global globalThis */
|
|
25
|
-
|
|
26
24
|
import * as hooksFrames from "./../../hooks/content/content-hooks-frames.js";
|
|
27
25
|
import {
|
|
28
26
|
LAZY_SRC_ATTRIBUTE_NAME,
|
|
@@ -51,6 +49,7 @@ if (browser && browser.runtime && browser.runtime.onMessage && browser.runtime.o
|
|
|
51
49
|
timeouts.delete(message.type);
|
|
52
50
|
try {
|
|
53
51
|
timeoutData.callback();
|
|
52
|
+
// eslint-disable-next-line no-unused-vars
|
|
54
53
|
} catch (error) {
|
|
55
54
|
clearRegularTimeout(message.type);
|
|
56
55
|
}
|
|
@@ -192,6 +191,7 @@ async function setAsyncTimeout(type, callback, delay, forceNativeTimeout) {
|
|
|
192
191
|
timeouts.set(type, timeoutData);
|
|
193
192
|
try {
|
|
194
193
|
await browser.runtime.sendMessage({ method: "singlefile.lazyTimeout.setTimeout", type, delay });
|
|
194
|
+
// eslint-disable-next-line no-unused-vars
|
|
195
195
|
} catch (error) {
|
|
196
196
|
setRegularTimeout(type, callback, delay);
|
|
197
197
|
}
|
|
@@ -215,6 +215,7 @@ async function clearAsyncTimeout(type) {
|
|
|
215
215
|
if (browser && browser.runtime && browser.runtime.sendMessage) {
|
|
216
216
|
try {
|
|
217
217
|
await browser.runtime.sendMessage({ method: "singlefile.lazyTimeout.clearTimeout", type });
|
|
218
|
+
// eslint-disable-next-line no-unused-vars
|
|
218
219
|
} catch (error) {
|
|
219
220
|
clearRegularTimeout(type);
|
|
220
221
|
}
|
package/single-file-infobar.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/* global
|
|
24
|
+
/* global window, document */
|
|
25
25
|
|
|
26
26
|
import { appendInfobar, refreshInfobarInfo, extractInfobarData } from "./core/infobar.js";
|
|
27
27
|
|
|
@@ -55,6 +55,7 @@ import { appendInfobar, refreshInfobarInfo, extractInfobarData } from "./core/in
|
|
|
55
55
|
if (browser && browser.runtime && browser.runtime.sendMessage) {
|
|
56
56
|
try {
|
|
57
57
|
options = await browser.runtime.sendMessage({ method: "tabs.getOptions", url: infoData.saveUrl });
|
|
58
|
+
// eslint-disable-next-line no-unused-vars
|
|
58
59
|
} catch (error) {
|
|
59
60
|
// ignored
|
|
60
61
|
}
|
package/single-file.js
CHANGED
package/vendor/css-minifier.js
CHANGED
|
@@ -246,7 +246,7 @@ function keyframes(content, preservedTokens) {
|
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
248
|
|
|
249
|
-
while (true) {
|
|
249
|
+
while (true) {
|
|
250
250
|
|
|
251
251
|
let level = 0;
|
|
252
252
|
buffer = "";
|
|
@@ -327,7 +327,7 @@ function collectComments(content, comments) {
|
|
|
327
327
|
|
|
328
328
|
let from = 0, end;
|
|
329
329
|
|
|
330
|
-
while (true) {
|
|
330
|
+
while (true) {
|
|
331
331
|
|
|
332
332
|
const start = content.indexOf("/*", from);
|
|
333
333
|
|
|
@@ -572,7 +572,8 @@ function processString(content = "", options = defaultOptions) {
|
|
|
572
572
|
try {
|
|
573
573
|
pattern = REGEXP_REMOVE_SPACES;
|
|
574
574
|
content = content.replace(pattern, token => token.replace(REGEXP_COLUMN, "___PSEUDOCLASSCOLON___"));
|
|
575
|
-
|
|
575
|
+
// eslint-disable-next-line no-unused-vars
|
|
576
|
+
} catch (error) {
|
|
576
577
|
// ignored
|
|
577
578
|
}
|
|
578
579
|
|