Socket
Socket
Sign inDemoInstall

@commitlint/load

Package Overview
Dependencies
Maintainers
4
Versions
86
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 19.1.0 to 19.2.0

9

lib/load.js

@@ -25,4 +25,4 @@ import path from 'path';

const loaded = await loadConfig(cwd, options.file);
const baseDirectory = (loaded === null || loaded === void 0 ? void 0 : loaded.filepath) ? path.dirname(loaded.filepath) : cwd;
const configFilePath = loaded === null || loaded === void 0 ? void 0 : loaded.filepath;
const baseDirectory = loaded?.filepath ? path.dirname(loaded.filepath) : cwd;
const configFilePath = loaded?.filepath;
let config = {};

@@ -42,3 +42,6 @@ if (loaded) {

const resolvedParserPreset = resolveFrom(config.parserPreset, configFilePath);
config.parserPreset = Object.assign({ name: config.parserPreset }, (await loadParserPreset(resolvedParserPreset)));
config.parserPreset = {
name: config.parserPreset,
...(await loadParserPreset(resolvedParserPreset)),
};
}

@@ -45,0 +48,0 @@ // Resolve extends key

@@ -6,2 +6,3 @@ import { existsSync, readFileSync } from 'fs';

const moduleName = 'commitlint';
const searchStrategy = 'global';
export async function loadConfig(cwd, configPath) {

@@ -21,2 +22,3 @@ let tsLoaderInstance;

const explorer = cosmiconfig(moduleName, {
searchStrategy,
searchPlaces: [

@@ -26,2 +28,3 @@ // cosmiconfig overrides default searchPlaces if any new search place is added (For e.g. `*.ts` files),

'package.json',
'package.yaml',
`.${moduleName}rc`,

@@ -71,3 +74,2 @@ `.${moduleName}rc.json`,

export const isEsmModule = (cwd) => {
var _a;
const packagePath = path.join(cwd, 'package.json');

@@ -78,4 +80,4 @@ if (!existsSync(packagePath)) {

const packageJSON = readFileSync(packagePath, { encoding: 'utf-8' });
return ((_a = JSON.parse(packageJSON)) === null || _a === void 0 ? void 0 : _a.type) === 'module';
return JSON.parse(packageJSON)?.type === 'module';
};
//# sourceMappingURL=load-config.js.map

@@ -36,3 +36,6 @@ function isObjectLike(obj) {

const result = parser.parserOpts((_, opts) => {
resolve(Object.assign(Object.assign({}, parser), { parserOpts: opts === null || opts === void 0 ? void 0 : opts.parserOpts }));
resolve({
...parser,
parserOpts: opts?.parserOpts,
});
});

@@ -43,3 +46,6 @@ // If result has data or a promise, the parser doesn't support factory-init

Promise.resolve(result).then((opts) => {
resolve(Object.assign(Object.assign({}, parser), { parserOpts: opts === null || opts === void 0 ? void 0 : opts.parserOpts }));
resolve({
...parser,
parserOpts: opts?.parserOpts,
});
});

@@ -46,0 +52,0 @@ }

@@ -35,3 +35,3 @@ import { createRequire } from 'module';

console.error(chalk.red(`Failed to load plugin ${longName}.`));
const message = (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error occurred';
const message = error?.message || 'Unknown error occurred';
throw new MissingPluginError(pluginName, message, {

@@ -38,0 +38,0 @@ pluginName: longName,

export class WhitespacePluginError extends Error {
__proto__ = Error;
messageTemplate = 'whitespace-found';
messageData = {};
constructor(pluginName, data = {}) {
super(`Whitespace found in plugin name '${pluginName}'`);
this.__proto__ = Error;
this.messageTemplate = 'whitespace-found';
this.messageData = {};
this.messageData = data;

@@ -12,6 +12,7 @@ Object.setPrototypeOf(this, WhitespacePluginError.prototype);

export class MissingPluginError extends Error {
__proto__ = Error;
messageTemplate = 'plugin-missing';
messageData;
constructor(pluginName, errorMessage = '', data = {}) {
super(`Failed to load plugin ${pluginName}: ${errorMessage}`);
this.__proto__ = Error;
this.messageTemplate = 'plugin-missing';
this.messageData = data;

@@ -18,0 +19,0 @@ Object.setPrototypeOf(this, MissingPluginError.prototype);

{
"name": "@commitlint/load",
"type": "module",
"version": "19.1.0",
"version": "19.2.0",
"description": "Load shared commitlint configuration",

@@ -53,3 +53,3 @@ "main": "lib/load.js",

"chalk": "^5.3.0",
"cosmiconfig": "^8.3.6",
"cosmiconfig": "^9.0.0",
"cosmiconfig-typescript-loader": "^5.0.0",

@@ -60,3 +60,3 @@ "lodash.isplainobject": "^4.0.6",

},
"gitHead": "8d7a3d5d49ab77733e166cb5f195b1b7f277b4a7"
"gitHead": "a64b417b58b3b1e89f07ff529a29a4af223e9369"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc