knip 2.19.2 → 2.19.3
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.
|
@@ -54,14 +54,24 @@ const findWebpackDependencies = async (configFilePath, { manifest, isProduction
|
|
|
54
54
|
const cfg = typeof config === 'function' ? config(env, argv) : config;
|
|
55
55
|
return [cfg].flat().flatMap(config => {
|
|
56
56
|
const dependencies = (config.module?.rules?.flatMap(resolveRuleSetDependencies) ?? []).map(loader => loader.replace(/\?.*/, ''));
|
|
57
|
-
const entries =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
const entries = [];
|
|
58
|
+
if (typeof cfg.entry === 'string')
|
|
59
|
+
entries.push(cfg.entry);
|
|
60
|
+
else if (Array.isArray(cfg.entry))
|
|
61
|
+
entries.push(...cfg.entry);
|
|
62
|
+
else if (typeof cfg.entry === 'object') {
|
|
63
|
+
Object.values(cfg.entry).map(entry => {
|
|
64
|
+
if (typeof entry === 'string')
|
|
65
|
+
entries.push(entry);
|
|
66
|
+
else if (Array.isArray(entry))
|
|
67
|
+
entries.push(...entry);
|
|
68
|
+
else if (typeof entry === 'function')
|
|
69
|
+
entries.push(entry());
|
|
70
|
+
else if (entry && typeof entry === 'object' && 'filename' in entry)
|
|
71
|
+
entries.push(entry['filename']);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return [...dependencies, ...entries.map(entry => (config.context ? join(config.context, entry) : entry))];
|
|
65
75
|
});
|
|
66
76
|
});
|
|
67
77
|
const scripts = Object.values(manifest.scripts ?? {});
|
|
@@ -20,8 +20,11 @@ export class SourceFileManager {
|
|
|
20
20
|
if (this.sourceFileCache.has(filePath))
|
|
21
21
|
return this.sourceFileCache.get(filePath);
|
|
22
22
|
const contents = ts.sys.readFile(filePath);
|
|
23
|
-
if (typeof contents !== 'string')
|
|
24
|
-
|
|
23
|
+
if (typeof contents !== 'string') {
|
|
24
|
+
if (isInternal(filePath))
|
|
25
|
+
throw new Error(`Unable to read ${filePath}`);
|
|
26
|
+
return this.createSourceFile(filePath, '');
|
|
27
|
+
}
|
|
25
28
|
const ext = extname(filePath);
|
|
26
29
|
const compiler = this.syncCompilers?.get(ext);
|
|
27
30
|
const compiled = compiler ? compiler(contents, filePath) : contents;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.19.
|
|
1
|
+
export declare const version = "2.19.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.19.
|
|
1
|
+
export const version = '2.19.3';
|
package/package.json
CHANGED