@analogjs/vite-plugin-nitro 1.0.0-beta.1 → 1.0.0-beta.3
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 +1 -1
- package/src/lib/build-server.js +24 -24
- package/src/lib/build-server.js.map +1 -1
- package/src/lib/build-sitemap.d.ts +1 -1
- package/src/lib/build-sitemap.js +37 -42
- package/src/lib/build-sitemap.js.map +1 -1
- package/src/lib/build-ssr.js +11 -15
- package/src/lib/build-ssr.js.map +1 -1
- package/src/lib/options.d.ts +28 -1
- package/src/lib/plugins/dev-server-plugin.js +10 -8
- package/src/lib/plugins/dev-server-plugin.js.map +1 -1
- package/src/lib/plugins/page-endpoints.js +29 -33
- package/src/lib/plugins/page-endpoints.js.map +1 -1
- package/src/lib/utils/get-content-files.d.ts +2 -0
- package/src/lib/utils/get-content-files.js +36 -0
- package/src/lib/utils/get-content-files.js.map +1 -0
- package/src/lib/vite-nitro-plugin.spec.data.js +14 -19
- package/src/lib/vite-nitro-plugin.spec.data.js.map +1 -1
- package/src/lib/vite-plugin-nitro.js +168 -127
- package/src/lib/vite-plugin-nitro.js.map +1 -1
package/package.json
CHANGED
package/src/lib/build-server.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { copyPublicAssets, prerender } from 'nitropack';
|
|
3
2
|
import { createNitro, build, prepare } from 'nitropack';
|
|
4
3
|
import * as fs from 'fs';
|
|
5
4
|
import { addPostRenderingHooks } from './hooks/post-rendering-hook.js';
|
|
6
|
-
export function buildServer(options, nitroConfig) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
addPostRenderingHooks(nitro, options.prerender.postRenderingHooks);
|
|
12
|
-
}
|
|
13
|
-
yield prepare(nitro);
|
|
14
|
-
yield copyPublicAssets(nitro);
|
|
15
|
-
if (((_b = nitroConfig === null || nitroConfig === void 0 ? void 0 : nitroConfig.prerender) === null || _b === void 0 ? void 0 : _b.routes) &&
|
|
16
|
-
((_c = nitroConfig === null || nitroConfig === void 0 ? void 0 : nitroConfig.prerender) === null || _c === void 0 ? void 0 : _c.routes.find((route) => route === '/'))) {
|
|
17
|
-
// Remove the root index.html so it can be replaced with the prerendered version
|
|
18
|
-
if (fs.existsSync(`${(_d = nitroConfig === null || nitroConfig === void 0 ? void 0 : nitroConfig.output) === null || _d === void 0 ? void 0 : _d.publicDir}/index.html`)) {
|
|
19
|
-
fs.unlinkSync(`${(_e = nitroConfig === null || nitroConfig === void 0 ? void 0 : nitroConfig.output) === null || _e === void 0 ? void 0 : _e.publicDir}/index.html`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
console.log(`Prerendering static pages...`);
|
|
23
|
-
yield prerender(nitro);
|
|
24
|
-
if (!(options === null || options === void 0 ? void 0 : options.static)) {
|
|
25
|
-
console.log('Building Server...');
|
|
26
|
-
yield build(nitro);
|
|
27
|
-
}
|
|
28
|
-
yield nitro.close();
|
|
5
|
+
export async function buildServer(options, nitroConfig) {
|
|
6
|
+
const nitro = await createNitro({
|
|
7
|
+
dev: false,
|
|
8
|
+
preset: process.env['BUILD_PRESET'],
|
|
9
|
+
...nitroConfig,
|
|
29
10
|
});
|
|
11
|
+
if (options?.prerender?.postRenderingHooks) {
|
|
12
|
+
addPostRenderingHooks(nitro, options.prerender.postRenderingHooks);
|
|
13
|
+
}
|
|
14
|
+
await prepare(nitro);
|
|
15
|
+
await copyPublicAssets(nitro);
|
|
16
|
+
if (nitroConfig?.prerender?.routes &&
|
|
17
|
+
nitroConfig?.prerender?.routes.find((route) => route === '/')) {
|
|
18
|
+
// Remove the root index.html so it can be replaced with the prerendered version
|
|
19
|
+
if (fs.existsSync(`${nitroConfig?.output?.publicDir}/index.html`)) {
|
|
20
|
+
fs.unlinkSync(`${nitroConfig?.output?.publicDir}/index.html`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
console.log(`Prerendering static pages...`);
|
|
24
|
+
await prerender(nitro);
|
|
25
|
+
if (!options?.static) {
|
|
26
|
+
console.log('Building Server...');
|
|
27
|
+
await build(nitro);
|
|
28
|
+
}
|
|
29
|
+
await nitro.close();
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=build-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-server.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-server.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAiB,EACjB,WAAyB;IAEzB,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC;QAC9B,GAAG,EAAE,KAAK;QACV,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QACnC,GAAG,WAAW;KACf,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE;QAC1C,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;KACpE;IAED,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;IACrB,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE9B,IACE,WAAW,EAAE,SAAS,EAAE,MAAM;QAC9B,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,EAC7D;QACA,gFAAgF;QAChF,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,WAAW,EAAE,MAAM,EAAE,SAAS,aAAa,CAAC,EAAE;YACjE,EAAE,CAAC,UAAU,CAAC,GAAG,WAAW,EAAE,MAAM,EAAE,SAAS,aAAa,CAAC,CAAC;SAC/D;KACF;IAED,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;IAEvB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE;QACpB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;KACpB;IAED,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -4,4 +4,4 @@ export type PagesJson = {
|
|
|
4
4
|
page: string;
|
|
5
5
|
lastMod: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function buildSitemap(config: UserConfig, sitemapConfig: SitemapConfig, routes: string[] | (() => Promise<(string | undefined)[]>), outputDir: string): Promise<void>;
|
|
7
|
+
export declare function buildSitemap(config: UserConfig, sitemapConfig: SitemapConfig, routes: (string | undefined)[] | (() => Promise<(string | undefined)[]>), outputDir: string): Promise<void>;
|
package/src/lib/build-sitemap.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import * as fs from 'fs';
|
|
3
2
|
import { create } from 'xmlbuilder2';
|
|
4
3
|
import * as path from 'path';
|
|
5
|
-
export function buildSitemap(config, sitemapConfig, routes, outputDir) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
page.ele('lastmod').txt(item.lastMod);
|
|
19
|
-
}
|
|
20
|
-
const mapPath = `${path.resolve(outputDir)}/sitemap.xml`;
|
|
21
|
-
try {
|
|
22
|
-
console.log(`Writing sitemap at ${mapPath}`);
|
|
23
|
-
fs.writeFileSync(mapPath, sitemap.end({ prettyPrint: true }));
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
console.error(`Unable to write file at ${mapPath}`, e);
|
|
27
|
-
}
|
|
4
|
+
export async function buildSitemap(config, sitemapConfig, routes, outputDir) {
|
|
5
|
+
const routeList = await optionHasRoutes(routes);
|
|
6
|
+
if (routeList.length) {
|
|
7
|
+
const slash = checkSlash(sitemapConfig.host);
|
|
8
|
+
const sitemapData = routeList.map((page) => ({
|
|
9
|
+
page: `${sitemapConfig.host}${slash}${page.replace(/^\/+/g, '')}`,
|
|
10
|
+
lastMod: new Date().toISOString().split('T')[0],
|
|
11
|
+
}));
|
|
12
|
+
const sitemap = createXml('urlset');
|
|
13
|
+
for (const item of sitemapData) {
|
|
14
|
+
const page = sitemap.ele('url');
|
|
15
|
+
page.ele('loc').txt(item.page);
|
|
16
|
+
page.ele('lastmod').txt(item.lastMod);
|
|
28
17
|
}
|
|
29
|
-
|
|
18
|
+
const mapPath = `${path.resolve(outputDir)}/sitemap.xml`;
|
|
19
|
+
try {
|
|
20
|
+
console.log(`Writing sitemap at ${mapPath}`);
|
|
21
|
+
fs.writeFileSync(mapPath, sitemap.end({ prettyPrint: true }));
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error(`Unable to write file at ${mapPath}`, e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
30
27
|
}
|
|
31
28
|
function createXml(elementName) {
|
|
32
29
|
return create({ version: '1.0', encoding: 'UTF-8' })
|
|
@@ -39,22 +36,20 @@ function checkSlash(host) {
|
|
|
39
36
|
const finalChar = host.slice(-1);
|
|
40
37
|
return finalChar === '/' ? '' : '/';
|
|
41
38
|
}
|
|
42
|
-
function optionHasRoutes(routes) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return routeList;
|
|
58
|
-
});
|
|
39
|
+
async function optionHasRoutes(routes) {
|
|
40
|
+
let routeList;
|
|
41
|
+
if (typeof routes === 'function') {
|
|
42
|
+
// returns an array or undefined
|
|
43
|
+
routeList = await routes();
|
|
44
|
+
}
|
|
45
|
+
else if (Array.isArray(routes)) {
|
|
46
|
+
// returns an array of strings
|
|
47
|
+
routeList = routes;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// default it to an empty of array
|
|
51
|
+
routeList = [];
|
|
52
|
+
}
|
|
53
|
+
return routeList.filter(Boolean);
|
|
59
54
|
}
|
|
60
55
|
//# sourceMappingURL=build-sitemap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-sitemap.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-sitemap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-sitemap.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAS7B,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAkB,EAClB,aAA4B,EAC5B,MAAwE,EACxE,SAAiB;IAEjB,MAAM,SAAS,GAAa,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAE1D,IAAI,SAAS,CAAC,MAAM,EAAE;QACpB,MAAM,KAAK,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAgB,SAAS,CAAC,GAAG,CAAC,CAAC,IAA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AC;AAC7D,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AACtC,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,MAAwE;IAExE,IAAI,SAAiC,CAAC;IAEtC,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;QAChC,gCAAgC;QAChC,SAAS,GAAG,MAAM,MAAM,EAAE,CAAC;KAC5B;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAChC,8BAA8B;QAC9B,SAAS,GAAG,MAAM,CAAC;KACpB;SAAM;QACL,kCAAkC;QAClC,SAAS,GAAG,EAAE,CAAC;KAChB;IAED,OAAO,SAAS,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;AAC/C,CAAC"}
|
package/src/lib/build-ssr.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { build, mergeConfig } from 'vite';
|
|
3
2
|
import * as path from 'path';
|
|
4
|
-
export function buildSSRApp(config, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
rollupOptions: {
|
|
13
|
-
input: (options === null || options === void 0 ? void 0 : options.entryServer) || path.resolve(rootDir, './src/main.server.ts'),
|
|
14
|
-
},
|
|
15
|
-
outDir: (options === null || options === void 0 ? void 0 : options.ssrBuildDir) || path.resolve('dist', rootDir, 'ssr'),
|
|
3
|
+
export async function buildSSRApp(config, options) {
|
|
4
|
+
const workspaceRoot = options?.workspaceRoot ?? process.cwd();
|
|
5
|
+
const rootDir = path.relative(workspaceRoot, config.root || '.') || '.';
|
|
6
|
+
const ssrBuildConfig = mergeConfig(config, {
|
|
7
|
+
build: {
|
|
8
|
+
ssr: true,
|
|
9
|
+
rollupOptions: {
|
|
10
|
+
input: options?.entryServer || path.resolve(rootDir, './src/main.server.ts'),
|
|
16
11
|
},
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
outDir: options?.ssrBuildDir || path.resolve('dist', rootDir, 'ssr'),
|
|
13
|
+
},
|
|
19
14
|
});
|
|
15
|
+
await build(ssrBuildConfig);
|
|
20
16
|
}
|
|
21
17
|
//# sourceMappingURL=build-ssr.js.map
|
package/src/lib/build-ssr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssr.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-ssr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-ssr.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAc,MAAM,MAAM,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAkB,EAAE,OAAiB;IACrE,MAAM,aAAa,GAAG,OAAO,EAAE,aAAa,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC;IAExE,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE;QACzC,KAAK,EAAE;YACL,GAAG,EAAE,IAAI;YACT,aAAa,EAAE;gBACb,KAAK,EACH,OAAO,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,sBAAsB,CAAC;aACxE;YACD,MAAM,EAAE,OAAO,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;SACrE;KACF,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,cAAc,CAAC,CAAC;AAC9B,CAAC"}
|
package/src/lib/options.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface PrerenderOptions {
|
|
|
19
19
|
/**
|
|
20
20
|
* List of routes to prerender resolved statically or dynamically.
|
|
21
21
|
*/
|
|
22
|
-
routes?: string[] | (() => Promise<(string | undefined)[]>);
|
|
22
|
+
routes?: (string | PrerenderContentDir)[] | (() => Promise<(string | PrerenderContentDir | undefined)[]>);
|
|
23
23
|
sitemap?: SitemapConfig;
|
|
24
24
|
/** List of functions that run for each route after pre-rendering is complete. */
|
|
25
25
|
postRenderingHooks?: ((routes: PrerenderRoute) => Promise<void>)[];
|
|
@@ -27,3 +27,30 @@ export interface PrerenderOptions {
|
|
|
27
27
|
export interface SitemapConfig {
|
|
28
28
|
host: string;
|
|
29
29
|
}
|
|
30
|
+
export interface PrerenderContentDir {
|
|
31
|
+
/**
|
|
32
|
+
* The directory where files should be grabbed from.
|
|
33
|
+
* @example `/src/contents/blog`
|
|
34
|
+
*/
|
|
35
|
+
contentDir: string;
|
|
36
|
+
/**
|
|
37
|
+
* Transform the matching content files path into a route.
|
|
38
|
+
* The function is called for each matching content file within the specified contentDir.
|
|
39
|
+
* @param file information of the matching file (`path`, `name`, `extension`, `attributes`)
|
|
40
|
+
* @returns a string with the route should be returned (e. g. `/blog/<slug>`) or the value `false`, when the route should not be prerendered.
|
|
41
|
+
*/
|
|
42
|
+
transform: (file: PrerenderContentFile) => string | false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @param path the path to the content file
|
|
46
|
+
* @param name the basename of the matching content file without the file extension
|
|
47
|
+
* @param extension the file extension
|
|
48
|
+
* @param attributes the frontmatter attributes extracted from the frontmatter section of the file
|
|
49
|
+
* @returns a string with the route should be returned (e. g. `/blog/<slug>`) or the value `false`, when the route should not be prerendered.
|
|
50
|
+
*/
|
|
51
|
+
export interface PrerenderContentFile {
|
|
52
|
+
path: string;
|
|
53
|
+
attributes: Record<string, any>;
|
|
54
|
+
name: string;
|
|
55
|
+
extension: string;
|
|
56
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// SSR dev server, middleware and error page source modified from
|
|
2
2
|
// https://github.com/solidjs/solid-start/blob/main/packages/start/dev/server.js
|
|
3
|
-
import { __awaiter } from "tslib";
|
|
4
3
|
import * as path from 'path';
|
|
5
4
|
import * as fs from 'fs';
|
|
6
5
|
export function devServerPlugin(options) {
|
|
@@ -18,14 +17,17 @@ export function devServerPlugin(options) {
|
|
|
18
17
|
};
|
|
19
18
|
},
|
|
20
19
|
configureServer(viteServer) {
|
|
21
|
-
return () =>
|
|
20
|
+
return async () => {
|
|
22
21
|
remove_html_middlewares(viteServer.middlewares);
|
|
23
|
-
viteServer.middlewares.use((req, res) =>
|
|
22
|
+
viteServer.middlewares.use(async (req, res) => {
|
|
24
23
|
let template = fs.readFileSync(path.resolve(viteServer.config.root, index), 'utf-8');
|
|
25
|
-
template =
|
|
24
|
+
template = await viteServer.transformIndexHtml(req.originalUrl, template);
|
|
26
25
|
try {
|
|
27
|
-
const entryServer = (
|
|
28
|
-
const result =
|
|
26
|
+
const entryServer = (await viteServer.ssrLoadModule('~analog/entry-server'))['default'];
|
|
27
|
+
const result = await entryServer(req.originalUrl, template, {
|
|
28
|
+
req,
|
|
29
|
+
res,
|
|
30
|
+
});
|
|
29
31
|
res.setHeader('Content-Type', 'text/html');
|
|
30
32
|
res.end(result);
|
|
31
33
|
}
|
|
@@ -48,8 +50,8 @@ export function devServerPlugin(options) {
|
|
|
48
50
|
</html>
|
|
49
51
|
`);
|
|
50
52
|
}
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
53
55
|
},
|
|
54
56
|
};
|
|
55
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server-plugin.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-nitro/src/lib/plugins/dev-server-plugin.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,gFAAgF
|
|
1
|
+
{"version":3,"file":"dev-server-plugin.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-nitro/src/lib/plugins/dev-server-plugin.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,gFAAgF;AAGhF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAOzB,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAC;IAChE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC;IAE5C,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,MAAM;YACJ,OAAO;gBACL,OAAO,EAAE;oBACP,KAAK,EAAE;wBACL,sBAAsB,EAAE,WAAW;qBACpC;iBACF;aACF,CAAC;QACJ,CAAC;QACD,eAAe,CAAC,UAAU;YACxB,OAAO,KAAK,IAAI,EAAE;gBAChB,uBAAuB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAChD,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;oBAC5C,IAAI,QAAQ,GAAG,EAAE,CAAC,YAAY,CAC5B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAC3C,OAAO,CACR,CAAC;oBAEF,QAAQ,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAC5C,GAAG,CAAC,WAAqB,EACzB,QAAQ,CACT,CAAC;oBAEF,IAAI;wBACF,MAAM,WAAW,GAAG,CAClB,MAAM,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAC,CACvD,CAAC,SAAS,CAAC,CAAC;wBACb,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,G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KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAChC,GAAG;QACH,KAAK,EAAE,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { buildSync } from 'esbuild';
|
|
3
2
|
import { normalizePath } from 'vite';
|
|
4
3
|
export function pageEndpointsPlugin() {
|
|
5
4
|
return {
|
|
6
5
|
name: 'analogjs-vite-plugin-nitro-rollup-page-endpoint',
|
|
7
|
-
transform(_code, id) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if ((_b = compiled.metafile) === null || _b === void 0 ? void 0 : _b.outputs[key].entryPoint) {
|
|
27
|
-
fileExports = (_c = compiled.metafile) === null || _c === void 0 ? void 0 : _c.outputs[key].exports;
|
|
28
|
-
}
|
|
6
|
+
async transform(_code, id) {
|
|
7
|
+
if (normalizePath(id).includes('src/app/pages') &&
|
|
8
|
+
id.endsWith('.server.ts')) {
|
|
9
|
+
const compiled = buildSync({
|
|
10
|
+
stdin: {
|
|
11
|
+
contents: _code,
|
|
12
|
+
sourcefile: id,
|
|
13
|
+
loader: 'ts',
|
|
14
|
+
},
|
|
15
|
+
write: false,
|
|
16
|
+
metafile: true,
|
|
17
|
+
platform: 'neutral',
|
|
18
|
+
format: 'esm',
|
|
19
|
+
logLevel: 'silent',
|
|
20
|
+
});
|
|
21
|
+
let fileExports = [];
|
|
22
|
+
for (let key in compiled.metafile?.outputs) {
|
|
23
|
+
if (compiled.metafile?.outputs[key].entryPoint) {
|
|
24
|
+
fileExports = compiled.metafile?.outputs[key].exports;
|
|
29
25
|
}
|
|
30
|
-
|
|
26
|
+
}
|
|
27
|
+
const code = `
|
|
31
28
|
import { defineEventHandler } from 'h3';
|
|
32
29
|
|
|
33
30
|
${fileExports.includes('load')
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
? _code
|
|
32
|
+
: `
|
|
36
33
|
${_code}
|
|
37
34
|
export const load = () => {
|
|
38
35
|
return {};
|
|
@@ -53,13 +50,12 @@ export function pageEndpointsPlugin() {
|
|
|
53
50
|
}
|
|
54
51
|
});
|
|
55
52
|
`;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
53
|
+
return {
|
|
54
|
+
code,
|
|
55
|
+
map: null,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
63
59
|
},
|
|
64
60
|
};
|
|
65
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-endpoints.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-nitro/src/lib/plugins/page-endpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page-endpoints.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-nitro/src/lib/plugins/page-endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI,EAAE,iDAAiD;QACvD,KAAK,CAAC,SAAS,CAAC,KAAa,EAAE,EAAU;YACvC,IACE,aAAa,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;gBAC3C,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EACzB;gBACA,MAAM,QAAQ,GAAG,SAAS,CAAC;oBACzB,KAAK,EAAE;wBACL,QAAQ,EAAE,KAAK;wBACf,UAAU,EAAE,EAAE;wBACd,MAAM,EAAE,IAAI;qBACb;oBACD,KAAK,EAAE,KAAK;oBACZ,QAAQ,EAAE,IAAI;oBACd,QAAQ,EAAE,SAAS;oBACnB,MAAM,EAAE,KAAK;oBACb,QAAQ,EAAE,QAAQ;iBACnB,CAAC,CAAC;gBAEH,IAAI,WAAW,GAAa,EAAE,CAAC;gBAE/B,KAAK,IAAI,GAAG,IAAI,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE;oBAC1C,IAAI,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE;wBAC9C,WAAW,GAAG,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;qBACvD;iBACF;gBAED,MAAM,IAAI,GAAG;;;cAIP,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC;oBAC1B,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC;kBACA,KAAK;;;kBAIX;;;;;;;;;;;;;;;;WAgBD,CAAC;gBAEJ,OAAO;oBACL,IAAI;oBACJ,GAAG,EAAE,IAAI;iBACV,CAAC;aACH;YAED,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { normalizePath } from 'vite';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
export function getMatchingContentFilesWithFrontMatter(workspaceRoot, rootDir, glob) {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
+
const fg = require('fast-glob');
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
10
|
+
const fm = require('front-matter');
|
|
11
|
+
const root = normalizePath(path.resolve(workspaceRoot, rootDir));
|
|
12
|
+
const resolvedDir = normalizePath(path.resolve(root, glob));
|
|
13
|
+
const contentFiles = fg.sync([`${root}/${resolvedDir}/*`], {
|
|
14
|
+
dot: true,
|
|
15
|
+
});
|
|
16
|
+
const mappedFilesWithFm = contentFiles.map((f) => {
|
|
17
|
+
const fileContents = fs.readFileSync(f, 'utf8');
|
|
18
|
+
const raw = fm(fileContents);
|
|
19
|
+
const filepath = f.replace(root, '');
|
|
20
|
+
const match = filepath.match(/\/([^/.]+)(\.([^/.]+))?$/);
|
|
21
|
+
let name = '';
|
|
22
|
+
let extension = '';
|
|
23
|
+
if (match) {
|
|
24
|
+
name = match[1];
|
|
25
|
+
extension = match[3] || ''; // Using an empty string if there's no extension
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
name,
|
|
29
|
+
extension,
|
|
30
|
+
path: resolvedDir,
|
|
31
|
+
attributes: raw.attributes,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
return mappedFilesWithFm;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=get-content-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-content-files.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-nitro/src/lib/utils/get-content-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,UAAU,sCAAsC,CACpD,aAAqB,EACrB,OAAe,EACf,IAAY;IAEZ,8DAA8D;IAC9D,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,8DAA8D;IAC9D,MA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path from 'path';
|
|
4
3
|
export const mockViteDevServer = {
|
|
@@ -34,24 +33,20 @@ export const mockNitroConfig = {
|
|
|
34
33
|
],
|
|
35
34
|
},
|
|
36
35
|
};
|
|
37
|
-
export function mockBuildFunctions() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return { buildSSRAppImportSpy, buildServerImportSpy, buildSitemapImportSpy };
|
|
49
|
-
});
|
|
36
|
+
export async function mockBuildFunctions() {
|
|
37
|
+
const buildServerImport = await import('./build-server');
|
|
38
|
+
const buildServerImportSpy = vi.fn();
|
|
39
|
+
buildServerImport.buildServer = buildServerImportSpy;
|
|
40
|
+
const buildSSRAppImport = await import('./build-ssr');
|
|
41
|
+
const buildSSRAppImportSpy = vi.fn();
|
|
42
|
+
buildSSRAppImport.buildSSRApp = buildSSRAppImportSpy;
|
|
43
|
+
const buildSitemapImport = await import('./build-sitemap');
|
|
44
|
+
const buildSitemapImportSpy = vi.fn();
|
|
45
|
+
buildSitemapImport.buildSitemap = buildSitemapImportSpy;
|
|
46
|
+
return { buildSSRAppImportSpy, buildServerImportSpy, buildSitemapImportSpy };
|
|
50
47
|
}
|
|
51
|
-
export function runConfigAndCloseBundle(plugin) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
yield plugin[1].closeBundle();
|
|
55
|
-
});
|
|
48
|
+
export async function runConfigAndCloseBundle(plugin) {
|
|
49
|
+
await plugin[1].config({}, { command: 'build' });
|
|
50
|
+
await plugin[1].closeBundle();
|
|
56
51
|
}
|
|
57
52
|
//# sourceMappingURL=vite-nitro-plugin.spec.data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-nitro-plugin.spec.data.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/vite-nitro-plugin.spec.data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-nitro-plugin.spec.data.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/vite-nitro-plugin.spec.data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE;QACX,gEAAgE;QAChE,GAAG,EAAE,GAAG,EAAE,GAAE,CAAC;KACd;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IACvC,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE;QACN,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QAChC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;KAC9C;IACD,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,EAAE;IACjB,QAAQ,EAAE,CAAC,YAAY,CAAC;IACxB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE;QACT,UAAU,EAAE,SAAS;KACtB;IACD,UAAU,EAAE;QACV,gBAAgB,EAAE,KAAK;KACxB;IACD,YAAY,EAAE;QACZ,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,iDAAiD;gBACvD,SAAS,KAAI,CAAC;aACf;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACzD,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC;IAErD,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACtD,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC;IAErD,MAAM,kBAAkB,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC3D,MAAM,qBAAqB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IACtC,kBAAkB,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAExD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAC/E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,MAAgB;IAC5D,MACE,MAAM,CAAC,CAAC,CAAC,CAAC,MAIX,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAe,CAAC,CAAC;IACzC,MAAO,MAAM,CAAC,CAAC,CAAC,CAAC,WAAmC,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { build, createDevServer, createNitro } from 'nitropack';
|
|
3
2
|
import { toNodeListener } from 'h3';
|
|
4
3
|
import { normalizePath } from 'vite';
|
|
@@ -9,169 +8,211 @@ import { pageEndpointsPlugin } from './plugins/page-endpoints.js';
|
|
|
9
8
|
import { getPageHandlers } from './utils/get-page-handlers.js';
|
|
10
9
|
import { buildSitemap } from './build-sitemap.js';
|
|
11
10
|
import { devServerPlugin } from './plugins/dev-server-plugin.js';
|
|
11
|
+
import { getMatchingContentFilesWithFrontMatter } from './utils/get-content-files.js';
|
|
12
12
|
let clientOutputPath = '';
|
|
13
13
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
14
14
|
export function nitro(options, nitroOptions) {
|
|
15
|
-
|
|
16
|
-
const workspaceRoot = (_a = options === null || options === void 0 ? void 0 : options.workspaceRoot) !== null && _a !== void 0 ? _a : process.cwd();
|
|
15
|
+
const workspaceRoot = options?.workspaceRoot ?? process.cwd();
|
|
17
16
|
const isTest = process.env['NODE_ENV'] === 'test' || !!process.env['VITEST'];
|
|
18
|
-
const apiPrefix = `/${
|
|
17
|
+
const apiPrefix = `/${nitroOptions?.runtimeConfig?.['apiPrefix'] ?? 'api'}`;
|
|
19
18
|
let isBuild = false;
|
|
20
19
|
let isServe = false;
|
|
21
20
|
let ssrBuild = false;
|
|
22
21
|
let config;
|
|
23
22
|
let nitroConfig;
|
|
24
23
|
return [
|
|
25
|
-
(
|
|
24
|
+
(options?.ssr
|
|
26
25
|
? devServerPlugin({
|
|
27
|
-
entryServer: options
|
|
28
|
-
index: options
|
|
26
|
+
entryServer: options?.entryServer,
|
|
27
|
+
index: options?.index,
|
|
29
28
|
})
|
|
30
29
|
: false),
|
|
31
30
|
{
|
|
32
31
|
name: '@analogjs/vite-plugin-nitro',
|
|
33
|
-
config(_config, { command }) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
async config(_config, { command }) {
|
|
33
|
+
isServe = command === 'serve';
|
|
34
|
+
isBuild = command === 'build';
|
|
35
|
+
ssrBuild = _config.build?.ssr === true;
|
|
36
|
+
config = _config;
|
|
37
|
+
const rootDir = path.relative(workspaceRoot, config.root || '.') || '.';
|
|
38
|
+
const buildPreset = process.env['BUILD_PRESET'] ??
|
|
39
|
+
nitroOptions?.preset;
|
|
40
|
+
const pageHandlers = getPageHandlers({ workspaceRoot, rootDir });
|
|
41
|
+
nitroConfig = {
|
|
42
|
+
rootDir,
|
|
43
|
+
preset: buildPreset,
|
|
44
|
+
logLevel: nitroOptions?.logLevel || 0,
|
|
45
|
+
srcDir: normalizePath(`${rootDir}/src/server`),
|
|
46
|
+
scanDirs: [normalizePath(`${rootDir}/src/server`)],
|
|
47
|
+
output: {
|
|
48
|
+
dir: normalizePath(path.resolve(workspaceRoot, 'dist', rootDir, 'analog')),
|
|
49
|
+
publicDir: normalizePath(path.resolve(workspaceRoot, 'dist', rootDir, 'analog/public')),
|
|
50
|
+
...nitroOptions?.output,
|
|
51
|
+
},
|
|
52
|
+
buildDir: normalizePath(path.resolve(workspaceRoot, 'dist', rootDir, '.nitro')),
|
|
53
|
+
typescript: {
|
|
54
|
+
generateTsConfig: false,
|
|
55
|
+
},
|
|
56
|
+
runtimeConfig: { ...nitroOptions?.runtimeConfig },
|
|
57
|
+
rollupConfig: {
|
|
58
|
+
onwarn(warning) {
|
|
59
|
+
if (warning.message.includes('empty chunk') &&
|
|
60
|
+
warning.message.endsWith('.server')) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
53
63
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
plugins: [pageEndpointsPlugin()],
|
|
64
|
+
plugins: [pageEndpointsPlugin()],
|
|
65
|
+
},
|
|
66
|
+
handlers: [
|
|
67
|
+
{
|
|
68
|
+
handler: normalizePath(`${__dirname}/runtime/api-middleware`),
|
|
69
|
+
middleware: true,
|
|
63
70
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
...pageHandlers,
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
if (isVercelPreset(buildPreset)) {
|
|
75
|
+
nitroConfig = withVercelOutputAPI(nitroConfig, workspaceRoot);
|
|
76
|
+
}
|
|
77
|
+
if (!ssrBuild && !isTest) {
|
|
78
|
+
// store the client output path for the SSR build config
|
|
79
|
+
clientOutputPath = path.resolve(rootDir, config.build?.outDir || 'dist/client');
|
|
80
|
+
}
|
|
81
|
+
nitroConfig.alias = {
|
|
82
|
+
'#analog/ssr': normalizePath(path.resolve(workspaceRoot, 'dist', rootDir, 'ssr/main.server')),
|
|
83
|
+
'#analog/index': normalizePath(path.resolve(clientOutputPath, 'index.html')),
|
|
84
|
+
...nitroOptions?.alias,
|
|
85
|
+
};
|
|
86
|
+
if (isBuild) {
|
|
87
|
+
if (isEmptyPrerenderRoutes(options)) {
|
|
88
|
+
nitroConfig.prerender = {};
|
|
89
|
+
nitroConfig.prerender.routes = ['/'];
|
|
74
90
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
if (options?.prerender) {
|
|
92
|
+
nitroConfig.prerender = nitroConfig.prerender ?? {};
|
|
93
|
+
nitroConfig.prerender.crawlLinks = options?.prerender?.discover;
|
|
94
|
+
let routes = [];
|
|
95
|
+
const prerenderRoutes = options?.prerender?.routes;
|
|
96
|
+
if (isArrayWithElements(prerenderRoutes)) {
|
|
97
|
+
routes = prerenderRoutes;
|
|
98
|
+
}
|
|
99
|
+
else if (typeof prerenderRoutes === 'function') {
|
|
100
|
+
routes = await prerenderRoutes();
|
|
84
101
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const prerenderRoutes = (_f = options === null || options === void 0 ? void 0 : options.prerender) === null || _f === void 0 ? void 0 : _f.routes;
|
|
89
|
-
if (isArrayWithElements(prerenderRoutes)) {
|
|
90
|
-
nitroConfig.prerender.routes = prerenderRoutes;
|
|
102
|
+
nitroConfig.prerender.routes = routes.reduce((prev, current) => {
|
|
103
|
+
if (!current) {
|
|
104
|
+
return prev;
|
|
91
105
|
}
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
if (typeof current === 'string') {
|
|
107
|
+
prev.push(current);
|
|
108
|
+
return prev;
|
|
94
109
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
'node-fetch-native/dist/polyfill',
|
|
105
|
-
...(((_g = nitroOptions === null || nitroOptions === void 0 ? void 0 : nitroOptions.externals) === null || _g === void 0 ? void 0 : _g.external) || []),
|
|
106
|
-
] }), moduleSideEffects: [
|
|
107
|
-
'zone.js/node',
|
|
108
|
-
'zone.js/fesm2015/zone-node',
|
|
109
|
-
...((nitroOptions === null || nitroOptions === void 0 ? void 0 : nitroOptions.moduleSideEffects) || []),
|
|
110
|
-
], renderer: normalizePath(`${__dirname}/runtime/renderer`), handlers: [
|
|
111
|
-
{
|
|
112
|
-
handler: normalizePath(`${__dirname}/runtime/api-middleware`),
|
|
113
|
-
middleware: true,
|
|
114
|
-
},
|
|
115
|
-
...pageHandlers,
|
|
116
|
-
] });
|
|
117
|
-
}
|
|
110
|
+
const affectedFiles = getMatchingContentFilesWithFrontMatter(workspaceRoot, rootDir, current.contentDir);
|
|
111
|
+
affectedFiles.forEach((f) => {
|
|
112
|
+
const result = current.transform(f);
|
|
113
|
+
if (result) {
|
|
114
|
+
prev.push(result);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return prev;
|
|
118
|
+
}, []);
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
if (ssrBuild) {
|
|
121
|
+
nitroConfig = {
|
|
122
|
+
...nitroConfig,
|
|
123
|
+
publicAssets: [{ dir: clientOutputPath }],
|
|
124
|
+
serverAssets: [
|
|
125
|
+
{
|
|
126
|
+
baseName: 'public',
|
|
127
|
+
dir: clientOutputPath,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
externals: {
|
|
131
|
+
...nitroOptions?.externals,
|
|
132
|
+
external: [
|
|
133
|
+
'rxjs',
|
|
134
|
+
'node-fetch-native/dist/polyfill',
|
|
135
|
+
...(nitroOptions?.externals?.external || []),
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
moduleSideEffects: [
|
|
139
|
+
'zone.js/node',
|
|
140
|
+
'zone.js/fesm2015/zone-node',
|
|
141
|
+
...(nitroOptions?.moduleSideEffects || []),
|
|
142
|
+
],
|
|
143
|
+
renderer: normalizePath(`${__dirname}/runtime/renderer`),
|
|
144
|
+
handlers: [
|
|
145
|
+
{
|
|
146
|
+
handler: normalizePath(`${__dirname}/runtime/api-middleware`),
|
|
147
|
+
middleware: true,
|
|
148
|
+
},
|
|
149
|
+
...pageHandlers,
|
|
150
|
+
],
|
|
151
|
+
};
|
|
137
152
|
}
|
|
138
|
-
}
|
|
153
|
+
}
|
|
154
|
+
nitroConfig = {
|
|
155
|
+
...nitroConfig,
|
|
156
|
+
...nitroOptions,
|
|
157
|
+
};
|
|
139
158
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
async configureServer(viteServer) {
|
|
160
|
+
if (isServe && !isTest) {
|
|
161
|
+
const nitro = await createNitro({
|
|
162
|
+
dev: true,
|
|
163
|
+
...nitroConfig,
|
|
164
|
+
});
|
|
165
|
+
const server = createDevServer(nitro);
|
|
166
|
+
await build(nitro);
|
|
167
|
+
viteServer.middlewares.use(apiPrefix, toNodeListener(server.app));
|
|
168
|
+
viteServer.httpServer?.once('listening', () => {
|
|
169
|
+
process.env['ANALOG_HOST'] = !viteServer.config.server.host
|
|
170
|
+
? 'localhost'
|
|
171
|
+
: viteServer.config.server.host;
|
|
172
|
+
process.env['ANALOG_PORT'] = `${viteServer.config.server.port}`;
|
|
173
|
+
});
|
|
174
|
+
console.log(`\n\nThe server endpoints are accessible under the "${apiPrefix}" path.`);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
async closeBundle() {
|
|
178
|
+
if (ssrBuild) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (isBuild) {
|
|
182
|
+
if (options?.ssr) {
|
|
183
|
+
console.log('Building SSR application...');
|
|
184
|
+
await buildSSRApp(config, options);
|
|
145
185
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if ((_a = options === null || options === void 0 ? void 0 : options.prerender) === null || _a === void 0 ? void 0 : _a.sitemap) {
|
|
153
|
-
console.log('Building Sitemap...');
|
|
154
|
-
// sitemap needs to be built after all directories are built
|
|
155
|
-
yield buildSitemap(config, options.prerender.sitemap, options.prerender.routes, (_b = nitroConfig.output) === null || _b === void 0 ? void 0 : _b.publicDir);
|
|
156
|
-
}
|
|
157
|
-
console.log(`\n\nThe '@analogjs/platform' server has been successfully built.`);
|
|
186
|
+
await buildServer(options, nitroConfig);
|
|
187
|
+
if (nitroConfig.prerender?.routes?.length &&
|
|
188
|
+
options?.prerender?.sitemap) {
|
|
189
|
+
console.log('Building Sitemap...');
|
|
190
|
+
// sitemap needs to be built after all directories are built
|
|
191
|
+
await buildSitemap(config, options.prerender.sitemap, nitroConfig.prerender.routes, nitroConfig.output?.publicDir);
|
|
158
192
|
}
|
|
159
|
-
|
|
193
|
+
console.log(`\n\nThe '@analogjs/platform' server has been successfully built.`);
|
|
194
|
+
}
|
|
160
195
|
},
|
|
161
196
|
},
|
|
162
197
|
];
|
|
163
198
|
}
|
|
164
199
|
function isEmptyPrerenderRoutes(options) {
|
|
165
|
-
|
|
166
|
-
if (!options || isArrayWithElements((_a = options === null || options === void 0 ? void 0 : options.prerender) === null || _a === void 0 ? void 0 : _a.routes)) {
|
|
200
|
+
if (!options || isArrayWithElements(options?.prerender?.routes)) {
|
|
167
201
|
return false;
|
|
168
202
|
}
|
|
169
|
-
return !
|
|
203
|
+
return !options.prerender?.routes;
|
|
170
204
|
}
|
|
171
205
|
function isArrayWithElements(arr) {
|
|
172
206
|
return !!(Array.isArray(arr) && arr.length);
|
|
173
207
|
}
|
|
174
208
|
const isVercelPreset = (buildPreset) => process.env['VERCEL'] ||
|
|
175
209
|
(buildPreset && buildPreset.toLowerCase().includes('vercel'));
|
|
176
|
-
const withVercelOutputAPI = (nitroConfig, workspaceRoot) => (
|
|
210
|
+
const withVercelOutputAPI = (nitroConfig, workspaceRoot) => ({
|
|
211
|
+
...nitroConfig,
|
|
212
|
+
output: {
|
|
213
|
+
...nitroConfig?.output,
|
|
214
|
+
dir: normalizePath(path.resolve(workspaceRoot, '.vercel', 'output')),
|
|
215
|
+
publicDir: normalizePath(path.resolve(workspaceRoot, '.vercel', 'output/static')),
|
|
216
|
+
},
|
|
217
|
+
});
|
|
177
218
|
//# sourceMappingURL=vite-plugin-nitro.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-nitro.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/vite-plugin-nitro.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin-nitro.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-nitro/src/lib/vite-plugin-nitro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAO,cAAc,EAAE,MAAM,IAAI,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/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