knip 6.5.0 → 6.6.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/ConfigurationChief.d.ts +8 -3
- package/dist/WorkspaceWorker.d.ts +6 -4
- package/dist/WorkspaceWorker.js +22 -4
- package/dist/binaries/plugins.js +2 -2
- package/dist/binaries/resolvers/bun.js +3 -3
- package/dist/binaries/resolvers/npm.js +2 -2
- package/dist/binaries/resolvers/pnpm.js +2 -2
- package/dist/binaries/resolvers/yarn.js +3 -3
- package/dist/compilers/index.d.ts +10 -0
- package/dist/graph/build.js +24 -14
- package/dist/plugins/astro/index.js +4 -2
- package/dist/plugins/astro/resolveFromAST.d.ts +1 -0
- package/dist/plugins/astro/resolveFromAST.js +40 -1
- package/dist/plugins/eslint/index.js +2 -7
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/react-email/index.js +5 -3
- package/dist/plugins/rslib/index.js +8 -5
- package/dist/plugins/rslib/resolveFromAST.d.ts +2 -0
- package/dist/plugins/rslib/resolveFromAST.js +4 -0
- package/dist/plugins/sveltejs-package/helpers.d.ts +8 -0
- package/dist/plugins/sveltejs-package/helpers.js +65 -0
- package/dist/plugins/sveltejs-package/index.d.ts +3 -0
- package/dist/plugins/sveltejs-package/index.js +27 -0
- package/dist/plugins/vitest/helpers.d.ts +3 -1
- package/dist/plugins/vitest/helpers.js +18 -0
- package/dist/plugins/vitest/index.js +5 -19
- package/dist/reporters/trace.js +3 -3
- package/dist/reporters/util/util.d.ts +2 -2
- package/dist/reporters/util/util.js +13 -12
- package/dist/reporters/watch.js +4 -4
- 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/types/args.d.ts +2 -0
- package/dist/types/config.d.ts +17 -4
- package/dist/typescript/ast-helpers.d.ts +2 -0
- package/dist/typescript/ast-helpers.js +3 -3
- package/dist/util/colors.d.ts +18 -0
- package/dist/util/colors.js +24 -0
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/debug.js +2 -4
- package/dist/util/glob-core.js +18 -14
- package/dist/util/log.js +3 -3
- package/dist/util/package-json.d.ts +5 -0
- package/dist/util/package-json.js +9 -0
- package/dist/util/to-source-path.d.ts +3 -1
- package/dist/util/to-source-path.js +43 -20
- package/dist/util/trace.js +8 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -3
- package/dist/plugins/rslib/types.d.ts +0 -1
- package/dist/plugins/rslib/types.js +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { toAlias } from '../../util/input.js';
|
|
2
|
+
import { join, toPosix } from '../../util/path.js';
|
|
1
3
|
const environments = {
|
|
2
4
|
node: null,
|
|
3
5
|
jsdom: null,
|
|
@@ -29,6 +31,22 @@ const builtInReporters = [
|
|
|
29
31
|
'tree',
|
|
30
32
|
'verbose',
|
|
31
33
|
];
|
|
34
|
+
const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
|
|
35
|
+
export const getAliasInputs = (aliasOptions, cwd) => {
|
|
36
|
+
const inputs = [];
|
|
37
|
+
for (const [alias, value] of Object.entries(aliasOptions)) {
|
|
38
|
+
if (!value)
|
|
39
|
+
continue;
|
|
40
|
+
const prefixes = [value]
|
|
41
|
+
.flat()
|
|
42
|
+
.filter((value) => typeof value === 'string')
|
|
43
|
+
.map(prefix => (toPosix(prefix).startsWith(cwd) ? prefix : join(cwd, prefix)));
|
|
44
|
+
if (alias.length > 1)
|
|
45
|
+
inputs.push(toAlias(alias, prefixes));
|
|
46
|
+
inputs.push(toAlias(addStar(alias), prefixes.map(addStar)));
|
|
47
|
+
}
|
|
48
|
+
return inputs;
|
|
49
|
+
};
|
|
32
50
|
export const getExternalReporters = (reporters) => reporters
|
|
33
51
|
? [reporters]
|
|
34
52
|
.flat()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DEFAULT_EXTENSIONS } from '../../constants.js';
|
|
2
2
|
import { _glob } from '../../util/glob.js';
|
|
3
|
-
import {
|
|
4
|
-
import { isAbsolute, isInternal, join, toAbsolute
|
|
3
|
+
import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
4
|
+
import { isAbsolute, isInternal, join, toAbsolute } from '../../util/path.js';
|
|
5
5
|
import { hasDependency } from '../../util/plugin.js';
|
|
6
6
|
import { getIndexHtmlEntries } from '../vite/helpers.js';
|
|
7
|
-
import { getEnvSpecifier, getExternalReporters } from './helpers.js';
|
|
7
|
+
import { getAliasInputs, getEnvSpecifier, getExternalReporters } from './helpers.js';
|
|
8
8
|
const title = 'Vitest';
|
|
9
9
|
const enablers = ['vitest'];
|
|
10
10
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
@@ -106,23 +106,9 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
|
|
110
109
|
const addAliases = (aliasOptions) => {
|
|
111
|
-
for (const
|
|
112
|
-
|
|
113
|
-
continue;
|
|
114
|
-
const prefixes = [value]
|
|
115
|
-
.flat()
|
|
116
|
-
.filter(value => typeof value === 'string')
|
|
117
|
-
.map(prefix => {
|
|
118
|
-
if (toPosix(prefix).startsWith(options.cwd))
|
|
119
|
-
return prefix;
|
|
120
|
-
return join(options.cwd, prefix);
|
|
121
|
-
});
|
|
122
|
-
if (alias.length > 1)
|
|
123
|
-
inputs.add(toAlias(alias, prefixes));
|
|
124
|
-
inputs.add(toAlias(addStar(alias), prefixes.map(addStar)));
|
|
125
|
-
}
|
|
110
|
+
for (const input of getAliasInputs(aliasOptions, options.cwd))
|
|
111
|
+
inputs.add(input);
|
|
126
112
|
};
|
|
127
113
|
const seenRoots = new Set();
|
|
128
114
|
for (const cfg of configs) {
|
package/dist/reporters/trace.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import st from '../util/colors.js';
|
|
2
2
|
import { toRelative } from '../util/path.js';
|
|
3
3
|
import { toRegexOrString } from '../util/regex.js';
|
|
4
4
|
import { Table } from '../util/table.js';
|
|
@@ -19,8 +19,8 @@ export default ({ graph, explorer, options, workspaceFilePathFilter }) => {
|
|
|
19
19
|
continue;
|
|
20
20
|
seen.add(key);
|
|
21
21
|
table.row();
|
|
22
|
-
table.cell('filePath',
|
|
23
|
-
table.cell('package',
|
|
22
|
+
table.cell('filePath', st.whiteBright(`${toRel(_import.filePath)}${pos}`));
|
|
23
|
+
table.cell('package', st.cyanBright(packageName));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
for (const line of table.toRows())
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ISSUE_TYPE_TITLE } from '../../constants.ts';
|
|
2
2
|
import type { Issue, IssueRecords, IssueSeverity, IssueSymbol, IssueType } from '../../types/issues.ts';
|
|
3
3
|
import { Table } from '../../util/table.ts';
|
|
4
|
-
export declare const dim:
|
|
5
|
-
export declare const bright:
|
|
4
|
+
export declare const dim: (text: string | number | null | undefined) => string;
|
|
5
|
+
export declare const bright: (text: string | number | null | undefined) => string;
|
|
6
6
|
export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Duplicate exports" | "Exported types in used namespace" | "Exports in used namespace" | "Referenced optional peerDependencies" | "Unlisted binaries" | "Unlisted dependencies" | "Unresolved imports" | "Unused catalog entries" | "Unused dependencies" | "Unused devDependencies" | "Unused exported enum members" | "Unused exported namespace members" | "Unused exported types" | "Unused exports" | "Unused files";
|
|
7
7
|
export declare const getColoredTitle: (title: string, count: number) => string;
|
|
8
8
|
export declare const getDimmedTitle: (title: string, count: number) => string;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import picocolors from 'picocolors';
|
|
2
1
|
import { ISSUE_TYPE_TITLE, SYMBOL_TYPE } from '../../constants.js';
|
|
2
|
+
import st from '../../util/colors.js';
|
|
3
3
|
import { relative } from '../../util/path.js';
|
|
4
4
|
import { Table } from '../../util/table.js';
|
|
5
5
|
const plain = (text) => text;
|
|
6
|
-
export const dim =
|
|
7
|
-
export const bright =
|
|
8
|
-
const yellow = picocolors.yellow;
|
|
6
|
+
export const dim = st.gray;
|
|
7
|
+
export const bright = st.whiteBright;
|
|
9
8
|
export const getIssueTypeTitle = (reportType) => ISSUE_TYPE_TITLE[reportType];
|
|
10
|
-
export const getColoredTitle = (title, count) => `${
|
|
11
|
-
export const getDimmedTitle = (title, count) => `${yellow(`${
|
|
9
|
+
export const getColoredTitle = (title, count) => `${st.style(['yellowBright', 'underline'], title)} (${count})`;
|
|
10
|
+
export const getDimmedTitle = (title, count) => `${st.yellow(`${st.underline(title)} (${count})`)}`;
|
|
12
11
|
export const getIssueLine = ({ owner, filePath, symbols, parentSymbol, severity }, cwd) => {
|
|
13
12
|
const symbol = symbols ? `: ${symbols.map(s => s.symbol).join(', ')}` : '';
|
|
14
13
|
const parent = parentSymbol ? ` (${parentSymbol})` : '';
|
|
15
14
|
const print = severity === 'warn' ? dim : plain;
|
|
16
|
-
return `${owner ? `${
|
|
15
|
+
return `${owner ? `${st.cyan(owner)} ` : ''}${print(`${relative(cwd, filePath)}${symbol}${parent}`)}`;
|
|
17
16
|
};
|
|
18
17
|
export const convert = (issue) => ({
|
|
19
18
|
namespace: 'parentSymbol' in issue ? issue.parentSymbol : undefined,
|
|
@@ -32,12 +31,14 @@ const sortByPos = (a, b) => {
|
|
|
32
31
|
: filePathA.localeCompare(filePathB);
|
|
33
32
|
};
|
|
34
33
|
const highlightSymbol = (issue) => (_) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
34
|
+
const { specifier, symbol } = issue;
|
|
35
|
+
if (specifier && specifier !== symbol) {
|
|
36
|
+
const idx = specifier.indexOf(symbol);
|
|
37
|
+
if (idx !== -1) {
|
|
38
|
+
return `${dim(specifier.slice(0, idx))}${bright(symbol)}${dim(specifier.slice(idx + symbol.length))}`;
|
|
39
|
+
}
|
|
39
40
|
}
|
|
40
|
-
return
|
|
41
|
+
return symbol;
|
|
41
42
|
};
|
|
42
43
|
export const getTableForType = (issues, cwd, options = { isUseColors: true }) => {
|
|
43
44
|
const table = new Table({ truncateStart: ['filePath'], noTruncate: ['symbolType'] });
|
package/dist/reporters/watch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import st from '../util/colors.js';
|
|
2
2
|
import { perfObserver } from '../util/Performance.js';
|
|
3
3
|
import { prettyMilliseconds } from '../util/string.js';
|
|
4
4
|
import { flattenIssues, getIssueTypeTitle, getTableForType } from './util/util.js';
|
|
@@ -12,7 +12,7 @@ export default (options, { issues, streamer, duration, size }) => {
|
|
|
12
12
|
const issuesForType = flattenIssues(issues[reportType]);
|
|
13
13
|
if (issuesForType.length > 0) {
|
|
14
14
|
if (title) {
|
|
15
|
-
lines.push(`${
|
|
15
|
+
lines.push(`${st.style(['yellowBright', 'underline'], title)} (${issuesForType.length})`);
|
|
16
16
|
}
|
|
17
17
|
lines.push(...getTableForType(issuesForType, options.cwd).toRows());
|
|
18
18
|
}
|
|
@@ -23,8 +23,8 @@ export default (options, { issues, streamer, duration, size }) => {
|
|
|
23
23
|
const ms = duration ?? perfObserver.getCurrentDurationInMs();
|
|
24
24
|
const summary = `${size} files (${prettyMilliseconds(ms)} • ${mem}MB)`;
|
|
25
25
|
const messages = totalIssues === 0
|
|
26
|
-
? ['✂️ Excellent, Knip found no issues.', '',
|
|
27
|
-
: [...lines, '',
|
|
26
|
+
? ['✂️ Excellent, Knip found no issues.', '', st.gray(summary)]
|
|
27
|
+
: [...lines, '', st.gray(summary)];
|
|
28
28
|
if (options.isDebug)
|
|
29
29
|
console.log(messages.join('\n'));
|
|
30
30
|
else
|
|
@@ -581,6 +581,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
581
581
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
582
582
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
583
583
|
}, z.core.$strip>]>>;
|
|
584
|
+
'sveltejs-package': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
585
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
586
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
587
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
588
|
+
}, z.core.$strip>]>>;
|
|
584
589
|
sveltekit: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
585
590
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
586
591
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1328,6 +1333,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1328
1333
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1329
1334
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1330
1335
|
}, z.core.$strip>]>>;
|
|
1336
|
+
'sveltejs-package': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1337
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1338
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1339
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1340
|
+
}, z.core.$strip>]>>;
|
|
1331
1341
|
sveltekit: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1332
1342
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1333
1343
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -2092,6 +2102,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
2092
2102
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2093
2103
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2094
2104
|
}, z.core.$strip>]>>;
|
|
2105
|
+
'sveltejs-package': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2106
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2107
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2108
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2109
|
+
}, z.core.$strip>]>>;
|
|
2095
2110
|
sveltekit: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2096
2111
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2097
2112
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -586,6 +586,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
586
586
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
587
587
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
588
588
|
}, z.core.$strip>]>;
|
|
589
|
+
'sveltejs-package': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
590
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
591
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
592
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
593
|
+
}, z.core.$strip>]>;
|
|
589
594
|
sveltekit: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
590
595
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
591
596
|
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' | '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', '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' | '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'];
|
package/dist/types/args.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ParsedArgs } from 'minimist';
|
|
2
2
|
import type { Input } from '../util/input.ts';
|
|
3
|
+
import type { Manifest } from '../util/package-json.ts';
|
|
3
4
|
export type ConfigArg = boolean | (string | [string, (id: string) => string])[];
|
|
4
5
|
export type Args = {
|
|
5
6
|
binaries?: string[];
|
|
@@ -15,5 +16,6 @@ export type Args = {
|
|
|
15
16
|
resolveInputs?: (parsed: ParsedArgs, options: {
|
|
16
17
|
cwd: string;
|
|
17
18
|
args: string[];
|
|
19
|
+
manifest: Manifest;
|
|
18
20
|
}) => Input[];
|
|
19
21
|
};
|
package/dist/types/config.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { knipConfigurationSchema, workspaceConfigurationSchema } from '../s
|
|
|
5
5
|
import type { pluginSchema } from '../schema/plugins.ts';
|
|
6
6
|
import type { ParsedCLIArgs } from '../util/cli-arguments.ts';
|
|
7
7
|
import type { Input } from '../util/input.ts';
|
|
8
|
+
import type { Manifest } from '../util/package-json.ts';
|
|
8
9
|
import type { Args } from './args.ts';
|
|
9
10
|
import type { IssueType, SymbolType } from './issues.ts';
|
|
10
11
|
import type { Tags } from './options.ts';
|
|
@@ -72,18 +73,17 @@ export interface WorkspaceConfiguration extends BaseWorkspaceConfiguration, Part
|
|
|
72
73
|
interface BaseOptions {
|
|
73
74
|
rootCwd: string;
|
|
74
75
|
cwd: string;
|
|
75
|
-
|
|
76
|
-
rootManifest:
|
|
76
|
+
manifest: Manifest;
|
|
77
|
+
rootManifest: Manifest | undefined;
|
|
77
78
|
}
|
|
78
79
|
type IsPluginEnabledOptions = {
|
|
79
80
|
cwd: string;
|
|
80
|
-
manifest:
|
|
81
|
+
manifest: Manifest;
|
|
81
82
|
dependencies: Set<string>;
|
|
82
83
|
config: WorkspaceConfiguration;
|
|
83
84
|
};
|
|
84
85
|
export type IsPluginEnabled = (options: IsPluginEnabledOptions) => boolean | Promise<boolean>;
|
|
85
86
|
export interface PluginOptions extends BaseOptions {
|
|
86
|
-
manifest: PackageJson;
|
|
87
87
|
config: EnsuredPluginConfiguration;
|
|
88
88
|
configFileDir: string;
|
|
89
89
|
configFileName: string;
|
|
@@ -96,6 +96,18 @@ type PluginSetup = () => Promise<void> | void;
|
|
|
96
96
|
export type IsLoadConfig = (options: PluginOptions, dependencies: Set<string>) => boolean;
|
|
97
97
|
export type ResolveConfig<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
|
|
98
98
|
export type Resolve = (options: PluginOptions) => Promise<Input[]> | Input[];
|
|
99
|
+
export type SourceMap = {
|
|
100
|
+
srcDir: string;
|
|
101
|
+
outDir: string;
|
|
102
|
+
};
|
|
103
|
+
export interface ResolveSourceMapOptions {
|
|
104
|
+
cwd: string;
|
|
105
|
+
manifest: Manifest;
|
|
106
|
+
dependencies: Set<string>;
|
|
107
|
+
rootCwd: string;
|
|
108
|
+
rootManifest: Manifest | undefined;
|
|
109
|
+
}
|
|
110
|
+
export type ResolveSourceMap = (options: ResolveSourceMapOptions) => Promise<SourceMap[]> | SourceMap[];
|
|
99
111
|
export type HandleInput = (input: Input) => string | undefined;
|
|
100
112
|
export type RegisterCompilerInput = {
|
|
101
113
|
extension: string;
|
|
@@ -141,6 +153,7 @@ export interface Plugin {
|
|
|
141
153
|
isLoadConfig?: IsLoadConfig;
|
|
142
154
|
resolveConfig?: ResolveConfig;
|
|
143
155
|
resolve?: Resolve;
|
|
156
|
+
resolveSourceMap?: ResolveSourceMap;
|
|
144
157
|
resolveFromAST?: ResolveFromAST;
|
|
145
158
|
isFilterTransitiveDependencies?: boolean;
|
|
146
159
|
registerCompilers?: RegisterCompilers;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ParseResult, Program } from 'oxc-parser';
|
|
2
|
+
export declare const getStringValue: (node: any) => string | undefined;
|
|
3
|
+
export declare const getPropertyKey: (prop: any) => string | undefined;
|
|
2
4
|
export declare const getImportMap: (program: Program) => Map<string, string>;
|
|
3
5
|
export declare const getDefaultImportName: (importMap: Map<string, string>, specifier: string) => string | undefined;
|
|
4
6
|
export declare const getPropertyValues: (node: any, propertyName: string) => Set<string>;
|
|
@@ -3,7 +3,8 @@ import stripJsonComments from 'strip-json-comments';
|
|
|
3
3
|
import { extname, isInternal } from '../util/path.js';
|
|
4
4
|
import { parseFile } from './visitors/helpers.js';
|
|
5
5
|
const isStringLiteral = (node) => node?.type === 'StringLiteral' || (node?.type === 'Literal' && typeof node.value === 'string');
|
|
6
|
-
const getStringValue = (node) => (isStringLiteral(node) ? node.value : undefined);
|
|
6
|
+
export const getStringValue = (node) => (isStringLiteral(node) ? node.value : undefined);
|
|
7
|
+
export const getPropertyKey = (prop) => prop?.key?.type === 'Identifier' ? prop.key.name : getStringValue(prop?.key);
|
|
7
8
|
export const getImportMap = (program) => {
|
|
8
9
|
const importMap = new Map();
|
|
9
10
|
for (const node of program.body ?? []) {
|
|
@@ -101,9 +102,8 @@ export const findProperty = (node, name) => {
|
|
|
101
102
|
if (node?.type !== 'ObjectExpression')
|
|
102
103
|
return;
|
|
103
104
|
for (const prop of node.properties ?? []) {
|
|
104
|
-
if (prop.type === 'Property' && (prop
|
|
105
|
+
if (prop.type === 'Property' && getPropertyKey(prop) === name)
|
|
105
106
|
return prop.value;
|
|
106
|
-
}
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
export const getStringValues = (node) => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { styleText } from 'node:util';
|
|
2
|
+
type Modifier = Parameters<typeof styleText>[0];
|
|
3
|
+
type Input = string | number | null | undefined;
|
|
4
|
+
declare const st: {
|
|
5
|
+
red: (text: Input) => string;
|
|
6
|
+
green: (text: Input) => string;
|
|
7
|
+
yellow: (text: Input) => string;
|
|
8
|
+
cyan: (text: Input) => string;
|
|
9
|
+
white: (text: Input) => string;
|
|
10
|
+
gray: (text: Input) => string;
|
|
11
|
+
dim: (text: Input) => string;
|
|
12
|
+
underline: (text: Input) => string;
|
|
13
|
+
cyanBright: (text: Input) => string;
|
|
14
|
+
whiteBright: (text: Input) => string;
|
|
15
|
+
yellowBright: (text: Input) => string;
|
|
16
|
+
style: (mods: Modifier, text: Input) => string;
|
|
17
|
+
};
|
|
18
|
+
export default st;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { styleText } from 'node:util';
|
|
2
|
+
const isColors = !process.env.NO_COLOR && (process.env.FORCE_COLOR === '1' || !!process.stdout.isTTY);
|
|
3
|
+
const make = (mod) => (text) => {
|
|
4
|
+
const str = String(text);
|
|
5
|
+
return isColors ? styleText(mod, str, { validateStream: false }) : str;
|
|
6
|
+
};
|
|
7
|
+
const st = {
|
|
8
|
+
red: make('red'),
|
|
9
|
+
green: make('green'),
|
|
10
|
+
yellow: make('yellow'),
|
|
11
|
+
cyan: make('cyan'),
|
|
12
|
+
white: make('white'),
|
|
13
|
+
gray: make('gray'),
|
|
14
|
+
dim: make('dim'),
|
|
15
|
+
underline: make('underline'),
|
|
16
|
+
cyanBright: make('cyanBright'),
|
|
17
|
+
whiteBright: make('whiteBright'),
|
|
18
|
+
yellowBright: make('yellowBright'),
|
|
19
|
+
style: (mods, text) => {
|
|
20
|
+
const str = String(text);
|
|
21
|
+
return isColors ? styleText(mods, str, { validateStream: false }) : str;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export default st;
|
|
@@ -621,6 +621,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
621
621
|
entry?: string | string[] | undefined;
|
|
622
622
|
project?: string | string[] | undefined;
|
|
623
623
|
} | undefined;
|
|
624
|
+
'sveltejs-package'?: string | boolean | string[] | {
|
|
625
|
+
config?: string | string[] | undefined;
|
|
626
|
+
entry?: string | string[] | undefined;
|
|
627
|
+
project?: string | string[] | undefined;
|
|
628
|
+
} | undefined;
|
|
624
629
|
sveltekit?: string | boolean | string[] | {
|
|
625
630
|
config?: string | string[] | undefined;
|
|
626
631
|
entry?: string | string[] | undefined;
|
|
@@ -1379,6 +1384,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1379
1384
|
entry?: string | string[] | undefined;
|
|
1380
1385
|
project?: string | string[] | undefined;
|
|
1381
1386
|
} | undefined;
|
|
1387
|
+
'sveltejs-package'?: string | boolean | string[] | {
|
|
1388
|
+
config?: string | string[] | undefined;
|
|
1389
|
+
entry?: string | string[] | undefined;
|
|
1390
|
+
project?: string | string[] | undefined;
|
|
1391
|
+
} | undefined;
|
|
1382
1392
|
sveltekit?: string | boolean | string[] | {
|
|
1383
1393
|
config?: string | string[] | undefined;
|
|
1384
1394
|
entry?: string | string[] | undefined;
|
package/dist/util/debug.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import util, { parseArgs } from 'node:util';
|
|
2
|
-
import
|
|
2
|
+
import st from './colors.js';
|
|
3
3
|
const { values } = parseArgs({ strict: false, options: { debug: { type: 'boolean' } } });
|
|
4
4
|
const IS_DEBUG_ENABLED = values.debug ?? false;
|
|
5
5
|
const IS_COLORS = !process.env.NO_COLOR;
|
|
6
6
|
const noop = () => { };
|
|
7
7
|
const inspectOptions = { maxArrayLength: null, depth: null, colors: IS_COLORS };
|
|
8
8
|
export const inspect = (obj) => console.log(util.inspect(obj, inspectOptions));
|
|
9
|
-
const ctx = (text) => typeof text === 'string'
|
|
10
|
-
? picocolors.yellow(`[${text}]`)
|
|
11
|
-
: `${picocolors.yellow(`[${text[0]}]`)} ${picocolors.cyan(text[1])}`;
|
|
9
|
+
const ctx = (text) => typeof text === 'string' ? st.yellow(`[${text}]`) : `${st.yellow(`[${text[0]}]`)} ${st.cyan(text[1])}`;
|
|
12
10
|
const logArray = (collection) => {
|
|
13
11
|
console.log(util.inspect(collection.sort(), inspectOptions));
|
|
14
12
|
};
|
package/dist/util/glob-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { basename } from 'node:path';
|
|
3
|
+
import { fdir } from 'fdir';
|
|
4
4
|
import { glob as tinyGlob } from 'tinyglobby';
|
|
5
5
|
import picomatch from 'picomatch';
|
|
6
6
|
import { GLOBAL_IGNORE_PATTERNS } from '../constants.js';
|
|
@@ -10,7 +10,6 @@ import { isDirectory, isFile } from './fs.js';
|
|
|
10
10
|
import { timerify } from './Performance.js';
|
|
11
11
|
import { expandIgnorePatterns, parseAndConvertGitignorePatterns } from './parse-and-convert-gitignores.js';
|
|
12
12
|
import { dirname, join, relative, toPosix } from './path.js';
|
|
13
|
-
const walk = promisify(_walk);
|
|
14
13
|
const cachedGitIgnores = new Map();
|
|
15
14
|
const cachedGlobIgnores = new Map();
|
|
16
15
|
const isGitRoot = (dir) => isDirectory(dir, '.git') || isFile(dir, '.git');
|
|
@@ -155,19 +154,24 @@ export const findAndParseGitignores = async (cwd, workspaceDirs) => {
|
|
|
155
154
|
};
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
const cwdPrefixLen = cwd.length + 1;
|
|
158
|
+
const walkGitignores = async () => {
|
|
159
|
+
await new fdir()
|
|
160
|
+
.withFullPaths()
|
|
161
|
+
.exclude((_dirName, dirPath) => {
|
|
162
|
+
const absPath = toPosix(dirPath.slice(0, -1));
|
|
163
|
+
return (isRelevantDir && !isRelevantDir(absPath)) || getMatcher()(absPath.slice(cwdPrefixLen));
|
|
164
|
+
})
|
|
165
|
+
.filter((filePath, isDir) => {
|
|
166
|
+
if (isDir || basename(filePath) !== '.gitignore')
|
|
167
|
+
return false;
|
|
168
|
+
addFile(filePath);
|
|
161
169
|
return true;
|
|
162
|
-
}
|
|
163
|
-
|
|
170
|
+
})
|
|
171
|
+
.crawl(cwd)
|
|
172
|
+
.withPromise();
|
|
164
173
|
};
|
|
165
|
-
|
|
166
|
-
await walk(cwd, {
|
|
167
|
-
concurrency: 16,
|
|
168
|
-
entryFilter,
|
|
169
|
-
deepFilter,
|
|
170
|
-
});
|
|
174
|
+
await timerify(walkGitignores)();
|
|
171
175
|
if (unignores.size > 0) {
|
|
172
176
|
const unignorePaths = new Set();
|
|
173
177
|
for (const u of unignores) {
|
package/dist/util/log.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import st from './colors.js';
|
|
2
2
|
export const logWarning = (prefix, message) => {
|
|
3
|
-
console.warn(`${
|
|
3
|
+
console.warn(`${st.yellow(prefix)}: ${message}`);
|
|
4
4
|
};
|
|
5
5
|
export const logError = (prefix, message) => {
|
|
6
|
-
console.error(`${
|
|
6
|
+
console.error(`${st.red(prefix)}: ${message}`);
|
|
7
7
|
};
|
|
@@ -8,5 +8,10 @@ interface ExtendedPackageJson extends PackageJson {
|
|
|
8
8
|
export declare const load: (filePath: string) => Promise<ExtendedPackageJson>;
|
|
9
9
|
export declare const save: (filePath: string, content: ExtendedPackageJson) => Promise<void>;
|
|
10
10
|
export declare const getEntrySpecifiersFromManifest: (manifest: PackageJson) => Set<string>;
|
|
11
|
+
export type Manifest = PackageJson & {
|
|
12
|
+
scriptNames: Set<string>;
|
|
13
|
+
getMajor: (name: string) => number | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare const createManifest: (raw: PackageJson) => Manifest;
|
|
11
16
|
export declare const getManifestImportDependencies: (manifest: PackageJson) => Set<string>;
|
|
12
17
|
export {};
|
|
@@ -87,6 +87,15 @@ export const getEntrySpecifiersFromManifest = (manifest) => {
|
|
|
87
87
|
}
|
|
88
88
|
return entryPaths;
|
|
89
89
|
};
|
|
90
|
+
export const createManifest = (raw) => Object.assign(raw, {
|
|
91
|
+
...raw,
|
|
92
|
+
scriptNames: new Set(Object.keys(raw.scripts ?? {})),
|
|
93
|
+
getMajor(name) {
|
|
94
|
+
const range = raw.dependencies?.[name] ?? raw.devDependencies?.[name];
|
|
95
|
+
const match = range?.match(/\d+/)?.[0];
|
|
96
|
+
return match ? Number.parseInt(match, 10) : undefined;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
90
99
|
export const getManifestImportDependencies = (manifest) => {
|
|
91
100
|
const dependencies = new Set();
|
|
92
101
|
if (!manifest.imports)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { SourceMap } from '../types/config.ts';
|
|
1
2
|
import type { CompilerOptions } from '../types/project.ts';
|
|
2
3
|
import type { ConfigurationChief, Workspace } from '../ConfigurationChief.ts';
|
|
3
|
-
export declare const augmentWorkspace: (workspace: Workspace, dir: string, compilerOptions: CompilerOptions) => void;
|
|
4
|
+
export declare const augmentWorkspace: (workspace: Workspace, dir: string, compilerOptions: CompilerOptions | undefined, pluginSourceMaps?: SourceMap[]) => void;
|
|
4
5
|
export declare const getModuleSourcePathHandler: (chief: ConfigurationChief) => (filePath: string) => string | undefined;
|
|
5
6
|
export declare const getToSourcePathsHandler: (chief: ConfigurationChief) => (specifiers: Set<string>, dir: string, extensions: (string | undefined) | undefined, label: string) => Promise<string[]>;
|
|
7
|
+
export declare const toSourceMappedSpecifiers: (ws: Workspace | undefined, absSpecifier: string, extensions?: string) => string[];
|
|
6
8
|
export type ToSourceFilePath = ReturnType<typeof getModuleSourcePathHandler>;
|