webpack 5.111.0 → 5.111.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/APIPlugin.js +3 -4
- package/lib/CompatibilityPlugin.js +3 -4
- package/lib/Compilation.js +16 -35
- package/lib/Compiler.js +4 -5
- package/lib/ConstPlugin.js +16 -132
- package/lib/DependencyTemplate.js +2 -1
- package/lib/DotenvPlugin.js +24 -28
- package/lib/ErrorHelpers.js +113 -0
- package/lib/ExportsInfo.js +20 -16
- package/lib/ExternalModule.js +6 -8
- package/lib/FlagDependencyExportsPlugin.js +8 -13
- package/lib/FlagDependencyUsagePlugin.js +9 -13
- package/lib/Generator.js +24 -2
- package/lib/HotModuleReplacementPlugin.js +2 -0
- package/lib/IgnorePlugin.js +1 -1
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/Module.js +3 -3
- package/lib/ModuleGraph.js +6 -9
- package/lib/MultiCompiler.js +6 -16
- package/lib/NormalModule.js +96 -44
- package/lib/RuntimeTemplate.js +33 -43
- package/lib/SourceMapDevToolPlugin.js +53 -103
- package/lib/TemplatedPathPlugin.js +16 -59
- package/lib/asset/AssetBytesGenerator.js +7 -1
- package/lib/asset/AssetGenerator.js +25 -16
- package/lib/asset/AssetSourceGenerator.js +7 -1
- package/lib/buildChunkGraph.js +11 -15
- package/lib/cache/MemoryCachePlugin.js +4 -4
- package/lib/cache/MemoryWithGcCachePlugin.js +7 -8
- package/lib/cache/PackFileCacheStrategy.js +3 -18
- package/lib/cache/getLazyHashedEtag.js +3 -5
- package/lib/config/browserslistTargetHandler.js +2 -8
- package/lib/config/defaults.js +52 -78
- package/lib/config/getClaimedAssetTypes.js +10 -11
- package/lib/config/target.js +3 -4
- package/lib/{ContextExclusionPlugin.js → context/ContextExclusionPlugin.js} +1 -1
- package/lib/{ContextModule.js → context/ContextModule.js} +37 -34
- package/lib/{ContextModuleFactory.js → context/ContextModuleFactory.js} +19 -21
- package/lib/{ContextReplacementPlugin.js → context/ContextReplacementPlugin.js} +4 -4
- package/lib/css/CssGenerator.js +19 -11
- package/lib/css/CssParser.js +18 -20
- package/lib/css/cssMinify.js +32 -29
- package/lib/css/data.js +797 -288
- package/lib/css/syntax.js +2250 -934
- package/lib/debug/ProfilingPlugin.js +3 -4
- package/lib/dependencies/CommonJsExportRequireDependency.js +10 -11
- package/lib/dependencies/CommonJsImportsParserPlugin.js +4 -5
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +2 -4
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -9
- package/lib/dependencies/ContextElementDependency.js +1 -1
- package/lib/dependencies/CssIcssExportDependency.js +6 -8
- package/lib/dependencies/CssIcssImportDependency.js +3 -6
- package/lib/dependencies/CssUrlDependency.js +3 -5
- package/lib/dependencies/HarmonyCompatibilityDependency.js +11 -20
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -4
- package/lib/dependencies/HarmonyExportExpressionDependency.js +3 -4
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyExportInitFragment.js +26 -19
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +7 -28
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +103 -16
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +3 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +16 -2
- package/lib/dependencies/HtmlEntryDependency.js +74 -102
- package/lib/dependencies/HtmlInlineScriptDependency.js +3 -4
- package/lib/dependencies/HtmlInlineStyleDependency.js +3 -4
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaGlobHelpers.js +1 -1
- package/lib/dependencies/ImportMetaPlugin.js +8 -10
- package/lib/dependencies/ImportParserPlugin.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +26 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/URLContextDependency.js +1 -1
- package/lib/dependencies/URLDependency.js +6 -5
- package/lib/dependencies/WorkerAndWorkletPlugin.js +15 -21
- package/lib/dependencies/WorkerDependency.js +6 -5
- package/lib/dependencies/WorkletDependency.js +6 -9
- package/lib/errors/HookWebpackError.js +3 -2
- package/lib/hmr/LazyCompilationPlugin.js +3 -5
- package/lib/html/HtmlGenerator.js +61 -82
- package/lib/html/HtmlModulesPlugin.js +88 -139
- package/lib/html/HtmlParser.js +97 -141
- package/lib/html/data.js +21 -0
- package/lib/html/htmlMinify.js +10 -11
- package/lib/html/syntax.js +883 -993
- package/lib/index.js +46 -3
- package/lib/javascript/ChunkFormatHelpers.js +4 -3
- package/lib/javascript/JavascriptGenerator.js +8 -1
- package/lib/javascript/JavascriptModulesPlugin.js +21 -48
- package/lib/javascript/JavascriptParser.js +721 -178
- package/lib/javascript/parser.js +6 -0
- package/lib/javascript/syntax.js +420 -92
- package/lib/json/JsonGenerator.js +7 -1
- package/lib/library/ModuleLibraryPlugin.js +64 -136
- package/lib/loaders/LoaderRunner.js +137 -9
- package/lib/node/NodeWatchFileSystem.js +3 -9
- package/lib/optimize/AggressiveMergingPlugin.js +3 -5
- package/lib/optimize/ConcatenatedModule.js +81 -100
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -11
- package/lib/optimize/InnerGraphPlugin.js +7 -13
- package/lib/optimize/LimitChunkCountPlugin.js +5 -8
- package/lib/optimize/MangleExportsPlugin.js +3 -4
- package/lib/optimize/ModuleConcatenationPlugin.js +3 -4
- package/lib/optimize/SideEffectsFlagPlugin.js +7 -19
- package/lib/optimize/SplitChunksPlugin.js +2 -4
- package/lib/performance/BroadContextsPlugin.js +1 -1
- package/lib/performance/CacheEffectivenessPlugin.js +3 -4
- package/lib/performance/SizeLimitsPlugin.js +2 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +6 -8
- package/lib/prefetch/ResourceHintPlugin.js +17 -21
- package/lib/prefetch/StartupAssetHintRuntimeModule.js +7 -10
- package/lib/runtime/AsyncModuleRuntimeModule.js +3 -5
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +3 -4
- package/lib/runtime/GlobalRuntimeModule.js +2 -4
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +55 -85
- package/lib/schemes/DataUriPlugin.js +3 -6
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +9 -9
- package/lib/serialization/FileMiddleware.js +16 -16
- package/lib/serialization/ObjectMiddleware.js +30 -33
- package/lib/stats/DefaultStatsFactoryPlugin.js +3 -4
- package/lib/typescript/TypeScriptPlugin.js +2 -3
- package/lib/url/URLParserPlugin.js +6 -8
- package/lib/util/LocConverter.js +4 -7
- package/lib/util/SourceProcessor.js +15 -22
- package/lib/util/chainedImports.js +3 -4
- package/lib/util/concatenate.js +4 -4
- package/lib/util/createHooksRegistry.js +1 -2
- package/lib/util/dataURL.js +2 -3
- package/lib/util/deterministicGrouping.js +8 -13
- package/lib/util/findGraphRoots.js +6 -13
- package/lib/util/globUtils.js +1 -1
- package/lib/util/hash/wasm-hash.js +3 -4
- package/lib/util/internalSerializables.js +1 -1
- package/lib/util/semver.js +5 -3
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +6 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -1
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +3 -4
- package/lib/wasm-sync/WebAssemblyGenerator.js +6 -1
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +5 -1
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -4
- package/package.json +30 -23
- package/types.d.ts +299 -280
|
@@ -6,25 +6,25 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = require("tapable");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const {
|
|
15
|
-
const {
|
|
16
|
-
const { join } = require("./util/fs");
|
|
9
|
+
const ModuleFactory = require("../ModuleFactory");
|
|
10
|
+
const ContextElementDependency = require("../dependencies/ContextElementDependency");
|
|
11
|
+
const LazySet = require("../util/LazySet");
|
|
12
|
+
const asyncLib = require("../util/async");
|
|
13
|
+
const { cachedSetProperty } = require("../util/cleverMerge");
|
|
14
|
+
const { createFakeHook } = require("../util/deprecation");
|
|
15
|
+
const { join } = require("../util/fs");
|
|
17
16
|
const {
|
|
18
17
|
globPatternBaseReachesDir,
|
|
19
18
|
globUserRequest,
|
|
20
19
|
isNonExhaustiveImportMetaGlobSkippedDir,
|
|
21
20
|
resolveContextModuleGlobPattern
|
|
22
|
-
} = require("
|
|
21
|
+
} = require("../util/globUtils");
|
|
22
|
+
const ContextModule = require("./ContextModule");
|
|
23
23
|
|
|
24
|
-
/** @import { ResolvedContextModuleGlobPattern } from "
|
|
24
|
+
/** @import { ResolvedContextModuleGlobPattern } from "../util/globUtils" */
|
|
25
25
|
/** @typedef {(context: string, subResource: string, callback: () => void, resolvedGlobPatterns?: ResolvedContextModuleGlobPattern[]) => void} AddSubDirectoryFn */
|
|
26
26
|
/** @import { ResolveRequest } from "enhanced-resolve" */
|
|
27
|
-
/** @import { FileSystemDependencies } from "
|
|
27
|
+
/** @import { FileSystemDependencies } from "../Compilation" */
|
|
28
28
|
/**
|
|
29
29
|
* @import {
|
|
30
30
|
* ContextModuleOptions,
|
|
@@ -36,17 +36,17 @@ const {
|
|
|
36
36
|
* @import {
|
|
37
37
|
* ModuleFactoryCreateData,
|
|
38
38
|
* ModuleFactoryCallback
|
|
39
|
-
* } from "
|
|
39
|
+
* } from "../ModuleFactory"
|
|
40
40
|
*/
|
|
41
|
-
/** @import ResolverFactory from "
|
|
42
|
-
/** @import ContextDependency from "
|
|
41
|
+
/** @import ResolverFactory from "../ResolverFactory" */
|
|
42
|
+
/** @import ContextDependency from "../dependencies/ContextDependency" */
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Defines the shared type used by this module.
|
|
46
46
|
* @template T
|
|
47
|
-
* @typedef {import("
|
|
47
|
+
* @typedef {import("../util/deprecation").FakeHook<T>} FakeHook<T>
|
|
48
48
|
*/
|
|
49
|
-
/** @import { IStats, InputFileSystem } from "
|
|
49
|
+
/** @import { IStats, InputFileSystem } from "../util/fs" */
|
|
50
50
|
/** @typedef {{ context: string, request: string }} ContextAlternativeRequest */
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -531,11 +531,9 @@ class ContextModuleFactory extends ModuleFactory {
|
|
|
531
531
|
}
|
|
532
532
|
return callback();
|
|
533
533
|
}
|
|
534
|
-
//
|
|
535
|
-
//
|
|
536
|
-
//
|
|
537
|
-
// lookup, array allocations) for every file in the
|
|
538
|
-
// context — which is the bulk of work on rebuilds.
|
|
534
|
+
// Collected for one batched `alternativeRequests` call per
|
|
535
|
+
// directory: calling the hook per file would pay its overhead
|
|
536
|
+
// across the whole context, the bulk of a rebuild.
|
|
539
537
|
fileObjs.push({
|
|
540
538
|
context: ctx,
|
|
541
539
|
request: `.${subResource.slice(ctx.length).replace(/\\/g, "/")}`
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const ContextElementDependency = require("
|
|
9
|
-
const { isAbsolute, join } = require("
|
|
8
|
+
const ContextElementDependency = require("../dependencies/ContextElementDependency");
|
|
9
|
+
const { isAbsolute, join } = require("../util/fs");
|
|
10
10
|
|
|
11
|
-
/** @import Compiler from "
|
|
11
|
+
/** @import Compiler from "../Compiler" */
|
|
12
12
|
/** @import { ContextModuleOptions } from "./ContextModule" */
|
|
13
13
|
/**
|
|
14
14
|
* @import {
|
|
@@ -16,7 +16,7 @@ const { isAbsolute, join } = require("./util/fs");
|
|
|
16
16
|
* AfterContextResolveData
|
|
17
17
|
* } from "./ContextModuleFactory"
|
|
18
18
|
*/
|
|
19
|
-
/** @import { InputFileSystem } from "
|
|
19
|
+
/** @import { InputFileSystem } from "../util/fs" */
|
|
20
20
|
|
|
21
21
|
/** @typedef {Record<string, string>} NewContentCreateContextMap */
|
|
22
22
|
|
package/lib/css/CssGenerator.js
CHANGED
|
@@ -618,10 +618,21 @@ class CssGenerator extends Generator {
|
|
|
618
618
|
generateError(error, module, generateContext) {
|
|
619
619
|
switch (generateContext.type) {
|
|
620
620
|
case JAVASCRIPT_TYPE: {
|
|
621
|
-
return new RawSource(
|
|
621
|
+
return new RawSource(
|
|
622
|
+
Generator.throwBuildErrorCode(
|
|
623
|
+
error,
|
|
624
|
+
undefined,
|
|
625
|
+
generateContext.runtimeTemplate.requestShortener
|
|
626
|
+
)
|
|
627
|
+
);
|
|
622
628
|
}
|
|
623
629
|
case CSS_TYPE: {
|
|
624
|
-
|
|
630
|
+
const message = Generator.buildErrorMessage(
|
|
631
|
+
error,
|
|
632
|
+
generateContext.runtimeTemplate.requestShortener
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
return new RawSource(`/**\n ${message} \n**/`);
|
|
625
636
|
}
|
|
626
637
|
default:
|
|
627
638
|
return null;
|
|
@@ -1018,10 +1029,9 @@ class CssGenerator extends Generator {
|
|
|
1018
1029
|
_cssToJsLiteral(cssSource, devtool, generateContext) {
|
|
1019
1030
|
const { source, map } = cssSource.sourceAndMap();
|
|
1020
1031
|
let content = /** @type {string} */ (source);
|
|
1021
|
-
// A `renderEmbeddedSource` tap may
|
|
1022
|
-
//
|
|
1023
|
-
//
|
|
1024
|
-
// answer for the same reason.
|
|
1032
|
+
// A `renderEmbeddedSource` tap may return a mapped source whatever `devtool`
|
|
1033
|
+
// says, so wanting no map is checked here too: this data URI would ship the
|
|
1034
|
+
// sources inside the bundle. `hidden` answers the same.
|
|
1025
1035
|
const wanted = typeof devtool === "string" && !devtool.includes("hidden");
|
|
1026
1036
|
if (map && wanted) {
|
|
1027
1037
|
const namedMap = this._nameMapSources(map, generateContext);
|
|
@@ -1082,11 +1092,9 @@ class CssGenerator extends Generator {
|
|
|
1082
1092
|
result = cssSource;
|
|
1083
1093
|
}
|
|
1084
1094
|
|
|
1085
|
-
// Only text bound for a JS literal. `CSS_TEXT_TYPE`
|
|
1086
|
-
// `<style>`
|
|
1087
|
-
//
|
|
1088
|
-
// which is not visible here. After the `@charset` prefix, so a tap sees a
|
|
1089
|
-
// whole stylesheet.
|
|
1095
|
+
// Only text bound for a JS literal. Whether a `CSS_TEXT_TYPE` inline
|
|
1096
|
+
// `<style>` is CSS at all turns on the element's `type`, a call the HTML
|
|
1097
|
+
// layer makes. After the `@charset` prefix, so a tap sees a whole sheet.
|
|
1090
1098
|
if (result && asJsLiteral) {
|
|
1091
1099
|
result = this._renderEmbeddedSource(result, module, generateContext);
|
|
1092
1100
|
}
|
package/lib/css/CssParser.js
CHANGED
|
@@ -164,13 +164,14 @@ const fontMimeType = (request) => {
|
|
|
164
164
|
return getMimeTypes().lookup(resourcePath);
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
//
|
|
168
|
-
// walked without modules
|
|
169
|
-
// `Ident` visitor no-ops, the `Declaration` visitor returns early,
|
|
170
|
-
// `url
|
|
171
|
-
// rewrites and image-set fences
|
|
172
|
-
// are read
|
|
173
|
-
// `:export { k: v }` captures each value's byte range from
|
|
167
|
+
// WHY: skip options for a non-CSS-Modules parse. The selector prelude is never
|
|
168
|
+
// walked without modules, and the value and function-arg leaves reach nothing —
|
|
169
|
+
// the `Ident` visitor no-ops, the `Declaration` visitor returns early, and there
|
|
170
|
+
// is no ICSS. `url`, functions, strings, blocks and commas are kept, carrying
|
|
171
|
+
// the `url()` rewrites and image-set fences, and at-rule preludes too, since
|
|
172
|
+
// `@media` and `@import` are read. A CSS-Modules parse skips nothing: selectors
|
|
173
|
+
// are walked, and ICSS `:export { k: v }` captures each value's byte range from
|
|
174
|
+
// its first and last node.
|
|
174
175
|
const SKIP_NON_MODULES = {
|
|
175
176
|
types: buildSkipSet([
|
|
176
177
|
NodeType.Number,
|
|
@@ -4814,13 +4815,13 @@ class CssParser extends Parser {
|
|
|
4814
4815
|
},
|
|
4815
4816
|
[NodeType.Ident](path) {
|
|
4816
4817
|
const node = path.node;
|
|
4817
|
-
//
|
|
4818
|
-
// and ICSS context
|
|
4819
|
-
// no work, and idents are the most common node, so skipping
|
|
4820
|
-
// `value` slice matters. With no `@value
|
|
4821
|
-
// probe can never hit, so it
|
|
4822
|
-
// probe reads two char codes instead of slicing
|
|
4823
|
-
// match,
|
|
4818
|
+
// WHY: a fast exit before slicing the ident value. Outside dashed-ident
|
|
4819
|
+
// scoping and ICSS context — any non-CSS-Modules stylesheet — a bare
|
|
4820
|
+
// ident carries no work, and idents are the most common node, so skipping
|
|
4821
|
+
// the per-ident `value` slice matters. With no `@value` or `:import`
|
|
4822
|
+
// definitions the ICSS probe can never hit, so it does not warrant the
|
|
4823
|
+
// slice either. The dashed probe reads two char codes instead of slicing,
|
|
4824
|
+
// and an escaped dash does not match, as in the string form.
|
|
4824
4825
|
const dashedActive = dashed.active;
|
|
4825
4826
|
const icss = icssActive() && icssDefinitions.size !== 0;
|
|
4826
4827
|
if (!dashedActive && !icss) return;
|
|
@@ -4915,12 +4916,9 @@ class CssParser extends Parser {
|
|
|
4915
4916
|
emitICSSSymbol(identValue, identStart, identEnd);
|
|
4916
4917
|
}
|
|
4917
4918
|
};
|
|
4918
|
-
// `as` selects the top-level production
|
|
4919
|
-
// block's contents,
|
|
4920
|
-
//
|
|
4921
|
-
// (per-source) is passed to `process`. One skip set: selector prelude +
|
|
4922
|
-
// unread value leaves (non-modules only; CSS Modules needs its selectors
|
|
4923
|
-
// and ICSS-captured values).
|
|
4919
|
+
// `as` selects the top-level production of §5.3: a `style` attribute is a
|
|
4920
|
+
// block's contents, anything else a full stylesheet. `as` and `skip` are
|
|
4921
|
+
// per-parse, so only the per-source `locConverter` reaches `process`.
|
|
4924
4922
|
new SourceProcessor()
|
|
4925
4923
|
.use(/** @type {VisitorMap} */ (visitors))
|
|
4926
4924
|
.process(source, {
|
package/lib/css/cssMinify.js
CHANGED
|
@@ -44,36 +44,40 @@ const cssMinify = async (input, sourceMap, minimizerOptions = {}) => {
|
|
|
44
44
|
|
|
45
45
|
// TODO expose the remaining declined transforms on `optimization.minimize.css`
|
|
46
46
|
// like `convertLengthUnits` — the switches below turn off what webpack does
|
|
47
|
-
// make, not what it declines.
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
//
|
|
47
|
+
// make, not what it declines.
|
|
48
|
+
|
|
49
|
+
// WHY: each transform webpack declines is on in other minifiers, and each costs
|
|
50
|
+
// something measured.
|
|
51
|
+
// - Dropping a declaration a later one overrides loses a fallback pair an
|
|
52
|
+
// engine that cannot read the newer spelling depends on.
|
|
53
|
+
// - Merging rules a third stands between, and merging non-adjacent `@media`,
|
|
54
|
+
// both reorder the cascade (csso loses ~12,900 Tailwind classes to it).
|
|
55
|
+
// Adjacent rules sharing a block do join, nothing being between them to step
|
|
56
|
+
// over — only where every selector is a shape each engine parses, since one
|
|
57
|
+
// it cannot invalidates the whole list and loses the rest with it.
|
|
58
|
+
// - Two color conversions are declined rather than guessed. Every polar and Lab
|
|
59
|
+
// function converts to hex, except a channel landing near a `.5` boundary,
|
|
60
|
+
// where implementations round opposite ways (which is why esbuild and
|
|
61
|
+
// lightningcss emit different bytes for `hwb(194 0% 0%)`), and a Lab-family
|
|
62
|
+
// color outside the sRGB gamut, which hex would clip rather than respell.
|
|
63
|
+
|
|
64
|
+
// WHY: which longhand families merge into their shorthand is decided in
|
|
65
|
+
// `tooling/generate-css-data.js`, where three kinds are excluded for good
|
|
66
|
+
// rather than pending an option.
|
|
67
|
+
// - A shorthand gathering a whole family (`border`, `font`, `background`,
|
|
65
68
|
// `transition`, `flex`, `columns`) resets longhands `computed` does not
|
|
66
69
|
// name — `border` clears `border-image`, `font` clears `font-size-adjust` —
|
|
67
|
-
// so the merge would drop a declaration nothing in the family wrote. The
|
|
68
|
-
//
|
|
69
|
-
// (`FAMILY_LONGHANDS`), where each value parses back into its own slot
|
|
70
|
-
// -
|
|
70
|
+
// so the merge would drop a declaration nothing in the family wrote. The ones
|
|
71
|
+
// checked against a browser and found to reset nothing else do merge
|
|
72
|
+
// (`FAMILY_LONGHANDS`), where each value parses back into its own slot.
|
|
73
|
+
// - A shorthand materially newer than its longhands (`place-items`/`-content`
|
|
71
74
|
// /`-self`) would lose both declarations, not one, on a target reading only
|
|
72
|
-
// the longhands. `output.environment` states this for `inset` alone
|
|
73
|
-
// `overflow` is newer only two values wide, so it merges when it collapses
|
|
74
|
-
// -
|
|
75
|
+
// the longhands. `output.environment` states this for `inset` alone, and
|
|
76
|
+
// `overflow` is newer only two values wide, so it merges when it collapses.
|
|
77
|
+
// - A pair two shorthands both claim, which cannot be right for both. None
|
|
75
78
|
// today: `mdn-data` gave `corner-inline-start-shape` the block-start edge's
|
|
76
79
|
// corners, corrected in the generator to the pair Chromium computes.
|
|
80
|
+
|
|
77
81
|
const {
|
|
78
82
|
SourceProcessor,
|
|
79
83
|
askEmbeddedRenderer,
|
|
@@ -84,10 +88,9 @@ const cssMinify = async (input, sourceMap, minimizerOptions = {}) => {
|
|
|
84
88
|
const [[file, given]] = Object.entries(input);
|
|
85
89
|
// The plugin hands a text minifier a string; the type admits an image's bytes.
|
|
86
90
|
const code = typeof given === "string" ? given : given.toString("utf8");
|
|
87
|
-
// `process` parses once, and
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
// back to the original source.
|
|
91
|
+
// `process` parses once, and under `mode: "minify"` the same walk prints the
|
|
92
|
+
// minified serialization too. Naming the input with `source` or `content` is
|
|
93
|
+
// what asks for the map the plugin composes back to the original.
|
|
91
94
|
const {
|
|
92
95
|
as,
|
|
93
96
|
environment,
|