@rspack/core 1.0.0-beta.0 → 1.0.0-beta.2

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.
Files changed (177) hide show
  1. package/dist/ChunkGroup.d.ts +1 -0
  2. package/dist/ChunkGroup.js +3 -0
  3. package/dist/Compilation.d.ts +19 -1
  4. package/dist/Compiler.d.ts +11 -10
  5. package/dist/Compiler.js +16 -16
  6. package/dist/ExecuteModulePlugin.d.ts +0 -1
  7. package/dist/ExecuteModulePlugin.js +0 -1
  8. package/dist/Module.d.ts +2 -2
  9. package/dist/Module.js +1 -1
  10. package/dist/MultiCompiler.js +1 -1
  11. package/dist/NormalModule.d.ts +1 -0
  12. package/dist/NormalModule.js +1 -0
  13. package/dist/Resolver.d.ts +1 -2
  14. package/dist/RspackError.js +1 -1
  15. package/dist/Stats.js +22 -2
  16. package/dist/Template.js +2 -2
  17. package/dist/builtin-loader/lightningcss/index.js +1 -1
  18. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/BannerPlugin.d.ts +31 -31
  23. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/DefinePlugin.js +1 -1
  31. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +3 -3
  36. package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +1 -1
  37. package/dist/builtin-plugin/EnableLibraryPlugin.js +1 -6
  38. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
  39. package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +1 -1
  40. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/EntryPlugin.d.ts +3 -2
  42. package/dist/builtin-plugin/EntryPlugin.js +1 -0
  43. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/ExternalsPlugin.d.ts +5 -5
  46. package/dist/builtin-plugin/ExternalsPlugin.js +1 -1
  47. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +9 -9
  52. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +0 -1
  56. package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -1
  57. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -11
  60. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  65. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  66. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  67. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  68. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  69. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  70. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  71. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  72. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  73. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  74. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  75. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  76. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  78. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  79. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +2 -3
  81. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  82. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
  83. package/dist/builtin-plugin/base.d.ts +1 -1
  84. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +3 -5
  85. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +7 -5
  86. package/dist/builtin-plugin/css-extract/loader.d.ts +8 -3
  87. package/dist/builtin-plugin/css-extract/loader.js +27 -22
  88. package/dist/builtin-plugin/lazy-compilation/backend.js +4 -4
  89. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  90. package/dist/config/adapter.js +16 -2
  91. package/dist/config/adapterRuleUse.d.ts +2 -6
  92. package/dist/config/adapterRuleUse.js +10 -9
  93. package/dist/config/defaults.js +28 -42
  94. package/dist/config/normalization.d.ts +7 -3
  95. package/dist/config/normalization.js +7 -2
  96. package/dist/config/zod.d.ts +1634 -1093
  97. package/dist/config/zod.js +31 -2
  98. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  99. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  100. package/dist/container/default.runtime.js +1 -1
  101. package/dist/exports.d.ts +1 -1
  102. package/dist/lib/AbstractMethodError.d.ts +12 -3
  103. package/dist/lib/AbstractMethodError.js +29 -22
  104. package/dist/lib/Cache.d.ts +40 -46
  105. package/dist/lib/Cache.js +43 -78
  106. package/dist/lib/CacheFacade.d.ts +119 -143
  107. package/dist/lib/CacheFacade.js +123 -124
  108. package/dist/lib/Dependency.d.ts +23 -0
  109. package/dist/lib/Dependency.js +11 -0
  110. package/dist/lib/EntryOptionPlugin.d.ts +19 -2
  111. package/dist/lib/EntryOptionPlugin.js +22 -6
  112. package/dist/lib/EnvironmentPlugin.d.ts +17 -10
  113. package/dist/lib/EnvironmentPlugin.js +16 -17
  114. package/dist/lib/HookWebpackError.d.ts +27 -33
  115. package/dist/lib/HookWebpackError.js +33 -34
  116. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  117. package/dist/lib/{ignoreWarningsPlugin.js → IgnoreWarningsPlugin.js} +17 -0
  118. package/dist/lib/LoaderOptionsPlugin.d.ts +18 -9
  119. package/dist/lib/LoaderOptionsPlugin.js +38 -14
  120. package/dist/lib/LoaderTargetPlugin.d.ts +17 -8
  121. package/dist/lib/LoaderTargetPlugin.js +17 -15
  122. package/dist/lib/ModuleFilenameHelpers.d.ts +10 -1
  123. package/dist/lib/ModuleFilenameHelpers.js +10 -1
  124. package/dist/lib/NormalModuleReplacementPlugin.d.ts +15 -5
  125. package/dist/lib/NormalModuleReplacementPlugin.js +15 -5
  126. package/dist/lib/WebpackError.d.ts +23 -22
  127. package/dist/lib/WebpackError.js +15 -35
  128. package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
  129. package/dist/lib/cache/MemoryCachePlugin.js +40 -0
  130. package/dist/lib/cache/getLazyHashedEtag.d.ts +24 -24
  131. package/dist/lib/cache/getLazyHashedEtag.js +20 -23
  132. package/dist/lib/cache/mergeEtags.d.ts +15 -9
  133. package/dist/lib/cache/mergeEtags.js +18 -11
  134. package/dist/lib/formatLocation.d.ts +14 -9
  135. package/dist/lib/formatLocation.js +17 -15
  136. package/dist/loader-runner/index.js +6 -7
  137. package/dist/loader-runner/loadLoader.js +8 -11
  138. package/dist/logging/Logger.js +3 -3
  139. package/dist/logging/createConsoleLogger.d.ts +26 -6
  140. package/dist/logging/createConsoleLogger.js +21 -58
  141. package/dist/logging/runtime.d.ts +4 -10
  142. package/dist/logging/runtime.js +8 -23
  143. package/dist/logging/truncateArgs.d.ts +4 -4
  144. package/dist/logging/truncateArgs.js +5 -10
  145. package/dist/node/NodeEnvironmentPlugin.js +2 -2
  146. package/dist/node/NodeWatchFileSystem.js +6 -6
  147. package/dist/node/nodeConsole.d.ts +7 -21
  148. package/dist/node/nodeConsole.js +29 -36
  149. package/dist/rspackOptionsApply.d.ts +0 -1
  150. package/dist/rspackOptionsApply.js +10 -9
  151. package/dist/sharing/ProvideSharedPlugin.d.ts +20 -19
  152. package/dist/sharing/ProvideSharedPlugin.js +26 -17
  153. package/dist/sharing/SharePlugin.d.ts +3 -0
  154. package/dist/sharing/SharePlugin.js +4 -1
  155. package/dist/stats/DefaultStatsFactoryPlugin.js +187 -96
  156. package/dist/stats/DefaultStatsPresetPlugin.js +1 -2
  157. package/dist/stats/DefaultStatsPrinterPlugin.js +18 -19
  158. package/dist/stats/StatsFactory.d.ts +2 -1
  159. package/dist/stats/StatsFactory.js +2 -6
  160. package/dist/stats/statsFactoryUtils.d.ts +63 -23
  161. package/dist/util/SizeFormatHelpers.js +1 -1
  162. package/dist/util/bindingVersionCheck.js +3 -3
  163. package/dist/util/cleverMerge.js +3 -2
  164. package/dist/util/comparators.d.ts +2 -2
  165. package/dist/util/comparators.js +5 -4
  166. package/dist/util/createHash.js +1 -1
  167. package/dist/util/fs.js +2 -2
  168. package/dist/util/identifier.js +2 -2
  169. package/dist/util/index.js +1 -1
  170. package/dist/util/memoize.js +1 -4
  171. package/dist/util/smartGrouping.js +4 -6
  172. package/dist/util/webpack.d.ts +1 -1
  173. package/dist/util/webpack.js +2 -1
  174. package/module.d.ts +1 -1
  175. package/package.json +3 -3
  176. package/compiled/enhanced-resolve/index.js +0 -5566
  177. package/dist/lib/ignoreWarningsPlugin.d.ts +0 -7
@@ -1,191 +1,167 @@
1
- export = CacheFacade;
2
- declare class CacheFacade {
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/CacheFacade.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
10
+ import type { Cache, CallbackCache, Etag } from "./Cache";
11
+ import type WebpackError from "./WebpackError";
12
+ import type { HashConstructor, HashableObject } from "./cache/getLazyHashedEtag";
13
+ type CallbackNormalErrorCache<T> = (err?: WebpackError | null, result?: T) => void;
14
+ declare abstract class BaseCache {
15
+ abstract get<T>(callback: CallbackCache<T>): void;
16
+ abstract getPromise<T>(): Promise<T | undefined>;
17
+ abstract store<T>(data: T, callback: CallbackCache<void>): void;
18
+ abstract storePromise<T>(data: T): Promise<void>;
19
+ }
20
+ export declare class MultiItemCache implements BaseCache {
21
+ _items: ItemCacheFacade[];
3
22
  /**
4
- * @param {Cache} cache the root cache
5
- * @param {string} name the child cache name
6
- * @param {string | HashConstructor} hashFunction the hash function to use
23
+ * @param items item caches
24
+ * @returns
7
25
  */
8
- constructor(cache: Cache, name: string, hashFunction: string | HashConstructor);
9
- _cache: import("./Cache");
10
- _name: string;
11
- _hashFunction: any;
26
+ constructor(items: ItemCacheFacade[]);
12
27
  /**
13
- * @param {string} name the child cache name#
14
- * @returns {CacheFacade} child cache
28
+ * @param callback signals when the value is retrieved
29
+ * @returns
15
30
  */
16
- getChildCache(name: string): CacheFacade;
31
+ get<T>(callback: CallbackCache<T>): void;
17
32
  /**
18
- * @param {string} identifier the cache identifier
19
- * @param {Etag | null} etag the etag
20
- * @returns {ItemCacheFacade} item cache
33
+ * @returns promise with the data
21
34
  */
22
- getItemCache(identifier: string, etag: Etag | null): ItemCacheFacade;
35
+ getPromise<T>(): Promise<T | undefined>;
23
36
  /**
24
- * @param {HashableObject} obj an hashable object
25
- * @returns {Etag} an etag that is lazy hashed
37
+ * @param data the value to store
38
+ * @param callback signals when the value is stored
39
+ * @returns
26
40
  */
27
- getLazyHashedEtag(obj: HashableObject): Etag;
41
+ store<T>(data: T, callback: CallbackCache<void>): void;
28
42
  /**
29
- * @param {Etag} a an etag
30
- * @param {Etag} b another etag
31
- * @returns {Etag} an etag that represents both
43
+ * @param data the value to store
44
+ * @returns promise signals when the value is stored
32
45
  */
33
- mergeEtags(a: Etag, b: Etag): Etag;
46
+ storePromise<T>(data: T): Promise<void>;
47
+ }
48
+ export declare class ItemCacheFacade implements BaseCache {
49
+ _cache: Cache;
50
+ _name: string;
51
+ _etag: Etag | null;
34
52
  /**
35
- * @template T
36
- * @param {string} identifier the cache identifier
37
- * @param {Etag | null} etag the etag
38
- * @param {CallbackCache<T>} callback signals when the value is retrieved
39
- * @returns {void}
53
+ * @param cache the root cache
54
+ * @param name the child cache item name
55
+ * @param etag the etag
56
+ * @returns
40
57
  */
41
- get<T>(identifier: string, etag: Etag | null, callback: CallbackCache<T>): void;
58
+ constructor(cache: Cache, name: string, etag: Etag | null);
42
59
  /**
43
- * @template T
44
- * @param {string} identifier the cache identifier
45
- * @param {Etag | null} etag the etag
46
- * @returns {Promise<T>} promise with the data
60
+ * @param callback signals when the value is retrieved
61
+ * @returns
47
62
  */
48
- getPromise<T_1>(identifier: string, etag: Etag | null): Promise<T_1>;
63
+ get<T>(callback: CallbackCache<T>): void;
49
64
  /**
50
- * @template T
51
- * @param {string} identifier the cache identifier
52
- * @param {Etag | null} etag the etag
53
- * @param {T} data the value to store
54
- * @param {CallbackCache<void>} callback signals when the value is stored
55
- * @returns {void}
65
+ * @returns promise with the data
56
66
  */
57
- store<T_2>(identifier: string, etag: Etag | null, data: T_2, callback: CallbackCache<void>): void;
67
+ getPromise<T>(): Promise<T | undefined>;
58
68
  /**
59
- * @template T
60
- * @param {string} identifier the cache identifier
61
- * @param {Etag | null} etag the etag
62
- * @param {T} data the value to store
63
- * @returns {Promise<void>} promise signals when the value is stored
69
+ * @param data the value to store
70
+ * @param callback signals when the value is stored
71
+ * @returns
64
72
  */
65
- storePromise<T_3>(identifier: string, etag: Etag | null, data: T_3): Promise<void>;
73
+ store<T>(data: T, callback: CallbackCache<void>): void;
66
74
  /**
67
- * @template T
68
- * @param {string} identifier the cache identifier
69
- * @param {Etag | null} etag the etag
70
- * @param {function(CallbackNormalErrorCache<T>): void} computer function to compute the value if not cached
71
- * @param {CallbackNormalErrorCache<T>} callback signals when the value is retrieved
72
- * @returns {void}
75
+ * @param data the value to store
76
+ * @returns promise signals when the value is stored
73
77
  */
74
- provide<T_4>(identifier: string, etag: Etag | null, computer: (arg0: CallbackNormalErrorCache<T_4>) => void, callback: CallbackNormalErrorCache<T_4>): void;
78
+ storePromise<T>(data: T): Promise<void>;
75
79
  /**
76
- * @template T
77
- * @param {string} identifier the cache identifier
78
- * @param {Etag | null} etag the etag
79
- * @param {function(): Promise<T> | T} computer function to compute the value if not cached
80
- * @returns {Promise<T>} promise with the data
80
+ * @param computer function to compute the value if not cached
81
+ * @param callback signals when the value is retrieved
82
+ * @returns
81
83
  */
82
- providePromise<T_5>(identifier: string, etag: Etag | null, computer: () => T_5 | Promise<T_5>): Promise<T_5>;
83
- }
84
- declare namespace CacheFacade {
85
- export { ItemCacheFacade, MultiItemCache, Cache, Etag, WebpackError, HashableObject, HashConstructor, CallbackCache, CallbackNormalErrorCache };
86
- }
87
- type Etag = import("./Cache").Etag;
88
- declare class ItemCacheFacade {
84
+ provide<T>(computer: (callback: CallbackNormalErrorCache<T>) => void, callback: CallbackNormalErrorCache<T>): void;
89
85
  /**
90
- * @param {Cache} cache the root cache
91
- * @param {string} name the child cache item name
92
- * @param {Etag | null} etag the etag
86
+ * @param computer function to compute the value if not cached
87
+ * @returns promise with the data
93
88
  */
94
- constructor(cache: Cache, name: string, etag: Etag | null);
95
- _cache: import("./Cache");
89
+ providePromise<T>(computer: () => Promise<T> | T): Promise<T>;
90
+ }
91
+ export declare class CacheFacade {
96
92
  _name: string;
97
- _etag: import("./Cache").Etag | null;
93
+ _cache: Cache;
94
+ _hashFunction: string | HashConstructor;
98
95
  /**
99
- * @template T
100
- * @param {CallbackCache<T>} callback signals when the value is retrieved
101
- * @returns {void}
96
+ * @param cache the root cache
97
+ * @param name the child cache name
98
+ * @param hashFunction the hash function to use
102
99
  */
103
- get<T>(callback: CallbackCache<T>): void;
100
+ constructor(cache: Cache, name: string, hashFunction: string | HashConstructor);
104
101
  /**
105
- * @template T
106
- * @returns {Promise<T>} promise with the data
102
+ * @param name the child cache name#
103
+ * @returns child cache
107
104
  */
108
- getPromise<T_1>(): Promise<T_1>;
105
+ getChildCache(name: string): CacheFacade;
109
106
  /**
110
- * @template T
111
- * @param {T} data the value to store
112
- * @param {CallbackCache<void>} callback signals when the value is stored
113
- * @returns {void}
107
+ * @param identifier the cache identifier
108
+ * @param etag the etag
109
+ * @returns item cache
114
110
  */
115
- store<T_2>(data: T_2, callback: CallbackCache<void>): void;
111
+ getItemCache(identifier: string, etag: Etag | null): ItemCacheFacade;
116
112
  /**
117
- * @template T
118
- * @param {T} data the value to store
119
- * @returns {Promise<void>} promise signals when the value is stored
113
+ * @param obj an hashable object
114
+ * @returns an etag that is lazy hashed
120
115
  */
121
- storePromise<T_3>(data: T_3): Promise<void>;
116
+ getLazyHashedEtag(obj: HashableObject): Etag;
122
117
  /**
123
- * @template T
124
- * @param {function(CallbackNormalErrorCache<T>): void} computer function to compute the value if not cached
125
- * @param {CallbackNormalErrorCache<T>} callback signals when the value is retrieved
126
- * @returns {void}
118
+ * @param a an etag
119
+ * @param b another etag
120
+ * @returns an etag that represents both
127
121
  */
128
- provide<T_4>(computer: (arg0: CallbackNormalErrorCache<T_4>) => void, callback: CallbackNormalErrorCache<T_4>): void;
122
+ mergeEtags(a: Etag, b: Etag): Etag;
129
123
  /**
130
- * @template T
131
- * @param {function(): Promise<T> | T} computer function to compute the value if not cached
132
- * @returns {Promise<T>} promise with the data
124
+ * @param identifier the cache identifier
125
+ * @param etag the etag
126
+ * @param callback signals when the value is retrieved
127
+ * @returns
133
128
  */
134
- providePromise<T_5>(computer: () => T_5 | Promise<T_5>): Promise<T_5>;
135
- }
136
- type HashableObject = import("./cache/getLazyHashedEtag").HashableObject;
137
- type CallbackCache<T> = (err?: (WebpackError | null) | undefined, result?: T | undefined) => void;
138
- type CallbackNormalErrorCache<T> = (err?: (Error | null) | undefined, result?: T | undefined) => void;
139
- type Cache = import("./Cache");
140
- type HashConstructor = any;
141
- /** @typedef {import("./Cache")} Cache */
142
- /** @typedef {import("./Cache").Etag} Etag */
143
- /** @typedef {import("./WebpackError")} WebpackError */
144
- /** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */
145
- /** @typedef {any} HashConstructor */
146
- /**
147
- * @template T
148
- * @callback CallbackCache
149
- * @param {(WebpackError | null)=} err
150
- * @param {T=} result
151
- * @returns {void}
152
- */
153
- /**
154
- * @template T
155
- * @callback CallbackNormalErrorCache
156
- * @param {(Error | null)=} err
157
- * @param {T=} result
158
- * @returns {void}
159
- */
160
- declare class MultiItemCache {
129
+ get<T>(identifier: string, etag: Etag | null, callback: CallbackCache<T>): void;
161
130
  /**
162
- * @param {ItemCacheFacade[]} items item caches
131
+ * @param identifier the cache identifier
132
+ * @param etag the etag
133
+ * @returns promise with the data
163
134
  */
164
- constructor(items: ItemCacheFacade[]);
165
- _items: ItemCacheFacade[];
135
+ getPromise<T>(identifier: string, etag: Etag | null): Promise<T | undefined>;
166
136
  /**
167
- * @template T
168
- * @param {CallbackCache<T>} callback signals when the value is retrieved
169
- * @returns {void}
137
+ * @param identifier the cache identifier
138
+ * @param etag the etag
139
+ * @param data the value to store
140
+ * @param callback signals when the value is stored
141
+ * @returns
170
142
  */
171
- get<T>(callback: CallbackCache<T>): void;
143
+ store<T>(identifier: string, etag: Etag | null, data: T, callback: CallbackCache<void>): void;
172
144
  /**
173
- * @template T
174
- * @returns {Promise<T>} promise with the data
145
+ * @param identifier the cache identifier
146
+ * @param etag the etag
147
+ * @param data the value to store
148
+ * @returns promise signals when the value is stored
175
149
  */
176
- getPromise<T_1>(): Promise<T_1>;
150
+ storePromise<T>(identifier: string, etag: Etag | null, data: T): Promise<void>;
177
151
  /**
178
- * @template T
179
- * @param {T} data the value to store
180
- * @param {CallbackCache<void>} callback signals when the value is stored
181
- * @returns {void}
152
+ * @param identifier the cache identifier
153
+ * @param etag the etag
154
+ * @param computer function to compute the value if not cached
155
+ * @param callback signals when the value is retrieved
156
+ * @returns
182
157
  */
183
- store<T_2>(data: T_2, callback: CallbackCache<void>): void;
158
+ provide<T>(identifier: string, etag: Etag | null, computer: (callback: CallbackNormalErrorCache<T>) => void, callback: CallbackNormalErrorCache<T>): void;
184
159
  /**
185
- * @template T
186
- * @param {T} data the value to store
187
- * @returns {Promise<void>} promise signals when the value is stored
160
+ * @param identifier the cache identifier
161
+ * @param etag the etag
162
+ * @param computer function to compute the value if not cached
163
+ * @returns promise with the data
188
164
  */
189
- storePromise<T_3>(data: T_3): Promise<void>;
165
+ providePromise<T>(identifier: string, etag: Etag | null, computer: () => Promise<T> | T): Promise<{} | T | null>;
190
166
  }
191
- type WebpackError = import("./WebpackError");
167
+ export default CacheFacade;