@prisma/config 6.20.0-integration-next.3 → 6.20.0-integration-merge-release-workflows.2
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.d.ts +47 -0
- package/dist/index.js +138 -75
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -204,6 +204,20 @@ declare type LoadConfigFromFileInput = {
|
|
|
204
204
|
configRoot?: string;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
/**
|
|
208
|
+
* User's Prisma configuration should live in `prisma.config.ts` instead of `package.json#prisma`.
|
|
209
|
+
* See: https://pris.ly/prisma-config.
|
|
210
|
+
*
|
|
211
|
+
* This function returns `null` if no `package.json` is found, or if the `prisma` property is not defined therein.
|
|
212
|
+
*
|
|
213
|
+
* TODO: remove in Prisma 7.
|
|
214
|
+
* @deprecated
|
|
215
|
+
*/
|
|
216
|
+
export declare function loadConfigFromPackageJson(cwd?: string): Promise<{
|
|
217
|
+
config: PrismaConfigPackageJson;
|
|
218
|
+
loadedFromFile: string;
|
|
219
|
+
} | null>;
|
|
220
|
+
|
|
207
221
|
declare type MappedError = {
|
|
208
222
|
kind: 'GenericJs';
|
|
209
223
|
id: number;
|
|
@@ -355,6 +369,25 @@ export declare type PrismaConfigInternal = _PrismaConfigInternal & {
|
|
|
355
369
|
|
|
356
370
|
declare type _PrismaConfigInternal = Omit<PrismaConfig, 'engine' | 'datasource' | 'adapter'> & {
|
|
357
371
|
loadedFromFile: string | null;
|
|
372
|
+
/**
|
|
373
|
+
* The deprecated Prisma configuration from `package.json#prisma`.
|
|
374
|
+
* This is set to `null` if no `package.json#prisma` config was found.
|
|
375
|
+
* The configuration read from the Prisma config file (e.g., `prisma.config.ts`) takes precedence over
|
|
376
|
+
* this `package.json#prisma` config.
|
|
377
|
+
* @deprecated
|
|
378
|
+
*/
|
|
379
|
+
deprecatedPackageJson: {
|
|
380
|
+
/**
|
|
381
|
+
* The Prisma configuration from `package.json#prisma`.
|
|
382
|
+
* @deprecated
|
|
383
|
+
*/
|
|
384
|
+
config: PrismaConfigPackageJson;
|
|
385
|
+
/**
|
|
386
|
+
* The path from where the `package.json` config was loaded.
|
|
387
|
+
* @deprecated
|
|
388
|
+
*/
|
|
389
|
+
loadedFromFile: string;
|
|
390
|
+
} | null;
|
|
358
391
|
} & ({
|
|
359
392
|
engine: 'classic';
|
|
360
393
|
datasource: {
|
|
@@ -368,6 +401,20 @@ declare type _PrismaConfigInternal = Omit<PrismaConfig, 'engine' | 'datasource'
|
|
|
368
401
|
engine?: never;
|
|
369
402
|
});
|
|
370
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Example:
|
|
406
|
+
* ```json
|
|
407
|
+
* {
|
|
408
|
+
* "schema": "./prisma/schema.prisma",
|
|
409
|
+
* "seed": "tsx ./prisma/seed.ts"
|
|
410
|
+
* }
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
declare type PrismaConfigPackageJson = {
|
|
414
|
+
schema?: string;
|
|
415
|
+
seed?: string;
|
|
416
|
+
};
|
|
417
|
+
|
|
371
418
|
declare type PrismaConfigUnconditional = {
|
|
372
419
|
/**
|
|
373
420
|
* Experimental feature gates. Each experimental feature must be explicitly enabled.
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,8 @@ __export(index_exports, {
|
|
|
34
34
|
defaultTestConfig: () => defaultTestConfig,
|
|
35
35
|
defineConfig: () => defineConfig,
|
|
36
36
|
env: () => env,
|
|
37
|
-
loadConfigFromFile: () => loadConfigFromFile
|
|
37
|
+
loadConfigFromFile: () => loadConfigFromFile,
|
|
38
|
+
loadConfigFromPackageJson: () => loadConfigFromPackageJson
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(index_exports);
|
|
40
41
|
|
|
@@ -357,7 +358,7 @@ var mockAdapterErrors = {
|
|
|
357
358
|
};
|
|
358
359
|
|
|
359
360
|
// src/PrismaConfig.ts
|
|
360
|
-
var
|
|
361
|
+
var import_effect3 = require("effect");
|
|
361
362
|
var import_Function = require("effect/Function");
|
|
362
363
|
|
|
363
364
|
// src/defineConfig.ts
|
|
@@ -366,7 +367,8 @@ var import_effect = require("effect");
|
|
|
366
367
|
// src/defaultConfig.ts
|
|
367
368
|
function defaultConfig() {
|
|
368
369
|
return makePrismaConfigInternal({
|
|
369
|
-
loadedFromFile: null
|
|
370
|
+
loadedFromFile: null,
|
|
371
|
+
deprecatedPackageJson: null
|
|
370
372
|
});
|
|
371
373
|
}
|
|
372
374
|
|
|
@@ -511,105 +513,133 @@ function defineExtensionsConfig(config, configInput) {
|
|
|
511
513
|
debug2("[config.extensions]: %o", config["extensions"]);
|
|
512
514
|
}
|
|
513
515
|
|
|
516
|
+
// src/loadConfigFromPackageJson.ts
|
|
517
|
+
var import_promises = require("node:fs/promises");
|
|
518
|
+
var import_node_process = __toESM(require("node:process"));
|
|
519
|
+
var import_effect2 = require("effect");
|
|
520
|
+
var import_package = require("empathic/package");
|
|
521
|
+
var PrismaConfigPackageJsonShape = import_effect2.Schema.Struct({
|
|
522
|
+
schema: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
523
|
+
seed: import_effect2.Schema.optional(import_effect2.Schema.NonEmptyString)
|
|
524
|
+
});
|
|
525
|
+
async function loadConfigFromPackageJson(cwd = import_node_process.default.cwd()) {
|
|
526
|
+
const pkgPath = (0, import_package.up)({ cwd });
|
|
527
|
+
if (pkgPath === void 0) {
|
|
528
|
+
return null;
|
|
529
|
+
}
|
|
530
|
+
const pkgJson = await (0, import_promises.readFile)(pkgPath, { encoding: "utf-8" }).then((p) => JSON.parse(p));
|
|
531
|
+
const deprecatedConfig = pkgJson["prisma"];
|
|
532
|
+
if (deprecatedConfig === void 0) {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
if (Object.keys(deprecatedConfig).length === 1 && deprecatedConfig["prismaCommit"] !== void 0) {
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
config: deprecatedConfig,
|
|
540
|
+
loadedFromFile: pkgPath
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
|
|
514
544
|
// src/PrismaConfig.ts
|
|
515
545
|
var debug3 = Debug("prisma:config:PrismaConfig");
|
|
516
|
-
var SqlMigrationAwareDriverAdapterFactoryShape =
|
|
546
|
+
var SqlMigrationAwareDriverAdapterFactoryShape = import_effect3.Schema.declare(
|
|
517
547
|
(input) => {
|
|
518
548
|
return typeof input === "function";
|
|
519
549
|
},
|
|
520
550
|
{
|
|
521
551
|
identifier: "SqlMigrationAwareDriverAdapterFactory",
|
|
522
|
-
encode:
|
|
523
|
-
decode:
|
|
552
|
+
encode: import_effect3.identity,
|
|
553
|
+
decode: import_effect3.identity
|
|
524
554
|
}
|
|
525
555
|
);
|
|
526
|
-
var ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape =
|
|
556
|
+
var ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape = import_effect3.Schema.declare(
|
|
527
557
|
(input) => {
|
|
528
558
|
return typeof input === "function";
|
|
529
559
|
},
|
|
530
560
|
{
|
|
531
561
|
identifier: "ErrorCapturingSqlMigrationAwareDriverAdapterFactory",
|
|
532
|
-
encode:
|
|
533
|
-
decode:
|
|
562
|
+
encode: import_effect3.identity,
|
|
563
|
+
decode: import_effect3.identity
|
|
534
564
|
}
|
|
535
565
|
);
|
|
536
|
-
var SchemaEngineConfigClassicShape =
|
|
537
|
-
engine:
|
|
538
|
-
datasource:
|
|
539
|
-
url:
|
|
540
|
-
directUrl:
|
|
541
|
-
shadowDatabaseUrl:
|
|
566
|
+
var SchemaEngineConfigClassicShape = import_effect3.Schema.Struct({
|
|
567
|
+
engine: import_effect3.Schema.Literal("classic"),
|
|
568
|
+
datasource: import_effect3.Schema.Struct({
|
|
569
|
+
url: import_effect3.Schema.String,
|
|
570
|
+
directUrl: import_effect3.Schema.optional(import_effect3.Schema.String),
|
|
571
|
+
shadowDatabaseUrl: import_effect3.Schema.optional(import_effect3.Schema.String)
|
|
542
572
|
})
|
|
543
573
|
});
|
|
544
|
-
var SchemaEngineConfigJsShape =
|
|
545
|
-
engine:
|
|
574
|
+
var SchemaEngineConfigJsShape = import_effect3.Schema.Struct({
|
|
575
|
+
engine: import_effect3.Schema.Literal("js"),
|
|
546
576
|
adapter: SqlMigrationAwareDriverAdapterFactoryShape
|
|
547
577
|
});
|
|
548
|
-
var SchemaEngineConfigAbsentShape =
|
|
549
|
-
engine:
|
|
578
|
+
var SchemaEngineConfigAbsentShape = import_effect3.Schema.Struct({
|
|
579
|
+
engine: import_effect3.Schema.optional(import_effect3.Schema.Never)
|
|
550
580
|
});
|
|
551
|
-
var SchemaEngineConfigShape =
|
|
581
|
+
var SchemaEngineConfigShape = import_effect3.Schema.Union(
|
|
552
582
|
SchemaEngineConfigClassicShape,
|
|
553
583
|
SchemaEngineConfigJsShape,
|
|
554
584
|
SchemaEngineConfigAbsentShape
|
|
555
585
|
);
|
|
556
|
-
var SchemaEngineConfigJsInternal =
|
|
557
|
-
engine:
|
|
586
|
+
var SchemaEngineConfigJsInternal = import_effect3.Schema.Struct({
|
|
587
|
+
engine: import_effect3.Schema.Literal("js"),
|
|
558
588
|
adapter: ErrorCapturingSqlMigrationAwareDriverAdapterFactoryShape
|
|
559
589
|
});
|
|
560
|
-
var SchemaEngineConfigInternal =
|
|
590
|
+
var SchemaEngineConfigInternal = import_effect3.Schema.Union(
|
|
561
591
|
SchemaEngineConfigClassicShape,
|
|
562
592
|
SchemaEngineConfigJsInternal,
|
|
563
593
|
SchemaEngineConfigAbsentShape
|
|
564
594
|
);
|
|
565
|
-
var ExperimentalConfigShape =
|
|
566
|
-
adapter:
|
|
567
|
-
studio:
|
|
568
|
-
externalTables:
|
|
569
|
-
extensions:
|
|
595
|
+
var ExperimentalConfigShape = import_effect3.Schema.Struct({
|
|
596
|
+
adapter: import_effect3.Schema.optional(import_effect3.Schema.Boolean),
|
|
597
|
+
studio: import_effect3.Schema.optional(import_effect3.Schema.Boolean),
|
|
598
|
+
externalTables: import_effect3.Schema.optional(import_effect3.Schema.Boolean),
|
|
599
|
+
extensions: import_effect3.Schema.optional(import_effect3.Schema.Boolean)
|
|
570
600
|
});
|
|
571
601
|
if (false) {
|
|
572
602
|
__testExperimentalConfigShapeValueA;
|
|
573
603
|
__testExperimentalConfigShapeValueB;
|
|
574
604
|
}
|
|
575
|
-
var MigrationsConfigShape =
|
|
576
|
-
path:
|
|
577
|
-
initShadowDb:
|
|
578
|
-
seed:
|
|
605
|
+
var MigrationsConfigShape = import_effect3.Schema.Struct({
|
|
606
|
+
path: import_effect3.Schema.optional(import_effect3.Schema.String),
|
|
607
|
+
initShadowDb: import_effect3.Schema.optional(import_effect3.Schema.String),
|
|
608
|
+
seed: import_effect3.Schema.optional(import_effect3.Schema.NonEmptyString)
|
|
579
609
|
});
|
|
580
610
|
if (false) {
|
|
581
611
|
__testMigrationsConfigShapeValueA;
|
|
582
612
|
__testMigrationsConfigShapeValueB;
|
|
583
613
|
}
|
|
584
|
-
var TablesConfigShape =
|
|
585
|
-
external:
|
|
614
|
+
var TablesConfigShape = import_effect3.Schema.Struct({
|
|
615
|
+
external: import_effect3.Schema.optional(import_effect3.Schema.mutable(import_effect3.Schema.Array(import_effect3.Schema.String)))
|
|
586
616
|
});
|
|
587
617
|
if (false) {
|
|
588
618
|
__testTablesConfigShapeValueA;
|
|
589
619
|
__testTablesConfigShapeValueB;
|
|
590
620
|
}
|
|
591
|
-
var EnumsConfigShape =
|
|
592
|
-
external:
|
|
621
|
+
var EnumsConfigShape = import_effect3.Schema.Struct({
|
|
622
|
+
external: import_effect3.Schema.optional(import_effect3.Schema.mutable(import_effect3.Schema.Array(import_effect3.Schema.String)))
|
|
593
623
|
});
|
|
594
624
|
if (false) {
|
|
595
625
|
__testEnumsConfigShapeValueA;
|
|
596
626
|
__testEnumsConfigShapeValueB;
|
|
597
627
|
}
|
|
598
|
-
var ViewsConfigShape =
|
|
599
|
-
path:
|
|
628
|
+
var ViewsConfigShape = import_effect3.Schema.Struct({
|
|
629
|
+
path: import_effect3.Schema.optional(import_effect3.Schema.String)
|
|
600
630
|
});
|
|
601
631
|
if (false) {
|
|
602
632
|
__testViewsConfigShapeValueA;
|
|
603
633
|
__testViewsConfigShapeValueB;
|
|
604
634
|
}
|
|
605
|
-
var TypedSqlConfigShape =
|
|
606
|
-
path:
|
|
635
|
+
var TypedSqlConfigShape = import_effect3.Schema.Struct({
|
|
636
|
+
path: import_effect3.Schema.optional(import_effect3.Schema.String)
|
|
607
637
|
});
|
|
608
638
|
if (false) {
|
|
609
639
|
__testTypedSqlConfigShapeValueA;
|
|
610
640
|
__testTypedSqlConfigShapeValueB;
|
|
611
641
|
}
|
|
612
|
-
var PrismaStudioConfigShape =
|
|
642
|
+
var PrismaStudioConfigShape = import_effect3.Schema.Struct({
|
|
613
643
|
/**
|
|
614
644
|
* Instantiates the Prisma driver adapter to use for Prisma Studio.
|
|
615
645
|
*/
|
|
@@ -623,18 +653,18 @@ if (false) {
|
|
|
623
653
|
__testPrismaConfig;
|
|
624
654
|
__testPrismaConfigInternal;
|
|
625
655
|
}
|
|
626
|
-
var PrismaConfigUnconditionalShape =
|
|
627
|
-
experimental:
|
|
628
|
-
schema:
|
|
629
|
-
studio:
|
|
630
|
-
migrations:
|
|
631
|
-
tables:
|
|
632
|
-
enums:
|
|
633
|
-
views:
|
|
634
|
-
typedSql:
|
|
635
|
-
extensions:
|
|
656
|
+
var PrismaConfigUnconditionalShape = import_effect3.Schema.Struct({
|
|
657
|
+
experimental: import_effect3.Schema.optional(ExperimentalConfigShape),
|
|
658
|
+
schema: import_effect3.Schema.optional(import_effect3.Schema.String),
|
|
659
|
+
studio: import_effect3.Schema.optional(PrismaStudioConfigShape),
|
|
660
|
+
migrations: import_effect3.Schema.optional(MigrationsConfigShape),
|
|
661
|
+
tables: import_effect3.Schema.optional(TablesConfigShape),
|
|
662
|
+
enums: import_effect3.Schema.optional(EnumsConfigShape),
|
|
663
|
+
views: import_effect3.Schema.optional(ViewsConfigShape),
|
|
664
|
+
typedSql: import_effect3.Schema.optional(TypedSqlConfigShape),
|
|
665
|
+
extensions: import_effect3.Schema.optional(import_effect3.Schema.Any)
|
|
636
666
|
});
|
|
637
|
-
var PrismaConfigShape =
|
|
667
|
+
var PrismaConfigShape = import_effect3.Schema.extend(SchemaEngineConfigShape, PrismaConfigUnconditionalShape);
|
|
638
668
|
if (false) {
|
|
639
669
|
__testPrismaConfigValueA;
|
|
640
670
|
__testPrismaConfigValueB;
|
|
@@ -642,52 +672,58 @@ if (false) {
|
|
|
642
672
|
function validateExperimentalFeatures2(config) {
|
|
643
673
|
const experimental = config.experimental || {};
|
|
644
674
|
if (config.engine === "js" && !experimental.adapter) {
|
|
645
|
-
return
|
|
675
|
+
return import_effect3.Either.left(
|
|
646
676
|
new Error("The `engine === 'js'` configuration requires `experimental.adapter` to be set to `true`.")
|
|
647
677
|
);
|
|
648
678
|
}
|
|
649
679
|
if (config.studio && !experimental.studio) {
|
|
650
|
-
return
|
|
680
|
+
return import_effect3.Either.left(new Error("The `studio` configuration requires `experimental.studio` to be set to `true`."));
|
|
651
681
|
}
|
|
652
682
|
if (config.tables?.external && !experimental.externalTables) {
|
|
653
|
-
return
|
|
683
|
+
return import_effect3.Either.left(
|
|
654
684
|
new Error("The `tables.external` configuration requires `experimental.externalTables` to be set to `true`.")
|
|
655
685
|
);
|
|
656
686
|
}
|
|
657
687
|
if (config.enums?.external && !experimental.externalTables) {
|
|
658
|
-
return
|
|
688
|
+
return import_effect3.Either.left(
|
|
659
689
|
new Error("The `enums.external` configuration requires `experimental.externalTables` to be set to `true`.")
|
|
660
690
|
);
|
|
661
691
|
}
|
|
662
692
|
if (config.migrations?.initShadowDb && !experimental.externalTables) {
|
|
663
|
-
return
|
|
693
|
+
return import_effect3.Either.left(
|
|
664
694
|
new Error(
|
|
665
695
|
"The `migrations.initShadowDb` configuration requires `experimental.externalTables` to be set to `true`."
|
|
666
696
|
)
|
|
667
697
|
);
|
|
668
698
|
}
|
|
669
699
|
if (config["extensions"] && !experimental.extensions) {
|
|
670
|
-
return
|
|
700
|
+
return import_effect3.Either.left(
|
|
671
701
|
new Error("The `extensions` configuration requires `experimental.extensions` to be set to `true`.")
|
|
672
702
|
);
|
|
673
703
|
}
|
|
674
|
-
return
|
|
704
|
+
return import_effect3.Either.right(config);
|
|
675
705
|
}
|
|
676
706
|
function parsePrismaConfigShape(input) {
|
|
677
707
|
return (0, import_Function.pipe)(
|
|
678
|
-
|
|
708
|
+
import_effect3.Schema.decodeUnknownEither(PrismaConfigShape, {})(input, {
|
|
679
709
|
onExcessProperty: "error"
|
|
680
710
|
}),
|
|
681
|
-
|
|
711
|
+
import_effect3.Either.flatMap(validateExperimentalFeatures2)
|
|
682
712
|
);
|
|
683
713
|
}
|
|
684
714
|
var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
|
|
685
|
-
var PrismaConfigInternalShape =
|
|
715
|
+
var PrismaConfigInternalShape = import_effect3.Schema.extend(
|
|
686
716
|
PrismaConfigUnconditionalShape,
|
|
687
|
-
|
|
717
|
+
import_effect3.Schema.extend(
|
|
688
718
|
SchemaEngineConfigInternal,
|
|
689
|
-
|
|
690
|
-
loadedFromFile:
|
|
719
|
+
import_effect3.Schema.Struct({
|
|
720
|
+
loadedFromFile: import_effect3.Schema.NullOr(import_effect3.Schema.String),
|
|
721
|
+
deprecatedPackageJson: import_effect3.Schema.NullOr(
|
|
722
|
+
import_effect3.Schema.Struct({
|
|
723
|
+
config: PrismaConfigPackageJsonShape,
|
|
724
|
+
loadedFromFile: import_effect3.Schema.String
|
|
725
|
+
})
|
|
726
|
+
)
|
|
691
727
|
})
|
|
692
728
|
)
|
|
693
729
|
);
|
|
@@ -704,10 +740,10 @@ function parsePrismaConfigInternalShape(input) {
|
|
|
704
740
|
debug3("Parsing PrismaConfigInternal: %o", input);
|
|
705
741
|
if (typeof input === "object" && input !== null && input["__brand"] === PRISMA_CONFIG_INTERNAL_BRAND) {
|
|
706
742
|
debug3("Short-circuit: input is already a PrismaConfigInternal object");
|
|
707
|
-
return
|
|
743
|
+
return import_effect3.Either.right(input);
|
|
708
744
|
}
|
|
709
745
|
return (0, import_Function.pipe)(
|
|
710
|
-
|
|
746
|
+
import_effect3.Schema.decodeUnknownEither(PrismaConfigInternalShape, {})(input, {
|
|
711
747
|
onExcessProperty: "error"
|
|
712
748
|
}),
|
|
713
749
|
// Brand the output type to make `PrismaConfigInternal` opaque, without exposing the `Effect/Brand` type
|
|
@@ -716,7 +752,7 @@ function parsePrismaConfigInternalShape(input) {
|
|
|
716
752
|
// - https://github.com/microsoft/rushstack/issues/1308
|
|
717
753
|
// - https://github.com/microsoft/rushstack/issues/4034
|
|
718
754
|
// - https://github.com/microsoft/TypeScript/issues/58914
|
|
719
|
-
|
|
755
|
+
import_effect3.Either.map(brandPrismaConfigInternal)
|
|
720
756
|
);
|
|
721
757
|
}
|
|
722
758
|
function makePrismaConfigInternal(makeArgs) {
|
|
@@ -726,14 +762,14 @@ function parseDefaultExport(defaultExport) {
|
|
|
726
762
|
const parseResultEither = (0, import_Function.pipe)(
|
|
727
763
|
// If the given config conforms to the `PrismaConfig` shape, feed it to `defineConfig`.
|
|
728
764
|
parsePrismaConfigShape(defaultExport),
|
|
729
|
-
|
|
765
|
+
import_effect3.Either.map((config) => {
|
|
730
766
|
debug3("Parsed `PrismaConfig` shape: %o", config);
|
|
731
767
|
return defineConfig(config);
|
|
732
768
|
}),
|
|
733
769
|
// Otherwise, try to parse it as a `PrismaConfigInternal` shape.
|
|
734
|
-
|
|
770
|
+
import_effect3.Either.orElse(() => parsePrismaConfigInternalShape(defaultExport))
|
|
735
771
|
);
|
|
736
|
-
if (
|
|
772
|
+
if (import_effect3.Either.isLeft(parseResultEither)) {
|
|
737
773
|
throw parseResultEither.left;
|
|
738
774
|
}
|
|
739
775
|
return parseResultEither.right;
|
|
@@ -742,7 +778,8 @@ function parseDefaultExport(defaultExport) {
|
|
|
742
778
|
// src/defaultTestConfig.ts
|
|
743
779
|
function defaultTestConfig() {
|
|
744
780
|
return makePrismaConfigInternal({
|
|
745
|
-
loadedFromFile: null
|
|
781
|
+
loadedFromFile: null,
|
|
782
|
+
deprecatedPackageJson: null
|
|
746
783
|
});
|
|
747
784
|
}
|
|
748
785
|
|
|
@@ -763,16 +800,27 @@ function env(name) {
|
|
|
763
800
|
|
|
764
801
|
// src/loadConfigFromFile.ts
|
|
765
802
|
var import_node_path = __toESM(require("node:path"));
|
|
766
|
-
var
|
|
803
|
+
var import_node_process2 = __toESM(require("node:process"));
|
|
767
804
|
var debug4 = Debug("prisma:config:loadConfigFromFile");
|
|
768
805
|
var SUPPORTED_EXTENSIONS = [".js", ".ts", ".mjs", ".cjs", ".mts", ".cts"];
|
|
769
806
|
async function loadConfigFromFile({
|
|
770
807
|
configFile,
|
|
771
|
-
configRoot =
|
|
808
|
+
configRoot = import_node_process2.default.cwd()
|
|
772
809
|
}) {
|
|
773
810
|
const start = performance.now();
|
|
774
811
|
const getTime = () => `${(performance.now() - start).toFixed(2)}ms`;
|
|
775
812
|
const diagnostics = [];
|
|
813
|
+
const deprecatedPrismaConfigFromJson = await loadConfigFromPackageJson(configRoot);
|
|
814
|
+
if (deprecatedPrismaConfigFromJson) {
|
|
815
|
+
diagnostics.push({
|
|
816
|
+
_tag: "warn",
|
|
817
|
+
value: ({ warn, link }) => () => warn(
|
|
818
|
+
`The configuration property \`package.json#prisma\` is deprecated and will be removed in Prisma 7. Please migrate to a Prisma config file (e.g., \`prisma.config.ts\`).
|
|
819
|
+
For more information, see: ${link("https://pris.ly/prisma-config")}
|
|
820
|
+
`
|
|
821
|
+
)
|
|
822
|
+
});
|
|
823
|
+
}
|
|
776
824
|
try {
|
|
777
825
|
const { configModule, resolvedPath, error } = await loadConfigTsOrJs(configRoot, configFile);
|
|
778
826
|
if (error) {
|
|
@@ -807,6 +855,20 @@ async function loadConfigFromFile({
|
|
|
807
855
|
`))
|
|
808
856
|
});
|
|
809
857
|
const prismaConfig = transformPathsInConfigToAbsolute(parsedConfig, resolvedPath);
|
|
858
|
+
if (deprecatedPrismaConfigFromJson) {
|
|
859
|
+
diagnostics.push({
|
|
860
|
+
_tag: "warn",
|
|
861
|
+
value: ({ warn, link }) => () => warn(`The Prisma config file in ${import_node_path.default.relative(
|
|
862
|
+
configRoot,
|
|
863
|
+
resolvedPath
|
|
864
|
+
)} overrides the deprecated \`package.json#prisma\` property in ${import_node_path.default.relative(
|
|
865
|
+
configRoot,
|
|
866
|
+
deprecatedPrismaConfigFromJson.loadedFromFile
|
|
867
|
+
)}.
|
|
868
|
+
For more information, see: ${link("https://pris.ly/prisma-config")}
|
|
869
|
+
`)
|
|
870
|
+
});
|
|
871
|
+
}
|
|
810
872
|
return {
|
|
811
873
|
config: {
|
|
812
874
|
...prismaConfig,
|
|
@@ -933,5 +995,6 @@ function transformPathsInConfigToAbsolute(prismaConfig, resolvedPath) {
|
|
|
933
995
|
defaultTestConfig,
|
|
934
996
|
defineConfig,
|
|
935
997
|
env,
|
|
936
|
-
loadConfigFromFile
|
|
998
|
+
loadConfigFromFile,
|
|
999
|
+
loadConfigFromPackageJson
|
|
937
1000
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/config",
|
|
3
|
-
"version": "6.20.0-integration-
|
|
3
|
+
"version": "6.20.0-integration-merge-release-workflows.2",
|
|
4
4
|
"description": "Internal package used to define and read Prisma configuration files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"vitest": "3.2.4",
|
|
22
|
-
"@prisma/driver-adapter-utils": "6.20.0-integration-
|
|
23
|
-
"@prisma/get-platform": "6.20.0-integration-
|
|
22
|
+
"@prisma/driver-adapter-utils": "6.20.0-integration-merge-release-workflows.2",
|
|
23
|
+
"@prisma/get-platform": "6.20.0-integration-merge-release-workflows.2"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|