@baeta/plugin-prisma 0.0.19-75-20230619184544-4493aaa → 0.0.20
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 +21 -4
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +20 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
# @baeta/plugin-prisma
|
|
2
2
|
|
|
3
|
-
## 0.0.
|
|
3
|
+
## 0.0.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#102](https://github.com/andreisergiu98/baeta/pull/102) [`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
|
|
8
|
+
|
|
9
|
+
- [#102](https://github.com/andreisergiu98/baeta/pull/102) [`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies and builder
|
|
10
|
+
|
|
11
|
+
- [#106](https://github.com/andreisergiu98/baeta/pull/106) [`01788ab`](https://github.com/andreisergiu98/baeta/commit/01788ab04ff6956b2b50186af5bec8ed7ebbe76e) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add compatibility with windows
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c), [`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c), [`01788ab`](https://github.com/andreisergiu98/baeta/commit/01788ab04ff6956b2b50186af5bec8ed7ebbe76e)]:
|
|
14
|
+
- @baeta/generator-sdk@0.0.10
|
|
15
|
+
- @baeta/plugin-exec@0.0.8
|
|
16
|
+
- @baeta/util-path@0.0.2
|
|
17
|
+
|
|
18
|
+
## 0.0.19
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
6
21
|
|
|
7
22
|
- [#69](https://github.com/andreisergiu98/baeta/pull/69) [`3cdd9b3`](https://github.com/andreisergiu98/baeta/commit/3cdd9b30369d21179769a4b8d5f76e326ae6db37) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
|
|
8
23
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
- [#91](https://github.com/andreisergiu98/baeta/pull/91) [`e0944f6`](https://github.com/andreisergiu98/baeta/commit/e0944f6320e6cf2f0a3d2c9f51edd282bdce0546) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`3ff5e54`](https://github.com/andreisergiu98/baeta/commit/3ff5e54f31cf42ba2264b12309338d6e78710722), [`3cdd9b3`](https://github.com/andreisergiu98/baeta/commit/3cdd9b30369d21179769a4b8d5f76e326ae6db37), [`e0944f6`](https://github.com/andreisergiu98/baeta/commit/e0944f6320e6cf2f0a3d2c9f51edd282bdce0546)]:
|
|
27
|
+
- @baeta/generator-sdk@0.0.9
|
|
28
|
+
- @baeta/plugin-exec@0.0.7
|
|
12
29
|
|
|
13
30
|
## 0.0.18
|
|
14
31
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// lib/client-generator.ts
|
|
2
2
|
var _pluginexec = require('@baeta/plugin-exec');
|
|
3
|
+
var _utilpath = require('@baeta/util-path');
|
|
3
4
|
var _promises = require('fs/promises');
|
|
4
|
-
var _path = require('path');
|
|
5
5
|
async function compareSchemas(cwd, current, generated) {
|
|
6
6
|
const [currentSchema, generatedSchema] = await Promise.all([
|
|
7
|
-
_promises.readFile.call(void 0,
|
|
8
|
-
_promises.readFile.call(void 0,
|
|
7
|
+
_promises.readFile.call(void 0, _utilpath.resolve.call(void 0, cwd, current), "utf-8"),
|
|
8
|
+
_promises.readFile.call(void 0, _utilpath.resolve.call(void 0, cwd, generated), "utf-8").catch(() => null)
|
|
9
9
|
]);
|
|
10
10
|
return currentSchema === generatedSchema;
|
|
11
11
|
}
|
|
12
12
|
function createPrismaClientPlugin(options) {
|
|
13
13
|
const { prismaSchema, generateCommand, generatedSchemaPath } = options;
|
|
14
14
|
const skip = async (ctx) => {
|
|
15
|
-
const schema =
|
|
15
|
+
const schema = _utilpath.resolve.call(void 0, ctx.generatorOptions.cwd, prismaSchema);
|
|
16
16
|
if (ctx.watching && _optionalChain([ctx, 'access', _ => _.changedFile, 'optionalAccess', _2 => _2.path]) !== schema) {
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
@@ -26,7 +26,7 @@ function createPrismaClientPlugin(options) {
|
|
|
26
26
|
actionName: "Prisma client",
|
|
27
27
|
exec: _nullishCoalesce(generateCommand, () => ( "prisma generate")),
|
|
28
28
|
watch: (generatorOptions, watcher, reload) => {
|
|
29
|
-
const prismaPath =
|
|
29
|
+
const prismaPath = _utilpath.resolve.call(void 0, generatorOptions.cwd, prismaSchema);
|
|
30
30
|
const handleChange = (file) => {
|
|
31
31
|
if (file.path === prismaPath) {
|
|
32
32
|
reload(file);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/client-generator.ts","../index.ts"],"names":[],"mappings":";AACA,SAAS,wBAAwB;AACjC,SAAS,
|
|
1
|
+
{"version":3,"sources":["../lib/client-generator.ts","../index.ts"],"names":[],"mappings":";AACA,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAe,eAAe,KAAa,SAAiB,WAAmB;AAC7E,QAAM,CAAC,eAAe,eAAe,IAAI,MAAM,QAAQ,IAAI;AAAA,IACzD,SAAS,QAAQ,KAAK,OAAO,GAAG,OAAO;AAAA,IACvC,SAAS,QAAQ,KAAK,SAAS,GAAG,OAAO,EAAE,MAAM,MAAM,IAAI;AAAA,EAC7D,CAAC;AACD,SAAO,kBAAkB;AAC3B;AAEO,SAAS,yBAAyB,SAA8B;AACrE,QAAM,EAAE,cAAc,iBAAiB,oBAAoB,IAAI;AAE/D,QAAM,OAAO,OAAO,QAAa;AAC/B,UAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,YAAY;AAE7D,QAAI,IAAI,YAAY,IAAI,aAAa,SAAS,QAAQ;AACpD,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,IAAI,YAAY,qBAAqB;AACxC,aAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,mBAAmB;AAAA,IACnF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO,iBAAiB;AAAA,IACtB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM,mBAAmB;AAAA,IACzB,OAAO,CAAC,kBAAkB,SAAS,WAAW;AAC5C,YAAM,aAAa,QAAQ,iBAAiB,KAAK,YAAY;AAE7D,YAAM,eAAe,CAAC,SAAsB;AAC1C,YAAI,KAAK,SAAS,YAAY;AAC5B,iBAAO,IAAI;AAAA,QACb;AAAA,MACF;AAEA,cAAQ,GAAG,UAAU,YAAY;AACjC,cAAQ,GAAG,UAAU,YAAY;AAAA,IACnC;AAAA,IACA;AAAA,EACF,CAAC;AACH;;;AC7CA,IAAO,wBAAQ;AAER,SAAS,aAAa,SAA8B;AACzD,MAAI,QAAQ,mBAAmB,OAAO;AACpC,WAAO,CAAC;AAAA,EACV;AACA,SAAO,CAAC,yBAAyB,OAAO,CAAC;AAC3C","sourcesContent":["import { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport { readFile } from 'fs/promises';\nimport { PrismaPluginOptions } from './options';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n const [currentSchema, generatedSchema] = await Promise.all([\n readFile(resolve(cwd, current), 'utf-8'),\n readFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n ]);\n return currentSchema === generatedSchema;\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n const { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n const skip = async (ctx: Ctx) => {\n const schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n if (ctx.watching && ctx.changedFile?.path !== schema) {\n return true;\n }\n\n if (!ctx.watching && generatedSchemaPath) {\n return compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n }\n\n return false;\n };\n\n return createExecPlugin({\n name: 'prisma-client',\n actionName: 'Prisma client',\n exec: generateCommand ?? 'prisma generate',\n watch: (generatorOptions, watcher, reload) => {\n const prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n const handleChange = (file: WatcherFile) => {\n if (file.path === prismaPath) {\n reload(file);\n }\n };\n\n watcher.on('update', handleChange);\n watcher.on('delete', handleChange);\n },\n skip,\n });\n}\n","import { createPrismaClientPlugin } from './lib/client-generator';\nimport { PrismaPluginOptions } from './lib/options';\n\nexport type { PrismaPluginOptions };\nexport default prismaPlugin;\n\nexport function prismaPlugin(options: PrismaPluginOptions) {\n if (options.generateClient === false) {\n return [];\n }\n return [createPrismaClientPlugin(options)];\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as _baeta_generator_sdk from '@baeta/generator-sdk';
|
|
2
|
+
|
|
3
|
+
interface PrismaPluginOptions {
|
|
4
|
+
prismaSchema: string;
|
|
5
|
+
generateClient?: boolean;
|
|
6
|
+
generateCommand?: string;
|
|
7
|
+
generatedSchemaPath?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare function prismaPlugin(options: PrismaPluginOptions): _baeta_generator_sdk.GeneratorPluginV1<{}>[];
|
|
11
|
+
|
|
12
|
+
export { type PrismaPluginOptions, prismaPlugin as default, prismaPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ interface PrismaPluginOptions {
|
|
|
9
9
|
|
|
10
10
|
declare function prismaPlugin(options: PrismaPluginOptions): _baeta_generator_sdk.GeneratorPluginV1<{}>[];
|
|
11
11
|
|
|
12
|
-
export { PrismaPluginOptions, prismaPlugin as default, prismaPlugin };
|
|
12
|
+
export { type PrismaPluginOptions, prismaPlugin as default, prismaPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// lib/client-generator.ts
|
|
2
2
|
import { createExecPlugin } from "@baeta/plugin-exec";
|
|
3
|
+
import { resolve } from "@baeta/util-path";
|
|
3
4
|
import { readFile } from "fs/promises";
|
|
4
|
-
import { resolve } from "path";
|
|
5
5
|
async function compareSchemas(cwd, current, generated) {
|
|
6
6
|
const [currentSchema, generatedSchema] = await Promise.all([
|
|
7
7
|
readFile(resolve(cwd, current), "utf-8"),
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport {
|
|
1
|
+
{"version":3,"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport { readFile } from 'fs/promises';\nimport { PrismaPluginOptions } from './options';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n const [currentSchema, generatedSchema] = await Promise.all([\n readFile(resolve(cwd, current), 'utf-8'),\n readFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n ]);\n return currentSchema === generatedSchema;\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n const { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n const skip = async (ctx: Ctx) => {\n const schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n if (ctx.watching && ctx.changedFile?.path !== schema) {\n return true;\n }\n\n if (!ctx.watching && generatedSchemaPath) {\n return compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n }\n\n return false;\n };\n\n return createExecPlugin({\n name: 'prisma-client',\n actionName: 'Prisma client',\n exec: generateCommand ?? 'prisma generate',\n watch: (generatorOptions, watcher, reload) => {\n const prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n const handleChange = (file: WatcherFile) => {\n if (file.path === prismaPath) {\n reload(file);\n }\n };\n\n watcher.on('update', handleChange);\n watcher.on('delete', handleChange);\n },\n skip,\n });\n}\n","import { createPrismaClientPlugin } from './lib/client-generator';\nimport { PrismaPluginOptions } from './lib/options';\n\nexport type { PrismaPluginOptions };\nexport default prismaPlugin;\n\nexport function prismaPlugin(options: PrismaPluginOptions) {\n if (options.generateClient === false) {\n return [];\n }\n return [createPrismaClientPlugin(options)];\n}\n"],"mappings":";AACA,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAe,eAAe,KAAa,SAAiB,WAAmB;AAC7E,QAAM,CAAC,eAAe,eAAe,IAAI,MAAM,QAAQ,IAAI;AAAA,IACzD,SAAS,QAAQ,KAAK,OAAO,GAAG,OAAO;AAAA,IACvC,SAAS,QAAQ,KAAK,SAAS,GAAG,OAAO,EAAE,MAAM,MAAM,IAAI;AAAA,EAC7D,CAAC;AACD,SAAO,kBAAkB;AAC3B;AAEO,SAAS,yBAAyB,SAA8B;AACrE,QAAM,EAAE,cAAc,iBAAiB,oBAAoB,IAAI;AAE/D,QAAM,OAAO,OAAO,QAAa;AAC/B,UAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,YAAY;AAE7D,QAAI,IAAI,YAAY,IAAI,aAAa,SAAS,QAAQ;AACpD,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,IAAI,YAAY,qBAAqB;AACxC,aAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,mBAAmB;AAAA,IACnF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO,iBAAiB;AAAA,IACtB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM,mBAAmB;AAAA,IACzB,OAAO,CAAC,kBAAkB,SAAS,WAAW;AAC5C,YAAM,aAAa,QAAQ,iBAAiB,KAAK,YAAY;AAE7D,YAAM,eAAe,CAAC,SAAsB;AAC1C,YAAI,KAAK,SAAS,YAAY;AAC5B,iBAAO,IAAI;AAAA,QACb;AAAA,MACF;AAEA,cAAQ,GAAG,UAAU,YAAY;AACjC,cAAQ,GAAG,UAAU,YAAY;AAAA,IACnC;AAAA,IACA;AAAA,EACF,CAAC;AACH;;;AC7CA,IAAO,wBAAQ;AAER,SAAS,aAAa,SAA8B;AACzD,MAAI,QAAQ,mBAAmB,OAAO;AACpC,WAAO,CAAC;AAAA,EACV;AACA,SAAO,CAAC,yBAAyB,OAAO,CAAC;AAC3C;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-prisma",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"baeta",
|
|
6
|
+
"graphql",
|
|
7
|
+
"schema",
|
|
8
|
+
"types",
|
|
9
|
+
"typescript",
|
|
10
|
+
"framework",
|
|
11
|
+
"builder"
|
|
12
|
+
],
|
|
4
13
|
"homepage": "https://github.com/andreisergiu98/baeta#readme",
|
|
5
14
|
"bugs": {
|
|
6
15
|
"url": "https://github.com/andreisergiu98/baeta/issues"
|
|
@@ -11,7 +20,10 @@
|
|
|
11
20
|
"directory": "packages/plugin-prisma"
|
|
12
21
|
},
|
|
13
22
|
"license": "MIT",
|
|
14
|
-
"author":
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "Andrei Pampu",
|
|
25
|
+
"url": "https://github.com/andreisergiu98"
|
|
26
|
+
},
|
|
15
27
|
"type": "module",
|
|
16
28
|
"exports": {
|
|
17
29
|
".": {
|
|
@@ -33,15 +45,16 @@
|
|
|
33
45
|
"types": "tsc --noEmit"
|
|
34
46
|
},
|
|
35
47
|
"dependencies": {
|
|
36
|
-
"@baeta/generator-sdk": "^0.0.
|
|
37
|
-
"@baeta/plugin-exec": "^0.0.
|
|
38
|
-
"
|
|
48
|
+
"@baeta/generator-sdk": "^0.0.10",
|
|
49
|
+
"@baeta/plugin-exec": "^0.0.8",
|
|
50
|
+
"@baeta/util-path": "^0.0.2",
|
|
51
|
+
"execa": "^8.0.1"
|
|
39
52
|
},
|
|
40
53
|
"devDependencies": {
|
|
41
54
|
"@baeta/builder": "^0.0.0",
|
|
42
55
|
"@baeta/tsconfig": "^0.0.0",
|
|
43
|
-
"@types/node": "^18.
|
|
44
|
-
"typescript": "^5.
|
|
56
|
+
"@types/node": "^18.19.9",
|
|
57
|
+
"typescript": "^5.3.3"
|
|
45
58
|
},
|
|
46
59
|
"engines": {
|
|
47
60
|
"node": ">=18.0.0"
|