@commitlint/load 18.2.0 → 18.4.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.
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { Options } from 'cosmiconfig';
|
|
1
2
|
export interface LoadConfigResult {
|
|
2
3
|
config: unknown;
|
|
3
4
|
filepath: string;
|
|
4
5
|
isEmpty?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function loadConfig(cwd: string, configPath?: string): Promise<LoadConfigResult | null>;
|
|
8
|
+
export declare const isDynamicAwaitSupported: () => boolean;
|
|
9
|
+
export declare const getDynamicAwaitConfig: () => Partial<Options>;
|
|
7
10
|
//# sourceMappingURL=load-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/utils/load-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,OAAO,EAEP,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAID,wBAAsB,UAAU,CAC/B,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAmDlC;AAKD,eAAO,MAAM,uBAAuB,eAOnC,CAAC;AAIF,eAAO,MAAM,qBAAqB,QAAO,QAAQ,OAAO,CAYnD,CAAC"}
|
package/lib/utils/load-config.js
CHANGED
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.loadConfig = void 0;
|
|
6
|
+
exports.getDynamicAwaitConfig = exports.isDynamicAwaitSupported = exports.loadConfig = void 0;
|
|
7
7
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
8
8
|
const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const moduleName = 'commitlint';
|
|
10
11
|
async function loadConfig(cwd, configPath) {
|
|
11
|
-
const moduleName = 'commitlint';
|
|
12
12
|
let tsLoaderInstance;
|
|
13
13
|
const tsLoader = (...args) => {
|
|
14
14
|
if (!tsLoaderInstance) {
|
|
@@ -16,6 +16,7 @@ async function loadConfig(cwd, configPath) {
|
|
|
16
16
|
}
|
|
17
17
|
return tsLoaderInstance(...args);
|
|
18
18
|
};
|
|
19
|
+
const { searchPlaces, loaders } = (0, exports.getDynamicAwaitConfig)();
|
|
19
20
|
const explorer = (0, cosmiconfig_1.cosmiconfig)(moduleName, {
|
|
20
21
|
searchPlaces: [
|
|
21
22
|
// cosmiconfig overrides default searchPlaces if any new search place is added (For e.g. `*.ts` files),
|
|
@@ -34,11 +35,9 @@ async function loadConfig(cwd, configPath) {
|
|
|
34
35
|
`.${moduleName}rc.cts`,
|
|
35
36
|
`${moduleName}.config.ts`,
|
|
36
37
|
`${moduleName}.config.cts`,
|
|
38
|
+
...(searchPlaces || []),
|
|
37
39
|
],
|
|
38
|
-
loaders: {
|
|
39
|
-
'.ts': tsLoader,
|
|
40
|
-
'.cts': tsLoader,
|
|
41
|
-
},
|
|
40
|
+
loaders: Object.assign({ '.ts': tsLoader, '.cts': tsLoader }, (loaders || {})),
|
|
42
41
|
});
|
|
43
42
|
const explicitPath = configPath ? path_1.default.resolve(cwd, configPath) : undefined;
|
|
44
43
|
const explore = explicitPath ? explorer.load : explorer.search;
|
|
@@ -50,4 +49,30 @@ async function loadConfig(cwd, configPath) {
|
|
|
50
49
|
return null;
|
|
51
50
|
}
|
|
52
51
|
exports.loadConfig = loadConfig;
|
|
52
|
+
// See the following issues for more context:
|
|
53
|
+
// - Issue: https://github.com/nodejs/node/issues/40058
|
|
54
|
+
// - Resolution: https://github.com/nodejs/node/pull/48510 (Node v20.8.0)
|
|
55
|
+
const isDynamicAwaitSupported = () => {
|
|
56
|
+
const [major, minor] = process.version
|
|
57
|
+
.replace('v', '')
|
|
58
|
+
.split('.')
|
|
59
|
+
.map((val) => parseInt(val));
|
|
60
|
+
return major >= 20 && minor >= 8;
|
|
61
|
+
};
|
|
62
|
+
exports.isDynamicAwaitSupported = isDynamicAwaitSupported;
|
|
63
|
+
// If dynamic await is supported (Node >= v20.8.0), support mjs config.
|
|
64
|
+
// Otherwise, don't support mjs and use synchronous js/cjs loaders.
|
|
65
|
+
const getDynamicAwaitConfig = () => (0, exports.isDynamicAwaitSupported)()
|
|
66
|
+
? {
|
|
67
|
+
searchPlaces: [`.${moduleName}rc.mjs`, `${moduleName}.config.mjs`],
|
|
68
|
+
loaders: {},
|
|
69
|
+
}
|
|
70
|
+
: {
|
|
71
|
+
searchPlaces: [],
|
|
72
|
+
loaders: {
|
|
73
|
+
'.cjs': cosmiconfig_1.defaultLoadersSync['.cjs'],
|
|
74
|
+
'.js': cosmiconfig_1.defaultLoadersSync['.js'],
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
exports.getDynamicAwaitConfig = getDynamicAwaitConfig;
|
|
53
78
|
//# sourceMappingURL=load-config.js.map
|
|
@@ -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,6CAKqB;AACrB,iFAA+D;AAC/D,gDAAwB;AAQxB,MAAM,UAAU,GAAG,YAAY,CAAC;AAEzB,KAAK,UAAU,UAAU,CAC/B,GAAW,EACX,UAAmB;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AM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAExC,IAAI,KAAK,EAAE;QACV,OAAO,KAAK,CAAC;KACb;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAtDD,gCAsDC;AAED,6CAA6C;AAC7C,wDAAwD;AACxD,0EAA0E;AACnE,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC3C,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO;SACpC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;SAChB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAE9B,OAAO,KAAK,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AAPW,QAAA,uBAAuB,2BAOlC;AAEF,uEAAuE;AACvE,mEAAmE;AAC5D,MAAM,qBAAqB,GAAG,GAAqB,EAAE,CAC3D,IAAA,+BAAuB,GAAE;IACxB,CAAC,CAAC;QACA,YAAY,EAAE,CAAC,IAAI,UAAU,QAAQ,EAAE,GAAG,UAAU,aAAa,CAAC;QAClE,OAAO,EAAE,EAAE;KACV;IACH,CAAC,CAAC;QACA,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE;YACR,MAAM,EAAE,gCAAkB,CAAC,MAAM,CAAC;YAClC,KAAK,EAAE,gCAAkB,CAAC,KAAK,CAAC;SAChC;KACA,CAAC;AAZO,QAAA,qBAAqB,yBAY5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/load",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.4.1",
|
|
4
4
|
"description": "Load shared commitlint configuration",
|
|
5
5
|
"main": "lib/load.js",
|
|
6
6
|
"types": "lib/load.d.ts",
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"typescript": "^5.2.2"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@commitlint/config-validator": "^18.
|
|
48
|
-
"@commitlint/execute-rule": "^18.
|
|
49
|
-
"@commitlint/resolve-extends": "^18.
|
|
50
|
-
"@commitlint/types": "^18.
|
|
47
|
+
"@commitlint/config-validator": "^18.4.0",
|
|
48
|
+
"@commitlint/execute-rule": "^18.4.0",
|
|
49
|
+
"@commitlint/resolve-extends": "^18.4.0",
|
|
50
|
+
"@commitlint/types": "^18.4.0",
|
|
51
51
|
"@types/node": "^18.11.9",
|
|
52
52
|
"chalk": "^4.1.0",
|
|
53
|
-
"cosmiconfig": "^8.
|
|
53
|
+
"cosmiconfig": "^8.3.6",
|
|
54
54
|
"cosmiconfig-typescript-loader": "^5.0.0",
|
|
55
55
|
"lodash.isplainobject": "^4.0.6",
|
|
56
56
|
"lodash.merge": "^4.6.2",
|
|
57
57
|
"lodash.uniq": "^4.5.0",
|
|
58
58
|
"resolve-from": "^5.0.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "74b2f82803dedc1c3ea880878e9f27e1d4bd9be6"
|
|
61
61
|
}
|