@dbml/parse 8.0.0-alpha.11 → 8.0.0-alpha.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.
@@ -1235,7 +1235,7 @@ var isAbsolute = function(r) {
1235
1235
  }
1236
1236
  relativeTo(r) {
1237
1237
  let j = relative$1(r, this.path);
1238
- return j.startsWith(".") ? j : `./${j}`;
1238
+ return !j.startsWith("./") && !j.startsWith("../") && ![".", ".."].includes(j) ? `./${j}` : j;
1239
1239
  }
1240
1240
  toString() {
1241
1241
  return this.path;
@@ -7638,7 +7638,7 @@ var ProjectBinder = class {
7638
7638
  interpretBody(r) {
7639
7639
  return r.body.flatMap((r) => {
7640
7640
  let j = r;
7641
- switch (j.type?.value.toLowerCase()) {
7641
+ switch (j.getElementKind()) {
7642
7642
  case ElementKind.Table: {
7643
7643
  let r = this.interpretSubElement(j);
7644
7644
  return r.getValue() && this.project.tables?.push(r.getValue()), r.getErrors();
@@ -8591,7 +8591,7 @@ var TableBinder = class {
8591
8591
  }
8592
8592
  interpretSubElements(r) {
8593
8593
  return r.flatMap((r) => {
8594
- switch (r.type?.value.toLowerCase()) {
8594
+ switch (r.getElementKind()) {
8595
8595
  case ElementKind.Note: return this.table.note = {
8596
8596
  value: normalizeNote(extractQuotedStringToken(r.body instanceof BlockExpressionNode ? r.body.body[0].callee : r.body.callee)),
8597
8597
  token: getTokenPosition(r)
@@ -8611,8 +8611,8 @@ var TableBinder = class {
8611
8611
  P.name = extractVariableFromExpression(r.expression) || "";
8612
8612
  let F = r.expression ? this.compiler.nodeReferee(r.expression).getFiltered(UNHANDLED) : void 0, I = this.compiler.parseFile(this.filepath).getValue().ast, L = this.compiler.nodeSymbol(I).getFiltered(UNHANDLED);
8613
8613
  if (F && !L.inNestedSchema(this.compiler, F)) {
8614
- let M = this.compiler.nodeSymbol(this.declarationNode).getFiltered(UNHANDLED), P = M ? (this.compiler.symbolUses(M).getFiltered(UNHANDLED) ?? []).find((r) => r.filepath.equals(this.filepath)) : void 0;
8615
- N.push(new CompileError(CompileErrorCode.UNSUPPORTED, `Import TablePartial from '${F.filepath}' first. Currently, importing a table that uses a table partial requires that table partial to also be in scope.`, P?.useSpecifierDeclaration ?? r));
8614
+ let M = this.compiler.nodeSymbol(this.declarationNode).getFiltered(UNHANDLED), I = M ? (this.compiler.symbolUses(M).getFiltered(UNHANDLED) ?? []).find((r) => r.filepath.equals(this.filepath)) : void 0;
8615
+ N.push(new CompileError(CompileErrorCode.UNSUPPORTED, `Import TablePartial ${P.name} from '${F.filepath}' first. Currently, importing a table that uses a table partial requires that table partial to also be in scope.`, I?.useSpecifierDeclaration ?? r));
8616
8616
  }
8617
8617
  return this.table.partials.push(P), N;
8618
8618
  }
@@ -9014,8 +9014,8 @@ var TableGroupBinder = class {
9014
9014
  }
9015
9015
  interpretSubElements(r) {
9016
9016
  return r.flatMap((r) => {
9017
- switch (r.type?.value.toLowerCase()) {
9018
- case "note":
9017
+ switch (r.getElementKind()) {
9018
+ case ElementKind.Note:
9019
9019
  this.tableGroup.note = {
9020
9020
  value: normalizeNote(extractQuotedStringToken(r.body instanceof BlockExpressionNode ? r.body.body[0].callee : r.body.callee)),
9021
9021
  token: getTokenPosition(r)
@@ -9236,7 +9236,7 @@ var TablePartialBinder = class {
9236
9236
  }
9237
9237
  interpretSubElements(r) {
9238
9238
  return r.flatMap((r) => {
9239
- switch (r.type?.value.toLowerCase()) {
9239
+ switch (r.getElementKind()) {
9240
9240
  case ElementKind.Note: return this.tablePartial.note = {
9241
9241
  value: normalizeNote(extractQuotedStringToken(r.body instanceof BlockExpressionNode ? r.body.body[0].callee : r.body.callee)),
9242
9242
  token: getTokenPosition(r)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@dbml/parse",
4
- "version": "8.0.0-alpha.11",
4
+ "version": "8.0.0-alpha.12",
5
5
  "description": "DBML parser v2",
6
6
  "author": "Holistics <dev@holistics.io>",
7
7
  "license": "Apache-2.0",
@@ -46,5 +46,5 @@
46
46
  "engines": {
47
47
  "node": ">=18"
48
48
  },
49
- "gitHead": "976e0f27c85468fa8a0fbb2ded04862e86b05b89"
49
+ "gitHead": "53557d9ec226c4e7b8177229efce49594535502b"
50
50
  }