Comparing version 12.0.0 to 12.0.1
@@ -1,4 +0,1 @@ | ||
import * as glob from 'fast-glob'; | ||
import * as path from 'path'; | ||
/** | ||
@@ -448,20 +445,2 @@ * Newline. | ||
/** | ||
* Quick flatten utility to flatten a 2-dimensional array. | ||
* | ||
* @param {Array<Array<Item>>} array | ||
* The array to flatten. | ||
* | ||
* @return {Array<Item>} | ||
* The flattened array. | ||
*/ | ||
function flatten(array) { | ||
const result = []; | ||
array.forEach((arr) => { | ||
arr.forEach((item) => { | ||
result.push(item); | ||
}); | ||
}); | ||
return result; | ||
} | ||
/** | ||
* Creates a { name: value } object if the input isn't already in that format. | ||
@@ -548,58 +527,2 @@ * | ||
// Regex to extract the module name. | ||
const nameExpr = /(.*)\..*/i; | ||
/** | ||
* Internal method for globbing a single pattern. | ||
* | ||
* @param {String} globPattern | ||
* The glob pattern. | ||
* | ||
* @param {String} opts.cwd | ||
* Current working directory, used for resolving filepaths. | ||
* Defaults to `process.cwd()`. | ||
* | ||
* @return {[{name, path, opts}]} | ||
* The module names and paths. | ||
* | ||
* @api private | ||
*/ | ||
function _listModules(globPattern, opts) { | ||
opts = { cwd: process.cwd(), glob: glob.sync, ...opts }; | ||
let patternOpts = null; | ||
if (Array.isArray(globPattern)) { | ||
patternOpts = globPattern[1]; | ||
globPattern = globPattern[0]; | ||
} | ||
// Replace Windows path separators with Posix path | ||
globPattern = globPattern.replace(/\\/g, '/'); | ||
const result = opts.glob(globPattern, { cwd: opts.cwd }); | ||
const mapped = result.map((p) => ({ | ||
name: nameExpr.exec(path.basename(p))[1], | ||
path: path.resolve(opts.cwd, p), | ||
opts: patternOpts, | ||
})); | ||
return mapped; | ||
} | ||
/** | ||
* Returns a list of {name, path} pairs, | ||
* where the name is the module name, and path is the actual | ||
* full path to the module. | ||
* | ||
* @param {String|Array<String>} globPatterns | ||
* The glob pattern as a string or an array of strings. | ||
* | ||
* @param {String} opts.cwd | ||
* Current working directory, used for resolving filepaths. | ||
* Defaults to `process.cwd()`. | ||
* | ||
* @return {[{name, path}]} | ||
* An array of objects with the module names and paths. | ||
*/ | ||
function listModules(globPatterns, opts) { | ||
if (Array.isArray(globPatterns)) { | ||
return flatten(globPatterns.map((p) => _listModules(p, opts))); | ||
} | ||
return _listModules(globPatterns, opts); | ||
} | ||
/* | ||
@@ -1439,2 +1362,2 @@ * Parses the parameter list of a function string, including ES6 class constructors. | ||
export { AwilixError, AwilixRegistrationError, AwilixResolutionError, AwilixTypeError, InjectionMode, Lifetime, RESOLVER, aliasTo, asClass, asFunction, asValue, createBuildResolver, createContainer, createDisposableResolver, isClass, isFunction, listModules }; | ||
export { AwilixError, AwilixRegistrationError, AwilixResolutionError, AwilixTypeError, InjectionMode, Lifetime, RESOLVER, aliasTo, asClass, asFunction, asValue, createBuildResolver, createContainer, createDisposableResolver, isClass, isFunction }; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fast-glob'), require('path')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'fast-glob', 'path'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Awilix = {}, global.glob, global.path)); | ||
})(this, (function (exports, glob, path) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Awilix = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
var glob__namespace = /*#__PURE__*/_interopNamespaceDefault(glob); | ||
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path); | ||
/** | ||
@@ -471,20 +451,2 @@ * Newline. | ||
/** | ||
* Quick flatten utility to flatten a 2-dimensional array. | ||
* | ||
* @param {Array<Array<Item>>} array | ||
* The array to flatten. | ||
* | ||
* @return {Array<Item>} | ||
* The flattened array. | ||
*/ | ||
function flatten(array) { | ||
const result = []; | ||
array.forEach((arr) => { | ||
arr.forEach((item) => { | ||
result.push(item); | ||
}); | ||
}); | ||
return result; | ||
} | ||
/** | ||
* Creates a { name: value } object if the input isn't already in that format. | ||
@@ -571,58 +533,2 @@ * | ||
// Regex to extract the module name. | ||
const nameExpr = /(.*)\..*/i; | ||
/** | ||
* Internal method for globbing a single pattern. | ||
* | ||
* @param {String} globPattern | ||
* The glob pattern. | ||
* | ||
* @param {String} opts.cwd | ||
* Current working directory, used for resolving filepaths. | ||
* Defaults to `process.cwd()`. | ||
* | ||
* @return {[{name, path, opts}]} | ||
* The module names and paths. | ||
* | ||
* @api private | ||
*/ | ||
function _listModules(globPattern, opts) { | ||
opts = { cwd: process.cwd(), glob: glob__namespace.sync, ...opts }; | ||
let patternOpts = null; | ||
if (Array.isArray(globPattern)) { | ||
patternOpts = globPattern[1]; | ||
globPattern = globPattern[0]; | ||
} | ||
// Replace Windows path separators with Posix path | ||
globPattern = globPattern.replace(/\\/g, '/'); | ||
const result = opts.glob(globPattern, { cwd: opts.cwd }); | ||
const mapped = result.map((p) => ({ | ||
name: nameExpr.exec(path__namespace.basename(p))[1], | ||
path: path__namespace.resolve(opts.cwd, p), | ||
opts: patternOpts, | ||
})); | ||
return mapped; | ||
} | ||
/** | ||
* Returns a list of {name, path} pairs, | ||
* where the name is the module name, and path is the actual | ||
* full path to the module. | ||
* | ||
* @param {String|Array<String>} globPatterns | ||
* The glob pattern as a string or an array of strings. | ||
* | ||
* @param {String} opts.cwd | ||
* Current working directory, used for resolving filepaths. | ||
* Defaults to `process.cwd()`. | ||
* | ||
* @return {[{name, path}]} | ||
* An array of objects with the module names and paths. | ||
*/ | ||
function listModules(globPatterns, opts) { | ||
if (Array.isArray(globPatterns)) { | ||
return flatten(globPatterns.map((p) => _listModules(p, opts))); | ||
} | ||
return _listModules(globPatterns, opts); | ||
} | ||
/* | ||
@@ -1478,4 +1384,3 @@ * Parses the parameter list of a function string, including ES6 class constructors. | ||
exports.isFunction = isFunction; | ||
exports.listModules = listModules; | ||
})); |
{ | ||
"name": "awilix", | ||
"version": "12.0.0", | ||
"version": "12.0.1", | ||
"description": "Extremely powerful dependency injection container.", | ||
@@ -5,0 +5,0 @@ "main": "lib/awilix.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
304860
6772