@veryfront/ext-content-mdx 0.1.1177 → 0.1.1178
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 +2 -0
- package/esm/deno.js +5 -3
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +34 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/url-builder.js +160 -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
package/esm/deno.d.ts
CHANGED
|
@@ -373,7 +373,9 @@ declare namespace _default {
|
|
|
373
373
|
"verify:quick": string;
|
|
374
374
|
"typecheck:consumer": string;
|
|
375
375
|
"codemod:chat": string;
|
|
376
|
+
"codemod:esm-sh": string;
|
|
376
377
|
"lint:chat-ratchets": string;
|
|
378
|
+
"lint:esm-sh-codemod": string;
|
|
377
379
|
"lint:test-typecheck": string;
|
|
378
380
|
docs: string;
|
|
379
381
|
"docs:coverage": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1178",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -436,11 +436,13 @@ export default {
|
|
|
436
436
|
"fmt": "deno fmt src/ cli/ react/ && deno fmt --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts && deno fmt --config=scripts/codemods/deno.json scripts/codemods/",
|
|
437
437
|
"fmt:check": "deno fmt --check src/ cli/ react/ && deno fmt --check --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts && deno fmt --check --config=scripts/codemods/deno.json scripts/codemods/",
|
|
438
438
|
"typecheck": "deno task generate:manifests:check && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/modules/index.ts src/proxy/main.ts src/react/components/ui/index.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/service/route-export.check.ts src/eval/index.ts src/tool/index.ts src/workflow/index.ts src/prompt/index.ts src/resource/index.ts src/runs/index.ts src/mcp/index.ts src/provider/index.ts",
|
|
439
|
-
"verify": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:chat-ratchets && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck && deno task typecheck:consumer && deno task test && deno task test:e2e:binary",
|
|
440
|
-
"verify:quick": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:chat-ratchets && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck",
|
|
439
|
+
"verify": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:chat-ratchets && deno task lint:esm-sh-codemod && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck && deno task typecheck:consumer && deno task test && deno task test:e2e:binary",
|
|
440
|
+
"verify:quick": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:chat-ratchets && deno task lint:esm-sh-codemod && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck",
|
|
441
441
|
"typecheck:consumer": "deno run --allow-read --allow-run --allow-env --allow-write scripts/typecheck/run-consumer-typecheck.ts",
|
|
442
442
|
"codemod:chat": "deno run --frozen --config=scripts/codemods/deno.json --allow-read --allow-write --allow-env=BABEL_TYPES_8_BREAKING scripts/codemods/migrate-chat-composition.ts",
|
|
443
|
+
"codemod:esm-sh": "deno run --frozen --config=scripts/codemods/deno.json --allow-read --allow-write --allow-env=BABEL_TYPES_8_BREAKING scripts/codemods/migrate-esm-sh-imports.ts",
|
|
443
444
|
"lint:chat-ratchets": "deno run --allow-read scripts/lint/ban-chat-antipatterns.ts && deno check --no-config --frozen --lock=deno.lock scripts/codemods/migrate-chat-composition.ts && deno check --config=deno.json --frozen --lock=deno.lock src/react/chat-barrels.check.ts && deno test --frozen --config=scripts/codemods/deno.json --no-check --allow-read --allow-write --allow-env=BABEL_TYPES_8_BREAKING scripts/codemods/migrate-chat-composition.test.ts",
|
|
445
|
+
"lint:esm-sh-codemod": "deno check --no-config --frozen --lock=deno.lock scripts/codemods/migrate-esm-sh-imports.ts && deno test --frozen --config=scripts/codemods/deno.json --no-check --allow-read --allow-write --allow-env=BABEL_TYPES_8_BREAKING scripts/codemods/migrate-esm-sh-imports.test.ts",
|
|
444
446
|
"lint:test-typecheck": "deno run --allow-read --allow-run scripts/lint/check-test-typecheck-baseline.ts",
|
|
445
447
|
"docs": "deno run --allow-read --allow-write --allow-run --allow-env scripts/docs/generate-api-reference.ts",
|
|
446
448
|
"docs:coverage": "deno run --allow-read scripts/docs/docs-coverage.ts",
|
|
@@ -44,6 +44,40 @@ export declare function getReactImportMap(version: string): Record<string, strin
|
|
|
44
44
|
* Build module server URL for a path.
|
|
45
45
|
*/
|
|
46
46
|
export declare function buildModuleServerUrl(baseUrl: string, path: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Bind an internal module URL to the immutable dependency snapshot that
|
|
49
|
+
* produced it. Flag-off keys intentionally preserve the historical URL shape.
|
|
50
|
+
*/
|
|
51
|
+
export declare function appendDependencyPinningKey(url: string, dependencyPinningCacheKey?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Bind an import-map prefix target to a dependency snapshot without adding a
|
|
54
|
+
* query string. Import-map prefix targets must end in `/`; placing the token in
|
|
55
|
+
* a reserved path segment keeps that invariant when the browser appends the
|
|
56
|
+
* concrete module suffix.
|
|
57
|
+
*/
|
|
58
|
+
export declare function appendDependencyPinningPathKey(url: string, dependencyPinningCacheKey?: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Bind a same-origin module-server URL to a dependency snapshot and canonicalize
|
|
61
|
+
* it to a root-relative URL. Foreign origins are preserved byte-for-byte.
|
|
62
|
+
*/
|
|
63
|
+
export declare function appendSameOriginDependencyPinningPathKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Bind a same-origin absolute module URL to an SSR dependency snapshot.
|
|
66
|
+
* Foreign origins and flag-off requests are preserved byte-for-byte.
|
|
67
|
+
*/
|
|
68
|
+
export declare function appendSameOriginSSRDependencyPinningKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string;
|
|
69
|
+
export interface ExtractedDependencyPinningPath {
|
|
70
|
+
pathname: string;
|
|
71
|
+
cacheKey?: string;
|
|
72
|
+
found: boolean;
|
|
73
|
+
malformed: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Remove a dependency snapshot path segment before module classification and
|
|
77
|
+
* source lookup. The decoded key is validated by the request handler alongside
|
|
78
|
+
* query-based tokens.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractDependencyPinningPathKey(pathname: string): ExtractedDependencyPinningPath;
|
|
47
81
|
/**
|
|
48
82
|
* Build cross-project import URL.
|
|
49
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;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;AAEF;;;;;;;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,CAqBR;AAED;;;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;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1E;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"}
|
|
1
|
+
{"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;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;AAEF;;;;;;;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,CAqBR;AAED;;;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;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWzE;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;AAeD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,yBAAyB,CAAC,EAAE,MAAM,GACjC,MAAM,CA4CR;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,CAwBR;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,CA4ChC;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"}
|
|
@@ -75,6 +75,166 @@ export function buildModuleServerUrl(baseUrl, path) {
|
|
|
75
75
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
76
76
|
return `${normalizedBase}${normalizedPath}`;
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Bind an internal module URL to the immutable dependency snapshot that
|
|
80
|
+
* produced it. Flag-off keys intentionally preserve the historical URL shape.
|
|
81
|
+
*/
|
|
82
|
+
export function appendDependencyPinningKey(url, dependencyPinningCacheKey) {
|
|
83
|
+
if (!dependencyPinningCacheKey?.startsWith("on:"))
|
|
84
|
+
return url;
|
|
85
|
+
const hashIndex = url.indexOf("#");
|
|
86
|
+
const hash = hashIndex === -1 ? "" : url.slice(hashIndex);
|
|
87
|
+
const urlWithoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
88
|
+
const queryIndex = urlWithoutHash.indexOf("?");
|
|
89
|
+
const path = queryIndex === -1 ? urlWithoutHash : urlWithoutHash.slice(0, queryIndex);
|
|
90
|
+
const params = new URLSearchParams(queryIndex === -1 ? "" : urlWithoutHash.slice(queryIndex + 1));
|
|
91
|
+
params.set("pins", dependencyPinningCacheKey);
|
|
92
|
+
return `${path}?${params.toString()}${hash}`;
|
|
93
|
+
}
|
|
94
|
+
const DEPENDENCY_PINNING_PATH_MARKER = "_pins/";
|
|
95
|
+
const MODULE_SERVER_PATH_PREFIXES = ["/_vf_modules/"];
|
|
96
|
+
const DEPENDENCY_PINNING_PATH_KEY_PATTERN = /^on:[A-Za-z0-9._-]+$/;
|
|
97
|
+
function decodeDependencyPinningPathKey(encodedKey) {
|
|
98
|
+
try {
|
|
99
|
+
const cacheKey = decodeURIComponent(encodedKey);
|
|
100
|
+
return DEPENDENCY_PINNING_PATH_KEY_PATTERN.test(cacheKey) ? cacheKey : undefined;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Bind an import-map prefix target to a dependency snapshot without adding a
|
|
108
|
+
* query string. Import-map prefix targets must end in `/`; placing the token in
|
|
109
|
+
* a reserved path segment keeps that invariant when the browser appends the
|
|
110
|
+
* concrete module suffix.
|
|
111
|
+
*/
|
|
112
|
+
export function appendDependencyPinningPathKey(url, dependencyPinningCacheKey) {
|
|
113
|
+
if (!dependencyPinningCacheKey?.startsWith("on:"))
|
|
114
|
+
return url;
|
|
115
|
+
const hashIndex = url.indexOf("#");
|
|
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));
|
|
121
|
+
for (const prefix of MODULE_SERVER_PATH_PREFIXES) {
|
|
122
|
+
const prefixIndex = path.indexOf(prefix);
|
|
123
|
+
if (prefixIndex === -1)
|
|
124
|
+
continue;
|
|
125
|
+
const origin = path.slice(0, prefixIndex);
|
|
126
|
+
if (origin !== "" && !/^https?:\/\/[^/]+$/i.test(origin))
|
|
127
|
+
continue;
|
|
128
|
+
let modulePath = path.slice(prefixIndex + prefix.length);
|
|
129
|
+
if (modulePath.startsWith(DEPENDENCY_PINNING_PATH_MARKER)) {
|
|
130
|
+
const existingKeyEnd = modulePath.indexOf("/", DEPENDENCY_PINNING_PATH_MARKER.length);
|
|
131
|
+
const encodedExistingKey = existingKeyEnd === -1
|
|
132
|
+
? modulePath.slice(DEPENDENCY_PINNING_PATH_MARKER.length)
|
|
133
|
+
: modulePath.slice(DEPENDENCY_PINNING_PATH_MARKER.length, existingKeyEnd);
|
|
134
|
+
if (decodeDependencyPinningPathKey(encodedExistingKey)) {
|
|
135
|
+
if (existingKeyEnd === -1)
|
|
136
|
+
return url;
|
|
137
|
+
modulePath = modulePath.slice(existingKeyEnd + 1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
params.delete("pins");
|
|
141
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
142
|
+
return `${origin}${prefix}${DEPENDENCY_PINNING_PATH_MARKER}${encodeURIComponent(dependencyPinningCacheKey)}/${modulePath}${query}${hash}`;
|
|
143
|
+
}
|
|
144
|
+
return url;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Bind a same-origin module-server URL to a dependency snapshot and canonicalize
|
|
148
|
+
* it to a root-relative URL. Foreign origins are preserved byte-for-byte.
|
|
149
|
+
*/
|
|
150
|
+
export function appendSameOriginDependencyPinningPathKey(url, dependencyPinningCacheKey, moduleServerOrigin) {
|
|
151
|
+
if (!dependencyPinningCacheKey?.startsWith("on:"))
|
|
152
|
+
return url;
|
|
153
|
+
if (url.startsWith("/_vf_modules/")) {
|
|
154
|
+
return appendDependencyPinningPathKey(url, dependencyPinningCacheKey);
|
|
155
|
+
}
|
|
156
|
+
if (!moduleServerOrigin ||
|
|
157
|
+
(!/^https?:\/\//i.test(url) && !url.startsWith("//"))) {
|
|
158
|
+
return url;
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
const requestOrigin = new URL(moduleServerOrigin);
|
|
162
|
+
const target = new URL(url, requestOrigin);
|
|
163
|
+
if (target.origin !== requestOrigin.origin ||
|
|
164
|
+
!target.pathname.startsWith("/_vf_modules/")) {
|
|
165
|
+
return url;
|
|
166
|
+
}
|
|
167
|
+
return appendDependencyPinningPathKey(`${target.pathname}${target.search}${target.hash}`, dependencyPinningCacheKey);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return url;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Bind a same-origin absolute module URL to an SSR dependency snapshot.
|
|
175
|
+
* Foreign origins and flag-off requests are preserved byte-for-byte.
|
|
176
|
+
*/
|
|
177
|
+
export function appendSameOriginSSRDependencyPinningKey(url, dependencyPinningCacheKey, moduleServerOrigin) {
|
|
178
|
+
if (!dependencyPinningCacheKey?.startsWith("on:") ||
|
|
179
|
+
!moduleServerOrigin ||
|
|
180
|
+
(!/^https?:\/\//i.test(url) && !url.startsWith("//"))) {
|
|
181
|
+
return url;
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const requestOrigin = new URL(moduleServerOrigin);
|
|
185
|
+
const target = new URL(url, requestOrigin);
|
|
186
|
+
if (target.origin !== requestOrigin.origin ||
|
|
187
|
+
!target.pathname.startsWith("/_vf_modules/")) {
|
|
188
|
+
return url;
|
|
189
|
+
}
|
|
190
|
+
target.searchParams.set("ssr", "true");
|
|
191
|
+
return appendDependencyPinningKey(target.href, dependencyPinningCacheKey);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return url;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Remove a dependency snapshot path segment before module classification and
|
|
199
|
+
* source lookup. The decoded key is validated by the request handler alongside
|
|
200
|
+
* query-based tokens.
|
|
201
|
+
*/
|
|
202
|
+
export function extractDependencyPinningPathKey(pathname) {
|
|
203
|
+
for (const prefix of MODULE_SERVER_PATH_PREFIXES) {
|
|
204
|
+
const markerPrefix = `${prefix}${DEPENDENCY_PINNING_PATH_MARKER}`;
|
|
205
|
+
if (!pathname.startsWith(markerPrefix))
|
|
206
|
+
continue;
|
|
207
|
+
const encodedKeyAndPath = pathname.slice(markerPrefix.length);
|
|
208
|
+
const separatorIndex = encodedKeyAndPath.indexOf("/");
|
|
209
|
+
const encodedKey = separatorIndex === -1
|
|
210
|
+
? encodedKeyAndPath
|
|
211
|
+
: encodedKeyAndPath.slice(0, separatorIndex);
|
|
212
|
+
const cacheKey = decodeDependencyPinningPathKey(encodedKey);
|
|
213
|
+
if (!cacheKey) {
|
|
214
|
+
return { pathname, found: false, malformed: false };
|
|
215
|
+
}
|
|
216
|
+
if (separatorIndex === -1) {
|
|
217
|
+
return { pathname, found: true, malformed: true };
|
|
218
|
+
}
|
|
219
|
+
const modulePath = encodedKeyAndPath.slice(separatorIndex + 1);
|
|
220
|
+
if (modulePath.startsWith(DEPENDENCY_PINNING_PATH_MARKER)) {
|
|
221
|
+
const nestedKeyEnd = modulePath.indexOf("/", DEPENDENCY_PINNING_PATH_MARKER.length);
|
|
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
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
pathname: `${prefix}${modulePath}`,
|
|
231
|
+
cacheKey,
|
|
232
|
+
found: true,
|
|
233
|
+
malformed: false,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
return { pathname, found: false, malformed: false };
|
|
237
|
+
}
|
|
78
238
|
/**
|
|
79
239
|
* Build cross-project import URL.
|
|
80
240
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-content-mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1178",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-content-mdx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vfile": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"veryfront": "^0.1.
|
|
70
|
+
"veryfront": "^0.1.1178"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|