@vitejs/plugin-rsc 0.4.22 → 0.4.24
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-CrIhPWor.d.ts → plugin-YtSjJn3Y.d.ts} +16 -0
- package/dist/{plugin-BLljgx4e.js → plugin-r-u6Aj3n.js} +168 -41
- 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 +6 -6
- 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-r-u6Aj3n.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 };
|
|
@@ -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[];
|
|
@@ -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";
|
|
@@ -12,10 +11,12 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
12
11
|
import { createRequestListener } from "@remix-run/node-fetch-server";
|
|
13
12
|
import * as esModuleLexer from "es-module-lexer";
|
|
14
13
|
import MagicString from "magic-string";
|
|
14
|
+
import * as vite from "vite";
|
|
15
15
|
import { defaultServerConditions, isCSSRequest, normalizePath, parseAstAsync } from "vite";
|
|
16
16
|
import { crawlFrameworkPkgs, findClosestPkgJsonPath } from "vitefu";
|
|
17
17
|
import { walk } from "estree-walker";
|
|
18
18
|
import { analyze, extract_names } from "periscopic";
|
|
19
|
+
import { stripVTControlCharacters } from "node:util";
|
|
19
20
|
import { createHash } from "node:crypto";
|
|
20
21
|
|
|
21
22
|
//#region src/transforms/hoist.ts
|
|
@@ -305,6 +306,78 @@ function transformServerActionServer(input, ast, options) {
|
|
|
305
306
|
});
|
|
306
307
|
}
|
|
307
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
|
+
|
|
308
381
|
//#endregion
|
|
309
382
|
//#region src/transforms/cjs.ts
|
|
310
383
|
function transformCjsToEsm(code, ast) {
|
|
@@ -401,13 +474,6 @@ function extractPackageKey(id) {
|
|
|
401
474
|
|
|
402
475
|
//#endregion
|
|
403
476
|
//#region src/plugins/utils.ts
|
|
404
|
-
function evalValue(rawValue) {
|
|
405
|
-
const fn = new Function(`
|
|
406
|
-
var console, exports, global, module, process, require
|
|
407
|
-
return (\n${rawValue}\n)
|
|
408
|
-
`);
|
|
409
|
-
return fn();
|
|
410
|
-
}
|
|
411
477
|
function sortObject(o) {
|
|
412
478
|
return Object.fromEntries(Object.entries(o).sort(([a], [b]) => a.localeCompare(b)));
|
|
413
479
|
}
|
|
@@ -581,12 +647,16 @@ var RscPluginManager = class {
|
|
|
581
647
|
buildAssetsManifest;
|
|
582
648
|
isScanBuild = false;
|
|
583
649
|
clientReferenceMetaMap = {};
|
|
650
|
+
clientReferenceGroups = {};
|
|
584
651
|
serverReferenceMetaMap = {};
|
|
585
652
|
serverResourcesMetaMap = {};
|
|
586
653
|
stabilize() {
|
|
587
654
|
this.clientReferenceMetaMap = sortObject(this.clientReferenceMetaMap);
|
|
588
655
|
this.serverResourcesMetaMap = sortObject(this.serverResourcesMetaMap);
|
|
589
656
|
}
|
|
657
|
+
toRelativeId(id) {
|
|
658
|
+
return normalizePath(path.relative(this.config.root, id));
|
|
659
|
+
}
|
|
590
660
|
};
|
|
591
661
|
/** @experimental */
|
|
592
662
|
function vitePluginRscMinimal(rscPluginOptions = {}, manager = new RscPluginManager()) {
|
|
@@ -796,7 +866,7 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
796
866
|
},
|
|
797
867
|
async hotUpdate(ctx) {
|
|
798
868
|
if (isCSSRequest(ctx.file)) {
|
|
799
|
-
if (this.environment.name === "client") return ctx.modules.filter((m) => !m.id?.includes("?direct"));
|
|
869
|
+
if (this.environment.name === "client") return ctx.modules.filter((m) => !(m.id?.includes("?direct") && !m.isSelfAccepting));
|
|
800
870
|
}
|
|
801
871
|
const ids = ctx.modules.map((mod) => mod.id).filter((v) => v !== null);
|
|
802
872
|
if (ids.length === 0) return;
|
|
@@ -990,8 +1060,8 @@ function vitePluginRsc(rscPluginOptions = {}) {
|
|
|
990
1060
|
assert(entry);
|
|
991
1061
|
const entryUrl = assetsURL(entry.chunk.fileName, manager);
|
|
992
1062
|
const clientReferenceDeps = {};
|
|
993
|
-
for (const
|
|
994
|
-
const deps = assetDeps[
|
|
1063
|
+
for (const meta of Object.values(manager.clientReferenceMetaMap)) {
|
|
1064
|
+
const deps = assetDeps[meta.groupChunkId]?.deps ?? {
|
|
995
1065
|
js: [],
|
|
996
1066
|
css: []
|
|
997
1067
|
};
|
|
@@ -1161,7 +1231,7 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1161
1231
|
referenceKey = importId;
|
|
1162
1232
|
} else {
|
|
1163
1233
|
importId = id;
|
|
1164
|
-
referenceKey = hashString(
|
|
1234
|
+
referenceKey = hashString(manager.toRelativeId(id));
|
|
1165
1235
|
}
|
|
1166
1236
|
const transformDirectiveProxyExport_ = withRollupError(this, transformDirectiveProxyExport);
|
|
1167
1237
|
const result = transformDirectiveProxyExport_(ast, {
|
|
@@ -1191,29 +1261,72 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1191
1261
|
};
|
|
1192
1262
|
}
|
|
1193
1263
|
},
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1264
|
+
{
|
|
1265
|
+
name: "rsc:use-client/build-references",
|
|
1266
|
+
resolveId(source) {
|
|
1267
|
+
if (source.startsWith("virtual:vite-rsc/client-references")) return "\0" + source;
|
|
1268
|
+
},
|
|
1269
|
+
load(id) {
|
|
1270
|
+
if (id === "\0virtual:vite-rsc/client-references") {
|
|
1271
|
+
if (this.environment.mode === "dev") return {
|
|
1272
|
+
code: `export default {}`,
|
|
1273
|
+
map: null
|
|
1274
|
+
};
|
|
1275
|
+
if (manager.isScanBuild) {
|
|
1276
|
+
let code$1 = ``;
|
|
1277
|
+
for (const meta of Object.values(manager.clientReferenceMetaMap)) code$1 += `import ${JSON.stringify(meta.importId)};\n`;
|
|
1278
|
+
return {
|
|
1279
|
+
code: code$1,
|
|
1280
|
+
map: null
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
let code = "";
|
|
1284
|
+
manager.clientReferenceGroups = {};
|
|
1285
|
+
for (const meta of Object.values(manager.clientReferenceMetaMap)) {
|
|
1286
|
+
let name = useClientPluginOptions.clientChunks?.({
|
|
1287
|
+
id: meta.importId,
|
|
1288
|
+
serverChunk: meta.serverChunk
|
|
1289
|
+
}) ?? manager.toRelativeId(meta.importId);
|
|
1290
|
+
name = cleanUrl(name.replaceAll("..", "__"));
|
|
1291
|
+
const group = manager.clientReferenceGroups[name] ??= [];
|
|
1292
|
+
group.push(meta);
|
|
1293
|
+
meta.groupChunkId = `\0virtual:vite-rsc/client-references/group/${name}`;
|
|
1294
|
+
}
|
|
1295
|
+
debug$1("client-reference-groups", manager.clientReferenceGroups);
|
|
1296
|
+
for (const [name, metas] of Object.entries(manager.clientReferenceGroups)) {
|
|
1297
|
+
const groupVirtual = `virtual:vite-rsc/client-references/group/${name}`;
|
|
1298
|
+
for (const meta of metas) code += `\
|
|
1299
|
+
${JSON.stringify(meta.referenceKey)}: async () => {
|
|
1300
|
+
const m = await import(${JSON.stringify(groupVirtual)});
|
|
1301
|
+
return m.export_${meta.referenceKey};
|
|
1302
|
+
},
|
|
1303
|
+
`;
|
|
1304
|
+
}
|
|
1305
|
+
code = `export default {${code}};\n`;
|
|
1306
|
+
return {
|
|
1307
|
+
code,
|
|
1308
|
+
map: null
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
if (id.startsWith("\0virtual:vite-rsc/client-references/group/")) {
|
|
1312
|
+
const name = id.slice(42);
|
|
1313
|
+
const metas = manager.clientReferenceGroups[name];
|
|
1314
|
+
assert(metas, `unknown client reference group: ${name}`);
|
|
1315
|
+
let code = ``;
|
|
1316
|
+
for (const meta of metas) {
|
|
1317
|
+
const exports = meta.renderedExports.map((name$1) => `${name$1}: import_${meta.referenceKey}.${name$1},\n`).sort().join("");
|
|
1318
|
+
code += `
|
|
1319
|
+
import * as import_${meta.referenceKey} from ${JSON.stringify(meta.importId)};
|
|
1320
|
+
export const export_${meta.referenceKey} = {${exports}};
|
|
1321
|
+
`;
|
|
1322
|
+
}
|
|
1323
|
+
return {
|
|
1324
|
+
code,
|
|
1325
|
+
map: null
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1210
1328
|
}
|
|
1211
|
-
|
|
1212
|
-
return {
|
|
1213
|
-
code,
|
|
1214
|
-
map: null
|
|
1215
|
-
};
|
|
1216
|
-
}),
|
|
1329
|
+
},
|
|
1217
1330
|
{
|
|
1218
1331
|
name: "rsc:virtual-client-in-server-package",
|
|
1219
1332
|
async load(id) {
|
|
@@ -1254,9 +1367,23 @@ function vitePluginUseClient(useClientPluginOptions, manager) {
|
|
|
1254
1367
|
},
|
|
1255
1368
|
generateBundle(_options, bundle) {
|
|
1256
1369
|
if (this.environment.name !== serverEnvironmentName) return;
|
|
1257
|
-
for (const chunk of Object.values(bundle)) if (chunk.type === "chunk")
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1370
|
+
for (const chunk of Object.values(bundle)) if (chunk.type === "chunk") {
|
|
1371
|
+
const metas = [];
|
|
1372
|
+
for (const id of chunk.moduleIds) {
|
|
1373
|
+
const meta = manager.clientReferenceMetaMap[id];
|
|
1374
|
+
if (meta) metas.push([id, meta]);
|
|
1375
|
+
}
|
|
1376
|
+
if (metas.length > 0) {
|
|
1377
|
+
let serverChunk;
|
|
1378
|
+
if (chunk.facadeModuleId) serverChunk = "facade:" + manager.toRelativeId(chunk.facadeModuleId);
|
|
1379
|
+
else serverChunk = "shared:" + manager.toRelativeId(metas.map(([id]) => id).sort()[0]);
|
|
1380
|
+
for (const [id, meta] of metas) {
|
|
1381
|
+
const mod = chunk.modules[id];
|
|
1382
|
+
assert(mod);
|
|
1383
|
+
meta.renderedExports = mod.renderedExports;
|
|
1384
|
+
meta.serverChunk = serverChunk;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1260
1387
|
}
|
|
1261
1388
|
}
|
|
1262
1389
|
},
|
|
@@ -1297,7 +1424,7 @@ function customOptimizerMetadataPlugin({ setMetadata }) {
|
|
|
1297
1424
|
name: "rsc:use-client:optimizer-metadata",
|
|
1298
1425
|
apply: "serve",
|
|
1299
1426
|
config() {
|
|
1300
|
-
return { environments: { client: { optimizeDeps: "rolldownVersion" in
|
|
1427
|
+
return { environments: { client: { optimizeDeps: "rolldownVersion" in vite ? { rolldownOptions: { plugins: [optimizerPluginRolldown()] } } : { esbuildOptions: { plugins: [optimizerPluginEsbuild()] } } } } };
|
|
1301
1428
|
},
|
|
1302
1429
|
configResolved(config) {
|
|
1303
1430
|
const file = path.join(config.cacheDir, "deps", MEATADATA_FILE);
|
|
@@ -1367,7 +1494,7 @@ function vitePluginUseServer(useServerPluginOptions, manager) {
|
|
|
1367
1494
|
debug$1(`internal server reference created through a package imported in ${this.environment.name} environment: ${id}`);
|
|
1368
1495
|
id = cleanUrl(id);
|
|
1369
1496
|
}
|
|
1370
|
-
if (manager.config.command === "build") normalizedId_ = hashString(
|
|
1497
|
+
if (manager.config.command === "build") normalizedId_ = hashString(manager.toRelativeId(id));
|
|
1371
1498
|
else normalizedId_ = normalizeViteImportAnalysisUrl(manager.server.environments[serverEnvironmentName], id);
|
|
1372
1499
|
}
|
|
1373
1500
|
return normalizedId_;
|
|
@@ -1688,7 +1815,7 @@ function vitePluginRscCss(rscCssOptions = {}, manager) {
|
|
|
1688
1815
|
}, manager);
|
|
1689
1816
|
return generateResourcesCode(serializeValueWithRuntime(deps), manager);
|
|
1690
1817
|
} else {
|
|
1691
|
-
const key =
|
|
1818
|
+
const key = manager.toRelativeId(importer);
|
|
1692
1819
|
manager.serverResourcesMetaMap[importer] = { key };
|
|
1693
1820
|
return `
|
|
1694
1821
|
import __vite_rsc_assets_manifest__ from "virtual:vite-rsc/assets-manifest";
|
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-r-u6Aj3n.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.24",
|
|
4
4
|
"description": "React Server Components (RSC) support for Vite.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -41,18 +41,18 @@
|
|
|
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.
|
|
54
|
+
"@types/node": "^22.18.0",
|
|
55
|
+
"@types/react": "^19.1.11",
|
|
56
56
|
"@types/react-dom": "^19.1.7",
|
|
57
57
|
"@vitejs/plugin-react": "workspace:*",
|
|
58
58
|
"react": "^19.1.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
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
|