webpack 5.100.1 → 5.101.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/README.md +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +21 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +127 -114
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +1 -1
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +86 -5
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +28 -24
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +42 -44
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -12
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +10 -3
- package/lib/asset/AssetGenerator.js +3 -3
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +50 -0
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -23
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +59 -75
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +10 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +16 -16
- package/lib/javascript/JavascriptParser.js +90 -83
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +3 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +7 -2
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +161 -52
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +22 -6
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +17 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +86 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +107 -8
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +3 -3
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +186 -54
|
@@ -46,7 +46,7 @@ const proxyFetch = (request, proxy) => (url, options, callback) => {
|
|
|
46
46
|
* @param {Socket=} socket socket
|
|
47
47
|
* @returns {void}
|
|
48
48
|
*/
|
|
49
|
-
const doRequest = socket => {
|
|
49
|
+
const doRequest = (socket) => {
|
|
50
50
|
request
|
|
51
51
|
.get(url, { ...options, ...(socket && { socket }) }, callback)
|
|
52
52
|
.on("error", eventEmitter.emit.bind(eventEmitter, "error"));
|
|
@@ -68,7 +68,7 @@ const proxyFetch = (request, proxy) => (url, options, callback) => {
|
|
|
68
68
|
doRequest(socket);
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
.on("error", err => {
|
|
71
|
+
.on("error", (err) => {
|
|
72
72
|
eventEmitter.emit(
|
|
73
73
|
"error",
|
|
74
74
|
new Error(
|
|
@@ -101,7 +101,7 @@ const validate = createSchemaValidation(
|
|
|
101
101
|
* @param {string} str path
|
|
102
102
|
* @returns {string} safe path
|
|
103
103
|
*/
|
|
104
|
-
const toSafePath = str =>
|
|
104
|
+
const toSafePath = (str) =>
|
|
105
105
|
str
|
|
106
106
|
.replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "")
|
|
107
107
|
.replace(/[^a-zA-Z0-9._-]+/g, "_");
|
|
@@ -110,7 +110,7 @@ const toSafePath = str =>
|
|
|
110
110
|
* @param {Buffer} content content
|
|
111
111
|
* @returns {string} integrity
|
|
112
112
|
*/
|
|
113
|
-
const computeIntegrity = content => {
|
|
113
|
+
const computeIntegrity = (content) => {
|
|
114
114
|
const hash = createHash("sha512");
|
|
115
115
|
hash.update(content);
|
|
116
116
|
const integrity = `sha512-${hash.digest("base64")}`;
|
|
@@ -131,7 +131,7 @@ const verifyIntegrity = (content, integrity) => {
|
|
|
131
131
|
* @param {string} str input
|
|
132
132
|
* @returns {Record<string, string>} parsed
|
|
133
133
|
*/
|
|
134
|
-
const parseKeyValuePairs = str => {
|
|
134
|
+
const parseKeyValuePairs = (str) => {
|
|
135
135
|
/** @type {Record<string, string>} */
|
|
136
136
|
const result = {};
|
|
137
137
|
for (const item of str.split(",")) {
|
|
@@ -197,7 +197,7 @@ const areLockfileEntriesEqual = (a, b) =>
|
|
|
197
197
|
* @param {LockfileEntry} entry lockfile entry
|
|
198
198
|
* @returns {`resolved: ${string}, integrity: ${string}, contentType: ${string}`} stringified entry
|
|
199
199
|
*/
|
|
200
|
-
const entryToString = entry =>
|
|
200
|
+
const entryToString = (entry) =>
|
|
201
201
|
`resolved: ${entry.resolved}, integrity: ${entry.integrity}, contentType: ${entry.contentType}`;
|
|
202
202
|
|
|
203
203
|
class Lockfile {
|
|
@@ -273,7 +273,7 @@ class Lockfile {
|
|
|
273
273
|
* @param {FnWithoutKey<R>} fn function
|
|
274
274
|
* @returns {FnWithoutKey<R>} cached function
|
|
275
275
|
*/
|
|
276
|
-
const cachedWithoutKey = fn => {
|
|
276
|
+
const cachedWithoutKey = (fn) => {
|
|
277
277
|
let inFlight = false;
|
|
278
278
|
/** @type {Error | undefined} */
|
|
279
279
|
let cachedError;
|
|
@@ -281,7 +281,7 @@ const cachedWithoutKey = fn => {
|
|
|
281
281
|
let cachedResult;
|
|
282
282
|
/** @type {FnWithoutKeyCallback<R>[] | undefined} */
|
|
283
283
|
let cachedCallbacks;
|
|
284
|
-
return callback => {
|
|
284
|
+
return (callback) => {
|
|
285
285
|
if (inFlight) {
|
|
286
286
|
if (cachedResult !== undefined) return callback(null, cachedResult);
|
|
287
287
|
if (cachedError !== undefined) return callback(cachedError);
|
|
@@ -487,7 +487,7 @@ class HttpUriPlugin {
|
|
|
487
487
|
* @param {string} url the url
|
|
488
488
|
* @returns {string} the key
|
|
489
489
|
*/
|
|
490
|
-
const getCacheKey = url => {
|
|
490
|
+
const getCacheKey = (url) => {
|
|
491
491
|
const cachedResult = cacheKeyCache.get(url);
|
|
492
492
|
if (cachedResult !== undefined) return cachedResult;
|
|
493
493
|
const result = _getCacheKey(url);
|
|
@@ -499,7 +499,7 @@ class HttpUriPlugin {
|
|
|
499
499
|
* @param {string} url the url
|
|
500
500
|
* @returns {string} the key
|
|
501
501
|
*/
|
|
502
|
-
const _getCacheKey = url => {
|
|
502
|
+
const _getCacheKey = (url) => {
|
|
503
503
|
const parsedUrl = new URL(url);
|
|
504
504
|
const folder = toSafePath(parsedUrl.origin);
|
|
505
505
|
const name = toSafePath(parsedUrl.pathname);
|
|
@@ -520,7 +520,7 @@ class HttpUriPlugin {
|
|
|
520
520
|
* @param {(err: Error | null, lockfile?: Lockfile) => void} callback callback
|
|
521
521
|
* @returns {void}
|
|
522
522
|
*/
|
|
523
|
-
callback => {
|
|
523
|
+
(callback) => {
|
|
524
524
|
const readLockfile = () => {
|
|
525
525
|
intermediateFs.readFile(lockfileLocation, (err, buffer) => {
|
|
526
526
|
if (err && err.code !== "ENOENT") {
|
|
@@ -622,9 +622,9 @@ class HttpUriPlugin {
|
|
|
622
622
|
}
|
|
623
623
|
const key = getCacheKey(result.entry.resolved);
|
|
624
624
|
const filePath = join(intermediateFs, cacheLocation, key);
|
|
625
|
-
mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => {
|
|
625
|
+
mkdirp(intermediateFs, dirname(intermediateFs, filePath), (err) => {
|
|
626
626
|
if (err) return callback(err);
|
|
627
|
-
intermediateFs.writeFile(filePath, result.content, err => {
|
|
627
|
+
intermediateFs.writeFile(filePath, result.content, (err) => {
|
|
628
628
|
if (err) return callback(err);
|
|
629
629
|
callback(null, result);
|
|
630
630
|
});
|
|
@@ -706,7 +706,7 @@ class HttpUriPlugin {
|
|
|
706
706
|
headers["if-none-match"] = cachedResult.etag;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
fetch(new URL(url), { headers }, res => {
|
|
709
|
+
fetch(new URL(url), { headers }, (res) => {
|
|
710
710
|
const etag = res.headers.etag;
|
|
711
711
|
const location = res.headers.location;
|
|
712
712
|
const cacheControl = res.headers["cache-control"];
|
|
@@ -718,7 +718,7 @@ class HttpUriPlugin {
|
|
|
718
718
|
* @param {Partial<Pick<FetchResultMeta, "fresh">> & (Pick<RedirectFetchResult, "location"> | Pick<ContentFetchResult, "content" | "entry">)} partialResult result
|
|
719
719
|
* @returns {void}
|
|
720
720
|
*/
|
|
721
|
-
const finishWith = partialResult => {
|
|
721
|
+
const finishWith = (partialResult) => {
|
|
722
722
|
if ("location" in partialResult) {
|
|
723
723
|
logger.debug(
|
|
724
724
|
`GET ${url} [${res.statusCode}] -> ${partialResult.location}`
|
|
@@ -751,7 +751,7 @@ class HttpUriPlugin {
|
|
|
751
751
|
...result,
|
|
752
752
|
fresh: false
|
|
753
753
|
},
|
|
754
|
-
err => {
|
|
754
|
+
(err) => {
|
|
755
755
|
if (err) {
|
|
756
756
|
logger.warn(
|
|
757
757
|
`${url} can't be stored in cache: ${err.message}`
|
|
@@ -820,7 +820,7 @@ class HttpUriPlugin {
|
|
|
820
820
|
stream = stream.pipe(createInflate());
|
|
821
821
|
}
|
|
822
822
|
|
|
823
|
-
stream.on("data", chunk => {
|
|
823
|
+
stream.on("data", (chunk) => {
|
|
824
824
|
bufferArr.push(chunk);
|
|
825
825
|
});
|
|
826
826
|
|
|
@@ -851,7 +851,7 @@ class HttpUriPlugin {
|
|
|
851
851
|
content
|
|
852
852
|
});
|
|
853
853
|
});
|
|
854
|
-
}).on("error", err => {
|
|
854
|
+
}).on("error", (err) => {
|
|
855
855
|
logger.log(`GET ${url} (error)`);
|
|
856
856
|
err.message += `\nwhile fetching ${url}`;
|
|
857
857
|
callback(err);
|
|
@@ -881,7 +881,7 @@ class HttpUriPlugin {
|
|
|
881
881
|
* @param {string} uri uri
|
|
882
882
|
* @returns {boolean} true when allowed, otherwise false
|
|
883
883
|
*/
|
|
884
|
-
const isAllowed = uri => {
|
|
884
|
+
const isAllowed = (uri) => {
|
|
885
885
|
for (const allowed of allowedUris) {
|
|
886
886
|
if (typeof allowed === "string") {
|
|
887
887
|
if (uri.startsWith(allowed)) return true;
|
|
@@ -908,7 +908,7 @@ class HttpUriPlugin {
|
|
|
908
908
|
return callback(
|
|
909
909
|
new Error(
|
|
910
910
|
`${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris
|
|
911
|
-
.map(uri => ` - ${uri}`)
|
|
911
|
+
.map((uri) => ` - ${uri}`)
|
|
912
912
|
.join("\n")}`
|
|
913
913
|
)
|
|
914
914
|
);
|
|
@@ -972,7 +972,7 @@ Remove this line from the lockfile to force upgrading.`
|
|
|
972
972
|
/**
|
|
973
973
|
* @param {Buffer=} lockedContent locked content
|
|
974
974
|
*/
|
|
975
|
-
const doFetch = lockedContent => {
|
|
975
|
+
const doFetch = (lockedContent) => {
|
|
976
976
|
resolveContent(url, entry.integrity, (err, _result) => {
|
|
977
977
|
if (err) {
|
|
978
978
|
if (lockedContent) {
|
|
@@ -1053,7 +1053,7 @@ Remove this line from the lockfile to force upgrading.`
|
|
|
1053
1053
|
* @param {Buffer | undefined} _result result
|
|
1054
1054
|
* @returns {void}
|
|
1055
1055
|
*/
|
|
1056
|
-
const continueWithCachedContent = _result => {
|
|
1056
|
+
const continueWithCachedContent = (_result) => {
|
|
1057
1057
|
if (!upgrade) {
|
|
1058
1058
|
// When not in upgrade mode, we accept the result from the lockfile cache
|
|
1059
1059
|
return callback(null, { entry, content });
|
|
@@ -1101,7 +1101,7 @@ This will avoid that the end of line sequence is changed by git on Windows.`;
|
|
|
1101
1101
|
filePath,
|
|
1102
1102
|
/** @type {Buffer} */
|
|
1103
1103
|
(contentWithChangedEol),
|
|
1104
|
-
err => {
|
|
1104
|
+
(err) => {
|
|
1105
1105
|
if (err) return callback(err);
|
|
1106
1106
|
continueWithCachedContent(
|
|
1107
1107
|
/** @type {Buffer} */
|
|
@@ -1260,15 +1260,10 @@ Run build with un-frozen lockfile to automatically fix lockfile.`
|
|
|
1260
1260
|
)) {
|
|
1261
1261
|
lockfile.entries.set(key, value);
|
|
1262
1262
|
}
|
|
1263
|
-
intermediateFs.writeFile(
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
/** @type {NonNullable<IntermediateFileSystem["unlink"]>} */
|
|
1268
|
-
(intermediateFs.unlink)(tempFile, () => callback(err))
|
|
1269
|
-
);
|
|
1270
|
-
}
|
|
1271
|
-
intermediateFs.rename(tempFile, lockfileLocation, err => {
|
|
1263
|
+
intermediateFs.writeFile(
|
|
1264
|
+
tempFile,
|
|
1265
|
+
lockfile.toString(),
|
|
1266
|
+
(err) => {
|
|
1272
1267
|
if (err) {
|
|
1273
1268
|
writeDone();
|
|
1274
1269
|
return (
|
|
@@ -1276,10 +1271,19 @@ Run build with un-frozen lockfile to automatically fix lockfile.`
|
|
|
1276
1271
|
(intermediateFs.unlink)(tempFile, () => callback(err))
|
|
1277
1272
|
);
|
|
1278
1273
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1274
|
+
intermediateFs.rename(tempFile, lockfileLocation, (err) => {
|
|
1275
|
+
if (err) {
|
|
1276
|
+
writeDone();
|
|
1277
|
+
return (
|
|
1278
|
+
/** @type {NonNullable<IntermediateFileSystem["unlink"]>} */
|
|
1279
|
+
(intermediateFs.unlink)(tempFile, () => callback(err))
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
writeDone();
|
|
1283
|
+
callback();
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1283
1287
|
});
|
|
1284
1288
|
};
|
|
1285
1289
|
if (inProgressWrite) {
|
|
@@ -124,7 +124,7 @@ class VirtualUrlPlugin {
|
|
|
124
124
|
(compilation, { normalModuleFactory }) => {
|
|
125
125
|
normalModuleFactory.hooks.resolveForScheme
|
|
126
126
|
.for(scheme)
|
|
127
|
-
.tap(PLUGIN_NAME, resourceData => {
|
|
127
|
+
.tap(PLUGIN_NAME, (resourceData) => {
|
|
128
128
|
const virtualConfig = this.findVirtualModuleConfigById(
|
|
129
129
|
resourceData.resource
|
|
130
130
|
);
|
|
@@ -117,7 +117,7 @@ const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION");
|
|
|
117
117
|
* @param {number} n number
|
|
118
118
|
* @returns {0 | 1 | 2} type of number for serialization
|
|
119
119
|
*/
|
|
120
|
-
const identifyNumber = n => {
|
|
120
|
+
const identifyNumber = (n) => {
|
|
121
121
|
if (n === (n | 0)) {
|
|
122
122
|
if (n <= 127 && n >= -128) return 0;
|
|
123
123
|
if (n <= 2147483647 && n >= -2147483648) return 1;
|
|
@@ -129,7 +129,7 @@ const identifyNumber = n => {
|
|
|
129
129
|
* @param {bigint} n bigint
|
|
130
130
|
* @returns {0 | 1 | 2} type of bigint for serialization
|
|
131
131
|
*/
|
|
132
|
-
const identifyBigInt = n => {
|
|
132
|
+
const identifyBigInt = (n) => {
|
|
133
133
|
if (n <= BigInt(127) && n >= BigInt(-128)) return 0;
|
|
134
134
|
if (n <= BigInt(2147483647) && n >= BigInt(-2147483648)) return 1;
|
|
135
135
|
return 2;
|
|
@@ -164,7 +164,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
164
164
|
* @returns {LazyFunction<SerializedType, DeserializedType>} new lazy
|
|
165
165
|
*/
|
|
166
166
|
_serializeLazy(fn, context) {
|
|
167
|
-
return SerializerMiddleware.serializeLazy(fn, data =>
|
|
167
|
+
return SerializerMiddleware.serializeLazy(fn, (data) =>
|
|
168
168
|
this._serialize(data, context)
|
|
169
169
|
);
|
|
170
170
|
}
|
|
@@ -198,7 +198,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
198
198
|
/**
|
|
199
199
|
* @param {number} bytesNeeded bytes needed
|
|
200
200
|
*/
|
|
201
|
-
const allocate = bytesNeeded => {
|
|
201
|
+
const allocate = (bytesNeeded) => {
|
|
202
202
|
if (currentBuffer !== null) {
|
|
203
203
|
if (currentBuffer.length - currentPosition >= bytesNeeded) return;
|
|
204
204
|
flush();
|
|
@@ -248,14 +248,14 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
248
248
|
/**
|
|
249
249
|
* @param {number} byte byte
|
|
250
250
|
*/
|
|
251
|
-
const writeU8 = byte => {
|
|
251
|
+
const writeU8 = (byte) => {
|
|
252
252
|
/** @type {Buffer} */
|
|
253
253
|
(currentBuffer).writeUInt8(byte, currentPosition++);
|
|
254
254
|
};
|
|
255
255
|
/**
|
|
256
256
|
* @param {number} ui32 ui32
|
|
257
257
|
*/
|
|
258
|
-
const writeU32 = ui32 => {
|
|
258
|
+
const writeU32 = (ui32) => {
|
|
259
259
|
/** @type {Buffer} */
|
|
260
260
|
(currentBuffer).writeUInt32LE(ui32, currentPosition);
|
|
261
261
|
currentPosition += 4;
|
|
@@ -679,7 +679,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
679
679
|
* @returns {LazyFunction<DeserializedType, SerializedType>} new lazy
|
|
680
680
|
*/
|
|
681
681
|
_deserializeLazy(fn, context) {
|
|
682
|
-
return SerializerMiddleware.deserializeLazy(fn, data =>
|
|
682
|
+
return SerializerMiddleware.deserializeLazy(fn, (data) =>
|
|
683
683
|
this._deserialize(data, context)
|
|
684
684
|
);
|
|
685
685
|
}
|
|
@@ -696,7 +696,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
696
696
|
let currentIsBuffer = Buffer.isBuffer(currentBuffer);
|
|
697
697
|
let currentPosition = 0;
|
|
698
698
|
|
|
699
|
-
const retainedBuffer = context.retainedBuffer || (x => x);
|
|
699
|
+
const retainedBuffer = context.retainedBuffer || ((x) => x);
|
|
700
700
|
|
|
701
701
|
const checkOverflow = () => {
|
|
702
702
|
if (currentPosition >= /** @type {Buffer} */ (currentBuffer).length) {
|
|
@@ -711,7 +711,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
711
711
|
* @param {number} n n
|
|
712
712
|
* @returns {boolean} true when in current buffer, otherwise false
|
|
713
713
|
*/
|
|
714
|
-
const isInCurrentBuffer = n =>
|
|
714
|
+
const isInCurrentBuffer = (n) =>
|
|
715
715
|
currentIsBuffer &&
|
|
716
716
|
n + currentPosition <= /** @type {Buffer} */ (currentBuffer).length;
|
|
717
717
|
const ensureBuffer = () => {
|
|
@@ -728,7 +728,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
728
728
|
* @param {number} n amount of bytes to read
|
|
729
729
|
* @returns {Buffer} buffer with bytes
|
|
730
730
|
*/
|
|
731
|
-
const read = n => {
|
|
731
|
+
const read = (n) => {
|
|
732
732
|
ensureBuffer();
|
|
733
733
|
const rem =
|
|
734
734
|
/** @type {Buffer} */ (currentBuffer).length - currentPosition;
|
|
@@ -760,7 +760,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
|
760
760
|
* @param {number} n amount of bytes to read
|
|
761
761
|
* @returns {Buffer} buffer with bytes
|
|
762
762
|
*/
|
|
763
|
-
const readUpTo = n => {
|
|
763
|
+
const readUpTo = (n) => {
|
|
764
764
|
ensureBuffer();
|
|
765
765
|
const rem =
|
|
766
766
|
/** @type {Buffer} */
|
|
@@ -149,7 +149,7 @@ const serialize = async (
|
|
|
149
149
|
(options && options.name) || true,
|
|
150
150
|
writeFile,
|
|
151
151
|
hashFunction
|
|
152
|
-
).then(result => {
|
|
152
|
+
).then((result) => {
|
|
153
153
|
/** @type {LazyOptions} */
|
|
154
154
|
(item.options).size = result.size;
|
|
155
155
|
resultToLazy.set(result, item);
|
|
@@ -175,7 +175,7 @@ const serialize = async (
|
|
|
175
175
|
}
|
|
176
176
|
/** @type {BackgroundJob[]} */
|
|
177
177
|
const backgroundJobs = [];
|
|
178
|
-
const resolvedData = (await Promise.all(processedData)).map(item => {
|
|
178
|
+
const resolvedData = (await Promise.all(processedData)).map((item) => {
|
|
179
179
|
if (Array.isArray(item) || Buffer.isBuffer(item)) return item;
|
|
180
180
|
|
|
181
181
|
backgroundJobs.push(
|
|
@@ -265,7 +265,7 @@ const deserialize = async (middleware, name, readFile) => {
|
|
|
265
265
|
/**
|
|
266
266
|
* @param {number} n number of bytes to ensure
|
|
267
267
|
*/
|
|
268
|
-
const ensureData = n => {
|
|
268
|
+
const ensureData = (n) => {
|
|
269
269
|
if (contentPosition === contentItemLength) {
|
|
270
270
|
nextContent();
|
|
271
271
|
}
|
|
@@ -314,7 +314,7 @@ const deserialize = async (middleware, name, readFile) => {
|
|
|
314
314
|
* @param {number} l length
|
|
315
315
|
* @returns {Buffer} buffer
|
|
316
316
|
*/
|
|
317
|
-
const readSlice = l => {
|
|
317
|
+
const readSlice = (l) => {
|
|
318
318
|
ensureData(l);
|
|
319
319
|
if (contentPosition === 0 && contentItemLength === l) {
|
|
320
320
|
const result = contentItem;
|
|
@@ -448,7 +448,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
448
448
|
serialize(data, context) {
|
|
449
449
|
const { filename, extension = "" } = context;
|
|
450
450
|
return new Promise((resolve, reject) => {
|
|
451
|
-
mkdirp(this.fs, dirname(this.fs, filename), err => {
|
|
451
|
+
mkdirp(this.fs, dirname(this.fs, filename), (err) => {
|
|
452
452
|
if (err) return reject(err);
|
|
453
453
|
|
|
454
454
|
// It's important that we don't touch existing files during serialization
|
|
@@ -493,7 +493,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
493
493
|
stream = compression;
|
|
494
494
|
stream.on("finish", () => resolve());
|
|
495
495
|
} else {
|
|
496
|
-
stream.on("error", err => reject(err));
|
|
496
|
+
stream.on("error", (err) => reject(err));
|
|
497
497
|
stream.on("finish", () => resolve());
|
|
498
498
|
}
|
|
499
499
|
// split into chunks for WRITE_LIMIT_CHUNK size
|
|
@@ -514,7 +514,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
514
514
|
/**
|
|
515
515
|
* @param {(Error | null)=} err err
|
|
516
516
|
*/
|
|
517
|
-
const batchWrite = err => {
|
|
517
|
+
const batchWrite = (err) => {
|
|
518
518
|
// will be handled in "on" error handler
|
|
519
519
|
if (err) return;
|
|
520
520
|
|
|
@@ -553,8 +553,8 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
553
553
|
/**
|
|
554
554
|
* @param {(value?: undefined) => void} resolve resolve
|
|
555
555
|
*/
|
|
556
|
-
resolve => {
|
|
557
|
-
this.fs.rename(filename, `${filename}.old`, _err => {
|
|
556
|
+
(resolve) => {
|
|
557
|
+
this.fs.rename(filename, `${filename}.old`, (_err) => {
|
|
558
558
|
resolve();
|
|
559
559
|
});
|
|
560
560
|
}
|
|
@@ -564,7 +564,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
564
564
|
await Promise.all(
|
|
565
565
|
Array.from(
|
|
566
566
|
allWrittenFiles,
|
|
567
|
-
file =>
|
|
567
|
+
(file) =>
|
|
568
568
|
new Promise(
|
|
569
569
|
/**
|
|
570
570
|
* @param {(value?: undefined) => void} resolve resolve
|
|
@@ -572,7 +572,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
572
572
|
* @returns {void}
|
|
573
573
|
*/
|
|
574
574
|
(resolve, reject) => {
|
|
575
|
-
this.fs.rename(`${file}_`, file, err => {
|
|
575
|
+
this.fs.rename(`${file}_`, file, (err) => {
|
|
576
576
|
if (err) return reject(err);
|
|
577
577
|
resolve();
|
|
578
578
|
});
|
|
@@ -587,8 +587,8 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
587
587
|
* @param {(value?: undefined) => void} resolve resolve
|
|
588
588
|
* @returns {void}
|
|
589
589
|
*/
|
|
590
|
-
resolve => {
|
|
591
|
-
this.fs.rename(`${filename}_`, filename, err => {
|
|
590
|
+
(resolve) => {
|
|
591
|
+
this.fs.rename(`${filename}_`, filename, (err) => {
|
|
592
592
|
if (err) return reject(err);
|
|
593
593
|
resolve();
|
|
594
594
|
});
|
|
@@ -613,7 +613,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
613
613
|
* @param {string | boolean} name name
|
|
614
614
|
* @returns {Promise<Buffer[]>} result
|
|
615
615
|
*/
|
|
616
|
-
const readFile = name =>
|
|
616
|
+
const readFile = (name) =>
|
|
617
617
|
new Promise((resolve, reject) => {
|
|
618
618
|
const file = name
|
|
619
619
|
? join(this.fs, filename, `../${name}${extension}`)
|
|
@@ -661,9 +661,9 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
661
661
|
* @param {(reason?: Error) => void} reject reject
|
|
662
662
|
*/
|
|
663
663
|
(resolve, reject) => {
|
|
664
|
-
decompression.on("data", chunk => buf.push(chunk));
|
|
664
|
+
decompression.on("data", (chunk) => buf.push(chunk));
|
|
665
665
|
decompression.on("end", () => resolve());
|
|
666
|
-
decompression.on("error", err => reject(err));
|
|
666
|
+
decompression.on("error", (err) => reject(err));
|
|
667
667
|
}
|
|
668
668
|
)
|
|
669
669
|
]).then(() => buf)
|
|
@@ -735,7 +735,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
|
735
735
|
if (decompression) {
|
|
736
736
|
decompression.end();
|
|
737
737
|
}
|
|
738
|
-
this.fs.close(fd, err => {
|
|
738
|
+
this.fs.close(fd, (err) => {
|
|
739
739
|
if (err) {
|
|
740
740
|
reject(err);
|
|
741
741
|
return;
|
|
@@ -343,7 +343,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
343
343
|
/**
|
|
344
344
|
* @param {ReferenceableItem} item referenceable item
|
|
345
345
|
*/
|
|
346
|
-
const addReferenceable = item => {
|
|
346
|
+
const addReferenceable = (item) => {
|
|
347
347
|
referenceable.set(item, currentPos++);
|
|
348
348
|
};
|
|
349
349
|
let bufferDedupeMap = new Map();
|
|
@@ -351,7 +351,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
351
351
|
* @param {Buffer} buf buffer
|
|
352
352
|
* @returns {Buffer} deduped buffer
|
|
353
353
|
*/
|
|
354
|
-
const dedupeBuffer = buf => {
|
|
354
|
+
const dedupeBuffer = (buf) => {
|
|
355
355
|
const len = buf.length;
|
|
356
356
|
const entry = bufferDedupeMap.get(len);
|
|
357
357
|
if (entry === undefined) {
|
|
@@ -415,11 +415,11 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
415
415
|
* @param {Value} item item to stack
|
|
416
416
|
* @returns {string} stack
|
|
417
417
|
*/
|
|
418
|
-
const stackToString = item => {
|
|
418
|
+
const stackToString = (item) => {
|
|
419
419
|
const arr = [...cycleStack];
|
|
420
420
|
arr.push(item);
|
|
421
421
|
return arr
|
|
422
|
-
.map(item => {
|
|
422
|
+
.map((item) => {
|
|
423
423
|
if (typeof item === "string") {
|
|
424
424
|
if (item.length > 100) {
|
|
425
425
|
return `String ${JSON.stringify(item.slice(0, 100)).slice(
|
|
@@ -513,7 +513,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
513
513
|
/**
|
|
514
514
|
* @param {Value} item item to serialize
|
|
515
515
|
*/
|
|
516
|
-
const process = item => {
|
|
516
|
+
const process = (item) => {
|
|
517
517
|
if (Buffer.isBuffer(item)) {
|
|
518
518
|
// check if we can emit a reference
|
|
519
519
|
const ref = referenceable.get(item);
|
|
@@ -616,7 +616,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
616
616
|
} else if (SerializerMiddleware.isLazy(item, this)) {
|
|
617
617
|
throw new Error("Not implemented");
|
|
618
618
|
} else {
|
|
619
|
-
const data = SerializerMiddleware.serializeLazy(item, data =>
|
|
619
|
+
const data = SerializerMiddleware.serializeLazy(item, (data) =>
|
|
620
620
|
this.serialize([data], context)
|
|
621
621
|
);
|
|
622
622
|
SerializerMiddleware.setLazySerializedValue(item, data);
|
|
@@ -679,7 +679,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
679
679
|
/**
|
|
680
680
|
* @param {Value} item referenceable item
|
|
681
681
|
*/
|
|
682
|
-
const addReferenceable = item => {
|
|
682
|
+
const addReferenceable = (item) => {
|
|
683
683
|
referenceable.push(item);
|
|
684
684
|
currentPos++;
|
|
685
685
|
};
|
|
@@ -811,7 +811,7 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
|
811
811
|
} else if (typeof item === "function") {
|
|
812
812
|
return SerializerMiddleware.deserializeLazy(
|
|
813
813
|
item,
|
|
814
|
-
data =>
|
|
814
|
+
(data) =>
|
|
815
815
|
/** @type {[DeserializedType]} */
|
|
816
816
|
(this.deserialize(data, context))[0]
|
|
817
817
|
);
|
|
@@ -42,7 +42,7 @@ class Serializer {
|
|
|
42
42
|
) {
|
|
43
43
|
current =
|
|
44
44
|
/** @type {Promise<DeserializedValue>} */
|
|
45
|
-
(current).then(data => data && middleware.serialize(data, ctx));
|
|
45
|
+
(current).then((data) => data && middleware.serialize(data, ctx));
|
|
46
46
|
} else if (current) {
|
|
47
47
|
try {
|
|
48
48
|
current = middleware.serialize(current, ctx);
|
|
@@ -70,7 +70,7 @@ class Serializer {
|
|
|
70
70
|
current &&
|
|
71
71
|
typeof (/** @type {Promise<SerializedValue>} */ (current).then) ===
|
|
72
72
|
"function"
|
|
73
|
-
? /** @type {Promise<SerializedValue>} */ (current).then(data =>
|
|
73
|
+
? /** @type {Promise<SerializedValue>} */ (current).then((data) =>
|
|
74
74
|
middleware.deserialize(data, ctx)
|
|
75
75
|
)
|
|
76
76
|
: middleware.deserialize(current, ctx);
|
|
@@ -153,7 +153,7 @@ class SerializerMiddleware {
|
|
|
153
153
|
) {
|
|
154
154
|
return (
|
|
155
155
|
/** @type {Promise<TLazyInputValue>} */
|
|
156
|
-
(r).then(data => data && serialize(data))
|
|
156
|
+
(r).then((data) => data && serialize(data))
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
return serialize(/** @type {TLazyInputValue} */ (r));
|
|
@@ -187,7 +187,7 @@ class SerializerMiddleware {
|
|
|
187
187
|
) {
|
|
188
188
|
return (
|
|
189
189
|
/** @type {Promise<TLazyInputValue>} */
|
|
190
|
-
(r).then(data => deserialize(data))
|
|
190
|
+
(r).then((data) => deserialize(data))
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
return deserialize(/** @type {TLazyInputValue} */ (r));
|
|
@@ -148,7 +148,7 @@ class ConsumeSharedPlugin {
|
|
|
148
148
|
/**
|
|
149
149
|
* @param {string} details details
|
|
150
150
|
*/
|
|
151
|
-
const requiredVersionWarning = details => {
|
|
151
|
+
const requiredVersionWarning = (details) => {
|
|
152
152
|
const error = new WebpackError(
|
|
153
153
|
`No required version specified and unable to automatically determine one. ${details}`
|
|
154
154
|
);
|
|
@@ -163,7 +163,7 @@ class ConsumeSharedPlugin {
|
|
|
163
163
|
/**
|
|
164
164
|
* @param {(value?: string) => void} resolve resolve
|
|
165
165
|
*/
|
|
166
|
-
resolve => {
|
|
166
|
+
(resolve) => {
|
|
167
167
|
if (!config.import) {
|
|
168
168
|
resolve();
|
|
169
169
|
return;
|
|
@@ -208,7 +208,7 @@ class ConsumeSharedPlugin {
|
|
|
208
208
|
/**
|
|
209
209
|
* @param {(value?: SemVerRange) => void} resolve resolve
|
|
210
210
|
*/
|
|
211
|
-
resolve => {
|
|
211
|
+
(resolve) => {
|
|
212
212
|
if (config.requiredVersion !== undefined) {
|
|
213
213
|
resolve(/** @type {SemVerRange} */ (config.requiredVersion));
|
|
214
214
|
return;
|
|
@@ -276,7 +276,7 @@ class ConsumeSharedPlugin {
|
|
|
276
276
|
|
|
277
277
|
resolve();
|
|
278
278
|
},
|
|
279
|
-
result => {
|
|
279
|
+
(result) => {
|
|
280
280
|
if (!result) return false;
|
|
281
281
|
const maybeRequiredVersion =
|
|
282
282
|
getRequiredVersionFromDescriptionFile(
|
|
@@ -48,7 +48,7 @@ class ProvideSharedPlugin {
|
|
|
48
48
|
this._provides = /** @type {[string, ProvideOptions][]} */ (
|
|
49
49
|
parseOptions(
|
|
50
50
|
options.provides,
|
|
51
|
-
item => {
|
|
51
|
+
(item) => {
|
|
52
52
|
if (Array.isArray(item)) {
|
|
53
53
|
throw new Error("Unexpected array of provides");
|
|
54
54
|
}
|
|
@@ -61,7 +61,7 @@ class ProvideSharedPlugin {
|
|
|
61
61
|
};
|
|
62
62
|
return result;
|
|
63
63
|
},
|
|
64
|
-
item => ({
|
|
64
|
+
(item) => ({
|
|
65
65
|
shareKey: item.shareKey,
|
|
66
66
|
version: item.version,
|
|
67
67
|
shareScope: item.shareScope || options.shareScope || "default",
|
|
@@ -199,7 +199,7 @@ class ProvideSharedPlugin {
|
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
|
-
compiler.hooks.finishMake.tapPromise(PLUGIN_NAME, compilation => {
|
|
202
|
+
compiler.hooks.finishMake.tapPromise(PLUGIN_NAME, (compilation) => {
|
|
203
203
|
const resolvedProvideMap = compilationData.get(compilation);
|
|
204
204
|
if (!resolvedProvideMap) return Promise.resolve();
|
|
205
205
|
return Promise.all(
|
|
@@ -219,7 +219,7 @@ class ProvideSharedPlugin {
|
|
|
219
219
|
{
|
|
220
220
|
name: undefined
|
|
221
221
|
},
|
|
222
|
-
err => {
|
|
222
|
+
(err) => {
|
|
223
223
|
if (err) return reject(err);
|
|
224
224
|
resolve(null);
|
|
225
225
|
}
|
|
@@ -51,7 +51,7 @@ module.exports.resolveMatchedConfigs = (compilation, configs) => {
|
|
|
51
51
|
configs.map(([request, config]) => {
|
|
52
52
|
if (/^\.\.?(\/|$)/.test(request)) {
|
|
53
53
|
// relative request
|
|
54
|
-
return new Promise(resolve => {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
55
|
resolver.resolve(
|
|
56
56
|
{},
|
|
57
57
|
context,
|