Socket
Socket
Sign inDemoInstall

cspell-grammar

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cspell-grammar - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

dist/grammar/grammarFiles.js

@@ -9,3 +9,3 @@ "use strict";

const def = tryPList(grammarContents) || tryJsonOrYaml(grammarContents);
if (!def) {
if (!def || typeof def !== 'object') {
return Promise.reject(`Unable to load grammar file: "${pathToGrammar}"`);

@@ -12,0 +12,0 @@ }

@@ -76,2 +76,5 @@ "use strict";

for (const [k, s] of Object.entries(match)) {
if (s === undefined) {
continue;
}
if (m.has(k) || skip.has(k)) {

@@ -78,0 +81,0 @@ continue;

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

import { Chalk } from 'chalk';
import { ScopeColorizer, LineColorizer } from './types';

@@ -11,2 +10,15 @@ export declare type ColorTextFn = (text: string) => string;

export declare function createColorizer(scopeColorizer?: ScopeColorizer): LineColorizer;
export declare function createDefaultColorMap(chalk: Chalk): ScopeColorizerDefinition;
export interface ColorApplicator {
(...text: string[]): string;
red: ColorApplicator;
green: ColorApplicator;
yellow: ColorApplicator;
blue: ColorApplicator;
greenBright: ColorApplicator;
yellowBright: ColorApplicator;
dim: ColorApplicator;
gray: ColorApplicator;
bgHex: (hex: string) => ColorApplicator;
}
export declare function createDefaultColorMap(chalk: ColorApplicator): ScopeColorizerDefinition;
export declare function createDefaultColorApplicator(): ColorApplicator;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = require("chalk");
const cacheMap_1 = require("../util/cacheMap");
const bgColor = '#202020';
const defaultColorDef = createDefaultColorMap(chalk_1.default);
const defaultColorApplicator = createDefaultColorApplicator();
const defaultColorDef = createDefaultColorMap(defaultColorApplicator);
function createScopeColorizer(colorDef = defaultColorDef) {

@@ -52,3 +52,3 @@ const { colorMap, defaultColorizer } = colorDef;

[/support.function/, baseColor.greenBright],
[/^source$/, baseColor.gray],
[/^source/, baseColor.gray],
[/^title$/, baseColor.dim],

@@ -63,2 +63,16 @@ ];

exports.createDefaultColorMap = createDefaultColorMap;
function createDefaultColorApplicator() {
const applicator = ((...text) => text.join(''));
applicator.red = applicator;
applicator.green = applicator;
applicator.yellow = applicator;
applicator.blue = applicator;
applicator.greenBright = applicator;
applicator.yellowBright = applicator;
applicator.dim = applicator;
applicator.gray = applicator;
applicator.bgHex = function () { return this; };
return applicator;
}
exports.createDefaultColorApplicator = createDefaultColorApplicator;
//# sourceMappingURL=tokenColorizer.js.map
{
"name": "cspell-grammar",
"version": "0.1.1",
"version": "0.1.2",
"description": "A tmLanguage based Grammar Parser for cSpell",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -11,3 +11,3 @@ import * as fs from 'fs-extra';

if (!def) {
if (!def || typeof def !== 'object') {
return Promise.reject(`Unable to load grammar file: "${pathToGrammar}"`);

@@ -14,0 +14,0 @@ }

@@ -100,2 +100,3 @@ import * as XRegExp from 'xregexp';

for (const [k, s] of Object.entries(match!)) {
if (s === undefined) { continue; }
if (m.has(k) || skip.has(k)) { continue; }

@@ -102,0 +103,0 @@ let begin = text.indexOf(s, offset);

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

import chalk, { Chalk } from 'chalk';
import { create } from '../util/cacheMap';

@@ -15,3 +14,4 @@ import { Scope, Token } from '../grammar';

const defaultColorDef = createDefaultColorMap(chalk);
const defaultColorApplicator = createDefaultColorApplicator();
const defaultColorDef = createDefaultColorMap(defaultColorApplicator);

@@ -57,3 +57,16 @@ export function createScopeColorizer(colorDef: ScopeColorizerDefinition = defaultColorDef): ScopeColorizer {

export function createDefaultColorMap(chalk: Chalk): ScopeColorizerDefinition {
export interface ColorApplicator {
(...text: string[]): string;
red: ColorApplicator;
green: ColorApplicator;
yellow: ColorApplicator;
blue: ColorApplicator;
greenBright: ColorApplicator;
yellowBright: ColorApplicator;
dim: ColorApplicator;
gray: ColorApplicator;
bgHex: (hex: string) => ColorApplicator;
}
export function createDefaultColorMap(chalk: ColorApplicator): ScopeColorizerDefinition {
const baseColor = chalk.bgHex(bgColor);

@@ -69,3 +82,3 @@

[/support.function/, baseColor.greenBright],
[/^source$/, baseColor.gray],
[/^source/, baseColor.gray],
[/^title$/, baseColor.dim],

@@ -81,1 +94,16 @@ ];

}
export function createDefaultColorApplicator(): ColorApplicator {
const applicator = ((...text: string[]) => text.join('')) as ColorApplicator;
applicator.red = applicator;
applicator.green = applicator;
applicator.yellow = applicator;
applicator.blue = applicator;
applicator.greenBright = applicator;
applicator.yellowBright = applicator;
applicator.dim = applicator;
applicator.gray = applicator;
applicator.bgHex = function() { return this; };
return applicator;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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