diff --git a/packages/schema/build/bundle.js b/packages/schema/build/bundle.js index fb683cb6d..9adab015b 100644 --- a/packages/schema/build/bundle.js +++ b/packages/schema/build/bundle.js @@ -8,7 +8,7 @@ require('esbuild') entryPoints: ['src/extension.ts', 'src/language-server/main.ts'], outdir: 'bundle', bundle: true, - external: ['vscode'], + external: ['vscode', '@prisma/*'], platform: 'node', sourcemap: !minify, watch: watch diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ba3fcefaf..326a38ea1 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -29,6 +29,7 @@ "ts-morph": "^16.0.0" }, "devDependencies": { + "@types/node": "^18.0.0", "@types/semver": "^7.3.13", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", diff --git a/packages/sdk/src/prisma.ts b/packages/sdk/src/prisma.ts index 81ce71f7a..4b4e461a1 100644 --- a/packages/sdk/src/prisma.ts +++ b/packages/sdk/src/prisma.ts @@ -1,6 +1,6 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ + import type { DMMF } from '@prisma/generator-helper'; -import { getDMMF as getDMMF4 } from '@prisma/internals'; -import { getDMMF as getDMMF5 } from '@prisma/internals-v5'; import { getPrismaVersion } from '@zenstackhq/runtime'; import path from 'path'; import * as semver from 'semver'; @@ -84,8 +84,10 @@ export type GetDMMFOptions = { export function getDMMF(options: GetDMMFOptions): Promise { const prismaVersion = getPrismaVersion(); if (prismaVersion && semver.gte(prismaVersion, '5.0.0')) { - return getDMMF5(options); + const _getDMMF = require('@prisma/internals-v5').getDMMF; + return _getDMMF(options); } else { - return getDMMF4(options); + const _getDMMF = require('@prisma/internals').getDMMF; + return _getDMMF(options); } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b673ed490..396a09cb4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -121,7 +121,7 @@ importers: version: 0.2.1 ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.22.9)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5) + version: 29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5) typescript: specifier: ^4.9.5 version: 4.9.5 @@ -192,7 +192,7 @@ importers: version: 2.0.3(react@18.2.0) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.4) + version: 29.0.5(@babel/core@7.22.9)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.4) typescript: specifier: ^4.9.4 version: 4.9.4 @@ -620,6 +620,9 @@ importers: specifier: ^16.0.0 version: 16.0.0 devDependencies: + '@types/node': + specifier: ^18.0.0 + version: 18.0.0 '@types/semver': specifier: ^7.3.13 version: 7.5.0 @@ -10771,7 +10774,7 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-jest@29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.4): + /ts-jest@29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5): resolution: {integrity: sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -10802,7 +10805,7 @@ packages: lodash.memoize: 4.1.2 make-error: 1.3.6 semver: 7.5.3 - typescript: 4.9.4 + typescript: 4.9.5 yargs-parser: 21.1.1 dev: true @@ -10841,41 +10844,6 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-jest@29.0.5(@babel/core@7.22.9)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5): - resolution: {integrity: sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@jest/types': ^29.0.0 - babel-jest: ^29.0.0 - esbuild: '*' - jest: ^29.0.0 - typescript: '>=4.3' - peerDependenciesMeta: - '@babel/core': - optional: true - '@jest/types': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - dependencies: - '@babel/core': 7.22.9 - bs-logger: 0.2.6 - esbuild: 0.18.13 - fast-json-stable-stringify: 2.1.0 - jest: 29.5.0(@types/node@18.0.0) - jest-util: 29.5.0 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.5.3 - typescript: 4.9.5 - yargs-parser: 21.1.1 - dev: true - /ts-morph@16.0.0: resolution: {integrity: sha512-jGNF0GVpFj0orFw55LTsQxVYEUOCWBAbR5Ls7fTYE5pQsbW18ssTb/6UXx/GYAEjS+DQTp8VoTw0vqYMiaaQuw==} dependencies: