webpack 5.106.0 → 5.106.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Module.js CHANGED
@@ -120,14 +120,11 @@ const makeSerializable = require("./util/makeSerializable");
120
120
  * @property {[{ shareScope: string, initStage: number, init: string }]} share-init share-init for modules federation
121
121
  */
122
122
 
123
- /* eslint-disable jsdoc/type-formatting */
124
123
  /**
125
124
  * @template {string} K
126
125
  * @typedef {K extends keyof AllCodeGenerationSchemas ? AllCodeGenerationSchemas[K] : EXPECTED_ANY} CodeGenValue
127
126
  */
128
- /* eslint-enable jsdoc/type-formatting */
129
127
 
130
- /* eslint-disable jsdoc/require-template */
131
128
  /**
132
129
  * @typedef {object} CodeGenMapOverloads
133
130
  * @property {<K extends string>(key: K) => CodeGenValue<K> | undefined} get
@@ -51,6 +51,7 @@ const CC_HYPHEN_MINUS = "-".charCodeAt(0);
51
51
  const CC_TILDE = "~".charCodeAt(0);
52
52
  const CC_EQUAL = "=".charCodeAt(0);
53
53
  const CC_FULL_STOP = ".".charCodeAt(0);
54
+ const CC_EXCLAMATION = "!".charCodeAt(0);
54
55
 
55
56
  // https://www.w3.org/TR/css-syntax-3/#newline
56
57
  // We don't have `preprocessing` stage, so we need specify all of them
@@ -1772,10 +1773,16 @@ class CssParser extends Parser {
1772
1773
  )
1773
1774
  : false;
1774
1775
 
1776
+ let afterExclamation = false;
1777
+
1775
1778
  const end = walkCssTokens.consumeUntil(
1776
1779
  input,
1777
1780
  pos,
1778
1781
  {
1782
+ delim(input, start, end) {
1783
+ afterExclamation = input.charCodeAt(start) === CC_EXCLAMATION;
1784
+ return end;
1785
+ },
1779
1786
  leftSquareBracket(input, start, end) {
1780
1787
  let i = end;
1781
1788
 
@@ -1824,6 +1831,11 @@ class CssParser extends Parser {
1824
1831
  return end;
1825
1832
  }
1826
1833
 
1834
+ if (afterExclamation) {
1835
+ afterExclamation = false;
1836
+ return end;
1837
+ }
1838
+
1827
1839
  const identifier = input.slice(start, end);
1828
1840
  const keyword = identifier.toLowerCase();
1829
1841
 
@@ -55,7 +55,7 @@ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => {
55
55
  (generator.options.localIdentName);
56
56
  const relativeResourcePath = makePathsRelative(
57
57
  /** @type {string} */
58
- (module.context),
58
+ (runtimeTemplate.compilation.compiler.context),
59
59
  /** @type {string} */
60
60
  (module.getResource()),
61
61
  runtimeTemplate.compilation.compiler.root
@@ -163,7 +163,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
163
163
  // see test/test262-cases/test/language/module-code/instn-named-bndng-dflt-fun-anon.js cspell:disable-line
164
164
  initFragments.push(
165
165
  new InitFragment(
166
- `Reflect.defineProperty(${name}, "name", { value: "default", configurable: true });\n`,
166
+ `Object.defineProperty(${name}, "name", { value: "default", configurable: true });\n`,
167
167
  InitFragment.STAGE_HARMONY_EXPORTS,
168
168
  2
169
169
  )
@@ -172,7 +172,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
172
172
  } else {
173
173
  /** @type {string} */
174
174
  let content;
175
- const name = ConcatenationScope.DEFAULT_EXPORT;
175
+ let name = ConcatenationScope.DEFAULT_EXPORT;
176
176
  if (runtimeTemplate.supportsConst()) {
177
177
  content = `/* harmony default export */ const ${name} = `;
178
178
  if (concatenationScope) {
@@ -201,9 +201,13 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
201
201
  if (used) {
202
202
  runtimeRequirements.add(RuntimeGlobals.exports);
203
203
  // This is a little bit incorrect as TDZ is not correct, but we can't use const.
204
- content = `/* harmony default export */ ${exportsName}${propertyAccess(
204
+ // No local `__WEBPACK_DEFAULT_EXPORT__` binding is created in this path,
205
+ // so the anonymous-default `.name` fix-up below must reference the actual
206
+ // assignment target instead. See issue #20793.
207
+ name = `${exportsName}${propertyAccess(
205
208
  typeof used === "string" ? [used] : used
206
- )} = `;
209
+ )}`;
210
+ content = `/* harmony default export */ ${name} = `;
207
211
  } else {
208
212
  content = `/* unused harmony default export */ var ${name} = `;
209
213
  }
@@ -221,7 +225,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
221
225
  source.replace(
222
226
  dep.range[1],
223
227
  dep.rangeStatement[1] - 0.5,
224
- `);\nReflect.getOwnPropertyDescriptor(${name}, "name").writable || Reflect.defineProperty(${name}, "name", { value: "default", configurable: true });`
228
+ `);\n(Object.getOwnPropertyDescriptor(${name}, "name") || {}).writable || Object.defineProperty(${name}, "name", { value: "default", configurable: true });`
225
229
  );
226
230
  } else {
227
231
  source.replace(dep.range[1], dep.rangeStatement[1] - 0.5, ");");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.106.0",
3
+ "version": "5.106.1",
4
4
  "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
5
5
  "homepage": "https://github.com/webpack/webpack",
6
6
  "bugs": "https://github.com/webpack/webpack/issues",
@@ -167,7 +167,7 @@
167
167
  "node-gyp": "^12.1.0",
168
168
  "nyc": "^18.0.0",
169
169
  "open-cli": "^8.0.0",
170
- "oxc-parser": "^0.123.0",
170
+ "oxc-parser": "^0.124.0",
171
171
  "pkg-pr-new": "^0.0.66",
172
172
  "prettier": "^3.7.4",
173
173
  "prettier-2": "npm:prettier@^2",