knip 5.32.0 → 5.33.1
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/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/typescript/visitors/exports/exportKeyword.js +3 -1
- package/dist/util/package-json.js +5 -1
- package/dist/util/remove-export.js +12 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -95,7 +95,9 @@ export default visit(() => true, (node, { isFixExports, isFixTypes, isReportClas
|
|
|
95
95
|
identifier: stripQuotes(member.name.getText()),
|
|
96
96
|
pos: member.name.getStart(),
|
|
97
97
|
type: SymbolType.MEMBER,
|
|
98
|
-
fix: isFixTypes
|
|
98
|
+
fix: isFixTypes
|
|
99
|
+
? [member.getStart(), member.getEnd(), FIX_FLAGS.OBJECT_BINDING | FIX_FLAGS.WITH_NEWLINE]
|
|
100
|
+
: undefined,
|
|
99
101
|
}));
|
|
100
102
|
return { node, identifier, type: SymbolType.ENUM, pos, members, fix };
|
|
101
103
|
}
|
|
@@ -31,10 +31,14 @@ export const save = async (filePath, content) => {
|
|
|
31
31
|
await writeFile(filePath, fileContent);
|
|
32
32
|
};
|
|
33
33
|
export const getEntryPathsFromManifest = (manifest, sharedGlobOptions) => {
|
|
34
|
-
const { main, bin, exports, types, typings } = manifest;
|
|
34
|
+
const { main, module, browser, bin, exports, types, typings } = manifest;
|
|
35
35
|
const entryPaths = new Set();
|
|
36
36
|
if (typeof main === 'string')
|
|
37
37
|
entryPaths.add(main);
|
|
38
|
+
if (typeof module === 'string')
|
|
39
|
+
entryPaths.add(module);
|
|
40
|
+
if (typeof browser === 'string')
|
|
41
|
+
entryPaths.add(browser);
|
|
38
42
|
if (bin) {
|
|
39
43
|
if (typeof bin === 'string')
|
|
40
44
|
entryPaths.add(bin);
|
|
@@ -28,20 +28,28 @@ export const removeExport = ({ text, start, end, flags }) => {
|
|
|
28
28
|
if (subject === 'export' || subject === 'export default')
|
|
29
29
|
return beforeStart + afterEnd;
|
|
30
30
|
let closingBracketOffset = -1;
|
|
31
|
-
let
|
|
31
|
+
let removeAfterLength = -1;
|
|
32
32
|
if (flags & FIX_FLAGS.OBJECT_BINDING) {
|
|
33
33
|
let i = 0;
|
|
34
34
|
while (i <= afterEnd.length) {
|
|
35
35
|
const char = afterEnd[i];
|
|
36
36
|
if (char === ',') {
|
|
37
|
-
|
|
37
|
+
removeAfterLength = i + 1;
|
|
38
|
+
}
|
|
39
|
+
else if (flags & FIX_FLAGS.WITH_NEWLINE && (char === '\n' || char === '\r' || char === '\r\n')) {
|
|
40
|
+
removeAfterLength = i + 1;
|
|
38
41
|
}
|
|
39
42
|
else if (char === '}') {
|
|
40
43
|
closingBracketOffset = i + 1;
|
|
44
|
+
if (flags & FIX_FLAGS.WITH_NEWLINE)
|
|
45
|
+
removeAfterLength = i;
|
|
41
46
|
break;
|
|
42
47
|
}
|
|
43
|
-
else if (!/\s/.test(char))
|
|
48
|
+
else if (!/\s/.test(char)) {
|
|
49
|
+
if (flags & FIX_FLAGS.WITH_NEWLINE)
|
|
50
|
+
removeAfterLength = i;
|
|
44
51
|
break;
|
|
52
|
+
}
|
|
45
53
|
i++;
|
|
46
54
|
}
|
|
47
55
|
}
|
|
@@ -64,5 +72,5 @@ export const removeExport = ({ text, start, end, flags }) => {
|
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
return beforeStart + (
|
|
75
|
+
return beforeStart + (removeAfterLength === -1 ? afterEnd : afterEnd.substring(removeAfterLength));
|
|
68
76
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.33.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.33.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.33.1",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"easy-table": "1.2.0",
|
|
67
67
|
"enhanced-resolve": "^5.17.1",
|
|
68
68
|
"fast-glob": "^3.3.2",
|
|
69
|
-
"jiti": "^2.3.
|
|
69
|
+
"jiti": "^2.3.3",
|
|
70
70
|
"js-yaml": "^4.1.0",
|
|
71
71
|
"minimist": "^1.2.8",
|
|
72
72
|
"picocolors": "^1.0.0",
|