@secretlint/node
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -15,2 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createEngine = void 0; | ||
const core_1 = require("@secretlint/core"); | ||
@@ -34,4 +35,4 @@ const config_loader_1 = require("@secretlint/config-loader"); | ||
locale: options.locale, | ||
config: config | ||
} | ||
config: config, | ||
}, | ||
}); | ||
@@ -42,3 +43,3 @@ }); | ||
}; | ||
const executeOnContent = ({ content, filePath, config, options }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const executeOnContent = ({ content, filePath, config, options, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b; | ||
@@ -52,12 +53,12 @@ debug("executeOnContent content: %s", `${content.slice(0, 24)}...`); | ||
ext: path_1.default.extname(filePath), | ||
contentType: "text" | ||
contentType: "text", | ||
}, | ||
options: { | ||
locale: options.locale, | ||
config | ||
} | ||
config, | ||
}, | ||
}); | ||
debug("executeOnContent result: %o", result); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>format::start" | ||
type: "@node>format::start", | ||
}); | ||
@@ -67,14 +68,14 @@ const formatter = formatter_1.createFormatter({ | ||
formatterName: options.formatter, | ||
terminalLink: (_b = options.terminalLink) !== null && _b !== void 0 ? _b : false | ||
terminalLink: (_b = options.terminalLink) !== null && _b !== void 0 ? _b : false, | ||
}); | ||
const output = formatter.format([result]); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>format::end" | ||
type: "@node>format::end", | ||
}); | ||
return { | ||
ok: !hasErrorMessage(result), | ||
output: output | ||
output: output, | ||
}; | ||
}); | ||
const executeOnFiles = ({ filePathList, config, options }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const executeOnFiles = ({ filePathList, config, options, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _c, _d; | ||
@@ -90,7 +91,7 @@ const mapper = (filePath) => __awaiter(void 0, void 0, void 0, function* () { | ||
// https://github.com/secretlint/secretlint/issues/72 | ||
concurrency: os_1.default.cpus().length | ||
concurrency: os_1.default.cpus().length, | ||
}); | ||
debug("executeOnFiles result counts: %s", results.length); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>format::start" | ||
type: "@node>format::start", | ||
}); | ||
@@ -100,9 +101,9 @@ const formatter = formatter_1.createFormatter({ | ||
formatterName: options.formatter, | ||
terminalLink: (_d = options.terminalLink) !== null && _d !== void 0 ? _d : false | ||
terminalLink: (_d = options.terminalLink) !== null && _d !== void 0 ? _d : false, | ||
}); | ||
const output = formatter.format(results); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>format::end" | ||
type: "@node>format::end", | ||
}); | ||
const hasErrorAtLeastOne = results.some(result => { | ||
const hasErrorAtLeastOne = results.some((result) => { | ||
return hasErrorMessage(result); | ||
@@ -112,3 +113,3 @@ }); | ||
ok: !hasErrorAtLeastOne, | ||
output: output | ||
output: output, | ||
}; | ||
@@ -121,5 +122,5 @@ }); | ||
*/ | ||
exports.createEngine = (options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const createEngine = (options) => __awaiter(void 0, void 0, void 0, function* () { | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>load-config::start" | ||
type: "@node>load-config::start", | ||
}); | ||
@@ -130,3 +131,3 @@ const loadedResult = (() => { | ||
return config_loader_1.loadPackagesFromRawConfig({ | ||
rawConfig: options.configFileJSON | ||
rawConfig: options.configFileJSON, | ||
}); | ||
@@ -136,3 +137,3 @@ } | ||
cwd: options.cwd, | ||
configFilePath: options.configFilePath | ||
configFilePath: options.configFilePath, | ||
}); | ||
@@ -143,6 +144,6 @@ debug("Loaded ConfigFilePath: %s", loadConfigResult.configFilePath); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>load-config::end" | ||
type: "@node>load-config::end", | ||
}); | ||
if (!loadedResult.ok) { | ||
throw new Error(loadedResult.errors.map(error => error.stack).join("\n\n")); | ||
throw new Error(loadedResult.errors.map((error) => error.stack).join("\n\n")); | ||
} | ||
@@ -160,3 +161,3 @@ debug("Config: %O", loadedResult.config); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>execute::start" | ||
type: "@node>execute::start", | ||
}); | ||
@@ -167,6 +168,6 @@ return executeOnContent({ | ||
config: loadedResult.config, | ||
options: options | ||
options: options, | ||
}).finally(() => { | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>execute::end" | ||
type: "@node>execute::end", | ||
}); | ||
@@ -182,3 +183,3 @@ }); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>execute::start" | ||
type: "@node>execute::start", | ||
}); | ||
@@ -188,11 +189,12 @@ return executeOnFiles({ | ||
config: loadedResult.config, | ||
options: options | ||
options: options, | ||
}).finally(() => { | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@node>execute::end" | ||
type: "@node>execute::end", | ||
}); | ||
}); | ||
} | ||
}, | ||
}; | ||
}); | ||
exports.createEngine = createEngine; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@secretlint/node", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Secretlint client library for Node.js", | ||
@@ -44,7 +44,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@secretlint/config-loader": "^2.1.1", | ||
"@secretlint/core": "^2.1.1", | ||
"@secretlint/formatter": "^2.1.1", | ||
"@secretlint/profiler": "^2.1.1", | ||
"@secretlint/source-creator": "^2.1.1", | ||
"@secretlint/config-loader": "^2.2.0", | ||
"@secretlint/core": "^2.2.0", | ||
"@secretlint/formatter": "^2.2.0", | ||
"@secretlint/profiler": "^2.2.0", | ||
"@secretlint/source-creator": "^2.2.0", | ||
"debug": "^4.1.1", | ||
@@ -54,12 +54,12 @@ "p-map": "^4.0.0" | ||
"devDependencies": { | ||
"@secretlint/secretlint-rule-example": "^2.1.1", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^13.9.3", | ||
"cross-env": "^7.0.0", | ||
"mocha": "^7.1.1", | ||
"@secretlint/secretlint-rule-example": "^2.2.0", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^14.14.41", | ||
"cross-env": "^7.0.3", | ||
"mocha": "^8.3.2", | ||
"prettier": "^2.0.2", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^8.8.1", | ||
"ts-node-test-register": "^8.0.1", | ||
"typescript": "^3.8.2" | ||
"ts-node": "^9.0.0", | ||
"ts-node-test-register": "^9.0.1", | ||
"typescript": "^4.0.5" | ||
}, | ||
@@ -69,3 +69,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "ee794cdf7b9aa5f2ec756e361d269b24b6e40070" | ||
"gitHead": "64bf33d6ee6e31a8416bf2bde6ee27a700955fb1" | ||
} |
@@ -9,3 +9,3 @@ import { lintSource } from "@secretlint/core"; | ||
SecretLintCoreResult, | ||
SecretLintRuleLocaleTag | ||
SecretLintRuleLocaleTag, | ||
} from "@secretlint/types"; | ||
@@ -69,4 +69,4 @@ import os from "os"; | ||
locale: options.locale, | ||
config: config | ||
} | ||
config: config, | ||
}, | ||
}); | ||
@@ -82,3 +82,3 @@ }; | ||
config, | ||
options | ||
options, | ||
}: { | ||
@@ -97,12 +97,12 @@ content: string; | ||
ext: path.extname(filePath), | ||
contentType: "text" | ||
contentType: "text", | ||
}, | ||
options: { | ||
locale: options.locale, | ||
config | ||
} | ||
config, | ||
}, | ||
}); | ||
debug("executeOnContent result: %o", result); | ||
secretLintProfiler.mark({ | ||
type: "@node>format::start" | ||
type: "@node>format::start", | ||
}); | ||
@@ -112,11 +112,11 @@ const formatter = createFormatter({ | ||
formatterName: options.formatter, | ||
terminalLink: options.terminalLink ?? false | ||
terminalLink: options.terminalLink ?? false, | ||
}); | ||
const output = formatter.format([result]); | ||
secretLintProfiler.mark({ | ||
type: "@node>format::end" | ||
type: "@node>format::end", | ||
}); | ||
return { | ||
ok: !hasErrorMessage(result), | ||
output: output | ||
output: output, | ||
}; | ||
@@ -128,3 +128,3 @@ }; | ||
config, | ||
options | ||
options, | ||
}: { | ||
@@ -144,7 +144,7 @@ filePathList: string[]; | ||
// https://github.com/secretlint/secretlint/issues/72 | ||
concurrency: os.cpus().length | ||
concurrency: os.cpus().length, | ||
}); | ||
debug("executeOnFiles result counts: %s", results.length); | ||
secretLintProfiler.mark({ | ||
type: "@node>format::start" | ||
type: "@node>format::start", | ||
}); | ||
@@ -154,9 +154,9 @@ const formatter = createFormatter({ | ||
formatterName: options.formatter, | ||
terminalLink: options.terminalLink ?? false | ||
terminalLink: options.terminalLink ?? false, | ||
}); | ||
const output = formatter.format(results); | ||
secretLintProfiler.mark({ | ||
type: "@node>format::end" | ||
type: "@node>format::end", | ||
}); | ||
const hasErrorAtLeastOne = results.some(result => { | ||
const hasErrorAtLeastOne = results.some((result) => { | ||
return hasErrorMessage(result); | ||
@@ -166,3 +166,3 @@ }); | ||
ok: !hasErrorAtLeastOne, | ||
output: output | ||
output: output, | ||
}; | ||
@@ -178,3 +178,3 @@ }; | ||
secretLintProfiler.mark({ | ||
type: "@node>load-config::start" | ||
type: "@node>load-config::start", | ||
}); | ||
@@ -185,3 +185,3 @@ const loadedResult = (() => { | ||
return loadPackagesFromRawConfig({ | ||
rawConfig: options.configFileJSON | ||
rawConfig: options.configFileJSON, | ||
}); | ||
@@ -191,3 +191,3 @@ } | ||
cwd: options.cwd, | ||
configFilePath: options.configFilePath | ||
configFilePath: options.configFilePath, | ||
}); | ||
@@ -198,6 +198,6 @@ debug("Loaded ConfigFilePath: %s", loadConfigResult.configFilePath); | ||
secretLintProfiler.mark({ | ||
type: "@node>load-config::end" | ||
type: "@node>load-config::end", | ||
}); | ||
if (!loadedResult.ok) { | ||
throw new Error(loadedResult.errors.map(error => error.stack).join("\n\n")); | ||
throw new Error(loadedResult.errors.map((error) => error.stack).join("\n\n")); | ||
} | ||
@@ -215,3 +215,3 @@ debug("Config: %O", loadedResult.config); | ||
secretLintProfiler.mark({ | ||
type: "@node>execute::start" | ||
type: "@node>execute::start", | ||
}); | ||
@@ -222,6 +222,6 @@ return executeOnContent({ | ||
config: loadedResult.config, | ||
options: options | ||
options: options, | ||
}).finally(() => { | ||
secretLintProfiler.mark({ | ||
type: "@node>execute::end" | ||
type: "@node>execute::end", | ||
}); | ||
@@ -237,3 +237,3 @@ }); | ||
secretLintProfiler.mark({ | ||
type: "@node>execute::start" | ||
type: "@node>execute::start", | ||
}); | ||
@@ -243,10 +243,10 @@ return executeOnFiles({ | ||
config: loadedResult.config, | ||
options: options | ||
options: options, | ||
}).finally(() => { | ||
secretLintProfiler.mark({ | ||
type: "@node>execute::end" | ||
type: "@node>execute::end", | ||
}); | ||
}); | ||
} | ||
}, | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
480
25732
7