@cspell/cspell-tools 9.7.0 → 10.0.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.
package/dist/app.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as reportCheckChecksumFile, c as toError, d as compressFile, i as logWithTimestamp, l as generateBTrie, n as compile, o as reportChecksumForFiles, r as setLogger, s as updateChecksumForFiles, t as build, u as OSFlags } from "./build-BGL2P0c2.mjs";
1
+ import { a as reportCheckChecksumFile, c as toError, d as compressFile, i as logWithTimestamp, l as generateBTrie, n as compile, o as reportChecksumForFiles, r as setLogger, s as updateChecksumForFiles, t as build, u as OSFlags } from "./build-JrGA5AHH.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { CommanderError, Option } from "commander";
4
4
  import { writeFile } from "node:fs/promises";
@@ -6,12 +6,10 @@ import * as path from "node:path";
6
6
  import { glob } from "glob";
7
7
  import { opConcatMap, pipe } from "@cspell/cspell-pipe/sync";
8
8
  import YAML from "yaml";
9
-
10
9
  //#region src/util/globP.ts
11
10
  function globP(pattern, options) {
12
11
  return glob((Array.isArray(pattern) ? pattern : [pattern]).map((pattern) => pattern.replaceAll("\\", "/")), options);
13
12
  }
14
-
15
13
  //#endregion
16
14
  //#region src/gzip/gzip.ts
17
15
  /**
@@ -23,7 +21,6 @@ async function gzipFiles(globs, os) {
23
21
  const files = await globP(globs, { nodir: true });
24
22
  for (const fileName of files) await compressFile(fileName, os);
25
23
  }
26
-
27
24
  //#endregion
28
25
  //#region src/compiler/createCompileRequest.ts
29
26
  function createCompileRequest(sourceFiles, options) {
@@ -96,11 +93,9 @@ function normalizeSourcePath(source) {
96
93
  const cwd = process.cwd();
97
94
  return path.relative(cwd, source).split("\\").join("/");
98
95
  }
99
-
100
96
  //#endregion
101
97
  //#region src/config/config.ts
102
98
  const configFileSchemaURL = "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-tools/cspell-tools.config.schema.json";
103
-
104
99
  //#endregion
105
100
  //#region src/FeatureFlags/FeatureFlags.ts
106
101
  let systemFeatureFlags;
@@ -192,7 +187,6 @@ function toBool(value) {
192
187
  if (typeof value !== "string") return value;
193
188
  return boolValues[value.toLowerCase()];
194
189
  }
195
-
196
190
  //#endregion
197
191
  //#region src/FeatureFlags/parseFlags.ts
198
192
  const splitFlag = /[:=]/;
@@ -212,7 +206,6 @@ function parseFlags(ff, flags) {
212
206
  }
213
207
  return ff;
214
208
  }
215
-
216
209
  //#endregion
217
210
  //#region src/compile.ts
218
211
  getSystemFeatureFlags().register("compound", "Enable compound dictionary sources.");
@@ -243,7 +236,6 @@ To build, use:
243
236
  cspell-tools-cli build
244
237
  `);
245
238
  }
246
-
247
239
  //#endregion
248
240
  //#region src/app.ts
249
241
  const npmPackageRaw = readFileSync(new URL("../package.json", import.meta.url), "utf8");
@@ -286,7 +278,7 @@ async function run(program, argv, flags) {
286
278
  program.command("shasum [files...]").description("Calculate the checksum for files.").option("--list-file <list-file.txt...>", "Specify one or more files that contain paths of files to check.").option("-c, --check <checksum.txt>", "Verify the checksum of files against those stored in the checksum.txt file.").addOption(new Option("-u, --update <checksum.txt>", "Update checksums found in the file.").conflicts("--check")).option("-r, --root <root>", "Specify the root to use for relative paths. The current working directory is used by default.").action(shasum);
287
279
  await program.parseAsync(argv);
288
280
  }
289
-
290
281
  //#endregion
291
282
  export { run };
283
+
292
284
  //# sourceMappingURL=app.mjs.map
@@ -14,7 +14,6 @@ import { pipeAsync, toArray } from "@cspell/cspell-pipe";
14
14
  import { opAwaitAsync, opMapAsync } from "@cspell/cspell-pipe/operators";
15
15
  import { createHash } from "node:crypto";
16
16
  import { Buffer } from "node:buffer";
17
-
18
17
  //#region src/gzip/compressFiles.ts
19
18
  const gzip$1 = promisify(gzip);
20
19
  const gunzip$1 = promisify(gunzip);
@@ -63,7 +62,6 @@ async function decompress(buf, encoding) {
63
62
  if (!encoding) return dBuf;
64
63
  return (await dBuf).toString(encoding);
65
64
  }
66
-
67
65
  //#endregion
68
66
  //#region src/util/writeFile.ts
69
67
  /**
@@ -83,11 +81,9 @@ async function writeFile$1(filePath, data) {
83
81
  const toWrite = filePath.endsWith(".gz") ? await compressIfNeeded(buf) : buf;
84
82
  return fs.writeFile(filePath, toWrite);
85
83
  }
86
-
87
84
  //#endregion
88
85
  //#region src/compiler/readers/regHunspellFile.ts
89
86
  const regHunspellFile = /\.(dic|aff)$/i;
90
-
91
87
  //#endregion
92
88
  //#region src/compiler/readers/readHunspellFiles.ts
93
89
  const DEDUPE_SIZE = 1e3;
@@ -145,7 +141,6 @@ function* _mapAffWords(affWords) {
145
141
  } else yield forbid + word;
146
142
  }
147
143
  }
148
-
149
144
  //#endregion
150
145
  //#region src/compiler/readers/readTextFile.ts
151
146
  const isGzFile$1 = /\.gz$/;
@@ -157,7 +152,6 @@ function readTextFile(filename) {
157
152
  function readFile$2(filename) {
158
153
  return promises.readFile(filename).then(async (buffer) => isGzFile$1.test(filename) ? decompress(buffer) : buffer);
159
154
  }
160
-
161
155
  //#endregion
162
156
  //#region src/compiler/readers/textFileReader.ts
163
157
  async function textFileReader$1(filename) {
@@ -178,7 +172,6 @@ async function textFileReader$1(filename) {
178
172
  }
179
173
  };
180
174
  }
181
-
182
175
  //#endregion
183
176
  //#region src/compiler/readers/trieFileReader.ts
184
177
  async function trieFileReader(filename) {
@@ -209,7 +202,6 @@ var TrieFileReader = class TrieFileReader {
209
202
  return new TrieFileReader(filename, decodeTrie(filename.endsWith(".gz") ? gunzipSync(rawBuffer) : rawBuffer));
210
203
  }
211
204
  };
212
-
213
205
  //#endregion
214
206
  //#region src/compiler/Reader.ts
215
207
  const readers = [
@@ -234,7 +226,6 @@ async function createReader(filename, options) {
234
226
  const baseReader = await findMatchingReader(filename, options);
235
227
  return Object.assign(baseReader, { [Symbol.iterator]: () => baseReader.lines[Symbol.iterator]() });
236
228
  }
237
-
238
229
  //#endregion
239
230
  //#region src/compiler/bTrie.ts
240
231
  async function generateBTrieFromFile(file, options) {
@@ -266,13 +257,11 @@ function bTrieFileName(inputFilename, options) {
266
257
  async function createBTrieFromFile(file, buildOptions) {
267
258
  return encodeTrieDataToBTrie((await createReader(file, {})).toTrie().data, buildOptions);
268
259
  }
269
-
270
260
  //#endregion
271
261
  //#region src/bTrie.ts
272
262
  function generateBTrie(files, options) {
273
263
  return generateBTrieFromFiles(files, options);
274
264
  }
275
-
276
265
  //#endregion
277
266
  //#region src/config/configUtils.ts
278
267
  function isFilePath(source) {
@@ -286,7 +275,6 @@ function isFileListSource(source) {
286
275
  if (!source || isFilePath(source)) return false;
287
276
  return source.listFile !== void 0;
288
277
  }
289
-
290
278
  //#endregion
291
279
  //#region src/config/normalizeConfig.ts
292
280
  function normalizeConfig(cfg) {
@@ -301,7 +289,6 @@ function normalizeConfig(cfg) {
301
289
  filepath: cfg.filepath
302
290
  };
303
291
  }
304
-
305
292
  //#endregion
306
293
  //#region src/shasum/checksum.ts
307
294
  function calcChecksum(buf, alg = "SHA1") {
@@ -315,7 +302,6 @@ async function calcFileChecksum(filename, alg) {
315
302
  async function checkFile(checksum, filename, alg) {
316
303
  return await calcFileChecksum(filename, alg) === checksum;
317
304
  }
318
-
319
305
  //#endregion
320
306
  //#region src/util/errors.ts
321
307
  function toError(err) {
@@ -326,13 +312,11 @@ function isError(err) {
326
312
  if (err instanceof Error) return true;
327
313
  return false;
328
314
  }
329
-
330
315
  //#endregion
331
316
  //#region src/util/index.ts
332
317
  function isDefined$1(a) {
333
318
  return !!a || a !== null && a !== void 0;
334
319
  }
335
-
336
320
  //#endregion
337
321
  //#region src/shasum/shasum.ts
338
322
  async function shasumFile(filename, root) {
@@ -473,7 +457,6 @@ async function updateChecksumForFiles(filename, files, options) {
473
457
  function normalizeFilename(filename) {
474
458
  return filename.split(sep).join("/");
475
459
  }
476
-
477
460
  //#endregion
478
461
  //#region src/util/textRegex.ts
479
462
  const regExMatchRegExParts = /^\s*\/([\s\S]*?)\/([gimuxy]*)\s*$/;
@@ -570,18 +553,16 @@ function removeVerboseFromRegExp(pattern) {
570
553
  while (result.idx < pattern.length) for (const r of reducers) if (r(result)) break;
571
554
  return result.result;
572
555
  }
573
-
574
556
  //#endregion
575
557
  //#region src/compiler/WordsCollection.ts
576
558
  const defaultAllowedSplitWords = Object.freeze({
577
559
  size: 0,
578
560
  has: () => true
579
561
  });
580
- const defaultExcludeWordsCollection = Object.freeze({
562
+ Object.freeze({
581
563
  size: 0,
582
564
  has: () => false
583
565
  });
584
-
585
566
  //#endregion
586
567
  //#region src/compiler/createWordsCollection.ts
587
568
  var AllowedSplitWordsImpl = class {
@@ -652,13 +633,11 @@ function lineReadersToCollection(readers) {
652
633
  function toFilePathArray(filePathOrArray) {
653
634
  return Array.isArray(filePathOrArray) ? filePathOrArray : [filePathOrArray];
654
635
  }
655
-
656
636
  //#endregion
657
637
  //#region src/compiler/logWithTimestamp.ts
658
638
  const logWithTimestamp = (message, ...optionalParams) => {
659
639
  console.log(`${(/* @__PURE__ */ new Date()).toISOString()} ${message}`, ...optionalParams);
660
640
  };
661
-
662
641
  //#endregion
663
642
  //#region src/config/configDefaults.ts
664
643
  const defaultCompileSourceOptions = {
@@ -669,7 +648,6 @@ const defaultCompileSourceOptions = {
669
648
  storeSplitWordsAsCompounds: false,
670
649
  minCompoundLength: 4
671
650
  };
672
-
673
651
  //#endregion
674
652
  //#region src/compiler/text.ts
675
653
  const regExSplitWords = /([\p{Ll}])([\p{Lu}])/gu;
@@ -684,7 +662,6 @@ function splitCamelCaseWord(word) {
684
662
  function isSingleLetter(c) {
685
663
  return regExpIsLetter.test(c);
686
664
  }
687
-
688
665
  //#endregion
689
666
  //#region src/compiler/splitCamelCaseIfAllowed.ts
690
667
  const regExpSpaceOrDash = /[- ]+/g;
@@ -740,7 +717,6 @@ function calcWordIndex(word, words) {
740
717
  return wIndex;
741
718
  });
742
719
  }
743
-
744
720
  //#endregion
745
721
  //#region src/compiler/legacyLineToWords.ts
746
722
  const regNonWord = /[^\p{L}\p{M}' _\d]+/giu;
@@ -751,7 +727,6 @@ function legacyLineToWords(line, keepCase, allowedSplitWords) {
751
727
  const _minCompoundLength = minCompoundLength;
752
728
  return pipe(wordGroups, opConcatMap((a) => a.split(regExpSpaceOrDash)), opConcatMap((a) => splitCamelCaseIfAllowed(a, allowedSplitWords, keepCase, "", _minCompoundLength)), opMap((a) => a.trim()), opFilter((a) => !!a), opFilter((s) => !regExpRepeatChars.test(s)));
753
729
  }
754
-
755
730
  //#endregion
756
731
  //#region src/compiler/wordListParser.ts
757
732
  function normalizeTargetWords(options) {
@@ -800,7 +775,7 @@ const _defaultOptions = {
800
775
  storeSplitWordsAsCompounds: defaultCompileSourceOptions.storeSplitWordsAsCompounds,
801
776
  minCompoundLength: defaultCompileSourceOptions.minCompoundLength
802
777
  };
803
- const defaultParseDictionaryOptions = Object.freeze(_defaultOptions);
778
+ Object.freeze(_defaultOptions);
804
779
  const cSpellToolDirective = "cspell-tools:";
805
780
  /**
806
781
  * Normalizes a dictionary words based upon prefix / suffixes.
@@ -908,7 +883,6 @@ function createParseFileLineMapper(options) {
908
883
  function parseFileLines(lines, options) {
909
884
  return createParseFileLineMapper(options)(typeof lines === "string" ? [lines] : lines);
910
885
  }
911
-
912
886
  //#endregion
913
887
  //#region src/compiler/SourceReader.ts
914
888
  async function createSourceReader(filename, options) {
@@ -946,13 +920,11 @@ async function textFileReader(reader, options) {
946
920
  words
947
921
  };
948
922
  }
949
-
950
923
  //#endregion
951
924
  //#region src/compiler/streamSourceWordsFromFile.ts
952
925
  async function streamSourceWordsFromFile(filename, options) {
953
926
  return (await createSourceReader(filename, options)).words;
954
927
  }
955
-
956
928
  //#endregion
957
929
  //#region src/compiler/logger.ts
958
930
  const defaultLogger = console.log;
@@ -963,7 +935,6 @@ function setLogger(logger) {
963
935
  function getLogger() {
964
936
  return log;
965
937
  }
966
-
967
938
  //#endregion
968
939
  //#region src/compiler/writeTextToFile.ts
969
940
  const isGzFile = /\.gz$/;
@@ -976,15 +947,13 @@ async function writeTextToFile(filename, data, useGzCompress) {
976
947
  const buffer = useGz ? await compress(buf) : buf;
977
948
  await promises.writeFile(filename, buffer);
978
949
  }
979
-
980
950
  //#endregion
981
951
  //#region src/compiler/wordListCompiler.ts
982
952
  const mkdirp = async (p) => {
983
953
  await mkdir(p, { recursive: true });
984
954
  };
985
- const wordListHeader = `
986
- # cspell-tools: keep-case no-split`;
987
- const wordListHeaderLines = wordListHeader.split("\n").map((a) => a.trim());
955
+ const wordListHeaderLines = `
956
+ # cspell-tools: keep-case no-split`.split("\n").map((a) => a.trim());
988
957
  function createWordListCompiler(options) {
989
958
  return (lines) => {
990
959
  const finalLines = normalize(lines, options);
@@ -1122,7 +1091,6 @@ function createTrieCompiler(options) {
1122
1091
  });
1123
1092
  };
1124
1093
  }
1125
-
1126
1094
  //#endregion
1127
1095
  //#region src/compiler/compile.ts
1128
1096
  async function compile(request, options) {
@@ -1390,7 +1358,6 @@ function iterableToString(iter) {
1390
1358
  function addToSet(set, ...sources) {
1391
1359
  for (const items of sources) for (const item of items) set.add(item);
1392
1360
  }
1393
-
1394
1361
  //#endregion
1395
1362
  //#region src/build.ts
1396
1363
  const moduleName = "cspell-tools";
@@ -1431,7 +1398,7 @@ function normalizeRequest(buildInfo, root) {
1431
1398
  checksumFile
1432
1399
  };
1433
1400
  }
1434
-
1435
1401
  //#endregion
1436
1402
  export { reportCheckChecksumFile as a, toError as c, compressFile as d, logWithTimestamp as i, generateBTrie as l, compile as n, reportChecksumForFiles as o, setLogger as r, updateChecksumForFiles as s, build as t, OSFlags as u };
1437
- //# sourceMappingURL=build-BGL2P0c2.mjs.map
1403
+
1404
+ //# sourceMappingURL=build-JrGA5AHH.mjs.map
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { l as generateBTrie, t as build } from "./build-BGL2P0c2.mjs";
2
-
3
- export { build, generateBTrie };
1
+ import { l as generateBTrie, t as build } from "./build-JrGA5AHH.mjs";
2
+ export { build, generateBTrie };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cspell/cspell-tools",
3
- "version": "9.7.0",
3
+ "version": "10.0.0",
4
4
  "description": "Tools to assist with the development of cSpell",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -64,21 +64,21 @@
64
64
  },
65
65
  "homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-tools#readme",
66
66
  "dependencies": {
67
- "@cspell/cspell-pipe": "9.7.0",
67
+ "@cspell/cspell-pipe": "10.0.0",
68
68
  "commander": "^14.0.3",
69
- "cosmiconfig": "9.0.0",
70
- "cspell-trie-lib": "9.7.0",
69
+ "cosmiconfig": "9.0.1",
70
+ "cspell-trie-lib": "10.0.0",
71
71
  "glob": "^13.0.6",
72
- "hunspell-reader": "9.7.0",
73
- "yaml": "^2.8.2"
72
+ "hunspell-reader": "10.0.0",
73
+ "yaml": "^2.8.3"
74
74
  },
75
75
  "engines": {
76
- "node": ">=20"
76
+ "node": ">=22.18.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "lorem-ipsum": "^2.0.8",
80
- "ts-json-schema-generator": "2.4.0"
80
+ "ts-json-schema-generator": "2.9.0"
81
81
  },
82
82
  "module": "bin.mjs",
83
- "gitHead": "48f64e0bd95b39011af6dc80cd8ae4d519511f73"
83
+ "gitHead": "6ddfd576b6bb554a7cb8dba1ab053a0b6ff8021f"
84
84
  }