@cedarjs/vite 6.0.2 → 6.0.3-next.227

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.
Files changed (33) hide show
  1. package/dist/apiDevMiddleware.js +2 -2
  2. package/dist/buildApp.d.ts.map +1 -1
  3. package/dist/buildApp.js +3 -7
  4. package/dist/buildRouteHooks.d.ts +17 -0
  5. package/dist/buildRouteHooks.d.ts.map +1 -1
  6. package/dist/buildRouteHooks.js +87 -68
  7. package/dist/buildRouteManifest.d.ts.map +1 -1
  8. package/dist/buildRouteManifest.js +3 -13
  9. package/dist/bundled/react-server-dom-webpack.server.js +2311 -29157
  10. package/dist/devFeServer.js +3 -3
  11. package/dist/index.d.ts +0 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +0 -4
  14. package/dist/lib/getMergedConfig.d.ts.map +1 -1
  15. package/dist/lib/getMergedConfig.js +0 -5
  16. package/dist/middleware/types.d.ts +4 -1
  17. package/dist/middleware/types.d.ts.map +1 -1
  18. package/dist/plugins/vite-plugin-cedar-cell.d.ts +2 -1
  19. package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
  20. package/dist/plugins/vite-plugin-cedar-cell.js +30 -11
  21. package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +1 -1
  22. package/dist/plugins/vite-plugin-cedar-universal-deploy.js +2 -2
  23. package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts +2 -6
  24. package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -1
  25. package/dist/plugins/vite-plugin-handler-als-wrapping.js +4 -7
  26. package/dist/runFeServer.js +3 -3
  27. package/dist/streaming/streamHelpers.d.ts +6 -1
  28. package/dist/streaming/streamHelpers.d.ts.map +1 -1
  29. package/dist/streaming/streamHelpers.js +1 -1
  30. package/package.json +34 -32
  31. package/dist/plugins/vite-plugin-jsx-loader.d.ts +0 -6
  32. package/dist/plugins/vite-plugin-jsx-loader.d.ts.map +0 -1
  33. package/dist/plugins/vite-plugin-jsx-loader.js +0 -18
@@ -25,7 +25,7 @@ async function createServer() {
25
25
  const rwPaths = getPaths();
26
26
  const rscEnabled = getConfig().experimental.rsc?.enabled ?? false;
27
27
  const serverStorage = createServerStorage();
28
- app.use("*", (req, _res, next) => {
28
+ app.use((req, _res, next) => {
29
29
  const fullUrl = getFullUrl(req, rscEnabled);
30
30
  const perReqStore = createPerRequestMap({
31
31
  // Convert express headers to fetch header
@@ -102,8 +102,8 @@ async function createServer() {
102
102
  },
103
103
  vite
104
104
  );
105
- app.get("*", createServerAdapter(routeHandler));
106
- app.post("*", handleWithMiddleware());
105
+ app.get("/{*splat}", createServerAdapter(routeHandler));
106
+ app.post("/{*splat}", handleWithMiddleware());
107
107
  const port = getConfig().web.port;
108
108
  console.log(`Started server on http://localhost:${port}`);
109
109
  return app.listen(port);
package/dist/index.d.ts CHANGED
@@ -19,7 +19,6 @@ export { cedarRemoveFromBundle } from './plugins/vite-plugin-cedar-remove-from-b
19
19
  export { cedarjsResolveCedarStyleImportsPlugin } from './plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js';
20
20
  export { cedarjsJobPathInjectorPlugin } from './plugins/vite-plugin-cedarjs-job-path-injector.js';
21
21
  export { cedarMockCellDataPlugin } from './plugins/vite-plugin-cedar-mock-cell-data.js';
22
- export { cedarTransformJsAsJsx } from './plugins/vite-plugin-jsx-loader.js';
23
22
  export { cedarMergedConfig } from './plugins/vite-plugin-merged-config.js';
24
23
  export { cedarSwapApolloProvider } from './plugins/vite-plugin-swap-apollo-provider.js';
25
24
  export { cedarUniversalDeployPlugin } from './plugins/vite-plugin-cedar-universal-deploy.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAqCxC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,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAA;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAA;AACpH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAA;AAE1F,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CA+CzE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
package/dist/index.js CHANGED
@@ -25,7 +25,6 @@ import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-b
25
25
  import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
26
26
  import { cedarWaitForApiServer } from "./plugins/vite-plugin-cedar-wait-for-api-server.js";
27
27
  import { cedarjsResolveCedarStyleImportsPlugin } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
28
- import { cedarTransformJsAsJsx } from "./plugins/vite-plugin-jsx-loader.js";
29
28
  import { cedarMergedConfig } from "./plugins/vite-plugin-merged-config.js";
30
29
  import { cedarSwapApolloProvider } from "./plugins/vite-plugin-swap-apollo-provider.js";
31
30
  import { cedarApiImportGuardPlugin as cedarApiImportGuardPlugin2 } from "./plugins/vite-plugin-cedar-api-import-guard.js";
@@ -50,7 +49,6 @@ import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-
50
49
  import { cedarjsResolveCedarStyleImportsPlugin as cedarjsResolveCedarStyleImportsPlugin2 } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
51
50
  import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
52
51
  import { cedarMockCellDataPlugin as cedarMockCellDataPlugin2 } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
53
- import { cedarTransformJsAsJsx as cedarTransformJsAsJsx2 } from "./plugins/vite-plugin-jsx-loader.js";
54
52
  import { cedarMergedConfig as cedarMergedConfig2 } from "./plugins/vite-plugin-merged-config.js";
55
53
  import { cedarSwapApolloProvider as cedarSwapApolloProvider2 } from "./plugins/vite-plugin-swap-apollo-provider.js";
56
54
  import { cedarUniversalDeployPlugin } from "./plugins/vite-plugin-cedar-universal-deploy.js";
@@ -82,7 +80,6 @@ function cedar({ mode, babel } = {}) {
82
80
  cedarjsResolveCedarStyleImportsPlugin(),
83
81
  cedarSwapApolloProvider(),
84
82
  cedarCellTransform(),
85
- cedarTransformJsAsJsx(),
86
83
  cedarRemoveFromBundle(),
87
84
  cedarRemoveDevFatalErrorPage(),
88
85
  // RSC handles route auto-loading differently in each build stage
@@ -114,7 +111,6 @@ export {
114
111
  cedarRemoveFromBundle2 as cedarRemoveFromBundle,
115
112
  cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
116
113
  cedarSwapApolloProvider2 as cedarSwapApolloProvider,
117
- cedarTransformJsAsJsx2 as cedarTransformJsAsJsx,
118
114
  cedarUniversalDeployPlugin,
119
115
  cedarWaitForApiServer2 as cedarWaitForApiServer,
120
116
  cedarjsJobPathInjectorPlugin,
@@ -1 +1 @@
1
- {"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAW5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,CAyIpE"}
1
+ {"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAW5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,CAoIpE"}
@@ -97,11 +97,6 @@ function getMergedConfig(cedarConfig, cedarPaths) {
97
97
  // because rsc builds want false, client and server build wants true
98
98
  optimizeDeps: {
99
99
  esbuildOptions: {
100
- // @MARK this is because JS projects in Cedar don't have .jsx
101
- // extensions
102
- loader: {
103
- ".js": "jsx"
104
- },
105
100
  // Node.js global to browser globalThis
106
101
  // @MARK unsure why we need this, but required for DevFatalErrorPage
107
102
  // at least
@@ -1,3 +1,6 @@
1
1
  import type { Middleware, MiddlewareClass } from '@cedarjs/web/dist/server/middleware';
2
- export type MiddlewareReg = ([Middleware | MiddlewareClass, string] | Middleware | MiddlewareClass)[];
2
+ export type MiddlewareReg = ([
3
+ Middleware | MiddlewareClass,
4
+ string
5
+ ] | Middleware | MiddlewareClass)[];
3
6
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/middleware/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EAChB,MAAM,qCAAqC,CAAA;AAG5C,MAAM,MAAM,aAAa,GAAG,CACxB,CAAC,UAAU,GAAG,eAAe,EAAE,MAAM,CAAC,GACtC,UAAU,GACV,eAAe,CAClB,EAAE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/middleware/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EAChB,MAAM,qCAAqC,CAAA;AAG5C,MAAM,MAAM,aAAa,GAAG,CAC1B;IAAC,UAAU,GAAG,eAAe;IAAE,MAAM;CAAC,GAAG,UAAU,GAAG,eAAe,CACtE,EAAE,CAAA"}
@@ -16,7 +16,8 @@ import type { Plugin } from 'vite';
16
16
  * export const QUERY = gql`...`
17
17
  * export const Loading = () => <div>Loading...</div>
18
18
  * export const Success = ({ data }) => <div>{data}</div>
19
- * export default createCell({ QUERY, Loading, Success, displayName: 'MyCell' })
19
+ * const MyCell = createCell({ QUERY, Loading, Success, displayName: 'MyCell' })
20
+ * export default MyCell
20
21
  * ```
21
22
  */
22
23
  export declare function cedarCellTransform(): Plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAsK3C"}
1
+ {"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAsM3C"}
@@ -23,6 +23,7 @@ function cedarCellTransform() {
23
23
  if (!id.match(/Cell\.[jt]sx?$/)) {
24
24
  return null;
25
25
  }
26
+ const cellComponentName = parsePath(id).name;
26
27
  try {
27
28
  const ast = parse(code, {
28
29
  sourceType: "module",
@@ -111,20 +112,38 @@ function cedarCellTransform() {
111
112
  computed: false
112
113
  }
113
114
  ];
115
+ const cellVariableDeclaration = {
116
+ type: "VariableDeclaration",
117
+ kind: "const",
118
+ declarations: [
119
+ {
120
+ type: "VariableDeclarator",
121
+ id: {
122
+ type: "Identifier",
123
+ name: cellComponentName
124
+ },
125
+ init: {
126
+ type: "CallExpression",
127
+ callee: {
128
+ type: "Identifier",
129
+ name: createCellHookName
130
+ },
131
+ arguments: [
132
+ {
133
+ type: "ObjectExpression",
134
+ properties: objectProperties
135
+ }
136
+ ]
137
+ }
138
+ }
139
+ ]
140
+ };
141
+ path.node.body.push(cellVariableDeclaration);
114
142
  const exportDefaultDeclaration = {
115
143
  type: "ExportDefaultDeclaration",
116
144
  declaration: {
117
- type: "CallExpression",
118
- callee: {
119
- type: "Identifier",
120
- name: createCellHookName
121
- },
122
- arguments: [
123
- {
124
- type: "ObjectExpression",
125
- properties: objectProperties
126
- }
127
- ]
145
+ type: "Identifier",
146
+ name: cellComponentName
128
147
  }
129
148
  };
130
149
  path.node.body.push(exportDefaultDeclaration);
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-cedar-mock-cell-data.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-mock-cell-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CA2KhD;AAcD,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM;;;;;;CAoFxC,CAAA;AAgCD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;CACtD"}
1
+ {"version":3,"file":"vite-plugin-cedar-mock-cell-data.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-mock-cell-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAyKhD;AAcD,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM;;;;;;CAoFxC,CAAA;AAgCD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;CACtD"}
@@ -191,7 +191,7 @@ async function generateGraphQLModule(distPath) {
191
191
  });
192
192
  return `
193
193
  import { buildCedarContext, requestToLegacyEvent } from '@cedarjs/api/runtime';
194
- import { createGraphQLYoga } from '@cedarjs/graphql-server';
194
+ import { createGraphQLServer } from '@cedarjs/graphql-server';
195
195
 
196
196
  // Inlined bundle of ${path.basename(distPath)} (node_modules kept external)
197
197
  ${bundledCode}
@@ -275,7 +275,7 @@ function createGraphQLFetch(graphqlOptions) {
275
275
  let graphqlServerPromise = null;
276
276
  function getGraphQLServer() {
277
277
  if (!graphqlServerPromise) {
278
- graphqlServerPromise = createGraphQLYoga(graphqlOptions);
278
+ graphqlServerPromise = createGraphQLServer(graphqlOptions);
279
279
  }
280
280
  return graphqlServerPromise;
281
281
  }
@@ -25,9 +25,7 @@ import type { Plugin } from 'vite';
25
25
  * This replaces `babel-plugin-handler-als-wrapping` for Vite builds.
26
26
  * The babel plugin is still used for Jest and prerender.
27
27
  */
28
- export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
29
- projectIsEsm?: boolean;
30
- }): Plugin;
28
+ export declare function handlerAlsWrappingPlugin(): Plugin;
31
29
  /**
32
30
  * Wraps the `handler` export of an API function file with an async context
33
31
  * store guard. Returns the transformed code, or `null` if the file does not
@@ -38,7 +36,5 @@ export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
38
36
  * function so it can be applied from build pipelines that don't go through
39
37
  * Vite's plugin pipeline (e.g. the legacy esbuild API build).
40
38
  */
41
- export declare function applyHandlerAlsWrapping(code: string, { projectIsEsm }?: {
42
- projectIsEsm?: boolean;
43
- }): string | null;
39
+ export declare function applyHandlerAlsWrapping(code: string): string | null;
44
40
  //# sourceMappingURL=vite-plugin-handler-als-wrapping.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAoB,GACrB,GAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAuBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CAsDf"}
1
+ {"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAuBjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkDnE"}
@@ -1,9 +1,7 @@
1
1
  import path from "node:path";
2
2
  import { normalizePath } from "vite";
3
3
  import { getPaths } from "@cedarjs/project-config";
4
- function handlerAlsWrappingPlugin({
5
- projectIsEsm = false
6
- } = {}) {
4
+ function handlerAlsWrappingPlugin() {
7
5
  return {
8
6
  name: "handler-als-wrapping",
9
7
  transform(code, id) {
@@ -17,12 +15,12 @@ function handlerAlsWrappingPlugin({
17
15
  if (!normalizePath(id).startsWith(functionsDir + "/")) {
18
16
  return null;
19
17
  }
20
- const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
18
+ const wrapped = applyHandlerAlsWrapping(code);
21
19
  return wrapped ? { code: wrapped, map: null } : null;
22
20
  }
23
21
  };
24
22
  }
25
- function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
23
+ function applyHandlerAlsWrapping(code) {
26
24
  const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
27
25
  const handlerMatch = handlerRe.exec(code);
28
26
  if (!handlerMatch) {
@@ -30,8 +28,7 @@ function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
30
28
  }
31
29
  const afterEquals = code.slice(handlerMatch.index + handlerMatch[0].length).trimStart();
32
30
  const isAsync = /^async(?:\s*[\(\*]|\s+function)/.test(afterEquals);
33
- const storePath = projectIsEsm ? "@cedarjs/context/dist/store.js" : "@cedarjs/context/dist/store";
34
- const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '${storePath}'
31
+ const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store.js'
35
32
  `;
36
33
  const handlerStart = handlerMatch.index;
37
34
  const before = code.slice(0, handlerStart);
@@ -67,7 +67,7 @@ async function runFeServer() {
67
67
  "/assets",
68
68
  express.static(rwPaths.web.distBrowser + "/assets", { index: false })
69
69
  );
70
- app.use("*", (req, _res, next) => {
70
+ app.use((req, _res, next) => {
71
71
  const fullUrl = getFullUrl(req, rscEnabled);
72
72
  const headers = convertExpressHeaders(req.headersDistinct);
73
73
  const perReqStore = createPerRequestMap({ headers, fullUrl });
@@ -99,8 +99,8 @@ async function runFeServer() {
99
99
  getStylesheetLinks,
100
100
  getMiddlewareRouter: async () => middlewareRouter
101
101
  });
102
- app.get("*", createServerAdapter(routeHandler));
103
- app.post("*", handleWithMiddleware());
102
+ app.get("/{*splat}", createServerAdapter(routeHandler));
103
+ app.post("/{*splat}", handleWithMiddleware());
104
104
  app.listen(rwConfig.web.port);
105
105
  console.log(
106
106
  `Started production FE server on http://localhost:${rwConfig.web.port}`
@@ -3,9 +3,14 @@ import type { ServerAuthState } from '@cedarjs/auth/dist/AuthProvider/ServerAuth
3
3
  import type { TagDescriptor } from '@cedarjs/web';
4
4
  import type { MiddlewareResponse } from '@cedarjs/web/middleware';
5
5
  import type { ServerEntryType } from '../types.js';
6
+ interface FallbackDocumentProps {
7
+ css: string[];
8
+ meta: TagDescriptor[];
9
+ children?: React.ReactNode;
10
+ }
6
11
  interface RenderToStreamArgs {
7
12
  ServerEntry: ServerEntryType;
8
- FallbackDocument: React.FunctionComponent;
13
+ FallbackDocument: React.FunctionComponent<FallbackDocumentProps>;
9
14
  currentUrl: URL;
10
15
  metaTags: TagDescriptor[];
11
16
  cssLinks: string[];
@@ -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,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AAE,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"}
@@ -137,7 +137,7 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
137
137
  console.error("\u{1F53B} Failed to render shell");
138
138
  streamOptions.onError?.(e);
139
139
  const fallbackShell = await renderToReadableStream(
140
- FallbackDocument({
140
+ createElement(FallbackDocument, {
141
141
  children: null,
142
142
  css: cssLinks,
143
143
  meta: metaTags
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "6.0.2",
3
+ "version": "6.0.3-next.227",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,22 +48,24 @@
48
48
  "test:watch": "vitest watch"
49
49
  },
50
50
  "dependencies": {
51
+ "@babel/core": "^7.26.10",
51
52
  "@babel/generator": "7.29.8",
52
53
  "@babel/parser": "7.29.8",
54
+ "@babel/preset-typescript": "7.29.7",
53
55
  "@babel/traverse": "7.29.8",
54
56
  "@babel/types": "7.29.8",
55
- "@cedarjs/api": "6.0.2",
56
- "@cedarjs/api-server": "6.0.2",
57
- "@cedarjs/babel-config": "6.0.2",
58
- "@cedarjs/context": "6.0.2",
59
- "@cedarjs/graphql-server": "6.0.2",
60
- "@cedarjs/internal": "6.0.2",
61
- "@cedarjs/jobs": "6.0.2",
62
- "@cedarjs/project-config": "6.0.2",
63
- "@cedarjs/server-store": "6.0.2",
64
- "@cedarjs/structure": "6.0.2",
65
- "@cedarjs/testing": "6.0.2",
66
- "@swc/core": "1.16.1",
57
+ "@cedarjs/api": "6.0.3-next.227",
58
+ "@cedarjs/api-server": "6.0.3-next.227",
59
+ "@cedarjs/babel-config": "6.0.3-next.227",
60
+ "@cedarjs/context": "6.0.3-next.227",
61
+ "@cedarjs/graphql-server": "6.0.3-next.227",
62
+ "@cedarjs/internal": "6.0.3-next.227",
63
+ "@cedarjs/jobs": "6.0.3-next.227",
64
+ "@cedarjs/project-config": "6.0.3-next.227",
65
+ "@cedarjs/server-store": "6.0.3-next.227",
66
+ "@cedarjs/structure": "6.0.3-next.227",
67
+ "@cedarjs/testing": "6.0.3-next.227",
68
+ "@swc/core": "1.16.2",
67
69
  "@universal-deploy/store": "^0.2.1",
68
70
  "@universal-deploy/vite": "^0.1.9",
69
71
  "@vitejs/plugin-react": "4.7.0",
@@ -74,14 +76,14 @@
74
76
  "ansis": "4.3.1",
75
77
  "busboy": "^1.6.0",
76
78
  "dotenv-defaults": "5.0.2",
77
- "express": "4.22.2",
79
+ "express": "5.2.1",
78
80
  "fast-glob": "3.3.3",
79
81
  "find-my-way": "9.9.0",
80
82
  "http-proxy-middleware": "3.0.7",
81
83
  "isbot": "5.2.2",
82
84
  "magic-string": "0.30.21",
83
- "oxc-parser": "0.148.0",
84
- "react-server-dom-webpack": "19.2.7",
85
+ "oxc-parser": "0.149.0",
86
+ "react-server-dom-webpack": "19.3.0",
85
87
  "unimport": "5.7.0",
86
88
  "unplugin-auto-import": "19.3.0",
87
89
  "vite": "7.3.6",
@@ -92,36 +94,36 @@
92
94
  "yargs-parser": "21.1.1"
93
95
  },
94
96
  "devDependencies": {
95
- "@cedarjs/auth": "6.0.2",
96
- "@cedarjs/framework-tools": "6.0.2",
97
- "@cedarjs/router": "6.0.2",
98
- "@cedarjs/web": "6.0.2",
97
+ "@cedarjs/auth": "6.0.3-next.227",
98
+ "@cedarjs/framework-tools": "6.0.3-next.227",
99
+ "@cedarjs/router": "6.0.3-next.227",
100
+ "@cedarjs/web": "6.0.3-next.227",
99
101
  "@dr.pogodin/react-helmet": "2.0.4",
100
102
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
101
103
  "@jridgewell/trace-mapping": "0.3.31",
102
- "@oxc-project/types": "^0.147.0",
104
+ "@oxc-project/types": "^0.149.0",
103
105
  "@types/aws-lambda": "8.10.163",
104
106
  "@types/busboy": "^1",
105
- "@types/express": "4",
106
- "@types/react": "^18.2.55",
107
+ "@types/express": "5.0.6",
108
+ "@types/react": "^19.2.0",
107
109
  "@types/ws": "^8",
108
110
  "@types/yargs-parser": "21.0.3",
109
111
  "concurrently": "9.2.4",
110
- "memfs": "4.68.2",
112
+ "memfs": "4.76.0",
111
113
  "publint": "0.3.24",
112
- "react": "18.3.1",
113
- "react-dom": "18.3.1",
114
- "rollup": "4.60.4",
114
+ "react": "19.3.0",
115
+ "react-dom": "19.3.0",
116
+ "rollup": "4.63.2",
115
117
  "ts-dedent": "2.3.0",
116
118
  "typescript": "5.9.3",
117
119
  "vitest": "4.1.11"
118
120
  },
119
121
  "peerDependencies": {
120
- "@cedarjs/auth": "6.0.2",
121
- "@cedarjs/router": "6.0.2",
122
- "@cedarjs/web": "6.0.2",
123
- "react": "18.3.1",
124
- "react-dom": "18.3.1"
122
+ "@cedarjs/auth": "6.0.3-next.227",
123
+ "@cedarjs/router": "6.0.3-next.227",
124
+ "@cedarjs/web": "6.0.3-next.227",
125
+ "react": "19.3.0",
126
+ "react-dom": "19.3.0"
125
127
  },
126
128
  "engines": {
127
129
  "node": ">=24"
@@ -1,6 +0,0 @@
1
- import type { PluginOption } from 'vite';
2
- /**
3
- * This is a vite plugin to load and transform JS files as JSX.
4
- */
5
- export declare function cedarTransformJsAsJsx(): PluginOption;
6
- //# sourceMappingURL=vite-plugin-jsx-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin-jsx-loader.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-jsx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAGxC;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,YAAY,CAgBpD"}
@@ -1,18 +0,0 @@
1
- import { transformWithEsbuild } from "vite";
2
- function cedarTransformJsAsJsx() {
3
- return {
4
- name: "transform-js-files-as-jsx",
5
- async transform(code, id) {
6
- if (!id.match(/src\/.*\.js$/)) {
7
- return null;
8
- }
9
- return transformWithEsbuild(code, id, {
10
- loader: "jsx",
11
- jsx: "automatic"
12
- });
13
- }
14
- };
15
- }
16
- export {
17
- cedarTransformJsAsJsx
18
- };