trousse 2.14.1 → 2.14.2

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.
Files changed (2) hide show
  1. package/dist/urls.js +9 -2
  2. package/package.json +1 -1
package/dist/urls.js CHANGED
@@ -382,13 +382,20 @@ const sameQuerySpellings = [
382
382
  ["@", "%40"]
383
383
  ];
384
384
  const percentEscapeRegex = /%[0-9a-f]{2}/gi;
385
+ const addLowercaseHexSpellings = (url, spellings) => {
386
+ if (url.search(percentEscapeRegex) === -1) return [...new Set(spellings)];
387
+ const lowercaseHexSpellings = spellings.map((spelling) => {
388
+ return spelling.replace(percentEscapeRegex, (hex) => hex.toLowerCase());
389
+ });
390
+ return [.../* @__PURE__ */ new Set([...spellings, ...lowercaseHexSpellings])];
391
+ };
385
392
  const createUrlSpellings = (url) => {
386
393
  const uppercaseHexUrl = url.replace(percentEscapeRegex, (hex) => hex.toUpperCase());
387
394
  let spellings = [.../* @__PURE__ */ new Set([url, uppercaseHexUrl])];
388
395
  const hashIndex = url.indexOf("#");
389
396
  const queryEnd = hashIndex === -1 ? url.length : hashIndex;
390
397
  const queryIndex = url.indexOf("?");
391
- if (queryIndex === -1 || queryIndex > queryEnd) return spellings;
398
+ if (queryIndex === -1 || queryIndex > queryEnd) return addLowercaseHexSpellings(url, spellings);
392
399
  for (const [written, encoded] of sameQuerySpellings) {
393
400
  const swapped = spellings.flatMap((spelling) => {
394
401
  const fragmentIndex = spelling.indexOf("#");
@@ -400,7 +407,7 @@ const createUrlSpellings = (url) => {
400
407
  });
401
408
  spellings = [...new Set(swapped)];
402
409
  }
403
- return [.../* @__PURE__ */ new Set([url, ...spellings])];
410
+ return addLowercaseHexSpellings(url, [url, ...spellings]);
404
411
  };
405
412
  const genericSecondLevels = [
406
413
  "ac",
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "dependencies": {
47
47
  "entities": "^8.1.0"
48
48
  },
49
- "version": "2.14.1"
49
+ "version": "2.14.2"
50
50
  }