knip 6.6.3 → 6.8.0
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/ConfigurationChief.d.ts +6 -0
- package/dist/ConsoleStreamer.d.ts +4 -0
- package/dist/ConsoleStreamer.js +18 -0
- package/dist/IssueFixer.js +7 -2
- package/dist/WorkspaceWorker.js +23 -9
- package/dist/binaries/resolvers/index.d.ts +2 -0
- package/dist/binaries/resolvers/index.js +2 -0
- package/dist/binaries/resolvers/pnpm.js +18 -0
- package/dist/cli.js +1 -1
- package/dist/compilers/index.d.ts +10 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/vitest/helpers.js +2 -0
- package/dist/plugins/wxt/index.d.ts +3 -0
- package/dist/plugins/wxt/index.js +27 -0
- package/dist/plugins/wxt/types.d.ts +3 -0
- package/dist/plugins/wxt/types.js +1 -0
- package/dist/reporters/markdown.js +5 -3
- package/dist/schema/configuration.d.ts +15 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/typescript/visitors/imports.js +4 -3
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/create-options.js +2 -2
- package/dist/util/errors.d.ts +1 -0
- package/dist/util/errors.js +6 -0
- package/dist/util/fs.js +1 -1
- package/dist/util/log.d.ts +2 -2
- package/dist/util/log.js +4 -4
- package/dist/util/map-workspaces.js +8 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -776,6 +776,11 @@ export declare class ConfigurationChief {
|
|
|
776
776
|
entry?: string | string[] | undefined;
|
|
777
777
|
project?: string | string[] | undefined;
|
|
778
778
|
} | undefined;
|
|
779
|
+
wxt?: string | boolean | string[] | {
|
|
780
|
+
config?: string | string[] | undefined;
|
|
781
|
+
entry?: string | string[] | undefined;
|
|
782
|
+
project?: string | string[] | undefined;
|
|
783
|
+
} | undefined;
|
|
779
784
|
xo?: string | boolean | string[] | {
|
|
780
785
|
config?: string | string[] | undefined;
|
|
781
786
|
entry?: string | string[] | undefined;
|
|
@@ -963,6 +968,7 @@ export declare class ConfigurationChief {
|
|
|
963
968
|
webpack?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
964
969
|
wireit?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
965
970
|
wrangler?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
971
|
+
wxt?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
966
972
|
xo?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
967
973
|
yarn?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
968
974
|
yorkie?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -3,9 +3,13 @@ export declare class ConsoleStreamer {
|
|
|
3
3
|
isEnabled: boolean;
|
|
4
4
|
isWatch: boolean;
|
|
5
5
|
private lines;
|
|
6
|
+
private stdoutBaseline;
|
|
7
|
+
private stderrBaseline;
|
|
6
8
|
constructor(options: MainOptions);
|
|
7
9
|
private clearLines;
|
|
8
10
|
private clearScreen;
|
|
11
|
+
private snapshot;
|
|
12
|
+
private hadExternalWrites;
|
|
9
13
|
private update;
|
|
10
14
|
cast(message: string | string[], sub?: string): void;
|
|
11
15
|
clear(): void;
|
package/dist/ConsoleStreamer.js
CHANGED
|
@@ -2,9 +2,12 @@ export class ConsoleStreamer {
|
|
|
2
2
|
isEnabled = false;
|
|
3
3
|
isWatch = false;
|
|
4
4
|
lines = 0;
|
|
5
|
+
stdoutBaseline = 0;
|
|
6
|
+
stderrBaseline = 0;
|
|
5
7
|
constructor(options) {
|
|
6
8
|
this.isEnabled = options.isShowProgress;
|
|
7
9
|
this.isWatch = options.isWatch;
|
|
10
|
+
this.snapshot();
|
|
8
11
|
}
|
|
9
12
|
clearLines(count) {
|
|
10
13
|
if (count > 0) {
|
|
@@ -18,6 +21,14 @@ export class ConsoleStreamer {
|
|
|
18
21
|
clearScreen() {
|
|
19
22
|
process.stdout.write('\x1b[2J\x1b[1;1f');
|
|
20
23
|
}
|
|
24
|
+
snapshot() {
|
|
25
|
+
this.stdoutBaseline = process.stdout.bytesWritten ?? 0;
|
|
26
|
+
this.stderrBaseline = process.stderr.bytesWritten ?? 0;
|
|
27
|
+
}
|
|
28
|
+
hadExternalWrites() {
|
|
29
|
+
return ((process.stdout.bytesWritten ?? 0) > this.stdoutBaseline ||
|
|
30
|
+
(process.stderr.bytesWritten ?? 0) > this.stderrBaseline);
|
|
31
|
+
}
|
|
21
32
|
update(messages) {
|
|
22
33
|
this.clear();
|
|
23
34
|
process.stdout.write(`${messages.join('\n')}\n`);
|
|
@@ -26,17 +37,24 @@ export class ConsoleStreamer {
|
|
|
26
37
|
cast(message, sub) {
|
|
27
38
|
if (!this.isEnabled)
|
|
28
39
|
return;
|
|
40
|
+
if (this.hadExternalWrites())
|
|
41
|
+
this.lines = 0;
|
|
29
42
|
if (Array.isArray(message))
|
|
30
43
|
this.update(message);
|
|
31
44
|
else
|
|
32
45
|
this.update([`${message}${!sub || sub === '.' ? '' : ` (${sub})`}…`]);
|
|
46
|
+
this.snapshot();
|
|
33
47
|
}
|
|
34
48
|
clear() {
|
|
35
49
|
if (!this.isEnabled)
|
|
36
50
|
return;
|
|
51
|
+
if (this.hadExternalWrites())
|
|
52
|
+
this.lines = 0;
|
|
37
53
|
if (this.isWatch)
|
|
38
54
|
this.clearScreen();
|
|
39
55
|
else
|
|
40
56
|
this.clearLines(this.lines);
|
|
57
|
+
this.lines = 0;
|
|
58
|
+
this.snapshot();
|
|
41
59
|
}
|
|
42
60
|
}
|
package/dist/IssueFixer.js
CHANGED
|
@@ -5,6 +5,7 @@ import { debugLogArray, debugLogObject } from './util/debug.js';
|
|
|
5
5
|
import { load, save } from './util/package-json.js';
|
|
6
6
|
import { extname, join } from './util/path.js';
|
|
7
7
|
import { removeExport } from './util/remove-export.js';
|
|
8
|
+
const MODULE_MARKER = /^[ \t]*(import|export)\b/m;
|
|
8
9
|
export const fix = async (issues, counters, options) => {
|
|
9
10
|
const fixer = new IssueFixer(options);
|
|
10
11
|
const touchedFiles = await fixer.fixIssues(issues);
|
|
@@ -73,9 +74,13 @@ class IssueFixer {
|
|
|
73
74
|
if (fixes.length === 0)
|
|
74
75
|
continue;
|
|
75
76
|
const absFilePath = join(this.options.cwd, filePath);
|
|
76
|
-
const
|
|
77
|
+
const originalSource = await readFile(absFilePath, 'utf-8');
|
|
78
|
+
let sourceFileText = fixes
|
|
77
79
|
.sort((a, b) => b[0] - a[0])
|
|
78
|
-
.reduce((text, [start, end, flags]) => removeExport({ text, start, end, flags }),
|
|
80
|
+
.reduce((text, [start, end, flags]) => removeExport({ text, start, end, flags }), originalSource);
|
|
81
|
+
if (MODULE_MARKER.test(originalSource) && !MODULE_MARKER.test(sourceFileText)) {
|
|
82
|
+
sourceFileText = `${sourceFileText.trimEnd()}\n\nexport {};\n`;
|
|
83
|
+
}
|
|
79
84
|
await writeFile(absFilePath, sourceFileText);
|
|
80
85
|
touchedFiles.add(absFilePath);
|
|
81
86
|
for (const type of types) {
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -15,8 +15,10 @@ import { isConfig, isDeferResolve, isDependency, toConfig, toDebugString, toEntr
|
|
|
15
15
|
import { getPackageNameFromSpecifier } from './util/modules.js';
|
|
16
16
|
import { getKeysByValue } from './util/object.js';
|
|
17
17
|
import { timerify } from './util/Performance.js';
|
|
18
|
-
import { basename, dirname, isInternal, join } from './util/path.js';
|
|
18
|
+
import { basename, dirname, isInternal, join, toRelative } from './util/path.js';
|
|
19
19
|
import { extractPatternExtensions } from './util/pattern-extensions.js';
|
|
20
|
+
import { formatCauseMessage } from './util/errors.js';
|
|
21
|
+
import { logError } from './util/log.js';
|
|
20
22
|
import { loadConfigForPlugin } from './util/plugin.js';
|
|
21
23
|
import { ELLIPSIS } from './util/string.js';
|
|
22
24
|
const nullConfig = { config: null, entry: null, project: null };
|
|
@@ -327,15 +329,27 @@ export class WorkspaceWorker {
|
|
|
327
329
|
}
|
|
328
330
|
if (!cache.resolveConfig) {
|
|
329
331
|
const isLoad = typeof plugin.isLoadConfig === 'function' ? plugin.isLoadConfig(resolveOpts, this.dependencies) : true;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
332
|
+
if (isLoad) {
|
|
333
|
+
try {
|
|
334
|
+
const localConfig = await loadConfigForPlugin(configFilePath, plugin, resolveOpts, pluginName);
|
|
335
|
+
if (localConfig) {
|
|
336
|
+
const inputs = await plugin.resolveConfig(localConfig, resolveOpts);
|
|
337
|
+
if (plugin.isFilterTransitiveDependencies && !isManifest) {
|
|
338
|
+
this.filterTransitiveDependencies(inputs, configFilePath);
|
|
339
|
+
}
|
|
340
|
+
for (const input of inputs)
|
|
341
|
+
addInput(input, configFilePath);
|
|
342
|
+
cache.resolveConfig = inputs;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
if (!(error instanceof Error))
|
|
347
|
+
throw error;
|
|
348
|
+
const relPath = toRelative(configFilePath, this.options.cwd);
|
|
349
|
+
const cause = formatCauseMessage(error, this.options.cwd);
|
|
350
|
+
logError(`Error loading ${relPath} (${cause})`);
|
|
351
|
+
logError('Please fix or visit https://knip.dev/reference/known-issues');
|
|
335
352
|
}
|
|
336
|
-
for (const input of inputs)
|
|
337
|
-
addInput(input, configFilePath);
|
|
338
|
-
cache.resolveConfig = inputs;
|
|
339
353
|
}
|
|
340
354
|
}
|
|
341
355
|
}
|
|
@@ -5,7 +5,9 @@ declare const _default: {
|
|
|
5
5
|
npm: import("../../types/config.ts").BinaryResolver;
|
|
6
6
|
npx: import("../../types/config.ts").BinaryResolver;
|
|
7
7
|
pnpm: import("../../types/config.ts").BinaryResolver;
|
|
8
|
+
pn: import("../../types/config.ts").BinaryResolver;
|
|
8
9
|
pnpx: import("../../types/config.ts").BinaryResolver;
|
|
10
|
+
pnx: import("../../types/config.ts").BinaryResolver;
|
|
9
11
|
yarn: import("../../types/config.ts").BinaryResolver;
|
|
10
12
|
};
|
|
11
13
|
export default _default;
|
|
@@ -10,41 +10,58 @@ const commands = [
|
|
|
10
10
|
'cache',
|
|
11
11
|
'cat-file',
|
|
12
12
|
'cat-index',
|
|
13
|
+
'ci',
|
|
14
|
+
'clean-install',
|
|
15
|
+
'clean',
|
|
13
16
|
'config',
|
|
14
17
|
'dedupe',
|
|
15
18
|
'deploy',
|
|
16
19
|
'dlx',
|
|
20
|
+
'docs',
|
|
17
21
|
'doctor',
|
|
18
22
|
'env',
|
|
19
23
|
'fetch',
|
|
20
24
|
'find-hash',
|
|
25
|
+
'home',
|
|
21
26
|
'i',
|
|
27
|
+
'ic',
|
|
22
28
|
'ignored-builds',
|
|
23
29
|
'import',
|
|
24
30
|
'init',
|
|
31
|
+
'install-clean',
|
|
25
32
|
'install-test',
|
|
26
33
|
'install',
|
|
27
34
|
'it',
|
|
35
|
+
'la',
|
|
28
36
|
'licenses',
|
|
29
37
|
'link',
|
|
30
38
|
'list',
|
|
39
|
+
'll',
|
|
31
40
|
'ln',
|
|
32
41
|
'ls',
|
|
33
42
|
'outdated',
|
|
43
|
+
'pack-app',
|
|
34
44
|
'pack',
|
|
35
45
|
'patch-commit',
|
|
36
46
|
'patch-remove',
|
|
37
47
|
'patch',
|
|
48
|
+
'peers',
|
|
49
|
+
'ping',
|
|
38
50
|
'pkg',
|
|
51
|
+
'pm',
|
|
39
52
|
'prepare',
|
|
40
53
|
'prune',
|
|
41
54
|
'publish',
|
|
55
|
+
'purge',
|
|
42
56
|
'rb',
|
|
43
57
|
'rebuild',
|
|
44
58
|
'remove',
|
|
45
59
|
'rm',
|
|
46
60
|
'root',
|
|
61
|
+
'rt',
|
|
47
62
|
'run',
|
|
63
|
+
'runtime',
|
|
64
|
+
'sbom',
|
|
48
65
|
'self-update',
|
|
49
66
|
'server',
|
|
50
67
|
'setup',
|
|
@@ -61,6 +78,7 @@ const commands = [
|
|
|
61
78
|
'upgrade',
|
|
62
79
|
'version',
|
|
63
80
|
'why',
|
|
81
|
+
'with',
|
|
64
82
|
];
|
|
65
83
|
export const resolve = (_binary, args, options) => {
|
|
66
84
|
const parsed = parseArgs(args, {
|
package/dist/cli.js
CHANGED
|
@@ -83,7 +83,7 @@ const main = async () => {
|
|
|
83
83
|
if (!args.debug && error instanceof Error && isKnownError(error)) {
|
|
84
84
|
const knownErrors = getKnownErrors(error);
|
|
85
85
|
for (const knownError of knownErrors)
|
|
86
|
-
logError(
|
|
86
|
+
logError(knownError.message);
|
|
87
87
|
if (hasErrorCause(knownErrors[0])) {
|
|
88
88
|
console.error('Reason:', knownErrors[0].cause.message);
|
|
89
89
|
if (isModuleNotFoundError(knownErrors[0].cause))
|
|
@@ -723,6 +723,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
723
723
|
entry?: string | string[] | undefined;
|
|
724
724
|
project?: string | string[] | undefined;
|
|
725
725
|
} | undefined;
|
|
726
|
+
wxt?: string | boolean | string[] | {
|
|
727
|
+
config?: string | string[] | undefined;
|
|
728
|
+
entry?: string | string[] | undefined;
|
|
729
|
+
project?: string | string[] | undefined;
|
|
730
|
+
} | undefined;
|
|
726
731
|
xo?: string | boolean | string[] | {
|
|
727
732
|
config?: string | string[] | undefined;
|
|
728
733
|
entry?: string | string[] | undefined;
|
|
@@ -1484,6 +1489,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1484
1489
|
entry?: string | string[] | undefined;
|
|
1485
1490
|
project?: string | string[] | undefined;
|
|
1486
1491
|
} | undefined;
|
|
1492
|
+
wxt?: string | boolean | string[] | {
|
|
1493
|
+
config?: string | string[] | undefined;
|
|
1494
|
+
entry?: string | string[] | undefined;
|
|
1495
|
+
project?: string | string[] | undefined;
|
|
1496
|
+
} | undefined;
|
|
1487
1497
|
xo?: string | boolean | string[] | {
|
|
1488
1498
|
config?: string | string[] | undefined;
|
|
1489
1499
|
entry?: string | string[] | undefined;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ export declare const Plugins: {
|
|
|
148
148
|
webpack: import("../types/config.ts").Plugin;
|
|
149
149
|
wireit: import("../types/config.ts").Plugin;
|
|
150
150
|
wrangler: import("../types/config.ts").Plugin;
|
|
151
|
+
wxt: import("../types/config.ts").Plugin;
|
|
151
152
|
xo: import("../types/config.ts").Plugin;
|
|
152
153
|
yarn: import("../types/config.ts").Plugin;
|
|
153
154
|
yorkie: import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -142,6 +142,7 @@ import { default as webdriverIo } from './webdriver-io/index.js';
|
|
|
142
142
|
import { default as webpack } from './webpack/index.js';
|
|
143
143
|
import { default as wireit } from './wireit/index.js';
|
|
144
144
|
import { default as wrangler } from './wrangler/index.js';
|
|
145
|
+
import { default as wxt } from './wxt/index.js';
|
|
145
146
|
import { default as xo } from './xo/index.js';
|
|
146
147
|
import { default as yarn } from './yarn/index.js';
|
|
147
148
|
import { default as yorkie } from './yorkie/index.js';
|
|
@@ -291,6 +292,7 @@ export const Plugins = {
|
|
|
291
292
|
webpack,
|
|
292
293
|
wireit,
|
|
293
294
|
wrangler,
|
|
295
|
+
wxt,
|
|
294
296
|
xo,
|
|
295
297
|
yarn,
|
|
296
298
|
yorkie,
|
|
@@ -17,6 +17,7 @@ export const getEnvSpecifier = (env) => {
|
|
|
17
17
|
return `vitest-environment-${env}`;
|
|
18
18
|
};
|
|
19
19
|
const builtInReporters = [
|
|
20
|
+
'agent',
|
|
20
21
|
'basic',
|
|
21
22
|
'blob',
|
|
22
23
|
'default',
|
|
@@ -26,6 +27,7 @@ const builtInReporters = [
|
|
|
26
27
|
'html',
|
|
27
28
|
'json',
|
|
28
29
|
'junit',
|
|
30
|
+
'minimal',
|
|
29
31
|
'tap',
|
|
30
32
|
'tap-flat',
|
|
31
33
|
'tree',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { toDependency, toProductionEntry } from '../../util/input.js';
|
|
2
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
3
|
+
const title = 'WXT';
|
|
4
|
+
const enablers = ['wxt'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['wxt.config.{js,mjs,ts}'];
|
|
7
|
+
const production = ['entrypoints/**/*'];
|
|
8
|
+
const resolveConfig = async (localConfig) => {
|
|
9
|
+
const inputs = [];
|
|
10
|
+
for (const pattern of production) {
|
|
11
|
+
inputs.push(toProductionEntry(pattern));
|
|
12
|
+
}
|
|
13
|
+
for (const id of localConfig?.modules ?? []) {
|
|
14
|
+
if (typeof id === 'string')
|
|
15
|
+
inputs.push(toDependency(id));
|
|
16
|
+
}
|
|
17
|
+
return inputs;
|
|
18
|
+
};
|
|
19
|
+
const plugin = {
|
|
20
|
+
title,
|
|
21
|
+
enablers,
|
|
22
|
+
isEnabled,
|
|
23
|
+
config,
|
|
24
|
+
production,
|
|
25
|
+
resolveConfig,
|
|
26
|
+
};
|
|
27
|
+
export default plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,10 +18,12 @@ export default ({ report, issues, cwd }) => {
|
|
|
18
18
|
const longestSymbol = issuesForType.sort(sortLongestSymbol)[0].symbol.length;
|
|
19
19
|
const sortedByFilePath = issuesForType.sort(sortLongestFilePath);
|
|
20
20
|
const longestFilePath = getFilePath(sortedByFilePath[0]).length;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const nameWidth = Math.max(longestSymbol, 'Name'.length);
|
|
22
|
+
const locationWidth = Math.max(longestFilePath, 'Location'.length);
|
|
23
|
+
console.log(`| ${'Name'.padEnd(nameWidth)} | ${'Location'.padEnd(locationWidth)} | Severity |`);
|
|
24
|
+
console.log(`| :${'-'.repeat(nameWidth - 1)} | :${'-'.repeat(locationWidth - 1)} | :------- |`);
|
|
23
25
|
for (const issue of sortedByFilePath) {
|
|
24
|
-
console.log(`| ${issue.symbol.padEnd(
|
|
26
|
+
console.log(`| ${issue.symbol.padEnd(nameWidth)} | ${getFilePath(issue).padEnd(locationWidth)} | ${(issue.severity ?? '').padEnd(8)} |`);
|
|
25
27
|
}
|
|
26
28
|
console.log('');
|
|
27
29
|
}
|
|
@@ -721,6 +721,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
721
721
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
722
722
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
723
723
|
}, z.core.$strip>]>>;
|
|
724
|
+
wxt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
725
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
726
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
727
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
728
|
+
}, z.core.$strip>]>>;
|
|
724
729
|
xo: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
725
730
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
726
731
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1473,6 +1478,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1473
1478
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1474
1479
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1475
1480
|
}, z.core.$strip>]>>;
|
|
1481
|
+
wxt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1482
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1483
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1484
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1485
|
+
}, z.core.$strip>]>>;
|
|
1476
1486
|
xo: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1477
1487
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1478
1488
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -2242,6 +2252,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
2242
2252
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2243
2253
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2244
2254
|
}, z.core.$strip>]>>;
|
|
2255
|
+
wxt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2256
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2257
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2258
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2259
|
+
}, z.core.$strip>]>>;
|
|
2245
2260
|
xo: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2246
2261
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2247
2262
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -726,6 +726,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
726
726
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
727
727
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
728
728
|
}, z.core.$strip>]>;
|
|
729
|
+
wxt: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
730
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
731
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
732
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
733
|
+
}, z.core.$strip>]>;
|
|
729
734
|
xo: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
730
735
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
731
736
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
-
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'eleventy', 'eslint', 'execa', 'expo', 'expressive-code', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'lefthook', 'lint-staged', 'linthtml', 'lockfile-lint', 'lost-pixel', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nx', 'nyc', 'oclif', 'openapi-ts', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'vercel-og', 'vike', 'vite', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'xo', 'yarn', 'yorkie', 'zx'];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
+
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'eleventy', 'eslint', 'execa', 'expo', 'expressive-code', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'lefthook', 'lint-staged', 'linthtml', 'lockfile-lint', 'lost-pixel', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nx', 'nyc', 'oclif', 'openapi-ts', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'vercel-og', 'vike', 'vite', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
|
@@ -204,7 +204,7 @@ export function handleVariableDeclarator(node, s) {
|
|
|
204
204
|
if (_import) {
|
|
205
205
|
const internalImport = s.internal.get(_import.filePath);
|
|
206
206
|
if (internalImport) {
|
|
207
|
-
if (_import.isDynamicImport) {
|
|
207
|
+
if (_import.isDynamicImport && memberPath.length === 0) {
|
|
208
208
|
for (const prop of node.id.properties) {
|
|
209
209
|
if (prop.type === 'Property' && prop.key?.type === 'Identifier') {
|
|
210
210
|
addValue(internalImport.import, prop.key.name, s.filePath);
|
|
@@ -214,14 +214,15 @@ export function handleVariableDeclarator(node, s) {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
else {
|
|
217
|
+
else if (!_import.isDynamicImport) {
|
|
218
218
|
const ns = _import.isNamespace ? rootName : _import.importedName;
|
|
219
219
|
const prefix = [ns, ...memberPath].join('.');
|
|
220
|
+
const isNsRoot = _import.isNamespace && memberPath.length === 0;
|
|
220
221
|
for (const prop of node.id.properties) {
|
|
221
222
|
if (prop.type === 'Property' && prop.key?.type === 'Identifier') {
|
|
222
223
|
internalImport.refs.add(`${prefix}.${prop.key.name}`);
|
|
223
224
|
}
|
|
224
|
-
else if (prop.type === 'RestElement') {
|
|
225
|
+
else if (prop.type === 'RestElement' && isNsRoot) {
|
|
225
226
|
addValue(internalImport.import, OPAQUE, s.filePath);
|
|
226
227
|
}
|
|
227
228
|
}
|
|
@@ -761,6 +761,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
761
761
|
entry?: string | string[] | undefined;
|
|
762
762
|
project?: string | string[] | undefined;
|
|
763
763
|
} | undefined;
|
|
764
|
+
wxt?: string | boolean | string[] | {
|
|
765
|
+
config?: string | string[] | undefined;
|
|
766
|
+
entry?: string | string[] | undefined;
|
|
767
|
+
project?: string | string[] | undefined;
|
|
768
|
+
} | undefined;
|
|
764
769
|
xo?: string | boolean | string[] | {
|
|
765
770
|
config?: string | string[] | undefined;
|
|
766
771
|
entry?: string | string[] | undefined;
|
|
@@ -1524,6 +1529,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1524
1529
|
entry?: string | string[] | undefined;
|
|
1525
1530
|
project?: string | string[] | undefined;
|
|
1526
1531
|
} | undefined;
|
|
1532
|
+
wxt?: string | boolean | string[] | {
|
|
1533
|
+
config?: string | string[] | undefined;
|
|
1534
|
+
entry?: string | string[] | undefined;
|
|
1535
|
+
project?: string | string[] | undefined;
|
|
1536
|
+
} | undefined;
|
|
1527
1537
|
xo?: string | boolean | string[] | {
|
|
1528
1538
|
config?: string | string[] | undefined;
|
|
1529
1539
|
entry?: string | string[] | undefined;
|
|
@@ -43,14 +43,14 @@ export const createOptions = async (options) => {
|
|
|
43
43
|
if (invalid.length > 0) {
|
|
44
44
|
loadedConfig[key] = value.filter((v) => validIssueTypes.has(v));
|
|
45
45
|
for (const name of invalid)
|
|
46
|
-
logWarning(
|
|
46
|
+
logWarning(`Ignored unknown issue type "${name}" in ${key}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
else if (typeof value === 'object') {
|
|
50
50
|
for (const name in value) {
|
|
51
51
|
if (!validIssueTypes.has(name)) {
|
|
52
52
|
delete value[name];
|
|
53
|
-
logWarning(
|
|
53
|
+
logWarning(`Ignored unknown issue type "${name}" in ${key}`);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
package/dist/util/errors.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export declare const hasErrorCause: (error: Error) => error is ErrorWithCause;
|
|
|
11
11
|
export declare const isConfigurationError: (error: Error) => error is ConfigurationError;
|
|
12
12
|
export declare const isModuleNotFoundError: (error: Error) => boolean;
|
|
13
13
|
export declare const isLoaderError: (error: Error) => error is LoaderError;
|
|
14
|
+
export declare const formatCauseMessage: (error: Error, cwd: string) => string;
|
|
14
15
|
export declare const getKnownErrors: (error: Error) => Error[];
|
|
15
16
|
export {};
|
package/dist/util/errors.js
CHANGED
|
@@ -9,6 +9,12 @@ export const hasErrorCause = (error) => !isZodErrorLike(error) && error.cause in
|
|
|
9
9
|
export const isConfigurationError = (error) => error instanceof ConfigurationError;
|
|
10
10
|
export const isModuleNotFoundError = (error) => 'code' in error && error.code === 'MODULE_NOT_FOUND';
|
|
11
11
|
export const isLoaderError = (error) => error instanceof LoaderError;
|
|
12
|
+
export const formatCauseMessage = (error, cwd) => {
|
|
13
|
+
let root = error;
|
|
14
|
+
while (root.cause instanceof Error)
|
|
15
|
+
root = root.cause;
|
|
16
|
+
return root.message.split('\n', 1)[0].replace(`${cwd}/`, '');
|
|
17
|
+
};
|
|
12
18
|
export const getKnownErrors = (error) => {
|
|
13
19
|
if (isZodErrorLike(error))
|
|
14
20
|
return [...error.issues].map(error => {
|
package/dist/util/fs.js
CHANGED
|
@@ -54,7 +54,7 @@ export const hasFileWithExtension = (cwd, dirName, extensions) => {
|
|
|
54
54
|
return false;
|
|
55
55
|
};
|
|
56
56
|
export const loadJSON = async (filePath) => {
|
|
57
|
-
const contents = await loadFile(filePath);
|
|
57
|
+
const contents = (await loadFile(filePath)).replace(/^/, '');
|
|
58
58
|
try {
|
|
59
59
|
return JSON.parse(contents);
|
|
60
60
|
}
|
package/dist/util/log.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const logWarning: (
|
|
2
|
-
export declare const logError: (
|
|
1
|
+
export declare const logWarning: (message: string) => void;
|
|
2
|
+
export declare const logError: (message: string) => void;
|
package/dist/util/log.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import st from './colors.js';
|
|
2
|
-
export const logWarning = (
|
|
3
|
-
console.warn(`${st.yellow(
|
|
2
|
+
export const logWarning = (message) => {
|
|
3
|
+
console.warn(`${st.yellow('WARNING')}: ${message}`);
|
|
4
4
|
};
|
|
5
|
-
export const logError = (
|
|
6
|
-
console.error(`${st.red(
|
|
5
|
+
export const logError = (message) => {
|
|
6
|
+
console.error(`${st.red('ERROR')}: ${message}`);
|
|
7
7
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { glob } from 'tinyglobby';
|
|
3
3
|
import { partition } from './array.js';
|
|
4
|
+
import { debugLog } from './debug.js';
|
|
4
5
|
import { ConfigurationError } from './errors.js';
|
|
6
|
+
import { logWarning } from './log.js';
|
|
5
7
|
import { getPackageName } from './package-name.js';
|
|
6
8
|
import { join } from './path.js';
|
|
7
9
|
export default async function mapWorkspaces(cwd, workspaces) {
|
|
@@ -20,7 +22,7 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
20
22
|
const dir = join(cwd, name);
|
|
21
23
|
const manifestPath = join(cwd, match);
|
|
22
24
|
try {
|
|
23
|
-
const manifestStr = await readFile(manifestPath, 'utf8');
|
|
25
|
+
const manifestStr = (await readFile(manifestPath, 'utf8')).replace(/^/, '');
|
|
24
26
|
const manifest = JSON.parse(manifestStr);
|
|
25
27
|
const pkgName = getPackageName(manifest, dir);
|
|
26
28
|
const pkg = { dir, name, pkgName, manifestPath, manifestStr, manifest };
|
|
@@ -31,8 +33,12 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
31
33
|
throw new ConfigurationError(`Missing package name in ${manifestPath}`);
|
|
32
34
|
}
|
|
33
35
|
catch (error) {
|
|
34
|
-
if (error
|
|
36
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
35
37
|
debugLog('*', `Unable to load package.json for ${name}`);
|
|
38
|
+
}
|
|
39
|
+
else if (error instanceof SyntaxError) {
|
|
40
|
+
logWarning(`Skipping workspace ${name}: invalid JSON in ${manifestPath} (${error.message})`);
|
|
41
|
+
}
|
|
36
42
|
else
|
|
37
43
|
throw error;
|
|
38
44
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.8.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.8.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analysis",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"get-tsconfig": "4.14.0",
|
|
83
83
|
"jiti": "^2.6.0",
|
|
84
84
|
"minimist": "^1.2.8",
|
|
85
|
-
"oxc-parser": "^0.
|
|
85
|
+
"oxc-parser": "^0.128.0",
|
|
86
86
|
"oxc-resolver": "^11.19.1",
|
|
87
87
|
"picomatch": "^4.0.4",
|
|
88
88
|
"smol-toml": "^1.6.1",
|