@cedarjs/vite 8.0.0-canary.3365 → 8.0.0-canary.3367

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":"AASA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAoE7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA8GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAyMlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAiGnD;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":"AASA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAwE7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA8GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAoNlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAiGnD;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"}
@@ -20,7 +20,11 @@ import {
20
20
  import { getAsyncStoreInstance } from "@cedarjs/context/dist/store";
21
21
  import { createGraphQLServer } from "@cedarjs/graphql-server";
22
22
  import { applyGqlormInject } from "@cedarjs/internal/dist/build/api-graphql-transforms.js";
23
- import { getConfig, getPaths } from "@cedarjs/project-config";
23
+ import {
24
+ createPrismaClientFileMatcher,
25
+ getConfig,
26
+ getPaths
27
+ } from "@cedarjs/project-config";
24
28
  import { generateDiffSourceMap } from "./lib/generateDiffSourceMap.js";
25
29
  import { getWorkspacePackageAliases } from "./lib/workspacePackageAliases.js";
26
30
  import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
@@ -145,6 +149,7 @@ async function createApiViteServer() {
145
149
  const cedarPaths = getPaths();
146
150
  const cedarConfig = getConfig();
147
151
  const normalizedBase = normalizePath(cedarPaths.base);
152
+ const prismaClientFiles = createPrismaClientFileMatcher();
148
153
  const babelPlugins = getApiSideBabelConfigPath() ? getApiSideBabelPluginsForVite() : null;
149
154
  const workspacePkgSourceMap = Object.fromEntries(
150
155
  Object.entries(getWorkspacePackageAliases(cedarPaths, cedarConfig)).map(
@@ -198,6 +203,9 @@ async function createApiViteServer() {
198
203
  {
199
204
  name: "cedar-api-babel-transform",
200
205
  enforce: "pre",
206
+ async buildStart() {
207
+ await prismaClientFiles.load();
208
+ },
201
209
  async transform(code, id) {
202
210
  if (!/\.(ts|tsx|js|jsx)$/.test(id)) {
203
211
  return null;
@@ -208,6 +216,9 @@ async function createApiViteServer() {
208
216
  if (!id.startsWith(normalizedBase)) {
209
217
  return null;
210
218
  }
219
+ if (await prismaClientFiles.matches(id)) {
220
+ return null;
221
+ }
211
222
  let sourceCode = code;
212
223
  let sourceMap = null;
213
224
  if (normalizePath(id).endsWith("/graphql.ts") || normalizePath(id).endsWith("/graphql.js")) {
@@ -1 +1 @@
1
- {"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AA6DA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,EAC1B,EAAU,GACX,GAAE,oBAAyB,iBAsa3B"}
1
+ {"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AAiEA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,EAC1B,EAAU,GACX,GAAE,oBAAyB,iBA4b3B"}
package/dist/buildApp.js CHANGED
@@ -20,7 +20,11 @@ import {
20
20
  applySrcAlias
21
21
  } from "@cedarjs/internal/dist/build/api.js";
22
22
  import { findApiFiles } from "@cedarjs/internal/dist/files.js";
23
- import { getConfig, getPaths } from "@cedarjs/project-config";
23
+ import {
24
+ createPrismaClientFileMatcher,
25
+ getConfig,
26
+ getPaths
27
+ } from "@cedarjs/project-config";
24
28
  import { generateDiffSourceMap } from "./lib/generateDiffSourceMap.js";
25
29
  import { getWorkspacePackageAliases } from "./lib/workspacePackageAliases.js";
26
30
  import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
@@ -258,9 +262,13 @@ async function buildCedarApp({
258
262
  }
259
263
  plugins.push(cedarMockCellDataPlugin());
260
264
  if (workspace.includes("api")) {
265
+ const prismaClientFiles = createPrismaClientFileMatcher();
261
266
  plugins.push({
262
267
  name: "cedar-vite-api-babel-transform",
263
268
  enforce: "pre",
269
+ async buildStart() {
270
+ await prismaClientFiles.load();
271
+ },
264
272
  async transform(code, id) {
265
273
  if (!/\.(js|ts|tsx|jsx)$/.test(id)) {
266
274
  return null;
@@ -271,6 +279,16 @@ async function buildCedarApp({
271
279
  if (!normalizePath(id).startsWith(normalizePath(cedarPaths.api.base))) {
272
280
  return null;
273
281
  }
282
+ if (await prismaClientFiles.matches(id)) {
283
+ const rewrittenCode2 = applyImportExtensions(code, id);
284
+ if (rewrittenCode2 === code) {
285
+ return null;
286
+ }
287
+ return {
288
+ code: rewrittenCode2,
289
+ map: generateDiffSourceMap(code, rewrittenCode2)
290
+ };
291
+ }
274
292
  const babelPlugins = getApiSideBabelConfigPath() ? getApiSideBabelPluginsForVite() : null;
275
293
  const fromDirRelativeToApiSrc = path.relative(
276
294
  cedarPaths.api.src,
@@ -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,CA4H7C"}
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;AAQlC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAqI7C"}
@@ -3,15 +3,26 @@ import path from "node:path";
3
3
  import MagicString from "magic-string";
4
4
  import { parseSync } from "oxc-parser";
5
5
  import { normalizePath } from "vite";
6
- import { importStatementPath, getPaths } from "@cedarjs/project-config";
6
+ import {
7
+ createPrismaClientFileMatcher,
8
+ importStatementPath,
9
+ getPaths
10
+ } from "@cedarjs/project-config";
7
11
  function cedarImportDirPlugin() {
12
+ const prismaClientFiles = createPrismaClientFileMatcher();
8
13
  return {
9
14
  name: "vite-plugin-cedar-import-dir",
10
15
  enforce: "pre",
16
+ async buildStart() {
17
+ await prismaClientFiles.load();
18
+ },
11
19
  async transform(code, id) {
12
20
  if (!code.includes("/**/")) {
13
21
  return null;
14
22
  }
23
+ if (await prismaClientFiles.matches(id)) {
24
+ return null;
25
+ }
15
26
  let program;
16
27
  try {
17
28
  program = parseSync(id, code).program;
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-cedar-otel-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-otel-wrapping.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAwBhD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CA+Ef"}
1
+ {"version":3,"file":"vite-plugin-cedar-otel-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-otel-wrapping.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAQlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAkChD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CA+Ef"}
@@ -1,10 +1,17 @@
1
1
  import { parseSync } from "oxc-parser";
2
2
  import { normalizePath } from "vite";
3
- import { getPaths } from "@cedarjs/project-config";
3
+ import {
4
+ createPrismaClientFileMatcher,
5
+ getPaths
6
+ } from "@cedarjs/project-config";
4
7
  function cedarOtelWrappingPlugin() {
8
+ const prismaClientFiles = createPrismaClientFileMatcher();
5
9
  return {
6
10
  name: "cedar-otel-wrapping",
7
- transform(code, id) {
11
+ async buildStart() {
12
+ await prismaClientFiles.load();
13
+ },
14
+ async transform(code, id) {
8
15
  let apiSrc;
9
16
  try {
10
17
  apiSrc = normalizePath(getPaths().api.src);
@@ -14,6 +21,9 @@ function cedarOtelWrappingPlugin() {
14
21
  if (!normalizePath(id).startsWith(apiSrc + "/")) {
15
22
  return null;
16
23
  }
24
+ if (await prismaClientFiles.matches(id)) {
25
+ return null;
26
+ }
17
27
  const relativePath = normalizePath(id).slice(apiSrc.length + 1);
18
28
  const apiFolder = relativePath.split("/")[0] ?? "?";
19
29
  const result = applyOtelWrapping(code, id, apiFolder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "8.0.0-canary.3365",
3
+ "version": "8.0.0-canary.3367",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,17 +54,17 @@
54
54
  "@babel/preset-typescript": "7.29.7",
55
55
  "@babel/traverse": "7.29.10",
56
56
  "@babel/types": "7.29.8",
57
- "@cedarjs/api": "8.0.0-canary.3365",
58
- "@cedarjs/api-server": "8.0.0-canary.3365",
59
- "@cedarjs/babel-config": "8.0.0-canary.3365",
60
- "@cedarjs/context": "8.0.0-canary.3365",
61
- "@cedarjs/graphql-server": "8.0.0-canary.3365",
62
- "@cedarjs/internal": "8.0.0-canary.3365",
63
- "@cedarjs/jobs": "8.0.0-canary.3365",
64
- "@cedarjs/project-config": "8.0.0-canary.3365",
65
- "@cedarjs/server-store": "8.0.0-canary.3365",
66
- "@cedarjs/structure": "8.0.0-canary.3365",
67
- "@cedarjs/testing": "8.0.0-canary.3365",
57
+ "@cedarjs/api": "8.0.0-canary.3367",
58
+ "@cedarjs/api-server": "8.0.0-canary.3367",
59
+ "@cedarjs/babel-config": "8.0.0-canary.3367",
60
+ "@cedarjs/context": "8.0.0-canary.3367",
61
+ "@cedarjs/graphql-server": "8.0.0-canary.3367",
62
+ "@cedarjs/internal": "8.0.0-canary.3367",
63
+ "@cedarjs/jobs": "8.0.0-canary.3367",
64
+ "@cedarjs/project-config": "8.0.0-canary.3367",
65
+ "@cedarjs/server-store": "8.0.0-canary.3367",
66
+ "@cedarjs/structure": "8.0.0-canary.3367",
67
+ "@cedarjs/testing": "8.0.0-canary.3367",
68
68
  "@swc/core": "1.16.13",
69
69
  "@universal-deploy/store": "^0.2.1",
70
70
  "@universal-deploy/vite": "^0.1.9",
@@ -94,10 +94,10 @@
94
94
  "yargs-parser": "21.1.1"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/auth": "8.0.0-canary.3365",
98
- "@cedarjs/framework-tools": "8.0.0-canary.3365",
99
- "@cedarjs/router": "8.0.0-canary.3365",
100
- "@cedarjs/web": "8.0.0-canary.3365",
97
+ "@cedarjs/auth": "8.0.0-canary.3367",
98
+ "@cedarjs/framework-tools": "8.0.0-canary.3367",
99
+ "@cedarjs/router": "8.0.0-canary.3367",
100
+ "@cedarjs/web": "8.0.0-canary.3367",
101
101
  "@dr.pogodin/react-helmet": "2.0.4",
102
102
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
103
103
  "@jridgewell/trace-mapping": "0.3.31",
@@ -119,9 +119,9 @@
119
119
  "vitest": "4.1.11"
120
120
  },
121
121
  "peerDependencies": {
122
- "@cedarjs/auth": "8.0.0-canary.3365",
123
- "@cedarjs/router": "8.0.0-canary.3365",
124
- "@cedarjs/web": "8.0.0-canary.3365",
122
+ "@cedarjs/auth": "8.0.0-canary.3367",
123
+ "@cedarjs/router": "8.0.0-canary.3367",
124
+ "@cedarjs/web": "8.0.0-canary.3367",
125
125
  "react": "19.3.0",
126
126
  "react-dom": "19.3.0"
127
127
  },