@cedarjs/vite 5.0.4-next.167 → 5.0.4

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 (143) hide show
  1. package/dist/api/vite-plugin-cedar-vitest-api-preset.d.ts.map +1 -1
  2. package/dist/api/vite-plugin-cedar-vitest-api-preset.js +0 -4
  3. package/dist/apiDevMiddleware.d.ts.map +1 -1
  4. package/dist/apiDevMiddleware.js +9 -105
  5. package/dist/buildApp.d.ts.map +1 -1
  6. package/dist/buildApp.js +18 -79
  7. package/dist/buildRouteHooks.d.ts.map +1 -1
  8. package/dist/buildRouteHooks.js +4 -36
  9. package/dist/bundled/react-server-dom-webpack.server.js +99 -192
  10. package/dist/cedar-unified-dev.d.ts +0 -18
  11. package/dist/cedar-unified-dev.d.ts.map +1 -1
  12. package/dist/cedar-unified-dev.js +5 -39
  13. package/dist/cjs/ClientRouter.d.ts +1 -0
  14. package/dist/cjs/api/vite-plugin-cedar-vitest-api-preset.js +37 -0
  15. package/dist/cjs/apiDevMiddleware.js +371 -0
  16. package/dist/cjs/build/build.d.ts +1 -0
  17. package/dist/cjs/build/build.js +58 -0
  18. package/dist/cjs/buildApp.js +306 -0
  19. package/dist/cjs/buildFeServer.d.ts +1 -0
  20. package/dist/cjs/buildFeServer.js +63 -0
  21. package/dist/cjs/buildRouteHooks.js +80 -0
  22. package/dist/cjs/buildRouteManifest.js +92 -0
  23. package/dist/cjs/buildRscClientAndServer.js +54 -0
  24. package/dist/cjs/cedar-unified-dev.js +310 -0
  25. package/dist/cjs/client.d.ts +1 -0
  26. package/dist/cjs/clientSsr.d.ts +1 -0
  27. package/dist/cjs/devFeServer.js +157 -0
  28. package/dist/cjs/index.d.ts +1 -0
  29. package/dist/cjs/index.js +141 -0
  30. package/dist/cjs/lib/StatusError.js +37 -0
  31. package/dist/cjs/lib/entries.js +52 -0
  32. package/dist/cjs/lib/getMergedConfig.js +185 -0
  33. package/dist/cjs/lib/onWarn.js +36 -0
  34. package/dist/cjs/lib/registerFwGlobalsAndShims.js +102 -0
  35. package/dist/cjs/lib/workspacePackageAliases.js +107 -0
  36. package/dist/cjs/middleware/index.js +22 -0
  37. package/dist/cjs/middleware/invokeMiddleware.js +52 -0
  38. package/dist/cjs/middleware/register.js +105 -0
  39. package/dist/cjs/middleware/types.js +16 -0
  40. package/dist/cjs/package.json +1 -0
  41. package/dist/cjs/plugins/vite-plugin-cedar-auto-import.js +107 -0
  42. package/dist/cjs/plugins/vite-plugin-cedar-cell.js +183 -0
  43. package/dist/cjs/plugins/vite-plugin-cedar-cjs-compat.js +341 -0
  44. package/dist/cjs/plugins/vite-plugin-cedar-context-wrapping.js +95 -0
  45. package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +107 -0
  46. package/dist/cjs/plugins/vite-plugin-cedar-html-env.js +67 -0
  47. package/dist/cjs/plugins/vite-plugin-cedar-import-dir.js +118 -0
  48. package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +43 -0
  49. package/dist/cjs/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +61 -0
  50. package/dist/cjs/plugins/vite-plugin-cedar-remove-from-bundle.js +76 -0
  51. package/dist/cjs/plugins/vite-plugin-cedar-routes-auto-loader.js +126 -0
  52. package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +346 -0
  53. package/dist/cjs/plugins/vite-plugin-cedar-wait-for-api-server.js +134 -0
  54. package/dist/cjs/plugins/vite-plugin-cedarjs-job-path-injector.js +134 -0
  55. package/dist/cjs/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +106 -0
  56. package/dist/cjs/plugins/vite-plugin-jsx-loader.js +42 -0
  57. package/dist/cjs/plugins/vite-plugin-merged-config.js +39 -0
  58. package/dist/cjs/plugins/vite-plugin-rsc-analyze.js +104 -0
  59. package/dist/cjs/plugins/vite-plugin-rsc-reload.js +75 -0
  60. package/dist/cjs/plugins/vite-plugin-rsc-routes-auto-loader.js +159 -0
  61. package/dist/cjs/plugins/vite-plugin-rsc-routes-imports.js +125 -0
  62. package/dist/cjs/plugins/vite-plugin-rsc-ssr-router-import.js +75 -0
  63. package/dist/cjs/plugins/vite-plugin-rsc-transform-client.js +228 -0
  64. package/dist/cjs/plugins/vite-plugin-rsc-transform-server.js +398 -0
  65. package/dist/cjs/plugins/vite-plugin-swap-apollo-provider.js +46 -0
  66. package/dist/cjs/rsc/rscBuildAnalyze.js +126 -0
  67. package/dist/cjs/rsc/rscBuildClient.js +91 -0
  68. package/dist/cjs/rsc/rscBuildCopyCssAssets.js +56 -0
  69. package/dist/cjs/rsc/rscBuildEntriesFile.js +115 -0
  70. package/dist/cjs/rsc/rscBuildForServer.js +168 -0
  71. package/dist/cjs/rsc/rscBuildForSsr.js +173 -0
  72. package/dist/cjs/rsc/rscBuildRwEnvVars.js +56 -0
  73. package/dist/cjs/rsc/rscRenderer.js +165 -0
  74. package/dist/cjs/rsc/rscRequestHandler.js +162 -0
  75. package/dist/cjs/rsc/rscStudioHandlers.js +156 -0
  76. package/dist/cjs/runFeServer.js +165 -0
  77. package/dist/cjs/streaming/buildForStreamingServer.js +65 -0
  78. package/dist/cjs/streaming/collectCss.js +52 -0
  79. package/dist/cjs/streaming/createReactStreamingHandler.js +173 -0
  80. package/dist/cjs/streaming/streamHelpers.js +230 -0
  81. package/dist/cjs/streaming/transforms/bufferedTransform.js +61 -0
  82. package/dist/cjs/streaming/transforms/cancelTimeoutTransform.js +34 -0
  83. package/dist/cjs/streaming/transforms/encode-decode.js +36 -0
  84. package/dist/cjs/streaming/transforms/serverInjectionTransform.js +84 -0
  85. package/dist/cjs/streaming/triggerRouteHooks.js +96 -0
  86. package/dist/cjs/types.js +16 -0
  87. package/dist/cjs/utils.js +92 -0
  88. package/dist/devFeServer.js +8 -3
  89. package/dist/index.d.ts +4 -10
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +19 -45
  92. package/dist/lib/getMergedConfig.d.ts.map +1 -1
  93. package/dist/lib/getMergedConfig.js +0 -4
  94. package/dist/package.json +1 -0
  95. package/dist/plugins/vite-plugin-cedar-auto-import.d.ts +1 -1
  96. package/dist/plugins/vite-plugin-cedar-auto-import.d.ts.map +1 -1
  97. package/dist/plugins/vite-plugin-cedar-auto-import.js +1 -8
  98. package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
  99. package/dist/plugins/vite-plugin-cedar-cell.js +1 -2
  100. package/dist/plugins/{vite-plugin-handler-als-wrapping.d.ts → vite-plugin-cedar-context-wrapping.d.ts} +12 -12
  101. package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +1 -0
  102. package/dist/plugins/{vite-plugin-handler-als-wrapping.js → vite-plugin-cedar-context-wrapping.js} +16 -16
  103. package/dist/plugins/vite-plugin-cedar-import-dir.d.ts.map +1 -1
  104. package/dist/plugins/vite-plugin-cedar-import-dir.js +15 -33
  105. package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +3 -0
  106. package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +1 -0
  107. package/dist/plugins/vite-plugin-cedar-node-polyfills.js +19 -0
  108. package/dist/plugins/vite-plugin-cedar-universal-deploy.js +1 -1
  109. package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts.map +1 -1
  110. package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +0 -14
  111. package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts +0 -3
  112. package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts.map +1 -1
  113. package/dist/plugins/vite-plugin-swap-apollo-provider.js +2 -2
  114. package/dist/rsc/rscBuildForSsr.d.ts.map +1 -1
  115. package/dist/rsc/rscBuildForSsr.js +5 -3
  116. package/dist/streaming/buildForStreamingServer.d.ts.map +1 -1
  117. package/dist/streaming/buildForStreamingServer.js +5 -3
  118. package/package.json +52 -42
  119. package/dist/lib/generateDiffSourceMap.d.ts +0 -18
  120. package/dist/lib/generateDiffSourceMap.d.ts.map +0 -1
  121. package/dist/lib/generateDiffSourceMap.js +0 -151
  122. package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts +0 -3
  123. package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts.map +0 -1
  124. package/dist/plugins/vite-plugin-cedar-data-uri-shim.js +0 -43
  125. package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts +0 -12
  126. package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts.map +0 -1
  127. package/dist/plugins/vite-plugin-cedar-directory-named-import.js +0 -35
  128. package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts +0 -29
  129. package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts.map +0 -1
  130. package/dist/plugins/vite-plugin-cedar-gqlorm-inject.js +0 -76
  131. package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +0 -42
  132. package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +0 -1
  133. package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +0 -93
  134. package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +0 -28
  135. package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +0 -1
  136. package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +0 -67
  137. package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts +0 -28
  138. package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +0 -1
  139. package/dist/plugins/vite-plugin-cedar-mock-cell-data.js +0 -247
  140. package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts +0 -39
  141. package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts.map +0 -1
  142. package/dist/plugins/vite-plugin-cedar-otel-wrapping.js +0 -200
  143. package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import path from "node:path";
2
2
  import { normalizePath } from "vite";
3
3
  import { getPaths } from "@cedarjs/project-config";
4
- function handlerAlsWrappingPlugin({
4
+ function cedarContextWrappingPlugin({
5
5
  projectIsEsm = false
6
6
  } = {}) {
7
7
  return {
8
- name: "handler-als-wrapping",
8
+ name: "cedar-context-wrapping",
9
9
  transform(code, id) {
10
10
  let paths;
11
11
  try {
@@ -17,12 +17,12 @@ function handlerAlsWrappingPlugin({
17
17
  if (!normalizePath(id).startsWith(functionsDir + "/")) {
18
18
  return null;
19
19
  }
20
- const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
20
+ const wrapped = applyContextWrapping(code, { projectIsEsm });
21
21
  return wrapped ? { code: wrapped, map: null } : null;
22
22
  }
23
23
  };
24
24
  }
25
- function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
25
+ function applyContextWrapping(code, { projectIsEsm = false } = {}) {
26
26
  const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
27
27
  const handlerMatch = handlerRe.exec(code);
28
28
  if (!handlerMatch) {
@@ -31,30 +31,30 @@ function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
31
31
  const afterEquals = code.slice(handlerMatch.index + handlerMatch[0].length).trimStart();
32
32
  const isAsync = /^async(?:\s*[\(\*]|\s+function)/.test(afterEquals);
33
33
  const storePath = projectIsEsm ? "@cedarjs/context/dist/store.js" : "@cedarjs/context/dist/store";
34
- const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '${storePath}'
34
+ const importStatement = `import { getAsyncStoreInstance as __rw_getAsyncStoreInstance } from '${storePath}'
35
35
  `;
36
36
  const handlerStart = handlerMatch.index;
37
37
  const before = code.slice(0, handlerStart);
38
38
  const after = code.slice(handlerStart);
39
- const renamed = after.replace(handlerRe, "const __cedar_handler =");
39
+ const renamed = after.replace(handlerRe, "const __rw_handler =");
40
40
  const wrappedHandler = `
41
- export const handler = ${isAsync ? "async " : ""}(__cedar_event, __cedar_context) => {
41
+ export const handler = ${isAsync ? "async " : ""}(__rw_event, __rw__context) => {
42
42
  // The store will be undefined if no context isolation has been performed yet
43
- const __cedar_contextStore = __cedar_getAsyncStoreInstance().getStore()
44
- if (__cedar_contextStore === undefined) {
45
- return __cedar_getAsyncStoreInstance().run(
43
+ const __rw_contextStore = __rw_getAsyncStoreInstance().getStore()
44
+ if (__rw_contextStore === undefined) {
45
+ return __rw_getAsyncStoreInstance().run(
46
46
  new Map(),
47
- __cedar_handler,
48
- __cedar_event,
49
- __cedar_context
47
+ __rw_handler,
48
+ __rw_event,
49
+ __rw__context
50
50
  )
51
51
  }
52
- return __cedar_handler(__cedar_event, __cedar_context)
52
+ return __rw_handler(__rw_event, __rw__context)
53
53
  }
54
54
  `;
55
55
  return before + importStatement + renamed + wrappedHandler;
56
56
  }
57
57
  export {
58
- applyHandlerAlsWrapping,
59
- handlerAlsWrappingPlugin
58
+ applyContextWrapping,
59
+ cedarContextWrappingPlugin
60
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-cedar-import-dir.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-import-dir.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAqI7C"}
1
+ {"version":3,"file":"vite-plugin-cedar-import-dir.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-import-dir.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAgH7C"}
@@ -1,8 +1,6 @@
1
- import fs from "node:fs";
2
1
  import path from "node:path";
3
2
  import { parse, Lang } from "@ast-grep/napi";
4
- import MagicString from "magic-string";
5
- import { normalizePath } from "vite";
3
+ import fg from "fast-glob";
6
4
  import { importStatementPath, getPaths } from "@cedarjs/project-config";
7
5
  function cedarImportDirPlugin() {
8
6
  return {
@@ -24,7 +22,7 @@ function cedarImportDirPlugin() {
24
22
  }
25
23
  const root = ast.root();
26
24
  let hasTransformations = false;
27
- const s = new MagicString(code);
25
+ const edits = [];
28
26
  const globImports = root.findAll({
29
27
  rule: {
30
28
  pattern: "import $DEFAULT_IMPORT from $SOURCE"
@@ -43,37 +41,20 @@ function cedarImportDirPlugin() {
43
41
  hasTransformations = true;
44
42
  const importName = defaultImportNode.text();
45
43
  const importGlob = importStatementPath(sourceValue);
46
- let cwd = path.dirname(id);
47
- if (importGlob.startsWith("src/")) {
48
- const normalizedId = normalizePath(id);
49
- const apiBase = normalizePath(getPaths().api.base);
50
- const webBase = normalizePath(getPaths().web.base);
51
- if (normalizedId.startsWith(apiBase)) {
52
- cwd = getPaths().api.base;
53
- } else if (normalizedId.startsWith(webBase)) {
54
- cwd = getPaths().web.base;
55
- } else {
56
- throw new Error(`Unexpected file location: ${id}`);
57
- }
58
- }
44
+ const cwd = importGlob.startsWith("src/") ? getPaths().api.base : path.dirname(id);
59
45
  try {
60
- const dirFiles = fs.globSync(importGlob, {
61
- cwd,
62
- exclude: (n) => n.includes(".test.") || n.includes(".scenarios.") || n.includes(".d.ts")
63
- });
46
+ const dirFiles = fg.sync(importGlob, { cwd }).filter(
47
+ (n) => !n.includes(".test.") && !n.includes(".scenarios.") && !n.includes(".d.ts")
48
+ );
64
49
  const staticGlob = importGlob.split("*")[0];
65
50
  const filePathToVarName = (filePath) => {
66
- const normalizedPath = normalizePath(filePath);
67
- return normalizedPath.replace(staticGlob, "").replace(/\.(js|ts)$/, "").replace(/[^a-zA-Z0-9]/g, "_");
51
+ return filePath.replace(staticGlob, "").replace(/\.(js|ts)$/, "").replace(/[^a-zA-Z0-9]/g, "_");
68
52
  };
69
53
  let replacement = `let ${importName} = {};
70
54
  `;
71
55
  for (const filePath of dirFiles) {
72
- const normalizedPath = normalizePath(filePath);
73
- const lastSlash = normalizedPath.lastIndexOf("/");
74
- const fileDir = lastSlash >= 0 ? normalizedPath.slice(0, lastSlash) : "";
75
- const fileName = normalizedPath.slice(lastSlash + 1).replace(/\.\w+$/, "");
76
- const fileImportPath = fileDir ? fileDir + "/" + fileName : fileName;
56
+ const { dir: fileDir, name: fileName } = path.parse(filePath);
57
+ const fileImportPath = fileDir + "/" + fileName;
77
58
  const filePathVarName = filePathToVarName(filePath);
78
59
  const namespaceImportName = `${importName}_${filePathVarName}`;
79
60
  replacement += `import * as ${namespaceImportName} from '${fileImportPath}';
@@ -81,16 +62,17 @@ function cedarImportDirPlugin() {
81
62
  replacement += `${importName}.${filePathVarName} = ${namespaceImportName};
82
63
  `;
83
64
  }
84
- const range = importNode.range();
85
- s.overwrite(range.start.index, range.end.index, replacement.trim());
65
+ edits.push(importNode.replace(replacement.trim()));
86
66
  } catch (error) {
87
67
  console.warn(`Failed to process glob import: ${sourceValue}`, error);
88
68
  }
89
69
  }
90
- if (hasTransformations) {
70
+ if (hasTransformations && edits.length > 0) {
71
+ const transformedCode = root.commitEdits(edits);
91
72
  return {
92
- code: s.toString(),
93
- map: s.generateMap({ hires: true })
73
+ code: transformedCode,
74
+ map: null
75
+ // For simplicity, not generating source maps
94
76
  };
95
77
  }
96
78
  return null;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare function cedarNodePolyfills(): Plugin | undefined;
3
+ //# sourceMappingURL=vite-plugin-cedar-node-polyfills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-cedar-node-polyfills.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-node-polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAiBvD"}
@@ -0,0 +1,19 @@
1
+ import { nodePolyfills } from "vite-plugin-node-polyfills";
2
+ import { getConfig } from "@cedarjs/project-config";
3
+ function cedarNodePolyfills() {
4
+ if (getConfig().experimental?.rsc?.enabled) {
5
+ return void 0;
6
+ }
7
+ return {
8
+ ...nodePolyfills({
9
+ include: ["buffer"],
10
+ globals: {
11
+ Buffer: true
12
+ }
13
+ }),
14
+ apply: "serve"
15
+ };
16
+ }
17
+ export {
18
+ cedarNodePolyfills
19
+ };
@@ -296,7 +296,7 @@ async function generateFunctionModule(distPath) {
296
296
  const ctx = await buildCedarContext(request);
297
297
  // Wrap the handler in an AsyncLocalStorage run so the global
298
298
  // @cedarjs/context is available inside it (and isolated per request).
299
- // Mirrors the GraphQL module above and the handlerAlsWrappingPlugin
299
+ // Mirrors the GraphQL module above and the cedarContextWrappingPlugin
300
300
  // used for non-UD builds.
301
301
  const { getAsyncStoreInstance } = await import(
302
302
  '@cedarjs/context/dist/store'
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiClC,wBAAgB,qCAAqC,IAAI,MAAM,CA2F9D"}
1
+ {"version":3,"file":"vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiClC,wBAAgB,qCAAqC,IAAI,MAAM,CAkE9D"}
@@ -52,20 +52,6 @@ function cedarjsResolveCedarStyleImportsPlugin() {
52
52
  }
53
53
  }
54
54
  }
55
- if (cedarPaths && id.startsWith("$api/")) {
56
- const resolved = resolveFromAbsolutePath(
57
- path.join(cedarPaths.api.base, id.slice("$api/".length))
58
- );
59
- if (resolved) {
60
- return normalizePath(resolved);
61
- }
62
- }
63
- if (cedarPaths && id.startsWith("api/")) {
64
- const resolved = resolveFromAbsolutePath(path.join(cedarPaths.base, id));
65
- if (resolved) {
66
- return normalizePath(resolved);
67
- }
68
- }
69
55
  const resolvedPath = path.resolve(path.dirname(importer), id);
70
56
  if (fs.existsSync(resolvedPath)) {
71
57
  const stats = fs.statSync(resolvedPath);
@@ -5,9 +5,6 @@ import type { Plugin } from 'vite';
5
5
  *
6
6
  * import { RedwoodApolloProvider } from "@cedarjs/web/apollo" ->
7
7
  * import { RedwoodApolloProvider } from "@cedarjs/web/dist/apollo/suspense"
8
- *
9
- * import { CedarApolloProvider } from "@cedarjs/web/apollo/CedarApolloProvider" ->
10
- * import { CedarApolloProvider } from "@cedarjs/web/dist/apollo/suspense"
11
8
  */
12
9
  export declare function cedarSwapApolloProvider(): Plugin | undefined;
13
10
  //# sourceMappingURL=vite-plugin-swap-apollo-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-swap-apollo-provider.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-swap-apollo-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAyB5D"}
1
+ {"version":3,"file":"vite-plugin-swap-apollo-provider.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-swap-apollo-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAoB5D"}
@@ -5,11 +5,11 @@ function cedarSwapApolloProvider() {
5
5
  return void 0;
6
6
  }
7
7
  return {
8
- name: "cedar-swap-apollo-provider",
8
+ name: "redwood-swap-apollo-provider",
9
9
  async transform(code, id) {
10
10
  if (/web\/src\/App\.(ts|tsx|js|jsx)$/.test(id)) {
11
11
  return code.replace(
12
- /@cedarjs\/web\/apollo(?:\/CedarApolloProvider)?/g,
12
+ "@cedarjs/web/apollo",
13
13
  "@cedarjs/web/dist/apollo/suspense"
14
14
  );
15
15
  }
@@ -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,+GA6IA"}
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,+GA+IA"}
@@ -51,9 +51,11 @@ async function rscBuildForSsr({
51
51
  plugins: [
52
52
  cjsInterop({
53
53
  dependencies: [
54
- // Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware,
55
- // rwjs/router, rwjs/auth-*-api, rwjs/auth-*-web, rwjs/forms
56
- "@cedarjs/prerender/*"
54
+ // Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware, rwjs/router
55
+ "@cedarjs/forms",
56
+ "@cedarjs/prerender/*",
57
+ "@cedarjs/auth-*-api",
58
+ "@cedarjs/auth-!(dbauth)-web"
57
59
  ]
58
60
  }),
59
61
  rscRoutesAutoLoader(),
@@ -1 +1 @@
1
- {"version":3,"file":"buildForStreamingServer.d.ts","sourceRoot":"","sources":["../../src/streaming/buildForStreamingServer.ts"],"names":[],"mappings":"AAKA,wBAAsB,uBAAuB,CAAC,EAC5C,OAAe,GAChB,EAAE;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,iBAgCA"}
1
+ {"version":3,"file":"buildForStreamingServer.d.ts","sourceRoot":"","sources":["../../src/streaming/buildForStreamingServer.ts"],"names":[],"mappings":"AAKA,wBAAsB,uBAAuB,CAAC,EAC5C,OAAe,GAChB,EAAE;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,iBAkCA"}
@@ -14,9 +14,11 @@ async function buildForStreamingServer({
14
14
  plugins: [
15
15
  cjsInterop({
16
16
  dependencies: [
17
- // Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware,
18
- // rwjs/router, rwjs/auth-*-api, rwjs/auth-*-web, rwjs/forms
19
- "@cedarjs/prerender/*"
17
+ // Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware, rwjs/router
18
+ "@cedarjs/forms",
19
+ "@cedarjs/prerender/*",
20
+ "@cedarjs/auth-*-api",
21
+ "@cedarjs/auth-!(dbauth)-web"
20
22
  ]
21
23
  })
22
24
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.4-next.167",
3
+ "version": "5.0.4",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,17 +12,27 @@
12
12
  "exports": {
13
13
  "./package.json": "./package.json",
14
14
  ".": {
15
- "default": {
15
+ "import": {
16
16
  "types": "./dist/index.d.ts",
17
17
  "default": "./dist/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./dist/cjs/index.d.ts",
21
+ "default": "./dist/cjs/index.js"
18
22
  }
19
23
  },
20
24
  "./api": {
21
25
  "types": "./dist/api/vite-plugin-cedar-vitest-api-preset.d.ts",
22
26
  "default": "./dist/api/vite-plugin-cedar-vitest-api-preset.js"
23
27
  },
24
- "./buildFeServer": "./dist/buildFeServer.js",
25
- "./build": "./dist/build/build.js",
28
+ "./buildFeServer": {
29
+ "require": "./dist/cjs/buildFeServer.js",
30
+ "import": "./dist/buildFeServer.js"
31
+ },
32
+ "./build": {
33
+ "import": "./dist/build/build.js",
34
+ "default": "./dist/cjs/build/build.js"
35
+ },
26
36
  "./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
27
37
  },
28
38
  "bin": {
@@ -39,68 +49,67 @@
39
49
  "inject"
40
50
  ],
41
51
  "scripts": {
42
- "build": "node ./build.ts",
52
+ "build": "node ./build.ts && yarn build:types",
43
53
  "build:pack": "yarn pack -o cedarjs-vite.tgz",
44
54
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
45
- "check:attw": "yarn cedar-fwtools-attw --exclude-entrypoints ./bins/cedar-vite-build.mjs",
55
+ "check:attw": "node ./attw.ts",
46
56
  "check:package": "concurrently npm:check:attw yarn:publint",
47
57
  "test": "vitest run",
48
58
  "test:watch": "vitest watch"
49
59
  },
50
60
  "dependencies": {
51
- "@ast-grep/napi": "0.45.0",
61
+ "@ast-grep/napi": "0.43.0",
52
62
  "@babel/generator": "7.29.7",
53
63
  "@babel/parser": "7.29.7",
54
64
  "@babel/traverse": "7.29.7",
55
65
  "@babel/types": "7.29.7",
56
- "@cedarjs/api": "5.0.4-next.167",
57
- "@cedarjs/api-server": "5.0.4-next.167",
58
- "@cedarjs/babel-config": "5.0.4-next.167",
59
- "@cedarjs/context": "5.0.4-next.167",
60
- "@cedarjs/graphql-server": "5.0.4-next.167",
61
- "@cedarjs/internal": "5.0.4-next.167",
62
- "@cedarjs/project-config": "5.0.4-next.167",
63
- "@cedarjs/server-store": "5.0.4-next.167",
64
- "@cedarjs/structure": "5.0.4-next.167",
65
- "@cedarjs/testing": "5.0.4-next.167",
66
- "@swc/core": "1.15.46",
66
+ "@cedarjs/api": "5.0.4",
67
+ "@cedarjs/babel-config": "5.0.4",
68
+ "@cedarjs/context": "5.0.4",
69
+ "@cedarjs/cookie-jar": "5.0.4",
70
+ "@cedarjs/graphql-server": "5.0.4",
71
+ "@cedarjs/internal": "5.0.4",
72
+ "@cedarjs/project-config": "5.0.4",
73
+ "@cedarjs/server-store": "5.0.4",
74
+ "@cedarjs/testing": "5.0.4",
75
+ "@fastify/url-data": "6.0.3",
76
+ "@swc/core": "1.15.41",
67
77
  "@universal-deploy/store": "^0.2.1",
68
78
  "@universal-deploy/vite": "^0.1.9",
69
79
  "@vitejs/plugin-react": "4.7.0",
70
80
  "@whatwg-node/fetch": "0.10.13",
71
- "@whatwg-node/server": "0.11.0",
72
- "acorn": "8.17.0",
81
+ "@whatwg-node/server": "0.10.18",
82
+ "acorn": "8.16.0",
73
83
  "acorn-loose": "8.5.2",
74
- "ansis": "4.3.1",
84
+ "ansis": "4.2.0",
85
+ "buffer": "6.0.3",
75
86
  "busboy": "^1.6.0",
87
+ "cookie": "1.1.1",
76
88
  "dotenv-defaults": "5.0.2",
89
+ "execa": "5.1.1",
77
90
  "express": "4.22.2",
78
- "fast-glob": "3.3.3",
91
+ "fastify": "5.8.5",
92
+ "fastify-raw-body": "5.0.0",
79
93
  "find-my-way": "8.2.2",
80
94
  "http-proxy-middleware": "3.0.7",
81
- "isbot": "5.2.1",
82
- "magic-string": "0.30.21",
83
- "oxc-parser": "0.141.0",
95
+ "isbot": "5.1.43",
84
96
  "react": "18.3.1",
85
- "react-server-dom-webpack": "19.2.7",
86
- "unimport": "5.7.0",
87
- "unplugin-auto-import": "19.3.0",
88
- "vite": "7.3.6",
97
+ "react-server-dom-webpack": "19.2.4",
98
+ "rimraf": "6.1.3",
99
+ "rou3": "^0.8.1",
100
+ "vite": "7.3.5",
89
101
  "vite-plugin-cjs-interop": "2.4.4",
90
- "vite-plugin-graphql-tag": "0.1.1",
91
- "vite-tsconfig-paths": "^6.1.1",
102
+ "vite-plugin-node-polyfills": "0.26.0",
92
103
  "ws": "8.20.0",
93
104
  "yargs-parser": "21.1.1"
94
105
  },
95
106
  "devDependencies": {
96
- "@cedarjs/auth": "5.0.4-next.167",
97
- "@cedarjs/framework-tools": "5.0.4-next.167",
98
- "@cedarjs/router": "5.0.4-next.167",
99
- "@cedarjs/web": "5.0.4-next.167",
100
- "@dr.pogodin/react-helmet": "2.0.4",
107
+ "@arethetypeswrong/cli": "0.18.4",
108
+ "@cedarjs/auth": "5.0.4",
109
+ "@cedarjs/router": "5.0.4",
110
+ "@cedarjs/web": "5.0.4",
101
111
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
102
112
  "@jridgewell/trace-mapping": "0.3.31",
103
- "@oxc-project/types": "^0.141.0",
104
113
  "@types/aws-lambda": "8.10.162",
105
114
  "@types/busboy": "^1",
106
115
  "@types/express": "4",
@@ -108,17 +117,18 @@
108
117
  "@types/ws": "^8",
109
118
  "@types/yargs-parser": "21.0.3",
110
119
  "concurrently": "9.2.4",
120
+ "glob": "11.1.0",
111
121
  "memfs": "4.64.0",
112
- "publint": "0.3.22",
122
+ "publint": "0.3.21",
113
123
  "rollup": "4.60.4",
114
124
  "ts-dedent": "2.3.0",
115
125
  "typescript": "5.9.3",
116
- "vitest": "4.1.10"
126
+ "vitest": "3.2.6"
117
127
  },
118
128
  "peerDependencies": {
119
- "@cedarjs/auth": "5.0.4-next.167",
120
- "@cedarjs/router": "5.0.4-next.167",
121
- "@cedarjs/web": "5.0.4-next.167"
129
+ "@cedarjs/auth": "5.0.4",
130
+ "@cedarjs/router": "5.0.4",
131
+ "@cedarjs/web": "5.0.4"
122
132
  },
123
133
  "engines": {
124
134
  "node": ">=24"
@@ -1,18 +0,0 @@
1
- import type { SourceMap } from 'magic-string';
2
- /**
3
- * Generates a sourcemap for a string transform by diffing its input and
4
- * output. Used for transforms that don't produce a map themselves.
5
- *
6
- * The diff first anchors on the common prefix and suffix lines, then aligns
7
- * the remaining lines with an LCS so that unchanged lines *inside* the
8
- * changed region (e.g. statements inside a newly inserted wrapper) also map
9
- * exactly. Aligned line pairs that differ are refined with a character-level
10
- * prefix/suffix diff, which gives exact column mappings for in-place
11
- * rewrites (e.g. import specifier rewrites) — including the columns after
12
- * the rewritten span. Only lines with no counterpart at all map coarsely, to
13
- * the start of their surrounding edit.
14
- *
15
- * Returns null when the input and output are identical.
16
- */
17
- export declare function generateDiffSourceMap(original: string, transformed: string): SourceMap | null;
18
- //# sourceMappingURL=generateDiffSourceMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateDiffSourceMap.d.ts","sourceRoot":"","sources":["../../src/lib/generateDiffSourceMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAc7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,SAAS,GAAG,IAAI,CA0DlB"}
@@ -1,151 +0,0 @@
1
- import MagicString from "magic-string";
2
- const MAX_ALIGNMENT_CELLS = 1e6;
3
- function generateDiffSourceMap(original, transformed) {
4
- if (original === transformed) {
5
- return null;
6
- }
7
- const ms = new MagicString(original);
8
- const origLines = original.split("\n");
9
- const newLines = transformed.split("\n");
10
- const lineOffsets = new Array(origLines.length);
11
- let offset = 0;
12
- for (let i = 0; i < origLines.length; i++) {
13
- lineOffsets[i] = offset;
14
- offset += origLines[i].length + 1;
15
- }
16
- let prefix = 0;
17
- const maxPrefix = Math.min(origLines.length, newLines.length);
18
- while (prefix < maxPrefix && origLines[prefix] === newLines[prefix]) {
19
- prefix++;
20
- }
21
- let suffix = 0;
22
- const maxSuffix = Math.min(origLines.length, newLines.length) - prefix;
23
- while (suffix < maxSuffix && origLines[origLines.length - 1 - suffix] === newLines[newLines.length - 1 - suffix]) {
24
- suffix++;
25
- }
26
- const hunks = alignLines(
27
- origLines,
28
- prefix,
29
- origLines.length - suffix,
30
- newLines,
31
- prefix,
32
- newLines.length - suffix
33
- );
34
- for (const hunk of hunks) {
35
- applyHunk(ms, hunk, origLines, newLines, lineOffsets, original.length);
36
- }
37
- if (ms.toString() !== transformed) {
38
- return new MagicString(original).generateMap({ hires: true });
39
- }
40
- return ms.generateMap({ hires: true });
41
- }
42
- function alignLines(origLines, oLo, oHi, newLines, nLo, nHi) {
43
- const m = oHi - oLo;
44
- const n = nHi - nLo;
45
- if (m === 0 && n === 0) {
46
- return [];
47
- }
48
- if (m === 0 || n === 0 || m * n > MAX_ALIGNMENT_CELLS) {
49
- return [{ oStart: oLo, oEnd: oHi, nStart: nLo, nEnd: nHi }];
50
- }
51
- const width = n + 1;
52
- const dp = new Int32Array((m + 1) * width);
53
- for (let i2 = m - 1; i2 >= 0; i2--) {
54
- for (let j2 = n - 1; j2 >= 0; j2--) {
55
- dp[i2 * width + j2] = origLines[oLo + i2] === newLines[nLo + j2] ? dp[(i2 + 1) * width + j2 + 1] + 1 : Math.max(dp[(i2 + 1) * width + j2], dp[i2 * width + j2 + 1]);
56
- }
57
- }
58
- const hunks = [];
59
- let i = 0;
60
- let j = 0;
61
- let hunkO = 0;
62
- let hunkN = 0;
63
- const flushHunk = () => {
64
- if (i > hunkO || j > hunkN) {
65
- hunks.push({
66
- oStart: oLo + hunkO,
67
- oEnd: oLo + i,
68
- nStart: nLo + hunkN,
69
- nEnd: nLo + j
70
- });
71
- }
72
- };
73
- while (i < m && j < n) {
74
- if (origLines[oLo + i] === newLines[nLo + j]) {
75
- flushHunk();
76
- i++;
77
- j++;
78
- hunkO = i;
79
- hunkN = j;
80
- } else if (dp[(i + 1) * width + j] >= dp[i * width + j + 1]) {
81
- i++;
82
- } else {
83
- j++;
84
- }
85
- }
86
- i = m;
87
- j = n;
88
- flushHunk();
89
- return hunks;
90
- }
91
- function applyHunk(ms, { oStart, oEnd, nStart, nEnd }, origLines, newLines, lineOffsets, originalLength) {
92
- const oCount = oEnd - oStart;
93
- const nCount = nEnd - nStart;
94
- const newSlice = newLines.slice(nStart, nEnd);
95
- if (oCount === nCount) {
96
- for (let k = 0; k < oCount; k++) {
97
- diffLinePair(
98
- ms,
99
- lineOffsets[oStart + k],
100
- origLines[oStart + k],
101
- newLines[nStart + k]
102
- );
103
- }
104
- } else if (oCount === 0) {
105
- const text = newSlice.join("\n");
106
- if (oStart >= origLines.length) {
107
- ms.appendLeft(originalLength, "\n" + text);
108
- } else {
109
- ms.appendLeft(lineOffsets[oStart], text + "\n");
110
- }
111
- } else if (nCount === 0) {
112
- const start = lineOffsets[oStart];
113
- if (oEnd >= origLines.length) {
114
- ms.remove(oStart > 0 ? start - 1 : start, originalLength);
115
- } else {
116
- ms.remove(start, lineOffsets[oEnd]);
117
- }
118
- } else {
119
- const start = lineOffsets[oStart];
120
- const end = lineOffsets[oEnd - 1] + origLines[oEnd - 1].length;
121
- ms.overwrite(start, end, newSlice.join("\n"));
122
- }
123
- }
124
- function diffLinePair(ms, lineStart, origLine, newLine) {
125
- if (origLine === newLine) {
126
- return;
127
- }
128
- let charPrefix = 0;
129
- const maxCharPrefix = Math.min(origLine.length, newLine.length);
130
- while (charPrefix < maxCharPrefix && origLine[charPrefix] === newLine[charPrefix]) {
131
- charPrefix++;
132
- }
133
- let charSuffix = 0;
134
- const maxCharSuffix = Math.min(origLine.length, newLine.length) - charPrefix;
135
- while (charSuffix < maxCharSuffix && origLine[origLine.length - 1 - charSuffix] === newLine[newLine.length - 1 - charSuffix]) {
136
- charSuffix++;
137
- }
138
- const start = lineStart + charPrefix;
139
- const end = lineStart + origLine.length - charSuffix;
140
- const replacement = newLine.slice(charPrefix, newLine.length - charSuffix);
141
- if (start === end) {
142
- ms.appendLeft(start, replacement);
143
- } else if (replacement === "") {
144
- ms.remove(start, end);
145
- } else {
146
- ms.overwrite(start, end, replacement);
147
- }
148
- }
149
- export {
150
- generateDiffSourceMap
151
- };
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export declare function cedarDataUriShim(): Plugin | undefined;
3
- //# sourceMappingURL=vite-plugin-cedar-data-uri-shim.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin-cedar-data-uri-shim.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-data-uri-shim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAgClC,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CA4BrD"}