@vitejs/plugin-rsc 0.4.29 → 0.4.31
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 +79 -60
- 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-BI8kK-GE.js} +133 -177
- 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")`
|
|
@@ -382,6 +353,17 @@ export default defineConfig({
|
|
|
382
353
|
// this behavior can be customized by `serverHandler` option.
|
|
383
354
|
serverHandler: false,
|
|
384
355
|
|
|
356
|
+
// the plugin provides build-time validation of 'server-only' and 'client-only' imports.
|
|
357
|
+
// this is enabled by default. See the "server-only and client-only import" section below for details.
|
|
358
|
+
validateImports: true,
|
|
359
|
+
|
|
360
|
+
// by default, the plugin uses a build-time generated encryption key for
|
|
361
|
+
// "use server" closure argument binding.
|
|
362
|
+
// This can be overwritten by configuring `defineEncryptionKey` option,
|
|
363
|
+
// for example, to obtain a key through environment variable during runtime.
|
|
364
|
+
// cf. https://nextjs.org/docs/app/guides/data-security#overwriting-encryption-keys-advanced
|
|
365
|
+
defineEncryptionKey: 'process.env.MY_ENCRYPTION_KEY',
|
|
366
|
+
|
|
385
367
|
// when `loadModuleDevProxy: true`, `import.meta.viteRsc.loadModule` is implemented
|
|
386
368
|
// through `fetch` based RPC, which allows, for example, rsc environment inside
|
|
387
369
|
// cloudflare workers to communicate with node ssr environment on main Vite process.
|
|
@@ -391,13 +373,6 @@ export default defineConfig({
|
|
|
391
373
|
// if it breaks, it can be opt-out or selectively applied based on files.
|
|
392
374
|
rscCssTransform: { filter: (id) => id.includes('/my-app/') },
|
|
393
375
|
|
|
394
|
-
// by default, the plugin uses a build-time generated encryption key for
|
|
395
|
-
// "use server" closure argument binding.
|
|
396
|
-
// This can be overwritten by configuring `defineEncryptionKey` option,
|
|
397
|
-
// for example, to obtain a key through environment variable during runtime.
|
|
398
|
-
// cf. https://nextjs.org/docs/app/guides/data-security#overwriting-encryption-keys-advanced
|
|
399
|
-
defineEncryptionKey: 'process.env.MY_ENCRYPTION_KEY',
|
|
400
|
-
|
|
401
376
|
// see `RscPluginOptions` for full options ...
|
|
402
377
|
}),
|
|
403
378
|
],
|
|
@@ -434,26 +409,9 @@ This module re-exports RSC runtime API provided by `react-server-dom/client.brow
|
|
|
434
409
|
- `createFromFetch`: a robust way of `createFromReadableStream((await fetch("...")).body)`
|
|
435
410
|
- `encodeReply/setServerCallback`: server function related...
|
|
436
411
|
|
|
437
|
-
##
|
|
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`
|
|
412
|
+
## Tips
|
|
445
413
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
### `@vitejs/plugin-rsc/extra/ssr`
|
|
449
|
-
|
|
450
|
-
- `renderHtml`
|
|
451
|
-
|
|
452
|
-
### `@vitejs/plugin-rsc/extra/browser`
|
|
453
|
-
|
|
454
|
-
- `hydrate`
|
|
455
|
-
|
|
456
|
-
## CSS Support
|
|
414
|
+
### CSS Support
|
|
457
415
|
|
|
458
416
|
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.
|
|
459
417
|
|
|
@@ -487,11 +445,11 @@ export function Page() {
|
|
|
487
445
|
}
|
|
488
446
|
```
|
|
489
447
|
|
|
490
|
-
|
|
448
|
+
### Canary and Experimental channel releases
|
|
491
449
|
|
|
492
450
|
See https://github.com/vitejs/vite-plugin-react/pull/524 for how to install the package for React [canary](https://react.dev/community/versioning-policy#canary-channel) and [experimental](https://react.dev/community/versioning-policy#all-release-channels) usages.
|
|
493
451
|
|
|
494
|
-
|
|
452
|
+
### Using `@vitejs/plugin-rsc` as a framework package's `dependencies`
|
|
495
453
|
|
|
496
454
|
By default, `@vitejs/plugin-rsc` is expected to be used as `peerDependencies` similar to `react` and `react-dom`. When `@vitejs/plugin-rsc` is not available at the project root (e.g., in `node_modules/@vitejs/plugin-rsc`), you will see warnings like:
|
|
497
455
|
|
|
@@ -522,7 +480,7 @@ export default function myRscFrameworkPlugin() {
|
|
|
522
480
|
}
|
|
523
481
|
```
|
|
524
482
|
|
|
525
|
-
|
|
483
|
+
### Typescript
|
|
526
484
|
|
|
527
485
|
Types for global API are defined in `@vitejs/plugin-rsc/types`. For example, you can add it to `tsconfig.json` to have types for `import.meta.viteRsc` APIs:
|
|
528
486
|
|
|
@@ -542,6 +500,67 @@ import.meta.viteRsc.loadModule
|
|
|
542
500
|
|
|
543
501
|
See also [Vite documentation](https://vite.dev/guide/api-hmr.html#intellisense-for-typescript) for `vite/client` types.
|
|
544
502
|
|
|
503
|
+
### `server-only` and `client-only` import
|
|
504
|
+
|
|
505
|
+
<!-- references? -->
|
|
506
|
+
<!-- https://nextjs.org/docs/app/getting-started/server-and-client-components#preventing-environment-poisoning -->
|
|
507
|
+
<!-- https://overreacted.io/how-imports-work-in-rsc/ -->
|
|
508
|
+
|
|
509
|
+
You can use the `server-only` import to prevent accidentally importing server-only code into client bundles, which can expose sensitive server code in public static assets.
|
|
510
|
+
For example, the plugin will show an error `'server-only' cannot be imported in client build` for the following code:
|
|
511
|
+
|
|
512
|
+
- server-utils.js
|
|
513
|
+
|
|
514
|
+
```tsx
|
|
515
|
+
import 'server-only'
|
|
516
|
+
|
|
517
|
+
export async function getData() {
|
|
518
|
+
const res = await fetch('https://internal-service.com/data', {
|
|
519
|
+
headers: {
|
|
520
|
+
authorization: process.env.API_KEY,
|
|
521
|
+
},
|
|
522
|
+
})
|
|
523
|
+
return res.json()
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
- client.js
|
|
528
|
+
|
|
529
|
+
```tsx
|
|
530
|
+
'use client'
|
|
531
|
+
import { getData } from './server-utils.js' // ❌ 'server-only' cannot be imported in client build
|
|
532
|
+
...
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
Similarly, the `client-only` import ensures browser-specific code isn't accidentally imported into server environments.
|
|
536
|
+
For example, the plugin will show an error `'client-only' cannot be imported in server build` for the following code:
|
|
537
|
+
|
|
538
|
+
- client-utils.js
|
|
539
|
+
|
|
540
|
+
```tsx
|
|
541
|
+
import 'client-only'
|
|
542
|
+
|
|
543
|
+
export function getStorage(key) {
|
|
544
|
+
// This uses browser-only APIs
|
|
545
|
+
return window.localStorage.getItem(key)
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
- server.js
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { getStorage } from './client-utils.js' // ❌ 'client-only' cannot be imported in server build
|
|
553
|
+
|
|
554
|
+
export function ServerComponent() {
|
|
555
|
+
const data = getStorage("settings")
|
|
556
|
+
...
|
|
557
|
+
}
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Note that while there are official npm packages [`server-only`](https://www.npmjs.com/package/server-only) and [`client-only`](https://www.npmjs.com/package/client-only) created by React team, they don't need to be installed. The plugin internally overrides these imports and surfaces their runtime errors as build-time errors.
|
|
561
|
+
|
|
562
|
+
This build-time validation is enabled by default and can be disabled by setting `validateImports: false` in the plugin options.
|
|
563
|
+
|
|
545
564
|
## Credits
|
|
546
565
|
|
|
547
566
|
This project builds on fundamental techniques and insights from pioneering Vite RSC implementations.
|
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-BI8kK-GE.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
|
|
@@ -266,29 +183,82 @@ function validateImportPlugin() {
|
|
|
266
183
|
name: "rsc:validate-imports",
|
|
267
184
|
resolveId: {
|
|
268
185
|
order: "pre",
|
|
269
|
-
async handler(source,
|
|
186
|
+
async handler(source, _importer, options) {
|
|
270
187
|
if ("scan" in options && options.scan) return;
|
|
271
|
-
if (source === "client-only") {
|
|
272
|
-
if (this.environment.name === "rsc"
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
moduleSideEffects: false
|
|
188
|
+
if (source === "client-only" || source === "server-only") {
|
|
189
|
+
if (source === "client-only" && this.environment.name === "rsc" || source === "server-only" && this.environment.name !== "rsc") return {
|
|
190
|
+
id: `\0virtual:vite-rsc/validate-imports/invalid/${source}`,
|
|
191
|
+
moduleSideEffects: true
|
|
276
192
|
};
|
|
277
|
-
}
|
|
278
|
-
if (source === "server-only") {
|
|
279
|
-
if (this.environment.name !== "rsc") throw new Error(`'server-only' cannot be imported in client build (importer: '${importer ?? "unknown"}', environment: ${this.environment.name})`);
|
|
280
193
|
return {
|
|
281
|
-
id: `\0virtual:vite-rsc/
|
|
194
|
+
id: `\0virtual:vite-rsc/validate-imports/valid/${source}`,
|
|
282
195
|
moduleSideEffects: false
|
|
283
196
|
};
|
|
284
197
|
}
|
|
285
198
|
}
|
|
286
199
|
},
|
|
287
200
|
load(id) {
|
|
288
|
-
if (id.startsWith("\0virtual:vite-rsc/
|
|
201
|
+
if (id.startsWith("\0virtual:vite-rsc/validate-imports/invalid/")) return `throw new Error("invalid import of '${id.slice(id.lastIndexOf("/") + 1)}'")`;
|
|
202
|
+
if (id.startsWith("\0virtual:vite-rsc/validate-imports/")) return `export {}`;
|
|
203
|
+
},
|
|
204
|
+
transform: {
|
|
205
|
+
order: "post",
|
|
206
|
+
async handler(_code, id) {
|
|
207
|
+
if (this.environment.mode === "dev") {
|
|
208
|
+
if (id.startsWith(`\0virtual:vite-rsc/validate-imports/invalid/`)) {
|
|
209
|
+
const chain = getImportChainDev(this.environment, id);
|
|
210
|
+
validateImportChain(chain, this.environment.name, this.environment.config.root);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
buildEnd() {
|
|
216
|
+
if (this.environment.mode === "build") {
|
|
217
|
+
const serverOnly = getImportChainBuild(this, "\0virtual:vite-rsc/validate-imports/invalid/server-only");
|
|
218
|
+
validateImportChain(serverOnly, this.environment.name, this.environment.config.root);
|
|
219
|
+
const clientOnly = getImportChainBuild(this, "\0virtual:vite-rsc/validate-imports/invalid/client-only");
|
|
220
|
+
validateImportChain(clientOnly, this.environment.name, this.environment.config.root);
|
|
221
|
+
}
|
|
289
222
|
}
|
|
290
223
|
};
|
|
291
224
|
}
|
|
225
|
+
function getImportChainDev(environment, id) {
|
|
226
|
+
const chain = [];
|
|
227
|
+
const recurse = (id$1) => {
|
|
228
|
+
if (chain.includes(id$1)) return;
|
|
229
|
+
const info = environment.moduleGraph.getModuleById(id$1);
|
|
230
|
+
if (!info) return;
|
|
231
|
+
chain.push(id$1);
|
|
232
|
+
const next = [...info.importers][0];
|
|
233
|
+
if (next && next.id) recurse(next.id);
|
|
234
|
+
};
|
|
235
|
+
recurse(id);
|
|
236
|
+
return chain;
|
|
237
|
+
}
|
|
238
|
+
function getImportChainBuild(ctx, id) {
|
|
239
|
+
const chain = [];
|
|
240
|
+
const recurse = (id$1) => {
|
|
241
|
+
if (chain.includes(id$1)) return;
|
|
242
|
+
const info = ctx.getModuleInfo(id$1);
|
|
243
|
+
if (!info) return;
|
|
244
|
+
chain.push(id$1);
|
|
245
|
+
const next = info.importers[0];
|
|
246
|
+
if (next) recurse(next);
|
|
247
|
+
};
|
|
248
|
+
recurse(id);
|
|
249
|
+
return chain;
|
|
250
|
+
}
|
|
251
|
+
function validateImportChain(chain, environmentName, root) {
|
|
252
|
+
if (chain.length === 0) return;
|
|
253
|
+
const id = chain[0];
|
|
254
|
+
const source = id.slice(id.lastIndexOf("/") + 1);
|
|
255
|
+
let result = `'${source}' cannot be imported in ${source === "server-only" ? "client" : "server"} build ('${environmentName}' environment):\n`;
|
|
256
|
+
result += chain.slice(1, 6).map((id$1, i) => " ".repeat(i + 1) + `imported by ${path.relative(root, id$1).replaceAll("\0", "")}\n`).join("");
|
|
257
|
+
if (chain.length > 6) result += " ".repeat(7) + "...\n";
|
|
258
|
+
const error = new Error(result);
|
|
259
|
+
if (chain[1]) Object.assign(error, { id: chain[1] });
|
|
260
|
+
throw error;
|
|
261
|
+
}
|
|
292
262
|
|
|
293
263
|
//#endregion
|
|
294
264
|
//#region src/plugins/find-source-map-url.ts
|
|
@@ -498,6 +468,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
498
468
|
ssr: {
|
|
499
469
|
build: {
|
|
500
470
|
outDir: config.environments?.ssr?.build?.outDir ?? "dist/ssr",
|
|
471
|
+
copyPublicDir: false,
|
|
501
472
|
rollupOptions: { input: rscPluginOptions.entries?.ssr && { index: rscPluginOptions.entries.ssr } }
|
|
502
473
|
},
|
|
503
474
|
resolve: { noExternal },
|
|
@@ -517,6 +488,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
517
488
|
rsc: {
|
|
518
489
|
build: {
|
|
519
490
|
outDir: config.environments?.rsc?.build?.outDir ?? "dist/rsc",
|
|
491
|
+
copyPublicDir: false,
|
|
520
492
|
emitAssets: true,
|
|
521
493
|
rollupOptions: { input: rscPluginOptions.entries?.rsc && { index: rscPluginOptions.entries.rsc } }
|
|
522
494
|
},
|
|
@@ -582,8 +554,9 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
582
554
|
const resolved = await environment.pluginContainer.resolveId(source);
|
|
583
555
|
assert(resolved, `[vite-rsc] failed to resolve server handler '${source}'`);
|
|
584
556
|
const mod = await environment.runner.import(resolved.id);
|
|
557
|
+
const fetchHandler = getFetchHandlerExport(mod);
|
|
585
558
|
req.url = req.originalUrl ?? req.url;
|
|
586
|
-
await createRequestListener(
|
|
559
|
+
await createRequestListener(fetchHandler)(req, res);
|
|
587
560
|
} catch (e) {
|
|
588
561
|
next(e);
|
|
589
562
|
}
|
|
@@ -599,7 +572,8 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
599
572
|
};
|
|
600
573
|
const entryFile = path.join(manager.config.environments[options.environmentName].build.outDir, `${options.entryName}.js`);
|
|
601
574
|
const mod = await import(pathToFileURL(entryFile).href);
|
|
602
|
-
const
|
|
575
|
+
const fetchHandler = getFetchHandlerExport(mod);
|
|
576
|
+
const handler = createRequestListener(fetchHandler);
|
|
603
577
|
server.middlewares.use((req, _res, next) => {
|
|
604
578
|
delete req.headers["accept-encoding"];
|
|
605
579
|
next();
|
|
@@ -617,7 +591,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
617
591
|
},
|
|
618
592
|
async hotUpdate(ctx) {
|
|
619
593
|
if (isCSSRequest(ctx.file)) {
|
|
620
|
-
if (this.environment.name === "client") return
|
|
594
|
+
if (this.environment.name === "client") return;
|
|
621
595
|
}
|
|
622
596
|
if (ctx.modules.map((mod) => mod.id).filter((v) => v !== null).length === 0) return;
|
|
623
597
|
if (this.environment.name === "rsc") {
|
|
@@ -881,7 +855,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
881
855
|
const ssrCss = document.querySelectorAll("link[rel='stylesheet']");
|
|
882
856
|
import.meta.hot.on("vite:beforeUpdate", () => {
|
|
883
857
|
ssrCss.forEach(node => {
|
|
884
|
-
if (node.dataset.precedence?.startsWith("vite-rsc/")) {
|
|
858
|
+
if (node.dataset.precedence?.startsWith("vite-rsc/client-references")) {
|
|
885
859
|
node.remove();
|
|
886
860
|
}
|
|
887
861
|
});
|
|
@@ -892,6 +866,11 @@ import.meta.hot.on("rsc:update", () => {
|
|
|
892
866
|
document.querySelectorAll("vite-error-overlay").forEach((n) => n.close())
|
|
893
867
|
});
|
|
894
868
|
`;
|
|
869
|
+
code += `import.meta.hot.on("rsc:prune", ${(e) => {
|
|
870
|
+
document.querySelectorAll("link[rel='stylesheet']").forEach((node) => {
|
|
871
|
+
if (e.paths.includes(node.dataset.rscCssHref)) node.remove();
|
|
872
|
+
});
|
|
873
|
+
}});`;
|
|
895
874
|
return code;
|
|
896
875
|
}),
|
|
897
876
|
...vitePluginRscMinimal(rscPluginOptions, manager),
|
|
@@ -924,7 +903,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
924
903
|
id = normalizePath(path.relative(process.cwd(), id));
|
|
925
904
|
if (optimizerMetadata?.ids.includes(id)) ctx.warn("client component dependency is inconsistently optimized. It's recommended to add the dependency to 'optimizeDeps.exclude'.");
|
|
926
905
|
}
|
|
927
|
-
const debug
|
|
906
|
+
const debug = createDebug("vite-rsc:use-client");
|
|
928
907
|
return [
|
|
929
908
|
{
|
|
930
909
|
name: "rsc:use-client",
|
|
@@ -943,7 +922,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
943
922
|
let referenceKey;
|
|
944
923
|
const packageSource = packageSources.get(id);
|
|
945
924
|
if (!packageSource && this.environment.mode === "dev" && id.includes("/node_modules/")) {
|
|
946
|
-
debug
|
|
925
|
+
debug(`internal client reference created through a package imported in '${this.environment.name}' environment: ${id}`);
|
|
947
926
|
id = cleanUrl(id);
|
|
948
927
|
warnInoncistentClientOptimization(this, id);
|
|
949
928
|
importId = `/@id/__x00__virtual:vite-rsc/client-in-server-package-proxy/${encodeURIComponent(id)}`;
|
|
@@ -1021,7 +1000,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1021
1000
|
(manager.clientReferenceGroups[name] ??= []).push(meta);
|
|
1022
1001
|
meta.groupChunkId = `\0virtual:vite-rsc/client-references/group/${name}`;
|
|
1023
1002
|
}
|
|
1024
|
-
debug
|
|
1003
|
+
debug("client-reference-groups", manager.clientReferenceGroups);
|
|
1025
1004
|
for (const [name, metas] of Object.entries(manager.clientReferenceGroups)) {
|
|
1026
1005
|
const groupVirtual = `virtual:vite-rsc/client-references/group/${name}`;
|
|
1027
1006
|
for (const meta of metas) code += `\
|
|
@@ -1076,7 +1055,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1076
1055
|
resolveId: {
|
|
1077
1056
|
order: "pre",
|
|
1078
1057
|
async handler(source, importer, options) {
|
|
1079
|
-
if (this.environment.name === serverEnvironmentName && bareImportRE.test(source)) {
|
|
1058
|
+
if (this.environment.name === serverEnvironmentName && bareImportRE.test(source) && !(source === "client-only" || source === "server-only")) {
|
|
1080
1059
|
const resolved = await this.resolve(source, importer, options);
|
|
1081
1060
|
if (resolved && resolved.id.includes("/node_modules/")) {
|
|
1082
1061
|
packageSources.set(resolved.id, source);
|
|
@@ -1204,7 +1183,7 @@ function vitePluginDefineEncryptionKey(useServerPluginOptions) {
|
|
|
1204
1183
|
function vitePluginUseServer(useServerPluginOptions, manager) {
|
|
1205
1184
|
const serverEnvironmentName = useServerPluginOptions.environment?.rsc ?? "rsc";
|
|
1206
1185
|
const browserEnvironmentName = useServerPluginOptions.environment?.browser ?? "client";
|
|
1207
|
-
const debug
|
|
1186
|
+
const debug = createDebug("vite-rsc:use-server");
|
|
1208
1187
|
return [{
|
|
1209
1188
|
name: "rsc:use-server",
|
|
1210
1189
|
async transform(code, id) {
|
|
@@ -1217,7 +1196,7 @@ function vitePluginUseServer(useServerPluginOptions, manager) {
|
|
|
1217
1196
|
const getNormalizedId = () => {
|
|
1218
1197
|
if (!normalizedId_) {
|
|
1219
1198
|
if (this.environment.mode === "dev" && id.includes("/node_modules/")) {
|
|
1220
|
-
debug
|
|
1199
|
+
debug(`internal server reference created through a package imported in ${this.environment.name} environment: ${id}`);
|
|
1221
1200
|
id = cleanUrl(id);
|
|
1222
1201
|
}
|
|
1223
1202
|
if (manager.config.command === "build") normalizedId_ = hashString(manager.toRelativeId(id));
|
|
@@ -1453,6 +1432,19 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1453
1432
|
};
|
|
1454
1433
|
}
|
|
1455
1434
|
},
|
|
1435
|
+
{
|
|
1436
|
+
name: "rsc:rsc-css-self-accept",
|
|
1437
|
+
apply: "serve",
|
|
1438
|
+
transform: {
|
|
1439
|
+
order: "post",
|
|
1440
|
+
handler(_code, id, _options) {
|
|
1441
|
+
if (this.environment.name === "client" && this.environment.mode === "dev" && isCSSRequest(id) && directRequestRE.test(id)) {
|
|
1442
|
+
const mod = this.environment.moduleGraph.getModuleById(id);
|
|
1443
|
+
if (mod && !mod.isSelfAccepting) mod.isSelfAccepting = true;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1456
1448
|
{
|
|
1457
1449
|
name: "rsc:css-virtual",
|
|
1458
1450
|
resolveId(source) {
|
|
@@ -1474,6 +1466,19 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1474
1466
|
},
|
|
1475
1467
|
{
|
|
1476
1468
|
name: "rsc:importer-resources",
|
|
1469
|
+
configureServer(server) {
|
|
1470
|
+
const hot = server.environments.rsc.hot;
|
|
1471
|
+
const original = hot.send;
|
|
1472
|
+
hot.send = function(...args) {
|
|
1473
|
+
const e = args[0];
|
|
1474
|
+
if (e && typeof e === "object" && e.type === "prune") server.environments.client.hot.send({
|
|
1475
|
+
type: "custom",
|
|
1476
|
+
event: "rsc:prune",
|
|
1477
|
+
data: e
|
|
1478
|
+
});
|
|
1479
|
+
return original.apply(this, args);
|
|
1480
|
+
};
|
|
1481
|
+
},
|
|
1477
1482
|
async transform(code, id) {
|
|
1478
1483
|
if (!code.includes("import.meta.viteRsc.loadCss")) return;
|
|
1479
1484
|
assert(this.environment.name === "rsc");
|
|
@@ -1527,14 +1532,12 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1527
1532
|
assert(this.environment.name === "rsc");
|
|
1528
1533
|
const importer = parsed.id;
|
|
1529
1534
|
if (this.environment.mode === "dev") {
|
|
1530
|
-
const
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
type: "rsc-browser"
|
|
1534
|
-
})}`];
|
|
1535
|
+
const result = collectCss(server.environments.rsc, importer);
|
|
1536
|
+
for (const file of [importer, ...result.visitedFiles]) this.addWatchFile(file);
|
|
1537
|
+
const cssHrefs = result.hrefs.map((href) => href.slice(1));
|
|
1535
1538
|
const deps = assetsURLOfDeps({
|
|
1536
1539
|
css: cssHrefs,
|
|
1537
|
-
js:
|
|
1540
|
+
js: []
|
|
1538
1541
|
}, manager);
|
|
1539
1542
|
return generateResourcesCode(serializeValueWithRuntime(deps), manager);
|
|
1540
1543
|
} else {
|
|
@@ -1546,37 +1549,13 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1546
1549
|
`;
|
|
1547
1550
|
}
|
|
1548
1551
|
}
|
|
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
1552
|
}
|
|
1574
1553
|
},
|
|
1575
1554
|
createVirtualPlugin("vite-rsc/remove-duplicate-server-css", async function() {
|
|
1576
1555
|
assert.equal(this.environment.mode, "dev");
|
|
1577
1556
|
function removeFn() {
|
|
1578
1557
|
document.querySelectorAll("link[rel='stylesheet']").forEach((node) => {
|
|
1579
|
-
if (node instanceof HTMLElement && node.dataset.precedence?.startsWith("vite-rsc/")) node.remove();
|
|
1558
|
+
if (node instanceof HTMLElement && node.dataset.precedence?.startsWith("vite-rsc/client-reference")) node.remove();
|
|
1580
1559
|
});
|
|
1581
1560
|
}
|
|
1582
1561
|
return `\
|
|
@@ -1592,39 +1571,16 @@ export default function RemoveDuplicateServerCss() {
|
|
|
1592
1571
|
})
|
|
1593
1572
|
];
|
|
1594
1573
|
}
|
|
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
1574
|
function generateResourcesCode(depsCode, manager) {
|
|
1611
1575
|
const ResourcesFn = (React, deps, RemoveDuplicateServerCss) => {
|
|
1612
1576
|
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
|
-
]);
|
|
1577
|
+
return React.createElement(React.Fragment, null, [...deps.css.map((href) => React.createElement("link", {
|
|
1578
|
+
key: "css:" + href,
|
|
1579
|
+
rel: "stylesheet",
|
|
1580
|
+
precedence: "vite-rsc/importer-resources",
|
|
1581
|
+
href,
|
|
1582
|
+
"data-rsc-css-href": href
|
|
1583
|
+
})), RemoveDuplicateServerCss && React.createElement(RemoveDuplicateServerCss, { key: "remove-duplicate-css" })]);
|
|
1628
1584
|
};
|
|
1629
1585
|
};
|
|
1630
1586
|
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-BI8kK-GE.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
|