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

@markuplint/ml-config

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/ml-config - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0-alpha.0

55

lib/merge-config.js

@@ -14,7 +14,3 @@ "use strict";

parserOptions: mergeObject(a.parserOptions, b.parserOptions),
specs:
// v3
// mergeObject(a.specs, b.specs),
// v2
mergeSpecs(a.specs, b.specs),
specs: mergeObject(a.specs, b.specs),
excludeFiles: concatArray(a.excludeFiles, b.excludeFiles, true),

@@ -176,50 +172,1 @@ rules: mergeRules(

}
/**
* @deprecated
* @param a
* @param b
* @returns
*/
function mergeSpecs(a, b) {
return mergeObject(convertSpec_v1_to_v2(a), convertSpec_v1_to_v2(b));
}
/**
* @deprecated
* @param spec
* @returns
*/
function convertSpec_v1_to_v2(spec) {
if (spec == null) {
return;
}
if (typeof spec === 'string') {
return { '/.+/': spec };
}
if (Array.isArray(spec)) {
if (spec.length === 0) {
return {};
}
else if (spec.length === 1) {
return { '/.+/': spec[0] };
}
const res = {};
for (const item of spec) {
switch (item) {
case '@markuplint/vue-spec': {
res['/\\.vue$/i'] = item;
break;
}
case '@markuplint/react-spec': {
res['/\\.[jt]sx?$/i'] = item;
break;
}
default: {
res['/.+/'] = item;
}
}
}
deleteUndefProp(res);
return res;
}
return spec;
}

@@ -0,1 +1,3 @@

import type { RegexSelector } from '@markuplint/selector';
export type { RegexSelector } from '@markuplint/selector';
export interface Config {

@@ -7,3 +9,3 @@ $schema?: string;

parserOptions?: ParserOptions;
specs?: SpecConfig | SpecConfig_v1;
specs?: SpecConfig;
excludeFiles?: string[];

@@ -28,6 +30,2 @@ rules?: Rules;

};
/**
* @deprecated
*/
export declare type SpecConfig_v1 = string | string[];
export declare type Rule<T extends RuleConfigValue, O = void> = RuleConfig<T, O> | T | boolean;

@@ -47,6 +45,2 @@ export declare type AnyRule = Rule<RuleConfigValue, unknown>;

export interface NodeRule {
/**
* @deprecated
*/
tagName?: string;
selector?: string;

@@ -60,6 +54,2 @@ regexSelector?: RegexSelector;

export interface ChildNodeRule {
/**
* @deprecated
*/
tagName?: string;
selector?: string;

@@ -70,13 +60,2 @@ regexSelector?: RegexSelector;

}
export declare type RegexSelector = RegexSelectorWithoutCompination & {
combination?: {
combinator: RegexSelectorCombinator;
} & RegexSelector;
};
export declare type RegexSelectorCombinator = ' ' | '>' | '+' | '~' | ':has(+)' | ':has(~)';
export declare type RegexSelectorWithoutCompination = {
nodeName?: string;
attrName?: string;
attrValue?: string;
};
export declare type Report<T extends RuleConfigValue, O = null> = Report1<T, O> | Report2 | (Report1<T, O> & Report2);

@@ -83,0 +62,0 @@ export declare type Report1<T extends RuleConfigValue, O = null> = {

import type { AnyRule } from './types';
export declare function toRegxp(pattern: string): string | RegExp;
export declare function regexSelectorMatches(reg: string, raw: string): {
[x: string]: string;
} | null;
/**

@@ -7,0 +3,0 @@ * Return undefined if the template doesn't include the variable that is set as a property in data.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.exchangeValueOnRule = exports.provideValue = exports.regexSelectorMatches = exports.toRegxp = void 0;
exports.exchangeValueOnRule = exports.provideValue = void 0;
const tslib_1 = require("tslib");
const mustache_1 = tslib_1.__importDefault(require("mustache"));
function toRegxp(pattern) {
const matched = pattern.match(/^\/(.+)\/([ig]*)$/i);
if (matched) {
return new RegExp(matched[1], matched[2]);
}
return pattern;
}
exports.toRegxp = toRegxp;
function regexSelectorMatches(reg, raw) {
const res = {};
const pattern = toRegxp(reg);
const regex = pattern instanceof RegExp ? pattern : new RegExp(`^${pattern.trim()}$`);
const matched = regex.exec(raw);
if (!matched) {
return null;
}
matched.forEach((val, i) => (res[`$${i}`] = val));
return {
...res,
...matched.groups,
};
}
exports.regexSelectorMatches = regexSelectorMatches;
/**

@@ -30,0 +7,0 @@ * Return undefined if the template doesn't include the variable that is set as a property in data.

5

package.json
{
"name": "@markuplint/ml-config",
"version": "2.1.0",
"version": "3.0.0-alpha.0",
"description": "JSON Schema and TypeScript types of markuplint configure JSON",

@@ -22,2 +22,3 @@ "repository": "git@github.com:markuplint/markuplint.git",

"dependencies": {
"@markuplint/selector": "3.0.0-alpha.0",
"deepmerge": "^4.2.2",

@@ -27,3 +28,3 @@ "is-plain-object": "^5.0.0",

},
"gitHead": "373c916d5ebbba463f5e088696666a383ee96492"
"gitHead": "d32c522e016888e20bcbb5f09352c006b964f193"
}

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