cspell-trie-lib 9.1.2 → 9.1.3

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 +5 -54
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -440,12 +440,12 @@ function walker$1(root, compoundingMethod = CompoundWordsMethod.NONE) {
440
440
  return compoundingMethod === CompoundWordsMethod.NONE ? nodeWalker$1(root) : compoundWalker$1(root, compoundingMethod);
441
441
  }
442
442
  function walkerWords$1(root) {
443
- return walkerWordsITrie$1(root);
443
+ return walkerWordsITrie(root);
444
444
  }
445
445
  /**
446
446
  * Walks the Trie and yields each word.
447
447
  */
448
- function* walkerWordsITrie$1(root) {
448
+ function* walkerWordsITrie(root) {
449
449
  let depth = 0;
450
450
  const stack = [];
451
451
  const entries = root.entries();
@@ -622,9 +622,6 @@ function existMap(values) {
622
622
  function trieRootToITrieRoot(root) {
623
623
  return ImplITrieRoot.toITrieNode(root);
624
624
  }
625
- function trieNodeToITrieNode(node) {
626
- return ImplITrieNode.toITrieNode(node);
627
- }
628
625
  const EmptyKeys$2 = Object.freeze([]);
629
626
  const EmptyValues = Object.freeze([]);
630
627
  const EmptyEntries$2 = Object.freeze([]);
@@ -844,8 +841,7 @@ function* nodeWalker(root) {
844
841
  depth -= 1;
845
842
  }
846
843
  }
847
- const useITrie = false;
848
- const walkerWords = useITrie ? _walkerWords2 : _walkerWords;
844
+ const walkerWords = _walkerWords;
849
845
  /**
850
846
  * Walks the Trie and yields each word.
851
847
  */
@@ -894,49 +890,6 @@ function* _walkerWords(root) {
894
890
  function walker(root, compoundingMethod = CompoundWordsMethod.NONE) {
895
891
  return compoundingMethod === CompoundWordsMethod.NONE ? nodeWalker(root) : compoundWalker(root, compoundingMethod);
896
892
  }
897
- function _walkerWords2(root) {
898
- return walkerWordsITrie(trieNodeToITrieNode(root));
899
- }
900
- /**
901
- * Walks the Trie and yields each word.
902
- */
903
- function* walkerWordsITrie(root) {
904
- let depth = 0;
905
- const stack = [];
906
- stack[depth] = {
907
- t: "",
908
- n: root,
909
- c: [...root.entries()],
910
- ci: 0
911
- };
912
- while (depth >= 0) {
913
- let s = stack[depth];
914
- let baseText = s.t;
915
- while (s.ci < s.c.length && s.n) {
916
- const [char, node] = s.c[s.ci++];
917
- if (!node) continue;
918
- const text = baseText + char;
919
- if (node.eow) yield text;
920
- depth++;
921
- baseText = text;
922
- const c = [...node.entries()];
923
- if (stack[depth]) {
924
- s = stack[depth];
925
- s.t = text;
926
- s.n = node;
927
- s.c = c;
928
- s.ci = 0;
929
- } else stack[depth] = {
930
- t: text,
931
- n: node,
932
- c,
933
- ci: 0
934
- };
935
- s = stack[depth];
936
- }
937
- depth -= 1;
938
- }
939
- }
940
893
 
941
894
  //#endregion
942
895
  //#region src/lib/suggestions/genSuggestionsOptions.ts
@@ -3465,8 +3418,8 @@ function isLittleEndian() {
3465
3418
  }
3466
3419
  function checkSig(blob) {
3467
3420
  if (blob.length < HEADER_SIZE) return false;
3468
- const buf = Buffer.from(blob, 0, headerSig.length);
3469
- if (buf.toString("utf8", 0, headerSig.length) !== headerSig) return false;
3421
+ const buf = Buffer.from(blob, 0, 8);
3422
+ if (buf.toString("utf8", 0, 8) !== headerSig) return false;
3470
3423
  return true;
3471
3424
  }
3472
3425
  var ErrorDecodeTrieBlob = class extends Error {
@@ -3530,7 +3483,6 @@ function trieBlobSort(data) {
3530
3483
 
3531
3484
  //#endregion
3532
3485
  //#region src/lib/TrieBlob/FastTrieBlob.ts
3533
- const checkSorted = false;
3534
3486
  var FastTrieBlob = class FastTrieBlob {
3535
3487
  _readonly = false;
3536
3488
  #forbidIdx;
@@ -3553,7 +3505,6 @@ var FastTrieBlob = class FastTrieBlob {
3553
3505
  this.hasForbiddenWords = !!this.#forbidIdx;
3554
3506
  this.hasCompoundWords = !!this.#compoundIdx;
3555
3507
  this.hasNonStrictWords = !!this.#nonStrictIdx;
3556
- if (checkSorted) assertSorted(this.nodes, bitMasksInfo.NodeMaskChildCharIndex);
3557
3508
  }
3558
3509
  wordToUtf8Seq(word) {
3559
3510
  return this._charIndex.wordToUtf8Seq(word);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "9.1.2",
7
+ "version": "9.1.3",
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.1.2",
63
- "@cspell/cspell-types": "9.1.2",
62
+ "@cspell/cspell-pipe": "9.1.3",
63
+ "@cspell/cspell-types": "9.1.3",
64
64
  "gensequence": "^7.0.0"
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=20"
68
68
  },
69
69
  "devDependencies": {
70
- "@cspell/dict-en_us": "^4.4.11",
70
+ "@cspell/dict-en_us": "^4.4.13",
71
71
  "@cspell/dict-es-es": "^3.0.3",
72
72
  "@cspell/dict-nl-nl": "^2.4.0",
73
73
  "import-meta-resolve": "^4.1.0"
74
74
  },
75
- "gitHead": "231a39f34c2c586ebb596ae7b2a832a996a80a1e"
75
+ "gitHead": "cfa9ab3d0b5dc82afc488a6bf86a23e3a2afc077"
76
76
  }