Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.debug('Found a shorthand module with custom scope: %s', color.moduleName(moduleName));
resolver.lookupNodeModule(customModuleName);
// tool-plugin-name
} else if (moduleName.match(new RegExp(`^${projectName}-${typeName}-${modulePattern}$`, 'u'))) {
this.debug('Found an explicit public module: %s', color.moduleName(moduleName));
resolver.lookupNodeModule(moduleName);
// The previous 2 patterns if only name provided
} else if (moduleName.match(new RegExp(`^${modulePattern}$`, 'u')) && isNotToolOrType) {
this.debug(
'Resolving modules with internal "%s" scope and public "%s" prefix',
color.toolName(`@${projectName}`),
color.toolName(projectName),
);
// Detect internal scopes before public ones
resolver.lookupNodeModule(this.manager.formatModuleName(moduleName, true));
resolver.lookupNodeModule(this.manager.formatModuleName(moduleName));
// Unknown plugin module pattern
} else {
throw new Error(`Unknown plugin module format "${moduleName}".`);
}
return resolver;
}
this.debug('Found a shorthand module with custom scope: %s', color.moduleName(moduleName));
resolver.lookupNodeModule(customModuleName);
// tool-plugin-name
} else if (moduleName.match(new RegExp(`^${projectName}-${typeName}-${modulePattern}$`, 'u'))) {
this.debug('Found an explicit public module: %s', color.moduleName(moduleName));
resolver.lookupNodeModule(moduleName);
// The previous 2 patterns if only name provided
} else if (moduleName.match(new RegExp(`^${modulePattern}$`, 'u')) && isNotToolOrType) {
this.debug(
'Resolving modules with internal "%s" scope and public "%s" prefix',
color.toolName(`@${projectName}`),
color.toolName(projectName),
);
// Detect internal scopes before public ones
resolver.lookupNodeModule(this.manager.formatModuleName(moduleName, true));
resolver.lookupNodeModule(this.manager.formatModuleName(moduleName));
// Unknown plugin module pattern
} else {
throw new Error(`Unknown plugin module format "${moduleName}".`);
}
return resolver;
}
findConfigInPackageJSON(pkg: PackageConfig): ConfigPathOrObject | null {
const configName = this.getConfigName();
const config = (pkg as any)[configName];
this.debug.invariant(
!!config,
`Looking in package.json under ${color.toolName(configName)} property`,
'Found',
'Not found',
);
if (!config) {
return null;
}
// Extend from a preset if a string
if (typeof config === 'string') {
return { extends: [config] };
}
return config;
}
initialize(): this {
if (this.initialized) {
return this;
}
const { appName } = this.options;
const pluginNames = Object.keys(this.pluginTypes);
this.debug('Initializing %s application', color.toolName(appName));
this.args = parseArgs(
this.argv,
mergeWith(
{
array: [...pluginNames],
boolean: ['debug', 'silent'],
number: ['output'],
string: ['config', 'locale', 'theme', ...pluginNames],
},
this.options.argOptions,
handleMerge,
),
);
this.loadConfig();