veryfront 0.1.835 → 0.1.836
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.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAyDtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;
|
|
1
|
+
{"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAyDtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;AAyEF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAubzF;AAwWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD"}
|
|
@@ -123,13 +123,22 @@ function isSSRModuleRequest(req, url) {
|
|
|
123
123
|
const userAgent = req.headers.get("user-agent") ?? "";
|
|
124
124
|
return url.searchParams.get("ssr") === "true" || userAgent.startsWith("Deno/");
|
|
125
125
|
}
|
|
126
|
-
async function addReleaseVersionToFallbackImports(code, releaseId) {
|
|
127
|
-
if (!releaseId
|
|
126
|
+
async function addReleaseVersionToFallbackImports(code, modulePath, releaseId) {
|
|
127
|
+
if (!releaseId)
|
|
128
128
|
return code;
|
|
129
|
+
const moduleBaseUrl = `https://veryfront.local/_vf_modules/${modulePath}`;
|
|
129
130
|
return await replaceSpecifiers(code, (specifier) => {
|
|
130
|
-
if (
|
|
131
|
+
if (specifier.startsWith("/_vf_modules/")) {
|
|
132
|
+
return appendReleaseModuleVersion(specifier, releaseId);
|
|
133
|
+
}
|
|
134
|
+
if (!specifier.startsWith("./") && !specifier.startsWith("../"))
|
|
135
|
+
return null;
|
|
136
|
+
const resolved = new URL(specifier, moduleBaseUrl);
|
|
137
|
+
if (resolved.origin !== "https://veryfront.local")
|
|
138
|
+
return null;
|
|
139
|
+
if (!resolved.pathname.startsWith("/_vf_modules/"))
|
|
131
140
|
return null;
|
|
132
|
-
return appendReleaseModuleVersion(
|
|
141
|
+
return appendReleaseModuleVersion(`${resolved.pathname}${resolved.search}${resolved.hash}`, releaseId);
|
|
133
142
|
});
|
|
134
143
|
}
|
|
135
144
|
/** Serve transformed module at /_vf_modules/* path */
|
|
@@ -453,7 +462,7 @@ export function serveModule(req, options) {
|
|
|
453
462
|
manifest: releaseDependencyManifest ?? undefined,
|
|
454
463
|
readDependencySource: (path) => platformFs.readTextFile(path),
|
|
455
464
|
});
|
|
456
|
-
code = await addReleaseVersionToFallbackImports(code, options.releaseId);
|
|
465
|
+
code = await addReleaseVersionToFallbackImports(code, modulePath, options.releaseId);
|
|
457
466
|
}
|
|
458
467
|
}
|
|
459
468
|
const headers = getModuleHeaders(modulePath, {
|