knip 2.3.1 → 2.4.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 +1 -0
- package/dist/ConfigurationChief.js +2 -0
- package/dist/DependencyDeputy.js +7 -6
- package/dist/binaries/bash-parser.js +3 -2
- package/dist/binaries/index.js +5 -4
- package/dist/binaries/resolvers/fallback.js +3 -2
- package/dist/binaries/resolvers/node.js +1 -1
- package/dist/binaries/resolvers/npx.js +5 -2
- package/dist/binaries/resolvers/pnpm.js +5 -4
- package/dist/binaries/resolvers/rollup.js +2 -2
- package/dist/binaries/resolvers/yarn.js +6 -5
- package/dist/binaries/util.d.ts +6 -0
- package/dist/binaries/util.js +23 -0
- package/dist/index.js +2 -9
- package/dist/typescript/visitors/scripts/execa.d.ts +3 -0
- package/dist/typescript/visitors/scripts/execa.js +16 -0
- package/dist/typescript/visitors/scripts/index.js +2 -1
- package/dist/util/modules.d.ts +0 -1
- package/dist/util/modules.js +0 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -4
- package/dist/binaries/resolvers/util.d.ts +0 -2
- package/dist/binaries/resolvers/util.js +0 -15
|
@@ -24,6 +24,7 @@ export declare class ConfigurationChief {
|
|
|
24
24
|
additionalWorkspaces: Set<string>;
|
|
25
25
|
workspaceDirs: string[];
|
|
26
26
|
workspaces: Workspace[];
|
|
27
|
+
localWorkspaces: Set<string>;
|
|
27
28
|
resolvedConfigFilePath?: string;
|
|
28
29
|
constructor({ cwd, isProduction }: ConfigurationManagerOptions);
|
|
29
30
|
init(): Promise<void>;
|
|
@@ -50,6 +50,7 @@ export class ConfigurationChief {
|
|
|
50
50
|
additionalWorkspaces = new Set();
|
|
51
51
|
workspaceDirs = [];
|
|
52
52
|
workspaces = [];
|
|
53
|
+
localWorkspaces = new Set();
|
|
53
54
|
resolvedConfigFilePath;
|
|
54
55
|
constructor({ cwd, isProduction }) {
|
|
55
56
|
this.cwd = cwd;
|
|
@@ -152,6 +153,7 @@ export class ConfigurationChief {
|
|
|
152
153
|
this.ignoreWorkspaces = this.getIgnoredWorkspaces();
|
|
153
154
|
this.manifestWorkspaces = await this.getManifestWorkspaces();
|
|
154
155
|
this.additionalWorkspaces = await this.getAdditionalWorkspaces();
|
|
156
|
+
this.localWorkspaces = new Set(compact(this.getEnabledWorkspaces().map(w => w.pkgName)));
|
|
155
157
|
this.workspaces = this.getEnabledWorkspaces();
|
|
156
158
|
this.workspaceDirs = this.getAllWorkspaces()
|
|
157
159
|
.sort(byPathDepth)
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
|
+
import { fromBinary, isBinary } from './binaries/util.js';
|
|
2
3
|
import { IGNORE_DEFINITELY_TYPED, IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES } from './constants.js';
|
|
3
4
|
import { isDefinitelyTyped, getDefinitelyTypedFor, getPackageFromDefinitelyTyped } from './util/modules.js';
|
|
4
5
|
export class DependencyDeputy {
|
|
@@ -72,16 +73,16 @@ export class DependencyDeputy {
|
|
|
72
73
|
return true;
|
|
73
74
|
const workspaceNames = this.isStrict ? [workspace.name] : [workspace.name, ...[...workspace.ancestors].reverse()];
|
|
74
75
|
const closestWorkspaceName = workspaceNames.find(name => this.isInDependencies(name, packageName));
|
|
75
|
-
if (packageName
|
|
76
|
-
const
|
|
77
|
-
if (IGNORED_GLOBAL_BINARIES.includes(
|
|
76
|
+
if (isBinary(packageName)) {
|
|
77
|
+
const binaryName = fromBinary(packageName);
|
|
78
|
+
if (IGNORED_GLOBAL_BINARIES.includes(binaryName))
|
|
78
79
|
return true;
|
|
79
|
-
if (this.getWorkspaceManifest(workspace.name)?.ignoreBinaries.includes(
|
|
80
|
+
if (this.getWorkspaceManifest(workspace.name)?.ignoreBinaries.includes(binaryName))
|
|
80
81
|
return true;
|
|
81
82
|
for (const name of workspaceNames) {
|
|
82
83
|
const binaries = this.getInstalledBinaries(name);
|
|
83
|
-
if (binaries?.has(
|
|
84
|
-
const dependencies = binaries.get(
|
|
84
|
+
if (binaries?.has(binaryName)) {
|
|
85
|
+
const dependencies = binaries.get(binaryName);
|
|
85
86
|
if (dependencies?.size) {
|
|
86
87
|
dependencies.forEach(dependency => this.addReferencedDependency(name, dependency));
|
|
87
88
|
return true;
|
|
@@ -3,6 +3,7 @@ import parseArgs from 'minimist';
|
|
|
3
3
|
import { debugLogObject } from '../util/debug.js';
|
|
4
4
|
import * as FallbackResolver from './resolvers/fallback.js';
|
|
5
5
|
import * as KnownResolvers from './resolvers/index.js';
|
|
6
|
+
import { stripBinaryPath, toBinary } from './util.js';
|
|
6
7
|
const spawningBinaries = ['cross-env', 'dotenv'];
|
|
7
8
|
export const getBinariesFromScript = (script, { cwd, manifest, knownGlobalsOnly = false }) => {
|
|
8
9
|
if (!script)
|
|
@@ -11,7 +12,7 @@ export const getBinariesFromScript = (script, { cwd, manifest, knownGlobalsOnly
|
|
|
11
12
|
const getBinariesFromNodes = (nodes) => nodes.flatMap(node => {
|
|
12
13
|
switch (node.type) {
|
|
13
14
|
case 'Command': {
|
|
14
|
-
const binary = node.name?.text;
|
|
15
|
+
const binary = node.name?.text ? stripBinaryPath(node.name.text) : node.name?.text;
|
|
15
16
|
const commandExpansions = node.prefix?.flatMap(prefix => prefix.expansion?.filter(expansion => expansion.type === 'CommandExpansion') ?? []) ?? [];
|
|
16
17
|
if (commandExpansions.length > 0) {
|
|
17
18
|
return commandExpansions.flatMap(expansion => getBinariesFromNodes(expansion.commandAST.commands)) ?? [];
|
|
@@ -35,7 +36,7 @@ export const getBinariesFromScript = (script, { cwd, manifest, knownGlobalsOnly
|
|
|
35
36
|
const [spawnedBinary] = parsedArgs._;
|
|
36
37
|
if (spawnedBinary) {
|
|
37
38
|
const restArgs = args.slice(args.indexOf(spawnedBinary));
|
|
38
|
-
return [binary, ...fromArgs(restArgs)];
|
|
39
|
+
return [toBinary(binary), ...fromArgs(restArgs)];
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
42
|
return [];
|
package/dist/binaries/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { compact } from '../util/array.js';
|
|
2
|
-
import { getPackageNameFromModuleSpecifier
|
|
2
|
+
import { getPackageNameFromModuleSpecifier } from '../util/modules.js';
|
|
3
3
|
import { isInternal } from '../util/path.js';
|
|
4
4
|
import { timerify } from '../util/Performance.js';
|
|
5
5
|
import { getBinariesFromScript } from './bash-parser.js';
|
|
6
|
+
import { isBinary } from './util.js';
|
|
6
7
|
const defaultCwd = process.cwd();
|
|
7
8
|
const getDependenciesFromScripts = (npmScripts, options = {}) => {
|
|
8
9
|
const { cwd = defaultCwd, manifest = {}, knownGlobalsOnly = false } = options;
|
|
9
10
|
const scripts = typeof npmScripts === 'string' ? [npmScripts] : [...npmScripts];
|
|
10
11
|
const results = scripts.flatMap(script => getBinariesFromScript(script, { cwd, manifest, knownGlobalsOnly }));
|
|
11
12
|
return compact(results.map(identifier => {
|
|
12
|
-
if (isInternal(identifier))
|
|
13
|
+
if (isBinary(identifier) || isInternal(identifier))
|
|
13
14
|
return identifier;
|
|
14
|
-
const packageName = getPackageNameFromModuleSpecifier(
|
|
15
|
+
const packageName = getPackageNameFromModuleSpecifier(identifier);
|
|
15
16
|
if (!packageName.startsWith('.'))
|
|
16
|
-
return
|
|
17
|
+
return packageName;
|
|
17
18
|
}));
|
|
18
19
|
};
|
|
19
20
|
export const _getDependenciesFromScripts = timerify(getDependenciesFromScripts);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
2
|
import { compact } from '../../util/array.js';
|
|
3
|
-
import { tryResolveFilePaths } from '
|
|
3
|
+
import { toBinary, tryResolveFilePaths } from '../util.js';
|
|
4
4
|
const withPositional = parsed => [parsed._[0], parsed.require].flat();
|
|
5
5
|
const withoutPositional = parsed => [parsed.require].flat();
|
|
6
6
|
const argFilters = {
|
|
7
7
|
'babel-node': withPositional,
|
|
8
8
|
esbuild: withPositional,
|
|
9
|
+
execa: withPositional,
|
|
9
10
|
nodemon: withPositional,
|
|
10
11
|
'ts-node': withPositional,
|
|
11
12
|
zx: withPositional,
|
|
@@ -16,5 +17,5 @@ export const resolve = (binary, args, { cwd }) => {
|
|
|
16
17
|
const parsed = parseArgs(args, { string: ['r'], alias: { require: ['r', 'loader'] }, boolean: ['quiet', 'verbose'] });
|
|
17
18
|
const argFilter = argFilters[binary] ?? argFilters.default;
|
|
18
19
|
const filteredArgs = compact(argFilter(parsed));
|
|
19
|
-
return [binary, ...tryResolveFilePaths(cwd, filteredArgs)];
|
|
20
|
+
return [toBinary(binary), ...tryResolveFilePaths(cwd, filteredArgs)];
|
|
20
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import { tryResolveFilePath, tryResolveFilePaths } from '
|
|
2
|
+
import { tryResolveFilePath, tryResolveFilePaths } from '../util.js';
|
|
3
3
|
export const resolve = (binary, args, { cwd }) => {
|
|
4
4
|
const parsed = parseArgs(args, { string: ['r'], alias: { require: ['r', 'loader', 'experimental-loader'] } });
|
|
5
5
|
return [...tryResolveFilePath(cwd, parsed._[0]), ...tryResolveFilePaths(cwd, [parsed.require].flat())];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
+
import { fromBinary } from '../util.js';
|
|
2
3
|
export const resolve = (binary, args, { fromArgs }) => {
|
|
3
4
|
const parsed = parseArgs(args, { '--': true, stopEarly: true, boolean: ['yes', 'no'], alias: { yes: 'y', no: 'n' } });
|
|
4
|
-
const
|
|
5
|
+
const leftParsed = fromArgs(parsed._);
|
|
6
|
+
const left = parsed.yes ? leftParsed.slice(1) : leftParsed;
|
|
7
|
+
const packageName = left[0] ? [fromBinary(left[0])] : [];
|
|
5
8
|
const right = parsed['--'] ? fromArgs(parsed['--']) : [];
|
|
6
|
-
return [...
|
|
9
|
+
return [...packageName, ...left.slice(1), ...right];
|
|
7
10
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
+
import { toBinary } from '../util.js';
|
|
2
3
|
const commands = [
|
|
3
4
|
'add',
|
|
4
5
|
'dlx',
|
|
@@ -33,13 +34,13 @@ const commands = [
|
|
|
33
34
|
't',
|
|
34
35
|
'tst',
|
|
35
36
|
];
|
|
36
|
-
export const resolve = (
|
|
37
|
+
export const resolve = (_binary, args, { manifest }) => {
|
|
37
38
|
const scripts = manifest.scripts ? Object.keys(manifest.scripts) : [];
|
|
38
39
|
const parsed = parseArgs(args, {});
|
|
39
|
-
const [command,
|
|
40
|
+
const [command, binary] = parsed._;
|
|
40
41
|
if (scripts.includes(command) || commands.includes(command))
|
|
41
42
|
return [];
|
|
42
43
|
if (command === 'exec')
|
|
43
|
-
return [
|
|
44
|
-
return command ? [command] : [];
|
|
44
|
+
return [toBinary(binary)];
|
|
45
|
+
return command ? [toBinary(command)] : [];
|
|
45
46
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import { tryResolveFilePaths } from '
|
|
2
|
+
import { toBinary, tryResolveFilePaths } from '../util.js';
|
|
3
3
|
export const resolve = (binary, args, { cwd, fromArgs }) => {
|
|
4
4
|
const safeArgs = args.filter(arg => arg !== '--watch');
|
|
5
5
|
const parsed = parseArgs(safeArgs, { alias: { plugin: 'p' } });
|
|
6
6
|
const watchers = parsed.watch ? fromArgs(Object.values(parsed.watch)) : [];
|
|
7
7
|
const plugins = parsed.plugin ? tryResolveFilePaths(cwd, [parsed.plugin].flat()) : [];
|
|
8
8
|
const configPlugins = parsed.configPlugin ? tryResolveFilePaths(cwd, [parsed.configPlugin].flat()) : [];
|
|
9
|
-
return [binary, ...watchers, ...plugins, ...configPlugins];
|
|
9
|
+
return [toBinary(binary), ...watchers, ...plugins, ...configPlugins];
|
|
10
10
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
+
import { toBinary } from '../util.js';
|
|
2
3
|
const commands = [
|
|
3
4
|
'add',
|
|
4
5
|
'bin',
|
|
@@ -30,17 +31,17 @@ const commands = [
|
|
|
30
31
|
'workspace',
|
|
31
32
|
'workspaces',
|
|
32
33
|
];
|
|
33
|
-
export const resolve = (
|
|
34
|
+
export const resolve = (_binary, args, { manifest, fromArgs }) => {
|
|
34
35
|
const scripts = manifest.scripts ? Object.keys(manifest.scripts) : [];
|
|
35
36
|
const parsed = parseArgs(args, {});
|
|
36
|
-
const [command,
|
|
37
|
+
const [command, binary] = parsed._;
|
|
37
38
|
if (scripts.includes(command) || commands.includes(command))
|
|
38
39
|
return [];
|
|
39
|
-
if (command === 'run' && scripts.includes(
|
|
40
|
+
if (command === 'run' && scripts.includes(binary))
|
|
40
41
|
return [];
|
|
41
42
|
if (command === 'run' || command === 'exec')
|
|
42
|
-
return [
|
|
43
|
+
return [toBinary(binary)];
|
|
43
44
|
if (command === 'node')
|
|
44
45
|
return fromArgs(parsed._);
|
|
45
|
-
return command ? [command] : [];
|
|
46
|
+
return command ? [toBinary(command)] : [];
|
|
46
47
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const tryResolveFilePath: (cwd: string, specifier: string, fallback?: string) => string[];
|
|
2
|
+
export declare const tryResolveFilePaths: (cwd: string, specifiers: string[]) => string[];
|
|
3
|
+
export declare const toBinary: (specifier: string) => string;
|
|
4
|
+
export declare const fromBinary: (specifier: string) => string;
|
|
5
|
+
export declare const isBinary: (specifier: string) => boolean;
|
|
6
|
+
export declare const stripBinaryPath: (command: string) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isInNodeModules, join } from '../util/path.js';
|
|
2
|
+
import { _tryResolve } from '../util/require.js';
|
|
3
|
+
export const tryResolveFilePath = (cwd, specifier, fallback) => {
|
|
4
|
+
if (specifier) {
|
|
5
|
+
const filePath = join(cwd, specifier);
|
|
6
|
+
if (!isInNodeModules(filePath)) {
|
|
7
|
+
const resolvedFilePath = _tryResolve(filePath, cwd);
|
|
8
|
+
if (resolvedFilePath)
|
|
9
|
+
return [resolvedFilePath];
|
|
10
|
+
}
|
|
11
|
+
return fallback ? [stripNodeModulesFromPath(fallback)] : [];
|
|
12
|
+
}
|
|
13
|
+
return [];
|
|
14
|
+
};
|
|
15
|
+
export const tryResolveFilePaths = (cwd, specifiers) => specifiers.flatMap(specifier => tryResolveFilePath(cwd, specifier, specifier));
|
|
16
|
+
export const toBinary = (specifier) => specifier.replace(/^(bin:)?/, 'bin:');
|
|
17
|
+
export const fromBinary = (specifier) => specifier.replace(/^(bin:)?/, '');
|
|
18
|
+
export const isBinary = (specifier) => specifier.startsWith('bin:');
|
|
19
|
+
const stripNodeModulesFromPath = (command) => command.replace(/^(\.\/)?node_modules\//, '');
|
|
20
|
+
export const stripBinaryPath = (command) => stripNodeModulesFromPath(command)
|
|
21
|
+
.replace(/^(\.bin\/)/, '')
|
|
22
|
+
.replace(/\$\(npm bin\)\/(\w+)/, '$1')
|
|
23
|
+
.replace(/(\S+)@.*/, '$1');
|
package/dist/index.js
CHANGED
|
@@ -183,15 +183,8 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
183
183
|
exportedSymbols.set(filePath, exported);
|
|
184
184
|
for (const [specifierFilePath, importItems] of internal.entries()) {
|
|
185
185
|
const packageName = getPackageNameFromModuleSpecifier(importItems.specifier);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (importedWorkspace === workspace) {
|
|
189
|
-
principal.addEntryPath(specifierFilePath);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
external.add(importItems.specifier);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
186
|
+
if (chief.localWorkspaces.has(packageName))
|
|
187
|
+
external.add(packageName);
|
|
195
188
|
if (!importedSymbols.has(specifierFilePath)) {
|
|
196
189
|
importedSymbols.set(specifierFilePath, importItems);
|
|
197
190
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { stripQuotes } from '../../ast-helpers.js';
|
|
3
|
+
import { scriptVisitor as visit } from '../index.js';
|
|
4
|
+
export default visit(sourceFile => sourceFile.statements.some(statementImportsExeca$), node => {
|
|
5
|
+
if (ts.isTaggedTemplateExpression(node) && node.tag.getText() === '$') {
|
|
6
|
+
return stripQuotes(node.template.getText());
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
function statementImportsExeca$(node) {
|
|
10
|
+
return (ts.isImportDeclaration(node) &&
|
|
11
|
+
ts.isStringLiteral(node.moduleSpecifier) &&
|
|
12
|
+
node.moduleSpecifier.text === 'execa' &&
|
|
13
|
+
!!node.importClause?.namedBindings &&
|
|
14
|
+
ts.isNamedImports(node.importClause.namedBindings) &&
|
|
15
|
+
node.importClause.namedBindings.elements.some(element => element.name.text === '$'));
|
|
16
|
+
}
|
package/dist/util/modules.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { PackageJson } from '@npmcli/package-json';
|
|
2
2
|
export declare const getPackageNameFromModuleSpecifier: (moduleSpecifier: string) => string;
|
|
3
3
|
export declare const getPackageNameFromFilePath: (value: string) => string;
|
|
4
|
-
export declare const stripBinary: (command: string) => string;
|
|
5
4
|
export declare const isDefinitelyTyped: (packageName: string) => boolean;
|
|
6
5
|
export declare const getDefinitelyTypedFor: (packageName: string) => string;
|
|
7
6
|
export declare const getPackageFromDefinitelyTyped: (typedDependency: string) => string;
|
package/dist/util/modules.js
CHANGED
|
@@ -11,10 +11,6 @@ export const getPackageNameFromFilePath = (value) => {
|
|
|
11
11
|
return match[match.length - 1];
|
|
12
12
|
return value;
|
|
13
13
|
};
|
|
14
|
-
export const stripBinary = (command) => command
|
|
15
|
-
.replace(/(\.\/)?node_modules\/(\.bin\/)?(\w+)/, '$3')
|
|
16
|
-
.replace(/\$\(npm bin\)\/(\w+)/, '$1')
|
|
17
|
-
.replace(/(\S+)@.*/, '$1');
|
|
18
14
|
export const isDefinitelyTyped = (packageName) => packageName.startsWith('@types/');
|
|
19
15
|
export const getDefinitelyTypedFor = (packageName) => {
|
|
20
16
|
if (isDefinitelyTyped(packageName))
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.4.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.4.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://github.com/webpro/knip",
|
|
6
6
|
"repository": "github:webpro/knip",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"pretty-ms": "^8.0.0",
|
|
56
56
|
"strip-json-comments": "^5.0.0",
|
|
57
57
|
"summary": "^2.1.0",
|
|
58
|
-
"typescript": "5.0.2",
|
|
58
|
+
"typescript": "^5.0.2",
|
|
59
59
|
"zod": "^3.20.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"eslint-plugin-import": "2.27.5",
|
|
78
78
|
"globstar": "1.0.0",
|
|
79
79
|
"prettier": "2.8.7",
|
|
80
|
-
"release-it": "15.
|
|
80
|
+
"release-it": "15.10.0",
|
|
81
81
|
"remark-cli": "11.0.0",
|
|
82
82
|
"remark-preset-webpro": "0.0.2",
|
|
83
83
|
"tsx": "3.12.6",
|
|
@@ -99,7 +99,10 @@
|
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
101
|
"github": {
|
|
102
|
-
"release": true
|
|
102
|
+
"release": true,
|
|
103
|
+
"comments": {
|
|
104
|
+
"submit": true
|
|
105
|
+
}
|
|
103
106
|
},
|
|
104
107
|
"plugins": {
|
|
105
108
|
"@release-it/bumper": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isInNodeModules, join } from '../../util/path.js';
|
|
2
|
-
import { _tryResolve } from '../../util/require.js';
|
|
3
|
-
export const tryResolveFilePath = (cwd, specifier, fallback) => {
|
|
4
|
-
if (specifier) {
|
|
5
|
-
const filePath = join(cwd, specifier);
|
|
6
|
-
if (!isInNodeModules(filePath)) {
|
|
7
|
-
const resolvedFilePath = _tryResolve(filePath, cwd);
|
|
8
|
-
if (resolvedFilePath)
|
|
9
|
-
return [resolvedFilePath];
|
|
10
|
-
}
|
|
11
|
-
return fallback ? [fallback] : [];
|
|
12
|
-
}
|
|
13
|
-
return [];
|
|
14
|
-
};
|
|
15
|
-
export const tryResolveFilePaths = (cwd, specifiers) => specifiers.flatMap(specifier => tryResolveFilePath(cwd, specifier, specifier));
|