dot-language-support 2.2.8 → 2.2.10

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/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/1.5.0/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
3
3
  "formatter": {
4
4
  "enabled": true,
5
5
  "indentWidth": 4,
@@ -32,9 +32,7 @@
32
32
  },
33
33
  "overrides": [
34
34
  {
35
- "include": [
36
- "src/scanner.ts"
37
- ],
35
+ "includes": ["**/src/scanner.ts"],
38
36
  "linter": {
39
37
  "rules": {
40
38
  "suspicious": {
package/lib/cjs/binder.js CHANGED
@@ -9,9 +9,9 @@ function bindSourceFile(file) {
9
9
  binder.bind(file);
10
10
  }
11
11
  function createBinder() {
12
- let parent = undefined;
13
- let symbolTable = undefined;
14
- let colorTable = undefined;
12
+ let parent;
13
+ let symbolTable;
14
+ let colorTable;
15
15
  let graphContext = 0;
16
16
  function bind(node) {
17
17
  if (!node)
@@ -150,7 +150,7 @@ function createBinder() {
150
150
  const superParentStatement = attrContainer.parent;
151
151
  console.assert(!!superParentStatement);
152
152
  bind(node.leftId);
153
- let carrierIdentifier = undefined;
153
+ let carrierIdentifier;
154
154
  switch (superParentStatement.kind) {
155
155
  case types_js_1.SyntaxKind.NodeStatement:
156
156
  carrierIdentifier = superParentStatement.id.id;
@@ -8,6 +8,7 @@ export declare function findAllStatements<T extends Statement["kind"]>(node: Syn
8
8
  export declare function isAttrStatement(node: SyntaxNode): node is AttributeStatement;
9
9
  export declare function isEdgeStatement(node: SyntaxNode): node is EdgeStatement;
10
10
  export declare function isSubGraphStatement(node: SyntaxNode): node is SubGraphStatement;
11
+ export declare function isGraph(node: SyntaxNode): node is Graph;
11
12
  export declare function isNodeId(node: SyntaxNode): node is NodeId;
12
13
  export declare function edgeStatementHasAttributes(es: EdgeStatement): boolean;
13
14
  export declare function getIdentifierText(n: Identifier): string;
@@ -9,6 +9,7 @@ exports.findAllStatements = findAllStatements;
9
9
  exports.isAttrStatement = isAttrStatement;
10
10
  exports.isEdgeStatement = isEdgeStatement;
11
11
  exports.isSubGraphStatement = isSubGraphStatement;
12
+ exports.isGraph = isGraph;
12
13
  exports.isNodeId = isNodeId;
13
14
  exports.edgeStatementHasAttributes = edgeStatementHasAttributes;
14
15
  exports.getIdentifierText = getIdentifierText;
@@ -1,5 +1,5 @@
1
- export * from "./types.js";
2
- export * from "./scanner.js";
3
1
  export * from "./parser.js";
4
- export * from "./visitor.js";
2
+ export * from "./scanner.js";
5
3
  export * from "./service/service.js";
4
+ export * from "./types.js";
5
+ export * from "./visitor.js";
package/lib/cjs/index.js CHANGED
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types.js"), exports);
18
- __exportStar(require("./scanner.js"), exports);
19
17
  __exportStar(require("./parser.js"), exports);
20
- __exportStar(require("./visitor.js"), exports);
18
+ __exportStar(require("./scanner.js"), exports);
21
19
  __exportStar(require("./service/service.js"), exports);
20
+ __exportStar(require("./types.js"), exports);
21
+ __exportStar(require("./visitor.js"), exports);
22
22
  //# sourceMappingURL=index.js.map
package/lib/cjs/parser.js CHANGED
@@ -34,7 +34,7 @@ class Parser {
34
34
  this.sourceText = sourceText;
35
35
  this.scanner.setText(this.sourceText);
36
36
  __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_nextToken).call(this);
37
- let graph = undefined;
37
+ let graph;
38
38
  if (__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_token).call(this) !== types_1.SyntaxKind.EndOfFileToken) {
39
39
  graph = __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_parseGraph).call(this);
40
40
  if (__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_token).call(this) !== types_1.SyntaxKind.EndOfFileToken) {
@@ -89,7 +89,7 @@ _Parser_instances = new WeakSet(), _Parser_resetState = function _Parser_resetSt
89
89
  return __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_finishNode).call(this, node);
90
90
  }, _Parser_parseIdentifier = function _Parser_parseIdentifier() {
91
91
  let result;
92
- const escapedIdTexts = new Array();
92
+ const escapedIdTexts = [];
93
93
  switch (__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_token).call(this)) {
94
94
  case types_1.SyntaxKind.TextIdentifier:
95
95
  result = __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_parseTextIdentifier).call(this);
@@ -386,7 +386,7 @@ _Parser_instances = new WeakSet(), _Parser_resetState = function _Parser_resetSt
386
386
  this.currentContext |= 1 << context;
387
387
  let isListTerminated = atLeastOne ? false : __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_isListTerminator).call(this, context);
388
388
  const startPos = this.scanner.startPos;
389
- const elements = new Array();
389
+ const elements = [];
390
390
  while (!isListTerminated) {
391
391
  if (__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_isListElement).call(this, context, false)) {
392
392
  const element = parseElement();
@@ -477,7 +477,7 @@ _Parser_instances = new WeakSet(), _Parser_resetState = function _Parser_resetSt
477
477
  }
478
478
  }, _Parser_createEmptyArray = function _Parser_createEmptyArray() {
479
479
  const startPos = this.scanner.startPos;
480
- const elements = new Array();
480
+ const elements = [];
481
481
  return __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_createNodeArray).call(this, elements, startPos);
482
482
  }, _Parser_finishNode = function _Parser_finishNode(node, end) {
483
483
  node.end = end === undefined ? this.scanner.startPos : end;
@@ -308,7 +308,6 @@ _DefaultScanner_instances = new WeakSet(), _DefaultScanner_setTextPos = function
308
308
  }
309
309
  return skip ? undefined : this.text.substring(start, commentEnd);
310
310
  }, _DefaultScanner_scanHtml = function _DefaultScanner_scanHtml() {
311
- const htmlOpen = this.text.charCodeAt(this.pos);
312
311
  this.pos++;
313
312
  let result = "";
314
313
  const start = this.pos;
@@ -41,8 +41,8 @@ const index_js_1 = require("../index.js");
41
41
  const ChangeAllOtherEdgeOpsAndFixGraphCommand = __importStar(require("./command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js"));
42
42
  const ChangeEdgeOpCommand = __importStar(require("./command/ChangeEdgeOpCommand.js"));
43
43
  const ConsolidateDescendantsCommand = __importStar(require("./command/ConsolidateDescendantsCommand.js"));
44
- const RemoveSemicolonsCommand = __importStar(require("./command/RemoveSemicolons.js"));
45
44
  const common_js_1 = require("./command/common.js");
45
+ const RemoveSemicolonsCommand = __importStar(require("./command/RemoveSemicolons.js"));
46
46
  const util_js_1 = require("./util.js");
47
47
  function getCodeActions(doc, sourceFile, range, _context) {
48
48
  let actions = getActionsFromDiagnostics(doc, sourceFile, range);
@@ -149,7 +149,7 @@ function getAttributeCompletions(posistion) {
149
149
  }));
150
150
  }
151
151
  function getNodeCompletions(symbols, exlucdedSymbols) {
152
- const res = new Array();
152
+ const res = [];
153
153
  for (const [key, value] of symbols) {
154
154
  if (exlucdedSymbols === null || exlucdedSymbols === void 0 ? void 0 : exlucdedSymbols.includes(key))
155
155
  continue;
@@ -119,7 +119,7 @@ function getEdgeHover(n) {
119
119
  const p = n.parent;
120
120
  if (!p || p.rhs.length === 0)
121
121
  return undefined;
122
- let source = undefined;
122
+ let source;
123
123
  for (const curr of p.rhs) {
124
124
  if (curr === n)
125
125
  break;
package/lib/esm/binder.js CHANGED
@@ -6,9 +6,9 @@ export function bindSourceFile(file) {
6
6
  binder.bind(file);
7
7
  }
8
8
  function createBinder() {
9
- let parent = undefined;
10
- let symbolTable = undefined;
11
- let colorTable = undefined;
9
+ let parent;
10
+ let symbolTable;
11
+ let colorTable;
12
12
  let graphContext = 0;
13
13
  function bind(node) {
14
14
  if (!node)
@@ -147,7 +147,7 @@ function createBinder() {
147
147
  const superParentStatement = attrContainer.parent;
148
148
  console.assert(!!superParentStatement);
149
149
  bind(node.leftId);
150
- let carrierIdentifier = undefined;
150
+ let carrierIdentifier;
151
151
  switch (superParentStatement.kind) {
152
152
  case SyntaxKind.NodeStatement:
153
153
  carrierIdentifier = superParentStatement.id.id;
@@ -8,6 +8,7 @@ export declare function findAllStatements<T extends Statement["kind"]>(node: Syn
8
8
  export declare function isAttrStatement(node: SyntaxNode): node is AttributeStatement;
9
9
  export declare function isEdgeStatement(node: SyntaxNode): node is EdgeStatement;
10
10
  export declare function isSubGraphStatement(node: SyntaxNode): node is SubGraphStatement;
11
+ export declare function isGraph(node: SyntaxNode): node is Graph;
11
12
  export declare function isNodeId(node: SyntaxNode): node is NodeId;
12
13
  export declare function edgeStatementHasAttributes(es: EdgeStatement): boolean;
13
14
  export declare function getIdentifierText(n: Identifier): string;
@@ -175,7 +175,7 @@ export function isEdgeStatement(node) {
175
175
  export function isSubGraphStatement(node) {
176
176
  return node.kind === SyntaxKind.SubGraphStatement;
177
177
  }
178
- function isGraph(node) {
178
+ export function isGraph(node) {
179
179
  return node.kind === SyntaxKind.DirectedGraph || node.kind === SyntaxKind.UndirectedGraph;
180
180
  }
181
181
  export function isNodeId(node) {
@@ -1,5 +1,5 @@
1
- export * from "./types.js";
2
- export * from "./scanner.js";
3
1
  export * from "./parser.js";
4
- export * from "./visitor.js";
2
+ export * from "./scanner.js";
5
3
  export * from "./service/service.js";
4
+ export * from "./types.js";
5
+ export * from "./visitor.js";
package/lib/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./types.js";
2
- export * from "./scanner.js";
3
1
  export * from "./parser.js";
4
- export * from "./visitor.js";
2
+ export * from "./scanner.js";
5
3
  export * from "./service/service.js";
4
+ export * from "./types.js";
5
+ export * from "./visitor.js";
6
6
  //# sourceMappingURL=index.js.map
package/lib/esm/parser.js CHANGED
@@ -49,7 +49,7 @@ export class Parser {
49
49
  this.sourceText = sourceText;
50
50
  this.scanner.setText(this.sourceText);
51
51
  this.#nextToken();
52
- let graph = undefined;
52
+ let graph;
53
53
  if (this.#token() !== SyntaxKind.EndOfFileToken) {
54
54
  graph = this.#parseGraph();
55
55
  if (this.#token() !== SyntaxKind.EndOfFileToken) {
@@ -86,7 +86,7 @@ export class Parser {
86
86
  }
87
87
  #parseIdentifier() {
88
88
  let result;
89
- const escapedIdTexts = new Array();
89
+ const escapedIdTexts = [];
90
90
  switch (this.#token()) {
91
91
  case SyntaxKind.TextIdentifier:
92
92
  result = this.#parseTextIdentifier();
@@ -408,7 +408,7 @@ export class Parser {
408
408
  this.currentContext |= 1 << context;
409
409
  let isListTerminated = atLeastOne ? false : this.#isListTerminator(context);
410
410
  const startPos = this.scanner.startPos;
411
- const elements = new Array();
411
+ const elements = [];
412
412
  while (!isListTerminated) {
413
413
  if (this.#isListElement(context, false)) {
414
414
  const element = parseElement();
@@ -505,7 +505,7 @@ export class Parser {
505
505
  }
506
506
  #createEmptyArray() {
507
507
  const startPos = this.scanner.startPos;
508
- const elements = new Array();
508
+ const elements = [];
509
509
  return this.#createNodeArray(elements, startPos);
510
510
  }
511
511
  #finishNode(node, end) {
@@ -300,7 +300,6 @@ export class DefaultScanner {
300
300
  return skip ? undefined : this.text.substring(start, commentEnd);
301
301
  }
302
302
  #scanHtml() {
303
- const htmlOpen = this.text.charCodeAt(this.pos);
304
303
  this.pos++;
305
304
  let result = "";
306
305
  const start = this.pos;
@@ -1,10 +1,10 @@
1
1
  import { edgeStatementHasAttributes, findAllEdges, findNodeAtOffset, getAllowedEdgeOperation, getIdentifierText, isAttrStatement, isEdgeStatement, isNodeId, nodeContainsErrors, } from "../checker.js";
2
- import { SyntaxKind, forEachChild, isIdentifierNode, } from "../index.js";
2
+ import { forEachChild, isIdentifierNode, SyntaxKind, } from "../index.js";
3
3
  import * as ChangeAllOtherEdgeOpsAndFixGraphCommand from "./command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js";
4
4
  import * as ChangeEdgeOpCommand from "./command/ChangeEdgeOpCommand.js";
5
5
  import * as ConsolidateDescendantsCommand from "./command/ConsolidateDescendantsCommand.js";
6
- import * as RemoveSemicolonsCommand from "./command/RemoveSemicolons.js";
7
6
  import { getAllowedOp, getOppositeEdgeOp, getOppositeKind, } from "./command/common.js";
7
+ import * as RemoveSemicolonsCommand from "./command/RemoveSemicolons.js";
8
8
  import { assertNever, getStart } from "./util.js";
9
9
  export function getCodeActions(doc, sourceFile, range, _context) {
10
10
  let actions = getActionsFromDiagnostics(doc, sourceFile, range);
@@ -113,7 +113,7 @@ function getAttributeCompletions(posistion) {
113
113
  }));
114
114
  }
115
115
  function getNodeCompletions(symbols, exlucdedSymbols) {
116
- const res = new Array();
116
+ const res = [];
117
117
  for (const [key, value] of symbols) {
118
118
  if (exlucdedSymbols?.includes(key))
119
119
  continue;
@@ -112,7 +112,7 @@ function getEdgeHover(n) {
112
112
  const p = n.parent;
113
113
  if (!p || p.rhs.length === 0)
114
114
  return undefined;
115
- let source = undefined;
115
+ let source;
116
116
  for (const curr of p.rhs) {
117
117
  if (curr === n)
118
118
  break;
@@ -1,6 +1,6 @@
1
1
  import { findNodeAtOffset } from "../checker.js";
2
2
  import { isIdentifierNode } from "../index.js";
3
- import { syntaxNodeToRange, syntaxNodesToRanges } from "./util.js";
3
+ import { syntaxNodesToRanges, syntaxNodeToRange } from "./util.js";
4
4
  export function findReferences(doc, sourceFile, position, context) {
5
5
  if (!sourceFile.symbols)
6
6
  throw "sourceFile is not bound";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dot-language-support",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "description": "Parser and language service for graphviz (dot) files",
5
5
  "author": "Niklas Mollenhauer",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "test:coverage": "vitest run --coverage",
14
14
  "format": "biome format --write ./src",
15
15
  "lint": "biome lint ./src",
16
- "lint:fix": "biome lint --apply ./src",
16
+ "lint:fix": "biome lint --write ./src",
17
17
  "clean": "rimraf lib",
18
18
  "build:esm": "tsc --target esnext --module esnext --outDir lib/esm",
19
19
  "build:cjs": "tsc --target es2017 --module commonjs --outDir lib/cjs",
@@ -37,11 +37,11 @@
37
37
  "vscode-languageserver-types": "^3.17.5"
38
38
  },
39
39
  "devDependencies": {
40
- "@biomejs/biome": "^1.9.4",
41
- "@vitest/coverage-v8": "^3.1.4",
40
+ "@biomejs/biome": "^2.0.0",
41
+ "@vitest/coverage-v8": "^3.2.4",
42
42
  "rimraf": "^6.0.1",
43
43
  "typescript": "^5.8.3",
44
- "vitest": "^3.1.4"
44
+ "vitest": "^3.2.4"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=20"