knip 5.2.0 → 5.2.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/IssueFixer.js
CHANGED
|
@@ -46,8 +46,8 @@ export class IssueFixer {
|
|
|
46
46
|
if (exportPositions.length > 0) {
|
|
47
47
|
const sourceFileText = exportPositions.reduce((text, [start, end]) => text.substring(0, start) + text.substring(end), await readFile(filePath, 'utf-8'));
|
|
48
48
|
const withoutEmptyReExports = sourceFileText
|
|
49
|
-
.replaceAll(/export \{[ ,]+\} from ('|")[^'"]+('|");?\n?/g, '')
|
|
50
|
-
.replaceAll(/export \{[ ,]+\};?\n?/g, '');
|
|
49
|
+
.replaceAll(/export \{[ ,]+\} from ('|")[^'"]+('|");?\r?\n?/g, '')
|
|
50
|
+
.replaceAll(/export \{[ ,]+\};?\r?\n?/g, '');
|
|
51
51
|
await writeFile(filePath, withoutEmptyReExports);
|
|
52
52
|
}
|
|
53
53
|
}
|
package/dist/constants.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -434,7 +434,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
434
434
|
if (getReExportingEntryFile(importsForExport, identifier))
|
|
435
435
|
continue;
|
|
436
436
|
}
|
|
437
|
-
exportLookupLog(-1, `Looking up
|
|
437
|
+
exportLookupLog(-1, `Looking up ${identifier} export from`, filePath);
|
|
438
438
|
if (isIdentifierReferenced(filePath, identifier, importsForExport)) {
|
|
439
439
|
if (exportedItem.type === 'enum') {
|
|
440
440
|
exportedItem.members?.forEach(member => {
|
|
@@ -7,8 +7,9 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
7
7
|
const config = ['package.json'];
|
|
8
8
|
const entry = ['mockServiceWorker.js'];
|
|
9
9
|
const resolveEntryPaths = async (localConfig) => {
|
|
10
|
-
const workerDirectory = localConfig?.workerDirectory
|
|
11
|
-
|
|
10
|
+
const workerDirectory = localConfig?.workerDirectory;
|
|
11
|
+
const dir = workerDirectory ? [workerDirectory].flat()[0] : '.';
|
|
12
|
+
return entry.map(pattern => toEntryPattern(join(dir, pattern)));
|
|
12
13
|
};
|
|
13
14
|
export default {
|
|
14
15
|
title,
|
|
@@ -92,20 +92,22 @@ export default visit(() => true, (node, { isFixExports, isFixTypes }) => {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
if (ts.isTypeAliasDeclaration(node)) {
|
|
95
|
+
const identifier = defaultKeyword ? 'default' : node.name.getText();
|
|
95
96
|
const fix = isFixTypes ? [exportKeyword.getStart(), exportKeyword.getEnd() + 1] : undefined;
|
|
96
97
|
return {
|
|
97
98
|
node,
|
|
98
|
-
identifier
|
|
99
|
+
identifier,
|
|
99
100
|
type: SymbolType.TYPE,
|
|
100
101
|
pos: node.name.getStart(),
|
|
101
102
|
fix,
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
105
|
if (ts.isInterfaceDeclaration(node)) {
|
|
106
|
+
const identifier = defaultKeyword ? 'default' : node.name.getText();
|
|
105
107
|
const fix = isFixTypes ? [exportKeyword.getStart(), exportKeyword.getEnd() + 1] : undefined;
|
|
106
108
|
return {
|
|
107
109
|
node,
|
|
108
|
-
identifier
|
|
110
|
+
identifier,
|
|
109
111
|
type: SymbolType.INTERFACE,
|
|
110
112
|
pos: node.name.getStart(),
|
|
111
113
|
fix,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.2.
|
|
1
|
+
export declare const version = "5.2.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.2.
|
|
1
|
+
export const version = '5.2.1';
|