@cedarjs/vite 2.8.1-next.0 → 2.8.1-next.109

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.
@@ -27,8 +27,7 @@ var import_dist = require("@cedarjs/structure/dist/index.js");
27
27
  var import_utils = require("../utils.js");
28
28
  function getEntries() {
29
29
  const entries = {};
30
- const rwProject = (0, import_dist.getProject)((0, import_project_config.getPaths)().base);
31
- const routes = rwProject.getRouter().routes;
30
+ const routes = (0, import_dist.getProject)().getRouter().routes;
32
31
  const pages = routes.map((route) => route.page);
33
32
  for (const page of pages) {
34
33
  entries[page.constName] = (0, import_project_config.ensurePosixPath)((0, import_project_config.importStatementPath)(page.path));
@@ -37,8 +36,8 @@ function getEntries() {
37
36
  if (!serverEntry) {
38
37
  throw new Error("Server Entry file not found");
39
38
  }
40
- entries["__rwjs__ServerEntry"] = serverEntry;
41
- entries["__rwjs__Routes"] = (0, import_project_config.getPaths)().web.routes;
39
+ entries["__cedarjs__ServerEntry"] = serverEntry;
40
+ entries["__cedarjs__Routes"] = (0, import_project_config.getPaths)().web.routes;
42
41
  return entries;
43
42
  }
44
43
  async function getEntriesFromDist() {
@@ -21,7 +21,9 @@ __export(registerFwGlobalsAndShims_exports, {
21
21
  registerFwGlobalsAndShims: () => registerFwGlobalsAndShims
22
22
  });
23
23
  module.exports = __toCommonJS(registerFwGlobalsAndShims_exports);
24
+ var import_node_module = require("node:module");
24
25
  var import_project_config = require("@cedarjs/project-config");
26
+ const import_meta = {};
25
27
  const registerFwGlobalsAndShims = () => {
26
28
  registerFwGlobals();
27
29
  registerFwShims();
@@ -89,6 +91,7 @@ function registerFwShims() {
89
91
  console.log("registerFwShims require id", id);
90
92
  return globalThis.__rw_module_cache__.get(id);
91
93
  };
94
+ globalThis.__non_webpack_require__ ||= (0, import_node_module.createRequire)(import_meta.url);
92
95
  }
93
96
  function swapLocalhostFor127(hostString) {
94
97
  return hostString.replace("localhost", "127.0.0.1");
@@ -306,7 +306,7 @@ function babelPluginTransformServerAction({
306
306
  if (!name) {
307
307
  throw new Error("Server action must have a name");
308
308
  }
309
- const uniqueName = `__rwjs__rsa${serverActionNodes.length}_${name}`;
309
+ const uniqueName = `__cedarjs__rsa${serverActionNodes.length}_${name}`;
310
310
  serverActionNode.id = t.identifier(uniqueName);
311
311
  serverActionNodes.push(serverActionNode);
312
312
  init.body.body[serverActionNodeIndex] = t.variableDeclaration(
@@ -350,7 +350,7 @@ function babelPluginTransformServerAction({
350
350
  if (!name) {
351
351
  throw new Error("Server action must have a name");
352
352
  }
353
- const uniqueName = `__rwjs__rsa${serverActionNodes.length}_${name}`;
353
+ const uniqueName = `__cedarjs__rsa${serverActionNodes.length}_${name}`;
354
354
  serverActionNode.id = t.identifier(uniqueName);
355
355
  serverActionNodes.push(serverActionNode);
356
356
  body.body[serverActionNodeIndex] = t.variableDeclaration(
@@ -60,8 +60,10 @@ async function rscBuildAnalyze() {
60
60
  // it means we can skip analyzing them, which means faster build times.
61
61
  external: [
62
62
  "@prisma/client",
63
+ "@prisma/adapter-better-sqlite3",
63
64
  "@prisma/fetch-engine",
64
65
  "@prisma/internals",
66
+ "better-sqlite3",
65
67
  "@cedarjs/auth-dbauth-api",
66
68
  "@cedarjs/cookie-jar",
67
69
  "@cedarjs/server-store",
@@ -51,7 +51,7 @@ async function rscBuildClient(clientEntryFiles) {
51
51
  input: {
52
52
  // @MARK: temporary hack to find the entry client so we can get the
53
53
  // index.css bundle but we don't actually want this on an rsc page!
54
- __rwjs__client_entry: rwPaths.web.entryClient,
54
+ __cedarjs__client_entry: rwPaths.web.entryClient,
55
55
  // we need this, so that the output contains rsc-specific bundles
56
56
  // for the client-only components. They get loaded once the page is
57
57
  // rendered
@@ -89,8 +89,8 @@ export const ssrEntries = ${JSON.stringify(ssrEntries, void 0, 2)};
89
89
  );
90
90
  const serverEntries = {};
91
91
  const entries = {
92
- __rwjs__ServerEntry: (0, import_project_config.getPaths)().web.entryServer || "",
93
- __rwjs__Routes: (0, import_project_config.getPaths)().web.routes
92
+ __cedarjs__ServerEntry: (0, import_project_config.getPaths)().web.entryServer || "",
93
+ __cedarjs__Routes: (0, import_project_config.getPaths)().web.routes
94
94
  };
95
95
  for (const [name, sourceFile] of Object.entries(entries)) {
96
96
  const buildOutputItem = serverBuildOutput.find((item) => {
@@ -62,8 +62,10 @@ async function rscBuildForServer(clientEntryFiles, serverEntryFiles, customModul
62
62
  // Server store has to be externalized, because it's a singleton (shared between FW and App)
63
63
  external: [
64
64
  "@prisma/client",
65
+ "@prisma/adapter-better-sqlite3",
65
66
  "@prisma/fetch-engine",
66
67
  "@prisma/internals",
68
+ "better-sqlite3",
67
69
  "@cedarjs/auth-dbauth-api",
68
70
  "@cedarjs/cookie-jar",
69
71
  "@cedarjs/server-store",
@@ -67,8 +67,10 @@ async function rscBuildForSsr({
67
67
  noExternal: true,
68
68
  external: [
69
69
  "@prisma/client",
70
+ "@prisma/adapter-better-sqlite3",
70
71
  "@prisma/fetch-engine",
71
72
  "@prisma/internals",
73
+ "better-sqlite3",
72
74
  "@cedarjs/auth-dbauth-api",
73
75
  "@cedarjs/cookie-jar",
74
76
  "@cedarjs/server-store",
@@ -105,19 +107,19 @@ async function rscBuildForSsr({
105
107
  // index.css bundle but we don't actually want this on an rsc page!
106
108
  // TODO (RSC): Look into if we can remove this (and perhaps instead
107
109
  // use entry.server)
108
- __rwjs__client_entry: rwPaths.web.entryClient,
110
+ __cedarjs__client_entry: rwPaths.web.entryClient,
109
111
  "entry.server": rwPaths.web.entryServer,
110
112
  // we need this, so that the output contains rsc-specific bundles
111
113
  // for the client-only components. They get loaded once the page is
112
114
  // rendered
113
115
  ...clientEntryFiles,
114
116
  // These import redirections are so that we don't bundle multiple versions of react
115
- __rwjs__react: "react",
116
- __rwjs__location: "@cedarjs/router/location",
117
- __rwjs__server_auth_provider: "@cedarjs/auth/ServerAuthProvider",
118
- __rwjs__server_inject: "@cedarjs/web/serverInject",
119
- "__rwjs__rsdw-client": "react-server-dom-webpack/client.edge",
120
- // TODO (RSC): add __rwjs__ prefix to the entry below
117
+ __cedarjs__react: "react",
118
+ __cedarjs__location: "@cedarjs/router/location",
119
+ __cedarjs__server_auth_provider: "@cedarjs/auth/ServerAuthProvider",
120
+ __cedarjs__server_inject: "@cedarjs/web/serverInject",
121
+ "__cedarjs__rsdw-client": "react-server-dom-webpack/client.edge",
122
+ // TODO (RSC): add __cedarjs__ prefix to the entry below
121
123
  "rd-server": "react-dom/server.edge",
122
124
  // We need the document for React's fallback
123
125
  Document: rwPaths.web.document
@@ -132,7 +134,7 @@ async function rscBuildForSsr({
132
134
  // is resolved
133
135
  hoistTransitiveImports: false,
134
136
  entryFileNames: (chunkInfo) => {
135
- if (chunkInfo.name === "rd-server" || chunkInfo.name === "__rwjs__react" || chunkInfo.name === "__rwjs__location" || chunkInfo.name === "__rwjs__server_auth_provider" || chunkInfo.name === "__rwjs__server_inject" || chunkInfo.name === "__rwjs__rsdw-client" || chunkInfo.name === "entry.server" || chunkInfo.name === "Document") {
137
+ if (chunkInfo.name === "rd-server" || chunkInfo.name === "__cedarjs__react" || chunkInfo.name === "__cedarjs__location" || chunkInfo.name === "__cedarjs__server_auth_provider" || chunkInfo.name === "__cedarjs__server_inject" || chunkInfo.name === "__cedarjs__rsdw-client" || chunkInfo.name === "entry.server" || chunkInfo.name === "Document") {
136
138
  return "[name].mjs";
137
139
  }
138
140
  return "assets/[name]-[hash].mjs";
@@ -51,10 +51,10 @@ const getRoutesComponent = async () => {
51
51
  console.log("rscRenderer.ts serverEntries", serverEntries);
52
52
  const routesPath = import_node_path.default.join(
53
53
  (0, import_project_config.getPaths)().web.distRsc,
54
- serverEntries["__rwjs__Routes"]
54
+ serverEntries["__cedarjs__Routes"]
55
55
  );
56
56
  if (!routesPath) {
57
- throw new import_StatusError.StatusError("No entry found for __rwjs__Routes", 404);
57
+ throw new import_StatusError.StatusError("No entry found for __cedarjs__Routes", 404);
58
58
  }
59
59
  const routes = await loadServerFile(routesPath);
60
60
  return routes.default;
@@ -115,7 +115,7 @@ async function renderRsc(input) {
115
115
  console.log("renderRsc input", input);
116
116
  const serverRoutes = await getRoutesComponent();
117
117
  const model = {
118
- __rwjs__Routes: (0, import_react.createElement)(serverRoutes)
118
+ __cedarjs__Routes: (0, import_react.createElement)(serverRoutes)
119
119
  };
120
120
  console.log("rscRenderer.ts renderRsc model", model);
121
121
  return (0, import_server.renderToReadableStream)(model, getBundlerConfig());
@@ -152,8 +152,8 @@ async function executeRsa(input) {
152
152
  const serverRoutes = await getRoutesComponent();
153
153
  console.log("rscRenderer.ts executeRsa serverRoutes", serverRoutes);
154
154
  const model = {
155
- __rwjs__Routes: (0, import_react.createElement)(serverRoutes),
156
- __rwjs__rsa_data: data
155
+ __cedarjs__Routes: (0, import_react.createElement)(serverRoutes),
156
+ __cedarjs__rsa_data: data
157
157
  };
158
158
  console.log("rscRenderer.ts executeRsa model", model);
159
159
  return (0, import_server.renderToReadableStream)(model, getBundlerConfig());
@@ -84,12 +84,12 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
84
84
  meta: metaTags
85
85
  });
86
86
  const rscEnabled = (0, import_project_config.getConfig)().experimental?.rsc?.enabled;
87
- const { createElement } = rscEnabled ? await importModule("__rwjs__react") : await import("react");
87
+ const { createElement } = rscEnabled ? await importModule("__cedarjs__react") : await import("react");
88
88
  const {
89
89
  createInjector,
90
90
  ServerHtmlProvider,
91
91
  ServerInjectedHtml
92
- } = rscEnabled ? await importModule("__rwjs__server_inject") : await import("@cedarjs/web/serverInject");
92
+ } = rscEnabled ? await importModule("__cedarjs__server_inject") : await import("@cedarjs/web/serverInject");
93
93
  const { renderToString } = rscEnabled ? await importModule("rd-server") : await import("react-dom/server");
94
94
  const { injectionState, injectToPage } = createInjector();
95
95
  const bufferTransform = (0, import_bufferedTransform.createBufferedTransformStream)();
@@ -105,8 +105,8 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
105
105
  controller.abort();
106
106
  }, 1e4);
107
107
  const timeoutTransform = (0, import_cancelTimeoutTransform.createTimeoutTransform)(timeoutHandle);
108
- const { ServerAuthProvider } = rscEnabled ? await importModule("__rwjs__server_auth_provider") : await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
109
- const { LocationProvider } = rscEnabled ? await importModule("__rwjs__location") : await import("@cedarjs/router/location");
108
+ const { ServerAuthProvider } = rscEnabled ? await importModule("__cedarjs__server_auth_provider") : await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
109
+ const { LocationProvider } = rscEnabled ? await importModule("__cedarjs__location") : await import("@cedarjs/router/location");
110
110
  const renderRoot = (url) => {
111
111
  return createElement(
112
112
  ServerAuthProvider,
@@ -200,23 +200,25 @@ function applyStreamTransforms(reactStream, transformsToApply) {
200
200
  async function importModule(mod) {
201
201
  const distSsr = (0, import_project_config.getPaths)().web.distSsr;
202
202
  const rdServerPath = (0, import_utils.makeFilePath)(import_node_path.default.join(distSsr, "rd-server.mjs"));
203
- const reactPath = (0, import_utils.makeFilePath)(import_node_path.default.join(distSsr, "__rwjs__react.mjs"));
204
- const locationPath = (0, import_utils.makeFilePath)(import_node_path.default.join(distSsr, "__rwjs__location.mjs"));
203
+ const reactPath = (0, import_utils.makeFilePath)(import_node_path.default.join(distSsr, "__cedarjs__react.mjs"));
204
+ const locationPath = (0, import_utils.makeFilePath)(
205
+ import_node_path.default.join(distSsr, "__cedarjs__location.mjs")
206
+ );
205
207
  const ServerAuthProviderPath = (0, import_utils.makeFilePath)(
206
- import_node_path.default.join(distSsr, "__rwjs__server_auth_provider.mjs")
208
+ import_node_path.default.join(distSsr, "__cedarjs__server_auth_provider.mjs")
207
209
  );
208
210
  const ServerInjectPath = (0, import_utils.makeFilePath)(
209
- import_node_path.default.join(distSsr, "__rwjs__server_inject.mjs")
211
+ import_node_path.default.join(distSsr, "__cedarjs__server_inject.mjs")
210
212
  );
211
213
  if (mod === "rd-server") {
212
214
  return (await import(rdServerPath)).default;
213
- } else if (mod === "__rwjs__react") {
215
+ } else if (mod === "__cedarjs__react") {
214
216
  return (await import(reactPath)).default;
215
- } else if (mod === "__rwjs__location") {
217
+ } else if (mod === "__cedarjs__location") {
216
218
  return await import(locationPath);
217
- } else if (mod === "__rwjs__server_auth_provider") {
219
+ } else if (mod === "__cedarjs__server_auth_provider") {
218
220
  return await import(ServerAuthProviderPath);
219
- } else if (mod === "__rwjs__server_inject") {
221
+ } else if (mod === "__cedarjs__server_inject") {
220
222
  return await import(ServerInjectPath);
221
223
  }
222
224
  throw new Error("Unknown module " + mod);
package/dist/cjs/utils.js CHANGED
@@ -72,8 +72,8 @@ function convertExpressHeaders(expressDistinctHeaders) {
72
72
  const getFullUrl = (req, rscEnabled) => {
73
73
  const baseUrl = req.protocol + "://" + req.headers.host;
74
74
  const url = new URL(req.originalUrl || "", baseUrl);
75
- const pathname = url.searchParams.get("__rwjs__pathname");
76
- const search = url.searchParams.get("__rwjs__search");
75
+ const pathname = url.searchParams.get("__cedarjs__pathname");
76
+ const search = url.searchParams.get("__cedarjs__search");
77
77
  let pathnamePlusSearch = req.originalUrl;
78
78
  if (rscEnabled && pathname !== null && search !== null) {
79
79
  pathnamePlusSearch = pathname + "?" + search;
@@ -1 +1 @@
1
- {"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/lib/entries.ts"],"names":[],"mappings":"AAWA,wBAAgB,UAAU,2BA0BzB;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAI1E"}
1
+ {"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/lib/entries.ts"],"names":[],"mappings":"AAWA,wBAAgB,UAAU,2BAyBzB;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAI1E"}
@@ -7,8 +7,7 @@ import { getProject } from "@cedarjs/structure/dist/index.js";
7
7
  import { makeFilePath } from "../utils.js";
8
8
  function getEntries() {
9
9
  const entries = {};
10
- const rwProject = getProject(getPaths().base);
11
- const routes = rwProject.getRouter().routes;
10
+ const routes = getProject().getRouter().routes;
12
11
  const pages = routes.map((route) => route.page);
13
12
  for (const page of pages) {
14
13
  entries[page.constName] = ensurePosixPath(importStatementPath(page.path));
@@ -17,8 +16,8 @@ function getEntries() {
17
16
  if (!serverEntry) {
18
17
  throw new Error("Server Entry file not found");
19
18
  }
20
- entries["__rwjs__ServerEntry"] = serverEntry;
21
- entries["__rwjs__Routes"] = getPaths().web.routes;
19
+ entries["__cedarjs__ServerEntry"] = serverEntry;
20
+ entries["__cedarjs__Routes"] = getPaths().web.routes;
22
21
  return entries;
23
22
  }
24
23
  async function getEntriesFromDist() {
@@ -1 +1 @@
1
- {"version":3,"file":"registerFwGlobalsAndShims.d.ts","sourceRoot":"","sources":["../../src/lib/registerFwGlobalsAndShims.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,YAGrC,CAAA"}
1
+ {"version":3,"file":"registerFwGlobalsAndShims.d.ts","sourceRoot":"","sources":["../../src/lib/registerFwGlobalsAndShims.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,YAGrC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { createRequire } from "node:module";
1
2
  import { getConfig, getEnvVarDefinitions } from "@cedarjs/project-config";
2
3
  const registerFwGlobalsAndShims = () => {
3
4
  registerFwGlobals();
@@ -66,6 +67,7 @@ function registerFwShims() {
66
67
  console.log("registerFwShims require id", id);
67
68
  return globalThis.__rw_module_cache__.get(id);
68
69
  };
70
+ globalThis.__non_webpack_require__ ||= createRequire(import.meta.url);
69
71
  }
70
72
  function swapLocalhostFor127(hostString) {
71
73
  return hostString.replace("localhost", "127.0.0.1");
@@ -273,7 +273,7 @@ function babelPluginTransformServerAction({
273
273
  if (!name) {
274
274
  throw new Error("Server action must have a name");
275
275
  }
276
- const uniqueName = `__rwjs__rsa${serverActionNodes.length}_${name}`;
276
+ const uniqueName = `__cedarjs__rsa${serverActionNodes.length}_${name}`;
277
277
  serverActionNode.id = t.identifier(uniqueName);
278
278
  serverActionNodes.push(serverActionNode);
279
279
  init.body.body[serverActionNodeIndex] = t.variableDeclaration(
@@ -317,7 +317,7 @@ function babelPluginTransformServerAction({
317
317
  if (!name) {
318
318
  throw new Error("Server action must have a name");
319
319
  }
320
- const uniqueName = `__rwjs__rsa${serverActionNodes.length}_${name}`;
320
+ const uniqueName = `__cedarjs__rsa${serverActionNodes.length}_${name}`;
321
321
  serverActionNode.id = t.identifier(uniqueName);
322
322
  serverActionNodes.push(serverActionNode);
323
323
  body.body[serverActionNodeIndex] = t.variableDeclaration(
@@ -1 +1 @@
1
- {"version":3,"file":"rscBuildAnalyze.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildAnalyze.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAsB,eAAe;;;;;;;GAgGpC"}
1
+ {"version":3,"file":"rscBuildAnalyze.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildAnalyze.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAsB,eAAe;;;;;;;GAkGpC"}
@@ -37,8 +37,10 @@ async function rscBuildAnalyze() {
37
37
  // it means we can skip analyzing them, which means faster build times.
38
38
  external: [
39
39
  "@prisma/client",
40
+ "@prisma/adapter-better-sqlite3",
40
41
  "@prisma/fetch-engine",
41
42
  "@prisma/internals",
43
+ "better-sqlite3",
42
44
  "@cedarjs/auth-dbauth-api",
43
45
  "@cedarjs/cookie-jar",
44
46
  "@cedarjs/server-store",
@@ -28,7 +28,7 @@ async function rscBuildClient(clientEntryFiles) {
28
28
  input: {
29
29
  // @MARK: temporary hack to find the entry client so we can get the
30
30
  // index.css bundle but we don't actually want this on an rsc page!
31
- __rwjs__client_entry: rwPaths.web.entryClient,
31
+ __cedarjs__client_entry: rwPaths.web.entryClient,
32
32
  // we need this, so that the output contains rsc-specific bundles
33
33
  // for the client-only components. They get loaded once the page is
34
34
  // rendered
@@ -56,8 +56,8 @@ export const ssrEntries = ${JSON.stringify(ssrEntries, void 0, 2)};
56
56
  );
57
57
  const serverEntries = {};
58
58
  const entries = {
59
- __rwjs__ServerEntry: getPaths().web.entryServer || "",
60
- __rwjs__Routes: getPaths().web.routes
59
+ __cedarjs__ServerEntry: getPaths().web.entryServer || "",
60
+ __cedarjs__Routes: getPaths().web.routes
61
61
  };
62
62
  for (const [name, sourceFile] of Object.entries(entries)) {
63
63
  const buildOutputItem = serverBuildOutput.find((item) => {
@@ -1 +1 @@
1
- {"version":3,"file":"rscBuildForServer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForServer.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,+GAyItC"}
1
+ {"version":3,"file":"rscBuildForServer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForServer.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,+GA2ItC"}
@@ -39,8 +39,10 @@ async function rscBuildForServer(clientEntryFiles, serverEntryFiles, customModul
39
39
  // Server store has to be externalized, because it's a singleton (shared between FW and App)
40
40
  external: [
41
41
  "@prisma/client",
42
+ "@prisma/adapter-better-sqlite3",
42
43
  "@prisma/fetch-engine",
43
44
  "@prisma/internals",
45
+ "better-sqlite3",
44
46
  "@cedarjs/auth-dbauth-api",
45
47
  "@cedarjs/cookie-jar",
46
48
  "@cedarjs/server-store",
@@ -1 +1 @@
1
- {"version":3,"file":"rscBuildForSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForSsr.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,gBAAgB,EAChB,OAAe,GAChB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+GA2IA"}
1
+ {"version":3,"file":"rscBuildForSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForSsr.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,gBAAgB,EAChB,OAAe,GAChB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+GA6IA"}
@@ -34,8 +34,10 @@ async function rscBuildForSsr({
34
34
  noExternal: true,
35
35
  external: [
36
36
  "@prisma/client",
37
+ "@prisma/adapter-better-sqlite3",
37
38
  "@prisma/fetch-engine",
38
39
  "@prisma/internals",
40
+ "better-sqlite3",
39
41
  "@cedarjs/auth-dbauth-api",
40
42
  "@cedarjs/cookie-jar",
41
43
  "@cedarjs/server-store",
@@ -72,19 +74,19 @@ async function rscBuildForSsr({
72
74
  // index.css bundle but we don't actually want this on an rsc page!
73
75
  // TODO (RSC): Look into if we can remove this (and perhaps instead
74
76
  // use entry.server)
75
- __rwjs__client_entry: rwPaths.web.entryClient,
77
+ __cedarjs__client_entry: rwPaths.web.entryClient,
76
78
  "entry.server": rwPaths.web.entryServer,
77
79
  // we need this, so that the output contains rsc-specific bundles
78
80
  // for the client-only components. They get loaded once the page is
79
81
  // rendered
80
82
  ...clientEntryFiles,
81
83
  // These import redirections are so that we don't bundle multiple versions of react
82
- __rwjs__react: "react",
83
- __rwjs__location: "@cedarjs/router/location",
84
- __rwjs__server_auth_provider: "@cedarjs/auth/ServerAuthProvider",
85
- __rwjs__server_inject: "@cedarjs/web/serverInject",
86
- "__rwjs__rsdw-client": "react-server-dom-webpack/client.edge",
87
- // TODO (RSC): add __rwjs__ prefix to the entry below
84
+ __cedarjs__react: "react",
85
+ __cedarjs__location: "@cedarjs/router/location",
86
+ __cedarjs__server_auth_provider: "@cedarjs/auth/ServerAuthProvider",
87
+ __cedarjs__server_inject: "@cedarjs/web/serverInject",
88
+ "__cedarjs__rsdw-client": "react-server-dom-webpack/client.edge",
89
+ // TODO (RSC): add __cedarjs__ prefix to the entry below
88
90
  "rd-server": "react-dom/server.edge",
89
91
  // We need the document for React's fallback
90
92
  Document: rwPaths.web.document
@@ -99,7 +101,7 @@ async function rscBuildForSsr({
99
101
  // is resolved
100
102
  hoistTransitiveImports: false,
101
103
  entryFileNames: (chunkInfo) => {
102
- if (chunkInfo.name === "rd-server" || chunkInfo.name === "__rwjs__react" || chunkInfo.name === "__rwjs__location" || chunkInfo.name === "__rwjs__server_auth_provider" || chunkInfo.name === "__rwjs__server_inject" || chunkInfo.name === "__rwjs__rsdw-client" || chunkInfo.name === "entry.server" || chunkInfo.name === "Document") {
104
+ if (chunkInfo.name === "rd-server" || chunkInfo.name === "__cedarjs__react" || chunkInfo.name === "__cedarjs__location" || chunkInfo.name === "__cedarjs__server_auth_provider" || chunkInfo.name === "__cedarjs__server_inject" || chunkInfo.name === "__cedarjs__rsdw-client" || chunkInfo.name === "entry.server" || chunkInfo.name === "Document") {
103
105
  return "[name].mjs";
104
106
  }
105
107
  return "assets/[name]-[hash].mjs";
@@ -17,10 +17,10 @@ const getRoutesComponent = async () => {
17
17
  console.log("rscRenderer.ts serverEntries", serverEntries);
18
18
  const routesPath = path.join(
19
19
  getPaths().web.distRsc,
20
- serverEntries["__rwjs__Routes"]
20
+ serverEntries["__cedarjs__Routes"]
21
21
  );
22
22
  if (!routesPath) {
23
- throw new StatusError("No entry found for __rwjs__Routes", 404);
23
+ throw new StatusError("No entry found for __cedarjs__Routes", 404);
24
24
  }
25
25
  const routes = await loadServerFile(routesPath);
26
26
  return routes.default;
@@ -81,7 +81,7 @@ async function renderRsc(input) {
81
81
  console.log("renderRsc input", input);
82
82
  const serverRoutes = await getRoutesComponent();
83
83
  const model = {
84
- __rwjs__Routes: createElement(serverRoutes)
84
+ __cedarjs__Routes: createElement(serverRoutes)
85
85
  };
86
86
  console.log("rscRenderer.ts renderRsc model", model);
87
87
  return renderToReadableStream(model, getBundlerConfig());
@@ -118,8 +118,8 @@ async function executeRsa(input) {
118
118
  const serverRoutes = await getRoutesComponent();
119
119
  console.log("rscRenderer.ts executeRsa serverRoutes", serverRoutes);
120
120
  const model = {
121
- __rwjs__Routes: createElement(serverRoutes),
122
- __rwjs__rsa_data: data
121
+ __cedarjs__Routes: createElement(serverRoutes),
122
+ __cedarjs__rsa_data: data
123
123
  };
124
124
  console.log("rscRenderer.ts executeRsa model", model);
125
125
  return renderToReadableStream(model, getBundlerConfig());
@@ -18,6 +18,6 @@ interface StreamOptions {
18
18
  onError?: (err: Error) => void;
19
19
  }
20
20
  export declare function reactRenderToStreamResponse(mwRes: MiddlewareResponse, renderOptions: RenderToStreamArgs, streamOptions: StreamOptions): Promise<Response>;
21
- export declare function importModule(mod: 'rd-server' | '__rwjs__react' | '__rwjs__location' | '__rwjs__server_auth_provider' | '__rwjs__server_inject'): Promise<any>;
21
+ export declare function importModule(mod: 'rd-server' | '__cedarjs__react' | '__cedarjs__location' | '__cedarjs__server_auth_provider' | '__cedarjs__server_inject'): Promise<any>;
22
22
  export {};
23
23
  //# sourceMappingURL=streamHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamHelpers.d.ts","sourceRoot":"","sources":["../../src/streaming/streamHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAYlD,UAAU,kBAAkB;IAC1B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACzC,UAAU,EAAE,GAAG,CAAA;IACf,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,eAAe,CAAA;CAC3B;AAED,UAAU,aAAa;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;CAC/B;AA2BD,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,kBAAkB,EACzB,aAAa,EAAE,kBAAkB,EACjC,aAAa,EAAE,aAAa,qBAgM7B;AA2BD,wBAAsB,YAAY,CAChC,GAAG,EACC,WAAW,GACX,eAAe,GACf,kBAAkB,GAClB,8BAA8B,GAC9B,uBAAuB,gBA2B5B"}
1
+ {"version":3,"file":"streamHelpers.d.ts","sourceRoot":"","sources":["../../src/streaming/streamHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAYlD,UAAU,kBAAkB;IAC1B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACzC,UAAU,EAAE,GAAG,CAAA;IACf,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,eAAe,CAAA;CAC3B;AAED,UAAU,aAAa;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;CAC/B;AA2BD,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,kBAAkB,EACzB,aAAa,EAAE,kBAAkB,EACjC,aAAa,EAAE,aAAa,qBAgM7B;AA2BD,wBAAsB,YAAY,CAChC,GAAG,EACC,WAAW,GACX,kBAAkB,GAClB,qBAAqB,GACrB,iCAAiC,GACjC,0BAA0B,gBA6B/B"}
@@ -49,12 +49,12 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
49
49
  meta: metaTags
50
50
  });
51
51
  const rscEnabled = getConfig().experimental?.rsc?.enabled;
52
- const { createElement } = rscEnabled ? await importModule("__rwjs__react") : await import("react");
52
+ const { createElement } = rscEnabled ? await importModule("__cedarjs__react") : await import("react");
53
53
  const {
54
54
  createInjector,
55
55
  ServerHtmlProvider,
56
56
  ServerInjectedHtml
57
- } = rscEnabled ? await importModule("__rwjs__server_inject") : await import("@cedarjs/web/serverInject");
57
+ } = rscEnabled ? await importModule("__cedarjs__server_inject") : await import("@cedarjs/web/serverInject");
58
58
  const { renderToString } = rscEnabled ? await importModule("rd-server") : await import("react-dom/server");
59
59
  const { injectionState, injectToPage } = createInjector();
60
60
  const bufferTransform = createBufferedTransformStream();
@@ -70,8 +70,8 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
70
70
  controller.abort();
71
71
  }, 1e4);
72
72
  const timeoutTransform = createTimeoutTransform(timeoutHandle);
73
- const { ServerAuthProvider } = rscEnabled ? await importModule("__rwjs__server_auth_provider") : await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
74
- const { LocationProvider } = rscEnabled ? await importModule("__rwjs__location") : await import("@cedarjs/router/location");
73
+ const { ServerAuthProvider } = rscEnabled ? await importModule("__cedarjs__server_auth_provider") : await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
74
+ const { LocationProvider } = rscEnabled ? await importModule("__cedarjs__location") : await import("@cedarjs/router/location");
75
75
  const renderRoot = (url) => {
76
76
  return createElement(
77
77
  ServerAuthProvider,
@@ -165,23 +165,25 @@ function applyStreamTransforms(reactStream, transformsToApply) {
165
165
  async function importModule(mod) {
166
166
  const distSsr = getPaths().web.distSsr;
167
167
  const rdServerPath = makeFilePath(path.join(distSsr, "rd-server.mjs"));
168
- const reactPath = makeFilePath(path.join(distSsr, "__rwjs__react.mjs"));
169
- const locationPath = makeFilePath(path.join(distSsr, "__rwjs__location.mjs"));
168
+ const reactPath = makeFilePath(path.join(distSsr, "__cedarjs__react.mjs"));
169
+ const locationPath = makeFilePath(
170
+ path.join(distSsr, "__cedarjs__location.mjs")
171
+ );
170
172
  const ServerAuthProviderPath = makeFilePath(
171
- path.join(distSsr, "__rwjs__server_auth_provider.mjs")
173
+ path.join(distSsr, "__cedarjs__server_auth_provider.mjs")
172
174
  );
173
175
  const ServerInjectPath = makeFilePath(
174
- path.join(distSsr, "__rwjs__server_inject.mjs")
176
+ path.join(distSsr, "__cedarjs__server_inject.mjs")
175
177
  );
176
178
  if (mod === "rd-server") {
177
179
  return (await import(rdServerPath)).default;
178
- } else if (mod === "__rwjs__react") {
180
+ } else if (mod === "__cedarjs__react") {
179
181
  return (await import(reactPath)).default;
180
- } else if (mod === "__rwjs__location") {
182
+ } else if (mod === "__cedarjs__location") {
181
183
  return await import(locationPath);
182
- } else if (mod === "__rwjs__server_auth_provider") {
184
+ } else if (mod === "__cedarjs__server_auth_provider") {
183
185
  return await import(ServerAuthProviderPath);
184
- } else if (mod === "__rwjs__server_inject") {
186
+ } else if (mod === "__cedarjs__server_inject") {
185
187
  return await import(ServerInjectPath);
186
188
  }
187
189
  throw new Error("Unknown module " + mod);
package/dist/utils.js CHANGED
@@ -44,8 +44,8 @@ function convertExpressHeaders(expressDistinctHeaders) {
44
44
  const getFullUrl = (req, rscEnabled) => {
45
45
  const baseUrl = req.protocol + "://" + req.headers.host;
46
46
  const url = new URL(req.originalUrl || "", baseUrl);
47
- const pathname = url.searchParams.get("__rwjs__pathname");
48
- const search = url.searchParams.get("__rwjs__search");
47
+ const pathname = url.searchParams.get("__cedarjs__pathname");
48
+ const search = url.searchParams.get("__cedarjs__search");
49
49
  let pathnamePlusSearch = req.originalUrl;
50
50
  if (rscEnabled && pathname !== null && search !== null) {
51
51
  pathnamePlusSearch = pathname + "?" + search;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "2.8.1-next.0+f9966f3d1",
3
+ "version": "2.8.1-next.109+be993981d",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,18 +60,18 @@
60
60
  "test:watch": "vitest watch"
61
61
  },
62
62
  "dependencies": {
63
- "@ast-grep/napi": "0.41.0",
63
+ "@ast-grep/napi": "0.42.0",
64
64
  "@babel/generator": "7.29.1",
65
- "@babel/parser": "7.29.0",
65
+ "@babel/parser": "7.29.2",
66
66
  "@babel/traverse": "7.29.0",
67
- "@cedarjs/auth": "2.8.1-next.0+f9966f3d1",
68
- "@cedarjs/babel-config": "2.8.1-next.0+f9966f3d1",
69
- "@cedarjs/cookie-jar": "2.8.1-next.0+f9966f3d1",
70
- "@cedarjs/internal": "2.8.1-next.0+f9966f3d1",
71
- "@cedarjs/project-config": "2.8.1-next.0+f9966f3d1",
72
- "@cedarjs/server-store": "2.8.1-next.0+f9966f3d1",
73
- "@cedarjs/testing": "2.8.1-next.0+f9966f3d1",
74
- "@cedarjs/web": "2.8.1-next.0+f9966f3d1",
67
+ "@cedarjs/auth": "2.8.1-next.109+be993981d",
68
+ "@cedarjs/babel-config": "2.8.1-next.109+be993981d",
69
+ "@cedarjs/cookie-jar": "2.8.1-next.109+be993981d",
70
+ "@cedarjs/internal": "2.8.1-next.109+be993981d",
71
+ "@cedarjs/project-config": "2.8.1-next.109+be993981d",
72
+ "@cedarjs/server-store": "2.8.1-next.109+be993981d",
73
+ "@cedarjs/testing": "2.8.1-next.109+be993981d",
74
+ "@cedarjs/web": "2.8.1-next.109+be993981d",
75
75
  "@swc/core": "1.15.18",
76
76
  "@vitejs/plugin-react": "4.7.0",
77
77
  "@whatwg-node/fetch": "0.10.13",
@@ -80,18 +80,17 @@
80
80
  "buffer": "6.0.3",
81
81
  "busboy": "^1.6.0",
82
82
  "cookie": "1.1.1",
83
- "core-js": "3.48.0",
84
83
  "dotenv-defaults": "5.0.2",
85
84
  "execa": "5.1.1",
86
85
  "express": "4.22.1",
87
86
  "find-my-way": "8.2.2",
88
87
  "http-proxy-middleware": "3.0.5",
89
- "isbot": "5.1.35",
88
+ "isbot": "5.1.36",
90
89
  "react": "18.3.1",
91
90
  "react-server-dom-webpack": "19.2.4",
92
91
  "rimraf": "6.1.3",
93
92
  "vite": "5.4.21",
94
- "vite-plugin-cjs-interop": "2.4.3",
93
+ "vite-plugin-cjs-interop": "2.4.4",
95
94
  "vite-plugin-node-polyfills": "0.25.0",
96
95
  "ws": "8.19.0",
97
96
  "yargs-parser": "21.1.1"
@@ -106,7 +105,7 @@
106
105
  "@types/yargs-parser": "21.0.3",
107
106
  "concurrently": "9.2.1",
108
107
  "glob": "11.1.0",
109
- "memfs": "4.56.10",
108
+ "memfs": "4.56.11",
110
109
  "publint": "0.3.18",
111
110
  "rollup": "4.59.0",
112
111
  "tsx": "4.21.0",
@@ -116,5 +115,5 @@
116
115
  "publishConfig": {
117
116
  "access": "public"
118
117
  },
119
- "gitHead": "f9966f3d17f1740c9a1eeb90b30f0e6bd2655914"
118
+ "gitHead": "be993981d7e162a83244009c3f7ab9270c6773f3"
120
119
  }