knip 5.9.0 → 5.9.2
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 -6
- package/dist/ConfigurationChief.js +10 -8
- package/dist/ConsoleStreamer.js +1 -1
- package/dist/DependencyDeputy.d.ts +1 -1
- package/dist/DependencyDeputy.js +22 -18
- package/dist/IssueCollector.js +10 -9
- package/dist/IssueFixer.js +9 -7
- package/dist/PrincipalFactory.d.ts +2 -2
- package/dist/PrincipalFactory.js +3 -5
- package/dist/ProjectPrincipal.d.ts +6 -6
- package/dist/ProjectPrincipal.js +12 -10
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/WorkspaceWorker.js +13 -9
- package/dist/binaries/index.js +1 -1
- package/dist/binaries/resolvers/bun.js +1 -1
- package/dist/binaries/resolvers/index.d.ts +12 -12
- package/dist/binaries/util.js +1 -1
- package/dist/cli.js +10 -9
- package/dist/compilers/index.d.ts +1 -1
- package/dist/index.js +65 -57
- package/dist/issues/initializers.d.ts +1 -1
- package/dist/manifest/helpers.js +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +4 -4
- package/dist/plugins/ava/index.js +8 -8
- package/dist/plugins/babel/index.js +2 -2
- package/dist/plugins/babel/types.d.ts +1 -1
- package/dist/plugins/babel/types.js +1 -1
- package/dist/plugins/commitlint/index.d.ts +1 -1
- package/dist/plugins/cspell/index.d.ts +1 -1
- package/dist/plugins/drizzle/index.d.ts +1 -1
- package/dist/plugins/eleventy/helpers.d.ts +0 -1
- package/dist/plugins/eleventy/helpers.js +1 -2
- package/dist/plugins/eleventy/index.d.ts +1 -1
- package/dist/plugins/eslint/helpers.d.ts +1 -1
- package/dist/plugins/eslint/helpers.js +5 -2
- package/dist/plugins/eslint/index.d.ts +0 -1
- package/dist/plugins/eslint/index.js +1 -1
- package/dist/plugins/github-actions/index.js +1 -1
- package/dist/plugins/graphql-codegen/index.d.ts +1 -1
- package/dist/plugins/jest/index.js +5 -4
- package/dist/plugins/lint-staged/index.d.ts +1 -1
- package/dist/plugins/lint-staged/index.js +2 -1
- package/dist/plugins/linthtml/index.d.ts +1 -1
- package/dist/plugins/markdownlint/index.d.ts +1 -1
- package/dist/plugins/npm-package-json-lint/index.d.ts +1 -1
- package/dist/plugins/nyc/index.d.ts +1 -1
- package/dist/plugins/playwright/index.d.ts +1 -1
- package/dist/plugins/playwright-ct/index.js +1 -1
- package/dist/plugins/postcss/index.d.ts +1 -1
- package/dist/plugins/prettier/index.d.ts +1 -1
- package/dist/plugins/release-it/index.d.ts +1 -1
- package/dist/plugins/remark/index.d.ts +1 -1
- package/dist/plugins/semantic-release/index.d.ts +1 -1
- package/dist/plugins/stryker/index.d.ts +1 -1
- package/dist/plugins/stylelint/index.d.ts +1 -1
- package/dist/plugins/tsup/index.d.ts +1 -1
- package/dist/plugins/typescript/index.d.ts +0 -1
- package/dist/plugins/typescript/index.js +4 -3
- package/dist/plugins/unbuild/index.d.ts +1 -1
- package/dist/plugins/vite/index.d.ts +2 -2
- package/dist/plugins/vite/index.js +1 -1
- package/dist/plugins/vitest/index.d.ts +1 -1
- package/dist/plugins/vitest/index.js +8 -4
- package/dist/plugins/vue/index.d.ts +1 -1
- package/dist/plugins/vue/index.js +2 -1
- package/dist/plugins/vue/types.d.ts +1 -1
- package/dist/plugins/webpack/index.js +4 -4
- package/dist/plugins/wireit/index.d.ts +1 -1
- package/dist/plugins/yorkie/index.d.ts +1 -1
- package/dist/plugins/yorkie/index.js +2 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +6 -3
- package/dist/reporters/codeowners.js +9 -7
- package/dist/reporters/compact.js +1 -1
- package/dist/reporters/index.d.ts +5 -5
- package/dist/reporters/json.js +3 -3
- package/dist/reporters/markdown.js +7 -7
- package/dist/reporters/symbols.js +8 -8
- package/dist/reporters/util.js +3 -2
- package/dist/types/config.d.ts +5 -5
- package/dist/types/config.js +1 -3
- package/dist/types/exports.d.ts +1 -1
- package/dist/types/exports.js +1 -1
- package/dist/types/imports.d.ts +1 -1
- package/dist/types/imports.js +1 -1
- package/dist/typescript/SourceFile.d.ts +1 -1
- package/dist/typescript/SourceFile.js +1 -1
- package/dist/typescript/SourceFileManager.d.ts +1 -1
- package/dist/typescript/ast-helpers.js +2 -2
- package/dist/typescript/createHosts.d.ts +1 -1
- package/dist/typescript/createHosts.js +1 -1
- package/dist/typescript/getImportsAndExports.d.ts +1 -1
- package/dist/typescript/getImportsAndExports.js +15 -12
- package/dist/typescript/resolveModuleNames.js +2 -2
- package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importCall.js +24 -30
- package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/index.d.ts +2 -2
- package/dist/typescript/visitors/dynamic-imports/index.js +0 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.js +14 -22
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.js +10 -12
- package/dist/typescript/visitors/exports/exportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/exports/index.d.ts +2 -2
- package/dist/typescript/visitors/exports/index.js +0 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.js +2 -4
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.js +18 -20
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/index.d.ts +2 -2
- package/dist/typescript/visitors/imports/index.js +0 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.js +14 -16
- package/dist/typescript/visitors/index.d.ts +1 -1
- package/dist/typescript/visitors/index.js +0 -1
- package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
- package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
- package/dist/typescript/visitors/scripts/index.d.ts +2 -2
- package/dist/typescript/visitors/scripts/index.js +0 -1
- package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
- package/dist/util/Performance.d.ts +1 -1
- package/dist/util/Performance.js +5 -5
- package/dist/util/cli-arguments.js +1 -1
- package/dist/util/debug.js +1 -1
- package/dist/util/fs.d.ts +2 -2
- package/dist/util/fs.js +3 -3
- package/dist/util/get-included-issue-types.js +8 -5
- package/dist/util/get-reexporting-entry-file.js +12 -16
- package/dist/util/git.js +5 -5
- package/dist/util/glob.js +2 -2
- package/dist/util/globby.d.ts +1 -1
- package/dist/util/globby.js +11 -12
- package/dist/util/handle-dependency.d.ts +1 -1
- package/dist/util/handle-dependency.js +1 -2
- package/dist/util/is-identifier-referenced.js +4 -4
- package/dist/util/loader.js +3 -5
- package/dist/util/modules.js +7 -5
- package/dist/util/object.js +1 -1
- package/dist/util/plugin.d.ts +1 -1
- package/dist/util/plugin.js +12 -14
- package/dist/util/regex.js +1 -1
- package/dist/util/require.js +2 -2
- package/dist/util/tag.js +4 -2
- package/dist/util/type.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPkgGraph } from '@pnpm/workspace.pkgs-graph';
|
|
2
|
-
import type { Configuration,
|
|
2
|
+
import type { Configuration, IgnorePatterns, WorkspaceConfiguration } from './types/config.js';
|
|
3
3
|
import type { PackageJson } from './types/package-json.js';
|
|
4
4
|
type ConfigurationManagerOptions = {
|
|
5
5
|
cwd: string;
|
|
@@ -41,7 +41,7 @@ export declare class ConfigurationChief {
|
|
|
41
41
|
constructor({ cwd, isProduction, isStrict, isIncludeEntryExports }: ConfigurationManagerOptions);
|
|
42
42
|
init(): Promise<void>;
|
|
43
43
|
private loadResolvedConfigurationFile;
|
|
44
|
-
getRules(): import("
|
|
44
|
+
getRules(): import("./types/issues.js").Rules;
|
|
45
45
|
getFilters(): {
|
|
46
46
|
dir: string;
|
|
47
47
|
} | {
|
|
@@ -70,10 +70,8 @@ export declare class ConfigurationChief {
|
|
|
70
70
|
ignoreDependencies: (string | RegExp)[];
|
|
71
71
|
};
|
|
72
72
|
getConfigForWorkspace(workspaceName: string, extensions?: string[]): {
|
|
73
|
-
astro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
74
|
-
svelte?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
75
|
-
vue?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
76
73
|
moonrepo?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
74
|
+
astro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
77
75
|
angular?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
78
76
|
ava?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
79
77
|
babel?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -107,11 +105,13 @@ export declare class ConfigurationChief {
|
|
|
107
105
|
storybook?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
108
106
|
stryker?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
109
107
|
stylelint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
108
|
+
svelte?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
110
109
|
tailwind?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
111
110
|
tsup?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
112
111
|
typedoc?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
113
112
|
typescript?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
114
113
|
unbuild?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
114
|
+
vue?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
115
115
|
vite?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
116
116
|
vitest?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
117
117
|
webpack?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -134,7 +134,7 @@ export declare class ConfigurationChief {
|
|
|
134
134
|
ignore: string[];
|
|
135
135
|
isIncludeEntryExports: any;
|
|
136
136
|
};
|
|
137
|
-
getIncludedIssueTypes(): import("
|
|
137
|
+
getIncludedIssueTypes(): import("./types/issues.js").Report;
|
|
138
138
|
findWorkspaceByFilePath(filePath: string): Workspace | undefined;
|
|
139
139
|
findWorkspaceByName(name: string): Workspace | undefined;
|
|
140
140
|
getUnusedIgnoredWorkspaces(): string[];
|
|
@@ -2,9 +2,9 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import mapWorkspaces from '@npmcli/map-workspaces';
|
|
3
3
|
import { createPkgGraph } from '@pnpm/workspace.pkgs-graph';
|
|
4
4
|
import micromatch from 'micromatch';
|
|
5
|
-
import { partitionCompilers } from './compilers/index.js';
|
|
6
5
|
import { ConfigurationValidator } from './ConfigurationValidator.js';
|
|
7
|
-
import {
|
|
6
|
+
import { partitionCompilers } from './compilers/index.js';
|
|
7
|
+
import { DEFAULT_EXTENSIONS, KNIP_CONFIG_LOCATIONS, ROOT_WORKSPACE_NAME } from './constants.js';
|
|
8
8
|
import { defaultRules } from './issues/initializers.js';
|
|
9
9
|
import * as plugins from './plugins/index.js';
|
|
10
10
|
import { arrayify } from './util/array.js';
|
|
@@ -75,7 +75,7 @@ export class ConfigurationChief {
|
|
|
75
75
|
async init() {
|
|
76
76
|
const manifestPath = findFile(this.cwd, 'package.json');
|
|
77
77
|
const manifest = manifestPath && (await loadJSON(manifestPath));
|
|
78
|
-
if (!manifestPath
|
|
78
|
+
if (!(manifestPath && manifest)) {
|
|
79
79
|
throw new ConfigurationError('Unable to find package.json');
|
|
80
80
|
}
|
|
81
81
|
this.manifestPath = manifestPath;
|
|
@@ -239,7 +239,7 @@ export class ConfigurationChief {
|
|
|
239
239
|
const getAncestors = (name) => (ancestors, ancestorName) => {
|
|
240
240
|
if (name === ancestorName)
|
|
241
241
|
return ancestors;
|
|
242
|
-
if (ancestorName === ROOT_WORKSPACE_NAME || name.startsWith(ancestorName
|
|
242
|
+
if (ancestorName === ROOT_WORKSPACE_NAME || name.startsWith(`${ancestorName}/`))
|
|
243
243
|
ancestors.push(ancestorName);
|
|
244
244
|
return ancestors;
|
|
245
245
|
};
|
|
@@ -264,10 +264,12 @@ export class ConfigurationChief {
|
|
|
264
264
|
deps.filter(dir => !seen.has(dir)).forEach(addDependents);
|
|
265
265
|
};
|
|
266
266
|
this.availableWorkspaceNames.map(name => join(this.cwd, name)).forEach(addDependents);
|
|
267
|
-
|
|
267
|
+
for (const dir of workspaceDirsWithDependents)
|
|
268
|
+
ws.add(relative(this.cwd, dir) || ROOT_WORKSPACE_NAME);
|
|
268
269
|
}
|
|
269
270
|
else {
|
|
270
|
-
|
|
271
|
+
for (const name of workspaceNames)
|
|
272
|
+
ws.add(name);
|
|
271
273
|
}
|
|
272
274
|
return Array.from(ws)
|
|
273
275
|
.sort(byPathDepth)
|
|
@@ -296,7 +298,7 @@ export class ConfigurationChief {
|
|
|
296
298
|
getDescendentWorkspaces(name) {
|
|
297
299
|
return this.availableWorkspaceNames
|
|
298
300
|
.filter(workspaceName => workspaceName !== name)
|
|
299
|
-
.filter(workspaceName => name === ROOT_WORKSPACE_NAME || workspaceName.startsWith(name
|
|
301
|
+
.filter(workspaceName => name === ROOT_WORKSPACE_NAME || workspaceName.startsWith(`${name}/`));
|
|
300
302
|
}
|
|
301
303
|
getIgnoredWorkspacesFor(name) {
|
|
302
304
|
return this.ignoredWorkspacePatterns
|
|
@@ -365,7 +367,7 @@ export class ConfigurationChief {
|
|
|
365
367
|
return getIncludedIssueTypes(cliArgs, config);
|
|
366
368
|
}
|
|
367
369
|
findWorkspaceByFilePath(filePath) {
|
|
368
|
-
const workspaceDir = this.availableWorkspaceDirs.find(workspaceDir => filePath.startsWith(workspaceDir
|
|
370
|
+
const workspaceDir = this.availableWorkspaceDirs.find(workspaceDir => filePath.startsWith(`${workspaceDir}/`));
|
|
369
371
|
return this.includedWorkspaces.find(workspace => workspace.dir === workspaceDir);
|
|
370
372
|
}
|
|
371
373
|
findWorkspaceByName(name) {
|
package/dist/ConsoleStreamer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Workspace } from './ConfigurationChief.js';
|
|
2
2
|
import type { ConfigurationHints, Issue } from './types/issues.js';
|
|
3
3
|
import type { PackageJson } from './types/package-json.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DependencyArray, DependencySet, HostDependencies, InstalledBinaries, WorkspaceManifests } from './types/workspace.js';
|
|
5
5
|
type Options = {
|
|
6
6
|
isProduction: boolean;
|
|
7
7
|
isStrict: boolean;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
|
-
import {
|
|
2
|
+
import { IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES, IGNORED_RUNTIME_DEPENDENCIES, IGNORE_DEFINITELY_TYPED, ROOT_WORKSPACE_NAME, } from './constants.js';
|
|
3
3
|
import { getDependencyMetaData } from './manifest/index.js';
|
|
4
|
-
import {
|
|
5
|
-
import { hasMatch, hasMatchInSet, toRegexOrString
|
|
4
|
+
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, isDefinitelyTyped } from './util/modules.js';
|
|
5
|
+
import { findKey, hasMatch, hasMatchInSet, toRegexOrString } from './util/regex.js';
|
|
6
6
|
export class DependencyDeputy {
|
|
7
7
|
isProduction;
|
|
8
8
|
isStrict;
|
|
@@ -141,9 +141,7 @@ export class DependencyDeputy {
|
|
|
141
141
|
closestWorkspaceNameForTypes && this.addReferencedDependency(closestWorkspaceNameForTypes, typesPackageName);
|
|
142
142
|
return true;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
this.addReferencedDependency(workspace.name, packageName);
|
|
146
|
-
}
|
|
144
|
+
this.addReferencedDependency(workspace.name, packageName);
|
|
147
145
|
if (hasMatch(this.getWorkspaceManifest(workspace.name)?.ignoreDependencies, packageName))
|
|
148
146
|
return true;
|
|
149
147
|
if (hasMatch(this.ignoreDependencies, packageName))
|
|
@@ -160,7 +158,8 @@ export class DependencyDeputy {
|
|
|
160
158
|
if (binaries?.has(binaryName)) {
|
|
161
159
|
const dependencies = binaries.get(binaryName);
|
|
162
160
|
if (dependencies?.size) {
|
|
163
|
-
|
|
161
|
+
for (const dependency of dependencies)
|
|
162
|
+
this.addReferencedDependency(name, dependency);
|
|
164
163
|
return true;
|
|
165
164
|
}
|
|
166
165
|
}
|
|
@@ -226,7 +225,12 @@ export class DependencyDeputy {
|
|
|
226
225
|
return referencedDependencies.has(typedPackageName);
|
|
227
226
|
}
|
|
228
227
|
const hostDependencies = this.getHostDependenciesFor(workspaceName, dependency);
|
|
229
|
-
|
|
228
|
+
for (const { name } of hostDependencies) {
|
|
229
|
+
if (!peerDepRecs[name])
|
|
230
|
+
peerDepRecs[name] = 1;
|
|
231
|
+
else
|
|
232
|
+
peerDepRecs[name]++;
|
|
233
|
+
}
|
|
230
234
|
return hostDependencies.some(hostDependency => (isPeerDep === false || !hostDependency.isPeerOptional) && isReferencedDependency(hostDependency.name, true));
|
|
231
235
|
};
|
|
232
236
|
const isNotReferencedDependency = (dependency) => !isReferencedDependency(dependency, false);
|
|
@@ -259,28 +263,28 @@ export class DependencyDeputy {
|
|
|
259
263
|
const installedBinaryNames = new Set(installedBinaries?.keys() ?? []);
|
|
260
264
|
const ignoredBinaries = this._manifests.get(workspaceName)?.ignoreBinaries ?? [];
|
|
261
265
|
const ignoredDependencies = this._manifests.get(workspaceName)?.ignoreDependencies ?? [];
|
|
262
|
-
|
|
266
|
+
for (const pkg of referencedDependencies ?? []) {
|
|
263
267
|
for (const key of [...ignoredDependencies, ...rootIgnoreDependencies.keys()]) {
|
|
264
268
|
if ((typeof key === 'string' && key === pkg) || (key instanceof RegExp && key.test(pkg))) {
|
|
265
269
|
const rootKey = typeof key === 'string' ? key : findKey(rootIgnoreDependencies, key);
|
|
266
270
|
if (rootKey && rootIgnoreDependencies.has(rootKey)) {
|
|
267
271
|
rootIgnoreDependencies.set(rootKey, rootIgnoreDependencies.get(rootKey) + 1);
|
|
268
|
-
|
|
272
|
+
break;
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
|
-
}
|
|
273
|
-
|
|
276
|
+
}
|
|
277
|
+
for (const binaryName of referencedBinaries ?? []) {
|
|
274
278
|
for (const key of [...ignoredBinaries, ...rootIgnoreBinaries.keys()]) {
|
|
275
279
|
if ((typeof key === 'string' && key === binaryName) || (key instanceof RegExp && key.test(binaryName))) {
|
|
276
280
|
const rootKey = typeof key === 'string' ? key : findKey(rootIgnoreBinaries, key);
|
|
277
281
|
if (rootKey && rootIgnoreBinaries.has(rootKey)) {
|
|
278
282
|
rootIgnoreBinaries.set(rootKey, rootIgnoreBinaries.get(rootKey) + 1);
|
|
279
|
-
|
|
283
|
+
break;
|
|
280
284
|
}
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
|
-
}
|
|
287
|
+
}
|
|
284
288
|
if (workspaceName === ROOT_WORKSPACE_NAME)
|
|
285
289
|
continue;
|
|
286
290
|
const dependencies = this.getDependencies(workspaceName);
|
|
@@ -293,7 +297,7 @@ export class DependencyDeputy {
|
|
|
293
297
|
return true;
|
|
294
298
|
const isReferenced = hasMatchInSet(referencedDependencies, packageName);
|
|
295
299
|
const isListed = hasMatchInSet(dependencies, packageName) && !hasMatchInSet(peerDependencies, packageName);
|
|
296
|
-
return (isListed && isReferenced) || (
|
|
300
|
+
return (isListed && isReferenced) || !(this.isProduction || isReferenced || isListed);
|
|
297
301
|
})
|
|
298
302
|
.forEach(identifier => {
|
|
299
303
|
configurationHints.add({ workspaceName, identifier, type: 'ignoreDependencies' });
|
|
@@ -306,7 +310,7 @@ export class DependencyDeputy {
|
|
|
306
310
|
return true;
|
|
307
311
|
const isReferenced = hasMatchInSet(referencedBinaries, binaryName);
|
|
308
312
|
const isInstalled = hasMatchInSet(installedBinaryNames, binaryName);
|
|
309
|
-
return (isReferenced && isInstalled) || (
|
|
313
|
+
return (isReferenced && isInstalled) || !(this.isProduction || isInstalled || isReferenced);
|
|
310
314
|
})
|
|
311
315
|
.forEach(identifier => configurationHints.add({ workspaceName, identifier, type: 'ignoreBinaries' }));
|
|
312
316
|
}
|
|
@@ -319,7 +323,7 @@ export class DependencyDeputy {
|
|
|
319
323
|
return true;
|
|
320
324
|
const isReferenced = rootIgnoreDependencies.get(packageName) !== 0;
|
|
321
325
|
const isListed = hasMatchInSet(dependencies, packageName) && !hasMatchInSet(peerDependencies, packageName);
|
|
322
|
-
return (isReferenced && isListed) || (
|
|
326
|
+
return (isReferenced && isListed) || !(this.isProduction || isReferenced || isListed);
|
|
323
327
|
})
|
|
324
328
|
.forEach(identifier => configurationHints.add({ workspaceName: ROOT_WORKSPACE_NAME, identifier, type: 'ignoreDependencies' }));
|
|
325
329
|
Array.from(rootIgnoreBinaries.keys())
|
|
@@ -328,7 +332,7 @@ export class DependencyDeputy {
|
|
|
328
332
|
return true;
|
|
329
333
|
const isReferenced = rootIgnoreBinaries.get(binaryName) !== 0;
|
|
330
334
|
const isInstalled = hasMatchInSet(installedBinaryNames, binaryName);
|
|
331
|
-
return (isReferenced && isInstalled) || (
|
|
335
|
+
return (isReferenced && isInstalled) || !(this.isProduction || isReferenced || isInstalled);
|
|
332
336
|
})
|
|
333
337
|
.forEach(identifier => configurationHints.add({ workspaceName: ROOT_WORKSPACE_NAME, identifier, type: 'ignoreBinaries' }));
|
|
334
338
|
return { configurationHints };
|
package/dist/IssueCollector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import micromatch from 'micromatch';
|
|
2
|
-
import {
|
|
2
|
+
import { initCounters, initIssues } from './issues/initializers.js';
|
|
3
3
|
import { relative } from './util/path.js';
|
|
4
4
|
const hasHint = (hints, hint) => Array.from(hints).some(item => item.identifier === hint.identifier && item.type === hint.type && item.workspaceName === hint.workspaceName);
|
|
5
5
|
export class IssueCollector {
|
|
@@ -19,7 +19,8 @@ export class IssueCollector {
|
|
|
19
19
|
this.isMatch = () => false;
|
|
20
20
|
}
|
|
21
21
|
addIgnorePatterns(patterns) {
|
|
22
|
-
|
|
22
|
+
for (const pattern of patterns)
|
|
23
|
+
this.ignorePatterns.add(pattern);
|
|
23
24
|
const p = [...this.ignorePatterns];
|
|
24
25
|
this.isMatch = (filePath) => micromatch.isMatch(filePath, p, { dot: true });
|
|
25
26
|
}
|
|
@@ -28,20 +29,20 @@ export class IssueCollector {
|
|
|
28
29
|
this.counters.total += processed + unused;
|
|
29
30
|
}
|
|
30
31
|
addFilesIssues(filePaths) {
|
|
31
|
-
|
|
32
|
-
if (this.filters.dir && !filePath.startsWith(this.filters.dir
|
|
33
|
-
|
|
32
|
+
for (const filePath of filePaths) {
|
|
33
|
+
if (this.filters.dir && !filePath.startsWith(`${this.filters.dir}/`))
|
|
34
|
+
continue;
|
|
34
35
|
if (this.referencedFiles.has(filePath))
|
|
35
|
-
|
|
36
|
+
continue;
|
|
36
37
|
if (this.isMatch(filePath))
|
|
37
|
-
|
|
38
|
+
continue;
|
|
38
39
|
this.issues.files.add(filePath);
|
|
39
40
|
this.counters.files++;
|
|
40
41
|
this.counters.processed++;
|
|
41
|
-
}
|
|
42
|
+
}
|
|
42
43
|
}
|
|
43
44
|
addIssue(issue) {
|
|
44
|
-
if (this.filters.dir && !issue.filePath.startsWith(this.filters.dir
|
|
45
|
+
if (this.filters.dir && !issue.filePath.startsWith(`${this.filters.dir}/`))
|
|
45
46
|
return;
|
|
46
47
|
if (this.isMatch(issue.filePath))
|
|
47
48
|
return;
|
package/dist/IssueFixer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFile, writeFile } from 'fs/promises';
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import NPMCliPackageJson, {} from '@npmcli/package-json';
|
|
3
3
|
import { dirname, join } from './util/path.js';
|
|
4
4
|
export class IssueFixer {
|
|
@@ -20,7 +20,8 @@ export class IssueFixer {
|
|
|
20
20
|
if (!fixes || fixes.length === 0)
|
|
21
21
|
return;
|
|
22
22
|
if (this.unusedTypeNodes.has(filePath))
|
|
23
|
-
|
|
23
|
+
for (const fix of fixes)
|
|
24
|
+
this.unusedTypeNodes.get(filePath)?.add(fix);
|
|
24
25
|
else
|
|
25
26
|
this.unusedTypeNodes.set(filePath, new Set(fixes));
|
|
26
27
|
}
|
|
@@ -28,7 +29,8 @@ export class IssueFixer {
|
|
|
28
29
|
if (!fixes || fixes.length === 0)
|
|
29
30
|
return;
|
|
30
31
|
if (this.unusedExportNodes.has(filePath))
|
|
31
|
-
|
|
32
|
+
for (const fix of fixes)
|
|
33
|
+
this.unusedExportNodes.get(filePath)?.add(fix);
|
|
32
34
|
else
|
|
33
35
|
this.unusedExportNodes.set(filePath, new Set(fixes));
|
|
34
36
|
}
|
|
@@ -60,16 +62,16 @@ export class IssueFixer {
|
|
|
60
62
|
const manifest = await NPMCliPackageJson.load(dirname(join(this.cwd, filePath)));
|
|
61
63
|
const pkg = manifest.content;
|
|
62
64
|
if (filePath in issues.dependencies) {
|
|
63
|
-
Object.keys(issues.dependencies[filePath])
|
|
65
|
+
for (const dependency of Object.keys(issues.dependencies[filePath])) {
|
|
64
66
|
if (pkg.dependencies)
|
|
65
67
|
delete pkg.dependencies[dependency];
|
|
66
|
-
}
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
70
|
if (filePath in issues.devDependencies) {
|
|
69
|
-
Object.keys(issues.devDependencies[filePath])
|
|
71
|
+
for (const dependency of Object.keys(issues.devDependencies[filePath])) {
|
|
70
72
|
if (pkg.devDependencies)
|
|
71
73
|
delete pkg.devDependencies[dependency];
|
|
72
|
-
}
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
76
|
await manifest.save();
|
|
75
77
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
1
|
+
import type ts from 'typescript';
|
|
2
2
|
import { ProjectPrincipal } from './ProjectPrincipal.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
|
|
4
4
|
type Paths = ts.CompilerOptions['paths'];
|
|
5
5
|
type Principal = {
|
|
6
6
|
principal: ProjectPrincipal;
|
package/dist/PrincipalFactory.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
1
|
import { ProjectPrincipal } from './ProjectPrincipal.js';
|
|
3
2
|
import { debugLog } from './util/debug.js';
|
|
4
3
|
import { toAbsolute, toRelative } from './util/path.js';
|
|
@@ -24,9 +23,7 @@ export class PrincipalFactory {
|
|
|
24
23
|
this.linkPrincipal(principal, cwd, compilerOptions, pkgName, compilers);
|
|
25
24
|
return principal.principal;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
return this.addNewPrincipal(options);
|
|
29
|
-
}
|
|
26
|
+
return this.addNewPrincipal(options);
|
|
30
27
|
}
|
|
31
28
|
findReusablePrincipal(compilerOptions) {
|
|
32
29
|
const workspacePaths = compilerOptions?.paths ? Object.keys(compilerOptions.paths) : [];
|
|
@@ -44,7 +41,8 @@ export class PrincipalFactory {
|
|
|
44
41
|
const { pathsBasePath, paths } = compilerOptions;
|
|
45
42
|
if (pathsBasePath)
|
|
46
43
|
principal.principal.compilerOptions.pathsBasePath = pathsBasePath;
|
|
47
|
-
Object.keys(paths ?? {})
|
|
44
|
+
for (const p of Object.keys(paths ?? {}))
|
|
45
|
+
principal.pathKeys.add(p);
|
|
48
46
|
principal.principal.addPaths(paths);
|
|
49
47
|
principal.principal.addCompilers(compilers);
|
|
50
48
|
principal.cwds.add(cwd);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { type GetImportsAndExportsOptions } from './typescript/getImportsAndExports.js';
|
|
3
|
-
import { createCustomModuleResolver } from './typescript/resolveModuleNames.js';
|
|
4
|
-
import { SourceFileManager } from './typescript/SourceFileManager.js';
|
|
5
|
-
import type { SyncCompilers, AsyncCompilers } from './compilers/types.js';
|
|
6
2
|
import type { PrincipalOptions } from './PrincipalFactory.js';
|
|
3
|
+
import type { ReferencedDependencies } from './WorkspaceWorker.js';
|
|
4
|
+
import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
|
|
7
5
|
import type { SerializableExport, SerializableExportMember } from './types/exports.js';
|
|
8
6
|
import type { UnresolvedImport } from './types/imports.js';
|
|
9
7
|
import type { ProgramMaybe53 } from './typescript/SourceFile.js';
|
|
10
|
-
import type {
|
|
8
|
+
import type { SourceFileManager } from './typescript/SourceFileManager.js';
|
|
9
|
+
import { type GetImportsAndExportsOptions } from './typescript/getImportsAndExports.js';
|
|
10
|
+
import type { createCustomModuleResolver } from './typescript/resolveModuleNames.js';
|
|
11
11
|
export declare class ProjectPrincipal {
|
|
12
12
|
entryPaths: Set<string>;
|
|
13
13
|
projectPaths: Set<string>;
|
|
@@ -55,7 +55,7 @@ export declare class ProjectPrincipal {
|
|
|
55
55
|
};
|
|
56
56
|
exports: {
|
|
57
57
|
exported: import("./types/exports.js").SerializableExports;
|
|
58
|
-
duplicate: import("
|
|
58
|
+
duplicate: import("./types/issues.js").IssueSymbol[][];
|
|
59
59
|
};
|
|
60
60
|
scripts: Set<string>;
|
|
61
61
|
};
|
package/dist/ProjectPrincipal.js
CHANGED
|
@@ -3,12 +3,10 @@ import { getCompilerExtensions } from './compilers/index.js';
|
|
|
3
3
|
import { DEFAULT_EXTENSIONS, FOREIGN_FILE_EXTENSIONS } from './constants.js';
|
|
4
4
|
import { createHosts } from './typescript/createHosts.js';
|
|
5
5
|
import { _getImportsAndExports } from './typescript/getImportsAndExports.js';
|
|
6
|
-
import {
|
|
7
|
-
import { SourceFileManager } from './typescript/SourceFileManager.js';
|
|
6
|
+
import { timerify } from './util/Performance.js';
|
|
8
7
|
import { compact } from './util/array.js';
|
|
9
8
|
import { isStartsLikePackageName, sanitizeSpecifier } from './util/modules.js';
|
|
10
9
|
import { dirname, extname, isInNodeModules, join } from './util/path.js';
|
|
11
|
-
import { timerify } from './util/Performance.js';
|
|
12
10
|
const baseCompilerOptions = {
|
|
13
11
|
allowJs: true,
|
|
14
12
|
allowSyntheticDefaultImports: true,
|
|
@@ -96,7 +94,8 @@ export class ProjectPrincipal {
|
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
addEntryPaths(filePaths, options) {
|
|
99
|
-
|
|
97
|
+
for (const filePath of filePaths)
|
|
98
|
+
this.addEntryPath(filePath, options);
|
|
100
99
|
}
|
|
101
100
|
addProjectPath(filePath) {
|
|
102
101
|
if (!isInNodeModules(filePath) && this.hasAcceptedExtension(filePath)) {
|
|
@@ -104,7 +103,8 @@ export class ProjectPrincipal {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
addReferencedDependencies(workspaceName, referencedDependencies) {
|
|
107
|
-
|
|
106
|
+
for (const referencedDependency of referencedDependencies)
|
|
107
|
+
this.referencedDependencies.add([...referencedDependency, workspaceName]);
|
|
108
108
|
}
|
|
109
109
|
async runAsyncCompilers() {
|
|
110
110
|
const add = timerify(this.backend.fileManager.compileAndAddSourceFile.bind(this.backend.fileManager));
|
|
@@ -128,6 +128,8 @@ export class ProjectPrincipal {
|
|
|
128
128
|
return Array.from(this.projectPaths).filter(filePath => !sourceFiles.has(filePath));
|
|
129
129
|
}
|
|
130
130
|
analyzeSourceFile(filePath, options) {
|
|
131
|
+
if (!this.backend.typeChecker)
|
|
132
|
+
throw new Error('Must initialize TypeChecker before source file analysis');
|
|
131
133
|
const sourceFile = this.backend.fileManager.getSourceFile(filePath);
|
|
132
134
|
if (!sourceFile)
|
|
133
135
|
throw new Error(`Unable to find ${filePath}`);
|
|
@@ -138,10 +140,10 @@ export class ProjectPrincipal {
|
|
|
138
140
|
const { imports, exports, scripts } = _getImportsAndExports(sourceFile, getResolvedModule, this.backend.typeChecker, { ...options, skipExports });
|
|
139
141
|
const { internal, unresolved, external } = imports;
|
|
140
142
|
const unresolvedImports = new Set();
|
|
141
|
-
|
|
143
|
+
for (const unresolvedImport of unresolved) {
|
|
142
144
|
const { specifier } = unresolvedImport;
|
|
143
145
|
if (specifier.startsWith('http')) {
|
|
144
|
-
|
|
146
|
+
continue;
|
|
145
147
|
}
|
|
146
148
|
const resolvedModule = this.resolveModule(specifier, filePath);
|
|
147
149
|
if (resolvedModule) {
|
|
@@ -171,7 +173,7 @@ export class ProjectPrincipal {
|
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
|
-
}
|
|
176
|
+
}
|
|
175
177
|
return {
|
|
176
178
|
imports: {
|
|
177
179
|
internal,
|
|
@@ -193,7 +195,7 @@ export class ProjectPrincipal {
|
|
|
193
195
|
return members.filter(member => {
|
|
194
196
|
if (member.jsDocTags.includes('@public'))
|
|
195
197
|
return false;
|
|
196
|
-
const referencedSymbols = this.findReferences(filePath, member.pos);
|
|
198
|
+
const referencedSymbols = this.findReferences?.(filePath, member.pos);
|
|
197
199
|
const files = (referencedSymbols ?? [])
|
|
198
200
|
.flatMap(refs => refs.references)
|
|
199
201
|
.filter(ref => !ref.isDefinition)
|
|
@@ -210,7 +212,7 @@ export class ProjectPrincipal {
|
|
|
210
212
|
const languageService = ts.createLanguageService(this.backend.languageServiceHost, ts.createDocumentRegistry());
|
|
211
213
|
this.findReferences = timerify(languageService.findReferences);
|
|
212
214
|
}
|
|
213
|
-
const referencedSymbols = this.findReferences(filePath, exportedItem.pos);
|
|
215
|
+
const referencedSymbols = this.findReferences?.(filePath, exportedItem.pos);
|
|
214
216
|
const files = (referencedSymbols ?? [])
|
|
215
217
|
.flatMap(refs => refs.references)
|
|
216
218
|
.filter(ref => !ref.isDefinition)
|
|
@@ -27,7 +27,7 @@ export declare class WorkspaceWorker {
|
|
|
27
27
|
isStrict: boolean;
|
|
28
28
|
rootIgnore: Configuration['ignore'];
|
|
29
29
|
negatedWorkspacePatterns: string[];
|
|
30
|
-
enabledPluginsMap: Record<"
|
|
30
|
+
enabledPluginsMap: Record<"moonrepo" | "astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "msw" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg", boolean>;
|
|
31
31
|
enabledPlugins: PluginName[];
|
|
32
32
|
enabledPluginsInAncestors: string[];
|
|
33
33
|
constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }: WorkspaceManagerOptions);
|
|
@@ -46,7 +46,7 @@ export declare class WorkspaceWorker {
|
|
|
46
46
|
entryFilePatterns: Set<string>;
|
|
47
47
|
productionEntryFilePatterns: Set<string>;
|
|
48
48
|
referencedDependencies: ReferencedDependencies;
|
|
49
|
-
enabledPlugins: ("
|
|
49
|
+
enabledPlugins: ("moonrepo" | "astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "msw" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg")[];
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
52
|
export {};
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { plugins } from './plugins.js';
|
|
2
2
|
import { debugLogArray, debugLogObject } from './util/debug.js';
|
|
3
|
-
import { _pureGlob,
|
|
3
|
+
import { _pureGlob, hasNoProductionSuffix, hasProductionSuffix, negate, prependDirToPattern } from './util/glob.js';
|
|
4
4
|
import { get, getKeysByValue } from './util/object.js';
|
|
5
5
|
import { basename, dirname, join, toPosix } from './util/path.js';
|
|
6
6
|
import { getFinalEntryPaths, loadConfigForPlugin } from './util/plugin.js';
|
|
@@ -120,7 +120,7 @@ export class WorkspaceWorker {
|
|
|
120
120
|
if (project.length === 0)
|
|
121
121
|
return this.getProductionEntryFilePatterns(negatedTestFilePatterns);
|
|
122
122
|
const _project = this.config.project.map(pattern => {
|
|
123
|
-
if (!pattern.endsWith('!')
|
|
123
|
+
if (!(pattern.endsWith('!') || pattern.startsWith('!')))
|
|
124
124
|
return negate(pattern);
|
|
125
125
|
return pattern;
|
|
126
126
|
});
|
|
@@ -196,21 +196,25 @@ export class WorkspaceWorker {
|
|
|
196
196
|
const config = await loadConfigForPlugin(configFilePath, plugin, opts, pluginName);
|
|
197
197
|
if (config) {
|
|
198
198
|
if (hasResolveEntryPaths) {
|
|
199
|
-
const dependencies = await plugin.resolveEntryPaths(config, opts);
|
|
200
|
-
|
|
199
|
+
const dependencies = (await plugin.resolveEntryPaths?.(config, opts)) ?? [];
|
|
200
|
+
for (const id of dependencies)
|
|
201
|
+
configEntryPaths.push(id);
|
|
201
202
|
}
|
|
202
203
|
if (shouldRunConfigResolver) {
|
|
203
|
-
const dependencies = await plugin.resolveConfig(config, opts);
|
|
204
|
-
|
|
204
|
+
const dependencies = (await plugin.resolveConfig?.(config, opts)) ?? [];
|
|
205
|
+
for (const id of dependencies)
|
|
206
|
+
addDependency(id, configFilePath);
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
const finalEntryPaths = getFinalEntryPaths(plugin, options, configEntryPaths);
|
|
210
|
-
|
|
212
|
+
for (const id of finalEntryPaths)
|
|
213
|
+
addDependency(id);
|
|
211
214
|
if (hasResolve) {
|
|
212
|
-
const dependencies = await plugin.resolve(options);
|
|
213
|
-
|
|
215
|
+
const dependencies = (await plugin.resolve?.(options)) ?? [];
|
|
216
|
+
for (const id of dependencies)
|
|
217
|
+
addDependency(id, join(cwd, 'package.json'));
|
|
214
218
|
}
|
|
215
219
|
debugLogArray([name, plugin.title], 'dependencies', pluginDependencies);
|
|
216
220
|
}
|
package/dist/binaries/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FOREIGN_FILE_EXTENSIONS } from '../constants.js';
|
|
2
|
+
import { timerify } from '../util/Performance.js';
|
|
2
3
|
import { compact } from '../util/array.js';
|
|
3
4
|
import { getPackageNameFromModuleSpecifier } from '../util/modules.js';
|
|
4
5
|
import { extname, isInternal } from '../util/path.js';
|
|
5
|
-
import { timerify } from '../util/Performance.js';
|
|
6
6
|
import { fromBinary, isBinary } from '../util/protocols.js';
|
|
7
7
|
import { getBinariesFromScript } from './bash-parser.js';
|
|
8
8
|
const getDependenciesFromScripts = (npmScripts, options) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
2
|
import { tryResolveFilePath } from '../util.js';
|
|
3
|
-
const commands = ['add', 'create', 'init', 'install', 'link', 'pm', 'remove', 'run', 'update'];
|
|
3
|
+
const commands = ['add', 'create', 'init', 'install', 'link', 'pm', 'remove', 'run', 'test', 'update'];
|
|
4
4
|
export const resolve = (_binary, args, { manifestScriptNames, cwd, fromArgs }) => {
|
|
5
5
|
const parsed = parseArgs(args);
|
|
6
6
|
const [command, script] = parsed._;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
bun: import("
|
|
3
|
-
c8: import("
|
|
4
|
-
dotenv: import("
|
|
5
|
-
node: import("
|
|
6
|
-
nodemon: import("
|
|
7
|
-
npx: import("
|
|
8
|
-
nx: import("
|
|
9
|
-
pnpm: import("
|
|
10
|
-
rollup: import("
|
|
11
|
-
'ts-node': import("
|
|
12
|
-
tsx: import("
|
|
13
|
-
yarn: import("
|
|
2
|
+
bun: import("../types.js").Resolver;
|
|
3
|
+
c8: import("../types.js").Resolver;
|
|
4
|
+
dotenv: import("../types.js").Resolver;
|
|
5
|
+
node: import("../types.js").Resolver;
|
|
6
|
+
nodemon: import("../types.js").Resolver;
|
|
7
|
+
npx: import("../types.js").Resolver;
|
|
8
|
+
nx: import("../types.js").Resolver;
|
|
9
|
+
pnpm: import("../types.js").Resolver;
|
|
10
|
+
rollup: import("../types.js").Resolver;
|
|
11
|
+
'ts-node': import("../types.js").Resolver;
|
|
12
|
+
tsx: import("../types.js").Resolver;
|
|
13
|
+
yarn: import("../types.js").Resolver;
|
|
14
14
|
};
|
|
15
15
|
export default _default;
|
package/dist/binaries/util.js
CHANGED
|
@@ -10,7 +10,7 @@ export const tryResolveFilePath = (cwd, specifier, acceptModuleSpecifier) => {
|
|
|
10
10
|
if (resolvedFilePath) {
|
|
11
11
|
return resolvedFilePath;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
if (acceptModuleSpecifier) {
|
|
14
14
|
return getPackageNameFromModuleSpecifier(specifier);
|
|
15
15
|
}
|
|
16
16
|
}
|