cspell-lib 6.24.0 → 6.25.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.
@@ -233,6 +233,7 @@ exports.languageExtensionDefinitions = [
233
233
  { id: 'jar', extensions: ['.jar'], format: 'Binary' },
234
234
  { id: 'spv', extensions: ['.spv'], format: 'Binary', description: 'SPSS Output Document' },
235
235
  { id: 'mdb', extensions: ['.mdb'], format: 'Binary', description: 'Microsoft Access DB' },
236
+ { id: 'webm', extensions: ['.webm'], format: 'Binary', description: 'WebM is an audiovisual media file format.' },
236
237
  ];
237
238
  const binaryFormatIds = exports.languageExtensionDefinitions.filter((d) => d.format === 'Binary').map((d) => d.id);
238
239
  exports.binaryLanguages = new Set(['binary', 'image', 'video', 'fonts'].concat(binaryFormatIds));
@@ -32,6 +32,7 @@ export interface DictionaryFileDefinitionInternalWithSource extends DictionaryFi
32
32
  export type DictionaryDefinitionInternalWithSource = DictionaryDefinitionInternal & {
33
33
  readonly __source: string;
34
34
  };
35
+ export declare function cleanCSpellSettingsInternal(parts?: OptionalOrUndefined<Partial<CSpellSettingsInternal>>): CSpellSettingsInternal;
35
36
  export declare function createCSpellSettingsInternal(parts?: OptionalOrUndefined<Partial<CSpellSettingsInternal>>): CSpellSettingsInternal;
36
37
  export declare function isCSpellSettingsInternal(cs: CSpellSettingsInternal | CSpellSettingsWithSourceTrace | OptionalOrUndefined<CSpellSettingsInternal | CSpellSettingsWithSourceTrace>): cs is CSpellSettingsInternal;
37
38
  export declare function isDictionaryDefinitionInlineInternal(def: DictionaryDefinitionInternal | DictionaryDefinitionInline | DictionaryDefinition): def is DictionaryDefinitionInlineInternal;
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDictionaryDefinitionInlineInternal = exports.isCSpellSettingsInternal = exports.createCSpellSettingsInternal = exports.SymbolCSpellSettingsInternal = void 0;
3
+ exports.isDictionaryDefinitionInlineInternal = exports.isCSpellSettingsInternal = exports.createCSpellSettingsInternal = exports.cleanCSpellSettingsInternal = exports.SymbolCSpellSettingsInternal = void 0;
4
4
  const util_1 = require("../util/util");
5
5
  exports.SymbolCSpellSettingsInternal = Symbol('CSpellSettingsInternal');
6
+ function cleanCSpellSettingsInternal(parts = {}) {
7
+ const csi = (0, util_1.clean)(parts);
8
+ Object.assign(csi, { [exports.SymbolCSpellSettingsInternal]: true });
9
+ return csi;
10
+ }
11
+ exports.cleanCSpellSettingsInternal = cleanCSpellSettingsInternal;
6
12
  function createCSpellSettingsInternal(parts = {}) {
7
13
  return (0, util_1.clean)({
8
14
  ...parts,
@@ -18,7 +24,7 @@ function isDictionaryDefinitionInlineInternal(def) {
18
24
  if (def.path)
19
25
  return false;
20
26
  const defInline = def;
21
- return !!(defInline.words || defInline.flagWords || defInline.ignoreWords);
27
+ return !!(defInline.words || defInline.flagWords || defInline.ignoreWords || defInline.suggestWords);
22
28
  }
23
29
  exports.isDictionaryDefinitionInlineInternal = isDictionaryDefinitionInlineInternal;
24
30
  //# sourceMappingURL=CSpellSettingsInternalDef.js.map
@@ -63,6 +63,11 @@ function mergeList(left, right) {
63
63
  }
64
64
  const emptyWords = [];
65
65
  Object.freeze(emptyWords);
66
+ const cachedMerges = new WeakMap();
67
+ function _mergeWordsCached(left, right) {
68
+ const map = (0, AutoResolve_1.autoResolveWeak)(cachedMerges, left, () => new WeakMap());
69
+ return (0, AutoResolve_1.autoResolveWeak)(map, right, () => left.concat(right));
70
+ }
66
71
  function mergeWordsCached(left, right) {
67
72
  if (left === undefined)
68
73
  return !right || right.length ? right : emptyWords;
@@ -72,7 +77,7 @@ function mergeWordsCached(left, right) {
72
77
  return !right || right.length ? right : emptyWords;
73
78
  if (!right.length)
74
79
  return !left || left.length ? left : emptyWords;
75
- return left.concat(right);
80
+ return _mergeWordsCached(left, right);
76
81
  }
77
82
  function mergeObjects(left, right) {
78
83
  if (left === undefined)
@@ -120,7 +125,7 @@ function merge(left, right) {
120
125
  const includeRegExpList = takeRightOtherwiseLeft(_left.includeRegExpList, _right.includeRegExpList);
121
126
  const optionals = includeRegExpList?.length ? { includeRegExpList } : {};
122
127
  const version = max(_left.version, _right.version);
123
- const settings = (0, CSpellSettingsInternalDef_1.createCSpellSettingsInternal)({
128
+ const settings = (0, CSpellSettingsInternalDef_1.cleanCSpellSettingsInternal)({
124
129
  ..._left,
125
130
  ..._right,
126
131
  ...optionals,
@@ -131,6 +136,7 @@ function merge(left, right) {
131
136
  userWords: mergeWordsCached(_left.userWords, _right.userWords),
132
137
  flagWords: mergeWordsCached(_left.flagWords, _right.flagWords),
133
138
  ignoreWords: mergeWordsCached(_left.ignoreWords, _right.ignoreWords),
139
+ suggestWords: mergeWordsCached(_left.suggestWords, _right.suggestWords),
134
140
  enabledLanguageIds: replaceIfNotEmpty(_left.enabledLanguageIds, _right.enabledLanguageIds),
135
141
  enableFiletypes: mergeList(_left.enableFiletypes, _right.enableFiletypes),
136
142
  ignoreRegExpList: mergeListUnique(_left.ignoreRegExpList, _right.ignoreRegExpList),
@@ -240,7 +246,7 @@ function toInternalSettings(settings) {
240
246
  const { dictionaryDefinitions: defs, ...rest } = settings;
241
247
  const dictionaryDefinitions = (0, DictionarySettings_1.mapDictDefsToInternal)(defs, filenameToDirectory(settings.source?.filename) || resolveCwd());
242
248
  const setting = dictionaryDefinitions ? { ...rest, dictionaryDefinitions } : rest;
243
- return (0, CSpellSettingsInternalDef_1.createCSpellSettingsInternal)(setting);
249
+ return (0, CSpellSettingsInternalDef_1.cleanCSpellSettingsInternal)(setting);
244
250
  }
245
251
  exports.toInternalSettings = toInternalSettings;
246
252
  function filenameToDirectory(filename) {
@@ -26,6 +26,7 @@ export declare function normalizeDictionaryDefs(settings: NormalizeDictionaryDef
26
26
  words?: string[];
27
27
  flagWords?: string[];
28
28
  ignoreWords?: string[];
29
+ suggestWords?: string[];
29
30
  parser?: string;
30
31
  }>[] | undefined;
31
32
  }>;
@@ -29,7 +29,7 @@ function getDictionaryInternalSync(settings) {
29
29
  }
30
30
  exports.getDictionaryInternalSync = getDictionaryInternalSync;
31
31
  function _getDictionaryInternal(settings, spellDictionaries) {
32
- const { words = emptyWords, userWords = emptyWords, flagWords = emptyWords, ignoreWords = emptyWords } = settings;
32
+ const { words = emptyWords, userWords = emptyWords, flagWords = emptyWords, ignoreWords = emptyWords, suggestWords = emptyWords, } = settings;
33
33
  const settingsWordsDictionary = (0, cspell_dictionary_1.createSpellingDictionary)(words, '[words]', 'From Settings `words`', {
34
34
  caseSensitive: true,
35
35
  weightMap: undefined,
@@ -42,12 +42,14 @@ function _getDictionaryInternal(settings, spellDictionaries) {
42
42
  : undefined;
43
43
  const ignoreWordsDictionary = (0, cspell_dictionary_1.createIgnoreWordsDictionary)(ignoreWords, '[ignoreWords]', 'From Settings `ignoreWords`');
44
44
  const flagWordsDictionary = (0, cspell_dictionary_1.createForbiddenWordsDictionary)(flagWords, '[flagWords]', 'From Settings `flagWords`');
45
+ const suggestWordsDictionary = (0, cspell_dictionary_1.createSuggestDictionary)(suggestWords, '[suggestWords]', 'From Settings `suggestWords`');
45
46
  const dictionaries = [
46
47
  ...spellDictionaries,
47
48
  settingsWordsDictionary,
48
49
  settingsUserWordsDictionary,
49
50
  ignoreWordsDictionary,
50
51
  flagWordsDictionary,
52
+ suggestWordsDictionary,
51
53
  ].filter(util_1.isDefined);
52
54
  return (0, cspell_dictionary_1.createCollection)(dictionaries, 'dictionary collection');
53
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "6.24.0",
3
+ "version": "6.25.0",
4
4
  "description": "A library of useful functions used across various cspell tools.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -48,19 +48,19 @@
48
48
  },
49
49
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
50
50
  "dependencies": {
51
- "@cspell/cspell-bundled-dicts": "6.24.0",
52
- "@cspell/cspell-pipe": "6.24.0",
53
- "@cspell/cspell-types": "6.24.0",
54
- "@cspell/strong-weak-map": "6.24.0",
51
+ "@cspell/cspell-bundled-dicts": "6.25.0",
52
+ "@cspell/cspell-pipe": "6.25.0",
53
+ "@cspell/cspell-types": "6.25.0",
54
+ "@cspell/strong-weak-map": "6.25.0",
55
55
  "clear-module": "^4.1.2",
56
56
  "comment-json": "^4.2.3",
57
57
  "configstore": "^5.0.1",
58
58
  "cosmiconfig": "^8.0.0",
59
- "cspell-dictionary": "6.24.0",
60
- "cspell-glob": "6.24.0",
61
- "cspell-grammar": "6.24.0",
62
- "cspell-io": "6.24.0",
63
- "cspell-trie-lib": "6.24.0",
59
+ "cspell-dictionary": "6.25.0",
60
+ "cspell-glob": "6.25.0",
61
+ "cspell-grammar": "6.25.0",
62
+ "cspell-io": "6.25.0",
63
+ "cspell-trie-lib": "6.25.0",
64
64
  "fast-equals": "^4.0.3",
65
65
  "find-up": "^5.0.0",
66
66
  "gensequence": "^4.0.3",
@@ -89,8 +89,8 @@
89
89
  "jest": "^29.4.2",
90
90
  "lorem-ipsum": "^2.0.8",
91
91
  "rollup": "^3.15.0",
92
- "rollup-plugin-dts": "^5.1.1",
92
+ "rollup-plugin-dts": "^5.2.0",
93
93
  "ts-jest": "^29.0.5"
94
94
  },
95
- "gitHead": "0d1e8bf9426cd0bfb814df4f61da12d8aee57ddd"
95
+ "gitHead": "fd7541605e07c43887191097d58ab58d87fac8fd"
96
96
  }