single-file-core 1.5.41 → 1.5.43

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.
@@ -16877,10 +16877,10 @@ async function formatFilename(content, doc, options) {
16877
16877
  if (options.replaceEmojisInFilename) {
16878
16878
  EMOJIS.forEach(emoji => (filename = replaceAll(filename, emoji, " _" + EMOJI_NAMES[emoji] + "_ ")));
16879
16879
  }
16880
- const { replacementCharacter, filenameReplacedCharacters, replacementCharacters } = options.filenameReplacementCharacter;
16881
- filename = getValidFilename(filename, filenameReplacedCharacters, replacementCharacter, replacementCharacters);
16880
+ const { filenameReplacementCharacter, filenameReplacedCharacters, filenameReplacementCharacters } = options;
16881
+ filename = getValidFilename(filename, filenameReplacedCharacters, filenameReplacementCharacter, filenameReplacementCharacters);
16882
16882
  if (!options.backgroundSave) {
16883
- filename = filename.replace(/\//g, replacementCharacter);
16883
+ filename = filename.replace(/\//g, filenameReplacementCharacter);
16884
16884
  }
16885
16885
  if (!options.keepFilename && ((options.filenameMaxLengthUnit == "bytes" && getContentSize(filename) > options.filenameMaxLength) || filename.length > options.filenameMaxLength)) {
16886
16886
  const extensionMatch = filename.match(/(\.[^.]{3,4})$/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.41",
3
+ "version": "1.5.43",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -62,7 +62,7 @@
62
62
  featureSettings: "font-feature-settings"
63
63
  };
64
64
 
65
- const fetch = (url, options) => globalThis.fetch(url, options);
65
+ const fetch = globalThis.fetch.bind(globalThis);
66
66
  const CustomEvent = globalThis.CustomEvent;
67
67
  const document = globalThis.document;
68
68
  const screen = globalThis.screen;
@@ -145,7 +145,7 @@
145
145
  const response = await fetch(url, options);
146
146
  detail = { url, response: await response.arrayBuffer(), headers: [...response.headers], status: response.status };
147
147
  } catch (error) {
148
- detail = { url, error: error && error.toString() };
148
+ detail = { url, error: error && (error.message || error.toString()) };
149
149
  }
150
150
  document.dispatchEvent(new CustomEvent(FETCH_RESPONSE_EVENT, { detail }));
151
151
  });
@@ -272,8 +272,10 @@
272
272
  const rootBounds = getBoundingClientRectDefined ? rootBoundingRect : docBoundingRect;
273
273
  const time = 0;
274
274
  return { target, intersectionRatio, boundingClientRect, intersectionRect: boundingClientRect, isIntersecting, rootBounds, time };
275
- });
276
- observer.callback.call(intersectionObserver, params, intersectionObserver);
275
+ }).filter(params => params.boundingClientRect.width && params.boundingClientRect.height);
276
+ if (params.length) {
277
+ observer.callback.call(intersectionObserver, params, intersectionObserver);
278
+ }
277
279
  }
278
280
  });
279
281
  }