@cedarjs/vite 7.0.0 → 7.0.1-next.305

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.
@@ -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,6 +19,7 @@ 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 { cedarParsedScalarsPlugin } from './plugins/vite-plugin-cedar-parsed-scalars.js';
22
23
  export { cedarMergedConfig } from './plugins/vite-plugin-merged-config.js';
23
24
  export { cedarSwapApolloProvider } from './plugins/vite-plugin-swap-apollo-provider.js';
24
25
  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,MAA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AA8C,CAAA;AAC/E,OAAO,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,wBAAwB,EAAE,MAAM,+CAA+C,CAAA;AACxF,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,CAgDzE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
20
20
  import { cedarEntryInjectionPlugin } from "./plugins/vite-plugin-cedar-entry-injection.js";
21
21
  import { cedarHtmlEnvPlugin } from "./plugins/vite-plugin-cedar-html-env.js";
22
22
  import { cedarMockCellDataPlugin } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
23
+ import { cedarParsedScalarsPlugin } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
23
24
  import { cedarRemoveDevFatalErrorPage } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
24
25
  import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
25
26
  import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
@@ -49,6 +50,7 @@ import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-
49
50
  import { cedarjsResolveCedarStyleImportsPlugin as cedarjsResolveCedarStyleImportsPlugin2 } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
50
51
  import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
51
52
  import { cedarMockCellDataPlugin as cedarMockCellDataPlugin2 } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
53
+ import { cedarParsedScalarsPlugin as cedarParsedScalarsPlugin2 } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
52
54
  import { cedarMergedConfig as cedarMergedConfig2 } from "./plugins/vite-plugin-merged-config.js";
53
55
  import { cedarSwapApolloProvider as cedarSwapApolloProvider2 } from "./plugins/vite-plugin-swap-apollo-provider.js";
54
56
  import { cedarUniversalDeployPlugin } from "./plugins/vite-plugin-cedar-universal-deploy.js";
@@ -79,6 +81,7 @@ function cedar({ mode, babel } = {}) {
79
81
  cedarMergedConfig(),
80
82
  cedarjsResolveCedarStyleImportsPlugin(),
81
83
  cedarSwapApolloProvider(),
84
+ cedarParsedScalarsPlugin(),
82
85
  cedarCellTransform(),
83
86
  cedarRemoveFromBundle(),
84
87
  cedarRemoveDevFatalErrorPage(),
@@ -107,6 +110,7 @@ export {
107
110
  cedarMergedConfig2 as cedarMergedConfig,
108
111
  cedarMockCellDataPlugin2 as cedarMockCellDataPlugin,
109
112
  cedarOtelWrappingPlugin,
113
+ cedarParsedScalarsPlugin2 as cedarParsedScalarsPlugin,
110
114
  cedarRemoveDevFatalErrorPage2 as cedarRemoveDevFatalErrorPage,
111
115
  cedarRemoveFromBundle2 as cedarRemoveFromBundle,
112
116
  cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
@@ -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);
@@ -0,0 +1,20 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Gives `CedarApolloProvider` the cache config for the scalars in
4
+ * `graphql.parsedScalars` in `cedar.toml`. Does nothing when no scalar is set
5
+ * to be parsed.
6
+ *
7
+ * The config comes from the project's generated GraphQL schema, so it is built
8
+ * into the virtual module `virtual:cedar-parsed-scalars` rather than into the
9
+ * provider, which is a published package that Vite pre-bundles in dev. The
10
+ * module puts the config on `globalThis.__CEDAR__PARSED_SCALARS`, where the
11
+ * provider reads it when it creates the cache, and `App` and the web test
12
+ * setup file import the module so that every entry point that renders the
13
+ * provider has it. The module is a
14
+ * dependency of the generated schema file, so a change to the schema reloads
15
+ * the app. The generated schema is only read, and `graphql` and its schema
16
+ * loader only imported, when the virtual module is actually resolved, so a
17
+ * project that doesn't use this setting doesn't pay for loading them.
18
+ */
19
+ export declare function cedarParsedScalarsPlugin(): Plugin | undefined;
20
+ //# sourceMappingURL=vite-plugin-cedar-parsed-scalars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-cedar-parsed-scalars.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-parsed-scalars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAclC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,SAAS,CA4E7D"}
@@ -0,0 +1,60 @@
1
+ import { normalizePath } from "vite";
2
+ import { getParsedScalars, getPaths } from "@cedarjs/project-config";
3
+ const VIRTUAL_MODULE_ID = "virtual:cedar-parsed-scalars";
4
+ const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
5
+ const APP_FILE_REGEXP = /web[\\/]src[\\/]App\.(ts|tsx|js|jsx)$/;
6
+ const VITEST_WEB_SETUP_FILE_REGEXP = /[\\/]vitest-web\.setup\.(ts|js)$/;
7
+ function cedarParsedScalarsPlugin() {
8
+ if (Object.keys(getParsedScalars()).length === 0) {
9
+ return void 0;
10
+ }
11
+ return {
12
+ name: "cedar-parsed-scalars",
13
+ resolveId(id) {
14
+ if (id === VIRTUAL_MODULE_ID) {
15
+ return RESOLVED_VIRTUAL_MODULE_ID;
16
+ }
17
+ return null;
18
+ },
19
+ async load(id) {
20
+ if (id !== RESOLVED_VIRTUAL_MODULE_ID) {
21
+ return null;
22
+ }
23
+ this.addWatchFile(getPaths().generated.schema);
24
+ const { loadParsedScalarsCacheConfig } = await import("@cedarjs/internal/dist/generate/parsedScalars.js");
25
+ const config = loadParsedScalarsCacheConfig();
26
+ return `globalThis.__CEDAR__PARSED_SCALARS = ${JSON.stringify(config)}`;
27
+ },
28
+ transform(code, id) {
29
+ if (!APP_FILE_REGEXP.test(id) && !VITEST_WEB_SETUP_FILE_REGEXP.test(id)) {
30
+ return null;
31
+ }
32
+ return `import '${VIRTUAL_MODULE_ID}'
33
+ ${code}`;
34
+ },
35
+ // `this.addWatchFile` in `load` only reruns the virtual module for a
36
+ // change to a file it has already watched. The schema doesn't exist yet
37
+ // on a clean `cedar dev` (the web server and `cedar-gen-watch` start
38
+ // concurrently), so its first appearance is a 'create' event on a path
39
+ // nothing has watched yet, and reaches here without an `addWatchFile`
40
+ // call ever having registered it. Reload the virtual module for exactly
41
+ // that file, on every event type, so the app picks up the first schema
42
+ // once `cedar-gen-watch` writes it, the same way it already does for a
43
+ // later edit.
44
+ hotUpdate(options) {
45
+ if (options.file !== normalizePath(getPaths().generated.schema)) {
46
+ return;
47
+ }
48
+ const moduleGraph = this.environment.moduleGraph;
49
+ const module = moduleGraph.getModuleById(RESOLVED_VIRTUAL_MODULE_ID);
50
+ if (!module) {
51
+ return;
52
+ }
53
+ moduleGraph.invalidateModule(module);
54
+ return [module];
55
+ }
56
+ };
57
+ }
58
+ export {
59
+ cedarParsedScalarsPlugin
60
+ };
@@ -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,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"}
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,qBAAqB;IAC7B,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,IAAI,EAAE,aAAa,EAAE,CAAA;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,UAAU,kBAAkB;IAC1B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAA;IAChE,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"}
@@ -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": "7.0.0",
3
+ "version": "7.0.1-next.305",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,40 +48,42 @@
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.9",
54
+ "@babel/preset-typescript": "7.29.7",
53
55
  "@babel/traverse": "7.29.8",
54
56
  "@babel/types": "7.29.8",
55
- "@cedarjs/api": "7.0.0",
56
- "@cedarjs/api-server": "7.0.0",
57
- "@cedarjs/babel-config": "7.0.0",
58
- "@cedarjs/context": "7.0.0",
59
- "@cedarjs/graphql-server": "7.0.0",
60
- "@cedarjs/internal": "7.0.0",
61
- "@cedarjs/jobs": "7.0.0",
62
- "@cedarjs/project-config": "7.0.0",
63
- "@cedarjs/server-store": "7.0.0",
64
- "@cedarjs/structure": "7.0.0",
65
- "@cedarjs/testing": "7.0.0",
57
+ "@cedarjs/api": "7.0.1-next.305",
58
+ "@cedarjs/api-server": "7.0.1-next.305",
59
+ "@cedarjs/babel-config": "7.0.1-next.305",
60
+ "@cedarjs/context": "7.0.1-next.305",
61
+ "@cedarjs/graphql-server": "7.0.1-next.305",
62
+ "@cedarjs/internal": "7.0.1-next.305",
63
+ "@cedarjs/jobs": "7.0.1-next.305",
64
+ "@cedarjs/project-config": "7.0.1-next.305",
65
+ "@cedarjs/server-store": "7.0.1-next.305",
66
+ "@cedarjs/structure": "7.0.1-next.305",
67
+ "@cedarjs/testing": "7.0.1-next.305",
66
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",
70
- "@whatwg-node/fetch": "0.10.13",
71
- "@whatwg-node/server": "0.11.0",
72
+ "@whatwg-node/fetch": "0.12.0",
73
+ "@whatwg-node/server": "0.13.0",
72
74
  "acorn": "8.18.0",
73
75
  "acorn-loose": "8.5.2",
74
76
  "ansis": "4.4.0",
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
85
  "oxc-parser": "0.151.0",
84
- "react-server-dom-webpack": "19.2.8",
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": "7.0.0",
96
- "@cedarjs/framework-tools": "7.0.0",
97
- "@cedarjs/router": "7.0.0",
98
- "@cedarjs/web": "7.0.0",
97
+ "@cedarjs/auth": "7.0.1-next.305",
98
+ "@cedarjs/framework-tools": "7.0.1-next.305",
99
+ "@cedarjs/router": "7.0.1-next.305",
100
+ "@cedarjs/web": "7.0.1-next.305",
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
104
  "@oxc-project/types": "^0.151.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.78.1",
112
+ "memfs": "4.79.0",
111
113
  "publint": "0.3.24",
112
- "react": "18.3.1",
113
- "react-dom": "18.3.1",
114
+ "react": "19.3.0",
115
+ "react-dom": "19.3.0",
114
116
  "rollup": "4.63.4",
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": "7.0.0",
121
- "@cedarjs/router": "7.0.0",
122
- "@cedarjs/web": "7.0.0",
123
- "react": "18.3.1",
124
- "react-dom": "18.3.1"
122
+ "@cedarjs/auth": "7.0.1-next.305",
123
+ "@cedarjs/router": "7.0.1-next.305",
124
+ "@cedarjs/web": "7.0.1-next.305",
125
+ "react": "19.3.0",
126
+ "react-dom": "19.3.0"
125
127
  },
126
128
  "engines": {
127
129
  "node": ">=24"