webpack
Advanced tools
Comparing version 5.76.1 to 5.76.2
@@ -131,2 +131,5 @@ /* | ||
this._moduleMemCaches = undefined; | ||
/** @type {string} */ | ||
this._cacheStage = undefined; | ||
} | ||
@@ -133,0 +136,0 @@ |
@@ -46,3 +46,3 @@ /* | ||
`if (document.currentScript)`, | ||
Template.indent(`scriptUrl = document.currentScript.src`), | ||
Template.indent(`scriptUrl = document.currentScript.src;`), | ||
"if (!scriptUrl) {", | ||
@@ -49,0 +49,0 @@ Template.indent([ |
@@ -149,4 +149,3 @@ /* | ||
]) | ||
) + | ||
";", | ||
), | ||
`var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`, | ||
@@ -153,0 +152,0 @@ "script.onerror = onScriptComplete.bind(null, script.onerror);", |
@@ -50,3 +50,22 @@ /* | ||
const METACHARACTERS_REGEXP = /[-[\]\\/{}()*+?.^$|]/g; | ||
const CONTENT_HASH_DETECT_REGEXP = /\[contenthash(:\w+)?\]/; | ||
const CSS_AND_JS_MODULE_EXTENSIONS_REGEXP = /\.((c|m)?js|css)($|\?)/i; | ||
const CSS_EXTENSION_DETECT_REGEXP = /\.css($|\?)/i; | ||
const MAP_URL_COMMENT_REGEXP = /\[map\]/g; | ||
const URL_COMMENT_REGEXP = /\[url\]/g; | ||
const URL_FORMATTING_REGEXP = /^\n\/\/(.*)$/; | ||
/** | ||
* Reset's .lastIndex of stateful Regular Expressions | ||
* For when `test` or `exec` is called on them | ||
* @param {RegExp} regexp Stateful Regular Expression to be reset | ||
* @returns {void} | ||
* | ||
*/ | ||
const resetRegexpState = regexp => { | ||
regexp.lastIndex = -1; | ||
}; | ||
/** | ||
* Escapes regular expression metacharacters | ||
@@ -57,3 +76,3 @@ * @param {string} str String to quote | ||
const quoteMeta = str => { | ||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&"); | ||
return str.replace(METACHARACTERS_REGEXP, "\\$&"); | ||
}; | ||
@@ -157,3 +176,3 @@ | ||
const options = this.options; | ||
options.test = options.test || /\.((c|m)?js|css)($|\?)/i; | ||
options.test = options.test || CSS_AND_JS_MODULE_EXTENSIONS_REGEXP; | ||
@@ -415,4 +434,6 @@ const matchObject = ModuleFilenameHelpers.matchObject.bind( | ||
sourceMapFilename && | ||
/\[contenthash(:\w+)?\]/.test(sourceMapFilename); | ||
CONTENT_HASH_DETECT_REGEXP.test(sourceMapFilename); | ||
resetRegexpState(CONTENT_HASH_DETECT_REGEXP); | ||
// If SourceMap and asset uses contenthash, avoid a circular dependency by hiding hash in `file` | ||
@@ -435,9 +456,12 @@ if (usesContentHash && task.assetInfo.contenthash) { | ||
let currentSourceMappingURLComment = sourceMappingURLComment; | ||
let cssExtensionDetected = | ||
CSS_EXTENSION_DETECT_REGEXP.test(file); | ||
resetRegexpState(CSS_EXTENSION_DETECT_REGEXP); | ||
if ( | ||
currentSourceMappingURLComment !== false && | ||
/\.css($|\?)/i.test(file) | ||
cssExtensionDetected | ||
) { | ||
currentSourceMappingURLComment = | ||
currentSourceMappingURLComment.replace( | ||
/^\n\/\/(.*)$/, | ||
URL_FORMATTING_REGEXP, | ||
"\n/*$1*/" | ||
@@ -524,5 +548,5 @@ ); | ||
currentSourceMappingURLComment | ||
.replace(/\[map\]/g, () => sourceMapString) | ||
.replace(MAP_URL_COMMENT_REGEXP, () => sourceMapString) | ||
.replace( | ||
/\[url\]/g, | ||
URL_COMMENT_REGEXP, | ||
() => | ||
@@ -529,0 +553,0 @@ `data:application/json;charset=utf-8;base64,${Buffer.from( |
{ | ||
"name": "webpack", | ||
"version": "5.76.1", | ||
"version": "5.76.2", | ||
"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
4408559
127930