@speedy-js/code-helper-diagnostic
Advanced tools
Comparing version 1.2.4 to 1.3.0
@@ -14,1 +14,2 @@ export declare const SpeedyDefaultConfig = "speedy.config.ts"; | ||
}; | ||
//# sourceMappingURL=constant.d.ts.map |
@@ -26,5 +26,6 @@ import { DiagnosticBundlerInstance, DiagnosticLevel, Compiler, DiagnosticOption } from '@speedy-js/code-helper-types'; | ||
private runSpeedy; | ||
private runWebpack; | ||
/** 运行构建 */ | ||
private runBundle; | ||
/** 获取诊断配置 */ | ||
private getDiagnosticConfig; | ||
/** | ||
@@ -35,3 +36,2 @@ * 诊断构建流程 | ||
diagnostic(level?: keyof typeof DiagnosticLevel): Promise<import("@speedy-js/code-helper-types").ValidateResult | undefined>; | ||
private getDiagnosticConfig; | ||
/** | ||
@@ -56,1 +56,2 @@ * 诊断构建流程 | ||
} | ||
//# sourceMappingURL=diagnostic.d.ts.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
const constant_1 = require("./constant"); | ||
const transform_1 = require("../utils/transform"); | ||
const utils_1 = require("../utils"); | ||
class DiagnosticBundler { | ||
@@ -55,5 +55,5 @@ constructor(root, opt) { | ||
} | ||
else if (project === 'webpack') { | ||
this.bundler = require(packageName); | ||
} | ||
// else if (project === 'webpack') { | ||
// this.bundler = require(packageName); | ||
// } | ||
else { | ||
@@ -110,26 +110,24 @@ this.errors.push({ | ||
} | ||
runWebpack() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// const config = await loadConfig<WebpackTypes.Configuration>({ | ||
// cwd: path.resolve(this.root), | ||
// configFile: this.options.config, | ||
// configKey: 'webpack', | ||
// }).catch((e) => e); | ||
// if (config instanceof Error) { | ||
// return config; | ||
// } | ||
// if (!config.plugins) { | ||
// config.plugins = []; | ||
// } | ||
// const plugin = new Webpack.DiagnosticInternalPlugin(); | ||
// config.plugins.push(plugin); | ||
// this.moduleGraphs = [plugin.moduleGraph]; | ||
// return new Promise<any>((resolve) => { | ||
// const Bundler = this.bundler.webpack as typeof WebpackBundler; | ||
// Bundler(config, (err) => { | ||
// resolve(err); | ||
// }); | ||
// }); | ||
}); | ||
} | ||
// private async runWebpack() { | ||
// const config = await loadConfig<WebpackTypes.Configuration>({ | ||
// cwd: path.resolve(this.root), | ||
// configFile: this.options.config, | ||
// configKey: 'webpack', | ||
// }).catch((e) => e); | ||
// if (config instanceof Error) { | ||
// return config; | ||
// } | ||
// if (!config.plugins) { | ||
// config.plugins = []; | ||
// } | ||
// const plugin = new Webpack.DiagnosticInternalPlugin(); | ||
// config.plugins.push(plugin); | ||
// this.moduleGraphs = [plugin.moduleGraph]; | ||
// return new Promise<any>((resolve) => { | ||
// const Bundler = this.bundler.webpack as typeof WebpackBundler; | ||
// Bundler(config, (err) => { | ||
// resolve(err); | ||
// }); | ||
// }); | ||
// } | ||
/** 运行构建 */ | ||
@@ -154,6 +152,6 @@ runBundle() { | ||
} | ||
else if (project === 'webpack') { | ||
logStart('Webpack'); | ||
err = yield this.runWebpack(); | ||
} | ||
// else if (project === 'webpack') { | ||
// logStart('Webpack'); | ||
// err = await this.runWebpack(); | ||
// } | ||
const end = Date.now() - start; | ||
@@ -164,2 +162,9 @@ logger.info(`Build completed in ${end}ms.`); | ||
} | ||
/** 获取诊断配置 */ | ||
getDiagnosticConfig() { | ||
var _a, _b; | ||
if (this.options.project === 'speedy') { | ||
return (_b = (_a = this.compilers[0]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.diagnostic; | ||
} | ||
} | ||
/** | ||
@@ -186,8 +191,2 @@ * 诊断构建流程 | ||
} | ||
getDiagnosticConfig() { | ||
var _a, _b; | ||
if (this.options.project === 'speedy') { | ||
return (_b = (_a = this.compilers[0]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.diagnostic; | ||
} | ||
} | ||
/** | ||
@@ -198,16 +197,8 @@ * 诊断构建流程 | ||
diagnosticWithoutBundle(level) { | ||
var _a, _b, _c, _d; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const userConfig = this.getDiagnosticConfig(); | ||
const result = yield (0, linter_1.lint)({ | ||
errors: this.buildErrorMap, | ||
level: level ? code_helper_types_1.DiagnosticLevel[level] : this.options.level, | ||
rules: (_b = (_a = this.options.rules) !== null && _a !== void 0 ? _a : userConfig === null || userConfig === void 0 ? void 0 : userConfig.rules) !== null && _b !== void 0 ? _b : {}, | ||
extends: (_d = (_c = this.options.extends) !== null && _c !== void 0 ? _c : userConfig === null || userConfig === void 0 ? void 0 : userConfig.extends) !== null && _d !== void 0 ? _d : [], | ||
compilers: this.compilers, | ||
moduleGraphMap: this.moduleGraphMap, | ||
chalk: this.print, | ||
root: this.root, | ||
config: userConfig !== null && userConfig !== void 0 ? userConfig : {}, | ||
}); | ||
const rulesConfig = typeof userConfig === 'object' ? userConfig.rules : this.options.rules; | ||
const extendsConfig = typeof userConfig === 'object' ? userConfig.extends : this.options.extends; | ||
const linter = new linter_1.Linter(this.root, this.compilers, this.moduleGraphMap, this.buildErrorMap, rulesConfig, extendsConfig, level ? code_helper_types_1.DiagnosticLevel[level] : this.options.level, this.print); | ||
const result = yield linter.validate(); | ||
this.errors = this.errors.concat(result.errors); | ||
@@ -245,3 +236,3 @@ return result; | ||
return errors.map((error) => { | ||
return (0, transform_1.diagnosticToSpeedyError)(error, options.project, options.noColor); | ||
return (0, utils_1.diagnosticToSpeedyError)(error, options.project, options.noColor); | ||
}); | ||
@@ -248,0 +239,0 @@ } |
export * from './diagnostic'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,1 +5,2 @@ export * from './diagnostic'; | ||
export { defineRule, diagnosticToSpeedyError } from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -35,1 +35,2 @@ import { Position, Range, OffsetRange } from '@speedy-js/speedy-types'; | ||
} | ||
//# sourceMappingURL=document.d.ts.map |
import { FormatError } from '@speedy-js/code-helper-types'; | ||
export declare function transform(err: any): FormatError | void; | ||
//# sourceMappingURL=babel-type-duplicate-declare.d.ts.map |
@@ -5,17 +5,26 @@ "use strict"; | ||
function transform(err) { | ||
if (err.reasonCode !== 'VarRedeclaration' || err.code !== 'BABEL_PARSE_ERROR') { | ||
if (err.reason !== 'VarRedeclaration' || err.code !== 'BABEL_PARSE_ERROR') { | ||
return; | ||
} | ||
const matcher = /([^: ]+): Identifier ['"]([^'"]+)['"] has already been declared/; | ||
const matchResult = matcher.exec(err.message); | ||
if (!matchResult) { | ||
return; | ||
if (err.constructor.name === 'SpeedyError' && err.path) { | ||
return { | ||
files: [err.path], | ||
rules: 'no-same-name-with-type-import', | ||
origin: err, | ||
}; | ||
} | ||
return { | ||
files: [matchResult[1]], | ||
rules: 'no-same-name-with-type-import', | ||
origin: err, | ||
}; | ||
// TODO: 普通错误时如何检测 | ||
// const messageMatch = /Identifier ['"]([^'"]+)['"] has already been declared/; | ||
// const originMatcher = /([^: ]+): Identifier ['"]([^'"]+)['"] has already been declared/; | ||
// const matchResult = messageMatch.exec(err.message); | ||
// if (!matchResult) { | ||
// return; | ||
// } | ||
// return { | ||
// files: [matchResult[1]], | ||
// rules: 'no-same-name-with-type-import', | ||
// origin: err, | ||
// }; | ||
} | ||
exports.transform = transform; | ||
//# sourceMappingURL=babel-type-duplicate-declare.js.map |
import { FormatError } from '@speedy-js/code-helper-types'; | ||
export declare function transform(err: any): FormatError; | ||
//# sourceMappingURL=default.d.ts.map |
import { FormatError } from '@speedy-js/code-helper-types'; | ||
export declare function transformError(err: any): FormatError[]; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -21,2 +21,3 @@ "use strict"; | ||
result.push(transformed); | ||
break; | ||
} | ||
@@ -23,0 +24,0 @@ } |
@@ -1,3 +0,4 @@ | ||
import { ValidateOption, ValidateResult } from '@speedy-js/code-helper-types'; | ||
export * from './document'; | ||
export declare function lint(option?: ValidateOption): Promise<ValidateResult>; | ||
export * from './linter'; | ||
export * from './rule'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,54 +12,6 @@ "use strict"; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lint = void 0; | ||
const chalk_1 = require("chalk"); | ||
const code_helper_types_1 = require("@speedy-js/code-helper-types"); | ||
const errors_1 = require("./errors"); | ||
const rules_1 = require("./rules"); | ||
const rule_1 = require("./rule"); | ||
const utils_1 = require("../utils"); | ||
__exportStar(require("./document"), exports); | ||
function getRules(ruleMap = {}, extendRules, filterLevel) { | ||
const rules = rules_1.rules.concat(extendRules.map((data) => rule_1.Rule.fromExtend(data))); | ||
rules.forEach((rule) => { | ||
if (ruleMap[rule.title]) { | ||
rule.setOption(ruleMap[rule.title]); | ||
} | ||
}); | ||
return rules.filter((rule) => rule.match(filterLevel)); | ||
} | ||
function lint(option = {}) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const lintResult = { | ||
errors: [], | ||
replace: [], | ||
}; | ||
const rules = getRules((_a = option.rules) !== null && _a !== void 0 ? _a : {}, (_b = option.extends) !== null && _b !== void 0 ? _b : [], (_c = option.level) !== null && _c !== void 0 ? _c : code_helper_types_1.DiagnosticLevel.Normal); | ||
const context = { | ||
errors: (0, utils_1.map)((_d = option.errors) !== null && _d !== void 0 ? _d : new Map(), (val) => (0, errors_1.transformError)(val)), | ||
compilers: (_e = option.compilers) !== null && _e !== void 0 ? _e : [], | ||
root: (_f = option.root) !== null && _f !== void 0 ? _f : process.cwd(), | ||
chalk: (_g = option.chalk) !== null && _g !== void 0 ? _g : new chalk_1.Instance({ level: 3 }), | ||
moduleGraphMap: (_h = option.moduleGraphMap) !== null && _h !== void 0 ? _h : new Map(), | ||
config: undefined, | ||
}; | ||
yield Promise.all(rules.map((rule) => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield rule.validate(Object.assign(Object.assign({}, context), { config: rule.config })); | ||
lintResult.errors.push(...result.errors); | ||
lintResult.replace.push(...result.replace); | ||
}))); | ||
return lintResult; | ||
}); | ||
} | ||
exports.lint = lint; | ||
__exportStar(require("./linter"), exports); | ||
__exportStar(require("./rule"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,6 @@ | ||
import { RuleConfigItem, Severity, DiagnosticLevel, RuleMeta, ExtendRuleData, RuleKind, Diagnostic, RuleData, RuleCheckContext, ValidateResult } from '@speedy-js/code-helper-types'; | ||
export declare class Rule implements RuleMeta { | ||
static fromExtend(data: ExtendRuleData): Rule; | ||
import { RuleConfigItem, Severity, DiagnosticLevel, RuleMeta, ExtendRuleData, RuleKind, Diagnostic, RuleData, ValidateResult, LinterContext, DefaultRuleConfig, FormatError } from '@speedy-js/code-helper-types'; | ||
export declare class Rule<Config = DefaultRuleConfig> implements RuleMeta<Config> { | ||
static fromExtend<Config = DefaultRuleConfig>(data: ExtendRuleData<Config>): Rule<Config>; | ||
/** 规则元数据 */ | ||
readonly meta: RuleMeta; | ||
readonly meta: RuleMeta<Config>; | ||
/** 校验函数 */ | ||
@@ -11,8 +11,8 @@ private check; | ||
/** 当前选项 */ | ||
private _config; | ||
private _config?; | ||
/** 待删除的原始错误 */ | ||
replace: any[]; | ||
replace: FormatError[]; | ||
/** 校验报错 */ | ||
errors: Diagnostic[]; | ||
constructor(data: RuleData); | ||
constructor(data: RuleData<Config>); | ||
/** 规则名称 */ | ||
@@ -23,3 +23,3 @@ get title(): string; | ||
/** 当前配置 */ | ||
get config(): any; | ||
get config(): Config | undefined; | ||
/** 规则类别 */ | ||
@@ -31,3 +31,4 @@ get kind(): RuleKind; | ||
/** 校验 */ | ||
validate(context: Omit<RuleCheckContext, 'report'>): Promise<ValidateResult>; | ||
validate(context: LinterContext): Promise<ValidateResult>; | ||
} | ||
//# sourceMappingURL=rule.d.ts.map |
@@ -87,3 +87,3 @@ "use strict"; | ||
this._severity = severity; | ||
this._config = config !== null && config !== void 0 ? config : this._config; | ||
this._config = Object.assign(Object.assign({}, this.meta.defaultConfig), config); | ||
} | ||
@@ -95,3 +95,4 @@ /** 校验 */ | ||
this.replace.length = 0; | ||
yield this.check(Object.assign(Object.assign({}, context), { report: (_a) => { | ||
yield this.check(Object.assign(Object.assign({}, context), { config: this.config, report: (_a) => { | ||
var _b; | ||
var { document, replace } = _a, rest = __rest(_a, ["document", "replace"]); | ||
@@ -101,3 +102,3 @@ if (replace) { | ||
} | ||
this.errors.push(Object.assign(Object.assign({}, rest), { severity: this.severity, title: this.title.toUpperCase(), content: document === null || document === void 0 ? void 0 : document.getText(), uri: document === null || document === void 0 ? void 0 : document.uri, referenceUrl: this.meta.referenceUrl })); | ||
this.errors.push(Object.assign(Object.assign({}, rest), { severity: this.severity, title: this.title.toUpperCase(), content: document === null || document === void 0 ? void 0 : document.getText(), uri: document === null || document === void 0 ? void 0 : document.uri, referenceUrl: (_b = rest.referenceUrl) !== null && _b !== void 0 ? _b : this.meta.referenceUrl })); | ||
} })); | ||
@@ -104,0 +105,0 @@ return { |
@@ -13,1 +13,2 @@ import { Package } from './package'; | ||
} | ||
//# sourceMappingURL=dependency.d.ts.map |
import { Rule } from '../../rule'; | ||
export declare const rule: Rule; | ||
import { Config } from './types'; | ||
export declare const rule: Rule<Config>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,31 +18,6 @@ "use strict"; | ||
const path_1 = __importDefault(require("path")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const speedy_logger_1 = require("@speedy-js/speedy-logger"); | ||
const fs_1 = require("fs"); | ||
const rule_1 = require("../../rule"); | ||
const map_1 = require("./map"); | ||
const logger = (0, speedy_logger_1.createLogger)({ level: 'info' }); | ||
function getErrorMsg(packages, chalk, root) { | ||
const pkgName = packages[0].name; | ||
let message = `Multiple packages of ${chalk.bold.green(pkgName)} found:\n`; | ||
for (const pkg of packages) { | ||
message += ` ${chalk.bold.green(pkg.version)} ${chalk.bold(path_1.default.relative(root, pkg.root))}\n`; | ||
} | ||
return message.slice(0, -1); | ||
} | ||
function _getGraphData(_package, graphData) { | ||
var _a; | ||
if (!(_package === null || _package === void 0 ? void 0 : _package.imported)) { | ||
return; | ||
} | ||
graphData.nodes.push({ | ||
id: `${_package.name}@${_package.version}`, | ||
label: `${_package.name}@${_package.version}`, | ||
}); | ||
if ((_a = _package === null || _package === void 0 ? void 0 : _package.imported) === null || _a === void 0 ? void 0 : _a.length) { | ||
_package.imported.map((pkg) => { | ||
graphData.edges.push({ source: `${_package.name}@${_package.version}`, target: `${pkg.name}@${pkg.version}` }); | ||
_getGraphData(pkg, graphData); | ||
}); | ||
} | ||
} | ||
const utils_1 = require("./utils"); | ||
exports.rule = new rule_1.Rule({ | ||
@@ -53,29 +28,28 @@ meta: { | ||
kind: code_helper_types_1.RuleKind.ModuleGraph, | ||
defaultConfig: { checkVersion: 'minor' }, | ||
referenceUrl: 'https://diagnostic.web.bytedance.net/guide/overview/duplicate-packages.html', | ||
defaultConfig: { | ||
checkVersion: 'minor', | ||
ignore: [], | ||
}, | ||
}, | ||
check({ moduleGraphMap, compilers, report, root, chalk, config }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const dupPackages = (yield Promise.all(compilers.map((compiler) => __awaiter(this, void 0, void 0, function* () { | ||
const packages = yield Promise.all(compilers.map((compiler) => __awaiter(this, void 0, void 0, function* () { | ||
const pkg = new map_1.PackageMap(moduleGraphMap.get(compiler)); | ||
yield pkg.createTree(); | ||
return pkg.getDuplicatePackages(config); | ||
})))).reduce((ans, item) => ans.concat(item), []); | ||
const graphData = []; | ||
for (const pkg of dupPackages) { | ||
const _dupPackageData = []; | ||
pkg.forEach((_package) => { | ||
const data = { name: `${_package.name}@${_package.version}`, graph: { nodes: [], edges: [] } }; | ||
_getGraphData(_package, data.graph); | ||
data.graph.nodes.length && (data.graph.nodes[0].fill = '#7BC0FC'); | ||
_dupPackageData.push(data); | ||
}); | ||
graphData.push(_dupPackageData); | ||
}))); | ||
const dupPackages = (0, utils_1.mergeDuplicatePackages)(packages); | ||
const graphData = (0, utils_1.getGraphList)(dupPackages); | ||
if (graphData.length) { | ||
yield fs_1.promises.writeFile(path_1.default.join(root, '.graph-data.log'), JSON.stringify(graphData)); | ||
} | ||
if (graphData === null || graphData === void 0 ? void 0 : graphData.length) { | ||
fs_1.default.writeFileSync(path_1.default.join(process.cwd(), '.graph-data.log'), JSON.stringify(graphData)); | ||
logger.info('🟠🟠🟠 Duplicate packages graph data [.graph-data.log] in current command line root directory, please check this in https://diagnostic.web.bytedance.net/web.'); | ||
} | ||
for (const pkg of dupPackages) { | ||
report({ | ||
message: getErrorMsg(pkg, chalk, root), | ||
message: (0, utils_1.getErrorMsg)(pkg, chalk, root), | ||
suggestions: [ | ||
{ | ||
description: `Package Graph data ${chalk.bold.green('.graph-data.log')} in root directory, please check this in ${chalk.bold.green('https://diagnostic_playground.web.bytedance.net/graph')}`, | ||
}, | ||
], | ||
}); | ||
@@ -82,0 +56,0 @@ } |
import type { ModuleGraph } from '@speedy-js/speedy-types'; | ||
import { Package } from './package'; | ||
import { Dependency } from './dependency'; | ||
import type { Config } from './types'; | ||
export declare class PackageMap { | ||
@@ -13,5 +14,4 @@ private dependencies; | ||
addPackage(node: Package): void; | ||
getDuplicatePackages(config: { | ||
checkVersion: 'major' | 'minor' | 'patch'; | ||
}): Package[][]; | ||
getDuplicatePackages(config: Config): Package[][]; | ||
} | ||
//# sourceMappingURL=map.d.ts.map |
@@ -70,3 +70,3 @@ "use strict"; | ||
.map((pkg) => this.packages.filter((item) => item.name === pkg.name)) | ||
.filter((pkgs) => pkgs.length > 1) | ||
.filter((pkgs) => pkgs.length > 1 && !config.ignore.includes(pkgs[0].name)) | ||
.map((duplicatePacks) => { | ||
@@ -73,0 +73,0 @@ duplicatePacks.sort((_packA, _packB) => { |
@@ -18,2 +18,3 @@ import type { Dependency } from './dependency'; | ||
isSame(pkg: Package): boolean; | ||
toKey(): string; | ||
addDependency(dep: Dependency): void; | ||
@@ -23,1 +24,2 @@ addImported(pkg: Package): void; | ||
export {}; | ||
//# sourceMappingURL=package.d.ts.map |
@@ -92,2 +92,5 @@ "use strict"; | ||
} | ||
toKey() { | ||
return `${this.name}@${this.version}::${this.root}`; | ||
} | ||
addDependency(dep) { | ||
@@ -94,0 +97,0 @@ if (this.dependencies.every((item) => item.refFile !== dep.refFile || !item.dep.isSame(dep.dep))) { |
@@ -1,1 +0,2 @@ | ||
export declare const rules: import("../rule").Rule[]; | ||
export declare const rules: (import("..").Rule<import("./duplicate-package/types").Config> | import("..").Rule<undefined>)[]; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,3 +5,4 @@ "use strict"; | ||
const duplicate_package_1 = require("./duplicate-package"); | ||
exports.rules = [duplicate_package_1.rule]; | ||
const no_same_name_with_type_import_1 = require("./no-same-name-with-type-import"); | ||
exports.rules = [duplicate_package_1.rule, no_same_name_with_type_import_1.rule]; | ||
//# sourceMappingURL=index.js.map |
import { Severity, SeverityInput } from '@speedy-js/code-helper-types'; | ||
export declare function toSeverity(input: SeverityInput, defaultLevel: Severity): Severity; | ||
export declare function removeItem<T>(arr: T[], items: any[]): T[]; | ||
//# sourceMappingURL=utils.d.ts.map |
export * as DiagnosticSpeedyPlugin from './speedy'; | ||
//# sourceMappingURL=index.d.ts.map |
export * from './instance'; | ||
export * from './transform'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,1 +6,2 @@ import { SpeedyPlugin as SpeedyPluginType } from '@speedy-js/speedy-types'; | ||
export {}; | ||
//# sourceMappingURL=instance.d.ts.map |
@@ -28,3 +28,3 @@ "use strict"; | ||
const result = yield diagnostic.diagnosticWithoutBundle('Normal'); | ||
compiler.removeError(...result.replace); | ||
compiler.removeError(...result.replace.map((item) => item.origin)); | ||
compiler.report(result.errors.map((item) => (0, transform_1.diagnosticToSpeedyError)(item, 'Speedy'))); | ||
@@ -31,0 +31,0 @@ })); |
import { SpeedyPlugin as SpeedyPluginType } from '@speedy-js/speedy-types'; | ||
import { DiagnosticBundler } from '../../diagnostic'; | ||
export declare function TransformPlugin(diagnostic: DiagnosticBundler): SpeedyPluginType; | ||
//# sourceMappingURL=transform.d.ts.map |
@@ -1,2 +0,3 @@ | ||
import { ExtendRuleData } from '@speedy-js/code-helper-types'; | ||
export declare function defineRule(rule: ExtendRuleData): ExtendRuleData; | ||
import { DefaultRuleConfig, ExtendRuleData } from '@speedy-js/code-helper-types'; | ||
export declare function defineRule<Config = DefaultRuleConfig>(rule: ExtendRuleData<Config>): ExtendRuleData<Config>; | ||
//# sourceMappingURL=config.d.ts.map |
export * from './load'; | ||
export * from './log'; | ||
export * from './utils'; | ||
export * from './config'; | ||
export * from './transform'; | ||
export * from './config'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -16,4 +16,4 @@ "use strict"; | ||
__exportStar(require("./utils"), exports); | ||
__exportStar(require("./config"), exports); | ||
__exportStar(require("./transform"), exports); | ||
__exportStar(require("./config"), exports); | ||
//# sourceMappingURL=index.js.map |
import { IConfigLoaderOptions } from '@speedy-js/speedy-config-loader'; | ||
export declare function loadConfig<T>(config: IConfigLoaderOptions): Promise<T>; | ||
//# sourceMappingURL=load.d.ts.map |
export declare function log(...message: any[]): void; | ||
export declare function warn(...message: any[]): void; | ||
//# sourceMappingURL=log.d.ts.map |
@@ -5,1 +5,2 @@ import { SpeedyError, ErrorLevel } from '@speedy-js/speedy-error'; | ||
export declare function diagnosticToSpeedyError(error: Diagnostic, projectCode: string, noColor?: boolean): SpeedyError; | ||
//# sourceMappingURL=transform.d.ts.map |
export declare function map<K, U, R>(map: Map<K, U>, mapping: (val: U, key: K) => R): Map<K, R>; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "@speedy-js/code-helper-diagnostic", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "", | ||
@@ -17,3 +17,6 @@ "keywords": [], | ||
"dependencies": { | ||
"@speedy-js/speedy-utils": "0.13.2-webpack.1", | ||
"@babel/parser": "7.18.6", | ||
"@babel/types": "7.18.6", | ||
"@babel/traverse": "7.18.6", | ||
"@speedy-js/speedy-utils": "0.13.2-alpha.17", | ||
"lines-and-columns": "2.0.3", | ||
@@ -24,9 +27,11 @@ "look-it-up": "2.1.0" | ||
"@speedy-js/config": "0.8.0-3", | ||
"@speedy-js/code-helper-types": "1.1.0", | ||
"@speedy-js/code-helper-types": "1.2.0", | ||
"@speedy-js/esbuild": "0.14.28-speedy-5", | ||
"@speedy-js/eslint-config": "0.0.1", | ||
"@speedy-js/speedy-config-loader": "0.13.2-webpack.1", | ||
"@speedy-js/speedy-error": "0.13.2-webpack.1", | ||
"@speedy-js/speedy-logger": "0.13.2-webpack.1", | ||
"@speedy-js/speedy-types": "0.13.2-webpack.1", | ||
"@speedy-js/speedy-config-loader": "0.13.2-alpha.17", | ||
"@speedy-js/speedy-error": "0.13.2-alpha.17", | ||
"@speedy-js/speedy-logger": "0.13.2-alpha.17", | ||
"@speedy-js/speedy-types": "0.13.2-alpha.17", | ||
"@speedy-js/test-toolkit": "0.9.2-alpha.2", | ||
"@types/babel__traverse": "7.17.1", | ||
"@types/node": "12.20.42", | ||
@@ -33,0 +38,0 @@ "@types/semver": "7.3.9", |
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133983
137
1896
5
6
18
+ Added@babel/parser@7.18.6
+ Added@babel/traverse@7.18.6
+ Added@babel/types@7.18.6
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/generator@7.26.3(transitive)
+ Added@babel/helper-environment-visitor@7.24.7(transitive)
+ Added@babel/helper-function-name@7.24.7(transitive)
+ Added@babel/helper-hoist-variables@7.24.7(transitive)
+ Added@babel/helper-split-export-declaration@7.24.7(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.18.67.26.3(transitive)
+ Added@babel/template@7.25.9(transitive)
+ Added@babel/traverse@7.18.6(transitive)
+ Added@babel/types@7.18.67.26.3(transitive)
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@speedy-js/speedy-utils@0.13.2-alpha.17(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsesc@3.1.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
- Removed@speedy-js/speedy-utils@0.13.2-webpack.1(transitive)