@dbml/parse 5.0.0 → 5.2.0

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.
@@ -32,11 +32,11 @@ export default class Compiler {
32
32
  flatStream: () => readonly SyntaxToken[];
33
33
  };
34
34
  readonly parse: {
35
- source: () => string;
35
+ source: () => Readonly<string>;
36
36
  _: () => Report<Readonly<{
37
37
  ast: ProgramNode;
38
38
  tokens: SyntaxToken[];
39
- rawDb?: Database | undefined;
39
+ rawDb?: Database;
40
40
  }>, CompileError>;
41
41
  ast: () => Readonly<ProgramNode>;
42
42
  errors: () => readonly Readonly<CompileError>[];
@@ -60,7 +60,7 @@ export default class Compiler {
60
60
  readonly symbol: {
61
61
  ofName: (arg: {
62
62
  nameStack: string[];
63
- owner: ProgramNode | ElementDeclarationNode;
63
+ owner: ElementDeclarationNode | ProgramNode;
64
64
  }) => readonly Readonly<{
65
65
  symbol: NodeSymbol;
66
66
  kind: SymbolKind;
@@ -1,6 +1,6 @@
1
1
  import { serialize } from './lib/serialization/serialize';
2
2
  import { default as Compiler } from './compiler';
3
- import * as services from './services/index';
3
+ import * as services from '@/services/index';
4
4
  export { ElementKind, } from './lib/analyzer/types';
5
5
  export { SyntaxNode, ElementDeclarationNode, ProgramNode, SyntaxNodeKind, type SyntaxNodeId, } from './lib/parser/nodes';
6
6
  export { SyntaxToken, SyntaxTokenKind, } from './lib/lexer/tokens';
@@ -8,6 +8,7 @@ export default class IndexesBinder extends ElementBinder {
8
8
  topSubnamesSymbolKind: SymbolKind[];
9
9
  remainingSubnamesSymbolKind: SymbolKind;
10
10
  ignoreNameNotFound: boolean;
11
+ ignoreNameNotFoundForQuotedVariable: boolean;
11
12
  }[];
12
13
  };
13
14
  settingList: {};
@@ -8,6 +8,7 @@ export default class RefBinder extends ElementBinder {
8
8
  topSubnamesSymbolKind: SymbolKind[];
9
9
  remainingSubnamesSymbolKind: SymbolKind;
10
10
  ignoreNameNotFound: boolean;
11
+ ignoreNameNotFoundForQuotedVariable: boolean;
11
12
  }[];
12
13
  };
13
14
  settingList: {};
@@ -8,11 +8,13 @@ export default class TableBinder extends ElementBinder {
8
8
  topSubnamesSymbolKind?: undefined;
9
9
  remainingSubnamesSymbolKind?: undefined;
10
10
  ignoreNameNotFound?: undefined;
11
+ ignoreNameNotFoundForQuotedVariable?: undefined;
11
12
  } | {
12
13
  shouldBind: true;
13
14
  topSubnamesSymbolKind: SymbolKind[];
14
15
  remainingSubnamesSymbolKind: SymbolKind;
15
16
  ignoreNameNotFound: boolean;
17
+ ignoreNameNotFoundForQuotedVariable: boolean;
16
18
  })[];
17
19
  };
18
20
  settingList: {
@@ -21,9 +23,15 @@ export default class TableBinder extends ElementBinder {
21
23
  topSubnamesSymbolKind: SymbolKind[];
22
24
  remainingSubnamesSymbolKind: SymbolKind;
23
25
  ignoreNameNotFound: boolean;
26
+ ignoreNameNotFoundForQuotedVariable: boolean;
24
27
  };
25
28
  default: {
26
- shouldBind: false;
29
+ shouldBind: true;
30
+ topSubnamesSymbolKind: SymbolKind[];
31
+ remainingSubnamesSymbolKind: SymbolKind;
32
+ ignoreNameNotFound: boolean;
33
+ keywords: string[];
34
+ ignoreNameNotFoundForQuotedVariable: boolean;
27
35
  };
28
36
  check: {
29
37
  shouldBind: false;
@@ -36,5 +44,6 @@ export default class TableBinder extends ElementBinder {
36
44
  topSubnamesSymbolKind: never[];
37
45
  remainingSubnamesSymbolKind: SymbolKind;
38
46
  ignoreNameNotFound: boolean;
47
+ ignoreNameNotFoundForQuotedVariable: boolean;
39
48
  };
40
49
  }
@@ -8,6 +8,7 @@ export default class TableGroupBinder extends ElementBinder {
8
8
  topSubnamesSymbolKind: SymbolKind[];
9
9
  remainingSubnamesSymbolKind: SymbolKind;
10
10
  ignoreNameNotFound: boolean;
11
+ ignoreNameNotFoundForQuotedVariable: boolean;
11
12
  }[];
12
13
  };
13
14
  settingList: {};
@@ -8,11 +8,13 @@ export default class TablePartialBinder extends ElementBinder {
8
8
  topSubnamesSymbolKind?: undefined;
9
9
  remainingSubnamesSymbolKind?: undefined;
10
10
  ignoreNameNotFound?: undefined;
11
+ ignoreNameNotFoundForQuotedVariable?: undefined;
11
12
  } | {
12
13
  shouldBind: true;
13
14
  topSubnamesSymbolKind: SymbolKind[];
14
15
  remainingSubnamesSymbolKind: SymbolKind;
15
16
  ignoreNameNotFound: boolean;
17
+ ignoreNameNotFoundForQuotedVariable: boolean;
16
18
  })[];
17
19
  };
18
20
  settingList: {
@@ -21,6 +23,7 @@ export default class TablePartialBinder extends ElementBinder {
21
23
  topSubnamesSymbolKind: SymbolKind[];
22
24
  remainingSubnamesSymbolKind: SymbolKind;
23
25
  ignoreNameNotFound: boolean;
26
+ ignoreNameNotFoundForQuotedVariable: boolean;
24
27
  };
25
28
  default: {
26
29
  shouldBind: false;
@@ -5,6 +5,7 @@ export type BinderRule = {
5
5
  remainingSubnamesSymbolKind: SymbolKind;
6
6
  ignoreNameNotFound: boolean;
7
7
  keywords?: readonly string[];
8
+ ignoreNameNotFoundForQuotedVariable?: boolean;
8
9
  } | {
9
10
  shouldBind: false;
10
11
  };
@@ -5,14 +5,14 @@ import { NodeSymbol } from './symbol/symbols';
5
5
  import { SyntaxToken } from '../lexer/tokens';
6
6
  import { ElementKind } from './types';
7
7
  export declare function getElementKind(node?: ElementDeclarationNode): Option<ElementKind>;
8
- export declare function destructureMemberAccessExpression(node: SyntaxNode): Option<SyntaxNode[]>;
8
+ export declare function destructureMemberAccessExpression(node?: SyntaxNode): Option<SyntaxNode[]>;
9
9
  export declare function destructureComplexVariable(node?: SyntaxNode): Option<string[]>;
10
10
  export declare function destructureComplexTuple(node?: SyntaxNode): Option<{
11
11
  variables: string[];
12
12
  tupleElements?: string[];
13
13
  }>;
14
14
  export declare function extractVariableFromExpression(node?: SyntaxNode): Option<string>;
15
- export declare function destructureIndexNode(node: SyntaxNode): Option<{
15
+ export declare function destructureIndexNode(node?: SyntaxNode): Option<{
16
16
  functional: FunctionExpressionNode[];
17
17
  nonFunctional: (PrimaryExpressionNode & {
18
18
  expression: VariableNode;
@@ -3,7 +3,7 @@ import { Option } from '../option';
3
3
  import { default as NodeFactory } from './factory';
4
4
  import { ElementDeclarationNode, ExpressionNode, IdentiferStreamNode, InfixExpressionNode, LiteralNode, NormalExpressionNode, PrimaryExpressionNode, SyntaxNode, VariableNode } from './nodes';
5
5
  export declare function convertFuncAppToElem(callee: ExpressionNode | undefined, args: NormalExpressionNode[], factory: NodeFactory): Option<ElementDeclarationNode>;
6
- export declare function isAsKeyword(token: SyntaxToken): token is SyntaxToken & {
6
+ export declare function isAsKeyword(token?: SyntaxToken): token is SyntaxToken & {
7
7
  kind: SyntaxTokenKind.IDENTIFIER;
8
8
  value: 'as';
9
9
  };
@@ -36,11 +36,17 @@ export declare function isExpressionAnIdentifierNode(value?: unknown): value is
36
36
  };
37
37
  };
38
38
  };
39
- export declare function isAccessExpression(node: SyntaxNode): node is InfixExpressionNode & {
39
+ type AccessExpression = InfixExpressionNode & {
40
40
  leftExpression: SyntaxNode;
41
41
  rightExpression: SyntaxNode;
42
42
  op: SyntaxToken & {
43
43
  value: '.';
44
44
  };
45
45
  };
46
+ type DotDelimitedIdentifier = PrimaryExpressionNode | (AccessExpression & {
47
+ rightExpression: AccessExpression | PrimaryExpressionNode;
48
+ });
49
+ export declare function isAccessExpression(node?: SyntaxNode): node is AccessExpression;
50
+ export declare function isDotDelimitedIdentifier(node?: SyntaxNode): node is DotDelimitedIdentifier;
46
51
  export declare function extractStringFromIdentifierStream(stream?: IdentiferStreamNode): Option<string>;
52
+ export {};
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package",
2
3
  "name": "@dbml/parse",
3
- "version": "5.0.0",
4
- "description": "> TODO: description",
4
+ "version": "5.2.0",
5
+ "description": "DBML parser v2",
5
6
  "author": "Holistics <dev@holistics.io>",
6
7
  "license": "Apache-2.0",
7
8
  "homepage": "https://dbml.dbdiagram.io",
@@ -30,15 +31,19 @@
30
31
  "coverage": "vitest run --coverage",
31
32
  "prepublish": "npm run build",
32
33
  "prepare": "npm run build",
33
- "lint": "eslint ."
34
+ "lint": "eslint .",
35
+ "lint:fix": "eslint --fix ."
34
36
  },
35
37
  "devDependencies": {
36
- "@types/lodash": "^4.14.200",
38
+ "@stylistic/eslint-plugin": "^5.5.0",
39
+ "@types/lodash-es": "^4.17.12",
37
40
  "@types/node": "^20.8.8",
38
- "@typescript-eslint/eslint-plugin": "^8.30.1",
39
- "@typescript-eslint/parser": "^8.30.1",
41
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
42
+ "@typescript-eslint/parser": "^8.46.3",
43
+ "eslint": "^9.39.1",
40
44
  "monaco-editor-core": "^0.44.0",
41
- "typescript": "^5.2.2",
45
+ "typescript": "^5.9.3",
46
+ "typescript-eslint": "^8.46.3",
42
47
  "vite": "^6.3.5",
43
48
  "vite-plugin-dts": "^4.5.4",
44
49
  "vitest": "^3.1.4"
@@ -49,5 +54,5 @@
49
54
  "engines": {
50
55
  "node": ">=18"
51
56
  },
52
- "gitHead": "a2d029e9c3c78ab0956312495165ec3115b5bc00"
57
+ "gitHead": "20d556a6e6baad8a989c730e2afd3b65dedcea89"
53
58
  }