vite-plugin-react-server 0.3.10 → 0.3.12
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 +16 -14
- 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.d.ts +2 -2
- package/dist/plugin/checkFilesExist.d.ts.map +1 -1
- package/dist/plugin/checkFilesExist.js +43 -58
- package/dist/plugin/checkFilesExist.js.map +1 -1
- package/dist/plugin/collect-css-manifest.d.ts.map +1 -1
- package/dist/plugin/collect-css-manifest.js +5 -0
- package/dist/plugin/collect-css-manifest.js.map +1 -1
- package/dist/plugin/components.js +10 -15
- 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 +27 -24
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +26 -31
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/getPaths.js +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 +223 -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 +149 -50
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.d.ts +25 -0
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -0
- package/dist/plugin/helpers/getBundleManifest.js +72 -0
- package/dist/plugin/helpers/getBundleManifest.js.map +1 -0
- package/dist/plugin/helpers/inputNormalizer.d.ts +14 -1
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +128 -16
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
- package/dist/plugin/helpers/tryManifest.d.ts +3 -1
- 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 +37 -9
- 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/loader/css-loader.d.ts +16 -0
- package/dist/plugin/loader/css-loader.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.js +70 -0
- package/dist/plugin/loader/css-loader.js.map +1 -0
- package/dist/plugin/loader/react-loader.d.ts +17 -0
- package/dist/plugin/loader/react-loader.d.ts.map +1 -0
- package/dist/plugin/loader/react-loader.js +647 -0
- package/dist/plugin/loader/react-loader.js.map +1 -0
- package/dist/plugin/loader/rsc/messageHandler.d.ts +2 -0
- package/dist/plugin/loader/rsc/messageHandler.d.ts.map +1 -0
- package/dist/plugin/loader/rsc/messageHandler.js +1 -0
- package/dist/plugin/loader/rsc/rsc-worker.development.d.ts +2 -0
- package/dist/plugin/loader/rsc/rsc-worker.development.d.ts.map +1 -0
- package/dist/plugin/loader/rsc/rsc-worker.development.js +1 -0
- 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 +283 -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 +15 -9
- package/dist/plugin/react-server/createHandler.js.map +1 -1
- package/dist/plugin/react-server/createRscStream.d.ts +15 -3
- package/dist/plugin/react-server/createRscStream.d.ts.map +1 -1
- package/dist/plugin/react-server/createRscStream.js +53 -36
- 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 +147 -137
- 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 +68 -75
- package/dist/plugin/transformer/plugin.js.map +1 -1
- 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 +56 -20
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/utils/logger.d.ts +9 -0
- package/dist/plugin/utils/logger.d.ts.map +1 -0
- package/dist/plugin/utils/logger.js +68 -0
- package/dist/plugin/utils/logger.js.map +1 -0
- package/dist/plugin/worker/createWorker.d.ts +1 -0
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +23 -36
- package/dist/plugin/worker/createWorker.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.production.js +5 -1
- package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +33 -28
- 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 +147 -93
- 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/rsc/index.d.ts +1 -3
- package/dist/plugin/worker/rsc/index.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/index.js +1 -9
- package/dist/plugin/worker/rsc/index.js.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts +3 -0
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/messageHandler.js +107 -0
- package/dist/plugin/worker/rsc/messageHandler.js.map +1 -0
- package/dist/plugin/worker/rsc/plugin.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/plugin.js +74 -80
- package/dist/plugin/worker/rsc/rsc-worker.development.d.ts +32 -0
- package/dist/plugin/worker/rsc/rsc-worker.development.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/rsc-worker.development.js +43 -0
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -0
- package/dist/plugin/worker/rsc/rsc-worker.js +4 -106
- package/dist/plugin/worker/rsc/rsc-worker.production.d.ts +2 -0
- package/dist/plugin/worker/rsc/rsc-worker.production.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/rsc-worker.production.js +14 -0
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -0
- package/dist/plugin/worker/rsc/state.d.ts +11 -0
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/state.js +12 -0
- package/dist/plugin/worker/rsc/state.js.map +1 -0
- package/dist/plugin/worker/types.d.ts +62 -35
- 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 +16 -14
- package/plugin/assertServerCondition.ts +2 -3
- package/plugin/checkFilesExist.ts +46 -66
- package/plugin/collect-css-manifest.ts +5 -1
- package/plugin/config/createModuleIdGenerator.ts +52 -0
- package/plugin/config/defaults.ts +27 -20
- package/plugin/config/resolveOptions.ts +311 -25
- package/plugin/config/resolvePages.ts +1 -1
- package/plugin/config/resolveUserConfig.ts +195 -61
- package/plugin/helpers/getBundleManifest.ts +113 -0
- package/plugin/helpers/inputNormalizer.ts +186 -25
- package/plugin/helpers/tryManifest.ts +3 -1
- package/plugin/loader/createBuildLoader.ts +50 -9
- package/plugin/loader/createPageLoader.ts +1 -7
- package/plugin/loader/css-loader.ts +96 -0
- package/plugin/loader/react-loader.ts +945 -0
- package/plugin/loader/rsc/messageHandler.tsx +1 -0
- package/plugin/loader/rsc/rsc-worker.development.ts +1 -0
- 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 +351 -11
- package/plugin/react-server/createHandler.ts +16 -18
- package/plugin/react-server/createRscStream.ts +75 -42
- package/plugin/react-server/createSsrHandler.ts +7 -26
- package/plugin/react-server/plugin.ts +192 -155
- package/plugin/transformer/plugin.ts +70 -104
- package/plugin/transformer/types.ts +4 -0
- package/plugin/types/global.d.ts +8 -0
- package/plugin/types.ts +120 -64
- package/plugin/utils/logger.ts +52 -0
- package/plugin/worker/createWorker.ts +43 -44
- package/plugin/worker/html/html-worker.production.tsx +7 -2
- package/plugin/worker/html/messageHandler.ts +42 -35
- package/plugin/worker/html/plugin.ts +15 -11
- package/plugin/worker/html/renderPages.ts +177 -123
- package/plugin/worker/loader.ts +4 -13
- package/plugin/worker/plugin.ts +10 -1
- package/plugin/worker/rsc/index.ts +4 -13
- package/plugin/worker/rsc/messageHandler.tsx +143 -0
- package/plugin/worker/rsc/plugin.ts +38 -37
- package/plugin/worker/rsc/rsc-worker.development.ts +107 -0
- package/plugin/worker/rsc/rsc-worker.production.ts +13 -0
- package/plugin/worker/rsc/rsc-worker.tsx +5 -128
- package/plugin/worker/rsc/state.ts +37 -0
- package/plugin/worker/types.ts +83 -38
- package/scripts/check-react-version.mjs +17 -7
- package/scripts/react+0.0.0-experimental-b3a95caf-20250113.patch +143 -4170
- package/scripts/react-dom+0.0.0-experimental-b3a95caf-20250113.patch +14271 -90079
- 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/components.js.map +0 -1
- 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/createClientInputNormalizer.d.ts +0 -8
- package/dist/plugin/helpers/createClientInputNormalizer.d.ts.map +0 -1
- package/dist/plugin/helpers/createClientInputNormalizer.js +0 -35
- package/dist/plugin/helpers/createServerInputNormalizer.d.ts +0 -9
- package/dist/plugin/helpers/createServerInputNormalizer.d.ts.map +0 -1
- package/dist/plugin/helpers/createServerInputNormalizer.js +0 -37
- package/dist/plugin/helpers/createStaticInputNormalizer.d.ts +0 -7
- package/dist/plugin/helpers/createStaticInputNormalizer.d.ts.map +0 -1
- package/dist/plugin/helpers/createStaticInputNormalizer.js +0 -18
- package/dist/plugin/helpers/getModuleManifest.d.ts +0 -12
- package/dist/plugin/helpers/getModuleManifest.d.ts.map +0 -1
- package/dist/plugin/helpers/getModuleManifest.js +0 -24
- package/dist/plugin/helpers/getModuleManifest.js.map +0 -1
- package/dist/plugin/helpers/inputNormalizerWorker.d.ts +0 -11
- package/dist/plugin/helpers/inputNormalizerWorker.d.ts.map +0 -1
- package/dist/plugin/helpers/inputNormalizerWorker.js +0 -30
- package/dist/plugin/helpers/normalizedRelativePath.d.ts +0 -11
- package/dist/plugin/helpers/normalizedRelativePath.d.ts.map +0 -1
- package/dist/plugin/helpers/normalizedRelativePath.js +0 -36
- package/dist/plugin/helpers/resolveFilePath.d.ts +0 -13
- package/dist/plugin/helpers/resolveFilePath.d.ts.map +0 -1
- package/dist/plugin/helpers/resolveFilePath.js +0 -74
- package/dist/plugin/helpers/resolveWorkerModule.d.ts +0 -6
- package/dist/plugin/helpers/resolveWorkerModule.d.ts.map +0 -1
- package/dist/plugin/helpers/resolveWorkerModule.js +0 -24
- package/dist/plugin/helpers/validateModuleBase.d.ts +0 -3
- package/dist/plugin/helpers/validateModuleBase.d.ts.map +0 -1
- package/dist/plugin/helpers/validateModuleBase.js +0 -16
- package/dist/plugin/helpers/validateResolvedConfig.d.ts +0 -3
- package/dist/plugin/helpers/validateResolvedConfig.d.ts.map +0 -1
- package/dist/plugin/helpers/validateResolvedConfig.js +0 -17
- 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-client-components.d.ts +0 -21
- package/dist/plugin/transformer/transformer-client-components.d.ts.map +0 -1
- package/dist/plugin/transformer/transformer-client-components.js +0 -61
- package/dist/plugin/transformer/transformer-client-components.js.map +0 -1
- package/dist/plugin/transformer/transformer-server-actions.d.ts +0 -29
- package/dist/plugin/transformer/transformer-server-actions.d.ts.map +0 -1
- package/dist/plugin/transformer/transformer-server-actions.js +0 -76
- package/dist/plugin/transformer/transformer-server-actions.js.map +0 -1
- package/dist/plugin/worker/rsc/createRscStream.d.ts +0 -5
- package/dist/plugin/worker/rsc/createRscStream.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/createRscStream.js +0 -39
- package/dist/plugin/worker/rsc/createRscStream.js.map +0 -1
- package/dist/plugin/worker/rsc/development.d.ts +0 -5
- package/dist/plugin/worker/rsc/development.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/development.js +0 -13
- package/dist/plugin/worker/rsc/development.js.map +0 -1
- package/dist/plugin/worker/rsc/plugin.js.map +0 -1
- package/dist/plugin/worker/rsc/production.d.ts +0 -5
- package/dist/plugin/worker/rsc/production.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/production.js +0 -13
- package/dist/plugin/worker/rsc/production.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/helpers/createClientInputNormalizer.ts +0 -48
- package/plugin/helpers/createServerInputNormalizer.ts +0 -52
- package/plugin/helpers/createStaticInputNormalizer.ts +0 -26
- package/plugin/helpers/getModuleManifest.ts +0 -31
- package/plugin/helpers/inputNormalizerWorker.ts +0 -47
- package/plugin/helpers/normalizedRelativePath.ts +0 -59
- package/plugin/helpers/resolveFilePath.ts +0 -108
- package/plugin/helpers/resolveWorkerModule.ts +0 -41
- package/plugin/helpers/validateModuleBase.ts +0 -30
- package/plugin/helpers/validateResolvedConfig.ts +0 -21
- 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/plugin/transformer/transformer-client-components.ts +0 -94
- package/plugin/transformer/transformer-server-actions.ts +0 -110
- package/plugin/worker/rsc/createRscStream.ts +0 -42
- package/plugin/worker/rsc/development.ts +0 -6
- package/plugin/worker/rsc/production.ts +0 -6
- package/scripts/react-server-dom-esm+0.0.1.patch +0 -24775
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-react-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Vite plugin for React Server Components (RSC)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"./loader": "./dist/plugin/worker/loader.js",
|
|
25
25
|
"./package.json": "./package.json",
|
|
26
26
|
"./patch": "./scripts/patch.mjs",
|
|
27
|
-
"./check-react-version": "./scripts/check-react-version.mjs"
|
|
27
|
+
"./check-react-version": "./scripts/check-react-version.mjs",
|
|
28
|
+
"./css-loader": "./dist/plugin/loader/css-loader.js"
|
|
28
29
|
},
|
|
29
30
|
"typesVersions": {
|
|
30
31
|
"*": {
|
|
@@ -61,14 +62,12 @@
|
|
|
61
62
|
"test": "npm run build && npm run test:client && NODE_ENV=development npm run test:server",
|
|
62
63
|
"test:coverage": "vitest run --coverage",
|
|
63
64
|
"test:ui": "vitest --ui",
|
|
65
|
+
"experimental:clean-install": "npm install react-server-dom-esm react@experimental react-dom@experimental",
|
|
64
66
|
"experimental:copy": "cp -r ./oss-experimental/* ./node_modules/",
|
|
65
|
-
"experimental:patch": "npx patch-package react-server-dom-esm --exclude 'nothing'
|
|
67
|
+
"experimental:patch": "npx patch-package react-server-dom-esm react react-dom --exclude 'nothing'",
|
|
66
68
|
"experimental:move-patches": "mv patches/* ./scripts/",
|
|
67
|
-
"experimental:setup": "rm -rf patches/* && npm
|
|
68
|
-
"
|
|
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
|
+
"experimental:setup": "rm -rf patches/* && npm run experimental:clean-install && npm run experimental:copy && npm run experimental:patch && npm run experimental:move-patches && node scripts/check-react-version.mjs",
|
|
70
|
+
"postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package"
|
|
72
71
|
},
|
|
73
72
|
"keywords": [
|
|
74
73
|
"vite",
|
|
@@ -80,7 +79,7 @@
|
|
|
80
79
|
"author": "Nico Brinkkemper",
|
|
81
80
|
"license": "MIT",
|
|
82
81
|
"engines": {
|
|
83
|
-
"node": "^23.
|
|
82
|
+
"node": "^23.7.0"
|
|
84
83
|
},
|
|
85
84
|
"repository": {
|
|
86
85
|
"type": "git",
|
|
@@ -107,13 +106,12 @@
|
|
|
107
106
|
}
|
|
108
107
|
},
|
|
109
108
|
"devDependencies": {
|
|
110
|
-
"@types/node": "^20.17.16",
|
|
111
109
|
"@types/react": "^19.0.8",
|
|
112
110
|
"@types/react-dom": "^19.0.3",
|
|
113
111
|
"acorn-loose": "^8.3.0",
|
|
114
112
|
"patch-package": "^8.0.0",
|
|
115
|
-
"react": "^
|
|
116
|
-
"react-dom": "^
|
|
113
|
+
"react": "^0.0.0-experimental-e670e72f-20250214",
|
|
114
|
+
"react-dom": "^0.0.0-experimental-e670e72f-20250214",
|
|
117
115
|
"react-server-dom-esm": "^0.0.1",
|
|
118
116
|
"rollup": "^4.34.0",
|
|
119
117
|
"source-map": "^0.7.4",
|
|
@@ -122,9 +120,13 @@
|
|
|
122
120
|
"typescript": "^5.7.3",
|
|
123
121
|
"vite": "^6.0.11",
|
|
124
122
|
"vitest": "^3.0.4",
|
|
125
|
-
"webpack-sources": "^3.2.
|
|
123
|
+
"webpack-sources": "^3.2.3"
|
|
126
124
|
},
|
|
127
125
|
"bin": {
|
|
128
|
-
"
|
|
126
|
+
"check-react-version": "./scripts/check-react-version.mjs",
|
|
127
|
+
"patch": "./bin/patch.mjs"
|
|
128
|
+
},
|
|
129
|
+
"dependencies": {
|
|
130
|
+
"tsx": "^4.19.2"
|
|
129
131
|
}
|
|
130
132
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function assertServerCondition<P extends typeof process>(p: P): asserts p is P & { env: { NODE_OPTIONS: string } } {
|
|
1
|
+
export function assertServerCondition<P extends typeof process>(p: P): asserts p is P & { env: { NODE_OPTIONS: string } } {
|
|
2
2
|
const nodeOptions = p.env['NODE_OPTIONS'];
|
|
3
3
|
if (!nodeOptions?.match(/--conditions[= ]react-server/)) {
|
|
4
4
|
if(!nodeOptions?.match(/--conditions/)) {
|
|
@@ -9,5 +9,4 @@ function assertServerCondition<P extends typeof process>(p: P): asserts p is P &
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
return undefined;
|
|
12
|
-
};
|
|
13
|
-
assertServerCondition(process);
|
|
12
|
+
};
|
|
@@ -1,82 +1,62 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import type { CheckFilesExistReturn,
|
|
4
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import type { CheckFilesExistReturn, ResolvedUserOptions } from "./types.js";
|
|
4
|
+
import { normalizePath } from "vite";
|
|
5
|
+
import { createInputNormalizer } from "./helpers/inputNormalizer.js";
|
|
6
|
+
|
|
7
|
+
const resolveFileOption = (pageOrProps: string | ((url: string) => string)) => {
|
|
8
|
+
if (typeof pageOrProps === "string") {
|
|
9
|
+
return () => pageOrProps;
|
|
10
|
+
}
|
|
11
|
+
return pageOrProps;
|
|
12
|
+
};
|
|
5
13
|
|
|
6
14
|
export async function checkFilesExist(
|
|
7
15
|
pages: string[],
|
|
8
|
-
options:
|
|
16
|
+
options: ResolvedUserOptions,
|
|
9
17
|
root: string
|
|
10
18
|
): Promise<CheckFilesExistReturn> {
|
|
19
|
+
if (!root || root === "") {
|
|
20
|
+
throw new Error("Root not found");
|
|
21
|
+
}
|
|
11
22
|
const errors: string[] = [];
|
|
12
23
|
const pageSet = new Set<string>();
|
|
13
|
-
const pageMap = new Map<string, string>();
|
|
14
|
-
|
|
15
|
-
const toKey = (path: string) => {
|
|
16
|
-
return relative(root, resolve(root, path))
|
|
17
|
-
.replace(/\\/g, '/')
|
|
18
|
-
.replace(DEFAULT_CONFIG.FILE_REGEX, '')
|
|
19
|
-
.replace(/^\.\//, '');
|
|
20
|
-
}
|
|
21
|
-
// Check if files exist when string paths are provided
|
|
22
|
-
if (typeof options.Page === "string") {
|
|
23
|
-
const pagePath = options.Page;
|
|
24
|
-
const fullPagePath = resolve(root, pagePath);
|
|
25
|
-
const key = toKey(pagePath);
|
|
26
|
-
pageMap.set(key, pagePath);
|
|
27
|
-
if (!pageSet.has(key)) {
|
|
28
|
-
if (!existsSync(fullPagePath)) {
|
|
29
|
-
errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
|
|
30
|
-
}
|
|
31
|
-
pageSet.add(pagePath.replace(/^\//, ''));
|
|
32
|
-
}
|
|
33
|
-
} else if (typeof options.Page === "function" && pages) {
|
|
34
|
-
for (const page of pages) {
|
|
35
|
-
const pagePath = options.Page(page);
|
|
36
|
-
const fullPagePath = resolve(root, pagePath);
|
|
37
|
-
const key = toKey(pagePath);
|
|
38
|
-
pageMap.set(key, pagePath);
|
|
39
|
-
if (pageSet.has(key)) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (!existsSync(fullPagePath)) {
|
|
43
|
-
errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
|
|
44
|
-
}
|
|
45
|
-
pageSet.add(pagePath);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
24
|
const propsSet = new Set<string>();
|
|
25
|
+
const pageMap = new Map<string, string>();
|
|
50
26
|
const propsMap = new Map<string, string>();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
continue;
|
|
27
|
+
const urlMap = new Map<string, { props: string; page: string }>();
|
|
28
|
+
const normalizer = createInputNormalizer({
|
|
29
|
+
root,
|
|
30
|
+
preserveModulesRoot: options.build.preserveModulesRoot === true ? options.moduleBase : undefined,
|
|
31
|
+
removeExtension: true,
|
|
32
|
+
});
|
|
33
|
+
const pageFn = resolveFileOption(options.Page);
|
|
34
|
+
const propsFn = resolveFileOption(options.props);
|
|
35
|
+
for (const page of pages) {
|
|
36
|
+
const pagePath = pageFn(page);
|
|
37
|
+
const propsPath = propsFn(page);
|
|
38
|
+
const [pageKey, pageValue] = normalizer(pagePath);
|
|
39
|
+
const [propsKey, propsValue] = normalizer(propsPath);
|
|
40
|
+
try {
|
|
41
|
+
if (!existsSync(join(root, pageValue))) {
|
|
42
|
+
errors.push(
|
|
43
|
+
`Page file not found: ${pagePath}, ${join(root, pagePath)}`
|
|
44
|
+
);
|
|
70
45
|
}
|
|
71
|
-
if (!existsSync(
|
|
72
|
-
errors.push(
|
|
46
|
+
if (!existsSync(join(root, propsValue))) {
|
|
47
|
+
errors.push(
|
|
48
|
+
`Props file not found: ${propsPath}, ${join(root, propsPath)}`
|
|
49
|
+
);
|
|
73
50
|
}
|
|
74
|
-
|
|
51
|
+
} catch (error) {
|
|
52
|
+
errors.push(`Error checking files: ${error}`);
|
|
75
53
|
}
|
|
54
|
+
urlMap.set(page, { props: propsPath, page: pagePath });
|
|
55
|
+
pageSet.add(pagePath);
|
|
56
|
+
propsSet.add(propsPath);
|
|
57
|
+
pageMap.set(pageKey, pageValue);
|
|
58
|
+
propsMap.set(propsKey, propsValue);
|
|
76
59
|
}
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
console.warn("React Stream Plugin Validation:\n" + errors.join("\n"));
|
|
80
|
-
}
|
|
81
|
-
return { pageMap, pageSet, propsMap, propsSet };
|
|
61
|
+
return { pageMap, pageSet, propsMap, propsSet, urlMap, errors };
|
|
82
62
|
}
|
|
@@ -47,6 +47,11 @@ export function collectManifestCss(
|
|
|
47
47
|
onCss?.(id);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
+
if (id.endsWith(".css.js")) {
|
|
51
|
+
cssFiles.set(id.slice(0, -3), id.slice(0, -3));
|
|
52
|
+
onCss?.(id.slice(0, -3));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
50
55
|
// Get the manifest entry
|
|
51
56
|
const entry = manifest[id];
|
|
52
57
|
if (!entry) return;
|
|
@@ -73,6 +78,5 @@ export function collectManifestCss(
|
|
|
73
78
|
if (manifest[relativePagePath]) {
|
|
74
79
|
walkManifestEntry(relativePagePath);
|
|
75
80
|
}
|
|
76
|
-
|
|
77
81
|
return cssFiles;
|
|
78
82
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createInputNormalizer } from "../helpers/inputNormalizer.js";
|
|
2
|
+
|
|
3
|
+
export const createModuleIdGenerator = ({
|
|
4
|
+
inputRoot,
|
|
5
|
+
client,
|
|
6
|
+
server,
|
|
7
|
+
moduleBase,
|
|
8
|
+
isProduction,
|
|
9
|
+
preserveModulesRoot,
|
|
10
|
+
imports,
|
|
11
|
+
removeExtension
|
|
12
|
+
}: {
|
|
13
|
+
isProduction: boolean;
|
|
14
|
+
inputRoot: string;
|
|
15
|
+
client: string;
|
|
16
|
+
server: string;
|
|
17
|
+
moduleBase: string;
|
|
18
|
+
preserveModulesRoot: boolean;
|
|
19
|
+
removeExtension: ((path: string) => boolean) | string | RegExp;
|
|
20
|
+
imports: Record<string, string>;
|
|
21
|
+
}) => {
|
|
22
|
+
const normalizer = createInputNormalizer({
|
|
23
|
+
root: inputRoot,
|
|
24
|
+
removeExtension: removeExtension,
|
|
25
|
+
preserveModulesRoot: preserveModulesRoot === true ? moduleBase : undefined,
|
|
26
|
+
});
|
|
27
|
+
return (moduleIdPath: string, ssr = isProduction) => {
|
|
28
|
+
const [moduleId, modulePath] = normalizer(moduleIdPath);
|
|
29
|
+
const key = preserveModulesRoot ? `${moduleBase}/${moduleId}` : moduleId;
|
|
30
|
+
const hasImports = key in imports;
|
|
31
|
+
|
|
32
|
+
if (hasImports) {
|
|
33
|
+
// Return the actual file path from the manifest
|
|
34
|
+
const mappedImport = imports[key];
|
|
35
|
+
const noRoot = mappedImport.startsWith(inputRoot) ? mappedImport.slice(inputRoot.length +1) : mappedImport;
|
|
36
|
+
const noModuleBase = preserveModulesRoot ? noRoot.startsWith(moduleBase) ? noRoot.slice(moduleBase.length) : noRoot : noRoot;
|
|
37
|
+
return noModuleBase;
|
|
38
|
+
} else if (ssr && isProduction) {
|
|
39
|
+
// Only throw in production SSR builds
|
|
40
|
+
const availableImports =
|
|
41
|
+
Object.keys(imports).length > 0
|
|
42
|
+
? Object.keys(imports).join(", ")
|
|
43
|
+
: "none";
|
|
44
|
+
throw new Error(
|
|
45
|
+
`${availableImports === "none" ? "No imports." : `Module ID ${key}, ${modulePath} is not in imports. Available imports: ${availableImports}`}`
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
// For development or non-SSR builds, use the module ID
|
|
49
|
+
return moduleId;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { moduleIdDefault } from "./moduleIdDefault.js";
|
|
2
|
-
|
|
3
1
|
export const DEFAULT_CONFIG = {
|
|
4
2
|
FILE_REGEX: /\.(m|c)?(j|t)sx?$/,
|
|
5
3
|
CLIENT_ASSETS_DIR: "assets",
|
|
@@ -7,21 +5,19 @@ export const DEFAULT_CONFIG = {
|
|
|
7
5
|
MODULE_BASE: "src",
|
|
8
6
|
MODULE_BASE_PATH: "/src",
|
|
9
7
|
MODULE_BASE_URL: "/src",
|
|
10
|
-
PAGE: "
|
|
11
|
-
PROPS: "
|
|
12
|
-
CLIENT_ENTRY: "
|
|
13
|
-
SERVER_ENTRY: "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
HTML_WORKER_PATH:
|
|
17
|
-
RSC_WORKER_PATH:
|
|
8
|
+
PAGE: "src/page/page.tsx",
|
|
9
|
+
PROPS: "src/page/props.ts",
|
|
10
|
+
CLIENT_ENTRY: "src/client.tsx",
|
|
11
|
+
SERVER_ENTRY: "src/server.tsx",
|
|
12
|
+
PAGE_EXPORT_NAME: "Page",
|
|
13
|
+
PROPS_EXPORT_NAME: "props",
|
|
14
|
+
HTML_WORKER_PATH: `worker/html/html-worker.${process.env['NODE_ENV'] === 'development' ? 'development' : 'production'}.js`,
|
|
15
|
+
RSC_WORKER_PATH: `worker/rsc/rsc-worker.${process.env['NODE_ENV'] === 'development' ? 'development' : 'production'}.js`,
|
|
18
16
|
LOADER_PATH: 'worker/loader.js',
|
|
19
17
|
RSC_EXTENSION: ".rsc",
|
|
20
18
|
HTML: ({ children }: { children: any }) => children,
|
|
21
19
|
COLLECT_CSS: true,
|
|
22
20
|
COLLECT_ASSETS: true,
|
|
23
|
-
PAGE_PATTERN: "/src/page/**/*.page.tsx",
|
|
24
|
-
PROPS_PATTERN: "/src/page/**/*.props.ts",
|
|
25
21
|
DEV_PORT: 5173,
|
|
26
22
|
PREVIEW_PORT: 4173,
|
|
27
23
|
DEV_HOST: "localhost",
|
|
@@ -29,16 +25,27 @@ export const DEFAULT_CONFIG = {
|
|
|
29
25
|
ENV_PREFIX: "VITE_",
|
|
30
26
|
BUILD: {
|
|
31
27
|
pages: () => ["/"],
|
|
32
|
-
client: "
|
|
33
|
-
server: "
|
|
34
|
-
static: "
|
|
28
|
+
client: "client",
|
|
29
|
+
server: "server",
|
|
30
|
+
static: "static",
|
|
31
|
+
api: "api",
|
|
32
|
+
outDir: "dist",
|
|
33
|
+
assetsDir: "assets",
|
|
34
|
+
hash: "hash",
|
|
35
|
+
preserveModulesRoot: true,
|
|
35
36
|
},
|
|
36
37
|
MODULE_BASE_EXCEPTIONS: [] as string[],
|
|
37
38
|
AUTO_DISCOVER: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
modulePattern: (n: string) => DEFAULT_CONFIG.FILE_REGEX.test(n),
|
|
40
|
+
pagePattern: (n: string) => n.toLowerCase().endsWith('/page') || n.toLowerCase() === 'page',
|
|
41
|
+
propsPattern: (n: string) => n.toLowerCase().endsWith('/props') || n.toLowerCase() === 'props',
|
|
42
|
+
clientComponents: (n: string) => n.toLowerCase().endsWith('.client') || n.toLowerCase() === 'client',
|
|
43
|
+
serverFunctions: (n: string) => n.toLowerCase().endsWith('.server') || n.toLowerCase() === 'server',
|
|
44
|
+
cssPattern: (n: string) => n.toLowerCase().endsWith('.css'),
|
|
45
|
+
cssModulePattern: (n: string) => n.toLowerCase().endsWith('.css.js'),
|
|
46
|
+
vendorPattern: (n: string) => n.toLowerCase().startsWith('node_modules') || n.toLowerCase().startsWith('_virtual'),
|
|
47
|
+
htmlPattern: (n: string) => n.toLowerCase().endsWith('.html'),
|
|
48
|
+
jsonPattern: (n: string) => n.toLowerCase().endsWith('.json'),
|
|
42
49
|
},
|
|
43
|
-
MODULE_ID:
|
|
50
|
+
MODULE_ID: (id: string) => id,
|
|
44
51
|
} as const;
|