@vitejs/plugin-rsc 0.4.29 → 0.4.30
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 +2 -50
- package/dist/{browser-DUDACP5e.d.ts → browser-CQv7Z3J4.d.ts} +1 -1
- package/dist/browser.d.ts +3 -3
- package/dist/cjs-WQBk0zA_.js +104 -0
- package/dist/core/browser.d.ts +1 -1
- package/dist/core/rsc.d.ts +2 -2
- package/dist/core/rsc.js +1 -1
- package/dist/core/ssr.d.ts +2 -2
- package/dist/core/ssr.js +1 -1
- package/dist/{encryption-runtime-CAmm02Ms.js → encryption-runtime-CugTJCLM.js} +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/browser.js +1 -1
- package/dist/extra/rsc.d.ts +1 -1
- package/dist/extra/rsc.js +4 -4
- package/dist/extra/ssr.js +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/{plugin-DB5WEabT.js → plugin-Bzocj-4a.js} +49 -165
- package/dist/{plugin-BDdwA9-Y.d.ts → plugin-Cfy_9VpM.d.ts} +1 -1
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +3 -2
- package/dist/plugins/cjs.d.ts +6 -0
- package/dist/plugins/cjs.js +5 -0
- package/dist/react/browser.d.ts +3 -3
- package/dist/react/rsc.d.ts +3 -3
- package/dist/react/rsc.js +2 -2
- package/dist/react/ssr.d.ts +3 -3
- package/dist/react/ssr.js +2 -2
- package/dist/{rsc-BeJKxeMX.d.ts → rsc-3bkzqdsJ.d.ts} +1 -1
- package/dist/{rsc-DdBcg-Lb.js → rsc-BdCB3621.js} +1 -1
- package/dist/{rsc-D_DDN0W1.js → rsc-CiAoLCx8.js} +1 -1
- package/dist/rsc-html-stream/browser.js +1 -1
- package/dist/rsc-html-stream/ssr.js +1 -1
- package/dist/rsc.d.ts +4 -4
- package/dist/rsc.js +4 -4
- package/dist/{ssr-Y4u1WaMw.js → ssr-8BA2nj0-.js} +2 -2
- package/dist/{ssr-Bv84RACl.d.ts → ssr-CMjeQ9AS.d.ts} +1 -1
- package/dist/{ssr-D8iPOYvE.js → ssr-Cd4SbAaO.js} +1 -1
- package/dist/ssr.d.ts +3 -3
- package/dist/ssr.js +4 -4
- package/dist/transforms/index.d.ts +1 -1
- package/dist/utils/encryption-runtime.d.ts +1 -1
- package/dist/utils/encryption-runtime.js +3 -3
- package/package.json +1 -1
- /package/dist/{browser-CyGTajab.d.ts → browser-DwWQeoll.d.ts} +0 -0
- /package/dist/{client-BPIq1kGs.js → client-C7Eok9hc.js} +0 -0
- /package/dist/{encryption-runtime-BwOew_5N.d.ts → encryption-runtime-B8xcnJoN.d.ts} +0 -0
- /package/dist/{index-CrcbP1rd.d.ts → index-CPkExgij.d.ts} +0 -0
- /package/dist/{index-BH1wcQPN.d.ts → index-DWN3vCIQ.d.ts} +0 -0
- /package/dist/{rsc-cp4EenMG.js → rsc-GFzFWyhT.js} +0 -0
- /package/dist/{rsc-CpPqIkYr.d.ts → rsc-JJjz3Z0i.d.ts} +0 -0
- /package/dist/{rsc-D-lnfNSa.d.ts → rsc-c22DF1A7.d.ts} +0 -0
- /package/dist/{server-DoWzqBNF.js → server-BTo03tXh.js} +0 -0
- /package/dist/{shared-Cwk6fxfN.js → shared-AvKUASD5.js} +0 -0
- /package/dist/{ssr-CXrYz0RZ.d.ts → ssr-BrSGyrxe.d.ts} +0 -0
- /package/dist/{ssr-CMFFChNQ.js → ssr-Cm2FP2zD.js} +0 -0
package/README.md
CHANGED
|
@@ -14,12 +14,12 @@ This package provides [React Server Components](https://react.dev/reference/rsc/
|
|
|
14
14
|
You can create a starter project by:
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
|
|
17
|
+
npm create vite@latest -- --template rsc
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Examples
|
|
21
21
|
|
|
22
|
-
**Start here:** [`./examples/starter`](./examples/starter) - Recommended for understanding the
|
|
22
|
+
**Start here:** [`./examples/starter`](./examples/starter) - Recommended for understanding the package
|
|
23
23
|
|
|
24
24
|
- Provides an in-depth overview of API with inline comments to explain how they function within RSC-powered React application.
|
|
25
25
|
|
|
@@ -295,35 +295,6 @@ export function UserApp() {
|
|
|
295
295
|
}
|
|
296
296
|
```
|
|
297
297
|
|
|
298
|
-
#### `<id>?vite-rsc-css-export=<name>`
|
|
299
|
-
|
|
300
|
-
This special query convention provides automatic injection of `import.meta.viteRsc.loadCss`.
|
|
301
|
-
|
|
302
|
-
For example,
|
|
303
|
-
|
|
304
|
-
```tsx
|
|
305
|
-
// my-route.tsx
|
|
306
|
-
export function Page(props) {
|
|
307
|
-
return <div>...</div>
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// my-route.tsx?vite-rsc-css-export=Page
|
|
311
|
-
function Page(props) {
|
|
312
|
-
return <div>...</div>
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
function __Page(props) {
|
|
316
|
-
return (
|
|
317
|
-
<>
|
|
318
|
-
{import.meta.viteRsc.loadCss()}
|
|
319
|
-
<Page {...props} />
|
|
320
|
-
</>
|
|
321
|
-
)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
export { __Page as Page }
|
|
325
|
-
```
|
|
326
|
-
|
|
327
298
|
### Available on `ssr` environment
|
|
328
299
|
|
|
329
300
|
#### `import.meta.viteRsc.loadBootstrapScriptContent("index")`
|
|
@@ -434,25 +405,6 @@ This module re-exports RSC runtime API provided by `react-server-dom/client.brow
|
|
|
434
405
|
- `createFromFetch`: a robust way of `createFromReadableStream((await fetch("...")).body)`
|
|
435
406
|
- `encodeReply/setServerCallback`: server function related...
|
|
436
407
|
|
|
437
|
-
## High level API
|
|
438
|
-
|
|
439
|
-
> [!NOTE]
|
|
440
|
-
> High level API is deprecated. Please write on your own `@vitejs/plugin-rsc/{rsc,ssr,browser}` integration.
|
|
441
|
-
|
|
442
|
-
This is a wrapper of `react-server-dom` API and helper API to setup a minimal RSC app without writing own framework code like [`./examples/starter/src/framework`](./examples/starter/src/framework/). See [`./examples/basic`](./examples/basic/) for how this API is used.
|
|
443
|
-
|
|
444
|
-
### `@vitejs/plugin-rsc/extra/rsc`
|
|
445
|
-
|
|
446
|
-
- `renderRequest`
|
|
447
|
-
|
|
448
|
-
### `@vitejs/plugin-rsc/extra/ssr`
|
|
449
|
-
|
|
450
|
-
- `renderHtml`
|
|
451
|
-
|
|
452
|
-
### `@vitejs/plugin-rsc/extra/browser`
|
|
453
|
-
|
|
454
|
-
- `hydrate`
|
|
455
|
-
|
|
456
408
|
## CSS Support
|
|
457
409
|
|
|
458
410
|
The plugin automatically handles CSS code-splitting and injection for server components. This eliminates the need to manually call [`import.meta.viteRsc.loadCss()`](#importmetaviterscloadcss) in most cases.
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallServerCallback } from "./index-
|
|
2
|
-
import { setRequireModule } from "./browser-
|
|
3
|
-
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./browser-
|
|
1
|
+
import { CallServerCallback } from "./index-CPkExgij.js";
|
|
2
|
+
import { setRequireModule } from "./browser-DwWQeoll.js";
|
|
3
|
+
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./browser-CQv7Z3J4.js";
|
|
4
4
|
export { CallServerCallback, callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createDebug } from "./dist-DiJnRA1C.js";
|
|
2
|
+
import { parseIdQuery } from "./shared-AvKUASD5.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import * as esModuleLexer from "es-module-lexer";
|
|
6
|
+
import MagicString from "magic-string";
|
|
7
|
+
import { parseAstAsync } from "vite";
|
|
8
|
+
import { findClosestPkgJsonPath } from "vitefu";
|
|
9
|
+
import { walk } from "estree-walker";
|
|
10
|
+
import { analyze } from "periscopic";
|
|
11
|
+
|
|
12
|
+
//#region src/transforms/cjs.ts
|
|
13
|
+
function transformCjsToEsm(code, ast) {
|
|
14
|
+
const output = new MagicString(code);
|
|
15
|
+
const analyzed = analyze(ast);
|
|
16
|
+
const parentNodes = [];
|
|
17
|
+
const hoistedCodes = [];
|
|
18
|
+
let hoistIndex = 0;
|
|
19
|
+
walk(ast, {
|
|
20
|
+
enter(node) {
|
|
21
|
+
parentNodes.push(node);
|
|
22
|
+
if (node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1) {
|
|
23
|
+
let isTopLevel = true;
|
|
24
|
+
for (const parent of parentNodes) {
|
|
25
|
+
if (parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ArrowFunctionExpression") isTopLevel = false;
|
|
26
|
+
const scope = analyzed.map.get(parent);
|
|
27
|
+
if (scope && scope.declarations.has("require")) return;
|
|
28
|
+
}
|
|
29
|
+
if (isTopLevel) {
|
|
30
|
+
output.update(node.start, node.callee.end, "((await import");
|
|
31
|
+
output.appendRight(node.end, ").default)");
|
|
32
|
+
} else {
|
|
33
|
+
const hoisted = `__cjs_to_esm_hoist_${hoistIndex}`;
|
|
34
|
+
const importee = code.slice(node.arguments[0].start, node.arguments[0].end);
|
|
35
|
+
hoistedCodes.push(`const ${hoisted} = (await import(${importee})).default;\n`);
|
|
36
|
+
output.update(node.start, node.end, hoisted);
|
|
37
|
+
hoistIndex++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
leave() {
|
|
42
|
+
parentNodes.pop();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
for (const hoisted of hoistedCodes.reverse()) output.prepend(hoisted);
|
|
46
|
+
output.prepend(`let exports = {}; const module = { exports };\n`);
|
|
47
|
+
return { output };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/plugins/cjs.ts
|
|
52
|
+
const debug = createDebug("vite-rsc:cjs");
|
|
53
|
+
function cjsModuleRunnerPlugin() {
|
|
54
|
+
const warnedPackages = /* @__PURE__ */ new Set();
|
|
55
|
+
return [{
|
|
56
|
+
name: "cjs-module-runner-transform",
|
|
57
|
+
apply: "serve",
|
|
58
|
+
applyToEnvironment: (env) => env.config.dev.moduleRunnerTransform,
|
|
59
|
+
async transform(code, id) {
|
|
60
|
+
if (id.includes("/node_modules/") && !id.startsWith(this.environment.config.cacheDir) && /\b(require|exports)\b/.test(code)) {
|
|
61
|
+
id = parseIdQuery(id).filename;
|
|
62
|
+
if (!/\.[cm]?js$/.test(id)) return;
|
|
63
|
+
if (id.endsWith(".mjs")) return;
|
|
64
|
+
if (id.endsWith(".js")) {
|
|
65
|
+
const pkgJsonPath = await findClosestPkgJsonPath(path.dirname(id));
|
|
66
|
+
if (pkgJsonPath) {
|
|
67
|
+
if (JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8")).type === "module") return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const [, , , hasModuleSyntax] = esModuleLexer.parse(code);
|
|
71
|
+
if (hasModuleSyntax) return;
|
|
72
|
+
const packageKey = extractPackageKey(id);
|
|
73
|
+
if (!warnedPackages.has(packageKey)) {
|
|
74
|
+
debug(`non-optimized CJS dependency in '${this.environment.name}' environment: ${id}`);
|
|
75
|
+
warnedPackages.add(packageKey);
|
|
76
|
+
}
|
|
77
|
+
const ast = await parseAstAsync(code);
|
|
78
|
+
const output = transformCjsToEsm(code, ast).output;
|
|
79
|
+
output.append(`
|
|
80
|
+
;__vite_ssr_exportAll__(module.exports);
|
|
81
|
+
export default module.exports;
|
|
82
|
+
`);
|
|
83
|
+
return {
|
|
84
|
+
code: output.toString(),
|
|
85
|
+
map: output.generateMap({ hires: "boundary" })
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}];
|
|
90
|
+
}
|
|
91
|
+
function extractPackageKey(id) {
|
|
92
|
+
const yarnMatch = id.match(/\/.yarn\/cache\/([^/]+)/);
|
|
93
|
+
if (yarnMatch) return yarnMatch[1];
|
|
94
|
+
if (id.includes("/node_modules")) {
|
|
95
|
+
id = id.split("/node_modules/").at(-1);
|
|
96
|
+
let [x, y] = id.split("/");
|
|
97
|
+
if (x.startsWith("@")) return `${x}/${y}`;
|
|
98
|
+
return x;
|
|
99
|
+
}
|
|
100
|
+
return id;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { cjsModuleRunnerPlugin };
|
package/dist/core/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { setRequireModule } from "../browser-
|
|
1
|
+
import { setRequireModule } from "../browser-DwWQeoll.js";
|
|
2
2
|
export { setRequireModule };
|
package/dist/core/rsc.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-
|
|
1
|
+
import "../index-CPkExgij.js";
|
|
2
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-3bkzqdsJ.js";
|
|
3
3
|
export { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule };
|
package/dist/core/rsc.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
|
-
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-
|
|
3
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-GFzFWyhT.js";
|
|
4
4
|
|
|
5
5
|
export { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule };
|
package/dist/core/ssr.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { createServerConsumerManifest, setRequireModule } from "../ssr-
|
|
1
|
+
import "../index-CPkExgij.js";
|
|
2
|
+
import { createServerConsumerManifest, setRequireModule } from "../ssr-CMjeQ9AS.js";
|
|
3
3
|
export { createServerConsumerManifest, setRequireModule };
|
package/dist/core/ssr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
|
-
import { createServerConsumerManifest, setRequireModule } from "../ssr-
|
|
3
|
+
import { createServerConsumerManifest, setRequireModule } from "../ssr-Cm2FP2zD.js";
|
|
4
4
|
|
|
5
5
|
export { createServerConsumerManifest, setRequireModule };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { once } from "./dist-DiJnRA1C.js";
|
|
2
2
|
import { arrayToStream, concatArrayStream, decryptBuffer, encryptBuffer, fromBase64 } from "./encryption-utils-BDwwcMVT.js";
|
|
3
|
-
import { createFromReadableStream, renderToReadableStream } from "./rsc-
|
|
3
|
+
import { createFromReadableStream, renderToReadableStream } from "./rsc-BdCB3621.js";
|
|
4
4
|
import encryptionKeySource from "virtual:vite-rsc/encryption-key";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/encryption-runtime.ts
|
package/dist/extra/browser.d.ts
CHANGED
package/dist/extra/browser.js
CHANGED
|
@@ -3,7 +3,7 @@ import "../shared-CXg_u-4h.js";
|
|
|
3
3
|
import "../browser-7NhxQxuk.js";
|
|
4
4
|
import { createFromFetch, createFromReadableStream, createTemporaryReferenceSet, encodeReply, setServerCallback } from "../browser-D8OPzpF5.js";
|
|
5
5
|
import "../browser--ZREVnM9.js";
|
|
6
|
-
import { rscStream } from "../client-
|
|
6
|
+
import { rscStream } from "../client-C7Eok9hc.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import ReactDomClient from "react-dom/client";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
package/dist/extra/rsc.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RscPayload, renderRequest } from "../rsc-
|
|
1
|
+
import { RscPayload, renderRequest } from "../rsc-c22DF1A7.js";
|
|
2
2
|
export { RscPayload, renderRequest };
|
package/dist/extra/rsc.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
3
|
import "../encryption-utils-BDwwcMVT.js";
|
|
4
|
-
import { loadServerAction } from "../rsc-
|
|
5
|
-
import { createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, renderToReadableStream } from "../rsc-
|
|
6
|
-
import "../encryption-runtime-
|
|
7
|
-
import "../rsc-
|
|
4
|
+
import { loadServerAction } from "../rsc-GFzFWyhT.js";
|
|
5
|
+
import { createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, renderToReadableStream } from "../rsc-BdCB3621.js";
|
|
6
|
+
import "../encryption-runtime-CugTJCLM.js";
|
|
7
|
+
import "../rsc-CiAoLCx8.js";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/extra/rsc.tsx
|
package/dist/extra/ssr.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
|
-
import "../shared-
|
|
4
|
-
import "../ssr-
|
|
5
|
-
import { createFromReadableStream } from "../ssr-
|
|
6
|
-
import "../ssr-
|
|
7
|
-
import { injectRSCPayload } from "../server-
|
|
3
|
+
import "../shared-AvKUASD5.js";
|
|
4
|
+
import "../ssr-Cm2FP2zD.js";
|
|
5
|
+
import { createFromReadableStream } from "../ssr-Cd4SbAaO.js";
|
|
6
|
+
import "../ssr-8BA2nj0-.js";
|
|
7
|
+
import { injectRSCPayload } from "../server-BTo03tXh.js";
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
import ReactDomServer from "react-dom/server.edge";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { PluginApi, RscPluginOptions, getPluginApi, vitePluginRsc } from "./plugin-
|
|
1
|
+
import "./index-DWN3vCIQ.js";
|
|
2
|
+
import { PluginApi, RscPluginOptions, getPluginApi, vitePluginRsc } from "./plugin-Cfy_9VpM.js";
|
|
3
3
|
export { type PluginApi, type RscPluginOptions, vitePluginRsc as default, getPluginApi };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,8 @@ import "./plugin-CZbI4rhS.js";
|
|
|
3
3
|
import "./transforms-D1-2JfCh.js";
|
|
4
4
|
import "./encryption-utils-BDwwcMVT.js";
|
|
5
5
|
import "./rpc-CUvSZurk.js";
|
|
6
|
-
import { getPluginApi, vitePluginRsc } from "./plugin-
|
|
7
|
-
import "./
|
|
6
|
+
import { getPluginApi, vitePluginRsc } from "./plugin-Bzocj-4a.js";
|
|
7
|
+
import "./cjs-WQBk0zA_.js";
|
|
8
|
+
import "./shared-AvKUASD5.js";
|
|
8
9
|
|
|
9
10
|
export { vitePluginRsc as default, getPluginApi };
|
|
@@ -3,7 +3,8 @@ import { vitePluginRscCore } from "./plugin-CZbI4rhS.js";
|
|
|
3
3
|
import { hasDirective, transformDirectiveProxyExport, transformServerActionServer, transformWrapExport } from "./transforms-D1-2JfCh.js";
|
|
4
4
|
import { generateEncryptionKey, toBase64 } from "./encryption-utils-BDwwcMVT.js";
|
|
5
5
|
import { createRpcServer } from "./rpc-CUvSZurk.js";
|
|
6
|
-
import {
|
|
6
|
+
import { cjsModuleRunnerPlugin } from "./cjs-WQBk0zA_.js";
|
|
7
|
+
import { parseCssVirtual, parseIdQuery, toCssVirtual } from "./shared-AvKUASD5.js";
|
|
7
8
|
import { createRequire } from "node:module";
|
|
8
9
|
import assert from "node:assert";
|
|
9
10
|
import fs from "node:fs";
|
|
@@ -14,9 +15,8 @@ import * as esModuleLexer from "es-module-lexer";
|
|
|
14
15
|
import MagicString from "magic-string";
|
|
15
16
|
import * as vite from "vite";
|
|
16
17
|
import { defaultServerConditions, isCSSRequest, normalizePath, parseAstAsync } from "vite";
|
|
17
|
-
import { crawlFrameworkPkgs
|
|
18
|
+
import { crawlFrameworkPkgs } from "vitefu";
|
|
18
19
|
import { walk } from "estree-walker";
|
|
19
|
-
import { analyze } from "periscopic";
|
|
20
20
|
import { stripVTControlCharacters } from "node:util";
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
|
|
@@ -88,98 +88,7 @@ function evalValue(rawValue) {
|
|
|
88
88
|
return (\n${rawValue}\n)
|
|
89
89
|
`)();
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/transforms/cjs.ts
|
|
94
|
-
function transformCjsToEsm(code, ast) {
|
|
95
|
-
const output = new MagicString(code);
|
|
96
|
-
const analyzed = analyze(ast);
|
|
97
|
-
const parentNodes = [];
|
|
98
|
-
const hoistedCodes = [];
|
|
99
|
-
let hoistIndex = 0;
|
|
100
|
-
walk(ast, {
|
|
101
|
-
enter(node) {
|
|
102
|
-
parentNodes.push(node);
|
|
103
|
-
if (node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1) {
|
|
104
|
-
let isTopLevel = true;
|
|
105
|
-
for (const parent of parentNodes) {
|
|
106
|
-
if (parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ArrowFunctionExpression") isTopLevel = false;
|
|
107
|
-
const scope = analyzed.map.get(parent);
|
|
108
|
-
if (scope && scope.declarations.has("require")) return;
|
|
109
|
-
}
|
|
110
|
-
if (isTopLevel) {
|
|
111
|
-
output.update(node.start, node.callee.end, "(await import");
|
|
112
|
-
output.appendRight(node.end, ")");
|
|
113
|
-
} else {
|
|
114
|
-
const hoisted = `__cjs_to_esm_hoist_${hoistIndex}`;
|
|
115
|
-
const importee = code.slice(node.arguments[0].start, node.arguments[0].end);
|
|
116
|
-
hoistedCodes.push(`const ${hoisted} = await import(${importee});\n`);
|
|
117
|
-
output.update(node.start, node.end, hoisted);
|
|
118
|
-
hoistIndex++;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
leave() {
|
|
123
|
-
parentNodes.pop();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
for (const hoisted of hoistedCodes.reverse()) output.prepend(hoisted);
|
|
127
|
-
output.prepend(`const exports = {}; const module = { exports };\n`);
|
|
128
|
-
return { output };
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/plugins/cjs.ts
|
|
133
|
-
const debug = createDebug("vite-rsc:cjs");
|
|
134
|
-
function cjsModuleRunnerPlugin() {
|
|
135
|
-
const warnedPackages = /* @__PURE__ */ new Set();
|
|
136
|
-
return [{
|
|
137
|
-
name: "cjs-module-runner-transform",
|
|
138
|
-
apply: "serve",
|
|
139
|
-
applyToEnvironment: (env) => env.config.dev.moduleRunnerTransform,
|
|
140
|
-
async transform(code, id) {
|
|
141
|
-
if (id.includes("/node_modules/") && !id.startsWith(this.environment.config.cacheDir) && /\b(require|exports)\b/.test(code)) {
|
|
142
|
-
id = parseIdQuery(id).filename;
|
|
143
|
-
if (!/\.[cm]?js$/.test(id)) return;
|
|
144
|
-
if (id.endsWith(".mjs")) return;
|
|
145
|
-
if (id.endsWith(".js")) {
|
|
146
|
-
const pkgJsonPath = await findClosestPkgJsonPath(path.dirname(id));
|
|
147
|
-
if (pkgJsonPath) {
|
|
148
|
-
if (JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8")).type === "module") return;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
const [, , , hasModuleSyntax] = esModuleLexer.parse(code);
|
|
152
|
-
if (hasModuleSyntax) return;
|
|
153
|
-
const packageKey = extractPackageKey(id);
|
|
154
|
-
if (!warnedPackages.has(packageKey)) {
|
|
155
|
-
debug(`non-optimized CJS dependency in '${this.environment.name}' environment: ${id}`);
|
|
156
|
-
warnedPackages.add(packageKey);
|
|
157
|
-
}
|
|
158
|
-
const ast = await parseAstAsync(code);
|
|
159
|
-
const output = transformCjsToEsm(code, ast).output;
|
|
160
|
-
output.append(`
|
|
161
|
-
;__vite_ssr_exportAll__(module.exports);
|
|
162
|
-
export default module.exports;
|
|
163
|
-
`);
|
|
164
|
-
return {
|
|
165
|
-
code: output.toString(),
|
|
166
|
-
map: output.generateMap({ hires: "boundary" })
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}];
|
|
171
|
-
}
|
|
172
|
-
function extractPackageKey(id) {
|
|
173
|
-
const yarnMatch = id.match(/\/.yarn\/cache\/([^/]+)/);
|
|
174
|
-
if (yarnMatch) return yarnMatch[1];
|
|
175
|
-
if (id.includes("/node_modules")) {
|
|
176
|
-
id = id.split("/node_modules/").at(-1);
|
|
177
|
-
let [x, y] = id.split("/");
|
|
178
|
-
if (x.startsWith("@")) return `${x}/${y}`;
|
|
179
|
-
return x;
|
|
180
|
-
}
|
|
181
|
-
return id;
|
|
182
|
-
}
|
|
91
|
+
const directRequestRE = /(\?|&)direct=?(?:&|$)/;
|
|
183
92
|
|
|
184
93
|
//#endregion
|
|
185
94
|
//#region src/plugins/utils.ts
|
|
@@ -225,6 +134,14 @@ function getEntrySource(config, name = "index") {
|
|
|
225
134
|
function hashString(v) {
|
|
226
135
|
return createHash("sha256").update(v).digest().toString("hex").slice(0, 12);
|
|
227
136
|
}
|
|
137
|
+
function getFetchHandlerExport(exports) {
|
|
138
|
+
if ("default" in exports) {
|
|
139
|
+
const default_ = exports.default;
|
|
140
|
+
if (default_ && typeof default_ === "object" && "fetch" in default_ && typeof default_.fetch === "function") return default_.fetch;
|
|
141
|
+
if (typeof default_ === "function") return default_;
|
|
142
|
+
}
|
|
143
|
+
throw new Error("Invalid server handler entry");
|
|
144
|
+
}
|
|
228
145
|
|
|
229
146
|
//#endregion
|
|
230
147
|
//#region src/plugins/scan.ts
|
|
@@ -498,6 +415,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
498
415
|
ssr: {
|
|
499
416
|
build: {
|
|
500
417
|
outDir: config.environments?.ssr?.build?.outDir ?? "dist/ssr",
|
|
418
|
+
copyPublicDir: false,
|
|
501
419
|
rollupOptions: { input: rscPluginOptions.entries?.ssr && { index: rscPluginOptions.entries.ssr } }
|
|
502
420
|
},
|
|
503
421
|
resolve: { noExternal },
|
|
@@ -517,6 +435,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
517
435
|
rsc: {
|
|
518
436
|
build: {
|
|
519
437
|
outDir: config.environments?.rsc?.build?.outDir ?? "dist/rsc",
|
|
438
|
+
copyPublicDir: false,
|
|
520
439
|
emitAssets: true,
|
|
521
440
|
rollupOptions: { input: rscPluginOptions.entries?.rsc && { index: rscPluginOptions.entries.rsc } }
|
|
522
441
|
},
|
|
@@ -582,8 +501,9 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
582
501
|
const resolved = await environment.pluginContainer.resolveId(source);
|
|
583
502
|
assert(resolved, `[vite-rsc] failed to resolve server handler '${source}'`);
|
|
584
503
|
const mod = await environment.runner.import(resolved.id);
|
|
504
|
+
const fetchHandler = getFetchHandlerExport(mod);
|
|
585
505
|
req.url = req.originalUrl ?? req.url;
|
|
586
|
-
await createRequestListener(
|
|
506
|
+
await createRequestListener(fetchHandler)(req, res);
|
|
587
507
|
} catch (e) {
|
|
588
508
|
next(e);
|
|
589
509
|
}
|
|
@@ -599,7 +519,8 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
599
519
|
};
|
|
600
520
|
const entryFile = path.join(manager.config.environments[options.environmentName].build.outDir, `${options.entryName}.js`);
|
|
601
521
|
const mod = await import(pathToFileURL(entryFile).href);
|
|
602
|
-
const
|
|
522
|
+
const fetchHandler = getFetchHandlerExport(mod);
|
|
523
|
+
const handler = createRequestListener(fetchHandler);
|
|
603
524
|
server.middlewares.use((req, _res, next) => {
|
|
604
525
|
delete req.headers["accept-encoding"];
|
|
605
526
|
next();
|
|
@@ -617,7 +538,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
617
538
|
},
|
|
618
539
|
async hotUpdate(ctx) {
|
|
619
540
|
if (isCSSRequest(ctx.file)) {
|
|
620
|
-
if (this.environment.name === "client") return
|
|
541
|
+
if (this.environment.name === "client") return;
|
|
621
542
|
}
|
|
622
543
|
if (ctx.modules.map((mod) => mod.id).filter((v) => v !== null).length === 0) return;
|
|
623
544
|
if (this.environment.name === "rsc") {
|
|
@@ -881,7 +802,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
881
802
|
const ssrCss = document.querySelectorAll("link[rel='stylesheet']");
|
|
882
803
|
import.meta.hot.on("vite:beforeUpdate", () => {
|
|
883
804
|
ssrCss.forEach(node => {
|
|
884
|
-
if (node.dataset.precedence?.startsWith("vite-rsc/")) {
|
|
805
|
+
if (node.dataset.precedence?.startsWith("vite-rsc/client-references")) {
|
|
885
806
|
node.remove();
|
|
886
807
|
}
|
|
887
808
|
});
|
|
@@ -924,7 +845,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
924
845
|
id = normalizePath(path.relative(process.cwd(), id));
|
|
925
846
|
if (optimizerMetadata?.ids.includes(id)) ctx.warn("client component dependency is inconsistently optimized. It's recommended to add the dependency to 'optimizeDeps.exclude'.");
|
|
926
847
|
}
|
|
927
|
-
const debug
|
|
848
|
+
const debug = createDebug("vite-rsc:use-client");
|
|
928
849
|
return [
|
|
929
850
|
{
|
|
930
851
|
name: "rsc:use-client",
|
|
@@ -943,7 +864,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
943
864
|
let referenceKey;
|
|
944
865
|
const packageSource = packageSources.get(id);
|
|
945
866
|
if (!packageSource && this.environment.mode === "dev" && id.includes("/node_modules/")) {
|
|
946
|
-
debug
|
|
867
|
+
debug(`internal client reference created through a package imported in '${this.environment.name}' environment: ${id}`);
|
|
947
868
|
id = cleanUrl(id);
|
|
948
869
|
warnInoncistentClientOptimization(this, id);
|
|
949
870
|
importId = `/@id/__x00__virtual:vite-rsc/client-in-server-package-proxy/${encodeURIComponent(id)}`;
|
|
@@ -1021,7 +942,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1021
942
|
(manager.clientReferenceGroups[name] ??= []).push(meta);
|
|
1022
943
|
meta.groupChunkId = `\0virtual:vite-rsc/client-references/group/${name}`;
|
|
1023
944
|
}
|
|
1024
|
-
debug
|
|
945
|
+
debug("client-reference-groups", manager.clientReferenceGroups);
|
|
1025
946
|
for (const [name, metas] of Object.entries(manager.clientReferenceGroups)) {
|
|
1026
947
|
const groupVirtual = `virtual:vite-rsc/client-references/group/${name}`;
|
|
1027
948
|
for (const meta of metas) code += `\
|
|
@@ -1204,7 +1125,7 @@ function vitePluginDefineEncryptionKey(useServerPluginOptions) {
|
|
|
1204
1125
|
function vitePluginUseServer(useServerPluginOptions, manager) {
|
|
1205
1126
|
const serverEnvironmentName = useServerPluginOptions.environment?.rsc ?? "rsc";
|
|
1206
1127
|
const browserEnvironmentName = useServerPluginOptions.environment?.browser ?? "client";
|
|
1207
|
-
const debug
|
|
1128
|
+
const debug = createDebug("vite-rsc:use-server");
|
|
1208
1129
|
return [{
|
|
1209
1130
|
name: "rsc:use-server",
|
|
1210
1131
|
async transform(code, id) {
|
|
@@ -1217,7 +1138,7 @@ function vitePluginUseServer(useServerPluginOptions, manager) {
|
|
|
1217
1138
|
const getNormalizedId = () => {
|
|
1218
1139
|
if (!normalizedId_) {
|
|
1219
1140
|
if (this.environment.mode === "dev" && id.includes("/node_modules/")) {
|
|
1220
|
-
debug
|
|
1141
|
+
debug(`internal server reference created through a package imported in ${this.environment.name} environment: ${id}`);
|
|
1221
1142
|
id = cleanUrl(id);
|
|
1222
1143
|
}
|
|
1223
1144
|
if (manager.config.command === "build") normalizedId_ = hashString(manager.toRelativeId(id));
|
|
@@ -1453,6 +1374,19 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1453
1374
|
};
|
|
1454
1375
|
}
|
|
1455
1376
|
},
|
|
1377
|
+
{
|
|
1378
|
+
name: "rsc:rsc-css-self-accept",
|
|
1379
|
+
apply: "serve",
|
|
1380
|
+
transform: {
|
|
1381
|
+
order: "post",
|
|
1382
|
+
handler(_code, id, _options) {
|
|
1383
|
+
if (this.environment.name === "client" && this.environment.mode === "dev" && isCSSRequest(id) && directRequestRE.test(id)) {
|
|
1384
|
+
const mod = this.environment.moduleGraph.getModuleById(id);
|
|
1385
|
+
if (mod && !mod.isSelfAccepting) mod.isSelfAccepting = true;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1456
1390
|
{
|
|
1457
1391
|
name: "rsc:css-virtual",
|
|
1458
1392
|
resolveId(source) {
|
|
@@ -1527,14 +1461,12 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1527
1461
|
assert(this.environment.name === "rsc");
|
|
1528
1462
|
const importer = parsed.id;
|
|
1529
1463
|
if (this.environment.mode === "dev") {
|
|
1530
|
-
const
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
type: "rsc-browser"
|
|
1534
|
-
})}`];
|
|
1464
|
+
const result = collectCss(server.environments.rsc, importer);
|
|
1465
|
+
for (const file of [importer, ...result.visitedFiles]) this.addWatchFile(file);
|
|
1466
|
+
const cssHrefs = result.hrefs.map((href) => href.slice(1));
|
|
1535
1467
|
const deps = assetsURLOfDeps({
|
|
1536
1468
|
css: cssHrefs,
|
|
1537
|
-
js:
|
|
1469
|
+
js: []
|
|
1538
1470
|
}, manager);
|
|
1539
1471
|
return generateResourcesCode(serializeValueWithRuntime(deps), manager);
|
|
1540
1472
|
} else {
|
|
@@ -1546,37 +1478,13 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1546
1478
|
`;
|
|
1547
1479
|
}
|
|
1548
1480
|
}
|
|
1549
|
-
if (parsed?.type === "rsc-browser") {
|
|
1550
|
-
assert(this.environment.name === "client");
|
|
1551
|
-
assert(this.environment.mode === "dev");
|
|
1552
|
-
const importer = parsed.id;
|
|
1553
|
-
let code = collectCss(server.environments.rsc, importer).ids.map((id$1) => id$1.replace(/^\0/, "")).map((id$1) => `import ${JSON.stringify(id$1)};\n`).join("");
|
|
1554
|
-
code += `if (import.meta.hot) { import.meta.hot.accept() }\n`;
|
|
1555
|
-
return code;
|
|
1556
|
-
}
|
|
1557
|
-
},
|
|
1558
|
-
hotUpdate(ctx) {
|
|
1559
|
-
if (this.environment.name === "rsc") {
|
|
1560
|
-
const { server } = manager;
|
|
1561
|
-
const mods = collectModuleDependents(ctx.modules);
|
|
1562
|
-
for (const mod of mods) if (mod.id) {
|
|
1563
|
-
invalidteModuleById(server.environments.rsc, `\0` + toCssVirtual({
|
|
1564
|
-
id: mod.id,
|
|
1565
|
-
type: "rsc"
|
|
1566
|
-
}));
|
|
1567
|
-
invalidteModuleById(server.environments.client, `\0` + toCssVirtual({
|
|
1568
|
-
id: mod.id,
|
|
1569
|
-
type: "rsc-browser"
|
|
1570
|
-
}));
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
1481
|
}
|
|
1574
1482
|
},
|
|
1575
1483
|
createVirtualPlugin("vite-rsc/remove-duplicate-server-css", async function() {
|
|
1576
1484
|
assert.equal(this.environment.mode, "dev");
|
|
1577
1485
|
function removeFn() {
|
|
1578
1486
|
document.querySelectorAll("link[rel='stylesheet']").forEach((node) => {
|
|
1579
|
-
if (node instanceof HTMLElement && node.dataset.precedence?.startsWith("vite-rsc/")) node.remove();
|
|
1487
|
+
if (node instanceof HTMLElement && node.dataset.precedence?.startsWith("vite-rsc/client-reference")) node.remove();
|
|
1580
1488
|
});
|
|
1581
1489
|
}
|
|
1582
1490
|
return `\
|
|
@@ -1592,39 +1500,15 @@ export default function RemoveDuplicateServerCss() {
|
|
|
1592
1500
|
})
|
|
1593
1501
|
];
|
|
1594
1502
|
}
|
|
1595
|
-
function invalidteModuleById(environment, id) {
|
|
1596
|
-
const mod = environment.moduleGraph.getModuleById(id);
|
|
1597
|
-
if (mod) environment.moduleGraph.invalidateModule(mod);
|
|
1598
|
-
return mod;
|
|
1599
|
-
}
|
|
1600
|
-
function collectModuleDependents(mods) {
|
|
1601
|
-
const visited = /* @__PURE__ */ new Set();
|
|
1602
|
-
function recurse(mod) {
|
|
1603
|
-
if (visited.has(mod)) return;
|
|
1604
|
-
visited.add(mod);
|
|
1605
|
-
for (const importer of mod.importers) recurse(importer);
|
|
1606
|
-
}
|
|
1607
|
-
for (const mod of mods) recurse(mod);
|
|
1608
|
-
return [...visited];
|
|
1609
|
-
}
|
|
1610
1503
|
function generateResourcesCode(depsCode, manager) {
|
|
1611
1504
|
const ResourcesFn = (React, deps, RemoveDuplicateServerCss) => {
|
|
1612
1505
|
return function Resources() {
|
|
1613
|
-
return React.createElement(React.Fragment, null, [
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
})),
|
|
1620
|
-
...deps.js.map((href) => React.createElement("script", {
|
|
1621
|
-
key: "js:" + href,
|
|
1622
|
-
type: "module",
|
|
1623
|
-
async: true,
|
|
1624
|
-
src: href
|
|
1625
|
-
})),
|
|
1626
|
-
RemoveDuplicateServerCss && React.createElement(RemoveDuplicateServerCss, { key: "remove-duplicate-css" })
|
|
1627
|
-
]);
|
|
1506
|
+
return React.createElement(React.Fragment, null, [...deps.css.map((href) => React.createElement("link", {
|
|
1507
|
+
key: "css:" + href,
|
|
1508
|
+
rel: "stylesheet",
|
|
1509
|
+
precedence: "vite-rsc/importer-resources",
|
|
1510
|
+
href
|
|
1511
|
+
})), RemoveDuplicateServerCss && React.createElement(RemoveDuplicateServerCss, { key: "remove-duplicate-css" })]);
|
|
1628
1512
|
};
|
|
1629
1513
|
};
|
|
1630
1514
|
return `
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { AssetDeps, AssetsManifest, PluginApi, ResolvedAssetDeps, ResolvedAssetsManifest, RscPluginManager, RscPluginOptions, getPluginApi, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin-
|
|
1
|
+
import "./index-DWN3vCIQ.js";
|
|
2
|
+
import { AssetDeps, AssetsManifest, PluginApi, ResolvedAssetDeps, ResolvedAssetsManifest, RscPluginManager, RscPluginOptions, getPluginApi, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin-Cfy_9VpM.js";
|
|
3
3
|
export { AssetDeps, AssetsManifest, PluginApi, ResolvedAssetDeps, ResolvedAssetsManifest, RscPluginManager, RscPluginOptions, vitePluginRsc as default, getPluginApi, transformRscCssExport, vitePluginRscMinimal };
|
package/dist/plugin.js
CHANGED
|
@@ -3,7 +3,8 @@ import "./plugin-CZbI4rhS.js";
|
|
|
3
3
|
import "./transforms-D1-2JfCh.js";
|
|
4
4
|
import "./encryption-utils-BDwwcMVT.js";
|
|
5
5
|
import "./rpc-CUvSZurk.js";
|
|
6
|
-
import { getPluginApi, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin-
|
|
7
|
-
import "./
|
|
6
|
+
import { getPluginApi, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin-Bzocj-4a.js";
|
|
7
|
+
import "./cjs-WQBk0zA_.js";
|
|
8
|
+
import "./shared-AvKUASD5.js";
|
|
8
9
|
|
|
9
10
|
export { vitePluginRsc as default, getPluginApi, transformRscCssExport, vitePluginRscMinimal };
|
package/dist/react/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallServerCallback } from "../index-
|
|
2
|
-
import { setRequireModule } from "../browser-
|
|
3
|
-
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "../browser-
|
|
1
|
+
import { CallServerCallback } from "../index-CPkExgij.js";
|
|
2
|
+
import { setRequireModule } from "../browser-DwWQeoll.js";
|
|
3
|
+
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "../browser-CQv7Z3J4.js";
|
|
4
4
|
export { CallServerCallback, callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
package/dist/react/rsc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { loadServerAction, setRequireModule } from "../rsc-
|
|
3
|
-
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "../rsc-
|
|
1
|
+
import "../index-CPkExgij.js";
|
|
2
|
+
import { loadServerAction, setRequireModule } from "../rsc-3bkzqdsJ.js";
|
|
3
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "../rsc-JJjz3Z0i.js";
|
|
4
4
|
export { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, loadServerAction, registerClientReference, registerServerReference, renderToReadableStream, setRequireModule };
|
package/dist/react/rsc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
|
-
import { loadServerAction, setRequireModule } from "../rsc-
|
|
4
|
-
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "../rsc-
|
|
3
|
+
import { loadServerAction, setRequireModule } from "../rsc-GFzFWyhT.js";
|
|
4
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "../rsc-BdCB3621.js";
|
|
5
5
|
|
|
6
6
|
export { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, loadServerAction, registerClientReference, registerServerReference, renderToReadableStream, setRequireModule };
|
package/dist/react/ssr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { setRequireModule } from "../ssr-
|
|
3
|
-
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-
|
|
1
|
+
import "../index-CPkExgij.js";
|
|
2
|
+
import { setRequireModule } from "../ssr-CMjeQ9AS.js";
|
|
3
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-BrSGyrxe.js";
|
|
4
4
|
export { callServer, createFromReadableStream, createServerReference, findSourceMapURL, setRequireModule };
|
package/dist/react/ssr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
|
-
import { setRequireModule } from "../ssr-
|
|
4
|
-
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-
|
|
3
|
+
import { setRequireModule } from "../ssr-Cm2FP2zD.js";
|
|
4
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-Cd4SbAaO.js";
|
|
5
5
|
|
|
6
6
|
export { callServer, createFromReadableStream, createServerReference, findSourceMapURL, setRequireModule };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createClientManifest, createServerDecodeClientManifest, createServerManifest } from "./rsc-
|
|
1
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest } from "./rsc-GFzFWyhT.js";
|
|
2
2
|
import * as ReactServer from "@vitejs/plugin-rsc/vendor/react-server-dom/server.edge";
|
|
3
3
|
import * as ReactClient from "@vitejs/plugin-rsc/vendor/react-server-dom/client.edge";
|
|
4
4
|
|
package/dist/rsc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { createClientManifest, createServerManifest, loadServerAction, setRequireModule } from "./rsc-
|
|
3
|
-
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "./rsc-
|
|
4
|
-
import { decryptActionBoundArgs, encryptActionBoundArgs } from "./encryption-runtime-
|
|
1
|
+
import "./index-CPkExgij.js";
|
|
2
|
+
import { createClientManifest, createServerManifest, loadServerAction, setRequireModule } from "./rsc-3bkzqdsJ.js";
|
|
3
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "./rsc-JJjz3Z0i.js";
|
|
4
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "./encryption-runtime-B8xcnJoN.js";
|
|
5
5
|
export { createClientManifest, createClientTemporaryReferenceSet, createFromReadableStream, createServerManifest, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, decryptActionBoundArgs, encodeReply, encryptActionBoundArgs, loadServerAction, registerClientReference, registerServerReference, renderToReadableStream, setRequireModule };
|
package/dist/rsc.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./dist-DiJnRA1C.js";
|
|
2
2
|
import "./shared-CXg_u-4h.js";
|
|
3
3
|
import "./encryption-utils-BDwwcMVT.js";
|
|
4
|
-
import { createClientManifest, createServerManifest, loadServerAction, setRequireModule } from "./rsc-
|
|
5
|
-
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "./rsc-
|
|
6
|
-
import { decryptActionBoundArgs, encryptActionBoundArgs } from "./encryption-runtime-
|
|
7
|
-
import "./rsc-
|
|
4
|
+
import { createClientManifest, createServerManifest, loadServerAction, setRequireModule } from "./rsc-GFzFWyhT.js";
|
|
5
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "./rsc-BdCB3621.js";
|
|
6
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "./encryption-runtime-CugTJCLM.js";
|
|
7
|
+
import "./rsc-CiAoLCx8.js";
|
|
8
8
|
|
|
9
9
|
export { createClientManifest, createClientTemporaryReferenceSet, createFromReadableStream, createServerManifest, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, decryptActionBoundArgs, encodeReply, encryptActionBoundArgs, loadServerAction, registerClientReference, registerServerReference, renderToReadableStream, setRequireModule };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toCssVirtual } from "./shared-
|
|
2
|
-
import { setRequireModule } from "./ssr-
|
|
1
|
+
import { toCssVirtual } from "./shared-AvKUASD5.js";
|
|
2
|
+
import { setRequireModule } from "./ssr-Cm2FP2zD.js";
|
|
3
3
|
import * as clientReferences from "virtual:vite-rsc/client-references";
|
|
4
4
|
import assetsManifest from "virtual:vite-rsc/assets-manifest";
|
|
5
5
|
import * as ReactDOM from "react-dom";
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { createServerConsumerManifest, setRequireModule } from "./ssr-
|
|
3
|
-
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-
|
|
1
|
+
import "./index-CPkExgij.js";
|
|
2
|
+
import { createServerConsumerManifest, setRequireModule } from "./ssr-CMjeQ9AS.js";
|
|
3
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-BrSGyrxe.js";
|
|
4
4
|
export { callServer, createFromReadableStream, createServerConsumerManifest, createServerReference, findSourceMapURL, setRequireModule };
|
package/dist/ssr.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./dist-DiJnRA1C.js";
|
|
2
2
|
import "./shared-CXg_u-4h.js";
|
|
3
|
-
import "./shared-
|
|
4
|
-
import { createServerConsumerManifest, setRequireModule } from "./ssr-
|
|
5
|
-
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-
|
|
6
|
-
import "./ssr-
|
|
3
|
+
import "./shared-AvKUASD5.js";
|
|
4
|
+
import { createServerConsumerManifest, setRequireModule } from "./ssr-Cm2FP2zD.js";
|
|
5
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-Cd4SbAaO.js";
|
|
6
|
+
import "./ssr-8BA2nj0-.js";
|
|
7
7
|
|
|
8
8
|
export { callServer, createFromReadableStream, createServerConsumerManifest, createServerReference, findSourceMapURL, setRequireModule };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TransformProxyExportOptions, TransformWrapExportFilter, TransformWrapExportOptions, getExportNames, hasDirective, transformDirectiveProxyExport, transformHoistInlineDirective, transformProxyExport, transformServerActionServer, transformWrapExport } from "../index-
|
|
1
|
+
import { TransformProxyExportOptions, TransformWrapExportFilter, TransformWrapExportOptions, getExportNames, hasDirective, transformDirectiveProxyExport, transformHoistInlineDirective, transformProxyExport, transformServerActionServer, transformWrapExport } from "../index-DWN3vCIQ.js";
|
|
2
2
|
export { TransformProxyExportOptions, TransformWrapExportFilter, TransformWrapExportOptions, getExportNames, hasDirective, transformDirectiveProxyExport, transformHoistInlineDirective, transformProxyExport, transformServerActionServer, transformWrapExport };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-
|
|
1
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-B8xcnJoN.js";
|
|
2
2
|
export { decryptActionBoundArgs, encryptActionBoundArgs };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CXg_u-4h.js";
|
|
3
3
|
import "../encryption-utils-BDwwcMVT.js";
|
|
4
|
-
import "../rsc-
|
|
5
|
-
import "../rsc-
|
|
6
|
-
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-
|
|
4
|
+
import "../rsc-GFzFWyhT.js";
|
|
5
|
+
import "../rsc-BdCB3621.js";
|
|
6
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-CugTJCLM.js";
|
|
7
7
|
|
|
8
8
|
export { decryptActionBoundArgs, encryptActionBoundArgs };
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|