@solidjs/start 2.0.0-rc.8 → 2.0.0-rc.9
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.
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,18 @@ function isInvalidForRemoval(path) {
|
|
|
12
12
|
}
|
|
13
13
|
return isPathValid(target, t.isObjectPattern) || isPathValid(target, t.isArrayPattern);
|
|
14
14
|
}
|
|
15
|
+
function countValidImport(node) {
|
|
16
|
+
if (node.importKind === "type") {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
let count = 0;
|
|
20
|
+
for (const specifier of node.specifiers) {
|
|
21
|
+
if (specifier.type !== "ImportSpecifier" || specifier.importKind === "value") {
|
|
22
|
+
count += 1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return count;
|
|
26
|
+
}
|
|
15
27
|
export function removeUnusedVariables(program) {
|
|
16
28
|
// TODO(Alexis):
|
|
17
29
|
// This implementation is simple but slow
|
|
@@ -34,7 +46,7 @@ export function removeUnusedVariables(program) {
|
|
|
34
46
|
if (binding.references === 0 && !binding.path.removed) {
|
|
35
47
|
const parent = binding.path.parentPath;
|
|
36
48
|
if (isPathValid(parent, t.isImportDeclaration)) {
|
|
37
|
-
if (parent.node
|
|
49
|
+
if (countValidImport(parent.node) <= 1) {
|
|
38
50
|
parent.remove();
|
|
39
51
|
}
|
|
40
52
|
else {
|