@analogjs/vite-plugin-nitro 3.0.0-alpha.7 → 3.0.0-alpha.9
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/package.json +3 -6
- package/src/index.d.ts +1 -1
- package/src/index.js +6 -2
- package/src/index.js.map +1 -1
- package/src/lib/build-server.js +97 -140
- package/src/lib/build-server.js.map +1 -1
- package/src/lib/build-sitemap.js +48 -60
- package/src/lib/build-sitemap.js.map +1 -1
- package/src/lib/build-ssr.js +16 -18
- package/src/lib/build-ssr.js.map +1 -1
- package/src/lib/hooks/post-rendering-hook.js +10 -6
- package/src/lib/hooks/post-rendering-hook.js.map +1 -1
- package/src/lib/options.d.ts +8 -0
- package/src/lib/plugins/dev-server-plugin.js +91 -101
- package/src/lib/plugins/dev-server-plugin.js.map +1 -1
- package/src/lib/plugins/page-endpoints.js +26 -46
- package/src/lib/plugins/page-endpoints.js.map +1 -1
- package/src/lib/utils/get-content-files.js +88 -97
- package/src/lib/utils/get-content-files.js.map +1 -1
- package/src/lib/utils/get-page-handlers.js +70 -84
- package/src/lib/utils/get-page-handlers.js.map +1 -1
- package/src/lib/utils/node-web-bridge.js +34 -45
- package/src/lib/utils/node-web-bridge.js.map +1 -1
- package/src/lib/utils/register-dev-middleware.js +41 -47
- package/src/lib/utils/register-dev-middleware.js.map +1 -1
- package/src/lib/utils/renderers.js +55 -51
- package/src/lib/utils/renderers.js.map +1 -1
- package/src/lib/utils/rolldown.d.ts +2 -0
- package/src/lib/utils/rolldown.js +12 -0
- package/src/lib/utils/rolldown.js.map +1 -0
- package/src/lib/vite-plugin-nitro.js +442 -676
- package/src/lib/vite-plugin-nitro.js.map +1 -1
- package/README.md +0 -125
- package/src/lib/options.js +0 -2
- package/src/lib/options.js.map +0 -1
- package/src/lib/utils/load-esm.js +0 -23
- package/src/lib/utils/load-esm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/vite-plugin-nitro",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.9",
|
|
4
4
|
"description": "A Vite plugin for adding a nitro API server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Brandon Roberts <robertsbt@gmail.com>",
|
|
@@ -56,8 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public",
|
|
58
58
|
"provenance": true
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
"module": "./src/index.js",
|
|
62
|
-
"main": "./src/index.js"
|
|
63
|
-
}
|
|
59
|
+
}
|
|
60
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nitro } from './lib/vite-plugin-nitro.js';
|
|
2
|
-
export { Options, SitemapConfig, PrerenderRouteConfig, PrerenderContentDir, PrerenderContentFile, } from './lib/options.js';
|
|
2
|
+
export type { Options, SitemapConfig, PrerenderRouteConfig, PrerenderContentDir, PrerenderContentFile, } from './lib/options.js';
|
|
3
3
|
declare module 'nitro/types' {
|
|
4
4
|
interface NitroRouteConfig {
|
|
5
5
|
ssr?: boolean;
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { nitro } from
|
|
2
|
-
|
|
1
|
+
import { nitro } from "./lib/vite-plugin-nitro.js";
|
|
2
|
+
//#region packages/vite-plugin-nitro/src/index.ts
|
|
3
|
+
var src_default = nitro;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { src_default as default };
|
|
6
|
+
|
|
3
7
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../packages/vite-plugin-nitro/src/index.ts"],"sourcesContent":["import { nitro } from './lib/vite-plugin-nitro.js';\nexport type {\n Options,\n SitemapConfig,\n PrerenderRouteConfig,\n PrerenderContentDir,\n PrerenderContentFile,\n} from './lib/options.js';\n\ndeclare module 'nitro/types' {\n interface NitroRouteConfig {\n ssr?: boolean;\n }\n\n interface NitroRouteRules {\n ssr?: boolean;\n }\n}\n\nexport default nitro;\n"],"mappings":";;AAmBA,IAAA,cAAe"}
|
package/src/lib/build-server.js
CHANGED
|
@@ -1,152 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { dirname, join } from
|
|
4
|
-
import {
|
|
1
|
+
import { addPostRenderingHooks } from "./hooks/post-rendering-hook.js";
|
|
2
|
+
import { build, copyPublicAssets, createNitro, prepare, prerender } from "nitro/builder";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
//#region packages/vite-plugin-nitro/src/lib/build-server.ts
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
* Ensures a minimal `tsconfig.json` exists in the SSR output directory.
|
|
8
|
+
*
|
|
9
|
+
* Nitro v3's `nitro:oxc` Rollup plugin uses OXC's resolver for every
|
|
10
|
+
* file it transforms. OXC walks up the directory tree looking for a
|
|
11
|
+
* `tsconfig.json` to load path aliases. The SSR output directory
|
|
12
|
+
* (`dist/<app>/ssr/`) is outside the source tree, so no tsconfig
|
|
13
|
+
* exists there. On Windows, OXC's upward directory walk also fails to
|
|
14
|
+
* reach the project root's tsconfig due to path normalisation issues,
|
|
15
|
+
* causing:
|
|
16
|
+
*
|
|
17
|
+
* [TSCONFIG_ERROR] Failed to load tsconfig for
|
|
18
|
+
* '../../dist/apps/blog-app/ssr/main.server.js': Tsconfig not found
|
|
19
|
+
*
|
|
20
|
+
* Writing a minimal tsconfig satisfies the resolver without adding any
|
|
21
|
+
* path aliases that would interfere with Nitro's own module resolution.
|
|
22
|
+
*/
|
|
22
23
|
function ensureSsrTsconfig(nitroConfig) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (existsSync(tsconfigPath)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
writeFileSync(tsconfigPath, JSON.stringify({ compilerOptions: { module: 'ESNext', moduleResolution: 'bundler' } }, null, 2), 'utf8');
|
|
24
|
+
const ssrEntry = nitroConfig?.alias?.["#analog/ssr"];
|
|
25
|
+
if (!ssrEntry) return;
|
|
26
|
+
const tsconfigPath = join(dirname(ssrEntry.replace(/\//g, join("a", "b")[1])), "tsconfig.json");
|
|
27
|
+
if (existsSync(tsconfigPath)) return;
|
|
28
|
+
writeFileSync(tsconfigPath, JSON.stringify({ compilerOptions: {
|
|
29
|
+
module: "ESNext",
|
|
30
|
+
moduleResolution: "bundler"
|
|
31
|
+
} }, null, 2), "utf8");
|
|
35
32
|
}
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
function isVercelPreset(preset) {
|
|
34
|
+
return !!preset?.toLowerCase().includes("vercel");
|
|
38
35
|
}
|
|
39
36
|
function getVercelBuildConfigPath(nitro) {
|
|
40
|
-
|
|
37
|
+
return join(nitro.options.output.dir, "config.json");
|
|
41
38
|
}
|
|
42
39
|
function assertValidVercelBuildConfig(nitro) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
JSON.parse(buildConfig);
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
const symptomError = new Error(`Nitro generated an invalid Vercel build output config at "${buildConfigPath}": ${error instanceof Error ? error.message : String(error)}`);
|
|
59
|
-
symptomError.cause = error;
|
|
60
|
-
throw symptomError;
|
|
61
|
-
}
|
|
40
|
+
if (!isVercelPreset(nitro.options.preset)) return;
|
|
41
|
+
const buildConfigPath = getVercelBuildConfigPath(nitro);
|
|
42
|
+
if (!existsSync(buildConfigPath)) throw new Error(`Nitro did not generate the expected Vercel build output config at "${buildConfigPath}".`);
|
|
43
|
+
const buildConfig = readFileSync(buildConfigPath, "utf8").trim();
|
|
44
|
+
if (!buildConfig) throw new Error(`Nitro generated an empty Vercel build output config at "${buildConfigPath}".`);
|
|
45
|
+
try {
|
|
46
|
+
JSON.parse(buildConfig);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
const symptomError = /* @__PURE__ */ new Error(`Nitro generated an invalid Vercel build output config at "${buildConfigPath}": ${error instanceof Error ? error.message : String(error)}`);
|
|
49
|
+
symptomError.cause = error;
|
|
50
|
+
throw symptomError;
|
|
51
|
+
}
|
|
62
52
|
}
|
|
63
53
|
function ensureVercelFunctionConfig(nitro) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
shouldAddHelpers: false,
|
|
77
|
-
supportsResponseStreaming: true,
|
|
78
|
-
...nitro.options.vercel?.functions,
|
|
79
|
-
}, null, 2), 'utf8');
|
|
54
|
+
if (!isVercelPreset(nitro.options.preset)) return;
|
|
55
|
+
const serverDir = nitro.options.output.serverDir;
|
|
56
|
+
const functionConfigPath = join(serverDir, ".vc-config.json");
|
|
57
|
+
if (existsSync(functionConfigPath)) return;
|
|
58
|
+
mkdirSync(serverDir, { recursive: true });
|
|
59
|
+
writeFileSync(functionConfigPath, JSON.stringify({
|
|
60
|
+
handler: "index.mjs",
|
|
61
|
+
launcherType: "Nodejs",
|
|
62
|
+
shouldAddHelpers: false,
|
|
63
|
+
supportsResponseStreaming: true,
|
|
64
|
+
...nitro.options.vercel?.functions
|
|
65
|
+
}, null, 2), "utf8");
|
|
80
66
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
nitroConfig?.prerender?.routes?.length === 0)) {
|
|
120
|
-
const indexFileExts = ['', '.br', '.gz'];
|
|
121
|
-
indexFileExts.forEach((fileExt) => {
|
|
122
|
-
// Remove the root index.html(.br|.gz) files
|
|
123
|
-
const indexFilePath = join(nitroConfig?.output?.publicDir ?? '', `index.html${fileExt}`);
|
|
124
|
-
rmSync(indexFilePath, { force: true });
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (nitroConfig?.prerender?.routes &&
|
|
128
|
-
nitroConfig?.prerender?.routes?.length > 0) {
|
|
129
|
-
console.log(`Prerendering static pages...`);
|
|
130
|
-
await prerender(nitro);
|
|
131
|
-
}
|
|
132
|
-
if (routeSourceFiles && Object.keys(routeSourceFiles).length > 0) {
|
|
133
|
-
const publicDir = nitroConfig?.output?.publicDir;
|
|
134
|
-
if (!publicDir) {
|
|
135
|
-
throw new Error('Nitro public output directory is required to write route source files.');
|
|
136
|
-
}
|
|
137
|
-
for (const [route, content] of Object.entries(routeSourceFiles)) {
|
|
138
|
-
const outputPath = join(publicDir, `${route}.md`);
|
|
139
|
-
const outputDir = dirname(outputPath);
|
|
140
|
-
mkdirSync(outputDir, { recursive: true });
|
|
141
|
-
writeFileSync(outputPath, content, 'utf8');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (!options?.static) {
|
|
145
|
-
console.log('Building Server...');
|
|
146
|
-
await build(nitro);
|
|
147
|
-
ensureVercelFunctionConfig(nitro);
|
|
148
|
-
}
|
|
149
|
-
await nitro.close();
|
|
150
|
-
assertValidVercelBuildConfig(nitro);
|
|
67
|
+
async function buildServer(options, nitroConfig, routeSourceFiles) {
|
|
68
|
+
ensureSsrTsconfig(nitroConfig);
|
|
69
|
+
const nitro = await createNitro({
|
|
70
|
+
dev: false,
|
|
71
|
+
preset: process.env["BUILD_PRESET"],
|
|
72
|
+
...nitroConfig,
|
|
73
|
+
builder: nitroConfig?.builder ?? "rollup"
|
|
74
|
+
});
|
|
75
|
+
if (options?.prerender?.postRenderingHooks) addPostRenderingHooks(nitro, options.prerender.postRenderingHooks);
|
|
76
|
+
await prepare(nitro);
|
|
77
|
+
await copyPublicAssets(nitro);
|
|
78
|
+
if (options?.ssr && nitroConfig?.prerender?.routes && (nitroConfig?.prerender?.routes.find((route) => route === "/") || nitroConfig?.prerender?.routes?.length === 0)) [
|
|
79
|
+
"",
|
|
80
|
+
".br",
|
|
81
|
+
".gz"
|
|
82
|
+
].forEach((fileExt) => {
|
|
83
|
+
rmSync(join(nitroConfig?.output?.publicDir ?? "", `index.html${fileExt}`), { force: true });
|
|
84
|
+
});
|
|
85
|
+
if (nitroConfig?.prerender?.routes && nitroConfig?.prerender?.routes?.length > 0) {
|
|
86
|
+
console.log(`Prerendering static pages...`);
|
|
87
|
+
await prerender(nitro);
|
|
88
|
+
}
|
|
89
|
+
if (routeSourceFiles && Object.keys(routeSourceFiles).length > 0) {
|
|
90
|
+
const publicDir = nitroConfig?.output?.publicDir;
|
|
91
|
+
if (!publicDir) throw new Error("Nitro public output directory is required to write route source files.");
|
|
92
|
+
for (const [route, content] of Object.entries(routeSourceFiles)) {
|
|
93
|
+
const outputPath = join(publicDir, `${route}.md`);
|
|
94
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
95
|
+
writeFileSync(outputPath, content, "utf8");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!options?.static) {
|
|
99
|
+
console.log("Building Server...");
|
|
100
|
+
await build(nitro);
|
|
101
|
+
ensureVercelFunctionConfig(nitro);
|
|
102
|
+
}
|
|
103
|
+
await nitro.close();
|
|
104
|
+
assertValidVercelBuildConfig(nitro);
|
|
151
105
|
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { buildServer, isVercelPreset };
|
|
108
|
+
|
|
152
109
|
//# sourceMappingURL=build-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-server.js","
|
|
1
|
+
{"version":3,"file":"build-server.js","names":[],"sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-server.ts"],"sourcesContent":["import type { NitroConfig } from 'nitro/types';\nimport {\n build,\n copyPublicAssets,\n createNitro,\n prepare,\n prerender,\n} from 'nitro/builder';\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport { Options } from './options.js';\nimport { addPostRenderingHooks } from './hooks/post-rendering-hook.js';\n\n/**\n * Ensures a minimal `tsconfig.json` exists in the SSR output directory.\n *\n * Nitro v3's `nitro:oxc` Rollup plugin uses OXC's resolver for every\n * file it transforms. OXC walks up the directory tree looking for a\n * `tsconfig.json` to load path aliases. The SSR output directory\n * (`dist/<app>/ssr/`) is outside the source tree, so no tsconfig\n * exists there. On Windows, OXC's upward directory walk also fails to\n * reach the project root's tsconfig due to path normalisation issues,\n * causing:\n *\n * [TSCONFIG_ERROR] Failed to load tsconfig for\n * '../../dist/apps/blog-app/ssr/main.server.js': Tsconfig not found\n *\n * Writing a minimal tsconfig satisfies the resolver without adding any\n * path aliases that would interfere with Nitro's own module resolution.\n */\nfunction ensureSsrTsconfig(nitroConfig: NitroConfig | undefined) {\n const ssrEntry = nitroConfig?.alias?.['#analog/ssr'];\n if (!ssrEntry) {\n return;\n }\n\n // The alias value is a normalized absolute path (forward slashes on\n // all platforms). Convert to a native path for dirname().\n const ssrDir = dirname(ssrEntry.replace(/\\//g, join('a', 'b')[1]));\n const tsconfigPath = join(ssrDir, 'tsconfig.json');\n\n if (existsSync(tsconfigPath)) {\n return;\n }\n\n writeFileSync(\n tsconfigPath,\n JSON.stringify(\n { compilerOptions: { module: 'ESNext', moduleResolution: 'bundler' } },\n null,\n 2,\n ),\n 'utf8',\n );\n}\n\nexport function isVercelPreset(preset: string | undefined): boolean {\n return !!preset?.toLowerCase().includes('vercel');\n}\n\nfunction getVercelBuildConfigPath(\n nitro: Awaited<ReturnType<typeof createNitro>>,\n) {\n return join(nitro.options.output.dir, 'config.json');\n}\n\nfunction assertValidVercelBuildConfig(\n nitro: Awaited<ReturnType<typeof createNitro>>,\n) {\n if (!isVercelPreset(nitro.options.preset)) {\n return;\n }\n\n const buildConfigPath = getVercelBuildConfigPath(nitro);\n if (!existsSync(buildConfigPath)) {\n throw new Error(\n `Nitro did not generate the expected Vercel build output config at \"${buildConfigPath}\".`,\n );\n }\n\n const buildConfig = readFileSync(buildConfigPath, 'utf8').trim();\n if (!buildConfig) {\n throw new Error(\n `Nitro generated an empty Vercel build output config at \"${buildConfigPath}\".`,\n );\n }\n\n try {\n JSON.parse(buildConfig);\n } catch (error) {\n const symptomError = new Error(\n `Nitro generated an invalid Vercel build output config at \"${buildConfigPath}\": ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n\n (symptomError as Error & { cause?: unknown }).cause = error;\n throw symptomError;\n }\n}\n\nfunction ensureVercelFunctionConfig(\n nitro: Awaited<ReturnType<typeof createNitro>>,\n) {\n if (!isVercelPreset(nitro.options.preset)) {\n return;\n }\n\n const serverDir = nitro.options.output.serverDir;\n const functionConfigPath = join(serverDir, '.vc-config.json');\n\n if (existsSync(functionConfigPath)) {\n return;\n }\n\n mkdirSync(serverDir, { recursive: true });\n\n writeFileSync(\n functionConfigPath,\n JSON.stringify(\n {\n handler: 'index.mjs',\n launcherType: 'Nodejs',\n shouldAddHelpers: false,\n supportsResponseStreaming: true,\n ...nitro.options.vercel?.functions,\n },\n null,\n 2,\n ),\n 'utf8',\n );\n}\n\nexport async function buildServer(\n options?: Options,\n nitroConfig?: NitroConfig,\n routeSourceFiles?: Record<string, string>,\n): Promise<void> {\n // ── Ensure the SSR output has a tsconfig for OXC ─────────────────\n //\n // Must run before createNitro() so the tsconfig is on disk when the\n // nitro:oxc plugin initialises its resolver.\n ensureSsrTsconfig(nitroConfig);\n\n // ── Force Rollup as the server bundler ────────────────────────────\n //\n // Nitro v3 defaults to Rolldown when available. Rolldown is faster,\n // but its module resolver cannot resolve relative chunk imports\n // (e.g. `./assets/core-DTazUigR.js`) from a rebundled SSR entry on\n // Windows. The prerender build fails with:\n //\n // [RESOLVE_ERROR] Could not resolve './assets/core-DTazUigR.js'\n // in ../../dist/apps/blog-app/ssr/main.server.js\n //\n // This is a known Rolldown limitation with cross-directory relative\n // paths on Windows (backslash vs forward-slash normalisation).\n // Rollup handles these paths correctly on all platforms.\n //\n // The dev server already uses `builder: 'rollup'` for the same\n // reason. Default to Rollup here too until Rolldown's resolver\n // matures. The caller can still opt in to Rolldown explicitly via\n // nitroConfig.builder if their platform supports it.\n const nitro = await createNitro({\n dev: false,\n preset: process.env['BUILD_PRESET'],\n ...nitroConfig,\n builder: nitroConfig?.builder ?? 'rollup',\n });\n\n if (options?.prerender?.postRenderingHooks) {\n addPostRenderingHooks(nitro, options.prerender.postRenderingHooks);\n }\n\n await prepare(nitro);\n await copyPublicAssets(nitro);\n\n if (\n options?.ssr &&\n nitroConfig?.prerender?.routes &&\n (nitroConfig?.prerender?.routes.find((route) => route === '/') ||\n nitroConfig?.prerender?.routes?.length === 0)\n ) {\n const indexFileExts = ['', '.br', '.gz'];\n\n indexFileExts.forEach((fileExt) => {\n // Remove the root index.html(.br|.gz) files\n const indexFilePath = join(\n nitroConfig?.output?.publicDir ?? '',\n `index.html${fileExt}`,\n );\n\n rmSync(indexFilePath, { force: true });\n });\n }\n\n if (\n nitroConfig?.prerender?.routes &&\n nitroConfig?.prerender?.routes?.length > 0\n ) {\n console.log(`Prerendering static pages...`);\n await prerender(nitro);\n }\n\n if (routeSourceFiles && Object.keys(routeSourceFiles).length > 0) {\n const publicDir = nitroConfig?.output?.publicDir;\n if (!publicDir) {\n throw new Error(\n 'Nitro public output directory is required to write route source files.',\n );\n }\n\n for (const [route, content] of Object.entries(routeSourceFiles)) {\n const outputPath = join(publicDir, `${route}.md`);\n const outputDir = dirname(outputPath);\n mkdirSync(outputDir, { recursive: true });\n\n writeFileSync(outputPath, content, 'utf8');\n }\n }\n\n if (!options?.static) {\n console.log('Building Server...');\n await build(nitro);\n ensureVercelFunctionConfig(nitro);\n }\n\n await nitro.close();\n assertValidVercelBuildConfig(nitro);\n}\n"],"mappings":"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"}
|
package/src/lib/build-sitemap.js
CHANGED
|
@@ -1,68 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
catch (e) {
|
|
37
|
-
console.error(`Unable to write file at ${mapPath}`, e);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
|
+
import { create } from "xmlbuilder2";
|
|
4
|
+
//#region packages/vite-plugin-nitro/src/lib/build-sitemap.ts
|
|
5
|
+
async function buildSitemap(config, sitemapConfig, routes, outputDir, routeSitemaps) {
|
|
6
|
+
const routeList = await optionHasRoutes(routes);
|
|
7
|
+
if (routeList.length) {
|
|
8
|
+
const slash = checkSlash(sitemapConfig.host || "");
|
|
9
|
+
const sitemapData = routeList.map((page) => {
|
|
10
|
+
const url = `${slash}${page.replace(/^\/+/g, "")}`;
|
|
11
|
+
const config = routeSitemaps[url];
|
|
12
|
+
const props = typeof config === "object" ? config : config?.();
|
|
13
|
+
return {
|
|
14
|
+
page: `${sitemapConfig.host}${url}`,
|
|
15
|
+
lastMod: props?.lastmod ?? (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
16
|
+
changefreq: props?.changefreq,
|
|
17
|
+
priority: props?.priority
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const sitemap = createXml("urlset");
|
|
21
|
+
for (const item of sitemapData) {
|
|
22
|
+
const page = sitemap.ele("url");
|
|
23
|
+
page.ele("loc").txt(item.page);
|
|
24
|
+
page.ele("lastmod").txt(item.lastMod);
|
|
25
|
+
if (item.changefreq) page.ele("changefreq").txt(item.changefreq);
|
|
26
|
+
if (item.priority) page.ele("priority").txt(item.priority);
|
|
27
|
+
}
|
|
28
|
+
const mapPath = `${resolve(outputDir)}/sitemap.xml`;
|
|
29
|
+
try {
|
|
30
|
+
console.log(`Writing sitemap at ${mapPath}`);
|
|
31
|
+
writeFileSync(mapPath, sitemap.end({ prettyPrint: true }));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error(`Unable to write file at ${mapPath}`, e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
40
36
|
}
|
|
41
37
|
function createXml(elementName) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.com(`This file was automatically generated by Analog.`);
|
|
38
|
+
return create({
|
|
39
|
+
version: "1.0",
|
|
40
|
+
encoding: "UTF-8"
|
|
41
|
+
}).ele(elementName, { xmlns: "https://www.sitemaps.org/schemas/sitemap/0.9" }).com(`This file was automatically generated by Analog.`);
|
|
47
42
|
}
|
|
48
43
|
function checkSlash(host) {
|
|
49
|
-
|
|
50
|
-
return finalChar === '/' ? '' : '/';
|
|
44
|
+
return host.slice(-1) === "/" ? "" : "/";
|
|
51
45
|
}
|
|
52
46
|
async function optionHasRoutes(routes) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
else if (Array.isArray(routes)) {
|
|
59
|
-
// returns an array of strings
|
|
60
|
-
routeList = routes;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
// default it to an empty of array
|
|
64
|
-
routeList = [];
|
|
65
|
-
}
|
|
66
|
-
return routeList.filter(Boolean);
|
|
47
|
+
let routeList;
|
|
48
|
+
if (typeof routes === "function") routeList = await routes();
|
|
49
|
+
else if (Array.isArray(routes)) routeList = routes;
|
|
50
|
+
else routeList = [];
|
|
51
|
+
return routeList.filter(Boolean);
|
|
67
52
|
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { buildSitemap };
|
|
55
|
+
|
|
68
56
|
//# sourceMappingURL=build-sitemap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-sitemap.js","
|
|
1
|
+
{"version":3,"file":"build-sitemap.js","names":[],"sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-sitemap.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\nimport { XMLBuilder } from 'xmlbuilder2/lib/interfaces';\nimport { create } from 'xmlbuilder2';\nimport { UserConfig } from 'vite';\nimport { resolve } from 'node:path';\nimport {\n PrerenderContentFile,\n PrerenderSitemapConfig,\n SitemapConfig,\n} from './options';\n\nexport type PagesJson = {\n page: string;\n lastMod: string;\n changefreq?: string;\n priority?: string;\n};\n\nexport async function buildSitemap(\n config: UserConfig,\n sitemapConfig: SitemapConfig,\n routes: (string | undefined)[] | (() => Promise<(string | undefined)[]>),\n outputDir: string,\n routeSitemaps: Record<\n string,\n PrerenderSitemapConfig | (() => PrerenderSitemapConfig) | undefined\n >,\n): Promise<void> {\n const routeList: string[] = await optionHasRoutes(routes);\n\n if (routeList.length) {\n const slash = checkSlash(sitemapConfig.host || '');\n const sitemapData: PagesJson[] = routeList.map((page: string) => {\n const url = `${slash}${page.replace(/^\\/+/g, '')}`;\n const config = routeSitemaps[url];\n const props = typeof config === 'object' ? config : config?.();\n\n return {\n page: `${sitemapConfig.host}${url}`,\n lastMod: props?.lastmod ?? new Date().toISOString().split('T')[0],\n changefreq: props?.changefreq,\n priority: props?.priority,\n };\n });\n\n const sitemap = createXml('urlset');\n\n for (const item of sitemapData) {\n const page = sitemap.ele('url');\n page.ele('loc').txt(item.page);\n page.ele('lastmod').txt(item.lastMod);\n\n if (item.changefreq) {\n page.ele('changefreq').txt(item.changefreq);\n }\n\n if (item.priority) {\n page.ele('priority').txt(item.priority);\n }\n }\n\n const mapPath = `${resolve(outputDir)}/sitemap.xml`;\n try {\n console.log(`Writing sitemap at ${mapPath}`);\n writeFileSync(mapPath, sitemap.end({ prettyPrint: true }));\n } catch (e) {\n console.error(`Unable to write file at ${mapPath}`, e);\n }\n }\n}\n\nfunction createXml(elementName: 'urlset' | 'sitemapindex'): XMLBuilder {\n return create({ version: '1.0', encoding: 'UTF-8' })\n .ele(elementName, {\n xmlns: 'https://www.sitemaps.org/schemas/sitemap/0.9',\n })\n .com(`This file was automatically generated by Analog.`);\n}\n\nfunction checkSlash(host: string): string {\n const finalChar = host.slice(-1);\n return finalChar === '/' ? '' : '/';\n}\n\nasync function optionHasRoutes(\n routes: (string | undefined)[] | (() => Promise<(string | undefined)[]>),\n): Promise<string[]> {\n let routeList: (string | undefined)[];\n\n if (typeof routes === 'function') {\n // returns an array or undefined\n routeList = await routes();\n } else if (Array.isArray(routes)) {\n // returns an array of strings\n routeList = routes;\n } else {\n // default it to an empty of array\n routeList = [];\n }\n\n return routeList.filter(Boolean) as string[];\n}\n"],"mappings":";;;;AAkBA,eAAsB,aACpB,QACA,eACA,QACA,WACA,eAIe;CACf,MAAM,YAAsB,MAAM,gBAAgB,OAAO;AAEzD,KAAI,UAAU,QAAQ;EACpB,MAAM,QAAQ,WAAW,cAAc,QAAQ,GAAG;EAClD,MAAM,cAA2B,UAAU,KAAK,SAAiB;GAC/D,MAAM,MAAM,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;GAChD,MAAM,SAAS,cAAc;GAC7B,MAAM,QAAQ,OAAO,WAAW,WAAW,SAAS,UAAU;AAE9D,UAAO;IACL,MAAM,GAAG,cAAc,OAAO;IAC9B,SAAS,OAAO,4BAAW,IAAI,MAAM,EAAC,aAAa,CAAC,MAAM,IAAI,CAAC;IAC/D,YAAY,OAAO;IACnB,UAAU,OAAO;IAClB;IACD;EAEF,MAAM,UAAU,UAAU,SAAS;AAEnC,OAAK,MAAM,QAAQ,aAAa;GAC9B,MAAM,OAAO,QAAQ,IAAI,MAAM;AAC/B,QAAK,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK;AAC9B,QAAK,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ;AAErC,OAAI,KAAK,WACP,MAAK,IAAI,aAAa,CAAC,IAAI,KAAK,WAAW;AAG7C,OAAI,KAAK,SACP,MAAK,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS;;EAI3C,MAAM,UAAU,GAAG,QAAQ,UAAU,CAAC;AACtC,MAAI;AACF,WAAQ,IAAI,sBAAsB,UAAU;AAC5C,iBAAc,SAAS,QAAQ,IAAI,EAAE,aAAa,MAAM,CAAC,CAAC;WACnD,GAAG;AACV,WAAQ,MAAM,2BAA2B,WAAW,EAAE;;;;AAK5D,SAAS,UAAU,aAAoD;AACrE,QAAO,OAAO;EAAE,SAAS;EAAO,UAAU;EAAS,CAAC,CACjD,IAAI,aAAa,EAChB,OAAO,gDACR,CAAC,CACD,IAAI,mDAAmD;;AAG5D,SAAS,WAAW,MAAsB;AAExC,QADkB,KAAK,MAAM,GAAG,KACX,MAAM,KAAK;;AAGlC,eAAe,gBACb,QACmB;CACnB,IAAI;AAEJ,KAAI,OAAO,WAAW,WAEpB,aAAY,MAAM,QAAQ;UACjB,MAAM,QAAQ,OAAO,CAE9B,aAAY;KAGZ,aAAY,EAAE;AAGhB,QAAO,UAAU,OAAO,QAAQ"}
|
package/src/lib/build-ssr.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { relative, resolve } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
outDir: options?.ssrBuildDir || resolve(workspaceRoot, 'dist', rootDir, 'ssr'),
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
await build(ssrBuildConfig);
|
|
1
|
+
import { getBundleOptionsKey } from "./utils/rolldown.js";
|
|
2
|
+
import { build, mergeConfig } from "vite";
|
|
3
|
+
import { relative, resolve } from "node:path";
|
|
4
|
+
//#region packages/vite-plugin-nitro/src/lib/build-ssr.ts
|
|
5
|
+
async function buildSSRApp(config, options) {
|
|
6
|
+
const workspaceRoot = options?.workspaceRoot ?? process.cwd();
|
|
7
|
+
const sourceRoot = options?.sourceRoot ?? "src";
|
|
8
|
+
const rootDir = relative(workspaceRoot, config.root || ".") || ".";
|
|
9
|
+
await build(mergeConfig(config, { build: {
|
|
10
|
+
ssr: true,
|
|
11
|
+
[getBundleOptionsKey()]: { input: options?.entryServer || resolve(workspaceRoot, rootDir, `${sourceRoot}/main.server.ts`) },
|
|
12
|
+
outDir: options?.ssrBuildDir || resolve(workspaceRoot, "dist", rootDir, "ssr")
|
|
13
|
+
} }));
|
|
19
14
|
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { buildSSRApp };
|
|
17
|
+
|
|
20
18
|
//# sourceMappingURL=build-ssr.js.map
|
package/src/lib/build-ssr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssr.js","
|
|
1
|
+
{"version":3,"file":"build-ssr.js","names":[],"sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-ssr.ts"],"sourcesContent":["import { build, mergeConfig, UserConfig } from 'vite';\nimport { relative, resolve } from 'node:path';\n\nimport { Options } from './options.js';\nimport { getBundleOptionsKey } from './utils/rolldown.js';\n\nexport async function buildSSRApp(\n config: UserConfig,\n options?: Options,\n): Promise<void> {\n const workspaceRoot = options?.workspaceRoot ?? process.cwd();\n const sourceRoot = options?.sourceRoot ?? 'src';\n const rootDir = relative(workspaceRoot, config.root || '.') || '.';\n const bundleOptionsKey = getBundleOptionsKey();\n const ssrBuildConfig = mergeConfig(config, <UserConfig>{\n build: {\n ssr: true,\n [bundleOptionsKey]: {\n input:\n options?.entryServer ||\n resolve(workspaceRoot, rootDir, `${sourceRoot}/main.server.ts`),\n },\n outDir:\n options?.ssrBuildDir || resolve(workspaceRoot, 'dist', rootDir, 'ssr'),\n },\n });\n\n await build(ssrBuildConfig);\n}\n"],"mappings":";;;;AAMA,eAAsB,YACpB,QACA,SACe;CACf,MAAM,gBAAgB,SAAS,iBAAiB,QAAQ,KAAK;CAC7D,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,UAAU,SAAS,eAAe,OAAO,QAAQ,IAAI,IAAI;AAe/D,OAAM,MAbiB,YAAY,QAAoB,EACrD,OAAO;EACL,KAAK;GAHgB,qBAAqB,GAItB,EAClB,OACE,SAAS,eACT,QAAQ,eAAe,SAAS,GAAG,WAAW,iBAAiB,EAClE;EACD,QACE,SAAS,eAAe,QAAQ,eAAe,QAAQ,SAAS,MAAM;EACzE,EACF,CAAC,CAEyB"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region packages/vite-plugin-nitro/src/lib/hooks/post-rendering-hook.ts
|
|
2
|
+
function addPostRenderingHooks(nitro, hooks) {
|
|
3
|
+
hooks.forEach((hook) => {
|
|
4
|
+
nitro.hooks.hook("prerender:generate", (route) => {
|
|
5
|
+
hook(route);
|
|
6
|
+
});
|
|
7
|
+
});
|
|
7
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { addPostRenderingHooks };
|
|
11
|
+
|
|
8
12
|
//# sourceMappingURL=post-rendering-hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-rendering-hook.js","
|
|
1
|
+
{"version":3,"file":"post-rendering-hook.js","names":[],"sources":["../../../../../../packages/vite-plugin-nitro/src/lib/hooks/post-rendering-hook.ts"],"sourcesContent":["import type { Nitro, PrerenderRoute } from 'nitro/types';\n\nexport function addPostRenderingHooks(\n nitro: Nitro,\n hooks: ((pr: PrerenderRoute) => Promise<void>)[],\n): void {\n hooks.forEach((hook: (preRoute: PrerenderRoute) => void) => {\n nitro.hooks.hook('prerender:generate', (route: PrerenderRoute) => {\n hook(route);\n });\n });\n}\n"],"mappings":";AAEA,SAAgB,sBACd,OACA,OACM;AACN,OAAM,SAAS,SAA6C;AAC1D,QAAM,MAAM,KAAK,uBAAuB,UAA0B;AAChE,QAAK,MAAM;IACX;GACF"}
|
package/src/lib/options.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrerenderRoute } from 'nitro/types';
|
|
2
|
+
import type { UserConfig } from 'vite';
|
|
2
3
|
export interface Options {
|
|
3
4
|
ssr?: boolean;
|
|
4
5
|
ssrBuildDir?: string;
|
|
@@ -36,6 +37,13 @@ export interface Options {
|
|
|
36
37
|
* for API routes.
|
|
37
38
|
*/
|
|
38
39
|
useAPIMiddleware?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Vite-native build passthrough. Rolldown-only options such as
|
|
42
|
+
* `build.rolldownOptions.output.codeSplitting` are forwarded when present.
|
|
43
|
+
*/
|
|
44
|
+
vite?: {
|
|
45
|
+
build?: UserConfig['build'];
|
|
46
|
+
};
|
|
39
47
|
}
|
|
40
48
|
export interface PrerenderOptions {
|
|
41
49
|
/**
|