Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cspell-config-lib

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cspell-config-lib - npm Package Compare versions

Comparing version 8.1.3 to 8.2.0

21

dist/CSpellConfigFile.d.ts

@@ -6,5 +6,22 @@ import type { CSpellSettings } from '@cspell/cspell-types';

export interface ICSpellConfigFile {
/**
* The url of the config file, used to resolve imports.
*/
readonly url: URL;
/**
* The settings from the config file.
*/
readonly settings: CSpellSettings;
readonly readonly?: boolean;
/**
* Indicate that the config file is readonly.
*/
readonly?: boolean;
/**
* Indicate that the config file is virtual and not associated with a file on disk.
*/
virtual?: boolean;
/**
* Indicate that the config file is remote and not associated with a file on disk.
*/
remote?: boolean;
}

@@ -17,2 +34,4 @@ export declare abstract class CSpellConfigFile implements ICSpellConfigFile {

get readonly(): boolean;
get virtual(): boolean;
get remote(): boolean;
}

@@ -19,0 +38,0 @@ export declare abstract class ImplCSpellConfigFile extends CSpellConfigFile {

@@ -9,2 +9,8 @@ export class CSpellConfigFile {

}
get virtual() {
return false;
}
get remote() {
return this.url.protocol !== 'file:';
}
}

@@ -11,0 +17,0 @@ export class ImplCSpellConfigFile extends CSpellConfigFile {

2

dist/CSpellConfigFile/CSpellConfigFileInMemory.d.ts

@@ -10,4 +10,4 @@ import type { CSpellSettings } from '@cspell/cspell-types';

url: URL, settings: CSpellSettings);
get readonly(): boolean;
get virtual(): boolean;
}
//# sourceMappingURL=CSpellConfigFileInMemory.d.ts.map

@@ -12,3 +12,3 @@ import { ImplCSpellConfigFile } from '../CSpellConfigFile.js';

}
get readonly() {
get virtual() {
return true;

@@ -15,0 +15,0 @@ }

import type { CSpellSettings } from '@cspell/cspell-types';
import { ImplCSpellConfigFile } from '../CSpellConfigFile.js';
import type { SerializeSettingsFn } from '../Serializer.js';
import type { TextFile } from '../TextFile.js';

@@ -8,7 +7,8 @@ export declare class CSpellConfigFileJson extends ImplCSpellConfigFile {

readonly settings: CSpellSettings;
readonly serializer: SerializeSettingsFn;
constructor(url: URL, settings: CSpellSettings, serializer: SerializeSettingsFn);
indent: string | number;
constructor(url: URL, settings: CSpellSettings);
serialize(): string;
static parse(file: TextFile): CSpellConfigFileJson;
}
export declare function parseCSpellConfigFileJson(file: TextFile): CSpellConfigFileJson;
//# sourceMappingURL=CSpellConfigFileJson.d.ts.map

@@ -7,23 +7,32 @@ import { parse, stringify } from 'comment-json';

settings;
serializer;
constructor(url, settings, serializer) {
indent = 2;
constructor(url, settings) {
super(url, settings);
this.url = url;
this.settings = settings;
this.serializer = serializer;
}
serialize() {
return this.serializer(this.settings);
return stringify(this.settings, null, this.indent) + '\n';
}
static parse(file) {
try {
const cspell = parse(file.content);
if (!isCSpellSettings(cspell)) {
throw new ParseError(file.url);
}
const indent = detectIndent(file.content);
const cfg = new CSpellConfigFileJson(file.url, cspell);
cfg.indent = indent;
return cfg;
}
catch (cause) {
if (cause instanceof ParseError) {
throw cause;
}
throw new ParseError(file.url, undefined, { cause });
}
}
}
export function parseCSpellConfigFileJson(file) {
const cspell = parse(file.content);
if (!isCSpellSettings(cspell)) {
throw new Error(`Unable to parse ${file.url}`);
}
const indent = detectIndent(file.content);
function serialize(settings) {
return stringify(settings, null, indent) + '\n';
}
return new CSpellConfigFileJson(file.url, cspell, serialize);
return CSpellConfigFileJson.parse(file);
}

@@ -33,2 +42,9 @@ function isCSpellSettings(cfg) {

}
class ParseError extends Error {
url;
constructor(url, message, options) {
super(message || `Unable to parse ${url}`, options);
this.url = url;
}
}
//# sourceMappingURL=CSpellConfigFileJson.js.map

@@ -8,2 +8,3 @@ export interface TextFileRef {

}
export declare function createTextFile(url: URL, content: string): TextFile;
//# sourceMappingURL=TextFile.d.ts.map

@@ -1,2 +0,4 @@

export {};
export function createTextFile(url, content) {
return { url, content };
}
//# sourceMappingURL=TextFile.js.map
{
"name": "cspell-config-lib",
"version": "8.1.3",
"version": "8.2.0",
"description": "CSpell Config library",

@@ -49,7 +49,7 @@ "keywords": [

"dependencies": {
"@cspell/cspell-types": "8.1.3",
"@cspell/cspell-types": "8.2.0",
"comment-json": "^4.2.3",
"yaml": "^2.3.4"
},
"gitHead": "ea4335117b7c0e7b9ec22738315c82fae24ea997"
"gitHead": "3bcd6430bb33fb221d07030a60a2d61a2479e7ae"
}
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