@commitlint/load 14.1.0 → 16.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/lib/load.d.ts.map +1 -1
- package/lib/load.js +36 -43
- package/lib/load.js.map +1 -1
- package/lib/utils/load-config.js +3 -3
- package/lib/utils/load-config.js.map +1 -1
- package/lib/utils/load-parser-opts.d.ts +4 -1
- package/lib/utils/load-parser-opts.d.ts.map +1 -1
- package/lib/utils/load-parser-opts.js +34 -19
- package/lib/utils/load-parser-opts.js.map +1 -1
- package/package.json +11 -9
- package/lib/utils/pick-config.d.ts +0 -3
- package/lib/utils/pick-config.d.ts.map +0 -1
- package/lib/utils/pick-config.js +0 -10
- package/lib/utils/pick-config.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,55 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [16.2.1](https://github.com/conventional-changelog/commitlint/compare/v16.2.0...v16.2.1) (2022-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **load:** satisfy @types/node peer dependency for cosmiconfig-loader-typescript ([#3008](https://github.com/conventional-changelog/commitlint/issues/3008)) ([338180c](https://github.com/conventional-changelog/commitlint/commit/338180c7174625cddd7a0ea2b9d2786fee375756)), closes [#3007](https://github.com/conventional-changelog/commitlint/issues/3007)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [16.1.0](https://github.com/conventional-changelog/commitlint/compare/v16.0.3...v16.1.0) (2022-01-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **load:** accept functions as parser presets ([#2982](https://github.com/conventional-changelog/commitlint/issues/2982)) ([420e8d6](https://github.com/conventional-changelog/commitlint/commit/420e8d6a4d5663ade953272275a9e0fa7c5ddff0)), closes [#2964](https://github.com/conventional-changelog/commitlint/issues/2964) [#2964](https://github.com/conventional-changelog/commitlint/issues/2964)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [16.0.0](https://github.com/conventional-changelog/commitlint/compare/v15.0.0...v16.0.0) (2021-12-26)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* config validation ([#2412](https://github.com/conventional-changelog/commitlint/issues/2412)) ([c717202](https://github.com/conventional-changelog/commitlint/commit/c7172022097b11f46b33617e4a94d751243c1049)), closes [#327](https://github.com/conventional-changelog/commitlint/issues/327)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# [15.0.0](https://github.com/conventional-changelog/commitlint/compare/v14.2.0...v15.0.0) (2021-11-17)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* **types:** fix signature of QualifiedRuleConfig for async configurations ([#2868](https://github.com/conventional-changelog/commitlint/issues/2868)) ([#2869](https://github.com/conventional-changelog/commitlint/issues/2869)) ([c7f355b](https://github.com/conventional-changelog/commitlint/commit/c7f355b25e5baddab0b9559892f5ce4112e4f93a))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* simplify config resolution ([#2398](https://github.com/conventional-changelog/commitlint/issues/2398)) ([8a8384f](https://github.com/conventional-changelog/commitlint/commit/8a8384f3c18954447cb633e76a573e1db71a1440)), closes [#327](https://github.com/conventional-changelog/commitlint/issues/327)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
6
55
|
# [14.1.0](https://github.com/conventional-changelog/commitlint/compare/v14.0.0...v14.1.0) (2021-11-01)
|
|
7
56
|
|
|
8
57
|
|
package/lib/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,WAAW,EACX,eAAe,EAGf,UAAU,EACV,MAAM,mBAAmB,CAAC;AAU3B,wBAA8B,IAAI,CACjC,IAAI,GAAE,UAAe,EACrB,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,eAAe,CAAC,CA6F1B"}
|
package/lib/load.js
CHANGED
|
@@ -5,27 +5,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const execute_rule_1 = __importDefault(require("@commitlint/execute-rule"));
|
|
7
7
|
const resolve_extends_1 = __importDefault(require("@commitlint/resolve-extends"));
|
|
8
|
+
const config_validator_1 = require("@commitlint/config-validator");
|
|
8
9
|
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
9
10
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
10
|
-
const
|
|
11
|
-
const pick_1 = __importDefault(require("lodash/pick"));
|
|
12
|
-
const union_1 = __importDefault(require("lodash/union"));
|
|
11
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
13
12
|
const path_1 = __importDefault(require("path"));
|
|
14
13
|
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
15
14
|
const load_config_1 = require("./utils/load-config");
|
|
16
15
|
const load_parser_opts_1 = require("./utils/load-parser-opts");
|
|
17
16
|
const load_plugin_1 = __importDefault(require("./utils/load-plugin"));
|
|
18
|
-
const pick_config_1 = require("./utils/pick-config");
|
|
19
|
-
const w = (_, b) => Array.isArray(b) ? b : undefined;
|
|
20
17
|
async function load(seed = {}, options = {}) {
|
|
21
18
|
const cwd = typeof options.cwd === 'undefined' ? process.cwd() : options.cwd;
|
|
22
19
|
const loaded = await (0, load_config_1.loadConfig)(cwd, options.file);
|
|
23
20
|
const base = loaded && loaded.filepath ? path_1.default.dirname(loaded.filepath) : cwd;
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
let config = {};
|
|
22
|
+
if (loaded) {
|
|
23
|
+
(0, config_validator_1.validateConfig)(loaded.filepath || '', loaded.config);
|
|
24
|
+
config = loaded.config;
|
|
25
|
+
}
|
|
26
26
|
// Merge passed config with file based options
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
config = (0, merge_1.default)({
|
|
28
|
+
extends: [],
|
|
29
|
+
plugins: [],
|
|
30
|
+
rules: {},
|
|
31
|
+
}, config, seed);
|
|
29
32
|
// Resolve parserPreset key
|
|
30
33
|
if (typeof config.parserPreset === 'string') {
|
|
31
34
|
const resolvedParserPreset = (0, resolve_from_1.default)(base, config.parserPreset);
|
|
@@ -36,43 +39,27 @@ async function load(seed = {}, options = {}) {
|
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
41
|
// Resolve extends key
|
|
39
|
-
const extended = (0, resolve_extends_1.default)(
|
|
42
|
+
const extended = (0, resolve_extends_1.default)(config, {
|
|
40
43
|
prefix: 'commitlint-config',
|
|
41
44
|
cwd: base,
|
|
42
45
|
parserPreset: config.parserPreset,
|
|
43
46
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// TODO: check if this is still necessary with the new factory based conventional changelog parsers
|
|
47
|
-
// config.extends = Array.isArray(config.extends) ? config.extends : [];
|
|
48
|
-
// Resolve parser-opts from preset
|
|
49
|
-
if (typeof preset.parserPreset === 'object') {
|
|
50
|
-
preset.parserPreset.parserOpts = await (0, load_parser_opts_1.loadParserOpts)(preset.parserPreset.name,
|
|
51
|
-
// TODO: fix the types for factory based conventional changelog parsers
|
|
52
|
-
preset.parserPreset);
|
|
53
|
-
}
|
|
54
|
-
// Resolve config-relative formatter module
|
|
55
|
-
if (typeof config.formatter === 'string') {
|
|
56
|
-
preset.formatter =
|
|
57
|
-
resolve_from_1.default.silent(base, config.formatter) || config.formatter;
|
|
47
|
+
if (!extended.formatter || typeof extended.formatter !== 'string') {
|
|
48
|
+
extended.formatter = '@commitlint/format';
|
|
58
49
|
}
|
|
59
|
-
|
|
50
|
+
let plugins = {};
|
|
60
51
|
if (Array.isArray(extended.plugins)) {
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
// resolve plugins
|
|
64
|
-
if (Array.isArray(config.plugins)) {
|
|
65
|
-
config.plugins.forEach((plugin) => {
|
|
52
|
+
(0, uniq_1.default)(extended.plugins || []).forEach((plugin) => {
|
|
66
53
|
if (typeof plugin === 'string') {
|
|
67
|
-
(0, load_plugin_1.default)(
|
|
54
|
+
plugins = (0, load_plugin_1.default)(plugins, plugin, process.env.DEBUG === 'true');
|
|
68
55
|
}
|
|
69
56
|
else {
|
|
70
|
-
|
|
57
|
+
plugins.local = plugin;
|
|
71
58
|
}
|
|
72
59
|
});
|
|
73
60
|
}
|
|
74
|
-
const rules =
|
|
75
|
-
|
|
61
|
+
const rules = (await Promise.all(Object.entries(extended.rules || {}).map((entry) => (0, execute_rule_1.default)(entry)))).reduce((registry, item) => {
|
|
62
|
+
// type of `item` can be null, but Object.entries always returns key pair
|
|
76
63
|
const [key, value] = item;
|
|
77
64
|
registry[key] = value;
|
|
78
65
|
return registry;
|
|
@@ -82,16 +69,22 @@ async function load(seed = {}, options = {}) {
|
|
|
82
69
|
: typeof config.helpUrl === 'string'
|
|
83
70
|
? config.helpUrl
|
|
84
71
|
: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint';
|
|
85
|
-
const prompt =
|
|
72
|
+
const prompt = extended.prompt && (0, isPlainObject_1.default)(extended.prompt) ? extended.prompt : {};
|
|
86
73
|
return {
|
|
87
|
-
extends:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
74
|
+
extends: Array.isArray(extended.extends)
|
|
75
|
+
? extended.extends
|
|
76
|
+
: typeof extended.extends === 'string'
|
|
77
|
+
? [extended.extends]
|
|
78
|
+
: [],
|
|
79
|
+
// Resolve config-relative formatter module
|
|
80
|
+
formatter: resolve_from_1.default.silent(base, extended.formatter) || extended.formatter,
|
|
81
|
+
// Resolve parser-opts from preset
|
|
82
|
+
parserPreset: await (0, load_parser_opts_1.loadParserOpts)(extended.parserPreset),
|
|
83
|
+
ignores: extended.ignores,
|
|
84
|
+
defaultIgnores: extended.defaultIgnores,
|
|
85
|
+
plugins: plugins,
|
|
86
|
+
rules: rules,
|
|
87
|
+
helpUrl: helpUrl,
|
|
95
88
|
prompt,
|
|
96
89
|
};
|
|
97
90
|
}
|
package/lib/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":";;;;;AAAA,4EAAmD;AACnD,kFAAyD;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":";;;;;AAAA,4EAAmD;AACnD,kFAAyD;AACzD,mEAA4D;AAQ5D,yEAAiD;AACjD,yDAAiC;AACjC,uDAA+B;AAC/B,gDAAwB;AACxB,gEAAuC;AACvC,qDAA+C;AAC/C,+DAAwD;AACxD,sEAA6C;AAE9B,KAAK,UAAU,IAAI,CACjC,OAAmB,EAAE,EACrB,UAAuB,EAAE;IAEzB,MAAM,GAAG,GAAG,OAAO,OAAO,CAAC,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC7E,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAU,EAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,MAAM,CA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AAC,CAAC,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;gBACtC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACpB,CAAC,CAAC,EAAE;QACL,2CAA2C;QAC3C,SAAS,EACR,sBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,SAAS;QACnE,kCAAkC;QAClC,YAAY,EAAE,MAAM,IAAA,iCAAc,EAAC,QAAQ,CAAC,YAAY,CAAC;QACzD,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,OAAO;QAChB,MAAM;KACN,CAAC;AACH,CAAC;AAhGD,uBAgGC"}
|
package/lib/utils/load-config.js
CHANGED
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadConfig = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
7
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
9
|
-
const cosmiconfig_typescript_loader_1 = __importDefault(require("
|
|
8
|
+
const cosmiconfig_typescript_loader_1 = __importDefault(require("cosmiconfig-typescript-loader"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
10
|
async function loadConfig(cwd, configPath) {
|
|
11
11
|
const moduleName = 'commitlint';
|
|
12
12
|
const explorer = (0, cosmiconfig_1.cosmiconfig)(moduleName, {
|
|
@@ -27,7 +27,7 @@ async function loadConfig(cwd, configPath) {
|
|
|
27
27
|
`${moduleName}.config.ts`,
|
|
28
28
|
],
|
|
29
29
|
loaders: {
|
|
30
|
-
'.ts': cosmiconfig_typescript_loader_1.default,
|
|
30
|
+
'.ts': (0, cosmiconfig_typescript_loader_1.default)(),
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
33
|
const explicitPath = configPath ? path_1.default.resolve(cwd, configPath) : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAwC;AACxC,kGAA6D;AAC7D,gDAAwB;AAQjB,KAAK,UAAU,UAAU,CAC/B,GAAW,EACX,UAAmB;IAEnB,MAAM,UAAU,GAAG,YAAY,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,UAAU,EAAE;QACxC,YAAY,EAAE;YACb,uGAAuG;YACvG,gHAAgH;YAChH,cAAc;YACd,IAAI,UAAU,IAAI;YAClB,IAAI,UAAU,SAAS;YACvB,IAAI,UAAU,SAAS;YACvB,IAAI,UAAU,QAAQ;YACtB,IAAI,UAAU,OAAO;YACrB,IAAI,UAAU,QAAQ;YACtB,GAAG,UAAU,YAAY;YACzB,GAAG,UAAU,aAAa;YAE1B,sCAAsC;YACtC,IAAI,UAAU,OAAO;YACrB,GAAG,UAAU,YAAY;SACzB;QACD,OAAO,EAAE;YACR,KAAK,EAAE,IAAA,uCAAgB,GAAE;SACzB;KACD,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC/D,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IACrD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAExC,IAAI,KAAK,EAAE;QACV,OAAO,KAAK,CAAC;KACb;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAtCD,gCAsCC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ParserPreset } from '@commitlint/types';
|
|
2
|
+
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
3
|
+
export declare function loadParserOpts(pendingParser: string | Awaitable<ParserPreset> | (() => Awaitable<ParserPreset>) | undefined): Promise<ParserPreset | undefined>;
|
|
4
|
+
export {};
|
|
2
5
|
//# sourceMappingURL=load-parser-opts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-parser-opts.d.ts","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":"AAAA,wBAAsB,cAAc,CACnC,
|
|
1
|
+
{"version":3,"file":"load-parser-opts.d.ts","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C,aAAK,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAgBvC,wBAAsB,cAAc,CACnC,aAAa,EACV,MAAM,GACN,SAAS,CAAC,YAAY,CAAC,GACvB,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,CAAC,GAC/B,SAAS,GACV,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA0DnC"}
|
|
@@ -1,39 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadParserOpts = void 0;
|
|
4
|
-
|
|
4
|
+
function isObjectLike(obj) {
|
|
5
|
+
return Boolean(obj) && typeof obj === 'object'; // typeof null === 'object'
|
|
6
|
+
}
|
|
7
|
+
function isParserOptsFunction(obj) {
|
|
8
|
+
return typeof obj.parserOpts === 'function';
|
|
9
|
+
}
|
|
10
|
+
async function loadParserOpts(pendingParser) {
|
|
11
|
+
if (typeof pendingParser === 'function') {
|
|
12
|
+
return loadParserOpts(pendingParser());
|
|
13
|
+
}
|
|
14
|
+
if (!pendingParser || typeof pendingParser !== 'object') {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
5
17
|
// Await for the module, loaded with require
|
|
6
18
|
const parser = await pendingParser;
|
|
7
|
-
//
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
// exit early, no opts to resolve
|
|
20
|
+
if (!parser.parserOpts) {
|
|
21
|
+
return parser;
|
|
22
|
+
}
|
|
23
|
+
// Pull nested parserOpts, might happen if overwritten with a module in main config
|
|
24
|
+
if (typeof parser.parserOpts === 'object') {
|
|
25
|
+
// Await parser opts if applicable
|
|
26
|
+
parser.parserOpts = await parser.parserOpts;
|
|
27
|
+
if (isObjectLike(parser.parserOpts) &&
|
|
28
|
+
isObjectLike(parser.parserOpts.parserOpts)) {
|
|
29
|
+
parser.parserOpts = parser.parserOpts.parserOpts;
|
|
30
|
+
}
|
|
31
|
+
return parser;
|
|
12
32
|
}
|
|
13
33
|
// Create parser opts from factory
|
|
14
|
-
if (
|
|
15
|
-
typeof parser.
|
|
16
|
-
|
|
17
|
-
return
|
|
34
|
+
if (isParserOptsFunction(parser) &&
|
|
35
|
+
typeof parser.name === 'string' &&
|
|
36
|
+
parser.name.startsWith('conventional-changelog-')) {
|
|
37
|
+
return new Promise((resolve) => {
|
|
18
38
|
const result = parser.parserOpts((_, opts) => {
|
|
19
|
-
resolve(opts.parserOpts);
|
|
39
|
+
resolve(Object.assign(Object.assign({}, parser), { parserOpts: opts === null || opts === void 0 ? void 0 : opts.parserOpts }));
|
|
20
40
|
});
|
|
21
41
|
// If result has data or a promise, the parser doesn't support factory-init
|
|
22
42
|
// due to https://github.com/nodejs/promises-debugging/issues/16 it just quits, so let's use this fallback
|
|
23
43
|
if (result) {
|
|
24
44
|
Promise.resolve(result).then((opts) => {
|
|
25
|
-
resolve(opts.parserOpts);
|
|
45
|
+
resolve(Object.assign(Object.assign({}, parser), { parserOpts: opts === null || opts === void 0 ? void 0 : opts.parserOpts }));
|
|
26
46
|
});
|
|
27
47
|
}
|
|
48
|
+
return;
|
|
28
49
|
});
|
|
29
50
|
}
|
|
30
|
-
|
|
31
|
-
if (typeof parser === 'object' &&
|
|
32
|
-
typeof parser.parserOpts === 'object' &&
|
|
33
|
-
typeof parser.parserOpts.parserOpts === 'object') {
|
|
34
|
-
return parser.parserOpts.parserOpts;
|
|
35
|
-
}
|
|
36
|
-
return parser.parserOpts;
|
|
51
|
+
return parser;
|
|
37
52
|
}
|
|
38
53
|
exports.loadParserOpts = loadParserOpts;
|
|
39
54
|
//# sourceMappingURL=load-parser-opts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-parser-opts.js","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"load-parser-opts.js","sourceRoot":"","sources":["../../src/utils/load-parser-opts.ts"],"names":[],"mappings":";;;AAIA,SAAS,YAAY,CAAC,GAAY;IACjC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,2BAA2B;AAC5E,CAAC;AAED,SAAS,oBAAoB,CAC5B,GAAM;IAMN,OAAO,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU,CAAC;AAC7C,CAAC;AAEM,KAAK,UAAU,cAAc,CACnC,aAIY;IAEZ,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;QACxC,OAAO,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC;KACvC;IAED,IAAI,CAAC,aAAa,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QACxD,OAAO,SAAS,CAAC;KACjB;IACD,4CAA4C;IAC5C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;IAEnC,iCA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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/load",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.2.1",
|
|
4
4
|
"description": "Load shared commitlint configuration",
|
|
5
5
|
"main": "lib/load.js",
|
|
6
6
|
"types": "lib/load.d.ts",
|
|
@@ -35,22 +35,24 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@commitlint/test": "^
|
|
39
|
-
"@commitlint/utils": "^
|
|
40
|
-
"@types/lodash": "4.14.
|
|
38
|
+
"@commitlint/test": "^16.0.0",
|
|
39
|
+
"@commitlint/utils": "^16.2.1",
|
|
40
|
+
"@types/lodash": "4.14.178",
|
|
41
41
|
"conventional-changelog-atom": "^2.0.8",
|
|
42
42
|
"execa": "^5.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@commitlint/
|
|
46
|
-
"@commitlint/
|
|
47
|
-
"@commitlint/
|
|
48
|
-
"@
|
|
45
|
+
"@commitlint/config-validator": "^16.2.1",
|
|
46
|
+
"@commitlint/execute-rule": "^16.2.1",
|
|
47
|
+
"@commitlint/resolve-extends": "^16.2.1",
|
|
48
|
+
"@commitlint/types": "^16.2.1",
|
|
49
|
+
"@types/node": ">=12",
|
|
49
50
|
"chalk": "^4.0.0",
|
|
50
51
|
"cosmiconfig": "^7.0.0",
|
|
52
|
+
"cosmiconfig-typescript-loader": "^1.0.0",
|
|
51
53
|
"lodash": "^4.17.19",
|
|
52
54
|
"resolve-from": "^5.0.0",
|
|
53
55
|
"typescript": "^4.4.3"
|
|
54
56
|
},
|
|
55
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "071cce297f207ebcaf9cfa00e23542b7e0a550e8"
|
|
56
58
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pick-config.d.ts","sourceRoot":"","sources":["../../src/utils/pick-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAG7C,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,UAY1C,CAAC"}
|
package/lib/utils/pick-config.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pickConfig = void 0;
|
|
7
|
-
const pick_1 = __importDefault(require("lodash/pick"));
|
|
8
|
-
const pickConfig = (input) => (0, pick_1.default)(input, 'extends', 'rules', 'plugins', 'parserPreset', 'formatter', 'ignores', 'defaultIgnores', 'helpUrl', 'prompt');
|
|
9
|
-
exports.pickConfig = pickConfig;
|
|
10
|
-
//# sourceMappingURL=pick-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pick-config.js","sourceRoot":"","sources":["../../src/utils/pick-config.ts"],"names":[],"mappings":";;;;;;AACA,uDAA+B;AAExB,MAAM,UAAU,GAAG,CAAC,KAAc,EAAc,EAAE,CACxD,IAAA,cAAI,EACH,KAAK,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,cAAc,EACd,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,QAAQ,CACR,CAAC;AAZU,QAAA,UAAU,cAYpB"}
|