knip 6.42.1 → 6.44.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/CacheConsultant.d.ts +1 -0
- package/dist/CacheConsultant.js +2 -0
- package/dist/CatalogCounselor.d.ts +1 -3
- package/dist/CatalogCounselor.js +18 -15
- package/dist/ConfigurationChief.d.ts +42 -0
- package/dist/DependencyDeputy.d.ts +2 -1
- package/dist/DependencyDeputy.js +9 -4
- package/dist/IssueCollector.js +1 -0
- package/dist/IssueFixer.js +10 -5
- package/dist/ProjectPrincipal.d.ts +3 -2
- package/dist/ProjectPrincipal.js +32 -10
- package/dist/WorkspaceWorker.d.ts +5 -2
- package/dist/WorkspaceWorker.js +35 -17
- package/dist/binaries/resolvers/bun.js +1 -0
- package/dist/binaries/resolvers/npm.js +12 -2
- package/dist/binaries/resolvers/pnpm.js +5 -3
- package/dist/binaries/util.js +2 -1
- package/dist/cli.js +6 -1
- package/dist/compilers/compilers.js +2 -2
- package/dist/compilers/index.d.ts +5 -0
- package/dist/compilers/index.js +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/graph/analyze.js +3 -2
- package/dist/graph/build.d.ts +2 -0
- package/dist/graph/build.js +37 -22
- package/dist/graph-explorer/cache.d.ts +2 -1
- package/dist/graph-explorer/cache.js +5 -1
- package/dist/graph-explorer/explorer.d.ts +3 -5
- package/dist/graph-explorer/explorer.js +24 -3
- package/dist/plugins/_vue/auto-import.js +31 -1
- package/dist/plugins/biome/index.js +1 -1
- package/dist/plugins/buf/index.d.ts +3 -0
- package/dist/plugins/buf/index.js +33 -0
- package/dist/plugins/buf/types.d.ts +8 -0
- package/dist/plugins/buf/types.js +1 -0
- package/dist/plugins/cspell/index.js +1 -0
- package/dist/plugins/dependency-cruiser/index.js +2 -2
- package/dist/plugins/docusaurus/helpers.js +4 -4
- package/dist/plugins/electron-forge/index.d.ts +3 -0
- package/dist/plugins/electron-forge/index.js +94 -0
- package/dist/plugins/electron-vite/index.js +2 -2
- package/dist/plugins/eslint/helpers.d.ts +1 -0
- package/dist/plugins/eslint/helpers.js +1 -1
- package/dist/plugins/eslint/resolveFromAST.js +35 -10
- package/dist/plugins/expo/helpers.d.ts +1 -1
- package/dist/plugins/expo/helpers.js +15 -8
- package/dist/plugins/expo/types.d.ts +2 -1
- package/dist/plugins/expressive-code/index.d.ts +1 -1
- package/dist/plugins/expressive-code/index.js +2 -2
- package/dist/plugins/gatsby/index.js +6 -6
- package/dist/plugins/gatsby/types.d.ts +1 -1
- package/dist/plugins/github-actions/index.js +1 -1
- package/dist/plugins/i18next-parser/index.js +2 -2
- package/dist/plugins/index.d.ts +8 -1
- package/dist/plugins/index.js +14 -0
- package/dist/plugins/jasmine/index.js +2 -2
- package/dist/plugins/karma/index.js +4 -4
- package/dist/plugins/kysely-codegen/index.d.ts +3 -0
- package/dist/plugins/kysely-codegen/index.js +20 -0
- package/dist/plugins/lefthook/index.js +2 -2
- package/dist/plugins/lingui/index.d.ts +3 -0
- package/dist/plugins/lingui/index.js +16 -0
- package/dist/plugins/lockfile-lint/index.js +2 -2
- package/dist/plugins/lost-pixel/index.js +2 -2
- package/dist/plugins/lunaria/index.js +2 -2
- package/dist/plugins/marko/index.js +5 -6
- package/dist/plugins/mastra/index.d.ts +3 -0
- package/dist/plugins/mastra/index.js +57 -0
- package/dist/plugins/mcp/index.d.ts +3 -0
- package/dist/plugins/mcp/index.js +33 -0
- package/dist/plugins/mcp/types.d.ts +11 -0
- package/dist/plugins/mcp/types.js +1 -0
- package/dist/plugins/mise/index.js +0 -3
- package/dist/plugins/mocha/index.js +42 -3
- package/dist/plugins/mocha/types.d.ts +1 -0
- package/dist/plugins/next/index.d.ts +3 -0
- package/dist/plugins/next/index.js +57 -9
- package/dist/plugins/next/types.d.ts +11 -0
- package/dist/plugins/next/types.js +1 -0
- package/dist/plugins/nx/index.js +3 -8
- package/dist/plugins/nyc/index.js +1 -1
- package/dist/plugins/openapi-ts/index.js +2 -2
- package/dist/plugins/oxfmt/index.js +2 -2
- package/dist/plugins/playwright/index.js +6 -11
- package/dist/plugins/pnpm/index.js +2 -4
- package/dist/plugins/purgecss/index.d.ts +3 -0
- package/dist/plugins/purgecss/index.js +16 -0
- package/dist/plugins/railway/index.js +1 -4
- package/dist/plugins/remix/index.js +1 -1
- package/dist/plugins/rstest/index.js +2 -2
- package/dist/plugins/serverless-framework/index.js +1 -1
- package/dist/plugins/storybook/index.js +5 -5
- package/dist/plugins/sveltekit/resolveFromAST.js +1 -1
- package/dist/plugins/syncpack/index.js +2 -2
- package/dist/plugins/tailwind/compiler.js +6 -2
- package/dist/plugins/tanstack-router/index.js +3 -2
- package/dist/plugins/taskfile/index.js +4 -7
- package/dist/plugins/textlint/helpers.js +2 -2
- package/dist/plugins/travis/index.js +2 -2
- package/dist/plugins/typescript/index.js +9 -7
- package/dist/plugins/unocss/index.js +2 -2
- package/dist/plugins/vite-plugin-pwa/index.js +1 -4
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.d.ts +0 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vite-pwa-assets-generator/index.js +2 -2
- package/dist/plugins/vitest/helpers.d.ts +1 -1
- package/dist/plugins/vitest/helpers.js +17 -10
- package/dist/plugins/vitest/index.js +53 -45
- package/dist/plugins/vitest/types.d.ts +11 -7
- package/dist/plugins/webpack/index.js +4 -2
- package/dist/plugins/yarn/index.js +2 -4
- package/dist/reporters/codeclimate.d.ts +2 -2
- package/dist/reporters/codeclimate.js +2 -4
- package/dist/reporters/codeowners.d.ts +2 -2
- package/dist/reporters/codeowners.js +9 -9
- package/dist/reporters/compact.d.ts +2 -2
- package/dist/reporters/compact.js +8 -7
- package/dist/reporters/cycles.d.ts +2 -2
- package/dist/reporters/cycles.js +7 -6
- package/dist/reporters/disclosure.d.ts +2 -2
- package/dist/reporters/disclosure.js +6 -4
- package/dist/reporters/github-actions.d.ts +2 -2
- package/dist/reporters/github-actions.js +7 -5
- package/dist/reporters/index.d.ts +10 -10
- package/dist/reporters/json.d.ts +2 -2
- package/dist/reporters/json.js +2 -4
- package/dist/reporters/markdown.d.ts +2 -2
- package/dist/reporters/markdown.js +11 -9
- package/dist/reporters/sarif.d.ts +2 -2
- package/dist/reporters/sarif.js +2 -3
- package/dist/reporters/symbols.d.ts +2 -2
- package/dist/reporters/symbols.js +6 -4
- package/dist/run.d.ts +1 -1
- package/dist/run.js +3 -10
- package/dist/schema/configuration.d.ts +105 -0
- package/dist/schema/plugins.d.ts +35 -0
- package/dist/schema/plugins.js +7 -0
- package/dist/session/configuration.d.ts +12 -0
- package/dist/session/configuration.js +43 -0
- package/dist/session/incremental.d.ts +54 -0
- package/dist/session/incremental.js +49 -0
- package/dist/session/session.d.ts +1 -1
- package/dist/session/session.js +62 -27
- package/dist/session/watch.d.ts +2 -0
- package/dist/session/watch.js +41 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +7 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/issues.d.ts +4 -0
- package/dist/types/package-json.d.ts +0 -3
- package/dist/typescript/ast-nodes.js +3 -3
- package/dist/typescript/get-imports-and-exports.js +2 -0
- package/dist/typescript/visitors/calls.js +15 -11
- package/dist/typescript/visitors/exports.js +5 -4
- package/dist/typescript/visitors/imports.d.ts +2 -1
- package/dist/typescript/visitors/imports.js +25 -19
- package/dist/typescript/visitors/members.js +23 -26
- package/dist/typescript/visitors/walk.d.ts +3 -0
- package/dist/typescript/visitors/walk.js +55 -3
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +3 -0
- package/dist/util/create-input-handler.js +1 -1
- package/dist/util/create-options.d.ts +72 -1
- package/dist/util/create-options.js +13 -2
- package/dist/util/file-entry-cache.d.ts +2 -0
- package/dist/util/file-entry-cache.js +19 -1
- package/dist/util/gitignore-cache.d.ts +1 -0
- package/dist/util/gitignore-cache.js +1 -0
- package/dist/util/glob-core.js +4 -2
- package/dist/util/glob.d.ts +1 -0
- package/dist/util/glob.js +6 -0
- package/dist/util/input.d.ts +2 -0
- package/dist/util/loader.d.ts +1 -0
- package/dist/util/loader.js +38 -2
- package/dist/util/modules.js +5 -2
- package/dist/util/path.d.ts +1 -0
- package/dist/util/path.js +1 -0
- package/dist/util/remove-export.js +3 -1
- package/dist/util/reporter.d.ts +1 -1
- package/dist/util/reporter.js +53 -9
- package/dist/util/watch.d.ts +5 -11
- package/dist/util/watch.js +84 -68
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/schema.json +28 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IMPORT_FLAGS, OPAQUE } from '../../constants.js';
|
|
2
2
|
import { addValue } from '../../util/module-graph.js';
|
|
3
|
+
import { isStartsLikePackageName } from '../../util/modules.js';
|
|
3
4
|
import { getSafeScriptFromArgs, getScriptFromArg, getStringValue, isStringLiteral } from '../ast-nodes.js';
|
|
4
5
|
import { isShadowed } from './walk.js';
|
|
5
6
|
function getRegisteredCustomElement(node, s) {
|
|
@@ -136,23 +137,26 @@ export function handleCallExpression(node, s) {
|
|
|
136
137
|
s.addImport(specifier, undefined, undefined, undefined, node.arguments[0].start, IMPORT_FLAGS.ENTRY);
|
|
137
138
|
return;
|
|
138
139
|
}
|
|
139
|
-
if (s.hasNodeModuleImport &&
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
if (s.hasNodeModuleImport && node.arguments.length >= 1 && isStringLiteral(node.arguments[0])) {
|
|
141
|
+
const { callee } = node;
|
|
142
|
+
const nodeModuleMethod = callee.type === 'Identifier'
|
|
143
|
+
? callee.name
|
|
144
|
+
: callee.type === 'MemberExpression' &&
|
|
145
|
+
!callee.computed &&
|
|
146
|
+
callee.object.type === 'Identifier' &&
|
|
147
|
+
callee.object.name === 'module' &&
|
|
148
|
+
callee.property.type === 'Identifier' &&
|
|
149
|
+
callee.property.name;
|
|
148
150
|
const specifier = getStringValue(node.arguments[0]);
|
|
149
151
|
const arg1 = node.arguments[1];
|
|
150
|
-
if (
|
|
152
|
+
if ((nodeModuleMethod === 'register' &&
|
|
153
|
+
specifier &&
|
|
151
154
|
(!specifier.startsWith('.') ||
|
|
152
155
|
(arg1?.type === 'MemberExpression' &&
|
|
153
156
|
!arg1.computed &&
|
|
154
157
|
arg1.object.type === 'MetaProperty' &&
|
|
155
|
-
arg1.property.name === 'url')))
|
|
158
|
+
arg1.property.name === 'url'))) ||
|
|
159
|
+
(nodeModuleMethod === 'findPackageJSON' && isStartsLikePackageName(specifier) && !URL.canParse(specifier))) {
|
|
156
160
|
s.addImport(specifier, undefined, undefined, undefined, node.arguments[0].start, IMPORT_FLAGS.ENTRY);
|
|
157
161
|
return;
|
|
158
162
|
}
|
|
@@ -88,7 +88,7 @@ export function handleExportNamed(node, s) {
|
|
|
88
88
|
}
|
|
89
89
|
else if (declarator.id.type === 'Identifier') {
|
|
90
90
|
const name = declarator.id.name;
|
|
91
|
-
const fix = s.getFix(exportStart, exportStart + 7);
|
|
91
|
+
const fix = decl.declarations.length === 1 ? s.getFix(exportStart, exportStart + 7) : undefined;
|
|
92
92
|
const jsDocTags = s.getJSDocTags(exportStart);
|
|
93
93
|
let isReExport = false;
|
|
94
94
|
if (declarator.init?.type === 'Identifier') {
|
|
@@ -235,11 +235,12 @@ export function handleExportDefault(node, s) {
|
|
|
235
235
|
if (s.skipExports || s.isInNamespace(node))
|
|
236
236
|
return;
|
|
237
237
|
const decl = node.declaration;
|
|
238
|
-
const
|
|
238
|
+
const isNamedDeclaration = (decl.type === 'ClassDeclaration' || decl.type === 'FunctionDeclaration') && decl.id;
|
|
239
|
+
const start = decl.type === 'ClassDeclaration' ? Math.min(node.start, decl.decorators[0]?.start ?? node.start) : node.start;
|
|
239
240
|
const fix = s.options.isFixExports
|
|
240
|
-
?
|
|
241
|
+
? isNamedDeclaration
|
|
241
242
|
? [node.start, decl.start, FIX_FLAGS.NONE]
|
|
242
|
-
: [
|
|
243
|
+
: [start, node.end + 1, FIX_FLAGS.NONE]
|
|
243
244
|
: undefined;
|
|
244
245
|
let type = SYMBOL_TYPE.UNKNOWN;
|
|
245
246
|
let pos = decl.start;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ImportExpression, VariableDeclarator } from 'oxc-parser';
|
|
1
|
+
import type { ArrayExpression, Expression, ImportExpression, VariableDeclarator } from 'oxc-parser';
|
|
2
2
|
import type { WalkState } from './walk.ts';
|
|
3
|
+
export declare function getPromiseAllElements(expression: Expression): ArrayExpression['elements'] | undefined;
|
|
3
4
|
export declare function handleVariableDeclarator(node: VariableDeclarator, s: WalkState): void;
|
|
4
5
|
export declare function handleImportExpression(node: ImportExpression, s: WalkState): void;
|
|
@@ -2,6 +2,17 @@ import { IMPORT_FLAGS, IMPORT_STAR, OPAQUE } from '../../constants.js';
|
|
|
2
2
|
import { addValue } from '../../util/module-graph.js';
|
|
3
3
|
import { isInNodeModules } from '../../util/path.js';
|
|
4
4
|
import { getStringValue, isStringLiteral } from '../ast-nodes.js';
|
|
5
|
+
export function getPromiseAllElements(expression) {
|
|
6
|
+
if (expression.type === 'CallExpression' &&
|
|
7
|
+
expression.callee.type === 'MemberExpression' &&
|
|
8
|
+
!expression.callee.computed &&
|
|
9
|
+
expression.callee.object.type === 'Identifier' &&
|
|
10
|
+
expression.callee.object.name === 'Promise' &&
|
|
11
|
+
expression.callee.property.name === 'all' &&
|
|
12
|
+
expression.arguments[0]?.type === 'ArrayExpression') {
|
|
13
|
+
return expression.arguments[0].elements;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
5
16
|
export function handleVariableDeclarator(node, s) {
|
|
6
17
|
const init = node.init;
|
|
7
18
|
if (!init)
|
|
@@ -16,6 +27,7 @@ export function handleVariableDeclarator(node, s) {
|
|
|
16
27
|
if (importExpr && isStringLiteral(importExpr.source)) {
|
|
17
28
|
s.handledImportExpressions.add(importExpr.start);
|
|
18
29
|
const specifier = getStringValue(importExpr.source);
|
|
30
|
+
const caughtFlag = init.type === 'AwaitExpression' && s.caughtTryBlockEnds.length > 0 ? IMPORT_FLAGS.CAUGHT : IMPORT_FLAGS.NONE;
|
|
19
31
|
if (node.id.type === 'ObjectPattern') {
|
|
20
32
|
for (const prop of node.id.properties) {
|
|
21
33
|
if (prop.type === 'Property') {
|
|
@@ -26,16 +38,16 @@ export function handleVariableDeclarator(node, s) {
|
|
|
26
38
|
: undefined;
|
|
27
39
|
const localName = prop.value?.type === 'Identifier' ? prop.value.name : importedName;
|
|
28
40
|
const alias = localName !== importedName ? localName : undefined;
|
|
29
|
-
s.addImport(specifier, importedName, alias, undefined, prop.key?.start ?? prop.start, IMPORT_FLAGS.DYNAMIC);
|
|
41
|
+
s.addImport(specifier, importedName, alias, undefined, prop.key?.start ?? prop.start, IMPORT_FLAGS.DYNAMIC | caughtFlag);
|
|
30
42
|
}
|
|
31
43
|
else if (prop.type === 'RestElement' && prop.argument?.type === 'Identifier') {
|
|
32
|
-
s.addImport(specifier, IMPORT_STAR, prop.argument.name, undefined, prop.start, IMPORT_FLAGS.DYNAMIC);
|
|
44
|
+
s.addImport(specifier, IMPORT_STAR, prop.argument.name, undefined, prop.start, IMPORT_FLAGS.DYNAMIC | caughtFlag);
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
else if (node.id.type === 'Identifier') {
|
|
37
49
|
if (init.type === 'AwaitExpression') {
|
|
38
|
-
s.addImport(specifier, 'default', node.id.name, undefined, importExpr.source.start, IMPORT_FLAGS.DYNAMIC);
|
|
50
|
+
s.addImport(specifier, 'default', node.id.name, undefined, importExpr.source.start, IMPORT_FLAGS.DYNAMIC | caughtFlag);
|
|
39
51
|
const resolved = s.resolveModule(specifier, s.filePath);
|
|
40
52
|
if (resolved && !resolved.isExternalLibraryImport && !isInNodeModules(resolved.resolvedFileName)) {
|
|
41
53
|
s.localImportMap.set(node.id.name, {
|
|
@@ -47,11 +59,11 @@ export function handleVariableDeclarator(node, s) {
|
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
else {
|
|
50
|
-
s.addImport(specifier, undefined, undefined, undefined, importExpr.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.OPAQUE);
|
|
62
|
+
s.addImport(specifier, undefined, undefined, undefined, importExpr.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.OPAQUE | caughtFlag);
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
65
|
else {
|
|
54
|
-
s.addImport(specifier, undefined, undefined, undefined, importExpr.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.OPAQUE);
|
|
66
|
+
s.addImport(specifier, undefined, undefined, undefined, importExpr.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.OPAQUE | caughtFlag);
|
|
55
67
|
}
|
|
56
68
|
return;
|
|
57
69
|
}
|
|
@@ -87,16 +99,8 @@ export function handleVariableDeclarator(node, s) {
|
|
|
87
99
|
}
|
|
88
100
|
return;
|
|
89
101
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
init.argument.callee.type === 'MemberExpression' &&
|
|
93
|
-
!init.argument.callee.computed &&
|
|
94
|
-
init.argument.callee.object.type === 'Identifier' &&
|
|
95
|
-
init.argument.callee.object.name === 'Promise' &&
|
|
96
|
-
init.argument.callee.property.name === 'all' &&
|
|
97
|
-
init.argument.arguments[0]?.type === 'ArrayExpression' &&
|
|
98
|
-
node.id.type === 'ArrayPattern') {
|
|
99
|
-
const imports = init.argument.arguments[0].elements;
|
|
102
|
+
const imports = init.type === 'AwaitExpression' ? getPromiseAllElements(init.argument) : undefined;
|
|
103
|
+
if (imports && node.id.type === 'ArrayPattern') {
|
|
100
104
|
const bindings = node.id.elements;
|
|
101
105
|
for (let i = 0; i < imports.length; i++) {
|
|
102
106
|
const imp = imports[i];
|
|
@@ -106,6 +110,7 @@ export function handleVariableDeclarator(node, s) {
|
|
|
106
110
|
if (imp?.type === 'ImportExpression' && isStringLiteral(imp.source)) {
|
|
107
111
|
s.handledImportExpressions.add(imp.start);
|
|
108
112
|
const specifier = getStringValue(imp.source);
|
|
113
|
+
const caughtFlag = s.caughtTryBlockEnds.length > 0 ? IMPORT_FLAGS.CAUGHT : IMPORT_FLAGS.NONE;
|
|
109
114
|
if (binding?.type === 'ObjectPattern') {
|
|
110
115
|
for (const prop of binding.properties) {
|
|
111
116
|
if (prop.type === 'Property') {
|
|
@@ -114,12 +119,12 @@ export function handleVariableDeclarator(node, s) {
|
|
|
114
119
|
: prop.key?.type === 'Literal' && typeof prop.key.value === 'string'
|
|
115
120
|
? prop.key.value
|
|
116
121
|
: undefined;
|
|
117
|
-
s.addImport(specifier, importedName, undefined, undefined, prop.key?.start ?? prop.start,
|
|
122
|
+
s.addImport(specifier, importedName, undefined, undefined, prop.key?.start ?? prop.start, caughtFlag);
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
else if (binding?.type === 'Identifier') {
|
|
122
|
-
s.addImport(specifier, 'default', binding.name, undefined, imp.source.start, IMPORT_FLAGS.DYNAMIC);
|
|
127
|
+
s.addImport(specifier, 'default', binding.name, undefined, imp.source.start, IMPORT_FLAGS.DYNAMIC | caughtFlag);
|
|
123
128
|
const resolved = s.resolveModule(specifier, s.filePath);
|
|
124
129
|
if (resolved && !resolved.isExternalLibraryImport && !isInNodeModules(resolved.resolvedFileName)) {
|
|
125
130
|
s.localImportMap.set(binding.name, {
|
|
@@ -131,7 +136,7 @@ export function handleVariableDeclarator(node, s) {
|
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
else {
|
|
134
|
-
s.addImport(specifier, undefined, undefined, undefined, imp.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.SIDE_EFFECTS);
|
|
139
|
+
s.addImport(specifier, undefined, undefined, undefined, imp.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.SIDE_EFFECTS | caughtFlag);
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
}
|
|
@@ -268,6 +273,7 @@ export function handleImportExpression(node, s) {
|
|
|
268
273
|
return;
|
|
269
274
|
const specifier = getStringValue(node.source);
|
|
270
275
|
if (specifier) {
|
|
271
|
-
s.
|
|
276
|
+
const caughtFlag = s.caughtImportExpressions.has(node.start) ? IMPORT_FLAGS.CAUGHT : IMPORT_FLAGS.NONE;
|
|
277
|
+
s.addImport(specifier, undefined, undefined, undefined, node.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.OPAQUE | caughtFlag);
|
|
272
278
|
}
|
|
273
279
|
}
|
|
@@ -2,6 +2,7 @@ import { OPAQUE } from '../../constants.js';
|
|
|
2
2
|
import { addValue } from '../../util/module-graph.js';
|
|
3
3
|
import { getStringValue, isStringLiteral } from '../ast-nodes.js';
|
|
4
4
|
import { isShadowed } from './walk.js';
|
|
5
|
+
const chainNames = [];
|
|
5
6
|
function markWholeObjectRead(internalImport, id) {
|
|
6
7
|
(internalImport.enumerated ??= new Set()).add(id);
|
|
7
8
|
}
|
|
@@ -9,7 +10,10 @@ function isNumericKey(value) {
|
|
|
9
10
|
return value != null && Number.isFinite(Number(value)) && String(Number(value)) === value;
|
|
10
11
|
}
|
|
11
12
|
export function handleMemberExpression(node, s) {
|
|
12
|
-
if (node.object.type === 'MemberExpression' &&
|
|
13
|
+
if (node.object.type === 'MemberExpression' &&
|
|
14
|
+
node.object.object.type === 'MemberExpression' &&
|
|
15
|
+
!node.computed &&
|
|
16
|
+
node.property.type === 'Identifier') {
|
|
13
17
|
s.chainedMemberExprs.add(node.object);
|
|
14
18
|
}
|
|
15
19
|
if (node.object.type === 'Identifier') {
|
|
@@ -143,34 +147,27 @@ export function handleMemberExpression(node, s) {
|
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
if (node.object.type === 'MemberExpression' &&
|
|
146
|
-
!node.object.computed &&
|
|
147
150
|
node.object.object.type === 'MemberExpression' &&
|
|
148
|
-
!
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (!isShadowed(
|
|
156
|
-
const _import = s.localImportMap.get(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
151
|
+
!s.chainedMemberExprs.has(node)) {
|
|
152
|
+
chainNames.length = 0;
|
|
153
|
+
let root = node;
|
|
154
|
+
while (root.type === 'MemberExpression' && !root.computed && root.property.type === 'Identifier') {
|
|
155
|
+
chainNames.push(root.property.name);
|
|
156
|
+
root = root.object;
|
|
157
|
+
}
|
|
158
|
+
if (root.type === 'Identifier' && !isShadowed(root.name, root.start)) {
|
|
159
|
+
const _import = s.localImportMap.get(root.name);
|
|
160
|
+
const internalImport = _import && s.internal.get(_import.filePath);
|
|
161
|
+
if (internalImport || !_import) {
|
|
162
|
+
let path = '';
|
|
163
|
+
for (let i = chainNames.length - 1; i >= 0; i--) {
|
|
164
|
+
path = path ? `${path}.${chainNames[i]}` : chainNames[i];
|
|
165
|
+
if (internalImport)
|
|
166
|
+
s.addNsMemberRefs(internalImport, root.name, path);
|
|
167
|
+
else
|
|
168
|
+
s.memberRefsInFile.push(root.name, path);
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
|
-
else {
|
|
169
|
-
const a = node.object.object.property.name;
|
|
170
|
-
const b = node.object.property.name;
|
|
171
|
-
const c = node.property.name;
|
|
172
|
-
s.memberRefsInFile.push(rootName, a, rootName, `${a}.${b}`, rootName, `${a}.${b}.${c}`);
|
|
173
|
-
}
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
173
|
if (node.object.type === 'MemberExpression' &&
|
|
@@ -44,6 +44,7 @@ interface WalkContext {
|
|
|
44
44
|
programFiles: Set<string>;
|
|
45
45
|
entryFiles: Set<string>;
|
|
46
46
|
handledImportExpressions: Set<number>;
|
|
47
|
+
caughtImportExpressions: Set<number>;
|
|
47
48
|
visitor: Visitor;
|
|
48
49
|
getJSDocTags: (nodeStart: number) => Set<string>;
|
|
49
50
|
}
|
|
@@ -53,6 +54,8 @@ export interface WalkState extends WalkContext {
|
|
|
53
54
|
isJS: boolean;
|
|
54
55
|
isModuleFile: boolean;
|
|
55
56
|
handledImportExpressions: Set<number>;
|
|
57
|
+
caughtTryBlockEnds: number[];
|
|
58
|
+
functionCaughtTryBlockEnds: number[][];
|
|
56
59
|
bareExprRefs: Set<string>;
|
|
57
60
|
accessedAliases: Set<string>;
|
|
58
61
|
nsContainers: Map<string, Map<string, string>>;
|
|
@@ -7,7 +7,7 @@ import { collectAugmentationRefs, getLineAndCol, getStringValue, isStringLiteral
|
|
|
7
7
|
import { EMPTY_TAGS } from './jsdoc.js';
|
|
8
8
|
import { handleCallExpression, handleNewExpression, trackCustomElementRegistry } from './calls.js';
|
|
9
9
|
import { handleExportAssignment, handleExportDefault, handleExportNamed, handleExpressionStatement, } from './exports.js';
|
|
10
|
-
import { handleImportExpression, handleVariableDeclarator } from './imports.js';
|
|
10
|
+
import { getPromiseAllElements, handleImportExpression, handleVariableDeclarator } from './imports.js';
|
|
11
11
|
import { handleJSXMemberExpression, handleMemberExpression } from './members.js';
|
|
12
12
|
let state;
|
|
13
13
|
const _getFix = (start, end, flags) => state.options.isFixExports ? [start, end, flags ?? FIX_FLAGS.NONE] : undefined;
|
|
@@ -267,16 +267,30 @@ const coreVisitorObject = {
|
|
|
267
267
|
state.scopeEnds[state.scopeDepth] = node.end;
|
|
268
268
|
state.scopeDepth++;
|
|
269
269
|
},
|
|
270
|
-
'BlockStatement:exit'() {
|
|
270
|
+
'BlockStatement:exit'(node) {
|
|
271
271
|
state.scopeDepth--;
|
|
272
|
+
if (state.caughtTryBlockEnds[state.caughtTryBlockEnds.length - 1] === node.end)
|
|
273
|
+
state.caughtTryBlockEnds.pop();
|
|
272
274
|
},
|
|
273
275
|
TSModuleDeclaration(node) {
|
|
274
276
|
state.nsRanges.push([node.start, node.end]);
|
|
275
|
-
if (node.kind
|
|
277
|
+
if (node.kind === 'global' || !isStringLiteral(node.id))
|
|
278
|
+
return;
|
|
279
|
+
if (state.isModuleFile) {
|
|
276
280
|
const specifier = getStringValue(node.id);
|
|
277
281
|
for (const name of collectAugmentationRefs(node))
|
|
278
282
|
state.addImport(specifier, name, undefined, undefined, node.id.start, IMPORT_FLAGS.TYPE_ONLY | IMPORT_FLAGS.AUGMENT);
|
|
279
283
|
}
|
|
284
|
+
else if (node.body?.type === 'TSModuleBlock') {
|
|
285
|
+
for (const stmt of node.body.body) {
|
|
286
|
+
if ((stmt.type === 'ImportDeclaration' ||
|
|
287
|
+
stmt.type === 'ExportAllDeclaration' ||
|
|
288
|
+
stmt.type === 'ExportNamedDeclaration') &&
|
|
289
|
+
stmt.source) {
|
|
290
|
+
state.addImport(stmt.source.value, undefined, undefined, undefined, stmt.source.start, IMPORT_FLAGS.TYPE_ONLY | IMPORT_FLAGS.OPAQUE);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
280
294
|
},
|
|
281
295
|
TSInterfaceDeclaration(node) {
|
|
282
296
|
if (state.scopeDepth > 0 || state.isInNamespace(node))
|
|
@@ -307,6 +321,8 @@ const coreVisitorObject = {
|
|
|
307
321
|
state.staticBlockDepth--;
|
|
308
322
|
},
|
|
309
323
|
FunctionDeclaration(node) {
|
|
324
|
+
state.functionCaughtTryBlockEnds.push(state.caughtTryBlockEnds);
|
|
325
|
+
state.caughtTryBlockEnds = [];
|
|
310
326
|
if (node.id?.name) {
|
|
311
327
|
state.localDeclarationTypes.set(node.id.name, SYMBOL_TYPE.FUNCTION);
|
|
312
328
|
state.localDeclarations.set(node.id.name, node);
|
|
@@ -315,12 +331,25 @@ const coreVisitorObject = {
|
|
|
315
331
|
}
|
|
316
332
|
_addParamShadows(node.params, node.body);
|
|
317
333
|
},
|
|
334
|
+
'FunctionDeclaration:exit'() {
|
|
335
|
+
state.caughtTryBlockEnds = state.functionCaughtTryBlockEnds.pop();
|
|
336
|
+
},
|
|
318
337
|
FunctionExpression(node) {
|
|
338
|
+
state.functionCaughtTryBlockEnds.push(state.caughtTryBlockEnds);
|
|
339
|
+
state.caughtTryBlockEnds = [];
|
|
319
340
|
_addParamShadows(node.params, node.body);
|
|
320
341
|
},
|
|
342
|
+
'FunctionExpression:exit'() {
|
|
343
|
+
state.caughtTryBlockEnds = state.functionCaughtTryBlockEnds.pop();
|
|
344
|
+
},
|
|
321
345
|
ArrowFunctionExpression(node) {
|
|
346
|
+
state.functionCaughtTryBlockEnds.push(state.caughtTryBlockEnds);
|
|
347
|
+
state.caughtTryBlockEnds = [];
|
|
322
348
|
_addParamShadows(node.params, node.body);
|
|
323
349
|
},
|
|
350
|
+
'ArrowFunctionExpression:exit'() {
|
|
351
|
+
state.caughtTryBlockEnds = state.functionCaughtTryBlockEnds.pop();
|
|
352
|
+
},
|
|
324
353
|
CatchClause(node) {
|
|
325
354
|
if (node.param?.type === 'Identifier' && node.body) {
|
|
326
355
|
_addShadowRange(node.param.name, [node.body.start, node.body.end]);
|
|
@@ -368,6 +397,27 @@ const coreVisitorObject = {
|
|
|
368
397
|
ImportExpression(node) {
|
|
369
398
|
handleImportExpression(node, state);
|
|
370
399
|
},
|
|
400
|
+
TryStatement(node) {
|
|
401
|
+
if (node.handler)
|
|
402
|
+
state.caughtTryBlockEnds.push(node.block.end);
|
|
403
|
+
},
|
|
404
|
+
AwaitExpression(node) {
|
|
405
|
+
if (state.caughtTryBlockEnds.length === 0)
|
|
406
|
+
return;
|
|
407
|
+
const { argument } = node;
|
|
408
|
+
if (argument.type === 'ImportExpression') {
|
|
409
|
+
state.caughtImportExpressions.add(argument.start);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
const elements = getPromiseAllElements(argument);
|
|
413
|
+
if (!elements)
|
|
414
|
+
return;
|
|
415
|
+
for (const element of elements) {
|
|
416
|
+
if (element?.type === 'ImportExpression')
|
|
417
|
+
state.caughtImportExpressions.add(element.start);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
},
|
|
371
421
|
CallExpression(node) {
|
|
372
422
|
handleCallExpression(node, state);
|
|
373
423
|
},
|
|
@@ -821,6 +871,8 @@ function walkAST(program, sourceText, filePath, hasModuleSyntax, ctx) {
|
|
|
821
871
|
localToExports: new Map(),
|
|
822
872
|
customElementRegistries: new Set(),
|
|
823
873
|
classNameStack: [],
|
|
874
|
+
caughtTryBlockEnds: [],
|
|
875
|
+
functionCaughtTryBlockEnds: [],
|
|
824
876
|
staticBlockDepth: 0,
|
|
825
877
|
addExport: _addExport,
|
|
826
878
|
getFix: _getFix,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -h, --help Print this help text\n -V, --version Print version\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n -c, --config [file] Configuration file path\n (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n --use-tsconfig-files Use tsconfig.json to define project files (override `project` patterns)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n\nMode\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --include-entry-exports Include entry files when reporting unused exports\n --no-gitignore Don't respect .gitignore\n -p, --production Analyze only production source files (e.g. no test files, devDependencies)\n -s, --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -w, --watch Watch mode\n\nScope\n -W, --workspace [filter] Filter workspaces by name, directory, or glob (can be repeated)\n -D, --directory [dir] Run process from a different directory (default: cwd)\n --include Include provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved,catalog,catalogReferences\n --exports Shortcut for --include exports,nsExports,types,nsTypes,enumMembers,namespaceMembers,duplicates\n --files Shortcut for --include files\n --cycles Shortcut for --include cycles (circular dependencies)\n --tags Include or exclude tagged exports\n\nFix\n -f, --fix Fix issues (modifies files in your repo)\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n -F, --format Format modified files after --fix using the local formatter\n\nOutput\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter (default: symbols), can be repeated (3)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --no-config-hints Suppress configuration hints\n --no-tag-hints Suppress tag hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --treat-tag-hints-as-errors Exit with non-zero code (1) if there are any tag hints\n --max-issues Maximum number of total issues before non-zero exit code (default: 0)\n --max-show-issues Maximum number of issues to display per type\n --no-exit-code Always exit with code zero (0)\n\nTroubleshooting\n -d, --debug Show debug output\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n --performance Measure count and running time of key functions and display stats table\n --performance-fn [name] Measure only function [name]\n -u, --duration Print total running time (zero overhead, no instrumentation)\n --trace Show trace output\n --trace-dependency [name] Show files that import the named dependency\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, types, nsTypes, enumMembers, namespaceMembers, duplicates, catalog, catalogReferences, cycles\n(2) Fixable issue types: dependencies, exports, types, files, catalog\n(3) Built-in reporters: symbols (default), compact, codeowners, cycles, json, codeclimate, markdown, disclosure, github-actions, sarif\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip --workspace @myorg/* --workspace '!@myorg/legacy'\n$ knip --workspace './apps/*' --workspace '@shared/utils'\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
|
|
1
|
+
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -h, --help Print this help text\n -V, --version Print version\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n -c, --config [file] Configuration file path\n (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n --use-tsconfig-files Use tsconfig.json to define project files (override `project` patterns)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n\nMode\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --include-entry-exports Include entry files when reporting unused exports\n --no-gitignore Don't respect .gitignore\n -p, --production Analyze only production source files (e.g. no test files, devDependencies)\n -s, --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -w, --watch Watch mode\n\nScope\n -W, --workspace [filter] Filter workspaces by name, directory, or glob (can be repeated)\n -D, --directory [dir] Run process from a different directory (default: cwd)\n --include Include provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved,catalog,catalogReferences\n --exports Shortcut for --include exports,nsExports,types,nsTypes,enumMembers,namespaceMembers,duplicates\n --files Shortcut for --include files\n --cycles Shortcut for --include cycles (circular dependencies)\n --tags Include or exclude tagged exports\n\nFix\n -f, --fix Fix issues (modifies files in your repo)\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n -F, --format Format modified files after --fix using the local formatter\n\nOutput\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter (default: symbols), can be repeated (3)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --output-file Write reporter output to a file instead of stdout ([reporter=]path), can be repeated\n --no-config-hints Suppress configuration hints\n --no-tag-hints Suppress tag hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --treat-tag-hints-as-errors Exit with non-zero code (1) if there are any tag hints\n --max-issues Maximum number of total issues before non-zero exit code (default: 0)\n --max-show-issues Maximum number of issues to display per type\n --no-exit-code Always exit with code zero (0)\n\nTroubleshooting\n -d, --debug Show debug output\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n --performance Measure count and running time of key functions and display stats table\n --performance-fn [name] Measure only function [name]\n -u, --duration Print total running time (zero overhead, no instrumentation)\n --trace Show trace output\n --trace-dependency [name] Show files that import the named dependency\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, types, nsTypes, enumMembers, namespaceMembers, duplicates, catalog, catalogReferences, cycles\n(2) Fixable issue types: dependencies, exports, types, files, catalog\n(3) Built-in reporters: symbols (default), compact, codeowners, cycles, json, codeclimate, markdown, disclosure, github-actions, sarif\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip --workspace @myorg/* --workspace '!@myorg/legacy'\n$ knip --workspace './apps/*' --workspace '@shared/utils'\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --reporter symbols --reporter json --output-file json=knip.json\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
|
|
2
2
|
export type ParsedCLIArgs = ReturnType<typeof parseCLIArgs>;
|
|
3
3
|
export declare const parseNumericOption: (value: string | undefined, option: string) => number | undefined;
|
|
4
4
|
export default function parseCLIArgs(): {
|
|
@@ -29,6 +29,7 @@ export default function parseCLIArgs(): {
|
|
|
29
29
|
'no-gitignore'?: boolean | undefined;
|
|
30
30
|
'no-progress'?: boolean | undefined;
|
|
31
31
|
'no-tag-hints'?: boolean | undefined;
|
|
32
|
+
'output-file'?: string[] | undefined;
|
|
32
33
|
performance?: boolean | undefined;
|
|
33
34
|
'performance-fn'?: string | undefined;
|
|
34
35
|
production?: boolean | undefined;
|
|
@@ -44,6 +44,7 @@ Output
|
|
|
44
44
|
--preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)
|
|
45
45
|
--reporter Select reporter (default: symbols), can be repeated (3)
|
|
46
46
|
--reporter-options Pass extra options to the reporter (as JSON string, see example)
|
|
47
|
+
--output-file Write reporter output to a file instead of stdout ([reporter=]path), can be repeated
|
|
47
48
|
--no-config-hints Suppress configuration hints
|
|
48
49
|
--no-tag-hints Suppress tag hints
|
|
49
50
|
--treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints
|
|
@@ -77,6 +78,7 @@ $ knip --workspace @myorg/* --workspace '!@myorg/legacy'
|
|
|
77
78
|
$ knip --workspace './apps/*' --workspace '@shared/utils'
|
|
78
79
|
$ knip -c ./config/knip.json --reporter compact
|
|
79
80
|
$ knip --reporter codeowners --reporter-options '{"path":".github/CODEOWNERS"}'
|
|
81
|
+
$ knip --reporter symbols --reporter json --output-file json=knip.json
|
|
80
82
|
$ knip --tags=-lintignore
|
|
81
83
|
|
|
82
84
|
Website: https://knip.dev`;
|
|
@@ -118,6 +120,7 @@ export default function parseCLIArgs() {
|
|
|
118
120
|
'no-gitignore': { type: 'boolean' },
|
|
119
121
|
'no-progress': { type: 'boolean', short: 'n' },
|
|
120
122
|
'no-tag-hints': { type: 'boolean' },
|
|
123
|
+
'output-file': { type: 'string', multiple: true },
|
|
121
124
|
performance: { type: 'boolean' },
|
|
122
125
|
'performance-fn': { type: 'string' },
|
|
123
126
|
production: { type: 'boolean', short: 'p' },
|
|
@@ -60,7 +60,7 @@ export const createInputHandler = (deputy, chief, isGitIgnored, addIssue, extern
|
|
|
60
60
|
isDevOnly: isConfig(input),
|
|
61
61
|
isTypeOnly: input.isTypeOnly,
|
|
62
62
|
});
|
|
63
|
-
if (input.
|
|
63
|
+
if (input.alsoReferenceOwner && input.containingFilePath) {
|
|
64
64
|
const owningWorkspace = chief.findWorkspaceByFilePath(input.containingFilePath);
|
|
65
65
|
if (owningWorkspace && owningWorkspace !== inputWorkspace) {
|
|
66
66
|
const isOwnerHandled = deputy.maybeAddReferencedExternalDependency(owningWorkspace, packageName, {
|
|
@@ -4,8 +4,9 @@ interface CreateOptions extends Partial<Options> {
|
|
|
4
4
|
args?: ParsedCLIArgs;
|
|
5
5
|
}
|
|
6
6
|
export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
7
|
+
createdFrom: CreateOptions;
|
|
7
8
|
cacheLocation: string;
|
|
8
|
-
catalog: import("../CatalogCounselor.ts").CatalogContainer;
|
|
9
|
+
catalog: import("../CatalogCounselor.ts").CatalogContainer[];
|
|
9
10
|
config: string | undefined;
|
|
10
11
|
configFilePath: string | undefined;
|
|
11
12
|
cwd: string;
|
|
@@ -91,6 +92,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
91
92
|
entry?: string | string[] | undefined;
|
|
92
93
|
project?: string | string[] | undefined;
|
|
93
94
|
} | undefined;
|
|
95
|
+
buf?: string | boolean | string[] | {
|
|
96
|
+
config?: string | string[] | undefined;
|
|
97
|
+
entry?: string | string[] | undefined;
|
|
98
|
+
project?: string | string[] | undefined;
|
|
99
|
+
} | undefined;
|
|
94
100
|
bumpp?: string | boolean | string[] | {
|
|
95
101
|
config?: string | string[] | undefined;
|
|
96
102
|
entry?: string | string[] | undefined;
|
|
@@ -191,6 +197,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
191
197
|
entry?: string | string[] | undefined;
|
|
192
198
|
project?: string | string[] | undefined;
|
|
193
199
|
} | undefined;
|
|
200
|
+
'electron-forge'?: string | boolean | string[] | {
|
|
201
|
+
config?: string | string[] | undefined;
|
|
202
|
+
entry?: string | string[] | undefined;
|
|
203
|
+
project?: string | string[] | undefined;
|
|
204
|
+
} | undefined;
|
|
194
205
|
'electron-vite'?: string | boolean | string[] | {
|
|
195
206
|
config?: string | string[] | undefined;
|
|
196
207
|
entry?: string | string[] | undefined;
|
|
@@ -316,6 +327,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
316
327
|
entry?: string | string[] | undefined;
|
|
317
328
|
project?: string | string[] | undefined;
|
|
318
329
|
} | undefined;
|
|
330
|
+
'kysely-codegen'?: string | boolean | string[] | {
|
|
331
|
+
config?: string | string[] | undefined;
|
|
332
|
+
entry?: string | string[] | undefined;
|
|
333
|
+
project?: string | string[] | undefined;
|
|
334
|
+
} | undefined;
|
|
319
335
|
ladle?: string | boolean | string[] | {
|
|
320
336
|
config?: string | string[] | undefined;
|
|
321
337
|
entry?: string | string[] | undefined;
|
|
@@ -331,6 +347,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
331
347
|
entry?: string | string[] | undefined;
|
|
332
348
|
project?: string | string[] | undefined;
|
|
333
349
|
} | undefined;
|
|
350
|
+
lingui?: string | boolean | string[] | {
|
|
351
|
+
config?: string | string[] | undefined;
|
|
352
|
+
entry?: string | string[] | undefined;
|
|
353
|
+
project?: string | string[] | undefined;
|
|
354
|
+
} | undefined;
|
|
334
355
|
'lint-staged'?: string | boolean | string[] | {
|
|
335
356
|
config?: string | string[] | undefined;
|
|
336
357
|
entry?: string | string[] | undefined;
|
|
@@ -371,6 +392,16 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
371
392
|
entry?: string | string[] | undefined;
|
|
372
393
|
project?: string | string[] | undefined;
|
|
373
394
|
} | undefined;
|
|
395
|
+
mastra?: string | boolean | string[] | {
|
|
396
|
+
config?: string | string[] | undefined;
|
|
397
|
+
entry?: string | string[] | undefined;
|
|
398
|
+
project?: string | string[] | undefined;
|
|
399
|
+
} | undefined;
|
|
400
|
+
mcp?: string | boolean | string[] | {
|
|
401
|
+
config?: string | string[] | undefined;
|
|
402
|
+
entry?: string | string[] | undefined;
|
|
403
|
+
project?: string | string[] | undefined;
|
|
404
|
+
} | undefined;
|
|
374
405
|
mdx?: string | boolean | string[] | {
|
|
375
406
|
config?: string | string[] | undefined;
|
|
376
407
|
entry?: string | string[] | undefined;
|
|
@@ -596,6 +627,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
596
627
|
entry?: string | string[] | undefined;
|
|
597
628
|
project?: string | string[] | undefined;
|
|
598
629
|
} | undefined;
|
|
630
|
+
purgecss?: string | boolean | string[] | {
|
|
631
|
+
config?: string | string[] | undefined;
|
|
632
|
+
entry?: string | string[] | undefined;
|
|
633
|
+
project?: string | string[] | undefined;
|
|
634
|
+
} | undefined;
|
|
599
635
|
quasar?: string | boolean | string[] | {
|
|
600
636
|
config?: string | string[] | undefined;
|
|
601
637
|
entry?: string | string[] | undefined;
|
|
@@ -1098,6 +1134,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1098
1134
|
entry?: string | string[] | undefined;
|
|
1099
1135
|
project?: string | string[] | undefined;
|
|
1100
1136
|
} | undefined;
|
|
1137
|
+
buf?: string | boolean | string[] | {
|
|
1138
|
+
config?: string | string[] | undefined;
|
|
1139
|
+
entry?: string | string[] | undefined;
|
|
1140
|
+
project?: string | string[] | undefined;
|
|
1141
|
+
} | undefined;
|
|
1101
1142
|
bumpp?: string | boolean | string[] | {
|
|
1102
1143
|
config?: string | string[] | undefined;
|
|
1103
1144
|
entry?: string | string[] | undefined;
|
|
@@ -1198,6 +1239,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1198
1239
|
entry?: string | string[] | undefined;
|
|
1199
1240
|
project?: string | string[] | undefined;
|
|
1200
1241
|
} | undefined;
|
|
1242
|
+
'electron-forge'?: string | boolean | string[] | {
|
|
1243
|
+
config?: string | string[] | undefined;
|
|
1244
|
+
entry?: string | string[] | undefined;
|
|
1245
|
+
project?: string | string[] | undefined;
|
|
1246
|
+
} | undefined;
|
|
1201
1247
|
'electron-vite'?: string | boolean | string[] | {
|
|
1202
1248
|
config?: string | string[] | undefined;
|
|
1203
1249
|
entry?: string | string[] | undefined;
|
|
@@ -1323,6 +1369,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1323
1369
|
entry?: string | string[] | undefined;
|
|
1324
1370
|
project?: string | string[] | undefined;
|
|
1325
1371
|
} | undefined;
|
|
1372
|
+
'kysely-codegen'?: string | boolean | string[] | {
|
|
1373
|
+
config?: string | string[] | undefined;
|
|
1374
|
+
entry?: string | string[] | undefined;
|
|
1375
|
+
project?: string | string[] | undefined;
|
|
1376
|
+
} | undefined;
|
|
1326
1377
|
ladle?: string | boolean | string[] | {
|
|
1327
1378
|
config?: string | string[] | undefined;
|
|
1328
1379
|
entry?: string | string[] | undefined;
|
|
@@ -1338,6 +1389,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1338
1389
|
entry?: string | string[] | undefined;
|
|
1339
1390
|
project?: string | string[] | undefined;
|
|
1340
1391
|
} | undefined;
|
|
1392
|
+
lingui?: string | boolean | string[] | {
|
|
1393
|
+
config?: string | string[] | undefined;
|
|
1394
|
+
entry?: string | string[] | undefined;
|
|
1395
|
+
project?: string | string[] | undefined;
|
|
1396
|
+
} | undefined;
|
|
1341
1397
|
'lint-staged'?: string | boolean | string[] | {
|
|
1342
1398
|
config?: string | string[] | undefined;
|
|
1343
1399
|
entry?: string | string[] | undefined;
|
|
@@ -1378,6 +1434,16 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1378
1434
|
entry?: string | string[] | undefined;
|
|
1379
1435
|
project?: string | string[] | undefined;
|
|
1380
1436
|
} | undefined;
|
|
1437
|
+
mastra?: string | boolean | string[] | {
|
|
1438
|
+
config?: string | string[] | undefined;
|
|
1439
|
+
entry?: string | string[] | undefined;
|
|
1440
|
+
project?: string | string[] | undefined;
|
|
1441
|
+
} | undefined;
|
|
1442
|
+
mcp?: string | boolean | string[] | {
|
|
1443
|
+
config?: string | string[] | undefined;
|
|
1444
|
+
entry?: string | string[] | undefined;
|
|
1445
|
+
project?: string | string[] | undefined;
|
|
1446
|
+
} | undefined;
|
|
1381
1447
|
mdx?: string | boolean | string[] | {
|
|
1382
1448
|
config?: string | string[] | undefined;
|
|
1383
1449
|
entry?: string | string[] | undefined;
|
|
@@ -1603,6 +1669,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1603
1669
|
entry?: string | string[] | undefined;
|
|
1604
1670
|
project?: string | string[] | undefined;
|
|
1605
1671
|
} | undefined;
|
|
1672
|
+
purgecss?: string | boolean | string[] | {
|
|
1673
|
+
config?: string | string[] | undefined;
|
|
1674
|
+
entry?: string | string[] | undefined;
|
|
1675
|
+
project?: string | string[] | undefined;
|
|
1676
|
+
} | undefined;
|
|
1606
1677
|
quasar?: string | boolean | string[] | {
|
|
1607
1678
|
config?: string | string[] | undefined;
|
|
1608
1679
|
entry?: string | string[] | undefined;
|