cspell-trie-lib 9.3.2 → 9.4.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -3
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1286,7 +1286,7 @@ var _WeightCostCalculator = class {
1286
1286
  }
1287
1287
  };
1288
1288
  function normalizeDef(def) {
1289
- const { map,...rest } = def;
1289
+ const { map, ...rest } = def;
1290
1290
  return {
1291
1291
  ...rest,
1292
1292
  map: normalizeMap(map)
@@ -4452,7 +4452,7 @@ function findWordNode(root, word, options) {
4452
4452
  * @param options
4453
4453
  */
4454
4454
  function _findWord(root, word, options) {
4455
- const { node: _,...result } = _findWordNode(root, word, options);
4455
+ const { node: _, ...result } = _findWordNode(root, word, options);
4456
4456
  return result;
4457
4457
  }
4458
4458
  /**
@@ -5097,6 +5097,27 @@ const ESCAPE = "\\";
5097
5097
 
5098
5098
  //#endregion
5099
5099
  //#region src/lib/io/importExportV4.ts
5100
+ /**
5101
+ * Trie file format v4
5102
+ *
5103
+ * Trie format v4 is very similar to v3. The v4 reader can even read v3 files.
5104
+ * The motivation behind v4 is to reduce the cost of storing `.trie` files in git.
5105
+ * When a word is added in v3, nearly the entire file is changed due to the absolute
5106
+ * references. V4 adds an index sorted by the most frequently used reference to the least.
5107
+ * Because git diff is line based, it is important to add line breaks at logical points.
5108
+ * V3 added line breaks just to make sure the lines were not too long, V4 takes a different
5109
+ * approach. Line breaks are added at two distinct points. First, at the start of each two
5110
+ * letter prefix and second after approximately 50 words have been emitted.
5111
+ *
5112
+ * To improve readability and git diff, at the beginning of each two letter prefix,
5113
+ * a comment is emitted.
5114
+ *
5115
+ * Example:
5116
+ *
5117
+ * ```
5118
+ * /* ab *​/
5119
+ * ```
5120
+ */
5100
5121
  const REF_INDEX_BEGIN = "[";
5101
5122
  const REF_INDEX_END = "]";
5102
5123
  const INLINE_DATA_COMMENT_LINE = "/";
@@ -5571,7 +5592,7 @@ var TrieNodeBuilder = class {
5571
5592
  assertIsValidChar(char);
5572
5593
  if (currNode.k) {
5573
5594
  const s$1 = stack[depth];
5574
- const { k: _, c: c$1,...copy } = currNode;
5595
+ const { k: _, c: c$1, ...copy } = currNode;
5575
5596
  currNode = s$1.n.c[s$1.c] = copy;
5576
5597
  if (c$1) currNode.c = Object.assign(Object.create(null), c$1);
5577
5598
  nodes.push(currNode);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "9.3.2",
7
+ "version": "9.4.0",
8
8
  "description": "Trie Data Structure to support cspell.",
9
9
  "type": "module",
10
10
  "sideEffects": false,
@@ -59,8 +59,8 @@
59
59
  },
60
60
  "homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-trie-lib#readme",
61
61
  "dependencies": {
62
- "@cspell/cspell-pipe": "9.3.2",
63
- "@cspell/cspell-types": "9.3.2",
62
+ "@cspell/cspell-pipe": "9.4.0",
63
+ "@cspell/cspell-types": "9.4.0",
64
64
  "gensequence": "^8.0.8"
65
65
  },
66
66
  "engines": {
@@ -72,5 +72,5 @@
72
72
  "@cspell/dict-nl-nl": "^2.4.2",
73
73
  "import-meta-resolve": "^4.2.0"
74
74
  },
75
- "gitHead": "595bde79b4a5abf3256b71129995ec3601454b02"
75
+ "gitHead": "12dba3d8b880384d1401c765cb2186647f5a266f"
76
76
  }