@vitejs/plugin-rsc 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{browser-DUDACP5e.d.ts → browser-mbRygLxB.d.ts} +1 -1
- package/dist/browser.d.ts +3 -3
- 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-z7X8aRLB.js → encryption-runtime-CJUalqt3.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 +1 -1
- package/dist/index.js +2 -3
- package/dist/{plugin-Ddfc3b6D.js → plugin--LiSJGtB.js} +185 -51
- package/dist/{plugin-CrIhPWor.d.ts → plugin-YtSjJn3Y.d.ts} +16 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +2 -3
- 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-0ugrKC93.js → rsc-BwEwbLG4.js} +1 -1
- package/dist/{rsc-BeJKxeMX.d.ts → rsc-CxDPDiLz.d.ts} +1 -1
- package/dist/{rsc-K03z8Dh0.js → rsc-VjVw_i-M.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-D154nyka.js → ssr-BEKKb_cw.js} +1 -1
- package/dist/{ssr-Bv84RACl.d.ts → ssr-BoNKka-5.d.ts} +1 -1
- package/dist/{ssr-BnEu3hbo.js → ssr-CWjOQSe3.js} +2 -2
- package/dist/ssr.d.ts +3 -3
- package/dist/ssr.js +4 -4
- package/dist/utils/encryption-runtime.d.ts +1 -1
- package/dist/utils/encryption-runtime.js +3 -3
- package/package.json +7 -7
- package/dist/vite-utils-Vzd7cqfv.js +0 -79
- package/dist/vite-utils.d.ts +0 -23
- package/dist/vite-utils.js +0 -3
- /package/dist/{browser-CyGTajab.d.ts → browser-CuwQIlVY.d.ts} +0 -0
- /package/dist/{client-BPIq1kGs.js → client-C1J4FCf5.js} +0 -0
- /package/dist/{encryption-runtime-BmDC7d-3.d.ts → encryption-runtime-SgJRa9yj.d.ts} +0 -0
- /package/dist/{index-CrcbP1rd.d.ts → index-QWzVHuya.d.ts} +0 -0
- /package/dist/{rsc-C54XEgZY.js → rsc-BfBPoIV8.js} +0 -0
- /package/dist/{rsc-A9Zr9bEE.d.ts → rsc-CFtzqEG8.d.ts} +0 -0
- /package/dist/{rsc-D-lnfNSa.d.ts → rsc-Cv3XEZqB.d.ts} +0 -0
- /package/dist/{server-DoWzqBNF.js → server-D0-DavPP.js} +0 -0
- /package/dist/{shared-Cwk6fxfN.js → shared-BWHxNw3Q.js} +0 -0
- /package/dist/{ssr-v4qYqcXu.js → ssr--rFiBtws.js} +0 -0
- /package/dist/{ssr-EOoYUXrM.d.ts → ssr-D6GTzOzx.d.ts} +0 -0
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-QWzVHuya.js";
|
|
2
|
+
import { setRequireModule } from "./browser-CuwQIlVY.js";
|
|
3
|
+
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "./browser-mbRygLxB.js";
|
|
4
4
|
export { CallServerCallback, callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setRequireModule, setServerCallback };
|
package/dist/core/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { setRequireModule } from "../browser-
|
|
1
|
+
import { setRequireModule } from "../browser-CuwQIlVY.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-QWzVHuya.js";
|
|
2
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-CxDPDiLz.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-CEyKoKAb.js";
|
|
3
|
-
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-
|
|
3
|
+
import { createClientManifest, createServerDecodeClientManifest, createServerManifest, loadServerAction, setRequireModule } from "../rsc-BfBPoIV8.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-QWzVHuya.js";
|
|
2
|
+
import { createServerConsumerManifest, setRequireModule } from "../ssr-BoNKka-5.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-CEyKoKAb.js";
|
|
3
|
-
import { createServerConsumerManifest, setRequireModule } from "../ssr
|
|
3
|
+
import { createServerConsumerManifest, setRequireModule } from "../ssr--rFiBtws.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-VjVw_i-M.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-CEyKoKAb.js";
|
|
|
3
3
|
import "../browser-BhJd-Orx.js";
|
|
4
4
|
import { createFromFetch, createFromReadableStream, createTemporaryReferenceSet, encodeReply, setServerCallback } from "../browser-D8OPzpF5.js";
|
|
5
5
|
import "../browser-QU10IP0-.js";
|
|
6
|
-
import { rscStream } from "../client-
|
|
6
|
+
import { rscStream } from "../client-C1J4FCf5.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-Cv3XEZqB.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-CEyKoKAb.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-BfBPoIV8.js";
|
|
5
|
+
import { createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, renderToReadableStream } from "../rsc-VjVw_i-M.js";
|
|
6
|
+
import "../encryption-runtime-CJUalqt3.js";
|
|
7
|
+
import "../rsc-BwEwbLG4.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-CEyKoKAb.js";
|
|
3
|
-
import "../shared-
|
|
4
|
-
import "../ssr
|
|
5
|
-
import { createFromReadableStream } from "../ssr-
|
|
6
|
-
import "../ssr-
|
|
7
|
-
import { injectRSCPayload } from "../server-
|
|
3
|
+
import "../shared-BWHxNw3Q.js";
|
|
4
|
+
import "../ssr--rFiBtws.js";
|
|
5
|
+
import { createFromReadableStream } from "../ssr-BEKKb_cw.js";
|
|
6
|
+
import "../ssr-CWjOQSe3.js";
|
|
7
|
+
import { injectRSCPayload } from "../server-D0-DavPP.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
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "./dist-DiJnRA1C.js";
|
|
2
2
|
import "./plugin-CZbI4rhS.js";
|
|
3
|
-
import { transformHoistInlineDirective, vitePluginRsc } from "./plugin
|
|
3
|
+
import { transformHoistInlineDirective, vitePluginRsc } from "./plugin--LiSJGtB.js";
|
|
4
4
|
import "./encryption-utils-BDwwcMVT.js";
|
|
5
5
|
import "./rpc-tGuLT8PD.js";
|
|
6
|
-
import "./
|
|
7
|
-
import "./shared-Cwk6fxfN.js";
|
|
6
|
+
import "./shared-BWHxNw3Q.js";
|
|
8
7
|
|
|
9
8
|
export { vitePluginRsc as default, transformHoistInlineDirective };
|
|
@@ -2,8 +2,7 @@ import { createDebug, tinyassert } from "./dist-DiJnRA1C.js";
|
|
|
2
2
|
import { vitePluginRscCore } from "./plugin-CZbI4rhS.js";
|
|
3
3
|
import { generateEncryptionKey, toBase64 } from "./encryption-utils-BDwwcMVT.js";
|
|
4
4
|
import { createRpcServer } from "./rpc-tGuLT8PD.js";
|
|
5
|
-
import {
|
|
6
|
-
import { parseCssVirtual, parseIdQuery, toCssVirtual } from "./shared-Cwk6fxfN.js";
|
|
5
|
+
import { parseCssVirtual, parseIdQuery, toCssVirtual } from "./shared-BWHxNw3Q.js";
|
|
7
6
|
import { createRequire } from "node:module";
|
|
8
7
|
import assert from "node:assert";
|
|
9
8
|
import fs from "node:fs";
|
|
@@ -17,6 +16,7 @@ import { defaultServerConditions, isCSSRequest, normalizePath, parseAstAsync } f
|
|
|
17
16
|
import { crawlFrameworkPkgs, findClosestPkgJsonPath } from "vitefu";
|
|
18
17
|
import { walk } from "estree-walker";
|
|
19
18
|
import { analyze, extract_names } from "periscopic";
|
|
19
|
+
import { stripVTControlCharacters } from "node:util";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
21
21
|
|
|
22
22
|
//#region src/transforms/hoist.ts
|
|
@@ -306,6 +306,78 @@ function transformServerActionServer(input, ast, options) {
|
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/plugins/vite-utils.ts
|
|
311
|
+
const VALID_ID_PREFIX = `/@id/`;
|
|
312
|
+
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
313
|
+
const FS_PREFIX = `/@fs/`;
|
|
314
|
+
function wrapId(id) {
|
|
315
|
+
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
|
316
|
+
}
|
|
317
|
+
function withTrailingSlash(path$1) {
|
|
318
|
+
if (path$1[path$1.length - 1] !== "/") return `${path$1}/`;
|
|
319
|
+
return path$1;
|
|
320
|
+
}
|
|
321
|
+
const postfixRE = /[?#].*$/;
|
|
322
|
+
function cleanUrl(url) {
|
|
323
|
+
return url.replace(postfixRE, "");
|
|
324
|
+
}
|
|
325
|
+
function splitFileAndPostfix(path$1) {
|
|
326
|
+
const file = cleanUrl(path$1);
|
|
327
|
+
return {
|
|
328
|
+
file,
|
|
329
|
+
postfix: path$1.slice(file.length)
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const windowsSlashRE = /\\/g;
|
|
333
|
+
function slash(p) {
|
|
334
|
+
return p.replace(windowsSlashRE, "/");
|
|
335
|
+
}
|
|
336
|
+
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
337
|
+
function injectQuery(url, queryToInject) {
|
|
338
|
+
const { file, postfix } = splitFileAndPostfix(url);
|
|
339
|
+
const normalizedFile = isWindows ? slash(file) : file;
|
|
340
|
+
return `${normalizedFile}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
341
|
+
}
|
|
342
|
+
function normalizeResolvedIdToUrl(environment, url, resolved) {
|
|
343
|
+
const root = environment.config.root;
|
|
344
|
+
const depsOptimizer = environment.depsOptimizer;
|
|
345
|
+
if (resolved.id.startsWith(withTrailingSlash(root))) url = resolved.id.slice(root.length);
|
|
346
|
+
else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || resolved.id !== "/@react-refresh" && path.isAbsolute(resolved.id) && fs.existsSync(cleanUrl(resolved.id))) url = path.posix.join(FS_PREFIX, resolved.id);
|
|
347
|
+
else url = resolved.id;
|
|
348
|
+
if (url[0] !== "." && url[0] !== "/") url = wrapId(resolved.id);
|
|
349
|
+
return url;
|
|
350
|
+
}
|
|
351
|
+
function normalizeViteImportAnalysisUrl(environment, id) {
|
|
352
|
+
let url = normalizeResolvedIdToUrl(environment, id, { id });
|
|
353
|
+
if (environment.config.consumer === "client") {
|
|
354
|
+
const mod = environment.moduleGraph.getModuleById(id);
|
|
355
|
+
if (mod && mod.lastHMRTimestamp > 0) url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
|
356
|
+
}
|
|
357
|
+
return url;
|
|
358
|
+
}
|
|
359
|
+
function prepareError(err) {
|
|
360
|
+
return {
|
|
361
|
+
message: stripVTControlCharacters(err.message),
|
|
362
|
+
stack: stripVTControlCharacters(cleanStack(err.stack || "")),
|
|
363
|
+
id: err.id,
|
|
364
|
+
frame: stripVTControlCharacters(err.frame || ""),
|
|
365
|
+
plugin: err.plugin,
|
|
366
|
+
pluginCode: err.pluginCode?.toString(),
|
|
367
|
+
loc: err.loc
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function cleanStack(stack) {
|
|
371
|
+
return stack.split(/\n/).filter((l) => /^\s*at/.test(l)).join("\n");
|
|
372
|
+
}
|
|
373
|
+
function evalValue(rawValue) {
|
|
374
|
+
const fn = new Function(`
|
|
375
|
+
var console, exports, global, module, process, require
|
|
376
|
+
return (\n${rawValue}\n)
|
|
377
|
+
`);
|
|
378
|
+
return fn();
|
|
379
|
+
}
|
|
380
|
+
|
|
309
381
|
//#endregion
|
|
310
382
|
//#region src/transforms/cjs.ts
|
|
311
383
|
function transformCjsToEsm(code, ast) {
|
|
@@ -402,13 +474,6 @@ function extractPackageKey(id) {
|
|
|
402
474
|
|
|
403
475
|
//#endregion
|
|
404
476
|
//#region src/plugins/utils.ts
|
|
405
|
-
function evalValue(rawValue) {
|
|
406
|
-
const fn = new Function(`
|
|
407
|
-
var console, exports, global, module, process, require
|
|
408
|
-
return (\n${rawValue}\n)
|
|
409
|
-
`);
|
|
410
|
-
return fn();
|
|
411
|
-
}
|
|
412
477
|
function sortObject(o) {
|
|
413
478
|
return Object.fromEntries(Object.entries(o).sort(([a], [b]) => a.localeCompare(b)));
|
|
414
479
|
}
|
|
@@ -567,6 +632,7 @@ async function findSourceMapURL(server, filename, environmentName) {
|
|
|
567
632
|
|
|
568
633
|
//#endregion
|
|
569
634
|
//#region src/plugin.ts
|
|
635
|
+
const isRolldownVite = "rolldownVersion" in vite;
|
|
570
636
|
const BUILD_ASSETS_MANIFEST_NAME = "__vite_rsc_assets_manifest.js";
|
|
571
637
|
const PKG_NAME = "@vitejs/plugin-rsc";
|
|
572
638
|
const REACT_SERVER_DOM_NAME = `${PKG_NAME}/vendor/react-server-dom`;
|
|
@@ -582,12 +648,16 @@ var RscPluginManager = class {
|
|
|
582
648
|
buildAssetsManifest;
|
|
583
649
|
isScanBuild = false;
|
|
584
650
|
clientReferenceMetaMap = {};
|
|
651
|
+
clientReferenceGroups = {};
|
|
585
652
|
serverReferenceMetaMap = {};
|
|
586
653
|
serverResourcesMetaMap = {};
|
|
587
654
|
stabilize() {
|
|
588
655
|
this.clientReferenceMetaMap = sortObject(this.clientReferenceMetaMap);
|
|
589
656
|
this.serverResourcesMetaMap = sortObject(this.serverResourcesMetaMap);
|
|
590
657
|
}
|
|
658
|
+
toRelativeId(id) {
|
|
659
|
+
return normalizePath(path.relative(this.config.root, id));
|
|
660
|
+
}
|
|
591
661
|
};
|
|
592
662
|
/** @experimental */
|
|
593
663
|
function vitePluginRscMinimal(rscPluginOptions = {}, manager = new RscPluginManager()) {
|
|
@@ -708,6 +778,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
708
778
|
"react/jsx-runtime",
|
|
709
779
|
"react/jsx-dev-runtime",
|
|
710
780
|
"react-dom/server.edge",
|
|
781
|
+
"react-dom/static.edge",
|
|
711
782
|
`${REACT_SERVER_DOM_NAME}/client.edge`
|
|
712
783
|
],
|
|
713
784
|
exclude: [PKG_NAME]
|
|
@@ -746,6 +817,20 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
746
817
|
buildApp: rscPluginOptions.useBuildAppHook ? buildApp : void 0,
|
|
747
818
|
configureServer(server) {
|
|
748
819
|
globalThis.__viteRscDevServer = server;
|
|
820
|
+
const oldSend = server.environments.client.hot.send;
|
|
821
|
+
server.environments.client.hot.send = async function(...args) {
|
|
822
|
+
const e = args[0];
|
|
823
|
+
if (e && typeof e === "object" && e.type === "update") {
|
|
824
|
+
for (const update of e.updates) if (update.type === "js-update") {
|
|
825
|
+
const mod = server.environments.client.moduleGraph.urlToModuleMap.get(update.path);
|
|
826
|
+
if (mod && mod.id && manager.clientReferenceMetaMap[mod.id]) {
|
|
827
|
+
const serverMod = server.environments.rsc.moduleGraph.getModuleById(mod.id);
|
|
828
|
+
if (serverMod) server.environments.rsc.moduleGraph.invalidateModule(serverMod);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return oldSend.apply(this, args);
|
|
833
|
+
};
|
|
749
834
|
if (rscPluginOptions.disableServerHandler) return;
|
|
750
835
|
if (rscPluginOptions.serverHandler === false) return;
|
|
751
836
|
const options = rscPluginOptions.serverHandler ?? {
|
|
@@ -797,7 +882,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
797
882
|
},
|
|
798
883
|
async hotUpdate(ctx) {
|
|
799
884
|
if (isCSSRequest(ctx.file)) {
|
|
800
|
-
if (this.environment.name === "client") return ctx.modules.filter((m) => !m.id?.includes("?direct"));
|
|
885
|
+
if (this.environment.name === "client") return ctx.modules.filter((m) => !(m.id?.includes("?direct") && !m.isSelfAccepting));
|
|
801
886
|
}
|
|
802
887
|
const ids = ctx.modules.map((mod) => mod.id).filter((v) => v !== null);
|
|
803
888
|
if (ids.length === 0) return;
|
|
@@ -991,8 +1076,8 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
991
1076
|
assert(entry);
|
|
992
1077
|
const entryUrl = assetsURL(entry.chunk.fileName, manager);
|
|
993
1078
|
const clientReferenceDeps = {};
|
|
994
|
-
for (const
|
|
995
|
-
const deps = assetDeps[
|
|
1079
|
+
for (const meta of Object.values(manager.clientReferenceMetaMap)) {
|
|
1080
|
+
const deps = assetDeps[meta.groupChunkId]?.deps ?? {
|
|
996
1081
|
js: [],
|
|
997
1082
|
css: []
|
|
998
1083
|
};
|
|
@@ -1081,17 +1166,9 @@ import.meta.hot.on("rsc:update", () => {
|
|
|
1081
1166
|
}),
|
|
1082
1167
|
{
|
|
1083
1168
|
name: "rsc:inject-async-local-storage",
|
|
1084
|
-
|
|
1085
|
-
const __viteRscAyncHooks =
|
|
1086
|
-
|
|
1087
|
-
},
|
|
1088
|
-
banner(chunk) {
|
|
1089
|
-
if ((this.environment.name === "ssr" || this.environment.name === "rsc") && this.environment.mode === "build" && chunk.isEntry) return `\
|
|
1090
|
-
import * as __viteRscAyncHooks from "node:async_hooks";
|
|
1091
|
-
globalThis.AsyncLocalStorage = __viteRscAyncHooks.AsyncLocalStorage;
|
|
1092
|
-
`;
|
|
1093
|
-
return "";
|
|
1094
|
-
}
|
|
1169
|
+
transform: { handler(code) {
|
|
1170
|
+
if ((this.environment.name === "ssr" || this.environment.name === "rsc") && code.includes("typeof AsyncLocalStorage") && code.includes("new AsyncLocalStorage()") && !code.includes("__viteRscAyncHooks")) return (this.environment.mode === "build" && !isRolldownVite ? `const __viteRscAyncHooks = require("node:async_hooks");` : `import * as __viteRscAyncHooks from "node:async_hooks";`) + `globalThis.AsyncLocalStorage = __viteRscAyncHooks.AsyncLocalStorage;` + code;
|
|
1171
|
+
} }
|
|
1095
1172
|
},
|
|
1096
1173
|
...vitePluginRscMinimal(rscPluginOptions, manager),
|
|
1097
1174
|
...vitePluginFindSourceMapURL(),
|
|
@@ -1162,7 +1239,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1162
1239
|
referenceKey = importId;
|
|
1163
1240
|
} else {
|
|
1164
1241
|
importId = id;
|
|
1165
|
-
referenceKey = hashString(
|
|
1242
|
+
referenceKey = hashString(manager.toRelativeId(id));
|
|
1166
1243
|
}
|
|
1167
1244
|
const transformDirectiveProxyExport_ = withRollupError(this, transformDirectiveProxyExport);
|
|
1168
1245
|
const result = transformDirectiveProxyExport_(ast, {
|
|
@@ -1192,29 +1269,72 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1192
1269
|
};
|
|
1193
1270
|
}
|
|
1194
1271
|
},
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1272
|
+
{
|
|
1273
|
+
name: "rsc:use-client/build-references",
|
|
1274
|
+
resolveId(source) {
|
|
1275
|
+
if (source.startsWith("virtual:vite-rsc/client-references")) return "\0" + source;
|
|
1276
|
+
},
|
|
1277
|
+
load(id) {
|
|
1278
|
+
if (id === "\0virtual:vite-rsc/client-references") {
|
|
1279
|
+
if (this.environment.mode === "dev") return {
|
|
1280
|
+
code: `export default {}`,
|
|
1281
|
+
map: null
|
|
1282
|
+
};
|
|
1283
|
+
if (manager.isScanBuild) {
|
|
1284
|
+
let code$1 = ``;
|
|
1285
|
+
for (const meta of Object.values(manager.clientReferenceMetaMap)) code$1 += `import ${JSON.stringify(meta.importId)};\n`;
|
|
1286
|
+
return {
|
|
1287
|
+
code: code$1,
|
|
1288
|
+
map: null
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
let code = "";
|
|
1292
|
+
manager.clientReferenceGroups = {};
|
|
1293
|
+
for (const meta of Object.values(manager.clientReferenceMetaMap)) {
|
|
1294
|
+
let name = useClientPluginOptions.clientChunks?.({
|
|
1295
|
+
id: meta.importId,
|
|
1296
|
+
serverChunk: meta.serverChunk
|
|
1297
|
+
}) ?? manager.toRelativeId(meta.importId);
|
|
1298
|
+
name = cleanUrl(name.replaceAll("..", "__"));
|
|
1299
|
+
const group = manager.clientReferenceGroups[name] ??= [];
|
|
1300
|
+
group.push(meta);
|
|
1301
|
+
meta.groupChunkId = `\0virtual:vite-rsc/client-references/group/${name}`;
|
|
1302
|
+
}
|
|
1303
|
+
debug$1("client-reference-groups", manager.clientReferenceGroups);
|
|
1304
|
+
for (const [name, metas] of Object.entries(manager.clientReferenceGroups)) {
|
|
1305
|
+
const groupVirtual = `virtual:vite-rsc/client-references/group/${name}`;
|
|
1306
|
+
for (const meta of metas) code += `\
|
|
1307
|
+
${JSON.stringify(meta.referenceKey)}: async () => {
|
|
1308
|
+
const m = await import(${JSON.stringify(groupVirtual)});
|
|
1309
|
+
return m.export_${meta.referenceKey};
|
|
1310
|
+
},
|
|
1311
|
+
`;
|
|
1312
|
+
}
|
|
1313
|
+
code = `export default {${code}};\n`;
|
|
1314
|
+
return {
|
|
1315
|
+
code,
|
|
1316
|
+
map: null
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
if (id.startsWith("\0virtual:vite-rsc/client-references/group/")) {
|
|
1320
|
+
const name = id.slice(42);
|
|
1321
|
+
const metas = manager.clientReferenceGroups[name];
|
|
1322
|
+
assert(metas, `unknown client reference group: ${name}`);
|
|
1323
|
+
let code = ``;
|
|
1324
|
+
for (const meta of metas) {
|
|
1325
|
+
const exports = meta.renderedExports.map((name$1) => `${name$1}: import_${meta.referenceKey}.${name$1},\n`).sort().join("");
|
|
1326
|
+
code += `
|
|
1327
|
+
import * as import_${meta.referenceKey} from ${JSON.stringify(meta.importId)};
|
|
1328
|
+
export const export_${meta.referenceKey} = {${exports}};
|
|
1329
|
+
`;
|
|
1330
|
+
}
|
|
1331
|
+
return {
|
|
1332
|
+
code,
|
|
1333
|
+
map: null
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1211
1336
|
}
|
|
1212
|
-
|
|
1213
|
-
return {
|
|
1214
|
-
code,
|
|
1215
|
-
map: null
|
|
1216
|
-
};
|
|
1217
|
-
}),
|
|
1337
|
+
},
|
|
1218
1338
|
{
|
|
1219
1339
|
name: "rsc:virtual-client-in-server-package",
|
|
1220
1340
|
async load(id) {
|
|
@@ -1255,9 +1375,23 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1255
1375
|
},
|
|
1256
1376
|
generateBundle(_options, bundle) {
|
|
1257
1377
|
if (this.environment.name !== serverEnvironmentName) return;
|
|
1258
|
-
for (const chunk of Object.values(bundle)) if (chunk.type === "chunk")
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1378
|
+
for (const chunk of Object.values(bundle)) if (chunk.type === "chunk") {
|
|
1379
|
+
const metas = [];
|
|
1380
|
+
for (const id of chunk.moduleIds) {
|
|
1381
|
+
const meta = manager.clientReferenceMetaMap[id];
|
|
1382
|
+
if (meta) metas.push([id, meta]);
|
|
1383
|
+
}
|
|
1384
|
+
if (metas.length > 0) {
|
|
1385
|
+
let serverChunk;
|
|
1386
|
+
if (chunk.facadeModuleId) serverChunk = "facade:" + manager.toRelativeId(chunk.facadeModuleId);
|
|
1387
|
+
else serverChunk = "shared:" + manager.toRelativeId(metas.map(([id]) => id).sort()[0]);
|
|
1388
|
+
for (const [id, meta] of metas) {
|
|
1389
|
+
const mod = chunk.modules[id];
|
|
1390
|
+
assert(mod);
|
|
1391
|
+
meta.renderedExports = mod.renderedExports;
|
|
1392
|
+
meta.serverChunk = serverChunk;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1261
1395
|
}
|
|
1262
1396
|
}
|
|
1263
1397
|
},
|
|
@@ -1368,7 +1502,7 @@ function vitePluginUseServer(useServerPluginOptions, manager) {
|
|
|
1368
1502
|
debug$1(`internal server reference created through a package imported in ${this.environment.name} environment: ${id}`);
|
|
1369
1503
|
id = cleanUrl(id);
|
|
1370
1504
|
}
|
|
1371
|
-
if (manager.config.command === "build") normalizedId_ = hashString(
|
|
1505
|
+
if (manager.config.command === "build") normalizedId_ = hashString(manager.toRelativeId(id));
|
|
1372
1506
|
else normalizedId_ = normalizeViteImportAnalysisUrl(manager.server.environments[serverEnvironmentName], id);
|
|
1373
1507
|
}
|
|
1374
1508
|
return normalizedId_;
|
|
@@ -1689,7 +1823,7 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1689
1823
|
}, manager);
|
|
1690
1824
|
return generateResourcesCode(serializeValueWithRuntime(deps), manager);
|
|
1691
1825
|
} else {
|
|
1692
|
-
const key =
|
|
1826
|
+
const key = manager.toRelativeId(importer);
|
|
1693
1827
|
manager.serverResourcesMetaMap[importer] = { key };
|
|
1694
1828
|
return `
|
|
1695
1829
|
import __vite_rsc_assets_manifest__ from "virtual:vite-rsc/assets-manifest";
|
|
@@ -17,6 +17,8 @@ type ClientReferenceMeta = {
|
|
|
17
17
|
packageSource?: string;
|
|
18
18
|
exportNames: string[];
|
|
19
19
|
renderedExports: string[];
|
|
20
|
+
serverChunk?: string;
|
|
21
|
+
groupChunkId?: string;
|
|
20
22
|
};
|
|
21
23
|
type ServerRerferenceMeta = {
|
|
22
24
|
importId: string;
|
|
@@ -30,11 +32,13 @@ declare class RscPluginManager {
|
|
|
30
32
|
buildAssetsManifest: AssetsManifest | undefined;
|
|
31
33
|
isScanBuild: boolean;
|
|
32
34
|
clientReferenceMetaMap: Record<string, ClientReferenceMeta>;
|
|
35
|
+
clientReferenceGroups: Record<string, ClientReferenceMeta[]>;
|
|
33
36
|
serverReferenceMetaMap: Record<string, ServerRerferenceMeta>;
|
|
34
37
|
serverResourcesMetaMap: Record<string, {
|
|
35
38
|
key: string;
|
|
36
39
|
}>;
|
|
37
40
|
stabilize(): void;
|
|
41
|
+
toRelativeId(id: string): string;
|
|
38
42
|
}
|
|
39
43
|
type RscPluginOptions = {
|
|
40
44
|
/**
|
|
@@ -97,6 +101,18 @@ type RscPluginOptions = {
|
|
|
97
101
|
ssr?: string;
|
|
98
102
|
rsc?: string;
|
|
99
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Custom chunking strategy for client reference modules.
|
|
106
|
+
*
|
|
107
|
+
* This function allows you to group multiple client components into
|
|
108
|
+
* custom chunks instead of having each module in its own chunk.
|
|
109
|
+
*/
|
|
110
|
+
clientChunks?: (meta: {
|
|
111
|
+
/** client reference module id */
|
|
112
|
+
id: string;
|
|
113
|
+
/** server chunk which includes a corresponding client reference proxy module */
|
|
114
|
+
serverChunk: string;
|
|
115
|
+
}) => string | undefined;
|
|
100
116
|
};
|
|
101
117
|
/** @experimental */
|
|
102
118
|
declare function vitePluginRscMinimal(rscPluginOptions?: RscPluginOptions, manager?: RscPluginManager): Plugin[];
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AssetDeps, AssetsManifest, ResolvedAssetDeps, ResolvedAssetsManifest, RscPluginOptions, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin-
|
|
1
|
+
import { AssetDeps, AssetsManifest, ResolvedAssetDeps, ResolvedAssetsManifest, RscPluginOptions, transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin-YtSjJn3Y.js";
|
|
2
2
|
export { AssetDeps, AssetsManifest, ResolvedAssetDeps, ResolvedAssetsManifest, RscPluginOptions, vitePluginRsc as default, transformRscCssExport, vitePluginRscMinimal };
|
package/dist/plugin.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "./dist-DiJnRA1C.js";
|
|
2
2
|
import "./plugin-CZbI4rhS.js";
|
|
3
|
-
import { transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin
|
|
3
|
+
import { transformRscCssExport, vitePluginRsc, vitePluginRscMinimal } from "./plugin--LiSJGtB.js";
|
|
4
4
|
import "./encryption-utils-BDwwcMVT.js";
|
|
5
5
|
import "./rpc-tGuLT8PD.js";
|
|
6
|
-
import "./
|
|
7
|
-
import "./shared-Cwk6fxfN.js";
|
|
6
|
+
import "./shared-BWHxNw3Q.js";
|
|
8
7
|
|
|
9
8
|
export { vitePluginRsc as default, 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-QWzVHuya.js";
|
|
2
|
+
import { setRequireModule } from "../browser-CuwQIlVY.js";
|
|
3
|
+
import { callServer, createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, findSourceMapURL, setServerCallback } from "../browser-mbRygLxB.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-QWzVHuya.js";
|
|
2
|
+
import { loadServerAction, setRequireModule } from "../rsc-CxDPDiLz.js";
|
|
3
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "../rsc-CFtzqEG8.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-CEyKoKAb.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-BfBPoIV8.js";
|
|
4
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "../rsc-VjVw_i-M.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-QWzVHuya.js";
|
|
2
|
+
import { setRequireModule } from "../ssr-BoNKka-5.js";
|
|
3
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-D6GTzOzx.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-CEyKoKAb.js";
|
|
3
|
-
import { setRequireModule } from "../ssr
|
|
4
|
-
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-
|
|
3
|
+
import { setRequireModule } from "../ssr--rFiBtws.js";
|
|
4
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "../ssr-BEKKb_cw.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-BfBPoIV8.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-QWzVHuya.js";
|
|
2
|
+
import { createClientManifest, createServerManifest, loadServerAction, setRequireModule } from "./rsc-CxDPDiLz.js";
|
|
3
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "./rsc-CFtzqEG8.js";
|
|
4
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "./encryption-runtime-SgJRa9yj.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-CEyKoKAb.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-BfBPoIV8.js";
|
|
5
|
+
import { createClientTemporaryReferenceSet, createFromReadableStream, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, encodeReply, registerClientReference, registerServerReference, renderToReadableStream } from "./rsc-VjVw_i-M.js";
|
|
6
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "./encryption-runtime-CJUalqt3.js";
|
|
7
|
+
import "./rsc-BwEwbLG4.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-BWHxNw3Q.js";
|
|
2
|
+
import { setRequireModule } from "./ssr--rFiBtws.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-QWzVHuya.js";
|
|
2
|
+
import { createServerConsumerManifest, setRequireModule } from "./ssr-BoNKka-5.js";
|
|
3
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-D6GTzOzx.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-CEyKoKAb.js";
|
|
3
|
-
import "./shared-
|
|
4
|
-
import { createServerConsumerManifest, setRequireModule } from "./ssr
|
|
5
|
-
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-
|
|
6
|
-
import "./ssr-
|
|
3
|
+
import "./shared-BWHxNw3Q.js";
|
|
4
|
+
import { createServerConsumerManifest, setRequireModule } from "./ssr--rFiBtws.js";
|
|
5
|
+
import { callServer, createFromReadableStream, createServerReference, findSourceMapURL } from "./ssr-BEKKb_cw.js";
|
|
6
|
+
import "./ssr-CWjOQSe3.js";
|
|
7
7
|
|
|
8
8
|
export { callServer, createFromReadableStream, createServerConsumerManifest, createServerReference, findSourceMapURL, setRequireModule };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-
|
|
1
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-SgJRa9yj.js";
|
|
2
2
|
export { decryptActionBoundArgs, encryptActionBoundArgs };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../dist-DiJnRA1C.js";
|
|
2
2
|
import "../shared-CEyKoKAb.js";
|
|
3
3
|
import "../encryption-utils-BDwwcMVT.js";
|
|
4
|
-
import "../rsc-
|
|
5
|
-
import "../rsc-
|
|
6
|
-
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-
|
|
4
|
+
import "../rsc-BfBPoIV8.js";
|
|
5
|
+
import "../rsc-VjVw_i-M.js";
|
|
6
|
+
import { decryptActionBoundArgs, encryptActionBoundArgs } from "../encryption-runtime-CJUalqt3.js";
|
|
7
7
|
|
|
8
8
|
export { decryptActionBoundArgs, encryptActionBoundArgs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-rsc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.25",
|
|
4
4
|
"description": "React Server Components (RSC) support for Vite.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -41,26 +41,26 @@
|
|
|
41
41
|
"@remix-run/node-fetch-server": "^0.8.0",
|
|
42
42
|
"es-module-lexer": "^1.7.0",
|
|
43
43
|
"estree-walker": "^3.0.3",
|
|
44
|
-
"magic-string": "^0.30.
|
|
44
|
+
"magic-string": "^0.30.18",
|
|
45
45
|
"periscopic": "^4.0.2",
|
|
46
46
|
"turbo-stream": "^3.1.0",
|
|
47
47
|
"vitefu": "^1.1.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@hiogawa/utils": "^1.7.0",
|
|
51
|
-
"@playwright/test": "^1.
|
|
51
|
+
"@playwright/test": "^1.55.0",
|
|
52
52
|
"@tsconfig/strictest": "^2.0.5",
|
|
53
53
|
"@types/estree": "^1.0.8",
|
|
54
|
-
"@types/node": "^22.
|
|
55
|
-
"@types/react": "^19.1.
|
|
56
|
-
"@types/react-dom": "^19.1.
|
|
54
|
+
"@types/node": "^22.18.0",
|
|
55
|
+
"@types/react": "^19.1.11",
|
|
56
|
+
"@types/react-dom": "^19.1.8",
|
|
57
57
|
"@vitejs/plugin-react": "workspace:*",
|
|
58
58
|
"react": "^19.1.1",
|
|
59
59
|
"react-dom": "^19.1.1",
|
|
60
60
|
"react-server-dom-webpack": "^19.1.1",
|
|
61
61
|
"rsc-html-stream": "^0.0.7",
|
|
62
62
|
"tinyexec": "^1.0.1",
|
|
63
|
-
"tsdown": "^0.14.
|
|
63
|
+
"tsdown": "^0.14.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "*",
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { stripVTControlCharacters } from "node:util";
|
|
4
|
-
|
|
5
|
-
//#region src/vite-utils.ts
|
|
6
|
-
const VALID_ID_PREFIX = `/@id/`;
|
|
7
|
-
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
8
|
-
const FS_PREFIX = `/@fs/`;
|
|
9
|
-
function wrapId(id) {
|
|
10
|
-
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
|
11
|
-
}
|
|
12
|
-
function unwrapId(id) {
|
|
13
|
-
return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
|
|
14
|
-
}
|
|
15
|
-
function withTrailingSlash(path$1) {
|
|
16
|
-
if (path$1[path$1.length - 1] !== "/") return `${path$1}/`;
|
|
17
|
-
return path$1;
|
|
18
|
-
}
|
|
19
|
-
const postfixRE = /[?#].*$/;
|
|
20
|
-
function cleanUrl(url) {
|
|
21
|
-
return url.replace(postfixRE, "");
|
|
22
|
-
}
|
|
23
|
-
function splitFileAndPostfix(path$1) {
|
|
24
|
-
const file = cleanUrl(path$1);
|
|
25
|
-
return {
|
|
26
|
-
file,
|
|
27
|
-
postfix: path$1.slice(file.length)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const windowsSlashRE = /\\/g;
|
|
31
|
-
function slash(p) {
|
|
32
|
-
return p.replace(windowsSlashRE, "/");
|
|
33
|
-
}
|
|
34
|
-
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
35
|
-
function injectQuery(url, queryToInject) {
|
|
36
|
-
const { file, postfix } = splitFileAndPostfix(url);
|
|
37
|
-
const normalizedFile = isWindows ? slash(file) : file;
|
|
38
|
-
return `${normalizedFile}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
39
|
-
}
|
|
40
|
-
function joinUrlSegments(a, b) {
|
|
41
|
-
if (!a || !b) return a || b || "";
|
|
42
|
-
if (a.endsWith("/")) a = a.substring(0, a.length - 1);
|
|
43
|
-
if (b[0] !== "/") b = "/" + b;
|
|
44
|
-
return a + b;
|
|
45
|
-
}
|
|
46
|
-
function normalizeResolvedIdToUrl(environment, url, resolved) {
|
|
47
|
-
const root = environment.config.root;
|
|
48
|
-
const depsOptimizer = environment.depsOptimizer;
|
|
49
|
-
if (resolved.id.startsWith(withTrailingSlash(root))) url = resolved.id.slice(root.length);
|
|
50
|
-
else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || resolved.id !== "/@react-refresh" && path.isAbsolute(resolved.id) && fs.existsSync(cleanUrl(resolved.id))) url = path.posix.join(FS_PREFIX, resolved.id);
|
|
51
|
-
else url = resolved.id;
|
|
52
|
-
if (url[0] !== "." && url[0] !== "/") url = wrapId(resolved.id);
|
|
53
|
-
return url;
|
|
54
|
-
}
|
|
55
|
-
function normalizeViteImportAnalysisUrl(environment, id) {
|
|
56
|
-
let url = normalizeResolvedIdToUrl(environment, id, { id });
|
|
57
|
-
if (environment.config.consumer === "client") {
|
|
58
|
-
const mod = environment.moduleGraph.getModuleById(id);
|
|
59
|
-
if (mod && mod.lastHMRTimestamp > 0) url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
|
60
|
-
}
|
|
61
|
-
return url;
|
|
62
|
-
}
|
|
63
|
-
function prepareError(err) {
|
|
64
|
-
return {
|
|
65
|
-
message: stripVTControlCharacters(err.message),
|
|
66
|
-
stack: stripVTControlCharacters(cleanStack(err.stack || "")),
|
|
67
|
-
id: err.id,
|
|
68
|
-
frame: stripVTControlCharacters(err.frame || ""),
|
|
69
|
-
plugin: err.plugin,
|
|
70
|
-
pluginCode: err.pluginCode?.toString(),
|
|
71
|
-
loc: err.loc
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function cleanStack(stack) {
|
|
75
|
-
return stack.split(/\n/).filter((l) => /^\s*at/.test(l)).join("\n");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
|
-
export { FS_PREFIX, NULL_BYTE_PLACEHOLDER, VALID_ID_PREFIX, cleanUrl, injectQuery, joinUrlSegments, normalizeResolvedIdToUrl, normalizeViteImportAnalysisUrl, prepareError, slash, splitFileAndPostfix, unwrapId, withTrailingSlash, wrapId };
|
package/dist/vite-utils.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DevEnvironment, ErrorPayload, Rollup } from "vite";
|
|
2
|
-
|
|
3
|
-
//#region src/vite-utils.d.ts
|
|
4
|
-
declare const VALID_ID_PREFIX = "/@id/";
|
|
5
|
-
declare const NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
6
|
-
declare const FS_PREFIX = "/@fs/";
|
|
7
|
-
declare function wrapId(id: string): string;
|
|
8
|
-
declare function unwrapId(id: string): string;
|
|
9
|
-
declare function withTrailingSlash(path: string): string;
|
|
10
|
-
declare function cleanUrl(url: string): string;
|
|
11
|
-
declare function splitFileAndPostfix(path: string): {
|
|
12
|
-
file: string;
|
|
13
|
-
postfix: string;
|
|
14
|
-
};
|
|
15
|
-
declare function slash(p: string): string;
|
|
16
|
-
declare function injectQuery(url: string, queryToInject: string): string;
|
|
17
|
-
declare function joinUrlSegments(a: string, b: string): string;
|
|
18
|
-
declare function normalizeResolvedIdToUrl(environment: DevEnvironment, url: string, resolved: Rollup.PartialResolvedId): string;
|
|
19
|
-
declare function normalizeViteImportAnalysisUrl(environment: DevEnvironment, id: string): string;
|
|
20
|
-
type RollupError = Rollup.RollupError;
|
|
21
|
-
declare function prepareError(err: Error | RollupError): ErrorPayload["err"];
|
|
22
|
-
//#endregion
|
|
23
|
-
export { FS_PREFIX, NULL_BYTE_PLACEHOLDER, VALID_ID_PREFIX, cleanUrl, injectQuery, joinUrlSegments, normalizeResolvedIdToUrl, normalizeViteImportAnalysisUrl, prepareError, slash, splitFileAndPostfix, unwrapId, withTrailingSlash, wrapId };
|
package/dist/vite-utils.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FS_PREFIX, NULL_BYTE_PLACEHOLDER, VALID_ID_PREFIX, cleanUrl, injectQuery, joinUrlSegments, normalizeResolvedIdToUrl, normalizeViteImportAnalysisUrl, prepareError, slash, splitFileAndPostfix, unwrapId, withTrailingSlash, wrapId } from "./vite-utils-Vzd7cqfv.js";
|
|
2
|
-
|
|
3
|
-
export { FS_PREFIX, NULL_BYTE_PLACEHOLDER, VALID_ID_PREFIX, cleanUrl, injectQuery, joinUrlSegments, normalizeResolvedIdToUrl, normalizeViteImportAnalysisUrl, prepareError, slash, splitFileAndPostfix, unwrapId, withTrailingSlash, wrapId };
|
|
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
|