knip 5.71.0 → 5.72.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 (52) hide show
  1. package/dist/ConfigurationChief.d.ts +6 -0
  2. package/dist/ConsoleStreamer.js +1 -1
  3. package/dist/compilers/index.d.ts +10 -0
  4. package/dist/compilers/index.js +3 -0
  5. package/dist/compilers/scss.d.ts +6 -0
  6. package/dist/compilers/scss.js +14 -0
  7. package/dist/graph/analyze.js +19 -8
  8. package/dist/graph-explorer/explorer.d.ts +1 -1
  9. package/dist/graph-explorer/explorer.js +1 -1
  10. package/dist/graph-explorer/operations/{build-trace-tree.d.ts → build-exports-tree.d.ts} +4 -1
  11. package/dist/graph-explorer/operations/build-exports-tree.js +96 -0
  12. package/dist/graph-explorer/operations/is-referenced.js +4 -4
  13. package/dist/graph-explorer/utils.d.ts +1 -2
  14. package/dist/graph-explorer/utils.js +0 -15
  15. package/dist/graph-explorer/walk-down.d.ts +2 -1
  16. package/dist/graph-explorer/walk-down.js +7 -10
  17. package/dist/plugins/index.d.ts +1 -0
  18. package/dist/plugins/index.js +2 -0
  19. package/dist/plugins/rsbuild/index.js +8 -0
  20. package/dist/plugins/rsbuild/types.d.ts +1 -0
  21. package/dist/plugins/storybook/index.js +12 -4
  22. package/dist/plugins/storybook/types.d.ts +5 -0
  23. package/dist/plugins/svgo/index.js +1 -1
  24. package/dist/plugins/svgr/index.d.ts +3 -0
  25. package/dist/plugins/svgr/index.js +24 -0
  26. package/dist/plugins/svgr/types.d.ts +3 -0
  27. package/dist/plugins/svgr/types.js +1 -0
  28. package/dist/plugins/vite/index.js +4 -0
  29. package/dist/plugins/vitest/index.js +1 -1
  30. package/dist/schema/configuration.d.ts +10 -0
  31. package/dist/schema/plugins.d.ts +5 -0
  32. package/dist/schema/plugins.js +1 -0
  33. package/dist/types/PluginNames.d.ts +2 -2
  34. package/dist/types/PluginNames.js +1 -0
  35. package/dist/types/module-graph.d.ts +2 -3
  36. package/dist/typescript/ast-helpers.d.ts +1 -1
  37. package/dist/typescript/ast-helpers.js +0 -3
  38. package/dist/typescript/get-imports-and-exports.js +74 -11
  39. package/dist/typescript/resolve-module-names.js +5 -4
  40. package/dist/util/Performance.js +4 -2
  41. package/dist/util/create-options.d.ts +10 -0
  42. package/dist/util/create-options.js +7 -3
  43. package/dist/util/module-graph.js +0 -1
  44. package/dist/util/resolve.d.ts +3 -2
  45. package/dist/util/resolve.js +25 -2
  46. package/dist/util/trace.d.ts +2 -10
  47. package/dist/util/trace.js +42 -36
  48. package/dist/version.d.ts +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +7 -7
  51. package/schema.json +4 -0
  52. package/dist/graph-explorer/operations/build-trace-tree.js +0 -51
@@ -1,51 +0,0 @@
1
- import { CONTINUE } from '../constants.js';
2
- import { walkDown } from '../walk-down.js';
3
- export const buildExportsTree = (graph, entryPaths, options) => {
4
- const traces = [];
5
- const processFile = (filePath, file) => {
6
- for (const exportId of options.identifier ? [options.identifier] : file.exports.keys()) {
7
- if (!options.identifier || file.exports.has(exportId)) {
8
- const trace = buildExportTree(graph, entryPaths, filePath, exportId);
9
- if (trace)
10
- traces.push(trace);
11
- }
12
- }
13
- };
14
- if (options.filePath) {
15
- const file = graph.get(options.filePath);
16
- if (file)
17
- processFile(options.filePath, file);
18
- }
19
- else {
20
- for (const [filePath, file] of graph)
21
- processFile(filePath, file);
22
- }
23
- return traces;
24
- };
25
- const buildExportTree = (graph, entryPaths, filePath, identifier) => {
26
- const rootNode = {
27
- filePath,
28
- identifier,
29
- hasRef: false,
30
- isEntry: entryPaths.has(filePath),
31
- children: [],
32
- };
33
- const nodeMap = new Map();
34
- nodeMap.set(`${filePath}:${identifier}`, rootNode);
35
- walkDown(graph, filePath, identifier, (sourceFile, sourceId, importingFile, id, isEntry, isReExport) => {
36
- const key = `${importingFile}:${id}`;
37
- const childNode = nodeMap.get(key) ?? {
38
- filePath: importingFile,
39
- identifier: id,
40
- hasRef: !isReExport && Boolean(graph.get(importingFile)?.traceRefs?.has(id)),
41
- isEntry,
42
- children: [],
43
- };
44
- nodeMap.set(key, childNode);
45
- const parentKey = `${sourceFile}:${sourceId}`;
46
- const parentNode = nodeMap.get(parentKey) ?? rootNode;
47
- parentNode.children.push(childNode);
48
- return CONTINUE;
49
- }, entryPaths);
50
- return rootNode;
51
- };