vite-plugin-react-server 0.3.19 → 1.0.1
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 +245 -144
- 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/README.md +1 -6
- 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,307 @@ A Vite plugin that enables React Server Components (RSC) streaming and static bu
|
|
|
10
9
|
|
|
11
10
|
## Installation
|
|
12
11
|
|
|
13
|
-
```
|
|
14
|
-
npm install -D vite-plugin-react-
|
|
12
|
+
```sh
|
|
13
|
+
npm install -D vite-plugin-react-server
|
|
14
|
+
```
|
|
15
|
+
|
|
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
|
|
15
22
|
```
|
|
16
23
|
|
|
17
|
-
|
|
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
|
-
- Make rsc worker part of the application
|
|
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
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
### Configuration
|
|
56
77
|
```ts
|
|
57
|
-
import {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
import type { StreamPluginOptions } from "vite-plugin-react-server/server";
|
|
79
|
+
|
|
80
|
+
const createRouter = (file: "props.ts" | "page.tsx") => (url: string) => {
|
|
81
|
+
switch (url) {
|
|
82
|
+
case "/bidoof":
|
|
83
|
+
case "/bidoof/index.rsc":
|
|
84
|
+
return `src/page/bidoof/${file}`;
|
|
85
|
+
case "/404":
|
|
86
|
+
case "/404/index.rsc":
|
|
87
|
+
return `src/page/404/${file}`;
|
|
88
|
+
case "/":
|
|
89
|
+
case "/index.rsc":
|
|
90
|
+
return `src/page/${file}`;
|
|
91
|
+
default:
|
|
92
|
+
throw new Error(`Unknown route: ${url}`);
|
|
63
93
|
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const config = {
|
|
97
|
+
moduleBase: "src",
|
|
98
|
+
Page: createRouter("page.tsx"),
|
|
99
|
+
props: createRouter("props.ts"),
|
|
100
|
+
Html: Html,
|
|
101
|
+
build: {
|
|
102
|
+
pages: ["/", "/bidoof", "/404" ],
|
|
103
|
+
},
|
|
104
|
+
} satisfies StreamPluginOptions;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### vite-plugin-react-server/client
|
|
108
|
+
|
|
109
|
+
Used in `vite.config.ts` for standard Vite client-side behavior
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { defineConfig, type Plugin } from "vite";
|
|
113
|
+
import { vitePluginReactClient } from "vite-plugin-react-server/client";
|
|
114
|
+
import { config } from "./vite.react.config";
|
|
115
|
+
|
|
116
|
+
export default defineConfig({
|
|
117
|
+
plugins: vitePluginReactClient(config),
|
|
64
118
|
});
|
|
65
119
|
```
|
|
66
|
-
|
|
120
|
+
|
|
121
|
+
#### Build Steps
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
vite build
|
|
125
|
+
```
|
|
126
|
+
Outputs React client-side ESM files to `dist/client`.
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
vite build --ssr
|
|
130
|
+
```
|
|
131
|
+
Outputs files for server-side execution to `dist/server`.
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
vite preview
|
|
135
|
+
```
|
|
136
|
+
Serves the static directory.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### vite-plugin-react-server
|
|
141
|
+
|
|
142
|
+
Used in `vite.server.config.ts`, this plugin strictly separates client and server execution. The client components will be emitted as references.
|
|
67
143
|
|
|
68
144
|
```ts
|
|
145
|
+
import { defineConfig, Plugin } from "vite";
|
|
69
146
|
import { vitePluginReactServer } from "vite-plugin-react-server";
|
|
70
|
-
import { config } from "./config
|
|
71
|
-
|
|
72
|
-
export default defineConfig(
|
|
73
|
-
|
|
74
|
-
plugins: vitePluginReactServer(config),
|
|
75
|
-
}
|
|
147
|
+
import { config } from "./vite.react.config";
|
|
148
|
+
|
|
149
|
+
export default defineConfig({
|
|
150
|
+
plugins: vitePluginReactServer(config) as Plugin[],
|
|
76
151
|
});
|
|
77
152
|
```
|
|
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
153
|
|
|
154
|
+
#### Running in Development
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
NODE_OPTIONS="--conditions=react-server" vite --config vite.server.config.ts
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Build Steps
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
NODE_OPTIONS="--conditions=react-server" vite build --config vite.server.config.ts
|
|
164
|
+
```
|
|
165
|
+
Generates server and static folder. The plugin ensures proper SSR handling without requiring `--ssr` manually.
|
|
166
|
+
Note: ssr can still be disabled via config `{ssr:false}`, which will enable vite's browser virtualization
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Static Site Generation
|
|
171
|
+
|
|
172
|
+
Single-out the static generation step by only inluding the static plugin. Expects client and server folders to be there.
|
|
80
173
|
```ts
|
|
81
|
-
import
|
|
174
|
+
import { defineConfig, Plugin } from "vite";
|
|
175
|
+
import { reactStaticPlugin } from "vite-plugin-react-server/static";
|
|
176
|
+
import { config } from "./vite.react.config";
|
|
82
177
|
|
|
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
|
-
};
|
|
178
|
+
export default defineConfig({
|
|
179
|
+
plugins: [reactStaticPlugin(config)],
|
|
180
|
+
});
|
|
101
181
|
```
|
|
102
182
|
|
|
103
|
-
|
|
183
|
+
Example output structure:
|
|
104
184
|
|
|
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
|
-
}
|
|
185
|
+
```sh
|
|
186
|
+
dist/static/index.html
|
|
187
|
+
dist/static/index.rsc
|
|
188
|
+
dist/static/about/index.html
|
|
189
|
+
dist/static/about/index.rsc
|
|
117
190
|
```
|
|
118
191
|
|
|
119
|
-
|
|
192
|
+
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
193
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Configuration
|
|
197
|
+
|
|
198
|
+
### moduleBase
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
const config = {
|
|
202
|
+
moduleBase: "src",
|
|
126
203
|
}
|
|
127
204
|
```
|
|
205
|
+
Defines the root directory for project modules. This can be customized.
|
|
128
206
|
|
|
129
|
-
###
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const res = await fetch("https://pokeapi.co/api/v2/pokemon-form/399/")
|
|
134
|
-
return res.json()
|
|
135
|
-
}
|
|
207
|
+
### moduleBasePath
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
moduleBasePath: "",
|
|
136
211
|
```
|
|
212
|
+
Passed as the second argument to `renderToPipeableStream` for server-side rendering.
|
|
137
213
|
|
|
138
|
-
###
|
|
139
|
-
Use the "use client" directive for client-side features:
|
|
140
|
-
```tsx
|
|
141
|
-
"use client"
|
|
142
|
-
import { useState } from 'react'
|
|
214
|
+
### moduleBaseURL
|
|
143
215
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return <button onClick={() => setCount(c => c + 1)}>{count}</button>
|
|
147
|
-
}
|
|
216
|
+
```ts
|
|
217
|
+
moduleBaseURL: "https://github.com/my-gh-pages",
|
|
148
218
|
```
|
|
219
|
+
Defines asset URL resolution for CSS collectors and bootstrapModule.
|
|
149
220
|
|
|
150
|
-
###
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
221
|
+
### Page and props Mapping
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
Page: (id) => join(id.replace('index.rsc',''), 'page.tsx')
|
|
225
|
+
```
|
|
226
|
+
Defines how pages are mapped to file paths.
|
|
227
|
+
```ts
|
|
228
|
+
props: (id) => join(id.replace('index.rsc',''), 'props.ts')
|
|
229
|
+
```
|
|
230
|
+
Defines how to load the initial props of the page file.
|
|
231
|
+
|
|
232
|
+
If you do not want prop files, just don't define it.
|
|
233
|
+
```ts
|
|
234
|
+
pageExportName: 'Page',
|
|
157
235
|
```
|
|
236
|
+
Changes the default name "Page"
|
|
237
|
+
```ts
|
|
238
|
+
propsExportName: 'props',
|
|
239
|
+
```
|
|
240
|
+
Changes the default name "props"
|
|
158
241
|
|
|
159
|
-
|
|
242
|
+
---
|
|
160
243
|
|
|
161
|
-
|
|
162
|
-
- CSS files are automatically collected and link tags emitted
|
|
163
|
-
- Components are streamed only when visited
|
|
164
|
-
- Supports both sync and async props, and all kinds of combinations I haven't tried or tested yet!
|
|
244
|
+
## Example Setup
|
|
165
245
|
|
|
166
|
-
|
|
246
|
+
### package.json Scripts
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
"scripts": {
|
|
250
|
+
"build": "build:client && build:server",
|
|
251
|
+
"dev": "NODE_OPTIONS='--conditions react-server' vite --config vite.server.config.ts",
|
|
252
|
+
"dev:client": "vite",
|
|
253
|
+
"build:server": "NODE_OPTIONS='--conditions react-server' vite build --config vite.server.config.ts",
|
|
254
|
+
"build:client": "vite build"
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Sample Page Component
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
// src/my-page.tsx
|
|
262
|
+
export const Page = ({ name }) => {
|
|
263
|
+
return <div>Hello {name}</div>;
|
|
264
|
+
};
|
|
265
|
+
```
|
|
167
266
|
|
|
168
|
-
###
|
|
267
|
+
### Sample Props File
|
|
169
268
|
|
|
170
|
-
|
|
269
|
+
```ts
|
|
270
|
+
// src/my-props.ts
|
|
271
|
+
export const props = {
|
|
272
|
+
name: "John Doe",
|
|
273
|
+
};
|
|
274
|
+
```
|
|
171
275
|
|
|
172
|
-
|
|
173
|
-
- Simpler architecture
|
|
174
|
-
- Better error reporting (same errors in console and browser)
|
|
175
|
-
- Easier to debug
|
|
176
|
-
- More direct stream handling
|
|
276
|
+
### Vite Configuration Files
|
|
177
277
|
|
|
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
|
|
278
|
+
#### Client Configuration (`vite.config.ts`)
|
|
183
279
|
|
|
184
|
-
|
|
280
|
+
```ts
|
|
281
|
+
import { vitePluginReactClient } from "vite-plugin-react-server/client";
|
|
282
|
+
import { defineConfig } from "vite";
|
|
185
283
|
|
|
186
|
-
|
|
284
|
+
export default defineConfig({
|
|
285
|
+
plugins: vitePluginReactClient(),
|
|
286
|
+
});
|
|
287
|
+
```
|
|
187
288
|
|
|
188
|
-
|
|
289
|
+
#### Server Configuration (`vite.server.config.ts`)
|
|
189
290
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
- This makes worker threads essential for supporting both server and client code in the same build process
|
|
291
|
+
```ts
|
|
292
|
+
import { vitePluginReactServer } from "vite-plugin-react-server";
|
|
293
|
+
import { defineConfig } from "vite";
|
|
194
294
|
|
|
195
|
-
|
|
295
|
+
export default defineConfig({
|
|
296
|
+
plugins: vitePluginReactServer(),
|
|
297
|
+
});
|
|
298
|
+
```
|
|
196
299
|
|
|
197
|
-
|
|
300
|
+
---
|
|
198
301
|
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
|
|
202
|
-
- Have more control over RSC boundaries
|
|
302
|
+
```sh
|
|
303
|
+
NODE_OPTIONS='--conditions react-server' npx vite --config vite.server.config.ts
|
|
304
|
+
```
|
|
203
305
|
|
|
204
|
-
|
|
205
|
-
- APIs for user-defined workers
|
|
206
|
-
- Documentation for worker patterns
|
|
207
|
-
- Examples of worker-based architectures
|
|
208
|
-
- Support for different worker strategies
|
|
306
|
+
In development mode, the server plugin pipes the React stream directly to the response.
|
|
209
307
|
|
|
210
|
-
|
|
308
|
+
```sh
|
|
309
|
+
NODE_OPTIONS='--conditions react-server' npx vite build --config vite.server.config.ts
|
|
310
|
+
```
|
|
311
|
+
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.
|
|
211
312
|
|
|
212
|
-
##
|
|
313
|
+
## Contributions
|
|
213
314
|
|
|
214
|
-
|
|
315
|
+
If you want to help develop or maintain the plugin feel free to open a PR or issue on GitHub.
|
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.1",
|
|
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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AA;AACvC,MAAA;AAAA;AACF;AAIF,EAAI,IAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AACvB,IAAA,MAAM,QAAQ,cAAe,CAAA,IAAA;AAAA,MAC3B,CAAC,CACC,KAAA,YAAA,CAAa,SAAS,CAAE,CAAA,IAAI,KAC3B,CAAE,CAAA,GAAA,IAAO,aAAa,QAAS,CAAA,CAAA,CAAE,GAAG,CACpC,IAAA,CAAA,CAAE,QAAQ,YAAa,CAAA,QAAA,CAAS,EAAE,IAAI;AAAA,KAC3C;AACA,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,iBAAA,CAAkB,OAAO,QAAQ,CAAA;AAAA,KAC5B,MAAA;AACL,MAAM,MAAA,MAAA,GAAS,OAAO,IAAK,CAAA,QAAQ,EAAE,IAAK,CAAA,CAAC,GAAQ,KAAA,KAAA,KAAU,GAAG,CAAA;AAChE,MAAA,IAAI,MAAQ,EAAA;AACV,QAAQ,OAAA,CAAA,IAAA;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"}
|