veryfront 0.1.790 → 0.1.791
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 +1 -1
- package/esm/src/html/html-shell-generator.d.ts.map +1 -1
- package/esm/src/html/html-shell-generator.js +9 -4
- package/esm/src/html/hydration-script-builder/templates/router.js +2 -2
- package/esm/src/release-assets/build-executor.d.ts +1 -2
- package/esm/src/release-assets/build-executor.d.ts.map +1 -1
- package/esm/src/release-assets/build-executor.js +2 -9
- package/esm/src/release-assets/manifest-cache.d.ts.map +1 -1
- package/esm/src/release-assets/manifest-cache.js +3 -1
- package/esm/src/release-assets/route-path.d.ts +3 -0
- package/esm/src/release-assets/route-path.d.ts.map +1 -0
- package/esm/src/release-assets/route-path.js +9 -0
- package/esm/src/server/handlers/request/ssr/ssr-response-builder.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-shell-generator.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-shell-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"html-shell-generator.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-shell-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA2BxE,OAAO,EAGL,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAqCxD,KAAK,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC;AAqFzE,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,EACtB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAC5C,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBzC;AA8QD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,EACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAC5C,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
|
|
@@ -7,6 +7,7 @@ import { isMarkdownPreview as checkMarkdownPreview } from "../transforms/md/util
|
|
|
7
7
|
import { generateModulePreloadHintsFromManifest, getRouteManifest, } from "../modules/manifest/route-module-manifest.js";
|
|
8
8
|
import { getReadyManifestForRender } from "../release-assets/manifest-cache.js";
|
|
9
9
|
import { resolveManifestModuleUrl, resolveManifestRoutePreloadUrls, } from "../release-assets/html-consumption.js";
|
|
10
|
+
import { routeForPage } from "../release-assets/route-path.js";
|
|
10
11
|
import { buildNonceAttribute, escapeHTML } from "./html-escape.js";
|
|
11
12
|
import { generateHydrationData, getDevScripts, getProdScripts, PROD_HYDRATION_MODULE_PATH, } from "./hydration-script-builder/index.js";
|
|
12
13
|
import { getPreviewStylesheetLink, getStudioScripts } from "./dev-scripts.js";
|
|
@@ -72,23 +73,27 @@ function generateModulePreloadHints(options) {
|
|
|
72
73
|
if (studioEmbed || options.environment === "preview") {
|
|
73
74
|
return hints.join("\n ");
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
+
const relativePagePath = options.pagePath
|
|
76
77
|
? getRelativePagePath(options.pagePath, projectDir)
|
|
78
|
+
: "";
|
|
79
|
+
const releaseManifestRoute = relativePagePath ? routeForPage(relativePagePath) ?? "" : "";
|
|
80
|
+
const legacyModuleManifestRoute = relativePagePath
|
|
81
|
+
? relativePagePath
|
|
77
82
|
.replace(/\.(tsx|ts|jsx|mdx)$/, "")
|
|
78
83
|
.replace(/^pages\//, "")
|
|
79
84
|
: "";
|
|
80
85
|
// Manifest-covered routes: preload the full closure from the manifest.
|
|
81
86
|
if (releaseManifest) {
|
|
82
|
-
for (const url of resolveManifestRoutePreloadUrls(releaseManifest,
|
|
87
|
+
for (const url of resolveManifestRoutePreloadUrls(releaseManifest, releaseManifestRoute)) {
|
|
83
88
|
addHint(url);
|
|
84
89
|
}
|
|
85
90
|
return hints.join("\n ");
|
|
86
91
|
}
|
|
87
92
|
const projectSlug = options.projectSlug ?? options.projectId;
|
|
88
|
-
const manifest = getRouteManifest(projectSlug,
|
|
93
|
+
const manifest = getRouteManifest(projectSlug, legacyModuleManifestRoute);
|
|
89
94
|
if (!manifest || manifest.renderCount <= 0)
|
|
90
95
|
return hints.join("\n ");
|
|
91
|
-
for (const hint of generateModulePreloadHintsFromManifest(projectSlug,
|
|
96
|
+
for (const hint of generateModulePreloadHintsFromManifest(projectSlug, legacyModuleManifestRoute, 50)) {
|
|
92
97
|
const href = hint.match(/href="([^"]+)"/)?.[1];
|
|
93
98
|
if (!href || addedUrls.has(href))
|
|
94
99
|
continue;
|
|
@@ -401,8 +401,8 @@ export const getRouterScript = () => `
|
|
|
401
401
|
// Render page from page data
|
|
402
402
|
// ============================================
|
|
403
403
|
async function renderPageFromData(pageData, targetPath) {
|
|
404
|
-
if (
|
|
405
|
-
window.__veryfrontSetReleaseAssetModules(pageData.releaseAssetModules);
|
|
404
|
+
if (window.__veryfrontSetReleaseAssetModules) {
|
|
405
|
+
window.__veryfrontSetReleaseAssetModules(pageData.releaseAssetModules || null);
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
perfStart('render:loadAll');
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module release-assets/build-executor
|
|
16
16
|
*/
|
|
17
|
+
export { routeForPage } from "./route-path.js";
|
|
17
18
|
export interface ReleaseAssetBuildInput {
|
|
18
19
|
/** Project reference (slug or id) used for API calls. */
|
|
19
20
|
projectReference: string;
|
|
@@ -92,8 +93,6 @@ export interface ReleaseAssetBuildResult {
|
|
|
92
93
|
gaps: string[];
|
|
93
94
|
error?: string;
|
|
94
95
|
}
|
|
95
|
-
/** Derive a route path from a page module logical path. */
|
|
96
|
-
export declare function routeForPage(logicalPath: string): string | null;
|
|
97
96
|
/**
|
|
98
97
|
* Execute a release asset build. Pure orchestration over the injected client
|
|
99
98
|
* and a runtime-provided temp dir + react version.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAqBH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAe/C,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAA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EACf,KAAK,EAAE,SAAS,GAAG,QAAQ,EAC3B,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA2cD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
|
|
@@ -25,6 +25,8 @@ import { PLATFORM_UTILITIES } from "../html/utils.js";
|
|
|
25
25
|
import { extractCandidatesFromFiles } from "../html/styles-builder/candidate-extractor.js";
|
|
26
26
|
import { sha256HexBytes } from "./hash.js";
|
|
27
27
|
import { RELEASE_ASSET_BASE_PATH, RELEASE_ASSET_CONTENT_TYPES, RELEASE_ASSET_MANIFEST_SCHEMA_VERSION, RELEASE_ASSET_MAX_SIZE_BYTES, RELEASE_ASSET_UPLOAD_CONCURRENCY, releaseAssetUrl, } from "./constants.js";
|
|
28
|
+
import { routeForPage } from "./route-path.js";
|
|
29
|
+
export { routeForPage } from "./route-path.js";
|
|
28
30
|
const logger = serverLogger.component("release-asset-build");
|
|
29
31
|
/** Browser module source extensions eligible for transform. */
|
|
30
32
|
const BROWSER_MODULE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mdx"];
|
|
@@ -51,15 +53,6 @@ function isBrowserModule(path) {
|
|
|
51
53
|
return false;
|
|
52
54
|
return BROWSER_MODULE_DIRS.some((dir) => path.startsWith(dir));
|
|
53
55
|
}
|
|
54
|
-
/** Derive a route path from a page module logical path. */
|
|
55
|
-
export function routeForPage(logicalPath) {
|
|
56
|
-
if (!logicalPath.startsWith("pages/"))
|
|
57
|
-
return null;
|
|
58
|
-
const withoutPrefix = logicalPath.slice("pages/".length);
|
|
59
|
-
const withoutExt = withoutPrefix.replace(/\.(tsx|ts|jsx|mdx|js)$/, "");
|
|
60
|
-
const route = withoutExt.replace(/\/index$/, "").replace(/^index$/, "");
|
|
61
|
-
return `/${route}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
62
|
-
}
|
|
63
56
|
/**
|
|
64
57
|
* Statically resolve relative imports in a source file to logical paths.
|
|
65
58
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-cache.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/manifest-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAkC5F;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAChE,CAAC;CACH;AAKD;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED;;;;;GAK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
|
@@ -122,7 +122,9 @@ export function getReadyManifestForRender(releaseId) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
if (best) {
|
|
125
|
-
|
|
125
|
+
const now = Date.now();
|
|
126
|
+
if ((best.refreshAfter ?? best.expiresAt) <= now) {
|
|
127
|
+
best.refreshAfter = now + READY_REVALIDATE_MS;
|
|
126
128
|
scheduleFetch(releaseId);
|
|
127
129
|
}
|
|
128
130
|
return best.manifest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-path.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/route-path.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Derive a route path from a page module logical path. */
|
|
2
|
+
export function routeForPage(logicalPath) {
|
|
3
|
+
if (!logicalPath.startsWith("pages/"))
|
|
4
|
+
return null;
|
|
5
|
+
const withoutPrefix = logicalPath.slice("pages/".length);
|
|
6
|
+
const withoutExt = withoutPrefix.replace(/\.(tsx|ts|jsx|mdx|js)$/, "");
|
|
7
|
+
const route = withoutExt.replace(/\/index$/, "").replace(/^index$/, "");
|
|
8
|
+
return `/${route}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
9
|
+
}
|
|
@@ -45,7 +45,7 @@ export async function buildSSRResponse(req, ctx, result, builder) {
|
|
|
45
45
|
return new Response(null, { status: response.status, headers: response.headers });
|
|
46
46
|
}
|
|
47
47
|
// ETag match → 304 Not Modified (production only)
|
|
48
|
-
if (!isDev && result.etag && hasMatchingEtag(req, result.etag)) {
|
|
48
|
+
if (!isDev && !builder.nonce && result.etag && hasMatchingEtag(req, result.etag)) {
|
|
49
49
|
return builder
|
|
50
50
|
.withCORS(req, ctx.securityConfig?.cors)
|
|
51
51
|
.withSecurity(ctx.securityConfig ?? undefined, req)
|