webpack
Advanced tools
Comparing version 5.67.0 to 5.68.0
@@ -204,2 +204,35 @@ /* | ||
); | ||
parser.hooks.expression | ||
.for("__webpack_module__.id") | ||
.tap("APIPlugin", expr => { | ||
parser.state.module.buildInfo.moduleConcatenationBailout = | ||
"__webpack_module__.id"; | ||
const dep = new ConstDependency( | ||
parser.state.module.moduleArgument + ".id", | ||
expr.range, | ||
[RuntimeGlobals.moduleId] | ||
); | ||
dep.loc = expr.loc; | ||
parser.state.module.addPresentationalDependency(dep); | ||
return true; | ||
}); | ||
parser.hooks.expression | ||
.for("__webpack_module__") | ||
.tap("APIPlugin", expr => { | ||
parser.state.module.buildInfo.moduleConcatenationBailout = | ||
"__webpack_module__"; | ||
const dep = new ConstDependency( | ||
parser.state.module.moduleArgument, | ||
expr.range, | ||
[RuntimeGlobals.module] | ||
); | ||
dep.loc = expr.loc; | ||
parser.state.module.addPresentationalDependency(dep); | ||
return true; | ||
}); | ||
parser.hooks.evaluateTypeof | ||
.for("__webpack_module__") | ||
.tap("APIPlugin", evaluateToString("object")); | ||
}; | ||
@@ -206,0 +239,0 @@ |
@@ -33,4 +33,4 @@ /* | ||
merge(other) { | ||
const promises = new Set(this.promises); | ||
for (const p of other.promises) { | ||
const promises = new Set(other.promises); | ||
for (const p of this.promises) { | ||
promises.add(p); | ||
@@ -55,3 +55,3 @@ } | ||
`var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${p}]);`, | ||
`${p} = (__webpack_async_dependencies__.then ? await __webpack_async_dependencies__ : __webpack_async_dependencies__)[0];`, | ||
`${p} = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];`, | ||
"" | ||
@@ -65,3 +65,3 @@ ]); | ||
`var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${sepPromises}]);`, | ||
`([${sepPromises}] = __webpack_async_dependencies__.then ? await __webpack_async_dependencies__ : __webpack_async_dependencies__);`, | ||
`([${sepPromises}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);`, | ||
"" | ||
@@ -68,0 +68,0 @@ ]); |
@@ -472,2 +472,3 @@ /* | ||
D(parserOptions, "strictThisContextOnImports", false); | ||
D(parserOptions, "importMeta", true); | ||
if (futureDefaults) D(parserOptions, "exportsPresence", "error"); | ||
@@ -474,0 +475,0 @@ }; |
@@ -77,10 +77,10 @@ /* | ||
runtimeTemplate.supportsArrowFunction() | ||
? `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async (__webpack_handle_async_dependencies__) => {\n` | ||
: `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async function (__webpack_handle_async_dependencies__) {\n`, | ||
? `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n` | ||
: `${RuntimeGlobals.asyncModule}(${module.moduleArgument}, async function (__webpack_handle_async_dependencies__, __webpack_async_result__) { try {\n`, | ||
InitFragment.STAGE_ASYNC_BOUNDARY, | ||
0, | ||
undefined, | ||
module.buildMeta.async | ||
? `\n__webpack_handle_async_dependencies__();\n}, 1);` | ||
: "\n});" | ||
`\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }${ | ||
module.buildMeta.async ? ", 1" : "" | ||
});` | ||
) | ||
@@ -87,0 +87,0 @@ ); |
@@ -23,2 +23,3 @@ /* | ||
/** @typedef {import("estree").MemberExpression} MemberExpression */ | ||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */ | ||
/** @typedef {import("../Compiler")} Compiler */ | ||
@@ -48,7 +49,25 @@ /** @typedef {import("../NormalModule")} NormalModule */ | ||
/** | ||
* @param {Parser} parser parser | ||
* @param {Object} parserOptions parserOptions | ||
* @param {Parser} parser parser parser | ||
* @param {JavascriptParserOptions} parserOptions parserOptions | ||
* @returns {void} | ||
*/ | ||
const parserHandler = (parser, parserOptions) => { | ||
const parserHandler = (parser, { importMeta }) => { | ||
if (importMeta === false) { | ||
const { importMetaName } = compilation.outputOptions; | ||
if (importMetaName === "import.meta") return; | ||
parser.hooks.expression | ||
.for("import.meta") | ||
.tap("ImportMetaPlugin", metaProperty => { | ||
const dep = new ConstDependency( | ||
importMetaName, | ||
metaProperty.range | ||
); | ||
dep.loc = metaProperty.loc; | ||
parser.state.module.addPresentationalDependency(dep); | ||
return true; | ||
}); | ||
return; | ||
} | ||
/// import.meta direct /// | ||
@@ -55,0 +74,0 @@ parser.hooks.typeof |
@@ -403,3 +403,2 @@ /* | ||
/** | ||
* @deprecated moved to .buildInfo.exportsArgument | ||
* @returns {string} name of the exports argument | ||
@@ -412,3 +411,2 @@ */ | ||
/** | ||
* @deprecated moved to .buildInfo.moduleArgument | ||
* @returns {string} name of the module argument | ||
@@ -415,0 +413,0 @@ */ |
@@ -25,2 +25,3 @@ /* | ||
'var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";', | ||
'var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";', | ||
`var completeQueue = ${runtimeTemplate.basicFunction("queue", [ | ||
@@ -60,5 +61,9 @@ "if(queue) {", | ||
"queue = 0;" | ||
])}, ${runtimeTemplate.basicFunction("e", [ | ||
"obj[webpackError] = e;", | ||
"completeQueue(queue);", | ||
"queue = 0;" | ||
])});`, | ||
`var obj = {}; | ||
obj[webpackThen] = ${runtimeTemplate.expressionFunction( | ||
"var obj = {};", | ||
`obj[webpackThen] = ${runtimeTemplate.expressionFunction( | ||
"queueFunction(queue, fn), dep['catch'](reject)", | ||
@@ -72,9 +77,9 @@ "fn, reject" | ||
"}", | ||
`var ret = {}; | ||
ret[webpackThen] = ${runtimeTemplate.expressionFunction( | ||
"var ret = {};", | ||
`ret[webpackThen] = ${runtimeTemplate.expressionFunction( | ||
"completeFunction(fn)", | ||
"fn" | ||
)}; | ||
ret[webpackExports] = dep; | ||
return ret;` | ||
)};`, | ||
"ret[webpackExports] = dep;", | ||
"return ret;" | ||
])})`, | ||
@@ -125,5 +130,10 @@ "deps" | ||
`body(${runtimeTemplate.basicFunction("deps", [ | ||
"if(!deps) return outerResolve();", | ||
"currentDeps = wrapDeps(deps);", | ||
"var fn, result;", | ||
"var fn;", | ||
`var getResult = ${runtimeTemplate.returningFunction( | ||
`currentDeps.map(${runtimeTemplate.basicFunction("d", [ | ||
"if(d[webpackError]) throw d[webpackError];", | ||
"return d[webpackExports];" | ||
])})` | ||
)}`, | ||
`var promise = new Promise(${runtimeTemplate.basicFunction( | ||
@@ -133,6 +143,3 @@ "resolve, reject", | ||
`fn = ${runtimeTemplate.expressionFunction( | ||
`resolve(result = currentDeps.map(${runtimeTemplate.returningFunction( | ||
"d[webpackExports]", | ||
"d" | ||
)}))` | ||
"resolve(getResult)" | ||
)};`, | ||
@@ -143,4 +150,7 @@ "fn.r = 0;", | ||
)});`, | ||
"return fn.r ? promise : result;" | ||
])}).then(outerResolve, reject);`, | ||
"return fn.r ? promise : getResult();" | ||
])}, ${runtimeTemplate.expressionFunction( | ||
"err && reject(promise[webpackError] = err), outerResolve()", | ||
"err" | ||
)});`, | ||
"isEvaluating = false;" | ||
@@ -147,0 +157,0 @@ ])};` |
@@ -8,2 +8,10 @@ /* | ||
/** | ||
* Compare two arrays or strings by performing strict equality check for each value. | ||
* @template T [T=any] | ||
* @param {ArrayLike<T>} a Array of values to be compared | ||
* @param {ArrayLike<T>} b Array of values to be compared | ||
* @returns {boolean} returns true if all the elements of passed arrays are strictly equal. | ||
*/ | ||
exports.equals = (a, b) => { | ||
@@ -18,9 +26,15 @@ if (a.length !== b.length) return false; | ||
/** | ||
* | ||
* @param {Array} arr Array of values to be partitioned | ||
* @param {(value: any) => boolean} fn Partition function which partitions based on truthiness of result. | ||
* @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate. | ||
* Partition an array by calling a predicate function on each value. | ||
* @template T [T=any] | ||
* @param {Array<T>} arr Array of values to be partitioned | ||
* @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result. | ||
* @returns {[Array<T>, Array<T>]} returns the values of `arr` partitioned into two new arrays based on fn predicate. | ||
*/ | ||
exports.groupBy = (arr = [], fn) => { | ||
return arr.reduce( | ||
/** | ||
* @param {[Array<T>, Array<T>]} groups An accumulator storing already partitioned values returned from previous call. | ||
* @param {T} value The value of the current element | ||
* @returns {[Array<T>, Array<T>]} returns an array of partitioned groups accumulator resulting from calling a predicate on the current value. | ||
*/ | ||
(groups, value) => { | ||
@@ -27,0 +41,0 @@ groups[fn(value) ? 0 : 1].push(value); |
@@ -170,5 +170,6 @@ /* | ||
module.moduleArgument | ||
}, ${runtimeTemplate.basicFunction( | ||
"__webpack_handle_async_dependencies__", | ||
}, async ${runtimeTemplate.basicFunction( | ||
"__webpack_handle_async_dependencies__, __webpack_async_result__", | ||
[ | ||
"try {", | ||
importsCode, | ||
@@ -178,3 +179,8 @@ `var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([${promises.join( | ||
)}]);`, | ||
"return __webpack_async_dependencies__.then ? __webpack_async_dependencies__.then(__webpack_instantiate__) : __webpack_instantiate__(__webpack_async_dependencies__);" | ||
`var [${promises.join( | ||
", " | ||
)}] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;`, | ||
`${importsCompatCode}await ${instantiateCall};`, | ||
"__webpack_async_result__();", | ||
"} catch(e) { __webpack_async_result__(e); }" | ||
] | ||
@@ -181,0 +187,0 @@ )}, 1);` |
{ | ||
"name": "webpack", | ||
"version": "5.67.0", | ||
"version": "5.68.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
4327323
125564
23