@cedarjs/internal 8.0.0-canary.3365 → 8.0.0-canary.3366

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":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAwCtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAI9D,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAStB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AA8UD,eAAO,MAAM,gBAAgB,iHA+D5B,CAAA;AAcD,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAoDf"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AA6CtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAI9D,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAStB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AA8XD,eAAO,MAAM,gBAAgB,iHA+D5B,CAAA;AAcD,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAoDf"}
package/dist/build/api.js CHANGED
@@ -14,7 +14,12 @@ import {
14
14
  getApiSideBabelPluginsForVite,
15
15
  transformWithBabel
16
16
  } from "@cedarjs/babel-config";
17
- import { getConfig, getPaths, resolveFile } from "@cedarjs/project-config";
17
+ import {
18
+ getConfig,
19
+ getPaths,
20
+ createPrismaClientFileMatcher,
21
+ resolveFile
22
+ } from "@cedarjs/project-config";
18
23
  import { findApiFiles } from "../files.js";
19
24
  import {
20
25
  applyGqlormInject,
@@ -55,8 +60,19 @@ const cleanApiBuild = async () => {
55
60
  const runCedarBabelTransformsPlugin = {
56
61
  name: "cedar-esbuild-babel-transform",
57
62
  setup(build2) {
63
+ let prismaClientFiles = createPrismaClientFileMatcher();
64
+ build2.onStart(async () => {
65
+ prismaClientFiles = createPrismaClientFileMatcher();
66
+ await prismaClientFiles.load();
67
+ });
58
68
  build2.onLoad({ filter: /\.(js|ts|tsx|jsx)$/ }, async (args) => {
59
69
  let fileContents = await fs.promises.readFile(args.path, "utf-8");
70
+ if (await prismaClientFiles.matches(args.path)) {
71
+ return {
72
+ contents: applyImportExtensions(fileContents, args.path),
73
+ loader: getEsbuildLoader(args.path)
74
+ };
75
+ }
60
76
  fileContents = applySrcAlias(
61
77
  fileContents,
62
78
  path.dirname(
@@ -120,16 +136,23 @@ function getEsbuildLoader(filePath) {
120
136
  }
121
137
  }
122
138
  function createImportDirVitePlugin() {
139
+ const prismaClientFiles = createPrismaClientFileMatcher();
123
140
  return {
124
141
  name: "cedar-internal-import-dir",
125
142
  enforce: "pre",
126
- transform(code, id) {
143
+ async buildStart() {
144
+ await prismaClientFiles.load();
145
+ },
146
+ async transform(code, id) {
127
147
  if (!/\.(js|ts|tsx|jsx)$/.test(id)) {
128
148
  return null;
129
149
  }
130
150
  if (id.includes("node_modules")) {
131
151
  return null;
132
152
  }
153
+ if (await prismaClientFiles.matches(id)) {
154
+ return null;
155
+ }
133
156
  const result = applyImportDir(code, id);
134
157
  if (!result) {
135
158
  return null;
@@ -170,9 +193,13 @@ function createDirectoryNamedImportVitePlugin() {
170
193
  }
171
194
  function createCedarViteApiPlugin() {
172
195
  const cedarConfig = getConfig();
196
+ const prismaClientFiles = createPrismaClientFileMatcher();
173
197
  return {
174
198
  name: "cedar-vite-api-babel-transform",
175
199
  enforce: "pre",
200
+ async buildStart() {
201
+ await prismaClientFiles.load();
202
+ },
176
203
  async transform(code, id) {
177
204
  if (!/\.(js|ts|tsx|jsx)$/.test(id)) {
178
205
  return null;
@@ -184,6 +211,16 @@ function createCedarViteApiPlugin() {
184
211
  if (!normalizePath(id).startsWith(normalizePath(cedarPaths.api.base))) {
185
212
  return null;
186
213
  }
214
+ if (await prismaClientFiles.matches(id)) {
215
+ const outputCode2 = applyImportExtensions(code, id);
216
+ if (outputCode2 === code) {
217
+ return null;
218
+ }
219
+ return {
220
+ code: outputCode2,
221
+ map: new MagicString(code).generateMap({ hires: true })
222
+ };
223
+ }
187
224
  let sourceCode = code;
188
225
  const normalizedId = normalizePath(id);
189
226
  sourceCode = applySrcAlias(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/internal",
3
- "version": "8.0.0-canary.3365",
3
+ "version": "8.0.0-canary.3366",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -120,14 +120,14 @@
120
120
  "@babel/core": "^7.26.10",
121
121
  "@babel/parser": "7.29.9",
122
122
  "@babel/traverse": "7.29.10",
123
- "@cedarjs/api": "8.0.0-canary.3365",
124
- "@cedarjs/babel-config": "8.0.0-canary.3365",
125
- "@cedarjs/cli-helpers": "8.0.0-canary.3365",
126
- "@cedarjs/graphql-server": "8.0.0-canary.3365",
127
- "@cedarjs/project-config": "8.0.0-canary.3365",
128
- "@cedarjs/router": "8.0.0-canary.3365",
129
- "@cedarjs/structure": "8.0.0-canary.3365",
130
- "@cedarjs/utils": "8.0.0-canary.3365",
123
+ "@cedarjs/api": "8.0.0-canary.3366",
124
+ "@cedarjs/babel-config": "8.0.0-canary.3366",
125
+ "@cedarjs/cli-helpers": "8.0.0-canary.3366",
126
+ "@cedarjs/graphql-server": "8.0.0-canary.3366",
127
+ "@cedarjs/project-config": "8.0.0-canary.3366",
128
+ "@cedarjs/router": "8.0.0-canary.3366",
129
+ "@cedarjs/structure": "8.0.0-canary.3366",
130
+ "@cedarjs/utils": "8.0.0-canary.3366",
131
131
  "@graphql-codegen/add": "6.0.1",
132
132
  "@graphql-codegen/cli": "6.3.1",
133
133
  "@graphql-codegen/client-preset": "5.3.0",
@@ -165,7 +165,7 @@
165
165
  "vite-tsconfig-paths": "^6.1.1"
166
166
  },
167
167
  "devDependencies": {
168
- "@cedarjs/framework-tools": "8.0.0-canary.3365",
168
+ "@cedarjs/framework-tools": "8.0.0-canary.3366",
169
169
  "@jridgewell/trace-mapping": "0.3.31",
170
170
  "@oxc-project/types": "^0.153.0",
171
171
  "concurrently": "9.2.4",