@cedarjs/router 2.4.0 → 3.0.0-canary.13187
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/cjs/rsc/RscCache.d.ts.map +1 -1
- package/dist/cjs/rsc/RscCache.js +11 -1
- package/dist/cjs/rsc/clientSsr.d.ts +7 -0
- package/dist/cjs/rsc/clientSsr.d.ts.map +1 -1
- package/dist/cjs/rsc/clientSsr.js +52 -4
- package/dist/cjs/rsc/utils.d.ts +4 -2
- package/dist/cjs/rsc/utils.d.ts.map +1 -1
- package/dist/cjs/rsc/utils.js +20 -5
- package/dist/rsc/RscCache.d.ts.map +1 -1
- package/dist/rsc/RscCache.js +11 -1
- package/dist/rsc/clientSsr.d.ts +7 -0
- package/dist/rsc/clientSsr.d.ts.map +1 -1
- package/dist/rsc/clientSsr.js +53 -5
- package/dist/rsc/utils.d.ts +4 -2
- package/dist/rsc/utils.d.ts.map +1 -1
- package/dist/rsc/utils.js +20 -5
- package/package.json +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RscCache.d.ts","sourceRoot":"","sources":["../../../src/rsc/RscCache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RscCache.d.ts","sourceRoot":"","sources":["../../../src/rsc/RscCache.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,QAAQ;IACvB,cAAc,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAwC;IACrD,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,WAAW,CAAI;IAEvB,OAAO,CAAC,SAAS,CAAQ;;IAgDzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS;IAMhD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC;IA2B1C,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,qBAAqB;CAW9B"}
|
package/dist/cjs/rsc/RscCache.js
CHANGED
|
@@ -21,6 +21,16 @@ __export(RscCache_exports, {
|
|
|
21
21
|
RscCache: () => RscCache
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(RscCache_exports);
|
|
24
|
+
class DummyWS {
|
|
25
|
+
readyState = WebSocket?.OPEN;
|
|
26
|
+
addEventListener() {
|
|
27
|
+
}
|
|
28
|
+
send() {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (typeof globalThis.WebSocket === "undefined") {
|
|
32
|
+
globalThis.WebSocket = DummyWS;
|
|
33
|
+
}
|
|
24
34
|
class RscCache {
|
|
25
35
|
cache = /* @__PURE__ */ new Map();
|
|
26
36
|
socket;
|
|
@@ -89,7 +99,7 @@ class RscCache {
|
|
|
89
99
|
} else if (this.sendRetries >= 10) {
|
|
90
100
|
console.error("Exhausted retries to send message to WebSocket server.");
|
|
91
101
|
} else {
|
|
92
|
-
console.error("WebSocket connection is closed.");
|
|
102
|
+
console.error("RscCache: WebSocket connection is closed.");
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
sendUpdateToWebSocket() {
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render the RW App's Routes.{tsx,jsx} component.
|
|
3
|
+
* In production, this function will read the Routes component from the App's
|
|
4
|
+
* dist directory.
|
|
5
|
+
* During dev, this function will use Vite to load the Routes component from
|
|
6
|
+
* the App's src directory.
|
|
7
|
+
*/
|
|
1
8
|
export declare function renderRoutesSsr(pathname: string): Promise<any>;
|
|
2
9
|
//# sourceMappingURL=clientSsr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientSsr.d.ts","sourceRoot":"","sources":["../../../src/rsc/clientSsr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clientSsr.d.ts","sourceRoot":"","sources":["../../../src/rsc/clientSsr.ts"],"names":[],"mappings":"AA2FA;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,gBA0GrD"}
|
|
@@ -32,16 +32,31 @@ __export(clientSsr_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(clientSsr_exports);
|
|
34
34
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
+
var import_node_url = require("node:url");
|
|
35
36
|
var import_project_config = require("@cedarjs/project-config");
|
|
36
37
|
var import_ssrModuleMap = require("./ssrModuleMap.js");
|
|
37
38
|
var import_utils = require("./utils.js");
|
|
38
39
|
var import_utils2 = require("./utils.js");
|
|
39
40
|
async function getEntries() {
|
|
41
|
+
if (globalThis.__rwjs__vite_ssr_runtime) {
|
|
42
|
+
return {
|
|
43
|
+
serverEntries: {
|
|
44
|
+
__rwjs__Routes: "../../src/Routes.tsx"
|
|
45
|
+
},
|
|
46
|
+
ssrEntries: {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
40
49
|
const entriesPath = (0, import_project_config.getPaths)().web.distRscEntries;
|
|
41
50
|
const entries = await import((0, import_utils2.makeFilePath)(entriesPath));
|
|
42
51
|
return entries;
|
|
43
52
|
}
|
|
44
53
|
async function getRoutesComponent() {
|
|
54
|
+
if (globalThis.__rwjs__vite_rsc_runtime) {
|
|
55
|
+
const routesMod = await globalThis.__rwjs__vite_rsc_runtime.executeUrl(
|
|
56
|
+
(0, import_project_config.getPaths)().web.routes
|
|
57
|
+
);
|
|
58
|
+
return routesMod.default;
|
|
59
|
+
}
|
|
45
60
|
const { serverEntries } = await getEntries();
|
|
46
61
|
const entryPath = import_node_path.default.join(
|
|
47
62
|
(0, import_project_config.getPaths)().web.distRsc,
|
|
@@ -91,19 +106,52 @@ async function renderRoutesSsr(pathname) {
|
|
|
91
106
|
get(_target, encodedId) {
|
|
92
107
|
console.log("Proxy get encodedId", encodedId);
|
|
93
108
|
const [filePath, name] = encodedId.split("#");
|
|
94
|
-
const id = resolveClientEntryForProd(filePath, clientEntries);
|
|
109
|
+
const id = globalThis.__rwjs__vite_ssr_runtime ? filePath : resolveClientEntryForProd(filePath, clientEntries);
|
|
95
110
|
console.log("clientSsr.ts::Proxy id", id);
|
|
96
111
|
return { id, chunks: [id], name, async: true };
|
|
97
112
|
}
|
|
98
113
|
}
|
|
99
114
|
);
|
|
115
|
+
const serverModuleMap = new Proxy(
|
|
116
|
+
{},
|
|
117
|
+
{
|
|
118
|
+
get(_target, encodedId) {
|
|
119
|
+
console.log("serverModuleMap Proxy get encodedId", encodedId);
|
|
120
|
+
const [filePath, name] = encodedId.split("#");
|
|
121
|
+
const id = (0, import_node_url.pathToFileURL)(filePath).href;
|
|
122
|
+
console.log("serverModuleMap::Proxy id", id);
|
|
123
|
+
return { id, chunks: [id], name, async: true };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
);
|
|
100
127
|
const { createElement } = await (0, import_utils.importReact)();
|
|
101
128
|
const { renderToReadableStream } = await (0, import_utils.importRsdwServer)();
|
|
102
129
|
console.log("clientSsr.ts right before renderToReadableStream");
|
|
103
|
-
const
|
|
130
|
+
const originalStream = renderToReadableStream(
|
|
131
|
+
createElement(Routes),
|
|
132
|
+
bundlerConfig
|
|
133
|
+
);
|
|
134
|
+
const [streamForLogging, streamForRendering] = originalStream.tee();
|
|
135
|
+
(async () => {
|
|
136
|
+
const reader = streamForLogging.getReader();
|
|
137
|
+
const decoder = new TextDecoder();
|
|
138
|
+
let logContent = "";
|
|
139
|
+
while (true) {
|
|
140
|
+
const { done, value } = await reader.read();
|
|
141
|
+
if (done) {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
logContent += decoder.decode(value, { stream: true });
|
|
145
|
+
}
|
|
146
|
+
console.log("Stream content:", logContent);
|
|
147
|
+
})();
|
|
104
148
|
const { createFromReadableStream } = await (0, import_utils.importRsdwClient)();
|
|
105
|
-
const data = createFromReadableStream(
|
|
106
|
-
|
|
149
|
+
const data = createFromReadableStream(streamForRendering, {
|
|
150
|
+
serverConsumerManifest: {
|
|
151
|
+
moduleMap: import_ssrModuleMap.moduleMap,
|
|
152
|
+
serverModuleMap,
|
|
153
|
+
moduleLoading: null
|
|
154
|
+
}
|
|
107
155
|
});
|
|
108
156
|
rscCache.set(pathname, data);
|
|
109
157
|
return data;
|
package/dist/cjs/rsc/utils.d.ts
CHANGED
|
@@ -6,13 +6,15 @@ export declare function makeFilePath(path: string): string;
|
|
|
6
6
|
/**
|
|
7
7
|
* See vite/streamHelpers.ts.
|
|
8
8
|
*
|
|
9
|
-
* This function ensures we load the
|
|
9
|
+
* This function ensures we load the bundled version of React to prevent
|
|
10
|
+
* multiple instances of React
|
|
10
11
|
*/
|
|
11
12
|
export declare function importReact(): Promise<any>;
|
|
12
13
|
/**
|
|
13
14
|
* See vite/streamHelpers.ts.
|
|
14
15
|
*
|
|
15
|
-
* This function ensures we load the same version of rsdw_client to
|
|
16
|
+
* This function ensures we load the same version of rsdw_client everywhere to
|
|
17
|
+
* prevent multiple instances of React
|
|
16
18
|
*/
|
|
17
19
|
export declare function importRsdwClient(): Promise<RSDWClientType>;
|
|
18
20
|
export declare function importRsdwServer(): Promise<RSDWServerType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/rsc/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvF,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAIvF,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAC7C,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAE7C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/rsc/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvF,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAIvF,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAC7C,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAE7C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,iBAUhC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAYhE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAmBhE"}
|
package/dist/cjs/rsc/utils.js
CHANGED
|
@@ -41,11 +41,19 @@ function makeFilePath(path2) {
|
|
|
41
41
|
return (0, import_node_url.pathToFileURL)(path2).href;
|
|
42
42
|
}
|
|
43
43
|
async function importReact() {
|
|
44
|
+
if (globalThis.__rwjs__vite_ssr_runtime) {
|
|
45
|
+
const reactMod = await import("react");
|
|
46
|
+
return reactMod.default;
|
|
47
|
+
}
|
|
44
48
|
const distSsr = (0, import_project_config.getPaths)().web.distSsr;
|
|
45
49
|
const reactPath = makeFilePath(import_node_path.default.join(distSsr, "__rwjs__react.mjs"));
|
|
46
50
|
return (await import(reactPath)).default;
|
|
47
51
|
}
|
|
48
52
|
async function importRsdwClient() {
|
|
53
|
+
if (globalThis.__rwjs__vite_ssr_runtime) {
|
|
54
|
+
const rsdwcMod = await import("react-server-dom-webpack/client.edge");
|
|
55
|
+
return rsdwcMod.default;
|
|
56
|
+
}
|
|
49
57
|
const distSsr = (0, import_project_config.getPaths)().web.distSsr;
|
|
50
58
|
const rsdwClientPath = makeFilePath(
|
|
51
59
|
import_node_path.default.join(distSsr, "__rwjs__rsdw-client.mjs")
|
|
@@ -53,11 +61,18 @@ async function importRsdwClient() {
|
|
|
53
61
|
return (await import(rsdwClientPath)).default;
|
|
54
62
|
}
|
|
55
63
|
async function importRsdwServer() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
if (globalThis.__rwjs__vite_rsc_runtime) {
|
|
65
|
+
const rsdwServerMod = await globalThis.__rwjs__vite_rsc_runtime.executeUrl(
|
|
66
|
+
"react-server-dom-webpack/server.edge"
|
|
67
|
+
);
|
|
68
|
+
return rsdwServerMod.default;
|
|
69
|
+
} else {
|
|
70
|
+
const dynamicImport = "";
|
|
71
|
+
return import(
|
|
72
|
+
/* @vite-ignore */
|
|
73
|
+
dynamicImport + "react-server-dom-webpack/server.edge"
|
|
74
|
+
);
|
|
75
|
+
}
|
|
61
76
|
}
|
|
62
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
78
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RscCache.d.ts","sourceRoot":"","sources":["../../src/rsc/RscCache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RscCache.d.ts","sourceRoot":"","sources":["../../src/rsc/RscCache.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,QAAQ;IACvB,cAAc,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAwC;IACrD,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,WAAW,CAAI;IAEvB,OAAO,CAAC,SAAS,CAAQ;;IAgDzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS;IAMhD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC;IA2B1C,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,qBAAqB;CAW9B"}
|
package/dist/rsc/RscCache.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
class DummyWS {
|
|
2
|
+
readyState = WebSocket?.OPEN;
|
|
3
|
+
addEventListener() {
|
|
4
|
+
}
|
|
5
|
+
send() {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
if (typeof globalThis.WebSocket === "undefined") {
|
|
9
|
+
globalThis.WebSocket = DummyWS;
|
|
10
|
+
}
|
|
1
11
|
class RscCache {
|
|
2
12
|
cache = /* @__PURE__ */ new Map();
|
|
3
13
|
socket;
|
|
@@ -66,7 +76,7 @@ class RscCache {
|
|
|
66
76
|
} else if (this.sendRetries >= 10) {
|
|
67
77
|
console.error("Exhausted retries to send message to WebSocket server.");
|
|
68
78
|
} else {
|
|
69
|
-
console.error("WebSocket connection is closed.");
|
|
79
|
+
console.error("RscCache: WebSocket connection is closed.");
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
sendUpdateToWebSocket() {
|
package/dist/rsc/clientSsr.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render the RW App's Routes.{tsx,jsx} component.
|
|
3
|
+
* In production, this function will read the Routes component from the App's
|
|
4
|
+
* dist directory.
|
|
5
|
+
* During dev, this function will use Vite to load the Routes component from
|
|
6
|
+
* the App's src directory.
|
|
7
|
+
*/
|
|
1
8
|
export declare function renderRoutesSsr(pathname: string): Promise<any>;
|
|
2
9
|
//# sourceMappingURL=clientSsr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/clientSsr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clientSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/clientSsr.ts"],"names":[],"mappings":"AA2FA;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,gBA0GrD"}
|
package/dist/rsc/clientSsr.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
2
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
3
4
|
import { moduleMap } from "./ssrModuleMap.js";
|
|
4
|
-
import { importRsdwClient,
|
|
5
|
+
import { importRsdwClient, importReact, importRsdwServer } from "./utils.js";
|
|
5
6
|
import { makeFilePath } from "./utils.js";
|
|
6
7
|
async function getEntries() {
|
|
8
|
+
if (globalThis.__rwjs__vite_ssr_runtime) {
|
|
9
|
+
return {
|
|
10
|
+
serverEntries: {
|
|
11
|
+
__rwjs__Routes: "../../src/Routes.tsx"
|
|
12
|
+
},
|
|
13
|
+
ssrEntries: {}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
7
16
|
const entriesPath = getPaths().web.distRscEntries;
|
|
8
17
|
const entries = await import(makeFilePath(entriesPath));
|
|
9
18
|
return entries;
|
|
10
19
|
}
|
|
11
20
|
async function getRoutesComponent() {
|
|
21
|
+
if (globalThis.__rwjs__vite_rsc_runtime) {
|
|
22
|
+
const routesMod = await globalThis.__rwjs__vite_rsc_runtime.executeUrl(
|
|
23
|
+
getPaths().web.routes
|
|
24
|
+
);
|
|
25
|
+
return routesMod.default;
|
|
26
|
+
}
|
|
12
27
|
const { serverEntries } = await getEntries();
|
|
13
28
|
const entryPath = path.join(
|
|
14
29
|
getPaths().web.distRsc,
|
|
@@ -58,19 +73,52 @@ async function renderRoutesSsr(pathname) {
|
|
|
58
73
|
get(_target, encodedId) {
|
|
59
74
|
console.log("Proxy get encodedId", encodedId);
|
|
60
75
|
const [filePath, name] = encodedId.split("#");
|
|
61
|
-
const id = resolveClientEntryForProd(filePath, clientEntries);
|
|
76
|
+
const id = globalThis.__rwjs__vite_ssr_runtime ? filePath : resolveClientEntryForProd(filePath, clientEntries);
|
|
62
77
|
console.log("clientSsr.ts::Proxy id", id);
|
|
63
78
|
return { id, chunks: [id], name, async: true };
|
|
64
79
|
}
|
|
65
80
|
}
|
|
66
81
|
);
|
|
82
|
+
const serverModuleMap = new Proxy(
|
|
83
|
+
{},
|
|
84
|
+
{
|
|
85
|
+
get(_target, encodedId) {
|
|
86
|
+
console.log("serverModuleMap Proxy get encodedId", encodedId);
|
|
87
|
+
const [filePath, name] = encodedId.split("#");
|
|
88
|
+
const id = pathToFileURL(filePath).href;
|
|
89
|
+
console.log("serverModuleMap::Proxy id", id);
|
|
90
|
+
return { id, chunks: [id], name, async: true };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
);
|
|
67
94
|
const { createElement } = await importReact();
|
|
68
95
|
const { renderToReadableStream } = await importRsdwServer();
|
|
69
96
|
console.log("clientSsr.ts right before renderToReadableStream");
|
|
70
|
-
const
|
|
97
|
+
const originalStream = renderToReadableStream(
|
|
98
|
+
createElement(Routes),
|
|
99
|
+
bundlerConfig
|
|
100
|
+
);
|
|
101
|
+
const [streamForLogging, streamForRendering] = originalStream.tee();
|
|
102
|
+
(async () => {
|
|
103
|
+
const reader = streamForLogging.getReader();
|
|
104
|
+
const decoder = new TextDecoder();
|
|
105
|
+
let logContent = "";
|
|
106
|
+
while (true) {
|
|
107
|
+
const { done, value } = await reader.read();
|
|
108
|
+
if (done) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
logContent += decoder.decode(value, { stream: true });
|
|
112
|
+
}
|
|
113
|
+
console.log("Stream content:", logContent);
|
|
114
|
+
})();
|
|
71
115
|
const { createFromReadableStream } = await importRsdwClient();
|
|
72
|
-
const data = createFromReadableStream(
|
|
73
|
-
|
|
116
|
+
const data = createFromReadableStream(streamForRendering, {
|
|
117
|
+
serverConsumerManifest: {
|
|
118
|
+
moduleMap,
|
|
119
|
+
serverModuleMap,
|
|
120
|
+
moduleLoading: null
|
|
121
|
+
}
|
|
74
122
|
});
|
|
75
123
|
rscCache.set(pathname, data);
|
|
76
124
|
return data;
|
package/dist/rsc/utils.d.ts
CHANGED
|
@@ -6,13 +6,15 @@ export declare function makeFilePath(path: string): string;
|
|
|
6
6
|
/**
|
|
7
7
|
* See vite/streamHelpers.ts.
|
|
8
8
|
*
|
|
9
|
-
* This function ensures we load the
|
|
9
|
+
* This function ensures we load the bundled version of React to prevent
|
|
10
|
+
* multiple instances of React
|
|
10
11
|
*/
|
|
11
12
|
export declare function importReact(): Promise<any>;
|
|
12
13
|
/**
|
|
13
14
|
* See vite/streamHelpers.ts.
|
|
14
15
|
*
|
|
15
|
-
* This function ensures we load the same version of rsdw_client to
|
|
16
|
+
* This function ensures we load the same version of rsdw_client everywhere to
|
|
17
|
+
* prevent multiple instances of React
|
|
16
18
|
*/
|
|
17
19
|
export declare function importRsdwClient(): Promise<RSDWClientType>;
|
|
18
20
|
export declare function importRsdwServer(): Promise<RSDWServerType>;
|
package/dist/rsc/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/rsc/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvF,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAIvF,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAC7C,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAE7C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/rsc/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvF,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAIvF,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAC7C,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAE7C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,iBAUhC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAYhE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAmBhE"}
|
package/dist/rsc/utils.js
CHANGED
|
@@ -5,11 +5,19 @@ function makeFilePath(path2) {
|
|
|
5
5
|
return pathToFileURL(path2).href;
|
|
6
6
|
}
|
|
7
7
|
async function importReact() {
|
|
8
|
+
if (globalThis.__rwjs__vite_ssr_runtime) {
|
|
9
|
+
const reactMod = await import("react");
|
|
10
|
+
return reactMod.default;
|
|
11
|
+
}
|
|
8
12
|
const distSsr = getPaths().web.distSsr;
|
|
9
13
|
const reactPath = makeFilePath(path.join(distSsr, "__rwjs__react.mjs"));
|
|
10
14
|
return (await import(reactPath)).default;
|
|
11
15
|
}
|
|
12
16
|
async function importRsdwClient() {
|
|
17
|
+
if (globalThis.__rwjs__vite_ssr_runtime) {
|
|
18
|
+
const rsdwcMod = await import("react-server-dom-webpack/client.edge");
|
|
19
|
+
return rsdwcMod.default;
|
|
20
|
+
}
|
|
13
21
|
const distSsr = getPaths().web.distSsr;
|
|
14
22
|
const rsdwClientPath = makeFilePath(
|
|
15
23
|
path.join(distSsr, "__rwjs__rsdw-client.mjs")
|
|
@@ -17,11 +25,18 @@ async function importRsdwClient() {
|
|
|
17
25
|
return (await import(rsdwClientPath)).default;
|
|
18
26
|
}
|
|
19
27
|
async function importRsdwServer() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
if (globalThis.__rwjs__vite_rsc_runtime) {
|
|
29
|
+
const rsdwServerMod = await globalThis.__rwjs__vite_rsc_runtime.executeUrl(
|
|
30
|
+
"react-server-dom-webpack/server.edge"
|
|
31
|
+
);
|
|
32
|
+
return rsdwServerMod.default;
|
|
33
|
+
} else {
|
|
34
|
+
const dynamicImport = "";
|
|
35
|
+
return import(
|
|
36
|
+
/* @vite-ignore */
|
|
37
|
+
dynamicImport + "react-server-dom-webpack/server.edge"
|
|
38
|
+
);
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
export {
|
|
27
42
|
importReact,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/router",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-canary.13187+947a27d51",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -95,17 +95,18 @@
|
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@babel/runtime-corejs3": "7.28.4",
|
|
98
|
-
"@cedarjs/auth": "
|
|
99
|
-
"@cedarjs/server-store": "
|
|
98
|
+
"@cedarjs/auth": "3.0.0-canary.13187",
|
|
99
|
+
"@cedarjs/server-store": "3.0.0-canary.13187",
|
|
100
100
|
"core-js": "3.47.0",
|
|
101
|
-
"react": "
|
|
102
|
-
"react-dom": "
|
|
101
|
+
"react": "19.2.3",
|
|
102
|
+
"react-dom": "19.2.3",
|
|
103
|
+
"react-server-dom-webpack": "19.2.3"
|
|
103
104
|
},
|
|
104
105
|
"devDependencies": {
|
|
105
106
|
"@arethetypeswrong/cli": "0.18.2",
|
|
106
107
|
"@babel/cli": "7.28.3",
|
|
107
108
|
"@babel/core": "^7.26.10",
|
|
108
|
-
"@cedarjs/framework-tools": "
|
|
109
|
+
"@cedarjs/framework-tools": "3.0.0-canary.13187",
|
|
109
110
|
"@testing-library/jest-dom": "6.9.1",
|
|
110
111
|
"@types/react": "^18.2.55",
|
|
111
112
|
"@types/react-dom": "^18.2.19",
|
|
@@ -117,11 +118,11 @@
|
|
|
117
118
|
"vitest": "3.2.4"
|
|
118
119
|
},
|
|
119
120
|
"peerDependencies": {
|
|
120
|
-
"react": "
|
|
121
|
-
"react-dom": "
|
|
121
|
+
"react": "19.2.3",
|
|
122
|
+
"react-dom": "19.2.3"
|
|
122
123
|
},
|
|
123
124
|
"publishConfig": {
|
|
124
125
|
"access": "public"
|
|
125
126
|
},
|
|
126
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "947a27d5126e707b44a936fe22b1c153312904a8"
|
|
127
128
|
}
|