single-file-core 1.5.102 → 1.5.104
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/index.js
CHANGED
|
@@ -181,6 +181,9 @@ class Runner {
|
|
|
181
181
|
this.options.rootDocument = root;
|
|
182
182
|
this.options.updatedResources = this.options.updatedResources || {};
|
|
183
183
|
this.options.fontTests = new Map();
|
|
184
|
+
if (root && !this.options.saveFilenameTemplateData && (this.options.openEditor || /{digest-sha-\d/.test(this.options.filenameTemplate))) {
|
|
185
|
+
this.options.saveFilenameTemplateData = true;
|
|
186
|
+
}
|
|
184
187
|
this.batchRequest = new BatchRequest();
|
|
185
188
|
this.processor = new Processor(options, processorHelper, this.batchRequest);
|
|
186
189
|
if (rootDocDefined) {
|
|
@@ -668,7 +671,7 @@ class Processor {
|
|
|
668
671
|
optionsElement.textContent = JSON.stringify({
|
|
669
672
|
saveUrl: this.options.url,
|
|
670
673
|
saveDate: this.options.saveDate.getTime(),
|
|
671
|
-
visitDate: this.options.visitDate.getTime(),
|
|
674
|
+
visitDate: (this.options.visitDate || this.options.saveDate).getTime(),
|
|
672
675
|
filenameTemplate: this.options.filenameTemplate,
|
|
673
676
|
filenameReplacedCharacters: this.options.filenameReplacedCharacters,
|
|
674
677
|
filenameReplacementCharacter: this.options.filenameReplacementCharacter,
|
|
@@ -248,7 +248,7 @@ class ProcessorHelperCommon {
|
|
|
248
248
|
return serializeSrcset([Object.assign({}, srcsetValue, { url: resourceURL })]);
|
|
249
249
|
}
|
|
250
250
|
}));
|
|
251
|
-
resourceElement.setAttribute("srcset", srcsetValues.join(", "));
|
|
251
|
+
resourceElement.setAttribute("srcset", srcsetValues.filter(srcsetValue => srcsetValue).join(", "));
|
|
252
252
|
} else {
|
|
253
253
|
resourceElement.setAttribute("srcset", "");
|
|
254
254
|
}
|
package/package.json
CHANGED
package/test/fixtures/README.md
CHANGED
|
@@ -9,6 +9,9 @@ Frozen sample archives used by the test suites of the projects consuming
|
|
|
9
9
|
stylesheet and an image: the manifest has an `aliases` map and the
|
|
10
10
|
`pages/N/` copies are symlink entries
|
|
11
11
|
- `single-page.zip.html` — regular single-page self-extracting archive
|
|
12
|
+
- `classic-digest.html` — hand-written classic (uncompressed) saved page with
|
|
13
|
+
embedded filename template data and a `{digest-sha-256}` filename template,
|
|
14
|
+
used to verify the editor recomputes the filename digest when saving
|
|
12
15
|
|
|
13
16
|
The fixtures are intentionally frozen. When the archive format evolves, add
|
|
14
17
|
new fixtures (see `generate-fixtures.sh`) instead of regenerating these ones,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!DOCTYPE html><html><!--
|
|
2
|
+
Page saved with SingleFile
|
|
3
|
+
url: https://example.com/digest
|
|
4
|
+
saved date: Thu Aug 27 2026 00:00:00 GMT+0000
|
|
5
|
+
--><head><meta charset="utf-8"><title>Digest fixture</title></head><body><script type="application/json" data-single-file-options>{"saveUrl": "https://example.com/digest", "saveDate": 1787000000000, "visitDate": 1787000000000, "filenameTemplate": "{page-title}_{digest-sha-256}.html", "filenameReplacedCharacters": ["~", "+", "?", "%", "*", ":", "|", "\"", "<", ">", "\\\\", "\u0000-\u001f", "\u007f"], "filenameReplacementCharacter": "_", "filenameReplacementCharacters": ["\uff5e", "\uff0b", "\uff1f", "\uff05", "\uff0a", "\uff1a", "\uff5c", "\uff02", "\uff1c", "\uff1e", "\uff3c"], "filenameMaxLengthUnit": "bytes", "filenameMaxLength": 192, "replaceEmojisInFilename": false, "compressContent": false, "referrer": "", "title": "Digest fixture", "info": {}}</script><h1>Delta</h1></body></html>
|