single-file-core 1.2.24 → 1.2.25

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 globalThis, FileReader, TextDecoder, Node */
24
+ /* global globalThis, FileReader, Node */
25
25
 
26
26
  import {
27
27
  configure,
@@ -85,10 +85,11 @@ async function process(pageData, options, lastModDate = new Date()) {
85
85
  const substitutionsLF = [];
86
86
  if (options.extractDataFromPage) {
87
87
  if (!options.extractDataFromPageTags) {
88
- const textContent = new TextDecoder().decode(data);
88
+ let textContent = "";
89
+ data.slice(startOffset).forEach(charCode => textContent += String.fromCharCode(charCode));
89
90
  const matchEndTagComment = textContent.match(/-->/i);
90
91
  if (matchEndTagComment) {
91
- return findExtraDataTags(data, pageData, options, lastModDate);
92
+ return findExtraDataTags(textContent, pageData, options, lastModDate);
92
93
  }
93
94
  }
94
95
  for (let index = 0; index < data.length; index++) {
@@ -218,12 +219,11 @@ async function prependHTMLData(pageData, zipDataWriter, script, options) {
218
219
  return extraDataOffset;
219
220
  }
220
221
 
221
- function findExtraDataTags(data, pageData, options, lastModDate, indexExtractDataFromPageTags = 0) {
222
- const textContent = new TextDecoder().decode(data);
222
+ function findExtraDataTags(textContent, pageData, options, lastModDate, indexExtractDataFromPageTags = 0) {
223
223
  const matchEndTag = textContent.match(EXTRA_DATA_REGEXPS[indexExtractDataFromPageTags]);
224
224
  if (matchEndTag) {
225
225
  if (indexExtractDataFromPageTags < EXTRA_DATA_TAGS.length - 1) {
226
- return findExtraDataTags(data, pageData, options, lastModDate, indexExtractDataFromPageTags + 1);
226
+ return findExtraDataTags(textContent, pageData, options, lastModDate, indexExtractDataFromPageTags + 1);
227
227
  } else {
228
228
  options.extractDataFromPage = false;
229
229
  return process(pageData, options, lastModDate);
package/single-file.js CHANGED
@@ -111,6 +111,7 @@ async function getPageData(options = {}, initOptions, doc = globalThis.document,
111
111
  createRootDirectory: options.createRootDirectory,
112
112
  selfExtractingArchive: options.selfExtractingArchive,
113
113
  extractDataFromPage: options.extractDataFromPage,
114
+ preventAppendedData: options.preventAppendedData,
114
115
  insertCanonicalLink: options.insertCanonicalLink,
115
116
  insertMetaNoIndex: options.insertMetaNoIndex,
116
117
  password: options.password,