webpack 5.107.1 → 5.108.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.
- package/hot/dev-server.js +2 -0
- package/lib/APIPlugin.js +8 -4
- package/lib/CacheFacade.js +7 -0
- package/lib/Chunk.js +4 -0
- package/lib/ChunkGraph.js +30 -9
- package/lib/CircularModulesPlugin.js +190 -0
- package/lib/CleanPlugin.js +2 -1
- package/lib/Compilation.js +396 -65
- package/lib/Compiler.js +52 -14
- package/lib/ConcatenationScope.js +10 -3
- package/lib/ContextExclusionPlugin.js +1 -0
- package/lib/ContextModule.js +92 -47
- package/lib/ContextModuleFactory.js +45 -38
- package/lib/ContextReplacementPlugin.js +4 -0
- package/lib/DefinePlugin.js +89 -15
- package/lib/Dependency.js +111 -7
- package/lib/EntryOptionPlugin.js +39 -2
- package/lib/EntryPlugin.js +2 -0
- package/lib/ExportsInfo.js +314 -73
- package/lib/ExternalModule.js +82 -34
- package/lib/ExternalModuleFactoryPlugin.js +1 -0
- package/lib/ExternalsPlugin.js +1 -0
- package/lib/FileSystemInfo.js +173 -23
- package/lib/FlagAllModulesAsUsedPlugin.js +1 -5
- package/lib/FlagDependencyExportsPlugin.js +23 -0
- package/lib/FlagDependencyUsagePlugin.js +87 -5
- package/lib/FlagEntryExportAsUsedPlugin.js +2 -0
- package/lib/Generator.js +8 -0
- package/lib/HotModuleReplacementPlugin.js +65 -28
- package/lib/IgnorePlugin.js +1 -0
- package/lib/InitFragment.js +5 -0
- package/lib/JavascriptMetaInfoPlugin.js +7 -5
- package/lib/LazyBarrel.js +361 -0
- package/lib/LoaderTargetPlugin.js +1 -0
- package/lib/Module.js +21 -42
- package/lib/ModuleGraph.js +3 -2
- package/lib/ModuleProfile.js +27 -1
- package/lib/ModuleTemplate.js +2 -0
- package/lib/MultiCompiler.js +16 -0
- package/lib/MultiStats.js +1 -0
- package/lib/MultiWatching.js +2 -0
- package/lib/NodeStuffPlugin.js +22 -17
- package/lib/NormalModule.js +557 -77
- package/lib/NormalModuleReplacementPlugin.js +2 -0
- package/lib/PrefetchPlugin.js +2 -0
- package/lib/ProgressPlugin.js +9 -1
- package/lib/ProvidePlugin.js +1 -0
- package/lib/RawModule.js +20 -16
- package/lib/RecordIdsPlugin.js +1 -0
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimePlugin.js +58 -26
- package/lib/RuntimeTemplate.js +278 -21
- package/lib/SelfModuleFactory.js +1 -0
- package/lib/SourceMapDevToolPlugin.js +105 -30
- package/lib/Stats.js +1 -0
- package/lib/Template.js +8 -2
- package/lib/TemplatedPathPlugin.js +473 -131
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -0
- package/lib/WarnDeprecatedOptionPlugin.js +4 -0
- package/lib/WarnNoModeSetPlugin.js +1 -0
- package/lib/WatchIgnorePlugin.js +1 -0
- package/lib/Watching.js +9 -0
- package/lib/WebpackOptionsApply.js +50 -5
- package/lib/asset/AssetBytesGenerator.js +11 -3
- package/lib/asset/AssetGenerator.js +47 -22
- package/lib/asset/AssetModule.js +47 -0
- package/lib/asset/AssetModulesPlugin.js +14 -14
- package/lib/asset/AssetParser.js +2 -2
- package/lib/asset/AssetSourceGenerator.js +8 -0
- package/lib/asset/RawDataUrlModule.js +12 -13
- package/lib/buildChunkGraph.js +88 -9
- package/lib/bun/BunTargetPlugin.js +48 -0
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -0
- package/lib/cache/AddManagedPathsPlugin.js +3 -0
- package/lib/cache/IdleFileCachePlugin.js +4 -0
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +1 -0
- package/lib/cache/ResolverCachePlugin.js +2 -0
- package/lib/cache/getLazyHashedEtag.js +9 -2
- package/lib/cache/mergeEtags.js +2 -0
- package/lib/cli.js +109 -19
- package/lib/config/browserslistTargetHandler.js +99 -0
- package/lib/config/defaults.js +147 -7
- package/lib/config/defineConfig.js +31 -0
- package/lib/config/normalization.js +5 -0
- package/lib/config/target.js +181 -2
- package/lib/container/ContainerEntryModule.js +15 -14
- package/lib/container/ContainerExposedDependency.js +2 -2
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/container/FallbackDependency.js +5 -7
- package/lib/container/FallbackModule.js +10 -9
- package/lib/container/RemoteModule.js +20 -10
- package/lib/container/RemoteRuntimeModule.js +14 -12
- package/lib/css/CssGenerator.js +353 -327
- package/lib/css/CssInjectStyleRuntimeModule.js +36 -8
- package/lib/css/CssLoadingRuntimeModule.js +118 -47
- package/lib/css/CssModule.js +52 -23
- package/lib/css/CssModulesPlugin.js +107 -124
- package/lib/css/CssParser.js +2759 -2205
- package/lib/css/syntax.js +2859 -0
- package/lib/debug/ProfilingPlugin.js +2 -0
- package/lib/deno/DenoTargetPlugin.js +47 -0
- package/lib/dependencies/AMDDefineDependency.js +22 -17
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +1 -0
- package/lib/dependencies/AMDRequireArrayDependency.js +7 -11
- package/lib/dependencies/AMDRequireContextDependency.js +7 -11
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -0
- package/lib/dependencies/AMDRequireDependency.js +24 -20
- package/lib/dependencies/CachedConstDependency.js +3 -0
- package/lib/dependencies/CommonJsDependencyHelpers.js +1 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +79 -31
- package/lib/dependencies/CommonJsExportsDependency.js +21 -16
- package/lib/dependencies/CommonJsExportsParserPlugin.js +230 -7
- package/lib/dependencies/CommonJsFullRequireDependency.js +27 -19
- package/lib/dependencies/CommonJsImportsParserPlugin.js +51 -16
- package/lib/dependencies/CommonJsPlugin.js +1 -1
- package/lib/dependencies/CommonJsRequireContextDependency.js +10 -13
- package/lib/dependencies/CommonJsRequireDependency.js +42 -11
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +22 -14
- package/lib/dependencies/ConstDependency.js +16 -11
- package/lib/dependencies/ContextDependency.js +4 -0
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -1
- package/lib/dependencies/ContextElementDependency.js +23 -14
- package/lib/dependencies/CreateRequireParserPlugin.js +1 -0
- package/lib/dependencies/CreateScriptUrlDependency.js +5 -7
- package/lib/dependencies/CriticalDependencyWarning.js +1 -0
- package/lib/dependencies/CssIcssExportDependency.js +512 -574
- package/lib/dependencies/CssIcssImportDependency.js +9 -9
- package/lib/dependencies/CssIcssSymbolDependency.js +22 -15
- package/lib/dependencies/CssImportDependency.js +25 -1
- package/lib/dependencies/CssUrlDependency.js +23 -14
- package/lib/dependencies/DllEntryDependency.js +9 -13
- package/lib/dependencies/ExportBindingInitFragment.js +164 -0
- package/lib/dependencies/ExportsInfoDependency.js +12 -12
- package/lib/dependencies/ExternalModuleDependency.js +8 -5
- package/lib/dependencies/ExternalModuleInitFragment.js +7 -5
- package/lib/dependencies/ExternalModuleInitFragmentDependency.js +13 -10
- package/lib/dependencies/HarmonyAcceptDependency.js +11 -11
- package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -0
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +47 -22
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +28 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +46 -22
- package/lib/dependencies/HarmonyExportExpressionDependency.js +107 -30
- package/lib/dependencies/HarmonyExportHeaderDependency.js +7 -9
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +109 -31
- package/lib/dependencies/HarmonyExportInitFragment.js +22 -20
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +83 -18
- package/lib/dependencies/HarmonyExports.js +4 -1
- package/lib/dependencies/HarmonyImportDependency.js +24 -0
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +110 -74
- package/lib/dependencies/HarmonyImportGuard.js +254 -0
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +18 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +118 -14
- package/lib/dependencies/HarmonyLinkingError.js +1 -0
- package/lib/dependencies/HarmonyModulesPlugin.js +1 -0
- package/lib/dependencies/{HtmlScriptSrcDependency.js → HtmlEntryDependency.js} +267 -154
- package/lib/dependencies/HtmlInlineHtmlDependency.js +107 -0
- package/lib/dependencies/HtmlInlineScriptDependency.js +20 -27
- package/lib/dependencies/HtmlInlineStyleDependency.js +62 -11
- package/lib/dependencies/HtmlSourceDependency.js +18 -0
- package/lib/dependencies/ImportContextDependency.js +5 -9
- package/lib/dependencies/ImportDependency.js +44 -2
- package/lib/dependencies/ImportMetaHotAcceptDependency.js +1 -0
- package/lib/dependencies/ImportMetaHotDeclineDependency.js +1 -0
- package/lib/dependencies/ImportMetaPlugin.js +74 -30
- package/lib/dependencies/ImportParserPlugin.js +19 -0
- package/lib/dependencies/ImportWeakDependency.js +1 -0
- package/lib/dependencies/JsonExportsDependency.js +9 -9
- package/lib/dependencies/LoaderImportDependency.js +1 -0
- package/lib/dependencies/LocalModule.js +11 -12
- package/lib/dependencies/LocalModuleDependency.js +11 -13
- package/lib/dependencies/ModuleDecoratorDependency.js +9 -9
- package/lib/dependencies/ModuleDependency.js +7 -0
- package/lib/dependencies/ModuleHotAcceptDependency.js +1 -0
- package/lib/dependencies/ModuleHotDeclineDependency.js +1 -0
- package/lib/dependencies/ModuleInitFragmentDependency.js +15 -11
- package/lib/dependencies/ProvidedDependency.js +31 -27
- package/lib/dependencies/PureExpressionDependency.js +7 -9
- package/lib/dependencies/RequireEnsureDependency.js +12 -13
- package/lib/dependencies/RequireHeaderDependency.js +3 -4
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -0
- package/lib/dependencies/RequireResolveContextDependency.js +7 -11
- package/lib/dependencies/RequireResolveDependency.js +1 -0
- package/lib/dependencies/RequireResolveHeaderDependency.js +3 -5
- package/lib/dependencies/RuntimeRequirementsDependency.js +6 -7
- package/lib/dependencies/StaticExportsDependency.js +10 -10
- package/lib/dependencies/SystemPlugin.js +2 -0
- package/lib/dependencies/URLContextDependency.js +5 -7
- package/lib/dependencies/URLDependency.js +14 -16
- package/lib/dependencies/UnsupportedDependency.js +8 -13
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +11 -16
- package/lib/dependencies/WebAssemblyImportDependency.js +14 -16
- package/lib/dependencies/WebpackIsIncludedDependency.js +1 -0
- package/lib/dependencies/WorkerDependency.js +19 -8
- package/lib/dependencies/WorkerPlugin.js +40 -10
- package/lib/dependencies/processExportInfo.js +13 -11
- package/lib/dll/DelegatedModule.js +29 -15
- package/lib/dll/DelegatedModuleFactoryPlugin.js +1 -0
- package/lib/dll/DelegatedPlugin.js +1 -0
- package/lib/dll/DllEntryPlugin.js +3 -0
- package/lib/dll/DllModule.js +3 -2
- package/lib/dll/DllPlugin.js +16 -0
- package/lib/dll/DllReferencePlugin.js +3 -0
- package/lib/dll/LibManifestPlugin.js +1 -0
- package/lib/electron/ElectronTargetPlugin.js +22 -4
- package/lib/errors/ConcurrentCompilationError.js +1 -0
- package/lib/errors/HookWebpackError.js +11 -13
- package/lib/errors/IgnoreErrorModuleFactory.js +1 -0
- package/lib/errors/InvalidDependenciesModuleWarning.js +2 -0
- package/lib/errors/JSONParseError.js +9 -8
- package/lib/errors/ModuleBuildError.js +16 -13
- package/lib/errors/ModuleDependencyError.js +8 -1
- package/lib/errors/ModuleDependencyWarning.js +8 -1
- package/lib/errors/ModuleError.js +5 -11
- package/lib/errors/ModuleHashingError.js +4 -0
- package/lib/errors/ModuleNotFoundError.js +3 -0
- package/lib/errors/ModuleParseError.js +5 -11
- package/lib/errors/ModuleRestoreError.js +2 -0
- package/lib/errors/ModuleStoreError.js +3 -0
- package/lib/errors/ModuleWarning.js +7 -11
- package/lib/errors/NodeStuffInWebError.js +1 -0
- package/lib/errors/NonErrorEmittedError.js +2 -0
- package/lib/errors/UnhandledSchemeError.js +1 -0
- package/lib/esm/ModuleChunkLoadingPlugin.js +0 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +28 -23
- package/lib/hmr/HotModuleReplacement.runtime.js +175 -30
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +7 -0
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +173 -26
- package/lib/hmr/LazyCompilationPlugin.js +134 -6
- package/lib/html/HtmlGenerator.js +292 -50
- package/lib/html/HtmlModule.js +40 -0
- package/lib/html/HtmlModulesPlugin.js +287 -60
- package/lib/html/HtmlParser.js +1108 -1099
- package/lib/html/{walkHtmlTokens.js → syntax.js} +4701 -212
- package/lib/ids/IdHelpers.js +4 -2
- package/lib/index.js +19 -0
- package/lib/javascript/BasicEvaluatedExpression.js +1 -0
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -0
- package/lib/javascript/JavascriptGenerator.js +6 -2
- package/lib/javascript/JavascriptModule.js +54 -0
- package/lib/javascript/JavascriptModulesPlugin.js +257 -102
- package/lib/javascript/JavascriptParser.js +286 -159
- package/lib/json/JsonModule.js +40 -0
- package/lib/json/JsonModulesPlugin.js +7 -0
- package/lib/json/JsonParser.js +4 -2
- package/lib/library/AssignLibraryPlugin.js +5 -3
- package/lib/library/ExportPropertyLibraryPlugin.js +1 -0
- package/lib/library/FalseIIFEUmdWarning.js +1 -0
- package/lib/library/ModuleLibraryPlugin.js +54 -29
- package/lib/library/SystemLibraryPlugin.js +3 -3
- package/lib/node/NodeTargetPlugin.js +1 -0
- package/lib/node/NodeWatchFileSystem.js +38 -22
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +10 -9
- package/lib/node/RequireChunkLoadingRuntimeModule.js +18 -16
- package/lib/optimize/ConcatenatedModule.js +397 -78
- package/lib/optimize/ConstExportsPlugin.js +211 -0
- package/lib/optimize/InlineExports.js +178 -0
- package/lib/optimize/InnerGraph.js +372 -275
- package/lib/optimize/InnerGraphPlugin.js +196 -99
- package/lib/optimize/ModuleConcatenationPlugin.js +56 -25
- package/lib/optimize/RealContentHashPlugin.js +14 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +234 -64
- package/lib/runtime/AsyncModuleRuntimeModule.js +32 -30
- package/lib/runtime/AutoPublicPathRuntimeModule.js +11 -5
- package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +1 -1
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +6 -4
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +33 -4
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +82 -3
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +1 -1
- package/lib/runtime/LoadScriptRuntimeModule.js +18 -13
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +39 -26
- package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +1 -1
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +4 -4
- package/lib/runtime/RelativeUrlRuntimeModule.js +3 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -1
- package/lib/runtime/StartupEntrypointRuntimeModule.js +4 -3
- package/lib/runtime/WorkerRuntimeModule.js +33 -0
- package/lib/schemes/HttpUriPlugin.js +3 -2
- package/lib/serialization/AggregateErrorSerializer.js +7 -6
- package/lib/serialization/ArraySerializer.js +4 -8
- package/lib/serialization/BinaryMiddleware.js +538 -468
- package/lib/serialization/DateObjectSerializer.js +2 -2
- package/lib/serialization/ErrorObjectSerializer.js +7 -6
- package/lib/serialization/MapObjectSerializer.js +5 -9
- package/lib/serialization/NullPrototypeObjectSerializer.js +7 -9
- package/lib/serialization/ObjectMiddleware.js +50 -13
- package/lib/serialization/PlainObjectSerializer.js +9 -8
- package/lib/serialization/RegExpObjectSerializer.js +2 -2
- package/lib/serialization/Serializer.js +1 -0
- package/lib/serialization/SetObjectSerializer.js +4 -8
- package/lib/sharing/ConsumeSharedModule.js +6 -7
- package/lib/sharing/ConsumeSharedPlugin.js +1 -0
- package/lib/sharing/ConsumeSharedRuntimeModule.js +46 -41
- package/lib/sharing/ProvideSharedDependency.js +30 -15
- package/lib/sharing/ProvideSharedModule.js +30 -11
- package/lib/sharing/ProvideSharedPlugin.js +4 -2
- package/lib/sharing/SharePlugin.js +3 -0
- package/lib/sharing/ShareRuntimeModule.js +18 -16
- package/lib/sharing/resolveMatchedConfigs.js +2 -1
- package/lib/sharing/utils.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +4 -6
- package/lib/stats/DefaultStatsPrinterPlugin.js +14 -14
- package/lib/stats/StatsFactory.js +11 -9
- package/lib/stats/StatsPrinter.js +9 -2
- package/lib/url/URLParserPlugin.js +5 -2
- package/lib/util/AsyncQueue.js +10 -0
- package/lib/util/LazyBucketSortedSet.js +5 -0
- package/lib/util/LazySet.js +6 -4
- package/lib/util/LocConverter.js +11 -1
- package/lib/util/Semaphore.js +1 -0
- package/lib/util/SourceProcessor.js +106 -0
- package/lib/util/TupleSet.js +1 -0
- package/lib/util/WeakTupleMap.js +27 -1
- package/lib/util/chainedImports.js +3 -3
- package/lib/util/comparators.js +2 -2
- package/lib/util/concatenate.js +31 -7
- package/lib/util/createHash.js +0 -1
- package/lib/util/deterministicGrouping.js +19 -12
- package/lib/util/extractSourceMap.js +1 -1
- package/lib/util/findGraphRoots.js +2 -0
- package/lib/util/fs.js +16 -6
- package/lib/util/hash/DebugHash.js +1 -0
- package/lib/util/hash/hash-digest.js +24 -15
- package/lib/util/identifier.js +7 -0
- package/lib/util/internalSerializables.js +11 -2
- package/lib/util/magicComment.js +42 -0
- package/lib/util/makeSerializable.js +1 -0
- package/lib/util/nonNumericOnlyHash.js +30 -1
- package/lib/util/property.js +7 -1
- package/lib/util/publicPathPlaceholder.js +64 -0
- package/lib/util/registerExternalSerializer.js +4 -4
- package/lib/wasm-async/AsyncWasmModule.js +77 -0
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +1 -96
- package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +1 -1
- package/lib/wasm-sync/SyncWasmModule.js +39 -0
- package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +1 -0
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +6 -3
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -1
- package/lib/wasm-sync/WebAssemblyGenerator.js +1 -0
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +2 -0
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +10 -0
- package/lib/wasm-sync/WebAssemblyParser.js +7 -3
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +45 -39
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +11 -10
- package/package.json +36 -28
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +212 -3
- package/schemas/plugins/HtmlGeneratorOptions.check.js +1 -1
- package/schemas/plugins/HtmlParserOptions.check.d.ts +7 -0
- package/schemas/plugins/HtmlParserOptions.check.js +6 -0
- package/schemas/plugins/HtmlParserOptions.json +3 -0
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssParserOptions.check.js +1 -1
- package/types.d.ts +1592 -314
- package/lib/css/walkCssTokens.js +0 -2020
- package/lib/util/AppendOnlyStackedSet.js +0 -93
package/lib/css/CssGenerator.js
CHANGED
|
@@ -23,15 +23,24 @@ const {
|
|
|
23
23
|
JAVASCRIPT_AND_CSS_TEXT_TYPES,
|
|
24
24
|
JAVASCRIPT_AND_CSS_TYPES,
|
|
25
25
|
JAVASCRIPT_TYPE,
|
|
26
|
-
JAVASCRIPT_TYPES
|
|
26
|
+
JAVASCRIPT_TYPES,
|
|
27
|
+
NO_TYPES
|
|
27
28
|
} = require("../ModuleSourceTypeConstants");
|
|
28
29
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
29
30
|
const Template = require("../Template");
|
|
31
|
+
const { getPresentKinds } = require("../TemplatedPathPlugin");
|
|
30
32
|
const CssImportDependency = require("../dependencies/CssImportDependency");
|
|
31
33
|
const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency");
|
|
32
34
|
|
|
33
35
|
const { encodeMappings } = require("../util/createMappings");
|
|
34
36
|
const memoize = require("../util/memoize");
|
|
37
|
+
const {
|
|
38
|
+
PUBLIC_PATH_FULL_HASH,
|
|
39
|
+
walkFullHashPlaceholders
|
|
40
|
+
} = require("../util/publicPathPlaceholder");
|
|
41
|
+
|
|
42
|
+
// Avoids `type.split("/")[0]` allocation on the `getTypes` hot path.
|
|
43
|
+
const CSS_TYPE_PREFIX = `${CSS_TYPE}/`;
|
|
35
44
|
|
|
36
45
|
/** @typedef {import("webpack-sources").Source} Source */
|
|
37
46
|
/** @typedef {import("../../declarations/WebpackOptions").CssModuleGeneratorOptions} CssModuleGeneratorOptions */
|
|
@@ -52,6 +61,8 @@ const memoize = require("../util/memoize");
|
|
|
52
61
|
/** @typedef {import("../util/Hash")} Hash */
|
|
53
62
|
/** @typedef {import("./CssModulesPlugin").ModuleFactoryCacheEntry} ModuleFactoryCacheEntry */
|
|
54
63
|
/** @typedef {import("./CssModule")} CssModule */
|
|
64
|
+
/** @typedef {import("./CssModule").CssModuleBuildInfo} CssModuleBuildInfo */
|
|
65
|
+
/** @typedef {import("./CssModule").CssModuleBuildMeta} CssModuleBuildMeta */
|
|
55
66
|
/** @typedef {import("../Compilation")} Compilation */
|
|
56
67
|
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
|
57
68
|
/** @typedef {import("../../declarations/WebpackOptions").CssParserExportType} CssParserExportType */
|
|
@@ -65,10 +76,7 @@ const getCssModulesPlugin = memoize(() => require("./CssModulesPlugin"));
|
|
|
65
76
|
/** @typedef {import("webpack-sources").RawSourceMap} RawSourceMap */
|
|
66
77
|
|
|
67
78
|
/**
|
|
68
|
-
* Build a v3 source map
|
|
69
|
-
* known CSS-class export entry back to the corresponding selector position
|
|
70
|
-
* in the original CSS. Lines without an associated export are left
|
|
71
|
-
* unmapped — devtools simply shows them as part of the bundled JS.
|
|
79
|
+
* Build a v3 source map mapping CSS-class export lines back to their selector positions.
|
|
72
80
|
* @param {string} generatedJs the generated JS string
|
|
73
81
|
* @param {ExportLocsMap} exportLocs map of export names to CSS source location
|
|
74
82
|
* @param {string} cssContent original CSS source content
|
|
@@ -83,14 +91,29 @@ const buildExportsSourceMap = (
|
|
|
83
91
|
) => {
|
|
84
92
|
const lines = generatedJs.split("\n");
|
|
85
93
|
|
|
86
|
-
|
|
94
|
+
// O(L) pass: match `\t"<name>": <value>` lines against export names.
|
|
95
|
+
const keyToName = new Map();
|
|
87
96
|
for (const [exportName] of exportLocs) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
keyToName.set(JSON.stringify(exportName), exportName);
|
|
98
|
+
}
|
|
99
|
+
const lineByExport = new Map();
|
|
100
|
+
for (let i = 0; i < lines.length && lineByExport.size < keyToName.size; i++) {
|
|
101
|
+
const line = lines[i];
|
|
102
|
+
if (line.charCodeAt(0) !== 9 || line.charCodeAt(1) !== 34) continue;
|
|
103
|
+
let j = 2;
|
|
104
|
+
while (j < line.length) {
|
|
105
|
+
const c = line.charCodeAt(j);
|
|
106
|
+
if (c === 92) {
|
|
107
|
+
j += 2;
|
|
108
|
+
continue;
|
|
93
109
|
}
|
|
110
|
+
if (c === 34) break;
|
|
111
|
+
j++;
|
|
112
|
+
}
|
|
113
|
+
if (line.charCodeAt(j + 1) !== 58) continue;
|
|
114
|
+
const name = keyToName.get(line.slice(1, j + 1));
|
|
115
|
+
if (name !== undefined && !lineByExport.has(name)) {
|
|
116
|
+
lineByExport.set(name, i);
|
|
94
117
|
}
|
|
95
118
|
}
|
|
96
119
|
|
|
@@ -98,9 +121,7 @@ const buildExportsSourceMap = (
|
|
|
98
121
|
const perLine = lines.map(() => null);
|
|
99
122
|
for (const [exportName, genLine] of lineByExport) {
|
|
100
123
|
const pos = /** @type {SourcePosition} */ (exportLocs.get(exportName));
|
|
101
|
-
//
|
|
102
|
-
// dependency `loc` uses 1-based lines and 0-based columns, so subtract
|
|
103
|
-
// one from the line.
|
|
124
|
+
// V3 source maps are 0-based; webpack `loc` lines are 1-based.
|
|
104
125
|
perLine[genLine] = {
|
|
105
126
|
generatedColumn: 0,
|
|
106
127
|
sourceIndex: 0,
|
|
@@ -127,12 +148,31 @@ class CssGenerator extends Generator {
|
|
|
127
148
|
*/
|
|
128
149
|
constructor(options, moduleGraph) {
|
|
129
150
|
super();
|
|
151
|
+
/** @type {CssModuleGeneratorOptions} */
|
|
130
152
|
this.options = options;
|
|
153
|
+
/** @type {boolean | undefined} */
|
|
131
154
|
this._exportsOnly = options.exportsOnly;
|
|
155
|
+
/** @type {boolean | undefined} */
|
|
132
156
|
this._esModule = options.esModule;
|
|
157
|
+
/** @type {ModuleGraph} */
|
|
133
158
|
this._moduleGraph = moduleGraph;
|
|
134
159
|
/** @type {WeakMap<Source, ModuleFactoryCacheEntry>} */
|
|
135
160
|
this._moduleFactoryCache = new WeakMap();
|
|
161
|
+
const localIdentName = options.localIdentName;
|
|
162
|
+
// Detect hash placeholders via the canonical template parser so this stays
|
|
163
|
+
// in sync with `interpolate`'s grammar.
|
|
164
|
+
const isFn = typeof localIdentName === "function";
|
|
165
|
+
const kinds =
|
|
166
|
+
typeof localIdentName === "string"
|
|
167
|
+
? getPresentKinds(localIdentName)
|
|
168
|
+
: undefined;
|
|
169
|
+
/** @type {boolean} */
|
|
170
|
+
this._localIdentNeedsHash =
|
|
171
|
+
isFn ||
|
|
172
|
+
(kinds !== undefined && (kinds.has("fullhash") || kinds.has("hash")));
|
|
173
|
+
/** @type {boolean} */
|
|
174
|
+
this._localIdentNeedsContentHash =
|
|
175
|
+
isFn || (kinds !== undefined && kinds.has("contenthash"));
|
|
136
176
|
}
|
|
137
177
|
|
|
138
178
|
/**
|
|
@@ -149,201 +189,6 @@ class CssGenerator extends Generator {
|
|
|
149
189
|
return undefined;
|
|
150
190
|
}
|
|
151
191
|
|
|
152
|
-
/**
|
|
153
|
-
* Returns the `@charset` that will appear at the start of this module's
|
|
154
|
-
* default export, walking through text imports when the module has no
|
|
155
|
-
* local `@charset` of its own.
|
|
156
|
-
* @param {NormalModule} module the module
|
|
157
|
-
* @param {ModuleGraph} moduleGraph module graph
|
|
158
|
-
* @param {WeakSet<NormalModule>=} visited cycle guard
|
|
159
|
-
* @returns {string | undefined} the effective charset
|
|
160
|
-
*/
|
|
161
|
-
_getEffectiveCharset(module, moduleGraph, visited = new WeakSet()) {
|
|
162
|
-
if (!module || visited.has(module)) return undefined;
|
|
163
|
-
const exportType = /** @type {CssModule} */ (module).exportType;
|
|
164
|
-
if (exportType !== "text" && exportType !== "css-style-sheet") {
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
visited.add(module);
|
|
168
|
-
const own =
|
|
169
|
-
module.buildInfo && /** @type {BuildInfo} */ (module.buildInfo).charset;
|
|
170
|
-
if (own !== undefined) return own;
|
|
171
|
-
if (exportType !== "text") return undefined;
|
|
172
|
-
for (const dep of module.dependencies) {
|
|
173
|
-
if (dep instanceof CssImportDependency) {
|
|
174
|
-
const depModule = /** @type {NormalModule} */ (
|
|
175
|
-
moduleGraph.getModule(dep)
|
|
176
|
-
);
|
|
177
|
-
const inherited = this._getEffectiveCharset(
|
|
178
|
-
depModule,
|
|
179
|
-
moduleGraph,
|
|
180
|
-
visited
|
|
181
|
-
);
|
|
182
|
-
if (inherited !== undefined) return inherited;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return undefined;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Generate JavaScript expressions that evaluate each `@import`'d module
|
|
190
|
-
* for side effects. Only used by `style` exportType, where each imported
|
|
191
|
-
* style module injects its own `<style>` element independently — no
|
|
192
|
-
* content merging happens at the parent. `text` and `css-style-sheet`
|
|
193
|
-
* instead inline their imports at build time via
|
|
194
|
-
* {@link CssGenerator#_generateMergedContentSource}.
|
|
195
|
-
* @param {NormalModule} module the module to generate CSS text for
|
|
196
|
-
* @param {GenerateContext} generateContext the generate context
|
|
197
|
-
* @returns {string[]} JS expressions, one per `@import` dependency
|
|
198
|
-
*/
|
|
199
|
-
_generateImportSideEffects(module, generateContext) {
|
|
200
|
-
const { moduleGraph, concatenationScope } = generateContext;
|
|
201
|
-
const parts = [];
|
|
202
|
-
|
|
203
|
-
for (const dep of module.dependencies) {
|
|
204
|
-
if (!(dep instanceof CssImportDependency)) continue;
|
|
205
|
-
const depModule = /** @type {CssModule} */ (moduleGraph.getModule(dep));
|
|
206
|
-
// Concat-scoped deps are inlined into the same module; their side
|
|
207
|
-
// effect (own `<style>` injection) is emitted at the dep's own
|
|
208
|
-
// site, so no explicit reference is needed here.
|
|
209
|
-
if (concatenationScope && concatenationScope.isModuleInScope(depModule)) {
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
parts.push(
|
|
213
|
-
generateContext.runtimeTemplate.moduleExports({
|
|
214
|
-
module: depModule,
|
|
215
|
-
chunkGraph: generateContext.chunkGraph,
|
|
216
|
-
request: depModule.userRequest,
|
|
217
|
-
weak: false,
|
|
218
|
-
runtimeRequirements: generateContext.runtimeRequirements
|
|
219
|
-
})
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return parts;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Build a single CSS `Source` that contains, in source order, the rendered
|
|
228
|
-
* CSS text of every transitively `@import`'d module followed by the
|
|
229
|
-
* current module's own CSS text. Imports are inlined at build time so
|
|
230
|
-
* the resulting `Source` carries a single, accurate source map covering
|
|
231
|
-
* every contributing file — no runtime merge helper required.
|
|
232
|
-
*
|
|
233
|
-
* Only `text` / `css-style-sheet` imports contribute CSS text; `link` and
|
|
234
|
-
* `style` imports are emitted separately (own `.css` file or own
|
|
235
|
-
* `<style>` injection) and are skipped here.
|
|
236
|
-
*
|
|
237
|
-
* `ancestors` tracks the path from the top-level caller down to the
|
|
238
|
-
* current module — not every module ever visited. A module reappearing
|
|
239
|
-
* along a sibling branch (a "diamond import" like two different files
|
|
240
|
-
* each `@import`'ing the same shared module) must be inlined every time,
|
|
241
|
-
* matching the prior runtime behavior where each `default` getter was
|
|
242
|
-
* invoked at every import site.
|
|
243
|
-
* @param {NormalModule} module the module to render
|
|
244
|
-
* @param {GenerateContext} generateContext the generate context
|
|
245
|
-
* @param {Set<NormalModule>} ancestors modules on the current path
|
|
246
|
-
* @returns {Source | null} merged CSS source, or null when the module has no content
|
|
247
|
-
*/
|
|
248
|
-
_generateMergedContentSource(module, generateContext, ancestors) {
|
|
249
|
-
if (ancestors.has(module)) return null;
|
|
250
|
-
ancestors.add(module);
|
|
251
|
-
try {
|
|
252
|
-
const { moduleGraph } = generateContext;
|
|
253
|
-
/** @type {Source[]} */
|
|
254
|
-
const parts = [];
|
|
255
|
-
|
|
256
|
-
for (const dep of module.dependencies) {
|
|
257
|
-
if (!(dep instanceof CssImportDependency)) continue;
|
|
258
|
-
const depModule = /** @type {CssModule} */ (moduleGraph.getModule(dep));
|
|
259
|
-
if (!depModule) continue;
|
|
260
|
-
const depExportType = depModule.exportType;
|
|
261
|
-
if (depExportType !== "text" && depExportType !== "css-style-sheet") {
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
const depMerged = this._generateMergedContentSource(
|
|
265
|
-
depModule,
|
|
266
|
-
generateContext,
|
|
267
|
-
ancestors
|
|
268
|
-
);
|
|
269
|
-
if (depMerged) parts.push(depMerged);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
const own = this._generateContentSource(module, generateContext);
|
|
273
|
-
if (own) parts.push(own);
|
|
274
|
-
|
|
275
|
-
if (parts.length === 0) return null;
|
|
276
|
-
if (parts.length === 1) return parts[0];
|
|
277
|
-
return new ConcatSource(...parts);
|
|
278
|
-
} finally {
|
|
279
|
-
ancestors.delete(module);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Generate CSS source for the current module
|
|
285
|
-
* @param {NormalModule} module the module to generate CSS source for
|
|
286
|
-
* @param {GenerateContext} generateContext the generate context
|
|
287
|
-
* @returns {Source | null} the CSS source
|
|
288
|
-
*/
|
|
289
|
-
_generateContentSource(module, generateContext) {
|
|
290
|
-
const moduleSourceContent = /** @type {Source} */ (
|
|
291
|
-
this.generate(module, {
|
|
292
|
-
...generateContext,
|
|
293
|
-
type: CSS_TYPE
|
|
294
|
-
})
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
if (!moduleSourceContent) {
|
|
298
|
-
return null;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const compilation = generateContext.runtimeTemplate.compilation;
|
|
302
|
-
// For non-link exportTypes (style, text, css-style-sheet), url() in the CSS
|
|
303
|
-
// is resolved relative to the document URL (for <style> tags and CSSStyleSheet),
|
|
304
|
-
// not relative to any output file. Use empty undoPath so urls are relative to
|
|
305
|
-
// the output root.
|
|
306
|
-
const undoPath = "";
|
|
307
|
-
|
|
308
|
-
const CssModulesPlugin = getCssModulesPlugin();
|
|
309
|
-
const hooks = CssModulesPlugin.getCompilationHooks(compilation);
|
|
310
|
-
return CssModulesPlugin.renderModule(
|
|
311
|
-
/** @type {CssModule} */ (module),
|
|
312
|
-
{
|
|
313
|
-
undoPath,
|
|
314
|
-
moduleSourceContent,
|
|
315
|
-
moduleFactoryCache: this._moduleFactoryCache,
|
|
316
|
-
runtimeTemplate: generateContext.runtimeTemplate
|
|
317
|
-
},
|
|
318
|
-
hooks
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Serialize a CSS Source into a JS string literal with an optional
|
|
324
|
-
* inline `sourceMappingURL` data URI so DevTools can resolve the
|
|
325
|
-
* original sources at runtime.
|
|
326
|
-
* @param {Source} cssSource the CSS source
|
|
327
|
-
* @param {import("../../declarations/WebpackOptions").DevTool | undefined} devtool the devtool option
|
|
328
|
-
* @returns {Source} a Source representing a JS string literal
|
|
329
|
-
*/
|
|
330
|
-
_cssToJsLiteral(cssSource, devtool) {
|
|
331
|
-
const { source, map } = cssSource.sourceAndMap();
|
|
332
|
-
let content = /** @type {string} */ (source);
|
|
333
|
-
if (map) {
|
|
334
|
-
const inlineMap =
|
|
335
|
-
typeof devtool === "string" && devtool.includes("nosources")
|
|
336
|
-
? { ...map, sourcesContent: undefined }
|
|
337
|
-
: map;
|
|
338
|
-
const base64Map = Buffer.from(JSON.stringify(inlineMap), "utf8").toString(
|
|
339
|
-
"base64"
|
|
340
|
-
);
|
|
341
|
-
const trailingNewline = content.endsWith("\n") ? "" : "\n";
|
|
342
|
-
content += `${trailingNewline}/*# sourceMappingURL=data:application/json;charset=utf-8;base64,${base64Map}*/`;
|
|
343
|
-
}
|
|
344
|
-
return new RawSource(JSON.stringify(content));
|
|
345
|
-
}
|
|
346
|
-
|
|
347
192
|
/**
|
|
348
193
|
* Processes the provided module.
|
|
349
194
|
* @param {NormalModule} module the current module
|
|
@@ -464,16 +309,13 @@ class CssGenerator extends Generator {
|
|
|
464
309
|
case JAVASCRIPT_TYPE: {
|
|
465
310
|
const compilation = generateContext.runtimeTemplate.compilation;
|
|
466
311
|
const devtool = compilation.options.devtool;
|
|
467
|
-
const isCssModule = /** @type {
|
|
312
|
+
const isCssModule = /** @type {CssModuleBuildMeta} */ (module.buildMeta)
|
|
468
313
|
.isCssModule;
|
|
469
314
|
|
|
470
315
|
const generateContentCode = () => {
|
|
471
316
|
switch (exportType) {
|
|
472
317
|
case "style": {
|
|
473
|
-
const cssSource = this.
|
|
474
|
-
module,
|
|
475
|
-
generateContext
|
|
476
|
-
);
|
|
318
|
+
const cssSource = this._renderCss(module, generateContext);
|
|
477
319
|
if (!cssSource) return "";
|
|
478
320
|
|
|
479
321
|
generateContext.runtimeRequirements.add(
|
|
@@ -485,14 +327,16 @@ class CssGenerator extends Generator {
|
|
|
485
327
|
if (generateContext.concatenationScope) {
|
|
486
328
|
return new ConcatSource(
|
|
487
329
|
`__webpack_css_styles__.push([${JSON.stringify(moduleId)}, `,
|
|
488
|
-
this._cssToJsLiteral(cssSource, devtool),
|
|
330
|
+
this._cssToJsLiteral(cssSource, devtool, generateContext),
|
|
489
331
|
"]);"
|
|
490
332
|
);
|
|
491
333
|
}
|
|
492
334
|
|
|
493
335
|
return new ConcatSource(
|
|
494
|
-
`${RuntimeGlobals.cssInjectStyle}(${JSON.stringify(
|
|
495
|
-
|
|
336
|
+
`${RuntimeGlobals.cssInjectStyle}(${JSON.stringify(
|
|
337
|
+
moduleId
|
|
338
|
+
)}, `,
|
|
339
|
+
this._cssToJsLiteral(cssSource, devtool, generateContext),
|
|
496
340
|
");"
|
|
497
341
|
);
|
|
498
342
|
}
|
|
@@ -504,7 +348,7 @@ class CssGenerator extends Generator {
|
|
|
504
348
|
const generateImportCode = () => {
|
|
505
349
|
switch (exportType) {
|
|
506
350
|
case "style": {
|
|
507
|
-
return this.
|
|
351
|
+
return this._generateImportExpressions(module, generateContext)
|
|
508
352
|
.map((expr) => `${expr};`)
|
|
509
353
|
.join("\n");
|
|
510
354
|
}
|
|
@@ -513,31 +357,6 @@ class CssGenerator extends Generator {
|
|
|
513
357
|
}
|
|
514
358
|
};
|
|
515
359
|
const generateExportCode = () => {
|
|
516
|
-
/** @returns {Source} generated CSS text as JS expression */
|
|
517
|
-
const generateCssText = () => {
|
|
518
|
-
const cssSource = this._generateMergedContentSource(
|
|
519
|
-
module,
|
|
520
|
-
generateContext,
|
|
521
|
-
new Set()
|
|
522
|
-
);
|
|
523
|
-
|
|
524
|
-
let jsLiteral = cssSource
|
|
525
|
-
? this._cssToJsLiteral(cssSource, devtool)
|
|
526
|
-
: new RawSource('""');
|
|
527
|
-
|
|
528
|
-
const effectiveCharset =
|
|
529
|
-
exportType === "css-style-sheet" || exportType === "text"
|
|
530
|
-
? this._getEffectiveCharset(module, generateContext.moduleGraph)
|
|
531
|
-
: undefined;
|
|
532
|
-
if (effectiveCharset !== undefined) {
|
|
533
|
-
jsLiteral = new ConcatSource(
|
|
534
|
-
`'@charset "${effectiveCharset}";\\n' + `,
|
|
535
|
-
jsLiteral
|
|
536
|
-
);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
return jsLiteral;
|
|
540
|
-
};
|
|
541
360
|
/**
|
|
542
361
|
* Generates js default export.
|
|
543
362
|
* @returns {Source | null} the default export
|
|
@@ -545,21 +364,33 @@ class CssGenerator extends Generator {
|
|
|
545
364
|
const generateJSDefaultExport = () => {
|
|
546
365
|
switch (exportType) {
|
|
547
366
|
case "text": {
|
|
548
|
-
return
|
|
367
|
+
return this._generateCssText(module, generateContext, true);
|
|
549
368
|
}
|
|
550
369
|
case "css-style-sheet": {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
370
|
+
const rt = generateContext.runtimeTemplate;
|
|
371
|
+
const fnPrefix = rt.supportsArrowFunction()
|
|
372
|
+
? "() => {\n"
|
|
373
|
+
: "function() {\n";
|
|
374
|
+
const constOrVar = rt.renderConst();
|
|
375
|
+
const fallback =
|
|
376
|
+
"{ cssText: css, replaceSync: function(value) { this.cssText = value; } }";
|
|
377
|
+
if (rt.compilation.compiler.platform.node === true) {
|
|
378
|
+
return new ConcatSource(
|
|
379
|
+
`(${fnPrefix}${constOrVar} css = `,
|
|
380
|
+
this._generateCssText(module, generateContext, true),
|
|
381
|
+
`;\nreturn ${fallback};\n})()`
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
if (rt.isUniversalTarget()) {
|
|
385
|
+
return new ConcatSource(
|
|
386
|
+
`(${fnPrefix}${constOrVar} css = `,
|
|
387
|
+
this._generateCssText(module, generateContext, true),
|
|
388
|
+
`;\nif (typeof CSSStyleSheet === 'undefined') return ${fallback};\n${constOrVar} sheet = new CSSStyleSheet();\nsheet.replaceSync(css);\nreturn sheet;\n})()`
|
|
389
|
+
);
|
|
390
|
+
}
|
|
560
391
|
return new ConcatSource(
|
|
561
392
|
`(${fnPrefix}${constOrVar} sheet = new CSSStyleSheet();\nsheet.replaceSync(`,
|
|
562
|
-
|
|
393
|
+
this._generateCssText(module, generateContext, true),
|
|
563
394
|
");\nreturn sheet;\n})()"
|
|
564
395
|
);
|
|
565
396
|
}
|
|
@@ -571,7 +402,7 @@ class CssGenerator extends Generator {
|
|
|
571
402
|
/** @type {Source | null} */
|
|
572
403
|
const defaultExport = generateJSDefaultExport();
|
|
573
404
|
|
|
574
|
-
/** @type {
|
|
405
|
+
/** @type {CssModuleBuildInfo} */
|
|
575
406
|
(module.buildInfo).cssData = cssData;
|
|
576
407
|
|
|
577
408
|
// Required for HMR
|
|
@@ -588,11 +419,15 @@ class CssGenerator extends Generator {
|
|
|
588
419
|
/** @type {Set<string>} */
|
|
589
420
|
const usedIdentifiers = new Set();
|
|
590
421
|
const { RESERVED_IDENTIFIER } = getPropertyName();
|
|
422
|
+
const exportsInfo =
|
|
423
|
+
generateContext.moduleGraph.getExportsInfo(module);
|
|
591
424
|
|
|
592
425
|
if (defaultExport) {
|
|
593
|
-
const usedName =
|
|
594
|
-
|
|
595
|
-
|
|
426
|
+
const usedName = /** @type {string | false} */ (
|
|
427
|
+
exportsInfo
|
|
428
|
+
.getExportInfo("default")
|
|
429
|
+
.getUsedName("default", generateContext.runtime)
|
|
430
|
+
);
|
|
596
431
|
if (usedName) {
|
|
597
432
|
let identifier = Template.toIdentifier(usedName);
|
|
598
433
|
if (RESERVED_IDENTIFIER.has(identifier)) {
|
|
@@ -612,9 +447,11 @@ class CssGenerator extends Generator {
|
|
|
612
447
|
}
|
|
613
448
|
|
|
614
449
|
for (const [name, v] of cssData.exports) {
|
|
615
|
-
const usedName =
|
|
616
|
-
|
|
617
|
-
|
|
450
|
+
const usedName = /** @type {string | false} */ (
|
|
451
|
+
exportsInfo
|
|
452
|
+
.getExportInfo(name)
|
|
453
|
+
.getUsedName(name, generateContext.runtime)
|
|
454
|
+
);
|
|
618
455
|
if (!usedName) {
|
|
619
456
|
continue;
|
|
620
457
|
}
|
|
@@ -634,7 +471,9 @@ class CssGenerator extends Generator {
|
|
|
634
471
|
identifier
|
|
635
472
|
);
|
|
636
473
|
source.add(
|
|
637
|
-
`${generateContext.runtimeTemplate.renderConst()} ${identifier} = ${JSON.stringify(
|
|
474
|
+
`${generateContext.runtimeTemplate.renderConst()} ${identifier} = ${JSON.stringify(
|
|
475
|
+
v
|
|
476
|
+
)};\n`
|
|
638
477
|
);
|
|
639
478
|
}
|
|
640
479
|
return source;
|
|
@@ -704,7 +543,6 @@ class CssGenerator extends Generator {
|
|
|
704
543
|
source.add("\n");
|
|
705
544
|
}
|
|
706
545
|
}
|
|
707
|
-
// For link-type modules without any JS emit, skip source wrapping
|
|
708
546
|
if (
|
|
709
547
|
exportType === "link" &&
|
|
710
548
|
!isCssModule &&
|
|
@@ -718,9 +556,6 @@ class CssGenerator extends Generator {
|
|
|
718
556
|
compilation.requestShortener
|
|
719
557
|
);
|
|
720
558
|
|
|
721
|
-
// When per-export source positions are available, emit a
|
|
722
|
-
// SourceMapSource mapping each export line back to its CSS
|
|
723
|
-
// selector; otherwise fall back to OriginalSource.
|
|
724
559
|
if (
|
|
725
560
|
/** @type {ExportLocsMap} */
|
|
726
561
|
(cssData.exportLocs).size > 0
|
|
@@ -740,42 +575,14 @@ class CssGenerator extends Generator {
|
|
|
740
575
|
return new OriginalSource(generatedJs, sourceName);
|
|
741
576
|
}
|
|
742
577
|
case CSS_TYPE: {
|
|
743
|
-
if (!(this._exportsOnly ||
|
|
578
|
+
if (!(this._exportsOnly || exportType !== "link")) {
|
|
744
579
|
generateContext.runtimeRequirements.add(RuntimeGlobals.hasCssModules);
|
|
745
580
|
}
|
|
746
581
|
|
|
747
582
|
return InitFragment.addToSource(source, initFragments, generateContext);
|
|
748
583
|
}
|
|
749
|
-
case CSS_TEXT_TYPE:
|
|
750
|
-
|
|
751
|
-
// `HtmlInlineStyleDependency.Template` need when they want to
|
|
752
|
-
// drop the processed CSS straight into an inline `<style>`
|
|
753
|
-
// tag. Mirrors the JS-side `generateCssText()` (charset
|
|
754
|
-
// prefix included), without the JS string-literal wrapper.
|
|
755
|
-
const cssSource = this._generateMergedContentSource(
|
|
756
|
-
module,
|
|
757
|
-
generateContext,
|
|
758
|
-
new Set()
|
|
759
|
-
);
|
|
760
|
-
|
|
761
|
-
const effectiveCharset = this._getEffectiveCharset(
|
|
762
|
-
module,
|
|
763
|
-
generateContext.moduleGraph
|
|
764
|
-
);
|
|
765
|
-
const charsetPrefix =
|
|
766
|
-
effectiveCharset !== undefined
|
|
767
|
-
? `@charset "${effectiveCharset}";\n`
|
|
768
|
-
: "";
|
|
769
|
-
|
|
770
|
-
if (!cssSource) {
|
|
771
|
-
return charsetPrefix
|
|
772
|
-
? new RawSource(charsetPrefix)
|
|
773
|
-
: new RawSource("");
|
|
774
|
-
}
|
|
775
|
-
return charsetPrefix
|
|
776
|
-
? new ConcatSource(charsetPrefix, cssSource)
|
|
777
|
-
: cssSource;
|
|
778
|
-
}
|
|
584
|
+
case CSS_TEXT_TYPE:
|
|
585
|
+
return this._generateCssText(module, generateContext, false);
|
|
779
586
|
default:
|
|
780
587
|
return null;
|
|
781
588
|
}
|
|
@@ -814,10 +621,12 @@ class CssGenerator extends Generator {
|
|
|
814
621
|
return JAVASCRIPT_TYPES;
|
|
815
622
|
}
|
|
816
623
|
|
|
817
|
-
|
|
624
|
+
let hasJs = false;
|
|
625
|
+
let hasCssText = false;
|
|
818
626
|
const connections = this._moduleGraph.getIncomingConnections(module);
|
|
819
627
|
|
|
820
628
|
for (const connection of connections) {
|
|
629
|
+
if (hasJs && hasCssText) break;
|
|
821
630
|
if (
|
|
822
631
|
exportType === "link" &&
|
|
823
632
|
connection.dependency instanceof CssImportDependency
|
|
@@ -825,22 +634,17 @@ class CssGenerator extends Generator {
|
|
|
825
634
|
continue;
|
|
826
635
|
}
|
|
827
636
|
|
|
828
|
-
// when no hmr required, css module js output contains no sideEffects at all
|
|
829
|
-
// js sideeffect connection doesn't require js type output
|
|
830
637
|
if (connection.dependency instanceof HarmonyImportSideEffectDependency) {
|
|
831
638
|
continue;
|
|
832
639
|
}
|
|
833
640
|
|
|
834
|
-
//
|
|
835
|
-
// text directly via the `css-text` source type — they don't go
|
|
836
|
-
// through the JS-string wrapper that other consumers use.
|
|
837
|
-
// Matched by dependency category so the CSS package doesn't
|
|
838
|
-
// have to import HtmlInlineStyleDependency.
|
|
641
|
+
// HTML inline styles consume CSS_TEXT_TYPE directly.
|
|
839
642
|
if (
|
|
840
643
|
connection.dependency &&
|
|
841
|
-
connection.dependency.category === "html-style"
|
|
644
|
+
(connection.dependency.category === "html-style" ||
|
|
645
|
+
connection.dependency.category === "html-style-attribute")
|
|
842
646
|
) {
|
|
843
|
-
|
|
647
|
+
hasCssText = true;
|
|
844
648
|
continue;
|
|
845
649
|
}
|
|
846
650
|
|
|
@@ -848,38 +652,36 @@ class CssGenerator extends Generator {
|
|
|
848
652
|
continue;
|
|
849
653
|
}
|
|
850
654
|
|
|
851
|
-
if (connection.originModule.type.
|
|
852
|
-
|
|
655
|
+
if (!connection.originModule.type.startsWith(CSS_TYPE_PREFIX)) {
|
|
656
|
+
hasJs = true;
|
|
853
657
|
} else {
|
|
854
658
|
const originModule = /** @type {CssModule} */ connection.originModule;
|
|
855
|
-
const originExportType =
|
|
856
|
-
.exportType;
|
|
857
|
-
if (
|
|
858
|
-
|
|
859
|
-
originExportType && originExportType !== "link"
|
|
860
|
-
)
|
|
861
|
-
) {
|
|
862
|
-
sourceTypes.add(JAVASCRIPT_TYPE);
|
|
659
|
+
const originExportType =
|
|
660
|
+
/** @type {CssModule} */ (originModule).exportType || "link";
|
|
661
|
+
if (originExportType !== "link") {
|
|
662
|
+
hasJs = true;
|
|
863
663
|
}
|
|
864
664
|
}
|
|
865
665
|
}
|
|
866
|
-
if (
|
|
867
|
-
this._exportsOnly ||
|
|
868
|
-
/** @type {boolean} */ (exportType && exportType !== "link")
|
|
869
|
-
) {
|
|
870
|
-
const hasJs = sourceTypes.has(JAVASCRIPT_TYPE);
|
|
871
|
-
const hasCssText = sourceTypes.has(CSS_TEXT_TYPE);
|
|
666
|
+
if (this._exportsOnly || exportType !== "link") {
|
|
872
667
|
if (hasJs && hasCssText) return JAVASCRIPT_AND_CSS_TEXT_TYPES;
|
|
873
668
|
if (hasJs) return JAVASCRIPT_TYPES;
|
|
874
669
|
if (hasCssText) return CSS_TEXT_TYPES;
|
|
875
|
-
return
|
|
670
|
+
return NO_TYPES;
|
|
876
671
|
}
|
|
877
|
-
if (
|
|
672
|
+
if (hasJs) {
|
|
878
673
|
return JAVASCRIPT_AND_CSS_TYPES;
|
|
879
674
|
}
|
|
880
675
|
return CSS_TYPES;
|
|
881
676
|
}
|
|
882
677
|
|
|
678
|
+
/**
|
|
679
|
+
* @returns {boolean} whether getTypes() depends on the module's incoming connections
|
|
680
|
+
*/
|
|
681
|
+
getTypesDependOnIncomingConnections() {
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
684
|
+
|
|
883
685
|
/**
|
|
884
686
|
* Returns the estimated size for the requested source type.
|
|
885
687
|
* @param {NormalModule} module the module
|
|
@@ -889,12 +691,15 @@ class CssGenerator extends Generator {
|
|
|
889
691
|
getSize(module, type) {
|
|
890
692
|
switch (type) {
|
|
891
693
|
case JAVASCRIPT_TYPE: {
|
|
892
|
-
const cssData = /** @type {
|
|
694
|
+
const cssData = /** @type {CssModuleBuildInfo} */ (module.buildInfo)
|
|
695
|
+
.cssData;
|
|
893
696
|
if (!cssData) {
|
|
894
697
|
return 42;
|
|
895
698
|
}
|
|
896
699
|
if (cssData.exports.size === 0) {
|
|
897
|
-
if (
|
|
700
|
+
if (
|
|
701
|
+
/** @type {CssModuleBuildMeta} */ (module.buildMeta).isCssModule
|
|
702
|
+
) {
|
|
898
703
|
return 42;
|
|
899
704
|
}
|
|
900
705
|
return 0;
|
|
@@ -909,6 +714,7 @@ class CssGenerator extends Generator {
|
|
|
909
714
|
|
|
910
715
|
return stringifiedExports.length + 42;
|
|
911
716
|
}
|
|
717
|
+
case CSS_TEXT_TYPE:
|
|
912
718
|
case CSS_TYPE: {
|
|
913
719
|
const originalSource = module.originalSource();
|
|
914
720
|
|
|
@@ -932,6 +738,226 @@ class CssGenerator extends Generator {
|
|
|
932
738
|
hash.update(/** @type {boolean} */ (this._esModule).toString());
|
|
933
739
|
hash.update(/** @type {boolean} */ (this._exportsOnly).toString());
|
|
934
740
|
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Resolve the effective `@charset` by walking text imports.
|
|
744
|
+
* @param {NormalModule} module the module
|
|
745
|
+
* @param {ModuleGraph} moduleGraph module graph
|
|
746
|
+
* @param {WeakSet<NormalModule>=} visited cycle guard
|
|
747
|
+
* @returns {string | undefined} the effective charset
|
|
748
|
+
*/
|
|
749
|
+
_getEffectiveCharset(module, moduleGraph, visited = new WeakSet()) {
|
|
750
|
+
if (!module || visited.has(module)) return undefined;
|
|
751
|
+
const exportType = /** @type {CssModule} */ (module).exportType;
|
|
752
|
+
if (exportType !== "text" && exportType !== "css-style-sheet") {
|
|
753
|
+
return undefined;
|
|
754
|
+
}
|
|
755
|
+
visited.add(module);
|
|
756
|
+
const own =
|
|
757
|
+
module.buildInfo &&
|
|
758
|
+
/** @type {CssModuleBuildInfo} */ (module.buildInfo).charset;
|
|
759
|
+
if (own !== undefined) return own;
|
|
760
|
+
if (exportType !== "text") return undefined;
|
|
761
|
+
for (const dep of module.dependencies) {
|
|
762
|
+
if (dep instanceof CssImportDependency) {
|
|
763
|
+
const depModule = /** @type {NormalModule} */ (
|
|
764
|
+
moduleGraph.getModule(dep)
|
|
765
|
+
);
|
|
766
|
+
const inherited = this._getEffectiveCharset(
|
|
767
|
+
depModule,
|
|
768
|
+
moduleGraph,
|
|
769
|
+
visited
|
|
770
|
+
);
|
|
771
|
+
if (inherited !== undefined) return inherited;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
return undefined;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Generate JS expressions for `@import` side effects (`style` exportType only).
|
|
779
|
+
* @param {NormalModule} module the module to generate CSS text for
|
|
780
|
+
* @param {GenerateContext} generateContext the generate context
|
|
781
|
+
* @returns {string[]} JS expressions, one per `@import` dependency
|
|
782
|
+
*/
|
|
783
|
+
_generateImportExpressions(module, generateContext) {
|
|
784
|
+
const { moduleGraph, concatenationScope } = generateContext;
|
|
785
|
+
const parts = [];
|
|
786
|
+
|
|
787
|
+
for (const dep of module.dependencies) {
|
|
788
|
+
if (!(dep instanceof CssImportDependency)) continue;
|
|
789
|
+
const depModule = /** @type {CssModule} */ (moduleGraph.getModule(dep));
|
|
790
|
+
if (concatenationScope && concatenationScope.isModuleInScope(depModule)) {
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
parts.push(
|
|
794
|
+
generateContext.runtimeTemplate.moduleExports({
|
|
795
|
+
module: depModule,
|
|
796
|
+
chunkGraph: generateContext.chunkGraph,
|
|
797
|
+
request: depModule.userRequest,
|
|
798
|
+
weak: false,
|
|
799
|
+
runtimeRequirements: generateContext.runtimeRequirements
|
|
800
|
+
})
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
return parts;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Recursively merge `@import`'d CSS into a single Source (text/css-style-sheet only).
|
|
809
|
+
* @param {NormalModule} module the module to render
|
|
810
|
+
* @param {GenerateContext} generateContext the generate context
|
|
811
|
+
* @param {Set<NormalModule>} ancestors modules on the current path (cycle guard)
|
|
812
|
+
* @returns {Source | null} merged CSS source, or null when the module has no content
|
|
813
|
+
*/
|
|
814
|
+
_renderMergedCss(module, generateContext, ancestors) {
|
|
815
|
+
if (ancestors.has(module)) return null;
|
|
816
|
+
ancestors.add(module);
|
|
817
|
+
try {
|
|
818
|
+
const { moduleGraph } = generateContext;
|
|
819
|
+
/** @type {Source[]} */
|
|
820
|
+
const parts = [];
|
|
821
|
+
|
|
822
|
+
for (const dep of module.dependencies) {
|
|
823
|
+
if (!(dep instanceof CssImportDependency)) continue;
|
|
824
|
+
const depModule = /** @type {CssModule} */ (moduleGraph.getModule(dep));
|
|
825
|
+
if (!depModule) continue;
|
|
826
|
+
const depExportType = depModule.exportType;
|
|
827
|
+
if (depExportType !== "text" && depExportType !== "css-style-sheet") {
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
const depMerged = this._renderMergedCss(
|
|
831
|
+
depModule,
|
|
832
|
+
generateContext,
|
|
833
|
+
ancestors
|
|
834
|
+
);
|
|
835
|
+
if (depMerged) parts.push(depMerged);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const own = this._renderCss(module, generateContext);
|
|
839
|
+
if (own) parts.push(own);
|
|
840
|
+
|
|
841
|
+
if (parts.length === 0) return null;
|
|
842
|
+
if (parts.length === 1) return parts[0];
|
|
843
|
+
return new ConcatSource(...parts);
|
|
844
|
+
} finally {
|
|
845
|
+
ancestors.delete(module);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Generate CSS source for the current module
|
|
851
|
+
* @param {NormalModule} module the module to generate CSS source for
|
|
852
|
+
* @param {GenerateContext} generateContext the generate context
|
|
853
|
+
* @returns {Source | null} the CSS source
|
|
854
|
+
*/
|
|
855
|
+
_renderCss(module, generateContext) {
|
|
856
|
+
const moduleSourceContent = /** @type {Source} */ (
|
|
857
|
+
this.generate(module, {
|
|
858
|
+
...generateContext,
|
|
859
|
+
type: CSS_TYPE
|
|
860
|
+
})
|
|
861
|
+
);
|
|
862
|
+
|
|
863
|
+
if (!moduleSourceContent) {
|
|
864
|
+
return null;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const compilation = generateContext.runtimeTemplate.compilation;
|
|
868
|
+
const undoPath = "";
|
|
869
|
+
|
|
870
|
+
const CssModulesPlugin = getCssModulesPlugin();
|
|
871
|
+
const hooks = CssModulesPlugin.getCompilationHooks(compilation);
|
|
872
|
+
return CssModulesPlugin.renderModule(
|
|
873
|
+
/** @type {CssModule} */ (module),
|
|
874
|
+
{
|
|
875
|
+
undoPath,
|
|
876
|
+
moduleSourceContent,
|
|
877
|
+
moduleFactoryCache: this._moduleFactoryCache,
|
|
878
|
+
runtimeTemplate: generateContext.runtimeTemplate
|
|
879
|
+
},
|
|
880
|
+
hooks
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Convert a CSS Source into a JS string literal, splicing `__webpack_require__.h()` for `[fullhash]` placeholders.
|
|
886
|
+
* @param {Source} cssSource the CSS source
|
|
887
|
+
* @param {import("../../declarations/WebpackOptions").DevTool | undefined} devtool the devtool option
|
|
888
|
+
* @param {GenerateContext} generateContext the generate context
|
|
889
|
+
* @returns {Source} a Source representing a JS string literal
|
|
890
|
+
*/
|
|
891
|
+
_cssToJsLiteral(cssSource, devtool, generateContext) {
|
|
892
|
+
const { source, map } = cssSource.sourceAndMap();
|
|
893
|
+
let content = /** @type {string} */ (source);
|
|
894
|
+
if (map) {
|
|
895
|
+
const inlineMap =
|
|
896
|
+
typeof devtool === "string" && devtool.includes("nosources")
|
|
897
|
+
? { ...map, sourcesContent: undefined }
|
|
898
|
+
: map;
|
|
899
|
+
const base64Map = Buffer.from(JSON.stringify(inlineMap), "utf8").toString(
|
|
900
|
+
"base64"
|
|
901
|
+
);
|
|
902
|
+
const trailingNewline = content.endsWith("\n") ? "" : "\n";
|
|
903
|
+
content += `${trailingNewline}/*# sourceMappingURL=data:application/json;charset=utf-8;base64,${base64Map}*/`;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
if (!content.includes(PUBLIC_PATH_FULL_HASH)) {
|
|
907
|
+
return new RawSource(JSON.stringify(content));
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const result = new ConcatSource();
|
|
911
|
+
let last = 0;
|
|
912
|
+
walkFullHashPlaceholders(content, (start, end, length) => {
|
|
913
|
+
result.add(JSON.stringify(content.slice(last, start)));
|
|
914
|
+
result.add(
|
|
915
|
+
length === 0
|
|
916
|
+
? ` + ${RuntimeGlobals.getFullHash}() + `
|
|
917
|
+
: ` + ${RuntimeGlobals.getFullHash}().slice(0, ${length}) + `
|
|
918
|
+
);
|
|
919
|
+
last = end;
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
result.add(JSON.stringify(content.slice(last)));
|
|
923
|
+
generateContext.runtimeRequirements.add(RuntimeGlobals.getFullHash);
|
|
924
|
+
return result;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Generate the merged CSS text for a module, optionally wrapped as a
|
|
929
|
+
* JS string literal for embedding in JavaScript output.
|
|
930
|
+
* @param {NormalModule} module the module
|
|
931
|
+
* @param {GenerateContext} generateContext the generate context
|
|
932
|
+
* @param {boolean} asJsLiteral wrap the result as a JS string literal
|
|
933
|
+
* @returns {Source} the CSS text source
|
|
934
|
+
*/
|
|
935
|
+
_generateCssText(module, generateContext, asJsLiteral) {
|
|
936
|
+
const cssSource = this._renderMergedCss(module, generateContext, new Set());
|
|
937
|
+
const effectiveCharset = this._getEffectiveCharset(
|
|
938
|
+
module,
|
|
939
|
+
generateContext.moduleGraph
|
|
940
|
+
);
|
|
941
|
+
|
|
942
|
+
let result;
|
|
943
|
+
if (effectiveCharset !== undefined) {
|
|
944
|
+
const prefix = `@charset "${effectiveCharset}";\n`;
|
|
945
|
+
result = cssSource
|
|
946
|
+
? new ConcatSource(prefix, cssSource)
|
|
947
|
+
: new RawSource(prefix);
|
|
948
|
+
} else {
|
|
949
|
+
result = cssSource;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
if (asJsLiteral) {
|
|
953
|
+
const devtool =
|
|
954
|
+
generateContext.runtimeTemplate.compilation.options.devtool;
|
|
955
|
+
return result
|
|
956
|
+
? this._cssToJsLiteral(result, devtool, generateContext)
|
|
957
|
+
: new RawSource('""');
|
|
958
|
+
}
|
|
959
|
+
return result || new RawSource("");
|
|
960
|
+
}
|
|
935
961
|
}
|
|
936
962
|
|
|
937
963
|
module.exports = CssGenerator;
|