vite-plugin-react-server 0.3.10 → 0.3.11
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/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -4
- package/dist/plugin/assertServerCondition.d.ts +5 -1
- package/dist/plugin/assertServerCondition.d.ts.map +1 -1
- package/dist/plugin/assertServerCondition.js +1 -3
- package/dist/plugin/checkFilesExist.js +10 -7
- package/dist/plugin/checkFilesExist.js.map +1 -1
- package/dist/plugin/config/createModuleIdGenerator.d.ts +11 -0
- package/dist/plugin/config/createModuleIdGenerator.d.ts.map +1 -0
- package/dist/plugin/config/createModuleIdGenerator.js +44 -0
- package/dist/plugin/config/createModuleIdGenerator.js.map +1 -0
- package/dist/plugin/config/defaults.d.ts +31 -19
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +22 -27
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/resolveOptions.d.ts +1 -1
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +202 -16
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolvePages.d.ts +2 -0
- package/dist/plugin/config/resolvePages.d.ts.map +1 -1
- package/dist/plugin/config/resolvePages.js.map +1 -1
- package/dist/plugin/config/resolveUserConfig.d.ts +2 -2
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +161 -50
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.d.ts +20 -0
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -0
- package/dist/plugin/helpers/getBundleManifest.js +43 -0
- package/dist/plugin/helpers/getBundleManifest.js.map +1 -0
- package/dist/plugin/helpers/getModuleManifest.d.ts +5 -0
- package/dist/plugin/helpers/getModuleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getModuleManifest.js +20 -21
- package/dist/plugin/helpers/inputNormalizer.d.ts +15 -1
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +122 -16
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
- package/dist/plugin/helpers/inputNormalizerWorker.d.ts +2 -1
- package/dist/plugin/helpers/inputNormalizerWorker.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizerWorker.js +10 -7
- package/dist/plugin/helpers/tryManifest.d.ts +2 -0
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +1 -1
- package/dist/plugin/helpers/tryManifest.js.map +1 -1
- package/dist/plugin/loader/createBuildLoader.d.ts +6 -2
- package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createBuildLoader.js +35 -10
- package/dist/plugin/loader/createBuildLoader.js.map +1 -1
- package/dist/plugin/loader/createPageLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createPageLoader.js +0 -7
- package/dist/plugin/plugin.d.ts +0 -1
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +2 -1
- package/dist/plugin/preserver/plugin.d.ts.map +1 -1
- package/dist/plugin/preserver/plugin.js +3 -2
- package/dist/plugin/preserver/plugin.js.map +1 -1
- package/dist/plugin/react-client/index.d.ts +2 -1
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +19 -1
- package/dist/plugin/react-client/index.js.map +1 -0
- package/dist/plugin/react-client/plugin.d.ts +2 -2
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +106 -10
- package/dist/plugin/react-client/plugin.js.map +1 -1
- package/dist/plugin/react-server/createHandler.d.ts +2 -2
- package/dist/plugin/react-server/createHandler.d.ts.map +1 -1
- package/dist/plugin/react-server/createHandler.js +5 -5
- package/dist/plugin/react-server/createHandler.js.map +1 -1
- package/dist/plugin/react-server/createRscStream.d.ts.map +1 -1
- package/dist/plugin/react-server/createRscStream.js +15 -1
- package/dist/plugin/react-server/createRscStream.js.map +1 -1
- package/dist/plugin/react-server/createSsrHandler.d.ts +2 -2
- package/dist/plugin/react-server/createSsrHandler.d.ts.map +1 -1
- package/dist/plugin/react-server/createSsrHandler.js +5 -12
- package/dist/plugin/react-server/index.js +18 -9
- package/dist/plugin/react-server/index.js.map +1 -0
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +133 -127
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/transformer/plugin.d.ts +2 -1
- package/dist/plugin/transformer/plugin.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.js +52 -72
- package/dist/plugin/transformer/plugin.js.map +1 -1
- package/dist/plugin/transformer/transformer-client-components.d.ts +12 -3
- package/dist/plugin/transformer/transformer-client-components.d.ts.map +1 -1
- package/dist/plugin/transformer/transformer-client-components.js +71 -10
- package/dist/plugin/transformer/transformer-client-components.js.map +1 -1
- package/dist/plugin/transformer/transformer-server-actions.d.ts +3 -3
- package/dist/plugin/transformer/transformer-server-actions.d.ts.map +1 -1
- package/dist/plugin/transformer/transformer-server-actions.js +80 -66
- package/dist/plugin/transformer/types.d.ts +4 -0
- package/dist/plugin/transformer/types.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +51 -20
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +37 -23
- package/dist/plugin/worker/html/messageHandler.js.map +1 -1
- package/dist/plugin/worker/html/plugin.d.ts.map +1 -1
- package/dist/plugin/worker/html/plugin.js +10 -5
- package/dist/plugin/worker/html/renderPages.d.ts +7 -6
- package/dist/plugin/worker/html/renderPages.d.ts.map +1 -1
- package/dist/plugin/worker/html/renderPages.js +112 -57
- package/dist/plugin/worker/html/renderPages.js.map +1 -1
- package/dist/plugin/worker/loader.d.ts +1 -11
- package/dist/plugin/worker/loader.d.ts.map +1 -1
- package/dist/plugin/worker/loader.js +2 -2
- package/dist/plugin/worker/loader.js.map +1 -1
- package/dist/plugin/worker/plugin.d.ts +10 -1
- package/dist/plugin/worker/plugin.d.ts.map +1 -1
- package/dist/plugin/worker/plugin.js +10 -1
- package/dist/plugin/worker/types.d.ts +17 -4
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.d.ts +1 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -3
- package/dist/server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -4
- package/plugin/assertServerCondition.ts +2 -3
- package/plugin/checkFilesExist.ts +10 -10
- package/plugin/config/createModuleIdGenerator.ts +52 -0
- package/plugin/config/defaults.ts +24 -15
- package/plugin/config/resolveOptions.ts +253 -25
- package/plugin/config/resolvePages.ts +1 -1
- package/plugin/config/resolveUserConfig.ts +197 -62
- package/plugin/helpers/getBundleManifest.ts +75 -0
- package/plugin/helpers/getModuleManifest.ts +5 -0
- package/plugin/helpers/inputNormalizer.ts +175 -26
- package/plugin/helpers/inputNormalizerWorker.ts +13 -8
- package/plugin/helpers/tryManifest.ts +2 -0
- package/plugin/loader/createBuildLoader.ts +54 -10
- package/plugin/loader/createPageLoader.ts +1 -7
- package/plugin/plugin.ts +2 -1
- package/plugin/preserver/plugin.ts +2 -1
- package/plugin/react-client/index.ts +12 -1
- package/plugin/react-client/plugin.ts +127 -12
- package/plugin/react-server/createHandler.ts +7 -13
- package/plugin/react-server/createRscStream.ts +14 -2
- package/plugin/react-server/createSsrHandler.ts +7 -26
- package/plugin/react-server/plugin.ts +176 -144
- package/plugin/transformer/plugin.ts +69 -94
- package/plugin/transformer/transformer-client-components.ts +98 -24
- package/plugin/transformer/transformer-server-actions.ts +22 -7
- package/plugin/transformer/types.ts +4 -0
- package/plugin/types.ts +118 -64
- package/plugin/worker/html/messageHandler.ts +46 -31
- package/plugin/worker/html/plugin.ts +15 -11
- package/plugin/worker/html/renderPages.ts +175 -88
- package/plugin/worker/loader.ts +4 -13
- package/plugin/worker/plugin.ts +10 -1
- package/plugin/worker/types.ts +24 -3
- package/dist/node_modules/magic-string/dist/magic-string.es.js +0 -1283
- package/dist/node_modules/magic-string/dist/magic-string.es.js.map +0 -1
- package/dist/plugin/build/createClientBuildConfig.d.ts +0 -3
- package/dist/plugin/build/createClientBuildConfig.d.ts.map +0 -1
- package/dist/plugin/build/createClientBuildConfig.js +0 -14
- package/dist/plugin/build/createServerBuildConfig.d.ts +0 -12
- package/dist/plugin/build/createServerBuildConfig.d.ts.map +0 -1
- package/dist/plugin/build/createServerBuildConfig.js +0 -40
- package/dist/plugin/build/createSharedBuildConfig.d.ts +0 -5
- package/dist/plugin/build/createSharedBuildConfig.d.ts.map +0 -1
- package/dist/plugin/build/createSharedBuildConfig.js +0 -28
- package/dist/plugin/build/mergeInputs.d.ts +0 -9
- package/dist/plugin/build/mergeInputs.d.ts.map +0 -1
- package/dist/plugin/build/mergeInputs.js +0 -56
- package/dist/plugin/config/moduleIdDefault.d.ts +0 -8
- package/dist/plugin/config/moduleIdDefault.d.ts.map +0 -1
- package/dist/plugin/config/moduleIdDefault.js +0 -23
- package/dist/plugin/config/moduleIdDefault.js.map +0 -1
- package/dist/plugin/helpers/getModuleManifest.js.map +0 -1
- package/dist/plugin/react-server/createDevMiddleware.d.ts +0 -8
- package/dist/plugin/react-server/createDevMiddleware.d.ts.map +0 -1
- package/dist/plugin/react-server/createDevMiddleware.js +0 -68
- package/dist/plugin/react-server/createDevServer.d.ts +0 -4
- package/dist/plugin/react-server/createDevServer.d.ts.map +0 -1
- package/dist/plugin/react-server/createDevServer.js +0 -4
- package/dist/plugin/react-server/createReactNodeStreamer.d.ts +0 -10
- package/dist/plugin/react-server/createReactNodeStreamer.d.ts.map +0 -1
- package/dist/plugin/react-server/createReactNodeStreamer.js +0 -7
- package/dist/plugin/transformer/transformer-server-actions.js.map +0 -1
- package/plugin/build/createClientBuildConfig.ts +0 -21
- package/plugin/build/createServerBuildConfig.ts +0 -66
- package/plugin/build/createSharedBuildConfig.ts +0 -35
- package/plugin/build/mergeInputs.ts +0 -58
- package/plugin/config/moduleIdDefault.ts +0 -23
- package/plugin/react-server/createDevMiddleware.ts +0 -91
- package/plugin/react-server/createDevServer.ts +0 -9
- package/plugin/react-server/createReactNodeStreamer.ts +0 -26
package/dist/client.d.ts
CHANGED
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,mBAAmB,mBAAmB,CAAC"}
|
package/dist/client.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { StreamPluginOptions } from './plugin/types.js';
|
|
2
|
-
export declare const viteReactServer: (options: StreamPluginOptions) => Promise<import("vite").Plugin<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}> | (() => void)>;
|
|
6
|
-
export declare const viteReactClient: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any> | (() => void)>;
|
|
7
|
-
export declare const viteReactStream: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any> | (() => void)>;
|
|
2
|
+
export declare const viteReactServer: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any>[] | (() => void)>;
|
|
3
|
+
export declare const viteReactClient: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any>[] | (() => void)>;
|
|
4
|
+
export declare const viteReactStream: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any>[] | (() => void)>;
|
|
8
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,eAAO,MAAM,eAAe,YAAmB,mBAAmB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,eAAO,MAAM,eAAe,YAAmB,mBAAmB,yDAOjE,CAAA;AAED,eAAO,MAAM,eAAe,YAAmB,mBAAmB,yDAOjE,CAAA;AAED,eAAO,MAAM,eAAe,YAAa,mBAAmB,yDAM3D,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const viteReactServer = async (options) => {
|
|
|
10
10
|
};
|
|
11
11
|
} else {
|
|
12
12
|
const module = await import('./server.js');
|
|
13
|
-
return module.
|
|
13
|
+
return module.vitePluginReactServer(options);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
const viteReactClient = async (options) => {
|
|
@@ -19,7 +19,7 @@ const viteReactClient = async (options) => {
|
|
|
19
19
|
};
|
|
20
20
|
} else {
|
|
21
21
|
const module = await import('./client.js');
|
|
22
|
-
return module.
|
|
22
|
+
return module.vitePluginReactClient(options);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
const viteReactStream = (options) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["\"use strict\";\n\nimport type { StreamPluginOptions } from './plugin/types.js';\n\nconst isServer = process.env['NODE_OPTIONS']?.match(/--conditions[= ]react-server/)\n\nexport const viteReactServer = async (options: StreamPluginOptions)=>{\n if(!isServer){\n return ()=>{}\n } else {\n const module = await import('./server.js')\n return module.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["\"use strict\";\n\nimport type { StreamPluginOptions } from './plugin/types.js';\n\nconst isServer = process.env['NODE_OPTIONS']?.match(/--conditions[= ]react-server/)\n\nexport const viteReactServer = async (options: StreamPluginOptions)=>{\n if(!isServer){\n return ()=>{}\n } else {\n const module = await import('./server.js')\n return module.vitePluginReactServer(options)\n }\n}\n\nexport const viteReactClient = async (options: StreamPluginOptions)=>{\n if(isServer){\n return ()=>{}\n } else {\n const module = await import('./client.js')\n return module.vitePluginReactClient(options)\n }\n}\n\nexport const viteReactStream = (options: StreamPluginOptions)=>{\n if(isServer){\n return viteReactClient(options)\n } else {\n return viteReactServer(options)\n }\n}"],"names":[],"mappings":";;;;;AAIA,MAAM,WAAW,OAAQ,CAAA,GAAA,CAAI,cAAc,CAAA,EAAG,MAAM,8BAA8B,CAAA;AAErE,MAAA,eAAA,GAAkB,OAAO,OAA+B,KAAA;AACnE,EAAA,IAAG,CAAC,QAAS,EAAA;AACX,IAAA,OAAO,MAAI;AAAA,KAAC;AAAA,GACP,MAAA;AACL,IAAM,MAAA,MAAA,GAAS,MAAM,OAAO,aAAa,CAAA;AACzC,IAAO,OAAA,MAAA,CAAO,sBAAsB,OAAO,CAAA;AAAA;AAE/C;AAEa,MAAA,eAAA,GAAkB,OAAO,OAA+B,KAAA;AACnE,EAAA,IAAG,QAAS,EAAA;AACR,IAAA,OAAO,MAAI;AAAA,KAAC;AAAA,GACT,MAAA;AACL,IAAM,MAAA,MAAA,GAAS,MAAM,OAAO,aAAa,CAAA;AACzC,IAAO,OAAA,MAAA,CAAO,sBAAsB,OAAO,CAAA;AAAA;AAE/C;AAEa,MAAA,eAAA,GAAkB,CAAC,OAA+B,KAAA;AAC7D,EAAA,IAAG,QAAS,EAAA;AACV,IAAA,OAAO,gBAAgB,OAAO,CAAA;AAAA,GACzB,MAAA;AACL,IAAA,OAAO,gBAAgB,OAAO,CAAA;AAAA;AAElC;;;;"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-react-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Vite plugin for React Server Components (RSC)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin/index.js",
|
|
@@ -66,9 +66,7 @@
|
|
|
66
66
|
"experimental:move-patches": "mv patches/* ./scripts/",
|
|
67
67
|
"experimental:setup": "rm -rf patches/* && npm install react-server-dom-esm react@canary react-dom@canary && npm run experimental:copy && npm run experimental:patch && npm run experimental:move-patches && node scripts/check-react-version.mjs",
|
|
68
68
|
"experimental:check": "node scripts/check-react-version.mjs",
|
|
69
|
-
"postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package"
|
|
70
|
-
"start": "cd template; NODE_OPTIONS='--conditions react-server' npx vite",
|
|
71
|
-
"template:build": "cd template && NODE_OPTIONS='--conditions react-server' npx vite build"
|
|
69
|
+
"postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package"
|
|
72
70
|
},
|
|
73
71
|
"keywords": [
|
|
74
72
|
"vite",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertServerCondition.d.ts","sourceRoot":"","sources":["../../plugin/assertServerCondition.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"assertServerCondition.d.ts","sourceRoot":"","sources":["../../plugin/assertServerCondition.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAWtH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function assertServerCondition(p) {
|
|
1
|
+
export function assertServerCondition(p) {
|
|
2
2
|
const nodeOptions = p.env['NODE_OPTIONS'];
|
|
3
3
|
if (!nodeOptions?.match(/--conditions[= ]react-server/)) {
|
|
4
4
|
if (!nodeOptions?.match(/--conditions/)) {
|
|
@@ -11,5 +11,3 @@ function assertServerCondition(p) {
|
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
;
|
|
14
|
-
assertServerCondition(process);
|
|
15
|
-
export {};
|
|
@@ -4,19 +4,22 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { normalizePath } from 'vite';
|
|
9
9
|
|
|
10
10
|
async function checkFilesExist(pages, options, root) {
|
|
11
|
+
if (!root || root === "") {
|
|
12
|
+
throw new Error("Root not found");
|
|
13
|
+
}
|
|
11
14
|
const errors = [];
|
|
12
15
|
const pageSet = /* @__PURE__ */ new Set();
|
|
13
16
|
const pageMap = /* @__PURE__ */ new Map();
|
|
14
17
|
const toKey = (path) => {
|
|
15
|
-
return
|
|
18
|
+
return normalizePath(path);
|
|
16
19
|
};
|
|
17
20
|
if (typeof options.Page === "string") {
|
|
18
21
|
const pagePath = options.Page;
|
|
19
|
-
const fullPagePath =
|
|
22
|
+
const fullPagePath = join(root, pagePath);
|
|
20
23
|
const key = toKey(pagePath);
|
|
21
24
|
pageMap.set(key, pagePath);
|
|
22
25
|
if (!pageSet.has(key)) {
|
|
@@ -28,7 +31,7 @@ async function checkFilesExist(pages, options, root) {
|
|
|
28
31
|
} else if (typeof options.Page === "function" && pages) {
|
|
29
32
|
for (const page of pages) {
|
|
30
33
|
const pagePath = options.Page(page);
|
|
31
|
-
const fullPagePath =
|
|
34
|
+
const fullPagePath = join(root, pagePath);
|
|
32
35
|
const key = toKey(pagePath);
|
|
33
36
|
pageMap.set(key, pagePath);
|
|
34
37
|
if (pageSet.has(key)) {
|
|
@@ -44,7 +47,7 @@ async function checkFilesExist(pages, options, root) {
|
|
|
44
47
|
const propsMap = /* @__PURE__ */ new Map();
|
|
45
48
|
if (typeof options.props === "string") {
|
|
46
49
|
const propsPath = options.props;
|
|
47
|
-
const fullPropsPath =
|
|
50
|
+
const fullPropsPath = join(root, propsPath);
|
|
48
51
|
const key = toKey(propsPath);
|
|
49
52
|
propsMap.set(key, propsPath);
|
|
50
53
|
if (!propsSet.has(key)) {
|
|
@@ -56,7 +59,7 @@ async function checkFilesExist(pages, options, root) {
|
|
|
56
59
|
} else if (typeof options.props === "function" && pages) {
|
|
57
60
|
for (const page of pages) {
|
|
58
61
|
const propsPath = options.props(page);
|
|
59
|
-
const fullPropsPath =
|
|
62
|
+
const fullPropsPath = join(root, propsPath);
|
|
60
63
|
const key = toKey(propsPath);
|
|
61
64
|
propsMap.set(key, propsPath);
|
|
62
65
|
if (propsSet.has(key)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFilesExist.js","sources":["../../plugin/checkFilesExist.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport {
|
|
1
|
+
{"version":3,"file":"checkFilesExist.js","sources":["../../plugin/checkFilesExist.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { CheckFilesExistReturn, StreamPluginOptions } from \"./types.js\";\nimport { normalizePath } from \"vite\";\n\nexport async function checkFilesExist(\n pages: string[],\n options: Pick<StreamPluginOptions, \"Page\" | \"props\">,\n root: string\n): Promise<CheckFilesExistReturn> {\n if(!root || root === '') {\n throw new Error(\"Root not found\");\n }\n const errors: string[] = [];\n const pageSet = new Set<string>();\n const pageMap = new Map<string, string>();\n \n const toKey = (path: string) => {\n return normalizePath(path)\n }\n // Check if files exist when string paths are provided\n if (typeof options.Page === \"string\") {\n const pagePath = options.Page;\n const fullPagePath = join(root, pagePath);\n const key = toKey(pagePath);\n pageMap.set(key, pagePath);\n if (!pageSet.has(key)) {\n if (!existsSync(fullPagePath)) {\n errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);\n }\n pageSet.add(pagePath.replace(/^\\//, ''));\n }\n } else if (typeof options.Page === \"function\" && pages) {\n for (const page of pages) {\n const pagePath = options.Page(page);\n const fullPagePath = join(root, pagePath);\n const key = toKey(pagePath);\n pageMap.set(key, pagePath);\n if (pageSet.has(key)) {\n continue;\n }\n if (!existsSync(fullPagePath)) {\n errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);\n }\n pageSet.add(pagePath);\n }\n }\n\n const propsSet = new Set<string>();\n const propsMap = new Map<string, string>();\n if (typeof options.props === \"string\") {\n const propsPath = options.props;\n const fullPropsPath = join(root, propsPath);\n const key = toKey(propsPath);\n propsMap.set(key, propsPath);\n if (!propsSet.has(key)) {\n if (!existsSync(fullPropsPath)) {\n errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);\n }\n propsSet.add(propsPath);\n }\n } else if (typeof options.props === \"function\" && pages) {\n for (const page of pages) {\n const propsPath = options.props(page);\n const fullPropsPath = join(root, propsPath);\n const key = toKey(propsPath);\n propsMap.set(key, propsPath);\n if (propsSet.has(key)) {\n continue;\n }\n if (!existsSync(fullPropsPath)) {\n errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);\n }\n propsSet.add(propsPath);\n }\n }\n\n if (errors.length) {\n console.warn(\"React Stream Plugin Validation:\\n\" + errors.join(\"\\n\"));\n }\n return { pageMap, pageSet, propsMap, propsSet };\n}\n"],"names":[],"mappings":";;;;;;;;;AAKsB,eAAA,eAAA,CACpB,KACA,EAAA,OAAA,EACA,IACgC,EAAA;AAChC,EAAG,IAAA,CAAC,IAAQ,IAAA,IAAA,KAAS,EAAI,EAAA;AACvB,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA;AAAA;AAElC,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAM,MAAA,OAAA,uBAAc,GAAY,EAAA;AAChC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AAG,CAAG,EAAA;AACrB,QAAA;AAAA;AAEF,MAAI,IAAA,CAAC,UAAW,CAAA,aAAa,CAAG,EAAA;AAC9B,QAAA,MAAA,CAAO,IAAK,CAAA,CAAA,sBAAA,EAAyB,SAAS,CAAA,EAAA,EAAK,aAAa,CAAE,CAAA,CAAA;AAAA;AAEpE,MAAA,QAAA,CAAS,IAAI,SAAS,CAAA;AAAA;AACxB;AAGF,EAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,IAAA,OAAA,CAAQ,IAAK,CAAA,mCAAA,GAAsC,MAAO,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA;AAEtE,EAAA,OAAO,EAAE,OAAA,EAAS,OAAS,EAAA,QAAA,EAAU,QAAS,EAAA;AAChD;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const createModuleIdGenerator: ({ inputRoot, client, server, moduleBase, isProduction, preserveModulesRoot, imports, removeExtension }: {
|
|
2
|
+
isProduction: boolean;
|
|
3
|
+
inputRoot: string;
|
|
4
|
+
client: string;
|
|
5
|
+
server: string;
|
|
6
|
+
moduleBase: string;
|
|
7
|
+
preserveModulesRoot: boolean;
|
|
8
|
+
removeExtension: ((path: string) => boolean) | string | RegExp;
|
|
9
|
+
imports: Record<string, string>;
|
|
10
|
+
}) => (moduleIdPath: string, ssr?: boolean) => string;
|
|
11
|
+
//# sourceMappingURL=createModuleIdGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createModuleIdGenerator.d.ts","sourceRoot":"","sources":["../../../plugin/config/createModuleIdGenerator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,2GASjC;IACD,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,oBAMuB,MAAM,0BAyB7B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { createInputNormalizer } from '../helpers/inputNormalizer.js';
|
|
7
|
+
|
|
8
|
+
const createModuleIdGenerator = ({
|
|
9
|
+
inputRoot,
|
|
10
|
+
client,
|
|
11
|
+
server,
|
|
12
|
+
moduleBase,
|
|
13
|
+
isProduction,
|
|
14
|
+
preserveModulesRoot,
|
|
15
|
+
imports,
|
|
16
|
+
removeExtension
|
|
17
|
+
}) => {
|
|
18
|
+
const normalizer = createInputNormalizer({
|
|
19
|
+
root: inputRoot,
|
|
20
|
+
removeExtension,
|
|
21
|
+
preserveModulesRoot: preserveModulesRoot === true ? moduleBase : undefined
|
|
22
|
+
});
|
|
23
|
+
return (moduleIdPath, ssr = isProduction) => {
|
|
24
|
+
const [moduleId, modulePath] = normalizer(moduleIdPath);
|
|
25
|
+
const key = preserveModulesRoot ? `${moduleBase}/${moduleId}` : moduleId;
|
|
26
|
+
const hasImports = key in imports;
|
|
27
|
+
if (hasImports) {
|
|
28
|
+
const mappedImport = imports[key];
|
|
29
|
+
const noRoot = mappedImport.startsWith(inputRoot) ? mappedImport.slice(inputRoot.length + 1) : mappedImport;
|
|
30
|
+
const noModuleBase = preserveModulesRoot ? noRoot.startsWith(moduleBase) ? noRoot.slice(moduleBase.length) : noRoot : noRoot;
|
|
31
|
+
return noModuleBase;
|
|
32
|
+
} else if (ssr && isProduction) {
|
|
33
|
+
const availableImports = Object.keys(imports).length > 0 ? Object.keys(imports).join(", ") : "none";
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Module ID ${key}, ${modulePath} is not in imports and is not SSR. Available imports: ${availableImports}`
|
|
36
|
+
);
|
|
37
|
+
} else {
|
|
38
|
+
return moduleId;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { createModuleIdGenerator };
|
|
44
|
+
//# sourceMappingURL=createModuleIdGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createModuleIdGenerator.js","sources":["../../../plugin/config/createModuleIdGenerator.ts"],"sourcesContent":["import { createInputNormalizer } from \"../helpers/inputNormalizer.js\";\n\nexport const createModuleIdGenerator = ({\n inputRoot,\n client,\n server,\n moduleBase,\n isProduction,\n preserveModulesRoot,\n imports,\n removeExtension\n}: {\n isProduction: boolean;\n inputRoot: string;\n client: string;\n server: string;\n moduleBase: string;\n preserveModulesRoot: boolean;\n removeExtension: ((path: string) => boolean) | string | RegExp;\n imports: Record<string, string>;\n}) => {\n const normalizer = createInputNormalizer({\n root: inputRoot,\n removeExtension: removeExtension,\n preserveModulesRoot: preserveModulesRoot === true ? moduleBase : undefined,\n });\n return (moduleIdPath: string, ssr = isProduction) => {\n const [moduleId, modulePath] = normalizer(moduleIdPath);\n const key = preserveModulesRoot ? `${moduleBase}/${moduleId}` : moduleId;\n const hasImports = key in imports;\n\n if (hasImports) {\n // Return the actual file path from the manifest\n const mappedImport = imports[key];\n const noRoot = mappedImport.startsWith(inputRoot) ? mappedImport.slice(inputRoot.length +1) : mappedImport;\n const noModuleBase = preserveModulesRoot ? noRoot.startsWith(moduleBase) ? noRoot.slice(moduleBase.length) : noRoot : noRoot;\n return noModuleBase;\n } else if (ssr && isProduction) {\n // Only throw in production SSR builds\n const availableImports =\n Object.keys(imports).length > 0\n ? Object.keys(imports).join(\", \")\n : \"none\";\n throw new Error(\n `Module ID ${key}, ${modulePath} is not in imports and is not SSR. Available imports: ${availableImports}`\n );\n } else {\n // For development or non-SS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AO,IAAK,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,IAAI,CAC9B,GAAA,MAAA;AACN,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAa,UAAA,EAAA,GAAG,CAAK,EAAA,EAAA,UAAU,yDAAyD,gBAAgB,CAAA;AAAA,OAC1G;AAAA,KACK,MAAA;AAEL,MAAO,OAAA,QAAA;AAAA;AACT,GACF;AACF;;;;"}
|
|
@@ -5,10 +5,10 @@ export declare const DEFAULT_CONFIG: {
|
|
|
5
5
|
readonly MODULE_BASE: "src";
|
|
6
6
|
readonly MODULE_BASE_PATH: "/src";
|
|
7
7
|
readonly MODULE_BASE_URL: "/src";
|
|
8
|
-
readonly PAGE: "
|
|
9
|
-
readonly PROPS: "
|
|
10
|
-
readonly CLIENT_ENTRY: "
|
|
11
|
-
readonly SERVER_ENTRY: "
|
|
8
|
+
readonly PAGE: "src/page/page.tsx";
|
|
9
|
+
readonly PROPS: "src/page/props.ts";
|
|
10
|
+
readonly CLIENT_ENTRY: "src/client.tsx";
|
|
11
|
+
readonly SERVER_ENTRY: "src/server.tsx";
|
|
12
12
|
readonly PAGE_EXPORT: "Page";
|
|
13
13
|
readonly PROPS_EXPORT: "props";
|
|
14
14
|
readonly HTML_WORKER_PATH: "worker/html/html-worker.js";
|
|
@@ -20,8 +20,6 @@ export declare const DEFAULT_CONFIG: {
|
|
|
20
20
|
}) => any;
|
|
21
21
|
readonly COLLECT_CSS: true;
|
|
22
22
|
readonly COLLECT_ASSETS: true;
|
|
23
|
-
readonly PAGE_PATTERN: "/src/page/**/*.page.tsx";
|
|
24
|
-
readonly PROPS_PATTERN: "/src/page/**/*.props.ts";
|
|
25
23
|
readonly DEV_PORT: 5173;
|
|
26
24
|
readonly PREVIEW_PORT: 4173;
|
|
27
25
|
readonly DEV_HOST: "localhost";
|
|
@@ -29,23 +27,37 @@ export declare const DEFAULT_CONFIG: {
|
|
|
29
27
|
readonly ENV_PREFIX: "VITE_";
|
|
30
28
|
readonly BUILD: {
|
|
31
29
|
readonly pages: () => string[];
|
|
32
|
-
readonly client: "
|
|
33
|
-
readonly server: "
|
|
34
|
-
readonly static: "
|
|
30
|
+
readonly client: "client";
|
|
31
|
+
readonly server: "server";
|
|
32
|
+
readonly static: "static";
|
|
33
|
+
readonly api: "api";
|
|
34
|
+
readonly outDir: "dist";
|
|
35
|
+
readonly assetsDir: "assets";
|
|
36
|
+
readonly hash: "hash";
|
|
37
|
+
readonly preserveModulesRoot: true;
|
|
35
38
|
};
|
|
36
39
|
readonly MODULE_BASE_EXCEPTIONS: string[];
|
|
37
40
|
readonly AUTO_DISCOVER: {
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
41
|
+
readonly modulePattern: (n: string) => boolean;
|
|
42
|
+
readonly pagePattern: (n: string) => boolean;
|
|
43
|
+
readonly propsPattern: (n: string) => boolean;
|
|
44
|
+
readonly clientComponents: (n: string) => boolean;
|
|
45
|
+
readonly serverFunctions: (n: string) => boolean;
|
|
46
|
+
readonly cssPattern: (n: string) => boolean;
|
|
47
|
+
readonly cssModulePattern: (n: string) => boolean;
|
|
48
|
+
readonly vendorPattern: (n: string) => boolean;
|
|
49
|
+
readonly htmlPattern: (n: string) => boolean;
|
|
50
|
+
readonly jsonPattern: (n: string) => boolean;
|
|
42
51
|
};
|
|
43
|
-
readonly MODULE_ID: ({
|
|
52
|
+
readonly MODULE_ID: ({ inputRoot, client, server, moduleBase, isProduction, preserveModulesRoot, imports, removeExtension }: {
|
|
44
53
|
isProduction: boolean;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
inputRoot: string;
|
|
55
|
+
client: string;
|
|
56
|
+
server: string;
|
|
57
|
+
moduleBase: string;
|
|
58
|
+
preserveModulesRoot: boolean;
|
|
59
|
+
removeExtension: ((path: string) => boolean) | string | RegExp;
|
|
60
|
+
imports: Record<string, string>;
|
|
61
|
+
}) => (moduleIdPath: string, ssr?: boolean) => string;
|
|
50
62
|
};
|
|
51
63
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../plugin/config/defaults.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;kCAiBJ;QAAE,QAAQ,EAAE,GAAG,CAAA;KAAE
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../plugin/config/defaults.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;kCAiBJ;QAAE,QAAQ,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;qCAmBR,MAAM,EAAE;;oCAEjB,MAAM;kCACR,MAAM;mCACL,MAAM;uCACF,MAAM;sCACP,MAAM;iCACX,MAAM;uCACA,MAAM;oCACT,MAAM;kCACR,MAAM;kCACN,MAAM;;;;;;;;;;;;CAGjB,CAAC"}
|
|
@@ -3,50 +3,45 @@
|
|
|
3
3
|
* Copyright (c) Nico Brinkkemper
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
-
import { moduleIdDefault } from './moduleIdDefault.js';
|
|
7
|
-
|
|
8
6
|
const DEFAULT_CONFIG = {
|
|
9
7
|
FILE_REGEX: /\.(m|c)?(j|t)sx?$/,
|
|
10
8
|
CLIENT_ASSETS_DIR: "assets",
|
|
11
|
-
RSC_DIR: "rsc",
|
|
12
9
|
MODULE_BASE: "src",
|
|
13
|
-
MODULE_BASE_PATH: "/src",
|
|
14
10
|
MODULE_BASE_URL: "/src",
|
|
15
|
-
PAGE: "
|
|
16
|
-
PROPS: "
|
|
17
|
-
CLIENT_ENTRY: "
|
|
18
|
-
SERVER_ENTRY: "
|
|
11
|
+
PAGE: "src/page/page.tsx",
|
|
12
|
+
PROPS: "src/page/props.ts",
|
|
13
|
+
CLIENT_ENTRY: "src/client.tsx",
|
|
14
|
+
SERVER_ENTRY: "src/server.tsx",
|
|
19
15
|
PAGE_EXPORT: "Page",
|
|
20
16
|
PROPS_EXPORT: "props",
|
|
21
17
|
HTML_WORKER_PATH: "worker/html/html-worker.js",
|
|
22
18
|
RSC_WORKER_PATH: "worker/rsc/rsc-worker.js",
|
|
23
19
|
LOADER_PATH: "worker/loader.js",
|
|
24
|
-
RSC_EXTENSION: ".rsc",
|
|
25
20
|
HTML: ({ children }) => children,
|
|
26
21
|
COLLECT_CSS: true,
|
|
27
22
|
COLLECT_ASSETS: true,
|
|
28
|
-
PAGE_PATTERN: "/src/page/**/*.page.tsx",
|
|
29
|
-
PROPS_PATTERN: "/src/page/**/*.props.ts",
|
|
30
|
-
DEV_PORT: 5173,
|
|
31
|
-
PREVIEW_PORT: 4173,
|
|
32
|
-
DEV_HOST: "localhost",
|
|
33
|
-
PREVIEW_HOST: "localhost",
|
|
34
|
-
ENV_PREFIX: "VITE_",
|
|
35
23
|
BUILD: {
|
|
36
24
|
pages: () => ["/"],
|
|
37
|
-
client: "
|
|
38
|
-
server: "
|
|
39
|
-
static: "
|
|
25
|
+
client: "client",
|
|
26
|
+
server: "server",
|
|
27
|
+
static: "static",
|
|
28
|
+
api: "api",
|
|
29
|
+
outDir: "dist",
|
|
30
|
+
hash: "hash",
|
|
31
|
+
preserveModulesRoot: true
|
|
40
32
|
},
|
|
41
|
-
MODULE_BASE_EXCEPTIONS: [],
|
|
42
33
|
AUTO_DISCOVER: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
modulePattern: (n) => DEFAULT_CONFIG.FILE_REGEX.test(n),
|
|
35
|
+
pagePattern: (n) => n.toLowerCase().endsWith("page"),
|
|
36
|
+
propsPattern: (n) => n.toLowerCase().endsWith("props"),
|
|
37
|
+
clientComponents: (n) => n.toLowerCase().endsWith("client"),
|
|
38
|
+
serverFunctions: (n) => n.toLowerCase().endsWith("server"),
|
|
39
|
+
cssPattern: (n) => n.toLowerCase().endsWith("css"),
|
|
40
|
+
cssModulePattern: (n) => n.toLowerCase().endsWith("css.js"),
|
|
41
|
+
vendorPattern: (n) => n.toLowerCase().startsWith("node_modules") || n.toLowerCase().startsWith("_virtual"),
|
|
42
|
+
htmlPattern: (n) => n.toLowerCase().endsWith("html"),
|
|
43
|
+
jsonPattern: (n) => n.toLowerCase().endsWith("json")
|
|
44
|
+
}};
|
|
50
45
|
|
|
51
46
|
export { DEFAULT_CONFIG };
|
|
52
47
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sources":["../../../plugin/config/defaults.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"defaults.js","sources":["../../../plugin/config/defaults.ts"],"sourcesContent":["import { createModuleIdGenerator } from \"./createModuleIdGenerator.js\";\n\nexport const DEFAULT_CONFIG = {\n FILE_REGEX: /\\.(m|c)?(j|t)sx?$/,\n CLIENT_ASSETS_DIR: \"assets\",\n RSC_DIR: \"rsc\",\n MODULE_BASE: \"src\",\n MODULE_BASE_PATH: \"/src\",\n MODULE_BASE_URL: \"/src\",\n PAGE: \"src/page/page.tsx\",\n PROPS: \"src/page/props.ts\",\n CLIENT_ENTRY: \"src/client.tsx\",\n SERVER_ENTRY: \"src/server.tsx\",\n PAGE_EXPORT: \"Page\",\n PROPS_EXPORT: \"props\",\n HTML_WORKER_PATH: 'worker/html/html-worker.js',\n RSC_WORKER_PATH: 'worker/rsc/rsc-worker.js',\n LOADER_PATH: 'worker/loader.js',\n RSC_EXTENSION: \".rsc\",\n HTML: ({ children }: { children: any }) => children,\n COLLECT_CSS: true,\n COLLECT_ASSETS: true,\n DEV_PORT: 5173,\n PREVIEW_PORT: 4173,\n DEV_HOST: \"localhost\",\n PREVIEW_HOST: \"localhost\",\n ENV_PREFIX: \"VITE_\",\n BUILD: {\n pages: () => [\"/\"],\n client: \"client\",\n server: \"server\",\n static: \"static\",\n api: \"api\",\n outDir: \"dist\",\n assetsDir: \"assets\",\n hash: \"hash\",\n preserveModulesRoot: true,\n },\n MODULE_BASE_EXCEPTIONS: [] as string[],\n AUTO_DISCOVER: {\n modulePattern: (n: string) => DEFAULT_CONFIG.FILE_REGEX.test(n),\n pagePattern: (n: string) => n.toLowerCase().endsWith('page'),\n propsPattern: (n: string) => n.toLowerCase().endsWith('props'),\n clientComponents: (n: string) => n.toLowerCase().endsWith('client'),\n serverFunctions: (n: string) => n.toLowerCase().endsWith('server'),\n cssPattern: (n: string) => n.toLowerCase().endsWith('css'),\n cssModulePattern: (n: string) => n.toLowerCase().endsWith('css.js'),\n vendorPattern: (n: string) => n.toLowerCase().startsWith('node_modules') || n.toLowerCase().startsWith('_virtual'),\n htmlPattern: (n: string) => n.toLowerCase().endsWith('html'),\n jsonPattern: (n: string) => n.toLowerCase().endsWith('json'),\n },\n MODULE_ID: createModuleIdGenerator\n} as const; "],"names":[],"mappings":";;;;;AAEO,MAAM,cAAiB,GAAA;AAAA,EAC5B,UAAY,EAAA,mBAAA;AAAA,EACZ,iBAAmB,EAAA,QAAA;AAAA,EAEnB,WAAa,EAAA,KAAA;AAAA,EAEb,eAAiB,EAAA,MAAA;AAAA,EACjB,IAAM,EAAA,mBAAA;AAAA,EACN,KAAO,EAAA,mBAAA;AAAA,EACP,YAAc,EAAA,gBAAA;AAAA,EACd,YAAc,EAAA,gBAAA;AAAA,EACd,WAAa,EAAA,MAAA;AAAA,EACb,YAAc,EAAA,OAAA;AAAA,EACd,gBAAkB,EAAA,4BAAA;AAAA,EAClB,eAAiB,EAAA,0BAAA;AAAA,EACjB,WAAa,EAAA,kBAAA;AAAA,EAEb,IAAM,EAAA,CAAC,EAAE,QAAA,EAAkC,KAAA,QAAA;AAAA,EAC3C,WAAa,EAAA,IAAA;AAAA,EACb,cAAgB,EAAA,IAAA;AAAA,EAMhB,KAAO,EAAA;AAAA,IACL,KAAA,EAAO,MAAM,CAAC,G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Options: (options: StreamPluginOptions) => {
|
|
2
|
+
export declare const resolveOptions: (options: StreamPluginOptions, isClient?: boolean) => {
|
|
3
3
|
type: "success";
|
|
4
4
|
userOptions: ResolvedUserOptions;
|
|
5
5
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA0B5E,eAAO,MAAM,cAAc,YAChB,mBAAmB,aAClB,OAAO,KAEf;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CA8QhC,CAAC"}
|