@rsdoctor/components 1.0.2 → 1.1.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.
Files changed (129) hide show
  1. package/dist/components/Alert/change.d.ts +0 -5
  2. package/dist/components/Alert/change.js +63 -14
  3. package/dist/components/Alert/change.js.map +1 -1
  4. package/dist/components/Alert/view.js +47 -10
  5. package/dist/components/Alert/view.js.map +1 -1
  6. package/dist/components/Alerts/overlay.js +7 -2
  7. package/dist/components/Alerts/overlay.js.map +1 -1
  8. package/dist/components/Loader/Analysis/files.js +2 -9
  9. package/dist/components/Loader/Analysis/files.js.map +1 -1
  10. package/dist/components/Loader/executions.js +53 -96
  11. package/dist/components/Loader/executions.js.map +1 -1
  12. package/dist/components/Resolver/analysis.d.ts +1 -1
  13. package/dist/components/Resolver/analysis.js +66 -24
  14. package/dist/components/Resolver/analysis.js.map +1 -1
  15. package/dist/components/base/CodeViewer/index.d.ts +5 -0
  16. package/dist/components/base/CodeViewer/index.js +104 -0
  17. package/dist/components/base/CodeViewer/index.js.map +1 -0
  18. package/dist/components/base/CodeViewer/index.module.js +7 -0
  19. package/dist/components/base/CodeViewer/index.module.js.map +1 -0
  20. package/dist/components/base/CodeViewer/index_module.css +35 -0
  21. package/dist/components/base/CodeViewer/interface.d.ts +45 -0
  22. package/dist/components/base/CodeViewer/useCodeDrawer.d.ts +9 -0
  23. package/dist/components/base/CodeViewer/useCodeDrawer.js +51 -0
  24. package/dist/components/base/CodeViewer/useCodeDrawer.js.map +1 -0
  25. package/dist/components/base/CodeViewer/utils.d.ts +18 -0
  26. package/dist/components/base/CodeViewer/utils.js +185 -0
  27. package/dist/components/base/CodeViewer/utils.js.map +1 -0
  28. package/dist/components/base/DiffViewer/index.d.ts +5 -0
  29. package/dist/components/base/DiffViewer/index.js +99 -0
  30. package/dist/components/base/DiffViewer/index.js.map +1 -0
  31. package/dist/components/base/DiffViewer/index.module.js +7 -0
  32. package/dist/components/base/DiffViewer/index.module.js.map +1 -0
  33. package/dist/components/base/DiffViewer/index_module.css +29 -0
  34. package/dist/components/base/DiffViewer/interface.d.ts +47 -0
  35. package/dist/components/base/DiffViewer/interface.js +0 -0
  36. package/dist/components/base/DiffViewer/useDiffDrawer.d.ts +9 -0
  37. package/dist/components/base/DiffViewer/useDiffDrawer.js +54 -0
  38. package/dist/components/base/DiffViewer/useDiffDrawer.js.map +1 -0
  39. package/dist/components/base/DiffViewer/utils.d.ts +7 -0
  40. package/dist/components/base/DiffViewer/utils.js +52 -0
  41. package/dist/components/base/DiffViewer/utils.js.map +1 -0
  42. package/dist/components/base/index.d.ts +5 -0
  43. package/dist/components/base/index.js +4 -0
  44. package/dist/components/base/index.js.map +1 -0
  45. package/dist/components/index.d.ts +4 -5
  46. package/dist/components/index.js +4 -5
  47. package/dist/components/index.js.map +1 -1
  48. package/dist/pages/BundleSize/components/asset.js +13 -23
  49. package/dist/pages/BundleSize/components/asset.js.map +1 -1
  50. package/dist/pages/BundleSize/components/index.js +254 -249
  51. package/dist/pages/BundleSize/components/index.js.map +1 -1
  52. package/dist/pages/Resources/BundleDiff/DiffContainer/changes.js +15 -15
  53. package/dist/pages/Resources/BundleDiff/DiffContainer/changes.js.map +1 -1
  54. package/dist/pages/TreeShaking/editor.js +12 -8
  55. package/dist/pages/TreeShaking/editor.js.map +1 -1
  56. package/dist/pages/TreeShaking/index.js +2 -2
  57. package/dist/pages/TreeShaking/index.js.map +1 -1
  58. package/dist/pages/TreeShaking/utils.d.ts +1 -1
  59. package/dist/pages/TreeShaking/utils.js +8 -11
  60. package/dist/pages/TreeShaking/utils.js.map +1 -1
  61. package/dist/utils/index.d.ts +1 -2
  62. package/dist/utils/index.js +1 -2
  63. package/dist/utils/index.js.map +1 -1
  64. package/package.json +13 -10
  65. package/dist/components/BundleDiff/DiffContainer/assets.d.ts +0 -7
  66. package/dist/components/BundleDiff/DiffContainer/assets.js +0 -509
  67. package/dist/components/BundleDiff/DiffContainer/assets.js.map +0 -1
  68. package/dist/components/BundleDiff/DiffContainer/cards.d.ts +0 -3
  69. package/dist/components/BundleDiff/DiffContainer/cards.js +0 -158
  70. package/dist/components/BundleDiff/DiffContainer/cards.js.map +0 -1
  71. package/dist/components/BundleDiff/DiffContainer/changes.d.ts +0 -15
  72. package/dist/components/BundleDiff/DiffContainer/changes.js +0 -71
  73. package/dist/components/BundleDiff/DiffContainer/changes.js.map +0 -1
  74. package/dist/components/BundleDiff/DiffContainer/constants.d.ts +0 -11
  75. package/dist/components/BundleDiff/DiffContainer/constants.js +0 -19
  76. package/dist/components/BundleDiff/DiffContainer/constants.js.map +0 -1
  77. package/dist/components/BundleDiff/DiffContainer/diff.d.ts +0 -23
  78. package/dist/components/BundleDiff/DiffContainer/diff.js +0 -116
  79. package/dist/components/BundleDiff/DiffContainer/diff.js.map +0 -1
  80. package/dist/components/BundleDiff/DiffContainer/index.d.ts +0 -3
  81. package/dist/components/BundleDiff/DiffContainer/index.js +0 -182
  82. package/dist/components/BundleDiff/DiffContainer/index.js.map +0 -1
  83. package/dist/components/BundleDiff/DiffContainer/modules.d.ts +0 -8
  84. package/dist/components/BundleDiff/DiffContainer/modules.js +0 -304
  85. package/dist/components/BundleDiff/DiffContainer/modules.js.map +0 -1
  86. package/dist/components/BundleDiff/DiffContainer/overview.d.ts +0 -5
  87. package/dist/components/BundleDiff/DiffContainer/overview.js +0 -180
  88. package/dist/components/BundleDiff/DiffContainer/overview.js.map +0 -1
  89. package/dist/components/BundleDiff/DiffContainer/packages.d.ts +0 -19
  90. package/dist/components/BundleDiff/DiffContainer/packages.js +0 -332
  91. package/dist/components/BundleDiff/DiffContainer/packages.js.map +0 -1
  92. package/dist/components/BundleDiff/DiffContainer/row.d.ts +0 -9
  93. package/dist/components/BundleDiff/DiffContainer/row.js +0 -371
  94. package/dist/components/BundleDiff/DiffContainer/row.js.map +0 -1
  95. package/dist/components/BundleDiff/DiffContainer/types.d.ts +0 -44
  96. package/dist/components/BundleDiff/DiffContainer/utils.d.ts +0 -2
  97. package/dist/components/BundleDiff/DiffContainer/utils.js +0 -26
  98. package/dist/components/BundleDiff/DiffContainer/utils.js.map +0 -1
  99. package/dist/components/BundleDiff/DiffServerAPIProvider/index.d.ts +0 -3
  100. package/dist/components/BundleDiff/DiffServerAPIProvider/index.js +0 -39
  101. package/dist/components/BundleDiff/DiffServerAPIProvider/index.js.map +0 -1
  102. package/dist/components/BundleDiff/constants.d.ts +0 -11
  103. package/dist/components/BundleDiff/constants.js +0 -21
  104. package/dist/components/BundleDiff/constants.js.map +0 -1
  105. package/dist/components/BundleDiff/index.d.ts +0 -1
  106. package/dist/components/BundleDiff/index.js +0 -3
  107. package/dist/components/BundleDiff/index.js.map +0 -1
  108. package/dist/components/CodeViewer/config.d.ts +0 -2
  109. package/dist/components/CodeViewer/config.js +0 -20
  110. package/dist/components/CodeViewer/config.js.map +0 -1
  111. package/dist/components/CodeViewer/diff.d.ts +0 -11
  112. package/dist/components/CodeViewer/diff.js +0 -56
  113. package/dist/components/CodeViewer/diff.js.map +0 -1
  114. package/dist/components/CodeViewer/highlight.d.ts +0 -10
  115. package/dist/components/CodeViewer/highlight.js +0 -94
  116. package/dist/components/CodeViewer/highlight.js.map +0 -1
  117. package/dist/components/CodeViewer/index.d.ts +0 -4
  118. package/dist/components/CodeViewer/index.js +0 -6
  119. package/dist/components/CodeViewer/index.js.map +0 -1
  120. package/dist/components/CodeViewer/viewer.d.ts +0 -14
  121. package/dist/components/CodeViewer/viewer.js +0 -63
  122. package/dist/components/CodeViewer/viewer.js.map +0 -1
  123. package/dist/pages/BundleSize/components/editor.d.ts +0 -5
  124. package/dist/pages/BundleSize/components/editor.js +0 -40
  125. package/dist/pages/BundleSize/components/editor.js.map +0 -1
  126. package/dist/utils/monaco.d.ts +0 -12
  127. package/dist/utils/monaco.js +0 -78
  128. package/dist/utils/monaco.js.map +0 -1
  129. /package/dist/components/{BundleDiff/DiffContainer/types.js → base/CodeViewer/interface.js} +0 -0
@@ -1,371 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { InfoCircleOutlined, SearchOutlined } from "@ant-design/icons";
3
- import {
4
- beautifyModulePath,
5
- formatPercent,
6
- formatSize
7
- } from "@rsdoctor/components/utils";
8
- import { Client } from "@rsdoctor/types";
9
- import { Graph } from "@rsdoctor/utils/common";
10
- import {
11
- Button,
12
- Divider,
13
- Input,
14
- Space,
15
- Table,
16
- Tag,
17
- Tooltip,
18
- Typography
19
- } from "antd";
20
- import { upperFirst } from "lodash-es";
21
- import { useMemo, useRef, useState } from "react";
22
- import { ViewChanges } from "./changes";
23
- import { UpdateType } from "./constants";
24
- import { FileUpdateTypeTag, getUpdateType } from "./modules";
25
- import { formatDiffSize } from "./utils";
26
- import { Color } from "../../../constants";
27
- const ModuleHashPattern = /[a-fA-F0-9]{20,}/;
28
- const getSizeColumnPropsForModuleRow = (key, sizeKey) => {
29
- return {
30
- width: 200,
31
- sorter: (a, b) => (a[key]?.size[sizeKey] || 0) - (b[key]?.size[sizeKey] || 0),
32
- render: (_v, r) => {
33
- if (!r[key])
34
- return "-";
35
- const size = r[key].size[sizeKey];
36
- return /* @__PURE__ */ jsxs(Space, { children: [
37
- /* @__PURE__ */ jsx(Typography.Text, { children: formatSize(size) }),
38
- key === "current" ? formatDiffSize(
39
- r.baseline?.size[sizeKey] || 0,
40
- size,
41
- (r.baseline?.size[sizeKey] || 0) > size ? Client.RsdoctorClientDiffState.Down : Client.RsdoctorClientDiffState.Up
42
- ) : null
43
- ] });
44
- }
45
- };
46
- };
47
- const getTargetColumnPropsForModuleRow = (key, bModulesCount, cModulesCount) => {
48
- const isB = key === "baseline";
49
- return {
50
- title: () => {
51
- const count = isB ? bModulesCount : cModulesCount;
52
- const title = upperFirst(key);
53
- const diff = Graph.diffSize(bModulesCount, cModulesCount);
54
- return /* @__PURE__ */ jsxs("div", { children: [
55
- /* @__PURE__ */ jsx(Typography.Text, { children: title }),
56
- /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
57
- /* @__PURE__ */ jsx(
58
- Tooltip,
59
- {
60
- title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
61
- /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
62
- title,
63
- " modules is ",
64
- count
65
- ] }),
66
- isB ? null : /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
67
- "Percent is ",
68
- formatPercent(diff.percent)
69
- ] })
70
- ] }),
71
- children: /* @__PURE__ */ jsxs(Space, { children: [
72
- /* @__PURE__ */ jsx(
73
- Typography.Text,
74
- {
75
- type: "secondary",
76
- style: { fontSize: 10, fontWeight: 400 },
77
- children: count
78
- }
79
- ),
80
- /* @__PURE__ */ jsx(InfoCircleOutlined, {})
81
- ] })
82
- }
83
- )
84
- ] });
85
- },
86
- children: [
87
- {
88
- title: "Source Size",
89
- ...getSizeColumnPropsForModuleRow(key, "sourceSize")
90
- },
91
- {
92
- title: "Parsed Size",
93
- defaultSortOrder: isB ? void 0 : "descend",
94
- ...getSizeColumnPropsForModuleRow(key, "parsedSize")
95
- }
96
- ],
97
- filterSearch: true,
98
- filters: [
99
- {
100
- text: "Show Changed",
101
- value: UpdateType.NotChanged
102
- },
103
- {
104
- text: "Show All",
105
- value: "All"
106
- }
107
- ],
108
- onFilter(v, r) {
109
- return v === UpdateType.NotChanged ? getUpdateType(r) !== v : true;
110
- }
111
- };
112
- };
113
- const ModuleRowForAsset = ({ data, baseline, current }) => {
114
- const { modules: bTotalModules } = baseline.moduleGraph;
115
- const { modules: cTotalModules } = current.moduleGraph;
116
- const { chunks: bToTalChunks } = baseline.chunkGraph;
117
- const { chunks: cToTalChunks } = current.chunkGraph;
118
- const bRoot = baseline.root;
119
- const cRoot = current.root;
120
- const [searchText, setSearchText] = useState("");
121
- const searchInput = useRef(null);
122
- const handleSearch = (selectedKeys, confirm) => {
123
- confirm();
124
- setSearchText(selectedKeys[0]);
125
- };
126
- const handleReset = (clearFilters) => {
127
- clearFilters();
128
- setSearchText("");
129
- };
130
- const isBaseline = "__is_baseline__";
131
- const bModules = useMemo(
132
- () => data.baseline ? Graph.getModulesByAsset(data.baseline, bToTalChunks, bTotalModules).map((e) => ({
133
- ...e,
134
- [isBaseline]: true
135
- })).filter((cModule) => !cModule.concatenationModules?.length) : [],
136
- [data, baseline]
137
- );
138
- const cModules = useMemo(
139
- () => data.current ? Graph.getModulesByAsset(data.current, cToTalChunks, cTotalModules).map((e) => ({
140
- ...e,
141
- [isBaseline]: false
142
- })).filter((cModule) => !cModule.concatenationModules?.length) : [],
143
- [data, current]
144
- );
145
- const getPathInfo = (r) => beautifyModulePath(r.path, r[isBaseline] ? bRoot : cRoot);
146
- const dataSource = useMemo(() => {
147
- const mods = [...bModules, ...cModules];
148
- const map = /* @__PURE__ */ new Map();
149
- mods.forEach((mod) => {
150
- const modPath = mod.webpackId?.replace(ModuleHashPattern, "") || mod.path?.replace(ModuleHashPattern, "");
151
- let t = map.get(modPath);
152
- if (!t) {
153
- t = { path: modPath };
154
- }
155
- if (mod[isBaseline]) {
156
- t.baseline = mod;
157
- } else {
158
- t.current = mod;
159
- }
160
- map.set(modPath, t);
161
- });
162
- return [...map.values()];
163
- }, [bModules, cModules, searchText]);
164
- const { bModulesCount, cModulesCount, totalCount } = useMemo(() => {
165
- const fileNameFilter = (e) => getPathInfo(e).alias.indexOf(searchText) > -1;
166
- let b = dataSource.filter((e) => e.baseline);
167
- let c = dataSource.filter((e) => e.current);
168
- let totalCount2 = dataSource.length;
169
- if (searchText) {
170
- b = b.filter(fileNameFilter);
171
- c = c.filter(fileNameFilter);
172
- totalCount2 = dataSource.filter(fileNameFilter).length;
173
- }
174
- return {
175
- bModulesCount: b.length,
176
- cModulesCount: c.length,
177
- totalCount: totalCount2
178
- };
179
- }, [dataSource, searchText]);
180
- return /* @__PURE__ */ jsx(
181
- Table,
182
- {
183
- dataSource,
184
- rowKey: (e) => e.path,
185
- size: "small",
186
- pagination: {
187
- size: "small"
188
- },
189
- bordered: true,
190
- scroll: { x: 1500 },
191
- columns: [
192
- {
193
- fixed: "left",
194
- title: () => {
195
- return /* @__PURE__ */ jsxs("div", { children: [
196
- /* @__PURE__ */ jsxs(Typography.Text, { children: [
197
- "Modules of ",
198
- `"${data.alias}"`
199
- ] }),
200
- /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
201
- /* @__PURE__ */ jsxs(
202
- Tooltip,
203
- {
204
- title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
205
- /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
206
- "filtered modules: ",
207
- totalCount
208
- ] }),
209
- /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
210
- "total modules: ",
211
- dataSource.length
212
- ] })
213
- ] }),
214
- children: [
215
- /* @__PURE__ */ jsxs(
216
- Typography.Text,
217
- {
218
- type: "secondary",
219
- style: { fontSize: 10, fontWeight: 400, marginRight: 4 },
220
- children: [
221
- totalCount,
222
- "/",
223
- dataSource.length
224
- ]
225
- }
226
- ),
227
- /* @__PURE__ */ jsx(InfoCircleOutlined, {})
228
- ]
229
- }
230
- )
231
- ] });
232
- },
233
- filterDropdown({
234
- setSelectedKeys,
235
- selectedKeys,
236
- confirm,
237
- clearFilters
238
- }) {
239
- return /* @__PURE__ */ jsxs(
240
- "div",
241
- {
242
- style: { padding: 8 },
243
- onKeyDown: (e) => e.stopPropagation(),
244
- children: [
245
- /* @__PURE__ */ jsx(
246
- Input,
247
- {
248
- ref: searchInput,
249
- placeholder: `Search by file name`,
250
- value: selectedKeys[0],
251
- onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
252
- onPressEnter: () => handleSearch(selectedKeys, confirm),
253
- style: { marginBottom: 8, display: "block" }
254
- }
255
- ),
256
- /* @__PURE__ */ jsxs(Space, { children: [
257
- /* @__PURE__ */ jsx(
258
- Button,
259
- {
260
- type: "primary",
261
- onClick: () => handleSearch(selectedKeys, confirm),
262
- icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
263
- size: "small",
264
- style: { width: 90 },
265
- children: "Search"
266
- }
267
- ),
268
- /* @__PURE__ */ jsx(
269
- Button,
270
- {
271
- onClick: () => {
272
- clearFilters && handleReset(clearFilters);
273
- setSelectedKeys([]);
274
- handleSearch([], confirm);
275
- },
276
- size: "small",
277
- style: { width: 90 },
278
- children: "Reset"
279
- }
280
- )
281
- ] })
282
- ]
283
- }
284
- );
285
- },
286
- filterSearch: true,
287
- filterIcon: (filtered) => /* @__PURE__ */ jsxs(Space, { children: [
288
- /* @__PURE__ */ jsx(
289
- Typography.Text,
290
- {
291
- type: searchText ? void 0 : "secondary",
292
- style: { fontWeight: 400 },
293
- children: searchText || "Search by file name"
294
- }
295
- ),
296
- /* @__PURE__ */ jsx(
297
- SearchOutlined,
298
- {
299
- style: { color: filtered ? Color.Blue : void 0 }
300
- }
301
- )
302
- ] }),
303
- onFilterDropdownOpenChange: (visible) => {
304
- if (visible) {
305
- setTimeout(() => searchInput.current?.focus(), 100);
306
- }
307
- },
308
- onFilter(v, r) {
309
- return getPathInfo(r).alias.indexOf(v) > -1;
310
- },
311
- render: (_v, r) => {
312
- const { alias, inNodeModules } = getPathInfo(r);
313
- return /* @__PURE__ */ jsxs(Space, { children: [
314
- /* @__PURE__ */ jsx(Tooltip, { title: r.path, children: /* @__PURE__ */ jsx(Typography.Text, { copyable: { text: r.path }, children: alias }) }),
315
- inNodeModules ? /* @__PURE__ */ jsx(Tag, { color: "warning", children: "node_modules" }) : null,
316
- /* @__PURE__ */ jsx(FileUpdateTypeTag, { type: getUpdateType(r) })
317
- ] });
318
- }
319
- },
320
- getTargetColumnPropsForModuleRow(
321
- "current",
322
- bModulesCount,
323
- cModulesCount
324
- ),
325
- getTargetColumnPropsForModuleRow(
326
- "baseline",
327
- bModulesCount,
328
- cModulesCount
329
- ),
330
- {
331
- title: "Actions",
332
- width: 200,
333
- render: (_v, r) => {
334
- return /* @__PURE__ */ jsx(Space, { direction: "vertical", style: { maxWidth: 170 }, children: /* @__PURE__ */ jsx(
335
- ViewChanges,
336
- {
337
- text: "View Changes",
338
- file: r.path,
339
- data: [
340
- {
341
- baseline: baseline.moduleCodeMap[r.baseline?.id]?.source,
342
- current: current.moduleCodeMap[r.current?.id]?.source,
343
- group: "Source"
344
- },
345
- {
346
- baseline: baseline.moduleCodeMap[r.baseline?.id]?.transformed,
347
- current: current.moduleCodeMap[r.current?.id]?.transformed,
348
- group: "Transformed Source"
349
- },
350
- {
351
- baseline: baseline.moduleCodeMap[r.baseline?.id]?.parsedSource,
352
- current: current.moduleCodeMap[r.current?.id]?.parsedSource,
353
- group: "Parsed Source"
354
- }
355
- ]
356
- }
357
- ) });
358
- }
359
- }
360
- ]
361
- }
362
- );
363
- };
364
- export {
365
- ModuleHashPattern,
366
- ModuleRowForAsset,
367
- getSizeColumnPropsForModuleRow,
368
- getTargetColumnPropsForModuleRow
369
- };
370
-
371
- //# sourceMappingURL=row.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAmDQ,SACE,KADF;AAnDR,SAAS,oBAAoB,sBAAsB;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,kBAAkB;AAC3B,SAAgB,SAAS,QAAQ,gBAAgB;AACjD,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB,qBAAqB;AAMjD,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AAEf,MAAM,oBAAoB;AAE1B,MAAM,iCAAiC,CAC5C,KACA,YAC2C;AAC3C,SAAO;AAAA,IACL,OAAO;AAAA,IACP,QAAQ,CAAC,GAAG,OACT,EAAE,GAAG,GAAG,KAAK,OAAO,KAAK,MAAM,EAAE,GAAG,GAAG,KAAK,OAAO,KAAK;AAAA,IAC3D,Q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N,SACE,QAAQ,cAAc,EAAE,SAAS,EAAY,GAAG;AAAA,oBAClD,OAAO;AAAA,kBACT;AAAA,kBACA;AAAA,oBACE,UACE,SAAS,cAAc,EAAE,UAAU,EAAY,GAC3C;AAAA,oBACN,SACE,QAAQ,cAAc,EAAE,SAAS,EAAY,GACzC;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,kBACA;AAAA,oBACE,UACE,SAAS,cAAc,EAAE,UAAU,EAAY,GAC3C;AAAA,oBACN,SACE,QAAQ,cAAc,EAAE,SAAS,EAAY,GACzC;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,gBACF;AAAA;AAAA,YACF,GACF;AAAA,UAEJ;AAAA,QACF;AAAA,MACF;AAAA;AAAA,EACF;AAEJ","names":["totalCount"],"ignoreList":[],"sources":["../../../../src/components/BundleDiff/DiffContainer/row.tsx"],"sourcesContent":["import { InfoCircleOutlined, SearchOutlined } from '@ant-design/icons';\nimport {\n beautifyModulePath,\n formatPercent,\n formatSize,\n} from '@rsdoctor/components/utils';\nimport { Client } from '@rsdoctor/types';\nimport { Graph } from '@rsdoctor/utils/common';\nimport {\n Button,\n Divider,\n Input,\n InputRef,\n Space,\n Table,\n Tag,\n Tooltip,\n Typography,\n} from 'antd';\nimport {\n ColumnGroupType,\n ColumnType,\n FilterConfirmProps,\n} from 'antd/es/table/interface';\nimport { upperFirst } from 'lodash-es';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { ViewChanges } from './changes';\nimport { UpdateType } from './constants';\nimport { FileUpdateTypeTag, getUpdateType } from './modules';\nimport {\n BundleDiffComponentCardProps,\n BundleDiffTableAssetsData,\n BundleDiffTableModulesData,\n} from './types';\nimport { formatDiffSize } from './utils';\nimport { Color } from '../../../constants';\n\nexport const ModuleHashPattern = /[a-fA-F0-9]{20,}/;\n\nexport const getSizeColumnPropsForModuleRow = (\n key: 'baseline' | 'current',\n sizeKey: 'parsedSize' | 'sourceSize',\n): ColumnType<BundleDiffTableModulesData> => {\n return {\n width: 200,\n sorter: (a, b) =>\n (a[key]?.size[sizeKey] || 0) - (b[key]?.size[sizeKey] || 0),\n render: (_v, r) => {\n if (!r[key]) return '-';\n const size = r[key]!.size[sizeKey];\n return (\n <Space>\n <Typography.Text>{formatSize(size)}</Typography.Text>\n {/* {key === 'current' ? <SizePercent baseline={r.baseline?.size[sizeKey] || 0} current={size} /> : null} */}\n {key === 'current'\n ? formatDiffSize(\n r.baseline?.size[sizeKey] || 0,\n size,\n (r.baseline?.size[sizeKey] || 0) > size\n ? Client.RsdoctorClientDiffState.Down\n : Client.RsdoctorClientDiffState.Up,\n )\n : null}\n </Space>\n );\n },\n };\n};\n\nexport const getTargetColumnPropsForModuleRow = (\n key: 'baseline' | 'current',\n bModulesCount: number,\n cModulesCount: number,\n): ColumnGroupType<BundleDiffTableModulesData> => {\n const isB = key === 'baseline';\n return {\n title: () => {\n const count = isB ? bModulesCount : cModulesCount;\n const title = upperFirst(key);\n const diff = Graph.diffSize(bModulesCount, cModulesCount);\n return (\n <div>\n <Typography.Text>{title}</Typography.Text>\n <Divider type=\"vertical\" />\n <Tooltip\n title={\n <Space direction=\"vertical\">\n <Typography.Text style={{ color: 'inherit' }}>\n {title} modules is {count}\n </Typography.Text>\n {isB ? null : (\n <Typography.Text style={{ color: 'inherit' }}>\n Percent is {formatPercent(diff.percent)}\n </Typography.Text>\n )}\n </Space>\n }\n >\n <Space>\n <Typography.Text\n type=\"secondary\"\n style={{ fontSize: 10, fontWeight: 400 }}\n >\n {count}\n </Typography.Text>\n <InfoCircleOutlined />\n </Space>\n </Tooltip>\n </div>\n );\n },\n children: [\n {\n title: 'Source Size',\n ...getSizeColumnPropsForModuleRow(key, 'sourceSize'),\n },\n {\n title: 'Parsed Size',\n defaultSortOrder: isB ? undefined : 'descend',\n ...getSizeColumnPropsForModuleRow(key, 'parsedSize'),\n },\n ],\n filterSearch: true,\n filters: [\n {\n text: 'Show Changed',\n value: UpdateType.NotChanged,\n },\n {\n text: 'Show All',\n value: 'All',\n },\n ],\n onFilter(v, r) {\n return v === UpdateType.NotChanged ? getUpdateType(r) !== v : true;\n },\n };\n};\n\nexport const ModuleRowForAsset: React.FC<\n { data: BundleDiffTableAssetsData } & Pick<\n BundleDiffComponentCardProps,\n 'baseline' | 'current'\n >\n> = ({ data, baseline, current }) => {\n const { modules: bTotalModules } = baseline.moduleGraph;\n const { modules: cTotalModules } = current.moduleGraph;\n const { chunks: bToTalChunks } = baseline.chunkGraph;\n const { chunks: cToTalChunks } = current.chunkGraph;\n const bRoot = baseline.root;\n const cRoot = current.root;\n\n const [searchText, setSearchText] = useState('');\n const searchInput = useRef<InputRef>(null);\n\n const handleSearch = (\n selectedKeys: string[],\n confirm: (param?: FilterConfirmProps) => void,\n ) => {\n confirm();\n setSearchText(selectedKeys[0]);\n };\n\n const handleReset = (clearFilters: () => void) => {\n clearFilters();\n setSearchText('');\n };\n\n const isBaseline = '__is_baseline__' as const;\n\n const bModules = useMemo(\n () =>\n data.baseline\n ? Graph.getModulesByAsset(data.baseline, bToTalChunks, bTotalModules)\n .map((e) => ({\n ...e,\n [isBaseline]: true,\n }))\n .filter((cModule) => !cModule.concatenationModules?.length)\n : [],\n [data, baseline],\n );\n const cModules = useMemo(\n () =>\n data.current\n ? Graph.getModulesByAsset(data.current, cToTalChunks, cTotalModules)\n .map((e) => ({\n ...e,\n [isBaseline]: false,\n }))\n .filter((cModule) => !cModule.concatenationModules?.length)\n : [],\n [data, current],\n );\n\n const getPathInfo = (r: BundleDiffTableModulesData) =>\n beautifyModulePath(r.path, r[isBaseline] ? bRoot : cRoot);\n\n const dataSource: BundleDiffTableModulesData[] = useMemo(() => {\n const mods = [...bModules, ...cModules];\n const map = new Map<string, BundleDiffTableModulesData>();\n\n // group by module.path\n mods.forEach((mod) => {\n const modPath =\n mod.webpackId?.replace(ModuleHashPattern, '') ||\n mod.path?.replace(ModuleHashPattern, '');\n let t: BundleDiffTableModulesData = map.get(modPath)!;\n\n if (!t) {\n t = { path: modPath };\n }\n\n if (mod[isBaseline]) {\n t.baseline = mod;\n } else {\n t.current = mod;\n }\n map.set(modPath, t);\n });\n\n return [...map.values()];\n }, [bModules, cModules, searchText]);\n\n const { bModulesCount, cModulesCount, totalCount } = useMemo(() => {\n const fileNameFilter = (e: BundleDiffTableModulesData) =>\n getPathInfo(e).alias.indexOf(searchText) > -1;\n\n let b = dataSource.filter((e) => e.baseline);\n let c = dataSource.filter((e) => e.current);\n let totalCount = dataSource.length;\n\n if (searchText) {\n b = b.filter(fileNameFilter);\n c = c.filter(fileNameFilter);\n totalCount = dataSource.filter(fileNameFilter).length;\n }\n\n return {\n bModulesCount: b.length,\n cModulesCount: c.length,\n totalCount,\n };\n }, [dataSource, searchText]);\n\n return (\n <Table\n dataSource={dataSource}\n rowKey={(e) => e.path}\n size=\"small\"\n pagination={{\n size: 'small',\n }}\n bordered\n scroll={{ x: 1500 }}\n columns={[\n {\n fixed: 'left',\n title: () => {\n return (\n <div>\n <Typography.Text>\n Modules of {`\"${data.alias}\"`}\n </Typography.Text>\n <Divider type=\"vertical\" />\n <Tooltip\n title={\n <Space direction=\"vertical\">\n <Typography.Text style={{ color: 'inherit' }}>\n filtered modules: {totalCount}\n </Typography.Text>\n <Typography.Text style={{ color: 'inherit' }}>\n total modules: {dataSource.length}\n </Typography.Text>\n </Space>\n }\n >\n <Typography.Text\n type=\"secondary\"\n style={{ fontSize: 10, fontWeight: 400, marginRight: 4 }}\n >\n {totalCount}/{dataSource.length}\n </Typography.Text>\n <InfoCircleOutlined />\n </Tooltip>\n </div>\n );\n },\n filterDropdown({\n setSelectedKeys,\n selectedKeys,\n confirm,\n clearFilters,\n }) {\n return (\n <div\n style={{ padding: 8 }}\n onKeyDown={(e) => e.stopPropagation()}\n >\n <Input\n ref={searchInput}\n placeholder={`Search by file name`}\n value={selectedKeys[0] as string | number}\n onChange={(e) =>\n setSelectedKeys(e.target.value ? [e.target.value] : [])\n }\n onPressEnter={() =>\n handleSearch(selectedKeys as string[], confirm)\n }\n style={{ marginBottom: 8, display: 'block' }}\n />\n <Space>\n <Button\n type=\"primary\"\n onClick={() =>\n handleSearch(selectedKeys as string[], confirm)\n }\n icon={<SearchOutlined />}\n size=\"small\"\n style={{ width: 90 }}\n >\n Search\n </Button>\n <Button\n onClick={() => {\n clearFilters && handleReset(clearFilters);\n setSelectedKeys([]);\n handleSearch([], confirm);\n }}\n size=\"small\"\n style={{ width: 90 }}\n >\n Reset\n </Button>\n </Space>\n </div>\n );\n },\n filterSearch: true,\n filterIcon: (filtered) => (\n <Space>\n <Typography.Text\n type={searchText ? undefined : 'secondary'}\n style={{ fontWeight: 400 }}\n >\n {searchText || 'Search by file name'}\n </Typography.Text>\n <SearchOutlined\n style={{ color: filtered ? Color.Blue : undefined }}\n />\n </Space>\n ),\n onFilterDropdownOpenChange: (visible) => {\n if (visible) {\n setTimeout(() => searchInput.current?.focus(), 100);\n }\n },\n onFilter(v, r) {\n return getPathInfo(r).alias.indexOf(v as string) > -1;\n },\n render: (_v, r) => {\n const { alias, inNodeModules } = getPathInfo(r);\n return (\n <Space>\n <Tooltip title={r.path}>\n <Typography.Text copyable={{ text: r.path }}>\n {alias}\n </Typography.Text>\n </Tooltip>\n {inNodeModules ? <Tag color=\"warning\">node_modules</Tag> : null}\n <FileUpdateTypeTag type={getUpdateType(r)} />\n </Space>\n );\n },\n },\n getTargetColumnPropsForModuleRow(\n 'current',\n bModulesCount,\n cModulesCount,\n ),\n getTargetColumnPropsForModuleRow(\n 'baseline',\n bModulesCount,\n cModulesCount,\n ),\n {\n title: 'Actions',\n width: 200,\n render: (_v, r) => {\n return (\n <Space direction=\"vertical\" style={{ maxWidth: 170 }}>\n <ViewChanges\n text=\"View Changes\"\n file={r.path}\n data={[\n {\n baseline:\n baseline.moduleCodeMap[r.baseline?.id as number]\n ?.source,\n current:\n current.moduleCodeMap[r.current?.id as number]?.source,\n group: 'Source',\n },\n {\n baseline:\n baseline.moduleCodeMap[r.baseline?.id as number]\n ?.transformed,\n current:\n current.moduleCodeMap[r.current?.id as number]\n ?.transformed,\n group: 'Transformed Source',\n },\n {\n baseline:\n baseline.moduleCodeMap[r.baseline?.id as number]\n ?.parsedSource,\n current:\n current.moduleCodeMap[r.current?.id as number]\n ?.parsedSource,\n group: 'Parsed Source',\n },\n ]}\n />\n </Space>\n );\n },\n },\n ]}\n />\n );\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IiIsIm5hbWVzIjpbXSwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W119"]}
@@ -1,44 +0,0 @@
1
- import { Client, Manifest, SDK } from '@rsdoctor/types';
2
- import { UpdateType } from './constants';
3
- import { InferServerAPIBody } from '../../Manifest';
4
- export type BundleDiffServerAPIProviderComponentCommonProps<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends> = {
5
- manifests?: Manifest.RsdoctorManifest[];
6
- api: T;
7
- children: (baseline: SDK.ServerAPI.InferResponseType<T>, current: SDK.ServerAPI.InferResponseType<T>) => JSX.Element;
8
- } & InferServerAPIBody<T>;
9
- export interface BundleDiffContainerProps {
10
- manifests: Manifest.RsdoctorManifest[];
11
- }
12
- export interface BundleDiffComponentCommonProps {
13
- baseline: Manifest.RsdoctorManifest;
14
- current: Manifest.RsdoctorManifest;
15
- onlyBaseline: boolean;
16
- assetsDiffResult: Client.RsdoctorClientAssetsDiffResult;
17
- }
18
- export interface BundleDiffComponentCardProps {
19
- baseline: SDK.ServerAPI.ResponseTypes[SDK.ServerAPI.API.GetBundleDiffSummary];
20
- current: SDK.ServerAPI.ResponseTypes[SDK.ServerAPI.API.GetBundleDiffSummary];
21
- onlyBaseline: boolean;
22
- assetsDiffResult: Client.RsdoctorClientAssetsDiffResult;
23
- }
24
- export interface BundleDiffTableOverviewData {
25
- total: Client.RsdoctorClientAssetsDiffItem;
26
- initial?: Client.RsdoctorClientAssetsDiffItem;
27
- }
28
- export interface BundleDiffTableAssetsData {
29
- alias: string;
30
- baseline?: SDK.AssetData;
31
- current?: SDK.AssetData;
32
- }
33
- export interface BundleDiffTableModulesData {
34
- [key: string]: unknown;
35
- path: string;
36
- baseline?: SDK.ModuleData;
37
- current?: SDK.ModuleData;
38
- }
39
- export interface BundleDiffTablePackagesData {
40
- name: string;
41
- updateType: UpdateType;
42
- baseline?: SDK.PackageData[];
43
- current?: SDK.PackageData[];
44
- }
@@ -1,2 +0,0 @@
1
- import { Client } from '@rsdoctor/types';
2
- export declare const formatDiffSize: (bSize: number, cSize: number, state: Client.RsdoctorClientDiffState, propsStyle?: Record<string, string | number>) => import("react/jsx-runtime").JSX.Element;
@@ -1,26 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { formatSize } from "@rsdoctor/components/utils";
3
- import { Client } from "@rsdoctor/types";
4
- import { Typography } from "antd";
5
- import { Color } from "../../../constants";
6
- const formatDiffSize = (bSize, cSize, state, propsStyle) => {
7
- return /* @__PURE__ */ jsx(Fragment, { children: cSize - bSize === 0 ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsxs(
8
- Typography.Text,
9
- {
10
- strong: true,
11
- style: {
12
- color: state === Client.RsdoctorClientDiffState.Up ? Color.Red : Color.Green,
13
- ...propsStyle
14
- },
15
- children: [
16
- state === Client.RsdoctorClientDiffState.Up ? "+" : "-",
17
- formatSize(Math.abs(cSize - bSize))
18
- ]
19
- }
20
- ) });
21
- };
22
- export {
23
- formatDiffSize
24
- };
25
-
26
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAcQ,wBAEA,YAFA;AAdR,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAEf,MAAM,iBAAiB,CAC5B,OACA,OACA,OACA,eACG;AACH,SACE,gCACG,kBAAQ,UAAU,IACjB,gCAAE,IAEF;AAAA,IAAC,WAAW;AAAA,IAAX;AAAA,MACC,QAAM;AAAA,MACN,OAAO;AAAA,QACL,OACE,UAAU,OAAO,wBAAwB,KACrC,MAAM,MACN,MAAM;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,MAEC;AAAA,kBAAU,OAAO,wBAAwB,KAAK,MAAM;AAAA,QACpD,WAAW,KAAK,IAAI,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,EACrC,GAEJ;AAEJ","names":[],"ignoreList":[],"sources":["../../../../src/components/BundleDiff/DiffContainer/utils.tsx"],"sourcesContent":["import { formatSize } from '@rsdoctor/components/utils';\nimport { Client } from '@rsdoctor/types';\nimport { Typography } from 'antd';\nimport { Color } from '../../../constants';\n\nexport const formatDiffSize = (\n bSize: number,\n cSize: number,\n state: Client.RsdoctorClientDiffState,\n propsStyle?: Record<string, string | number>,\n) => {\n return (\n <>\n {cSize - bSize === 0 ? (\n <></>\n ) : (\n <Typography.Text\n strong\n style={{\n color:\n state === Client.RsdoctorClientDiffState.Up\n ? Color.Red\n : Color.Green,\n ...propsStyle,\n }}\n >\n {state === Client.RsdoctorClientDiffState.Up ? '+' : '-'}\n {formatSize(Math.abs(cSize - bSize))}\n </Typography.Text>\n )}\n </>\n );\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IiIsIm5hbWVzIjpbXSwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W119"]}
@@ -1,3 +0,0 @@
1
- import { SDK } from '@rsdoctor/types';
2
- import { BundleDiffServerAPIProviderComponentCommonProps } from '../DiffContainer/types';
3
- export declare const DiffServerAPIProvider: <T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(props: BundleDiffServerAPIProviderComponentCommonProps<T>) => JSX.Element;
@@ -1,39 +0,0 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { Client } from "@rsdoctor/types";
3
- import { Empty } from "antd";
4
- import { ServerAPIProvider } from "../../Manifest";
5
- import { useUrlQuery, fetchManifest } from "../../../utils";
6
- const DiffServerAPIProvider = (props) => {
7
- const { api, body, children, manifests } = props;
8
- const query = useUrlQuery();
9
- const [baselineFile, currentFile] = query[Client.RsdoctorClientUrlQuery.BundleDiffFiles]?.split(",") || [];
10
- if (manifests?.length) {
11
- return /* @__PURE__ */ jsx(Fragment, { children: children(manifests[0].data, manifests[1].data) });
12
- }
13
- return /* @__PURE__ */ jsx(
14
- ServerAPIProvider,
15
- {
16
- api,
17
- body,
18
- manifestLoader: baselineFile ? () => fetchManifest(baselineFile) : void 0,
19
- children: (baseline) => {
20
- return baseline ? /* @__PURE__ */ jsx(
21
- ServerAPIProvider,
22
- {
23
- api,
24
- body,
25
- manifestLoader: currentFile ? () => fetchManifest(currentFile) : void 0,
26
- children: (current) => {
27
- return current ? children(baseline, current) : /* @__PURE__ */ jsx(Empty, {});
28
- }
29
- }
30
- ) : /* @__PURE__ */ jsx(Empty, {});
31
- }
32
- }
33
- );
34
- };
35
- export {
36
- DiffServerAPIProvider
37
- };
38
-
39
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAkBW;AAlBX,SAAS,cAAmB;AAE5B,SAAS,aAAa;AACtB,SAAS,yBAAyB;AAClC,SAAS,aAAa,qBAAqB;AAEpC,MAAM,wBAAwB,CAGnC,UACgB;AAChB,QAAM,EAAE,KAAK,MAAM,UAAU,UAAU,IAAI;AAC3C,QAAM,QAAQ,YAAY;AAC1B,QAAM,CAAC,cAAc,WAAW,IAC9B,MAAM,OAAO,uBAAuB,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAEvE,MAAI,WAAW,QAAQ;AAErB,WAAO,gCAAG,mBAAS,UAAU,CAAC,EAAE,MAAa,UAAU,CAAC,EAAE,IAAW,GAAE;AAAA,EACzE;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,gBACE,eAAe,MAAM,cAAc,YAAY,IAAI;AAAA,MAGpD,WAAC,aAAa;AACb,eAAO,WACL;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,gBACE,cAAc,MAAM,cAAc,WAAW,IAAI;AAAA,YAGlD,WAAC,YAAY;AACZ,qBAAO,UAAU,SAAS,UAAU,OAAO,IAAI,oBAAC,SAAM;AAAA,YACxD;AAAA;AAAA,QACF,IAEA,oBAAC,SAAM;AAAA,MAEX;AAAA;AAAA,EACF;AAEJ","names":[],"ignoreList":[],"sources":["../../../../src/components/BundleDiff/DiffServerAPIProvider/index.tsx"],"sourcesContent":["import { Client, SDK } from '@rsdoctor/types';\nimport { BundleDiffServerAPIProviderComponentCommonProps } from '../DiffContainer/types';\nimport { Empty } from 'antd';\nimport { ServerAPIProvider } from '../../Manifest';\nimport { useUrlQuery, fetchManifest } from '../../../utils';\n\nexport const DiffServerAPIProvider = <\n T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends,\n>(\n props: BundleDiffServerAPIProviderComponentCommonProps<T>,\n): JSX.Element => {\n const { api, body, children, manifests } = props;\n const query = useUrlQuery();\n const [baselineFile, currentFile] =\n query[Client.RsdoctorClientUrlQuery.BundleDiffFiles]?.split(',') || [];\n\n if (manifests?.length) {\n // 兼容 webpack stats 场景\n return <>{children(manifests[0].data as any, manifests[1].data as any)}</>;\n }\n\n return (\n <ServerAPIProvider\n api={api}\n body={body}\n manifestLoader={\n baselineFile ? () => fetchManifest(baselineFile) : undefined\n }\n >\n {(baseline) => {\n return baseline ? (\n <ServerAPIProvider\n api={api}\n body={body}\n manifestLoader={\n currentFile ? () => fetchManifest(currentFile) : undefined\n }\n >\n {(current) => {\n return current ? children(baseline, current) : <Empty />;\n }}\n </ServerAPIProvider>\n ) : (\n <Empty />\n );\n }}\n </ServerAPIProvider>\n );\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IiIsIm5hbWVzIjpbXSwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W119"]}
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { Client, Manifest } from '@rsdoctor/types';
3
- export declare const name = "Bundle Diff";
4
- export declare const route = Client.RsdoctorClientRoutes.BundleDiff;
5
- export declare const BundleDiffContext: React.Context<{
6
- manifests: Manifest.RsdoctorManifest[];
7
- setManifests(_manifests: Manifest.RsdoctorManifest[]): void;
8
- loading: boolean;
9
- setLoading(_loading: boolean): void;
10
- withLoading(_func: (...args: unknown[]) => Promise<unknown> | unknown): Promise<void>;
11
- }>;
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- import { Client } from "@rsdoctor/types";
3
- const name = "Bundle Diff";
4
- const route = Client.RsdoctorClientRoutes.BundleDiff;
5
- const BundleDiffContext = React.createContext({
6
- manifests: [],
7
- setManifests(_manifests) {
8
- },
9
- loading: false,
10
- setLoading(_loading) {
11
- },
12
- async withLoading(_func) {
13
- }
14
- });
15
- export {
16
- BundleDiffContext,
17
- name,
18
- route
19
- };
20
-
21
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,cAAwB;AAE1B,MAAM,OAAO;AAEb,MAAM,QAAQ,OAAO,qBAAqB;AAE1C,MAAM,oBAAoB,MAAM,cAAc;AAAA,EACnD,WAAW,CAAC;AAAA,EACZ,aAAa,YAA+C;AAAA,EAAC;AAAA,EAC7D,SAAS;AAAA,EACT,WAAW,UAAyB;AAAA,EAAC;AAAA,EACrC,MAAM,YACJ,OACA;AAAA,EAAC;AACL,CAAC","names":[],"ignoreList":[],"sources":["../../../src/components/BundleDiff/constants.tsx"],"sourcesContent":["import React from 'react';\nimport { Client, Manifest } from '@rsdoctor/types';\n\nexport const name = 'Bundle Diff';\n\nexport const route = Client.RsdoctorClientRoutes.BundleDiff;\n\nexport const BundleDiffContext = React.createContext({\n manifests: [] as Manifest.RsdoctorManifest[],\n setManifests(_manifests: Manifest.RsdoctorManifest[]): void {},\n loading: false,\n setLoading(_loading: boolean): void {},\n async withLoading(\n _func: (...args: unknown[]) => Promise<unknown> | unknown,\n ) {},\n});\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IiIsIm5hbWVzIjpbXSwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W119"]}
@@ -1 +0,0 @@
1
- export * from './DiffContainer';
@@ -1,3 +0,0 @@
1
- export * from "./DiffContainer";
2
-
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAAA,cAAc","names":[],"ignoreList":[],"sources":["../../../src/components/BundleDiff/index.ts"],"sourcesContent":["export * from './DiffContainer';\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IiIsIm5hbWVzIjpbXSwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W119"]}
@@ -1,2 +0,0 @@
1
- import type { editor } from 'monaco-editor';
2
- export declare const DefaultEditorConfig: editor.IStandaloneEditorConstructionOptions;
@@ -1,20 +0,0 @@
1
- const DefaultEditorConfig = {
2
- readOnly: true,
3
- domReadOnly: true,
4
- fontSize: 12,
5
- renderValidationDecorations: "off",
6
- hideCursorInOverviewRuler: true,
7
- smoothScrolling: true,
8
- wordWrap: "bounded",
9
- colorDecorators: true,
10
- codeLens: false,
11
- cursorWidth: 0,
12
- minimap: {
13
- enabled: false
14
- }
15
- };
16
- export {
17
- DefaultEditorConfig
18
- };
19
-
20
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAEO,MAAM,sBAAmE;AAAA,EAC9E,UAAU;AAAA,EACV,aAAa;AAAA,EACb,UAAU;AAAA,EACV,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,SAAS;AAAA,IACP,SAAS;AAAA,EACX;AACF","names":[],"ignoreList":[],"sources":["../../../src/components/CodeViewer/config.ts"],"sourcesContent":["import type { editor } from 'monaco-editor';\n\nexport const DefaultEditorConfig: editor.IStandaloneEditorConstructionOptions = {\n readOnly: true,\n domReadOnly: true,\n fontSize: 12,\n renderValidationDecorations: 'off',\n hideCursorInOverviewRuler: true,\n smoothScrolling: true,\n wordWrap: 'bounded',\n colorDecorators: true,\n codeLens: false,\n cursorWidth: 0,\n minimap: {\n enabled: false,\n },\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IiIsIm5hbWVzIjpbXSwiaWdub3JlTGlzdCI6W10sInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W119"]}
@@ -1,11 +0,0 @@
1
- import { DiffEditorProps } from '@monaco-editor/react';
2
- import React from 'react';
3
- interface DiffViewerProps {
4
- before: string;
5
- after: string;
6
- filepath: string;
7
- className?: string;
8
- editorProps?: DiffEditorProps;
9
- }
10
- export declare const DiffViewer: React.FC<DiffViewerProps>;
11
- export {};