@@ -66,8 +66,54 @@ const CLASS_DECLARATION = 'ClassDeclaration'
66
66
const DEFAULT = 'default'
67
67
const TYPE_ALIAS = 'TypeAlias'
68
68
69
+ /**
70
+ * List of imports per file.
71
+ *
72
+ * Represented by a two-level Map to a Set of identifiers. The upper-level Map
73
+ * keys are the paths to the modules containing the imports, while the
74
+ * lower-level Map keys are the paths to the files which are being imported
75
+ * from. Lastly, the Set of identifiers contains either names being imported
76
+ * or a special AST node name listed above (e.g ImportDefaultSpecifier).
77
+ *
78
+ * For example, if we have a file named foo.js containing:
79
+ *
80
+ * import { o2 } from './bar.js';
81
+ *
82
+ * Then we will have a structure that looks like:
83
+ *
84
+ * Map { 'foo.js' => Map { 'bar.js' => Set { 'o2' } } }
85
+ *
86
+ * @type {Map<string, Map<string, Set<string>>> }
87
+ */
69
88
const importList = new Map ( )
89
+
90
+ /**
91
+ * List of exports per file.
92
+ *
93
+ * Represented by a two-level Map to an object of metadata. The upper-level Map
94
+ * keys are the paths to the modules containing the exports, while the
95
+ * lower-level Map keys are the specific identifiers or special AST node names
96
+ * being exported. The leaf-level metadata object at the moment only contains a
97
+ * `whereUsed` propoerty, which contains a Set of paths to modules that import
98
+ * the name.
99
+ *
100
+ * For example, if we have a file named bar.js containing the following exports:
101
+ *
102
+ * const o2 = 'bar';
103
+ * export { o2 };
104
+ *
105
+ * And a file named foo.js containing the following import:
106
+ *
107
+ * import { o2 } from './bar.js';
108
+ *
109
+ * Then we will have a structure that looks like:
110
+ *
111
+ * Map { 'bar.js' => Map { 'o2' => { whereUsed: Set { 'foo.js' } } } }
112
+ *
113
+ * @type {Map<string, Map<string, object>> }
114
+ */
70
115
const exportList = new Map ( )
116
+
71
117
const ignoredFiles = new Set ( )
72
118
const filesOutsideSrc = new Set ( )
73
119
0 commit comments