@cedarjs/vite 5.0.6 → 5.0.7-next.219

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 (152) 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 +4 -0
  3. package/dist/apiDevMiddleware.d.ts.map +1 -1
  4. package/dist/apiDevMiddleware.js +117 -15
  5. package/dist/buildApp.d.ts.map +1 -1
  6. package/dist/buildApp.js +79 -18
  7. package/dist/buildRouteHooks.d.ts.map +1 -1
  8. package/dist/buildRouteHooks.js +36 -4
  9. package/dist/bundled/react-server-dom-webpack.server.js +192 -99
  10. package/dist/cedar-unified-dev.d.ts +18 -0
  11. package/dist/cedar-unified-dev.d.ts.map +1 -1
  12. package/dist/cedar-unified-dev.js +39 -5
  13. package/dist/devFeServer.js +3 -8
  14. package/dist/index.d.ts +11 -4
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +51 -19
  17. package/dist/lib/generateDiffSourceMap.d.ts +18 -0
  18. package/dist/lib/generateDiffSourceMap.d.ts.map +1 -0
  19. package/dist/lib/generateDiffSourceMap.js +151 -0
  20. package/dist/lib/getMergedConfig.d.ts.map +1 -1
  21. package/dist/lib/getMergedConfig.js +16 -6
  22. package/dist/lib/registerFwGlobalsAndShims.d.ts.map +1 -1
  23. package/dist/lib/registerFwGlobalsAndShims.js +14 -4
  24. package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts +13 -0
  25. package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts.map +1 -0
  26. package/dist/plugins/vite-plugin-cedar-api-import-guard.js +17 -0
  27. package/dist/plugins/vite-plugin-cedar-auto-import.d.ts +1 -1
  28. package/dist/plugins/vite-plugin-cedar-auto-import.d.ts.map +1 -1
  29. package/dist/plugins/vite-plugin-cedar-auto-import.js +8 -1
  30. package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
  31. package/dist/plugins/vite-plugin-cedar-cell.js +2 -1
  32. package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts +3 -0
  33. package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts.map +1 -0
  34. package/dist/plugins/vite-plugin-cedar-data-uri-shim.js +43 -0
  35. package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts +12 -0
  36. package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts.map +1 -0
  37. package/dist/plugins/vite-plugin-cedar-directory-named-import.js +35 -0
  38. package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts +29 -0
  39. package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts.map +1 -0
  40. package/dist/plugins/vite-plugin-cedar-gqlorm-inject.js +76 -0
  41. package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +42 -0
  42. package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +1 -0
  43. package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +103 -0
  44. package/dist/plugins/vite-plugin-cedar-import-dir.d.ts.map +1 -1
  45. package/dist/plugins/vite-plugin-cedar-import-dir.js +44 -31
  46. package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +28 -0
  47. package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +1 -0
  48. package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +67 -0
  49. package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts +28 -0
  50. package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +1 -0
  51. package/dist/plugins/vite-plugin-cedar-mock-cell-data.js +247 -0
  52. package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts +39 -0
  53. package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts.map +1 -0
  54. package/dist/plugins/vite-plugin-cedar-otel-wrapping.js +200 -0
  55. package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts.map +1 -1
  56. package/dist/plugins/vite-plugin-cedar-universal-deploy.js +92 -90
  57. package/dist/plugins/vite-plugin-cedarjs-job-path-injector.d.ts +29 -0
  58. package/dist/plugins/vite-plugin-cedarjs-job-path-injector.d.ts.map +1 -1
  59. package/dist/plugins/vite-plugin-cedarjs-job-path-injector.js +63 -81
  60. package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts.map +1 -1
  61. package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +14 -0
  62. package/dist/plugins/{vite-plugin-cedar-context-wrapping.d.ts → vite-plugin-handler-als-wrapping.d.ts} +12 -12
  63. package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -0
  64. package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +16 -16
  65. package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts +3 -0
  66. package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts.map +1 -1
  67. package/dist/plugins/vite-plugin-swap-apollo-provider.js +2 -2
  68. package/dist/rsc/rscBuildForSsr.d.ts.map +1 -1
  69. package/dist/rsc/rscBuildForSsr.js +3 -5
  70. package/dist/streaming/buildForStreamingServer.d.ts.map +1 -1
  71. package/dist/streaming/buildForStreamingServer.js +3 -5
  72. package/package.json +41 -52
  73. package/dist/cjs/ClientRouter.d.ts +0 -1
  74. package/dist/cjs/api/vite-plugin-cedar-vitest-api-preset.js +0 -37
  75. package/dist/cjs/apiDevMiddleware.js +0 -371
  76. package/dist/cjs/build/build.d.ts +0 -1
  77. package/dist/cjs/build/build.js +0 -58
  78. package/dist/cjs/buildApp.js +0 -306
  79. package/dist/cjs/buildFeServer.d.ts +0 -1
  80. package/dist/cjs/buildFeServer.js +0 -63
  81. package/dist/cjs/buildRouteHooks.js +0 -80
  82. package/dist/cjs/buildRouteManifest.js +0 -92
  83. package/dist/cjs/buildRscClientAndServer.js +0 -54
  84. package/dist/cjs/cedar-unified-dev.js +0 -310
  85. package/dist/cjs/client.d.ts +0 -1
  86. package/dist/cjs/clientSsr.d.ts +0 -1
  87. package/dist/cjs/devFeServer.js +0 -157
  88. package/dist/cjs/index.d.ts +0 -1
  89. package/dist/cjs/index.js +0 -141
  90. package/dist/cjs/lib/StatusError.js +0 -37
  91. package/dist/cjs/lib/entries.js +0 -52
  92. package/dist/cjs/lib/getMergedConfig.js +0 -185
  93. package/dist/cjs/lib/onWarn.js +0 -36
  94. package/dist/cjs/lib/registerFwGlobalsAndShims.js +0 -102
  95. package/dist/cjs/lib/workspacePackageAliases.js +0 -107
  96. package/dist/cjs/middleware/index.js +0 -22
  97. package/dist/cjs/middleware/invokeMiddleware.js +0 -52
  98. package/dist/cjs/middleware/register.js +0 -105
  99. package/dist/cjs/middleware/types.js +0 -16
  100. package/dist/cjs/package.json +0 -1
  101. package/dist/cjs/plugins/vite-plugin-cedar-auto-import.js +0 -107
  102. package/dist/cjs/plugins/vite-plugin-cedar-cell.js +0 -183
  103. package/dist/cjs/plugins/vite-plugin-cedar-cjs-compat.js +0 -341
  104. package/dist/cjs/plugins/vite-plugin-cedar-context-wrapping.js +0 -95
  105. package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +0 -107
  106. package/dist/cjs/plugins/vite-plugin-cedar-html-env.js +0 -67
  107. package/dist/cjs/plugins/vite-plugin-cedar-import-dir.js +0 -118
  108. package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +0 -43
  109. package/dist/cjs/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +0 -61
  110. package/dist/cjs/plugins/vite-plugin-cedar-remove-from-bundle.js +0 -76
  111. package/dist/cjs/plugins/vite-plugin-cedar-routes-auto-loader.js +0 -126
  112. package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +0 -346
  113. package/dist/cjs/plugins/vite-plugin-cedar-wait-for-api-server.js +0 -134
  114. package/dist/cjs/plugins/vite-plugin-cedarjs-job-path-injector.js +0 -134
  115. package/dist/cjs/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +0 -106
  116. package/dist/cjs/plugins/vite-plugin-jsx-loader.js +0 -42
  117. package/dist/cjs/plugins/vite-plugin-merged-config.js +0 -39
  118. package/dist/cjs/plugins/vite-plugin-rsc-analyze.js +0 -104
  119. package/dist/cjs/plugins/vite-plugin-rsc-reload.js +0 -75
  120. package/dist/cjs/plugins/vite-plugin-rsc-routes-auto-loader.js +0 -159
  121. package/dist/cjs/plugins/vite-plugin-rsc-routes-imports.js +0 -125
  122. package/dist/cjs/plugins/vite-plugin-rsc-ssr-router-import.js +0 -75
  123. package/dist/cjs/plugins/vite-plugin-rsc-transform-client.js +0 -228
  124. package/dist/cjs/plugins/vite-plugin-rsc-transform-server.js +0 -398
  125. package/dist/cjs/plugins/vite-plugin-swap-apollo-provider.js +0 -46
  126. package/dist/cjs/rsc/rscBuildAnalyze.js +0 -126
  127. package/dist/cjs/rsc/rscBuildClient.js +0 -91
  128. package/dist/cjs/rsc/rscBuildCopyCssAssets.js +0 -56
  129. package/dist/cjs/rsc/rscBuildEntriesFile.js +0 -115
  130. package/dist/cjs/rsc/rscBuildForServer.js +0 -168
  131. package/dist/cjs/rsc/rscBuildForSsr.js +0 -173
  132. package/dist/cjs/rsc/rscBuildRwEnvVars.js +0 -56
  133. package/dist/cjs/rsc/rscRenderer.js +0 -165
  134. package/dist/cjs/rsc/rscRequestHandler.js +0 -162
  135. package/dist/cjs/rsc/rscStudioHandlers.js +0 -156
  136. package/dist/cjs/runFeServer.js +0 -165
  137. package/dist/cjs/streaming/buildForStreamingServer.js +0 -65
  138. package/dist/cjs/streaming/collectCss.js +0 -52
  139. package/dist/cjs/streaming/createReactStreamingHandler.js +0 -173
  140. package/dist/cjs/streaming/streamHelpers.js +0 -230
  141. package/dist/cjs/streaming/transforms/bufferedTransform.js +0 -61
  142. package/dist/cjs/streaming/transforms/cancelTimeoutTransform.js +0 -34
  143. package/dist/cjs/streaming/transforms/encode-decode.js +0 -36
  144. package/dist/cjs/streaming/transforms/serverInjectionTransform.js +0 -84
  145. package/dist/cjs/streaming/triggerRouteHooks.js +0 -96
  146. package/dist/cjs/types.js +0 -16
  147. package/dist/cjs/utils.js +0 -92
  148. package/dist/package.json +0 -1
  149. package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +0 -1
  150. package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +0 -3
  151. package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +0 -1
  152. package/dist/plugins/vite-plugin-cedar-node-polyfills.js +0 -19
@@ -1,3 +1,32 @@
1
+ import type { SourceMap } from 'magic-string';
1
2
  import type { Plugin } from 'vite';
3
+ /**
4
+ * Vite plugin that injects `path` and `name` properties into `createJob()`
5
+ * definitions so the jobs runner can locate and identify the job's module at
6
+ * runtime.
7
+ *
8
+ * Transforms:
9
+ * export const myJob = jobs.createJob({ perform: ... })
10
+ * into:
11
+ * export const myJob = jobs.createJob({ perform: ..., path: "...", name: "myJob" })
12
+ *
13
+ * The extraction uses an oxc-parser AST walk so the transform is robust
14
+ * against nested object properties, aliased imports, and TypeScript syntax.
15
+ * The same logic is duplicated in `@cedarjs/internal`
16
+ * (`applyJobPathInjector`) for the standalone esbuild API build.
17
+ */
2
18
  export declare function cedarjsJobPathInjectorPlugin(): Plugin;
19
+ /**
20
+ * Injects `path` and `name` properties into `createJob()` definitions.
21
+ * Returns the transformed code with a sourcemap, or null if no
22
+ * transformation was needed.
23
+ *
24
+ * Duplicate of `@cedarjs/internal`'s `applyJobPathInjector` so this logic can
25
+ * run inside the Vite plugin pipeline without depending on internal's build
26
+ * output.
27
+ */
28
+ export declare function applyJobPathInjector(code: string, filePath: string, jobsDir: string): {
29
+ code: string;
30
+ map: SourceMap;
31
+ } | null;
3
32
  //# sourceMappingURL=vite-plugin-cedarjs-job-path-injector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-cedarjs-job-path-injector.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-job-path-injector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC,wBAAgB,4BAA4B,IAAI,MAAM,CAqHrD"}
1
+ {"version":3,"file":"vite-plugin-cedarjs-job-path-injector.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-job-path-injector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAoBrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,IAAI,CAiFzC"}
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
- import { parse, Lang } from "@ast-grep/napi";
2
+ import MagicString from "magic-string";
3
+ import { parseSync } from "oxc-parser";
3
4
  import { getPaths } from "@cedarjs/project-config";
4
5
  function cedarjsJobPathInjectorPlugin() {
5
6
  return {
@@ -8,93 +9,74 @@ function cedarjsJobPathInjectorPlugin() {
8
9
  if (!code.includes("createJob")) {
9
10
  return null;
10
11
  }
11
- const isTypescript = id.endsWith(".ts") || id.endsWith(".tsx");
12
- const language = isTypescript ? Lang.TypeScript : Lang.JavaScript;
13
- let ast;
14
- try {
15
- ast = parse(language, code);
16
- } catch (error) {
17
- console.warn("Failed to parse file:", id);
18
- console.warn(error);
12
+ const result = applyJobPathInjector(code, id, getPaths().api.jobs);
13
+ if (!result) {
19
14
  return null;
20
15
  }
21
- const paths = getPaths();
22
- const edits = [];
23
- const root = ast.root();
24
- const createJobCalls = root.findAll({
25
- rule: {
26
- pattern: "export const $VAR_NAME = $OBJ.createJob({ $$$PROPS })"
27
- }
28
- });
29
- for (const callNode of createJobCalls) {
30
- const varNameNode = callNode.getMatch("VAR_NAME");
31
- const propsNodes = callNode.getMultipleMatches("PROPS");
32
- if (!varNameNode) {
33
- continue;
34
- }
35
- const importName = varNameNode.text();
36
- const importPath = path.relative(paths.api.jobs, id);
37
- const importPathWithoutExtension = importPath.replace(/\.[^/.]+$/, "");
38
- const pathProperty = `path: ${JSON.stringify(importPathWithoutExtension)}`;
39
- const nameProperty = `name: ${JSON.stringify(importName)}`;
40
- let insertText = "";
41
- if (propsNodes.length > 0) {
42
- const objectLiteral = callNode.find({
43
- rule: {
44
- kind: "object",
45
- inside: {
46
- kind: "arguments"
47
- }
48
- }
49
- });
50
- if (objectLiteral) {
51
- insertText = `, ${pathProperty}, ${nameProperty}`;
52
- const objectText = objectLiteral.text();
53
- const closeBraceIndex = objectText.lastIndexOf("}");
54
- if (closeBraceIndex !== -1) {
55
- const range = objectLiteral.range();
56
- edits.push({
57
- startPos: range.start.index + closeBraceIndex,
58
- endPos: range.start.index + closeBraceIndex,
59
- insertedText: insertText
60
- });
61
- }
62
- }
63
- } else {
64
- const objectLiteral = callNode.find({
65
- rule: {
66
- kind: "object",
67
- inside: {
68
- kind: "arguments"
69
- }
70
- }
71
- });
72
- if (objectLiteral) {
73
- insertText = `${pathProperty}, ${nameProperty}`;
74
- const objectText = objectLiteral.text();
75
- const openBraceIndex = objectText.indexOf("{");
76
- if (openBraceIndex !== -1) {
77
- const range = objectLiteral.range();
78
- edits.push({
79
- startPos: range.start.index + openBraceIndex + 1,
80
- endPos: range.start.index + openBraceIndex + 1,
81
- insertedText: insertText
82
- });
83
- }
84
- }
85
- }
86
- }
87
- if (edits.length === 0) {
88
- return null;
89
- }
90
- const modifiedCode = root.commitEdits(edits);
91
16
  return {
92
- code: modifiedCode,
93
- map: null
17
+ code: result.code,
18
+ map: result.map
94
19
  };
95
20
  }
96
21
  };
97
22
  }
23
+ function applyJobPathInjector(code, filePath, jobsDir) {
24
+ let program;
25
+ try {
26
+ program = parseSync(filePath, code, { sourceType: "module" }).program;
27
+ } catch (error) {
28
+ console.warn("Failed to parse file:", filePath);
29
+ console.warn(error);
30
+ return null;
31
+ }
32
+ const importPath = path.relative(jobsDir, filePath);
33
+ const importPathWithoutExtension = importPath.replace(/\.[^/.]+$/, "");
34
+ const s = new MagicString(code);
35
+ let hasTransformations = false;
36
+ for (const node of program.body) {
37
+ if (node.type !== "ExportNamedDeclaration") {
38
+ continue;
39
+ }
40
+ const decl = node.declaration;
41
+ if (decl?.type !== "VariableDeclaration") {
42
+ continue;
43
+ }
44
+ for (const declarator of decl.declarations) {
45
+ if (declarator.id.type !== "Identifier") {
46
+ continue;
47
+ }
48
+ const init = declarator.init;
49
+ if (init?.type !== "CallExpression") {
50
+ continue;
51
+ }
52
+ const callee = init.callee;
53
+ if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier" || callee.property.name !== "createJob") {
54
+ continue;
55
+ }
56
+ const configArg = init.arguments[0];
57
+ if (configArg?.type !== "ObjectExpression") {
58
+ continue;
59
+ }
60
+ hasTransformations = true;
61
+ const pathProperty = `path: ${JSON.stringify(importPathWithoutExtension)}`;
62
+ const nameProperty = `name: ${JSON.stringify(declarator.id.name)}`;
63
+ const lastProperty = configArg.properties.at(-1);
64
+ if (lastProperty) {
65
+ s.appendLeft(lastProperty.end, `, ${pathProperty}, ${nameProperty}`);
66
+ } else {
67
+ s.appendLeft(configArg.start + 1, `${pathProperty}, ${nameProperty}`);
68
+ }
69
+ }
70
+ }
71
+ if (!hasTransformations) {
72
+ return null;
73
+ }
74
+ return {
75
+ code: s.toString(),
76
+ map: s.generateMap({ hires: true })
77
+ };
78
+ }
98
79
  export {
80
+ applyJobPathInjector,
99
81
  cedarjsJobPathInjectorPlugin
100
82
  };
@@ -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,CAkE9D"}
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,CAwG9D"}
@@ -52,6 +52,20 @@ function cedarjsResolveCedarStyleImportsPlugin() {
52
52
  }
53
53
  }
54
54
  }
55
+ if (cedarPaths && id.startsWith("$api/") && this.environment?.name !== "client") {
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
+ }
55
69
  const resolvedPath = path.resolve(path.dirname(importer), id);
56
70
  if (fs.existsSync(resolvedPath)) {
57
71
  const stats = fs.statSync(resolvedPath);
@@ -8,24 +8,24 @@ import type { Plugin } from 'vite';
8
8
  * For each file in `api/src/functions/` that exports a `handler`, this plugin:
9
9
  *
10
10
  * 1. Adds an import at the top of the file:
11
- * import { getAsyncStoreInstance as __rw_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
11
+ * import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
12
12
  *
13
13
  * 2. Renames the original handler:
14
- * const __rw_handler = <original handler value>
14
+ * const __cedar_handler = <original handler value>
15
15
  *
16
16
  * 3. Replaces the handler export with a wrapper that checks context isolation:
17
- * export const handler = (__rw_event, __rw__context) => {
18
- * const __rw_contextStore = __rw_getAsyncStoreInstance().getStore()
19
- * if (__rw_contextStore === undefined) {
20
- * return __rw_getAsyncStoreInstance().run(new Map(), __rw_handler, __rw_event, __rw__context)
17
+ * export const handler = (__cedar_event, __cedar_context) => {
18
+ * const __cedar_contextStore = __cedar_getAsyncStoreInstance().getStore()
19
+ * if (__cedar_contextStore === undefined) {
20
+ * return __cedar_getAsyncStoreInstance().run(new Map(), __cedar_handler, __cedar_event, __cedar_context)
21
21
  * }
22
- * return __rw_handler(__rw_event, __rw__context)
22
+ * return __cedar_handler(__cedar_event, __cedar_context)
23
23
  * }
24
24
  *
25
- * This replaces `babel-plugin-redwood-context-wrapping` for Vite builds.
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 cedarContextWrappingPlugin({ projectIsEsm, }?: {
28
+ export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
29
29
  projectIsEsm?: boolean;
30
30
  }): Plugin;
31
31
  /**
@@ -34,11 +34,11 @@ export declare function cedarContextWrappingPlugin({ projectIsEsm, }?: {
34
34
  * export a `handler`.
35
35
  *
36
36
  * This is the context-isolation safeguard that used to be performed by
37
- * `babel-plugin-redwood-context-wrapping`. It is exported as a standalone
37
+ * `babel-plugin-handler-als-wrapping`. It is exported as a standalone
38
38
  * function so it can be applied from build pipelines that don't go through
39
39
  * Vite's plugin pipeline (e.g. the legacy esbuild API build).
40
40
  */
41
- export declare function applyContextWrapping(code: string, { projectIsEsm }?: {
41
+ export declare function applyHandlerAlsWrapping(code: string, { projectIsEsm }?: {
42
42
  projectIsEsm?: boolean;
43
43
  }): string | null;
44
- //# sourceMappingURL=vite-plugin-cedar-context-wrapping.d.ts.map
44
+ //# sourceMappingURL=vite-plugin-handler-als-wrapping.d.ts.map
@@ -0,0 +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,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 cedarContextWrappingPlugin({
4
+ function handlerAlsWrappingPlugin({
5
5
  projectIsEsm = false
6
6
  } = {}) {
7
7
  return {
8
- name: "cedar-context-wrapping",
8
+ name: "handler-als-wrapping",
9
9
  transform(code, id) {
10
10
  let paths;
11
11
  try {
@@ -17,12 +17,12 @@ function cedarContextWrappingPlugin({
17
17
  if (!normalizePath(id).startsWith(functionsDir + "/")) {
18
18
  return null;
19
19
  }
20
- const wrapped = applyContextWrapping(code, { projectIsEsm });
20
+ const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
21
21
  return wrapped ? { code: wrapped, map: null } : null;
22
22
  }
23
23
  };
24
24
  }
25
- function applyContextWrapping(code, { projectIsEsm = false } = {}) {
25
+ function applyHandlerAlsWrapping(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 applyContextWrapping(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 __rw_getAsyncStoreInstance } from '${storePath}'
34
+ const importStatement = `import { getAsyncStoreInstance as __cedar_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 __rw_handler =");
39
+ const renamed = after.replace(handlerRe, "const __cedar_handler =");
40
40
  const wrappedHandler = `
41
- export const handler = ${isAsync ? "async " : ""}(__rw_event, __rw__context) => {
41
+ export const handler = ${isAsync ? "async " : ""}(__cedar_event, __cedar_context) => {
42
42
  // The store will be undefined if no context isolation has been performed yet
43
- const __rw_contextStore = __rw_getAsyncStoreInstance().getStore()
44
- if (__rw_contextStore === undefined) {
45
- return __rw_getAsyncStoreInstance().run(
43
+ const __cedar_contextStore = __cedar_getAsyncStoreInstance().getStore()
44
+ if (__cedar_contextStore === undefined) {
45
+ return __cedar_getAsyncStoreInstance().run(
46
46
  new Map(),
47
- __rw_handler,
48
- __rw_event,
49
- __rw__context
47
+ __cedar_handler,
48
+ __cedar_event,
49
+ __cedar_context
50
50
  )
51
51
  }
52
- return __rw_handler(__rw_event, __rw__context)
52
+ return __cedar_handler(__cedar_event, __cedar_context)
53
53
  }
54
54
  `;
55
55
  return before + importStatement + renamed + wrappedHandler;
56
56
  }
57
57
  export {
58
- applyContextWrapping,
59
- cedarContextWrappingPlugin
58
+ applyHandlerAlsWrapping,
59
+ handlerAlsWrappingPlugin
60
60
  };
@@ -5,6 +5,9 @@ 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"
8
11
  */
9
12
  export declare function cedarSwapApolloProvider(): Plugin | undefined;
10
13
  //# 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;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAoB5D"}
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"}
@@ -5,11 +5,11 @@ function cedarSwapApolloProvider() {
5
5
  return void 0;
6
6
  }
7
7
  return {
8
- name: "redwood-swap-apollo-provider",
8
+ name: "cedar-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",
12
+ /@cedarjs\/web\/apollo(?:\/CedarApolloProvider)?/g,
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,+GA+IA"}
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"}
@@ -51,11 +51,9 @@ async function rscBuildForSsr({
51
51
  plugins: [
52
52
  cjsInterop({
53
53
  dependencies: [
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"
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/*"
59
57
  ]
60
58
  }),
61
59
  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,iBAkCA"}
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"}
@@ -14,11 +14,9 @@ async function buildForStreamingServer({
14
14
  plugins: [
15
15
  cjsInterop({
16
16
  dependencies: [
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"
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/*"
22
20
  ]
23
21
  })
24
22
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.6",
3
+ "version": "5.0.7-next.219",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,27 +12,17 @@
12
12
  "exports": {
13
13
  "./package.json": "./package.json",
14
14
  ".": {
15
- "import": {
15
+ "default": {
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"
22
18
  }
23
19
  },
24
20
  "./api": {
25
21
  "types": "./dist/api/vite-plugin-cedar-vitest-api-preset.d.ts",
26
22
  "default": "./dist/api/vite-plugin-cedar-vitest-api-preset.js"
27
23
  },
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
- },
24
+ "./buildFeServer": "./dist/buildFeServer.js",
25
+ "./build": "./dist/build/build.js",
36
26
  "./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
37
27
  },
38
28
  "bin": {
@@ -49,67 +39,67 @@
49
39
  "inject"
50
40
  ],
51
41
  "scripts": {
52
- "build": "node ./build.ts && yarn build:types",
42
+ "build": "node ./build.ts",
53
43
  "build:pack": "yarn pack -o cedarjs-vite.tgz",
54
44
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
55
- "check:attw": "node ./attw.ts",
45
+ "check:attw": "yarn cedar-fwtools-attw --exclude-entrypoints ./bins/cedar-vite-build.mjs",
56
46
  "check:package": "concurrently npm:check:attw yarn:publint",
57
47
  "test": "vitest run",
58
48
  "test:watch": "vitest watch"
59
49
  },
60
50
  "dependencies": {
61
- "@ast-grep/napi": "0.43.0",
62
51
  "@babel/generator": "7.29.7",
63
52
  "@babel/parser": "7.29.7",
64
53
  "@babel/traverse": "7.29.7",
65
54
  "@babel/types": "7.29.7",
66
- "@cedarjs/api": "5.0.6",
67
- "@cedarjs/babel-config": "5.0.6",
68
- "@cedarjs/context": "5.0.6",
69
- "@cedarjs/cookie-jar": "5.0.6",
70
- "@cedarjs/graphql-server": "5.0.6",
71
- "@cedarjs/internal": "5.0.6",
72
- "@cedarjs/project-config": "5.0.6",
73
- "@cedarjs/server-store": "5.0.6",
74
- "@cedarjs/testing": "5.0.6",
75
- "@fastify/url-data": "6.0.3",
76
- "@swc/core": "1.15.41",
55
+ "@cedarjs/api": "5.0.7-next.219",
56
+ "@cedarjs/api-server": "5.0.7-next.219",
57
+ "@cedarjs/babel-config": "5.0.7-next.219",
58
+ "@cedarjs/context": "5.0.7-next.219",
59
+ "@cedarjs/graphql-server": "5.0.7-next.219",
60
+ "@cedarjs/internal": "5.0.7-next.219",
61
+ "@cedarjs/project-config": "5.0.7-next.219",
62
+ "@cedarjs/server-store": "5.0.7-next.219",
63
+ "@cedarjs/structure": "5.0.7-next.219",
64
+ "@cedarjs/testing": "5.0.7-next.219",
65
+ "@swc/core": "1.15.46",
77
66
  "@universal-deploy/store": "^0.2.1",
78
67
  "@universal-deploy/vite": "^0.1.9",
79
68
  "@vitejs/plugin-react": "4.7.0",
80
69
  "@whatwg-node/fetch": "0.10.13",
81
- "@whatwg-node/server": "0.10.18",
82
- "acorn": "8.16.0",
70
+ "@whatwg-node/server": "0.11.0",
71
+ "acorn": "8.17.0",
83
72
  "acorn-loose": "8.5.2",
84
- "ansis": "4.2.0",
85
- "buffer": "6.0.3",
73
+ "ansis": "4.3.1",
86
74
  "busboy": "^1.6.0",
87
- "cookie": "1.1.1",
88
75
  "dotenv-defaults": "5.0.2",
89
- "execa": "5.1.1",
90
76
  "express": "4.22.2",
91
- "fastify": "5.8.5",
92
- "fastify-raw-body": "5.0.0",
77
+ "fast-glob": "3.3.3",
93
78
  "find-my-way": "8.2.2",
94
79
  "http-proxy-middleware": "3.0.7",
95
- "isbot": "5.1.43",
80
+ "isbot": "5.2.1",
81
+ "magic-string": "0.30.21",
82
+ "oxc-parser": "0.141.0",
96
83
  "react": "18.3.1",
97
- "react-server-dom-webpack": "19.2.4",
98
- "rimraf": "6.1.3",
99
- "rou3": "^0.8.1",
100
- "vite": "7.3.5",
84
+ "react-server-dom-webpack": "19.2.7",
85
+ "unimport": "5.7.0",
86
+ "unplugin-auto-import": "19.3.0",
87
+ "vite": "7.3.6",
101
88
  "vite-plugin-cjs-interop": "2.4.4",
102
- "vite-plugin-node-polyfills": "0.26.0",
89
+ "vite-plugin-graphql-tag": "0.1.1",
90
+ "vite-tsconfig-paths": "^6.1.1",
103
91
  "ws": "8.20.0",
104
92
  "yargs-parser": "21.1.1"
105
93
  },
106
94
  "devDependencies": {
107
- "@arethetypeswrong/cli": "0.18.4",
108
- "@cedarjs/auth": "5.0.6",
109
- "@cedarjs/router": "5.0.6",
110
- "@cedarjs/web": "5.0.6",
95
+ "@cedarjs/auth": "5.0.7-next.219",
96
+ "@cedarjs/framework-tools": "5.0.7-next.219",
97
+ "@cedarjs/router": "5.0.7-next.219",
98
+ "@cedarjs/web": "5.0.7-next.219",
99
+ "@dr.pogodin/react-helmet": "2.0.4",
111
100
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
112
101
  "@jridgewell/trace-mapping": "0.3.31",
102
+ "@oxc-project/types": "^0.141.0",
113
103
  "@types/aws-lambda": "8.10.162",
114
104
  "@types/busboy": "^1",
115
105
  "@types/express": "4",
@@ -117,18 +107,17 @@
117
107
  "@types/ws": "^8",
118
108
  "@types/yargs-parser": "21.0.3",
119
109
  "concurrently": "9.2.4",
120
- "glob": "11.1.0",
121
110
  "memfs": "4.64.0",
122
- "publint": "0.3.21",
111
+ "publint": "0.3.22",
123
112
  "rollup": "4.60.4",
124
113
  "ts-dedent": "2.3.0",
125
114
  "typescript": "5.9.3",
126
- "vitest": "3.2.6"
115
+ "vitest": "4.1.10"
127
116
  },
128
117
  "peerDependencies": {
129
- "@cedarjs/auth": "5.0.6",
130
- "@cedarjs/router": "5.0.6",
131
- "@cedarjs/web": "5.0.6"
118
+ "@cedarjs/auth": "5.0.7-next.219",
119
+ "@cedarjs/router": "5.0.7-next.219",
120
+ "@cedarjs/web": "5.0.7-next.219"
132
121
  },
133
122
  "engines": {
134
123
  "node": ">=24"
@@ -1 +0,0 @@
1
- export type * from "../ClientRouter.d.ts"
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var vite_plugin_cedar_vitest_api_preset_exports = {};
20
- __export(vite_plugin_cedar_vitest_api_preset_exports, {
21
- cedarVitestPreset: () => cedarVitestPreset
22
- });
23
- module.exports = __toCommonJS(vite_plugin_cedar_vitest_api_preset_exports);
24
- var import_vitest = require("@cedarjs/testing/api/vitest");
25
- var import_vite_plugin_cedarjs_resolve_cedar_style_imports = require("../plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js");
26
- function cedarVitestPreset() {
27
- return [
28
- (0, import_vitest.cedarVitestApiConfigPlugin)(),
29
- (0, import_vitest.autoImportsPlugin)(),
30
- (0, import_vite_plugin_cedarjs_resolve_cedar_style_imports.cedarjsResolveCedarStyleImportsPlugin)(),
31
- (0, import_vitest.trackDbImportsPlugin)()
32
- ];
33
- }
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- cedarVitestPreset
37
- });