Socket
Socket
Sign inDemoInstall

@commitlint/load

Package Overview
Dependencies
Maintainers
4
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/load - npm Package Compare versions

Comparing version 18.2.0 to 18.4.0

3

lib/utils/load-config.d.ts

@@ -0,1 +1,2 @@

import { Options } from 'cosmiconfig';
export interface LoadConfigResult {

@@ -7,2 +8,4 @@ config: unknown;

export declare function loadConfig(cwd: string, configPath?: string): Promise<LoadConfigResult | null>;
export declare const isDynamicAwaitSupported: () => boolean;
export declare const getDynamicAwaitConfig: () => Partial<Options>;
//# sourceMappingURL=load-config.d.ts.map

@@ -6,8 +6,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.loadConfig = void 0;
exports.getDynamicAwaitConfig = exports.isDynamicAwaitSupported = exports.loadConfig = void 0;
const cosmiconfig_1 = require("cosmiconfig");
const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader");
const path_1 = __importDefault(require("path"));
const moduleName = 'commitlint';
async function loadConfig(cwd, configPath) {
const moduleName = 'commitlint';
let tsLoaderInstance;

@@ -20,2 +20,3 @@ const tsLoader = (...args) => {

};
const { searchPlaces, loaders } = (0, exports.getDynamicAwaitConfig)();
const explorer = (0, cosmiconfig_1.cosmiconfig)(moduleName, {

@@ -39,7 +40,5 @@ searchPlaces: [

`${moduleName}.config.cts`,
...(searchPlaces || []),
],
loaders: {
'.ts': tsLoader,
'.cts': tsLoader,
},
loaders: Object.assign({ '.ts': tsLoader, '.cts': tsLoader }, (loaders || {})),
});

@@ -56,2 +55,28 @@ const explicitPath = configPath ? path_1.default.resolve(cwd, configPath) : undefined;

exports.loadConfig = loadConfig;
// See the following issues for more context:
// - Issue: https://github.com/nodejs/node/issues/40058
// - Resolution: https://github.com/nodejs/node/pull/48510 (Node v20.8.0)
const isDynamicAwaitSupported = () => {
const [major, minor] = process.version
.replace('v', '')
.split('.')
.map((val) => parseInt(val));
return major >= 20 && minor >= 8;
};
exports.isDynamicAwaitSupported = isDynamicAwaitSupported;
// If dynamic await is supported (Node >= v20.8.0), support mjs config.
// Otherwise, don't support mjs and use synchronous js/cjs loaders.
const getDynamicAwaitConfig = () => (0, exports.isDynamicAwaitSupported)()
? {
searchPlaces: [`.${moduleName}rc.mjs`, `${moduleName}.config.mjs`],
loaders: {},
}
: {
searchPlaces: [],
loaders: {
'.cjs': cosmiconfig_1.defaultLoadersSync['.cjs'],
'.js': cosmiconfig_1.defaultLoadersSync['.js'],
},
};
exports.getDynamicAwaitConfig = getDynamicAwaitConfig;
//# sourceMappingURL=load-config.js.map

12

package.json
{
"name": "@commitlint/load",
"version": "18.2.0",
"version": "18.4.0",
"description": "Load shared commitlint configuration",

@@ -47,6 +47,6 @@ "main": "lib/load.js",

"dependencies": {
"@commitlint/config-validator": "^18.1.0",
"@commitlint/execute-rule": "^18.1.0",
"@commitlint/resolve-extends": "^18.1.0",
"@commitlint/types": "^18.1.0",
"@commitlint/config-validator": "^18.4.0",
"@commitlint/execute-rule": "^18.4.0",
"@commitlint/resolve-extends": "^18.4.0",
"@commitlint/types": "^18.4.0",
"@types/node": "^18.11.9",

@@ -61,3 +61,3 @@ "chalk": "^4.1.0",

},
"gitHead": "9b80b6edfb724f385100f660879df3b45ab276f4"
"gitHead": "0546cd735eceada6470c9d5c544c7f5c450b87e3"
}

Sorry, the diff of this file is not supported yet

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