webpack 5.99.9 → 5.100.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/bin/webpack.js +8 -2
- package/hot/log.js +15 -15
- package/hot/poll.js +1 -0
- package/lib/APIPlugin.js +3 -3
- package/lib/AbstractMethodError.js +1 -0
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +1 -1
- package/lib/CaseSensitiveModulesWarning.js +4 -4
- package/lib/Chunk.js +6 -6
- package/lib/ChunkGraph.js +37 -31
- package/lib/ChunkGroup.js +4 -4
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +94 -17
- package/lib/CodeGenerationResults.js +1 -1
- package/lib/CompatibilityPlugin.js +5 -2
- package/lib/Compilation.js +67 -45
- package/lib/Compiler.js +46 -16
- package/lib/ConcatenationScope.js +15 -6
- package/lib/ConstPlugin.js +5 -3
- package/lib/ContextModule.js +16 -12
- package/lib/ContextModuleFactory.js +4 -3
- package/lib/ContextReplacementPlugin.js +4 -2
- package/lib/CssModule.js +2 -2
- package/lib/DefinePlugin.js +111 -3
- package/lib/DelegatedModuleFactoryPlugin.js +18 -18
- package/lib/Dependency.js +6 -1
- package/lib/DependencyTemplate.js +1 -0
- package/lib/DllEntryPlugin.js +3 -1
- package/lib/DllPlugin.js +4 -3
- package/lib/DllReferencePlugin.js +2 -2
- package/lib/DynamicEntryPlugin.js +1 -1
- package/lib/EntryOptionPlugin.js +5 -0
- package/lib/ErrorHelpers.js +4 -4
- package/lib/EvalDevToolModulePlugin.js +3 -3
- package/lib/EvalSourceMapDevToolPlugin.js +7 -7
- package/lib/ExportsInfo.js +48 -39
- package/lib/ExternalModule.js +15 -11
- package/lib/ExternalModuleFactoryPlugin.js +5 -2
- package/lib/FileSystemInfo.js +51 -36
- package/lib/FlagDependencyExportsPlugin.js +14 -7
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +14 -1
- package/lib/HookWebpackError.js +1 -0
- package/lib/HotModuleReplacementPlugin.js +77 -50
- package/lib/IgnorePlugin.js +1 -1
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +0 -1
- package/lib/LibManifestPlugin.js +4 -2
- package/lib/LoaderOptionsPlugin.js +6 -4
- package/lib/MainTemplate.js +2 -2
- package/lib/Module.js +21 -6
- package/lib/ModuleFactory.js +1 -0
- package/lib/ModuleGraph.js +24 -2
- package/lib/ModuleGraphConnection.js +5 -5
- package/lib/ModuleInfoHeaderPlugin.js +2 -1
- package/lib/ModuleParseError.js +1 -0
- package/lib/ModuleSourceTypesConstants.js +12 -12
- package/lib/ModuleTemplate.js +1 -1
- package/lib/ModuleTypeConstants.js +21 -21
- package/lib/MultiCompiler.js +6 -6
- package/lib/NormalModule.js +31 -44
- package/lib/NormalModuleFactory.js +29 -19
- package/lib/NormalModuleReplacementPlugin.js +1 -1
- package/lib/NullFactory.js +1 -0
- package/lib/OptimizationStages.js +1 -1
- package/lib/Parser.js +1 -0
- package/lib/ProgressPlugin.js +12 -5
- package/lib/ProvidePlugin.js +5 -1
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/RuntimeGlobals.js +175 -155
- package/lib/RuntimeModule.js +1 -0
- package/lib/RuntimePlugin.js +33 -7
- package/lib/RuntimeTemplate.js +111 -11
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +15 -25
- package/lib/SourceMapDevToolPlugin.js +19 -17
- package/lib/Template.js +2 -2
- package/lib/TemplatedPathPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +7 -8
- package/lib/WatchIgnorePlugin.js +4 -3
- package/lib/WebpackIsIncludedPlugin.js +2 -1
- package/lib/WebpackOptionsApply.js +115 -27
- package/lib/asset/AssetGenerator.js +15 -11
- package/lib/asset/AssetModulesPlugin.js +19 -17
- package/lib/asset/AssetSourceGenerator.js +4 -4
- package/lib/asset/RawDataUrlModule.js +4 -2
- package/lib/async-modules/AwaitDependenciesInitFragment.js +1 -1
- package/lib/buildChunkGraph.js +6 -3
- package/lib/cache/AddBuildDependenciesPlugin.js +5 -6
- package/lib/cache/IdleFileCachePlugin.js +7 -4
- package/lib/cache/MemoryCachePlugin.js +1 -0
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +26 -20
- package/lib/cache/ResolverCachePlugin.js +16 -8
- package/lib/cli.js +15 -10
- package/lib/config/browserslistTargetHandler.js +3 -3
- package/lib/config/defaults.js +25 -17
- package/lib/config/normalization.js +2 -1
- package/lib/config/target.js +6 -5
- package/lib/container/ContainerPlugin.js +1 -1
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/container/FallbackModule.js +2 -1
- package/lib/container/HoistContainerReferencesPlugin.js +1 -1
- package/lib/container/ModuleFederationPlugin.js +2 -2
- package/lib/container/RemoteModule.js +1 -1
- package/lib/css/CssGenerator.js +9 -6
- package/lib/css/CssModulesPlugin.js +44 -31
- package/lib/css/CssParser.js +6 -4
- package/lib/css/walkCssTokens.js +33 -37
- package/lib/debug/ProfilingPlugin.js +6 -6
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -8
- package/lib/dependencies/AMDPlugin.js +12 -8
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +28 -26
- package/lib/dependencies/CachedConstDependency.js +1 -5
- package/lib/dependencies/CommonJsExportRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsExportsParserPlugin.js +22 -25
- package/lib/dependencies/CommonJsFullRequireDependency.js +1 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +100 -114
- package/lib/dependencies/CommonJsPlugin.js +15 -16
- package/lib/dependencies/ContextDependencyHelpers.js +2 -1
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/lib/dependencies/CssIcssExportDependency.js +1 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/DynamicExports.js +9 -9
- package/lib/dependencies/ExportsInfoDependency.js +1 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +122 -101
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +95 -19
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +11 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +238 -162
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +20 -9
- package/lib/dependencies/HarmonyModulesPlugin.js +23 -12
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
- package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
- package/lib/dependencies/ImportMetaPlugin.js +2 -2
- package/lib/dependencies/ImportParserPlugin.js +40 -9
- package/lib/dependencies/ImportPlugin.js +3 -1
- package/lib/dependencies/LoaderPlugin.js +1 -0
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +3 -1
- package/lib/dependencies/RequireEnsurePlugin.js +6 -6
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +33 -34
- package/lib/dependencies/RequireIncludePlugin.js +1 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/URLContextDependency.js +65 -0
- package/lib/dependencies/URLPlugin.js +17 -157
- package/lib/dependencies/WorkerPlugin.js +23 -10
- package/lib/dependencies/processExportInfo.js +2 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +269 -185
- package/lib/esm/ModuleChunkLoadingPlugin.js +39 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +70 -3
- package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +37 -0
- package/lib/hmr/LazyCompilationPlugin.js +4 -2
- package/lib/hmr/lazyCompilationBackend.js +4 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +6 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +30 -35
- package/lib/ids/DeterministicModuleIdsPlugin.js +4 -3
- package/lib/ids/HashedModuleIdsPlugin.js +5 -4
- package/lib/ids/IdHelpers.js +21 -17
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +4 -4
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +3 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +1 -1
- package/lib/index.js +13 -3
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +113 -119
- package/lib/javascript/BasicEvaluatedExpression.js +2 -1
- package/lib/javascript/ChunkHelpers.js +1 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +121 -136
- package/lib/javascript/EnableChunkLoadingPlugin.js +6 -3
- package/lib/javascript/JavascriptGenerator.js +14 -2
- package/lib/javascript/JavascriptModulesPlugin.js +68 -27
- package/lib/javascript/JavascriptParser.js +117 -76
- package/lib/javascript/JavascriptParserHelpers.js +41 -41
- package/lib/javascript/StartupHelpers.js +17 -17
- package/lib/json/JsonGenerator.js +4 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/json/JsonParser.js +1 -1
- package/lib/library/AbstractLibraryPlugin.js +6 -2
- package/lib/library/AssignLibraryPlugin.js +21 -6
- package/lib/library/EnableLibraryPlugin.js +23 -3
- package/lib/library/UmdLibraryPlugin.js +15 -6
- package/lib/logging/createConsoleLogger.js +3 -3
- package/lib/logging/runtime.js +9 -9
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/RequireChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/nodeConsole.js +4 -2
- package/lib/optimize/AggressiveMergingPlugin.js +45 -46
- package/lib/optimize/AggressiveSplittingPlugin.js +13 -12
- package/lib/optimize/ConcatenatedModule.js +227 -57
- package/lib/optimize/EnsureChunkConditionsPlugin.js +58 -58
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -1
- package/lib/optimize/InnerGraph.js +115 -112
- package/lib/optimize/InnerGraphPlugin.js +2 -2
- package/lib/optimize/LimitChunkCountPlugin.js +4 -2
- package/lib/optimize/MangleExportsPlugin.js +4 -3
- package/lib/optimize/MergeDuplicateChunksPlugin.js +80 -81
- package/lib/optimize/MinChunkSizePlugin.js +6 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +31 -22
- package/lib/optimize/RealContentHashPlugin.js +26 -20
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -2
- package/lib/optimize/SplitChunksPlugin.js +16 -13
- package/lib/rules/BasicEffectRulePlugin.js +4 -2
- package/lib/rules/BasicMatcherRulePlugin.js +3 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +3 -1
- package/lib/rules/RuleSetCompiler.js +6 -3
- package/lib/rules/UseEffectRulePlugin.js +3 -1
- package/lib/runtime/AsyncModuleRuntimeModule.js +64 -9
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +214 -0
- package/lib/runtime/RuntimeIdRuntimeModule.js +2 -1
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +8 -7
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +27 -19
- package/lib/schemes/VirtualUrlPlugin.js +222 -0
- package/lib/serialization/AggregateErrorSerializer.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +5 -4
- package/lib/serialization/FileMiddleware.js +7 -4
- package/lib/serialization/ObjectMiddleware.js +14 -8
- package/lib/serialization/Serializer.js +5 -3
- package/lib/serialization/SerializerMiddleware.js +2 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +3 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +2 -2
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +3 -2
- package/lib/sharing/SharePlugin.js +2 -1
- package/lib/sharing/ShareRuntimeModule.js +3 -5
- package/lib/sharing/utils.js +34 -34
- package/lib/stats/DefaultStatsFactoryPlugin.js +49 -46
- package/lib/stats/DefaultStatsPresetPlugin.js +4 -2
- package/lib/stats/DefaultStatsPrinterPlugin.js +15 -9
- package/lib/stats/StatsFactory.js +4 -2
- package/lib/stats/StatsPrinter.js +3 -2
- package/lib/url/URLParserPlugin.js +266 -0
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Hash.js +2 -0
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazyBucketSortedSet.js +2 -1
- package/lib/util/LazySet.js +11 -6
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/SetHelpers.js +3 -3
- package/lib/util/SortableSet.js +2 -2
- package/lib/util/StackedCacheMap.js +3 -1
- package/lib/util/StackedMap.js +2 -2
- package/lib/util/StringXor.js +1 -0
- package/lib/util/TupleSet.js +1 -0
- package/lib/util/URLAbsoluteSpecifier.js +1 -1
- package/lib/util/cleverMerge.js +12 -8
- package/lib/util/comparators.js +154 -127
- package/lib/util/compileBooleanMatcher.js +8 -3
- package/lib/util/concatenate.js +8 -7
- package/lib/util/conventions.js +72 -73
- package/lib/util/create-schema-validation.js +2 -1
- package/lib/util/createHash.js +10 -4
- package/lib/util/deprecation.js +69 -66
- package/lib/util/deterministicGrouping.js +4 -2
- package/lib/util/extractUrlAndGlobal.js +1 -1
- package/lib/util/findGraphRoots.js +2 -2
- package/lib/util/fs.js +30 -23
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/wasm-hash.js +4 -2
- package/lib/util/identifier.js +13 -12
- package/lib/util/internalSerializables.js +2 -0
- package/lib/util/magicComment.js +5 -5
- package/lib/util/processAsyncTree.js +1 -1
- package/lib/util/propertyAccess.js +1 -1
- package/lib/util/propertyName.js +1 -1
- package/lib/util/registerExternalSerializer.js +1 -2
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +29 -21
- package/lib/util/semver.js +1 -1
- package/lib/util/serialization.js +3 -0
- package/lib/util/source.js +3 -2
- package/lib/validateSchema.js +1 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +6 -3
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -1
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +46 -49
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +2 -3
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +3 -2
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +3 -0
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -22
- package/lib/webpack.js +4 -5
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -24
- package/lib/webworker/WebWorkerTemplatePlugin.js +1 -0
- package/package.json +119 -113
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +17 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts +7 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +6 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +77 -0
- package/types.d.ts +1230 -360
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const memoize = require("./memoize");
|
|
9
9
|
|
|
10
|
+
/** @typedef {import("schema-utils").Schema} Schema */
|
|
10
11
|
/** @typedef {import("schema-utils/declarations/validate").ValidationErrorConfiguration} ValidationErrorConfiguration */
|
|
11
12
|
/** @typedef {import("./fs").JsonObject} JsonObject */
|
|
12
13
|
|
|
@@ -15,7 +16,7 @@ const getValidate = memoize(() => require("schema-utils").validate);
|
|
|
15
16
|
/**
|
|
16
17
|
* @template {object | object[]} T
|
|
17
18
|
* @param {((value: T) => boolean) | undefined} check check
|
|
18
|
-
* @param {() =>
|
|
19
|
+
* @param {() => Schema} getSchema get schema fn
|
|
19
20
|
* @param {ValidationErrorConfiguration} options options
|
|
20
21
|
* @returns {(value?: T) => void} validate
|
|
21
22
|
*/
|
package/lib/util/createHash.js
CHANGED
|
@@ -48,8 +48,9 @@ class BulkUpdateDecorator extends Hash {
|
|
|
48
48
|
typeof data !== "string" ||
|
|
49
49
|
data.length > BULK_SIZE
|
|
50
50
|
) {
|
|
51
|
-
if (this.hash === undefined)
|
|
51
|
+
if (this.hash === undefined) {
|
|
52
52
|
this.hash = /** @type {HashFactory} */ (this.hashFactory)();
|
|
53
|
+
}
|
|
53
54
|
if (this.buffer.length > 0) {
|
|
54
55
|
this.hash.update(this.buffer);
|
|
55
56
|
this.buffer = "";
|
|
@@ -58,8 +59,9 @@ class BulkUpdateDecorator extends Hash {
|
|
|
58
59
|
} else {
|
|
59
60
|
this.buffer += data;
|
|
60
61
|
if (this.buffer.length > BULK_SIZE) {
|
|
61
|
-
if (this.hash === undefined)
|
|
62
|
+
if (this.hash === undefined) {
|
|
62
63
|
this.hash = /** @type {HashFactory} */ (this.hashFactory)();
|
|
64
|
+
}
|
|
63
65
|
this.hash.update(this.buffer);
|
|
64
66
|
this.buffer = "";
|
|
65
67
|
}
|
|
@@ -113,13 +115,17 @@ class DebugHash extends Hash {
|
|
|
113
115
|
* @returns {this} updated hash
|
|
114
116
|
*/
|
|
115
117
|
update(data, inputEncoding) {
|
|
116
|
-
if (typeof data !== "string") data = data.toString("
|
|
118
|
+
if (typeof data !== "string") data = data.toString("utf8");
|
|
117
119
|
const prefix = Buffer.from("@webpack-debug-digest@").toString("hex");
|
|
118
120
|
if (data.startsWith(prefix)) {
|
|
119
121
|
data = Buffer.from(data.slice(prefix.length), "hex").toString();
|
|
120
122
|
}
|
|
121
123
|
this.string += `[${data}](${
|
|
122
|
-
/** @type {string} */
|
|
124
|
+
/** @type {string} */
|
|
125
|
+
(
|
|
126
|
+
// eslint-disable-next-line unicorn/error-message
|
|
127
|
+
new Error().stack
|
|
128
|
+
).split("\n", 3)[2]
|
|
123
129
|
})\n`;
|
|
124
130
|
return this;
|
|
125
131
|
}
|
package/lib/util/deprecation.js
CHANGED
|
@@ -96,8 +96,10 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
|
|
96
96
|
* @this {Set<T>}
|
|
97
97
|
* @returns {number} count
|
|
98
98
|
*/
|
|
99
|
+
// eslint-disable-next-line func-names
|
|
99
100
|
set[method] = function () {
|
|
100
101
|
d();
|
|
102
|
+
// eslint-disable-next-line unicorn/prefer-spread
|
|
101
103
|
const array = Array.from(this);
|
|
102
104
|
return Array.prototype[/** @type {keyof COPY_METHODS} */ (method)].apply(
|
|
103
105
|
array,
|
|
@@ -123,9 +125,9 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
|
|
123
125
|
* @this {Set<T>}
|
|
124
126
|
* @returns {number} count
|
|
125
127
|
*/
|
|
126
|
-
set.push = function () {
|
|
128
|
+
set.push = function push() {
|
|
127
129
|
dPush();
|
|
128
|
-
// eslint-disable-next-line prefer-rest-params
|
|
130
|
+
// eslint-disable-next-line prefer-rest-params, unicorn/prefer-spread
|
|
129
131
|
for (const item of Array.from(arguments)) {
|
|
130
132
|
this.add(item);
|
|
131
133
|
}
|
|
@@ -221,6 +223,71 @@ module.exports.createArrayToSetDeprecationSet = name => {
|
|
|
221
223
|
return SetDeprecatedArray;
|
|
222
224
|
};
|
|
223
225
|
|
|
226
|
+
/**
|
|
227
|
+
* @template {object} T
|
|
228
|
+
* @param {T} fakeHook fake hook implementation
|
|
229
|
+
* @param {string=} message deprecation message (not deprecated when unset)
|
|
230
|
+
* @param {string=} code deprecation code (not deprecated when unset)
|
|
231
|
+
* @returns {FakeHook<T>} fake hook which redirects
|
|
232
|
+
*/
|
|
233
|
+
module.exports.createFakeHook = (fakeHook, message, code) => {
|
|
234
|
+
if (message && code) {
|
|
235
|
+
fakeHook = deprecateAllProperties(fakeHook, message, code);
|
|
236
|
+
}
|
|
237
|
+
return Object.freeze(
|
|
238
|
+
Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) })
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @template T
|
|
244
|
+
* @param {T} obj object
|
|
245
|
+
* @param {string} message deprecation message
|
|
246
|
+
* @param {string} code deprecation code
|
|
247
|
+
* @returns {T} object with property access deprecated
|
|
248
|
+
*/
|
|
249
|
+
const deprecateAllProperties = (obj, message, code) => {
|
|
250
|
+
const newObj = {};
|
|
251
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
252
|
+
for (const name of Object.keys(descriptors)) {
|
|
253
|
+
const descriptor = descriptors[name];
|
|
254
|
+
if (typeof descriptor.value === "function") {
|
|
255
|
+
Object.defineProperty(newObj, name, {
|
|
256
|
+
...descriptor,
|
|
257
|
+
value: util.deprecate(descriptor.value, message, code)
|
|
258
|
+
});
|
|
259
|
+
} else if (descriptor.get || descriptor.set) {
|
|
260
|
+
Object.defineProperty(newObj, name, {
|
|
261
|
+
...descriptor,
|
|
262
|
+
get: descriptor.get && util.deprecate(descriptor.get, message, code),
|
|
263
|
+
set: descriptor.set && util.deprecate(descriptor.set, message, code)
|
|
264
|
+
});
|
|
265
|
+
} else {
|
|
266
|
+
let value = descriptor.value;
|
|
267
|
+
Object.defineProperty(newObj, name, {
|
|
268
|
+
configurable: descriptor.configurable,
|
|
269
|
+
enumerable: descriptor.enumerable,
|
|
270
|
+
get: util.deprecate(() => value, message, code),
|
|
271
|
+
set: descriptor.writable
|
|
272
|
+
? util.deprecate(
|
|
273
|
+
/**
|
|
274
|
+
* @template T
|
|
275
|
+
* @param {T} v value
|
|
276
|
+
* @returns {T} result
|
|
277
|
+
*/
|
|
278
|
+
v => (value = v),
|
|
279
|
+
message,
|
|
280
|
+
code
|
|
281
|
+
)
|
|
282
|
+
: undefined
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return /** @type {T} */ (newObj);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
module.exports.deprecateAllProperties = deprecateAllProperties;
|
|
290
|
+
|
|
224
291
|
/**
|
|
225
292
|
* @template {object} T
|
|
226
293
|
* @param {T} obj object
|
|
@@ -283,67 +350,3 @@ module.exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => {
|
|
|
283
350
|
})
|
|
284
351
|
);
|
|
285
352
|
};
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @template T
|
|
289
|
-
* @param {T} obj object
|
|
290
|
-
* @param {string} message deprecation message
|
|
291
|
-
* @param {string} code deprecation code
|
|
292
|
-
* @returns {T} object with property access deprecated
|
|
293
|
-
*/
|
|
294
|
-
const deprecateAllProperties = (obj, message, code) => {
|
|
295
|
-
const newObj = {};
|
|
296
|
-
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
297
|
-
for (const name of Object.keys(descriptors)) {
|
|
298
|
-
const descriptor = descriptors[name];
|
|
299
|
-
if (typeof descriptor.value === "function") {
|
|
300
|
-
Object.defineProperty(newObj, name, {
|
|
301
|
-
...descriptor,
|
|
302
|
-
value: util.deprecate(descriptor.value, message, code)
|
|
303
|
-
});
|
|
304
|
-
} else if (descriptor.get || descriptor.set) {
|
|
305
|
-
Object.defineProperty(newObj, name, {
|
|
306
|
-
...descriptor,
|
|
307
|
-
get: descriptor.get && util.deprecate(descriptor.get, message, code),
|
|
308
|
-
set: descriptor.set && util.deprecate(descriptor.set, message, code)
|
|
309
|
-
});
|
|
310
|
-
} else {
|
|
311
|
-
let value = descriptor.value;
|
|
312
|
-
Object.defineProperty(newObj, name, {
|
|
313
|
-
configurable: descriptor.configurable,
|
|
314
|
-
enumerable: descriptor.enumerable,
|
|
315
|
-
get: util.deprecate(() => value, message, code),
|
|
316
|
-
set: descriptor.writable
|
|
317
|
-
? util.deprecate(
|
|
318
|
-
/**
|
|
319
|
-
* @template T
|
|
320
|
-
* @param {T} v value
|
|
321
|
-
* @returns {T} result
|
|
322
|
-
*/
|
|
323
|
-
v => (value = v),
|
|
324
|
-
message,
|
|
325
|
-
code
|
|
326
|
-
)
|
|
327
|
-
: undefined
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return /** @type {T} */ (newObj);
|
|
332
|
-
};
|
|
333
|
-
module.exports.deprecateAllProperties = deprecateAllProperties;
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @template {object} T
|
|
337
|
-
* @param {T} fakeHook fake hook implementation
|
|
338
|
-
* @param {string=} message deprecation message (not deprecated when unset)
|
|
339
|
-
* @param {string=} code deprecation code (not deprecated when unset)
|
|
340
|
-
* @returns {FakeHook<T>} fake hook which redirects
|
|
341
|
-
*/
|
|
342
|
-
module.exports.createFakeHook = (fakeHook, message, code) => {
|
|
343
|
-
if (message && code) {
|
|
344
|
-
fakeHook = deprecateAllProperties(fakeHook, message, code);
|
|
345
|
-
}
|
|
346
|
-
return Object.freeze(
|
|
347
|
-
Object.assign(fakeHook, { _fakeHook: /** @type {true} */ (true) })
|
|
348
|
-
);
|
|
349
|
-
};
|
|
@@ -343,13 +343,15 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
|
343
343
|
group,
|
|
344
344
|
problemTypes
|
|
345
345
|
);
|
|
346
|
-
if (minMatches !== groupMatches)
|
|
346
|
+
if (minMatches !== groupMatches) {
|
|
347
347
|
return minMatches < groupMatches ? group : min;
|
|
348
|
+
}
|
|
348
349
|
if (
|
|
349
350
|
selectiveSizeSum(min.size, problemTypes) >
|
|
350
351
|
selectiveSizeSum(group.size, problemTypes)
|
|
351
|
-
)
|
|
352
|
+
) {
|
|
352
353
|
return group;
|
|
354
|
+
}
|
|
353
355
|
return min;
|
|
354
356
|
});
|
|
355
357
|
for (const node of problemNodes) bestGroup.nodes.push(node);
|
|
@@ -14,5 +14,5 @@ module.exports = function extractUrlAndGlobal(urlAndGlobal) {
|
|
|
14
14
|
if (index <= 0 || index === urlAndGlobal.length - 1) {
|
|
15
15
|
throw new Error(`Invalid request "${urlAndGlobal}"`);
|
|
16
16
|
}
|
|
17
|
-
return [urlAndGlobal.
|
|
17
|
+
return [urlAndGlobal.slice(index + 1), urlAndGlobal.slice(0, index)];
|
|
18
18
|
};
|
|
@@ -98,7 +98,7 @@ module.exports = (items, getDependencies) => {
|
|
|
98
98
|
const stack = [
|
|
99
99
|
{
|
|
100
100
|
node: selectedNode,
|
|
101
|
-
openEdges:
|
|
101
|
+
openEdges: [...selectedNode.dependencies]
|
|
102
102
|
}
|
|
103
103
|
];
|
|
104
104
|
|
|
@@ -118,7 +118,7 @@ module.exports = (items, getDependencies) => {
|
|
|
118
118
|
// mark it as in-progress and recurse
|
|
119
119
|
stack.push({
|
|
120
120
|
node: dependency,
|
|
121
|
-
openEdges:
|
|
121
|
+
openEdges: [...dependency.dependencies]
|
|
122
122
|
});
|
|
123
123
|
dependency.marker = IN_PROGRESS_MARKER;
|
|
124
124
|
break;
|
package/lib/util/fs.js
CHANGED
|
@@ -49,16 +49,18 @@ const path = require("path");
|
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
+
* @template {string | Buffer} [T=string]
|
|
52
53
|
* @typedef {object} Dirent
|
|
53
|
-
* @property {() => boolean} isFile
|
|
54
|
-
* @property {() => boolean} isDirectory
|
|
55
|
-
* @property {() => boolean} isBlockDevice
|
|
56
|
-
* @property {() => boolean} isCharacterDevice
|
|
57
|
-
* @property {() => boolean} isSymbolicLink
|
|
58
|
-
* @property {() => boolean} isFIFO
|
|
59
|
-
* @property {() => boolean} isSocket
|
|
60
|
-
* @property {
|
|
61
|
-
* @property {string} path
|
|
54
|
+
* @property {() => boolean} isFile true when is file, otherwise false
|
|
55
|
+
* @property {() => boolean} isDirectory true when is directory, otherwise false
|
|
56
|
+
* @property {() => boolean} isBlockDevice true when is block device, otherwise false
|
|
57
|
+
* @property {() => boolean} isCharacterDevice true when is character device, otherwise false
|
|
58
|
+
* @property {() => boolean} isSymbolicLink true when is symbolic link, otherwise false
|
|
59
|
+
* @property {() => boolean} isFIFO true when is FIFO, otherwise false
|
|
60
|
+
* @property {() => boolean} isSocket true when is socket, otherwise false
|
|
61
|
+
* @property {T} name name
|
|
62
|
+
* @property {string} parentPath path
|
|
63
|
+
* @property {string=} path path
|
|
62
64
|
*/
|
|
63
65
|
|
|
64
66
|
/** @typedef {string | number | boolean | null} JsonPrimitive */
|
|
@@ -74,6 +76,7 @@ const path = require("path");
|
|
|
74
76
|
/** @typedef {(err: NodeJS.ErrnoException | null, result?: Buffer[]) => void} ReaddirBufferCallback */
|
|
75
77
|
/** @typedef {(err: NodeJS.ErrnoException | null, result?: string[] | Buffer[]) => void} ReaddirStringOrBufferCallback */
|
|
76
78
|
/** @typedef {(err: NodeJS.ErrnoException | null, result?: Dirent[]) => void} ReaddirDirentCallback */
|
|
79
|
+
/** @typedef {(err: NodeJS.ErrnoException | null, result?: Dirent<Buffer>[]) => void} ReaddirDirentBufferCallback */
|
|
77
80
|
/** @typedef {(err: NodeJS.ErrnoException | null, result?: IStats) => void} StatsCallback */
|
|
78
81
|
/** @typedef {(err: NodeJS.ErrnoException | null, result?: IBigIntStats) => void} BigIntStatsCallback */
|
|
79
82
|
/** @typedef {(err: NodeJS.ErrnoException | null, result?: IStats | IBigIntStats) => void} StatsOrBigIntStatsCallback */
|
|
@@ -187,20 +190,22 @@ const path = require("path");
|
|
|
187
190
|
|
|
188
191
|
/**
|
|
189
192
|
* @typedef {{
|
|
190
|
-
* (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback:
|
|
191
|
-
* (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback:
|
|
192
|
-
* (path: PathLike, callback:
|
|
193
|
-
* (path: PathLike,
|
|
194
|
-
* (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback:
|
|
193
|
+
* (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
|
|
194
|
+
* (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: (err: NodeJS.ErrnoException | null, files?: Buffer[]) => void): void;
|
|
195
|
+
* (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[] | Buffer[]) => void): void;
|
|
196
|
+
* (path: PathLike, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
|
|
197
|
+
* (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files?: Dirent<string>[]) => void): void;
|
|
198
|
+
* (path: PathLike, options: { encoding: 'buffer', withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void): void;
|
|
195
199
|
* }} Readdir
|
|
196
200
|
*/
|
|
197
201
|
|
|
198
202
|
/**
|
|
199
203
|
* @typedef {{
|
|
200
|
-
* (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | null): string[];
|
|
204
|
+
* (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined; } | BufferEncoding | null): string[];
|
|
201
205
|
* (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer'): Buffer[];
|
|
202
206
|
* (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[];
|
|
203
207
|
* (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[];
|
|
208
|
+
* (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }): Dirent<Buffer>[];
|
|
204
209
|
* }} ReaddirSync
|
|
205
210
|
*/
|
|
206
211
|
|
|
@@ -473,7 +478,6 @@ const relative = (fs, rootPath, targetPath) => {
|
|
|
473
478
|
`${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system`
|
|
474
479
|
);
|
|
475
480
|
};
|
|
476
|
-
module.exports.relative = relative;
|
|
477
481
|
|
|
478
482
|
/**
|
|
479
483
|
* @param {InputFileSystem|OutputFileSystem|undefined} fs a file system
|
|
@@ -493,7 +497,6 @@ const join = (fs, rootPath, filename) => {
|
|
|
493
497
|
`${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system`
|
|
494
498
|
);
|
|
495
499
|
};
|
|
496
|
-
module.exports.join = join;
|
|
497
500
|
|
|
498
501
|
/**
|
|
499
502
|
* @param {InputFileSystem|OutputFileSystem|undefined} fs a file system
|
|
@@ -512,7 +515,6 @@ const dirname = (fs, absPath) => {
|
|
|
512
515
|
`${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system`
|
|
513
516
|
);
|
|
514
517
|
};
|
|
515
|
-
module.exports.dirname = dirname;
|
|
516
518
|
|
|
517
519
|
/**
|
|
518
520
|
* @param {OutputFileSystem} fs a file system
|
|
@@ -557,7 +559,6 @@ const mkdirp = (fs, p, callback) => {
|
|
|
557
559
|
callback();
|
|
558
560
|
});
|
|
559
561
|
};
|
|
560
|
-
module.exports.mkdirp = mkdirp;
|
|
561
562
|
|
|
562
563
|
/**
|
|
563
564
|
* @param {IntermediateFileSystem} fs a file system
|
|
@@ -584,7 +585,6 @@ const mkdirpSync = (fs, p) => {
|
|
|
584
585
|
}
|
|
585
586
|
}
|
|
586
587
|
};
|
|
587
|
-
module.exports.mkdirpSync = mkdirpSync;
|
|
588
588
|
|
|
589
589
|
/**
|
|
590
590
|
* @param {InputFileSystem} fs a file system
|
|
@@ -593,22 +593,22 @@ module.exports.mkdirpSync = mkdirpSync;
|
|
|
593
593
|
* @returns {void}
|
|
594
594
|
*/
|
|
595
595
|
const readJson = (fs, p, callback) => {
|
|
596
|
-
if ("readJson" in fs)
|
|
596
|
+
if ("readJson" in fs) {
|
|
597
597
|
return /** @type {NonNullable<InputFileSystem["readJson"]>} */ (
|
|
598
598
|
fs.readJson
|
|
599
599
|
)(p, callback);
|
|
600
|
+
}
|
|
600
601
|
fs.readFile(p, (err, buf) => {
|
|
601
602
|
if (err) return callback(err);
|
|
602
603
|
let data;
|
|
603
604
|
try {
|
|
604
|
-
data = JSON.parse(/** @type {Buffer} */ (buf).toString("
|
|
605
|
+
data = JSON.parse(/** @type {Buffer} */ (buf).toString("utf8"));
|
|
605
606
|
} catch (err1) {
|
|
606
607
|
return callback(/** @type {Error} */ (err1));
|
|
607
608
|
}
|
|
608
609
|
return callback(null, data);
|
|
609
610
|
});
|
|
610
611
|
};
|
|
611
|
-
module.exports.readJson = readJson;
|
|
612
612
|
|
|
613
613
|
/**
|
|
614
614
|
* @param {InputFileSystem} fs a file system
|
|
@@ -648,4 +648,11 @@ const lstatReadlinkAbsolute = (fs, p, callback) => {
|
|
|
648
648
|
if ("lstat" in fs) return doStat();
|
|
649
649
|
doReadLink();
|
|
650
650
|
};
|
|
651
|
+
|
|
652
|
+
module.exports.dirname = dirname;
|
|
653
|
+
module.exports.join = join;
|
|
651
654
|
module.exports.lstatReadlinkAbsolute = lstatReadlinkAbsolute;
|
|
655
|
+
module.exports.mkdirp = mkdirp;
|
|
656
|
+
module.exports.mkdirpSync = mkdirpSync;
|
|
657
|
+
module.exports.readJson = readJson;
|
|
658
|
+
module.exports.relative = relative;
|
package/lib/util/hash/md4.js
CHANGED
|
@@ -10,8 +10,8 @@ const create = require("./wasm-hash");
|
|
|
10
10
|
// #region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1
|
|
11
11
|
const md4 = new WebAssembly.Module(
|
|
12
12
|
Buffer.from(
|
|
13
|
-
//
|
|
14
|
-
"AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/
|
|
13
|
+
// 2150 bytes
|
|
14
|
+
"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",
|
|
15
15
|
"base64"
|
|
16
16
|
)
|
|
17
17
|
);
|
|
@@ -61,12 +61,14 @@ class WasmHash {
|
|
|
61
61
|
const { exports, buffered, mem, chunkSize } = this;
|
|
62
62
|
let endPos;
|
|
63
63
|
if (data.length < 70) {
|
|
64
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case
|
|
64
65
|
if (!encoding || encoding === "utf-8" || encoding === "utf8") {
|
|
65
66
|
endPos = buffered;
|
|
66
67
|
for (let i = 0; i < data.length; i++) {
|
|
67
68
|
const cc = data.charCodeAt(i);
|
|
68
|
-
if (cc < 0x80)
|
|
69
|
-
|
|
69
|
+
if (cc < 0x80) {
|
|
70
|
+
mem[endPos++] = cc;
|
|
71
|
+
} else if (cc < 0x800) {
|
|
70
72
|
mem[endPos] = (cc >> 6) | 0xc0;
|
|
71
73
|
mem[endPos + 1] = (cc & 0x3f) | 0x80;
|
|
72
74
|
endPos += 2;
|
package/lib/util/identifier.js
CHANGED
|
@@ -75,8 +75,9 @@ const absoluteToRequest = (context, maybeAbsolutePath) => {
|
|
|
75
75
|
* @returns {string} absolute path
|
|
76
76
|
*/
|
|
77
77
|
const requestToAbsolute = (context, relativePath) => {
|
|
78
|
-
if (relativePath.startsWith("./") || relativePath.startsWith("../"))
|
|
78
|
+
if (relativePath.startsWith("./") || relativePath.startsWith("../")) {
|
|
79
79
|
return path.join(context, relativePath);
|
|
80
|
+
}
|
|
80
81
|
return relativePath;
|
|
81
82
|
};
|
|
82
83
|
|
|
@@ -280,8 +281,6 @@ const _makePathsRelative = (context, identifier) =>
|
|
|
280
281
|
.map(str => absoluteToRequest(context, str))
|
|
281
282
|
.join("");
|
|
282
283
|
|
|
283
|
-
module.exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative);
|
|
284
|
-
|
|
285
284
|
/**
|
|
286
285
|
* @param {string} context context for relative path
|
|
287
286
|
* @param {string} identifier identifier for path
|
|
@@ -293,8 +292,6 @@ const _makePathsAbsolute = (context, identifier) =>
|
|
|
293
292
|
.map(str => requestToAbsolute(context, str))
|
|
294
293
|
.join("");
|
|
295
294
|
|
|
296
|
-
module.exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute);
|
|
297
|
-
|
|
298
295
|
/**
|
|
299
296
|
* @param {string} context absolute context path
|
|
300
297
|
* @param {string} request any request string may containing absolute paths, query string, etc.
|
|
@@ -307,7 +304,6 @@ const _contextify = (context, request) =>
|
|
|
307
304
|
.join("!");
|
|
308
305
|
|
|
309
306
|
const contextify = makeCacheableWithContext(_contextify);
|
|
310
|
-
module.exports.contextify = contextify;
|
|
311
307
|
|
|
312
308
|
/**
|
|
313
309
|
* @param {string} context absolute context path
|
|
@@ -321,7 +317,6 @@ const _absolutify = (context, request) =>
|
|
|
321
317
|
.join("!");
|
|
322
318
|
|
|
323
319
|
const absolutify = makeCacheableWithContext(_absolutify);
|
|
324
|
-
module.exports.absolutify = absolutify;
|
|
325
320
|
|
|
326
321
|
const PATH_QUERY_FRAGMENT_REGEXP =
|
|
327
322
|
/^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
|
|
@@ -345,7 +340,6 @@ const _parseResource = str => {
|
|
|
345
340
|
fragment: match[3] || ""
|
|
346
341
|
};
|
|
347
342
|
};
|
|
348
|
-
module.exports.parseResource = makeCacheable(_parseResource);
|
|
349
343
|
|
|
350
344
|
/**
|
|
351
345
|
* Parse resource, skips fragment part
|
|
@@ -362,9 +356,6 @@ const _parseResourceWithoutFragment = str => {
|
|
|
362
356
|
query: match[2] ? match[2].replace(/\0(.)/g, "$1") : ""
|
|
363
357
|
};
|
|
364
358
|
};
|
|
365
|
-
module.exports.parseResourceWithoutFragment = makeCacheable(
|
|
366
|
-
_parseResourceWithoutFragment
|
|
367
|
-
);
|
|
368
359
|
|
|
369
360
|
/**
|
|
370
361
|
* @param {string} filename the filename which should be undone
|
|
@@ -372,7 +363,7 @@ module.exports.parseResourceWithoutFragment = makeCacheable(
|
|
|
372
363
|
* @param {boolean} enforceRelative true returns ./ for empty paths
|
|
373
364
|
* @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir
|
|
374
365
|
*/
|
|
375
|
-
|
|
366
|
+
const getUndoPath = (filename, outputPath, enforceRelative) => {
|
|
376
367
|
let depth = -1;
|
|
377
368
|
let append = "";
|
|
378
369
|
outputPath = outputPath.replace(/[\\/]$/, "");
|
|
@@ -398,3 +389,13 @@ module.exports.getUndoPath = (filename, outputPath, enforceRelative) => {
|
|
|
398
389
|
? `./${append}`
|
|
399
390
|
: append;
|
|
400
391
|
};
|
|
392
|
+
|
|
393
|
+
module.exports.absolutify = absolutify;
|
|
394
|
+
module.exports.contextify = contextify;
|
|
395
|
+
module.exports.getUndoPath = getUndoPath;
|
|
396
|
+
module.exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute);
|
|
397
|
+
module.exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative);
|
|
398
|
+
module.exports.parseResource = makeCacheable(_parseResource);
|
|
399
|
+
module.exports.parseResourceWithoutFragment = makeCacheable(
|
|
400
|
+
_parseResourceWithoutFragment
|
|
401
|
+
);
|
|
@@ -170,6 +170,8 @@ module.exports = {
|
|
|
170
170
|
"dependencies/UnsupportedDependency": () =>
|
|
171
171
|
require("../dependencies/UnsupportedDependency"),
|
|
172
172
|
"dependencies/URLDependency": () => require("../dependencies/URLDependency"),
|
|
173
|
+
"dependencies/URLContextDependency": () =>
|
|
174
|
+
require("../dependencies/URLContextDependency"),
|
|
173
175
|
"dependencies/WebAssemblyExportImportedDependency": () =>
|
|
174
176
|
require("../dependencies/WebAssemblyExportImportedDependency"),
|
|
175
177
|
"dependencies/WebAssemblyImportDependency": () =>
|
package/lib/util/magicComment.js
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
// regexp to match at least one "magic comment"
|
|
9
|
+
module.exports.createMagicCommentContext = () =>
|
|
10
|
+
require("vm").createContext(undefined, {
|
|
11
|
+
name: "Webpack Magic Comment Parser",
|
|
12
|
+
codeGeneration: { strings: false, wasm: false }
|
|
13
|
+
});
|
|
9
14
|
module.exports.webpackCommentRegExp = new RegExp(
|
|
10
15
|
/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/
|
|
11
16
|
);
|
|
@@ -14,8 +19,3 @@ module.exports.webpackCommentRegExp = new RegExp(
|
|
|
14
19
|
/**
|
|
15
20
|
* @returns {import("vm").Context} magic comment context
|
|
16
21
|
*/
|
|
17
|
-
module.exports.createMagicCommentContext = () =>
|
|
18
|
-
require("vm").createContext(undefined, {
|
|
19
|
-
name: "Webpack Magic Comment Parser",
|
|
20
|
-
codeGeneration: { strings: false, wasm: false }
|
|
21
|
-
});
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @returns {void}
|
|
16
16
|
*/
|
|
17
17
|
const processAsyncTree = (items, concurrency, processor, callback) => {
|
|
18
|
-
const queue =
|
|
18
|
+
const queue = [...items];
|
|
19
19
|
if (queue.length === 0) return callback();
|
|
20
20
|
let processing = 0;
|
|
21
21
|
let finished = false;
|
package/lib/util/propertyName.js
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const { register } = require("./serialization");
|
|
9
|
-
|
|
10
8
|
const Position = require("acorn").Position;
|
|
11
9
|
const SourceLocation = require("acorn").SourceLocation;
|
|
12
10
|
const ValidationError = require("schema-utils").ValidationError;
|
|
@@ -19,6 +17,7 @@ const {
|
|
|
19
17
|
ReplaceSource,
|
|
20
18
|
SourceMapSource
|
|
21
19
|
} = require("webpack-sources");
|
|
20
|
+
const { register } = require("./serialization");
|
|
22
21
|
|
|
23
22
|
/** @typedef {import("acorn").Position} Position */
|
|
24
23
|
/** @typedef {import("../Dependency").RealDependencyLocation} RealDependencyLocation */
|
package/lib/util/removeBOM.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
module.exports = strOrBuffer => {
|
|
13
13
|
if (typeof strOrBuffer === "string" && strOrBuffer.charCodeAt(0) === 0xfeff) {
|
|
14
|
-
return strOrBuffer.
|
|
14
|
+
return strOrBuffer.slice(1);
|
|
15
15
|
} else if (
|
|
16
16
|
Buffer.isBuffer(strOrBuffer) &&
|
|
17
17
|
strOrBuffer[0] === 0xef &&
|