react-native-bundle-discovery-ui 2.6.0 → 2.7.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.
@@ -1,17 +1,11 @@
1
- const { externalLinkHtml } = require("./_common.js");
2
- const {
3
- getTreeModule,
4
- getPackage,
5
- getPackageList,
6
- getCopyToClipboardButton,
7
- } = require("./_common");
8
-
1
+ const require_pages__common = require("./_common.js");
2
+ //#region src/client/pages/package.ts
9
3
  discovery.page.define("package", {
10
4
  view: "context",
11
5
  data: `
12
6
  // Tmp variables
13
7
  $currentPkgName: #.id;
14
- ${getPackage(`$pkg: modules.filter(=> path has "node_modules" and path has $currentPkgName)`)}[0];
8
+ ${require_pages__common.getPackage(`$pkg: modules.filter(=> path has "node_modules" and path has $currentPkgName)`)}[0];
15
9
  $copies: $pkg.pkgInstances.size() - 1;
16
10
  $ver: $pkg.pkgInstances[0].version;
17
11
 
@@ -31,12 +25,6 @@ discovery.page.define("package", {
31
25
  }
32
26
  `,
33
27
  content: [
34
- // TODO uncomment for debugging
35
- // {
36
- // view: "struct",
37
- // data: "$.currentPkg",
38
- // },
39
-
40
28
  {
41
29
  view: "block",
42
30
  content: [
@@ -76,13 +64,12 @@ discovery.page.define("package", {
76
64
  color: "rgba(255, 165, 0, 0.35)"
77
65
  }`,
78
66
  },
79
- getCopyToClipboardButton({
67
+ require_pages__common.getCopyToClipboardButton({
80
68
  textToCopy: `$.currentPkg.pkgName`,
81
69
  className: "m-l-0_5em",
82
70
  }),
83
71
  ],
84
72
  },
85
-
86
73
  {
87
74
  when: "$.currentPkgDeprecated",
88
75
  view: "list",
@@ -96,9 +83,7 @@ discovery.page.define("package", {
96
83
  ],
97
84
  },
98
85
  },
99
-
100
86
  "html: '<br>'",
101
-
102
87
  {
103
88
  view: "block",
104
89
  content: [
@@ -109,7 +94,7 @@ discovery.page.define("package", {
109
94
  data: `{ href: "https://www.npmjs.com/package/" + currentPkgWithUniqVerNpm }`,
110
95
  content: [
111
96
  "text: 'npmjs.com'",
112
- `html: '<span class="my-icon-inline my-icon-12">${externalLinkHtml}</span>'`,
97
+ `html: '<span class="my-icon-inline my-icon-12">${require_pages__common.externalLinkHtml}</span>'`,
113
98
  ],
114
99
  },
115
100
  "text: ' '",
@@ -119,7 +104,7 @@ discovery.page.define("package", {
119
104
  data: `{ href: "https://bundlephobia.com/package/" + currentPkgWithUniqVer }`,
120
105
  content: [
121
106
  "text: 'bundlephobia.com'",
122
- `html: '<span class="my-icon-inline my-icon-12">${externalLinkHtml}</span>'`,
107
+ `html: '<span class="my-icon-inline my-icon-12">${require_pages__common.externalLinkHtml}</span>'`,
123
108
  ],
124
109
  },
125
110
  "text: ' '",
@@ -129,7 +114,7 @@ discovery.page.define("package", {
129
114
  data: `{ href: "https://packagephobia.com/result?p=" + currentPkgWithUniqVer }`,
130
115
  content: [
131
116
  "text: 'packagephobia.com'",
132
- `html: '<span class="my-icon-inline my-icon-12">${externalLinkHtml}</span>'`,
117
+ `html: '<span class="my-icon-inline my-icon-12">${require_pages__common.externalLinkHtml}</span>'`,
133
118
  ],
134
119
  },
135
120
  {
@@ -145,7 +130,6 @@ discovery.page.define("package", {
145
130
  },
146
131
  ],
147
132
  },
148
-
149
133
  {
150
134
  when: "$.currentPkgInstancesWithMetadata",
151
135
  view: "block",
@@ -155,7 +139,10 @@ discovery.page.define("package", {
155
139
  view: "table",
156
140
  data: "$.currentPkgInstancesWithMetadata",
157
141
  cols: [
158
- { header: "Path", content: "text: pkgName" },
142
+ {
143
+ header: "Path",
144
+ content: "text: pkgName",
145
+ },
159
146
  {
160
147
  header: "Version",
161
148
  content: "pill-badge:{ text: 'v' + version, color: '#0af' }",
@@ -205,51 +192,16 @@ discovery.page.define("package", {
205
192
  },
206
193
  ],
207
194
  },
208
-
209
195
  "html: '<hr>'",
210
-
211
196
  {
212
197
  view: "block",
213
- content: getPackageList({
198
+ content: require_pages__common.getPackageList({
214
199
  data: "$.currentPkg",
215
200
  itemPkgName: "text: pkgName",
216
201
  showCopiesBadge: false,
217
202
  expanded: true,
218
203
  }),
219
-
220
- /*[
221
- {
222
- view: "list",
223
- data: "$.currentPkg",
224
- item: {
225
- view: "tree",
226
- expanded: true,
227
- itemConfig: {
228
- content: [
229
- "text: pkgName",
230
- "text: ' '",
231
- "pill-badge:{ text: size.formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }",
232
- ],
233
- children: `$.pkgInstances`,
234
- itemConfig: {
235
- view: "tree-leaf",
236
- content: [
237
- //
238
- "text:pkgName",
239
- "text:' '",
240
- "pill-badge:{ text: 'v' + version, color: '#0af' }",
241
- "pill-badge:{ text: size.formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }",
242
- ],
243
- children: `$.modules`,
244
- itemConfig: {
245
- view: "tree-leaf",
246
- content: getTreeModule({ hasPercent: false }),
247
- },
248
- },
249
- },
250
- },
251
- },
252
- ]*/
253
204
  },
254
205
  ],
255
206
  });
207
+ //#endregion
@@ -0,0 +1,63 @@
1
+ //#region src/client/prepare.ts
2
+ function getDuplicateId(path) {
3
+ const uniqueNodeModulePath = path.split("node_modules/").pop();
4
+ const ids = [uniqueNodeModulePath];
5
+ if (
6
+ uniqueNodeModulePath.startsWith("lodash.") ||
7
+ uniqueNodeModulePath.startsWith("lodash-es/")
8
+ ) {
9
+ const uniqueLodashPath = uniqueNodeModulePath
10
+ .replace("lodash-es/", "lodash/")
11
+ .replace("lodash.", "lodash/")
12
+ .replace("/index.js", ".js");
13
+ ids.push(uniqueLodashPath);
14
+ }
15
+ return ids;
16
+ }
17
+ function prepare(input) {
18
+ const data = input;
19
+ const moduleMap = /* @__PURE__ */ new Map();
20
+ const duplicatesMap = /* @__PURE__ */ new Map();
21
+ const allLodashModules = /* @__PURE__ */ new Set();
22
+ data.packages.forEach((pkg) => {
23
+ pkg.path = pkg.absolutePath.replace(`${data.rootFolder}/`, "");
24
+ });
25
+ data.modules.forEach((m) => {
26
+ m.absolutePath = m.path;
27
+ if (m.absolutePath === data.entryPoint) m.isEntry = true;
28
+ m.path = m.path.replace(`${data.rootFolder}/`, "");
29
+ m.dependencies.forEach((d) => {
30
+ d.path = d.absolutePath.replace(`${data.rootFolder}/`, "");
31
+ });
32
+ m._tmp_ids = getDuplicateId(m.path);
33
+ m.duplicates = [];
34
+ m._tmp_ids.forEach((id) => {
35
+ if (!duplicatesMap.has(id)) duplicatesMap.set(id, []);
36
+ duplicatesMap.get(id).push(m);
37
+ });
38
+ if (m.path.includes("node_modules/lodash")) allLodashModules.add(m);
39
+ m.dependents = [];
40
+ moduleMap.set(m.absolutePath, m);
41
+ if (m.path === "__prelude__")
42
+ m.source.code = m.source.code
43
+ .replaceAll(";", ";\n\n")
44
+ .replaceAll(",", ",\n ");
45
+ });
46
+ data.modules.forEach((m) => {
47
+ m._tmp_ids.forEach((id) => {
48
+ const duplicates = duplicatesMap.get(id);
49
+ if (duplicates.length > 1)
50
+ m.duplicates.push(...duplicates.filter((d) => d !== m));
51
+ });
52
+ if (m.path.endsWith("node_modules/lodash/index.js"))
53
+ m.duplicates.push(...allLodashModules);
54
+ delete m._tmp_ids;
55
+ m.dependencies.forEach((dependency) => {
56
+ const dependentModule = moduleMap.get(dependency.absolutePath);
57
+ if (dependentModule) dependentModule.dependents.push(m);
58
+ });
59
+ });
60
+ return data;
61
+ }
62
+ //#endregion
63
+ module.exports = prepare;
@@ -1,14 +1,12 @@
1
+ //#region src/client/queryHelpers.ts
1
2
  const helpers = {
2
- prettifyMap: new Map(),
3
+ prettifyMap: /* @__PURE__ */ new Map(),
3
4
  prettifyJS(sourceStr) {
4
- if (helpers.prettifyMap.has(sourceStr)) {
5
+ if (helpers.prettifyMap.has(sourceStr))
5
6
  return helpers.prettifyMap.get(sourceStr);
6
- }
7
-
8
7
  const prettier = require("prettier/standalone");
9
8
  const prettierPluginBabel = require("prettier/plugins/babel");
10
9
  const prettierPluginEstree = require("prettier/plugins/estree");
11
-
12
10
  return prettier
13
11
  .format(sourceStr, {
14
12
  parser: "babel",
@@ -23,15 +21,14 @@ const helpers = {
23
21
  });
24
22
  },
25
23
  askChatGPTAboutPackages() {
26
- const prompt = `I have a list of JavaScript packages from my React Native bundle (see below). I want to optimize bundle size by identifying similar or redundant packages — such as multiple versions of similar libraries (e.g., lodash, lodash-es, underscore, etc.), duplicate utilities, or overlapping functionality (e.g., date libraries like moment, dayjs, date-fns).
24
+ return `https://chat.openai.com/?prompt=${encodeURIComponent(`I have a list of JavaScript packages from my React Native bundle (see below). I want to optimize bundle size by identifying similar or redundant packages — such as multiple versions of similar libraries (e.g., lodash, lodash-es, underscore, etc.), duplicate utilities, or overlapping functionality (e.g., date libraries like moment, dayjs, date-fns).
27
25
 
28
26
  Please do the following:
29
27
 
30
28
  1. Group similar or overlapping packages together.
31
29
  2. For each group, suggest which one to keep and which ones to consider removing.
32
30
  3. For each group, provide a regex string that can be used to filter those packages from the list (e.g., in grep, find, or search tools).
33
- 4. Keep the output concise and copy-paste friendly.`;
34
- return `https://chat.openai.com/?prompt=${encodeURIComponent(prompt)}`;
31
+ 4. Keep the output concise and copy-paste friendly.`)}`;
35
32
  },
36
33
  plural(count, [singular, plural]) {
37
34
  return count === 1 ? singular : plural;
@@ -47,11 +44,8 @@ Please do the following:
47
44
  },
48
45
  getModulesName(path) {
49
46
  const modules = path.split("node_modules/");
50
- const lastModule = modules[modules.length - 1];
51
- const [folder, subFolder] = lastModule.split("/");
52
- if (folder.startsWith("@")) {
53
- return `${folder}/${subFolder}`;
54
- }
47
+ const [folder, subFolder] = modules[modules.length - 1].split("/");
48
+ if (folder.startsWith("@")) return `${folder}/${subFolder}`;
55
49
  return folder;
56
50
  },
57
51
  getBestNetworkGraphSize(module, params) {
@@ -74,60 +68,55 @@ Please do the following:
74
68
  module,
75
69
  { maxParentDepth = 2, omitVisitedModules = true } = {},
76
70
  ) {
77
- const queue = [{ module, parentId: "", level: 0 }];
78
- const visited = new Set();
71
+ const queue = [
72
+ {
73
+ module,
74
+ parentId: "",
75
+ level: 0,
76
+ },
77
+ ];
78
+ const visited = /* @__PURE__ */ new Set();
79
79
  const result = [];
80
80
  let entryPointPath = null;
81
81
  const data = [];
82
-
83
82
  while (queue.length > 0) {
84
83
  const { module: currentModule, parentId, level } = queue.shift();
85
-
86
- if (level >= Number(maxParentDepth)) {
87
- break;
88
- }
89
-
84
+ if (level >= Number(maxParentDepth)) break;
90
85
  const id = currentModule.path;
91
-
92
86
  if (omitVisitedModules) {
93
- if (visited.has(id)) {
94
- continue;
95
- }
87
+ if (visited.has(id)) continue;
96
88
  visited.add(id);
97
89
  }
98
-
99
90
  if (parentId) {
100
91
  const isEntryPoint = currentModule.dependents.length === 0;
101
- result.push({ isEntryPoint, id, parentId });
92
+ result.push({
93
+ isEntryPoint,
94
+ id,
95
+ parentId,
96
+ });
102
97
  data.push([parentId, id]);
103
- if (isEntryPoint) {
104
- entryPointPath = id;
105
- }
98
+ if (isEntryPoint) entryPointPath = id;
106
99
  }
107
-
108
- if (Array.isArray(currentModule.dependents)) {
109
- for (const dependentModule of currentModule.dependents) {
100
+ if (Array.isArray(currentModule.dependents))
101
+ for (const dependentModule of currentModule.dependents)
110
102
  queue.push({
111
103
  module: dependentModule,
112
104
  parentId: id,
113
105
  level: level + 1,
114
106
  });
115
- }
116
- }
117
107
  }
118
-
119
108
  if (!entryPointPath) {
120
- for (const item of result) {
109
+ for (const item of result)
121
110
  if (item.isEntryPoint) {
122
111
  entryPointPath = item.id;
123
112
  break;
124
113
  }
125
- }
126
114
  }
127
-
128
- return { entryPointPath, data };
115
+ return {
116
+ entryPointPath,
117
+ data,
118
+ };
129
119
  },
130
-
131
120
  getExtColor(extName) {
132
121
  const colors = {
133
122
  js: "#f1e05a50",
@@ -138,20 +127,18 @@ Please do the following:
138
127
  css: "#563d7c50",
139
128
  png: "#e44b2350",
140
129
  };
141
- return colors[extName] ?? colors["js"];
130
+ return colors[extName] ?? colors.js;
142
131
  },
143
132
  getFileExtension(filename) {
144
133
  const idx = filename.lastIndexOf(".");
145
134
  return idx === -1 ? "js" : filename.slice(idx + 1);
146
135
  },
147
- // "2022-06-14T19:46:38.369Z" -> "2022-06-14"
148
136
  formatDate(isoDate) {
149
137
  return isoDate ? new Date(isoDate).toISOString().slice(0, 10) : "";
150
138
  },
151
- // "2022-06-14T19:46:38.369Z" -> "3 years ago"
152
139
  timeAgo(isoDate) {
153
140
  if (!isoDate) return "";
154
- const days = Math.floor((Date.now() - new Date(isoDate)) / 86_400_000);
141
+ const days = Math.floor((Date.now() - new Date(isoDate).getTime()) / 864e5);
155
142
  const [count, unit] =
156
143
  days >= 365
157
144
  ? [Math.floor(days / 365), ["year", "years"]]
@@ -166,7 +153,7 @@ Please do the following:
166
153
  return Number(value).toFixed(fractionDigits);
167
154
  },
168
155
  percent(value, fractionDigits = 2) {
169
- return (100 * value).toFixed(fractionDigits) + "%";
156
+ return `${(100 * value).toFixed(fractionDigits)}%`;
170
157
  },
171
158
  formatBytes(bytes, decimals) {
172
159
  if (bytes == 0) return "0 Bytes";
@@ -174,87 +161,76 @@ Please do the following:
174
161
  dm = decimals || 2,
175
162
  sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
176
163
  i = Math.floor(Math.log(bytes) / Math.log(k));
177
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
164
+ return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
178
165
  },
179
166
  isPackageImport(moduleName) {
180
167
  return moduleName?.[0] !== ".";
181
168
  },
182
169
  transformFilesList(files, rootFolder, type) {
183
- const nodeModulesMap = { children: {}, size: 0 };
184
- const sourceCodeMap = { children: {}, size: 0 };
185
-
170
+ const nodeModulesMap = {
171
+ children: {},
172
+ size: 0,
173
+ };
174
+ const sourceCodeMap = {
175
+ children: {},
176
+ size: 0,
177
+ };
186
178
  files.forEach(({ path, size }) => {
187
- if (path === "__prelude__") {
188
- path = "node_modules/__prelude__";
189
- }
190
- if (path === "__runtime__") {
191
- path = "node_modules/__runtime__";
192
- }
193
-
194
- const shortPath = path.replace(rootFolder + "/", "");
179
+ if (path === "__prelude__") path = "node_modules/__prelude__";
180
+ if (path === "__runtime__") path = "node_modules/__runtime__";
181
+ const shortPath = path.replace(`${rootFolder}/`, "");
195
182
  const isNodeModule = shortPath.includes("node_modules/");
196
183
  const parts = shortenPath(shortPath, nodeModulesMap).split("/");
197
184
  let current = (isNodeModule ? nodeModulesMap : sourceCodeMap).children;
198
-
199
185
  parts.forEach((part, index) => {
200
- // console.log((" --- xdebug " + index + " ".repeat(50)).substr(0, 40), {
201
- // part,
202
- // parts,
203
- // });
204
- if (!current[part]) {
205
- current[part] = { size: 0, children: {} };
206
- }
207
-
186
+ if (!current[part])
187
+ current[part] = {
188
+ size: 0,
189
+ children: {},
190
+ };
208
191
  if (index === parts.length - 1) {
209
192
  current[part].size = size;
210
193
  current[part].path = shortPath;
211
194
  current[part].fullPath = path;
212
195
  }
213
-
214
196
  current = current[part].children;
215
197
  });
216
198
  });
217
-
218
199
  if (type === "foamtree") {
219
200
  sumSizes(nodeModulesMap);
220
201
  sumSizes(sourceCodeMap);
221
-
222
202
  const sourceCodeGroup = toGroups(sourceCodeMap, "Source Code");
223
203
  const nodeModulesGroup = nodeModulesMap?.children?.node_modules
224
204
  ? toGroups(nodeModulesMap.children.node_modules, "node_modules")
225
205
  : {};
226
-
227
- if (!sourceCodeGroup.groups) {
228
- return nodeModulesGroup;
229
- }
230
- if (!nodeModulesGroup.groups) {
231
- return sourceCodeGroup;
232
- }
233
-
206
+ if (!sourceCodeGroup.groups) return nodeModulesGroup;
207
+ if (!nodeModulesGroup.groups) return sourceCodeGroup;
234
208
  const topLevelNode = { groups: [sourceCodeGroup, nodeModulesGroup] };
235
209
  topLevelNode.weight = topLevelNode.groups.reduce(
236
210
  (acc, group) => acc + group.weight,
237
211
  0,
238
212
  );
239
-
240
213
  return topLevelNode;
241
214
  }
242
-
243
215
  if (type === "highcharts-treemap") {
244
216
  const ROOT_ID_1 = "~";
245
217
  const ROOT_ID_2 = ".";
246
218
  return [
247
- { id: ROOT_ID_1, name: "node_modules" },
248
- { id: ROOT_ID_2, name: "Source Code" },
219
+ {
220
+ id: ROOT_ID_1,
221
+ name: "node_modules",
222
+ },
223
+ {
224
+ id: ROOT_ID_2,
225
+ name: "Source Code",
226
+ },
249
227
  ]
250
228
  .concat(flattenTree(nodeModulesMap.children.node_modules, ROOT_ID_1))
251
229
  .concat(flattenTree(sourceCodeMap, ROOT_ID_2));
252
230
  }
253
-
254
- throw new Error("Unsupported type: " + type);
231
+ throw new Error(`Unsupported type: ${type}`);
255
232
  },
256
233
  };
257
-
258
234
  function flattenTree(
259
235
  node,
260
236
  parentId,
@@ -264,10 +240,9 @@ function flattenTree(
264
240
  overrideParentId,
265
241
  ) {
266
242
  const nodeChildrenCount = Object.keys(node.children);
267
-
268
243
  for (const key of nodeChildrenCount) {
269
244
  const childNode = node.children[key];
270
- const childId = parentId + "/" + key;
245
+ const childId = `${parentId}/${key}`;
271
246
  const childrenCount = Object.keys(childNode.children).length;
272
247
  const hasChildren = childrenCount > 0;
273
248
  const item = {
@@ -275,34 +250,21 @@ function flattenTree(
275
250
  name: prevWasSkipped ? parentId : key,
276
251
  parent: overrideParentId ?? parentId,
277
252
  };
278
-
279
- if (!hasChildren) {
280
- item.value = childNode.size;
281
- }
282
-
283
- if (lvl === 0) {
284
- item.color = Highcharts.getOptions().colors[randomInt(0, 9)];
285
- }
286
-
253
+ if (!hasChildren) item.value = childNode.size;
254
+ if (lvl === 0) item.color = Highcharts.getOptions().colors[randomInt(0, 9)];
287
255
  const skipThisNode = nodeChildrenCount.length === 1 && childrenCount === 1;
288
-
289
- if (!skipThisNode) {
290
- result.push(item);
291
- }
292
-
256
+ if (!skipThisNode) result.push(item);
293
257
  flattenTree(
294
258
  childNode,
295
259
  childId,
296
260
  skipThisNode,
297
261
  lvl + 1,
298
262
  result,
299
- skipThisNode ? (overrideParentId ?? parentId) : undefined,
263
+ skipThisNode ? (overrideParentId ?? parentId) : void 0,
300
264
  );
301
265
  }
302
-
303
266
  return result;
304
267
  }
305
-
306
268
  function sumSizes(node) {
307
269
  const isFile = Object.keys(node.children).length === 0;
308
270
  let totalFiles = isFile ? 1 : 0;
@@ -315,12 +277,13 @@ function sumSizes(node) {
315
277
  node.type = isFile ? "file" : "folder";
316
278
  node.size = totalSize;
317
279
  node.files = totalFiles;
318
- return { totalSize, totalFiles };
280
+ return {
281
+ totalSize,
282
+ totalFiles,
283
+ };
319
284
  }
320
-
321
285
  function toGroups(node, label) {
322
286
  const keys = Object.keys(node.children);
323
-
324
287
  const common = {
325
288
  label,
326
289
  weight: node.size,
@@ -329,47 +292,33 @@ function toGroups(node, label) {
329
292
  type: node.type,
330
293
  size: helpers.formatBytes(node.size),
331
294
  };
332
-
333
- if (keys.length === 0) {
334
- // File
335
- return common;
336
- }
337
-
338
- // Folder
295
+ if (keys.length === 0) return common;
339
296
  return Object.assign(common, {
340
297
  groups: keys.map((key) => toGroups(node.children[key], key)),
341
298
  });
342
299
  }
343
-
344
300
  function randomInt(min, max) {
345
301
  return Math.floor(Math.random() * (max - min + 1)) + min;
346
302
  }
347
-
348
303
  const nm = "node_modules/";
349
304
  function shortenPath(path, nodeModulesMap) {
350
- if (path.startsWith(nm + ".pnpm/")) {
351
- path = path.replaceAll(nm + ".pnpm/", "");
352
- }
353
- let index = path.lastIndexOf(nm);
354
-
305
+ if (path.startsWith(`${nm}.pnpm/`)) path = path.replaceAll(`${nm}.pnpm/`, "");
306
+ const index = path.lastIndexOf(nm);
355
307
  if (index > 0) {
356
308
  const pathWithoutNestedNM = path.slice(index);
357
- // Find the package name after "node_modules/"
358
309
  const firstSlash = pathWithoutNestedNM.indexOf("/");
359
310
  const secondSlash = pathWithoutNestedNM.indexOf("/", firstSlash + 1);
360
311
  const pkgName =
361
312
  secondSlash === -1
362
313
  ? pathWithoutNestedNM.slice(firstSlash + 1)
363
314
  : pathWithoutNestedNM.slice(firstSlash + 1, secondSlash);
364
-
365
315
  if (nodeModulesMap?.children?.node_modules?.children?.[pkgName]) {
366
316
  const parentPackage = helpers.getModulesName(path.slice(0, index));
367
- return nm + parentPackage + " ~ " + pathWithoutNestedNM.slice(nm.length);
317
+ return `${nm + parentPackage} ~ ${pathWithoutNestedNM.slice(13)}`;
368
318
  }
369
-
370
319
  return pathWithoutNestedNM;
371
320
  }
372
321
  return path;
373
322
  }
374
-
323
+ //#endregion
375
324
  module.exports = helpers;
@@ -0,0 +1,9 @@
1
+ const require_prepare = require("./prepare.js");
2
+ const require_queryHelpers = require("./queryHelpers.js");
3
+ //#region src/client/setup.ts
4
+ function setup({ addQueryHelpers, setPrepare }) {
5
+ addQueryHelpers(require_queryHelpers);
6
+ setPrepare(require_prepare);
7
+ }
8
+ //#endregion
9
+ module.exports = setup;
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/client/views/_theme.ts
3
+ function isDark() {
4
+ const isSystemDarkMode = window?.matchMedia?.(
5
+ "(prefers-color-scheme: dark)",
6
+ )?.matches;
7
+ const userMode = localStorage.getItem("discoveryjs:color-scheme");
8
+ return userMode === "auto" ? isSystemDarkMode : userMode === "dark";
9
+ }
10
+ function doTheming(el) {
11
+ const dark = isDark();
12
+ el.classList.add("highcharts-light");
13
+ el.classList[!dark ? "add" : "remove"]("my-light");
14
+ el.classList[dark ? "add" : "remove"]("highcharts-dark");
15
+ }
16
+ if (isDark()) require("../../../vendors/high-contrast-dark.js");
17
+ //#endregion
18
+ exports.doTheming = doTheming;