@baeta/plugin-prisma 2.0.0-next.11 → 2.0.0-next.12
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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as _baeta_generator_sdk0 from "@baeta/generator-sdk";
|
|
1
|
+
import * as _$_baeta_generator_sdk0 from "@baeta/generator-sdk";
|
|
2
2
|
|
|
3
3
|
//#region lib/options.d.ts
|
|
4
4
|
/**
|
|
@@ -36,7 +36,7 @@ interface PrismaPluginOptions {
|
|
|
36
36
|
* @param options - Configuration options for the pagination plugin
|
|
37
37
|
* @returns A Baeta generator plugin
|
|
38
38
|
*/
|
|
39
|
-
declare function prismaPlugin(options: PrismaPluginOptions): _baeta_generator_sdk0.GeneratorPluginV1<unknown>[];
|
|
39
|
+
declare function prismaPlugin(options: PrismaPluginOptions): _$_baeta_generator_sdk0.GeneratorPluginV1<unknown>[];
|
|
40
40
|
//#endregion
|
|
41
41
|
export { type PrismaPluginOptions, prismaPlugin as default, prismaPlugin };
|
|
42
42
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { createExecPlugin } from "@baeta/plugin-exec";
|
|
3
3
|
import { resolve } from "@baeta/util-path";
|
|
4
|
-
|
|
5
4
|
//#region lib/client-generator.ts
|
|
6
5
|
async function compareSchemas(cwd, current, generated) {
|
|
7
6
|
const [currentSchema, generatedSchema] = await Promise.all([readFile(resolve(cwd, current), "utf-8"), readFile(resolve(cwd, generated), "utf-8").catch(() => null)]);
|
|
@@ -29,7 +28,6 @@ function createPrismaClientPlugin(options) {
|
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
//#endregion
|
|
34
32
|
//#region index.ts
|
|
35
33
|
var plugin_prisma_default = prismaPlugin;
|
|
@@ -44,7 +42,7 @@ function prismaPlugin(options) {
|
|
|
44
42
|
if (options.generateClient === false) return [];
|
|
45
43
|
return [createPrismaClientPlugin(options)];
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
//#endregion
|
|
49
46
|
export { plugin_prisma_default as default, prismaPlugin };
|
|
47
|
+
|
|
50
48
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport type { PrismaPluginOptions } from './options.ts';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n\tconst [currentSchema, generatedSchema] = await Promise.all([\n\t\treadFile(resolve(cwd, current), 'utf-8'),\n\t\treadFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n\t]);\n\treturn currentSchema.replaceAll(' ', '') === generatedSchema?.replaceAll(' ', '');\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n\tconst { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n\treturn createExecPlugin({\n\t\tname: 'prisma-client',\n\t\tactionName: 'Prisma client',\n\t\texec: generateCommand ?? 'prisma generate',\n\t\twatch: (generatorOptions, watcher, reload) => {\n\t\t\tconst prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (file.path === prismaPath) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tskip: async (ctx: Ctx) => {\n\t\t\tconst schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n\t\t\tif (ctx.watching && ctx.changedFile?.path !== schema) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!ctx.watching && generatedSchemaPath) {\n\t\t\t\treturn compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t});\n}\n","import { createPrismaClientPlugin } from './lib/client-generator.ts';\nimport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport default prismaPlugin;\n\n/**\n * A plugin that manages Prisma client generation in your Baeta project.\n * See https://baeta.io/docs/plugins/prisma\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport type { PrismaPluginOptions } from './options.ts';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n\tconst [currentSchema, generatedSchema] = await Promise.all([\n\t\treadFile(resolve(cwd, current), 'utf-8'),\n\t\treadFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n\t]);\n\treturn currentSchema.replaceAll(' ', '') === generatedSchema?.replaceAll(' ', '');\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n\tconst { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n\treturn createExecPlugin({\n\t\tname: 'prisma-client',\n\t\tactionName: 'Prisma client',\n\t\texec: generateCommand ?? 'prisma generate',\n\t\twatch: (generatorOptions, watcher, reload) => {\n\t\t\tconst prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (file.path === prismaPath) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tskip: async (ctx: Ctx) => {\n\t\t\tconst schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n\t\t\tif (ctx.watching && ctx.changedFile?.path !== schema) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!ctx.watching && generatedSchemaPath) {\n\t\t\t\treturn compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t});\n}\n","import { createPrismaClientPlugin } from './lib/client-generator.ts';\nimport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport default prismaPlugin;\n\n/**\n * A plugin that manages Prisma client generation in your Baeta project.\n * See https://baeta.io/docs/plugins/prisma\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":";;;;AAMA,eAAe,eAAe,KAAa,SAAiB,WAAmB;CAC9E,MAAM,CAAC,eAAe,mBAAmB,MAAM,QAAQ,IAAI,CAC1D,SAAS,QAAQ,KAAK,QAAQ,EAAE,QAAQ,EACxC,SAAS,QAAQ,KAAK,UAAU,EAAE,QAAQ,CAAC,YAAY,KAAK,CAC5D,CAAC;AACF,QAAO,cAAc,WAAW,KAAK,GAAG,KAAK,iBAAiB,WAAW,KAAK,GAAG;;AAGlF,SAAgB,yBAAyB,SAA8B;CACtE,MAAM,EAAE,cAAc,iBAAiB,wBAAwB;AAE/D,QAAO,iBAAiB;EACvB,MAAM;EACN,YAAY;EACZ,MAAM,mBAAmB;EACzB,QAAQ,kBAAkB,SAAS,WAAW;GAC7C,MAAM,aAAa,QAAQ,iBAAiB,KAAK,aAAa;GAE9D,MAAM,gBAAgB,SAAsB;AAC3C,QAAI,KAAK,SAAS,WACjB,QAAO,KAAK;;AAId,WAAQ,GAAG,UAAU,aAAa;AAClC,WAAQ,GAAG,UAAU,aAAa;;EAEnC,MAAM,OAAO,QAAa;GACzB,MAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,aAAa;AAE9D,OAAI,IAAI,YAAY,IAAI,aAAa,SAAS,OAC7C,QAAO;AAGR,OAAI,CAAC,IAAI,YAAY,oBACpB,QAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,oBAAoB;AAGnF,UAAO;;EAER,CAAC;;;;ACzCH,IAAA,wBAAe;;;;;;;;AASf,SAAgB,aAAa,SAA8B;AAC1D,KAAI,QAAQ,mBAAmB,MAC9B,QAAO,EAAE;AAEV,QAAO,CAAC,yBAAyB,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-prisma",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.12",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"baeta",
|
|
6
6
|
"graphql",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "builder build",
|
|
41
|
+
"check:deps": "builder check-deps",
|
|
41
42
|
"prepack": "builder prepare",
|
|
42
|
-
"postpack": "builder prepare --
|
|
43
|
+
"postpack": "builder prepare --restore",
|
|
43
44
|
"test": "builder test",
|
|
44
45
|
"test:circular": "builder test-circular",
|
|
45
46
|
"types": "tsc --noEmit"
|
|
@@ -51,15 +52,14 @@
|
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
54
|
"@baeta/generator-sdk": "^2.0.0-next.4",
|
|
54
|
-
"@baeta/plugin-exec": "^2.0.0-next.
|
|
55
|
-
"@baeta/util-path": "^2.0.0-next.3"
|
|
56
|
-
"execa": "^9.6.0"
|
|
55
|
+
"@baeta/plugin-exec": "^2.0.0-next.12",
|
|
56
|
+
"@baeta/util-path": "^2.0.0-next.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@baeta/builder": "^0.0.0",
|
|
60
60
|
"@baeta/testing": "^0.0.0",
|
|
61
61
|
"@baeta/tsconfig": "^0.0.0",
|
|
62
|
-
"@types/node": "^22.19.
|
|
62
|
+
"@types/node": "^22.19.13",
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|