@nuxt/core
Advanced tools
Comparing version 2.14.12 to 2.15.0
286
dist/core.js
/*! | ||
* @nuxt/core v2.14.12 (c) 2016-2020 | ||
* - All the amazing contributors | ||
* Released under the MIT License. | ||
* @nuxt/core v2.15.0 (c) 2016-2021 | ||
* Released under the MIT License | ||
* Repository: https://github.com/nuxt/nuxt.js | ||
* Website: https://nuxtjs.org | ||
@@ -17,2 +16,3 @@ */ | ||
const utils = require('@nuxt/utils'); | ||
const lodash = require('lodash'); | ||
const Hookable = require('hable'); | ||
@@ -148,7 +148,9 @@ const config = require('@nuxt/config'); | ||
requireModule (moduleOpts) { | ||
return this.addModule(moduleOpts) | ||
requireModule (moduleOpts, { paths } = {}) { | ||
return this.addModule(moduleOpts, undefined, { paths }) | ||
} | ||
async addModule (moduleOpts) { | ||
async addModule (moduleOpts, arg2, arg3) { | ||
// Arg2 was previously used for requireOnce which is ignored now | ||
const { paths } = { ...arg2, ...arg3 }; | ||
let src; | ||
@@ -182,3 +184,5 @@ let options; | ||
try { | ||
handler = this.nuxt.resolver.requireModule(src, { useESM: true }); | ||
handler = this.nuxt.resolver.requireModule(src, { paths }); | ||
// pnp support | ||
try { (global.__NUXT_PATHS__ || []).push(this.nuxt.resolver.resolvePath(src, { paths })); } catch (_err) {} | ||
} catch (error) { | ||
@@ -243,228 +247,4 @@ if (error.code !== 'MODULE_NOT_FOUND') { | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var version = "2.15.0"; | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; | ||
var _freeGlobal = freeGlobal; | ||
/** Detect free variable `self`. */ | ||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
/** Used as a reference to the global object. */ | ||
var root = _freeGlobal || freeSelf || Function('return this')(); | ||
var _root = root; | ||
/** Built-in value references. */ | ||
var Symbol = _root.Symbol; | ||
var _Symbol = Symbol; | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var nativeObjectToString = objectProto.toString; | ||
/** Built-in value references. */ | ||
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; | ||
/** | ||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {string} Returns the raw `toStringTag`. | ||
*/ | ||
function getRawTag(value) { | ||
var isOwn = hasOwnProperty.call(value, symToStringTag), | ||
tag = value[symToStringTag]; | ||
try { | ||
value[symToStringTag] = undefined; | ||
var unmasked = true; | ||
} catch (e) {} | ||
var result = nativeObjectToString.call(value); | ||
if (unmasked) { | ||
if (isOwn) { | ||
value[symToStringTag] = tag; | ||
} else { | ||
delete value[symToStringTag]; | ||
} | ||
} | ||
return result; | ||
} | ||
var _getRawTag = getRawTag; | ||
/** Used for built-in method references. */ | ||
var objectProto$1 = Object.prototype; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var nativeObjectToString$1 = objectProto$1.toString; | ||
/** | ||
* Converts `value` to a string using `Object.prototype.toString`. | ||
* | ||
* @private | ||
* @param {*} value The value to convert. | ||
* @returns {string} Returns the converted string. | ||
*/ | ||
function objectToString(value) { | ||
return nativeObjectToString$1.call(value); | ||
} | ||
var _objectToString = objectToString; | ||
/** `Object#toString` result references. */ | ||
var nullTag = '[object Null]', | ||
undefinedTag = '[object Undefined]'; | ||
/** Built-in value references. */ | ||
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined; | ||
/** | ||
* The base implementation of `getTag` without fallbacks for buggy environments. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {string} Returns the `toStringTag`. | ||
*/ | ||
function baseGetTag(value) { | ||
if (value == null) { | ||
return value === undefined ? undefinedTag : nullTag; | ||
} | ||
return (symToStringTag$1 && symToStringTag$1 in Object(value)) | ||
? _getRawTag(value) | ||
: _objectToString(value); | ||
} | ||
var _baseGetTag = baseGetTag; | ||
/** | ||
* Creates a unary function that invokes `func` with its argument transformed. | ||
* | ||
* @private | ||
* @param {Function} func The function to wrap. | ||
* @param {Function} transform The argument transform. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function overArg(func, transform) { | ||
return function(arg) { | ||
return func(transform(arg)); | ||
}; | ||
} | ||
var _overArg = overArg; | ||
/** Built-in value references. */ | ||
var getPrototype = _overArg(Object.getPrototypeOf, Object); | ||
var _getPrototype = getPrototype; | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return value != null && typeof value == 'object'; | ||
} | ||
var isObjectLike_1 = isObjectLike; | ||
/** `Object#toString` result references. */ | ||
var objectTag = '[object Object]'; | ||
/** Used for built-in method references. */ | ||
var funcProto = Function.prototype, | ||
objectProto$2 = Object.prototype; | ||
/** Used to resolve the decompiled source of functions. */ | ||
var funcToString = funcProto.toString; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty$1 = objectProto$2.hasOwnProperty; | ||
/** Used to infer the `Object` constructor. */ | ||
var objectCtorString = funcToString.call(Object); | ||
/** | ||
* Checks if `value` is a plain object, that is, an object created by the | ||
* `Object` constructor or one with a `[[Prototype]]` of `null`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.8.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`. | ||
* @example | ||
* | ||
* function Foo() { | ||
* this.a = 1; | ||
* } | ||
* | ||
* _.isPlainObject(new Foo); | ||
* // => false | ||
* | ||
* _.isPlainObject([1, 2, 3]); | ||
* // => false | ||
* | ||
* _.isPlainObject({ 'x': 0, 'y': 0 }); | ||
* // => true | ||
* | ||
* _.isPlainObject(Object.create(null)); | ||
* // => true | ||
*/ | ||
function isPlainObject(value) { | ||
if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) { | ||
return false; | ||
} | ||
var proto = _getPrototype(value); | ||
if (proto === null) { | ||
return true; | ||
} | ||
var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor; | ||
return typeof Ctor == 'function' && Ctor instanceof Ctor && | ||
funcToString.call(Ctor) == objectCtorString; | ||
} | ||
var isPlainObject_1 = isPlainObject; | ||
var version = "2.14.12"; | ||
class Resolver { | ||
@@ -481,19 +261,13 @@ constructor (nuxt) { | ||
const { createRequire } = this.options; | ||
this._require = createRequire ? createRequire(module) : module.require; | ||
this._resolve = require.resolve; | ||
this._createRequire = this.options.createRequire || utils.createRequire; | ||
this._require = this._createRequire(__filename); | ||
} | ||
resolveModule (path) { | ||
resolveModule (path, { paths } = {}) { | ||
try { | ||
return this._resolve(path, { | ||
paths: this.options.modulesDir | ||
return this._require.resolve(path, { | ||
paths: [].concat(paths || [], this.options.modulesDir, global.__NUXT_PATHS__ || [], process.cwd()) | ||
}) | ||
} catch (error) { | ||
if (error.code !== 'MODULE_NOT_FOUND') { | ||
// TODO: remove after https://github.com/facebook/jest/pull/8487 released | ||
if (process.env.NODE_ENV === 'test' && error.message.startsWith('Cannot resolve module')) { | ||
return | ||
} | ||
throw error | ||
@@ -516,3 +290,3 @@ } | ||
resolvePath (path$1, { alias, isAlias = alias, module, isModule = module, isStyle } = {}) { | ||
resolvePath (path$1, { alias, isAlias = alias, module, isModule = module, isStyle, paths } = {}) { | ||
// TODO: Remove in Nuxt 3 | ||
@@ -535,3 +309,3 @@ if (alias) { | ||
if (isModule !== false) { | ||
resolvedPath = this.resolveModule(path$1); | ||
resolvedPath = this.resolveModule(path$1, { paths }); | ||
} | ||
@@ -583,3 +357,3 @@ | ||
requireModule (path, { esm, useESM = esm, alias, isAlias = alias, intropDefault, interopDefault = intropDefault } = {}) { | ||
requireModule (path, { alias, isAlias = alias, intropDefault, interopDefault = intropDefault, paths } = {}) { | ||
let resolvedPath = path; | ||
@@ -595,5 +369,2 @@ let requiredModule; | ||
} | ||
if (esm) { | ||
consola__default['default'].warn('Using esm is deprecated and will be removed in Nuxt 3. Use `useESM` instead.'); | ||
} | ||
@@ -604,3 +375,3 @@ let lastError; | ||
try { | ||
resolvedPath = this.resolvePath(path, { isAlias }); | ||
resolvedPath = this.resolvePath(path, { isAlias, paths }); | ||
} catch (e) { | ||
@@ -618,14 +389,5 @@ lastError = e; | ||
// By default use esm only for js,mjs files outside of node_modules | ||
if (useESM === undefined) { | ||
useESM = !isExternal && /.(js|mjs)$/.test(resolvedPath); | ||
} | ||
// Try to require | ||
try { | ||
if (useESM) { | ||
requiredModule = this._require(resolvedPath); | ||
} else { | ||
requiredModule = require(resolvedPath); | ||
} | ||
requiredModule = this._require(resolvedPath); | ||
} catch (e) { | ||
@@ -720,3 +482,3 @@ lastError = e; | ||
// Add hooks | ||
if (isPlainObject_1(this.options.hooks)) { | ||
if (lodash.isPlainObject(this.options.hooks)) { | ||
this.addHooks(this.options.hooks); | ||
@@ -723,0 +485,0 @@ } else if (typeof this.options.hooks === 'function') { |
{ | ||
"name": "@nuxt/core", | ||
"version": "2.14.12", | ||
"version": "2.15.0", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -11,14 +11,10 @@ "license": "MIT", | ||
"dependencies": { | ||
"@nuxt/config": "2.14.12", | ||
"@nuxt/devalue": "^1.2.4", | ||
"@nuxt/server": "2.14.12", | ||
"@nuxt/utils": "2.14.12", | ||
"@nuxt/vue-renderer": "2.14.12", | ||
"consola": "^2.15.0", | ||
"debug": "^4.2.0", | ||
"esm": "^3.2.25", | ||
"fs-extra": "^8.1.0", | ||
"@nuxt/config": "2.15.0", | ||
"@nuxt/server": "2.15.0", | ||
"@nuxt/utils": "2.15.0", | ||
"consola": "^2.15.3", | ||
"fs-extra": "^9.1.0", | ||
"hable": "^3.0.0", | ||
"hash-sum": "^2.0.0", | ||
"std-env": "^2.2.1" | ||
"lodash": "^4.17.20" | ||
}, | ||
@@ -25,0 +21,0 @@ "publishConfig": { |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
8
3
3
0
17146
457
+ Addedlodash@^4.17.20
+ Added@nuxt/config@2.15.0(transitive)
+ Added@nuxt/server@2.15.0(transitive)
+ Added@nuxt/utils@2.15.0(transitive)
+ Added@nuxt/vue-renderer@2.15.0(transitive)
+ Addedat-least-node@1.0.0(transitive)
+ Addeddefu@3.2.2(transitive)
+ Addedfs-extra@9.1.0(transitive)
+ Addedjiti@1.21.6(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedpify@5.0.0(transitive)
+ Addedufo@0.6.12(transitive)
+ Addeduniversalify@2.0.1(transitive)
- Removed@nuxt/devalue@^1.2.4
- Removed@nuxt/vue-renderer@2.14.12
- Removeddebug@^4.2.0
- Removedesm@^3.2.25
- Removedstd-env@^2.2.1
- Removed@nuxt/config@2.14.12(transitive)
- Removed@nuxt/server@2.14.12(transitive)
- Removed@nuxt/ufo@0.5.4(transitive)
- Removed@nuxt/utils@2.14.12(transitive)
- Removed@nuxt/vue-renderer@2.14.12(transitive)
- Removedchalk@3.0.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddefu@2.0.4(transitive)
- Removedesm@3.2.25(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedjiti@0.1.20(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedpify@4.0.1(transitive)
- Removeduniversalify@0.1.2(transitive)
Updated@nuxt/config@2.15.0
Updated@nuxt/server@2.15.0
Updated@nuxt/utils@2.15.0
Updatedconsola@^2.15.3
Updatedfs-extra@^9.1.0