tldts-experimental 7.5.0 → 7.5.1
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/dist/cjs/index.js +15 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/packed-hashes.js +6 -0
- package/dist/cjs/src/packed-hashes.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/es6/src/packed-hashes.js +6 -0
- package/dist/es6/src/packed-hashes.js.map +1 -1
- package/dist/es6/tsconfig.bundle.tsbuildinfo +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +4 -4
- package/src/packed-hashes.ts +8 -0
package/dist/cjs/index.js
CHANGED
|
@@ -823,9 +823,9 @@ function extraSuffixLookup(hostname, options, isException, out) {
|
|
|
823
823
|
}
|
|
824
824
|
continue;
|
|
825
825
|
}
|
|
826
|
-
// `*.p` also matches `p`, else one more
|
|
827
|
-
if (wildcard && start !==
|
|
828
|
-
start =
|
|
826
|
+
// `*.p` also matches `p`, else one more non-empty label.
|
|
827
|
+
if (wildcard && start > 1 && hostname.charCodeAt(start - 2) !== 46) {
|
|
828
|
+
start = hostname.lastIndexOf('.', start - 2) + 1;
|
|
829
829
|
}
|
|
830
830
|
if (start < rule) {
|
|
831
831
|
rule = start;
|
|
@@ -939,7 +939,12 @@ function parseImpl(url, step, suffixLookup, partialOptions, result) {
|
|
|
939
939
|
// extractHostname returned `url` unchanged (same reference).
|
|
940
940
|
let urlIsValid = false;
|
|
941
941
|
if (!options.extractHostname) {
|
|
942
|
-
|
|
942
|
+
// Trim trailing dots as extractHostname does (`new URL()` keeps them).
|
|
943
|
+
let end = url.length;
|
|
944
|
+
while (end > 1 && url.charCodeAt(end - 1) === 46 /* '.' */) {
|
|
945
|
+
end -= 1;
|
|
946
|
+
}
|
|
947
|
+
result.hostname = end === url.length ? url : url.slice(0, end);
|
|
943
948
|
}
|
|
944
949
|
else if (options.mixedInputs) {
|
|
945
950
|
urlIsValid = isValidHostname(url);
|
|
@@ -1248,6 +1253,12 @@ function suffixLookup(hostname, options, out) {
|
|
|
1248
1253
|
// important to make sure that we always keep the longest match if there
|
|
1249
1254
|
// are both a wildcard and a normal rule matching).
|
|
1250
1255
|
if (match !== 0 /* Result.NO_MATCH */) {
|
|
1256
|
+
// '*' never matches an empty label ('.S', '..S'): `*.S` then only
|
|
1257
|
+
// implies `S`.
|
|
1258
|
+
if ((match & 16 /* Result.WILDCARD_MATCH */) !== 0 &&
|
|
1259
|
+
(labelStart === 1 || hostname.charCodeAt(labelStart - 2) === 46)) {
|
|
1260
|
+
match = (match & -17 /* Result.WILDCARD_MATCH */) | 8 /* Result.NORMAL_MATCH */;
|
|
1261
|
+
}
|
|
1251
1262
|
matchKind = match;
|
|
1252
1263
|
matchLabels = label + ((match & 16 /* Result.WILDCARD_MATCH */) !== 0 ? 2 : 1);
|
|
1253
1264
|
matchIndex = labelStart;
|