knip 5.76.2 → 5.76.3
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/DependencyDeputy.d.ts +2 -1
- package/dist/DependencyDeputy.js +17 -9
- package/dist/WorkspaceWorker.d.ts +3 -1
- package/dist/WorkspaceWorker.js +5 -2
- package/dist/binaries/package-manager/bunx.js +7 -4
- package/dist/graph/analyze.js +5 -2
- package/dist/graph/build.js +13 -7
- package/dist/plugins/bun/index.js +10 -13
- package/dist/plugins/node/index.js +14 -16
- package/dist/types/config.d.ts +2 -0
- package/dist/typescript/get-imports-and-exports.d.ts +1 -1
- package/dist/typescript/get-imports-and-exports.js +7 -6
- package/dist/util/create-input-handler.d.ts +1 -1
- package/dist/util/create-input-handler.js +5 -3
- package/dist/util/create-options.d.ts +2 -0
- package/dist/util/create-options.js +8 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -6,13 +6,14 @@ import type { MainOptions } from './util/create-options.js';
|
|
|
6
6
|
export declare class DependencyDeputy {
|
|
7
7
|
isProduction: boolean;
|
|
8
8
|
isStrict: boolean;
|
|
9
|
+
isReportDependencies: boolean;
|
|
9
10
|
_manifests: WorkspaceManifests;
|
|
10
11
|
referencedDependencies: Map<string, Set<string>>;
|
|
11
12
|
referencedBinaries: Map<string, Set<string>>;
|
|
12
13
|
hostDependencies: Map<string, HostDependencies>;
|
|
13
14
|
installedBinaries: Map<string, InstalledBinaries>;
|
|
14
15
|
hasTypesIncluded: Map<string, Set<string>>;
|
|
15
|
-
constructor({ isProduction, isStrict }: MainOptions);
|
|
16
|
+
constructor({ isProduction, isStrict, isReportDependencies }: MainOptions);
|
|
16
17
|
addWorkspace({ name, cwd, dir, manifestPath, manifestStr, manifest, ignoreDependencies: id, ignoreBinaries: ib, ignoreUnresolved: iu, }: {
|
|
17
18
|
name: string;
|
|
18
19
|
cwd: string;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -8,15 +8,17 @@ const filterIsProduction = (id, isProduction) => typeof id === 'string' ? (isPro
|
|
|
8
8
|
export class DependencyDeputy {
|
|
9
9
|
isProduction;
|
|
10
10
|
isStrict;
|
|
11
|
+
isReportDependencies;
|
|
11
12
|
_manifests = new Map();
|
|
12
13
|
referencedDependencies;
|
|
13
14
|
referencedBinaries;
|
|
14
15
|
hostDependencies;
|
|
15
16
|
installedBinaries;
|
|
16
17
|
hasTypesIncluded;
|
|
17
|
-
constructor({ isProduction, isStrict }) {
|
|
18
|
+
constructor({ isProduction, isStrict, isReportDependencies }) {
|
|
18
19
|
this.isProduction = isProduction;
|
|
19
20
|
this.isStrict = isStrict;
|
|
21
|
+
this.isReportDependencies = isReportDependencies;
|
|
20
22
|
this.referencedDependencies = new Map();
|
|
21
23
|
this.referencedBinaries = new Map();
|
|
22
24
|
this.hostDependencies = new Map();
|
|
@@ -39,14 +41,16 @@ export class DependencyDeputy {
|
|
|
39
41
|
...(this.isStrict ? peerDependencies : []),
|
|
40
42
|
...(this.isProduction ? [] : devDependencies),
|
|
41
43
|
];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
if (this.isReportDependencies) {
|
|
45
|
+
const { hostDependencies, installedBinaries, hasTypesIncluded } = getDependencyMetaData({
|
|
46
|
+
packageNames,
|
|
47
|
+
dir,
|
|
48
|
+
cwd,
|
|
49
|
+
});
|
|
50
|
+
this.setHostDependencies(name, hostDependencies);
|
|
51
|
+
this.setInstalledBinaries(name, installedBinaries);
|
|
52
|
+
this.setHasTypesIncluded(name, hasTypesIncluded);
|
|
53
|
+
}
|
|
50
54
|
const ignoreDependencies = id.flatMap(id => filterIsProduction(id, this.isProduction)).map(toRegexOrString);
|
|
51
55
|
const ignoreBinaries = ib.flatMap(ib => filterIsProduction(ib, this.isProduction)).map(toRegexOrString);
|
|
52
56
|
const ignoreUnresolved = iu.map(toRegexOrString);
|
|
@@ -124,6 +128,8 @@ export class DependencyDeputy {
|
|
|
124
128
|
return manifest.optionalPeerDependencies;
|
|
125
129
|
}
|
|
126
130
|
maybeAddReferencedExternalDependency(workspace, packageName) {
|
|
131
|
+
if (!this.isReportDependencies)
|
|
132
|
+
return true;
|
|
127
133
|
if (isBuiltin(packageName))
|
|
128
134
|
return true;
|
|
129
135
|
if (IGNORED_RUNTIME_DEPENDENCIES.has(packageName))
|
|
@@ -145,6 +151,8 @@ export class DependencyDeputy {
|
|
|
145
151
|
return false;
|
|
146
152
|
}
|
|
147
153
|
maybeAddReferencedBinary(workspace, binaryName) {
|
|
154
|
+
if (!this.isReportDependencies)
|
|
155
|
+
return new Set();
|
|
148
156
|
if (IGNORED_GLOBAL_BINARIES.has(binaryName))
|
|
149
157
|
return new Set();
|
|
150
158
|
this.addReferencedBinary(workspace.name, binaryName);
|
|
@@ -13,6 +13,7 @@ type WorkspaceManagerOptions = {
|
|
|
13
13
|
config: WorkspaceConfiguration;
|
|
14
14
|
manifest: PackageJson;
|
|
15
15
|
dependencies: DependencySet;
|
|
16
|
+
rootManifest: PackageJson | undefined;
|
|
16
17
|
handleInput: HandleInput;
|
|
17
18
|
findWorkspaceByFilePath: (filePath: string) => Workspace | undefined;
|
|
18
19
|
getSourceFile: GetSourceFile;
|
|
@@ -32,6 +33,7 @@ export declare class WorkspaceWorker {
|
|
|
32
33
|
dir: string;
|
|
33
34
|
config: WorkspaceConfiguration;
|
|
34
35
|
manifest: PackageJson;
|
|
36
|
+
rootManifest: PackageJson | undefined;
|
|
35
37
|
dependencies: DependencySet;
|
|
36
38
|
handleInput: HandleInput;
|
|
37
39
|
findWorkspaceByFilePath: (filePath: string) => Workspace | undefined;
|
|
@@ -44,7 +46,7 @@ export declare class WorkspaceWorker {
|
|
|
44
46
|
enabledPluginsInAncestors: string[];
|
|
45
47
|
cache: CacheConsultant<CacheItem>;
|
|
46
48
|
configFilesMap: Map<string, Map<PluginName, Set<string>>>;
|
|
47
|
-
constructor({ name, dir, config, manifest, dependencies, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, handleInput, findWorkspaceByFilePath, getSourceFile, configFilesMap, options, }: WorkspaceManagerOptions);
|
|
49
|
+
constructor({ name, dir, config, manifest, dependencies, rootManifest, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, handleInput, findWorkspaceByFilePath, getSourceFile, configFilesMap, options, }: WorkspaceManagerOptions);
|
|
48
50
|
init(): Promise<void>;
|
|
49
51
|
private determineEnabledPlugins;
|
|
50
52
|
private getConfigForPlugin;
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -21,6 +21,7 @@ export class WorkspaceWorker {
|
|
|
21
21
|
dir;
|
|
22
22
|
config;
|
|
23
23
|
manifest;
|
|
24
|
+
rootManifest;
|
|
24
25
|
dependencies;
|
|
25
26
|
handleInput;
|
|
26
27
|
findWorkspaceByFilePath;
|
|
@@ -33,11 +34,12 @@ export class WorkspaceWorker {
|
|
|
33
34
|
enabledPluginsInAncestors;
|
|
34
35
|
cache;
|
|
35
36
|
configFilesMap;
|
|
36
|
-
constructor({ name, dir, config, manifest, dependencies, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, handleInput, findWorkspaceByFilePath, getSourceFile, configFilesMap, options, }) {
|
|
37
|
+
constructor({ name, dir, config, manifest, dependencies, rootManifest, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, handleInput, findWorkspaceByFilePath, getSourceFile, configFilesMap, options, }) {
|
|
37
38
|
this.name = name;
|
|
38
39
|
this.dir = dir;
|
|
39
40
|
this.config = config;
|
|
40
41
|
this.manifest = manifest;
|
|
42
|
+
this.rootManifest = rootManifest;
|
|
41
43
|
this.dependencies = dependencies;
|
|
42
44
|
this.negatedWorkspacePatterns = negatedWorkspacePatterns;
|
|
43
45
|
this.ignoredWorkspacePatterns = ignoredWorkspacePatterns;
|
|
@@ -158,7 +160,8 @@ export class WorkspaceWorker {
|
|
|
158
160
|
const isProduction = this.options.isProduction;
|
|
159
161
|
const knownBinsOnly = false;
|
|
160
162
|
const manifestScriptNames = new Set(Object.keys(manifest.scripts ?? {}));
|
|
161
|
-
const
|
|
163
|
+
const rootManifest = this.rootManifest;
|
|
164
|
+
const baseOptions = { manifestScriptNames, rootManifest, cwd, rootCwd, containingFilePath, knownBinsOnly };
|
|
162
165
|
const baseScriptOptions = { ...baseOptions, manifest, isProduction, enabledPlugins: this.enabledPlugins };
|
|
163
166
|
const [productionScripts, developmentScripts] = getFilteredScripts(manifest.scripts ?? {});
|
|
164
167
|
const inputsFromManifest = _getInputsFromScripts(Object.values(developmentScripts), baseOptions);
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import { toDependency } from '../../util/input.js';
|
|
2
|
+
import { toBinary, toDependency } from '../../util/input.js';
|
|
3
3
|
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
|
+
import { isInternal } from '../../util/path.js';
|
|
4
5
|
import { argsFrom } from '../util.js';
|
|
5
6
|
export const resolveX = (args, options) => {
|
|
6
7
|
const { fromArgs } = options;
|
|
7
|
-
const parsed = parseArgs(args);
|
|
8
|
+
const parsed = parseArgs(args, { boolean: ['bun'] });
|
|
8
9
|
const packageSpecifier = parsed._[0];
|
|
9
10
|
const specifier = packageSpecifier ? stripVersionFromSpecifier(packageSpecifier) : '';
|
|
10
11
|
const packages = parsed.package && !parsed.yes ? [parsed.package].flat().map(stripVersionFromSpecifier) : [];
|
|
11
12
|
const command = parsed['shell-mode'] ? fromArgs([parsed['shell-mode']]) : [];
|
|
12
13
|
const restArgs = argsFrom(args, packageSpecifier);
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const isBinary = specifier && !packageSpecifier.includes('@') && !isInternal(specifier);
|
|
15
|
+
const dependency = isBinary ? toBinary(specifier, { optional: true }) : toDependency(specifier, { optional: true });
|
|
16
|
+
const specifiers = specifier ? [dependency] : [];
|
|
17
|
+
return [...specifiers, ...packages.map(id => toDependency(id)), ...command, ...fromArgs(restArgs).slice(1)];
|
|
15
18
|
};
|
|
16
19
|
export const resolve = (_binary, args, options) => {
|
|
17
20
|
return resolveX(args, options);
|
package/dist/graph/analyze.js
CHANGED
|
@@ -199,8 +199,11 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const unusedFiles =
|
|
203
|
-
|
|
202
|
+
const unusedFiles = options.isReportFiles
|
|
203
|
+
? [...unreferencedFiles].filter(filePath => !analyzedFiles.has(filePath))
|
|
204
|
+
: [];
|
|
205
|
+
if (options.isReportFiles)
|
|
206
|
+
collector.addFilesIssues(unusedFiles);
|
|
204
207
|
collector.addFileCounts({ processed: analyzedFiles.size, unused: unusedFiles.length });
|
|
205
208
|
if (options.isReportDependencies) {
|
|
206
209
|
const { dependencyIssues, devDependencyIssues, optionalPeerDependencyIssues } = deputy.settleDependencyIssues();
|
package/dist/graph/build.js
CHANGED
|
@@ -20,8 +20,9 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
20
20
|
const toModuleSourceFilePath = getModuleSourcePathHandler(chief);
|
|
21
21
|
const toSourceFilePaths = getToSourcePathsHandler(chief);
|
|
22
22
|
const addIssue = (issue) => collector.addIssue(issue) && options.isWatch && collector.retainIssue(issue);
|
|
23
|
-
const externalRefsFromInputs = new Map();
|
|
23
|
+
const externalRefsFromInputs = options.isSession ? new Map() : undefined;
|
|
24
24
|
const handleInput = createInputHandler(deputy, chief, isGitIgnored, addIssue, externalRefsFromInputs, options);
|
|
25
|
+
const rootManifest = chief.getManifestForWorkspace('.');
|
|
25
26
|
for (const workspace of workspaces) {
|
|
26
27
|
const { name, dir, manifestPath, manifestStr } = workspace;
|
|
27
28
|
const manifest = chief.getManifestForWorkspace(name);
|
|
@@ -62,6 +63,7 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
62
63
|
config,
|
|
63
64
|
manifest,
|
|
64
65
|
dependencies,
|
|
66
|
+
rootManifest,
|
|
65
67
|
handleInput: (input) => handleInput(input, workspace),
|
|
66
68
|
findWorkspaceByFilePath: chief.findWorkspaceByFilePath.bind(chief),
|
|
67
69
|
negatedWorkspacePatterns: chief.getNegatedWorkspacePatterns(name),
|
|
@@ -255,6 +257,7 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
255
257
|
isFixExports: options.isFixUnusedExports,
|
|
256
258
|
isFixTypes: options.isFixUnusedTypes,
|
|
257
259
|
isReportClassMembers: options.isReportClassMembers,
|
|
260
|
+
isReportExports: options.isReportExports,
|
|
258
261
|
skipTypeOnly: options.isStrict,
|
|
259
262
|
tags: options.tags,
|
|
260
263
|
};
|
|
@@ -316,6 +319,7 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
316
319
|
containingFilePath: filePath,
|
|
317
320
|
dependencies,
|
|
318
321
|
manifestScriptNames,
|
|
322
|
+
rootManifest,
|
|
319
323
|
};
|
|
320
324
|
const inputs = _getInputsFromScripts(file.scripts, opts);
|
|
321
325
|
for (const input of inputs) {
|
|
@@ -327,7 +331,7 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
327
331
|
}
|
|
328
332
|
}
|
|
329
333
|
file.imports.unresolved = unresolvedImports;
|
|
330
|
-
const pluginRefs = externalRefsFromInputs
|
|
334
|
+
const pluginRefs = externalRefsFromInputs?.get(filePath);
|
|
331
335
|
if (pluginRefs)
|
|
332
336
|
for (const ref of pluginRefs)
|
|
333
337
|
file.imports.externalRefs.add(ref);
|
|
@@ -385,11 +389,13 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
385
389
|
}
|
|
386
390
|
principals.length = 0;
|
|
387
391
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
graph.
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
if (externalRefsFromInputs) {
|
|
393
|
+
for (const [filePath, refs] of externalRefsFromInputs) {
|
|
394
|
+
if (!graph.has(filePath))
|
|
395
|
+
graph.set(filePath, createFileNode());
|
|
396
|
+
for (const ref of refs)
|
|
397
|
+
graph.get(filePath).imports.externalRefs.add(ref);
|
|
398
|
+
}
|
|
393
399
|
}
|
|
394
400
|
return {
|
|
395
401
|
graph,
|
|
@@ -2,17 +2,16 @@ import parseArgs from 'minimist';
|
|
|
2
2
|
import { toEntry } from '../../util/input.js';
|
|
3
3
|
const title = 'Bun';
|
|
4
4
|
const enablers = ['bun'];
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const scripts =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const parsed = parseArgs(scripts[script].split(' '));
|
|
5
|
+
const hasBunTest = (scripts) => scripts && Object.values(scripts).some(script => /(?<=^|\s)bun test/.test(script));
|
|
6
|
+
const isEnabled = ({ manifest }) => !!hasBunTest(manifest.scripts);
|
|
7
|
+
const patterns = ['**/*.{test,spec}.{js,jsx,ts,tsx}', '**/*_{test,spec}.{js,jsx,ts,tsx}'];
|
|
8
|
+
const resolve = (options) => {
|
|
9
|
+
const scripts = { ...options.rootManifest?.scripts, ...options.manifest.scripts };
|
|
10
|
+
for (const script of Object.values(scripts)) {
|
|
11
|
+
if (/(?<=^|\s)bun test/.test(script)) {
|
|
12
|
+
const parsed = parseArgs(script.split(' '));
|
|
14
13
|
if (parsed._.filter(id => id !== 'bun' && id !== 'test').length === 0) {
|
|
15
|
-
return
|
|
14
|
+
return patterns.map(toEntry);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -22,8 +21,6 @@ const plugin = {
|
|
|
22
21
|
title,
|
|
23
22
|
enablers,
|
|
24
23
|
isEnabled,
|
|
25
|
-
|
|
26
|
-
packageJsonPath,
|
|
27
|
-
resolveConfig,
|
|
24
|
+
resolve,
|
|
28
25
|
};
|
|
29
26
|
export default plugin;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { toEntry, toProductionEntry } from '../../util/input.js';
|
|
2
2
|
const title = 'Node.js';
|
|
3
3
|
const isEnabled = () => true;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
entries.push(...patterns.map(id => toEntry(id)));
|
|
4
|
+
const patterns = [
|
|
5
|
+
'**/*{.,-,_}test.{cjs,mjs,js,cts,mts,ts}',
|
|
6
|
+
'**/test-*.{cjs,mjs,js,cts,mts,ts}',
|
|
7
|
+
'**/test.{cjs,mjs,js,cts,mts,ts}',
|
|
8
|
+
'**/test/**/*.{cjs,mjs,js,cts,mts,ts}',
|
|
9
|
+
];
|
|
10
|
+
const hasNodeTest = (scripts) => scripts && Object.values(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(script));
|
|
11
|
+
const entry = ['server.js'];
|
|
12
|
+
const resolve = (options) => {
|
|
13
|
+
const entries = entry.map(id => toProductionEntry(id));
|
|
14
|
+
if (hasNodeTest(options.manifest.scripts) || hasNodeTest(options.rootManifest?.scripts)) {
|
|
15
|
+
entries.push(...patterns.map(toEntry));
|
|
17
16
|
}
|
|
18
17
|
return entries;
|
|
19
18
|
};
|
|
@@ -39,9 +38,8 @@ const args = {
|
|
|
39
38
|
const plugin = {
|
|
40
39
|
title,
|
|
41
40
|
isEnabled,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
resolveConfig,
|
|
41
|
+
entry,
|
|
42
|
+
resolve,
|
|
45
43
|
args,
|
|
46
44
|
};
|
|
47
45
|
export default plugin;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export type GetImportsAndExportsOptions = {
|
|
|
33
33
|
isFixExports: boolean;
|
|
34
34
|
isFixTypes: boolean;
|
|
35
35
|
isReportClassMembers: boolean;
|
|
36
|
+
isReportExports: boolean;
|
|
36
37
|
tags: Tags;
|
|
37
38
|
};
|
|
38
39
|
export interface Configuration {
|
|
@@ -72,6 +73,7 @@ interface BaseOptions {
|
|
|
72
73
|
rootCwd: string;
|
|
73
74
|
cwd: string;
|
|
74
75
|
manifestScriptNames: Set<string>;
|
|
76
|
+
rootManifest: PackageJson | undefined;
|
|
75
77
|
}
|
|
76
78
|
type IsPluginEnabledOptions = {
|
|
77
79
|
cwd: string;
|
|
@@ -2,4 +2,4 @@ import ts from 'typescript';
|
|
|
2
2
|
import type { GetImportsAndExportsOptions, IgnoreExportsUsedInFile } from '../types/config.js';
|
|
3
3
|
import type { FileNode } from '../types/module-graph.js';
|
|
4
4
|
import type { BoundSourceFile } from './SourceFile.js';
|
|
5
|
-
export declare const _getImportsAndExports: (sourceFile: BoundSourceFile, resolveModule: (specifier: string) => ts.ResolvedModuleFull | undefined, typeChecker: ts.TypeChecker, options: GetImportsAndExportsOptions, ignoreExportsUsedInFile: IgnoreExportsUsedInFile,
|
|
5
|
+
export declare const _getImportsAndExports: (sourceFile: BoundSourceFile, resolveModule: (specifier: string) => ts.ResolvedModuleFull | undefined, typeChecker: ts.TypeChecker, options: GetImportsAndExportsOptions, ignoreExportsUsedInFile: IgnoreExportsUsedInFile, skipExportsForFile: boolean) => FileNode;
|
|
@@ -34,7 +34,8 @@ const createMember = (node, member, pos) => {
|
|
|
34
34
|
flags: member.flags,
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, ignoreExportsUsedInFile,
|
|
37
|
+
const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, ignoreExportsUsedInFile, skipExportsForFile) => {
|
|
38
|
+
const skipExports = skipExportsForFile || !options.isReportExports;
|
|
38
39
|
const internal = new Map();
|
|
39
40
|
const external = new Set();
|
|
40
41
|
const unresolved = new Set();
|
|
@@ -197,8 +198,6 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
197
198
|
}
|
|
198
199
|
};
|
|
199
200
|
const addExport = ({ node, symbol, identifier, type, pos, members, fix }) => {
|
|
200
|
-
if (skipExports)
|
|
201
|
-
return;
|
|
202
201
|
let isReExport = Boolean(node.parent?.parent && ts.isExportDeclaration(node.parent.parent) && node.parent.parent.moduleSpecifier);
|
|
203
202
|
if (symbol) {
|
|
204
203
|
const importedSymbolFilePath = importedInternalSymbols.get(symbol);
|
|
@@ -266,9 +265,11 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
266
265
|
const result = visitor(node, options);
|
|
267
266
|
result && (Array.isArray(result) ? result.forEach(addImportWithNode) : addImportWithNode(result));
|
|
268
267
|
}
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
268
|
+
if (!skipExports) {
|
|
269
|
+
for (const visitor of visitors.export) {
|
|
270
|
+
const result = visitor(node, options);
|
|
271
|
+
result && (Array.isArray(result) ? result.forEach(addExport) : addExport(result));
|
|
272
|
+
}
|
|
272
273
|
}
|
|
273
274
|
if (ts.isImportEqualsDeclaration(node) &&
|
|
274
275
|
ts.isQualifiedName(node.moduleReference) &&
|
|
@@ -5,4 +5,4 @@ import type { ExternalRef } from '../types/module-graph.js';
|
|
|
5
5
|
import type { MainOptions } from './create-options.js';
|
|
6
6
|
import { type Input } from './input.js';
|
|
7
7
|
export type ExternalRefsFromInputs = Map<string, Set<ExternalRef>>;
|
|
8
|
-
export declare const createInputHandler: (deputy: DependencyDeputy, chief: ConfigurationChief, isGitIgnored: (filePath: string) => boolean, addIssue: (issue: Issue) => void, externalRefs: ExternalRefsFromInputs, options: MainOptions) => (input: Input, workspace: Workspace) => string | undefined;
|
|
8
|
+
export declare const createInputHandler: (deputy: DependencyDeputy, chief: ConfigurationChief, isGitIgnored: (filePath: string) => boolean, addIssue: (issue: Issue) => void, externalRefs: ExternalRefsFromInputs | undefined, options: MainOptions) => (input: Input, workspace: Workspace) => string | undefined;
|
|
@@ -21,8 +21,10 @@ export const createInputHandler = (deputy, chief, isGitIgnored, addIssue, extern
|
|
|
21
21
|
const inputWorkspace = getWorkspaceFor(input, chief, workspace);
|
|
22
22
|
const dependencies = deputy.maybeAddReferencedBinary(inputWorkspace, binaryName);
|
|
23
23
|
if (dependencies) {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if (externalRefs) {
|
|
25
|
+
for (const dependency of dependencies) {
|
|
26
|
+
addExternalRef(externalRefs, containingFilePath, { specifier: dependency, identifier: binaryName });
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
@@ -44,7 +46,7 @@ export const createInputHandler = (deputy, chief, isGitIgnored, addIssue, extern
|
|
|
44
46
|
const inputWorkspace = getWorkspaceFor(input, chief, workspace);
|
|
45
47
|
if (inputWorkspace) {
|
|
46
48
|
const isHandled = deputy.maybeAddReferencedExternalDependency(inputWorkspace, packageName);
|
|
47
|
-
if (!isWorkspace) {
|
|
49
|
+
if (externalRefs && !isWorkspace) {
|
|
48
50
|
addExternalRef(externalRefs, containingFilePath, { specifier: packageName, identifier: undefined });
|
|
49
51
|
}
|
|
50
52
|
if (isWorkspace || isDependency(input)) {
|
|
@@ -31,6 +31,8 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
31
31
|
isProduction: boolean;
|
|
32
32
|
isReportClassMembers: boolean;
|
|
33
33
|
isReportDependencies: boolean;
|
|
34
|
+
isReportExports: boolean;
|
|
35
|
+
isReportFiles: boolean;
|
|
34
36
|
isReportTypes: boolean;
|
|
35
37
|
isReportValues: boolean;
|
|
36
38
|
isSession: boolean;
|
|
@@ -101,6 +101,14 @@ export const createOptions = async (options) => {
|
|
|
101
101
|
includedIssueTypes.unlisted ||
|
|
102
102
|
includedIssueTypes.unresolved ||
|
|
103
103
|
includedIssueTypes.binaries,
|
|
104
|
+
isReportExports: includedIssueTypes.exports ||
|
|
105
|
+
includedIssueTypes.types ||
|
|
106
|
+
includedIssueTypes.nsExports ||
|
|
107
|
+
includedIssueTypes.nsTypes ||
|
|
108
|
+
includedIssueTypes.enumMembers ||
|
|
109
|
+
includedIssueTypes.duplicates ||
|
|
110
|
+
isReportClassMembers,
|
|
111
|
+
isReportFiles: includedIssueTypes.files,
|
|
104
112
|
isReportTypes: includedIssueTypes.types || includedIssueTypes.nsTypes || includedIssueTypes.enumMembers,
|
|
105
113
|
isReportValues: includedIssueTypes.exports || includedIssueTypes.nsExports || isReportClassMembers,
|
|
106
114
|
isSession: options.isSession ?? false,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.76.
|
|
1
|
+
export declare const version = "5.76.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.76.
|
|
1
|
+
export const version = '5.76.3';
|