Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"jest": "^29.5.0",
"lerna": "^7.1.4",
"lerna-changelog": "^2.2.0",
"vitest": "^4.0.9"
"vite": "^7.3.1",
"vite-plugin-dts": "^4.5.4",
"vitest": "^4.0.16"
},
"resolutions": {
"**/tmp": "0.2.5"
Expand Down
6 changes: 1 addition & 5 deletions packages/dbml-core/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ export default defineConfig(
'node_modules/*',
'lib/*',
'types/*',
'src/parse/dbmlParser.js',
'src/parse/mssqlParser.js',
'src/parse/mysqlParser.js',
'src/parse/postgresParser.js',
'src/parse/schemarbParser.js',
'src/parse/deprecated/*',
'src/parse/ANTLR/parsers/*',
],
},
Expand Down
12 changes: 1 addition & 11 deletions packages/dbml-core/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ const config: Config = {
coverageDirectory: 'coverage',
collectCoverageFrom: [
'src/**/*.{js,ts}',
'!src/parse/buildParser.js',
'!src/parse/dbmlParser.js',
'!src/parse/mssqlParser.js',
'!src/parse/mysqlParser.js',
'!src/parse/postgresParser.js',
'!src/parse/schemarbParser.js',
'!src/parse/dbml/**/*.js',
'!src/parse/mssql/**/*.js',
'!src/parse/mysql/**/*.js',
'!src/parse/postgresql/**/*.js',
'!src/parse/schemarb/**/*.js',
'!src/parse/deprecated/**/*.js',
'!src/parse/ANTLR/parsers/**/*.js',
],
};
Expand Down
16 changes: 13 additions & 3 deletions packages/dbml-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
],
"types": "./types/index.d.ts",
"main": "lib/index.js",
"exports": {
".": {
"types": "./types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js",
"default": "./lib/index.js"
}
},
"sideEffects": false,
"publishConfig": {
"access": "public"
},
Expand All @@ -29,8 +38,8 @@
"coverage": "jest --coverage",
"benchmark": "jest --projects jest-bench.config.json",
"build:lib": "babel src --out-dir lib --copy-files",
"build:parser": "npx babel-node src/parse/buildParser.js",
"build": "npm run build:parser && npm run build:lib",
"build:parser": "npx babel-node src/parse/deprecated/buildParser.js",
"build": "npm run build:lib",
"prepublish": "npm run build",
"lint": "eslint .",
"lint:fix": "eslint --fix ."
Expand Down Expand Up @@ -61,7 +70,8 @@
"pegjs-require-import": "0.0.6",
"ts-jest": "^29.4.5",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.3"
"typescript-eslint": "^8.46.3",
"vite-plugin-commonjs": "^0.10.4"
},
"gitHead": "5cb80e1aa38fb9a4dbe3079e39c9ef93cd4dc556",
"engines": {
Expand Down
File renamed without changes.
22 changes: 17 additions & 5 deletions packages/dbml-core/src/parse/Parser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Compiler } from '@dbml/parse';
import Database from '../model_structure/database';
import mysqlParser from './mysqlParser';
import postgresParser from './postgresParser';
import dbmlParser from './dbmlParser';
import schemarbParser from './schemarbParser';
import mssqlParser from './mssqlParser';
import mysqlParser from './deprecated/mysqlParser';
import postgresParser from './deprecated/postgresParser';
import dbmlParser from './deprecated/dbmlParser';
import schemarbParser from './deprecated/schemarbParser';
import mssqlParser from './deprecated/mssqlParser';
import { parse } from './ANTLR/ASTGeneration';
import { CompilerError } from './error';

Expand All @@ -22,6 +22,9 @@ class Parser {
return parse(str, 'mysql');
}

/**
* @deprecated Use the `parseMySQLToJSONv2` method instead
*/
static parseMySQLToJSON (str) {
return mysqlParser.parse(str);
}
Expand All @@ -30,6 +33,9 @@ class Parser {
return parse(str, 'postgres');
}

/**
* @deprecated Use the `parsePostgresToJSONv2` method instead
*/
static parsePostgresToJSON (str) {
return postgresParser.parse(str);
}
Expand Down Expand Up @@ -59,6 +65,9 @@ class Parser {
return compiler.parse.rawDb();
}

/**
* @deprecated Use the `parseDBMLToJSONv2` method instead
*/
static parseDBMLToJSON (str) {
return dbmlParser.parse(str);
}
Expand All @@ -67,6 +76,9 @@ class Parser {
return schemarbParser.parse(str);
}

/**
* @deprecated Use the `parseMSSQLToJSONv2` method instead
*/
static parseMSSQLToJSON (str) {
return mssqlParser.parseWithPegError(str);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @deprecated This file is deprecated and should not be maintained.
* The PEG parsers are being replaced by ANTLR-based parsers.
* Use the v2 parser methods in Parser.js instead.
*/
import pegjsRequire from 'pegjs-require-import';
import Promise from 'bluebird';

Expand Down
6 changes: 6 additions & 0 deletions packages/dbml-core/src/parse/deprecated/mssqlParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @deprecated This parser is deprecated. Use parseMSSQLToJSONv2 instead.
*/
import mssqlParser from './mssql';

export default mssqlParser;
3 changes: 0 additions & 3 deletions packages/dbml-core/src/parse/mssqlParser.js

This file was deleted.

28 changes: 28 additions & 0 deletions packages/dbml-core/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="vitest" />

import path from 'path';
import { defineConfig } from 'vite';
import commonjs from 'vite-plugin-commonjs';

export default defineConfig({
plugins: [commonjs()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src/"),
},
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
fileName: 'dbml-core',
formats: ['cjs', 'es'],
},
},
test: {
globals: true,
coverage: {
provider: 'v8',
reporter: ['json', 'json-summary', 'html', 'text'],
},
},
});
7 changes: 3 additions & 4 deletions packages/dbml-parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
],
"main": "./dist/dbml-parse.js",
"module": "./dist/dbml-parse.mjs",
"types": "./dist/index.d.ts",
"types": "./dist/src/index.d.ts",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/dbml-parse.mjs",
"require": "./dist/dbml-parse.js"
}
Expand Down Expand Up @@ -43,9 +44,7 @@
"eslint": "^9.39.1",
"monaco-editor-core": "^0.44.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.3",
"vite": "^7.2.2",
"vite-plugin-dts": "^4.5.4"
"typescript-eslint": "^8.46.3"
},
"dependencies": {
"lodash-es": "^4.17.21"
Expand Down
1 change: 0 additions & 1 deletion packages/dbml-parse/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'DbmlParser',
fileName: 'dbml-parse',
formats: ['cjs', 'es'],
},
Expand Down
Loading