@cspell/cspell-tools 7.1.1 → 7.3.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/compile.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { CompileCommonAppOptions } from './AppOptions.js';
2
2
  import type { FeatureFlags } from './FeatureFlags/index.js';
3
- export declare const configFileHeader: string;
3
+ export declare const configFileHeader = "# yaml-language-server: $schema=https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-tools/cspell-tools.config.schema.json\n\n";
4
4
  export declare function processCompileAction(src: string[], options: CompileCommonAppOptions, featureFlags: FeatureFlags | undefined): Promise<void>;
5
5
  //# sourceMappingURL=compile.d.ts.map
@@ -4,7 +4,7 @@ export async function createSourceReader(filename, options) {
4
4
  const reader = await createReader(filename, options);
5
5
  if (reader.type !== 'TextFile') {
6
6
  return {
7
- words: reader.lines,
7
+ words: splitLines(reader.lines, options),
8
8
  get size() {
9
9
  return reader.size;
10
10
  },
@@ -12,6 +12,18 @@ export async function createSourceReader(filename, options) {
12
12
  }
13
13
  return textFileReader(reader, options);
14
14
  }
15
+ function splitLines(lines, options) {
16
+ if (!options.splitWords)
17
+ return lines;
18
+ function* split() {
19
+ const regNonWordOrDigit = /[^\p{L}\p{M}'\w-]+/giu;
20
+ for (const line of lines) {
21
+ const words = line.split(regNonWordOrDigit);
22
+ yield* words;
23
+ }
24
+ }
25
+ return split();
26
+ }
15
27
  async function textFileReader(reader, options) {
16
28
  const { legacy, splitWords: split, allowedSplitWords } = options;
17
29
  const words = [...parseFileLines(reader, { legacy, split, allowedSplitWords })];
@@ -13,7 +13,16 @@ export interface TestHelper {
13
13
  */
14
14
  resolveTemp(...parts: string[]): string;
15
15
  createTempDir(...parts: string[]): void;
16
+ /**
17
+ * Resolves a fixture path to an absolute path
18
+ * @param parts - relative path to fixture
19
+ */
16
20
  resolveFixture(...parts: string[]): string;
21
+ /**
22
+ * Resolves a path to an absolute path in Samples
23
+ * @param parts - relative path to sample
24
+ */
25
+ resolveSample(...parts: string[]): string;
17
26
  /**
18
27
  * Make the temp directory
19
28
  * @param parts
@@ -8,6 +8,7 @@ const _dirname = test_dirname(import.meta.url);
8
8
  const packageRoot = path.join(_dirname, '../..');
9
9
  const repoRoot = path.join(packageRoot, '../..');
10
10
  const tempDirBase = path.join(packageRoot, 'temp');
11
+ const repoSamples = path.join(repoRoot, 'packages/Samples');
11
12
  export function createTestHelper(testFilenameUrl) {
12
13
  testFilenameUrl && assert(testFilenameUrl.startsWith('file:'));
13
14
  const testFilename = testFilenameUrl && test_filename(testFilenameUrl);
@@ -76,6 +77,9 @@ class TestHelperImpl {
76
77
  resolveFixture(...parts) {
77
78
  return path.resolve(this.fixtureDir, ...parts);
78
79
  }
80
+ resolveSample(...parts) {
81
+ return path.resolve(repoSamples, ...parts);
82
+ }
79
83
  /**
80
84
  * calc a path relative to the package temp directory.
81
85
  * @param parts - optional path segments
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@cspell/cspell-tools",
3
- "version": "7.1.1",
3
+ "version": "7.3.0",
4
4
  "description": "Tools to assist with the development of cSpell",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "type": "module",
9
9
  "bin": {
10
- "cspell-tools-cli": "bin.js"
10
+ "cspell-tools-cli": "bin.mjs"
11
11
  },
12
12
  "scripts": {
13
13
  "build": "pnpm run build-schema && pnpm run compile",
@@ -32,7 +32,7 @@
32
32
  "Compiler"
33
33
  ],
34
34
  "files": [
35
- "bin.js",
35
+ "bin.mjs",
36
36
  "dist",
37
37
  "cspell-tools.config.schema.json",
38
38
  "!**/*.tsbuildInfo",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
50
50
  "dependencies": {
51
- "@cspell/cspell-pipe": "7.1.1",
51
+ "@cspell/cspell-pipe": "7.3.0",
52
52
  "commander": "^11.0.0",
53
53
  "cosmiconfig": "8.0.0",
54
- "cspell-trie-lib": "7.1.1",
54
+ "cspell-trie-lib": "7.3.0",
55
55
  "gensequence": "^5.0.2",
56
- "glob": "^10.3.3",
57
- "hunspell-reader": "7.1.1",
58
- "yaml": "^2.3.1"
56
+ "glob": "^10.3.4",
57
+ "hunspell-reader": "7.3.0",
58
+ "yaml": "^2.3.2"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=16"
@@ -67,6 +67,6 @@
67
67
  "shelljs": "^0.8.5",
68
68
  "ts-json-schema-generator": "^1.3.0"
69
69
  },
70
- "main": "bin.js",
71
- "gitHead": "2dafa5386c58637614034c7a6d0fa13c03b16e41"
70
+ "module": "bin.mjs",
71
+ "gitHead": "4a16b099b64c5b55645529a4ae79bc32aaf0fc8e"
72
72
  }
File without changes