@vercel/routing-utils 5.0.2 → 5.0.3
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/superstatic.js +5 -36
- package/package.json +3 -5
package/dist/superstatic.js
CHANGED
|
@@ -29,38 +29,7 @@ __export(superstatic_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(superstatic_exports);
|
|
31
31
|
var import_url = require("url");
|
|
32
|
-
var import_path_to_regexp = require("path-to-regexp");
|
|
33
|
-
var import_path_to_regexp_updated = require("path-to-regexp-updated");
|
|
34
|
-
function pathToRegexp(callerId, path, keys, options) {
|
|
35
|
-
const currentRegExp = (0, import_path_to_regexp.pathToRegexp)(path, keys, options);
|
|
36
|
-
try {
|
|
37
|
-
const currentKeys = keys;
|
|
38
|
-
const newKeys = [];
|
|
39
|
-
const newRegExp = (0, import_path_to_regexp_updated.pathToRegexp)(path, newKeys, options);
|
|
40
|
-
const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
|
|
41
|
-
if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
|
|
42
|
-
const message = JSON.stringify({
|
|
43
|
-
path,
|
|
44
|
-
currentRegExp: currentRegExp.toString(),
|
|
45
|
-
newRegExp: newRegExp.toString()
|
|
46
|
-
});
|
|
47
|
-
console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
|
|
48
|
-
}
|
|
49
|
-
const isDiffKeys = keys?.toString() !== newKeys?.toString();
|
|
50
|
-
if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
|
|
51
|
-
const message = JSON.stringify({
|
|
52
|
-
isDiffKeys,
|
|
53
|
-
currentKeys,
|
|
54
|
-
newKeys
|
|
55
|
-
});
|
|
56
|
-
console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
|
|
57
|
-
}
|
|
58
|
-
} catch (err) {
|
|
59
|
-
const error = err;
|
|
60
|
-
console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${error.message}`);
|
|
61
|
-
}
|
|
62
|
-
return currentRegExp;
|
|
63
|
-
}
|
|
32
|
+
var import_path_to_regexp = require("@vercel-internals/path-to-regexp");
|
|
64
33
|
const UN_NAMED_SEGMENT = "__UN_NAMED_SEGMENT__";
|
|
65
34
|
function getCleanUrls(filePaths) {
|
|
66
35
|
const htmlFiles = filePaths.map(toRoute).filter((f) => f.endsWith(".html")).map((f) => ({
|
|
@@ -216,7 +185,7 @@ function convertTrailingSlash(enable, status = 308) {
|
|
|
216
185
|
}
|
|
217
186
|
function sourceToRegex(source) {
|
|
218
187
|
const keys = [];
|
|
219
|
-
const r = pathToRegexp("632", source, keys, {
|
|
188
|
+
const r = (0, import_path_to_regexp.pathToRegexp)("632", source, keys, {
|
|
220
189
|
strict: true,
|
|
221
190
|
sensitive: true,
|
|
222
191
|
delimiter: "/"
|
|
@@ -289,9 +258,9 @@ function replaceSegments(segments, hasItemSegments, destination, isRedirect, int
|
|
|
289
258
|
const hashKeys = [];
|
|
290
259
|
const hostnameKeys = [];
|
|
291
260
|
try {
|
|
292
|
-
pathToRegexp("528", pathname, pathnameKeys);
|
|
293
|
-
pathToRegexp("834", hash || "", hashKeys);
|
|
294
|
-
pathToRegexp("712", hostname || "", hostnameKeys);
|
|
261
|
+
(0, import_path_to_regexp.pathToRegexp)("528", pathname, pathnameKeys);
|
|
262
|
+
(0, import_path_to_regexp.pathToRegexp)("834", hash || "", hashKeys);
|
|
263
|
+
(0, import_path_to_regexp.pathToRegexp)("712", hostname || "", hostnameKeys);
|
|
295
264
|
} catch (_) {
|
|
296
265
|
}
|
|
297
266
|
destParams = new Set(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/routing-utils",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Vercel routing utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
"directory": "packages/routing-utils"
|
|
14
14
|
},
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"path-to-regexp-updated": "npm:path-to-regexp@6.3.0",
|
|
18
|
-
"path-to-regexp": "6.1.0"
|
|
19
|
-
},
|
|
16
|
+
"dependencies": {},
|
|
20
17
|
"devDependencies": {
|
|
21
18
|
"@types/jest": "27.4.1",
|
|
22
19
|
"@types/node": "14.18.33",
|
|
20
|
+
"@vercel-internals/path-to-regexp": "1.0.0",
|
|
23
21
|
"ajv": "^6.12.3",
|
|
24
22
|
"jest-junit": "16.0.0",
|
|
25
23
|
"typescript": "4.9.5"
|