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
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import { PassThrough } from "node:stream";
|
|
2
2
|
import { parentPort } from "node:worker_threads";
|
|
3
3
|
import type { HtmlRenderState, HtmlWorkerMessage } from "../types.js";
|
|
4
|
-
import ReactDOMServer from "react-dom/server";
|
|
4
|
+
import * as ReactDOMServer from "react-dom/server";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import {
|
|
7
7
|
createFromNodeStream,
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
} from "react-server-dom-esm/client.node";
|
|
10
|
+
import { join } from "path";
|
|
10
11
|
|
|
11
12
|
// Track active renders and streams
|
|
12
13
|
const activeRenders = new Map<string, HtmlRenderState>();
|
|
14
|
+
const htmlContent = new Map<string, string>();
|
|
15
|
+
const htmlPromises = new Map<string, Promise<string>>();
|
|
16
|
+
|
|
13
17
|
|
|
14
18
|
export const messageHandler = async (message: HtmlWorkerMessage) => {
|
|
15
19
|
try {
|
|
16
20
|
switch (message.type) {
|
|
17
21
|
case "RSC_CHUNK": {
|
|
18
|
-
const { id, chunk,
|
|
22
|
+
const { id, chunk, moduleRootPath, moduleBaseURL, htmlOutputPath, pipableStreamOptions } = message;
|
|
23
|
+
|
|
19
24
|
const render = activeRenders.get(id);
|
|
20
|
-
|
|
21
25
|
if (!render) {
|
|
22
26
|
activeRenders.set(id, {
|
|
23
27
|
chunks: [chunk],
|
|
24
28
|
id,
|
|
25
29
|
complete: false,
|
|
26
30
|
rendered: false,
|
|
27
|
-
|
|
31
|
+
moduleRootPath,
|
|
32
|
+
moduleBaseURL,
|
|
33
|
+
outDir: '',
|
|
34
|
+
htmlOutputPath: htmlOutputPath ?? join(process.cwd(), 'index.html'),
|
|
35
|
+
pipableStreamOptions: pipableStreamOptions,
|
|
28
36
|
});
|
|
29
37
|
} else {
|
|
30
38
|
render.chunks = [...render.chunks, chunk];
|
|
@@ -39,6 +47,9 @@ export const messageHandler = async (message: HtmlWorkerMessage) => {
|
|
|
39
47
|
throw new Error(`No render state found for ${id}`);
|
|
40
48
|
}
|
|
41
49
|
|
|
50
|
+
// Mark this render as complete
|
|
51
|
+
render.complete = true;
|
|
52
|
+
|
|
42
53
|
// Create a PassThrough stream to handle the chunks
|
|
43
54
|
const rscStream = new PassThrough();
|
|
44
55
|
|
|
@@ -47,18 +58,18 @@ export const messageHandler = async (message: HtmlWorkerMessage) => {
|
|
|
47
58
|
rscStream.write(chunk);
|
|
48
59
|
}
|
|
49
60
|
rscStream.end();
|
|
50
|
-
|
|
61
|
+
|
|
51
62
|
// Create React elements from stream
|
|
52
|
-
const reactElements = createFromNodeStream(
|
|
63
|
+
const reactElements = await createFromNodeStream(
|
|
53
64
|
rscStream,
|
|
54
65
|
render.moduleRootPath,
|
|
55
|
-
|
|
66
|
+
'localhost'
|
|
56
67
|
);
|
|
57
68
|
|
|
58
69
|
// Create a promise that resolves when HTML is complete
|
|
59
70
|
const htmlPromise = new Promise<string>((resolve) => {
|
|
60
|
-
let html = "";
|
|
61
71
|
const collectStream = new PassThrough();
|
|
72
|
+
let html = '';
|
|
62
73
|
|
|
63
74
|
collectStream.on("data", (chunk) => {
|
|
64
75
|
html += chunk.toString();
|
|
@@ -66,8 +77,14 @@ export const messageHandler = async (message: HtmlWorkerMessage) => {
|
|
|
66
77
|
|
|
67
78
|
collectStream.on("end", () => {
|
|
68
79
|
resolve(html);
|
|
80
|
+
render.rendered = true;
|
|
81
|
+
parentPort?.postMessage({
|
|
82
|
+
type: "ALL_READY",
|
|
83
|
+
id,
|
|
84
|
+
html,
|
|
85
|
+
outputPath: render.htmlOutputPath,
|
|
86
|
+
});
|
|
69
87
|
});
|
|
70
|
-
|
|
71
88
|
// Render to pipeable stream
|
|
72
89
|
const stream = ReactDOMServer.renderToPipeableStream(
|
|
73
90
|
reactElements as React.ReactNode,
|
|
@@ -75,24 +92,7 @@ export const messageHandler = async (message: HtmlWorkerMessage) => {
|
|
|
75
92
|
...render.pipableStreamOptions,
|
|
76
93
|
onShellReady() {
|
|
77
94
|
parentPort?.postMessage({ type: "SHELL_READY", id });
|
|
78
|
-
}
|
|
79
|
-
async onAllReady() {
|
|
80
|
-
const finalHtml = await htmlPromise;
|
|
81
|
-
parentPort?.postMessage({
|
|
82
|
-
type: "HTML_READY",
|
|
83
|
-
id,
|
|
84
|
-
html: finalHtml,
|
|
85
|
-
outputPath: render.htmlOutputPath,
|
|
86
|
-
});
|
|
87
|
-
parentPort?.postMessage({ type: "ALL_READY", id });
|
|
88
|
-
},
|
|
89
|
-
onError(error) {
|
|
90
|
-
parentPort?.postMessage({
|
|
91
|
-
type: "ERROR",
|
|
92
|
-
id,
|
|
93
|
-
error: error instanceof Error ? error.message : String(error),
|
|
94
|
-
});
|
|
95
|
-
},
|
|
95
|
+
}
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
|
|
@@ -100,17 +100,24 @@ export const messageHandler = async (message: HtmlWorkerMessage) => {
|
|
|
100
100
|
stream.pipe(collectStream);
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
+
htmlPromises.set(id, htmlPromise);
|
|
104
|
+
|
|
105
|
+
// Clean up resources
|
|
106
|
+
rscStream.destroy();
|
|
107
|
+
activeRenders.delete(id);
|
|
108
|
+
htmlContent.delete(id);
|
|
109
|
+
htmlPromises.delete(id);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
case "SHUTDOWN": {
|
|
114
|
+
console.log('Received shutdown signal');
|
|
115
|
+
parentPort?.close();
|
|
103
116
|
break;
|
|
104
117
|
}
|
|
105
118
|
}
|
|
106
119
|
} catch (error) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
id:
|
|
110
|
-
message.type === "RSC_CHUNK" || message.type === "RSC_END"
|
|
111
|
-
? message.id
|
|
112
|
-
: "",
|
|
113
|
-
error: error instanceof Error ? error.message : String(error),
|
|
114
|
-
});
|
|
120
|
+
console.error('Error in messageHandler:', error);
|
|
121
|
+
throw error;
|
|
115
122
|
}
|
|
116
123
|
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
import { resolve } from "path";
|
|
3
|
-
import type { ModuleFormat } from 'rollup';
|
|
4
|
-
import type { StreamPluginOptions } from "../../types.js";
|
|
1
|
+
import type { Plugin, UserConfig } from "vite";
|
|
2
|
+
import { join, resolve } from "path";
|
|
3
|
+
import type { ModuleFormat, RollupOptions } from 'rollup';
|
|
4
|
+
import type { ResolvedUserOptions, StreamPluginOptions } from "../../types.js";
|
|
5
5
|
import { DEFAULT_CONFIG } from "../../config/defaults.js";
|
|
6
6
|
import { getPluginRoot } from "../../config/getPaths.js";
|
|
7
|
+
import { resolveOptions } from "../../config/resolveOptions.js";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
let userOptions: ResolvedUserOptions;
|
|
9
10
|
export function reactHtmlWorkerPlugin(options: StreamPluginOptions): Plugin {
|
|
11
|
+
const resolvedUserOptions = resolveOptions(options);
|
|
12
|
+
if(resolvedUserOptions.type === 'error') {
|
|
13
|
+
throw resolvedUserOptions.error
|
|
14
|
+
}
|
|
15
|
+
userOptions = resolvedUserOptions.userOptions;
|
|
10
16
|
return {
|
|
11
17
|
name: "vite:react-html-worker",
|
|
12
18
|
config(config) {
|
|
@@ -25,18 +31,16 @@ export function reactHtmlWorkerPlugin(options: StreamPluginOptions): Plugin {
|
|
|
25
31
|
},
|
|
26
32
|
output: {
|
|
27
33
|
format,
|
|
28
|
-
dir:
|
|
34
|
+
dir: join(userOptions.build.outDir, userOptions.build.server),
|
|
29
35
|
entryFileNames: '[name].js',
|
|
30
36
|
preserveModules: true,
|
|
37
|
+
preserveModulesRoot: userOptions.build.preserveModulesRoot === true ? userOptions.moduleBase : undefined,
|
|
31
38
|
// Add manifest entry
|
|
32
39
|
manualChunks: {
|
|
33
40
|
'html-worker': [htmlWorkerPath]
|
|
34
|
-
},
|
|
35
|
-
resolve: {
|
|
36
|
-
conditions: ['react-server'],
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
};
|
|
43
|
+
} satisfies RollupOptions;
|
|
40
44
|
|
|
41
45
|
return {
|
|
42
46
|
build: {
|
|
@@ -79,7 +83,7 @@ export function reactHtmlWorkerPlugin(options: StreamPluginOptions): Plugin {
|
|
|
79
83
|
minify: false,
|
|
80
84
|
sourcemap: true,
|
|
81
85
|
}
|
|
82
|
-
};
|
|
86
|
+
} satisfies UserConfig;
|
|
83
87
|
},
|
|
84
88
|
// Add this to ensure entry is in manifest
|
|
85
89
|
generateBundle(_, bundle) {
|
|
@@ -4,7 +4,17 @@ import { dirname, join, resolve as resolvePath } from "node:path";
|
|
|
4
4
|
import { Transform } from "node:stream";
|
|
5
5
|
import type { Worker } from "node:worker_threads";
|
|
6
6
|
import { createHandler } from "../../react-server/createHandler.js";
|
|
7
|
-
import type { ResolvedUserConfig,
|
|
7
|
+
import type { CheckFilesExistReturn, ResolvedUserConfig, ResolvedUserOptions } from "../../types.js";
|
|
8
|
+
import type {
|
|
9
|
+
HtmlWorkerResponse,
|
|
10
|
+
WorkerRscChunkMessage,
|
|
11
|
+
} from "../types.js";
|
|
12
|
+
import type { Manifest } from "vite";
|
|
13
|
+
import type {
|
|
14
|
+
PluginContext,
|
|
15
|
+
} from "rollup";
|
|
16
|
+
import React from "react";
|
|
17
|
+
import { collectManifestCss } from "../../collect-css-manifest.js";
|
|
8
18
|
|
|
9
19
|
interface PipeableStreamOptions {
|
|
10
20
|
bootstrapModules?: string[];
|
|
@@ -24,18 +34,10 @@ interface PipeableStreamOptions {
|
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
type RenderPagesOptions = {
|
|
27
|
-
pluginOptions:
|
|
28
|
-
Pick<
|
|
29
|
-
StreamPluginOptions,
|
|
30
|
-
"moduleBase" | "moduleBasePath" | "moduleBaseURL" | "projectRoot"
|
|
31
|
-
>
|
|
32
|
-
> &
|
|
33
|
-
Pick<
|
|
34
|
-
StreamPluginOptions,
|
|
35
|
-
"Page" | "props" | "build" | "Html" | "pageExportName" | "propsExportName"
|
|
36
|
-
>;
|
|
37
|
+
pluginOptions: ResolvedUserOptions;
|
|
37
38
|
userConfig: ResolvedUserConfig;
|
|
38
|
-
|
|
39
|
+
clientManifest: Manifest;
|
|
40
|
+
serverManifest: Manifest;
|
|
39
41
|
worker: Worker;
|
|
40
42
|
pipableStreamOptions?: PipeableStreamOptions;
|
|
41
43
|
loader: (id: string) => Promise<Record<string, any>>;
|
|
@@ -46,137 +48,189 @@ type RenderPagesOptions = {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
export async function renderPages(
|
|
51
|
+
pluginContext: PluginContext,
|
|
49
52
|
routes: string[],
|
|
53
|
+
files: CheckFilesExistReturn,
|
|
50
54
|
options: RenderPagesOptions
|
|
51
55
|
) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const destinationRoot = resolvePath(options.userConfig.root, options.userConfig.build.outDir);
|
|
56
|
+
const root = pluginContext.environment.config.root;
|
|
57
|
+
const outDir = pluginContext.environment.config.build.outDir;
|
|
55
58
|
const failedRoutes = new Map<string, Error>();
|
|
56
|
-
const moduleRootPath = join(destinationRoot, options.moduleBasePath);
|
|
57
|
-
const moduleBaseURL = options.moduleBaseURL;
|
|
58
|
-
const htmlRoot = join(
|
|
59
|
-
options.userConfig.root,
|
|
60
|
-
options.userConfig.build.outDir
|
|
61
|
-
);
|
|
62
|
-
const streamStarted = new Set<string>();
|
|
63
59
|
const completedRoutes = new Set<string>();
|
|
64
|
-
const htmlContent = new Map<string, string>();
|
|
65
60
|
const writePromises = new Map<string, Promise<void>>();
|
|
66
61
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case "HTML_READY": {
|
|
78
|
-
htmlContent.set(msg.id, msg.html);
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case "ALL_READY": {
|
|
82
|
-
completedRoutes.add(msg.id);
|
|
83
|
-
|
|
84
|
-
if (completedRoutes.size === routes.length) {
|
|
85
|
-
options.worker.removeListener("message", messageHandler);
|
|
62
|
+
try {
|
|
63
|
+
// Set up worker message handling
|
|
64
|
+
const allRoutesComplete = new Promise<void>((resolve, reject) => {
|
|
65
|
+
options.worker.on("message", (msg: HtmlWorkerResponse) => {
|
|
66
|
+
switch (msg.type) {
|
|
67
|
+
case "ALL_READY": {
|
|
68
|
+
const { id, html, outputPath } = msg;
|
|
69
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
86
70
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// Wait for all files to be written
|
|
101
|
-
Promise.all(writePromises.values())
|
|
102
|
-
.then(() => resolve())
|
|
103
|
-
.catch(reject);
|
|
71
|
+
writeFile(outputPath, html)
|
|
72
|
+
.then(() => {
|
|
73
|
+
completedRoutes.add(id);
|
|
74
|
+
if (completedRoutes.size === routes.length) {
|
|
75
|
+
resolve();
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
.catch((error) => {
|
|
79
|
+
console.error('Write error for route:', id, error);
|
|
80
|
+
failedRoutes.set(id, error as Error);
|
|
81
|
+
reject(error);
|
|
82
|
+
});
|
|
83
|
+
break;
|
|
104
84
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
case "ERROR": {
|
|
108
|
-
console.error("[renderPages] Worker error:", msg.error);
|
|
109
|
-
if (msg.id) {
|
|
85
|
+
case "ERROR": {
|
|
86
|
+
console.error('Worker error for route:', msg.id, msg.error);
|
|
110
87
|
failedRoutes.set(msg.id, new Error(msg.error));
|
|
88
|
+
reject(new Error(msg.error));
|
|
89
|
+
break;
|
|
111
90
|
}
|
|
112
|
-
break;
|
|
113
91
|
}
|
|
114
|
-
}
|
|
92
|
+
});
|
|
115
93
|
});
|
|
116
|
-
});
|
|
117
94
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
manifest: options.manifest,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
if (result.type !== "success") {
|
|
130
|
-
console.log("[renderPages] Handler failed:", result);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
95
|
+
// Process routes sequentially
|
|
96
|
+
for (const route of routes) {
|
|
97
|
+
const routeFiles = files.urlMap.get(route);
|
|
98
|
+
if (!routeFiles) {
|
|
99
|
+
console.error('No files found for route:', route);
|
|
100
|
+
failedRoutes.set(route, new Error(`No files found for ${route}`));
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
133
103
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
});
|
|
157
|
-
callback();
|
|
104
|
+
const cssFiles = collectManifestCss(
|
|
105
|
+
options.serverManifest,
|
|
106
|
+
options.moduleBasePath,
|
|
107
|
+
routeFiles.page,
|
|
108
|
+
options.onCssFile
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// Create handler for pure RSC output
|
|
112
|
+
const rscResult = await createHandler(route, {
|
|
113
|
+
...options.pluginOptions,
|
|
114
|
+
Html: React.Fragment // Use Fragment for pure RSC output
|
|
115
|
+
}, {
|
|
116
|
+
loader: options.loader,
|
|
117
|
+
clientManifest: options.clientManifest,
|
|
118
|
+
serverManifest: options.serverManifest,
|
|
119
|
+
pipableStreamOptions: {
|
|
120
|
+
...options.pipableStreamOptions,
|
|
121
|
+
importMap: {
|
|
122
|
+
imports: {
|
|
123
|
+
...options.pipableStreamOptions?.importMap?.imports,
|
|
124
|
+
...Object.fromEntries(Array.from(cssFiles.entries()))
|
|
125
|
+
}
|
|
158
126
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Create handler for HTML output
|
|
131
|
+
const htmlResult = await createHandler(route, options.pluginOptions, {
|
|
132
|
+
loader: options.loader,
|
|
133
|
+
clientManifest: options.clientManifest,
|
|
134
|
+
serverManifest: options.serverManifest,
|
|
135
|
+
pipableStreamOptions: {
|
|
136
|
+
...options.pipableStreamOptions,
|
|
137
|
+
importMap: {
|
|
138
|
+
imports: {
|
|
139
|
+
...options.pipableStreamOptions?.importMap?.imports,
|
|
140
|
+
...Object.fromEntries(Array.from(cssFiles.entries()))
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
});
|
|
162
145
|
|
|
163
|
-
|
|
164
|
-
|
|
146
|
+
if (rscResult.type !== "success" || htmlResult.type !== "success") {
|
|
147
|
+
console.error('Handler failed for route:', route);
|
|
148
|
+
failedRoutes.set(route, new Error(`Handler failed for ${route}`));
|
|
149
|
+
continue;
|
|
165
150
|
}
|
|
166
|
-
});
|
|
167
151
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
152
|
+
// Process both streams
|
|
153
|
+
await Promise.all([
|
|
154
|
+
// Save RSC stream to .rsc file in client directory
|
|
155
|
+
new Promise<void>((resolve, reject) => {
|
|
156
|
+
const chunks: Buffer[] = [];
|
|
157
|
+
const rscTransform = new Transform({
|
|
158
|
+
transform(chunk, _encoding, callback) {
|
|
159
|
+
try {
|
|
160
|
+
chunks.push(Buffer.from(chunk));
|
|
161
|
+
callback(null, chunk);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
callback(error as Error);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
flush(callback) {
|
|
167
|
+
try {
|
|
168
|
+
const rscPath = join(options.pluginOptions.build.outDir, options.pluginOptions.build.client, route, 'index.rsc');
|
|
169
|
+
|
|
170
|
+
// Ensure directory exists
|
|
171
|
+
mkdirSync(dirname(rscPath), { recursive: true });
|
|
172
|
+
|
|
173
|
+
// Write complete file
|
|
174
|
+
writeFile(rscPath, Buffer.concat(chunks))
|
|
175
|
+
.then(() => {
|
|
176
|
+
callback();
|
|
177
|
+
resolve();
|
|
178
|
+
})
|
|
179
|
+
.catch(error => {
|
|
180
|
+
console.error('RSC write error:', error);
|
|
181
|
+
callback(error as Error);
|
|
182
|
+
reject(error);
|
|
183
|
+
});
|
|
184
|
+
} catch (error) {
|
|
185
|
+
callback(error as Error);
|
|
186
|
+
reject(error);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
rscResult.stream.pipe(rscTransform);
|
|
192
|
+
}),
|
|
193
|
+
|
|
194
|
+
// Send HTML stream to worker
|
|
195
|
+
new Promise<void>((resolve, reject) => {
|
|
196
|
+
const htmlTransform = new Transform({
|
|
197
|
+
transform(chunk, _encoding, callback) {
|
|
198
|
+
try {
|
|
199
|
+
options.worker.postMessage({
|
|
200
|
+
type: "RSC_CHUNK",
|
|
201
|
+
id: route,
|
|
202
|
+
chunk: chunk.toString(),
|
|
203
|
+
moduleRootPath: join(root, options.pluginOptions.build.outDir),
|
|
204
|
+
moduleBaseURL: options.moduleBaseURL,
|
|
205
|
+
htmlOutputPath: join(options.pluginOptions.build.outDir, options.pluginOptions.build.client, route, 'index.html'),
|
|
206
|
+
pipableStreamOptions: options.pipableStreamOptions,
|
|
207
|
+
});
|
|
208
|
+
callback(null, chunk);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
callback(error as Error);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
flush(callback) {
|
|
214
|
+
options.worker.postMessage({
|
|
215
|
+
type: "RSC_END",
|
|
216
|
+
id: route,
|
|
217
|
+
});
|
|
218
|
+
callback();
|
|
219
|
+
resolve();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
173
222
|
|
|
174
|
-
|
|
175
|
-
|
|
223
|
+
htmlResult.stream.pipe(htmlTransform);
|
|
224
|
+
})
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
await allRoutesComplete;
|
|
229
|
+
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.error('Render error:', error);
|
|
232
|
+
throw error;
|
|
176
233
|
}
|
|
177
234
|
|
|
178
|
-
return {
|
|
179
|
-
failedRoutes,
|
|
180
|
-
completedRoutes
|
|
181
|
-
};
|
|
235
|
+
return { failedRoutes, completedRoutes };
|
|
182
236
|
}
|
package/plugin/worker/loader.ts
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
* This file can be overridden via the plugin options:
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* reactStreamPlugin({
|
|
7
|
-
* loaderPath: './my-custom-loader.ts'
|
|
8
|
-
* })
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* The default loader provides basic module loading functionality.
|
|
12
|
-
* Override this if you need custom module resolution or transformation.
|
|
3
|
+
* Not used currently
|
|
13
4
|
*/
|
|
14
|
-
export function load(id: string) {
|
|
15
|
-
return import(id);
|
|
5
|
+
export async function load(id: string) {
|
|
6
|
+
return await import(id);
|
|
16
7
|
}
|
package/plugin/worker/plugin.ts
CHANGED
|
@@ -4,7 +4,16 @@ import { reactHtmlWorkerPlugin } from "./html/plugin.js"
|
|
|
4
4
|
import { reactRscWorkerPlugin } from "./rsc/plugin.js"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* This plugin can be used to create your own worker paths.
|
|
7
|
+
* This plugin can be used to create your own worker paths. This build should be separated from the main build.
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* @example
|
|
12
|
+
*export reactWorkerPluginConfig = {
|
|
13
|
+
* htmlWorkerPath: './workers/html.tsx',
|
|
14
|
+
* rscWorkerPath: './workers/rsc.tsx',
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
8
17
|
*
|
|
9
18
|
* @param options
|
|
10
19
|
* @returns
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
process.env['NODE_ENV'] === 'production'
|
|
6
|
-
? import('./production.js')
|
|
7
|
-
: import('./development.js')
|
|
1
|
+
await(
|
|
2
|
+
process.env["NODE_ENV"] === "production"
|
|
3
|
+
? import("./rsc-worker.production.js")
|
|
4
|
+
: import("./rsc-worker.development.js")
|
|
8
5
|
);
|
|
9
|
-
|
|
10
|
-
// Re-export worker functions
|
|
11
|
-
export const {
|
|
12
|
-
createRscStream,
|
|
13
|
-
createWorker
|
|
14
|
-
} = worker;
|