@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.
@@ -1 +1 @@
1
- {"version":3,"file":"RscCache.d.ts","sourceRoot":"","sources":["../../src/rsc/RscCache.ts"],"names":[],"mappings":"AAYA,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"}
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"}
@@ -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("RscCache: WebSocket connection is closed.");
69
+ console.error("WebSocket connection is closed.");
80
70
  }
81
71
  }
82
72
  sendUpdateToWebSocket() {
@@ -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":"AA2FA;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,gBA0GrD"}
1
+ {"version":3,"file":"clientSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/clientSsr.ts"],"names":[],"mappings":"AAuEA,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,gBA2DrD"}
@@ -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, importReact, importRsdwServer } from "./utils.js";
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 = globalThis.__cedarjs__vite_ssr_runtime ? filePath : resolveClientEntryForProd(filePath, clientEntries);
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 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
- })();
70
+ const stream = renderToReadableStream(createElement(Routes), bundlerConfig);
115
71
  const { createFromReadableStream } = await importRsdwClient();
116
- const data = createFromReadableStream(streamForRendering, {
117
- serverConsumerManifest: {
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;
@@ -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 bundled version of React to prevent
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 everywhere to
17
- * prevent multiple instances of React
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>;
@@ -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,iBAUhC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAYhE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAmBhE"}
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
- if (globalThis.__cedarjs__vite_rsc_runtime) {
29
- const rsdwServerMod = await globalThis.__cedarjs__vite_rsc_runtime.import(
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
- }
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-canary.2851",
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-canary.2851",
56
- "@cedarjs/server-store": "6.0.0-canary.2851",
57
- "react": "19.2.3",
58
- "react-dom": "19.2.3",
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-canary.2851",
65
- "@cedarjs/framework-tools": "6.0.0-canary.2851",
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-canary.2851",
78
- "react": "19.2.3",
79
- "react-dom": "19.2.3"
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"