@ohos-ports/rsbuild-core 1.1.14-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/bin/rsbuild.js +20 -0
  4. package/compiled/chokidar/index.d.ts +345 -0
  5. package/compiled/chokidar/index.js +1778 -0
  6. package/compiled/chokidar/license +21 -0
  7. package/compiled/chokidar/package.json +1 -0
  8. package/compiled/connect/index.d.ts +90 -0
  9. package/compiled/connect/index.js +1240 -0
  10. package/compiled/connect/license +25 -0
  11. package/compiled/connect/package.json +1 -0
  12. package/compiled/connect-history-api-fallback/index.d.ts +1 -0
  13. package/compiled/connect-history-api-fallback/index.js +149 -0
  14. package/compiled/connect-history-api-fallback/license +21 -0
  15. package/compiled/connect-history-api-fallback/package.json +1 -0
  16. package/compiled/cors/index.d.ts +1 -0
  17. package/compiled/cors/index.js +371 -0
  18. package/compiled/cors/license +22 -0
  19. package/compiled/cors/package.json +1 -0
  20. package/compiled/css-loader/api.js +85 -0
  21. package/compiled/css-loader/getUrl.js +26 -0
  22. package/compiled/css-loader/index.d.ts +1 -0
  23. package/compiled/css-loader/index.js +8008 -0
  24. package/compiled/css-loader/license +20 -0
  25. package/compiled/css-loader/noSourceMaps.js +5 -0
  26. package/compiled/css-loader/package.json +1 -0
  27. package/compiled/css-loader/sourceMaps.js +16 -0
  28. package/compiled/html-rspack-plugin/default_index.ejs +9 -0
  29. package/compiled/html-rspack-plugin/index.d.ts +289 -0
  30. package/compiled/html-rspack-plugin/index.js +1583 -0
  31. package/compiled/html-rspack-plugin/license +20 -0
  32. package/compiled/html-rspack-plugin/loader.js +162 -0
  33. package/compiled/html-rspack-plugin/package.json +1 -0
  34. package/compiled/http-proxy-middleware/index.d.ts +318 -0
  35. package/compiled/http-proxy-middleware/index.js +5280 -0
  36. package/compiled/http-proxy-middleware/license +22 -0
  37. package/compiled/http-proxy-middleware/package.json +1 -0
  38. package/compiled/jiti/index.d.ts +1 -0
  39. package/compiled/jiti/index.js +416 -0
  40. package/compiled/jiti/license +21 -0
  41. package/compiled/jiti/package.json +1 -0
  42. package/compiled/launch-editor-middleware/index.d.ts +1 -0
  43. package/compiled/launch-editor-middleware/index.js +694 -0
  44. package/compiled/launch-editor-middleware/license +21 -0
  45. package/compiled/launch-editor-middleware/package.json +1 -0
  46. package/compiled/mrmime/index.d.ts +4 -0
  47. package/compiled/mrmime/index.js +452 -0
  48. package/compiled/mrmime/package.json +1 -0
  49. package/compiled/on-finished/index.d.ts +13 -0
  50. package/compiled/on-finished/index.js +197 -0
  51. package/compiled/on-finished/license +23 -0
  52. package/compiled/on-finished/package.json +1 -0
  53. package/compiled/open/index.d.ts +153 -0
  54. package/compiled/open/index.js +409 -0
  55. package/compiled/open/package.json +1 -0
  56. package/compiled/open/xdg-open +1066 -0
  57. package/compiled/picocolors/index.d.ts +55 -0
  58. package/compiled/picocolors/index.js +108 -0
  59. package/compiled/picocolors/license +15 -0
  60. package/compiled/picocolors/package.json +1 -0
  61. package/compiled/postcss/index.d.ts +1 -0
  62. package/compiled/postcss/index.js +5997 -0
  63. package/compiled/postcss/license +20 -0
  64. package/compiled/postcss/package.json +1 -0
  65. package/compiled/postcss-load-config/index.d.ts +1 -0
  66. package/compiled/postcss-load-config/index.js +739 -0
  67. package/compiled/postcss-load-config/license +20 -0
  68. package/compiled/postcss-load-config/package.json +1 -0
  69. package/compiled/postcss-loader/index.d.ts +1 -0
  70. package/compiled/postcss-loader/index.js +741 -0
  71. package/compiled/postcss-loader/license +20 -0
  72. package/compiled/postcss-loader/package.json +1 -0
  73. package/compiled/rsbuild-dev-middleware/index.d.ts +1 -0
  74. package/compiled/rsbuild-dev-middleware/index.js +6158 -0
  75. package/compiled/rsbuild-dev-middleware/license +20 -0
  76. package/compiled/rsbuild-dev-middleware/package.json +1 -0
  77. package/compiled/rslog/index.d.ts +66 -0
  78. package/compiled/rslog/index.js +334 -0
  79. package/compiled/rslog/license +21 -0
  80. package/compiled/rslog/package.json +1 -0
  81. package/compiled/rspack-chain/index.d.ts +611 -0
  82. package/compiled/rspack-chain/index.js +1740 -0
  83. package/compiled/rspack-chain/license +373 -0
  84. package/compiled/rspack-chain/package.json +1 -0
  85. package/compiled/rspack-manifest-plugin/index.d.ts +44 -0
  86. package/compiled/rspack-manifest-plugin/index.js +394 -0
  87. package/compiled/rspack-manifest-plugin/license +21 -0
  88. package/compiled/rspack-manifest-plugin/package.json +1 -0
  89. package/compiled/sirv/index.d.ts +1 -0
  90. package/compiled/sirv/index.js +709 -0
  91. package/compiled/sirv/package.json +1 -0
  92. package/compiled/style-loader/index.d.ts +1 -0
  93. package/compiled/style-loader/index.js +427 -0
  94. package/compiled/style-loader/license +20 -0
  95. package/compiled/style-loader/package.json +1 -0
  96. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  97. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  98. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  99. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  100. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  101. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  102. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  103. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  104. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  105. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  106. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  107. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  108. package/compiled/tinyglobby/index.d.ts +25 -0
  109. package/compiled/tinyglobby/index.js +2749 -0
  110. package/compiled/tinyglobby/index1.js +17 -0
  111. package/compiled/tinyglobby/license +21 -0
  112. package/compiled/tinyglobby/package.json +1 -0
  113. package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
  114. package/compiled/webpack-bundle-analyzer/index.js +13480 -0
  115. package/compiled/webpack-bundle-analyzer/license +20 -0
  116. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  117. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  118. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  119. package/compiled/webpack-merge/index.d.ts +31 -0
  120. package/compiled/webpack-merge/index.js +1200 -0
  121. package/compiled/webpack-merge/license +20 -0
  122. package/compiled/webpack-merge/package.json +1 -0
  123. package/compiled/ws/index.d.ts +401 -0
  124. package/compiled/ws/index.js +3153 -0
  125. package/compiled/ws/license +20 -0
  126. package/compiled/ws/package.json +1 -0
  127. package/dist/client/hmr.js +143 -0
  128. package/dist/client/overlay.js +210 -0
  129. package/dist/ignoreCssLoader.mjs +4 -0
  130. package/dist/index.cjs +7251 -0
  131. package/dist/index.js +7118 -0
  132. package/dist/transformLoader.mjs +22 -0
  133. package/dist/transformRawLoader.mjs +22 -0
  134. package/dist-types/cli/commands.d.ts +23 -0
  135. package/dist-types/cli/index.d.ts +1 -0
  136. package/dist-types/cli/init.d.ts +7 -0
  137. package/dist-types/cli/prepare.d.ts +1 -0
  138. package/dist-types/client/hmr.d.ts +1 -0
  139. package/dist-types/client/overlay.d.ts +1 -0
  140. package/dist-types/config.d.ts +90 -0
  141. package/dist-types/configChain.d.ts +139 -0
  142. package/dist-types/constants.d.ts +37 -0
  143. package/dist-types/createContext.d.ts +11 -0
  144. package/dist-types/createRsbuild.d.ts +2 -0
  145. package/dist-types/helpers/format.d.ts +5 -0
  146. package/dist-types/helpers/fs.d.ts +13 -0
  147. package/dist-types/helpers/index.d.ts +47 -0
  148. package/dist-types/helpers/path.d.ts +11 -0
  149. package/dist-types/helpers/stats.d.ts +9 -0
  150. package/dist-types/hooks.d.ts +48 -0
  151. package/dist-types/index.d.ts +26 -0
  152. package/dist-types/initPlugins.d.ts +6 -0
  153. package/dist-types/internal.d.ts +6 -0
  154. package/dist-types/loadEnv.d.ts +50 -0
  155. package/dist-types/loader/ignoreCssLoader.d.ts +2 -0
  156. package/dist-types/loader/transformLoader.d.ts +7 -0
  157. package/dist-types/loader/transformRawLoader.d.ts +3 -0
  158. package/dist-types/logger.d.ts +4 -0
  159. package/dist-types/mergeConfig.d.ts +2 -0
  160. package/dist-types/package.json +1 -0
  161. package/dist-types/pluginHelper.d.ts +12 -0
  162. package/dist-types/pluginManager.d.ts +9 -0
  163. package/dist-types/plugins/appIcon.d.ts +2 -0
  164. package/dist-types/plugins/asset.d.ts +3 -0
  165. package/dist-types/plugins/basic.d.ts +5 -0
  166. package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
  167. package/dist-types/plugins/cache.d.ts +2 -0
  168. package/dist-types/plugins/cleanOutput.d.ts +3 -0
  169. package/dist-types/plugins/css.d.ts +3 -0
  170. package/dist-types/plugins/define.d.ts +2 -0
  171. package/dist-types/plugins/entry.d.ts +2 -0
  172. package/dist-types/plugins/externals.d.ts +2 -0
  173. package/dist-types/plugins/fileSize.d.ts +4 -0
  174. package/dist-types/plugins/html.d.ts +9 -0
  175. package/dist-types/plugins/inlineChunk.d.ts +2 -0
  176. package/dist-types/plugins/lazyCompilation.d.ts +2 -0
  177. package/dist-types/plugins/manifest.d.ts +2 -0
  178. package/dist-types/plugins/minimize.d.ts +10 -0
  179. package/dist-types/plugins/moduleFederation.d.ts +2 -0
  180. package/dist-types/plugins/moment.d.ts +2 -0
  181. package/dist-types/plugins/nodeAddons.d.ts +2 -0
  182. package/dist-types/plugins/nonce.d.ts +2 -0
  183. package/dist-types/plugins/output.d.ts +2 -0
  184. package/dist-types/plugins/performance.d.ts +5 -0
  185. package/dist-types/plugins/progress.d.ts +2 -0
  186. package/dist-types/plugins/resolve.d.ts +2 -0
  187. package/dist-types/plugins/resourceHints.d.ts +2 -0
  188. package/dist-types/plugins/rsdoctor.d.ts +2 -0
  189. package/dist-types/plugins/rspackProfile.d.ts +2 -0
  190. package/dist-types/plugins/server.d.ts +2 -0
  191. package/dist-types/plugins/splitChunks.d.ts +4 -0
  192. package/dist-types/plugins/sri.d.ts +2 -0
  193. package/dist-types/plugins/swc.d.ts +7 -0
  194. package/dist-types/plugins/target.d.ts +2 -0
  195. package/dist-types/plugins/wasm.d.ts +2 -0
  196. package/dist-types/provider/build.d.ts +3 -0
  197. package/dist-types/provider/createCompiler.d.ts +27 -0
  198. package/dist-types/provider/helpers.d.ts +12 -0
  199. package/dist-types/provider/initConfigs.d.ts +10 -0
  200. package/dist-types/provider/inspectConfig.d.ts +6 -0
  201. package/dist-types/provider/provider.d.ts +2 -0
  202. package/dist-types/provider/rspackConfig.d.ts +8 -0
  203. package/dist-types/rspack/RsbuildHtmlPlugin.d.ts +37 -0
  204. package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +29 -0
  205. package/dist-types/rspack/preload/helpers/determineAsValue.d.ts +22 -0
  206. package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +29 -0
  207. package/dist-types/rspack/preload/helpers/extractChunks.d.ts +28 -0
  208. package/dist-types/rspack/preload/helpers/index.d.ts +4 -0
  209. package/dist-types/rspack/preload/helpers/type.d.ts +13 -0
  210. package/dist-types/server/ansiHTML.d.ts +12 -0
  211. package/dist-types/server/cliShortcuts.d.ts +10 -0
  212. package/dist-types/server/compilerDevMiddleware.d.ts +31 -0
  213. package/dist-types/server/devMiddleware.d.ts +27 -0
  214. package/dist-types/server/devServer.d.ts +60 -0
  215. package/dist-types/server/environment.d.ts +8 -0
  216. package/dist-types/server/getDevMiddlewares.d.ts +25 -0
  217. package/dist-types/server/gzipMiddleware.d.ts +4 -0
  218. package/dist-types/server/helper.d.ts +71 -0
  219. package/dist-types/server/httpServer.d.ts +8 -0
  220. package/dist-types/server/middlewares.d.ts +34 -0
  221. package/dist-types/server/open.d.ts +10 -0
  222. package/dist-types/server/prodServer.d.ts +25 -0
  223. package/dist-types/server/proxy.d.ts +6 -0
  224. package/dist-types/server/restart.d.ts +14 -0
  225. package/dist-types/server/runner/asModule.d.ts +2 -0
  226. package/dist-types/server/runner/basic.d.ts +25 -0
  227. package/dist-types/server/runner/cjs.d.ts +10 -0
  228. package/dist-types/server/runner/esm.d.ts +6 -0
  229. package/dist-types/server/runner/index.d.ts +8 -0
  230. package/dist-types/server/runner/type.d.ts +36 -0
  231. package/dist-types/server/socketServer.d.ts +26 -0
  232. package/dist-types/server/watchFiles.d.ts +14 -0
  233. package/dist-types/types/config.d.ts +1309 -0
  234. package/dist-types/types/context.d.ts +52 -0
  235. package/dist-types/types/hooks.d.ts +146 -0
  236. package/dist-types/types/index.d.ts +8 -0
  237. package/dist-types/types/plugin.d.ts +329 -0
  238. package/dist-types/types/rsbuild.d.ts +156 -0
  239. package/dist-types/types/rspack.d.ts +16 -0
  240. package/dist-types/types/thirdParty.d.ts +176 -0
  241. package/dist-types/types/utils.d.ts +12 -0
  242. package/package.json +61 -0
  243. package/static/openChrome.applescript +95 -0
  244. package/types.d.ts +221 -0
@@ -0,0 +1,394 @@
1
+ (() => {
2
+ "use strict";
3
+ var __webpack_modules__ = {
4
+ 699: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.transformFiles =
7
+ exports.reduceChunk =
8
+ exports.reduceAssets =
9
+ exports.generateManifest =
10
+ void 0;
11
+ const path_1 = __nccwpck_require__(17);
12
+ const generateManifest = (
13
+ compilation,
14
+ files,
15
+ { generate, seed = {} },
16
+ ) => {
17
+ let result;
18
+ if (generate) {
19
+ const entrypointsArray = Array.from(
20
+ compilation.entrypoints.entries(),
21
+ );
22
+ const entrypoints = entrypointsArray.reduce(
23
+ (e, [name, entrypoint]) =>
24
+ Object.assign(e, { [name]: entrypoint.getFiles() }),
25
+ {},
26
+ );
27
+ result = generate(seed, files, entrypoints);
28
+ } else {
29
+ result = files.reduce(
30
+ (manifest, file) =>
31
+ Object.assign(manifest, { [file.name]: file.path }),
32
+ seed,
33
+ );
34
+ }
35
+ return result;
36
+ };
37
+ exports.generateManifest = generateManifest;
38
+ const getFileType = (fileName, { transformExtensions }) => {
39
+ const replaced = fileName.replace(/\?.*/, "");
40
+ const split = replaced.split(".");
41
+ const extension = split.pop();
42
+ return transformExtensions.test(extension)
43
+ ? `${split.pop()}.${extension}`
44
+ : extension;
45
+ };
46
+ const reduceAssets = (files, asset, moduleAssets) => {
47
+ let name;
48
+ if (moduleAssets[asset.name]) {
49
+ name = moduleAssets[asset.name];
50
+ } else if (asset.info.sourceFilename) {
51
+ name = (0, path_1.join)(
52
+ (0, path_1.dirname)(asset.name),
53
+ (0, path_1.basename)(asset.info.sourceFilename),
54
+ );
55
+ }
56
+ if (name) {
57
+ return files.concat({
58
+ isAsset: true,
59
+ isChunk: false,
60
+ isInitial: false,
61
+ isModuleAsset: true,
62
+ name,
63
+ path: asset.name,
64
+ });
65
+ }
66
+ const isEntryAsset = asset.chunks && asset.chunks.length > 0;
67
+ if (isEntryAsset) {
68
+ return files;
69
+ }
70
+ return files.concat({
71
+ isAsset: true,
72
+ isChunk: false,
73
+ isInitial: false,
74
+ isModuleAsset: false,
75
+ name: asset.name,
76
+ path: asset.name,
77
+ });
78
+ };
79
+ exports.reduceAssets = reduceAssets;
80
+ const reduceChunk = (files, chunk, options, auxiliaryFiles) => {
81
+ Array.from(chunk.auxiliaryFiles || []).forEach((auxiliaryFile) => {
82
+ auxiliaryFiles[auxiliaryFile] = {
83
+ isAsset: true,
84
+ isChunk: false,
85
+ isInitial: false,
86
+ isModuleAsset: true,
87
+ name: (0, path_1.basename)(auxiliaryFile),
88
+ path: auxiliaryFile,
89
+ };
90
+ });
91
+ return Array.from(chunk.files).reduce((prev, path) => {
92
+ let name = chunk.name ? chunk.name : null;
93
+ name = name
94
+ ? options.useEntryKeys && !path.endsWith(".map")
95
+ ? name
96
+ : `${name}.${getFileType(path, options)}`
97
+ : path;
98
+ return prev.concat({
99
+ chunk,
100
+ isAsset: false,
101
+ isChunk: true,
102
+ isInitial: chunk.isOnlyInitial(),
103
+ isModuleAsset: false,
104
+ name,
105
+ path,
106
+ });
107
+ }, files);
108
+ };
109
+ exports.reduceChunk = reduceChunk;
110
+ const standardizeFilePaths = (file) => {
111
+ const result = Object.assign({}, file);
112
+ result.name = file.name.replace(/\\/g, "/");
113
+ result.path = file.path.replace(/\\/g, "/");
114
+ return result;
115
+ };
116
+ const transformFiles = (files, options) =>
117
+ ["filter", "map", "sort"]
118
+ .filter((fname) => !!options[fname])
119
+ .reduce((prev, fname) => prev[fname](options[fname]), files)
120
+ .map(standardizeFilePaths);
121
+ exports.transformFiles = transformFiles;
122
+ },
123
+ 586: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
+ Object.defineProperty(exports, "__esModule", { value: true });
125
+ exports.normalModuleLoaderHook =
126
+ exports.getCompilerHooks =
127
+ exports.emitHook =
128
+ exports.beforeRunHook =
129
+ void 0;
130
+ const fs_1 = __nccwpck_require__(147);
131
+ const path_1 = __nccwpck_require__(17);
132
+ const lite_tapable_1 = __nccwpck_require__(348);
133
+ const helpers_1 = __nccwpck_require__(699);
134
+ const compilerHookMap = new WeakMap();
135
+ const getCompilerHooks = (compiler) => {
136
+ let hooks = compilerHookMap.get(compiler);
137
+ if (typeof hooks === "undefined") {
138
+ hooks = {
139
+ afterEmit: new lite_tapable_1.SyncWaterfallHook(["manifest"]),
140
+ beforeEmit: new lite_tapable_1.SyncWaterfallHook(["manifest"]),
141
+ };
142
+ compilerHookMap.set(compiler, hooks);
143
+ }
144
+ return hooks;
145
+ };
146
+ exports.getCompilerHooks = getCompilerHooks;
147
+ const beforeRunHook = (
148
+ { emitCountMap, manifestFileName },
149
+ _,
150
+ callback,
151
+ ) => {
152
+ const emitCount = emitCountMap.get(manifestFileName) || 0;
153
+ emitCountMap.set(manifestFileName, emitCount + 1);
154
+ if (callback) {
155
+ callback();
156
+ }
157
+ };
158
+ exports.beforeRunHook = beforeRunHook;
159
+ const emitHook = function emit(
160
+ {
161
+ compiler,
162
+ emitCountMap,
163
+ manifestAssetId,
164
+ manifestFileName,
165
+ moduleAssets,
166
+ options,
167
+ },
168
+ compilation,
169
+ ) {
170
+ const emitCount = emitCountMap.get(manifestFileName) - 1;
171
+ const stats = compilation
172
+ .getStats()
173
+ .toJson({
174
+ all: false,
175
+ assets: true,
176
+ cachedAssets: true,
177
+ ids: true,
178
+ publicPath: true,
179
+ });
180
+ const publicPath =
181
+ options.publicPath !== null ? options.publicPath : stats.publicPath;
182
+ const { basePath, removeKeyHash } = options;
183
+ emitCountMap.set(manifestFileName, emitCount);
184
+ const auxiliaryFiles = {};
185
+ let files = Array.from(compilation.chunks).reduce(
186
+ (prev, chunk) =>
187
+ (0, helpers_1.reduceChunk)(prev, chunk, options, auxiliaryFiles),
188
+ [],
189
+ );
190
+ files = stats.assets.reduce(
191
+ (prev, asset) =>
192
+ (0, helpers_1.reduceAssets)(prev, asset, moduleAssets),
193
+ files,
194
+ );
195
+ files = files.filter(({ name, path }) => {
196
+ var _a;
197
+ return (
198
+ !path.includes("hot-update") &&
199
+ typeof emitCountMap.get(
200
+ (0, path_1.join)(
201
+ ((_a = compiler.options.output) === null || _a === void 0
202
+ ? void 0
203
+ : _a.path) || "<unknown>",
204
+ name,
205
+ ),
206
+ ) === "undefined"
207
+ );
208
+ });
209
+ files.forEach((file) => {
210
+ delete auxiliaryFiles[file.path];
211
+ });
212
+ Object.keys(auxiliaryFiles).forEach((auxiliaryFile) => {
213
+ files = files.concat(auxiliaryFiles[auxiliaryFile]);
214
+ });
215
+ files = files.map((file) => {
216
+ const normalizePath = (path) => {
217
+ if (!path.endsWith("/")) {
218
+ return `${path}/`;
219
+ }
220
+ return path;
221
+ };
222
+ const changes = {
223
+ name: basePath ? normalizePath(basePath) + file.name : file.name,
224
+ path: publicPath
225
+ ? normalizePath(publicPath) + file.path
226
+ : file.path,
227
+ };
228
+ changes.name = removeKeyHash
229
+ ? changes.name.replace(removeKeyHash, "")
230
+ : changes.name;
231
+ return Object.assign(file, changes);
232
+ });
233
+ files = (0, helpers_1.transformFiles)(files, options);
234
+ let manifest = (0, helpers_1.generateManifest)(
235
+ compilation,
236
+ files,
237
+ options,
238
+ );
239
+ const isLastEmit = emitCount === 0;
240
+ manifest = getCompilerHooks(compiler).beforeEmit.call(manifest);
241
+ if (isLastEmit) {
242
+ const output = options.serialize(manifest);
243
+ compilation.emitAsset(
244
+ manifestAssetId,
245
+ new compiler.webpack.sources.RawSource(output),
246
+ );
247
+ if (options.writeToFileEmit) {
248
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(manifestFileName), {
249
+ recursive: true,
250
+ });
251
+ (0, fs_1.writeFileSync)(manifestFileName, output);
252
+ }
253
+ }
254
+ getCompilerHooks(compiler).afterEmit.call(manifest);
255
+ };
256
+ exports.emitHook = emitHook;
257
+ const normalModuleLoaderHook = ({ moduleAssets }, context, module) => {
258
+ const loaderContext = context;
259
+ const { emitFile } = loaderContext;
260
+ loaderContext.emitFile = (file, content, sourceMap) => {
261
+ if (module.userRequest && !moduleAssets[file]) {
262
+ Object.assign(moduleAssets, {
263
+ [file]: (0, path_1.join)(
264
+ (0, path_1.dirname)(file),
265
+ (0, path_1.basename)(module.userRequest),
266
+ ),
267
+ });
268
+ }
269
+ return emitFile.call(module, file, content, sourceMap);
270
+ };
271
+ };
272
+ exports.normalModuleLoaderHook = normalModuleLoaderHook;
273
+ },
274
+ 348: (module) => {
275
+ module.exports = require("@rspack/lite-tapable");
276
+ },
277
+ 147: (module) => {
278
+ module.exports = require("fs");
279
+ },
280
+ 17: (module) => {
281
+ module.exports = require("path");
282
+ },
283
+ };
284
+ var __webpack_module_cache__ = {};
285
+ function __nccwpck_require__(moduleId) {
286
+ var cachedModule = __webpack_module_cache__[moduleId];
287
+ if (cachedModule !== undefined) {
288
+ return cachedModule.exports;
289
+ }
290
+ var module = (__webpack_module_cache__[moduleId] = { exports: {} });
291
+ var threw = true;
292
+ try {
293
+ __webpack_modules__[moduleId](
294
+ module,
295
+ module.exports,
296
+ __nccwpck_require__,
297
+ );
298
+ threw = false;
299
+ } finally {
300
+ if (threw) delete __webpack_module_cache__[moduleId];
301
+ }
302
+ return module.exports;
303
+ }
304
+ if (typeof __nccwpck_require__ !== "undefined")
305
+ __nccwpck_require__.ab = __dirname + "/";
306
+ var __webpack_exports__ = {};
307
+ (() => {
308
+ var exports = __webpack_exports__;
309
+ Object.defineProperty(exports, "__esModule", { value: true });
310
+ exports.RspackManifestPlugin =
311
+ exports.WebpackManifestPlugin =
312
+ exports.getCompilerHooks =
313
+ void 0;
314
+ const path_1 = __nccwpck_require__(17);
315
+ const hooks_1 = __nccwpck_require__(586);
316
+ Object.defineProperty(exports, "getCompilerHooks", {
317
+ enumerable: true,
318
+ get: function () {
319
+ return hooks_1.getCompilerHooks;
320
+ },
321
+ });
322
+ const emitCountMap = new Map();
323
+ const defaults = {
324
+ assetHookStage: Infinity,
325
+ basePath: "",
326
+ fileName: "manifest.json",
327
+ filter: null,
328
+ generate: void 0,
329
+ map: null,
330
+ publicPath: null,
331
+ removeKeyHash: /([a-f0-9]{16,32}\.?)/gi,
332
+ seed: void 0,
333
+ serialize(manifest) {
334
+ return JSON.stringify(manifest, null, 2);
335
+ },
336
+ sort: null,
337
+ transformExtensions: /^(gz|map)$/i,
338
+ useEntryKeys: false,
339
+ useLegacyEmit: false,
340
+ writeToFileEmit: false,
341
+ };
342
+ class WebpackManifestPlugin {
343
+ constructor(opts) {
344
+ this.options = Object.assign({}, defaults, opts);
345
+ }
346
+ apply(compiler) {
347
+ var _a, _b;
348
+ const moduleAssets = {};
349
+ const manifestFileName = (0, path_1.resolve)(
350
+ ((_a = compiler.options.output) === null || _a === void 0
351
+ ? void 0
352
+ : _a.path) || "./",
353
+ this.options.fileName,
354
+ );
355
+ const manifestAssetId = (0, path_1.relative)(
356
+ ((_b = compiler.options.output) === null || _b === void 0
357
+ ? void 0
358
+ : _b.path) || "./",
359
+ manifestFileName,
360
+ );
361
+ const beforeRun = hooks_1.beforeRunHook.bind(this, {
362
+ emitCountMap,
363
+ manifestFileName,
364
+ });
365
+ const emit = hooks_1.emitHook.bind(this, {
366
+ compiler,
367
+ emitCountMap,
368
+ manifestAssetId,
369
+ manifestFileName,
370
+ moduleAssets,
371
+ options: this.options,
372
+ });
373
+ const hookOptions = {
374
+ name: "WebpackManifestPlugin",
375
+ stage: this.options.assetHookStage,
376
+ };
377
+ if (this.options.useLegacyEmit === true) {
378
+ compiler.hooks.emit.tap(hookOptions, emit);
379
+ } else {
380
+ compiler.hooks.thisCompilation.tap(hookOptions, (compilation) => {
381
+ compilation.hooks.processAssets.tap(hookOptions, () =>
382
+ emit(compilation),
383
+ );
384
+ });
385
+ }
386
+ compiler.hooks.run.tapAsync(hookOptions, beforeRun);
387
+ compiler.hooks.watchRun.tapAsync(hookOptions, beforeRun);
388
+ }
389
+ }
390
+ exports.WebpackManifestPlugin = WebpackManifestPlugin;
391
+ exports.RspackManifestPlugin = WebpackManifestPlugin;
392
+ })();
393
+ module.exports = __webpack_exports__;
394
+ })();
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Dane Thurber <dane.thurber@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"rspack-manifest-plugin","author":"Dane Thurber <dane.thurber@gmail.com>","version":"5.0.3","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -0,0 +1 @@
1
+ export = any;