webpack 5.99.9 → 5.100.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/bin/webpack.js +8 -2
- package/hot/log.js +15 -15
- package/hot/poll.js +1 -0
- package/lib/APIPlugin.js +3 -3
- package/lib/AbstractMethodError.js +1 -0
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +1 -1
- package/lib/CaseSensitiveModulesWarning.js +4 -4
- package/lib/Chunk.js +6 -6
- package/lib/ChunkGraph.js +37 -31
- package/lib/ChunkGroup.js +4 -4
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +94 -17
- package/lib/CodeGenerationResults.js +1 -1
- package/lib/CompatibilityPlugin.js +5 -2
- package/lib/Compilation.js +67 -45
- package/lib/Compiler.js +46 -16
- package/lib/ConcatenationScope.js +15 -6
- package/lib/ConstPlugin.js +5 -3
- package/lib/ContextModule.js +16 -12
- package/lib/ContextModuleFactory.js +4 -3
- package/lib/ContextReplacementPlugin.js +4 -2
- package/lib/CssModule.js +2 -2
- package/lib/DefinePlugin.js +111 -3
- package/lib/DelegatedModuleFactoryPlugin.js +18 -18
- package/lib/Dependency.js +11 -4
- package/lib/DependencyTemplate.js +1 -0
- package/lib/DllEntryPlugin.js +3 -1
- package/lib/DllPlugin.js +4 -3
- package/lib/DllReferencePlugin.js +2 -2
- package/lib/DynamicEntryPlugin.js +1 -1
- package/lib/EntryOptionPlugin.js +5 -0
- package/lib/ErrorHelpers.js +4 -4
- package/lib/EvalDevToolModulePlugin.js +3 -3
- package/lib/EvalSourceMapDevToolPlugin.js +7 -7
- package/lib/ExportsInfo.js +48 -39
- package/lib/ExternalModule.js +15 -11
- package/lib/ExternalModuleFactoryPlugin.js +5 -2
- package/lib/FileSystemInfo.js +51 -36
- package/lib/FlagDependencyExportsPlugin.js +14 -7
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +14 -1
- package/lib/HookWebpackError.js +1 -0
- package/lib/HotModuleReplacementPlugin.js +77 -50
- package/lib/IgnorePlugin.js +5 -2
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +0 -1
- package/lib/LibManifestPlugin.js +4 -2
- package/lib/LoaderOptionsPlugin.js +6 -4
- package/lib/MainTemplate.js +2 -2
- package/lib/Module.js +21 -6
- package/lib/ModuleFactory.js +1 -0
- package/lib/ModuleGraph.js +24 -2
- package/lib/ModuleGraphConnection.js +5 -5
- package/lib/ModuleInfoHeaderPlugin.js +2 -1
- package/lib/ModuleParseError.js +1 -0
- package/lib/ModuleSourceTypesConstants.js +12 -12
- package/lib/ModuleTemplate.js +1 -1
- package/lib/ModuleTypeConstants.js +21 -21
- package/lib/MultiCompiler.js +6 -6
- package/lib/NormalModule.js +31 -44
- package/lib/NormalModuleFactory.js +34 -20
- package/lib/NormalModuleReplacementPlugin.js +1 -1
- package/lib/NullFactory.js +1 -0
- package/lib/OptimizationStages.js +1 -1
- package/lib/Parser.js +1 -0
- package/lib/ProgressPlugin.js +12 -5
- package/lib/ProvidePlugin.js +5 -1
- package/lib/RawModule.js +14 -0
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/RuntimeGlobals.js +175 -155
- package/lib/RuntimeModule.js +1 -0
- package/lib/RuntimePlugin.js +33 -7
- package/lib/RuntimeTemplate.js +111 -11
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +15 -25
- package/lib/SourceMapDevToolPlugin.js +19 -17
- package/lib/Template.js +2 -2
- package/lib/TemplatedPathPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +7 -8
- package/lib/WatchIgnorePlugin.js +4 -3
- package/lib/WebpackIsIncludedPlugin.js +2 -1
- package/lib/WebpackOptionsApply.js +115 -27
- package/lib/asset/AssetGenerator.js +15 -11
- package/lib/asset/AssetModulesPlugin.js +19 -17
- package/lib/asset/AssetSourceGenerator.js +4 -4
- package/lib/asset/RawDataUrlModule.js +4 -2
- package/lib/async-modules/AwaitDependenciesInitFragment.js +1 -1
- package/lib/buildChunkGraph.js +6 -3
- package/lib/cache/AddBuildDependenciesPlugin.js +5 -6
- package/lib/cache/IdleFileCachePlugin.js +7 -4
- package/lib/cache/MemoryCachePlugin.js +1 -0
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +26 -20
- package/lib/cache/ResolverCachePlugin.js +16 -8
- package/lib/cli.js +15 -10
- package/lib/config/browserslistTargetHandler.js +3 -3
- package/lib/config/defaults.js +25 -17
- package/lib/config/normalization.js +2 -1
- package/lib/config/target.js +6 -5
- package/lib/container/ContainerPlugin.js +1 -1
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/container/FallbackModule.js +2 -1
- package/lib/container/HoistContainerReferencesPlugin.js +1 -1
- package/lib/container/ModuleFederationPlugin.js +2 -2
- package/lib/container/RemoteModule.js +1 -1
- package/lib/css/CssGenerator.js +9 -6
- package/lib/css/CssModulesPlugin.js +44 -31
- package/lib/css/CssParser.js +6 -4
- package/lib/css/walkCssTokens.js +33 -37
- package/lib/debug/ProfilingPlugin.js +6 -6
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -8
- package/lib/dependencies/AMDPlugin.js +12 -8
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +28 -26
- package/lib/dependencies/CachedConstDependency.js +1 -5
- package/lib/dependencies/CommonJsExportRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsExportsParserPlugin.js +22 -25
- package/lib/dependencies/CommonJsFullRequireDependency.js +1 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +100 -114
- package/lib/dependencies/CommonJsPlugin.js +15 -16
- package/lib/dependencies/ContextDependencyHelpers.js +2 -1
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/lib/dependencies/CssIcssExportDependency.js +1 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/DynamicExports.js +9 -9
- package/lib/dependencies/ExportsInfoDependency.js +1 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +122 -101
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +95 -19
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +11 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +238 -162
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +20 -9
- package/lib/dependencies/HarmonyModulesPlugin.js +23 -12
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
- package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
- package/lib/dependencies/ImportMetaPlugin.js +2 -2
- package/lib/dependencies/ImportParserPlugin.js +40 -9
- package/lib/dependencies/ImportPlugin.js +3 -1
- package/lib/dependencies/LoaderPlugin.js +1 -0
- package/lib/dependencies/ModuleDependency.js +3 -1
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +3 -1
- package/lib/dependencies/RequireEnsurePlugin.js +6 -6
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +33 -34
- package/lib/dependencies/RequireIncludePlugin.js +1 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/URLContextDependency.js +65 -0
- package/lib/dependencies/URLPlugin.js +17 -157
- package/lib/dependencies/WorkerPlugin.js +23 -10
- package/lib/dependencies/processExportInfo.js +2 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +269 -185
- package/lib/esm/ModuleChunkLoadingPlugin.js +39 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +70 -3
- package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +37 -0
- package/lib/hmr/LazyCompilationPlugin.js +4 -2
- package/lib/hmr/lazyCompilationBackend.js +4 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +6 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +30 -35
- package/lib/ids/DeterministicModuleIdsPlugin.js +4 -3
- package/lib/ids/HashedModuleIdsPlugin.js +5 -4
- package/lib/ids/IdHelpers.js +21 -17
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +4 -4
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +3 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +1 -1
- package/lib/index.js +13 -3
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +113 -119
- package/lib/javascript/BasicEvaluatedExpression.js +2 -1
- package/lib/javascript/ChunkHelpers.js +1 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +121 -136
- package/lib/javascript/EnableChunkLoadingPlugin.js +6 -3
- package/lib/javascript/JavascriptGenerator.js +14 -2
- package/lib/javascript/JavascriptModulesPlugin.js +68 -27
- package/lib/javascript/JavascriptParser.js +117 -76
- package/lib/javascript/JavascriptParserHelpers.js +41 -41
- package/lib/javascript/StartupHelpers.js +17 -17
- package/lib/json/JsonGenerator.js +4 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/json/JsonParser.js +1 -1
- package/lib/library/AbstractLibraryPlugin.js +6 -2
- package/lib/library/AssignLibraryPlugin.js +21 -6
- package/lib/library/EnableLibraryPlugin.js +23 -3
- package/lib/library/UmdLibraryPlugin.js +15 -6
- package/lib/logging/createConsoleLogger.js +3 -3
- package/lib/logging/runtime.js +9 -9
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/RequireChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/nodeConsole.js +4 -2
- package/lib/optimize/AggressiveMergingPlugin.js +45 -46
- package/lib/optimize/AggressiveSplittingPlugin.js +13 -12
- package/lib/optimize/ConcatenatedModule.js +227 -57
- package/lib/optimize/EnsureChunkConditionsPlugin.js +58 -58
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -1
- package/lib/optimize/InnerGraph.js +115 -112
- package/lib/optimize/InnerGraphPlugin.js +2 -2
- package/lib/optimize/LimitChunkCountPlugin.js +4 -2
- package/lib/optimize/MangleExportsPlugin.js +4 -3
- package/lib/optimize/MergeDuplicateChunksPlugin.js +80 -81
- package/lib/optimize/MinChunkSizePlugin.js +6 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +31 -22
- package/lib/optimize/RealContentHashPlugin.js +26 -20
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -2
- package/lib/optimize/SplitChunksPlugin.js +16 -13
- package/lib/rules/BasicEffectRulePlugin.js +4 -2
- package/lib/rules/BasicMatcherRulePlugin.js +3 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +3 -1
- package/lib/rules/RuleSetCompiler.js +19 -5
- package/lib/rules/UseEffectRulePlugin.js +17 -9
- package/lib/runtime/AsyncModuleRuntimeModule.js +64 -9
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +214 -0
- package/lib/runtime/RuntimeIdRuntimeModule.js +2 -1
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +8 -7
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +27 -19
- package/lib/schemes/VirtualUrlPlugin.js +222 -0
- package/lib/serialization/AggregateErrorSerializer.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +5 -4
- package/lib/serialization/FileMiddleware.js +7 -4
- package/lib/serialization/ObjectMiddleware.js +14 -8
- package/lib/serialization/Serializer.js +5 -3
- package/lib/serialization/SerializerMiddleware.js +2 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +3 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +2 -2
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +3 -2
- package/lib/sharing/SharePlugin.js +2 -1
- package/lib/sharing/ShareRuntimeModule.js +3 -5
- package/lib/sharing/utils.js +34 -34
- package/lib/stats/DefaultStatsFactoryPlugin.js +49 -46
- package/lib/stats/DefaultStatsPresetPlugin.js +13 -13
- package/lib/stats/DefaultStatsPrinterPlugin.js +15 -9
- package/lib/stats/StatsFactory.js +6 -3
- package/lib/stats/StatsPrinter.js +6 -7
- package/lib/url/URLParserPlugin.js +266 -0
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Hash.js +2 -0
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazyBucketSortedSet.js +2 -1
- package/lib/util/LazySet.js +11 -6
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/SetHelpers.js +3 -3
- package/lib/util/SortableSet.js +2 -2
- package/lib/util/StackedCacheMap.js +3 -1
- package/lib/util/StackedMap.js +2 -2
- package/lib/util/StringXor.js +1 -0
- package/lib/util/TupleSet.js +1 -0
- package/lib/util/URLAbsoluteSpecifier.js +1 -1
- package/lib/util/cleverMerge.js +95 -58
- package/lib/util/comparators.js +154 -127
- package/lib/util/compileBooleanMatcher.js +8 -3
- package/lib/util/concatenate.js +8 -7
- package/lib/util/conventions.js +72 -73
- package/lib/util/create-schema-validation.js +2 -1
- package/lib/util/createHash.js +10 -4
- package/lib/util/deprecation.js +69 -66
- package/lib/util/deterministicGrouping.js +4 -2
- package/lib/util/extractUrlAndGlobal.js +1 -1
- package/lib/util/findGraphRoots.js +2 -2
- package/lib/util/fs.js +30 -23
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/wasm-hash.js +4 -2
- package/lib/util/identifier.js +13 -12
- package/lib/util/internalSerializables.js +2 -0
- package/lib/util/magicComment.js +5 -5
- package/lib/util/processAsyncTree.js +1 -1
- package/lib/util/propertyAccess.js +1 -1
- package/lib/util/propertyName.js +1 -1
- package/lib/util/registerExternalSerializer.js +1 -2
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +29 -21
- package/lib/util/semver.js +1 -1
- package/lib/util/serialization.js +3 -0
- package/lib/util/source.js +3 -2
- package/lib/validateSchema.js +1 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +6 -3
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -1
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +46 -49
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +2 -3
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +3 -2
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +3 -0
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -22
- package/lib/webpack.js +4 -5
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -24
- package/lib/webworker/WebWorkerTemplatePlugin.js +1 -0
- package/package.json +119 -113
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +17 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts +7 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +6 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +77 -0
- package/types.d.ts +1243 -409
package/lib/config/defaults.js
CHANGED
|
@@ -8,26 +8,26 @@
|
|
|
8
8
|
const fs = require("fs");
|
|
9
9
|
const path = require("path");
|
|
10
10
|
const {
|
|
11
|
-
JAVASCRIPT_MODULE_TYPE_AUTO,
|
|
12
|
-
JAVASCRIPT_MODULE_TYPE_ESM,
|
|
13
|
-
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
|
|
14
|
-
JSON_MODULE_TYPE,
|
|
15
|
-
WEBASSEMBLY_MODULE_TYPE_ASYNC,
|
|
16
|
-
WEBASSEMBLY_MODULE_TYPE_SYNC,
|
|
17
11
|
ASSET_MODULE_TYPE,
|
|
18
12
|
ASSET_MODULE_TYPE_INLINE,
|
|
19
13
|
ASSET_MODULE_TYPE_RESOURCE,
|
|
20
|
-
CSS_MODULE_TYPE_AUTO,
|
|
21
14
|
CSS_MODULE_TYPE,
|
|
15
|
+
CSS_MODULE_TYPE_AUTO,
|
|
16
|
+
CSS_MODULE_TYPE_GLOBAL,
|
|
22
17
|
CSS_MODULE_TYPE_MODULE,
|
|
23
|
-
|
|
18
|
+
JAVASCRIPT_MODULE_TYPE_AUTO,
|
|
19
|
+
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
|
|
20
|
+
JAVASCRIPT_MODULE_TYPE_ESM,
|
|
21
|
+
JSON_MODULE_TYPE,
|
|
22
|
+
WEBASSEMBLY_MODULE_TYPE_ASYNC,
|
|
23
|
+
WEBASSEMBLY_MODULE_TYPE_SYNC
|
|
24
24
|
} = require("../ModuleTypeConstants");
|
|
25
25
|
const Template = require("../Template");
|
|
26
26
|
const { cleverMerge } = require("../util/cleverMerge");
|
|
27
27
|
const {
|
|
28
|
-
|
|
28
|
+
getDefaultTarget,
|
|
29
29
|
getTargetProperties,
|
|
30
|
-
|
|
30
|
+
getTargetsProperties
|
|
31
31
|
} = require("./target");
|
|
32
32
|
|
|
33
33
|
/** @typedef {import("../../declarations/WebpackOptions").CacheOptions} CacheOptions */
|
|
@@ -287,6 +287,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => {
|
|
|
287
287
|
F(options, "externalsType", () => {
|
|
288
288
|
const validExternalTypes = require("../../schemas/WebpackOptions.json")
|
|
289
289
|
.definitions.ExternalsType.enum;
|
|
290
|
+
|
|
290
291
|
return options.output.library &&
|
|
291
292
|
validExternalTypes.includes(options.output.library.type)
|
|
292
293
|
? /** @type {ExternalsType} */ (options.output.library.type)
|
|
@@ -585,6 +586,7 @@ const applyJavascriptParserOptionsDefaults = (
|
|
|
585
586
|
D(parserOptions, "dynamicImportPreload", false);
|
|
586
587
|
D(parserOptions, "dynamicImportFetchPriority", false);
|
|
587
588
|
D(parserOptions, "createRequire", isNode);
|
|
589
|
+
D(parserOptions, "dynamicUrl", true);
|
|
588
590
|
if (futureDefaults) D(parserOptions, "exportsPresence", "error");
|
|
589
591
|
};
|
|
590
592
|
|
|
@@ -993,7 +995,7 @@ const applyOutputDefaults = (
|
|
|
993
995
|
if (libraryName) return libraryName;
|
|
994
996
|
const pkgPath = path.resolve(context, "package.json");
|
|
995
997
|
try {
|
|
996
|
-
const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "
|
|
998
|
+
const packageInfo = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
997
999
|
return packageInfo.name || "";
|
|
998
1000
|
} catch (err) {
|
|
999
1001
|
if (/** @type {Error & { code: string }} */ (err).code !== "ENOENT") {
|
|
@@ -1240,7 +1242,7 @@ const applyOutputDefaults = (
|
|
|
1240
1242
|
tp.nodeBuiltins === null ||
|
|
1241
1243
|
tp.importScriptsInWorker === null) &&
|
|
1242
1244
|
output.module &&
|
|
1243
|
-
environment.
|
|
1245
|
+
environment.dynamicImportInWorker
|
|
1244
1246
|
) {
|
|
1245
1247
|
return "universal";
|
|
1246
1248
|
}
|
|
@@ -1275,7 +1277,11 @@ const applyOutputDefaults = (
|
|
|
1275
1277
|
"hotUpdateChunkFilename",
|
|
1276
1278
|
`[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}`
|
|
1277
1279
|
);
|
|
1278
|
-
D(
|
|
1280
|
+
D(
|
|
1281
|
+
output,
|
|
1282
|
+
"hotUpdateMainFilename",
|
|
1283
|
+
`[runtime].[fullhash].hot-update.${output.module ? "json.mjs" : "json"}`
|
|
1284
|
+
);
|
|
1279
1285
|
D(output, "crossOriginLoading", false);
|
|
1280
1286
|
F(output, "scriptType", () => (output.module ? "module" : false));
|
|
1281
1287
|
D(
|
|
@@ -1348,7 +1354,7 @@ const applyOutputDefaults = (
|
|
|
1348
1354
|
enabledChunkLoadingTypes.add(desc.chunkLoading);
|
|
1349
1355
|
}
|
|
1350
1356
|
});
|
|
1351
|
-
return
|
|
1357
|
+
return [...enabledChunkLoadingTypes];
|
|
1352
1358
|
});
|
|
1353
1359
|
|
|
1354
1360
|
A(output, "enabledWasmLoadingTypes", () => {
|
|
@@ -1364,7 +1370,7 @@ const applyOutputDefaults = (
|
|
|
1364
1370
|
enabledWasmLoadingTypes.add(desc.wasmLoading);
|
|
1365
1371
|
}
|
|
1366
1372
|
});
|
|
1367
|
-
return
|
|
1373
|
+
return [...enabledWasmLoadingTypes];
|
|
1368
1374
|
});
|
|
1369
1375
|
};
|
|
1370
1376
|
|
|
@@ -1480,8 +1486,9 @@ const applyNodeDefaults = (
|
|
|
1480
1486
|
});
|
|
1481
1487
|
|
|
1482
1488
|
const handlerForNames = () => {
|
|
1483
|
-
if (targetProperties && targetProperties.node)
|
|
1489
|
+
if (targetProperties && targetProperties.node) {
|
|
1484
1490
|
return outputModule ? "node-module" : "eval-only";
|
|
1491
|
+
}
|
|
1485
1492
|
// TODO webpack 6 should always default to false
|
|
1486
1493
|
return futureDefaults ? "warn-mock" : "mock";
|
|
1487
1494
|
};
|
|
@@ -1549,6 +1556,7 @@ const applyOptimizationDefaults = (
|
|
|
1549
1556
|
apply: compiler => {
|
|
1550
1557
|
// Lazy load the Terser plugin
|
|
1551
1558
|
const TerserPlugin = require("terser-webpack-plugin");
|
|
1559
|
+
|
|
1552
1560
|
new TerserPlugin({
|
|
1553
1561
|
terserOptions: {
|
|
1554
1562
|
compress: {
|
|
@@ -1738,7 +1746,7 @@ const applyInfrastructureLoggingDefaults = infrastructureLogging => {
|
|
|
1738
1746
|
D(infrastructureLogging, "appendOnly", !tty);
|
|
1739
1747
|
};
|
|
1740
1748
|
|
|
1749
|
+
module.exports.DEFAULTS = DEFAULTS;
|
|
1741
1750
|
module.exports.applyWebpackOptionsBaseDefaults =
|
|
1742
1751
|
applyWebpackOptionsBaseDefaults;
|
|
1743
1752
|
module.exports.applyWebpackOptionsDefaults = applyWebpackOptionsDefaults;
|
|
1744
|
-
module.exports.DEFAULTS = DEFAULTS;
|
|
@@ -386,8 +386,9 @@ const getNormalizedWebpackOptions = config => ({
|
|
|
386
386
|
strictModuleExceptionHandling: output.strictModuleExceptionHandling,
|
|
387
387
|
trustedTypes: optionalNestedConfig(output.trustedTypes, trustedTypes => {
|
|
388
388
|
if (trustedTypes === true) return {};
|
|
389
|
-
if (typeof trustedTypes === "string")
|
|
389
|
+
if (typeof trustedTypes === "string") {
|
|
390
390
|
return { policyName: trustedTypes };
|
|
391
|
+
}
|
|
391
392
|
return { ...trustedTypes };
|
|
392
393
|
}),
|
|
393
394
|
uniqueName: output.uniqueName,
|
package/lib/config/target.js
CHANGED
|
@@ -194,7 +194,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
194
194
|
destructuring: v(6),
|
|
195
195
|
bigIntLiteral: v(10, 4),
|
|
196
196
|
dynamicImport: v(12, 17),
|
|
197
|
-
dynamicImportInWorker:
|
|
197
|
+
dynamicImportInWorker: v(12, 17),
|
|
198
198
|
module: v(12, 17)
|
|
199
199
|
};
|
|
200
200
|
}
|
|
@@ -240,7 +240,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
240
240
|
destructuring: v(1, 1),
|
|
241
241
|
bigIntLiteral: v(4),
|
|
242
242
|
dynamicImport: v(11),
|
|
243
|
-
dynamicImportInWorker:
|
|
243
|
+
dynamicImportInWorker: v(11),
|
|
244
244
|
module: v(11)
|
|
245
245
|
};
|
|
246
246
|
}
|
|
@@ -278,7 +278,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
278
278
|
destructuring: v(0, 15),
|
|
279
279
|
bigIntLiteral: v(0, 32),
|
|
280
280
|
dynamicImport: v(0, 43),
|
|
281
|
-
dynamicImportInWorker:
|
|
281
|
+
dynamicImportInWorker: v(0, 44),
|
|
282
282
|
module: v(0, 43)
|
|
283
283
|
};
|
|
284
284
|
}
|
|
@@ -289,7 +289,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
289
289
|
/^es(\d+)$/,
|
|
290
290
|
version => {
|
|
291
291
|
let v = Number(version);
|
|
292
|
-
if (v < 1000) v
|
|
292
|
+
if (v < 1000) v += 2009;
|
|
293
293
|
return {
|
|
294
294
|
const: v >= 2015,
|
|
295
295
|
templateLiteral: v >= 2015,
|
|
@@ -357,9 +357,10 @@ const mergeTargetProperties = targetProperties => {
|
|
|
357
357
|
break;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
if (hasTrue || hasFalse)
|
|
360
|
+
if (hasTrue || hasFalse) {
|
|
361
361
|
/** @type {TargetProperties} */
|
|
362
362
|
(result)[key] = hasFalse && hasTrue ? null : Boolean(hasTrue);
|
|
363
|
+
}
|
|
363
364
|
}
|
|
364
365
|
return result;
|
|
365
366
|
};
|
|
@@ -22,7 +22,7 @@ const getModuleFederationPlugin = memoize(() =>
|
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const validate = createSchemaValidation(
|
|
25
|
-
require("../../schemas/plugins/container/ContainerPlugin.check
|
|
25
|
+
require("../../schemas/plugins/container/ContainerPlugin.check"),
|
|
26
26
|
() => require("../../schemas/plugins/container/ContainerPlugin.json"),
|
|
27
27
|
{
|
|
28
28
|
name: "Container Plugin",
|
|
@@ -21,7 +21,7 @@ const { parseOptions } = require("./options");
|
|
|
21
21
|
/** @typedef {import("../Compiler")} Compiler */
|
|
22
22
|
|
|
23
23
|
const validate = createSchemaValidation(
|
|
24
|
-
require("../../schemas/plugins/container/ContainerReferencePlugin.check
|
|
24
|
+
require("../../schemas/plugins/container/ContainerReferencePlugin.check"),
|
|
25
25
|
() =>
|
|
26
26
|
require("../../schemas/plugins/container/ContainerReferencePlugin.json"),
|
|
27
27
|
{
|
|
@@ -104,8 +104,9 @@ class FallbackModule extends Module {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
this.clearDependenciesAndBlocks();
|
|
107
|
-
for (const request of this.requests)
|
|
107
|
+
for (const request of this.requests) {
|
|
108
108
|
this.addDependency(new FallbackItemDependency(request));
|
|
109
|
+
}
|
|
109
110
|
|
|
110
111
|
callback();
|
|
111
112
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const { SyncHook } = require("tapable");
|
|
9
|
-
const isValidExternalsType = require("../../schemas/plugins/container/ExternalsType.check
|
|
9
|
+
const isValidExternalsType = require("../../schemas/plugins/container/ExternalsType.check");
|
|
10
10
|
const Compilation = require("../Compilation");
|
|
11
11
|
const SharePlugin = require("../sharing/SharePlugin");
|
|
12
12
|
const createSchemaValidation = require("../util/create-schema-validation");
|
|
@@ -27,7 +27,7 @@ const HoistContainerReferences = require("./HoistContainerReferencesPlugin");
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const validate = createSchemaValidation(
|
|
30
|
-
require("../../schemas/plugins/container/ModuleFederationPlugin.check
|
|
30
|
+
require("../../schemas/plugins/container/ModuleFederationPlugin.check"),
|
|
31
31
|
() => require("../../schemas/plugins/container/ModuleFederationPlugin.json"),
|
|
32
32
|
{
|
|
33
33
|
name: "Module Federation Plugin",
|
|
@@ -141,7 +141,7 @@ class RemoteModule extends Module {
|
|
|
141
141
|
* @param {CodeGenerationContext} context context for code generation
|
|
142
142
|
* @returns {CodeGenerationResult} result
|
|
143
143
|
*/
|
|
144
|
-
codeGeneration({
|
|
144
|
+
codeGeneration({ moduleGraph, chunkGraph }) {
|
|
145
145
|
const module = moduleGraph.getModule(this.dependencies[0]);
|
|
146
146
|
const id = module && chunkGraph.getModuleId(module);
|
|
147
147
|
const sources = new Map();
|
package/lib/css/CssGenerator.js
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { ConcatSource, RawSource, ReplaceSource } = require("webpack-sources");
|
|
9
9
|
const { UsageState } = require("../ExportsInfo");
|
|
10
10
|
const Generator = require("../Generator");
|
|
11
11
|
const InitFragment = require("../InitFragment");
|
|
12
12
|
const {
|
|
13
|
+
CSS_TYPE,
|
|
14
|
+
CSS_TYPES,
|
|
13
15
|
JS_AND_CSS_EXPORT_TYPES,
|
|
14
16
|
JS_AND_CSS_TYPES,
|
|
15
|
-
|
|
16
|
-
JS_TYPE,
|
|
17
|
-
CSS_TYPE
|
|
17
|
+
JS_TYPE
|
|
18
18
|
} = require("../ModuleSourceTypesConstants");
|
|
19
19
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
20
20
|
const Template = require("../Template");
|
|
@@ -155,7 +155,9 @@ class CssGenerator extends Generator {
|
|
|
155
155
|
continue;
|
|
156
156
|
}
|
|
157
157
|
let identifier = Template.toIdentifier(usedName);
|
|
158
|
+
|
|
158
159
|
const { RESERVED_IDENTIFIER } = require("../util/propertyName");
|
|
160
|
+
|
|
159
161
|
if (RESERVED_IDENTIFIER.has(identifier)) {
|
|
160
162
|
identifier = `_${identifier}`;
|
|
161
163
|
}
|
|
@@ -260,8 +262,9 @@ class CssGenerator extends Generator {
|
|
|
260
262
|
if (!connection.originModule) {
|
|
261
263
|
continue;
|
|
262
264
|
}
|
|
263
|
-
if (connection.originModule.type.split("/")[0] !== CSS_TYPE)
|
|
265
|
+
if (connection.originModule.type.split("/")[0] !== CSS_TYPE) {
|
|
264
266
|
sourceTypes.add(JS_TYPE);
|
|
267
|
+
}
|
|
265
268
|
}
|
|
266
269
|
if (sourceTypes.has(JS_TYPE)) {
|
|
267
270
|
return JS_AND_CSS_TYPES;
|
|
@@ -289,7 +292,7 @@ class CssGenerator extends Generator {
|
|
|
289
292
|
}
|
|
290
293
|
const exports = cssData.exports;
|
|
291
294
|
const stringifiedExports = JSON.stringify(
|
|
292
|
-
|
|
295
|
+
[...exports].reduce((obj, [key, value]) => {
|
|
293
296
|
obj[key] = value;
|
|
294
297
|
return obj;
|
|
295
298
|
}, /** @type {Record<string, string>} */ ({}))
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { SyncHook, SyncWaterfallHook } = require("tapable");
|
|
9
9
|
const {
|
|
10
|
+
CachedSource,
|
|
10
11
|
ConcatSource,
|
|
11
12
|
PrefixSource,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
RawSource
|
|
13
|
+
RawSource,
|
|
14
|
+
ReplaceSource
|
|
15
15
|
} = require("webpack-sources");
|
|
16
16
|
const Compilation = require("../Compilation");
|
|
17
17
|
const CssModule = require("../CssModule");
|
|
@@ -19,9 +19,9 @@ const { tryRunOrWebpackError } = require("../HookWebpackError");
|
|
|
19
19
|
const HotUpdateChunk = require("../HotUpdateChunk");
|
|
20
20
|
const {
|
|
21
21
|
CSS_MODULE_TYPE,
|
|
22
|
+
CSS_MODULE_TYPE_AUTO,
|
|
22
23
|
CSS_MODULE_TYPE_GLOBAL,
|
|
23
|
-
CSS_MODULE_TYPE_MODULE
|
|
24
|
-
CSS_MODULE_TYPE_AUTO
|
|
24
|
+
CSS_MODULE_TYPE_MODULE
|
|
25
25
|
} = require("../ModuleTypeConstants");
|
|
26
26
|
const NormalModule = require("../NormalModule");
|
|
27
27
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
@@ -56,6 +56,7 @@ const CssParser = require("./CssParser");
|
|
|
56
56
|
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
|
57
57
|
/** @typedef {import("../Compiler")} Compiler */
|
|
58
58
|
/** @typedef {import("../CssModule").Inheritance} Inheritance */
|
|
59
|
+
/** @typedef {import("../CssModule").CSSModuleCreateData} CSSModuleCreateData */
|
|
59
60
|
/** @typedef {import("../Module")} Module */
|
|
60
61
|
/** @typedef {import("../Module").BuildInfo} BuildInfo */
|
|
61
62
|
/** @typedef {import("../Template").RuntimeTemplate} RuntimeTemplate */
|
|
@@ -99,6 +100,7 @@ const getCssLoadingRuntimeModule = memoize(() =>
|
|
|
99
100
|
*/
|
|
100
101
|
const getSchema = name => {
|
|
101
102
|
const { definitions } = require("../../schemas/WebpackOptions.json");
|
|
103
|
+
|
|
102
104
|
return {
|
|
103
105
|
definitions,
|
|
104
106
|
oneOf: [{ $ref: `#/definitions/${name}` }]
|
|
@@ -111,22 +113,22 @@ const generatorValidationOptions = {
|
|
|
111
113
|
};
|
|
112
114
|
const validateGeneratorOptions = {
|
|
113
115
|
css: createSchemaValidation(
|
|
114
|
-
require("../../schemas/plugins/css/CssGeneratorOptions.check
|
|
116
|
+
require("../../schemas/plugins/css/CssGeneratorOptions.check"),
|
|
115
117
|
() => getSchema("CssGeneratorOptions"),
|
|
116
118
|
generatorValidationOptions
|
|
117
119
|
),
|
|
118
120
|
"css/auto": createSchemaValidation(
|
|
119
|
-
require("../../schemas/plugins/css/CssAutoGeneratorOptions.check
|
|
121
|
+
require("../../schemas/plugins/css/CssAutoGeneratorOptions.check"),
|
|
120
122
|
() => getSchema("CssAutoGeneratorOptions"),
|
|
121
123
|
generatorValidationOptions
|
|
122
124
|
),
|
|
123
125
|
"css/module": createSchemaValidation(
|
|
124
|
-
require("../../schemas/plugins/css/CssModuleGeneratorOptions.check
|
|
126
|
+
require("../../schemas/plugins/css/CssModuleGeneratorOptions.check"),
|
|
125
127
|
() => getSchema("CssModuleGeneratorOptions"),
|
|
126
128
|
generatorValidationOptions
|
|
127
129
|
),
|
|
128
130
|
"css/global": createSchemaValidation(
|
|
129
|
-
require("../../schemas/plugins/css/CssGlobalGeneratorOptions.check
|
|
131
|
+
require("../../schemas/plugins/css/CssGlobalGeneratorOptions.check"),
|
|
130
132
|
() => getSchema("CssGlobalGeneratorOptions"),
|
|
131
133
|
generatorValidationOptions
|
|
132
134
|
)
|
|
@@ -138,22 +140,22 @@ const parserValidationOptions = {
|
|
|
138
140
|
};
|
|
139
141
|
const validateParserOptions = {
|
|
140
142
|
css: createSchemaValidation(
|
|
141
|
-
require("../../schemas/plugins/css/CssParserOptions.check
|
|
143
|
+
require("../../schemas/plugins/css/CssParserOptions.check"),
|
|
142
144
|
() => getSchema("CssParserOptions"),
|
|
143
145
|
parserValidationOptions
|
|
144
146
|
),
|
|
145
147
|
"css/auto": createSchemaValidation(
|
|
146
|
-
require("../../schemas/plugins/css/CssAutoParserOptions.check
|
|
148
|
+
require("../../schemas/plugins/css/CssAutoParserOptions.check"),
|
|
147
149
|
() => getSchema("CssAutoParserOptions"),
|
|
148
150
|
parserValidationOptions
|
|
149
151
|
),
|
|
150
152
|
"css/module": createSchemaValidation(
|
|
151
|
-
require("../../schemas/plugins/css/CssModuleParserOptions.check
|
|
153
|
+
require("../../schemas/plugins/css/CssModuleParserOptions.check"),
|
|
152
154
|
() => getSchema("CssModuleParserOptions"),
|
|
153
155
|
parserValidationOptions
|
|
154
156
|
),
|
|
155
157
|
"css/global": createSchemaValidation(
|
|
156
|
-
require("../../schemas/plugins/css/CssGlobalParserOptions.check
|
|
158
|
+
require("../../schemas/plugins/css/CssGlobalParserOptions.check"),
|
|
157
159
|
() => getSchema("CssGlobalParserOptions"),
|
|
158
160
|
parserValidationOptions
|
|
159
161
|
)
|
|
@@ -346,25 +348,34 @@ class CssModulesPlugin {
|
|
|
346
348
|
inheritance.push(...parent.inheritance);
|
|
347
349
|
}
|
|
348
350
|
|
|
349
|
-
return new CssModule(
|
|
351
|
+
return new CssModule(
|
|
352
|
+
/** @type {CSSModuleCreateData} */
|
|
353
|
+
({
|
|
354
|
+
...createData,
|
|
355
|
+
cssLayer: dependency.layer,
|
|
356
|
+
supports: dependency.supports,
|
|
357
|
+
media: dependency.media,
|
|
358
|
+
inheritance
|
|
359
|
+
})
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return new CssModule(
|
|
364
|
+
/** @type {CSSModuleCreateData} */
|
|
365
|
+
({
|
|
350
366
|
...createData,
|
|
351
367
|
cssLayer: dependency.layer,
|
|
352
368
|
supports: dependency.supports,
|
|
353
|
-
media: dependency.media
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return new CssModule({
|
|
359
|
-
...createData,
|
|
360
|
-
cssLayer: dependency.layer,
|
|
361
|
-
supports: dependency.supports,
|
|
362
|
-
media: dependency.media
|
|
363
|
-
});
|
|
369
|
+
media: dependency.media
|
|
370
|
+
})
|
|
371
|
+
);
|
|
364
372
|
}
|
|
365
373
|
}
|
|
366
374
|
|
|
367
|
-
return new CssModule(
|
|
375
|
+
return new CssModule(
|
|
376
|
+
/** @type {CSSModuleCreateData} */
|
|
377
|
+
(createData)
|
|
378
|
+
);
|
|
368
379
|
});
|
|
369
380
|
|
|
370
381
|
NormalModule.getCompilationHooks(compilation).processResult.tap(
|
|
@@ -392,7 +403,7 @@ class CssModulesPlugin {
|
|
|
392
403
|
const exports = cssData.exports;
|
|
393
404
|
const stringifiedExports = JSON.stringify(
|
|
394
405
|
JSON.stringify(
|
|
395
|
-
|
|
406
|
+
[...exports].reduce((obj, [key, value]) => {
|
|
396
407
|
obj[key] = value;
|
|
397
408
|
return obj;
|
|
398
409
|
}, /** @type {Record<string, string>} */ ({}))
|
|
@@ -622,8 +633,9 @@ class CssModulesPlugin {
|
|
|
622
633
|
return { list: sortedModules, set: new Set(sortedModules) };
|
|
623
634
|
});
|
|
624
635
|
|
|
625
|
-
if (modulesByChunkGroup.length === 1)
|
|
636
|
+
if (modulesByChunkGroup.length === 1) {
|
|
626
637
|
return modulesByChunkGroup[0].list.reverse();
|
|
638
|
+
}
|
|
627
639
|
|
|
628
640
|
const boundCompareModulesByIdOrIdentifier = compareModulesByIdOrIdentifier(
|
|
629
641
|
compilation.chunkGraph
|
|
@@ -698,8 +710,9 @@ class CssModulesPlugin {
|
|
|
698
710
|
// Remove the selected module from all lists
|
|
699
711
|
for (const { list, set } of modulesByChunkGroup) {
|
|
700
712
|
const lastModule = list[list.length - 1];
|
|
701
|
-
if (lastModule === selectedModule)
|
|
702
|
-
|
|
713
|
+
if (lastModule === selectedModule) {
|
|
714
|
+
list.pop();
|
|
715
|
+
} else if (hasFailed && set.has(selectedModule)) {
|
|
703
716
|
const idx = list.indexOf(selectedModule);
|
|
704
717
|
if (idx >= 0) list.splice(idx, 1);
|
|
705
718
|
}
|
package/lib/css/CssParser.js
CHANGED
|
@@ -24,8 +24,8 @@ const StaticExportsDependency = require("../dependencies/StaticExportsDependency
|
|
|
24
24
|
const binarySearchBounds = require("../util/binarySearchBounds");
|
|
25
25
|
const { parseResource } = require("../util/identifier");
|
|
26
26
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
createMagicCommentContext,
|
|
28
|
+
webpackCommentRegExp
|
|
29
29
|
} = require("../util/magicComment");
|
|
30
30
|
const walkCssTokens = require("./walkCssTokens");
|
|
31
31
|
|
|
@@ -117,6 +117,7 @@ const escapeIdentifier = str => {
|
|
|
117
117
|
|
|
118
118
|
let value;
|
|
119
119
|
|
|
120
|
+
// eslint-disable-next-line no-control-regex
|
|
120
121
|
if (/[\t\n\f\r\u000B]/.test(character)) {
|
|
121
122
|
const codePoint = character.charCodeAt(0);
|
|
122
123
|
|
|
@@ -254,8 +255,9 @@ class LocConverter {
|
|
|
254
255
|
} else {
|
|
255
256
|
this.column = str.length - i - 1;
|
|
256
257
|
this.line++;
|
|
257
|
-
while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1)
|
|
258
|
+
while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) {
|
|
258
259
|
this.line++;
|
|
260
|
+
}
|
|
259
261
|
}
|
|
260
262
|
} else {
|
|
261
263
|
let i = this._input.lastIndexOf("\n", this.pos);
|
|
@@ -337,7 +339,7 @@ class CssParser extends Parser {
|
|
|
337
339
|
*/
|
|
338
340
|
parse(source, state) {
|
|
339
341
|
if (Buffer.isBuffer(source)) {
|
|
340
|
-
source = source.toString("
|
|
342
|
+
source = source.toString("utf8");
|
|
341
343
|
} else if (typeof source === "object") {
|
|
342
344
|
throw new Error("webpackAst is unexpected for the CssParser");
|
|
343
345
|
}
|