@rsdoctor/utils 0.0.0-next-20240620044732

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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/cjs/build/envinfo.js +109 -0
  4. package/dist/cjs/build/file/cache.js +67 -0
  5. package/dist/cjs/build/file/index.js +44 -0
  6. package/dist/cjs/build/file/sharding.js +84 -0
  7. package/dist/cjs/build/index.js +50 -0
  8. package/dist/cjs/build/json.js +52 -0
  9. package/dist/cjs/build/process.js +49 -0
  10. package/dist/cjs/build/server.js +127 -0
  11. package/dist/cjs/common/alerts.js +49 -0
  12. package/dist/cjs/common/algorithm.js +60 -0
  13. package/dist/cjs/common/bundle.js +56 -0
  14. package/dist/cjs/common/crypto.js +53 -0
  15. package/dist/cjs/common/data/index.js +299 -0
  16. package/dist/cjs/common/graph/assets.js +322 -0
  17. package/dist/cjs/common/graph/chunk.js +67 -0
  18. package/dist/cjs/common/graph/dependency.js +40 -0
  19. package/dist/cjs/common/graph/entrypoints.js +30 -0
  20. package/dist/cjs/common/graph/index.js +30 -0
  21. package/dist/cjs/common/graph/modules.js +98 -0
  22. package/dist/cjs/common/index.js +80 -0
  23. package/dist/cjs/common/loader.js +261 -0
  24. package/dist/cjs/common/manifest.js +72 -0
  25. package/dist/cjs/common/package.js +97 -0
  26. package/dist/cjs/common/plugin.js +86 -0
  27. package/dist/cjs/common/resolver.js +82 -0
  28. package/dist/cjs/common/rspack.js +37 -0
  29. package/dist/cjs/common/summary.js +34 -0
  30. package/dist/cjs/common/time.js +91 -0
  31. package/dist/cjs/common/url.js +46 -0
  32. package/dist/cjs/error/error.js +236 -0
  33. package/dist/cjs/error/index.js +31 -0
  34. package/dist/cjs/error/transform.js +175 -0
  35. package/dist/cjs/error/utils.js +66 -0
  36. package/dist/cjs/index.js +41 -0
  37. package/dist/cjs/logger.js +51 -0
  38. package/dist/cjs/rule-utils/document/document.js +91 -0
  39. package/dist/cjs/rule-utils/document/index.js +26 -0
  40. package/dist/cjs/rule-utils/document/server.js +42 -0
  41. package/dist/cjs/rule-utils/document/types.js +16 -0
  42. package/dist/cjs/rule-utils/index.js +24 -0
  43. package/dist/cjs/rule-utils/parser/asserts.js +156 -0
  44. package/dist/cjs/rule-utils/parser/index.js +28 -0
  45. package/dist/cjs/rule-utils/parser/parser.js +92 -0
  46. package/dist/cjs/rule-utils/parser/types.js +33 -0
  47. package/dist/cjs/rule-utils/parser/utils.js +197 -0
  48. package/dist/esm/build/envinfo.js +75 -0
  49. package/dist/esm/build/file/cache.js +30 -0
  50. package/dist/esm/build/file/index.js +7 -0
  51. package/dist/esm/build/file/sharding.js +50 -0
  52. package/dist/esm/build/index.js +12 -0
  53. package/dist/esm/build/json.js +28 -0
  54. package/dist/esm/build/process.js +24 -0
  55. package/dist/esm/build/server.js +88 -0
  56. package/dist/esm/common/alerts.js +25 -0
  57. package/dist/esm/common/algorithm.js +33 -0
  58. package/dist/esm/common/bundle.js +30 -0
  59. package/dist/esm/common/crypto.js +28 -0
  60. package/dist/esm/common/data/index.js +265 -0
  61. package/dist/esm/common/graph/assets.js +286 -0
  62. package/dist/esm/common/graph/chunk.js +38 -0
  63. package/dist/esm/common/graph/dependency.js +14 -0
  64. package/dist/esm/common/graph/entrypoints.js +6 -0
  65. package/dist/esm/common/graph/index.js +5 -0
  66. package/dist/esm/common/graph/modules.js +70 -0
  67. package/dist/esm/common/index.js +32 -0
  68. package/dist/esm/common/loader.js +225 -0
  69. package/dist/esm/common/manifest.js +46 -0
  70. package/dist/esm/common/package.js +71 -0
  71. package/dist/esm/common/plugin.js +59 -0
  72. package/dist/esm/common/resolver.js +54 -0
  73. package/dist/esm/common/rspack.js +12 -0
  74. package/dist/esm/common/summary.js +10 -0
  75. package/dist/esm/common/time.js +64 -0
  76. package/dist/esm/common/url.js +20 -0
  77. package/dist/esm/error/error.js +202 -0
  78. package/dist/esm/error/index.js +5 -0
  79. package/dist/esm/error/transform.js +141 -0
  80. package/dist/esm/error/utils.js +40 -0
  81. package/dist/esm/index.js +6 -0
  82. package/dist/esm/logger.js +15 -0
  83. package/dist/esm/rule-utils/document/document.js +67 -0
  84. package/dist/esm/rule-utils/document/index.js +3 -0
  85. package/dist/esm/rule-utils/document/server.js +17 -0
  86. package/dist/esm/rule-utils/document/types.js +0 -0
  87. package/dist/esm/rule-utils/index.js +2 -0
  88. package/dist/esm/rule-utils/parser/asserts.js +132 -0
  89. package/dist/esm/rule-utils/parser/index.js +4 -0
  90. package/dist/esm/rule-utils/parser/parser.js +58 -0
  91. package/dist/esm/rule-utils/parser/types.js +9 -0
  92. package/dist/esm/rule-utils/parser/utils.js +164 -0
  93. package/dist/type/build/envinfo.d.ts +14 -0
  94. package/dist/type/build/envinfo.d.ts.map +1 -0
  95. package/dist/type/build/file/cache.d.ts +6 -0
  96. package/dist/type/build/file/cache.d.ts.map +1 -0
  97. package/dist/type/build/file/index.d.ts +4 -0
  98. package/dist/type/build/file/index.d.ts.map +1 -0
  99. package/dist/type/build/file/sharding.d.ts +23 -0
  100. package/dist/type/build/file/sharding.d.ts.map +1 -0
  101. package/dist/type/build/index.d.ts +6 -0
  102. package/dist/type/build/index.d.ts.map +1 -0
  103. package/dist/type/build/json.d.ts +2 -0
  104. package/dist/type/build/json.d.ts.map +1 -0
  105. package/dist/type/build/process.d.ts +4 -0
  106. package/dist/type/build/process.d.ts.map +1 -0
  107. package/dist/type/build/server.d.ts +16 -0
  108. package/dist/type/build/server.d.ts.map +1 -0
  109. package/dist/type/common/alerts.d.ts +3 -0
  110. package/dist/type/common/alerts.d.ts.map +1 -0
  111. package/dist/type/common/algorithm.d.ts +5 -0
  112. package/dist/type/common/algorithm.d.ts.map +1 -0
  113. package/dist/type/common/bundle.d.ts +4 -0
  114. package/dist/type/common/bundle.d.ts.map +1 -0
  115. package/dist/type/common/crypto.d.ts +3 -0
  116. package/dist/type/common/crypto.d.ts.map +1 -0
  117. package/dist/type/common/data/index.d.ts +11 -0
  118. package/dist/type/common/data/index.d.ts.map +1 -0
  119. package/dist/type/common/graph/assets.d.ts +53 -0
  120. package/dist/type/common/graph/assets.d.ts.map +1 -0
  121. package/dist/type/common/graph/chunk.d.ts +8 -0
  122. package/dist/type/common/graph/chunk.d.ts.map +1 -0
  123. package/dist/type/common/graph/dependency.d.ts +5 -0
  124. package/dist/type/common/graph/dependency.d.ts.map +1 -0
  125. package/dist/type/common/graph/entrypoints.d.ts +3 -0
  126. package/dist/type/common/graph/entrypoints.d.ts.map +1 -0
  127. package/dist/type/common/graph/index.d.ts +6 -0
  128. package/dist/type/common/graph/index.d.ts.map +1 -0
  129. package/dist/type/common/graph/modules.d.ts +10 -0
  130. package/dist/type/common/graph/modules.d.ts.map +1 -0
  131. package/dist/type/common/index.d.ts +16 -0
  132. package/dist/type/common/index.d.ts.map +1 -0
  133. package/dist/type/common/loader.d.ts +19 -0
  134. package/dist/type/common/loader.d.ts.map +1 -0
  135. package/dist/type/common/manifest.d.ts +5 -0
  136. package/dist/type/common/manifest.d.ts.map +1 -0
  137. package/dist/type/common/package.d.ts +8 -0
  138. package/dist/type/common/package.d.ts.map +1 -0
  139. package/dist/type/common/plugin.d.ts +6 -0
  140. package/dist/type/common/plugin.d.ts.map +1 -0
  141. package/dist/type/common/resolver.d.ts +7 -0
  142. package/dist/type/common/resolver.d.ts.map +1 -0
  143. package/dist/type/common/rspack.d.ts +8 -0
  144. package/dist/type/common/rspack.d.ts.map +1 -0
  145. package/dist/type/common/summary.d.ts +7 -0
  146. package/dist/type/common/summary.d.ts.map +1 -0
  147. package/dist/type/common/time.d.ts +5 -0
  148. package/dist/type/common/time.d.ts.map +1 -0
  149. package/dist/type/common/url.d.ts +4 -0
  150. package/dist/type/common/url.d.ts.map +1 -0
  151. package/dist/type/error/error.d.ts +36 -0
  152. package/dist/type/error/error.d.ts.map +1 -0
  153. package/dist/type/error/index.d.ts +3 -0
  154. package/dist/type/error/index.d.ts.map +1 -0
  155. package/dist/type/error/transform.d.ts +4 -0
  156. package/dist/type/error/transform.d.ts.map +1 -0
  157. package/dist/type/error/utils.d.ts +5 -0
  158. package/dist/type/error/utils.d.ts.map +1 -0
  159. package/dist/type/index.d.ts +3 -0
  160. package/dist/type/index.d.ts.map +1 -0
  161. package/dist/type/logger.d.ts +8 -0
  162. package/dist/type/logger.d.ts.map +1 -0
  163. package/dist/type/rule-utils/document/document.d.ts +17 -0
  164. package/dist/type/rule-utils/document/document.d.ts.map +1 -0
  165. package/dist/type/rule-utils/document/index.d.ts +4 -0
  166. package/dist/type/rule-utils/document/index.d.ts.map +1 -0
  167. package/dist/type/rule-utils/document/server.d.ts +5 -0
  168. package/dist/type/rule-utils/document/server.d.ts.map +1 -0
  169. package/dist/type/rule-utils/document/types.d.ts +32 -0
  170. package/dist/type/rule-utils/document/types.d.ts.map +1 -0
  171. package/dist/type/rule-utils/index.d.ts +3 -0
  172. package/dist/type/rule-utils/index.d.ts.map +1 -0
  173. package/dist/type/rule-utils/parser/asserts.d.ts +82 -0
  174. package/dist/type/rule-utils/parser/asserts.d.ts.map +1 -0
  175. package/dist/type/rule-utils/parser/index.d.ts +5 -0
  176. package/dist/type/rule-utils/parser/index.d.ts.map +1 -0
  177. package/dist/type/rule-utils/parser/parser.d.ts +119 -0
  178. package/dist/type/rule-utils/parser/parser.d.ts.map +1 -0
  179. package/dist/type/rule-utils/parser/types.d.ts +31 -0
  180. package/dist/type/rule-utils/parser/types.d.ts.map +1 -0
  181. package/dist/type/rule-utils/parser/utils.d.ts +31 -0
  182. package/dist/type/rule-utils/parser/utils.d.ts.map +1 -0
  183. package/package.json +111 -0
@@ -0,0 +1,322 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var assets_exports = {};
20
+ __export(assets_exports, {
21
+ diffAssetsByExtensions: () => diffAssetsByExtensions,
22
+ diffSize: () => diffSize,
23
+ filterAssets: () => filterAssets,
24
+ filterAssetsByExtensions: () => filterAssetsByExtensions,
25
+ formatAssetName: () => formatAssetName,
26
+ getAssetDetails: () => getAssetDetails,
27
+ getAssetsDiffResult: () => getAssetsDiffResult,
28
+ getAssetsSizeInfo: () => getAssetsSizeInfo,
29
+ getAssetsSummary: () => getAssetsSummary,
30
+ getInitialAssetsSizeInfo: () => getInitialAssetsSizeInfo,
31
+ isAssetMatchExtension: () => isAssetMatchExtension,
32
+ isAssetMatchExtensions: () => isAssetMatchExtensions,
33
+ isInitialAsset: () => isInitialAsset
34
+ });
35
+ module.exports = __toCommonJS(assets_exports);
36
+ var import_types = require("@rsdoctor/types");
37
+ var import_chunk = require("./chunk");
38
+ var import_modules = require("./modules");
39
+ const EXT = "js|css|html";
40
+ const hashPattern = /[a-z|A-Z|0-9]{4,32}/;
41
+ const hashSeparatorPattern = /[-|.]/;
42
+ const fileExtensionPattern = /(?:\.[a-z|A-Z|0-9]{2,}){1,}/;
43
+ const filenamePattern = new RegExp(
44
+ `(.*)${hashSeparatorPattern.source}${hashPattern.source}(${fileExtensionPattern.source})$`
45
+ );
46
+ function formatAssetName(assetName, fileConfig) {
47
+ const splitFilesList = fileConfig?.split(".");
48
+ let outputFileTailName = "";
49
+ let unHashedFileName = assetName;
50
+ if (splitFilesList?.length && splitFilesList.length >= 3 && splitFilesList[splitFilesList.length - 2]?.indexOf("[") < 0 && EXT.indexOf(splitFilesList[splitFilesList.length - 1]) > -1) {
51
+ outputFileTailName = splitFilesList[splitFilesList.length - 2];
52
+ const _regPattern = /(.*)(\.[a-f0-9]{4,32})([^.]*.[^.]+){2,}/g;
53
+ unHashedFileName = assetName.replace(_regPattern, "$1");
54
+ return `${unHashedFileName}.${outputFileTailName}.${assetName.substring(
55
+ assetName.lastIndexOf(".") + 1
56
+ )}`;
57
+ }
58
+ return assetName.replace(filenamePattern, "$1$2");
59
+ }
60
+ function isAssetMatchExtension(asset, ext) {
61
+ return asset.path.slice(-ext.length) === ext;
62
+ }
63
+ function isAssetMatchExtensions(asset, exts) {
64
+ if (!exts.length)
65
+ return false;
66
+ return exts.some((ext) => isAssetMatchExtension(asset, ext));
67
+ }
68
+ function filterAssetsByExtensions(assets, exts) {
69
+ if (typeof exts === "string")
70
+ return assets.filter((e) => isAssetMatchExtension(e, exts));
71
+ if (Array.isArray(exts)) {
72
+ return assets.filter((e) => isAssetMatchExtensions(e, exts));
73
+ }
74
+ return [];
75
+ }
76
+ function filterAssets(assets, filterOrExtensions) {
77
+ if (filterOrExtensions) {
78
+ if (typeof filterOrExtensions === "function") {
79
+ assets = assets.filter(filterOrExtensions);
80
+ } else {
81
+ assets = filterAssetsByExtensions(assets, filterOrExtensions);
82
+ }
83
+ }
84
+ return assets;
85
+ }
86
+ function getAssetsSizeInfo(assets, chunks, options = {}) {
87
+ const { withFileContent = true, filterOrExtensions } = options;
88
+ assets = assets.filter(
89
+ (e) => !isAssetMatchExtensions(e, import_types.Constants.MapExtensions)
90
+ );
91
+ if (filterOrExtensions) {
92
+ assets = filterAssets(assets, filterOrExtensions);
93
+ }
94
+ if (assets.length) {
95
+ return {
96
+ count: assets.length,
97
+ size: assets.reduce((t, c) => t + c.size, 0),
98
+ files: assets.map((e) => ({
99
+ path: e.path,
100
+ size: e.size,
101
+ initial: isInitialAsset(e, chunks),
102
+ content: withFileContent ? e.content : void 0
103
+ }))
104
+ };
105
+ }
106
+ return {
107
+ count: 0,
108
+ size: 0,
109
+ files: []
110
+ };
111
+ }
112
+ function isInitialAsset(asset, chunks) {
113
+ const cks = (0, import_chunk.getChunksByAsset)(asset, chunks);
114
+ return cks.some((e) => Boolean(e.initial));
115
+ }
116
+ function getInitialAssetsSizeInfo(assets, chunks, options = {}) {
117
+ if (options.filterOrExtensions) {
118
+ assets = filterAssets(assets, options.filterOrExtensions);
119
+ }
120
+ return getAssetsSizeInfo(assets, chunks, {
121
+ ...options,
122
+ filterOrExtensions: (asset) => isInitialAsset(asset, chunks)
123
+ });
124
+ }
125
+ function getAssetsDiffResult(baseline, current) {
126
+ return {
127
+ all: {
128
+ total: diffAssetsByExtensions(baseline, current)
129
+ },
130
+ js: {
131
+ total: diffAssetsByExtensions(baseline, current, import_types.Constants.JSExtension),
132
+ initial: diffAssetsByExtensions(
133
+ baseline,
134
+ current,
135
+ import_types.Constants.JSExtension,
136
+ true
137
+ )
138
+ },
139
+ css: {
140
+ total: diffAssetsByExtensions(baseline, current, import_types.Constants.CSSExtension),
141
+ initial: diffAssetsByExtensions(
142
+ baseline,
143
+ current,
144
+ import_types.Constants.CSSExtension,
145
+ true
146
+ )
147
+ },
148
+ imgs: {
149
+ total: diffAssetsByExtensions(baseline, current, import_types.Constants.ImgExtensions)
150
+ },
151
+ html: {
152
+ total: diffAssetsByExtensions(baseline, current, import_types.Constants.HtmlExtension)
153
+ },
154
+ media: {
155
+ total: diffAssetsByExtensions(
156
+ baseline,
157
+ current,
158
+ import_types.Constants.MediaExtensions
159
+ )
160
+ },
161
+ fonts: {
162
+ total: diffAssetsByExtensions(
163
+ baseline,
164
+ current,
165
+ import_types.Constants.FontExtensions
166
+ )
167
+ },
168
+ others: {
169
+ total: diffAssetsByExtensions(
170
+ baseline,
171
+ current,
172
+ (asset) => !isAssetMatchExtensions(
173
+ asset,
174
+ [
175
+ import_types.Constants.JSExtension,
176
+ import_types.Constants.CSSExtension,
177
+ import_types.Constants.HtmlExtension
178
+ ].concat(
179
+ import_types.Constants.ImgExtensions,
180
+ import_types.Constants.MediaExtensions,
181
+ import_types.Constants.FontExtensions,
182
+ import_types.Constants.MapExtensions
183
+ )
184
+ )
185
+ )
186
+ }
187
+ };
188
+ }
189
+ function diffSize(bSize, cSize) {
190
+ const isEqual = bSize === cSize;
191
+ const percent = isEqual ? 0 : bSize === 0 ? 100 : Math.abs(cSize - bSize) / bSize * 100;
192
+ const state = isEqual ? import_types.Client.RsdoctorClientDiffState.Equal : bSize > cSize ? import_types.Client.RsdoctorClientDiffState.Down : import_types.Client.RsdoctorClientDiffState.Up;
193
+ return { percent, state };
194
+ }
195
+ function diffAssetsByExtensions(baseline, current, filterOrExtensions, isInitial = false) {
196
+ const { size: bSize, count: bCount } = isInitial ? getInitialAssetsSizeInfo(baseline.assets, baseline.chunks, {
197
+ filterOrExtensions
198
+ }) : getAssetsSizeInfo(baseline.assets, baseline.chunks, {
199
+ filterOrExtensions
200
+ });
201
+ let cSize;
202
+ let cCount;
203
+ if (baseline === current) {
204
+ cSize = bSize;
205
+ cCount = bCount;
206
+ } else {
207
+ const { size, count } = isInitial ? getInitialAssetsSizeInfo(current.assets, current.chunks, {
208
+ filterOrExtensions
209
+ }) : getAssetsSizeInfo(current.assets, current.chunks, {
210
+ filterOrExtensions
211
+ });
212
+ cSize = size;
213
+ cCount = count;
214
+ }
215
+ const { percent, state } = diffSize(bSize, cSize);
216
+ return {
217
+ size: {
218
+ baseline: bSize,
219
+ current: cSize
220
+ },
221
+ count: {
222
+ baseline: bCount,
223
+ current: cCount
224
+ },
225
+ percent,
226
+ state
227
+ };
228
+ }
229
+ function getAssetsSummary(assets, chunks, options = {}) {
230
+ const jsOpt = {
231
+ ...options,
232
+ filterOrExtensions: import_types.Constants.JSExtension
233
+ };
234
+ const cssOpt = {
235
+ ...options,
236
+ filterOrExtensions: import_types.Constants.CSSExtension
237
+ };
238
+ const imgOpt = {
239
+ ...options,
240
+ filterOrExtensions: import_types.Constants.ImgExtensions
241
+ };
242
+ const htmlOpt = {
243
+ ...options,
244
+ filterOrExtensions: import_types.Constants.HtmlExtension
245
+ };
246
+ const mediaOpt = {
247
+ ...options,
248
+ filterOrExtensions: import_types.Constants.MediaExtensions
249
+ };
250
+ const fontOpt = {
251
+ ...options,
252
+ filterOrExtensions: import_types.Constants.FontExtensions
253
+ };
254
+ const otherOpt = {
255
+ ...options,
256
+ filterOrExtensions: (asset) => !isAssetMatchExtensions(
257
+ asset,
258
+ [
259
+ import_types.Constants.JSExtension,
260
+ import_types.Constants.CSSExtension,
261
+ import_types.Constants.HtmlExtension
262
+ ].concat(
263
+ import_types.Constants.ImgExtensions,
264
+ import_types.Constants.MediaExtensions,
265
+ import_types.Constants.FontExtensions,
266
+ import_types.Constants.MapExtensions
267
+ )
268
+ )
269
+ };
270
+ return {
271
+ all: {
272
+ total: getAssetsSizeInfo(assets, chunks, options)
273
+ },
274
+ js: {
275
+ total: getAssetsSizeInfo(assets, chunks, jsOpt),
276
+ initial: getInitialAssetsSizeInfo(assets, chunks, jsOpt)
277
+ },
278
+ css: {
279
+ total: getAssetsSizeInfo(assets, chunks, cssOpt),
280
+ initial: getInitialAssetsSizeInfo(assets, chunks, cssOpt)
281
+ },
282
+ imgs: {
283
+ total: getAssetsSizeInfo(assets, chunks, imgOpt)
284
+ },
285
+ html: {
286
+ total: getAssetsSizeInfo(assets, chunks, htmlOpt)
287
+ },
288
+ media: {
289
+ total: getAssetsSizeInfo(assets, chunks, mediaOpt)
290
+ },
291
+ fonts: {
292
+ total: getAssetsSizeInfo(assets, chunks, fontOpt)
293
+ },
294
+ others: {
295
+ total: getAssetsSizeInfo(assets, chunks, otherOpt)
296
+ }
297
+ };
298
+ }
299
+ function getAssetDetails(assetPath, assets, chunks, modules) {
300
+ const asset = assets.find((e) => e.path === assetPath);
301
+ return {
302
+ asset,
303
+ chunks: (0, import_chunk.getChunksByAsset)(asset, chunks),
304
+ modules: (0, import_modules.getModulesByAsset)(asset, chunks, modules)
305
+ };
306
+ }
307
+ // Annotate the CommonJS export names for ESM import in node:
308
+ 0 && (module.exports = {
309
+ diffAssetsByExtensions,
310
+ diffSize,
311
+ filterAssets,
312
+ filterAssetsByExtensions,
313
+ formatAssetName,
314
+ getAssetDetails,
315
+ getAssetsDiffResult,
316
+ getAssetsSizeInfo,
317
+ getAssetsSummary,
318
+ getInitialAssetsSizeInfo,
319
+ isAssetMatchExtension,
320
+ isAssetMatchExtensions,
321
+ isInitialAsset
322
+ });
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_exports = {};
20
+ __export(chunk_exports, {
21
+ getChunkByChunkId: () => getChunkByChunkId,
22
+ getChunkIdsByAsset: () => getChunkIdsByAsset,
23
+ getChunksByAsset: () => getChunksByAsset,
24
+ getChunksByChunkIds: () => getChunksByChunkIds,
25
+ getChunksByModule: () => getChunksByModule,
26
+ getChunksByModuleId: () => getChunksByModuleId
27
+ });
28
+ module.exports = __toCommonJS(chunk_exports);
29
+ function getChunkIdsByAsset(asset) {
30
+ if (asset.chunks) {
31
+ return asset.chunks;
32
+ }
33
+ return [];
34
+ }
35
+ function getChunksByModule(module2, chunks) {
36
+ if (module2.chunks.length) {
37
+ return getChunksByChunkIds(module2.chunks, chunks);
38
+ }
39
+ return [];
40
+ }
41
+ function getChunkByChunkId(chunkId, chunks) {
42
+ return chunks.find((e) => e.id === chunkId);
43
+ }
44
+ function getChunksByChunkIds(chunkIds, chunks) {
45
+ if (chunkIds.length) {
46
+ return chunkIds.map((id) => getChunkByChunkId(id, chunks)).filter(Boolean);
47
+ }
48
+ return [];
49
+ }
50
+ function getChunksByAsset(asset, chunks) {
51
+ return getChunksByChunkIds(getChunkIdsByAsset(asset), chunks);
52
+ }
53
+ function getChunksByModuleId(id, modules, chunks) {
54
+ const mod = modules.find((e) => e.id === id);
55
+ if (!mod)
56
+ return [];
57
+ return getChunksByModule(mod, chunks);
58
+ }
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ getChunkByChunkId,
62
+ getChunkIdsByAsset,
63
+ getChunksByAsset,
64
+ getChunksByChunkIds,
65
+ getChunksByModule,
66
+ getChunksByModuleId
67
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var dependency_exports = {};
20
+ __export(dependency_exports, {
21
+ getDependenciesByModule: () => getDependenciesByModule,
22
+ getDependencyByPackageData: () => getDependencyByPackageData,
23
+ getDependencyByResolvedRequest: () => getDependencyByResolvedRequest
24
+ });
25
+ module.exports = __toCommonJS(dependency_exports);
26
+ function getDependencyByPackageData(dep, dependencies) {
27
+ return dependencies.find((item) => item.id === dep.dependencyId);
28
+ }
29
+ function getDependenciesByModule(module2, dependencies) {
30
+ return module2.dependencies.map((id) => dependencies.find((dep) => dep.id === id)).filter(Boolean);
31
+ }
32
+ function getDependencyByResolvedRequest(resolvedRequest, dependencies) {
33
+ return dependencies.find((e) => e.resolvedRequest === resolvedRequest);
34
+ }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ getDependenciesByModule,
38
+ getDependencyByPackageData,
39
+ getDependencyByResolvedRequest
40
+ });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var entrypoints_exports = {};
20
+ __export(entrypoints_exports, {
21
+ getEntryPoints: () => getEntryPoints
22
+ });
23
+ module.exports = __toCommonJS(entrypoints_exports);
24
+ function getEntryPoints(entrypoints) {
25
+ return entrypoints;
26
+ }
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ getEntryPoints
30
+ });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var graph_exports = {};
17
+ module.exports = __toCommonJS(graph_exports);
18
+ __reExport(graph_exports, require("./assets"), module.exports);
19
+ __reExport(graph_exports, require("./chunk"), module.exports);
20
+ __reExport(graph_exports, require("./modules"), module.exports);
21
+ __reExport(graph_exports, require("./dependency"), module.exports);
22
+ __reExport(graph_exports, require("./entrypoints"), module.exports);
23
+ // Annotate the CommonJS export names for ESM import in node:
24
+ 0 && (module.exports = {
25
+ ...require("./assets"),
26
+ ...require("./chunk"),
27
+ ...require("./modules"),
28
+ ...require("./dependency"),
29
+ ...require("./entrypoints")
30
+ });
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var modules_exports = {};
20
+ __export(modules_exports, {
21
+ filterModulesAndDependenciesByPackageDeps: () => filterModulesAndDependenciesByPackageDeps,
22
+ getModuleByDependency: () => getModuleByDependency,
23
+ getModuleDetails: () => getModuleDetails,
24
+ getModuleIdsByChunk: () => getModuleIdsByChunk,
25
+ getModuleIdsByModulesIds: () => getModuleIdsByModulesIds,
26
+ getModulesByAsset: () => getModulesByAsset,
27
+ getModulesByChunk: () => getModulesByChunk,
28
+ getModulesByChunks: () => getModulesByChunks
29
+ });
30
+ module.exports = __toCommonJS(modules_exports);
31
+ var import_chunk = require("./chunk");
32
+ var import_dependency = require("./dependency");
33
+ function getModulesByAsset(asset, chunks, modules) {
34
+ const ids = (0, import_chunk.getChunkIdsByAsset)(asset);
35
+ const cks = (0, import_chunk.getChunksByChunkIds)(ids, chunks);
36
+ const res = getModulesByChunks(cks, modules);
37
+ return res;
38
+ }
39
+ function getModuleIdsByChunk(chunk) {
40
+ const { modules = [] } = chunk;
41
+ return modules;
42
+ }
43
+ function getModuleIdsByModulesIds(moduleIds, modules) {
44
+ return moduleIds.map((id) => modules.find((m) => m.id === id)).filter(Boolean);
45
+ }
46
+ function getModulesByChunk(chunk, modules) {
47
+ const ids = getModuleIdsByChunk(chunk);
48
+ return ids.map((id) => modules.find((e) => e.id === id)).filter(Boolean);
49
+ }
50
+ function getModulesByChunks(chunks, modules) {
51
+ const res = [];
52
+ chunks.forEach((chunk) => {
53
+ getModulesByChunk(chunk, modules).forEach((md) => {
54
+ if (!res.filter((_m) => _m.id === md.id).length)
55
+ res.push(md);
56
+ });
57
+ });
58
+ return res;
59
+ }
60
+ function getModuleByDependency(dep, modules) {
61
+ return modules.find((item) => item.id === dep.module);
62
+ }
63
+ function filterModulesAndDependenciesByPackageDeps(deps, dependencies, modules) {
64
+ const _dependencies = [];
65
+ const _modules = [];
66
+ for (let i = 0; i < deps.length; i++) {
67
+ const dep = (0, import_dependency.getDependencyByPackageData)(deps[i], dependencies);
68
+ if (dep) {
69
+ _dependencies.push(dep);
70
+ const module2 = getModuleByDependency(dep, modules);
71
+ if (module2) {
72
+ _modules.push(module2);
73
+ }
74
+ }
75
+ }
76
+ return {
77
+ dependencies: _dependencies,
78
+ modules: _modules
79
+ };
80
+ }
81
+ function getModuleDetails(moduleId, modules, dependencies) {
82
+ const module2 = modules.find((e) => e.id === moduleId);
83
+ return {
84
+ module: module2,
85
+ dependencies: (0, import_dependency.getDependenciesByModule)(module2, dependencies)
86
+ };
87
+ }
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ filterModulesAndDependenciesByPackageDeps,
91
+ getModuleByDependency,
92
+ getModuleDetails,
93
+ getModuleIdsByChunk,
94
+ getModuleIdsByModulesIds,
95
+ getModulesByAsset,
96
+ getModulesByChunk,
97
+ getModulesByChunks
98
+ });
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var common_exports = {};
30
+ __export(common_exports, {
31
+ Alerts: () => Alerts,
32
+ Algorithm: () => Algorithm,
33
+ Bundle: () => Bundle,
34
+ Crypto: () => Crypto,
35
+ Data: () => Data,
36
+ Graph: () => Graph,
37
+ Loader: () => Loader,
38
+ Manifest: () => Manifest,
39
+ Package: () => Package,
40
+ Plugin: () => Plugin,
41
+ Resolver: () => Resolver,
42
+ Rspack: () => Rspack,
43
+ Summary: () => Summary,
44
+ Time: () => Time,
45
+ Url: () => Url
46
+ });
47
+ module.exports = __toCommonJS(common_exports);
48
+ var Summary = __toESM(require("./summary"));
49
+ var Crypto = __toESM(require("./crypto"));
50
+ var Manifest = __toESM(require("./manifest"));
51
+ var Loader = __toESM(require("./loader"));
52
+ var Time = __toESM(require("./time"));
53
+ var Algorithm = __toESM(require("./algorithm"));
54
+ var Resolver = __toESM(require("./resolver"));
55
+ var Graph = __toESM(require("./graph"));
56
+ var Bundle = __toESM(require("./bundle"));
57
+ var Url = __toESM(require("./url"));
58
+ var Plugin = __toESM(require("./plugin"));
59
+ var Data = __toESM(require("./data"));
60
+ var Alerts = __toESM(require("./alerts"));
61
+ var Rspack = __toESM(require("./rspack"));
62
+ var Package = __toESM(require("./package"));
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ Alerts,
66
+ Algorithm,
67
+ Bundle,
68
+ Crypto,
69
+ Data,
70
+ Graph,
71
+ Loader,
72
+ Manifest,
73
+ Package,
74
+ Plugin,
75
+ Resolver,
76
+ Rspack,
77
+ Summary,
78
+ Time,
79
+ Url
80
+ });