@cedarjs/vite 6.0.0-canary.2654 → 6.0.0-canary.2657

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.
@@ -1 +1 @@
1
- {"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAmC7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAkHlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoFnD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjD,CAAC,CAcD"}
1
+ {"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AA+D7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CA6IlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoFnD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjD,CAAC,CAcD"}
@@ -1,9 +1,16 @@
1
+ import fs from "node:fs";
1
2
  import { glob } from "node:fs/promises";
2
3
  import path from "node:path";
3
4
  import { pathToFileURL } from "node:url";
4
5
  import ansis from "ansis";
5
6
  import { normalizePath } from "vite";
6
7
  import { gqlPlugin as gqlTagPlugin } from "vite-plugin-graphql-tag";
8
+ import tsPathsMod from "vite-tsconfig-paths";
9
+ const tsconfigPaths = (
10
+ // @ts-expect-error – .default only exists at runtime in CJS double-wrap
11
+ // interop
12
+ tsPathsMod.default?.default || tsPathsMod.default || tsPathsMod
13
+ );
7
14
  import { buildCedarContext, wrapLegacyHandler } from "@cedarjs/api/runtime";
8
15
  import {
9
16
  getApiSideBabelPlugins,
@@ -20,6 +27,18 @@ import { applyGraphqlOptionsExtract } from "./plugins/vite-plugin-cedar-graphql-
20
27
  import { cedarImportDirPlugin } from "./plugins/vite-plugin-cedar-import-dir.js";
21
28
  import { applyOtelWrapping } from "./plugins/vite-plugin-cedar-otel-wrapping.js";
22
29
  import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
30
+ function resolveWithExtensions(id) {
31
+ if (fs.existsSync(id) && fs.statSync(id).isFile()) {
32
+ return id;
33
+ }
34
+ for (const ext of [".js", ".ts", ".jsx", ".tsx", ".mjs", ".mts"]) {
35
+ const withExt = id + ext;
36
+ if (fs.existsSync(withExt)) {
37
+ return withExt;
38
+ }
39
+ }
40
+ return id;
41
+ }
23
42
  const LAMBDA_FUNCTIONS = {};
24
43
  let graphqlYoga = null;
25
44
  let loadApiFunctionsInFlight = null;
@@ -148,6 +167,26 @@ async function createApiViteServer() {
148
167
  alias: workspacePkgSourceMap
149
168
  },
150
169
  plugins: [
170
+ // tsconfigPaths resolves user-defined tsconfig.json `paths` aliases; it
171
+ // replaces the Babel module-resolver's tsconfig-paths handling for dev.
172
+ tsconfigPaths(),
173
+ {
174
+ name: "cedar-api-src-redirect",
175
+ enforce: "pre",
176
+ resolveId(id, importer) {
177
+ const normalizedImporter = importer && normalizePath(importer);
178
+ const normalizedApiSrc = normalizePath(cedarPaths.api.src);
179
+ if (!normalizedImporter?.startsWith(`${normalizedApiSrc}/`)) {
180
+ return null;
181
+ }
182
+ if (id.startsWith("src/")) {
183
+ return resolveWithExtensions(
184
+ path.join(cedarPaths.api.src, id.slice(4))
185
+ );
186
+ }
187
+ return null;
188
+ }
189
+ },
151
190
  cedarImportDirPlugin(),
152
191
  cedarDirectoryNamedImportPlugin(),
153
192
  cedarAutoImportsPlugin(),
@@ -35,12 +35,14 @@ __export(apiDevMiddleware_exports, {
35
35
  startApiDevMiddleware: () => startApiDevMiddleware
36
36
  });
37
37
  module.exports = __toCommonJS(apiDevMiddleware_exports);
38
+ var import_node_fs = __toESM(require("node:fs"), 1);
38
39
  var import_promises = require("node:fs/promises");
39
40
  var import_node_path = __toESM(require("node:path"), 1);
40
41
  var import_node_url = require("node:url");
41
42
  var import_ansis = __toESM(require("ansis"), 1);
42
43
  var import_vite = require("vite");
43
44
  var import_vite_plugin_graphql_tag = require("vite-plugin-graphql-tag");
45
+ var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
44
46
  var import_runtime = require("@cedarjs/api/runtime");
45
47
  var import_babel_config = require("@cedarjs/babel-config");
46
48
  var import_store = require("@cedarjs/context/dist/store");
@@ -54,6 +56,23 @@ var import_vite_plugin_cedar_graphql_options_extract = require("./plugins/vite-p
54
56
  var import_vite_plugin_cedar_import_dir = require("./plugins/vite-plugin-cedar-import-dir.js");
55
57
  var import_vite_plugin_cedar_otel_wrapping = require("./plugins/vite-plugin-cedar-otel-wrapping.js");
56
58
  var import_vite_plugin_cedarjs_job_path_injector = require("./plugins/vite-plugin-cedarjs-job-path-injector.js");
59
+ const tsconfigPaths = (
60
+ // @ts-expect-error – .default only exists at runtime in CJS double-wrap
61
+ // interop
62
+ import_vite_tsconfig_paths.default.default?.default || import_vite_tsconfig_paths.default.default || import_vite_tsconfig_paths.default
63
+ );
64
+ function resolveWithExtensions(id) {
65
+ if (import_node_fs.default.existsSync(id) && import_node_fs.default.statSync(id).isFile()) {
66
+ return id;
67
+ }
68
+ for (const ext of [".js", ".ts", ".jsx", ".tsx", ".mjs", ".mts"]) {
69
+ const withExt = id + ext;
70
+ if (import_node_fs.default.existsSync(withExt)) {
71
+ return withExt;
72
+ }
73
+ }
74
+ return id;
75
+ }
57
76
  const LAMBDA_FUNCTIONS = {};
58
77
  let graphqlYoga = null;
59
78
  let loadApiFunctionsInFlight = null;
@@ -182,6 +201,26 @@ async function createApiViteServer() {
182
201
  alias: workspacePkgSourceMap
183
202
  },
184
203
  plugins: [
204
+ // tsconfigPaths resolves user-defined tsconfig.json `paths` aliases; it
205
+ // replaces the Babel module-resolver's tsconfig-paths handling for dev.
206
+ tsconfigPaths(),
207
+ {
208
+ name: "cedar-api-src-redirect",
209
+ enforce: "pre",
210
+ resolveId(id, importer) {
211
+ const normalizedImporter = importer && (0, import_vite.normalizePath)(importer);
212
+ const normalizedApiSrc = (0, import_vite.normalizePath)(cedarPaths.api.src);
213
+ if (!normalizedImporter?.startsWith(`${normalizedApiSrc}/`)) {
214
+ return null;
215
+ }
216
+ if (id.startsWith("src/")) {
217
+ return resolveWithExtensions(
218
+ import_node_path.default.join(cedarPaths.api.src, id.slice(4))
219
+ );
220
+ }
221
+ return null;
222
+ }
223
+ },
185
224
  (0, import_vite_plugin_cedar_import_dir.cedarImportDirPlugin)(),
186
225
  (0, import_vite_plugin_cedar_directory_named_import.cedarDirectoryNamedImportPlugin)(),
187
226
  (0, import_vite_plugin_cedar_auto_import.cedarAutoImportsPlugin)(),
@@ -3,5 +3,5 @@
3
3
  * buildFeServer -> buildRscFeServer -> rscBuildClient
4
4
  * Generate the client bundle
5
5
  */
6
- export declare function rscBuildClient(clientEntryFiles: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputAsset | import("rollup").OutputChunk)[]]>;
6
+ export declare function rscBuildClient(clientEntryFiles: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]>;
7
7
  //# sourceMappingURL=rscBuildClient.d.ts.map
@@ -3,5 +3,5 @@
3
3
  * buildFeServer -> buildRscFeServer -> rscBuildForServer
4
4
  * Generate the output to be used by the rsc worker (not the actual server!)
5
5
  */
6
- export declare function rscBuildForServer(clientEntryFiles: Record<string, string>, serverEntryFiles: Record<string, string>, customModules: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputAsset | import("rollup").OutputChunk)[]]>;
6
+ export declare function rscBuildForServer(clientEntryFiles: Record<string, string>, serverEntryFiles: Record<string, string>, customModules: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]>;
7
7
  //# sourceMappingURL=rscBuildForServer.d.ts.map
@@ -5,5 +5,5 @@
5
5
  export declare function rscBuildForSsr({ clientEntryFiles, verbose, }: {
6
6
  clientEntryFiles: Record<string, string>;
7
7
  verbose?: boolean;
8
- }): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputAsset | import("rollup").OutputChunk)[]]>;
8
+ }): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]>;
9
9
  //# sourceMappingURL=rscBuildForSsr.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "6.0.0-canary.2654",
3
+ "version": "6.0.0-canary.2657",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,15 +63,15 @@
63
63
  "@babel/parser": "7.29.7",
64
64
  "@babel/traverse": "7.29.7",
65
65
  "@babel/types": "7.29.7",
66
- "@cedarjs/api": "6.0.0-canary.2654",
67
- "@cedarjs/babel-config": "6.0.0-canary.2654",
68
- "@cedarjs/context": "6.0.0-canary.2654",
69
- "@cedarjs/cookie-jar": "6.0.0-canary.2654",
70
- "@cedarjs/graphql-server": "6.0.0-canary.2654",
71
- "@cedarjs/internal": "6.0.0-canary.2654",
72
- "@cedarjs/project-config": "6.0.0-canary.2654",
73
- "@cedarjs/server-store": "6.0.0-canary.2654",
74
- "@cedarjs/testing": "6.0.0-canary.2654",
66
+ "@cedarjs/api": "6.0.0-canary.2657",
67
+ "@cedarjs/babel-config": "6.0.0-canary.2657",
68
+ "@cedarjs/context": "6.0.0-canary.2657",
69
+ "@cedarjs/cookie-jar": "6.0.0-canary.2657",
70
+ "@cedarjs/graphql-server": "6.0.0-canary.2657",
71
+ "@cedarjs/internal": "6.0.0-canary.2657",
72
+ "@cedarjs/project-config": "6.0.0-canary.2657",
73
+ "@cedarjs/server-store": "6.0.0-canary.2657",
74
+ "@cedarjs/testing": "6.0.0-canary.2657",
75
75
  "@fastify/url-data": "6.0.3",
76
76
  "@swc/core": "1.15.41",
77
77
  "@universal-deploy/store": "^0.2.1",
@@ -108,9 +108,9 @@
108
108
  },
109
109
  "devDependencies": {
110
110
  "@arethetypeswrong/cli": "0.18.5",
111
- "@cedarjs/auth": "6.0.0-canary.2654",
112
- "@cedarjs/router": "6.0.0-canary.2654",
113
- "@cedarjs/web": "6.0.0-canary.2654",
111
+ "@cedarjs/auth": "6.0.0-canary.2657",
112
+ "@cedarjs/router": "6.0.0-canary.2657",
113
+ "@cedarjs/web": "6.0.0-canary.2657",
114
114
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
115
115
  "@jridgewell/trace-mapping": "0.3.31",
116
116
  "@types/aws-lambda": "8.10.162",