@cspell/cspell-tools 7.0.1-alpha.2 → 7.0.1-alpha.4

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.js CHANGED
@@ -5,7 +5,7 @@ import { build } from './build.js';
5
5
  import { processCompileAction } from './compile.js';
6
6
  import * as compiler from './compiler/index.js';
7
7
  import { logWithTimestamp } from './compiler/logWithTimestamp.js';
8
- import { compressFile } from './gzip/index.js';
8
+ import { gzip } from './gzip/index.js';
9
9
  import { reportCheckChecksumFile, reportChecksumForFiles } from './shasum/shasum.js';
10
10
  import { toError } from './util/errors.js';
11
11
  const npmPackageRaw = readFileSync(new URL('../package.json', import.meta.url), 'utf8');
@@ -30,15 +30,13 @@ function addCompileOptions(compileCommand) {
30
30
  .option('--trie-base <number>', 'Advanced: Set the trie base number. A value between 10 and 36');
31
31
  }
32
32
  export async function run(program, argv, flags) {
33
- async function gzip(files) {
34
- for (const fileName of files) {
35
- try {
36
- await compressFile(fileName);
37
- }
38
- catch (error) {
39
- const err = toError(error);
40
- program.error(err.message);
41
- }
33
+ async function handleGzip(files) {
34
+ try {
35
+ await gzip(files);
36
+ }
37
+ catch (error) {
38
+ const err = toError(error);
39
+ program.error(err.message);
42
40
  }
43
41
  }
44
42
  async function shasum(files, options) {
@@ -69,7 +67,7 @@ export async function run(program, argv, flags) {
69
67
  .option('-c, --config <path to run configuration>', 'Specify the run configuration file.')
70
68
  .option('-r, --root <directory>', 'Specify the run directory')
71
69
  .action(build);
72
- program.command('gzip <files...>').description('GZip files while keeping the original.').action(gzip);
70
+ program.command('gzip <files...>').description('GZip files while keeping the original.').action(handleGzip);
73
71
  program
74
72
  .command('shasum [files...]')
75
73
  .description('Calculate the checksum for files.')
package/dist/build.js CHANGED
@@ -12,7 +12,7 @@ const searchPlaces = [
12
12
  export async function build(targets, options) {
13
13
  const allowedTargets = new Set(targets || []);
14
14
  function filter(target) {
15
- return !targets || allowedTargets.has(target.name);
15
+ return !allowedTargets.size || allowedTargets.has(target.name);
16
16
  }
17
17
  const searchDir = path.resolve(options.root || options.cwd || '.');
18
18
  const explorer = cosmiconfig(moduleName, {
package/dist/compile.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { opConcatMap, pipe } from '@cspell/cspell-pipe/sync';
2
2
  import { compile } from './compiler/compile.js';
3
3
  import { createCompileRequest } from './compiler/createCompileRequest.js';
4
- import { globP } from './compiler/globP.js';
5
4
  import { getSystemFeatureFlags, parseFlags } from './FeatureFlags/index.js';
5
+ import { globP } from './util/globP.js';
6
6
  getSystemFeatureFlags().register('compound', 'Enable compound dictionary sources.');
7
7
  export async function processCompileAction(src, options, featureFlags) {
8
8
  const ff = featureFlags || getSystemFeatureFlags();
@@ -0,0 +1,2 @@
1
+ export declare function gzip(globs: string[]): Promise<void>;
2
+ //# sourceMappingURL=gzip.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { globP } from '../util/globP.js';
2
+ import { compressFile } from './compressFiles.js';
3
+ // cspell:ignore nodir
4
+ export async function gzip(globs) {
5
+ const files = await globP(globs, { nodir: true });
6
+ for (const fileName of files) {
7
+ await compressFile(fileName);
8
+ }
9
+ }
10
+ //# sourceMappingURL=gzip.js.map
@@ -1,2 +1,3 @@
1
1
  export { compressFile } from './compressFiles.js';
2
+ export { gzip } from './gzip.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export { compressFile } from './compressFiles.js';
2
+ export { gzip } from './gzip.js';
2
3
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ interface Options {
2
+ cwd?: string | URL;
3
+ nodir?: boolean;
4
+ }
5
+ export declare function globP(pattern: string | string[], options?: Options): Promise<string[]>;
6
+ export {};
7
+ //# sourceMappingURL=globP.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { glob } from 'glob';
2
+ export function globP(pattern, options) {
3
+ // Convert windows separators.
4
+ const globs = (Array.isArray(pattern) ? pattern : [pattern]).map((pattern) => pattern.replace(/\\/g, '/'));
5
+ return glob(globs, options);
6
+ }
7
+ //# sourceMappingURL=globP.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cspell/cspell-tools",
3
- "version": "7.0.1-alpha.2",
3
+ "version": "7.0.1-alpha.4",
4
4
  "description": "Tools to assist with the development of cSpell",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -50,20 +50,20 @@
50
50
  },
51
51
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
52
52
  "dependencies": {
53
- "@cspell/cspell-pipe": "7.0.1-alpha.2",
54
- "commander": "^10.0.1",
53
+ "@cspell/cspell-pipe": "7.0.1-alpha.4",
54
+ "commander": "^11.0.0",
55
55
  "cosmiconfig": "8.0.0",
56
- "cspell-trie-lib": "7.0.1-alpha.2",
56
+ "cspell-trie-lib": "7.0.1-alpha.4",
57
57
  "gensequence": "^5.0.2",
58
- "glob": "^8.1.0",
59
- "hunspell-reader": "7.0.1-alpha.2"
58
+ "glob": "^10.3.3",
59
+ "hunspell-reader": "7.0.1-alpha.4"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=16"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/glob": "^8.1.0",
66
- "@types/jest": "^29.5.2",
66
+ "@types/jest": "^29.5.3",
67
67
  "@types/shelljs": "^0.8.12",
68
68
  "jest": "^29.6.1",
69
69
  "lorem-ipsum": "^2.0.8",
@@ -71,5 +71,5 @@
71
71
  "ts-json-schema-generator": "^1.2.0"
72
72
  },
73
73
  "main": "bin.js",
74
- "gitHead": "1fecd5ff35dc5c104f504e761fae85a2eefc02a6"
74
+ "gitHead": "8d974b29bb443068fe200dede4636cb0828a5f21"
75
75
  }
@@ -1,2 +0,0 @@
1
- export declare function globP(pattern: string): Promise<string[]>;
2
- //# sourceMappingURL=globP.d.ts.map
@@ -1,9 +0,0 @@
1
- import glob from 'glob';
2
- import { promisify } from 'util';
3
- const pGlob = promisify(glob);
4
- export function globP(pattern) {
5
- // Convert windows separators.
6
- pattern = pattern.replace(/\\/g, '/');
7
- return pGlob(pattern);
8
- }
9
- //# sourceMappingURL=globP.js.map