@prisma/client-generator-ts 6.15.0-dev.1 → 6.15.0-dev.11

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.
package/dist/index.js CHANGED
@@ -3446,51 +3446,7 @@ var import_node_path = __toESM(require("node:path"));
3446
3446
  var import_client_common11 = require("@prisma/client-common");
3447
3447
  var import_debug = require("@prisma/debug");
3448
3448
  var import_ts_pattern = require("ts-pattern");
3449
-
3450
- // src/runtime-targets.ts
3451
- var supportedRuntimes = ["nodejs", "deno", "bun", "workerd", "edge-light", "react-native"];
3452
- function parseRuntimeTarget(target) {
3453
- switch (target.toLowerCase()) {
3454
- case "node":
3455
- case "nodejs":
3456
- return "nodejs";
3457
- case "deno":
3458
- case "deno-deploy":
3459
- return "deno";
3460
- case "bun":
3461
- return "bun";
3462
- case "workerd":
3463
- case "cloudflare":
3464
- return "workerd";
3465
- case "edge-light":
3466
- case "vercel":
3467
- return "edge-light";
3468
- case "react-native":
3469
- return "react-native";
3470
- default:
3471
- throw new Error(
3472
- `Unknown target runtime: "${target}". The available options are: ${supportedRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
3473
- );
3474
- }
3475
- }
3476
- function parseRuntimeTargetFromUnknown(target) {
3477
- if (typeof target !== "string") {
3478
- throw new Error(`Invalid target runtime: ${JSON.stringify(target)}. Expected a string.`);
3479
- }
3480
- return parseRuntimeTarget(target);
3481
- }
3482
- function isNodeJsLike(target) {
3483
- return target === "nodejs" || target === "bun" || target === "deno";
3484
- }
3485
-
3486
- // src/utils/wasm.ts
3487
3449
  var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
3488
- function buildDynamicRequireFn() {
3489
- return `const dynamicRequireFn = async <const T extends string>(name: T) =>
3490
- typeof globalThis.__non_webpack_require__ === 'function'
3491
- ? Promise.resolve(globalThis.__non_webpack_require__(name))
3492
- : await import(/* webpackIgnore: true */ /* @vite-ignore */ name)`;
3493
- }
3494
3450
  function usesEdgeWasmRuntime(component, runtimeName) {
3495
3451
  return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
3496
3452
  }
@@ -3505,7 +3461,6 @@ function buildGetWasmModule({
3505
3461
  const capitalizedComponent = (0, import_client_common11.capitalize)(component);
3506
3462
  const extension = (0, import_ts_pattern.match)(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
3507
3463
  const buildNonEdgeLoader = (0, import_ts_pattern.match)(runtimeName).with("library", () => component === "engine" && !!process.env.PRISMA_CLIENT_FORCE_WASM).with("client", () => component === "compiler").otherwise(() => false);
3508
- const buildNodeJsLoader = buildNonEdgeLoader && isNodeJsLike(target);
3509
3464
  const buildEdgeLoader = usesEdgeWasmRuntime(component, runtimeName);
3510
3465
  let wasmPathBase;
3511
3466
  let wasmBindingsPath;
@@ -3519,7 +3474,7 @@ function buildGetWasmModule({
3519
3474
  wasmBindingsPath = `${wasmPathBase}.mjs`;
3520
3475
  wasmModulePath = `${wasmPathBase}.wasm`;
3521
3476
  }
3522
- if (buildNodeJsLoader) {
3477
+ if (buildNonEdgeLoader) {
3523
3478
  wasmBindingsPath = `${wasmPathBase}.${extension}`;
3524
3479
  wasmModulePath = `${wasmPathBase}.wasm-base64.${extension}`;
3525
3480
  return `
@@ -3537,23 +3492,6 @@ config.${component}Wasm = {
3537
3492
  const { wasm } = await import(${JSON.stringify(wasmModulePath)})
3538
3493
  return await decodeBase64AsWasm(wasm)
3539
3494
  }
3540
- }`;
3541
- }
3542
- if (buildNonEdgeLoader) {
3543
- return `config.${component}Wasm = {
3544
- getRuntime: async () => await import(${JSON.stringify(wasmBindingsPath)}),
3545
-
3546
- getQuery${capitalizedComponent}WasmModule: async () => {
3547
- ${buildDynamicRequireFn()}
3548
-
3549
- // Note: we must use dynamic imports here to avoid bundling errors like \`Module parse failed: Unexpected character '' (1:0)\`.
3550
- const { readFile } = await dynamicRequireFn('node:fs/promises')
3551
- ${buildRequire(moduleFormat)}
3552
- const wasmModulePath = _require.resolve(${JSON.stringify(wasmModulePath)})
3553
- const wasmModuleBytes = await readFile(wasmModulePath)
3554
-
3555
- return new globalThis.WebAssembly.Module(wasmModuleBytes)
3556
- }
3557
3495
  }`;
3558
3496
  }
3559
3497
  if (buildEdgeLoader) {
@@ -3569,14 +3507,6 @@ config.${component}Wasm = {
3569
3507
  }
3570
3508
  return `config.${component}Wasm = undefined`;
3571
3509
  }
3572
- function buildRequire(moduleFormat) {
3573
- if (moduleFormat === "cjs") {
3574
- return "const _require = require\n";
3575
- }
3576
- return `const { createRequire } = await dynamicRequireFn('node:module')
3577
- const _require = createRequire(import.meta.url)
3578
- `;
3579
- }
3580
3510
  function readSourceFile(sourceFile) {
3581
3511
  const bundledLocation = import_node_path.default.join(__dirname, sourceFile);
3582
3512
  const sourceLocation = import_node_path.default.join(__dirname, "..", "..", "..", "client", "runtime", sourceFile);
@@ -6606,6 +6536,7 @@ async function deleteOutputDir(outputDir) {
6606
6536
  (await (0, import_fast_glob.glob)(
6607
6537
  [
6608
6538
  `${outputDir}/**/*.{js,ts,mts,cts,d.ts}`,
6539
+ `${outputDir}/**/*.wasm`,
6609
6540
  `${outputDir}/*.node`,
6610
6541
  `${outputDir}/{query,schema}-engine-*`,
6611
6542
  `${outputDir}/package.json`,
@@ -6631,7 +6562,7 @@ var import_get_tsconfig = require("get-tsconfig");
6631
6562
  var import_ts_pattern2 = require("ts-pattern");
6632
6563
 
6633
6564
  // package.json
6634
- var version = "6.15.0-dev.1";
6565
+ var version = "6.15.0-dev.11";
6635
6566
 
6636
6567
  // src/module-format.ts
6637
6568
  function parseModuleFormat(format) {
@@ -6673,6 +6604,39 @@ function fromTsConfigModule(module2) {
6673
6604
  return "esm";
6674
6605
  }
6675
6606
 
6607
+ // src/runtime-targets.ts
6608
+ var supportedRuntimes = ["nodejs", "deno", "bun", "workerd", "edge-light", "react-native"];
6609
+ function parseRuntimeTarget(target) {
6610
+ switch (target.toLowerCase()) {
6611
+ case "node":
6612
+ case "nodejs":
6613
+ return "nodejs";
6614
+ case "deno":
6615
+ case "deno-deploy":
6616
+ return "deno";
6617
+ case "bun":
6618
+ return "bun";
6619
+ case "workerd":
6620
+ case "cloudflare":
6621
+ return "workerd";
6622
+ case "edge-light":
6623
+ case "vercel":
6624
+ return "edge-light";
6625
+ case "react-native":
6626
+ return "react-native";
6627
+ default:
6628
+ throw new Error(
6629
+ `Unknown target runtime: "${target}". The available options are: ${supportedRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
6630
+ );
6631
+ }
6632
+ }
6633
+ function parseRuntimeTargetFromUnknown(target) {
6634
+ if (typeof target !== "string") {
6635
+ throw new Error(`Invalid target runtime: ${JSON.stringify(target)}. Expected a string.`);
6636
+ }
6637
+ return parseRuntimeTarget(target);
6638
+ }
6639
+
6676
6640
  // src/generator.ts
6677
6641
  var debug2 = (0, import_debug2.Debug)("prisma:client:generator");
6678
6642
  var missingOutputErrorMessage = `An output path is required for the \`prisma-client\` generator. Please provide an output path in your schema file:
package/dist/index.mjs CHANGED
@@ -3445,51 +3445,7 @@ import path from "node:path";
3445
3445
  import { capitalize as capitalize6 } from "@prisma/client-common";
3446
3446
  import { Debug } from "@prisma/debug";
3447
3447
  import { match } from "ts-pattern";
3448
-
3449
- // src/runtime-targets.ts
3450
- var supportedRuntimes = ["nodejs", "deno", "bun", "workerd", "edge-light", "react-native"];
3451
- function parseRuntimeTarget(target) {
3452
- switch (target.toLowerCase()) {
3453
- case "node":
3454
- case "nodejs":
3455
- return "nodejs";
3456
- case "deno":
3457
- case "deno-deploy":
3458
- return "deno";
3459
- case "bun":
3460
- return "bun";
3461
- case "workerd":
3462
- case "cloudflare":
3463
- return "workerd";
3464
- case "edge-light":
3465
- case "vercel":
3466
- return "edge-light";
3467
- case "react-native":
3468
- return "react-native";
3469
- default:
3470
- throw new Error(
3471
- `Unknown target runtime: "${target}". The available options are: ${supportedRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
3472
- );
3473
- }
3474
- }
3475
- function parseRuntimeTargetFromUnknown(target) {
3476
- if (typeof target !== "string") {
3477
- throw new Error(`Invalid target runtime: ${JSON.stringify(target)}. Expected a string.`);
3478
- }
3479
- return parseRuntimeTarget(target);
3480
- }
3481
- function isNodeJsLike(target) {
3482
- return target === "nodejs" || target === "bun" || target === "deno";
3483
- }
3484
-
3485
- // src/utils/wasm.ts
3486
3448
  var debug = Debug("prisma:client-generator-ts:wasm");
3487
- function buildDynamicRequireFn() {
3488
- return `const dynamicRequireFn = async <const T extends string>(name: T) =>
3489
- typeof globalThis.__non_webpack_require__ === 'function'
3490
- ? Promise.resolve(globalThis.__non_webpack_require__(name))
3491
- : await import(/* webpackIgnore: true */ /* @vite-ignore */ name)`;
3492
- }
3493
3449
  function usesEdgeWasmRuntime(component, runtimeName) {
3494
3450
  return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
3495
3451
  }
@@ -3504,7 +3460,6 @@ function buildGetWasmModule({
3504
3460
  const capitalizedComponent = capitalize6(component);
3505
3461
  const extension = match(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
3506
3462
  const buildNonEdgeLoader = match(runtimeName).with("library", () => component === "engine" && !!process.env.PRISMA_CLIENT_FORCE_WASM).with("client", () => component === "compiler").otherwise(() => false);
3507
- const buildNodeJsLoader = buildNonEdgeLoader && isNodeJsLike(target);
3508
3463
  const buildEdgeLoader = usesEdgeWasmRuntime(component, runtimeName);
3509
3464
  let wasmPathBase;
3510
3465
  let wasmBindingsPath;
@@ -3518,7 +3473,7 @@ function buildGetWasmModule({
3518
3473
  wasmBindingsPath = `${wasmPathBase}.mjs`;
3519
3474
  wasmModulePath = `${wasmPathBase}.wasm`;
3520
3475
  }
3521
- if (buildNodeJsLoader) {
3476
+ if (buildNonEdgeLoader) {
3522
3477
  wasmBindingsPath = `${wasmPathBase}.${extension}`;
3523
3478
  wasmModulePath = `${wasmPathBase}.wasm-base64.${extension}`;
3524
3479
  return `
@@ -3536,23 +3491,6 @@ config.${component}Wasm = {
3536
3491
  const { wasm } = await import(${JSON.stringify(wasmModulePath)})
3537
3492
  return await decodeBase64AsWasm(wasm)
3538
3493
  }
3539
- }`;
3540
- }
3541
- if (buildNonEdgeLoader) {
3542
- return `config.${component}Wasm = {
3543
- getRuntime: async () => await import(${JSON.stringify(wasmBindingsPath)}),
3544
-
3545
- getQuery${capitalizedComponent}WasmModule: async () => {
3546
- ${buildDynamicRequireFn()}
3547
-
3548
- // Note: we must use dynamic imports here to avoid bundling errors like \`Module parse failed: Unexpected character '' (1:0)\`.
3549
- const { readFile } = await dynamicRequireFn('node:fs/promises')
3550
- ${buildRequire(moduleFormat)}
3551
- const wasmModulePath = _require.resolve(${JSON.stringify(wasmModulePath)})
3552
- const wasmModuleBytes = await readFile(wasmModulePath)
3553
-
3554
- return new globalThis.WebAssembly.Module(wasmModuleBytes)
3555
- }
3556
3494
  }`;
3557
3495
  }
3558
3496
  if (buildEdgeLoader) {
@@ -3568,14 +3506,6 @@ config.${component}Wasm = {
3568
3506
  }
3569
3507
  return `config.${component}Wasm = undefined`;
3570
3508
  }
3571
- function buildRequire(moduleFormat) {
3572
- if (moduleFormat === "cjs") {
3573
- return "const _require = require\n";
3574
- }
3575
- return `const { createRequire } = await dynamicRequireFn('node:module')
3576
- const _require = createRequire(import.meta.url)
3577
- `;
3578
- }
3579
3509
  function readSourceFile(sourceFile) {
3580
3510
  const bundledLocation = path.join(__dirname, sourceFile);
3581
3511
  const sourceLocation = path.join(__dirname, "..", "..", "..", "client", "runtime", sourceFile);
@@ -6605,6 +6535,7 @@ async function deleteOutputDir(outputDir) {
6605
6535
  (await glob(
6606
6536
  [
6607
6537
  `${outputDir}/**/*.{js,ts,mts,cts,d.ts}`,
6538
+ `${outputDir}/**/*.wasm`,
6608
6539
  `${outputDir}/*.node`,
6609
6540
  `${outputDir}/{query,schema}-engine-*`,
6610
6541
  `${outputDir}/package.json`,
@@ -6630,7 +6561,7 @@ import { getTsconfig } from "get-tsconfig";
6630
6561
  import { match as match2 } from "ts-pattern";
6631
6562
 
6632
6563
  // package.json
6633
- var version = "6.15.0-dev.1";
6564
+ var version = "6.15.0-dev.11";
6634
6565
 
6635
6566
  // src/module-format.ts
6636
6567
  function parseModuleFormat(format) {
@@ -6672,6 +6603,39 @@ function fromTsConfigModule(module) {
6672
6603
  return "esm";
6673
6604
  }
6674
6605
 
6606
+ // src/runtime-targets.ts
6607
+ var supportedRuntimes = ["nodejs", "deno", "bun", "workerd", "edge-light", "react-native"];
6608
+ function parseRuntimeTarget(target) {
6609
+ switch (target.toLowerCase()) {
6610
+ case "node":
6611
+ case "nodejs":
6612
+ return "nodejs";
6613
+ case "deno":
6614
+ case "deno-deploy":
6615
+ return "deno";
6616
+ case "bun":
6617
+ return "bun";
6618
+ case "workerd":
6619
+ case "cloudflare":
6620
+ return "workerd";
6621
+ case "edge-light":
6622
+ case "vercel":
6623
+ return "edge-light";
6624
+ case "react-native":
6625
+ return "react-native";
6626
+ default:
6627
+ throw new Error(
6628
+ `Unknown target runtime: "${target}". The available options are: ${supportedRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
6629
+ );
6630
+ }
6631
+ }
6632
+ function parseRuntimeTargetFromUnknown(target) {
6633
+ if (typeof target !== "string") {
6634
+ throw new Error(`Invalid target runtime: ${JSON.stringify(target)}. Expected a string.`);
6635
+ }
6636
+ return parseRuntimeTarget(target);
6637
+ }
6638
+
6675
6639
  // src/generator.ts
6676
6640
  var debug2 = Debug2("prisma:client:generator");
6677
6641
  var missingOutputErrorMessage = `An output path is required for the \`prisma-client\` generator. Please provide an output path in your schema file:
@@ -2,5 +2,4 @@ declare const supportedRuntimes: readonly ["nodejs", "deno", "bun", "workerd", "
2
2
  export type RuntimeTarget = (typeof supportedRuntimes)[number];
3
3
  export declare function parseRuntimeTarget(target: string): RuntimeTarget;
4
4
  export declare function parseRuntimeTargetFromUnknown(target: unknown): RuntimeTarget;
5
- export declare function isNodeJsLike(target: RuntimeTarget): boolean;
6
5
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-ts",
3
- "version": "6.15.0-dev.1",
3
+ "version": "6.15.0-dev.11",
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": "6.14.0-25.717184b7b35ea05dfa71a3236b7af656013e1e49",
28
+ "@prisma/engines-version": "6.15.0-3.b6523d21f41470c3678cc736b3d4f2cdce9082fe",
29
29
  "ci-info": "4.2.0",
30
30
  "fast-glob": "3.3.3",
31
31
  "get-tsconfig": "4.10.0",
@@ -34,14 +34,14 @@
34
34
  "pkg-up": "3.1.0",
35
35
  "pluralize": "8.0.0",
36
36
  "ts-pattern": "5.6.2",
37
- "@prisma/client-common": "6.15.0-dev.1",
38
- "@prisma/debug": "6.15.0-dev.1",
39
- "@prisma/generator": "6.15.0-dev.1",
40
- "@prisma/dmmf": "6.15.0-dev.1",
41
- "@prisma/fetch-engine": "6.15.0-dev.1",
42
- "@prisma/get-platform": "6.15.0-dev.1",
43
- "@prisma/internals": "6.15.0-dev.1",
44
- "@prisma/ts-builders": "6.15.0-dev.1"
37
+ "@prisma/debug": "6.15.0-dev.11",
38
+ "@prisma/client-common": "6.15.0-dev.11",
39
+ "@prisma/dmmf": "6.15.0-dev.11",
40
+ "@prisma/fetch-engine": "6.15.0-dev.11",
41
+ "@prisma/generator": "6.15.0-dev.11",
42
+ "@prisma/get-platform": "6.15.0-dev.11",
43
+ "@prisma/ts-builders": "6.15.0-dev.11",
44
+ "@prisma/internals": "6.15.0-dev.11"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/pluralize": "0.0.33",