webpack 5.90.3 → 5.92.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/README.md +5 -5
- package/bin/webpack.js +6 -3
- package/lib/APIPlugin.js +14 -6
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -1
- package/lib/Cache.js +8 -2
- package/lib/CacheFacade.js +3 -3
- package/lib/Chunk.js +7 -4
- package/lib/ChunkGraph.js +52 -25
- package/lib/ChunkGroup.js +23 -17
- package/lib/CleanPlugin.js +8 -6
- package/lib/Compilation.js +295 -120
- package/lib/Compiler.js +223 -87
- package/lib/ConcatenationScope.js +3 -3
- package/lib/ConditionalInitFragment.js +4 -5
- package/lib/ContextModule.js +95 -41
- package/lib/ContextModuleFactory.js +4 -2
- package/lib/ContextReplacementPlugin.js +3 -2
- package/lib/DefinePlugin.js +18 -6
- package/lib/Dependency.js +12 -10
- package/lib/DependencyTemplate.js +17 -7
- package/lib/DllModule.js +1 -0
- package/lib/DllReferencePlugin.js +7 -3
- package/lib/EntryOptionPlugin.js +4 -1
- package/lib/EntryPlugin.js +6 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/EvalDevToolModulePlugin.js +11 -0
- package/lib/ExportsInfo.js +23 -8
- package/lib/ExternalModule.js +160 -35
- package/lib/ExternalModuleFactoryPlugin.js +37 -2
- package/lib/FileSystemInfo.js +69 -42
- package/lib/FlagDependencyExportsPlugin.js +21 -7
- package/lib/Generator.js +4 -4
- package/lib/HookWebpackError.js +2 -2
- package/lib/HotModuleReplacementPlugin.js +108 -45
- package/lib/IgnorePlugin.js +4 -1
- package/lib/InitFragment.js +5 -3
- package/lib/LibManifestPlugin.js +17 -9
- package/lib/Module.js +41 -14
- package/lib/ModuleFactory.js +3 -3
- package/lib/ModuleFilenameHelpers.js +30 -17
- package/lib/ModuleGraph.js +60 -31
- package/lib/ModuleGraphConnection.js +2 -1
- package/lib/MultiCompiler.js +62 -9
- package/lib/NodeStuffPlugin.js +14 -3
- package/lib/NormalModule.js +13 -13
- package/lib/NormalModuleFactory.js +18 -9
- package/lib/NormalModuleReplacementPlugin.js +5 -1
- package/lib/Parser.js +1 -1
- package/lib/PlatformPlugin.js +39 -0
- package/lib/ProgressPlugin.js +1 -1
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +2 -1
- package/lib/RecordIdsPlugin.js +4 -4
- package/lib/ResolverFactory.js +6 -4
- package/lib/RuntimeModule.js +4 -4
- package/lib/RuntimePlugin.js +1 -0
- package/lib/RuntimeTemplate.js +124 -52
- package/lib/SourceMapDevToolPlugin.js +4 -1
- package/lib/Stats.js +11 -4
- package/lib/Template.js +5 -5
- package/lib/TemplatedPathPlugin.js +48 -7
- package/lib/Watching.js +67 -60
- package/lib/WebpackError.js +6 -6
- package/lib/WebpackOptionsApply.js +18 -5
- package/lib/asset/AssetGenerator.js +15 -0
- package/lib/asset/RawDataUrlModule.js +3 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +120 -67
- package/lib/cache/IdleFileCachePlugin.js +8 -3
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
- package/lib/cache/PackFileCacheStrategy.js +51 -18
- package/lib/cache/ResolverCachePlugin.js +22 -14
- package/lib/cache/getLazyHashedEtag.js +2 -2
- package/lib/cli.js +5 -5
- package/lib/config/browserslistTargetHandler.js +7 -1
- package/lib/config/defaults.js +108 -34
- package/lib/config/normalization.js +3 -1
- package/lib/config/target.js +18 -11
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +4 -2
- package/lib/container/ContainerPlugin.js +14 -10
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +12 -3
- package/lib/css/CssExportsGenerator.js +68 -25
- package/lib/css/CssGenerator.js +34 -6
- package/lib/css/CssLoadingRuntimeModule.js +217 -98
- package/lib/css/CssModulesPlugin.js +238 -107
- package/lib/css/CssParser.js +24 -15
- package/lib/css/walkCssTokens.js +1 -1
- package/lib/debug/ProfilingPlugin.js +28 -3
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +9 -5
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +2 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +33 -18
- package/lib/dependencies/CommonJsExportsDependency.js +13 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -15
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -2
- package/lib/dependencies/ContextDependencyHelpers.js +49 -29
- package/lib/dependencies/ContextElementDependency.js +8 -1
- package/lib/dependencies/CssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +71 -9
- package/lib/dependencies/CssUrlDependency.js +10 -7
- package/lib/dependencies/ExportsInfoDependency.js +5 -4
- package/lib/dependencies/ExternalModuleDependency.js +4 -2
- package/lib/dependencies/ExternalModuleInitFragment.js +5 -3
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +43 -23
- package/lib/dependencies/HarmonyExportHeaderDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +73 -32
- package/lib/dependencies/HarmonyExportInitFragment.js +10 -2
- package/lib/dependencies/HarmonyImportDependency.js +28 -12
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +70 -19
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +47 -35
- package/lib/dependencies/ImportDependency.js +9 -2
- package/lib/dependencies/ImportEagerDependency.js +4 -2
- package/lib/dependencies/ImportMetaContextDependency.js +7 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +25 -14
- package/lib/dependencies/ImportMetaPlugin.js +1 -1
- package/lib/dependencies/ImportParserPlugin.js +15 -5
- package/lib/dependencies/ImportWeakDependency.js +4 -2
- package/lib/dependencies/LoaderDependency.js +2 -1
- package/lib/dependencies/LoaderImportDependency.js +2 -1
- package/lib/dependencies/LoaderPlugin.js +2 -2
- package/lib/dependencies/ModuleDependency.js +4 -5
- package/lib/dependencies/PureExpressionDependency.js +64 -47
- package/lib/dependencies/RequireContextPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +26 -14
- package/lib/dependencies/RequireEnsureDependency.js +1 -1
- package/lib/dependencies/URLDependency.js +7 -4
- package/lib/dependencies/WorkerDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +2 -1
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +92 -3
- package/lib/hmr/LazyCompilationPlugin.js +2 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +1 -1
- package/lib/ids/DeterministicChunkIdsPlugin.js +1 -1
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +6 -6
- package/lib/ids/NamedChunkIdsPlugin.js +1 -1
- package/lib/ids/NamedModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +2 -2
- package/lib/index.js +11 -0
- package/lib/javascript/BasicEvaluatedExpression.js +2 -2
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +0 -1
- package/lib/javascript/JavascriptModulesPlugin.js +174 -17
- package/lib/javascript/JavascriptParser.js +204 -71
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/javascript/StartupHelpers.js +22 -5
- package/lib/library/AbstractLibraryPlugin.js +2 -2
- package/lib/library/AmdLibraryPlugin.js +2 -2
- package/lib/library/AssignLibraryPlugin.js +3 -3
- package/lib/library/ExportPropertyLibraryPlugin.js +2 -2
- package/lib/library/JsonpLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +2 -2
- package/lib/library/SystemLibraryPlugin.js +2 -2
- package/lib/library/UmdLibraryPlugin.js +33 -12
- package/lib/logging/Logger.js +27 -2
- package/lib/logging/createConsoleLogger.js +13 -9
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
- package/lib/node/NodeEnvironmentPlugin.js +14 -8
- package/lib/node/NodeTemplatePlugin.js +1 -1
- package/lib/node/NodeWatchFileSystem.js +37 -26
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/nodeConsole.js +24 -1
- package/lib/optimize/AggressiveMergingPlugin.js +1 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +140 -121
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/InnerGraph.js +8 -3
- package/lib/optimize/InnerGraphPlugin.js +36 -13
- package/lib/optimize/LimitChunkCountPlugin.js +1 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +13 -3
- package/lib/optimize/RealContentHashPlugin.js +3 -3
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/RuntimeChunkPlugin.js +6 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +48 -17
- package/lib/optimize/SplitChunksPlugin.js +10 -10
- package/lib/performance/SizeLimitsPlugin.js +13 -2
- package/lib/rules/ObjectMatcherRulePlugin.js +15 -1
- package/lib/rules/RuleSetCompiler.js +9 -7
- package/lib/runtime/EnsureChunkRuntimeModule.js +2 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
- package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +4 -4
- package/lib/serialization/FileMiddleware.js +4 -3
- package/lib/serialization/NullPrototypeObjectSerializer.js +2 -2
- package/lib/serialization/ObjectMiddleware.js +8 -5
- package/lib/serialization/PlainObjectSerializer.js +2 -2
- package/lib/serialization/Serializer.js +19 -0
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/serialization/SingleItemMiddleware.js +2 -2
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +17 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -2
- package/lib/sharing/ProvideSharedPlugin.js +13 -6
- package/lib/sharing/resolveMatchedConfigs.js +3 -3
- package/lib/sharing/utils.js +13 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +20 -20
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/stats/StatsFactory.js +2 -2
- package/lib/stats/StatsPrinter.js +6 -6
- package/lib/util/ArrayQueue.js +14 -21
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Queue.js +8 -2
- package/lib/util/SortableSet.js +16 -4
- package/lib/util/StackedCacheMap.js +26 -0
- package/lib/util/TupleQueue.js +8 -2
- package/lib/util/WeakTupleMap.js +57 -13
- package/lib/util/binarySearchBounds.js +1 -1
- package/lib/util/cleverMerge.js +26 -13
- package/lib/util/comparators.js +37 -15
- package/lib/util/conventions.js +129 -0
- package/lib/util/createHash.js +3 -5
- package/lib/util/deprecation.js +3 -3
- package/lib/util/deterministicGrouping.js +2 -2
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +383 -69
- package/lib/util/hash/BatchedHash.js +3 -0
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/identifier.js +5 -5
- package/lib/util/mergeScope.js +79 -0
- package/lib/util/runtime.js +2 -17
- package/lib/util/semver.js +3 -0
- package/lib/util/smartGrouping.js +3 -3
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +4 -2
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -2
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +16 -7
- package/lib/wasm-sync/WebAssemblyGenerator.js +40 -19
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +1 -1
- package/lib/wasm-sync/WebAssemblyParser.js +7 -4
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -1
- package/lib/web/FetchCompileWasmPlugin.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +3 -2
- package/lib/webpack.js +19 -6
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +40 -39
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +97 -8
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +5 -1
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
- package/types.d.ts +1826 -639
package/lib/util/fs.js
CHANGED
@@ -11,7 +11,8 @@ const path = require("path");
|
|
11
11
|
/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */
|
12
12
|
|
13
13
|
/**
|
14
|
-
* @
|
14
|
+
* @template T
|
15
|
+
* @typedef {object} IStatsBase
|
15
16
|
* @property {() => boolean} isFile
|
16
17
|
* @property {() => boolean} isDirectory
|
17
18
|
* @property {() => boolean} isBlockDevice
|
@@ -19,20 +20,20 @@ const path = require("path");
|
|
19
20
|
* @property {() => boolean} isSymbolicLink
|
20
21
|
* @property {() => boolean} isFIFO
|
21
22
|
* @property {() => boolean} isSocket
|
22
|
-
* @property {
|
23
|
-
* @property {
|
24
|
-
* @property {
|
25
|
-
* @property {
|
26
|
-
* @property {
|
27
|
-
* @property {
|
28
|
-
* @property {
|
29
|
-
* @property {
|
30
|
-
* @property {
|
31
|
-
* @property {
|
32
|
-
* @property {
|
33
|
-
* @property {
|
34
|
-
* @property {
|
35
|
-
* @property {
|
23
|
+
* @property {T} dev
|
24
|
+
* @property {T} ino
|
25
|
+
* @property {T} mode
|
26
|
+
* @property {T} nlink
|
27
|
+
* @property {T} uid
|
28
|
+
* @property {T} gid
|
29
|
+
* @property {T} rdev
|
30
|
+
* @property {T} size
|
31
|
+
* @property {T} blksize
|
32
|
+
* @property {T} blocks
|
33
|
+
* @property {T} atimeMs
|
34
|
+
* @property {T} mtimeMs
|
35
|
+
* @property {T} ctimeMs
|
36
|
+
* @property {T} birthtimeMs
|
36
37
|
* @property {Date} atime
|
37
38
|
* @property {Date} mtime
|
38
39
|
* @property {Date} ctime
|
@@ -40,7 +41,15 @@ const path = require("path");
|
|
40
41
|
*/
|
41
42
|
|
42
43
|
/**
|
43
|
-
* @typedef {
|
44
|
+
* @typedef {IStatsBase<number>} IStats
|
45
|
+
*/
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @typedef {IStatsBase<bigint> & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint }} IBigIntStats
|
49
|
+
*/
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @typedef {object} Dirent
|
44
53
|
* @property {() => boolean} isFile
|
45
54
|
* @property {() => boolean} isDirectory
|
46
55
|
* @property {() => boolean} isBlockDevice
|
@@ -48,21 +57,31 @@ const path = require("path");
|
|
48
57
|
* @property {() => boolean} isSymbolicLink
|
49
58
|
* @property {() => boolean} isFIFO
|
50
59
|
* @property {() => boolean} isSocket
|
51
|
-
* @property {string
|
60
|
+
* @property {string} name
|
61
|
+
* @property {string} path
|
52
62
|
*/
|
53
63
|
|
54
|
-
/** @typedef {
|
55
|
-
/** @typedef {
|
56
|
-
/** @typedef {
|
57
|
-
/** @typedef {
|
58
|
-
|
59
|
-
/** @typedef {function(
|
60
|
-
/** @typedef {function(
|
61
|
-
/** @typedef {function(
|
62
|
-
/** @typedef {function(
|
64
|
+
/** @typedef {string | number | boolean | null} JsonPrimitive */
|
65
|
+
/** @typedef {JsonValue[]} JsonArray */
|
66
|
+
/** @typedef {JsonPrimitive | JsonObject | JsonArray} JsonValue */
|
67
|
+
/** @typedef {{[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined}} JsonObject */
|
68
|
+
|
69
|
+
/** @typedef {function(NodeJS.ErrnoException | null): void} NoParamCallback */
|
70
|
+
/** @typedef {function(NodeJS.ErrnoException | null, string=): void} StringCallback */
|
71
|
+
/** @typedef {function(NodeJS.ErrnoException | null, Buffer=): void} BufferCallback */
|
72
|
+
/** @typedef {function(NodeJS.ErrnoException | null, (string | Buffer)=): void} StringOrBufferCallback */
|
73
|
+
/** @typedef {function(NodeJS.ErrnoException | null, (string[])=): void} ReaddirStringCallback */
|
74
|
+
/** @typedef {function(NodeJS.ErrnoException | null, (Buffer[])=): void} ReaddirBufferCallback */
|
75
|
+
/** @typedef {function(NodeJS.ErrnoException | null, (string[] | Buffer[])=): void} ReaddirStringOrBufferCallback */
|
76
|
+
/** @typedef {function(NodeJS.ErrnoException | null, (Dirent[])=): void} ReaddirDirentCallback */
|
77
|
+
/** @typedef {function(NodeJS.ErrnoException | null, IStats=): void} StatsCallback */
|
78
|
+
/** @typedef {function(NodeJS.ErrnoException | null, IBigIntStats=): void} BigIntStatsCallback */
|
79
|
+
/** @typedef {function(NodeJS.ErrnoException | null, (IStats | IBigIntStats)=): void} StatsOrBigIntStatsCallback */
|
80
|
+
/** @typedef {function(NodeJS.ErrnoException | null, number=): void} NumberCallback */
|
81
|
+
/** @typedef {function(NodeJS.ErrnoException | Error | null, JsonObject=): void} ReadJsonCallback */
|
63
82
|
|
64
83
|
/**
|
65
|
-
* @typedef {
|
84
|
+
* @typedef {object} WatcherInfo
|
66
85
|
* @property {Set<string>} changes get current aggregated changes that have not yet send to callback
|
67
86
|
* @property {Set<string>} removals get current aggregated removals that have not yet send to callback
|
68
87
|
* @property {Map<string, FileSystemInfoEntry | "ignore">} fileTimeInfoEntries get info about files
|
@@ -71,7 +90,7 @@ const path = require("path");
|
|
71
90
|
|
72
91
|
// TODO webpack 6 deprecate missing getInfo
|
73
92
|
/**
|
74
|
-
* @typedef {
|
93
|
+
* @typedef {object} Watcher
|
75
94
|
* @property {function(): void} close closes the watcher and all underlying file watchers
|
76
95
|
* @property {function(): void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call
|
77
96
|
* @property {function(): Set<string>=} getAggregatedChanges get current aggregated changes that have not yet send to callback
|
@@ -85,59 +104,348 @@ const path = require("path");
|
|
85
104
|
* @callback WatchMethod
|
86
105
|
* @param {Iterable<string>} files watched files
|
87
106
|
* @param {Iterable<string>} directories watched directories
|
88
|
-
* @param {Iterable<string>} missing watched
|
107
|
+
* @param {Iterable<string>} missing watched existence entries
|
89
108
|
* @param {number} startTime timestamp of start time
|
90
109
|
* @param {WatchOptions} options options object
|
91
|
-
* @param {function(Error
|
110
|
+
* @param {function(Error | null, Map<string, FileSystemInfoEntry | "ignore">, Map<string, FileSystemInfoEntry | "ignore">, Set<string>, Set<string>): void} callback aggregated callback
|
92
111
|
* @param {function(string, number): void} callbackUndelayed callback when the first change was detected
|
93
112
|
* @returns {Watcher} a watcher
|
94
113
|
*/
|
95
114
|
|
96
|
-
// TODO webpack 6 make optional methods required
|
115
|
+
// TODO webpack 6 make optional methods required and avoid using non standard methods like `join`, `relative`, `dirname`, move IntermediateFileSystemExtras methods to InputFilesystem or OutputFilesystem
|
116
|
+
|
117
|
+
/**
|
118
|
+
* @typedef {string | Buffer | URL} PathLike
|
119
|
+
*/
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @typedef {PathLike | number} PathOrFileDescriptor
|
123
|
+
*/
|
124
|
+
|
125
|
+
/**
|
126
|
+
* @typedef {object} ObjectEncodingOptions
|
127
|
+
* @property {BufferEncoding | null | undefined} [encoding]
|
128
|
+
*/
|
129
|
+
|
130
|
+
/**
|
131
|
+
* @typedef {{
|
132
|
+
* (path: PathOrFileDescriptor, options: ({ encoding?: null | undefined, flag?: string | undefined } & import("events").Abortable) | undefined | null, callback: BufferCallback): void;
|
133
|
+
* (path: PathOrFileDescriptor, options: ({ encoding: BufferEncoding, flag?: string | undefined } & import("events").Abortable) | BufferEncoding, callback: StringCallback): void;
|
134
|
+
* (path: PathOrFileDescriptor, options: (ObjectEncodingOptions & { flag?: string | undefined } & import("events").Abortable) | BufferEncoding | undefined | null, callback: StringOrBufferCallback): void;
|
135
|
+
* (path: PathOrFileDescriptor, callback: BufferCallback): void;
|
136
|
+
* }} ReadFile
|
137
|
+
*/
|
138
|
+
|
139
|
+
/**
|
140
|
+
* @typedef {{
|
141
|
+
* (path: PathOrFileDescriptor, options?: { encoding?: null | undefined, flag?: string | undefined } | null): Buffer;
|
142
|
+
* (path: PathOrFileDescriptor, options: { encoding: BufferEncoding, flag?: string | undefined } | BufferEncoding): string;
|
143
|
+
* (path: PathOrFileDescriptor, options?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null): string | Buffer;
|
144
|
+
* }} ReadFileSync
|
145
|
+
*/
|
146
|
+
|
147
|
+
/**
|
148
|
+
* @typedef {ObjectEncodingOptions | BufferEncoding | undefined | null} EncodingOption
|
149
|
+
*/
|
150
|
+
|
151
|
+
/**
|
152
|
+
* @typedef {'buffer'| { encoding: 'buffer' }} BufferEncodingOption
|
153
|
+
*/
|
154
|
+
|
155
|
+
/**
|
156
|
+
* @typedef {object} StatOptions
|
157
|
+
* @property {(boolean | undefined)=} bigint
|
158
|
+
*/
|
159
|
+
|
160
|
+
/**
|
161
|
+
* @typedef {object} StatSyncOptions
|
162
|
+
* @property {(boolean | undefined)=} bigint
|
163
|
+
* @property {(boolean | undefined)=} throwIfNoEntry
|
164
|
+
*/
|
165
|
+
|
166
|
+
/**
|
167
|
+
* @typedef {{
|
168
|
+
* (path: PathLike, options: EncodingOption, callback: StringCallback): void;
|
169
|
+
* (path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void;
|
170
|
+
* (path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void;
|
171
|
+
* (path: PathLike, callback: StringCallback): void;
|
172
|
+
* }} Readlink
|
173
|
+
*/
|
174
|
+
|
175
|
+
/**
|
176
|
+
* @typedef {{
|
177
|
+
* (path: PathLike, options?: EncodingOption): string;
|
178
|
+
* (path: PathLike, options: BufferEncodingOption): Buffer;
|
179
|
+
* (path: PathLike, options?: EncodingOption): string | Buffer;
|
180
|
+
* }} ReadlinkSync
|
181
|
+
*/
|
182
|
+
|
183
|
+
/**
|
184
|
+
* @typedef {{
|
185
|
+
* (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: ReaddirStringCallback): void;
|
186
|
+
* (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: ReaddirBufferCallback): void;
|
187
|
+
* (path: PathLike, callback: ReaddirStringCallback): void;
|
188
|
+
* (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: ReaddirStringOrBufferCallback): void;
|
189
|
+
* (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: ReaddirDirentCallback): void;
|
190
|
+
* }} Readdir
|
191
|
+
*/
|
192
|
+
|
193
|
+
/**
|
194
|
+
* @typedef {{
|
195
|
+
* (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | null): string[];
|
196
|
+
* (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer'): Buffer[];
|
197
|
+
* (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[];
|
198
|
+
* (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[];
|
199
|
+
* }} ReaddirSync
|
200
|
+
*/
|
201
|
+
|
202
|
+
/**
|
203
|
+
* @typedef {{
|
204
|
+
* (path: PathLike, callback: StatsCallback): void;
|
205
|
+
* (path: PathLike, options: (StatOptions & { bigint?: false | undefined }) | undefined, callback: StatsCallback): void;
|
206
|
+
* (path: PathLike, options: StatOptions & { bigint: true }, callback: BigIntStatsCallback): void;
|
207
|
+
* (path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void;
|
208
|
+
* }} Stat
|
209
|
+
*/
|
210
|
+
|
211
|
+
/**
|
212
|
+
* @typedef {{
|
213
|
+
* (path: PathLike, options?: undefined): IStats;
|
214
|
+
* (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined;
|
215
|
+
* (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined;
|
216
|
+
* (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats;
|
217
|
+
* (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
|
218
|
+
* (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats;
|
219
|
+
* (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined;
|
220
|
+
* }} StatSync
|
221
|
+
*/
|
222
|
+
|
223
|
+
/**
|
224
|
+
* @typedef {{
|
225
|
+
* (path: PathLike, callback: StatsCallback): void;
|
226
|
+
* (path: PathLike, options: (StatOptions & { bigint?: false | undefined }) | undefined, callback: StatsCallback): void;
|
227
|
+
* (path: PathLike, options: StatOptions & { bigint: true }, callback: BigIntStatsCallback): void;
|
228
|
+
* (path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void;
|
229
|
+
* }} LStat
|
230
|
+
*/
|
231
|
+
|
232
|
+
/**
|
233
|
+
* @typedef {{
|
234
|
+
* (path: PathLike, options?: undefined): IStats;
|
235
|
+
* (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined;
|
236
|
+
* (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined;
|
237
|
+
* (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats;
|
238
|
+
* (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
|
239
|
+
* (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats;
|
240
|
+
* (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined;
|
241
|
+
* }} LStatSync
|
242
|
+
*/
|
243
|
+
|
244
|
+
/**
|
245
|
+
* @typedef {{
|
246
|
+
* (path: PathLike, options: EncodingOption, callback: StringCallback): void;
|
247
|
+
* (path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void;
|
248
|
+
* (path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void;
|
249
|
+
* (path: PathLike, callback: StringCallback): void;
|
250
|
+
* }} RealPath
|
251
|
+
*/
|
252
|
+
|
253
|
+
/**
|
254
|
+
* @typedef {{
|
255
|
+
* (path: PathLike, options?: EncodingOption): string;
|
256
|
+
* (path: PathLike, options: BufferEncodingOption): Buffer;
|
257
|
+
* (path: PathLike, options?: EncodingOption): string | Buffer;
|
258
|
+
* }} RealPathSync
|
259
|
+
*/
|
260
|
+
|
261
|
+
/**
|
262
|
+
* @typedef {function(PathOrFileDescriptor, ReadJsonCallback): void} ReadJson
|
263
|
+
*/
|
264
|
+
|
265
|
+
/**
|
266
|
+
* @typedef {function(PathOrFileDescriptor): JsonObject} ReadJsonSync
|
267
|
+
*/
|
97
268
|
|
98
269
|
/**
|
99
|
-
* @typedef {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
* @
|
104
|
-
* @property {
|
105
|
-
* @property {
|
106
|
-
* @property {
|
107
|
-
* @property {
|
270
|
+
* @typedef {function((string | string[] | Set<string>)=): void} Purge
|
271
|
+
*/
|
272
|
+
|
273
|
+
/**
|
274
|
+
* @typedef {object} InputFileSystem
|
275
|
+
* @property {ReadFile} readFile
|
276
|
+
* @property {ReadFileSync=} readFileSync
|
277
|
+
* @property {Readlink} readlink
|
278
|
+
* @property {ReadlinkSync=} readlinkSync
|
279
|
+
* @property {Readdir} readdir
|
280
|
+
* @property {ReaddirSync=} readdirSync
|
281
|
+
* @property {Stat} stat
|
282
|
+
* @property {StatSync=} statSync
|
283
|
+
* @property {LStat=} lstat
|
284
|
+
* @property {LStatSync=} lstatSync
|
285
|
+
* @property {RealPath=} realpath
|
286
|
+
* @property {RealPathSync=} realpathSync
|
287
|
+
* @property {ReadJson=} readJson
|
288
|
+
* @property {ReadJsonSync=} readJsonSync
|
289
|
+
* @property {Purge=} purge
|
108
290
|
* @property {(function(string, string): string)=} join
|
109
291
|
* @property {(function(string, string): string)=} relative
|
110
292
|
* @property {(function(string): string)=} dirname
|
111
293
|
*/
|
112
294
|
|
113
295
|
/**
|
114
|
-
* @typedef {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
* @
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
* @
|
296
|
+
* @typedef {number | string} Mode
|
297
|
+
*/
|
298
|
+
|
299
|
+
/**
|
300
|
+
* @typedef {(ObjectEncodingOptions & import("events").Abortable & { mode?: Mode | undefined, flag?: string | undefined, flush?: boolean | undefined }) | BufferEncoding | null} WriteFileOptions
|
301
|
+
*/
|
302
|
+
|
303
|
+
/**
|
304
|
+
* @typedef {{
|
305
|
+
* (file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void;
|
306
|
+
* (file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void;
|
307
|
+
* }} WriteFile
|
308
|
+
*/
|
309
|
+
|
310
|
+
/**
|
311
|
+
* @typedef {{ recursive?: boolean | undefined, mode?: Mode | undefined }} MakeDirectoryOptions
|
312
|
+
*/
|
313
|
+
|
314
|
+
/**
|
315
|
+
* @typedef {{
|
316
|
+
* (file: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: StringCallback): void;
|
317
|
+
* (file: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null | undefined, callback: NoParamCallback): void;
|
318
|
+
* (file: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: StringCallback): void;
|
319
|
+
* (file: PathLike, callback: NoParamCallback): void;
|
320
|
+
* }} Mkdir
|
321
|
+
*/
|
322
|
+
|
323
|
+
/**
|
324
|
+
* @typedef {{ maxRetries?: number | undefined, recursive?: boolean | undefined, retryDelay?: number | undefined }} RmDirOptions
|
325
|
+
*/
|
326
|
+
|
327
|
+
/**
|
328
|
+
* @typedef {{
|
329
|
+
* (file: PathLike, callback: NoParamCallback): void;
|
330
|
+
* (file: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
|
331
|
+
* }} Rmdir
|
332
|
+
*/
|
333
|
+
|
334
|
+
/**
|
335
|
+
* @typedef {function(PathLike, NoParamCallback): void} Unlink
|
336
|
+
*/
|
337
|
+
|
338
|
+
/**
|
339
|
+
* @typedef {object} OutputFileSystem
|
340
|
+
* @property {WriteFile} writeFile
|
341
|
+
* @property {Mkdir} mkdir
|
342
|
+
* @property {Readdir=} readdir
|
343
|
+
* @property {Rmdir=} rmdir
|
344
|
+
* @property {Unlink=} unlink
|
345
|
+
* @property {Stat} stat
|
346
|
+
* @property {LStat=} lstat
|
347
|
+
* @property {ReadFile} readFile
|
123
348
|
* @property {(function(string, string): string)=} join
|
124
349
|
* @property {(function(string, string): string)=} relative
|
125
350
|
* @property {(function(string): string)=} dirname
|
126
351
|
*/
|
127
352
|
|
128
353
|
/**
|
129
|
-
* @typedef {
|
354
|
+
* @typedef {object} WatchFileSystem
|
130
355
|
* @property {WatchMethod} watch
|
131
356
|
*/
|
132
357
|
|
133
358
|
/**
|
134
|
-
* @typedef {
|
135
|
-
*
|
136
|
-
*
|
137
|
-
*
|
138
|
-
*
|
139
|
-
|
140
|
-
|
359
|
+
* @typedef {{
|
360
|
+
* (path: PathLike, options: MakeDirectoryOptions & { recursive: true }): string | undefined;
|
361
|
+
* (path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null): void;
|
362
|
+
* (path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
|
363
|
+
* }} MkdirSync
|
364
|
+
*/
|
365
|
+
|
366
|
+
/**
|
367
|
+
* @typedef {object} StreamOptions
|
368
|
+
* @property {(string | undefined)=} flags
|
369
|
+
* @property {(BufferEncoding | undefined)} encoding
|
370
|
+
* @property {(number | any | undefined)=} fd
|
371
|
+
* @property {(number | undefined)=} mode
|
372
|
+
* @property {(boolean | undefined)=} autoClose
|
373
|
+
* @property {(boolean | undefined)=} emitClose
|
374
|
+
* @property {(number | undefined)=} start
|
375
|
+
* @property {(AbortSignal | null | undefined)=} signal
|
376
|
+
*/
|
377
|
+
|
378
|
+
/**
|
379
|
+
* @typedef {object} FSImplementation
|
380
|
+
* @property {((...args: any[]) => any)=} open
|
381
|
+
* @property {((...args: any[]) => any)=} close
|
382
|
+
*/
|
383
|
+
|
384
|
+
/**
|
385
|
+
* @typedef {FSImplementation & { write: (...args: any[]) => any; close?: (...args: any[]) => any }} CreateWriteStreamFSImplementation
|
386
|
+
*/
|
387
|
+
|
388
|
+
/**
|
389
|
+
* @typedef {StreamOptions & { fs?: CreateWriteStreamFSImplementation | null | undefined }} WriteStreamOptions
|
390
|
+
*/
|
391
|
+
|
392
|
+
/**
|
393
|
+
* @typedef {function(PathLike, (BufferEncoding | WriteStreamOptions)=): NodeJS.WritableStream} CreateWriteStream
|
394
|
+
*/
|
395
|
+
|
396
|
+
/**
|
397
|
+
* @typedef {number | string} OpenMode
|
398
|
+
*/
|
399
|
+
|
400
|
+
/**
|
401
|
+
* @typedef {{
|
402
|
+
* (file: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: NumberCallback): void;
|
403
|
+
* (file: PathLike, flags: OpenMode | undefined, callback: NumberCallback): void;
|
404
|
+
* (file: PathLike, callback: NumberCallback): void;
|
405
|
+
* }} Open
|
406
|
+
*/
|
407
|
+
|
408
|
+
/**
|
409
|
+
* @typedef {number | bigint} ReadPosition
|
410
|
+
*/
|
411
|
+
|
412
|
+
/**
|
413
|
+
* @typedef {object} ReadSyncOptions
|
414
|
+
* @property {(number | undefined)=} offset
|
415
|
+
* @property {(number | undefined)=} length
|
416
|
+
* @property {(ReadPosition | null | undefined)=} position
|
417
|
+
*/
|
418
|
+
|
419
|
+
/**
|
420
|
+
* @template {NodeJS.ArrayBufferView} TBuffer
|
421
|
+
* @typedef {object} ReadAsyncOptions
|
422
|
+
* @property {(number | undefined)=} offset
|
423
|
+
* @property {(number | undefined)=} length
|
424
|
+
* @property {(ReadPosition | null | undefined)=} position
|
425
|
+
* @property {TBuffer=} buffer
|
426
|
+
*/
|
427
|
+
|
428
|
+
/**
|
429
|
+
* @template {NodeJS.ArrayBufferView} [TBuffer=Buffer]
|
430
|
+
* @typedef {{
|
431
|
+
* (fd: number, buffer: TBuffer, offset: number, length: number, position: ReadPosition | null, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void;
|
432
|
+
* (fd: number, options: ReadAsyncOptions<TBuffer>, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void;
|
433
|
+
* (fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void;
|
434
|
+
* }} Read
|
435
|
+
*/
|
436
|
+
|
437
|
+
/** @typedef {function(number, NoParamCallback): void} Close */
|
438
|
+
|
439
|
+
/** @typedef {function(PathLike, PathLike, NoParamCallback): void} Rename */
|
440
|
+
|
441
|
+
/**
|
442
|
+
* @typedef {object} IntermediateFileSystemExtras
|
443
|
+
* @property {MkdirSync} mkdirSync
|
444
|
+
* @property {CreateWriteStream} createWriteStream
|
445
|
+
* @property {Open} open
|
446
|
+
* @property {Read} read
|
447
|
+
* @property {Close} close
|
448
|
+
* @property {Rename} rename
|
141
449
|
*/
|
142
450
|
|
143
451
|
/** @typedef {InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras} IntermediateFileSystem */
|
@@ -260,7 +568,7 @@ const mkdirpSync = (fs, p) => {
|
|
260
568
|
fs.mkdirSync(p);
|
261
569
|
} catch (err) {
|
262
570
|
if (err) {
|
263
|
-
if (err.code === "ENOENT") {
|
571
|
+
if (/** @type {NodeJS.ErrnoException} */ (err).code === "ENOENT") {
|
264
572
|
const dir = dirname(fs, p);
|
265
573
|
if (dir === p) {
|
266
574
|
throw err;
|
@@ -268,7 +576,7 @@ const mkdirpSync = (fs, p) => {
|
|
268
576
|
mkdirpSync(fs, dir);
|
269
577
|
fs.mkdirSync(p);
|
270
578
|
return;
|
271
|
-
} else if (err.code === "EEXIST") {
|
579
|
+
} else if (/** @type {NodeJS.ErrnoException} */ (err).code === "EEXIST") {
|
272
580
|
return;
|
273
581
|
}
|
274
582
|
throw err;
|
@@ -284,14 +592,17 @@ exports.mkdirpSync = mkdirpSync;
|
|
284
592
|
* @returns {void}
|
285
593
|
*/
|
286
594
|
const readJson = (fs, p, callback) => {
|
287
|
-
if ("readJson" in fs)
|
595
|
+
if ("readJson" in fs)
|
596
|
+
return /** @type {NonNullable<InputFileSystem["readJson"]>} */ (
|
597
|
+
fs.readJson
|
598
|
+
)(p, callback);
|
288
599
|
fs.readFile(p, (err, buf) => {
|
289
600
|
if (err) return callback(err);
|
290
601
|
let data;
|
291
602
|
try {
|
292
|
-
data = JSON.parse(buf.toString("utf-8"));
|
603
|
+
data = JSON.parse(/** @type {Buffer} */ (buf).toString("utf-8"));
|
293
604
|
} catch (e) {
|
294
|
-
return callback(e);
|
605
|
+
return callback(/** @type {Error} */ (e));
|
295
606
|
}
|
296
607
|
return callback(null, data);
|
297
608
|
});
|
@@ -301,7 +612,7 @@ exports.readJson = readJson;
|
|
301
612
|
/**
|
302
613
|
* @param {InputFileSystem} fs a file system
|
303
614
|
* @param {string} p an absolute path
|
304
|
-
* @param {
|
615
|
+
* @param {function(NodeJS.ErrnoException | Error | null, (IStats | string)=): void} callback callback
|
305
616
|
* @returns {void}
|
306
617
|
*/
|
307
618
|
const lstatReadlinkAbsolute = (fs, p, callback) => {
|
@@ -320,13 +631,16 @@ const lstatReadlinkAbsolute = (fs, p, callback) => {
|
|
320
631
|
};
|
321
632
|
const doStat = () => {
|
322
633
|
if ("lstat" in fs) {
|
323
|
-
return fs.lstat(
|
324
|
-
|
325
|
-
|
326
|
-
return
|
634
|
+
return /** @type {NonNullable<InputFileSystem["lstat"]>} */ (fs.lstat)(
|
635
|
+
p,
|
636
|
+
(err, stats) => {
|
637
|
+
if (err) return callback(err);
|
638
|
+
if (/** @type {IStats} */ (stats).isSymbolicLink()) {
|
639
|
+
return doReadLink();
|
640
|
+
}
|
641
|
+
callback(null, stats);
|
327
642
|
}
|
328
|
-
|
329
|
-
});
|
643
|
+
);
|
330
644
|
} else {
|
331
645
|
return fs.stat(p, callback);
|
332
646
|
}
|
@@ -10,8 +10,8 @@ const create = require("./wasm-hash");
|
|
10
10
|
//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
|
11
11
|
const xxhash64 = new WebAssembly.Module(
|
12
12
|
Buffer.from(
|
13
|
-
//
|
14
|
-
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+
|
13
|
+
// 1160 bytes
|
14
|
+
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACqgIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAFBIGoiASAASQ0ACyACJAAgAyQBIAQkAiAFJAMLngYCAn8CfiMEQgBSBH4jAEIBiSMBQgeJfCMCQgyJfCMDQhKJfCMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IwFCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0jAkLP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSMDQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9BULFz9my8eW66icLIwQgAK18fCEDA0AgAUEIaiICIABNBEAgAyABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQMgAiEBDAELCyABQQRqIgIgAE0EQCADIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCEDIAIhAQsDQCAAIAFHBEAgAyABMQAAQsXP2bLx5brqJ36FQguJQoeVr6+Ytt6bnn9+IQMgAUEBaiEBDAELC0EAIAMgA0IhiIVCz9bTvtLHq9lCfiIDQh2IIAOFQvnz3fGZ9pmrFn4iA0IgiCADhSIDQiCIIgRC//8Dg0IghiAEQoCA/P8Pg0IQiIQiBEL/gYCA8B+DQhCGIARCgP6DgIDgP4NCCIiEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIANC/////w+DIgNC//8Dg0IghiADQoCA/P8Pg0IQiIQiA0L/gYCA8B+DQhCGIANCgP6DgIDgP4NCCIiEIgNCj4C8gPCBwAeDQgiGIANC8IHAh4CegPgAg0IEiIQiA0KGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gA0Kw4MCBg4aMmDCEfDcDAAs=",
|
15
15
|
"base64"
|
16
16
|
)
|
17
17
|
);
|
package/lib/util/identifier.js
CHANGED
@@ -11,7 +11,7 @@ const SEGMENTS_SPLIT_REGEXP = /([|!])/;
|
|
11
11
|
const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
|
12
12
|
|
13
13
|
/**
|
14
|
-
* @typedef {
|
14
|
+
* @typedef {object} MakeRelativePathsCache
|
15
15
|
* @property {Map<string, Map<string, string>>=} relativePaths
|
16
16
|
*/
|
17
17
|
|
@@ -100,7 +100,7 @@ const makeCacheable = realFn => {
|
|
100
100
|
|
101
101
|
/**
|
102
102
|
* @param {string} str the path with query and fragment
|
103
|
-
* @param {
|
103
|
+
* @param {object=} associatedObjectForCache an object to which the cache will be attached
|
104
104
|
* @returns {ParsedResource} parsed parts
|
105
105
|
*/
|
106
106
|
const fn = (str, associatedObjectForCache) => {
|
@@ -134,7 +134,7 @@ const makeCacheableWithContext = fn => {
|
|
134
134
|
/**
|
135
135
|
* @param {string} context context used to create relative path
|
136
136
|
* @param {string} identifier identifier used to create relative path
|
137
|
-
* @param {
|
137
|
+
* @param {object=} associatedObjectForCache an object to which the cache will be attached
|
138
138
|
* @returns {string} the returned relative path
|
139
139
|
*/
|
140
140
|
const cachedFn = (context, identifier, associatedObjectForCache) => {
|
@@ -164,7 +164,7 @@ const makeCacheableWithContext = fn => {
|
|
164
164
|
};
|
165
165
|
|
166
166
|
/**
|
167
|
-
* @param {
|
167
|
+
* @param {object=} associatedObjectForCache an object to which the cache will be attached
|
168
168
|
* @returns {function(string, string): string} cached function
|
169
169
|
*/
|
170
170
|
cachedFn.bindCache = associatedObjectForCache => {
|
@@ -207,7 +207,7 @@ const makeCacheableWithContext = fn => {
|
|
207
207
|
|
208
208
|
/**
|
209
209
|
* @param {string} context context used to create relative path
|
210
|
-
* @param {
|
210
|
+
* @param {object=} associatedObjectForCache an object to which the cache will be attached
|
211
211
|
* @returns {function(string): string} cached function
|
212
212
|
*/
|
213
213
|
cachedFn.bindContextCache = (context, associatedObjectForCache) => {
|