veryfront 0.1.783 → 0.1.784
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.js +1 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts +6 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.js +11 -0
- package/esm/src/html/hydration-script-builder/templates/loader.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/loader.js +36 -0
- package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/renderer.js +3 -0
- package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.js +4 -0
- package/esm/src/html/hydration-script-builder/templates/spa-renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/spa-renderer.js +3 -0
- package/esm/src/html/hydration-script-builder/types.d.ts +2 -0
- package/esm/src/html/hydration-script-builder/types.d.ts.map +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
|
@@ -142,7 +142,7 @@ async function generateHTMLShellPartsImpl(meta, options, params, props, contentF
|
|
|
142
142
|
pretty: useDevScripts,
|
|
143
143
|
releaseAssetManifest: releaseManifest,
|
|
144
144
|
});
|
|
145
|
-
const hydrationDataJson = generateHydrationData(meta.slug || "", params ?? {}, props ?? {}, options, { pretty: useDevScripts });
|
|
145
|
+
const hydrationDataJson = generateHydrationData(meta.slug || "", params ?? {}, props ?? {}, { ...options, releaseAssetManifest: releaseManifest }, { pretty: useDevScripts });
|
|
146
146
|
const nonce = options.nonce ?? "";
|
|
147
147
|
const modeScripts = useDevScripts
|
|
148
148
|
? getDevScripts(meta.slug || "", options.config, params, props, nonce, {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { ComponentProps } from "../../types/index.js";
|
|
2
|
+
import type { ReleaseAssetManifest } from "../../release-assets/manifest-schema.js";
|
|
2
3
|
import type { HTMLGenerationOptions } from "../types.js";
|
|
3
|
-
|
|
4
|
+
type HydrationOptions = HTMLGenerationOptions & {
|
|
5
|
+
releaseAssetManifest?: ReleaseAssetManifest | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function generateHydrationData(slug: string, params: Record<string, string | string[]>, props: ComponentProps, options: HydrationOptions, serializeOptions?: {
|
|
4
8
|
pretty?: boolean;
|
|
5
9
|
}): string;
|
|
10
|
+
export {};
|
|
6
11
|
//# sourceMappingURL=hydration-data-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration-data-generator.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/hydration-data-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydration-data-generator.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/hydration-data-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA8BzD,KAAK,gBAAgB,GAAG,qBAAqB,GAAG;IAC9C,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD,CAAC;AAcF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EACzC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,gBAAgB,EACzB,gBAAgB,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACtC,MAAM,CAiDR"}
|
|
@@ -2,6 +2,7 @@ import { resolveRelativePath } from "../../modules/react-loader/path-resolver.js
|
|
|
2
2
|
import { getExtensionName } from "../../utils/path-utils.js";
|
|
3
3
|
import { determineClientModuleStrategy } from "../../rendering/rsc/client-module-strategy.js";
|
|
4
4
|
import { jsonForInlineScript } from "../../security/client/html-sanitizer.js";
|
|
5
|
+
import { releaseAssetUrl } from "../../release-assets/constants.js";
|
|
5
6
|
function toProjectRelativePath(absolutePath, projectDir) {
|
|
6
7
|
if (!absolutePath)
|
|
7
8
|
return "";
|
|
@@ -19,6 +20,15 @@ function inferPageType(pagePath) {
|
|
|
19
20
|
return undefined;
|
|
20
21
|
return PAGE_TYPE_EXTENSIONS.has(ext) ? ext : undefined;
|
|
21
22
|
}
|
|
23
|
+
function buildReleaseAssetModules(manifest) {
|
|
24
|
+
if (!manifest)
|
|
25
|
+
return undefined;
|
|
26
|
+
const modules = {};
|
|
27
|
+
for (const [path, entry] of Object.entries(manifest.modules)) {
|
|
28
|
+
modules[path] = releaseAssetUrl(entry.contentHash, "js");
|
|
29
|
+
}
|
|
30
|
+
return Object.keys(modules).length > 0 ? modules : undefined;
|
|
31
|
+
}
|
|
22
32
|
export function generateHydrationData(slug, params, props, options, serializeOptions) {
|
|
23
33
|
const layouts = (options.nestedLayouts ?? [])
|
|
24
34
|
.map((layout) => {
|
|
@@ -51,6 +61,7 @@ export function generateHydrationData(slug, params, props, options, serializeOpt
|
|
|
51
61
|
isLocalProject: options.isLocalProject,
|
|
52
62
|
environment: options.environment,
|
|
53
63
|
}),
|
|
64
|
+
releaseAssetModules: buildReleaseAssetModules(options.releaseAssetManifest),
|
|
54
65
|
frontmatter: options.frontmatter,
|
|
55
66
|
layoutProps: options.layoutProps,
|
|
56
67
|
// In dev mode, client uses createRoot instead of hydrateRoot to avoid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/loader.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QAAO,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/loader.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QAAO,MA8IlC,CAAC"}
|
|
@@ -22,7 +22,41 @@ export const getLoaderScript = () => `
|
|
|
22
22
|
return url + (url.includes('?') ? '&' : '?') + key + '=' + value;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
let __releaseAssetModules = null;
|
|
26
|
+
function setReleaseAssetModules(value) {
|
|
27
|
+
__releaseAssetModules =
|
|
28
|
+
value && typeof value === 'object' && !Array.isArray(value) ? value : null;
|
|
29
|
+
window.__veryfrontReleaseAssetModules = __releaseAssetModules;
|
|
30
|
+
}
|
|
31
|
+
window.__veryfrontSetReleaseAssetModules = setReleaseAssetModules;
|
|
32
|
+
|
|
33
|
+
function normalizeReleaseAssetModulePath(path) {
|
|
34
|
+
return String(path || '')
|
|
35
|
+
.replace(/^\\/?_vf_modules\\//, '')
|
|
36
|
+
.replace(/^\\/+/, '')
|
|
37
|
+
.replace(/[?#].*$/, '');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function resolveReleaseAssetModuleUrl(path) {
|
|
41
|
+
if (!__releaseAssetModules || __studioEmbed || __hmrRefreshTimestamp) return null;
|
|
42
|
+
|
|
43
|
+
const key = normalizeReleaseAssetModulePath(path);
|
|
44
|
+
if (__releaseAssetModules[key]) return __releaseAssetModules[key];
|
|
45
|
+
|
|
46
|
+
const withoutExt = key.replace(/\\.(tsx|ts|jsx|mdx|js|mjs)$/, '');
|
|
47
|
+
const extensions = ['.tsx', '.ts', '.jsx', '.mdx', '.js'];
|
|
48
|
+
for (const ext of extensions) {
|
|
49
|
+
const candidate = withoutExt + ext;
|
|
50
|
+
if (__releaseAssetModules[candidate]) return __releaseAssetModules[candidate];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
25
56
|
function pathToModuleUrl(path, studioEmbed) {
|
|
57
|
+
const releaseAssetUrl = resolveReleaseAssetModuleUrl(path);
|
|
58
|
+
if (releaseAssetUrl) return releaseAssetUrl;
|
|
59
|
+
|
|
26
60
|
const pattern = /(pages|components|app|lib|layouts|shared|features)\\/(.+)\\.(tsx|ts|jsx|mdx)$/;
|
|
27
61
|
|
|
28
62
|
const match =
|
|
@@ -49,12 +83,14 @@ export const getLoaderScript = () => `
|
|
|
49
83
|
let __studioEmbed = false;
|
|
50
84
|
function setStudioEmbed(value) {
|
|
51
85
|
__studioEmbed = value;
|
|
86
|
+
window.__veryfrontStudioEmbed = value;
|
|
52
87
|
}
|
|
53
88
|
window.__veryfrontSetStudioEmbed = setStudioEmbed;
|
|
54
89
|
|
|
55
90
|
let __hmrRefreshTimestamp = null;
|
|
56
91
|
function setHMRRefreshTimestamp(timestamp) {
|
|
57
92
|
__hmrRefreshTimestamp = timestamp;
|
|
93
|
+
window.__veryfrontHMRRefreshTimestamp = timestamp;
|
|
58
94
|
}
|
|
59
95
|
window.__veryfrontSetHMRRefreshTimestamp = setHMRRefreshTimestamp;
|
|
60
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAqN7B,CAAC"}
|
|
@@ -33,6 +33,9 @@ export const getRendererScript = () => `
|
|
|
33
33
|
if (data.studioEmbed && window.__veryfrontSetStudioEmbed) {
|
|
34
34
|
window.__veryfrontSetStudioEmbed(true);
|
|
35
35
|
}
|
|
36
|
+
if (data.releaseAssetModules && window.__veryfrontSetReleaseAssetModules) {
|
|
37
|
+
window.__veryfrontSetReleaseAssetModules(data.releaseAssetModules);
|
|
38
|
+
}
|
|
36
39
|
|
|
37
40
|
try {
|
|
38
41
|
let pageModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAmrB3B,CAAC"}
|
|
@@ -401,6 +401,10 @@ export const getRouterScript = () => `
|
|
|
401
401
|
// Render page from page data
|
|
402
402
|
// ============================================
|
|
403
403
|
async function renderPageFromData(pageData, targetPath) {
|
|
404
|
+
if (pageData.releaseAssetModules && window.__veryfrontSetReleaseAssetModules) {
|
|
405
|
+
window.__veryfrontSetReleaseAssetModules(pageData.releaseAssetModules);
|
|
406
|
+
}
|
|
407
|
+
|
|
404
408
|
perfStart('render:loadAll');
|
|
405
409
|
const layoutPaths = (pageData.layouts || []).map((l) => l.path);
|
|
406
410
|
const allPaths = [pageData.pagePath, ...layoutPaths];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/spa-renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,QAAO,
|
|
1
|
+
{"version":3,"file":"spa-renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/spa-renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,QAAO,MAmEvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,MAoCrC,CAAC"}
|
|
@@ -19,6 +19,9 @@ export const getSpaRendererScript = () => `
|
|
|
19
19
|
if (initialData.studioEmbed && window.__veryfrontSetStudioEmbed) {
|
|
20
20
|
window.__veryfrontSetStudioEmbed(true);
|
|
21
21
|
}
|
|
22
|
+
if (initialData.releaseAssetModules && window.__veryfrontSetReleaseAssetModules) {
|
|
23
|
+
window.__veryfrontSetReleaseAssetModules(initialData.releaseAssetModules);
|
|
24
|
+
}
|
|
22
25
|
|
|
23
26
|
try {
|
|
24
27
|
const pageComponent = await loadComponent(initialData.pagePath);
|
|
@@ -12,6 +12,8 @@ export interface HydrationDataStructure {
|
|
|
12
12
|
pagePath?: string;
|
|
13
13
|
pageType?: "mdx" | "md" | "tsx" | "jsx" | "ts" | "js";
|
|
14
14
|
clientModuleStrategy?: ClientModuleStrategy;
|
|
15
|
+
/** Production release asset URLs keyed by logical source path. */
|
|
16
|
+
releaseAssetModules?: Record<string, string>;
|
|
15
17
|
frontmatter?: Record<string, unknown>;
|
|
16
18
|
layoutProps?: Record<string, Record<string, unknown>>;
|
|
17
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,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