@prisma/client-generator-ts 6.7.0-dev.14 → 6.7.0-dev.16
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/TSClient/GenerateContext.d.ts +4 -1
- package/dist/index.js +20 -8
- package/dist/index.mjs +20 -8
- package/dist/utils/buildDirname.d.ts +2 -1
- package/package.json +10 -10
|
@@ -2,12 +2,14 @@ import { GeneratorConfig } from '@prisma/generator';
|
|
|
2
2
|
import { DMMFHelper } from '../dmmf';
|
|
3
3
|
import { FileNameMapper } from '../file-extensions';
|
|
4
4
|
import { GenericArgsInfo } from '../GenericsArgsInfo';
|
|
5
|
+
import { ModuleFormat } from '../module-format';
|
|
5
6
|
export interface GenerateContextOptions {
|
|
6
7
|
dmmf: DMMFHelper;
|
|
7
8
|
genericArgsInfo: GenericArgsInfo;
|
|
8
9
|
runtimeImport: string;
|
|
9
10
|
outputFileName: FileNameMapper;
|
|
10
11
|
importFileName: FileNameMapper;
|
|
12
|
+
moduleFormat: ModuleFormat;
|
|
11
13
|
generator?: GeneratorConfig;
|
|
12
14
|
}
|
|
13
15
|
export declare class GenerateContext implements GenerateContextOptions {
|
|
@@ -16,7 +18,8 @@ export declare class GenerateContext implements GenerateContextOptions {
|
|
|
16
18
|
runtimeImport: string;
|
|
17
19
|
outputFileName: FileNameMapper;
|
|
18
20
|
importFileName: FileNameMapper;
|
|
21
|
+
moduleFormat: ModuleFormat;
|
|
19
22
|
generator?: GeneratorConfig;
|
|
20
|
-
constructor({ dmmf, genericArgsInfo, runtimeImport, outputFileName, importFileName, generator, }: GenerateContextOptions);
|
|
23
|
+
constructor({ dmmf, genericArgsInfo, runtimeImport, outputFileName, importFileName, moduleFormat, generator, }: GenerateContextOptions);
|
|
21
24
|
isPreviewFeatureOn(previewFeature: string): boolean;
|
|
22
25
|
}
|
package/dist/index.js
CHANGED
|
@@ -2952,10 +2952,13 @@ function buildDebugInitialization(edge) {
|
|
|
2952
2952
|
}
|
|
2953
2953
|
|
|
2954
2954
|
// src/utils/buildDirname.ts
|
|
2955
|
-
function buildDirname(edge) {
|
|
2955
|
+
function buildDirname(edge, moduleFormat) {
|
|
2956
2956
|
if (edge === true) {
|
|
2957
2957
|
return `config.dirname = '/'`;
|
|
2958
2958
|
}
|
|
2959
|
+
if (moduleFormat === "esm") {
|
|
2960
|
+
return `config.dirname = path.dirname(fileURLToPath(import.meta.url))`;
|
|
2961
|
+
}
|
|
2959
2962
|
return `config.dirname = __dirname`;
|
|
2960
2963
|
}
|
|
2961
2964
|
|
|
@@ -3804,9 +3807,9 @@ export const PrismaClient = runtime.getPrismaClient(config) as unknown as Prisma
|
|
|
3804
3807
|
// src/TSClient/file-generators/ClassFile.ts
|
|
3805
3808
|
var jsDocHeader = `/**
|
|
3806
3809
|
* WARNING: This is an internal file that is subject to change!
|
|
3807
|
-
*
|
|
3810
|
+
*
|
|
3808
3811
|
* \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
|
|
3809
|
-
*
|
|
3812
|
+
*
|
|
3810
3813
|
* Please import the \`PrismaClient\` class from the \`client.ts\` file instead.
|
|
3811
3814
|
*/
|
|
3812
3815
|
`;
|
|
@@ -3814,11 +3817,16 @@ function createClassFile(context, options) {
|
|
|
3814
3817
|
const imports = [
|
|
3815
3818
|
ts5.moduleImport(context.runtimeImport).asNamespace("runtime"),
|
|
3816
3819
|
ts5.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
|
|
3817
|
-
]
|
|
3820
|
+
];
|
|
3821
|
+
if (context.moduleFormat === "esm") {
|
|
3822
|
+
imports.unshift(ts5.moduleImport("node:url").named("fileURLToPath"));
|
|
3823
|
+
imports.unshift(ts5.moduleImport("node:path").asNamespace("path"));
|
|
3824
|
+
}
|
|
3825
|
+
const stringifiedImports = imports.map((i) => ts5.stringify(i));
|
|
3818
3826
|
const prismaClientClass = new PrismaClientClass(context, options.runtimeName);
|
|
3819
3827
|
return `${jsDocHeader}
|
|
3820
|
-
${
|
|
3821
|
-
|
|
3828
|
+
${stringifiedImports.join("\n")}
|
|
3829
|
+
|
|
3822
3830
|
${clientConfig(context, options)}
|
|
3823
3831
|
|
|
3824
3832
|
${prismaClientClass.toTS()}
|
|
@@ -3862,7 +3870,7 @@ function clientConfig(context, options) {
|
|
|
3862
3870
|
};
|
|
3863
3871
|
return `
|
|
3864
3872
|
const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
|
|
3865
|
-
${buildDirname(edge)}
|
|
3873
|
+
${buildDirname(edge, context.moduleFormat)}
|
|
3866
3874
|
${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
|
|
3867
3875
|
${buildGetWasmModule({ component: "engine", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
3868
3876
|
${buildGetWasmModule({ component: "compiler", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
@@ -5800,6 +5808,7 @@ var GenerateContext = class {
|
|
|
5800
5808
|
runtimeImport;
|
|
5801
5809
|
outputFileName;
|
|
5802
5810
|
importFileName;
|
|
5811
|
+
moduleFormat;
|
|
5803
5812
|
generator;
|
|
5804
5813
|
constructor({
|
|
5805
5814
|
dmmf,
|
|
@@ -5807,6 +5816,7 @@ var GenerateContext = class {
|
|
|
5807
5816
|
runtimeImport: runtimeImport2,
|
|
5808
5817
|
outputFileName,
|
|
5809
5818
|
importFileName,
|
|
5819
|
+
moduleFormat,
|
|
5810
5820
|
generator
|
|
5811
5821
|
}) {
|
|
5812
5822
|
this.dmmf = dmmf;
|
|
@@ -5814,6 +5824,7 @@ var GenerateContext = class {
|
|
|
5814
5824
|
this.runtimeImport = runtimeImport2;
|
|
5815
5825
|
this.outputFileName = outputFileName;
|
|
5816
5826
|
this.importFileName = importFileName;
|
|
5827
|
+
this.moduleFormat = moduleFormat;
|
|
5817
5828
|
this.generator = generator;
|
|
5818
5829
|
}
|
|
5819
5830
|
isPreviewFeatureOn(previewFeature) {
|
|
@@ -5837,6 +5848,7 @@ var TSClient = class {
|
|
|
5837
5848
|
runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
|
|
5838
5849
|
outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
|
|
5839
5850
|
importFileName: importFileNameMapper(this.options.importFileExtension),
|
|
5851
|
+
moduleFormat: this.options.moduleFormat,
|
|
5840
5852
|
generator: this.options.generator
|
|
5841
5853
|
});
|
|
5842
5854
|
const modelNames = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => model.name);
|
|
@@ -6425,7 +6437,7 @@ var import_get_tsconfig = require("get-tsconfig");
|
|
|
6425
6437
|
var import_ts_pattern2 = require("ts-pattern");
|
|
6426
6438
|
|
|
6427
6439
|
// package.json
|
|
6428
|
-
var version = "6.7.0-dev.
|
|
6440
|
+
var version = "6.7.0-dev.16";
|
|
6429
6441
|
|
|
6430
6442
|
// src/module-format.ts
|
|
6431
6443
|
function parseModuleFormat(format) {
|
package/dist/index.mjs
CHANGED
|
@@ -2948,10 +2948,13 @@ function buildDebugInitialization(edge) {
|
|
|
2948
2948
|
}
|
|
2949
2949
|
|
|
2950
2950
|
// src/utils/buildDirname.ts
|
|
2951
|
-
function buildDirname(edge) {
|
|
2951
|
+
function buildDirname(edge, moduleFormat) {
|
|
2952
2952
|
if (edge === true) {
|
|
2953
2953
|
return `config.dirname = '/'`;
|
|
2954
2954
|
}
|
|
2955
|
+
if (moduleFormat === "esm") {
|
|
2956
|
+
return `config.dirname = path.dirname(fileURLToPath(import.meta.url))`;
|
|
2957
|
+
}
|
|
2955
2958
|
return `config.dirname = __dirname`;
|
|
2956
2959
|
}
|
|
2957
2960
|
|
|
@@ -3803,9 +3806,9 @@ export const PrismaClient = runtime.getPrismaClient(config) as unknown as Prisma
|
|
|
3803
3806
|
// src/TSClient/file-generators/ClassFile.ts
|
|
3804
3807
|
var jsDocHeader = `/**
|
|
3805
3808
|
* WARNING: This is an internal file that is subject to change!
|
|
3806
|
-
*
|
|
3809
|
+
*
|
|
3807
3810
|
* \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
|
|
3808
|
-
*
|
|
3811
|
+
*
|
|
3809
3812
|
* Please import the \`PrismaClient\` class from the \`client.ts\` file instead.
|
|
3810
3813
|
*/
|
|
3811
3814
|
`;
|
|
@@ -3813,11 +3816,16 @@ function createClassFile(context, options) {
|
|
|
3813
3816
|
const imports = [
|
|
3814
3817
|
ts5.moduleImport(context.runtimeImport).asNamespace("runtime"),
|
|
3815
3818
|
ts5.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
|
|
3816
|
-
]
|
|
3819
|
+
];
|
|
3820
|
+
if (context.moduleFormat === "esm") {
|
|
3821
|
+
imports.unshift(ts5.moduleImport("node:url").named("fileURLToPath"));
|
|
3822
|
+
imports.unshift(ts5.moduleImport("node:path").asNamespace("path"));
|
|
3823
|
+
}
|
|
3824
|
+
const stringifiedImports = imports.map((i) => ts5.stringify(i));
|
|
3817
3825
|
const prismaClientClass = new PrismaClientClass(context, options.runtimeName);
|
|
3818
3826
|
return `${jsDocHeader}
|
|
3819
|
-
${
|
|
3820
|
-
|
|
3827
|
+
${stringifiedImports.join("\n")}
|
|
3828
|
+
|
|
3821
3829
|
${clientConfig(context, options)}
|
|
3822
3830
|
|
|
3823
3831
|
${prismaClientClass.toTS()}
|
|
@@ -3861,7 +3869,7 @@ function clientConfig(context, options) {
|
|
|
3861
3869
|
};
|
|
3862
3870
|
return `
|
|
3863
3871
|
const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
|
|
3864
|
-
${buildDirname(edge)}
|
|
3872
|
+
${buildDirname(edge, context.moduleFormat)}
|
|
3865
3873
|
${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
|
|
3866
3874
|
${buildGetWasmModule({ component: "engine", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
3867
3875
|
${buildGetWasmModule({ component: "compiler", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
@@ -5799,6 +5807,7 @@ var GenerateContext = class {
|
|
|
5799
5807
|
runtimeImport;
|
|
5800
5808
|
outputFileName;
|
|
5801
5809
|
importFileName;
|
|
5810
|
+
moduleFormat;
|
|
5802
5811
|
generator;
|
|
5803
5812
|
constructor({
|
|
5804
5813
|
dmmf,
|
|
@@ -5806,6 +5815,7 @@ var GenerateContext = class {
|
|
|
5806
5815
|
runtimeImport: runtimeImport2,
|
|
5807
5816
|
outputFileName,
|
|
5808
5817
|
importFileName,
|
|
5818
|
+
moduleFormat,
|
|
5809
5819
|
generator
|
|
5810
5820
|
}) {
|
|
5811
5821
|
this.dmmf = dmmf;
|
|
@@ -5813,6 +5823,7 @@ var GenerateContext = class {
|
|
|
5813
5823
|
this.runtimeImport = runtimeImport2;
|
|
5814
5824
|
this.outputFileName = outputFileName;
|
|
5815
5825
|
this.importFileName = importFileName;
|
|
5826
|
+
this.moduleFormat = moduleFormat;
|
|
5816
5827
|
this.generator = generator;
|
|
5817
5828
|
}
|
|
5818
5829
|
isPreviewFeatureOn(previewFeature) {
|
|
@@ -5836,6 +5847,7 @@ var TSClient = class {
|
|
|
5836
5847
|
runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
|
|
5837
5848
|
outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
|
|
5838
5849
|
importFileName: importFileNameMapper(this.options.importFileExtension),
|
|
5850
|
+
moduleFormat: this.options.moduleFormat,
|
|
5839
5851
|
generator: this.options.generator
|
|
5840
5852
|
});
|
|
5841
5853
|
const modelNames = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => model.name);
|
|
@@ -6424,7 +6436,7 @@ import { getTsconfig } from "get-tsconfig";
|
|
|
6424
6436
|
import { match as match2 } from "ts-pattern";
|
|
6425
6437
|
|
|
6426
6438
|
// package.json
|
|
6427
|
-
var version = "6.7.0-dev.
|
|
6439
|
+
var version = "6.7.0-dev.16";
|
|
6428
6440
|
|
|
6429
6441
|
// src/module-format.ts
|
|
6430
6442
|
function parseModuleFormat(format) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { ModuleFormat } from '../module-format';
|
|
1
2
|
/**
|
|
2
3
|
* Builds a `dirname` variable that holds the location of the generated client.
|
|
3
4
|
*/
|
|
4
|
-
export declare function buildDirname(edge: boolean): "config.dirname = '/'" | "config.dirname = __dirname";
|
|
5
|
+
export declare function buildDirname(edge: boolean, moduleFormat: ModuleFormat): "config.dirname = '/'" | "config.dirname = path.dirname(fileURLToPath(import.meta.url))" | "config.dirname = __dirname";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-ts",
|
|
3
|
-
"version": "6.7.0-dev.
|
|
3
|
+
"version": "6.7.0-dev.16",
|
|
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.7.0-
|
|
28
|
+
"@prisma/engines-version": "6.7.0-13.01156ec681e285fff9622a2f3f4f081517d96b9b",
|
|
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.7.0-dev.
|
|
38
|
-
"@prisma/dmmf": "6.7.0-dev.
|
|
39
|
-
"@prisma/fetch-engine": "6.7.0-dev.
|
|
40
|
-
"@prisma/
|
|
41
|
-
"@prisma/
|
|
42
|
-
"@prisma/get-platform": "6.7.0-dev.
|
|
43
|
-
"@prisma/
|
|
44
|
-
"@prisma/
|
|
37
|
+
"@prisma/client-common": "6.7.0-dev.16",
|
|
38
|
+
"@prisma/dmmf": "6.7.0-dev.16",
|
|
39
|
+
"@prisma/fetch-engine": "6.7.0-dev.16",
|
|
40
|
+
"@prisma/generator": "6.7.0-dev.16",
|
|
41
|
+
"@prisma/debug": "6.7.0-dev.16",
|
|
42
|
+
"@prisma/get-platform": "6.7.0-dev.16",
|
|
43
|
+
"@prisma/ts-builders": "6.7.0-dev.16",
|
|
44
|
+
"@prisma/internals": "6.7.0-dev.16"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/pluralize": "0.0.33",
|