@cspell/cspell-tools 10.4.0 → 10.4.1
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/cspell-tools.config.schema.json +0 -79
- package/dist/app.d.mts +0 -4
- package/dist/app.mjs +56 -42
- package/dist/{build-DitWkAJE.mjs → build-CkIhBjXk.mjs} +50 -84
- package/dist/index.d.mts +0 -10
- package/dist/index.mjs +1 -1
- package/package.json +5 -6
|
@@ -53,12 +53,6 @@
|
|
|
53
53
|
"description": "Words in the `allowedSplitWords` are considered correct and can be used as a basis for splitting compound words.\n\nIf entries can be split so that all the words in the entry are allowed, then only the individual words are added, otherwise the entire entry is added. This is to prevent misspellings in CamelCase words from being introduced into the dictionary.",
|
|
54
54
|
"markdownDescription": "Words in the `allowedSplitWords` are considered correct and can be used\nas a basis for splitting compound words.\n\nIf entries can be split so that all the words in the entry are allowed,\nthen only the individual words are added, otherwise the entire entry is added.\nThis is to prevent misspellings in CamelCase words from being introduced into the\ndictionary."
|
|
55
55
|
},
|
|
56
|
-
"keepRawCase": {
|
|
57
|
-
"default": false,
|
|
58
|
-
"description": "Do not generate lower case / accent free versions of words.",
|
|
59
|
-
"markdownDescription": "Do not generate lower case / accent free versions of words.",
|
|
60
|
-
"type": "boolean"
|
|
61
|
-
},
|
|
62
56
|
"listFile": {
|
|
63
57
|
"$ref": "#/definitions/FilePath"
|
|
64
58
|
},
|
|
@@ -128,12 +122,6 @@
|
|
|
128
122
|
"filename": {
|
|
129
123
|
"$ref": "#/definitions/FilePath"
|
|
130
124
|
},
|
|
131
|
-
"keepRawCase": {
|
|
132
|
-
"default": false,
|
|
133
|
-
"description": "Do not generate lower case / accent free versions of words.",
|
|
134
|
-
"markdownDescription": "Do not generate lower case / accent free versions of words.",
|
|
135
|
-
"type": "boolean"
|
|
136
|
-
},
|
|
137
125
|
"maxDepth": {
|
|
138
126
|
"description": "Maximum number of nested Hunspell Rules to apply. This is needed for recursive dictionaries like Hebrew.",
|
|
139
127
|
"markdownDescription": "Maximum number of nested Hunspell Rules to apply.\nThis is needed for recursive dictionaries like Hebrew.",
|
|
@@ -189,21 +177,6 @@
|
|
|
189
177
|
"Target": {
|
|
190
178
|
"additionalProperties": false,
|
|
191
179
|
"properties": {
|
|
192
|
-
"allowedSplitWords": {
|
|
193
|
-
"anyOf": [
|
|
194
|
-
{
|
|
195
|
-
"$ref": "#/definitions/FilePath"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"items": {
|
|
199
|
-
"$ref": "#/definitions/FilePath"
|
|
200
|
-
},
|
|
201
|
-
"type": "array"
|
|
202
|
-
}
|
|
203
|
-
],
|
|
204
|
-
"description": "Words in the `allowedSplitWords` are considered correct and can be used as a basis for splitting compound words.\n\nIf entries can be split so that all the words in the entry are allowed, then only the individual words are added, otherwise the entire entry is added. This is to prevent misspellings in CamelCase words from being introduced into the dictionary.",
|
|
205
|
-
"markdownDescription": "Words in the `allowedSplitWords` are considered correct and can be used\nas a basis for splitting compound words.\n\nIf entries can be split so that all the words in the entry are allowed,\nthen only the individual words are added, otherwise the entire entry is added.\nThis is to prevent misspellings in CamelCase words from being introduced into the\ndictionary."
|
|
206
|
-
},
|
|
207
180
|
"bTrie": {
|
|
208
181
|
"anyOf": [
|
|
209
182
|
{
|
|
@@ -332,21 +305,6 @@
|
|
|
332
305
|
"markdownDescription": "Url to JSON Schema",
|
|
333
306
|
"type": "string"
|
|
334
307
|
},
|
|
335
|
-
"allowedSplitWords": {
|
|
336
|
-
"anyOf": [
|
|
337
|
-
{
|
|
338
|
-
"$ref": "#/definitions/FilePath"
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
"items": {
|
|
342
|
-
"$ref": "#/definitions/FilePath"
|
|
343
|
-
},
|
|
344
|
-
"type": "array"
|
|
345
|
-
}
|
|
346
|
-
],
|
|
347
|
-
"description": "Words in the `allowedSplitWords` are considered correct and can be used as a basis for splitting compound words.\n\nIf entries can be split so that all the words in the entry are allowed, then only the individual words are added, otherwise the entire entry is added. This is to prevent misspellings in CamelCase words from being introduced into the dictionary.",
|
|
348
|
-
"markdownDescription": "Words in the `allowedSplitWords` are considered correct and can be used\nas a basis for splitting compound words.\n\nIf entries can be split so that all the words in the entry are allowed,\nthen only the individual words are added, otherwise the entire entry is added.\nThis is to prevent misspellings in CamelCase words from being introduced into the\ndictionary."
|
|
349
|
-
},
|
|
350
308
|
"checksumFile": {
|
|
351
309
|
"description": "Path to checksum file. `true` - defaults to `./checksum.txt`.",
|
|
352
310
|
"markdownDescription": "Path to checksum file. `true` - defaults to `./checksum.txt`.",
|
|
@@ -369,28 +327,11 @@
|
|
|
369
327
|
"markdownDescription": "Generate lower case / accent free versions of words.",
|
|
370
328
|
"type": "boolean"
|
|
371
329
|
},
|
|
372
|
-
"keepRawCase": {
|
|
373
|
-
"default": false,
|
|
374
|
-
"description": "Do not generate lower case / accent free versions of words.",
|
|
375
|
-
"markdownDescription": "Do not generate lower case / accent free versions of words.",
|
|
376
|
-
"type": "boolean"
|
|
377
|
-
},
|
|
378
330
|
"locale": {
|
|
379
331
|
"description": "The locale of the dictionary's words: a language and an optional region, such as `tr` or `tr-TR`. Words are lower-cased with this locale's case rules, for example, when generating the case insensitive forms with `generateNonStrict`. Without it, the default case rules are used.\n\nSet `dictionaryInformation.locale` in the dictionary definition to the same locale, so cspell searches the dictionary with the case rules it was built with. If the definition lists more than one locale, cspell uses the first valid one for case rules, so put this locale first.",
|
|
380
332
|
"markdownDescription": "The locale of the dictionary's words: a language and an optional region, such as `tr` or `tr-TR`.\nWords are lower-cased with this locale's case rules, for example, when generating the case insensitive\nforms with `generateNonStrict`. Without it, the default case rules are used.\n\nSet `dictionaryInformation.locale` in the dictionary definition to the same locale, so cspell searches the\ndictionary with the case rules it was built with. If the definition lists more than one locale, cspell uses the\nfirst valid one for case rules, so put this locale first.",
|
|
381
333
|
"type": "string"
|
|
382
334
|
},
|
|
383
|
-
"maxDepth": {
|
|
384
|
-
"description": "Maximum number of nested Hunspell Rules to apply. This is needed for recursive dictionaries like Hebrew.",
|
|
385
|
-
"markdownDescription": "Maximum number of nested Hunspell Rules to apply.\nThis is needed for recursive dictionaries like Hebrew.",
|
|
386
|
-
"type": "number"
|
|
387
|
-
},
|
|
388
|
-
"minCompoundLength": {
|
|
389
|
-
"default": 4,
|
|
390
|
-
"description": "Controls the minimum length of a compound word when storing words using `storeSplitWordsAsCompounds`. The compound words are prefixed / suffixed with `*`, to allow them to be combined with other compound words. If the length is too low, then the dictionary will consider many misspelled words as correct.",
|
|
391
|
-
"markdownDescription": "Controls the minimum length of a compound word when storing words using `storeSplitWordsAsCompounds`.\nThe compound words are prefixed / suffixed with `*`, to allow them to be combined with other compound words.\nIf the length is too low, then the dictionary will consider many misspelled words as correct.",
|
|
392
|
-
"type": "number"
|
|
393
|
-
},
|
|
394
335
|
"removeDuplicates": {
|
|
395
336
|
"default": false,
|
|
396
337
|
"description": "Remove duplicate words, favor lower case words over mixed case words. Combine compound prefixes where possible.",
|
|
@@ -408,26 +349,6 @@
|
|
|
408
349
|
"markdownDescription": "Sort the words in the resulting dictionary.\nDoes not apply to `trie` based formats.",
|
|
409
350
|
"type": "boolean"
|
|
410
351
|
},
|
|
411
|
-
"split": {
|
|
412
|
-
"anyOf": [
|
|
413
|
-
{
|
|
414
|
-
"type": "boolean"
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
"const": "legacy",
|
|
418
|
-
"type": "string"
|
|
419
|
-
}
|
|
420
|
-
],
|
|
421
|
-
"default": false,
|
|
422
|
-
"description": "Split lines into words.",
|
|
423
|
-
"markdownDescription": "Split lines into words."
|
|
424
|
-
},
|
|
425
|
-
"storeSplitWordsAsCompounds": {
|
|
426
|
-
"default": false,
|
|
427
|
-
"description": "Camel case words that have been split using the `allowedSplitWords` are added to the dictionary as compoundable words. These words are prefixed / suffixed with `*`.",
|
|
428
|
-
"markdownDescription": "Camel case words that have been split using the `allowedSplitWords` are added to the dictionary as compoundable words.\nThese words are prefixed / suffixed with `*`.",
|
|
429
|
-
"type": "boolean"
|
|
430
|
-
},
|
|
431
352
|
"targets": {
|
|
432
353
|
"description": "Optional Target Dictionaries to create.",
|
|
433
354
|
"items": {
|
package/dist/app.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
//#region src/FeatureFlags/FeatureFlags.d.ts
|
|
3
2
|
interface FeatureFlag {
|
|
4
3
|
name: string;
|
|
5
4
|
description: string;
|
|
@@ -26,9 +25,6 @@ declare class FeatureFlags {
|
|
|
26
25
|
help(): string;
|
|
27
26
|
fork(): FeatureFlags;
|
|
28
27
|
}
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/app.d.ts
|
|
31
28
|
export declare function run(program: Command, argv: string[], flags?: FeatureFlags): Promise<void>;
|
|
32
|
-
//#endregion
|
|
33
29
|
export {};
|
|
34
30
|
//# sourceMappingURL=app.d.mts.map
|
package/dist/app.mjs
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import { a as reportCheckChecksumFile, c as toError, i as logWithTimestamp, l as generateBTrie, n as compile, o as reportChecksumForFiles, r as setLogger, s as updateChecksumForFiles, t as build, u as compressFile } from "./build-
|
|
1
|
+
import { a as reportCheckChecksumFile, c as toError, i as logWithTimestamp, l as generateBTrie, n as compile, o as reportChecksumForFiles, r as setLogger, s as updateChecksumForFiles, t as build, u as compressFile } from "./build-CkIhBjXk.mjs";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { CommanderError, Option } from "commander";
|
|
4
|
-
import { writeFile } from "node:fs/promises";
|
|
4
|
+
import { glob, writeFile } from "node:fs/promises";
|
|
5
5
|
import * as path from "node:path";
|
|
6
|
-
import {
|
|
6
|
+
import { join, relative, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { toArray } from "@cspell/cspell-pipe";
|
|
7
9
|
import { opConcatMap, pipe } from "@cspell/cspell-pipe/sync";
|
|
8
10
|
import YAML from "yaml";
|
|
9
|
-
|
|
11
|
+
// src/util/globP.ts
|
|
10
12
|
function globP(pattern, options) {
|
|
11
13
|
const globs = (Array.isArray(pattern) ? pattern : [pattern]).map((pattern) => pattern.replaceAll("\\", "/"));
|
|
12
|
-
|
|
14
|
+
const cwd = options?.cwd ?? ".";
|
|
15
|
+
const root = resolve(cwd instanceof URL ? fileURLToPath(cwd) : cwd);
|
|
16
|
+
return options?.nodir ? globNonDirectories(globs, root) : toArray(glob(globs, { cwd: root }));
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
async function globNonDirectories(globs, root) {
|
|
19
|
+
return (await toArray(glob(globs, {
|
|
20
|
+
cwd: root,
|
|
21
|
+
withFileTypes: true
|
|
22
|
+
}))).filter((entry) => !entry.isDirectory()).map((entry) => relative(root, join(entry.parentPath, entry.name)));
|
|
23
|
+
}
|
|
24
|
+
// src/gzip/gzip.ts
|
|
16
25
|
/**
|
|
17
26
|
* GZip files matching the given globs.
|
|
18
27
|
* @param globs - array of globs to gzip
|
|
@@ -22,24 +31,20 @@ async function gzipFiles(globs, os) {
|
|
|
22
31
|
const files = await globP(globs, { nodir: true });
|
|
23
32
|
for (const fileName of files) await compressFile(fileName, os);
|
|
24
33
|
}
|
|
25
|
-
|
|
26
|
-
//#region src/compiler/createCompileRequest.ts
|
|
34
|
+
// src/compiler/createCompileRequest.ts
|
|
27
35
|
function createCompileRequest(sourceFiles, options) {
|
|
28
36
|
options = { ...options };
|
|
29
37
|
options.maxDepth ??= options.max_depth;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* Do not generate lower case / accent free versions of words.
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
keepRawCase
|
|
38
|
+
return { targets: calcTargets([...sourceFiles, ...(options.listFile || []).map((listFile) => ({ listFile }))], options, calcSourceOptions(options)) };
|
|
39
|
+
}
|
|
40
|
+
function calcSourceOptions(options) {
|
|
41
|
+
const sourceOptions = {
|
|
42
|
+
maxDepth: parseNumber(options.maxDepth),
|
|
43
|
+
split: options.useLegacySplitter ? "legacy" : options.split
|
|
40
44
|
};
|
|
45
|
+
return Object.fromEntries(Object.entries(sourceOptions).filter(([, v]) => v !== void 0));
|
|
41
46
|
}
|
|
42
|
-
function calcTargets(sources, options) {
|
|
47
|
+
function calcTargets(sources, options, sourceOptions) {
|
|
43
48
|
const { merge, output = ".", experimental = [] } = options;
|
|
44
49
|
const generateNonStrict = experimental.includes("compound") || void 0;
|
|
45
50
|
const format = calcFormat(options);
|
|
@@ -49,7 +54,7 @@ function calcTargets(sources, options) {
|
|
|
49
54
|
targetDirectory: output,
|
|
50
55
|
compress: options.compress,
|
|
51
56
|
format,
|
|
52
|
-
sources: sources.map(normalizeSource),
|
|
57
|
+
sources: sources.map((source) => normalizeSource(source, sourceOptions)),
|
|
53
58
|
sort,
|
|
54
59
|
trieBase: parseNumber(options.trieBase),
|
|
55
60
|
generateNonStrict,
|
|
@@ -61,7 +66,7 @@ function calcTargets(sources, options) {
|
|
|
61
66
|
targetDirectory: output,
|
|
62
67
|
compress: options.compress,
|
|
63
68
|
format,
|
|
64
|
-
sources: [normalizeSource(source)],
|
|
69
|
+
sources: [normalizeSource(source, sourceOptions)],
|
|
65
70
|
sort: options.sort,
|
|
66
71
|
trieBase: parseNumber(options.trieBase),
|
|
67
72
|
generateNonStrict,
|
|
@@ -85,26 +90,37 @@ function baseNameOfSource(source) {
|
|
|
85
90
|
function isFileSource(source) {
|
|
86
91
|
return typeof source !== "string" && source.filename !== void 0;
|
|
87
92
|
}
|
|
88
|
-
function normalizeSource(source) {
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
function normalizeSource(source, sourceOptions) {
|
|
94
|
+
const hasOptions = Object.keys(sourceOptions).length > 0;
|
|
95
|
+
if (typeof source === "string") {
|
|
96
|
+
const filename = normalizeSourcePath(source);
|
|
97
|
+
return hasOptions ? {
|
|
98
|
+
filename,
|
|
99
|
+
...sourceOptions
|
|
100
|
+
} : filename;
|
|
101
|
+
}
|
|
102
|
+
if (isFileSource(source)) {
|
|
103
|
+
const { filename, ...rest } = source;
|
|
104
|
+
return {
|
|
105
|
+
filename: normalizeSourcePath(filename),
|
|
106
|
+
...sourceOptions,
|
|
107
|
+
...rest
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const { listFile, ...rest } = source;
|
|
94
111
|
return {
|
|
95
|
-
|
|
96
|
-
|
|
112
|
+
listFile: normalizeSourcePath(listFile),
|
|
113
|
+
...sourceOptions,
|
|
114
|
+
...rest
|
|
97
115
|
};
|
|
98
116
|
}
|
|
99
117
|
function normalizeSourcePath(source) {
|
|
100
118
|
const cwd = process.cwd();
|
|
101
119
|
return path.relative(cwd, source).replaceAll("\\", "/");
|
|
102
120
|
}
|
|
103
|
-
|
|
104
|
-
//#region src/config/config.ts
|
|
121
|
+
// src/config/config.ts
|
|
105
122
|
const configFileSchemaURL = "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-tools/cspell-tools.config.schema.json";
|
|
106
|
-
|
|
107
|
-
//#region src/FeatureFlags/FeatureFlags.ts
|
|
123
|
+
// src/FeatureFlags/FeatureFlags.ts
|
|
108
124
|
let systemFeatureFlags;
|
|
109
125
|
/**
|
|
110
126
|
* Feature Flags are used to turn on/off features.
|
|
@@ -195,8 +211,7 @@ function toBool(value) {
|
|
|
195
211
|
if (typeof value !== "string") return value;
|
|
196
212
|
return boolValues[value.toLowerCase()];
|
|
197
213
|
}
|
|
198
|
-
|
|
199
|
-
//#region src/FeatureFlags/parseFlags.ts
|
|
214
|
+
// src/FeatureFlags/parseFlags.ts
|
|
200
215
|
const splitFlag = /[:=]/;
|
|
201
216
|
const leadingEql = /^=/;
|
|
202
217
|
function parseFlags(ff, flags) {
|
|
@@ -214,8 +229,7 @@ function parseFlags(ff, flags) {
|
|
|
214
229
|
}
|
|
215
230
|
return ff;
|
|
216
231
|
}
|
|
217
|
-
|
|
218
|
-
//#region src/compile.ts
|
|
232
|
+
// src/compile.ts
|
|
219
233
|
getSystemFeatureFlags().register("compound", "Enable compound dictionary sources.");
|
|
220
234
|
const defaultConfigFile = "cspell-tools.config.yaml";
|
|
221
235
|
const configFileHeader = `# yaml-language-server: $schema=${configFileSchemaURL}\n\n`;
|
|
@@ -245,8 +259,7 @@ To build, use:
|
|
|
245
259
|
cspell-tools-cli build
|
|
246
260
|
`);
|
|
247
261
|
}
|
|
248
|
-
|
|
249
|
-
//#region src/app.ts
|
|
262
|
+
// src/app.ts
|
|
250
263
|
const npmPackageRaw = readFileSync(new URL("../package.json", import.meta.url), "utf8");
|
|
251
264
|
const npmPackage = JSON.parse(npmPackageRaw);
|
|
252
265
|
setLogger(logWithTimestamp);
|
|
@@ -254,7 +267,9 @@ function collect(value, previous) {
|
|
|
254
267
|
return [...previous, value];
|
|
255
268
|
}
|
|
256
269
|
function addCompileOptions(compileCommand) {
|
|
257
|
-
return compileCommand.option("-o, --output <path>", "Specify the output directory, otherwise files are written back to the same location.").option("-n, --no-compress", "By default the files are GZipped, this will turn off GZ compression.").option("-m, --max_depth <limit>", "Maximum depth to apply suffix rules.").option("-M, --merge <target>", "Merge all files into a single target file (extensions are applied)").option("--split", "Split each line", void 0).option("--no-split", "Treat each line as a dictionary entry, do not split").option("--use-legacy-splitter", "Do not use legacy line splitter logic.").
|
|
270
|
+
return compileCommand.option("-o, --output <path>", "Specify the output directory, otherwise files are written back to the same location.").option("-n, --no-compress", "By default the files are GZipped, this will turn off GZ compression.").option("-m, --max_depth <limit>", "Maximum depth to apply suffix rules.").option("-M, --merge <target>", "Merge all files into a single target file (extensions are applied)").option("--split", "Split each line", void 0).option("--no-split", "Treat each line as a dictionary entry, do not split").option("--use-legacy-splitter", "Do not use legacy line splitter logic.").addOption(new Option("--keep-raw-case", "Has no effect.").hideHelp()).on("option:keep-raw-case", () => {
|
|
271
|
+
console.warn("--keep-raw-case has no effect and will be removed in future versions.");
|
|
272
|
+
}).option("-x, --experimental <flag>", "Experimental flags, used for testing new concepts. Flags: compound", collect, []).option("--trie3", "Use file format trie3", false).option("--trie4", "Use file format trie4", false).option("--trie-base <number>", "Advanced: Set the trie base number. A value between 10 and 36").option("--list-file <filename...>", "Path to a file that contains the list of files to compile. A list file contains one file per line.").option("--init", "Create a build command `cspell-tools.config.yaml` file based upon the options given instead of building.");
|
|
258
273
|
}
|
|
259
274
|
async function run(program, argv, flags) {
|
|
260
275
|
async function handleGzip(files) {
|
|
@@ -287,7 +302,6 @@ async function run(program, argv, flags) {
|
|
|
287
302
|
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);
|
|
288
303
|
await program.parseAsync(argv);
|
|
289
304
|
}
|
|
290
|
-
//#endregion
|
|
291
305
|
export { run };
|
|
292
306
|
|
|
293
307
|
//# sourceMappingURL=app.mjs.map
|
|
@@ -6,15 +6,15 @@ import * as Trie from "cspell-trie-lib";
|
|
|
6
6
|
import { COMPOUND_FIX, FORBID_PREFIX, createDictionaryLineParser, decodeTrie, encodeTrieDataToBTrie, parseDictionary } from "cspell-trie-lib";
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
8
|
import { gunzip, gunzipSync, gzip } from "node:zlib";
|
|
9
|
+
import { pipeAsync, toArray } from "@cspell/cspell-pipe";
|
|
9
10
|
import { opAppend, opCombine, opConcatMap, opFilter, opMap, pipe } from "@cspell/cspell-pipe/sync";
|
|
10
11
|
import * as HR from "hunspell-reader";
|
|
11
12
|
import { uniqueFilter } from "hunspell-reader";
|
|
12
13
|
import { cosmiconfig } from "cosmiconfig";
|
|
13
|
-
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
|
-
|
|
17
|
+
// src/gzip/compressFiles.ts
|
|
18
18
|
const gzip$1 = promisify(gzip);
|
|
19
19
|
const gunzip$1 = promisify(gunzip);
|
|
20
20
|
const OSSystemIDOffset = 9;
|
|
@@ -55,8 +55,7 @@ async function decompress(buf, encoding) {
|
|
|
55
55
|
if (!encoding) return dBuf;
|
|
56
56
|
return (await dBuf).toString(encoding);
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
//#region src/util/writeFile.ts
|
|
58
|
+
// src/util/writeFile.ts
|
|
60
59
|
/**
|
|
61
60
|
* Writes a file to disk and compress as needed.
|
|
62
61
|
*
|
|
@@ -74,11 +73,9 @@ async function writeFile$1(filePath, data) {
|
|
|
74
73
|
const toWrite = filePath.endsWith(".gz") ? await compressIfNeeded(buf) : buf;
|
|
75
74
|
return fs.writeFile(filePath, toWrite);
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
//#region src/compiler/readers/regHunspellFile.ts
|
|
76
|
+
// src/compiler/readers/regHunspellFile.ts
|
|
79
77
|
const regHunspellFile = /\.(dic|aff)$/i;
|
|
80
|
-
|
|
81
|
-
//#region src/compiler/readers/readHunspellFiles.ts
|
|
78
|
+
// src/compiler/readers/readHunspellFiles.ts
|
|
82
79
|
const DEDUPE_SIZE = 1e3;
|
|
83
80
|
async function readHunspellFiles(filename, options) {
|
|
84
81
|
const dicFile = filename.replace(regHunspellFile, ".dic");
|
|
@@ -134,8 +131,7 @@ function* _mapAffWords(affWords) {
|
|
|
134
131
|
} else yield forbid + word;
|
|
135
132
|
}
|
|
136
133
|
}
|
|
137
|
-
|
|
138
|
-
//#region src/compiler/readers/readTextFile.ts
|
|
134
|
+
// src/compiler/readers/readTextFile.ts
|
|
139
135
|
const isGzFile$1 = /\.gz$/;
|
|
140
136
|
function readTextFile(filename) {
|
|
141
137
|
return readFile$2(filename).then((buffer) => {
|
|
@@ -145,8 +141,7 @@ function readTextFile(filename) {
|
|
|
145
141
|
function readFile$2(filename) {
|
|
146
142
|
return promises.readFile(filename).then(async (buffer) => isGzFile$1.test(filename) ? decompress(buffer) : buffer);
|
|
147
143
|
}
|
|
148
|
-
|
|
149
|
-
//#region src/compiler/readers/textFileReader.ts
|
|
144
|
+
// src/compiler/readers/textFileReader.ts
|
|
150
145
|
async function textFileReader$1(filename) {
|
|
151
146
|
const words = (await readTextFile(filename)).split("\n").map((s) => s.trim());
|
|
152
147
|
let trie;
|
|
@@ -165,8 +160,7 @@ async function textFileReader$1(filename) {
|
|
|
165
160
|
}
|
|
166
161
|
};
|
|
167
162
|
}
|
|
168
|
-
|
|
169
|
-
//#region src/compiler/readers/trieFileReader.ts
|
|
163
|
+
// src/compiler/readers/trieFileReader.ts
|
|
170
164
|
async function trieFileReader(filename) {
|
|
171
165
|
return TrieFileReader.create(filename);
|
|
172
166
|
}
|
|
@@ -197,8 +191,7 @@ var TrieFileReader = class TrieFileReader {
|
|
|
197
191
|
return new TrieFileReader(filename, trie);
|
|
198
192
|
}
|
|
199
193
|
};
|
|
200
|
-
|
|
201
|
-
//#region src/compiler/Reader.ts
|
|
194
|
+
// src/compiler/Reader.ts
|
|
202
195
|
const readers = [
|
|
203
196
|
{
|
|
204
197
|
test: /\.trie\b/,
|
|
@@ -221,8 +214,7 @@ async function createReader(filename, options) {
|
|
|
221
214
|
const baseReader = await findMatchingReader(filename, options);
|
|
222
215
|
return Object.assign(baseReader, { [Symbol.iterator]: () => baseReader.lines[Symbol.iterator]() });
|
|
223
216
|
}
|
|
224
|
-
|
|
225
|
-
//#region src/compiler/bTrie.ts
|
|
217
|
+
// src/compiler/bTrie.ts
|
|
226
218
|
async function generateBTrieFromFile(file, options) {
|
|
227
219
|
const log = options.logger || console.log.bind(console);
|
|
228
220
|
log(`Processing file: ${file}`);
|
|
@@ -253,13 +245,11 @@ async function createBTrieFromFile(file, buildOptions) {
|
|
|
253
245
|
const trie = (await createReader(file, {})).toTrie();
|
|
254
246
|
return encodeTrieDataToBTrie(trie.data, buildOptions);
|
|
255
247
|
}
|
|
256
|
-
|
|
257
|
-
//#region src/bTrie.ts
|
|
248
|
+
// src/bTrie.ts
|
|
258
249
|
function generateBTrie(files, options) {
|
|
259
250
|
return generateBTrieFromFiles(files, options);
|
|
260
251
|
}
|
|
261
|
-
|
|
262
|
-
//#region src/config/configUtils.ts
|
|
252
|
+
// src/config/configUtils.ts
|
|
263
253
|
function isFilePath(source) {
|
|
264
254
|
return typeof source === "string";
|
|
265
255
|
}
|
|
@@ -271,8 +261,7 @@ function isFileListSource(source) {
|
|
|
271
261
|
if (!source || isFilePath(source)) return false;
|
|
272
262
|
return source.listFile !== void 0;
|
|
273
263
|
}
|
|
274
|
-
|
|
275
|
-
//#region src/config/normalizeConfig.ts
|
|
264
|
+
// src/config/normalizeConfig.ts
|
|
276
265
|
function normalizeConfig(cfg) {
|
|
277
266
|
if (!cfg) return cfg;
|
|
278
267
|
const dir = path.dirname(cfg.filepath);
|
|
@@ -285,8 +274,7 @@ function normalizeConfig(cfg) {
|
|
|
285
274
|
filepath: cfg.filepath
|
|
286
275
|
};
|
|
287
276
|
}
|
|
288
|
-
|
|
289
|
-
//#region src/shasum/checksum.ts
|
|
277
|
+
// src/shasum/checksum.ts
|
|
290
278
|
function calcChecksum(buf, alg = "SHA1") {
|
|
291
279
|
const hash = createHash(alg);
|
|
292
280
|
hash.update(buf);
|
|
@@ -298,8 +286,7 @@ async function calcFileChecksum(filename, alg) {
|
|
|
298
286
|
async function checkFile(checksum, filename, alg) {
|
|
299
287
|
return await calcFileChecksum(filename, alg) === checksum;
|
|
300
288
|
}
|
|
301
|
-
|
|
302
|
-
//#region src/util/errors.ts
|
|
289
|
+
// src/util/errors.ts
|
|
303
290
|
function toError(err) {
|
|
304
291
|
if (isError(err)) return err;
|
|
305
292
|
return /* @__PURE__ */ new Error(`${err}`);
|
|
@@ -308,13 +295,11 @@ function isError(err) {
|
|
|
308
295
|
if (err instanceof Error) return true;
|
|
309
296
|
return false;
|
|
310
297
|
}
|
|
311
|
-
|
|
312
|
-
//#region src/util/index.ts
|
|
298
|
+
// src/util/index.ts
|
|
313
299
|
function isDefined$1(a) {
|
|
314
300
|
return !!a || a !== null && a !== void 0;
|
|
315
301
|
}
|
|
316
|
-
|
|
317
|
-
//#region src/shasum/shasum.ts
|
|
302
|
+
// src/shasum/shasum.ts
|
|
318
303
|
async function shasumFile(filename, root) {
|
|
319
304
|
try {
|
|
320
305
|
return `${await calcFileChecksum(resolve(root || ".", filename))} ${filename}`;
|
|
@@ -453,8 +438,7 @@ async function updateChecksumForFiles(filename, files, options) {
|
|
|
453
438
|
function normalizeFilename(filename) {
|
|
454
439
|
return filename.split(sep).join("/");
|
|
455
440
|
}
|
|
456
|
-
|
|
457
|
-
//#region src/util/textRegex.ts
|
|
441
|
+
// src/util/textRegex.ts
|
|
458
442
|
const regExMatchRegExParts = /^\s*\/([\s\S]*?)\/([gimuxy]*)\s*$/;
|
|
459
443
|
function stringToRegExp(pattern, defaultFlags = "", forceFlags = "") {
|
|
460
444
|
if (pattern instanceof RegExp) return pattern;
|
|
@@ -549,8 +533,7 @@ function removeVerboseFromRegExp(pattern) {
|
|
|
549
533
|
while (result.idx < pattern.length) for (const r of reducers) if (r(result)) break;
|
|
550
534
|
return result.result;
|
|
551
535
|
}
|
|
552
|
-
|
|
553
|
-
//#region src/compiler/text.ts
|
|
536
|
+
// src/compiler/text.ts
|
|
554
537
|
const regExSplitWords = /([\p{Ll}])([\p{Lu}])/gu;
|
|
555
538
|
const regExSplitWords2 = /(\p{Lu})(\p{Lu}\p{Ll})/gu;
|
|
556
539
|
const regExpIsLetter = /^\p{L}\p{M}{0,2}$/u;
|
|
@@ -572,8 +555,7 @@ function lowerCase(word, locale) {
|
|
|
572
555
|
function isSingleLetter(c) {
|
|
573
556
|
return regExpIsLetter.test(c);
|
|
574
557
|
}
|
|
575
|
-
|
|
576
|
-
//#region src/compiler/WordsCollection.ts
|
|
558
|
+
// src/compiler/WordsCollection.ts
|
|
577
559
|
const defaultAllowedSplitWords = Object.freeze({
|
|
578
560
|
size: 0,
|
|
579
561
|
has: () => true
|
|
@@ -582,8 +564,7 @@ Object.freeze({
|
|
|
582
564
|
size: 0,
|
|
583
565
|
has: () => false
|
|
584
566
|
});
|
|
585
|
-
|
|
586
|
-
//#region src/compiler/createWordsCollection.ts
|
|
567
|
+
// src/compiler/createWordsCollection.ts
|
|
587
568
|
var AllowedSplitWordsImpl = class {
|
|
588
569
|
collection;
|
|
589
570
|
size;
|
|
@@ -666,31 +647,27 @@ function toFilePathArray(filePathOrArray) {
|
|
|
666
647
|
filePaths.set(filePathOrArray, paths);
|
|
667
648
|
return paths;
|
|
668
649
|
}
|
|
669
|
-
|
|
670
|
-
//#region src/compiler/logWithTimestamp.ts
|
|
650
|
+
// src/compiler/logWithTimestamp.ts
|
|
671
651
|
const logWithTimestamp = (message, ...optionalParams) => {
|
|
672
652
|
console.log(`${(/* @__PURE__ */ new Date()).toISOString()} ${message}`, ...optionalParams);
|
|
673
653
|
};
|
|
674
|
-
|
|
675
|
-
//#region src/config/configDefaults.ts
|
|
654
|
+
// src/config/configDefaults.ts
|
|
676
655
|
const defaultCompileSourceOptions = {
|
|
677
656
|
maxDepth: void 0,
|
|
678
657
|
split: false,
|
|
679
|
-
keepRawCase: false,
|
|
680
658
|
allowedSplitWords: void 0,
|
|
681
659
|
storeSplitWordsAsCompounds: false,
|
|
682
660
|
minCompoundLength: 4
|
|
683
661
|
};
|
|
684
|
-
|
|
685
|
-
//#region src/compiler/splitCamelCaseIfAllowed.ts
|
|
662
|
+
// src/compiler/splitCamelCaseIfAllowed.ts
|
|
686
663
|
const regExpSpaceOrDash = /[- ]+/g;
|
|
687
664
|
const regExpIsNumber = /^\d+$/;
|
|
688
665
|
function splitCamelCaseIfAllowed(word, allowedWords, keepCase, compoundPrefix, minCompoundLength, locale) {
|
|
689
666
|
const split = [...splitCamelCase(word)];
|
|
690
|
-
if (split.length === 1) return
|
|
667
|
+
if (split.length === 1) return lowerCaseUnlessAcronyms(split, allowedWords, keepCase, locale);
|
|
691
668
|
if (split.some((w) => isUnknown(w, allowedWords))) return [word];
|
|
692
669
|
const wordIndexes = calcWordIndex(word, split);
|
|
693
|
-
const adjusted =
|
|
670
|
+
const adjusted = lowerCaseUnlessAcronyms(split, allowedWords, keepCase, locale);
|
|
694
671
|
return !compoundPrefix ? adjusted : adjusted.map((w, i) => {
|
|
695
672
|
const { px, sx } = wordIndexes[i];
|
|
696
673
|
const canCompound = w.length >= minCompoundLength;
|
|
@@ -701,10 +678,10 @@ function splitCamelCaseIfAllowed(word, allowedWords, keepCase, compoundPrefix, m
|
|
|
701
678
|
return p + lc + s;
|
|
702
679
|
});
|
|
703
680
|
}
|
|
704
|
-
function
|
|
705
|
-
return words.map((w) =>
|
|
681
|
+
function lowerCaseUnlessAcronyms(words, allowedWords, keepCase, locale) {
|
|
682
|
+
return words.map((w) => lowerCaseUnlessAcronym(w, allowedWords, keepCase, locale));
|
|
706
683
|
}
|
|
707
|
-
function
|
|
684
|
+
function lowerCaseUnlessAcronym(word, allowedWords, keepCase, locale) {
|
|
708
685
|
const lc = lowerCase(word, locale);
|
|
709
686
|
if (!allowedWords.has(lc, true)) return word;
|
|
710
687
|
if (lc === word) return word;
|
|
@@ -736,8 +713,7 @@ function calcWordIndex(word, words) {
|
|
|
736
713
|
return wIndex;
|
|
737
714
|
});
|
|
738
715
|
}
|
|
739
|
-
|
|
740
|
-
//#region src/compiler/legacyLineToWords.ts
|
|
716
|
+
// src/compiler/legacyLineToWords.ts
|
|
741
717
|
const regNonWord = /[^\p{L}\p{M}' _\d]+/giu;
|
|
742
718
|
const regExpRepeatChars = /(.)\1{5}/i;
|
|
743
719
|
const minCompoundLength = defaultCompileSourceOptions.minCompoundLength;
|
|
@@ -746,8 +722,7 @@ function legacyLineToWords(line, keepCase, allowedSplitWords, locale) {
|
|
|
746
722
|
const _minCompoundLength = minCompoundLength;
|
|
747
723
|
return pipe(wordGroups, opConcatMap((a) => a.split(regExpSpaceOrDash)), opConcatMap((a) => splitCamelCaseIfAllowed(a, allowedSplitWords, keepCase, "", _minCompoundLength, locale)), opMap((a) => a.trim()), opFilter((a) => !!a), opFilter((s) => !regExpRepeatChars.test(s)));
|
|
748
724
|
}
|
|
749
|
-
|
|
750
|
-
//#region src/compiler/wordListParser.ts
|
|
725
|
+
// src/compiler/wordListParser.ts
|
|
751
726
|
function normalizeTargetWords(options) {
|
|
752
727
|
const lineParser = createDictionaryLineParser({
|
|
753
728
|
stripCaseAndAccents: options.generateNonStrict,
|
|
@@ -915,8 +890,7 @@ function replacementsToMapOperator(replacements) {
|
|
|
915
890
|
return word;
|
|
916
891
|
});
|
|
917
892
|
}
|
|
918
|
-
|
|
919
|
-
//#region src/compiler/SourceReader.ts
|
|
893
|
+
// src/compiler/SourceReader.ts
|
|
920
894
|
async function createSourceReader(filename, options) {
|
|
921
895
|
const reader = await createReader(filename, options);
|
|
922
896
|
if (reader.type !== "TextFile") return {
|
|
@@ -953,13 +927,11 @@ async function textFileReader(reader, options) {
|
|
|
953
927
|
words
|
|
954
928
|
};
|
|
955
929
|
}
|
|
956
|
-
|
|
957
|
-
//#region src/compiler/streamSourceWordsFromFile.ts
|
|
930
|
+
// src/compiler/streamSourceWordsFromFile.ts
|
|
958
931
|
async function streamSourceWordsFromFile(filename, options) {
|
|
959
932
|
return (await createSourceReader(filename, options)).words;
|
|
960
933
|
}
|
|
961
|
-
|
|
962
|
-
//#region src/compiler/logger.ts
|
|
934
|
+
// src/compiler/logger.ts
|
|
963
935
|
const defaultLogger = console.log;
|
|
964
936
|
let log = defaultLogger;
|
|
965
937
|
function setLogger(logger) {
|
|
@@ -968,8 +940,7 @@ function setLogger(logger) {
|
|
|
968
940
|
function getLogger() {
|
|
969
941
|
return log;
|
|
970
942
|
}
|
|
971
|
-
|
|
972
|
-
//#region src/compiler/writeTextToFile.ts
|
|
943
|
+
// src/compiler/writeTextToFile.ts
|
|
973
944
|
const isGzFile = /\.gz$/;
|
|
974
945
|
async function writeTextToFile(filename, data, useGzCompress) {
|
|
975
946
|
const dataStr = typeof data === "string" ? data : Array.isArray(data) ? data.join("") : [...data].join("");
|
|
@@ -980,8 +951,7 @@ async function writeTextToFile(filename, data, useGzCompress) {
|
|
|
980
951
|
const buffer = useGz ? await compress(buf) : buf;
|
|
981
952
|
await promises.writeFile(filename, buffer);
|
|
982
953
|
}
|
|
983
|
-
|
|
984
|
-
//#region src/compiler/wordListCompiler.ts
|
|
954
|
+
// src/compiler/wordListCompiler.ts
|
|
985
955
|
const mkdirp = async (p) => {
|
|
986
956
|
await mkdir(p, { recursive: true });
|
|
987
957
|
};
|
|
@@ -1110,8 +1080,7 @@ function createTrieCompiler(options) {
|
|
|
1110
1080
|
});
|
|
1111
1081
|
};
|
|
1112
1082
|
}
|
|
1113
|
-
|
|
1114
|
-
//#region src/compiler/compile.ts
|
|
1083
|
+
// src/compiler/compile.ts
|
|
1115
1084
|
async function compile(request, options) {
|
|
1116
1085
|
const { targets } = request;
|
|
1117
1086
|
const rootDir = path.resolve(request.rootDir || ".");
|
|
@@ -1132,7 +1101,7 @@ async function compile(request, options) {
|
|
|
1132
1101
|
(await compileTarget({
|
|
1133
1102
|
...targetOptions,
|
|
1134
1103
|
...target
|
|
1135
|
-
},
|
|
1104
|
+
}, {
|
|
1136
1105
|
rootDir,
|
|
1137
1106
|
cwd,
|
|
1138
1107
|
conditional,
|
|
@@ -1150,11 +1119,11 @@ function resolveChecksumFile(checksumFile, root) {
|
|
|
1150
1119
|
const cFilename = typeof checksumFile === "string" && checksumFile || checksumFile && "./checksum.txt" || void 0;
|
|
1151
1120
|
return cFilename && path.resolve(root, cFilename);
|
|
1152
1121
|
}
|
|
1153
|
-
async function compileTarget(target,
|
|
1122
|
+
async function compileTarget(target, compileOptions) {
|
|
1154
1123
|
logWithTimestamp(`Start compile: ${target.name}`);
|
|
1155
1124
|
const buildOptions = genBuildTargetDictionaryOptions(target, compileOptions);
|
|
1156
1125
|
const deps = /* @__PURE__ */ new Set();
|
|
1157
|
-
addToSet(deps, await buildTargetDictionary(target,
|
|
1126
|
+
addToSet(deps, await buildTargetDictionary(target, compileOptions, buildOptions), await compressDictionaryFileIfNeeded(buildOptions), await genBTrieForTarget(target, buildOptions));
|
|
1158
1127
|
logWithTimestamp(`Done compile: ${target.name}`);
|
|
1159
1128
|
const checksumRoot = buildOptions.checksumRoot;
|
|
1160
1129
|
return [...deps].map((d) => path.relative(checksumRoot, d));
|
|
@@ -1178,7 +1147,7 @@ function genBuildTargetDictionaryOptions(target, compileOptions) {
|
|
|
1178
1147
|
checksumRoot: checksumFile && path.dirname(checksumFile) || rootDir
|
|
1179
1148
|
};
|
|
1180
1149
|
}
|
|
1181
|
-
async function buildTargetDictionary(target,
|
|
1150
|
+
async function buildTargetDictionary(target, compileOptions, buildOptions) {
|
|
1182
1151
|
const { rootDir, checksumFile, conditional } = compileOptions;
|
|
1183
1152
|
const { format, sources, trieBase, sort = true, generateNonStrict = false, excludeWordsFrom = [], excludeWordsNotFoundIn = [], excludeWordsMatchingRegex, replacements } = target;
|
|
1184
1153
|
const { filename, useTrie, generateOnlyCompressedDictionary, checksumRoot } = buildOptions;
|
|
@@ -1192,7 +1161,7 @@ async function buildTargetDictionary(target, options, compileOptions, buildOptio
|
|
|
1192
1161
|
return excludeFromFilter(word) && includeFromFilter(word) && excludeRegexFilter(word);
|
|
1193
1162
|
};
|
|
1194
1163
|
const compress = generateOnlyCompressedDictionary;
|
|
1195
|
-
const filesToProcessAsync = pipeAsync(readSourceList(sources, rootDir), opMapAsync((src) => readFileSource(src,
|
|
1164
|
+
const filesToProcessAsync = pipeAsync(readSourceList(sources, rootDir), opMapAsync((src) => readFileSource(src, locale)), opAwaitAsync());
|
|
1196
1165
|
const filesToProcess = await toArray(filesToProcessAsync);
|
|
1197
1166
|
const normalizer = normalizeTargetWords({
|
|
1198
1167
|
sort: useTrie || sort,
|
|
@@ -1314,15 +1283,14 @@ function readSourceList(sources, rootDir) {
|
|
|
1314
1283
|
async function readFileList(fileList) {
|
|
1315
1284
|
return (await readTextFile(fileList)).split("\n").map((a) => a.trim()).filter((a) => !!a);
|
|
1316
1285
|
}
|
|
1317
|
-
async function readFileSource(fileSource,
|
|
1318
|
-
const { filename,
|
|
1286
|
+
async function readFileSource(fileSource, locale) {
|
|
1287
|
+
const { filename, split = false, maxDepth, storeSplitWordsAsCompounds, minCompoundLength } = fileSource;
|
|
1319
1288
|
const legacy = split === "legacy";
|
|
1320
1289
|
const readerOptions = {
|
|
1321
1290
|
maxDepth,
|
|
1322
1291
|
legacy,
|
|
1323
1292
|
splitWords: legacy ? false : split,
|
|
1324
|
-
|
|
1325
|
-
allowedSplitWords: await createAllowedSplitWordsFromFiles(fileSource.allowedSplitWords || sourceOptions.allowedSplitWords, locale),
|
|
1293
|
+
allowedSplitWords: await createAllowedSplitWordsFromFiles(fileSource.allowedSplitWords, locale),
|
|
1326
1294
|
storeSplitWordsAsCompounds,
|
|
1327
1295
|
minCompoundLength,
|
|
1328
1296
|
locale
|
|
@@ -1402,8 +1370,7 @@ function iterableToString(iter) {
|
|
|
1402
1370
|
function addToSet(set, ...sources) {
|
|
1403
1371
|
for (const items of sources) for (const item of items) set.add(item);
|
|
1404
1372
|
}
|
|
1405
|
-
|
|
1406
|
-
//#region src/build.ts
|
|
1373
|
+
// src/build.ts
|
|
1407
1374
|
const moduleName = "cspell-tools";
|
|
1408
1375
|
const searchPlaces = [
|
|
1409
1376
|
`${moduleName}.config.json`,
|
|
@@ -1435,14 +1402,13 @@ async function build(targets, options) {
|
|
|
1435
1402
|
});
|
|
1436
1403
|
}
|
|
1437
1404
|
function normalizeRequest(buildInfo, root) {
|
|
1438
|
-
const { rootDir = root, targets = [],
|
|
1405
|
+
const { rootDir = root, targets = [], ...rest } = buildInfo;
|
|
1439
1406
|
return {
|
|
1407
|
+
...rest,
|
|
1440
1408
|
rootDir: path.resolve(rootDir),
|
|
1441
|
-
targets
|
|
1442
|
-
checksumFile
|
|
1409
|
+
targets
|
|
1443
1410
|
};
|
|
1444
1411
|
}
|
|
1445
|
-
//#endregion
|
|
1446
1412
|
export { reportCheckChecksumFile as a, toError as c, logWithTimestamp as i, generateBTrie as l, compile as n, reportChecksumForFiles as o, setLogger as r, updateChecksumForFiles as s, build as t, compressFile as u };
|
|
1447
1413
|
|
|
1448
|
-
//# sourceMappingURL=build-
|
|
1414
|
+
//# sourceMappingURL=build-CkIhBjXk.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/config/config.d.ts
|
|
2
1
|
interface BTrieOptions {
|
|
3
2
|
/** compress the resulting file */
|
|
4
3
|
compress?: boolean | undefined;
|
|
@@ -7,21 +6,13 @@ interface BTrieOptions {
|
|
|
7
6
|
/** use a string table to reduce size */
|
|
8
7
|
useStringTable?: boolean | undefined;
|
|
9
8
|
}
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/compiler/logger.d.ts
|
|
12
9
|
type Logger = (message?: any, ...optionalParams: any[]) => void;
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/compiler/bTrie.d.ts
|
|
15
10
|
interface GenerateBTrieOptions extends BTrieOptions {
|
|
16
11
|
/** output directory */
|
|
17
12
|
output?: string;
|
|
18
13
|
logger?: Logger;
|
|
19
14
|
}
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/bTrie.d.ts
|
|
22
15
|
export declare function generateBTrie(files: string[], options: GenerateBTrieOptions): Promise<void>;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/build.d.ts
|
|
25
16
|
interface BuildOptions {
|
|
26
17
|
/** Optional path to config file */
|
|
27
18
|
config?: string | undefined;
|
|
@@ -33,6 +24,5 @@ interface BuildOptions {
|
|
|
33
24
|
conditional?: boolean;
|
|
34
25
|
}
|
|
35
26
|
export declare function build(targets: string[] | undefined, options: BuildOptions): Promise<void>;
|
|
36
|
-
//#endregion
|
|
37
27
|
export {};
|
|
38
28
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as build, l as generateBTrie } from "./build-
|
|
1
|
+
export { t as build, l as generateBTrie } from "./build-CkIhBjXk.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cspell/cspell-tools",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"description": "Tools to assist with the development of cSpell",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -65,12 +65,11 @@
|
|
|
65
65
|
"watch": "tsdown -w"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@cspell/cspell-pipe": "10.4.
|
|
68
|
+
"@cspell/cspell-pipe": "10.4.1",
|
|
69
69
|
"commander": "^15.0.0",
|
|
70
70
|
"cosmiconfig": "10.0.1",
|
|
71
|
-
"cspell-trie-lib": "10.4.
|
|
72
|
-
"
|
|
73
|
-
"hunspell-reader": "10.4.0",
|
|
71
|
+
"cspell-trie-lib": "10.4.1",
|
|
72
|
+
"hunspell-reader": "10.4.1",
|
|
74
73
|
"yaml": "^2.9.1"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
@@ -80,5 +79,5 @@
|
|
|
80
79
|
"engines": {
|
|
81
80
|
"node": ">=22.18.0"
|
|
82
81
|
},
|
|
83
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "ddb1699a4bfc2766675c2c97412a813d775772eb"
|
|
84
83
|
}
|