@prisma/client-generator-ts 7.3.0-dev.2 → 7.3.0-dev.3

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.
@@ -29,6 +29,7 @@ export interface GenerateClientOptions {
29
29
  moduleFormat: ModuleFormat;
30
30
  /** Include a "@ts-nocheck" comment at the top of all generated TS files */
31
31
  tsNoCheckPreamble: Boolean;
32
+ compilerBuild: 'fast' | 'small';
32
33
  }
33
34
  export interface FileMap {
34
35
  [name: string]: string | Buffer | FileMap;
@@ -37,5 +38,5 @@ export interface BuildClientResult {
37
38
  fileMap: FileMap;
38
39
  prismaClientDmmf: DMMF.Document;
39
40
  }
40
- export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
41
+ export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, compilerBuild, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
41
42
  export declare function generateClient(options: GenerateClientOptions): Promise<void>;
package/dist/index.d.mts CHANGED
@@ -43,6 +43,7 @@ export declare interface GenerateClientOptions {
43
43
  moduleFormat: ModuleFormat;
44
44
  /** Include a "@ts-nocheck" comment at the top of all generated TS files */
45
45
  tsNoCheckPreamble: Boolean;
46
+ compilerBuild: 'fast' | 'small';
46
47
  }
47
48
 
48
49
  declare type GeneratedFileExtension = (typeof expectedGeneratedFileExtensions)[number] | (string & {});
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export declare interface GenerateClientOptions {
43
43
  moduleFormat: ModuleFormat;
44
44
  /** Include a "@ts-nocheck" comment at the top of all generated TS files */
45
45
  tsNoCheckPreamble: Boolean;
46
+ compilerBuild: 'fast' | 'small';
46
47
  }
47
48
 
48
49
  declare type GeneratedFileExtension = (typeof expectedGeneratedFileExtensions)[number] | (string & {});
package/dist/index.js CHANGED
@@ -3433,19 +3433,26 @@ var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
3433
3433
  function usesEdgeWasmRuntime(runtimeName) {
3434
3434
  return runtimeName === "wasm-compiler-edge";
3435
3435
  }
3436
- function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat }) {
3436
+ function buildGetWasmModule({
3437
+ runtimeName,
3438
+ runtimeBase,
3439
+ activeProvider,
3440
+ moduleFormat,
3441
+ compilerBuild
3442
+ }) {
3437
3443
  const extension = (0, import_ts_pattern.match)(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
3438
3444
  const buildNonEdgeLoader = runtimeName === "client";
3439
3445
  const buildEdgeLoader = !buildNonEdgeLoader;
3446
+ const artifactName = `query_compiler_${compilerBuild}_bg`;
3440
3447
  let wasmPathBase;
3441
3448
  let wasmBindingsPath;
3442
3449
  let wasmModulePath;
3443
3450
  if (buildEdgeLoader) {
3444
- wasmPathBase = `./query_compiler_bg`;
3451
+ wasmPathBase = `./${artifactName}`;
3445
3452
  wasmBindingsPath = `${wasmPathBase}.js`;
3446
3453
  wasmModulePath = `${wasmPathBase}.wasm`;
3447
3454
  } else {
3448
- wasmPathBase = `${runtimeBase}/query_compiler_bg.${activeProvider}`;
3455
+ wasmPathBase = `${runtimeBase}/${artifactName}.${activeProvider}`;
3449
3456
  wasmBindingsPath = `${wasmPathBase}.mjs`;
3450
3457
  wasmModulePath = `${wasmPathBase}.wasm`;
3451
3458
  }
@@ -3465,7 +3472,9 @@ config.compilerWasm = {
3465
3472
  getQueryCompilerWasmModule: async () => {
3466
3473
  const { wasm } = await import(${JSON.stringify(wasmModulePath)})
3467
3474
  return await decodeBase64AsWasm(wasm)
3468
- }
3475
+ },
3476
+
3477
+ importName: ${JSON.stringify(`./${artifactName}.js`)}
3469
3478
  }`;
3470
3479
  }
3471
3480
  if (buildEdgeLoader) {
@@ -3475,7 +3484,9 @@ config.compilerWasm = {
3475
3484
  getQueryCompilerWasmModule: async () => {
3476
3485
  const { default: module } = await import(${JSON.stringify(`${wasmModulePath}?module`)})
3477
3486
  return module
3478
- }
3487
+ },
3488
+
3489
+ importName: ${JSON.stringify(`./${artifactName}.js`)}
3479
3490
  }`;
3480
3491
  }
3481
3492
  return `config.compilerWasm = undefined`;
@@ -3493,17 +3504,18 @@ function readSourceFile(sourceFile) {
3493
3504
  throw new Error(`Could not find ${sourceFile} in ${bundledLocation} or ${sourceLocation}`);
3494
3505
  }
3495
3506
  }
3496
- function buildWasmFileMap({ activeProvider, runtimeName }) {
3507
+ function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }) {
3497
3508
  const fileMap = {};
3498
3509
  debug("buildWasmFileMap with", { runtimeName });
3499
3510
  if (!usesEdgeWasmRuntime(runtimeName)) {
3500
3511
  debug("Skipping component compiler for runtime", runtimeName);
3501
3512
  return fileMap;
3502
3513
  }
3503
- const fileNameBase = `query_compiler_bg.${activeProvider}`;
3514
+ const artifactName = `query_compiler_${compilerBuild}_bg`;
3515
+ const fileNameBase = `${artifactName}.${activeProvider}`;
3504
3516
  const files = {
3505
- [`query_compiler_bg.wasm`]: `${fileNameBase}.wasm`,
3506
- [`query_compiler_bg.js`]: `${fileNameBase}.mjs`
3517
+ [`${artifactName}.wasm`]: `${fileNameBase}.wasm`,
3518
+ [`${artifactName}.js`]: `${fileNameBase}.mjs`
3507
3519
  };
3508
3520
  for (const [targetFile, sourceFile] of Object.entries(files)) {
3509
3521
  fileMap[targetFile] = readSourceFile(sourceFile);
@@ -3817,7 +3829,8 @@ function clientConfig(context, options) {
3817
3829
  runtimeName,
3818
3830
  target,
3819
3831
  activeProvider,
3820
- moduleFormat
3832
+ moduleFormat,
3833
+ compilerBuild
3821
3834
  } = options;
3822
3835
  const config = {
3823
3836
  previewFeatures: generator.previewFeatures,
@@ -3830,7 +3843,7 @@ function clientConfig(context, options) {
3830
3843
  return `
3831
3844
  const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
3832
3845
  ${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
3833
- ${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3846
+ ${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat, compilerBuild })}
3834
3847
  ${buildDebugInitialization(edge)}
3835
3848
  `;
3836
3849
  }
@@ -6131,7 +6144,8 @@ function buildClient({
6131
6144
  generatedFileExtension,
6132
6145
  importFileExtension,
6133
6146
  moduleFormat,
6134
- tsNoCheckPreamble: tsNoCheckPreamble2
6147
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6148
+ compilerBuild
6135
6149
  }) {
6136
6150
  const runtimeName = getRuntimeNameForTarget(target);
6137
6151
  const outputName = generatedFileNameMapper(generatedFileExtension);
@@ -6154,7 +6168,8 @@ function buildClient({
6154
6168
  generatedFileExtension,
6155
6169
  importFileExtension,
6156
6170
  moduleFormat,
6157
- tsNoCheckPreamble: tsNoCheckPreamble2
6171
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6172
+ compilerBuild
6158
6173
  };
6159
6174
  const client = new TSClient(clientOptions);
6160
6175
  let fileMap = client.generateClientFiles();
@@ -6177,7 +6192,8 @@ function buildClient({
6177
6192
  ...fileMap.internal,
6178
6193
  ...buildWasmFileMap({
6179
6194
  runtimeName,
6180
- activeProvider
6195
+ activeProvider,
6196
+ compilerBuild
6181
6197
  })
6182
6198
  }
6183
6199
  };
@@ -6214,7 +6230,8 @@ async function generateClient(options) {
6214
6230
  generatedFileExtension,
6215
6231
  importFileExtension,
6216
6232
  moduleFormat,
6217
- tsNoCheckPreamble: tsNoCheckPreamble2
6233
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6234
+ compilerBuild
6218
6235
  } = options;
6219
6236
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6220
6237
  const { prismaClientDmmf, fileMap } = buildClient({
@@ -6234,7 +6251,8 @@ async function generateClient(options) {
6234
6251
  generatedFileExtension,
6235
6252
  importFileExtension,
6236
6253
  moduleFormat,
6237
- tsNoCheckPreamble: tsNoCheckPreamble2
6254
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6255
+ compilerBuild
6238
6256
  });
6239
6257
  const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
6240
6258
  if (denylistsErrors) {
@@ -6406,7 +6424,7 @@ var import_internals7 = require("@prisma/internals");
6406
6424
  var import_get_tsconfig = require("get-tsconfig");
6407
6425
 
6408
6426
  // package.json
6409
- var version = "7.3.0-dev.2";
6427
+ var version = "7.3.0-dev.3";
6410
6428
 
6411
6429
  // src/module-format.ts
6412
6430
  function parseModuleFormat(format) {
@@ -6536,11 +6554,21 @@ var PrismaClientTsGenerator = class {
6536
6554
  generatedFileExtension,
6537
6555
  importFileExtension,
6538
6556
  moduleFormat,
6539
- tsNoCheckPreamble: true
6557
+ tsNoCheckPreamble: true,
6540
6558
  // Set to false only during internal tests
6559
+ compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild, target)
6541
6560
  });
6542
6561
  }
6543
6562
  };
6563
+ function parseCompilerBuildFromUnknown(value, target) {
6564
+ if (value === void 0) {
6565
+ return target === "vercel-edge" ? "small" : "fast";
6566
+ }
6567
+ if (value === "small" || value === "fast") {
6568
+ return value;
6569
+ }
6570
+ throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
6571
+ }
6544
6572
  // Annotate the CommonJS export names for ESM import in node:
6545
6573
  0 && (module.exports = {
6546
6574
  PrismaClientTsGenerator,
package/dist/index.mjs CHANGED
@@ -3426,19 +3426,26 @@ var debug = Debug("prisma:client-generator-ts:wasm");
3426
3426
  function usesEdgeWasmRuntime(runtimeName) {
3427
3427
  return runtimeName === "wasm-compiler-edge";
3428
3428
  }
3429
- function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat }) {
3429
+ function buildGetWasmModule({
3430
+ runtimeName,
3431
+ runtimeBase,
3432
+ activeProvider,
3433
+ moduleFormat,
3434
+ compilerBuild
3435
+ }) {
3430
3436
  const extension = match(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
3431
3437
  const buildNonEdgeLoader = runtimeName === "client";
3432
3438
  const buildEdgeLoader = !buildNonEdgeLoader;
3439
+ const artifactName = `query_compiler_${compilerBuild}_bg`;
3433
3440
  let wasmPathBase;
3434
3441
  let wasmBindingsPath;
3435
3442
  let wasmModulePath;
3436
3443
  if (buildEdgeLoader) {
3437
- wasmPathBase = `./query_compiler_bg`;
3444
+ wasmPathBase = `./${artifactName}`;
3438
3445
  wasmBindingsPath = `${wasmPathBase}.js`;
3439
3446
  wasmModulePath = `${wasmPathBase}.wasm`;
3440
3447
  } else {
3441
- wasmPathBase = `${runtimeBase}/query_compiler_bg.${activeProvider}`;
3448
+ wasmPathBase = `${runtimeBase}/${artifactName}.${activeProvider}`;
3442
3449
  wasmBindingsPath = `${wasmPathBase}.mjs`;
3443
3450
  wasmModulePath = `${wasmPathBase}.wasm`;
3444
3451
  }
@@ -3458,7 +3465,9 @@ config.compilerWasm = {
3458
3465
  getQueryCompilerWasmModule: async () => {
3459
3466
  const { wasm } = await import(${JSON.stringify(wasmModulePath)})
3460
3467
  return await decodeBase64AsWasm(wasm)
3461
- }
3468
+ },
3469
+
3470
+ importName: ${JSON.stringify(`./${artifactName}.js`)}
3462
3471
  }`;
3463
3472
  }
3464
3473
  if (buildEdgeLoader) {
@@ -3468,7 +3477,9 @@ config.compilerWasm = {
3468
3477
  getQueryCompilerWasmModule: async () => {
3469
3478
  const { default: module } = await import(${JSON.stringify(`${wasmModulePath}?module`)})
3470
3479
  return module
3471
- }
3480
+ },
3481
+
3482
+ importName: ${JSON.stringify(`./${artifactName}.js`)}
3472
3483
  }`;
3473
3484
  }
3474
3485
  return `config.compilerWasm = undefined`;
@@ -3486,17 +3497,18 @@ function readSourceFile(sourceFile) {
3486
3497
  throw new Error(`Could not find ${sourceFile} in ${bundledLocation} or ${sourceLocation}`);
3487
3498
  }
3488
3499
  }
3489
- function buildWasmFileMap({ activeProvider, runtimeName }) {
3500
+ function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }) {
3490
3501
  const fileMap = {};
3491
3502
  debug("buildWasmFileMap with", { runtimeName });
3492
3503
  if (!usesEdgeWasmRuntime(runtimeName)) {
3493
3504
  debug("Skipping component compiler for runtime", runtimeName);
3494
3505
  return fileMap;
3495
3506
  }
3496
- const fileNameBase = `query_compiler_bg.${activeProvider}`;
3507
+ const artifactName = `query_compiler_${compilerBuild}_bg`;
3508
+ const fileNameBase = `${artifactName}.${activeProvider}`;
3497
3509
  const files = {
3498
- [`query_compiler_bg.wasm`]: `${fileNameBase}.wasm`,
3499
- [`query_compiler_bg.js`]: `${fileNameBase}.mjs`
3510
+ [`${artifactName}.wasm`]: `${fileNameBase}.wasm`,
3511
+ [`${artifactName}.js`]: `${fileNameBase}.mjs`
3500
3512
  };
3501
3513
  for (const [targetFile, sourceFile] of Object.entries(files)) {
3502
3514
  fileMap[targetFile] = readSourceFile(sourceFile);
@@ -3810,7 +3822,8 @@ function clientConfig(context, options) {
3810
3822
  runtimeName,
3811
3823
  target,
3812
3824
  activeProvider,
3813
- moduleFormat
3825
+ moduleFormat,
3826
+ compilerBuild
3814
3827
  } = options;
3815
3828
  const config = {
3816
3829
  previewFeatures: generator.previewFeatures,
@@ -3823,7 +3836,7 @@ function clientConfig(context, options) {
3823
3836
  return `
3824
3837
  const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
3825
3838
  ${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
3826
- ${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3839
+ ${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat, compilerBuild })}
3827
3840
  ${buildDebugInitialization(edge)}
3828
3841
  `;
3829
3842
  }
@@ -6124,7 +6137,8 @@ function buildClient({
6124
6137
  generatedFileExtension,
6125
6138
  importFileExtension,
6126
6139
  moduleFormat,
6127
- tsNoCheckPreamble: tsNoCheckPreamble2
6140
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6141
+ compilerBuild
6128
6142
  }) {
6129
6143
  const runtimeName = getRuntimeNameForTarget(target);
6130
6144
  const outputName = generatedFileNameMapper(generatedFileExtension);
@@ -6147,7 +6161,8 @@ function buildClient({
6147
6161
  generatedFileExtension,
6148
6162
  importFileExtension,
6149
6163
  moduleFormat,
6150
- tsNoCheckPreamble: tsNoCheckPreamble2
6164
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6165
+ compilerBuild
6151
6166
  };
6152
6167
  const client = new TSClient(clientOptions);
6153
6168
  let fileMap = client.generateClientFiles();
@@ -6170,7 +6185,8 @@ function buildClient({
6170
6185
  ...fileMap.internal,
6171
6186
  ...buildWasmFileMap({
6172
6187
  runtimeName,
6173
- activeProvider
6188
+ activeProvider,
6189
+ compilerBuild
6174
6190
  })
6175
6191
  }
6176
6192
  };
@@ -6207,7 +6223,8 @@ async function generateClient(options) {
6207
6223
  generatedFileExtension,
6208
6224
  importFileExtension,
6209
6225
  moduleFormat,
6210
- tsNoCheckPreamble: tsNoCheckPreamble2
6226
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6227
+ compilerBuild
6211
6228
  } = options;
6212
6229
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6213
6230
  const { prismaClientDmmf, fileMap } = buildClient({
@@ -6227,7 +6244,8 @@ async function generateClient(options) {
6227
6244
  generatedFileExtension,
6228
6245
  importFileExtension,
6229
6246
  moduleFormat,
6230
- tsNoCheckPreamble: tsNoCheckPreamble2
6247
+ tsNoCheckPreamble: tsNoCheckPreamble2,
6248
+ compilerBuild
6231
6249
  });
6232
6250
  const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
6233
6251
  if (denylistsErrors) {
@@ -6399,7 +6417,7 @@ import { parseEnvValue } from "@prisma/internals";
6399
6417
  import { getTsconfig } from "get-tsconfig";
6400
6418
 
6401
6419
  // package.json
6402
- var version = "7.3.0-dev.2";
6420
+ var version = "7.3.0-dev.3";
6403
6421
 
6404
6422
  // src/module-format.ts
6405
6423
  function parseModuleFormat(format) {
@@ -6529,11 +6547,21 @@ var PrismaClientTsGenerator = class {
6529
6547
  generatedFileExtension,
6530
6548
  importFileExtension,
6531
6549
  moduleFormat,
6532
- tsNoCheckPreamble: true
6550
+ tsNoCheckPreamble: true,
6533
6551
  // Set to false only during internal tests
6552
+ compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild, target)
6534
6553
  });
6535
6554
  }
6536
6555
  };
6556
+ function parseCompilerBuildFromUnknown(value, target) {
6557
+ if (value === void 0) {
6558
+ return target === "vercel-edge" ? "small" : "fast";
6559
+ }
6560
+ if (value === "small" || value === "fast") {
6561
+ return value;
6562
+ }
6563
+ throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
6564
+ }
6537
6565
  export {
6538
6566
  PrismaClientTsGenerator,
6539
6567
  externalToInternalDmmf,
@@ -9,10 +9,12 @@ export type BuildWasmModuleOptions = {
9
9
  target: RuntimeTargetInternal;
10
10
  activeProvider: ActiveConnectorType;
11
11
  moduleFormat: ModuleFormat;
12
+ compilerBuild: 'fast' | 'small';
12
13
  };
13
- export declare function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat }: BuildWasmModuleOptions): string;
14
+ export declare function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat, compilerBuild, }: BuildWasmModuleOptions): string;
14
15
  export type BuildWasmFileMapOptions = {
15
16
  activeProvider: ActiveConnectorType;
16
17
  runtimeName: RuntimeName;
18
+ compilerBuild: 'fast' | 'small';
17
19
  };
18
- export declare function buildWasmFileMap({ activeProvider, runtimeName }: BuildWasmFileMapOptions): FileMap;
20
+ export declare function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }: BuildWasmFileMapOptions): FileMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-ts",
3
- "version": "7.3.0-dev.2",
3
+ "version": "7.3.0-dev.3",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "@antfu/ni": "0.21.12",
28
- "@prisma/engines-version": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
28
+ "@prisma/engines-version": "7.3.0-5.76bb4681f1254d55b127394fc978e3295d676a01",
29
29
  "fast-glob": "3.3.3",
30
30
  "get-tsconfig": "4.10.0",
31
31
  "indent-string": "4.0.0",
@@ -33,14 +33,14 @@
33
33
  "package-up": "5.0.0",
34
34
  "pluralize": "8.0.0",
35
35
  "ts-pattern": "5.6.2",
36
- "@prisma/client-common": "7.3.0-dev.2",
37
- "@prisma/debug": "7.3.0-dev.2",
38
- "@prisma/dmmf": "7.3.0-dev.2",
39
- "@prisma/fetch-engine": "7.3.0-dev.2",
40
- "@prisma/generator": "7.3.0-dev.2",
41
- "@prisma/get-platform": "7.3.0-dev.2",
42
- "@prisma/ts-builders": "7.3.0-dev.2",
43
- "@prisma/internals": "7.3.0-dev.2"
36
+ "@prisma/client-common": "7.3.0-dev.3",
37
+ "@prisma/debug": "7.3.0-dev.3",
38
+ "@prisma/dmmf": "7.3.0-dev.3",
39
+ "@prisma/fetch-engine": "7.3.0-dev.3",
40
+ "@prisma/generator": "7.3.0-dev.3",
41
+ "@prisma/get-platform": "7.3.0-dev.3",
42
+ "@prisma/internals": "7.3.0-dev.3",
43
+ "@prisma/ts-builders": "7.3.0-dev.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/pluralize": "0.0.33",