knip 6.27.0 → 6.29.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/DependencyDeputy.js +1 -1
- package/dist/WorkspaceWorker.js +9 -0
- package/dist/compilers/compilers.d.ts +1 -0
- package/dist/compilers/compilers.js +10 -0
- package/dist/compilers/index.d.ts +10 -0
- package/dist/compilers/index.js +2 -0
- package/dist/compilers/mdx.d.ts +2 -1
- package/dist/compilers/tsrx.d.ts +5 -0
- package/dist/compilers/tsrx.js +3 -0
- package/dist/constants.js +14 -0
- package/dist/graph/analyze.js +6 -4
- package/dist/graph-explorer/explorer.d.ts +1 -1
- package/dist/graph-explorer/operations/is-referenced.d.ts +1 -1
- package/dist/graph-explorer/operations/is-referenced.js +47 -33
- package/dist/manifest/index.d.ts +2 -1
- package/dist/plugins/angular/index.js +3 -0
- package/dist/plugins/babel/helpers.d.ts +9 -7
- package/dist/plugins/convex/index.js +11 -2
- package/dist/plugins/convex/types.d.ts +3 -0
- package/dist/plugins/convex/types.js +1 -0
- package/dist/plugins/github-actions/index.js +5 -2
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/markdownlint/index.js +26 -5
- package/dist/plugins/markdownlint/types.d.ts +6 -0
- package/dist/plugins/nitro/index.js +3 -1
- package/dist/plugins/nuxt/index.js +19 -8
- package/dist/plugins/openclaw/index.d.ts +3 -0
- package/dist/plugins/openclaw/index.js +52 -0
- package/dist/plugins/openclaw/types.d.ts +25 -0
- package/dist/plugins/openclaw/types.js +1 -0
- package/dist/plugins/prettier/index.js +1 -1
- package/dist/plugins/tailwind/index.js +8 -0
- package/dist/plugins/tsdown/index.js +43 -0
- package/dist/plugins/typescript/index.js +1 -1
- package/dist/reporters/util/configuration-hints.js +3 -1
- 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/issues.d.ts +1 -1
- package/dist/typescript/ast-nodes.d.ts +3 -1
- package/dist/typescript/comments.d.ts +1 -1
- package/dist/typescript/comments.js +71 -5
- package/dist/typescript/get-imports-and-exports.d.ts +3 -1
- package/dist/typescript/get-imports-and-exports.js +1 -1
- package/dist/typescript/visitors/walk.d.ts +1 -0
- package/dist/typescript/visitors/walk.js +14 -1
- package/dist/util/Performance.js +1 -1
- package/dist/util/codeowners.js +1 -1
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/glob-cache.d.ts +7 -1
- package/dist/util/glob-cache.js +52 -29
- package/dist/util/glob-core.d.ts +2 -0
- package/dist/util/glob-core.js +52 -7
- package/dist/util/glob.d.ts +6 -3
- package/dist/util/glob.js +23 -9
- package/dist/util/loader.d.ts +3 -1
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +4 -4
- package/dist/util/reporter.js +4 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +11 -11
- package/schema.json +4 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isDirectory } from '../../util/fs.js';
|
|
2
2
|
import { _syncGlob } from '../../util/glob.js';
|
|
3
|
-
import { toAlias, toConfig, toDeferResolveProductionEntry, toDependency, toEntry, toIgnore, toProductionEntry, } from '../../util/input.js';
|
|
3
|
+
import { toAlias, toConfig, toDeferResolveProductionEntry, toDependency, toEntry, toIgnore, toProductionDependency, toProductionEntry, } from '../../util/input.js';
|
|
4
4
|
import { loadTSConfig } from '../../util/load-tsconfig.js';
|
|
5
|
-
import { join } from '../../util/path.js';
|
|
5
|
+
import { isInternal, join, toAbsolute } from '../../util/path.js';
|
|
6
6
|
import { hasDependency } from '../../util/plugin.js';
|
|
7
7
|
import { buildAutoImportMap, collectLocalImportPaths, createAutoImportMaps, createTsCompiler, createVueCompiler, readAndParseFile, } from '../_vue/auto-import.js';
|
|
8
8
|
const title = 'Nuxt';
|
|
@@ -35,6 +35,13 @@ const setup = async () => {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
const resolve = () => [
|
|
39
|
+
toIgnore('^#build/', 'unresolved'),
|
|
40
|
+
toIgnore('#components', 'unresolved'),
|
|
41
|
+
toIgnore('#imports', 'unresolved'),
|
|
42
|
+
toIgnore('^#internal/', 'unresolved'),
|
|
43
|
+
toIgnore('#spa-template', 'unresolved'),
|
|
44
|
+
];
|
|
38
45
|
const resolveAlias = (specifier, srcDir, rootDir) => {
|
|
39
46
|
if (specifier.startsWith('~~/') || specifier.startsWith('@@/'))
|
|
40
47
|
return join(rootDir, specifier.slice(3));
|
|
@@ -80,14 +87,18 @@ const registerCompilers = async ({ cwd, hasDependency, registerCompiler }) => {
|
|
|
80
87
|
const resolveConfig = async (localConfig, options) => {
|
|
81
88
|
const { configFileDir: cwd } = options;
|
|
82
89
|
const hasAppDir = isDirectory(cwd, 'app');
|
|
83
|
-
const srcDir = localConfig.srcDir ?? (hasAppDir ? join(cwd, 'app') : cwd);
|
|
90
|
+
const srcDir = toAbsolute(localConfig.srcDir ?? (hasAppDir ? join(cwd, 'app') : cwd), cwd);
|
|
84
91
|
const serverDir = localConfig.serverDir ?? 'server';
|
|
85
92
|
const inputs = [];
|
|
93
|
+
const addModule = (id) => {
|
|
94
|
+
const specifier = resolveAlias(id, srcDir, cwd);
|
|
95
|
+
inputs.push(isInternal(specifier) ? toDeferResolveProductionEntry(specifier) : toProductionDependency(specifier));
|
|
96
|
+
};
|
|
86
97
|
for (const id of localConfig.modules ?? []) {
|
|
87
98
|
if (Array.isArray(id) && typeof id[0] === 'string')
|
|
88
|
-
|
|
99
|
+
addModule(id[0]);
|
|
89
100
|
if (typeof id === 'string')
|
|
90
|
-
|
|
101
|
+
addModule(id);
|
|
91
102
|
}
|
|
92
103
|
addAppEntries(inputs, srcDir, serverDir, localConfig, cwd);
|
|
93
104
|
const aliases = localConfig.alias;
|
|
@@ -101,7 +112,8 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
101
112
|
}
|
|
102
113
|
}
|
|
103
114
|
for (const ext of localConfig.extends ?? []) {
|
|
104
|
-
const
|
|
115
|
+
const target = resolveAlias(ext, srcDir, cwd);
|
|
116
|
+
const resolved = isInternal(target) ? toAbsolute(target, cwd) : target;
|
|
105
117
|
const configs = _syncGlob({ cwd: resolved, patterns: config });
|
|
106
118
|
if (configs.length > 0)
|
|
107
119
|
for (const cfg of configs)
|
|
@@ -129,8 +141,6 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
129
141
|
inputs.push(toAlias(key, paths[key], { dir }));
|
|
130
142
|
}
|
|
131
143
|
}
|
|
132
|
-
inputs.push(toIgnore('#imports', 'unresolved'));
|
|
133
|
-
inputs.push(toIgnore('#components', 'unresolved'));
|
|
134
144
|
return inputs;
|
|
135
145
|
};
|
|
136
146
|
const plugin = {
|
|
@@ -141,6 +151,7 @@ const plugin = {
|
|
|
141
151
|
entry,
|
|
142
152
|
production,
|
|
143
153
|
setup,
|
|
154
|
+
resolve,
|
|
144
155
|
resolveConfig,
|
|
145
156
|
registerCompilers,
|
|
146
157
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { collectPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
+
import { _parseFile } from '../../typescript/ast-nodes.js';
|
|
3
|
+
import { toProductionEntry } from '../../util/input.js';
|
|
4
|
+
const title = 'OpenClaw';
|
|
5
|
+
const enablers = 'This plugin is enabled when `package.json#openclaw` is present.';
|
|
6
|
+
const isEnabled = ({ manifest }) => Object.hasOwn(manifest, 'openclaw');
|
|
7
|
+
const config = ['package.json', 'openclaw.plugin.json'];
|
|
8
|
+
const isLoadConfig = ({ configFileName }) => configFileName === 'package.json';
|
|
9
|
+
const toEntries = (value) => (Array.isArray(value) ? value : [value]).flatMap(entry => typeof entry === 'string' ? [toProductionEntry(entry)] : []);
|
|
10
|
+
const toHookEntries = (value) => (Array.isArray(value) ? value : [value]).flatMap(entry => {
|
|
11
|
+
if (typeof entry !== 'string')
|
|
12
|
+
return [];
|
|
13
|
+
const dir = entry.trim().replace(/\/+$/, '');
|
|
14
|
+
return dir ? [toProductionEntry(`${dir}/{handler,index}.{ts,js}`)] : [];
|
|
15
|
+
});
|
|
16
|
+
const resolveConfig = (localConfig, options) => {
|
|
17
|
+
if (!localConfig)
|
|
18
|
+
return [];
|
|
19
|
+
const assetScripts = [localConfig.assetScripts?.build, localConfig.assetScripts?.copy].filter((script) => typeof script === 'string');
|
|
20
|
+
const assetScriptInputs = options
|
|
21
|
+
.getInputsFromScripts(assetScripts)
|
|
22
|
+
.map(input => input.type === 'entry' || input.type === 'deferResolveEntry' ? { ...input, production: true } : input);
|
|
23
|
+
return [
|
|
24
|
+
...toEntries(localConfig.extensions),
|
|
25
|
+
...toEntries(localConfig.runtimeExtensions),
|
|
26
|
+
...toEntries(localConfig.setupEntry),
|
|
27
|
+
...toEntries(localConfig.runtimeSetupEntry),
|
|
28
|
+
...toEntries(localConfig.providerCatalogEntry),
|
|
29
|
+
...toEntries(localConfig.channel?.configuredState?.specifier),
|
|
30
|
+
...toEntries(localConfig.channel?.persistedAuthState?.specifier),
|
|
31
|
+
...toHookEntries(localConfig.hooks),
|
|
32
|
+
...toEntries(localConfig.build?.staticAssets?.map(asset => asset.source)),
|
|
33
|
+
...assetScriptInputs,
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
const resolveFromAST = (_, options) => {
|
|
37
|
+
if (options.configFileName !== 'openclaw.plugin.json')
|
|
38
|
+
return [];
|
|
39
|
+
const sourceText = options.readFile(options.configFilePath).replace(/^\uFEFF/, '');
|
|
40
|
+
const { program } = _parseFile(`${options.configFilePath}.ts`, `(${sourceText}\n)`);
|
|
41
|
+
return [...collectPropertyValues(program, 'providerCatalogEntry')].map(entry => toProductionEntry(entry));
|
|
42
|
+
};
|
|
43
|
+
const plugin = {
|
|
44
|
+
title,
|
|
45
|
+
enablers,
|
|
46
|
+
isEnabled,
|
|
47
|
+
config,
|
|
48
|
+
isLoadConfig,
|
|
49
|
+
resolveConfig,
|
|
50
|
+
resolveFromAST,
|
|
51
|
+
};
|
|
52
|
+
export default plugin;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface OpenClawManifest {
|
|
2
|
+
assetScripts?: {
|
|
3
|
+
build?: string;
|
|
4
|
+
copy?: string;
|
|
5
|
+
};
|
|
6
|
+
build?: {
|
|
7
|
+
staticAssets?: {
|
|
8
|
+
source?: string;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
channel?: {
|
|
12
|
+
configuredState?: {
|
|
13
|
+
specifier?: string;
|
|
14
|
+
};
|
|
15
|
+
persistedAuthState?: {
|
|
16
|
+
specifier?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
extensions?: string | string[];
|
|
20
|
+
hooks?: string[];
|
|
21
|
+
providerCatalogEntry?: string;
|
|
22
|
+
runtimeExtensions?: string | string[];
|
|
23
|
+
setupEntry?: string;
|
|
24
|
+
runtimeSetupEntry?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toProductionEntry } from '../../util/input.js';
|
|
1
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
3
|
import compiler from './compiler.js';
|
|
3
4
|
const title = 'Tailwind';
|
|
@@ -12,11 +13,18 @@ const registerCompilers = ({ registerCompiler, hasDependency }) => {
|
|
|
12
13
|
break;
|
|
13
14
|
}
|
|
14
15
|
};
|
|
16
|
+
const args = {
|
|
17
|
+
binaries: ['tailwindcss'],
|
|
18
|
+
string: ['input'],
|
|
19
|
+
alias: { input: ['i'] },
|
|
20
|
+
resolveInputs: parsed => (parsed.input ? [toProductionEntry(parsed.input)] : []),
|
|
21
|
+
};
|
|
15
22
|
const plugin = {
|
|
16
23
|
title,
|
|
17
24
|
enablers,
|
|
18
25
|
isEnabled,
|
|
19
26
|
entry,
|
|
27
|
+
args,
|
|
20
28
|
registerCompilers,
|
|
21
29
|
};
|
|
22
30
|
export default plugin;
|
|
@@ -5,6 +5,8 @@ const title = 'tsdown';
|
|
|
5
5
|
const enablers = ['tsdown'];
|
|
6
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
7
|
const config = ['tsdown.config.{ts,mts,cts,js,mjs,cjs,json}', 'package.json'];
|
|
8
|
+
const sourcemapModes = new Set(['inline', 'hidden']);
|
|
9
|
+
const subcommands = new Set(['create', 'migrate']);
|
|
8
10
|
const isLoadConfig = ({ configFileName }) => configFileName === 'package.json' || configFileName.endsWith('.json');
|
|
9
11
|
const normalizeEntry = (entry) => {
|
|
10
12
|
if (!entry)
|
|
@@ -41,6 +43,47 @@ const resolveFromAST = program => [
|
|
|
41
43
|
];
|
|
42
44
|
const args = {
|
|
43
45
|
config: true,
|
|
46
|
+
args: args => {
|
|
47
|
+
if (subcommands.has(args[0]))
|
|
48
|
+
return [];
|
|
49
|
+
return args.filter((arg, index) => {
|
|
50
|
+
const previous = args[index - 1];
|
|
51
|
+
if (previous === '--sourcemap' && sourcemapModes.has(arg))
|
|
52
|
+
return false;
|
|
53
|
+
return previous !== '--watch' || arg.startsWith('-');
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
boolean: [
|
|
57
|
+
'attw',
|
|
58
|
+
'clean',
|
|
59
|
+
'deps.skip-node-modules-bundle',
|
|
60
|
+
'deps.skipNodeModulesBundle',
|
|
61
|
+
'devtools',
|
|
62
|
+
'dts',
|
|
63
|
+
'exe',
|
|
64
|
+
'exports',
|
|
65
|
+
'fail-on-warn',
|
|
66
|
+
'failOnWarn',
|
|
67
|
+
'minify',
|
|
68
|
+
'publint',
|
|
69
|
+
'report',
|
|
70
|
+
'shims',
|
|
71
|
+
'silent',
|
|
72
|
+
'sourcemap',
|
|
73
|
+
'treeshake',
|
|
74
|
+
'unbundle',
|
|
75
|
+
'unused',
|
|
76
|
+
'write',
|
|
77
|
+
],
|
|
78
|
+
resolveInputs: parsed => [
|
|
79
|
+
...[...parsed._, ...normalizeEntry(parsed.entry)].map(id => toProductionEntry(id, { allowIncludeExports: true })),
|
|
80
|
+
...[parsed.deps?.neverBundle, parsed.deps?.['never-bundle'], parsed.external]
|
|
81
|
+
.flat()
|
|
82
|
+
.filter(id => typeof id === 'string')
|
|
83
|
+
.map(id => toDependency(id, { optional: true })),
|
|
84
|
+
...(parsed.publint ? [toDependency('publint', { optional: true })] : []),
|
|
85
|
+
...(parsed.attw ? [toDependency('@arethetypeswrong/core', { optional: true })] : []),
|
|
86
|
+
],
|
|
44
87
|
};
|
|
45
88
|
const plugin = {
|
|
46
89
|
title,
|
|
@@ -3,7 +3,7 @@ import { toConfig, toDeferResolve, toProductionDependency } from '../../util/inp
|
|
|
3
3
|
import { join } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
const title = 'TypeScript';
|
|
6
|
-
const enablers = ['typescript', '@typescript/native-preview'];
|
|
6
|
+
const enablers = ['typescript', '@typescript/native', '@typescript/native-preview'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
8
|
const config = ['tsconfig.json'];
|
|
9
9
|
const resolveConfig = async (localConfig, options) => {
|
|
@@ -40,6 +40,7 @@ const addWorkspace = (options) => options.configFilePath
|
|
|
40
40
|
: `Create ${bright('knip.json')} configuration file with ${bright(`workspaces["${options.workspaceName}"]`)} object (${options.size} unused files)`;
|
|
41
41
|
const packageEntry = () => 'Package entry file not found';
|
|
42
42
|
const extensionUnregistered = () => `Extension in ${bright('project')} not registered as a compiler`;
|
|
43
|
+
const extensionExcluded = () => `Compiled extension excluded by ${bright('project')} (imports not followed)`;
|
|
43
44
|
export const hintPrinters = new Map([
|
|
44
45
|
['ignore', { print: unused }],
|
|
45
46
|
['ignoreFiles', { print: unused }],
|
|
@@ -51,6 +52,7 @@ export const hintPrinters = new Map([
|
|
|
51
52
|
['entry-empty', { print: empty }],
|
|
52
53
|
['project-empty', { print: empty }],
|
|
53
54
|
['project-extension-unregistered', { print: extensionUnregistered }],
|
|
55
|
+
['project-extension-excluded', { print: extensionExcluded }],
|
|
54
56
|
['entry-redundant', { print: remove }],
|
|
55
57
|
['project-redundant', { print: remove }],
|
|
56
58
|
['top-level-unconfigured', { print: add }],
|
|
@@ -69,7 +71,7 @@ const hintTypesOrder = [
|
|
|
69
71
|
['ignoreBinaries'],
|
|
70
72
|
['ignoreUnresolved'],
|
|
71
73
|
['entry-empty', 'project-empty', 'entry-redundant', 'project-redundant'],
|
|
72
|
-
['project-extension-unregistered'],
|
|
74
|
+
['project-extension-unregistered', 'project-extension-excluded'],
|
|
73
75
|
['package-entry'],
|
|
74
76
|
];
|
|
75
77
|
const UNCONFIGURED_MIN_FILES = 20;
|
|
@@ -416,6 +416,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
416
416
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
417
417
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
418
418
|
}, z.core.$strip>]>>;
|
|
419
|
+
openclaw: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
420
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
421
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
422
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
423
|
+
}, z.core.$strip>]>>;
|
|
419
424
|
orval: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
420
425
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
421
426
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1317,6 +1322,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1317
1322
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1318
1323
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1319
1324
|
}, z.core.$strip>]>>;
|
|
1325
|
+
openclaw: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1326
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1327
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1328
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1329
|
+
}, z.core.$strip>]>>;
|
|
1320
1330
|
orval: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1321
1331
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1322
1332
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -2236,6 +2246,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
2236
2246
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2237
2247
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2238
2248
|
}, z.core.$strip>]>>;
|
|
2249
|
+
openclaw: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2250
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2251
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2252
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2253
|
+
}, z.core.$strip>]>>;
|
|
2239
2254
|
orval: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2240
2255
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2241
2256
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -421,6 +421,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
421
421
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
422
422
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
423
423
|
}, z.core.$strip>]>;
|
|
424
|
+
openclaw: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
425
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
426
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
427
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
428
|
+
}, z.core.$strip>]>;
|
|
424
429
|
orval: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
425
430
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
426
431
|
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-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | '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' | 'tauri' | 'temporal' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
-
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expressive-code', 'fast', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'quasar', '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', 'tauri', 'temporal', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | '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' | 'tauri' | 'temporal' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
+
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expressive-code', 'fast', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'quasar', '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', 'tauri', 'temporal', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export type Preprocessor = (options: ReporterOptions) => ReporterOptions;
|
|
|
75
75
|
export type IssueSeverity = 'error' | 'warn' | 'off';
|
|
76
76
|
export type Rules = Record<IssueType, IssueSeverity>;
|
|
77
77
|
export type ConfigurationHints = Map<string, ConfigurationHint>;
|
|
78
|
-
export type ConfigurationHintType = 'ignore' | 'ignoreFiles' | 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'workspaces' | 'ignoreWorkspaces' | 'entry-redundant' | 'project-redundant' | 'entry-top-level' | 'project-top-level' | 'entry-empty' | 'project-empty' | 'project-extension-unregistered' | 'package-entry' | 'top-level-unconfigured' | 'workspace-unconfigured';
|
|
78
|
+
export type ConfigurationHintType = 'ignore' | 'ignoreFiles' | 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'workspaces' | 'ignoreWorkspaces' | 'entry-redundant' | 'project-redundant' | 'entry-top-level' | 'project-top-level' | 'entry-empty' | 'project-empty' | 'project-extension-unregistered' | 'project-extension-excluded' | 'package-entry' | 'top-level-unconfigured' | 'workspace-unconfigured';
|
|
79
79
|
export type ConfigurationHint = {
|
|
80
80
|
type: ConfigurationHintType;
|
|
81
81
|
identifier: string | RegExp;
|
|
@@ -2,7 +2,8 @@ import { type TemplateLiteral, type TSEnumDeclaration, type TSModuleDeclaration
|
|
|
2
2
|
import type { GetImportsAndExportsOptions, IgnoreExportsUsedInFile } from '../types/config.ts';
|
|
3
3
|
import type { SymbolType } from '../types/issues.ts';
|
|
4
4
|
import type { ExportMember } from '../types/module-graph.ts';
|
|
5
|
-
|
|
5
|
+
declare const parseFile: (filePath: string, sourceText: string) => import("oxc-parser").ParseResult;
|
|
6
|
+
export declare const _parseFile: typeof parseFile;
|
|
6
7
|
export declare const isAmbientDeclarationFile: (filePath: string, sourceText: string) => boolean;
|
|
7
8
|
export type ResolveModule = (specifier: string, containingFile: string) => ResolvedModule | undefined;
|
|
8
9
|
export interface ResolvedModule {
|
|
@@ -25,3 +26,4 @@ export declare const shouldCountRefs: (ignoreExportsUsedInFile: IgnoreExportsUse
|
|
|
25
26
|
export declare function extractNamespaceMembers(decl: TSModuleDeclaration, options: GetImportsAndExportsOptions, lineStarts: number[], getJSDocTags: (start: number) => Set<string>, prefix?: string): ExportMember[];
|
|
26
27
|
export declare const collectAugmentationRefs: (node: TSModuleDeclaration) => string[];
|
|
27
28
|
export declare function extractEnumMembers(decl: TSEnumDeclaration, options: GetImportsAndExportsOptions, lineStarts: number[], getJSDocTags: (start: number) => Set<string>): ExportMember[];
|
|
29
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Comment } from 'oxc-parser';
|
|
2
2
|
type CommentImportAdder = (specifier: string, identifier: string | undefined, alias: string | undefined, namespace: string | undefined, pos: number, modifiers: number) => void;
|
|
3
3
|
export declare const extractImportsFromComments: (comments: readonly Comment[], firstStmtStart: number, addImport: CommentImportAdder) => void;
|
|
4
4
|
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { parseSync } from 'oxc-parser';
|
|
1
2
|
import { IMPORT_FLAGS } from '../constants.js';
|
|
2
3
|
const jsDocImportRe = /import\(\s*['"]([^'"]+)['"]\s*\)(?:\.(\w+))?/g;
|
|
3
|
-
const jsDocImportTagRe = /@import\s+(?:\{[^}]*\}|\*\s+as\s+\w+)\s+from\s+['"]([^'"]+)['"]/g;
|
|
4
4
|
const jsDocTypeTagRe = /@(?:type|typedef|callback|param|arg|argument|property|prop|returns?|yields?|throws?|exception|this|extends|augments|implements|enum|template|satisfies|const|constant|member|var|namespace|module)\b/;
|
|
5
5
|
const jsxImportSourceRe = /@jsxImportSource\s+(\S+)/;
|
|
6
6
|
const referenceRe = /\s*<reference\s+(types|path)\s*=\s*"([^"]+)"[^/]*\/>/;
|
|
7
7
|
const envPragmaRe = /@(vitest|jest)-environment\s+([@\w./-]+)/g;
|
|
8
|
+
const jsDocImportTag = '@import';
|
|
9
|
+
const jsDocParseOptions = { sourceType: 'module' };
|
|
8
10
|
const resolveEnvironmentPragma = (tool, value) => {
|
|
9
11
|
if (value === 'node')
|
|
10
12
|
return undefined;
|
|
@@ -19,6 +21,47 @@ const resolveEnvironmentPragma = (tool, value) => {
|
|
|
19
21
|
return '@edge-runtime/vm';
|
|
20
22
|
return value;
|
|
21
23
|
};
|
|
24
|
+
const isWhitespace = (char) => char === 9 || char === 10 || char === 13 || char === 32;
|
|
25
|
+
const isHorizontalWhitespace = (char) => char === 9 || char === 13 || char === 32;
|
|
26
|
+
const isJsDocTagStart = (text, index) => {
|
|
27
|
+
let pos = text.lastIndexOf('\n', index - 1) + 1;
|
|
28
|
+
while (isWhitespace(text.charCodeAt(pos)))
|
|
29
|
+
pos++;
|
|
30
|
+
if (text.charCodeAt(pos) === 42) {
|
|
31
|
+
pos++;
|
|
32
|
+
while (isWhitespace(text.charCodeAt(pos)))
|
|
33
|
+
pos++;
|
|
34
|
+
}
|
|
35
|
+
return pos === index;
|
|
36
|
+
};
|
|
37
|
+
const getJsDocImportSource = (text, index) => {
|
|
38
|
+
let source = 'import type';
|
|
39
|
+
let pos = index + jsDocImportTag.length;
|
|
40
|
+
while (pos < text.length) {
|
|
41
|
+
const lineEnd = text.indexOf('\n', pos);
|
|
42
|
+
if (lineEnd === -1)
|
|
43
|
+
return source + text.slice(pos);
|
|
44
|
+
source += text.slice(pos, lineEnd);
|
|
45
|
+
let nextLine = lineEnd + 1;
|
|
46
|
+
while (isHorizontalWhitespace(text.charCodeAt(nextLine)))
|
|
47
|
+
nextLine++;
|
|
48
|
+
if (text.charCodeAt(nextLine) === 42) {
|
|
49
|
+
nextLine++;
|
|
50
|
+
while (isHorizontalWhitespace(text.charCodeAt(nextLine)))
|
|
51
|
+
nextLine++;
|
|
52
|
+
}
|
|
53
|
+
if (text.charCodeAt(nextLine) === 64)
|
|
54
|
+
return source;
|
|
55
|
+
source += '\n';
|
|
56
|
+
pos = nextLine;
|
|
57
|
+
}
|
|
58
|
+
return source;
|
|
59
|
+
};
|
|
60
|
+
const parseJsDocImport = (text, index) => {
|
|
61
|
+
const source = getJsDocImportSource(text, index);
|
|
62
|
+
const imported = parseSync('jsdoc.ts', source, jsDocParseOptions).module.staticImports[0];
|
|
63
|
+
return imported?.moduleRequest.value ? imported : undefined;
|
|
64
|
+
};
|
|
22
65
|
const isInJsDocTypeExpression = (text, index) => {
|
|
23
66
|
let depth = 0;
|
|
24
67
|
for (let pos = index - 1; pos >= 0; pos--) {
|
|
@@ -39,6 +82,24 @@ const isInJsDocTypeExpression = (text, index) => {
|
|
|
39
82
|
}
|
|
40
83
|
return false;
|
|
41
84
|
};
|
|
85
|
+
const addJsDocImport = (imported, pos, addImport) => {
|
|
86
|
+
const specifier = imported.moduleRequest.value;
|
|
87
|
+
if (imported.entries.length === 0) {
|
|
88
|
+
addImport(specifier, undefined, undefined, undefined, pos, IMPORT_FLAGS.TYPE_ONLY);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
for (const entry of imported.entries) {
|
|
92
|
+
if (entry.importName.kind === 'NamespaceObject') {
|
|
93
|
+
addImport(specifier, undefined, undefined, undefined, pos, IMPORT_FLAGS.TYPE_ONLY | IMPORT_FLAGS.OPAQUE);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const localName = entry.localName.value;
|
|
97
|
+
const identifier = entry.importName.kind === 'Default' ? 'default' : entry.importName.name;
|
|
98
|
+
const alias = localName === identifier ? undefined : localName;
|
|
99
|
+
addImport(specifier, identifier, alias, undefined, pos, IMPORT_FLAGS.TYPE_ONLY);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
42
103
|
export const extractImportsFromComments = (comments, firstStmtStart, addImport) => {
|
|
43
104
|
for (const comment of comments) {
|
|
44
105
|
const text = comment.value;
|
|
@@ -52,10 +113,15 @@ export const extractImportsFromComments = (comments, firstStmtStart, addImport)
|
|
|
52
113
|
const member = results[2];
|
|
53
114
|
addImport(specifier, member, undefined, undefined, comment.start + results.index, IMPORT_FLAGS.TYPE_ONLY);
|
|
54
115
|
}
|
|
55
|
-
|
|
56
|
-
while (
|
|
57
|
-
const
|
|
58
|
-
|
|
116
|
+
let index = text.indexOf(jsDocImportTag);
|
|
117
|
+
while (index !== -1) {
|
|
118
|
+
const next = index + jsDocImportTag.length;
|
|
119
|
+
if (isJsDocTagStart(text, index) && isWhitespace(text.charCodeAt(next))) {
|
|
120
|
+
const imported = parseJsDocImport(text, index);
|
|
121
|
+
if (imported)
|
|
122
|
+
addJsDocImport(imported, comment.start + index, addImport);
|
|
123
|
+
}
|
|
124
|
+
index = text.indexOf(jsDocImportTag, next);
|
|
59
125
|
}
|
|
60
126
|
}
|
|
61
127
|
const jsxMatch = text.match(jsxImportSourceRe);
|
|
@@ -2,4 +2,6 @@ import type { ParseResult, Visitor } from 'oxc-parser';
|
|
|
2
2
|
import type { GetImportsAndExportsOptions, IgnoreExportsUsedInFile, PluginVisitorContext } from '../types/config.ts';
|
|
3
3
|
import type { FileNode } from '../types/module-graph.ts';
|
|
4
4
|
import { type ResolveModule } from './ast-nodes.ts';
|
|
5
|
-
|
|
5
|
+
declare const getImportsAndExports: (filePath: string, sourceText: string, resolveModule: ResolveModule, options: GetImportsAndExportsOptions, ignoreExportsUsedInFile: IgnoreExportsUsedInFile, skipExportsForFile: boolean, visitor: Visitor, pluginCtx: PluginVisitorContext | undefined, cachedParseResult?: ParseResult) => FileNode;
|
|
6
|
+
export declare const _getImportsAndExports: typeof getImportsAndExports;
|
|
7
|
+
export {};
|
|
@@ -317,7 +317,7 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, igno
|
|
|
317
317
|
extractImportsFromComments(result.comments, firstStmtStart, addImport);
|
|
318
318
|
for (const [id, item] of exports) {
|
|
319
319
|
item.referencedIn = referencedInExport.get(id);
|
|
320
|
-
if (localRefs && shouldCountRefs(ignoreExportsUsedInFile, item.type) &&
|
|
320
|
+
if (localRefs && shouldCountRefs(ignoreExportsUsedInFile, item.type) && localRefs.has(id)) {
|
|
321
321
|
item.hasRefsInFile = true;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
@@ -155,7 +155,11 @@ export const isShadowed = (name, pos) => {
|
|
|
155
155
|
return false;
|
|
156
156
|
};
|
|
157
157
|
const _addLocalRef = (name, pos) => {
|
|
158
|
-
if (
|
|
158
|
+
if (isShadowed(name, pos))
|
|
159
|
+
return;
|
|
160
|
+
if (state.localImportMap.has(name))
|
|
161
|
+
(state.importedRefs ??= new Set()).add(name);
|
|
162
|
+
else
|
|
159
163
|
state.localRefs.add(name);
|
|
160
164
|
};
|
|
161
165
|
const _addShadowRange = (name, range) => {
|
|
@@ -731,6 +735,7 @@ function walkAST(program, sourceText, filePath, hasModuleSyntax, ctx) {
|
|
|
731
735
|
currentVarDeclStart: -1,
|
|
732
736
|
nsRanges: [],
|
|
733
737
|
memberRefsInFile: [],
|
|
738
|
+
importedRefs: undefined,
|
|
734
739
|
scopeDepth: 0,
|
|
735
740
|
scopeStarts: [],
|
|
736
741
|
scopeEnds: [],
|
|
@@ -835,6 +840,14 @@ function walkAST(program, sourceText, filePath, hasModuleSyntax, ctx) {
|
|
|
835
840
|
}
|
|
836
841
|
}
|
|
837
842
|
}
|
|
843
|
+
if (state.localRefs && state.importedRefs) {
|
|
844
|
+
for (const name of state.importedRefs) {
|
|
845
|
+
const exportNames = state.localToExports.get(name);
|
|
846
|
+
if (exportNames)
|
|
847
|
+
for (const exportName of exportNames)
|
|
848
|
+
state.localRefs.add(exportName);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
838
851
|
const localRefs = state.localRefs;
|
|
839
852
|
state = undefined;
|
|
840
853
|
return localRefs;
|
package/dist/util/Performance.js
CHANGED
|
@@ -9,7 +9,7 @@ const { values } = parseArgs({
|
|
|
9
9
|
'performance-fn': { type: 'string', multiple: true },
|
|
10
10
|
memory: { type: 'boolean' },
|
|
11
11
|
'memory-realtime': { type: 'boolean' },
|
|
12
|
-
duration: { type: 'boolean' },
|
|
12
|
+
duration: { type: 'boolean', short: 'u' },
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
const timerifyOnlyFnName = values['performance-fn'];
|
package/dist/util/codeowners.js
CHANGED
|
@@ -9,7 +9,7 @@ export function parseCodeowners(content) {
|
|
|
9
9
|
.map(rule => {
|
|
10
10
|
const [path, ...owners] = rule.split(/\s+/);
|
|
11
11
|
const { pattern } = convertGitignoreToPicomatchIgnorePatterns(path);
|
|
12
|
-
return { owners, match: picomatch(expandIgnorePatterns([pattern])) };
|
|
12
|
+
return { owners, match: picomatch(expandIgnorePatterns([pattern], true)) };
|
|
13
13
|
});
|
|
14
14
|
return (filePath) => {
|
|
15
15
|
for (const matcher of [...matchers].reverse()) {
|