webpack 5.102.0 → 5.103.0

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.
Files changed (146) hide show
  1. package/README.md +121 -134
  2. package/lib/ChunkGraph.js +2 -2
  3. package/lib/CodeGenerationResults.js +1 -1
  4. package/lib/CompatibilityPlugin.js +25 -2
  5. package/lib/Compilation.js +30 -13
  6. package/lib/ConcatenationScope.js +0 -15
  7. package/lib/ContextModule.js +3 -1
  8. package/lib/CssModule.js +6 -1
  9. package/lib/DefinePlugin.js +12 -12
  10. package/lib/Dependency.js +8 -1
  11. package/lib/DependencyTemplate.js +1 -0
  12. package/lib/DependencyTemplates.js +1 -1
  13. package/lib/DotenvPlugin.js +457 -0
  14. package/lib/EnvironmentPlugin.js +19 -16
  15. package/lib/EvalSourceMapDevToolPlugin.js +16 -0
  16. package/lib/ExportsInfo.js +6 -2
  17. package/lib/ExternalModule.js +20 -28
  18. package/lib/ExternalModuleFactoryPlugin.js +10 -8
  19. package/lib/ExternalsPlugin.js +2 -1
  20. package/lib/FileSystemInfo.js +9 -12
  21. package/lib/ManifestPlugin.js +235 -0
  22. package/lib/Module.js +3 -0
  23. package/lib/ModuleFilenameHelpers.js +1 -1
  24. package/lib/ModuleGraph.js +2 -1
  25. package/lib/ModuleSourceTypesConstants.js +0 -6
  26. package/lib/MultiCompiler.js +1 -1
  27. package/lib/NodeStuffPlugin.js +419 -121
  28. package/lib/NormalModule.js +18 -17
  29. package/lib/NormalModuleFactory.js +75 -4
  30. package/lib/RuntimeGlobals.js +22 -4
  31. package/lib/RuntimePlugin.js +27 -6
  32. package/lib/RuntimeTemplate.js +125 -57
  33. package/lib/SourceMapDevToolPlugin.js +26 -8
  34. package/lib/WebpackOptionsApply.js +33 -9
  35. package/lib/asset/AssetBytesGenerator.js +2 -1
  36. package/lib/asset/AssetGenerator.js +3 -5
  37. package/lib/asset/AssetSourceGenerator.js +1 -1
  38. package/lib/cache/getLazyHashedEtag.js +1 -1
  39. package/lib/config/browserslistTargetHandler.js +82 -76
  40. package/lib/config/defaults.js +105 -20
  41. package/lib/config/normalization.js +2 -1
  42. package/lib/config/target.js +7 -1
  43. package/lib/css/CssGenerator.js +283 -57
  44. package/lib/css/CssLoadingRuntimeModule.js +2 -0
  45. package/lib/css/CssMergeStyleSheetsRuntimeModule.js +56 -0
  46. package/lib/css/CssModulesPlugin.js +86 -40
  47. package/lib/css/CssParser.js +1174 -667
  48. package/lib/css/walkCssTokens.js +98 -1
  49. package/lib/dependencies/CommonJsImportsParserPlugin.js +0 -9
  50. package/lib/dependencies/CommonJsPlugin.js +12 -0
  51. package/lib/dependencies/ContextElementDependency.js +2 -2
  52. package/lib/dependencies/CssIcssExportDependency.js +247 -8
  53. package/lib/dependencies/CssIcssFromIdentifierDependency.js +124 -0
  54. package/lib/dependencies/CssIcssGlobalIdentifierDependency.js +48 -0
  55. package/lib/dependencies/CssIcssImportDependency.js +60 -54
  56. package/lib/dependencies/CssIcssLocalIdentifierDependency.js +61 -0
  57. package/lib/dependencies/{CssSelfLocalIdentifierDependency.js → CssIcssSelfLocalIdentifierDependency.js} +88 -10
  58. package/lib/dependencies/CssIcssSymbolDependency.js +31 -29
  59. package/lib/dependencies/CssImportDependency.js +15 -5
  60. package/lib/dependencies/ExternalModuleInitFragment.js +1 -1
  61. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +95 -0
  62. package/lib/dependencies/HarmonyAcceptDependency.js +6 -1
  63. package/lib/dependencies/HarmonyAcceptImportDependency.js +2 -1
  64. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +12 -1
  65. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +32 -21
  66. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +12 -8
  67. package/lib/dependencies/HarmonyImportDependency.js +27 -28
  68. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +28 -69
  69. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -3
  70. package/lib/dependencies/HarmonyImportSpecifierDependency.js +10 -8
  71. package/lib/dependencies/ImportContextDependency.js +13 -0
  72. package/lib/dependencies/ImportDependency.js +10 -4
  73. package/lib/dependencies/ImportEagerDependency.js +6 -3
  74. package/lib/dependencies/ImportMetaPlugin.js +98 -10
  75. package/lib/dependencies/ImportParserPlugin.js +19 -21
  76. package/lib/dependencies/ImportPhase.js +121 -0
  77. package/lib/dependencies/ImportWeakDependency.js +6 -3
  78. package/lib/dependencies/ModuleDependency.js +5 -1
  79. package/lib/dependencies/ModuleHotAcceptDependency.js +1 -1
  80. package/lib/dependencies/WorkerPlugin.js +1 -3
  81. package/lib/esm/ExportWebpackRequireRuntimeModule.js +1 -8
  82. package/lib/hmr/LazyCompilationPlugin.js +1 -0
  83. package/lib/ids/HashedModuleIdsPlugin.js +5 -7
  84. package/lib/ids/IdHelpers.js +5 -2
  85. package/lib/index.js +6 -0
  86. package/lib/javascript/ChunkHelpers.js +16 -5
  87. package/lib/javascript/JavascriptGenerator.js +101 -101
  88. package/lib/javascript/JavascriptModulesPlugin.js +25 -16
  89. package/lib/javascript/JavascriptParser.js +143 -39
  90. package/lib/json/JsonParser.js +7 -1
  91. package/lib/library/ModuleLibraryPlugin.js +0 -10
  92. package/lib/library/SystemLibraryPlugin.js +19 -5
  93. package/lib/library/UmdLibraryPlugin.js +1 -1
  94. package/lib/node/NodeTargetPlugin.js +9 -1
  95. package/lib/node/ReadFileCompileWasmPlugin.js +0 -2
  96. package/lib/optimize/ConcatenatedModule.js +161 -135
  97. package/lib/optimize/RealContentHashPlugin.js +5 -3
  98. package/lib/runtime/AsyncModuleRuntimeModule.js +28 -18
  99. package/lib/runtime/AutoPublicPathRuntimeModule.js +8 -3
  100. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +89 -55
  101. package/lib/serialization/FileMiddleware.js +1 -1
  102. package/lib/serialization/ObjectMiddleware.js +1 -1
  103. package/lib/stats/DefaultStatsFactoryPlugin.js +1 -1
  104. package/lib/util/Hash.js +35 -5
  105. package/lib/util/comparators.js +4 -3
  106. package/lib/util/create-schema-validation.js +1 -1
  107. package/lib/util/createHash.js +85 -15
  108. package/lib/util/hash/BatchedHash.js +47 -8
  109. package/lib/util/hash/wasm-hash.js +53 -13
  110. package/lib/util/internalSerializables.js +4 -4
  111. package/lib/util/jsonParseEvenBetterErrors.js +10 -0
  112. package/lib/wasm/EnableWasmLoadingPlugin.js +10 -4
  113. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +8 -5
  114. package/lib/wasm-async/AsyncWebAssemblyParser.js +0 -9
  115. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +8 -4
  116. package/lib/wasm-sync/WebAssemblyParser.js +0 -9
  117. package/lib/web/FetchCompileWasmPlugin.js +0 -2
  118. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
  119. package/lib/webpack.js +85 -82
  120. package/module.d.ts +5 -0
  121. package/package.json +28 -26
  122. package/schemas/WebpackOptions.check.js +1 -1
  123. package/schemas/WebpackOptions.json +110 -15
  124. package/schemas/plugins/{HashedModuleIdsPlugin.check.d.ts → ManifestPlugin.check.d.ts} +1 -1
  125. package/schemas/plugins/ManifestPlugin.check.js +6 -0
  126. package/schemas/plugins/ManifestPlugin.json +98 -0
  127. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  128. package/schemas/plugins/SourceMapDevToolPlugin.json +16 -3
  129. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  130. package/schemas/plugins/container/ContainerReferencePlugin.json +4 -1
  131. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  132. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  133. package/schemas/plugins/container/ModuleFederationPlugin.json +4 -1
  134. package/schemas/plugins/css/CssAutoParserOptions.check.js +1 -1
  135. package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
  136. package/schemas/plugins/css/CssGlobalParserOptions.check.js +1 -1
  137. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
  138. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  139. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  140. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.d.ts +7 -0
  141. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +6 -0
  142. package/schemas/plugins/{HashedModuleIdsPlugin.json → ids/HashedModuleIdsPlugin.json} +15 -2
  143. package/schemas/plugins/json/JsonModulesPluginParser.check.js +1 -1
  144. package/types.d.ts +788 -127
  145. package/lib/dependencies/CssLocalIdentifierDependency.js +0 -252
  146. package/schemas/plugins/HashedModuleIdsPlugin.check.js +0 -6
@@ -20,6 +20,7 @@ const { makePathsAbsolute } = require("./util/identifier");
20
20
  /** @typedef {import("webpack-sources").MapOptions} MapOptions */
21
21
  /** @typedef {import("webpack-sources").Source} Source */
22
22
  /** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
23
+ /** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").Rules} Rules */
23
24
  /** @typedef {import("./CacheFacade").ItemCacheFacade} ItemCacheFacade */
24
25
  /** @typedef {import("./Chunk")} Chunk */
25
26
  /** @typedef {import("./Compilation").Asset} Asset */
@@ -433,6 +434,25 @@ class SourceMapDevToolPlugin {
433
434
  moduleToSourceNameMapping.get(m)
434
435
  );
435
436
  sourceMap.sources = /** @type {string[]} */ (moduleFilenames);
437
+ sourceMap.ignoreList = options.ignoreList
438
+ ? sourceMap.sources.reduce(
439
+ /** @type {(acc: number[], sourceName: string, idx: number) => number[]} */ (
440
+ (acc, sourceName, idx) => {
441
+ const rule = /** @type {Rules} */ (
442
+ options.ignoreList
443
+ );
444
+ if (
445
+ ModuleFilenameHelpers.matchPart(sourceName, rule)
446
+ ) {
447
+ acc.push(idx);
448
+ }
449
+ return acc;
450
+ }
451
+ ),
452
+ []
453
+ )
454
+ : [];
455
+
436
456
  if (options.noSources) {
437
457
  sourceMap.sourcesContent = undefined;
438
458
  }
@@ -482,14 +502,12 @@ class SourceMapDevToolPlugin {
482
502
  const sourceMapString = JSON.stringify(sourceMap);
483
503
  if (sourceMapFilename) {
484
504
  const filename = file;
485
- const sourceMapContentHash =
486
- /** @type {string} */
487
- (
488
- usesContentHash &&
489
- createHash(compilation.outputOptions.hashFunction)
490
- .update(sourceMapString)
491
- .digest("hex")
492
- );
505
+ const sourceMapContentHash = usesContentHash
506
+ ? createHash(compilation.outputOptions.hashFunction)
507
+ .update(sourceMapString)
508
+ .digest("hex")
509
+ : undefined;
510
+
493
511
  const pathParams = {
494
512
  chunk,
495
513
  filename: options.fileContext
@@ -18,6 +18,7 @@ const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin");
18
18
 
19
19
  const JavascriptMetaInfoPlugin = require("./JavascriptMetaInfoPlugin");
20
20
 
21
+ const NodeStuffPlugin = require("./NodeStuffPlugin");
21
22
  const OptionsApply = require("./OptionsApply");
22
23
 
23
24
  const RecordIdsPlugin = require("./RecordIdsPlugin");
@@ -109,7 +110,15 @@ class WebpackOptionsApply extends OptionsApply {
109
110
  if (options.externalsPresets.node) {
110
111
  const NodeTargetPlugin = require("./node/NodeTargetPlugin");
111
112
 
112
- new NodeTargetPlugin().apply(compiler);
113
+ // Some older versions of Node.js don't support all built-in modules via import, only via `require`,
114
+ // but шt seems like there shouldn't be a warning here since these versions are rarely used in real applications
115
+ new NodeTargetPlugin(
116
+ options.output.module &&
117
+ compiler.platform.node === null &&
118
+ compiler.platform.web === null
119
+ ? "module-import"
120
+ : "node-commonjs"
121
+ ).apply(compiler);
113
122
 
114
123
  // Handle external CSS `@import` and `url()`
115
124
  if (options.experiments.css) {
@@ -126,7 +135,9 @@ class WebpackOptionsApply extends OptionsApply {
126
135
  if (dependencyType === "url") {
127
136
  return callback(null, `asset ${request}`);
128
137
  } else if (
129
- dependencyType === "css-import" &&
138
+ (dependencyType === "css-import" ||
139
+ dependencyType === "css-import-local-module" ||
140
+ dependencyType === "css-import-global-module") &&
130
141
  options.experiments.css
131
142
  ) {
132
143
  return callback(null, `css-import ${request}`);
@@ -149,7 +160,9 @@ class WebpackOptionsApply extends OptionsApply {
149
160
  if (dependencyType === "url") {
150
161
  return callback(null, `asset ${request}`);
151
162
  } else if (
152
- dependencyType === "css-import" &&
163
+ (dependencyType === "css-import" ||
164
+ dependencyType === "css-import-local-module" ||
165
+ dependencyType === "css-import-global-module") &&
153
166
  options.experiments.css
154
167
  ) {
155
168
  return callback(null, `css-import ${request}`);
@@ -294,6 +307,14 @@ class WebpackOptionsApply extends OptionsApply {
294
307
  ).apply(compiler);
295
308
  }
296
309
 
310
+ if (options.dotenv) {
311
+ const DotenvPlugin = require("./DotenvPlugin");
312
+
313
+ new DotenvPlugin(
314
+ typeof options.dotenv === "boolean" ? {} : options.dotenv
315
+ ).apply(compiler);
316
+ }
317
+
297
318
  if (options.devtool) {
298
319
  if (options.devtool.includes("source-map")) {
299
320
  const hidden = options.devtool.includes("hidden");
@@ -444,11 +465,11 @@ class WebpackOptionsApply extends OptionsApply {
444
465
  }
445
466
  new CommonJsPlugin().apply(compiler);
446
467
  new LoaderPlugin().apply(compiler);
447
- if (options.node !== false) {
448
- const NodeStuffPlugin = require("./NodeStuffPlugin");
449
-
450
- new NodeStuffPlugin(options.node).apply(compiler);
451
- }
468
+ new NodeStuffPlugin({
469
+ global: options.node ? options.node.global : false,
470
+ __dirname: options.node ? options.node.__dirname : false,
471
+ __filename: options.node ? options.node.__filename : false
472
+ }).apply(compiler);
452
473
  new APIPlugin().apply(compiler);
453
474
  new ExportsInfoApiPlugin().apply(compiler);
454
475
  new WebpackIsIncludedPlugin().apply(compiler);
@@ -667,8 +688,11 @@ class WebpackOptionsApply extends OptionsApply {
667
688
  if (options.optimization.nodeEnv) {
668
689
  const DefinePlugin = require("./DefinePlugin");
669
690
 
691
+ const defValue = JSON.stringify(options.optimization.nodeEnv);
692
+
670
693
  new DefinePlugin({
671
- "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv)
694
+ "process.env.NODE_ENV": defValue,
695
+ "import.meta.env.NODE_ENV": defValue
672
696
  }).apply(compiler);
673
697
  }
674
698
  if (options.optimization.minimize) {
@@ -53,6 +53,7 @@ class AssetSourceGenerator extends Generator {
53
53
 
54
54
  const encodedSource = originalSource.buffer().toString("base64");
55
55
 
56
+ runtimeRequirements.add(RuntimeGlobals.requireScope);
56
57
  runtimeRequirements.add(RuntimeGlobals.toBinary);
57
58
 
58
59
  let sourceContent;
@@ -65,7 +66,7 @@ class AssetSourceGenerator extends Generator {
65
66
  } = ${RuntimeGlobals.toBinary}(${JSON.stringify(encodedSource)});`;
66
67
  } else {
67
68
  runtimeRequirements.add(RuntimeGlobals.module);
68
- sourceContent = `${RuntimeGlobals.module}.exports = ${RuntimeGlobals.toBinary}(${JSON.stringify(
69
+ sourceContent = `${module.moduleArgument}.exports = ${RuntimeGlobals.toBinary}(${JSON.stringify(
69
70
  encodedSource
70
71
  )});`;
71
72
  }
@@ -244,11 +244,10 @@ class AssetGenerator extends Generator {
244
244
  hash.update(module.error.toString());
245
245
  }
246
246
 
247
- const fullContentHash = /** @type {string} */ (
248
- hash.digest(runtimeTemplate.outputOptions.hashDigest)
247
+ const fullContentHash = hash.digest(
248
+ runtimeTemplate.outputOptions.hashDigest
249
249
  );
250
250
 
251
- /** @type {string} */
252
251
  const contentHash = nonNumericOnlyHash(
253
252
  fullContentHash,
254
253
  runtimeTemplate.outputOptions.hashDigestLength
@@ -381,7 +380,6 @@ class AssetGenerator extends Generator {
381
380
  }
382
381
 
383
382
  return {
384
- // eslint-disable-next-line object-shorthand
385
383
  assetPath: /** @type {string} */ (assetPath),
386
384
  assetInfo: { sourceFilename, ...assetInfo }
387
385
  };
@@ -615,7 +613,7 @@ class AssetGenerator extends Generator {
615
613
 
616
614
  runtimeRequirements.add(RuntimeGlobals.module);
617
615
 
618
- return new RawSource(`${RuntimeGlobals.module}.exports = ${content};`);
616
+ return new RawSource(`${module.moduleArgument}.exports = ${content};`);
619
617
  } else if (type === "css-url") {
620
618
  return null;
621
619
  }
@@ -65,7 +65,7 @@ class AssetSourceGenerator extends Generator {
65
65
  } = ${JSON.stringify(encodedSource)};`;
66
66
  } else {
67
67
  runtimeRequirements.add(RuntimeGlobals.module);
68
- sourceContent = `${RuntimeGlobals.module}.exports = ${JSON.stringify(
68
+ sourceContent = `${module.moduleArgument}.exports = ${JSON.stringify(
69
69
  encodedSource
70
70
  )};`;
71
71
  }
@@ -34,7 +34,7 @@ class LazyHashedEtag {
34
34
  if (this._hash === undefined) {
35
35
  const hash = createHash(this._hashFunction);
36
36
  this._obj.updateHash(hash);
37
- this._hash = /** @type {string} */ (hash.digest("base64"));
37
+ this._hash = hash.digest("base64");
38
38
  }
39
39
  return this._hash;
40
40
  }
@@ -15,59 +15,46 @@ const browserslist = require("browserslist");
15
15
  // [[C:]/path/to/config][:env]
16
16
  const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
17
17
 
18
- /**
19
- * @typedef {object} BrowserslistHandlerConfig
20
- * @property {string=} configPath
21
- * @property {string=} env
22
- * @property {string=} query
23
- */
24
-
25
18
  /**
26
19
  * @param {string | null | undefined} input input string
27
20
  * @param {string} context the context directory
28
- * @returns {BrowserslistHandlerConfig} config
21
+ * @returns {string[] | undefined} selected browsers
29
22
  */
30
- const parse = (input, context) => {
31
- if (!input) {
32
- return {};
33
- }
34
-
35
- if (path.isAbsolute(input)) {
23
+ const load = (input, context) => {
24
+ // browserslist:path-to-config
25
+ // browserslist:path-to-config:env
26
+ if (input && path.isAbsolute(input)) {
36
27
  const [, configPath, env] = inputRx.exec(input) || [];
37
- return { configPath, env };
38
- }
39
28
 
40
- const config = browserslist.findConfig(context);
29
+ const config = browserslist.loadConfig({
30
+ config: configPath,
31
+ env
32
+ });
41
33
 
42
- if (config && Object.keys(config).includes(input)) {
43
- return { env: input };
34
+ return browserslist(config, { env });
44
35
  }
45
36
 
46
- return { query: input };
47
- };
37
+ const env = input || undefined;
48
38
 
49
- /**
50
- * @param {string | null | undefined} input input string
51
- * @param {string} context the context directory
52
- * @returns {string[] | undefined} selected browsers
53
- */
54
- const load = (input, context) => {
55
- const { configPath, env, query } = parse(input, context);
39
+ const config = browserslist.loadConfig({
40
+ path: context,
41
+ env
42
+ });
56
43
 
57
- // if a query is specified, then use it, else
58
- // if a path to a config is specified then load it, else
59
- // find a nearest config
60
- const config =
61
- query ||
62
- (configPath
63
- ? browserslist.loadConfig({
64
- config: configPath,
65
- env
66
- })
67
- : browserslist.loadConfig({ path: context, env }));
44
+ // browserslist
45
+ // browserslist:env
46
+ if (config) {
47
+ try {
48
+ return browserslist(config, { env, throwOnMissing: true });
49
+ } catch (_err) {
50
+ // Nothing, no `env` was found in browserslist, maybe input is `queries`
51
+ }
52
+ }
68
53
 
69
- if (!config) return;
70
- return browserslist(config);
54
+ // browserslist:query
55
+ if (env) {
56
+ return browserslist(env);
57
+ }
71
58
  };
72
59
 
73
60
  /**
@@ -104,28 +91,6 @@ const resolve = (browsers) => {
104
91
  const anyBrowser = browsers.some((b) => /^(?!node)/.test(b));
105
92
  const browserProperty = !anyBrowser ? false : anyNode ? null : true;
106
93
  const nodeProperty = !anyNode ? false : anyBrowser ? null : true;
107
- // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features
108
- const es6DynamicImport = rawChecker({
109
- /* eslint-disable camelcase */
110
- chrome: 63,
111
- and_chr: 63,
112
- edge: 79,
113
- firefox: 67,
114
- and_ff: 67,
115
- // ie: Not supported
116
- opera: 50,
117
- op_mob: 46,
118
- safari: [11, 1],
119
- ios_saf: [11, 3],
120
- samsung: [8, 2],
121
- android: 63,
122
- and_qq: [10, 4],
123
- baidu: [13, 18],
124
- and_uc: [15, 5],
125
- kaios: [3, 0],
126
- node: [12, 17]
127
- /* eslint-enable camelcase */
128
- });
129
94
 
130
95
  return {
131
96
  /* eslint-disable camelcase */
@@ -188,9 +153,9 @@ const resolve = (browsers) => {
188
153
  ios_saf: 7,
189
154
  samsung: [3, 0],
190
155
  android: 38,
191
- // and_qq: Unknown support
156
+ and_qq: [10, 4],
192
157
  // baidu: Unknown support
193
- // and_uc: Unknown support
158
+ and_uc: [12, 12],
194
159
  kaios: [3, 0],
195
160
  node: [0, 12]
196
161
  }),
@@ -207,9 +172,9 @@ const resolve = (browsers) => {
207
172
  ios_saf: 8,
208
173
  samsung: [5, 0],
209
174
  android: 49,
210
- // and_qq: Unknown support
175
+ and_qq: [10, 4],
211
176
  // baidu: Unknown support
212
- // and_uc: Unknown support
177
+ and_uc: [12, 12],
213
178
  kaios: [2, 5],
214
179
  node: [6, 0]
215
180
  }),
@@ -253,8 +218,44 @@ const resolve = (browsers) => {
253
218
  kaios: [3, 0],
254
219
  node: [12, 17]
255
220
  }),
256
- dynamicImport: es6DynamicImport,
257
- dynamicImportInWorker: es6DynamicImport && !anyNode,
221
+ dynamicImport: rawChecker({
222
+ chrome: 63,
223
+ and_chr: 63,
224
+ edge: 79,
225
+ firefox: 67,
226
+ and_ff: 67,
227
+ // ie: Not supported
228
+ opera: 50,
229
+ op_mob: 46,
230
+ safari: [11, 1],
231
+ ios_saf: [11, 3],
232
+ samsung: [8, 2],
233
+ android: 63,
234
+ and_qq: [10, 4],
235
+ baidu: [13, 18],
236
+ and_uc: [15, 5],
237
+ kaios: [3, 0],
238
+ node: [12, 17]
239
+ }),
240
+ dynamicImportInWorker: rawChecker({
241
+ chrome: 80,
242
+ and_chr: 80,
243
+ edge: 80,
244
+ firefox: 114,
245
+ and_ff: 114,
246
+ // ie: Not supported
247
+ opera: 67,
248
+ op_mob: 57,
249
+ safari: [15, 0],
250
+ ios_saf: [15, 0],
251
+ samsung: [13, 0],
252
+ android: 80,
253
+ and_qq: [10, 4],
254
+ baidu: [13, 18],
255
+ and_uc: [15, 5],
256
+ kaios: [3, 0],
257
+ node: [12, 17]
258
+ }),
258
259
  // browserslist does not have info about globalThis
259
260
  // so this is based on mdn-browser-compat-data
260
261
  globalThis: rawChecker({
@@ -270,9 +271,9 @@ const resolve = (browsers) => {
270
271
  ios_saf: [12, 2],
271
272
  samsung: [10, 1],
272
273
  android: 71,
273
- // and_qq: Unknown support
274
+ and_qq: [13, 1],
274
275
  // baidu: Unknown support
275
- // and_uc: Unknown support
276
+ and_uc: [15, 5],
276
277
  kaios: [3, 0],
277
278
  node: 12
278
279
  }),
@@ -289,9 +290,9 @@ const resolve = (browsers) => {
289
290
  ios_saf: [13, 4],
290
291
  samsung: 13,
291
292
  android: 80,
292
- // and_qq: Not supported
293
+ and_qq: [13, 1],
293
294
  // baidu: Not supported
294
- // and_uc: Not supported
295
+ and_uc: [15, 5],
295
296
  kaios: [3, 0],
296
297
  node: 14
297
298
  }),
@@ -327,9 +328,9 @@ const resolve = (browsers) => {
327
328
  ios_saf: 11,
328
329
  samsung: [6, 2],
329
330
  android: 55,
330
- and_qq: [13, 1],
331
+ and_qq: [10, 4],
331
332
  baidu: [13, 18],
332
- and_uc: [15, 5],
333
+ and_uc: [12, 12],
333
334
  kaios: 3,
334
335
  node: [7, 6]
335
336
  }),
@@ -345,7 +346,7 @@ const resolve = (browsers) => {
345
346
  fetchWasm: browserProperty,
346
347
  global: nodeProperty,
347
348
  importScripts: false,
348
- importScriptsInWorker: true,
349
+ importScriptsInWorker: Boolean(browserProperty),
349
350
  nodeBuiltins: nodeProperty,
350
351
  nodePrefixForCoreModules:
351
352
  nodeProperty &&
@@ -353,6 +354,11 @@ const resolve = (browsers) => {
353
354
  rawChecker({
354
355
  node: [14, 18]
355
356
  }),
357
+ importMetaDirnameAndFilename:
358
+ nodeProperty &&
359
+ rawChecker({
360
+ node: [22, 16]
361
+ }),
356
362
  require: nodeProperty
357
363
  };
358
364
  };