New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cspell-lib

Package Overview
Dependencies
Maintainers
1
Versions
367
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cspell-lib - npm Package Compare versions

Comparing version 8.1.1 to 8.1.2

2

dist/esm/index.d.ts

@@ -11,3 +11,3 @@ import * as ExclusionHelper from './exclusionHelper.js';

export { createTextDocument, updateTextDocument } from './Models/TextDocument.js';
export { calcOverrideSettings, checkFilenameMatchesGlob, type ConfigurationDependencies, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, type ImportFileRefWithError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
export { calcOverrideSettings, checkFilenameMatchesGlob, type ConfigurationDependencies, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, type ImportFileRefWithError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
export { defaultFileName as defaultSettingsFilename } from './Settings/index.js';

@@ -14,0 +14,0 @@ export { combineTextAndLanguageSettings, combineTextAndLanguageSettings as constructSettingsForText, } from './Settings/TextDocumentSettings.js';

@@ -8,3 +8,3 @@ import * as ExclusionHelper from './exclusionHelper.js';

export { createTextDocument, updateTextDocument } from './Models/TextDocument.js';
export { calcOverrideSettings, checkFilenameMatchesGlob, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
export { calcOverrideSettings, checkFilenameMatchesGlob, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
export { defaultFileName as defaultSettingsFilename } from './Settings/index.js';

@@ -11,0 +11,0 @@ export { combineTextAndLanguageSettings, combineTextAndLanguageSettings as constructSettingsForText, } from './Settings/TextDocumentSettings.js';

@@ -34,3 +34,42 @@ import type { CSpellUserSettings, ImportFileRef } from '@cspell/cspell-types';

}
export declare class ConfigLoader {
export interface IConfigLoader {
readSettingsAsync(filename: string | URL, relativeTo?: string | URL, pnpSettings?: PnPSettingsOptional): Promise<CSpellSettingsI>;
/**
* Read a cspell configuration file.
* @param filenameOrURL - URL, relative path, absolute path, or package name.
* @param relativeTo - optional URL, defaults to `pathToFileURL('./')`
*/
readConfigFile(filenameOrURL: string | URL, relativeTo?: string | URL): Promise<CSpellConfigFile | Error>;
searchForConfigFileLocation(searchFrom: URL | string | undefined): Promise<URL | undefined>;
searchForConfigFile(searchFrom: URL | string | undefined): Promise<CSpellConfigFile | undefined>;
/**
* This is an alias for `searchForConfigFile` and `mergeConfigFileWithImports`.
* @param searchFrom the directory / file URL to start searching from.
* @param pnpSettings - related to Using Yarn PNP.
* @returns the resulting settings
*/
searchForConfig(searchFrom: URL | string | undefined, pnpSettings?: PnPSettingsOptional): Promise<CSpellSettingsI | undefined>;
getGlobalSettingsAsync(): Promise<CSpellSettingsI>;
/**
* The loader caches configuration files for performance. This method clears the cache.
*/
clearCachedSettingsFiles(): void;
/**
* Resolve imports and merge.
* @param cfgFile - configuration file.
* @param pnpSettings - optional settings related to Using Yarn PNP.
*/
mergeConfigFileWithImports(cfgFile: CSpellConfigFile, pnpSettings?: PnPSettingsOptional | undefined): Promise<CSpellSettingsI>;
/**
* Create an in memory CSpellConfigFile.
* @param filename - URL to the file. Used to resolve imports.
* @param settings - settings to use.
*/
createCSpellConfigFile(filename: URL | string, settings: CSpellUserSettings): CSpellConfigFile;
/**
* Unsubscribe from any events and dispose of any resources including caches.
*/
dispose(): void;
}
export declare class ConfigLoader implements IConfigLoader {
readonly cspellIO: CSpellIO;

@@ -68,2 +107,3 @@ onReady: Promise<void>;

clearCachedSettingsFiles(): void;
protected prefetchGlobalSettingsAsync(): Promise<void>;
protected importSettings(fileRef: ImportFileRef, pnpSettings: PnPSettingsOptional | undefined, backReferences: string[]): ImportedConfigEntry;

@@ -88,3 +128,3 @@ private setupPnp;

declare function validateRawConfigVersion(config: CSpellConfigFile): void;
export declare function createConfigLoader(cspellIO?: CSpellIO): ConfigLoader;
export declare function createConfigLoader(cspellIO?: CSpellIO): IConfigLoader;
export declare function getDefaultConfigLoaderInternal(): ConfigLoaderInternal;

@@ -91,0 +131,0 @@ export declare const __testing__: {

@@ -5,3 +5,3 @@ import assert from 'assert';

import * as path from 'path';
import { fileURLToPath } from 'url';
import { fileURLToPath, pathToFileURL } from 'url';
import { onClearCache } from '../../../events/index.js';

@@ -39,3 +39,3 @@ import { createCSpellSettingsInternal as csi } from '../../../Models/CSpellSettingsInternalDef.js';

this.cspellConfigFileReaderWriter = createReaderWriter(undefined, undefined, createIO(cspellIO));
this.onReady = this.getGlobalSettingsAsync().then(() => undefined, (e) => logError(e));
this.onReady = this.prefetchGlobalSettingsAsync();
this.subscribeToEvents();

@@ -55,3 +55,4 @@ }

async readSettingsAsync(filename, relativeTo, pnpSettings) {
const ref = resolveFilename(filename, relativeTo || process.cwd());
await this.onReady;
const ref = resolveFilename(filename, relativeTo || pathToFileURL('./'));
const entry = this.importSettings(ref, pnpSettings || defaultPnPSettings, []);

@@ -61,3 +62,3 @@ return entry.onReady;

async readConfigFile(filenameOrURL, relativeTo) {
const ref = resolveFilename(filenameOrURL.toString(), relativeTo || process.cwd());
const ref = resolveFilename(filenameOrURL.toString(), relativeTo || pathToFileURL('./'));
const url = this.cspellIO.toFileURL(ref.filename);

@@ -110,3 +111,3 @@ const href = url.href;

getGlobalSettings() {
assert(this.globalSettings);
assert(this.globalSettings, 'Global settings not loaded');
return this.globalSettings;

@@ -131,3 +132,8 @@ }

this.cachedMergedConfig = new WeakMap();
this.prefetchGlobalSettingsAsync();
}
prefetchGlobalSettingsAsync() {
this.onReady = this.getGlobalSettingsAsync().then(() => undefined, (e) => logError(e));
return this.onReady;
}
importSettings(fileRef, pnpSettings, backReferences) {

@@ -134,0 +140,0 @@ const url = this.cspellIO.toFileURL(fileRef.filename);

import type { CSpellConfigFile } from 'cspell-config-lib';
import type { ConfigLoader } from './configLoader.js';
import type { IConfigLoader } from './configLoader.js';
import type { PnPSettingsOptional } from './PnPSettings.js';

@@ -32,4 +32,4 @@ import type { CSpellSettingsI, CSpellSettingsWST } from './types.js';

export declare function clearCachedSettingsFiles(): void;
export declare function getDefaultConfigLoader(): ConfigLoader;
export declare function getDefaultConfigLoader(): IConfigLoader;
export declare function readRawSettings(filename: string | URL, relativeTo?: string | URL): Promise<CSpellSettingsWST>;
//# sourceMappingURL=defaultConfigLoader.d.ts.map
export { __testing__, ConfigLoader, createConfigLoader, defaultFileName, loadPnP, sectionCSpell, } from './configLoader.js';
export { defaultConfigFilenames } from './configLocations.js';
export { clearCachedSettingsFiles, getCachedFileSize, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readRawSettings, searchForConfig, } from './defaultConfigLoader.js';
export { clearCachedSettingsFiles, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readRawSettings, searchForConfig, } from './defaultConfigLoader.js';
export { extractImportErrors, ImportFileRefWithError } from './extractImportErrors.js';

@@ -5,0 +5,0 @@ export { readSettings } from './readSettings.js';

export { __testing__, ConfigLoader, createConfigLoader, defaultFileName, loadPnP, sectionCSpell, } from './configLoader.js';
export { defaultConfigFilenames } from './configLocations.js';
export { clearCachedSettingsFiles, getCachedFileSize, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readRawSettings, searchForConfig, } from './defaultConfigLoader.js';
export { clearCachedSettingsFiles, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readRawSettings, searchForConfig, } from './defaultConfigLoader.js';
export { extractImportErrors } from './extractImportErrors.js';

@@ -5,0 +5,0 @@ export { readSettings } from './readSettings.js';

import { getDefaultConfigLoader } from './defaultConfigLoader.js';
export async function readSettings(filename, relativeToOrPnP, pnpSettings) {
const loader = getDefaultConfigLoader();
await loader.onReady;
const relativeTo = typeof relativeToOrPnP === 'string' || relativeToOrPnP instanceof URL ? relativeToOrPnP : undefined;

@@ -6,0 +5,0 @@ const pnp = pnpSettings

export { calcOverrideSettings } from './calcOverrideSettings.js';
export { checkFilenameMatchesGlob } from './checkFilenameMatchesGlob.js';
export { currentSettingsFileVersion, ENV_CSPELL_GLOB_ROOT } from './constants.js';
export { clearCachedSettingsFiles, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
export { clearCachedSettingsFiles, createConfigLoader, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
export { ImportError } from './Controller/ImportError.js';

@@ -6,0 +6,0 @@ export type { ConfigurationDependencies, ImportFileRefWithError } from './CSpellSettingsServer.js';

export { calcOverrideSettings } from './calcOverrideSettings.js';
export { checkFilenameMatchesGlob } from './checkFilenameMatchesGlob.js';
export { currentSettingsFileVersion, ENV_CSPELL_GLOB_ROOT } from './constants.js';
export { clearCachedSettingsFiles, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
export { clearCachedSettingsFiles, createConfigLoader, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
export { ImportError } from './Controller/ImportError.js';

@@ -6,0 +6,0 @@ export { extractDependencies, finalizeSettings, getSources, mergeInDocSettings, mergeSettings, } from './CSpellSettingsServer.js';

@@ -18,4 +18,3 @@ import path from 'path';

export function getSourceDirectoryUrl() {
const base = pathToFileURL(srcDirectory);
const srcDirectoryURL = new URL(base.pathname + '/', base);
const srcDirectoryURL = pathToFileURL(path.join(srcDirectory, '/'));
return srcDirectoryURL;

@@ -32,3 +31,3 @@ }

export function cwdURL() {
return pathToFileURL(process.cwd() + '/');
return pathToFileURL('./');
}

@@ -35,0 +34,0 @@ export function resolveFileWithURL(file, relativeToURL) {

{
"name": "cspell-lib",
"version": "8.1.1",
"version": "8.1.2",
"description": "A library of useful functions used across various cspell tools.",

@@ -60,17 +60,17 @@ "type": "module",

"dependencies": {
"@cspell/cspell-bundled-dicts": "8.1.1",
"@cspell/cspell-pipe": "8.1.1",
"@cspell/cspell-resolver": "8.1.1",
"@cspell/cspell-types": "8.1.1",
"@cspell/dynamic-import": "8.1.1",
"@cspell/strong-weak-map": "8.1.1",
"@cspell/cspell-bundled-dicts": "8.1.2",
"@cspell/cspell-pipe": "8.1.2",
"@cspell/cspell-resolver": "8.1.2",
"@cspell/cspell-types": "8.1.2",
"@cspell/dynamic-import": "8.1.2",
"@cspell/strong-weak-map": "8.1.2",
"clear-module": "^4.1.2",
"comment-json": "^4.2.3",
"configstore": "^6.0.0",
"cspell-config-lib": "8.1.1",
"cspell-dictionary": "8.1.1",
"cspell-glob": "8.1.1",
"cspell-grammar": "8.1.1",
"cspell-io": "8.1.1",
"cspell-trie-lib": "8.1.1",
"cspell-config-lib": "8.1.2",
"cspell-dictionary": "8.1.2",
"cspell-glob": "8.1.2",
"cspell-grammar": "8.1.2",
"cspell-io": "8.1.2",
"cspell-trie-lib": "8.1.2",
"fast-equals": "^5.0.1",

@@ -99,3 +99,3 @@ "gensequence": "^6.0.0",

},
"gitHead": "b0ac8d928b7e15fb1eb3d5b89374db1aa0ccc1f5"
"gitHead": "ba4eef94480562e7641298b32cb99723fd64aeca"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc