vite-plugin-react-server 0.3.19 → 1.0.0
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/README.md +219 -141
- package/dist/package.json +13 -6
- package/dist/plugin/collect-manifest-client-files.d.ts.map +1 -1
- package/dist/plugin/collect-manifest-client-files.js +25 -11
- package/dist/plugin/collect-manifest-client-files.js.map +1 -1
- package/dist/plugin/components.d.ts +3 -13
- package/dist/plugin/components.d.ts.map +1 -1
- package/dist/plugin/components.js +3 -54
- package/dist/plugin/config/defaults.d.ts +9 -2
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +3 -2
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/resolveOptions.d.ts +2 -2
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +6 -0
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +178 -149
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/css-collector-inline.d.ts +10 -0
- package/dist/plugin/css-collector-inline.d.ts.map +1 -0
- package/dist/plugin/css-collector-inline.js +55 -0
- package/dist/plugin/css-collector-inline.js.map +1 -0
- package/dist/plugin/css-collector.d.ts +14 -0
- package/dist/plugin/css-collector.d.ts.map +1 -0
- package/dist/plugin/css-collector.js +49 -0
- package/dist/plugin/css-collector.js.map +1 -0
- package/dist/plugin/helpers/createHandler.d.ts +3 -8
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +52 -55
- package/dist/plugin/helpers/createHandler.js.map +1 -1
- package/dist/plugin/helpers/createRscStream.d.ts +14 -4
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +25 -16
- package/dist/plugin/helpers/createRscStream.js.map +1 -1
- package/dist/plugin/html.d.ts +5 -0
- package/dist/plugin/html.d.ts.map +1 -0
- package/dist/plugin/html.js +11 -0
- package/dist/plugin/html.js.map +1 -0
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +3 -2
- package/dist/plugin/react-client/plugin.js.map +1 -1
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +47 -16
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +20 -12
- package/dist/plugin/react-static/plugin.js.map +1 -1
- package/dist/plugin/react-static/types.d.ts +2 -0
- package/dist/plugin/react-static/types.d.ts.map +1 -0
- package/dist/plugin/react-static/types.js +1 -0
- package/dist/plugin/types.d.ts +48 -11
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +4 -1
- package/dist/plugin/worker/html/messageHandler.js.map +1 -1
- package/dist/plugin/worker/html/renderPages.d.ts +8 -25
- package/dist/plugin/worker/html/renderPages.d.ts.map +1 -1
- package/dist/plugin/worker/html/renderPages.js +61 -44
- package/dist/plugin/worker/html/renderPages.js.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +37 -22
- package/dist/plugin/worker/rsc/messageHandler.js.map +1 -1
- package/dist/plugin/worker/types.d.ts +3 -0
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -4
- package/plugin/collect-manifest-client-files.ts +25 -10
- package/plugin/components.ts +3 -0
- package/plugin/config/defaults.tsx +10 -9
- package/plugin/config/resolveOptions.ts +10 -5
- package/plugin/config/resolveUserConfig.ts +218 -177
- package/plugin/css-collector-inline.tsx +60 -0
- package/plugin/css-collector.tsx +62 -0
- package/plugin/helpers/createHandler.ts +73 -83
- package/plugin/helpers/createRscStream.ts +49 -21
- package/plugin/html.tsx +9 -0
- package/plugin/react-client/plugin.ts +3 -2
- package/plugin/react-server/plugin.ts +58 -22
- package/plugin/react-static/plugin.ts +20 -11
- package/plugin/react-static/types.ts +3 -0
- package/plugin/types.ts +53 -11
- package/plugin/worker/html/messageHandler.ts +5 -2
- package/plugin/worker/html/renderPages.ts +82 -78
- package/plugin/worker/rsc/messageHandler.tsx +41 -26
- package/plugin/worker/types.ts +3 -0
- package/dist/plugin/components.js.map +0 -1
- package/dist/plugin/getEnv.d.ts +0 -19
- package/dist/plugin/getEnv.d.ts.map +0 -1
- package/dist/plugin/getEnv.js +0 -107
- package/dist/plugin/module-graph.d.ts +0 -10
- package/dist/plugin/module-graph.d.ts.map +0 -1
- package/dist/plugin/module-graph.js +0 -35
- package/dist/plugin/worker/html/plugin.d.ts +0 -4
- package/dist/plugin/worker/html/plugin.d.ts.map +0 -1
- package/dist/plugin/worker/html/plugin.js +0 -93
- package/dist/plugin/worker/plugin.d.ts +0 -19
- package/dist/plugin/worker/plugin.d.ts.map +0 -1
- package/dist/plugin/worker/plugin.js +0 -23
- package/dist/plugin/worker/rsc/plugin.d.ts +0 -4
- package/dist/plugin/worker/rsc/plugin.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/plugin.js +0 -75
- package/plugin/components.tsx +0 -59
- package/plugin/getEnv.ts +0 -135
- package/plugin/module-graph.ts +0 -48
- package/plugin/worker/html/plugin.ts +0 -100
- package/plugin/worker/plugin.ts +0 -26
- package/plugin/worker/rsc/plugin.ts +0 -83
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Vite React Server Plugin
|
|
2
2
|
|
|
3
|
-
A Vite plugin that enables React Server Components (RSC) streaming and static
|
|
4
|
-
|
|
3
|
+
A Vite plugin that enables React Server Components (RSC) streaming and static HTML page generation. It leverages experimental dependencies from React, specifically `react-server-dom-esm`.
|
|
5
4
|
|
|
6
5
|
## Example Projects
|
|
7
6
|
|
|
@@ -10,205 +9,284 @@ A Vite plugin that enables React Server Components (RSC) streaming and static bu
|
|
|
10
9
|
|
|
11
10
|
## Installation
|
|
12
11
|
|
|
13
|
-
```
|
|
12
|
+
```sh
|
|
14
13
|
npm install -D vite-plugin-react-stream
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
## Open
|
|
16
|
+
## Open Source and Work in Progress
|
|
17
|
+
|
|
18
|
+
This project uses the latest *OSS-experimental* React version from [the official React GitHub repository](https://github.com/facebook/react). The plugin includes a patch system to facilitate setup. First, install dependencies and patches:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install -D patch-package react@experimental react-dom@experimental react-server-dom-esm
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Add the following command to your `package.json` scripts:
|
|
18
25
|
|
|
19
|
-
This project uses the latest* oss-experimental React version taken from [the offical React github repository](https://github.com/facebook/react). This plugin offers a patch system that can get you up and running quickly. First run `npm install -D patch-package react@experimental react-dom@experimental react-server-dom-esm` and add the follow command to the scripts
|
|
20
26
|
```json
|
|
21
|
-
"patch": "check-react-version && patch"
|
|
27
|
+
"patch": "check-react-version && patch"
|
|
22
28
|
```
|
|
23
|
-
|
|
29
|
+
|
|
30
|
+
Run the patch command:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npm run patch
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It will instruct you to add:
|
|
37
|
+
|
|
24
38
|
```json
|
|
25
|
-
"postinstall": "patch-package"
|
|
39
|
+
"postinstall": "patch-package"
|
|
26
40
|
```
|
|
27
|
-
This will apply the patch for us after running `npm install`
|
|
28
41
|
|
|
29
|
-
If errors
|
|
42
|
+
This ensures the patch is applied after every `npm install`. If errors arise related to `react-server-dom-esm`, verify that the postinstall step ran.
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
### vite-plugin-react-server/client
|
|
33
|
-
- Client build
|
|
34
|
-
- Server Worker thread (rsc-worker)
|
|
44
|
+
---
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
- Server build
|
|
38
|
-
- Client Worker thread (html-worker)
|
|
46
|
+
## Plugin Structure and Purpose
|
|
39
47
|
|
|
40
|
-
###
|
|
41
|
-
- Preserves "use client" and "use server" condition in source code
|
|
48
|
+
### Strict Client-Server Separation
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
- Transforms client components for server environment or vice versa
|
|
50
|
+
This plugin enforces a **strict architectural separation** between client and server execution. It achieves this by requiring **distinct entry files** for both environments, preventing unintended dependencies or cross-thread interactions. While this approach improves maintainability and clarity, it requires additional boilerplate.
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
- Create your own html worker (client side worker)
|
|
48
|
-
- Make html worker part of the application
|
|
52
|
+
The separation is accomplished through two complementary plugins:
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
54
|
+
- **vite-plugin-react-server/client** → Handles client-side rendering and ESM bundling
|
|
55
|
+
- **vite-plugin-react-server** → Manages server-side streaming and RSC processing
|
|
56
|
+
|
|
57
|
+
This ensures that client-side and server-side concerns remain isolated from the beginning, reducing potential inconsistencies.
|
|
58
|
+
|
|
59
|
+
### Custom composition
|
|
60
|
+
|
|
61
|
+
You can pick and choose only the plugins you like to get the desired behavior as well. For example, we can choose only to use the preserver, the transformer, static plugin, etc.
|
|
62
|
+
|
|
63
|
+
### Worker support
|
|
64
|
+
|
|
65
|
+
The client plugin uses the `rsc-worker` to create server side streams. The server plugin uses the `html-worker` to create client side html. If you don't want to use the rsc-worker, simply don't serve the client plugin. If you don't want to use the `html-worker` simply don't configure the `build.pages` option.
|
|
66
|
+
|
|
67
|
+
### Custom Worker
|
|
68
|
+
|
|
69
|
+
Both workers can be customized using the `htmlWorkerPath` and `rscWorkerPath` respectively. The paths will be used to create the workers instead of the prebuilt worker included with this plugin. If these paths are defined, they will be made part of your application build as well.
|
|
70
|
+
|
|
71
|
+
Keep in mind that, using your custom worker means interacting with the message system of this plugin during development/static generation process.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Plugin Usage
|
|
75
|
+
|
|
76
|
+
### vite-plugin-react-server/client
|
|
77
|
+
|
|
78
|
+
Used in `vite.config.ts` for standard Vite client-side behavior
|
|
53
79
|
|
|
54
|
-
## Configuration
|
|
55
|
-
For client and server boundaries to work, it's very important to know which environment (or thread) the system is in. Let's setup the client first.
|
|
56
80
|
```ts
|
|
81
|
+
import { defineConfig, type Plugin } from "vite";
|
|
57
82
|
import { vitePluginReactClient } from "vite-plugin-react-server/client";
|
|
58
|
-
import { config } from "./config
|
|
59
|
-
|
|
60
|
-
export default defineConfig(
|
|
61
|
-
|
|
62
|
-
plugins: vitePluginReactClient(config),
|
|
63
|
-
}
|
|
83
|
+
import { config } from "./vite.react.config";
|
|
84
|
+
|
|
85
|
+
export default defineConfig({
|
|
86
|
+
plugins: vitePluginReactClient(config) as Plugin[],
|
|
64
87
|
});
|
|
65
88
|
```
|
|
66
|
-
|
|
89
|
+
|
|
90
|
+
#### Build Steps
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
vite build
|
|
94
|
+
```
|
|
95
|
+
Outputs React client-side ESM files to `dist/client`.
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
vite build --ssr
|
|
99
|
+
```
|
|
100
|
+
Outputs files for server-side execution to `dist/server`.
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
vite preview
|
|
104
|
+
```
|
|
105
|
+
Serves the static directory.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### vite-plugin-react-server
|
|
110
|
+
|
|
111
|
+
Used in `vite.server.config.ts`, this plugin strictly separates client and server execution. The client components will be emitted as references.
|
|
67
112
|
|
|
68
113
|
```ts
|
|
114
|
+
import { defineConfig, Plugin } from "vite";
|
|
69
115
|
import { vitePluginReactServer } from "vite-plugin-react-server";
|
|
70
|
-
import { config } from "./config
|
|
71
|
-
|
|
72
|
-
export default defineConfig(
|
|
73
|
-
|
|
74
|
-
plugins: vitePluginReactServer(config),
|
|
75
|
-
}
|
|
116
|
+
import { config } from "./vite.react.config";
|
|
117
|
+
|
|
118
|
+
export default defineConfig({
|
|
119
|
+
plugins: vitePluginReactServer(config) as Plugin[],
|
|
76
120
|
});
|
|
77
121
|
```
|
|
78
|
-
The server plugin will look the same when you serve it, but under the hood works quite differently. This plugin requires you to write `NODE_OPTIONS="--conditions=react-server" vite --ssr --config vite.server.config.ts`. Aside from building the server dist files, it will populate the client's folder with index files for all your routes.
|
|
79
122
|
|
|
123
|
+
#### Running in Development
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
NODE_OPTIONS="--conditions=react-server" vite --config vite.server.config.ts
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Build Steps
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
NODE_OPTIONS="--conditions=react-server" vite build --config vite.server.config.ts
|
|
133
|
+
```
|
|
134
|
+
Generates server and static folder. The plugin ensures proper SSR handling without requiring `--ssr` manually.
|
|
135
|
+
Note: ssr can still be disabled via config `{ssr:false}`, which will enable vite's browser virtualization
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Static Site Generation
|
|
140
|
+
|
|
141
|
+
Single-out the static generation step by only inluding the static plugin. Expects client and server folders to be there.
|
|
80
142
|
```ts
|
|
81
|
-
import
|
|
143
|
+
import { defineConfig, Plugin } from "vite";
|
|
144
|
+
import { reactStaticPlugin } from "vite-plugin-react-server/static";
|
|
145
|
+
import { config } from "./vite.react.config";
|
|
82
146
|
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// map the id to any page/prop file
|
|
87
|
-
Page: (id)=>'page.tsx'),
|
|
88
|
-
props: (id)=>'props.ts',
|
|
89
|
-
// production html (not used during development)
|
|
90
|
-
Html: ({ children, url }) => (
|
|
91
|
-
<html>
|
|
92
|
-
<title>{url}</title>
|
|
93
|
-
<body>{children}</body>
|
|
94
|
-
</html>
|
|
95
|
-
),
|
|
96
|
-
build: {
|
|
97
|
-
// routes to build index.html and index.rsc files for
|
|
98
|
-
pages: ["/", "/about"],
|
|
99
|
-
},
|
|
100
|
-
};
|
|
147
|
+
export default defineConfig({
|
|
148
|
+
plugins: [reactStaticPlugin(config)],
|
|
149
|
+
});
|
|
101
150
|
```
|
|
102
151
|
|
|
103
|
-
|
|
152
|
+
Example output structure:
|
|
104
153
|
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"build": "npm run build:client && npm run build:server",
|
|
111
|
-
"build:client": "vite build",
|
|
112
|
-
"build:server": "NODE_OPTIONS=--conditions=react-server vite build --ssr --config vite.server.config.ts",
|
|
113
|
-
"test:server": "NODE_OPTIONS=--conditions=react-server vitest",
|
|
114
|
-
"test:client": "vitest",
|
|
115
|
-
}
|
|
116
|
-
}
|
|
154
|
+
```sh
|
|
155
|
+
dist/static/index.html
|
|
156
|
+
dist/static/index.rsc
|
|
157
|
+
dist/static/about/index.html
|
|
158
|
+
dist/static/about/index.rsc
|
|
117
159
|
```
|
|
118
160
|
|
|
119
|
-
|
|
161
|
+
The entire `dist/client` directory is copied into `dist/static`, as well as any assets used server-side. Allowing easy deployment by moving the static folder to a hosting service.
|
|
120
162
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Configuration
|
|
166
|
+
|
|
167
|
+
### moduleBase
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
const config = {
|
|
171
|
+
moduleBase: "src",
|
|
126
172
|
}
|
|
127
173
|
```
|
|
174
|
+
Defines the root directory for project modules. This can be customized.
|
|
128
175
|
|
|
129
|
-
###
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const res = await fetch("https://pokeapi.co/api/v2/pokemon-form/399/")
|
|
134
|
-
return res.json()
|
|
135
|
-
}
|
|
176
|
+
### moduleBasePath
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
moduleBasePath: "",
|
|
136
180
|
```
|
|
181
|
+
Passed as the second argument to `renderToPipeableStream` for server-side rendering.
|
|
137
182
|
|
|
138
|
-
###
|
|
139
|
-
Use the "use client" directive for client-side features:
|
|
140
|
-
```tsx
|
|
141
|
-
"use client"
|
|
142
|
-
import { useState } from 'react'
|
|
183
|
+
### moduleBaseURL
|
|
143
184
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
185
|
+
```ts
|
|
186
|
+
moduleBaseURL: "https://github.com/my-gh-pages",
|
|
187
|
+
```
|
|
188
|
+
Defines asset URL resolution for CSS collectors and bootstrapModule.
|
|
189
|
+
|
|
190
|
+
### Page and props Mapping
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
Page: (id) => join(id.replace('index.rsc',''), 'page.tsx')
|
|
194
|
+
```
|
|
195
|
+
Defines how pages are mapped to file paths.
|
|
196
|
+
```ts
|
|
197
|
+
props: (id) => join(id.replace('index.rsc',''), 'props.ts')
|
|
198
|
+
```
|
|
199
|
+
Defines how to load the initial props of the page file.
|
|
200
|
+
|
|
201
|
+
If you do not want prop files, just don't define it.
|
|
202
|
+
```ts
|
|
203
|
+
pageExport: 'Page',
|
|
204
|
+
```
|
|
205
|
+
Changes the default name "Page"
|
|
206
|
+
```ts
|
|
207
|
+
propsExport: 'props',
|
|
208
|
+
```
|
|
209
|
+
Changes the default name "props"
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Example Setup
|
|
214
|
+
|
|
215
|
+
### package.json Scripts
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
"scripts": {
|
|
219
|
+
"build": "build:client && build:server",
|
|
220
|
+
"dev": "NODE_OPTIONS='--conditions react-server' vite --config vite.server.config.ts",
|
|
221
|
+
"dev:client": "vite",
|
|
222
|
+
"build:server": "NODE_OPTIONS='--conditions react-server' vite build --config vite.server.config.ts",
|
|
223
|
+
"build:client": "vite build"
|
|
147
224
|
}
|
|
148
225
|
```
|
|
149
226
|
|
|
150
|
-
###
|
|
151
|
-
|
|
227
|
+
### Sample Page Component
|
|
228
|
+
|
|
152
229
|
```tsx
|
|
153
|
-
|
|
154
|
-
export
|
|
155
|
-
|
|
156
|
-
}
|
|
230
|
+
// src/my-page.tsx
|
|
231
|
+
export const Page = ({ name }) => {
|
|
232
|
+
return <div>Hello {name}</div>;
|
|
233
|
+
};
|
|
157
234
|
```
|
|
158
235
|
|
|
159
|
-
|
|
236
|
+
### Sample Props File
|
|
160
237
|
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
|
|
164
|
-
|
|
238
|
+
```ts
|
|
239
|
+
// src/my-props.ts
|
|
240
|
+
export const props = {
|
|
241
|
+
name: "John Doe",
|
|
242
|
+
};
|
|
243
|
+
```
|
|
165
244
|
|
|
166
|
-
|
|
245
|
+
### Vite Configuration Files
|
|
167
246
|
|
|
168
|
-
|
|
247
|
+
#### Client Configuration (`vite.config.ts`)
|
|
169
248
|
|
|
170
|
-
|
|
249
|
+
```ts
|
|
250
|
+
import { vitePluginReactClient } from "vite-plugin-react-server/client";
|
|
251
|
+
import { defineConfig } from "vite";
|
|
171
252
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
- More direct stream handling
|
|
253
|
+
export default defineConfig({
|
|
254
|
+
plugins: vitePluginReactClient(),
|
|
255
|
+
});
|
|
256
|
+
```
|
|
177
257
|
|
|
178
|
-
|
|
179
|
-
- Allows running without react-server condition
|
|
180
|
-
- Uses message passing for communication
|
|
181
|
-
- Requires explicit support for features over message channels
|
|
182
|
-
- More complex but more flexible
|
|
258
|
+
#### Server Configuration (`vite.server.config.ts`)
|
|
183
259
|
|
|
184
|
-
|
|
260
|
+
```ts
|
|
261
|
+
import { vitePluginReactServer } from "vite-plugin-react-server";
|
|
262
|
+
import { defineConfig } from "vite";
|
|
185
263
|
|
|
186
|
-
|
|
264
|
+
export default defineConfig({
|
|
265
|
+
plugins: vitePluginReactServer(),
|
|
266
|
+
});
|
|
267
|
+
```
|
|
187
268
|
|
|
188
|
-
|
|
269
|
+
---
|
|
189
270
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
- This makes worker threads essential for supporting both server and client code in the same build process
|
|
271
|
+
```sh
|
|
272
|
+
NODE_OPTIONS='--conditions react-server' npx vite --config vite.server.config.ts
|
|
273
|
+
```
|
|
194
274
|
|
|
195
|
-
|
|
275
|
+
In development mode, the server plugin pipes the React stream directly to the response.
|
|
196
276
|
|
|
197
|
-
|
|
277
|
+
```sh
|
|
278
|
+
NODE_OPTIONS='--conditions react-server' npx vite build --config vite.server.config.ts
|
|
279
|
+
```
|
|
280
|
+
This builds the `dist/server` directory. It sets ssr to true by default, so you can't forget to. Additionally, when the build is done it generates the `dist/static` directory using the /static plugin.
|
|
198
281
|
|
|
199
|
-
|
|
200
|
-
- Run in client dev mode to naturally support their worker setup
|
|
201
|
-
- Get worker isolation benefits in their application
|
|
202
|
-
- Have more control over RSC boundaries
|
|
282
|
+
---
|
|
203
283
|
|
|
204
|
-
|
|
205
|
-
- APIs for user-defined workers
|
|
206
|
-
- Documentation for worker patterns
|
|
207
|
-
- Examples of worker-based architectures
|
|
208
|
-
- Support for different worker strategies
|
|
284
|
+
## Summary
|
|
209
285
|
|
|
210
|
-
|
|
286
|
+
- **Strict Client-Server Separation** → Ensures modularity and maintainability
|
|
287
|
+
- **Static Site Generation** → Produces deployable HTML and RSC files
|
|
288
|
+
- **Dual RSC Implementation** → Supports direct streaming and worker-based approaches
|
|
289
|
+
- **Customizable Module Loading** → Allows flexible project configurations
|
|
211
290
|
|
|
212
|
-
|
|
291
|
+
This plugin provides a workflow for React Server Components within Vite, balancing **performance, modularity, and ease of use**.
|
|
213
292
|
|
|
214
|
-
MIT
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-react-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Vite plugin for React Server Components (RSC)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin/index.js",
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
".": "./dist/plugin/index.js",
|
|
20
20
|
"./client": "./dist/client.js",
|
|
21
21
|
"./server": "./dist/server.js",
|
|
22
|
+
"./static": "./dist/static.js",
|
|
22
23
|
"./html-worker": "./dist/plugin/worker/html-worker.js",
|
|
23
24
|
"./rsc-worker": "./dist/plugin/worker/rsc-worker.js",
|
|
24
25
|
"./loader": "./dist/plugin/worker/loader.js",
|
|
25
26
|
"./package.json": "./package.json",
|
|
26
27
|
"./patch": "./scripts/patch.mjs",
|
|
27
28
|
"./check-react-version": "./scripts/check-react-version.mjs",
|
|
28
|
-
"./css-loader": "./dist/plugin/loader/css-loader.js"
|
|
29
|
+
"./css-loader": "./dist/plugin/loader/css-loader.js",
|
|
30
|
+
"./components": "./dist/plugin/components.js"
|
|
29
31
|
},
|
|
30
32
|
"typesVersions": {
|
|
31
33
|
"*": {
|
|
@@ -38,11 +40,17 @@
|
|
|
38
40
|
"server": [
|
|
39
41
|
"./dist/plugin/react-server/plugin.d.ts"
|
|
40
42
|
],
|
|
43
|
+
"static": [
|
|
44
|
+
"./dist/plugin/static/plugin.d.ts"
|
|
45
|
+
],
|
|
41
46
|
"worker": [
|
|
42
47
|
"./dist/plugin/worker/worker.d.ts"
|
|
43
48
|
],
|
|
44
49
|
"loader": [
|
|
45
50
|
"./dist/plugin/worker/loader.d.ts"
|
|
51
|
+
],
|
|
52
|
+
"components": [
|
|
53
|
+
"./dist/plugin/components.d.ts"
|
|
46
54
|
]
|
|
47
55
|
}
|
|
48
56
|
},
|
|
@@ -120,13 +128,12 @@
|
|
|
120
128
|
"typescript": "^5.7.3",
|
|
121
129
|
"vite": "^6.0.11",
|
|
122
130
|
"vitest": "^3.0.4",
|
|
123
|
-
"webpack-sources": "^3.2.3"
|
|
131
|
+
"webpack-sources": "^3.2.3",
|
|
132
|
+
"tsx": "^4.19.2"
|
|
124
133
|
},
|
|
125
134
|
"bin": {
|
|
126
135
|
"check-react-version": "./scripts/check-react-version.mjs",
|
|
127
136
|
"patch": "./bin/patch.mjs"
|
|
128
137
|
},
|
|
129
|
-
"dependencies": {
|
|
130
|
-
"tsx": "^4.19.2"
|
|
131
|
-
}
|
|
138
|
+
"dependencies": {}
|
|
132
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-manifest-client-files.d.ts","sourceRoot":"","sources":["../../plugin/collect-manifest-client-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAIlD,wBAAsB,qBAAqB,CAAC,EAC1C,WAAW,EACX,QAAQ,EACR,KAAK,EACL,SAAS,GACV,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,gCAoBA;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,cAAc,EACd,UAA0D,EAC1D,QAAmD,GACpD,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC;;;
|
|
1
|
+
{"version":3,"file":"collect-manifest-client-files.d.ts","sourceRoot":"","sources":["../../plugin/collect-manifest-client-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAIlD,wBAAsB,qBAAqB,CAAC,EAC1C,WAAW,EACX,QAAQ,EACR,KAAK,EACL,SAAS,GACV,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,gCAoBA;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,cAAc,EACd,UAA0D,EAC1D,QAAmD,GACpD,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC;;;EA6GA"}
|
|
@@ -24,7 +24,6 @@ async function collectModuleGraphCss({
|
|
|
24
24
|
seen.add(mod.id);
|
|
25
25
|
if (mod?.id?.endsWith(".css")) {
|
|
26
26
|
cssFiles.set(mod?.url, mod?.id);
|
|
27
|
-
onCss?.(mod?.url, parentUrl ?? pagePath);
|
|
28
27
|
}
|
|
29
28
|
mod?.importedModules?.forEach((imp) => walkModule(imp));
|
|
30
29
|
};
|
|
@@ -61,11 +60,19 @@ function collectManifestClientFiles({
|
|
|
61
60
|
seen.add(id);
|
|
62
61
|
const entry = manifest[id] ?? manifestValues.find((e) => id === e.file);
|
|
63
62
|
if (!entry) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const hasKey = Object.keys(manifest).find((key) => id === key);
|
|
64
|
+
if (hasKey) {
|
|
65
|
+
console.log(
|
|
66
|
+
`Manifest entry found for ${id}, but it is ${typeof entry}`
|
|
67
|
+
);
|
|
68
|
+
return;
|
|
69
|
+
} else {
|
|
70
|
+
console.log(
|
|
71
|
+
`No manifest entry found for ${id}, possible keys: ${Object.keys(
|
|
72
|
+
manifest
|
|
73
|
+
).join(", ")}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
69
76
|
return;
|
|
70
77
|
}
|
|
71
78
|
if (typeof testClient === "function" && typeof onClientModule === "function" && testClient(entry.file) || typeof testJson === "function" && testJson(entry.file)) {
|
|
@@ -103,11 +110,18 @@ function collectManifestClientFiles({
|
|
|
103
110
|
if (entry) {
|
|
104
111
|
walkManifestEntry(value, pagePath);
|
|
105
112
|
} else {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
const hasKey = Object.keys(manifest).find((key) => value === key);
|
|
114
|
+
if (hasKey) {
|
|
115
|
+
console.warn(
|
|
116
|
+
`Manifest entry found for ${value}, but it is ${typeof manifest[hasKey]}`
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
console.warn(
|
|
120
|
+
`No manifest entry found for ${value} (tried all possible keys: ${possibleKeys.join(
|
|
121
|
+
", "
|
|
122
|
+
)} for manifest keys: ${Object.keys(manifest).join(", ")})`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
111
125
|
}
|
|
112
126
|
}
|
|
113
127
|
return { cssFiles, clientFiles };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-manifest-client-files.js","sources":["../../plugin/collect-manifest-client-files.ts"],"sourcesContent":["import type { Manifest, ModuleGraph } from \"vite\";\nimport { createInputNormalizer } from \"./helpers/inputNormalizer.js\";\nimport { DEFAULT_CONFIG } from \"./config/defaults.js\";\n\nexport async function collectModuleGraphCss({\n moduleGraph,\n pagePath,\n onCss,\n parentUrl,\n}: {\n moduleGraph: ModuleGraph;\n pagePath: string;\n onCss?: (path: string, parentUrl: string) => void;\n parentUrl?: string;\n}) {\n if (!pagePath) return new Map<string, string>();\n\n const cssFiles = new Map<string, string>();\n const pageModule = await moduleGraph.getModuleByUrl(pagePath, true);\n if (!pageModule) {\n return new Map<string, string>();\n }\n const seen = new Set<string>();\n const walkModule = (mod: any) => {\n if (!mod?.id || seen.has(mod.id)) return;\n seen.add(mod.id);\n if (mod?.id?.endsWith(\".css\")) {\n cssFiles.set(mod?.url, mod?.id);\n onCss?.(mod?.url, parentUrl ?? pagePath);\n }\n mod?.importedModules?.forEach((imp: any) => walkModule(imp));\n };\n walkModule(pageModule);\n return cssFiles;\n}\n\nexport function collectManifestClientFiles({\n manifest,\n root,\n pagePath,\n preserveModulesRoot,\n moduleBase,\n onCss,\n onClientModule,\n testClient = DEFAULT_CONFIG.AUTO_DISCOVER.clientComponents,\n testJson = DEFAULT_CONFIG.AUTO_DISCOVER.jsonPattern,\n}: {\n manifest: Manifest;\n root: string;\n pagePath: string;\n preserveModulesRoot?: boolean;\n moduleBase?: string;\n onCss?: (path: string, parentUrl: string) => void;\n onClientModule?: (path: string, parentUrl: string) => void;\n parentUrl?: string;\n testClient?: (id: string) => boolean;\n testJson?: (id: string) => boolean;\n}) {\n const normalizer = createInputNormalizer({\n root,\n removeExtension: true,\n preserveModulesRoot: preserveModulesRoot ? moduleBase : undefined,\n });\n const [_, value] = normalizer(pagePath);\n\n const cssFiles = new Map<string, string>();\n const clientFiles = new Map<string, string>();\n const seen = new Set<string>();\n const manifestValues = Object.values(manifest);\n\n // Try different variations of the path\n const possibleKeys = [\n value, // Relative path\n ];\n\n const walkManifestEntry = (id: string, parentUrl: string) => {\n if (seen.has(id)) return;\n seen.add(id);\n\n // Get the manifest entry\n const entry = manifest[id] ?? manifestValues.find((e) => id === e.file);\n if (!entry) {\n console.log(\n `No manifest entry found for ${id}, possible keys: ${Object.keys(\n
|
|
1
|
+
{"version":3,"file":"collect-manifest-client-files.js","sources":["../../plugin/collect-manifest-client-files.ts"],"sourcesContent":["import type { Manifest, ModuleGraph } from \"vite\";\nimport { createInputNormalizer } from \"./helpers/inputNormalizer.js\";\nimport { DEFAULT_CONFIG } from \"./config/defaults.js\";\n\nexport async function collectModuleGraphCss({\n moduleGraph,\n pagePath,\n onCss,\n parentUrl,\n}: {\n moduleGraph: ModuleGraph;\n pagePath: string;\n onCss?: (path: string, parentUrl: string) => void;\n parentUrl?: string;\n}) {\n if (!pagePath) return new Map<string, string>();\n\n const cssFiles = new Map<string, string>();\n const pageModule = await moduleGraph.getModuleByUrl(pagePath, true);\n if (!pageModule) {\n return new Map<string, string>();\n }\n const seen = new Set<string>();\n const walkModule = (mod: any) => {\n if (!mod?.id || seen.has(mod.id)) return;\n seen.add(mod.id);\n if (mod?.id?.endsWith(\".css\")) {\n cssFiles.set(mod?.url, mod?.id);\n onCss?.(mod?.url, parentUrl ?? pagePath);\n }\n mod?.importedModules?.forEach((imp: any) => walkModule(imp));\n };\n walkModule(pageModule);\n return cssFiles;\n}\n\nexport function collectManifestClientFiles({\n manifest,\n root,\n pagePath,\n preserveModulesRoot,\n moduleBase,\n onCss,\n onClientModule,\n testClient = DEFAULT_CONFIG.AUTO_DISCOVER.clientComponents,\n testJson = DEFAULT_CONFIG.AUTO_DISCOVER.jsonPattern,\n}: {\n manifest: Manifest;\n root: string;\n pagePath: string;\n preserveModulesRoot?: boolean;\n moduleBase?: string;\n onCss?: (path: string, parentUrl: string) => void;\n onClientModule?: (path: string, parentUrl: string) => void;\n parentUrl?: string;\n testClient?: (id: string) => boolean;\n testJson?: (id: string) => boolean;\n}) {\n const normalizer = createInputNormalizer({\n root,\n removeExtension: true,\n preserveModulesRoot: preserveModulesRoot ? moduleBase : undefined,\n });\n const [_, value] = normalizer(pagePath);\n\n const cssFiles = new Map<string, string>();\n const clientFiles = new Map<string, string>();\n const seen = new Set<string>();\n const manifestValues = Object.values(manifest);\n\n // Try different variations of the path\n const possibleKeys = [\n value, // Relative path\n ];\n\n const walkManifestEntry = (id: string, parentUrl: string) => {\n if (seen.has(id)) return;\n seen.add(id);\n\n // Get the manifest entry\n const entry = manifest[id] ?? manifestValues.find((e) => id === e.file);\n if (!entry) {\n const hasKey = Object.keys(manifest).find((key) => id === key);\n if (hasKey) {\n console.log(\n `Manifest entry found for ${id}, but it is ${typeof entry}`\n );\n return;\n } else {\n console.log(\n `No manifest entry found for ${id}, possible keys: ${Object.keys(\n manifest\n ).join(\", \")}`\n );\n }\n return;\n }\n if (\n (typeof testClient === \"function\" &&\n typeof onClientModule === \"function\" &&\n testClient(entry.file)) ||\n (typeof testJson === \"function\" && testJson(entry.file))\n ) {\n onClientModule?.(entry.file ?? \"\", parentUrl);\n clientFiles.set(id, entry.name ?? \"\");\n }\n\n // Add direct CSS from the css array\n if (entry.css) {\n entry.css.forEach((css: string) => {\n cssFiles.set(css, css);\n onCss?.(css, id);\n onClientModule?.(css, id);\n });\n }\n\n // Walk imports recursively\n if (entry.imports) {\n entry.imports.forEach((imp: string) =>\n walkManifestEntry(imp, entry.file)\n );\n }\n\n // Also check dynamicImports\n if (entry.dynamicImports) {\n entry.dynamicImports.forEach((imp: string) =>\n walkManifestEntry(imp, entry.file)\n );\n }\n };\n\n // Try all possible keys\n for (const possibleKey of possibleKeys) {\n if (manifest[possibleKey]) {\n walkManifestEntry(possibleKey, pagePath);\n break;\n }\n }\n\n // If no entry found by key, try matching by file\n if (cssFiles.size === 0) {\n const entry = manifestValues.find(\n (e) =>\n possibleKeys.includes(e.file) ||\n (e.src && possibleKeys.includes(e.src)) ||\n (e.name && possibleKeys.includes(e.name))\n );\n if (entry) {\n walkManifestEntry(value, pagePath);\n } else {\n const hasKey = Object.keys(manifest).find((key) => value === key);\n if (hasKey) {\n console.warn(\n `Manifest entry found for ${value}, but it is ${typeof manifest[hasKey]}`\n );\n } else {\n console.warn(\n `No manifest entry found for ${value} (tried all possible keys: ${possibleKeys.join(\n \", \"\n )} for manifest keys: ${Object.keys(manifest).join(\", \")})`\n );\n }\n }\n }\n\n return { cssFiles, clientFiles };\n}\n"],"names":[],"mappings":";;;;;;;;AAIA,eAAsB,qBAAsB,CAAA;AAAA,EAC1C,WAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAKG,EAAA;AACD,EAAA,IAAI,CAAC,QAAA,EAAiB,uBAAA,IAAI,GAAoB,EAAA;AAE9C,EAAM,MAAA,QAAA,uBAAe,GAAoB,EAAA;AACzC,EAAA,MAAM,UAAa,GAAA,MAAM,WAAY,CAAA,cAAA,CAAe,UAAU,IAAI,CAAA;AAClE,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAA,2BAAW,GAAoB,EAAA;AAAA;AAEjC,EAAM,MAAA,IAAA,uBAAW,GAAY,EAAA;AAC7B,EAAM,MAAA,UAAA,GAAa,CAAC,GAAa,KAAA;AAC/B,IAAA,IAAI,CAAC,GAAK,EAAA,EAAA,IAAM,KAAK,GAAI,C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A;AAAA,UACN,4BAA4B,KAAK,CAAA,YAAA,EAAe,OAAO,QAAA,CAAS,MAAM,CAAC,CAAA;AAAA,SACzE;AAAA,OACK,MAAA;AACL,QAAQ,OAAA,CAAA,IAAA;AAAA,UACN,CAAA,4BAAA,EAA+B,KAAK,CAAA,2BAAA,EAA8B,YAAa,CAAA,IAAA;AAAA,YAC7E;AAAA,WACD,uBAAuB,MAAO,CAAA,IAAA,CAAK,QAAQ,CAAE,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAAA,SAC1D;AAAA;AACF;AACF;AAGF,EAAO,OAAA,EAAE,UAAU,WAAY,EAAA;AACjC;;;;"}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The high precedence ensures they bubble up to the document head.
|
|
5
|
-
*/
|
|
6
|
-
export declare function CssCollector({ children, cssFiles, moduleBaseUrl, route }: {
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
cssFiles: string[];
|
|
9
|
-
moduleBaseUrl?: string;
|
|
10
|
-
route?: string;
|
|
11
|
-
}): React.FunctionComponentElement<{
|
|
12
|
-
children?: React.ReactNode | undefined;
|
|
13
|
-
}>;
|
|
1
|
+
export { Html } from "./html.js";
|
|
2
|
+
export { CssCollector } from "./css-collector.js";
|
|
3
|
+
export { InlineCssCollector } from "./css-collector-inline.js";
|
|
14
4
|
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../plugin/components.
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../plugin/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|