@cedarjs/router 6.0.0-canary.2851 → 6.0.0-rc.221
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/rsc/RscCache.d.ts.map +1 -1
- package/dist/rsc/RscCache.js +1 -11
- package/dist/rsc/clientSsr.d.ts +0 -7
- package/dist/rsc/clientSsr.d.ts.map +1 -1
- package/dist/rsc/clientSsr.js +5 -53
- package/dist/rsc/utils.d.ts +3 -3
- package/dist/rsc/utils.d.ts.map +1 -1
- package/dist/rsc/utils.js +5 -20
- package/package.json +10 -11
|
@@ -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":"AAAA,MAAM,WAAW,QAAQ;IACvB,iBAAiB,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IACvC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;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,13 +1,3 @@
|
|
|
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
|
-
}
|
|
11
1
|
class RscCache {
|
|
12
2
|
cache = /* @__PURE__ */ new Map();
|
|
13
3
|
socket;
|
|
@@ -76,7 +66,7 @@ class RscCache {
|
|
|
76
66
|
} else if (this.sendRetries >= 10) {
|
|
77
67
|
console.error("Exhausted retries to send message to WebSocket server.");
|
|
78
68
|
} else {
|
|
79
|
-
console.error("
|
|
69
|
+
console.error("WebSocket connection is closed.");
|
|
80
70
|
}
|
|
81
71
|
}
|
|
82
72
|
sendUpdateToWebSocket() {
|
package/dist/rsc/clientSsr.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
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
|
-
*/
|
|
8
1
|
export declare function renderRoutesSsr(pathname: string): Promise<any>;
|
|
9
2
|
//# 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":"AAuEA,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,gBA2DrD"}
|
package/dist/rsc/clientSsr.js
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { pathToFileURL } from "node:url";
|
|
3
2
|
import { getPaths } from "@cedarjs/project-config";
|
|
4
3
|
import { moduleMap } from "./ssrModuleMap.js";
|
|
5
|
-
import { importRsdwClient,
|
|
4
|
+
import { importRsdwClient, importRsdwServer, importReact } from "./utils.js";
|
|
6
5
|
import { makeFilePath } from "./utils.js";
|
|
7
6
|
async function getEntries() {
|
|
8
|
-
if (globalThis.__cedarjs__vite_ssr_runtime) {
|
|
9
|
-
return {
|
|
10
|
-
serverEntries: {
|
|
11
|
-
__cedarjs__Routes: "../../src/Routes.tsx"
|
|
12
|
-
},
|
|
13
|
-
ssrEntries: {}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
7
|
const entriesPath = getPaths().web.distRscEntries;
|
|
17
8
|
const entries = await import(makeFilePath(entriesPath));
|
|
18
9
|
return entries;
|
|
19
10
|
}
|
|
20
11
|
async function getRoutesComponent() {
|
|
21
|
-
if (globalThis.__cedarjs__vite_rsc_runtime) {
|
|
22
|
-
const routesMod = await globalThis.__cedarjs__vite_rsc_runtime.import(
|
|
23
|
-
getPaths().web.routes
|
|
24
|
-
);
|
|
25
|
-
return routesMod.default;
|
|
26
|
-
}
|
|
27
12
|
const { serverEntries } = await getEntries();
|
|
28
13
|
const entryPath = path.join(
|
|
29
14
|
getPaths().web.distRsc,
|
|
@@ -73,52 +58,19 @@ async function renderRoutesSsr(pathname) {
|
|
|
73
58
|
get(_target, encodedId) {
|
|
74
59
|
console.log("Proxy get encodedId", encodedId);
|
|
75
60
|
const [filePath, name] = encodedId.split("#");
|
|
76
|
-
const id =
|
|
61
|
+
const id = resolveClientEntryForProd(filePath, clientEntries);
|
|
77
62
|
console.log("clientSsr.ts::Proxy id", id);
|
|
78
63
|
return { id, chunks: [id], name, async: true };
|
|
79
64
|
}
|
|
80
65
|
}
|
|
81
66
|
);
|
|
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
|
-
);
|
|
94
67
|
const { createElement } = await importReact();
|
|
95
68
|
const { renderToReadableStream } = await importRsdwServer();
|
|
96
69
|
console.log("clientSsr.ts right before renderToReadableStream");
|
|
97
|
-
const
|
|
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
|
-
})();
|
|
70
|
+
const stream = renderToReadableStream(createElement(Routes), bundlerConfig);
|
|
115
71
|
const { createFromReadableStream } = await importRsdwClient();
|
|
116
|
-
const data = createFromReadableStream(
|
|
117
|
-
|
|
118
|
-
moduleMap,
|
|
119
|
-
serverModuleMap,
|
|
120
|
-
moduleLoading: null
|
|
121
|
-
}
|
|
72
|
+
const data = createFromReadableStream(stream, {
|
|
73
|
+
ssrManifest: { moduleMap, moduleLoading: null }
|
|
122
74
|
});
|
|
123
75
|
rscCache.set(pathname, data);
|
|
124
76
|
return data;
|
package/dist/rsc/utils.d.ts
CHANGED
|
@@ -6,15 +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 same version of rsdw_client to prevent
|
|
10
10
|
* multiple instances of React
|
|
11
11
|
*/
|
|
12
12
|
export declare function importReact(): Promise<any>;
|
|
13
13
|
/**
|
|
14
14
|
* See vite/streamHelpers.ts.
|
|
15
15
|
*
|
|
16
|
-
* This function ensures we load the same version of rsdw_client
|
|
17
|
-
*
|
|
16
|
+
* This function ensures we load the same version of rsdw_client to prevent
|
|
17
|
+
* multiple instances of React
|
|
18
18
|
*/
|
|
19
19
|
export declare function importRsdwClient(): Promise<RSDWClientType>;
|
|
20
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;;;;;GAKG;AACH,wBAAsB,WAAW,
|
|
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,iBAKhC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAOhE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAWhE"}
|
package/dist/rsc/utils.js
CHANGED
|
@@ -5,19 +5,11 @@ function makeFilePath(path2) {
|
|
|
5
5
|
return pathToFileURL(path2).href;
|
|
6
6
|
}
|
|
7
7
|
async function importReact() {
|
|
8
|
-
if (globalThis.__cedarjs__vite_ssr_runtime) {
|
|
9
|
-
const reactMod = await import("react");
|
|
10
|
-
return reactMod.default;
|
|
11
|
-
}
|
|
12
8
|
const distSsr = getPaths().web.distSsr;
|
|
13
9
|
const reactPath = makeFilePath(path.join(distSsr, "__cedarjs__react.mjs"));
|
|
14
10
|
return (await import(reactPath)).default;
|
|
15
11
|
}
|
|
16
12
|
async function importRsdwClient() {
|
|
17
|
-
if (globalThis.__cedarjs__vite_ssr_runtime) {
|
|
18
|
-
const rsdwcMod = await import("react-server-dom-webpack/client.edge");
|
|
19
|
-
return rsdwcMod.default;
|
|
20
|
-
}
|
|
21
13
|
const distSsr = getPaths().web.distSsr;
|
|
22
14
|
const rsdwClientPath = makeFilePath(
|
|
23
15
|
path.join(distSsr, "__cedarjs__rsdw-client.mjs")
|
|
@@ -25,18 +17,11 @@ async function importRsdwClient() {
|
|
|
25
17
|
return (await import(rsdwClientPath)).default;
|
|
26
18
|
}
|
|
27
19
|
async function importRsdwServer() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
const dynamicImport = "";
|
|
35
|
-
return import(
|
|
36
|
-
/* @vite-ignore */
|
|
37
|
-
dynamicImport + "react-server-dom-webpack/server.edge"
|
|
38
|
-
);
|
|
39
|
-
}
|
|
20
|
+
const dynamicImport = "";
|
|
21
|
+
return import(
|
|
22
|
+
/* @vite-ignore */
|
|
23
|
+
dynamicImport + "react-server-dom-webpack/server.edge"
|
|
24
|
+
);
|
|
40
25
|
}
|
|
41
26
|
export {
|
|
42
27
|
importReact,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/router",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.221",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -52,17 +52,16 @@
|
|
|
52
52
|
"test:watch": "vitest watch"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@cedarjs/project-config": "6.0.0-
|
|
56
|
-
"@cedarjs/server-store": "6.0.0-
|
|
57
|
-
"react": "
|
|
58
|
-
"react-dom": "
|
|
59
|
-
"react-server-dom-webpack": "19.2.7",
|
|
55
|
+
"@cedarjs/project-config": "6.0.0-rc.221",
|
|
56
|
+
"@cedarjs/server-store": "6.0.0-rc.221",
|
|
57
|
+
"react": "18.3.1",
|
|
58
|
+
"react-dom": "18.3.1",
|
|
60
59
|
"ts-toolbelt": "9.6.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@arethetypeswrong/cli": "0.18.5",
|
|
64
|
-
"@cedarjs/auth": "6.0.0-
|
|
65
|
-
"@cedarjs/framework-tools": "6.0.0-
|
|
63
|
+
"@cedarjs/auth": "6.0.0-rc.221",
|
|
64
|
+
"@cedarjs/framework-tools": "6.0.0-rc.221",
|
|
66
65
|
"@testing-library/jest-dom": "6.9.1",
|
|
67
66
|
"@types/react": "^18.2.55",
|
|
68
67
|
"@types/react-dom": "^18.2.19",
|
|
@@ -74,9 +73,9 @@
|
|
|
74
73
|
"vitest": "4.1.10"
|
|
75
74
|
},
|
|
76
75
|
"peerDependencies": {
|
|
77
|
-
"@cedarjs/auth": "6.0.0-
|
|
78
|
-
"react": "
|
|
79
|
-
"react-dom": "
|
|
76
|
+
"@cedarjs/auth": "6.0.0-rc.221",
|
|
77
|
+
"react": "18.3.1",
|
|
78
|
+
"react-dom": "18.3.1"
|
|
80
79
|
},
|
|
81
80
|
"engines": {
|
|
82
81
|
"node": ">=24"
|