veryfront 0.1.806 → 0.1.809
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/cli/commands/build/command-help.d.ts.map +1 -1
- package/esm/cli/commands/build/command-help.js +7 -3
- package/esm/cli/commands/build/command.js +1 -1
- package/esm/cli/commands/build/config-display.js +1 -1
- package/esm/cli/commands/build/handler.js +1 -1
- package/esm/cli/mcp/tools/build-tool.js +2 -2
- package/esm/cli/shared/server-startup.d.ts.map +1 -1
- package/esm/cli/shared/server-startup.js +32 -1
- package/esm/deno.js +1 -1
- package/esm/src/build/bundler/code-splitter/esbuild-plugin.js +1 -1
- package/esm/src/build/index.d.ts +1 -0
- package/esm/src/build/index.d.ts.map +1 -1
- package/esm/src/build/index.js +1 -0
- package/esm/src/build/production-build/build/build-initializer.js +1 -1
- package/esm/src/build/production-build/build/build-orchestrator.js +1 -1
- package/esm/src/build/production-build/build/output-generator.d.ts.map +1 -1
- package/esm/src/build/production-build/build/output-generator.js +9 -0
- package/esm/src/build/production-build/client-runtime.d.ts.map +1 -1
- package/esm/src/build/production-build/client-runtime.js +21 -3
- package/esm/src/build/production-build/index.d.ts +1 -0
- package/esm/src/build/production-build/index.d.ts.map +1 -1
- package/esm/src/build/production-build/index.js +1 -0
- package/esm/src/build/production-build/local-release-assets.d.ts +15 -0
- package/esm/src/build/production-build/local-release-assets.d.ts.map +1 -0
- package/esm/src/build/production-build/local-release-assets.js +83 -0
- package/esm/src/build/production-build/static-generation.d.ts.map +1 -1
- package/esm/src/build/production-build/static-generation.js +14 -1
- package/esm/src/build/production-build/templates.d.ts.map +1 -1
- package/esm/src/build/production-build/templates.js +2 -2
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +5 -1
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +20 -1
- package/esm/src/release-assets/build-executor.d.ts +25 -0
- package/esm/src/release-assets/build-executor.d.ts.map +1 -1
- package/esm/src/release-assets/build-executor.js +137 -31
- package/esm/src/release-assets/constants.d.ts +2 -0
- package/esm/src/release-assets/constants.d.ts.map +1 -1
- package/esm/src/release-assets/constants.js +2 -0
- package/esm/src/release-assets/index.d.ts +13 -0
- package/esm/src/release-assets/index.d.ts.map +1 -0
- package/esm/src/release-assets/index.js +12 -0
- package/esm/src/release-assets/module-consumption.d.ts +16 -0
- package/esm/src/release-assets/module-consumption.d.ts.map +1 -0
- package/esm/src/release-assets/module-consumption.js +92 -0
- package/esm/src/routing/client/page-transition.js +2 -2
- package/esm/src/security/client/html-sanitizer.d.ts +2 -0
- package/esm/src/security/client/html-sanitizer.d.ts.map +1 -1
- package/esm/src/security/client/html-sanitizer.js +3 -1
- package/esm/src/server/handlers/request/module/data-endpoint-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/data-endpoint-handler.js +2 -1
- package/esm/src/server/handlers/request/module/page-module-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/page-module-handler.js +11 -0
- package/esm/src/server/handlers/request/static.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/static.handler.js +20 -1
- package/esm/src/server/production-server.d.ts +2 -0
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +2 -1
- package/esm/src/server/runtime-handler/index.d.ts +2 -0
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +1 -0
- package/esm/src/server/runtime-handler/project-resolution.d.ts +2 -0
- package/esm/src/server/runtime-handler/project-resolution.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-resolution.js +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +2 -2
- package/esm/src/server/services/static/static-file.service.d.ts.map +1 -1
- package/esm/src/server/services/static/static-file.service.js +4 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,SAAS,EAAE,WAoDvB,CAAC"}
|
|
@@ -17,9 +17,13 @@ export const buildHelp = {
|
|
|
17
17
|
flag: "--no-split",
|
|
18
18
|
description: "Disable code splitting",
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
flag: "--ssg",
|
|
22
|
+
description: "Enable static generation",
|
|
23
|
+
},
|
|
20
24
|
{
|
|
21
25
|
flag: "--no-ssg",
|
|
22
|
-
description: "Disable static generation",
|
|
26
|
+
description: "Disable static generation when another option enables it",
|
|
23
27
|
},
|
|
24
28
|
{
|
|
25
29
|
flag: "--include <paths>",
|
|
@@ -41,9 +45,9 @@ export const buildHelp = {
|
|
|
41
45
|
examples: [
|
|
42
46
|
"veryfront build",
|
|
43
47
|
"veryfront build --output dist",
|
|
44
|
-
"veryfront build --
|
|
48
|
+
"veryfront build --ssg",
|
|
45
49
|
"veryfront build --preset embedded # writes dist/embedded/*",
|
|
46
|
-
"veryfront build --include /docs --exclude /api",
|
|
50
|
+
"veryfront build --ssg --include /docs --exclude /api",
|
|
47
51
|
"veryfront build --dry-run",
|
|
48
52
|
],
|
|
49
53
|
};
|
|
@@ -36,7 +36,7 @@ export function buildCommand(options) {
|
|
|
36
36
|
enableSplitting: options.splitting ?? true,
|
|
37
37
|
enableCompression: options.compress ?? true,
|
|
38
38
|
enablePrefetch: options.prefetch ?? true,
|
|
39
|
-
ssg: options.ssg ??
|
|
39
|
+
ssg: options.ssg ?? false,
|
|
40
40
|
include: options.include,
|
|
41
41
|
exclude: options.exclude,
|
|
42
42
|
dryRun,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bold, cyan, dim, green, red, yellow } from "../../ui/index.js";
|
|
2
2
|
import { cliLogger } from "../../utils/index.js";
|
|
3
3
|
export function displayBuildConfig(options) {
|
|
4
|
-
const { projectDir, outputDir, splitting = true, compress = true, prefetch = true, ssg =
|
|
4
|
+
const { projectDir, outputDir, splitting = true, compress = true, prefetch = true, ssg = false, include, exclude, dryRun = false, } = options;
|
|
5
5
|
cliLogger.info(bold(cyan("\n🚀 Veryfront Production Build\n")));
|
|
6
6
|
cliLogger.info("Starting production build");
|
|
7
7
|
cliLogger.info(yellow("\nBuild Configuration:"));
|
|
@@ -15,7 +15,7 @@ export const getBuildArgsSchema = defineSchema((v) => v.object({
|
|
|
15
15
|
split: v.boolean().default(true),
|
|
16
16
|
compress: v.boolean().default(true),
|
|
17
17
|
prefetch: v.boolean().default(true),
|
|
18
|
-
ssg: v.boolean().default(
|
|
18
|
+
ssg: v.boolean().default(false),
|
|
19
19
|
noSsg: v.boolean().default(false),
|
|
20
20
|
include: v.array(v.string()).optional(),
|
|
21
21
|
exclude: v.array(v.string()).optional(),
|
|
@@ -27,8 +27,8 @@ const getBuildInput = defineSchema((v) => v.object({
|
|
|
27
27
|
ssg: v
|
|
28
28
|
.boolean()
|
|
29
29
|
.optional()
|
|
30
|
-
.default(
|
|
31
|
-
.describe("Enable static site generation. Defaults to
|
|
30
|
+
.default(false)
|
|
31
|
+
.describe("Enable static site generation. Defaults to false."),
|
|
32
32
|
dryRun: v
|
|
33
33
|
.boolean()
|
|
34
34
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-startup.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/server-startup.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,cAAc,EACd,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"server-startup.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/server-startup.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,cAAc,EACd,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAUlE,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAcD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAsB5D;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAWrD;AAED,MAAM,WAAW,+BAA+B;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAmD5D"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { getEnv, runtime, setEnv } from "../../src/platform/index.js";
|
|
2
2
|
import { startDevServer, startProductionServer, } from "../../src/server/index.js";
|
|
3
3
|
import { ensureBuiltinContentProcessor } from "./ensure-content-processor.js";
|
|
4
|
+
import { join } from "../../src/platform/compat/path/index.js";
|
|
5
|
+
import { parseReleaseAssetManifest } from "../../src/release-assets/index.js";
|
|
6
|
+
import { clearReleaseAssetManifestCache, configureReleaseAssetManifestFetcher, } from "../../src/release-assets/index.js";
|
|
7
|
+
import { LOCAL_RELEASE_ASSET_MANIFEST_PATH } from "../../src/build/index.js";
|
|
4
8
|
function buildDiscoveryConfig(options) {
|
|
5
9
|
const token = getEnv("VERYFRONT_API_TOKEN") ?? "";
|
|
6
10
|
const slug = getEnv("VERYFRONT_PROJECT_SLUG") ?? options.fallbackProjectSlug ?? "";
|
|
@@ -46,6 +50,22 @@ export async function startCliDevServer(options) {
|
|
|
46
50
|
}
|
|
47
51
|
export async function startCliProductionServer(options) {
|
|
48
52
|
const adapter = options.adapter ?? (await runtime.get());
|
|
53
|
+
const manifestPath = join(options.projectDir, "dist", LOCAL_RELEASE_ASSET_MANIFEST_PATH);
|
|
54
|
+
let registeredLocalManifest = false;
|
|
55
|
+
let localReleaseId;
|
|
56
|
+
try {
|
|
57
|
+
const manifestRaw = await adapter.fs.readFile(manifestPath);
|
|
58
|
+
const manifest = parseReleaseAssetManifest(JSON.parse(manifestRaw));
|
|
59
|
+
if (manifest) {
|
|
60
|
+
clearReleaseAssetManifestCache();
|
|
61
|
+
configureReleaseAssetManifestFetcher(() => Promise.resolve({ state: "ready", manifest }));
|
|
62
|
+
registeredLocalManifest = true;
|
|
63
|
+
localReleaseId = manifest.releaseId;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (_) {
|
|
67
|
+
/* expected: builds without local release asset manifests keep CDN fallback */
|
|
68
|
+
}
|
|
49
69
|
const serverOptions = {
|
|
50
70
|
projectDir: options.projectDir,
|
|
51
71
|
port: options.port,
|
|
@@ -55,6 +75,8 @@ export async function startCliProductionServer(options) {
|
|
|
55
75
|
signal: options.signal,
|
|
56
76
|
defaultProjectSlug: options.defaultProjectSlug,
|
|
57
77
|
defaultProjectId: options.defaultProjectId,
|
|
78
|
+
defaultReleaseId: localReleaseId,
|
|
79
|
+
defaultEnvironment: "production",
|
|
58
80
|
// Do NOT register a `localProjects` mapping here. `vf serve` and the
|
|
59
81
|
// compiled binary are production deployments, and `isLocalProject: true`
|
|
60
82
|
// flips `isDev` on in security headers (suppressing CSP) and in the SSR
|
|
@@ -66,5 +88,14 @@ export async function startCliProductionServer(options) {
|
|
|
66
88
|
};
|
|
67
89
|
const result = await startProductionServer(serverOptions);
|
|
68
90
|
ensureBuiltinContentProcessor();
|
|
69
|
-
return
|
|
91
|
+
return {
|
|
92
|
+
...result,
|
|
93
|
+
stop: async () => {
|
|
94
|
+
if (registeredLocalManifest) {
|
|
95
|
+
configureReleaseAssetManifestFetcher(undefined);
|
|
96
|
+
clearReleaseAssetManifestCache();
|
|
97
|
+
}
|
|
98
|
+
await result.stop();
|
|
99
|
+
},
|
|
100
|
+
};
|
|
70
101
|
}
|
package/esm/deno.js
CHANGED
|
@@ -10,7 +10,7 @@ export function createSplitterPlugin(projectDir) {
|
|
|
10
10
|
return null;
|
|
11
11
|
return { path: args.path, external: true };
|
|
12
12
|
});
|
|
13
|
-
build.onResolve({ filter: /\.mdx
|
|
13
|
+
build.onResolve({ filter: /\.mdx?$/ }, (args) => ({
|
|
14
14
|
path: join(projectDir, args.path),
|
|
15
15
|
namespace: "mdx",
|
|
16
16
|
}));
|
package/esm/src/build/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
export { compileMDXToJS } from "./compiler/mdx-to-js.js";
|
|
8
8
|
export { compileAllMDX, watchMDX } from "./compiler/mdx-compiler/index.js";
|
|
9
9
|
export { buildProduction } from "./production-build/build/build-orchestrator.js";
|
|
10
|
+
export { LOCAL_RELEASE_ASSET_MANIFEST_PATH } from "./production-build/local-release-assets.js";
|
|
10
11
|
export { buildEmbeddedPreset } from "./embedded/preset.js";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/build/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/build/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/esm/src/build/index.js
CHANGED
|
@@ -7,4 +7,5 @@
|
|
|
7
7
|
export { compileMDXToJS } from "./compiler/mdx-to-js.js";
|
|
8
8
|
export { compileAllMDX, watchMDX } from "./compiler/mdx-compiler/index.js";
|
|
9
9
|
export { buildProduction } from "./production-build/build/build-orchestrator.js";
|
|
10
|
+
export { LOCAL_RELEASE_ASSET_MANIFEST_PATH } from "./production-build/local-release-assets.js";
|
|
10
11
|
export { buildEmbeddedPreset } from "./embedded/preset.js";
|
|
@@ -35,7 +35,7 @@ export function normalizeBuildOptions(options) {
|
|
|
35
35
|
enableSplitting: options.enableSplitting ?? true,
|
|
36
36
|
enableCompression: options.enableCompression ?? true,
|
|
37
37
|
enablePrefetch: options.enablePrefetch ?? true,
|
|
38
|
-
ssg: options.ssg ??
|
|
38
|
+
ssg: options.ssg ?? false,
|
|
39
39
|
include: options.include,
|
|
40
40
|
exclude: options.exclude,
|
|
41
41
|
dryRun: options.dryRun ?? false,
|
|
@@ -33,7 +33,7 @@ export function buildProduction(options) {
|
|
|
33
33
|
const enableSplitting = normalizedOptions.enableSplitting ?? true;
|
|
34
34
|
const enablePrefetch = normalizedOptions.enablePrefetch ?? true;
|
|
35
35
|
const enableCompression = normalizedOptions.enableCompression ?? true;
|
|
36
|
-
const ssg = normalizedOptions.ssg ??
|
|
36
|
+
const ssg = normalizedOptions.ssg ?? false;
|
|
37
37
|
await withSpan("build.setupDirectories", () => setupBuildDirectories(context.adapter, outputDir, dryRun), {});
|
|
38
38
|
const routes = await withSpan("build.collectRoutes", () => collectAllRoutes(context.adapter, normalizedOptions.projectDir, ssg, normalizedOptions.include, normalizedOptions.exclude), {});
|
|
39
39
|
const splitResult = await withSpan("build.codeSplitting", () => runCodeSplitting(normalizedOptions.projectDir, outputDir, routes.pages, enableSplitting, dryRun), {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/build/production-build/build/output-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"output-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/build/production-build/build/output-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAa1F,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED;;GAEG;AACH,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBvF"}
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
import { serverLogger as logger } from "../../../utils/index.js";
|
|
12
12
|
import { join } from "../../../platform/compat/path/index.js";
|
|
13
13
|
import { generateServiceWorker } from "../../../server/build-service-worker.js";
|
|
14
|
+
import { generateProdHydrationModule } from "../../../html/hydration-script-builder/prod-scripts.js";
|
|
14
15
|
import { copyStaticAssets } from "../asset-generation.js";
|
|
15
16
|
import { generateAppModule, generateClientModule, generatePrefetchScript, generateRouterScript, } from "../client-runtime.js";
|
|
17
|
+
import { generateLocalReleaseAssetManifest } from "../local-release-assets.js";
|
|
16
18
|
import { generateManifest, generateRedirects } from "../manifest.js";
|
|
17
19
|
/**
|
|
18
20
|
* Generate client runtime scripts
|
|
@@ -25,6 +27,7 @@ export async function generateClientScripts(adapter, outputDir, dryRun) {
|
|
|
25
27
|
await adapter.fs.writeFile(join(outputDir, "_veryfront/client.js"), await generateClientModule());
|
|
26
28
|
await adapter.fs.writeFile(join(outputDir, "_veryfront/router.js"), await generateRouterScript(adapter));
|
|
27
29
|
await adapter.fs.writeFile(join(outputDir, "_veryfront/prefetch.js"), await generatePrefetchScript(adapter));
|
|
30
|
+
await adapter.fs.writeFile(join(outputDir, "_veryfront/hydration-runtime.js"), generateProdHydrationModule());
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
33
|
* Generate manifest and service worker
|
|
@@ -65,6 +68,12 @@ export function copyAssets(adapter, projectDir, outputDir, dryRun) {
|
|
|
65
68
|
export async function generateAllOutputs(options) {
|
|
66
69
|
const { adapter, projectDir, outputDir, dryRun, stats } = options;
|
|
67
70
|
await generateClientScripts(adapter, outputDir, dryRun);
|
|
71
|
+
await generateLocalReleaseAssetManifest({
|
|
72
|
+
adapter,
|
|
73
|
+
projectDir,
|
|
74
|
+
outputDir,
|
|
75
|
+
dryRun,
|
|
76
|
+
});
|
|
68
77
|
const assetStats = await copyAssets(adapter, projectDir, outputDir, dryRun);
|
|
69
78
|
stats.assets = assetStats.assets;
|
|
70
79
|
stats.totalSize += assetStats.totalSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/client-runtime.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAiBtE,UAAU,6BAA6B;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"client-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/client-runtime.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAiBtE,UAAU,6BAA6B;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAqCD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA4B1C;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,CAAC,EAAE,6BAA6B,GACtC,OAAO,CAAC,MAAM,CAAC,CAYjB;AAoBD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,6BAA6B,GACtC,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,6BAA6B,GACtC,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAYzD"}
|
|
@@ -37,9 +37,16 @@ async function readTextFile(path) {
|
|
|
37
37
|
const moduleDir = dirname(fromFileUrl(globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url));
|
|
38
38
|
const packageRoot = resolve(join(moduleDir, "..", "..", ".."));
|
|
39
39
|
const vfSrcPrefix = "@vf-src/";
|
|
40
|
+
const veryfrontInternalPrefix = "#veryfront/";
|
|
40
41
|
const moduleExtensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"];
|
|
41
42
|
const externalSpecifier = /^(std\/|@std\/|node:|deno:|https?:)/;
|
|
42
43
|
const relativeSpecifier = /^\.{1,2}(?:\/|$)/;
|
|
44
|
+
const unresolvedInternalAlias = /(?:^|["'])#veryfront\//;
|
|
45
|
+
const clientAliasPaths = new Map([
|
|
46
|
+
["#veryfront/config", "src/rendering/client/browser-stubs/config.ts"],
|
|
47
|
+
["#veryfront/errors/error-registry.ts", "src/rendering/client/browser-stubs/error-registry.ts"],
|
|
48
|
+
["#veryfront/routing", "src/routing/client/index.ts"],
|
|
49
|
+
]);
|
|
43
50
|
/**
|
|
44
51
|
* Generate app.js module
|
|
45
52
|
*/
|
|
@@ -86,7 +93,9 @@ export async function generateClientModule(options) {
|
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
95
|
function loadClientScript(preBundledScript, scriptName, sourceEntry, options) {
|
|
89
|
-
if (preBundledScript &&
|
|
96
|
+
if (preBundledScript &&
|
|
97
|
+
!options?.forceSourceBundle &&
|
|
98
|
+
!unresolvedInternalAlias.test(preBundledScript)) {
|
|
90
99
|
logger.debug(`Using pre-bundled client ${scriptName} script`);
|
|
91
100
|
return Promise.resolve(preBundledScript);
|
|
92
101
|
}
|
|
@@ -143,6 +152,15 @@ function createPathResolverPlugin() {
|
|
|
143
152
|
const resolved = await resolveFromCandidates(lookupBase);
|
|
144
153
|
return resolved ? { path: resolved } : null;
|
|
145
154
|
}
|
|
155
|
+
const aliasPath = clientAliasPaths.get(specifier);
|
|
156
|
+
if (aliasPath) {
|
|
157
|
+
return { path: resolve(packageRoot, aliasPath) };
|
|
158
|
+
}
|
|
159
|
+
if (specifier.startsWith(veryfrontInternalPrefix)) {
|
|
160
|
+
const lookupBase = resolve(packageRoot, "src", specifier.slice(veryfrontInternalPrefix.length));
|
|
161
|
+
const resolved = await resolveFromCandidates(lookupBase);
|
|
162
|
+
return resolved ? { path: resolved } : null;
|
|
163
|
+
}
|
|
146
164
|
if (relativeSpecifier.test(specifier)) {
|
|
147
165
|
const importerDir = determineImporterDir(args);
|
|
148
166
|
const lookupBase = resolve(importerDir, specifier);
|
|
@@ -192,7 +210,7 @@ function stripTrailingSeparator(path) {
|
|
|
192
210
|
}
|
|
193
211
|
function stripSpecifier(specifier) {
|
|
194
212
|
const queryIndex = specifier.indexOf("?");
|
|
195
|
-
const hashIndex = specifier.indexOf("#");
|
|
213
|
+
const hashIndex = specifier.startsWith("#") ? -1 : specifier.indexOf("#");
|
|
196
214
|
if (queryIndex === -1 && hashIndex === -1)
|
|
197
215
|
return specifier;
|
|
198
216
|
if (queryIndex === -1)
|
|
@@ -267,8 +285,8 @@ async function bundleClientEntry(entryRelative) {
|
|
|
267
285
|
"react/jsx-dev-runtime",
|
|
268
286
|
],
|
|
269
287
|
plugins: [
|
|
270
|
-
createPathResolverPlugin(),
|
|
271
288
|
createClientShimPlugin(shimPath),
|
|
289
|
+
createPathResolverPlugin(),
|
|
272
290
|
createFsLoaderPlugin(),
|
|
273
291
|
],
|
|
274
292
|
});
|
|
@@ -14,5 +14,6 @@ export { setupBuildDirectories } from "./build/index.js";
|
|
|
14
14
|
export { cleanupCachesUtil, cleanupRendererUtil, logCompletion, performCleanup, } from "./build/index.js";
|
|
15
15
|
export { runCodeSplitting, type SplitResult } from "./build/index.js";
|
|
16
16
|
export { copyAssets, generateClientScripts, generateManifestAndServiceWorker, generateRedirectsFile, type OutputGeneratorOptions, } from "./build/index.js";
|
|
17
|
+
export { generateLocalReleaseAssetManifest, LOCAL_RELEASE_ASSET_MANIFEST_PATH, type LocalReleaseAssetOptions, } from "./local-release-assets.js";
|
|
17
18
|
export { collectAllRoutes, type CollectedRoutes } from "./build/index.js";
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,aAAa,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,KAAK,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,gCAAgC,EAChC,qBAAqB,EACrB,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,aAAa,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,KAAK,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,gCAAgC,EAChC,qBAAqB,EACrB,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -14,4 +14,5 @@ export { setupBuildDirectories } from "./build/index.js";
|
|
|
14
14
|
export { cleanupCachesUtil, cleanupRendererUtil, logCompletion, performCleanup, } from "./build/index.js";
|
|
15
15
|
export { runCodeSplitting } from "./build/index.js";
|
|
16
16
|
export { copyAssets, generateClientScripts, generateManifestAndServiceWorker, generateRedirectsFile, } from "./build/index.js";
|
|
17
|
+
export { generateLocalReleaseAssetManifest, LOCAL_RELEASE_ASSET_MANIFEST_PATH, } from "./local-release-assets.js";
|
|
17
18
|
export { collectAllRoutes } from "./build/index.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RuntimeAdapter } from "../../platform/adapters/base.js";
|
|
2
|
+
import { type ReleaseAssetHttpDependencyVendor } from "../../release-assets/build-executor.js";
|
|
3
|
+
import type { ReleaseAssetManifest } from "../../release-assets/manifest-schema.js";
|
|
4
|
+
export declare const LOCAL_RELEASE_ASSET_MANIFEST_PATH = "_veryfront/release-asset-manifest.json";
|
|
5
|
+
export interface LocalReleaseAssetOptions {
|
|
6
|
+
adapter: RuntimeAdapter;
|
|
7
|
+
projectDir: string;
|
|
8
|
+
outputDir: string;
|
|
9
|
+
dryRun: boolean;
|
|
10
|
+
projectId?: string;
|
|
11
|
+
releaseId?: string;
|
|
12
|
+
vendorHttpImports?: ReleaseAssetHttpDependencyVendor;
|
|
13
|
+
}
|
|
14
|
+
export declare function generateLocalReleaseAssetManifest(options: LocalReleaseAssetOptions): Promise<ReleaseAssetManifest | null>;
|
|
15
|
+
//# sourceMappingURL=local-release-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-release-assets.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/local-release-assets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAOtE,OAAO,EAIL,KAAK,gCAAgC,EACtC,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAKpF,eAAO,MAAM,iCAAiC,2CAA2C,CAAC;AAE1F,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CACtD;AAoBD,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA8EtC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { dirname, join } from "../../platform/compat/path/index.js";
|
|
2
|
+
import { getHostEnv } from "../../platform/compat/process.js";
|
|
3
|
+
import { RELEASE_ASSET_BASE_PATH, RELEASE_ASSET_DEPENDENCY_IMPORT_MAP_ENV_FLAG, RELEASE_ASSET_MANIFEST_SCHEMA_VERSION, } from "../../release-assets/constants.js";
|
|
4
|
+
import { buildCachedHttpDependencyAssets, buildReactImportMapDependencyAssets, } from "../../release-assets/build-executor.js";
|
|
5
|
+
import { sha256HexBytes } from "../../release-assets/hash.js";
|
|
6
|
+
import { resolveProjectReactVersion } from "../../transforms/esm/package-registry.js";
|
|
7
|
+
import { VERSION } from "../../utils/version.js";
|
|
8
|
+
export const LOCAL_RELEASE_ASSET_MANIFEST_PATH = "_veryfront/release-asset-manifest.json";
|
|
9
|
+
function shouldBuildLocalDependencyAssets() {
|
|
10
|
+
return getHostEnv(RELEASE_ASSET_DEPENDENCY_IMPORT_MAP_ENV_FLAG) === "1";
|
|
11
|
+
}
|
|
12
|
+
function errorMessage(error) {
|
|
13
|
+
return error instanceof Error ? error.message : String(error);
|
|
14
|
+
}
|
|
15
|
+
async function writePreparedAsset(adapter, outputDir, asset) {
|
|
16
|
+
const assetPath = join(outputDir, RELEASE_ASSET_BASE_PATH, `${asset.contentHash}.js`);
|
|
17
|
+
await adapter.fs.mkdir(dirname(assetPath), { recursive: true });
|
|
18
|
+
await adapter.fs.writeFile(assetPath, new TextDecoder().decode(asset.bytes));
|
|
19
|
+
}
|
|
20
|
+
export async function generateLocalReleaseAssetManifest(options) {
|
|
21
|
+
if (!shouldBuildLocalDependencyAssets())
|
|
22
|
+
return null;
|
|
23
|
+
const tempDir = await options.adapter.fs.makeTempDir("vf-local-release-assets-");
|
|
24
|
+
try {
|
|
25
|
+
try {
|
|
26
|
+
const reactVersion = await resolveProjectReactVersion({ projectDir: options.projectDir });
|
|
27
|
+
const built = await buildReactImportMapDependencyAssets({
|
|
28
|
+
tempDir,
|
|
29
|
+
reactVersion,
|
|
30
|
+
vendorHttpImports: options.vendorHttpImports,
|
|
31
|
+
});
|
|
32
|
+
const cached = await buildCachedHttpDependencyAssets({
|
|
33
|
+
cacheDir: join(options.projectDir, ".cache", "veryfront-http-bundle"),
|
|
34
|
+
});
|
|
35
|
+
const dependencies = { ...cached.dependencies, ...built.dependencies };
|
|
36
|
+
const assetsByHash = new Map();
|
|
37
|
+
for (const asset of [...cached.assets, ...built.assets]) {
|
|
38
|
+
assetsByHash.set(asset.contentHash, asset);
|
|
39
|
+
}
|
|
40
|
+
const gaps = [...cached.gaps, ...built.gaps];
|
|
41
|
+
const sourceContentHash = await sha256HexBytes(new TextEncoder().encode([
|
|
42
|
+
options.projectDir,
|
|
43
|
+
reactVersion,
|
|
44
|
+
...Object.entries(dependencies)
|
|
45
|
+
.map(([specifier, entry]) => `${specifier}:${entry.contentHash}`)
|
|
46
|
+
.sort(),
|
|
47
|
+
].join("\n")));
|
|
48
|
+
const manifest = {
|
|
49
|
+
schemaVersion: RELEASE_ASSET_MANIFEST_SCHEMA_VERSION,
|
|
50
|
+
projectId: options.projectId ?? "local",
|
|
51
|
+
releaseId: options.releaseId ?? "standalone-dev",
|
|
52
|
+
releaseVersion: 0,
|
|
53
|
+
manifestVersion: 1,
|
|
54
|
+
builderVersion: VERSION,
|
|
55
|
+
sourceContentHash,
|
|
56
|
+
createdAt: new Date().toISOString(),
|
|
57
|
+
assetBasePath: RELEASE_ASSET_BASE_PATH,
|
|
58
|
+
modules: {},
|
|
59
|
+
css: [],
|
|
60
|
+
routes: {},
|
|
61
|
+
dependencies: Object.fromEntries(Object.entries(dependencies).map(([specifier, entry]) => [specifier, {
|
|
62
|
+
contentHash: entry.contentHash,
|
|
63
|
+
size: entry.size,
|
|
64
|
+
contentType: entry.contentType,
|
|
65
|
+
}])),
|
|
66
|
+
fallback: { mode: "jit", gaps },
|
|
67
|
+
};
|
|
68
|
+
if (options.dryRun)
|
|
69
|
+
return manifest;
|
|
70
|
+
await Promise.all([...assetsByHash.values()].map((asset) => writePreparedAsset(options.adapter, options.outputDir, asset)));
|
|
71
|
+
const manifestPath = join(options.outputDir, LOCAL_RELEASE_ASSET_MANIFEST_PATH);
|
|
72
|
+
await options.adapter.fs.mkdir(dirname(manifestPath), { recursive: true });
|
|
73
|
+
await options.adapter.fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2));
|
|
74
|
+
return manifest;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
throw new Error(`Failed to generate local release dependency assets: ${errorMessage(error)}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
await options.adapter.fs.remove(tempDir, { recursive: true }).catch(() => undefined);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-generation.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/static-generation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAa3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,KAAK,GAAG,WAAW,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"static-generation.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/static-generation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAa3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,KAAK,GAAG,WAAW,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAoID,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EAAE,EACnB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAqGnB;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAkDnB"}
|
|
@@ -27,6 +27,19 @@ function defaultTraceStep(_, fn) {
|
|
|
27
27
|
function getByteLength(text) {
|
|
28
28
|
return new TextEncoder().encode(text).length;
|
|
29
29
|
}
|
|
30
|
+
function extractClientNavigationHtml(html) {
|
|
31
|
+
const rootOpen = html.match(/<div\b(?=[^>]*\bid=(["'])root\1)[^>]*>/i);
|
|
32
|
+
if (!rootOpen || rootOpen.index === undefined)
|
|
33
|
+
return html;
|
|
34
|
+
const contentStart = rootOpen.index + rootOpen[0].length;
|
|
35
|
+
const portalsStart = html.indexOf('<div id="veryfront-portals"></div>', contentStart);
|
|
36
|
+
if (portalsStart === -1)
|
|
37
|
+
return html;
|
|
38
|
+
const rootClose = html.lastIndexOf("</div>", portalsStart);
|
|
39
|
+
if (rootClose < contentStart)
|
|
40
|
+
return html;
|
|
41
|
+
return html.slice(contentStart, rootClose);
|
|
42
|
+
}
|
|
30
43
|
const APP_ROUTE_STYLE_SOURCE_EXTENSIONS = [".tsx", ".jsx", ".ts", ".js", ".mdx", ".md"];
|
|
31
44
|
const APP_ROUTE_STYLE_SKIP_DIRS = new Set([
|
|
32
45
|
".deno_cache",
|
|
@@ -147,7 +160,7 @@ ${clientStyles}
|
|
|
147
160
|
path: route.path,
|
|
148
161
|
frontmatter: result.frontmatter,
|
|
149
162
|
headings: result.headings,
|
|
150
|
-
html:
|
|
163
|
+
html: extractClientNavigationHtml(enhancedHtml),
|
|
151
164
|
};
|
|
152
165
|
const dataPath = join(outputDir, "_veryfront/data", `${route.slug}.json`);
|
|
153
166
|
await adapter.fs.mkdir(dirname(dataPath), { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,aAAa,8KACmJ,CAAC;AAE9K,eAAO,MAAM,oBAAoB,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,aAAa,8KACmJ,CAAC;AAE9K,eAAO,MAAM,oBAAoB,EAAE,MAAM,GAAG,SACy42B,CAAC;AAEt72B,eAAO,MAAM,sBAAsB,EAAE,MAAM,GAAG,SAC630B,CAAC"}
|