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/plugin/worker/types.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Manifest } from "vite";
|
|
2
|
+
|
|
3
|
+
// Base message types
|
|
4
|
+
export interface WorkerMessage {
|
|
5
|
+
type: string;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface PipeableStreamOptions {
|
|
2
10
|
bootstrapModules?: string[];
|
|
3
11
|
bootstrapScripts?: string[];
|
|
4
12
|
bootstrapScriptContent?: string;
|
|
@@ -15,6 +23,7 @@ interface PipeableStreamOptions {
|
|
|
15
23
|
};
|
|
16
24
|
}
|
|
17
25
|
|
|
26
|
+
// Worker States
|
|
18
27
|
export interface HtmlRenderState {
|
|
19
28
|
chunks: string[];
|
|
20
29
|
complete: boolean;
|
|
@@ -29,96 +38,132 @@ export interface HtmlRenderState {
|
|
|
29
38
|
|
|
30
39
|
export interface RscRenderState {
|
|
31
40
|
id: string;
|
|
32
|
-
pipableStreamOptions: PipeableStreamOptions;
|
|
33
41
|
outDir: string;
|
|
34
42
|
moduleRootPath: string;
|
|
35
43
|
moduleBaseURL: string;
|
|
36
44
|
rscOutputPath: string;
|
|
37
45
|
componentImport: string;
|
|
38
46
|
propsImport: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface WorkerRscChunkMessage {
|
|
42
|
-
type: "RSC_CHUNK";
|
|
43
|
-
id: string;
|
|
44
|
-
chunk: string;
|
|
45
|
-
moduleRootPath: string;
|
|
46
|
-
moduleBaseURL: string;
|
|
47
|
-
outDir: string;
|
|
48
|
-
htmlOutputPath: string;
|
|
49
47
|
pipableStreamOptions: PipeableStreamOptions;
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
// Common Messages
|
|
51
|
+
export interface ShutdownMessage extends WorkerMessage {
|
|
53
52
|
type: "SHUTDOWN";
|
|
54
|
-
id: string;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
// RSC Messages
|
|
56
|
+
export interface RscRenderMessage extends WorkerMessage {
|
|
58
57
|
type: "RSC_RENDER";
|
|
59
|
-
id: string;
|
|
60
58
|
pageImport: string;
|
|
61
59
|
propsImport: string;
|
|
60
|
+
pageExportName: string;
|
|
61
|
+
propsExportName: string;
|
|
62
|
+
url: string;
|
|
62
63
|
outDir: string;
|
|
64
|
+
projectRoot: string;
|
|
63
65
|
moduleRootPath: string;
|
|
64
66
|
moduleBaseURL: string;
|
|
67
|
+
moduleBasePath: string;
|
|
65
68
|
pipableStreamOptions: PipeableStreamOptions;
|
|
69
|
+
cssFiles: string[];
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
export interface
|
|
69
|
-
type: "
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
export interface RscChunkMessage extends WorkerMessage {
|
|
73
|
+
type: "RSC_CHUNK";
|
|
74
|
+
chunk: string;
|
|
75
|
+
moduleRootPath: string;
|
|
76
|
+
moduleBaseURL: string;
|
|
77
|
+
outDir: string;
|
|
78
|
+
rscOutputPath: string;
|
|
79
|
+
cssFiles: Array<[string, string]>;
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
export interface
|
|
75
|
-
type: "
|
|
76
|
-
id: string;
|
|
77
|
-
error: string;
|
|
82
|
+
export interface RscShellReadyMessage extends WorkerMessage {
|
|
83
|
+
type: "SHELL_READY";
|
|
78
84
|
}
|
|
79
85
|
|
|
80
|
-
export interface
|
|
81
|
-
type: "
|
|
82
|
-
id: string;
|
|
86
|
+
export interface RscAllReadyMessage extends WorkerMessage {
|
|
87
|
+
type: "ALL_READY";
|
|
83
88
|
outputPath: string;
|
|
89
|
+
contents: string;
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
export interface RscEndMessage {
|
|
92
|
+
export interface RscEndMessage extends WorkerMessage {
|
|
87
93
|
type: "RSC_END";
|
|
88
|
-
id: string;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
export interface
|
|
96
|
+
export interface RscErrorMessage extends WorkerMessage {
|
|
97
|
+
type: "ERROR";
|
|
98
|
+
error: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ClientReferenceMessage extends WorkerMessage {
|
|
92
102
|
type: "CLIENT_REFERENCE";
|
|
93
|
-
id: string;
|
|
94
103
|
location: string;
|
|
95
104
|
key: string;
|
|
96
105
|
ref: unknown;
|
|
97
106
|
}
|
|
98
107
|
|
|
99
|
-
export interface ServerReferenceMessage {
|
|
108
|
+
export interface ServerReferenceMessage extends WorkerMessage {
|
|
100
109
|
type: "SERVER_REFERENCE";
|
|
101
|
-
id: string;
|
|
102
110
|
location: string;
|
|
103
111
|
key: string;
|
|
104
112
|
ref: unknown;
|
|
105
113
|
}
|
|
106
114
|
|
|
115
|
+
// HTML Messages
|
|
116
|
+
export interface WorkerRscChunkMessage extends WorkerMessage {
|
|
117
|
+
type: "RSC_CHUNK";
|
|
118
|
+
chunk: string;
|
|
119
|
+
moduleRootPath: string;
|
|
120
|
+
moduleBaseURL: string;
|
|
121
|
+
outDir: string;
|
|
122
|
+
htmlOutputPath: string;
|
|
123
|
+
pipableStreamOptions: PipeableStreamOptions;
|
|
124
|
+
clientManifest: Manifest;
|
|
125
|
+
serverManifest: Manifest;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ShellReadyMessage extends WorkerMessage {
|
|
129
|
+
type: "SHELL_READY";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface AllReadyMessage extends WorkerMessage {
|
|
133
|
+
type: "ALL_READY";
|
|
134
|
+
outputPath: string;
|
|
135
|
+
html: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface CssFileMessage extends WorkerMessage {
|
|
139
|
+
type: "CSS_FILE";
|
|
140
|
+
id: string;
|
|
141
|
+
cssFile: string;
|
|
142
|
+
moduleClasses?: Record<string, string>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Message Unions
|
|
107
146
|
export type HtmlWorkerMessage =
|
|
108
147
|
| WorkerRscChunkMessage
|
|
109
148
|
| RscEndMessage
|
|
110
149
|
| ShutdownMessage;
|
|
111
150
|
|
|
151
|
+
export type HtmlWorkerResponse =
|
|
152
|
+
| ShellReadyMessage
|
|
153
|
+
| AllReadyMessage
|
|
154
|
+
| RscErrorMessage;
|
|
155
|
+
|
|
112
156
|
export type RscWorkerMessage =
|
|
113
157
|
| RscRenderMessage
|
|
158
|
+
| RscChunkMessage
|
|
114
159
|
| RscEndMessage
|
|
115
160
|
| ShutdownMessage
|
|
116
161
|
| ClientReferenceMessage
|
|
117
|
-
| ServerReferenceMessage
|
|
162
|
+
| ServerReferenceMessage
|
|
163
|
+
| CssFileMessage;
|
|
118
164
|
|
|
119
165
|
export type RscWorkerResponse =
|
|
120
|
-
|
|
|
166
|
+
| RscShellReadyMessage
|
|
167
|
+
| RscAllReadyMessage
|
|
121
168
|
| RscErrorMessage
|
|
122
|
-
|
|
|
123
|
-
| ClientReferenceMessage
|
|
124
|
-
| ServerReferenceMessage;
|
|
169
|
+
| CssFileMessage;
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
import fs from 'node:fs/promises'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import React from 'react'
|
|
5
6
|
|
|
6
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
7
8
|
|
|
8
9
|
const TEMPLATE_VERSION = '0.0.0-experimental-b3a95caf-20250113'
|
|
10
|
+
const ACTUAL_TEMPLATE_VERSION = '19.1.0-experimental-b3a95caf-20250113'
|
|
11
|
+
const TARGET_VERSION = '0.0.0-experimental-e670e72f-20250214'
|
|
12
|
+
const ACTUAL_TARGET_VERSION = '19.1.0-experimental-e670e72f-20250214'
|
|
9
13
|
const STUB_VERSION = '0.0.1'
|
|
10
14
|
|
|
11
15
|
async function main() {
|
|
@@ -13,13 +17,17 @@ async function main() {
|
|
|
13
17
|
const reactPkgPath = path.resolve(process.cwd(), 'node_modules/react/package.json')
|
|
14
18
|
const reactPkg = JSON.parse(await fs.readFile(reactPkgPath, 'utf-8'))
|
|
15
19
|
const userPkg = JSON.parse(await fs.readFile(path.resolve(process.cwd(), 'package.json'), 'utf-8'))
|
|
16
|
-
const patchVersion =
|
|
20
|
+
const patchVersion = React.version
|
|
21
|
+
|
|
17
22
|
let userVersion = userPkg.dependencies?.react ?? userPkg.devDependencies?.react ?? userPkg.peerDependencies?.react
|
|
18
23
|
if(!userVersion) {
|
|
19
24
|
throw new Error('React version not found in package.json')
|
|
20
25
|
} else {
|
|
21
26
|
userVersion = userVersion.replace('^', '')
|
|
22
27
|
}
|
|
28
|
+
if(userVersion !== TARGET_VERSION) {
|
|
29
|
+
throw new Error(`React patch was made for version ${ACTUAL_TARGET_VERSION}, but you installed version ${userVersion}`)
|
|
30
|
+
}
|
|
23
31
|
// Define patches to process
|
|
24
32
|
const patches = [
|
|
25
33
|
{
|
|
@@ -43,18 +51,20 @@ async function main() {
|
|
|
43
51
|
// Process each patch
|
|
44
52
|
for (const {template, output} of patches) {
|
|
45
53
|
let patchContent = await fs.readFile(template, 'utf-8')
|
|
46
|
-
|
|
47
|
-
// Replace versions
|
|
48
|
-
patchContent = patchContent
|
|
49
|
-
.replace(new RegExp(TEMPLATE_VERSION, 'g'), patchVersion)
|
|
50
|
-
|
|
51
54
|
// Write patched file
|
|
52
55
|
const outputPath = path.resolve(userPatchesDir, output)
|
|
53
56
|
await fs.writeFile(outputPath, patchContent)
|
|
54
57
|
console.log(`Wrote patch file to ${outputPath}`)
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
console.log(`
|
|
60
|
+
console.log(`React version check result:
|
|
61
|
+
userVersion: ${userVersion}
|
|
62
|
+
patchVersion: ${patchVersion}
|
|
63
|
+
ACTUAL_TARGET_VERSION: ${ACTUAL_TARGET_VERSION}
|
|
64
|
+
ACTUAL_TEMPLATE_VERSION: ${ACTUAL_TEMPLATE_VERSION}
|
|
65
|
+
TARGET_VERSION: ${TARGET_VERSION}
|
|
66
|
+
TEMPLATE_VERSION: ${TEMPLATE_VERSION}
|
|
67
|
+
`)
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
const PATCH = ``
|