cspell-trie-lib 9.3.2 → 9.5.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 +26 -4
  2. package/package.json +5 -5
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)
@@ -3967,7 +3967,8 @@ var FastTrieBlobBuilder = class FastTrieBlobBuilder {
3967
3967
  if (pos < node.length) node = tf.nodes[node[pos] >>> NodeChildRefShift];
3968
3968
  else {
3969
3969
  const next = [0];
3970
- node[pos] = tf.nodes.push(next) - 1 << NodeChildRefShift | idx$1;
3970
+ const nodeIdx = tf.nodes.push(next) - 1;
3971
+ node[pos] = nodeIdx << NodeChildRefShift | idx$1;
3971
3972
  node = next;
3972
3973
  }
3973
3974
  }
@@ -4452,7 +4453,7 @@ function findWordNode(root, word, options) {
4452
4453
  * @param options
4453
4454
  */
4454
4455
  function _findWord(root, word, options) {
4455
- const { node: _,...result } = _findWordNode(root, word, options);
4456
+ const { node: _, ...result } = _findWordNode(root, word, options);
4456
4457
  return result;
4457
4458
  }
4458
4459
  /**
@@ -5097,6 +5098,27 @@ const ESCAPE = "\\";
5097
5098
 
5098
5099
  //#endregion
5099
5100
  //#region src/lib/io/importExportV4.ts
5101
+ /**
5102
+ * Trie file format v4
5103
+ *
5104
+ * Trie format v4 is very similar to v3. The v4 reader can even read v3 files.
5105
+ * The motivation behind v4 is to reduce the cost of storing `.trie` files in git.
5106
+ * When a word is added in v3, nearly the entire file is changed due to the absolute
5107
+ * references. V4 adds an index sorted by the most frequently used reference to the least.
5108
+ * Because git diff is line based, it is important to add line breaks at logical points.
5109
+ * V3 added line breaks just to make sure the lines were not too long, V4 takes a different
5110
+ * approach. Line breaks are added at two distinct points. First, at the start of each two
5111
+ * letter prefix and second after approximately 50 words have been emitted.
5112
+ *
5113
+ * To improve readability and git diff, at the beginning of each two letter prefix,
5114
+ * a comment is emitted.
5115
+ *
5116
+ * Example:
5117
+ *
5118
+ * ```
5119
+ * /* ab *​/
5120
+ * ```
5121
+ */
5100
5122
  const REF_INDEX_BEGIN = "[";
5101
5123
  const REF_INDEX_END = "]";
5102
5124
  const INLINE_DATA_COMMENT_LINE = "/";
@@ -5571,7 +5593,7 @@ var TrieNodeBuilder = class {
5571
5593
  assertIsValidChar(char);
5572
5594
  if (currNode.k) {
5573
5595
  const s$1 = stack[depth];
5574
- const { k: _, c: c$1,...copy } = currNode;
5596
+ const { k: _, c: c$1, ...copy } = currNode;
5575
5597
  currNode = s$1.n.c[s$1.c] = copy;
5576
5598
  if (c$1) currNode.c = Object.assign(Object.create(null), c$1);
5577
5599
  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.5.0",
8
8
  "description": "Trie Data Structure to support cspell.",
9
9
  "type": "module",
10
10
  "sideEffects": false,
@@ -59,18 +59,18 @@
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.5.0",
63
+ "@cspell/cspell-types": "9.5.0",
64
64
  "gensequence": "^8.0.8"
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=20"
68
68
  },
69
69
  "devDependencies": {
70
- "@cspell/dict-en_us": "^4.4.24",
70
+ "@cspell/dict-en_us": "^4.4.25",
71
71
  "@cspell/dict-es-es": "^3.0.8",
72
72
  "@cspell/dict-nl-nl": "^2.4.2",
73
73
  "import-meta-resolve": "^4.2.0"
74
74
  },
75
- "gitHead": "595bde79b4a5abf3256b71129995ec3601454b02"
75
+ "gitHead": "4407eed11650481d9037e5a1d53488a93ff4b66d"
76
76
  }