Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gasket/resolve

Package Overview
Dependencies
Maintainers
6
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gasket/resolve - npm Package Compare versions

Comparing version 6.24.0 to 6.29.0

lib/config.js

33

docs/api.md

@@ -14,5 +14,7 @@

------ | -----------
[assignPresetConfig(gasket)] | Loads config from presets and assigns to the main config.
[pluginIdentifier()] | Create package identifiers for Gasket plugins
[presetIdentifier()] | Create package identifiers for Gasket presets
[projectIdentifier(projectName, \[type\])] | Create function used to make instances of PackageIdentifier for a project
[flattenPresets(presetInfos)] | Takes list of top-level presets required by an app, and flattens out any that they might extend.

@@ -368,2 +370,16 @@ ## Typedefs

## assignPresetConfig(gasket)
Loads config from presets and assigns to the main config.
Merge priority order being:
- loaded file config > preset configs > child preset configs
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| gasket | `Gasket` | Gasket engine instance |
## pluginIdentifier()

@@ -409,2 +425,17 @@

## flattenPresets(presetInfos)
Takes list of top-level presets required by an app, and flattens out any that
they might extend.
Presets are ordered by extended depth, with deeper later.
**Kind**: global function
**Returns**: `Array.<PresetInfo>` - flattened presetInfos
| Param | Type | Description |
| --- | --- | --- |
| presetInfos | `Array.<PresetInfo>` | Array of preset infos |
## PluginDesc

@@ -585,5 +616,7 @@

[`projectIdentifier`]:#projectidentifierprojectname-type
[assignPresetConfig(gasket)]:#assignpresetconfiggasket
[pluginIdentifier()]:#pluginidentifier
[presetIdentifier()]:#presetidentifier
[projectIdentifier(projectName, \[type\])]:#projectidentifierprojectname-type
[flattenPresets(presetInfos)]:#flattenpresetspresetinfos
[.getModuleInfo(module, moduleName, \[meta\])]:#loadergetmoduleinfomodule-modulename-meta

@@ -590,0 +623,0 @@ [.loadModule(moduleName, \[meta\])]:#loaderloadmodulemodulename-meta

13

lib/index.js

@@ -0,10 +1,17 @@

const { Resolver } = require('./resolver');
const { Loader } = require('./loader');
const { pluginIdentifier, presetIdentifier } = require('./identifiers');
const { projectIdentifier } = require('./package-identifier');
const { loadGasketConfigFile, assignPresetConfig } = require('./config');
const { flattenPresets } = require('./preset-utils');
module.exports = {
Resolver: require('./resolver'),
Loader: require('./loader'),
Resolver,
Loader,
pluginIdentifier,
presetIdentifier,
projectIdentifier
projectIdentifier,
loadGasketConfigFile,
assignPresetConfig,
flattenPresets
};
const path = require('path');
const Resolver = require('./resolver');
const { Resolver } = require('./resolver');
const { pluginIdentifier, presetIdentifier } = require('./identifiers');

@@ -34,2 +34,11 @@

/**
* Presets and plugins to load
*
* @typedef {object} PluginConfig
*
* @property {PresetName[]} presets - Presets to load and add plugins from
* @property {PluginName[]|module[]} add - Names of plugins to load
* @property {PluginName[]} [remove] - Names of plugins to remove (from presets)
*/

@@ -54,2 +63,8 @@ /**

super(...arguments);
/**
* Loaded plugin configurations
* @type {Map<PluginConfig, {presets: PresetInfo[], plugins: PluginInfo[]}>}
* @private
*/
this._loaded = new Map();
}

@@ -173,11 +188,10 @@

*
* @param {object} config - Presets and plugins to load
* @param {PresetName[]} config.presets - Presets to load and add plugins from
* @param {PluginName[]|module[]} config.add - Names of plugins to load
* @param {PluginName[]} [config.remove] - Names of plugins to remove (from presets)
* @param {PluginConfig} pluginConfig - Presets and plugins to load
* @returns {{presets: PresetInfo[], plugins: PluginInfo[]}} results
*/
loadConfigured(config) {
const { presets = [], add = [], remove = [] } = config || {};
loadConfigured(pluginConfig) {
if (this._loaded.has(pluginConfig)) return this._loaded.get(pluginConfig);
const { presets = [], add = [], remove = [] } = pluginConfig || {};
const loadedPresets = presets.map(name => this.loadPreset(name, { from: 'config' }));

@@ -213,9 +227,14 @@ const loadedPlugins = add.map(module => this.loadPlugin(module, { from: 'config' }));

return {
const results = {
presets: loadedPresets,
plugins
};
this._loaded.set(pluginConfig, results);
return results;
}
}
module.exports = Loader;
module.exports = {
Loader
};

@@ -89,2 +89,4 @@ const debug = require('diagnostics')('gasket:resolver');

module.exports = Resolver;
module.exports = {
Resolver
};
{
"name": "@gasket/resolve",
"version": "6.24.0",
"version": "6.29.0",
"description": "Essential module resolution & configuration management for gasket plugins & presets.",

@@ -46,5 +46,7 @@ "main": "lib",

"diagnostics": "^2.0.2",
"lodash.defaultsdeep": "^4.6.1",
"semver": "^7.3.4"
},
"devDependencies": {
"@gasket/engine": "^6.29.0",
"@godaddy/dmd": "^1.0.0",

@@ -75,3 +77,3 @@ "eslint": "^8.7.0",

},
"gitHead": "b2d5e452d54b059398d483787c30087ee02b247a"
"gitHead": "a8e682034b21c7057234122d54b3ff4e172f58b9"
}

@@ -5,1 +5,3 @@ export { pluginIdentifier, presetIdentifier } from './identifiers';

export { Loader, PluginInfo, ModuleInfo, PresetInfo } from './loader';
export { loadGasketConfigFile } from './config';
export { flattenPresets, assignPresetConfig } from './preset-utils';

@@ -1,3 +0,4 @@

import Resolver from './resolver';
import { Resolver } from './resolver';
import { PluginName, PresetName } from './identifiers';
import * as module from 'module';

@@ -53,2 +54,17 @@ /**

export interface PluginConfig {
/**
* Presets to load and add plugins from
*/
presets?: PresetName[]
/**
* Names of plugins to load
*/
add?: Array<PluginName | object>
/**
* Names of plugins to remove (from presets)
*/
remove?: PluginName[]
}
/**

@@ -62,5 +78,5 @@ * Utility to load plugins, presets, and other modules with associated metadata

/**
* @param {object} options - Options
* @param {string|string[]} [options.resolveFrom] - Path(s) to resolve modules from
* @param {require} [options.require] - Require instance to use
* @param options - Options
* @param [options.resolveFrom] - Path(s) to resolve modules from
* @param [options.require] - Require instance to use
*/

@@ -75,6 +91,6 @@ constructor(options: {

*
* @param {object} module - Module content
* @param {string} moduleName - Name of module to load
* @param {object} [meta] - Additional meta data
* @returns {ModuleInfo} module
* @param module - Module content
* @param moduleName - Name of module to load
* @param [meta] - Additional meta data
* @returns module
*/

@@ -86,5 +102,5 @@ getModuleInfo(module: object, moduleName: string, meta?: object): ModuleInfo;

*
* @param {string} moduleName - Name of module to load
* @param {object} [meta] - Additional meta data
* @returns {ModuleInfo} module
* @param moduleName - Name of module to load
* @param [meta] - Additional meta data
* @returns module
*/

@@ -96,5 +112,5 @@ loadModule(moduleName: string, meta?: object): ModuleInfo;

*
* @param {PluginName|object} module - Name of module to load (or module content)
* @param {object} [meta] - Additional meta data
* @returns {PluginInfo} module
* @param module - Name of module to load (or module content)
* @param [meta] - Additional meta data
* @returns module
*/

@@ -106,7 +122,7 @@ loadPlugin(module: PluginName | object, meta?: object): PluginInfo;

*
* @param {PresetName} module - Name of module to load
* @param {object} [meta] - Additional meta data
* @param {boolean} [options] - Loading options
* @param {boolean} [options.shallow] - Do not recursively load dependencies
* @returns {PresetInfo} module
* @param module - Name of module to load
* @param [meta] - Additional meta data
* @param [options] - Loading options
* @param [options.shallow] - Do not recursively load dependencies
* @returns module
*/

@@ -120,13 +136,6 @@ loadPreset(module: PresetName, meta?: object, { shallow: boolean }?): PresetInfo;

*
* @param {object} config - Presets and plugins to load
* @param {PresetName[]} config.presets - Presets to load and add plugins from
* @param {PluginName[]|module[]} config.add - Names of plugins to load
* @param {string[]} [config.remove] - Names of plugins to remove (from presets)
* @returns {{presets: PresetInfo[], plugins: PluginInfo[]}} results
* @param pluginConfig - Presets and plugins to load
* @returns results
*/
loadConfigured(config: {
presets: PresetName[];
add: PluginName[] | object[];
remove?: PluginName[];
}): {
loadConfigured(pluginConfig: PluginConfig): {
presets: PresetInfo[];

@@ -133,0 +142,0 @@ plugins: PluginInfo[];

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