@veryfront/ext-content-mdx 0.1.1190 → 0.1.1192
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/esm/deno.d.ts +6 -0
- package/esm/deno.js +13 -7
- package/esm/src/errors/error-registry/module.d.ts +4 -0
- package/esm/src/errors/error-registry/module.d.ts.map +1 -1
- package/esm/src/errors/error-registry/module.js +16 -0
- package/esm/src/errors/error-registry.d.ts +2 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/types.d.ts.map +1 -1
- package/esm/src/errors/types.js +5 -2
- package/esm/src/platform/compat/error-introspection.d.ts +12 -1
- package/esm/src/platform/compat/error-introspection.d.ts.map +1 -1
- package/esm/src/platform/compat/error-introspection.js +40 -5
- package/esm/src/platform/compat/path/basic-operations.d.ts.map +1 -1
- package/esm/src/platform/compat/path/basic-operations.js +6 -2
- package/esm/src/platform/compat/path/portable.d.ts.map +1 -1
- package/esm/src/platform/compat/path/portable.js +98 -54
- package/esm/src/platform/compat/path/resolution.d.ts.map +1 -1
- package/esm/src/platform/compat/path/resolution.js +14 -5
- package/esm/src/platform/compat/primordials/array.d.ts +8 -0
- package/esm/src/platform/compat/primordials/array.d.ts.map +1 -0
- package/esm/src/platform/compat/primordials/array.js +33 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +6 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/url-builder.js +96 -29
- package/esm/src/utils/base64url.d.ts.map +1 -1
- package/esm/src/utils/base64url.js +10 -4
- package/esm/src/utils/bundle-manifest.d.ts +19 -1
- package/esm/src/utils/bundle-manifest.d.ts.map +1 -1
- package/esm/src/utils/bundle-manifest.js +124 -27
- package/esm/src/utils/constants/limits.d.ts +1 -1
- package/esm/src/utils/constants/limits.d.ts.map +1 -1
- package/esm/src/utils/constants/limits.js +1 -1
- package/esm/src/utils/hash-utils.d.ts.map +1 -1
- package/esm/src/utils/hash-utils.js +32 -6
- package/esm/src/utils/id.d.ts +16 -0
- package/esm/src/utils/id.d.ts.map +1 -0
- package/esm/src/utils/id.js +69 -0
- package/esm/src/utils/import-lockfile.d.ts +52 -1
- package/esm/src/utils/import-lockfile.d.ts.map +1 -1
- package/esm/src/utils/import-lockfile.js +1042 -58
- package/esm/src/utils/index.d.ts +1 -1
- package/esm/src/utils/index.d.ts.map +1 -1
- package/esm/src/utils/index.js +1 -1
- package/esm/src/utils/logger/logger.d.ts +1 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +359 -78
- package/esm/src/utils/logger/redact.d.ts +4 -2
- package/esm/src/utils/logger/redact.d.ts.map +1 -1
- package/esm/src/utils/logger/redact.js +300 -112
- package/esm/src/utils/logger/serialization.d.ts +3 -0
- package/esm/src/utils/logger/serialization.d.ts.map +1 -0
- package/esm/src/utils/logger/serialization.js +81 -0
- package/esm/src/utils/memoize.d.ts +1 -1
- package/esm/src/utils/memoize.d.ts.map +1 -1
- package/esm/src/utils/memoize.js +16 -5
- package/esm/src/utils/path-utils.d.ts.map +1 -1
- package/esm/src/utils/path-utils.js +4 -2
- package/esm/src/utils/sleep.d.ts +8 -0
- package/esm/src/utils/sleep.d.ts.map +1 -1
- package/esm/src/utils/sleep.js +11 -2
- package/esm/src/utils/timer.d.ts +10 -0
- package/esm/src/utils/timer.d.ts.map +1 -0
- package/esm/src/utils/timer.js +19 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +2 -2
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { primordialArrayAt as arrayAt, primordialArrayFilter as arrayFilter, primordialArrayJoin as arrayJoin, primordialArrayPop as arrayPop, primordialArrayPush as arrayPush, } from "../primordials/array.js";
|
|
3
|
+
const apply = Reflect.apply;
|
|
4
|
+
const arraySlice = Array.prototype.slice;
|
|
5
|
+
const regExpExec = RegExp.prototype.exec;
|
|
6
|
+
const stringEndsWith = String.prototype.endsWith;
|
|
7
|
+
const stringIncludes = String.prototype.includes;
|
|
8
|
+
const stringLastIndexOf = String.prototype.lastIndexOf;
|
|
9
|
+
const stringReplaceAll = String.prototype.replaceAll;
|
|
10
|
+
const stringSlice = String.prototype.slice;
|
|
11
|
+
const stringSplit = String.prototype.split;
|
|
12
|
+
const stringStartsWith = String.prototype.startsWith;
|
|
13
|
+
const stringToLowerCase = String.prototype.toLowerCase;
|
|
14
|
+
function includes(value, search) {
|
|
15
|
+
return apply(stringIncludes, value, [search]);
|
|
16
|
+
}
|
|
17
|
+
function startsWith(value, search) {
|
|
18
|
+
return apply(stringStartsWith, value, [search]);
|
|
19
|
+
}
|
|
20
|
+
function endsWith(value, search) {
|
|
21
|
+
return apply(stringEndsWith, value, [search]);
|
|
22
|
+
}
|
|
23
|
+
function slice(value, start, end) {
|
|
24
|
+
return apply(stringSlice, value, end === undefined ? [start] : [start, end]);
|
|
25
|
+
}
|
|
26
|
+
function lastIndexOf(value, search) {
|
|
27
|
+
return apply(stringLastIndexOf, value, [search]);
|
|
28
|
+
}
|
|
29
|
+
function matches(pattern, value) {
|
|
30
|
+
return apply(regExpExec, pattern, [value]);
|
|
31
|
+
}
|
|
2
32
|
export function hasWindowsLikePath(path) {
|
|
3
|
-
return
|
|
4
|
-
/^[A-Za-z]:/.test(path);
|
|
33
|
+
return includes(path, "\\") || matches(/^[A-Za-z]:/, path) !== null;
|
|
5
34
|
}
|
|
6
35
|
export function toPortableSeparators(path) {
|
|
7
|
-
return path
|
|
36
|
+
return apply(stringReplaceAll, path, ["\\", "/"]);
|
|
8
37
|
}
|
|
9
38
|
function analyzeRoot(path, windows) {
|
|
10
39
|
const portable = toPortableSeparators(path);
|
|
11
40
|
if (windows) {
|
|
12
|
-
const unc =
|
|
41
|
+
const unc = matches(/^\/\/([^/]+)\/+([^/]+)(\/+(.*))?$/, portable);
|
|
13
42
|
if (unc?.[1] && unc[2]) {
|
|
14
43
|
const device = `//${unc[1]}/${unc[2]}`;
|
|
15
44
|
return {
|
|
@@ -19,7 +48,7 @@ function analyzeRoot(path, windows) {
|
|
|
19
48
|
root: unc[3] === undefined ? device : `${device}/`,
|
|
20
49
|
};
|
|
21
50
|
}
|
|
22
|
-
const drive =
|
|
51
|
+
const drive = matches(/^([A-Za-z]:)(\/+)?(.*)$/, portable);
|
|
23
52
|
if (drive?.[1] !== undefined) {
|
|
24
53
|
const absolute = drive[2] !== undefined;
|
|
25
54
|
return {
|
|
@@ -30,11 +59,14 @@ function analyzeRoot(path, windows) {
|
|
|
30
59
|
};
|
|
31
60
|
}
|
|
32
61
|
}
|
|
33
|
-
if (
|
|
62
|
+
if (startsWith(portable, "/")) {
|
|
63
|
+
let restStart = 0;
|
|
64
|
+
while (portable[restStart] === "/")
|
|
65
|
+
restStart++;
|
|
34
66
|
return {
|
|
35
67
|
absolute: true,
|
|
36
68
|
device: "",
|
|
37
|
-
rest: portable
|
|
69
|
+
rest: slice(portable, restStart),
|
|
38
70
|
root: "/",
|
|
39
71
|
};
|
|
40
72
|
}
|
|
@@ -51,25 +83,30 @@ function appendRoot(root, tail) {
|
|
|
51
83
|
if (!root.absolute)
|
|
52
84
|
return `${root.root}${tail || "."}`;
|
|
53
85
|
if (!tail) {
|
|
54
|
-
return root.device
|
|
86
|
+
return startsWith(root.device, "//") ? `${root.device}/` : root.root;
|
|
55
87
|
}
|
|
56
|
-
return root.root
|
|
88
|
+
return endsWith(root.root, "/") ? `${root.root}${tail}` : `${root.root}/${tail}`;
|
|
57
89
|
}
|
|
58
90
|
function normalizeTail(rest, absolute) {
|
|
59
91
|
const normalized = [];
|
|
60
|
-
|
|
92
|
+
const segments = apply(stringSplit, rest, ["/"]);
|
|
93
|
+
// Path normalization is reached by shared-runtime coordination after tenant
|
|
94
|
+
// code has loaded. Avoid the live Array iterator so post-import prototype
|
|
95
|
+
// mutation cannot turn canonical lockfile lookup into a process-wide outage.
|
|
96
|
+
for (let index = 0; index < segments.length; index++) {
|
|
97
|
+
const segment = segments[index];
|
|
61
98
|
if (segment === "" || segment === ".")
|
|
62
99
|
continue;
|
|
63
100
|
if (segment !== "..") {
|
|
64
|
-
normalized
|
|
101
|
+
arrayPush(normalized, segment);
|
|
65
102
|
continue;
|
|
66
103
|
}
|
|
67
|
-
const previous = normalized
|
|
104
|
+
const previous = arrayAt(normalized, -1);
|
|
68
105
|
if (previous !== undefined && previous !== "..") {
|
|
69
|
-
normalized
|
|
106
|
+
arrayPop(normalized);
|
|
70
107
|
}
|
|
71
108
|
else if (!absolute) {
|
|
72
|
-
normalized
|
|
109
|
+
arrayPush(normalized, "..");
|
|
73
110
|
}
|
|
74
111
|
}
|
|
75
112
|
return normalized;
|
|
@@ -80,15 +117,15 @@ function canonicalPath(path, windows) {
|
|
|
80
117
|
export function removeTrailingSeparatorsExceptRoot(path, windows) {
|
|
81
118
|
const root = analyzeRoot(path, windows);
|
|
82
119
|
let canonical = canonicalPath(path, windows);
|
|
83
|
-
while (
|
|
120
|
+
while (endsWith(canonical, "/") &&
|
|
84
121
|
canonical.length > root.root.length) {
|
|
85
|
-
canonical =
|
|
122
|
+
canonical = slice(canonical, 0, -1);
|
|
86
123
|
}
|
|
87
124
|
return canonical;
|
|
88
125
|
}
|
|
89
126
|
function rootKey(root, windows) {
|
|
90
127
|
const value = root.device || root.root;
|
|
91
|
-
return windows ? value
|
|
128
|
+
return windows ? apply(stringToLowerCase, value, []) : value;
|
|
92
129
|
}
|
|
93
130
|
export function runtimeUsesWindowsPaths() {
|
|
94
131
|
const runtime = dntShim.dntGlobalThis;
|
|
@@ -121,44 +158,44 @@ export function portableNormalize(path, windows) {
|
|
|
121
158
|
if (path === "")
|
|
122
159
|
return ".";
|
|
123
160
|
const root = analyzeRoot(path, windows);
|
|
124
|
-
const tail = normalizeTail(root.rest, root.absolute)
|
|
161
|
+
const tail = arrayJoin(normalizeTail(root.rest, root.absolute), "/");
|
|
125
162
|
let result = appendRoot(root, tail);
|
|
126
|
-
const hadTrailingSeparator = /[\\/]
|
|
163
|
+
const hadTrailingSeparator = matches(/[\\/]$/, path) !== null;
|
|
127
164
|
if (hadTrailingSeparator && result === ".")
|
|
128
165
|
return "./";
|
|
129
166
|
if (hadTrailingSeparator &&
|
|
130
167
|
result !== root.root &&
|
|
131
|
-
!
|
|
168
|
+
!endsWith(result, "/")) {
|
|
132
169
|
result += "/";
|
|
133
170
|
}
|
|
134
171
|
return result;
|
|
135
172
|
}
|
|
136
173
|
export function portableJoin(paths, windows) {
|
|
137
|
-
const nonempty = paths
|
|
174
|
+
const nonempty = arrayFilter(paths, (path) => path.length > 0);
|
|
138
175
|
if (nonempty.length === 0)
|
|
139
176
|
return "/";
|
|
140
|
-
return portableNormalize(nonempty
|
|
177
|
+
return portableNormalize(arrayJoin(nonempty, "/"), windows);
|
|
141
178
|
}
|
|
142
179
|
export function portableDirname(path, windows) {
|
|
143
180
|
if (path.length === 0)
|
|
144
181
|
return ".";
|
|
145
182
|
const root = analyzeRoot(path, windows);
|
|
146
183
|
let canonical = canonicalPath(path, windows);
|
|
147
|
-
while (
|
|
184
|
+
while (endsWith(canonical, "/") &&
|
|
148
185
|
canonical.length > root.root.length) {
|
|
149
|
-
canonical =
|
|
186
|
+
canonical = slice(canonical, 0, -1);
|
|
150
187
|
}
|
|
151
188
|
if (canonical === root.root || canonical === root.device) {
|
|
152
189
|
return root.root || root.device || ".";
|
|
153
190
|
}
|
|
154
|
-
const lastSeparator =
|
|
191
|
+
const lastSeparator = lastIndexOf(canonical, "/");
|
|
155
192
|
if (lastSeparator === -1)
|
|
156
193
|
return root.device || ".";
|
|
157
194
|
if (lastSeparator < root.root.length)
|
|
158
195
|
return root.root || "/";
|
|
159
196
|
if (lastSeparator === 0)
|
|
160
197
|
return "/";
|
|
161
|
-
return
|
|
198
|
+
return slice(canonical, 0, lastSeparator);
|
|
162
199
|
}
|
|
163
200
|
export function portableBasename(path, ext, windows) {
|
|
164
201
|
if (path.length === 0)
|
|
@@ -168,44 +205,45 @@ export function portableBasename(path, ext, windows) {
|
|
|
168
205
|
const originalPath = canonical;
|
|
169
206
|
if (ext !== undefined && ext !== "" && ext === originalPath)
|
|
170
207
|
return "";
|
|
171
|
-
while (
|
|
208
|
+
while (endsWith(canonical, "/") &&
|
|
172
209
|
canonical.length > root.root.length) {
|
|
173
|
-
canonical =
|
|
210
|
+
canonical = slice(canonical, 0, -1);
|
|
174
211
|
}
|
|
175
212
|
if (windows &&
|
|
176
|
-
root.device
|
|
213
|
+
startsWith(root.device, "//") &&
|
|
177
214
|
root.rest === "") {
|
|
178
|
-
return root.device
|
|
215
|
+
return slice(root.device, lastIndexOf(root.device, "/") + 1);
|
|
179
216
|
}
|
|
180
217
|
if (canonical === root.root || canonical === root.device)
|
|
181
218
|
return "";
|
|
182
|
-
const lastSeparator =
|
|
183
|
-
let base =
|
|
219
|
+
const lastSeparator = lastIndexOf(canonical, "/");
|
|
220
|
+
let base = slice(canonical, lastSeparator + 1);
|
|
184
221
|
if (!root.absolute &&
|
|
185
222
|
root.device &&
|
|
186
223
|
lastSeparator === -1 &&
|
|
187
|
-
|
|
188
|
-
base =
|
|
224
|
+
startsWith(base, root.device)) {
|
|
225
|
+
base = slice(base, root.device.length);
|
|
189
226
|
}
|
|
190
|
-
if (ext !== undefined && ext !== "" &&
|
|
227
|
+
if (ext !== undefined && ext !== "" && endsWith(base, ext)) {
|
|
191
228
|
if (ext.length < base.length)
|
|
192
|
-
return
|
|
229
|
+
return slice(base, 0, -ext.length);
|
|
193
230
|
}
|
|
194
231
|
return base;
|
|
195
232
|
}
|
|
196
233
|
export function portableExtname(path, windows) {
|
|
197
234
|
const base = portableBasename(path, undefined, windows);
|
|
198
|
-
const lastDot =
|
|
235
|
+
const lastDot = lastIndexOf(base, ".");
|
|
199
236
|
if (lastDot <= 0 || base === "." || base === "..")
|
|
200
237
|
return "";
|
|
201
|
-
return
|
|
238
|
+
return slice(base, lastDot);
|
|
202
239
|
}
|
|
203
240
|
export function portableIsAbsolute(path, windows) {
|
|
204
241
|
return analyzeRoot(path, windows).absolute;
|
|
205
242
|
}
|
|
206
243
|
export function portableResolve(paths, windows) {
|
|
207
244
|
let resolved = runtimeCwd();
|
|
208
|
-
for (
|
|
245
|
+
for (let index = 0; index < paths.length; index++) {
|
|
246
|
+
const rawPath = paths[index];
|
|
209
247
|
if (rawPath.length === 0)
|
|
210
248
|
continue;
|
|
211
249
|
const path = toPortableSeparators(rawPath);
|
|
@@ -228,10 +266,10 @@ export function portableResolve(paths, windows) {
|
|
|
228
266
|
}
|
|
229
267
|
const normalized = portableNormalize(resolved, windows);
|
|
230
268
|
const root = analyzeRoot(normalized, windows);
|
|
231
|
-
if (
|
|
269
|
+
if (endsWith(normalized, "/") &&
|
|
232
270
|
normalized !== root.root &&
|
|
233
271
|
normalized !== `${root.device}/`) {
|
|
234
|
-
return
|
|
272
|
+
return slice(normalized, 0, -1);
|
|
235
273
|
}
|
|
236
274
|
return normalized;
|
|
237
275
|
}
|
|
@@ -249,34 +287,40 @@ export function portableRelative(from, to, windows) {
|
|
|
249
287
|
while (common < fromParts.length && common < toParts.length) {
|
|
250
288
|
const fromPart = fromParts[common];
|
|
251
289
|
const toPart = toParts[common];
|
|
252
|
-
const equal = windows
|
|
290
|
+
const equal = windows
|
|
291
|
+
? apply(stringToLowerCase, fromPart, []) === apply(stringToLowerCase, toPart, [])
|
|
292
|
+
: fromPart === toPart;
|
|
253
293
|
if (!equal)
|
|
254
294
|
break;
|
|
255
295
|
common++;
|
|
256
296
|
}
|
|
257
|
-
const result = [
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
297
|
+
const result = [];
|
|
298
|
+
for (let index = common; index < fromParts.length; index++) {
|
|
299
|
+
arrayPush(result, "..");
|
|
300
|
+
}
|
|
301
|
+
const remainingToParts = apply(arraySlice, toParts, [common]);
|
|
302
|
+
for (let index = 0; index < remainingToParts.length; index++) {
|
|
303
|
+
arrayPush(result, remainingToParts[index]);
|
|
304
|
+
}
|
|
305
|
+
return arrayJoin(result, "/") || ".";
|
|
262
306
|
}
|
|
263
307
|
export function portableParse(path, windows) {
|
|
264
308
|
const root = analyzeRoot(path, windows);
|
|
265
309
|
let canonical = canonicalPath(path, windows);
|
|
266
|
-
while (
|
|
310
|
+
while (endsWith(canonical, "/") &&
|
|
267
311
|
canonical.length > root.root.length) {
|
|
268
|
-
canonical =
|
|
312
|
+
canonical = slice(canonical, 0, -1);
|
|
269
313
|
}
|
|
270
|
-
const base = windows && root.device
|
|
314
|
+
const base = windows && startsWith(root.device, "//") && root.rest === ""
|
|
271
315
|
? ""
|
|
272
316
|
: portableBasename(canonical, undefined, windows);
|
|
273
317
|
const ext = portableExtname(base, windows);
|
|
274
|
-
const name =
|
|
318
|
+
const name = slice(base, 0, base.length - ext.length);
|
|
275
319
|
let dir = "";
|
|
276
320
|
if (base === "") {
|
|
277
321
|
dir = root.root;
|
|
278
322
|
}
|
|
279
|
-
else if (
|
|
323
|
+
else if (includes(canonical, "/") ||
|
|
280
324
|
(windows && root.device !== "")) {
|
|
281
325
|
dir = portableDirname(canonical, windows);
|
|
282
326
|
}
|
|
@@ -292,7 +336,7 @@ export function portableFormat(pathObject, windows) {
|
|
|
292
336
|
const root = toPortableSeparators(pathObject.root ?? "");
|
|
293
337
|
const dir = toPortableSeparators(pathObject.dir ?? "");
|
|
294
338
|
const rawExt = pathObject.ext ?? "";
|
|
295
|
-
const ext = rawExt && !
|
|
339
|
+
const ext = rawExt && !startsWith(rawExt, ".") ? `.${rawExt}` : rawExt;
|
|
296
340
|
const base = pathObject.base ||
|
|
297
341
|
`${pathObject.name ?? ""}${ext}`;
|
|
298
342
|
const directory = dir || root;
|
|
@@ -300,7 +344,7 @@ export function portableFormat(pathObject, windows) {
|
|
|
300
344
|
return base;
|
|
301
345
|
if (!base)
|
|
302
346
|
return directory;
|
|
303
|
-
if (
|
|
347
|
+
if (endsWith(directory, "/") || (windows && matches(/^[A-Za-z]:$/, directory) !== null)) {
|
|
304
348
|
return `${directory}${base}`;
|
|
305
349
|
}
|
|
306
350
|
return `${directory}/${base}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/resolution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/resolution.ts"],"names":[],"mappings":"AAsBA,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAMlD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMhD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAOzD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW9C"}
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
import { hasWindowsLikePath, portableIsAbsolute, portableNormalize, portableRelative, portableResolve, removeTrailingSeparatorsExceptRoot, runtimeUsesWindowsPaths, toPortableSeparators, } from "./portable.js";
|
|
2
2
|
import { getNativePathImplementation } from "./runtime.js";
|
|
3
|
+
const apply = Reflect.apply;
|
|
3
4
|
function usesWindowsFlavor(paths) {
|
|
4
|
-
|
|
5
|
+
if (runtimeUsesWindowsPaths())
|
|
6
|
+
return true;
|
|
7
|
+
for (let index = 0; index < paths.length; index++) {
|
|
8
|
+
if (hasWindowsLikePath(paths[index]))
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
5
12
|
}
|
|
6
13
|
/** Resolve path segments to an absolute, normalized path. */
|
|
7
14
|
export function resolve(...paths) {
|
|
8
15
|
const windows = usesWindowsFlavor(paths);
|
|
9
16
|
const pathApi = getNativePathImplementation(windows);
|
|
10
17
|
return pathApi
|
|
11
|
-
? toPortableSeparators(pathApi.resolve
|
|
18
|
+
? toPortableSeparators(apply(pathApi.resolve, pathApi, paths))
|
|
12
19
|
: portableResolve(paths, windows);
|
|
13
20
|
}
|
|
14
21
|
export function isAbsolute(path) {
|
|
15
22
|
const windows = usesWindowsFlavor([path]);
|
|
16
23
|
const pathApi = getNativePathImplementation(windows);
|
|
17
|
-
return pathApi
|
|
24
|
+
return pathApi
|
|
25
|
+
? apply(pathApi.isAbsolute, pathApi, [path])
|
|
26
|
+
: portableIsAbsolute(path, windows);
|
|
18
27
|
}
|
|
19
28
|
export function relative(from, to) {
|
|
20
29
|
const windows = usesWindowsFlavor([from, to]);
|
|
21
30
|
const pathApi = getNativePathImplementation(windows);
|
|
22
31
|
const result = pathApi
|
|
23
|
-
? toPortableSeparators(pathApi.relative
|
|
32
|
+
? toPortableSeparators(apply(pathApi.relative, pathApi, [from, to]))
|
|
24
33
|
: portableRelative(from, to, windows);
|
|
25
34
|
return result || ".";
|
|
26
35
|
}
|
|
@@ -28,7 +37,7 @@ export function normalize(path) {
|
|
|
28
37
|
const windows = usesWindowsFlavor([path]);
|
|
29
38
|
const pathApi = getNativePathImplementation(windows);
|
|
30
39
|
const normalized = pathApi
|
|
31
|
-
? toPortableSeparators(pathApi.normalize
|
|
40
|
+
? toPortableSeparators(apply(pathApi.normalize, pathApi, [path]))
|
|
32
41
|
: portableNormalize(path, windows);
|
|
33
42
|
// The established Veryfront facade contract returns canonical paths without
|
|
34
43
|
// a trailing separator, except for filesystem roots. Enforce that
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function primordialArrayAt<T>(values: readonly T[], index: number): T | undefined;
|
|
2
|
+
export declare function primordialArrayFilter<T>(values: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => unknown): T[];
|
|
3
|
+
export declare function primordialArrayJoin(values: readonly unknown[], separator: string): string;
|
|
4
|
+
export declare function primordialArrayMap<T, U>(values: readonly T[], callback: (value: T, index: number, array: readonly T[]) => U): U[];
|
|
5
|
+
export declare function primordialArrayPop<T>(values: T[]): T | undefined;
|
|
6
|
+
export declare function primordialArrayPush<T>(values: T[], value: T): void;
|
|
7
|
+
export declare function primordialArraySort<T>(values: T[], compare: (left: T, right: T) => number): T[];
|
|
8
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/primordials/array.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,SAAS,CAEf;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,GACnE,CAAC,EAAE,CAEL;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,OAAO,EAAE,EAC1B,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EACrC,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,GAC5D,CAAC,EAAE,CAEL;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAEhE;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAElE;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,GACrC,CAAC,EAAE,CAEL"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Capture shared array intrinsics once, before project code can replace mutable
|
|
2
|
+
// prototype methods in a long-lived runtime. Keep this module dependency-free so
|
|
3
|
+
// low-level compatibility code and higher framework layers can use the same
|
|
4
|
+
// trusted operations without introducing an import cycle.
|
|
5
|
+
const ArrayPrototypeAt = Array.prototype.at;
|
|
6
|
+
const ArrayPrototypeFilter = Array.prototype.filter;
|
|
7
|
+
const ArrayPrototypeJoin = Array.prototype.join;
|
|
8
|
+
const ArrayPrototypeMap = Array.prototype.map;
|
|
9
|
+
const ArrayPrototypePop = Array.prototype.pop;
|
|
10
|
+
const ArrayPrototypePush = Array.prototype.push;
|
|
11
|
+
const ArrayPrototypeSort = Array.prototype.sort;
|
|
12
|
+
const ReflectApply = Reflect.apply;
|
|
13
|
+
export function primordialArrayAt(values, index) {
|
|
14
|
+
return ReflectApply(ArrayPrototypeAt, values, [index]);
|
|
15
|
+
}
|
|
16
|
+
export function primordialArrayFilter(values, predicate) {
|
|
17
|
+
return ReflectApply(ArrayPrototypeFilter, values, [predicate]);
|
|
18
|
+
}
|
|
19
|
+
export function primordialArrayJoin(values, separator) {
|
|
20
|
+
return ReflectApply(ArrayPrototypeJoin, values, [separator]);
|
|
21
|
+
}
|
|
22
|
+
export function primordialArrayMap(values, callback) {
|
|
23
|
+
return ReflectApply(ArrayPrototypeMap, values, [callback]);
|
|
24
|
+
}
|
|
25
|
+
export function primordialArrayPop(values) {
|
|
26
|
+
return ReflectApply(ArrayPrototypePop, values, []);
|
|
27
|
+
}
|
|
28
|
+
export function primordialArrayPush(values, value) {
|
|
29
|
+
ReflectApply(ArrayPrototypePush, values, [value]);
|
|
30
|
+
}
|
|
31
|
+
export function primordialArraySort(values, compare) {
|
|
32
|
+
return ReflectApply(ArrayPrototypeSort, values, [compare]);
|
|
33
|
+
}
|
|
@@ -66,6 +66,12 @@ export declare function appendSameOriginDependencyPinningPathKey(url: string, de
|
|
|
66
66
|
* Foreign origins and flag-off requests are preserved byte-for-byte.
|
|
67
67
|
*/
|
|
68
68
|
export declare function appendSameOriginSSRDependencyPinningKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Bind a same-origin absolute module URL to an SSR dependency snapshot using
|
|
71
|
+
* the module-server path transport. Use this only when the consumer resolves
|
|
72
|
+
* `/_vf_modules/` paths through the module server instead of generic fetch.
|
|
73
|
+
*/
|
|
74
|
+
export declare function appendSameOriginSSRDependencyPinningPathKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string;
|
|
69
75
|
export interface ExtractedDependencyPinningPath {
|
|
70
76
|
pathname: string;
|
|
71
77
|
cacheKey?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AA0BF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,MAAM,CAQR;AAgBD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,GAAG,WAAW,EAC1B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,UAAQ,GACf,MAAM,CAKR;AAYD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAazE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,yBAAyB,CAAC,EAAE,MAAM,GACjC,MAAM,CAcR;AA4CD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,yBAAyB,CAAC,EAAE,MAAM,GACjC,MAAM,CAqCR;AAED;;;GAGG;AACH,wBAAgB,wCAAwC,CACtD,GAAG,EAAE,MAAM,EACX,yBAAyB,CAAC,EAAE,MAAM,EAClC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,GAAG,EAAE,MAAM,EACX,yBAAyB,CAAC,EAAE,MAAM,EAClC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,CA0BR;AAED;;;;GAIG;AACH,wBAAgB,2CAA2C,CACzD,GAAG,EAAE,MAAM,EACX,yBAAyB,CAAC,EAAE,MAAM,EAClC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,CA8BR;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,MAAM,GACf,8BAA8B,CAmChC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE,MAAM,GACX,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAGhG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAgDtE"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Single source of truth for all URL generation.
|
|
5
5
|
* Ensures consistent URLs across SSR and browser for hydration parity.
|
|
6
6
|
*/
|
|
7
|
+
import { primordialArrayJoin as arrayJoin, primordialArrayPush as arrayPush, } from "../../platform/compat/primordials/array.js";
|
|
7
8
|
/**
|
|
8
9
|
* Default React version - used when not specified.
|
|
9
10
|
*
|
|
@@ -17,6 +18,24 @@ export const DEFAULT_REACT_VERSION = "19.2.4";
|
|
|
17
18
|
export const TAILWIND_VERSION = "4.1.8";
|
|
18
19
|
/** csstype version - must match deno.json for type consistency */
|
|
19
20
|
export const CSSTYPE_VERSION = "3.2.3";
|
|
21
|
+
const ObjectEntries = Object.entries;
|
|
22
|
+
function buildEsmShParams(options) {
|
|
23
|
+
const params = [];
|
|
24
|
+
if (options?.external?.length) {
|
|
25
|
+
arrayPush(params, `external=${arrayJoin(options.external, ",")}`);
|
|
26
|
+
}
|
|
27
|
+
arrayPush(params, `target=${options?.target ?? "es2022"}`);
|
|
28
|
+
if (options?.deps) {
|
|
29
|
+
const deps = [];
|
|
30
|
+
const entries = ObjectEntries(options.deps);
|
|
31
|
+
for (let index = 0; index < entries.length; index++) {
|
|
32
|
+
const [key, value] = entries[index];
|
|
33
|
+
arrayPush(deps, `${key}@${value}`);
|
|
34
|
+
}
|
|
35
|
+
arrayPush(params, `deps=${arrayJoin(deps, ",")}`);
|
|
36
|
+
}
|
|
37
|
+
return params;
|
|
38
|
+
}
|
|
20
39
|
/**
|
|
21
40
|
* Build esm.sh URL with proper configuration.
|
|
22
41
|
*
|
|
@@ -26,22 +45,21 @@ export const CSSTYPE_VERSION = "3.2.3";
|
|
|
26
45
|
* @param options - URL options
|
|
27
46
|
*/
|
|
28
47
|
export function buildEsmShUrl(pkg, version, subpath, options) {
|
|
29
|
-
const params =
|
|
30
|
-
if (options?.external?.length) {
|
|
31
|
-
params.push(`external=${options.external.join(",")}`);
|
|
32
|
-
}
|
|
33
|
-
params.push(`target=${options?.target ?? "es2022"}`);
|
|
34
|
-
if (options?.deps) {
|
|
35
|
-
const depsStr = Object.entries(options.deps)
|
|
36
|
-
.map(([k, v]) => `${k}@${v}`)
|
|
37
|
-
.join(",");
|
|
38
|
-
params.push(`deps=${depsStr}`);
|
|
39
|
-
}
|
|
48
|
+
const params = buildEsmShParams(options);
|
|
40
49
|
const versionStr = version ? `@${version}` : "";
|
|
41
50
|
const pathStr = subpath ?? "";
|
|
42
|
-
const queryStr = params.length ? `?${params
|
|
51
|
+
const queryStr = params.length ? `?${arrayJoin(params, "&")}` : "";
|
|
43
52
|
return `https://esm.sh/${pkg}${versionStr}${pathStr}${queryStr}`;
|
|
44
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Build an esm.sh package-prefix URL. esm.sh's `&option/` form keeps the
|
|
56
|
+
* trailing slash required by the import-map prefix-matching algorithm.
|
|
57
|
+
*/
|
|
58
|
+
function buildEsmShPrefixUrl(pkg, version, options) {
|
|
59
|
+
const params = buildEsmShParams(options);
|
|
60
|
+
const optionStr = params.length ? `&${arrayJoin(params, "&")}` : "";
|
|
61
|
+
return `https://esm.sh/${pkg}@${version}${optionStr}/`;
|
|
62
|
+
}
|
|
45
63
|
/**
|
|
46
64
|
* Build React esm.sh URL.
|
|
47
65
|
* Uses deps=csstype for type consistency.
|
|
@@ -52,6 +70,12 @@ export function buildReactUrl(pkg, version, subpath, external = false) {
|
|
|
52
70
|
deps: { csstype: CSSTYPE_VERSION },
|
|
53
71
|
});
|
|
54
72
|
}
|
|
73
|
+
function buildReactPrefixUrl(pkg, version) {
|
|
74
|
+
return buildEsmShPrefixUrl(pkg, version, {
|
|
75
|
+
external: ["react"],
|
|
76
|
+
deps: { csstype: CSSTYPE_VERSION },
|
|
77
|
+
});
|
|
78
|
+
}
|
|
55
79
|
/**
|
|
56
80
|
* Get complete React import map for a specific version.
|
|
57
81
|
*/
|
|
@@ -63,8 +87,10 @@ export function getReactImportMap(version) {
|
|
|
63
87
|
"react-dom/server": buildReactUrl("react-dom", version, "/server", true),
|
|
64
88
|
"react/jsx-runtime": buildReactUrl("react", version, "/jsx-runtime", true),
|
|
65
89
|
"react/jsx-dev-runtime": buildReactUrl("react", version, "/jsx-dev-runtime", true),
|
|
66
|
-
// Prefix
|
|
67
|
-
|
|
90
|
+
// Prefix matches cover future package exports without allowing a project
|
|
91
|
+
// import map to redirect React or ReactDOM subpaths.
|
|
92
|
+
"react/": buildReactPrefixUrl("react", version),
|
|
93
|
+
"react-dom/": buildReactPrefixUrl("react-dom", version),
|
|
68
94
|
};
|
|
69
95
|
}
|
|
70
96
|
/**
|
|
@@ -94,6 +120,17 @@ export function appendDependencyPinningKey(url, dependencyPinningCacheKey) {
|
|
|
94
120
|
const DEPENDENCY_PINNING_PATH_MARKER = "_pins/";
|
|
95
121
|
const MODULE_SERVER_PATH_PREFIXES = ["/_vf_modules/"];
|
|
96
122
|
const DEPENDENCY_PINNING_PATH_KEY_PATTERN = /^on:[A-Za-z0-9._-]+$/;
|
|
123
|
+
function splitUrlComponents(url) {
|
|
124
|
+
const hashIndex = url.indexOf("#");
|
|
125
|
+
const hash = hashIndex === -1 ? "" : url.slice(hashIndex);
|
|
126
|
+
const urlWithoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
127
|
+
const queryIndex = urlWithoutHash.indexOf("?");
|
|
128
|
+
return {
|
|
129
|
+
path: queryIndex === -1 ? urlWithoutHash : urlWithoutHash.slice(0, queryIndex),
|
|
130
|
+
params: new URLSearchParams(queryIndex === -1 ? "" : urlWithoutHash.slice(queryIndex + 1)),
|
|
131
|
+
hash,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
97
134
|
function decodeDependencyPinningPathKey(encodedKey) {
|
|
98
135
|
try {
|
|
99
136
|
const cacheKey = decodeURIComponent(encodedKey);
|
|
@@ -103,6 +140,15 @@ function decodeDependencyPinningPathKey(encodedKey) {
|
|
|
103
140
|
return undefined;
|
|
104
141
|
}
|
|
105
142
|
}
|
|
143
|
+
function hasMalformedPercentEncoding(value) {
|
|
144
|
+
try {
|
|
145
|
+
decodeURIComponent(value);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
106
152
|
/**
|
|
107
153
|
* Bind an import-map prefix target to a dependency snapshot without adding a
|
|
108
154
|
* query string. Import-map prefix targets must end in `/`; placing the token in
|
|
@@ -112,12 +158,7 @@ function decodeDependencyPinningPathKey(encodedKey) {
|
|
|
112
158
|
export function appendDependencyPinningPathKey(url, dependencyPinningCacheKey) {
|
|
113
159
|
if (!dependencyPinningCacheKey?.startsWith("on:"))
|
|
114
160
|
return url;
|
|
115
|
-
const
|
|
116
|
-
const hash = hashIndex === -1 ? "" : url.slice(hashIndex);
|
|
117
|
-
const urlWithoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
118
|
-
const queryIndex = urlWithoutHash.indexOf("?");
|
|
119
|
-
const path = queryIndex === -1 ? urlWithoutHash : urlWithoutHash.slice(0, queryIndex);
|
|
120
|
-
const params = new URLSearchParams(queryIndex === -1 ? "" : urlWithoutHash.slice(queryIndex + 1));
|
|
161
|
+
const { path, params, hash } = splitUrlComponents(url);
|
|
121
162
|
for (const prefix of MODULE_SERVER_PATH_PREFIXES) {
|
|
122
163
|
const prefixIndex = path.indexOf(prefix);
|
|
123
164
|
if (prefixIndex === -1)
|
|
@@ -187,8 +228,37 @@ export function appendSameOriginSSRDependencyPinningKey(url, dependencyPinningCa
|
|
|
187
228
|
!target.pathname.startsWith("/_vf_modules/")) {
|
|
188
229
|
return url;
|
|
189
230
|
}
|
|
190
|
-
target.searchParams
|
|
191
|
-
|
|
231
|
+
const params = target.searchParams;
|
|
232
|
+
params.set("pins", dependencyPinningCacheKey);
|
|
233
|
+
params.set("ssr", "true");
|
|
234
|
+
return target.toString();
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
return url;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Bind a same-origin absolute module URL to an SSR dependency snapshot using
|
|
242
|
+
* the module-server path transport. Use this only when the consumer resolves
|
|
243
|
+
* `/_vf_modules/` paths through the module server instead of generic fetch.
|
|
244
|
+
*/
|
|
245
|
+
export function appendSameOriginSSRDependencyPinningPathKey(url, dependencyPinningCacheKey, moduleServerOrigin) {
|
|
246
|
+
if (!dependencyPinningCacheKey?.startsWith("on:") ||
|
|
247
|
+
!moduleServerOrigin ||
|
|
248
|
+
(!/^https?:\/\//i.test(url) && !url.startsWith("//"))) {
|
|
249
|
+
return url;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
const requestOrigin = new URL(moduleServerOrigin);
|
|
253
|
+
const target = new URL(url, requestOrigin);
|
|
254
|
+
if (target.origin !== requestOrigin.origin ||
|
|
255
|
+
!target.pathname.startsWith("/_vf_modules/")) {
|
|
256
|
+
return url;
|
|
257
|
+
}
|
|
258
|
+
const moduleUrl = appendDependencyPinningPathKey(`${target.pathname}${target.search}${target.hash}`, dependencyPinningCacheKey);
|
|
259
|
+
const { path, params, hash } = splitUrlComponents(moduleUrl);
|
|
260
|
+
params.set("ssr", "true");
|
|
261
|
+
return `${path}?${params.toString()}${hash}`;
|
|
192
262
|
}
|
|
193
263
|
catch {
|
|
194
264
|
return url;
|
|
@@ -209,6 +279,9 @@ export function extractDependencyPinningPathKey(pathname) {
|
|
|
209
279
|
const encodedKey = separatorIndex === -1
|
|
210
280
|
? encodedKeyAndPath
|
|
211
281
|
: encodedKeyAndPath.slice(0, separatorIndex);
|
|
282
|
+
if (hasMalformedPercentEncoding(encodedKey)) {
|
|
283
|
+
return { pathname, found: true, malformed: true };
|
|
284
|
+
}
|
|
212
285
|
const cacheKey = decodeDependencyPinningPathKey(encodedKey);
|
|
213
286
|
if (!cacheKey) {
|
|
214
287
|
return { pathname, found: false, malformed: false };
|
|
@@ -218,13 +291,7 @@ export function extractDependencyPinningPathKey(pathname) {
|
|
|
218
291
|
}
|
|
219
292
|
const modulePath = encodedKeyAndPath.slice(separatorIndex + 1);
|
|
220
293
|
if (modulePath.startsWith(DEPENDENCY_PINNING_PATH_MARKER)) {
|
|
221
|
-
|
|
222
|
-
const nestedEncodedKey = nestedKeyEnd === -1
|
|
223
|
-
? modulePath.slice(DEPENDENCY_PINNING_PATH_MARKER.length)
|
|
224
|
-
: modulePath.slice(DEPENDENCY_PINNING_PATH_MARKER.length, nestedKeyEnd);
|
|
225
|
-
if (decodeDependencyPinningPathKey(nestedEncodedKey)) {
|
|
226
|
-
return { pathname, found: true, malformed: true };
|
|
227
|
-
}
|
|
294
|
+
return { pathname, found: true, malformed: true };
|
|
228
295
|
}
|
|
229
296
|
return {
|
|
230
297
|
pathname: `${prefix}${modulePath}`,
|