Skip to content

Commit

Permalink
Match against all available internal workspace pkg names
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 6, 2023
1 parent 0d8415b commit 3d1fbe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ConfigurationChief.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ConfigurationValidator } from './ConfigurationValidator.js';
import { ROOT_WORKSPACE_NAME, DEFAULT_EXTENSIONS, KNIP_CONFIG_LOCATIONS } from './constants.js';
import { defaultRules } from './issues/initializers.js';
import * as plugins from './plugins/index.js';
import { arrayify, compact } from './util/array.js';
import { arrayify } from './util/array.js';
import parsedArgValues from './util/cli-arguments.js';
import { partitionCompilers } from './util/compilers.js';
import { ConfigurationError, LoaderError } from './util/errors.js';
Expand Down Expand Up @@ -107,11 +107,11 @@ export class ConfigurationChief {
manifestWorkspaces: Map<string, string> = new Map();
additionalWorkspaceNames: Set<string> = new Set();
availableWorkspaceNames: string[] = [];
availableWorkspacePkgNames: Set<string | undefined> = new Set();
availableWorkspaceDirs: string[] = [];
availableWorkspaceManifests: { dir: string; manifest: PackageJsonWithPlugins }[] = [];
workspacesGraph: ReturnType<typeof createPkgGraph> | undefined;
enabledWorkspaces: Workspace[] = [];
localWorkspaces: Set<string> = new Set();

resolvedConfigFilePath?: string;

Expand Down Expand Up @@ -264,9 +264,9 @@ export class ConfigurationChief {
.map(dir => join(this.cwd, dir));

this.availableWorkspaceManifests = this.getAvailableWorkspaceManifests(this.availableWorkspaceDirs);
this.availableWorkspacePkgNames = new Set(this.availableWorkspaceManifests.map(w => w.manifest.name));
this.workspacesGraph = createPkgGraph(this.availableWorkspaceManifests);
this.enabledWorkspaces = this.getEnabledWorkspaces();
this.localWorkspaces = new Set(compact(this.enabledWorkspaces.map(w => w.pkgName)));
}

private getListedWorkspaces() {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const main = async (unresolvedConfiguration: CommandLineOptions) => {

for (const [specifierFilePath, importItems] of internal.entries()) {
const packageName = getPackageNameFromModuleSpecifier(importItems.specifier);
if (packageName && chief.localWorkspaces.has(packageName)) {
if (packageName && chief.availableWorkspacePkgNames.has(packageName)) {
// Mark "external" imports from other local workspaces as used dependency
external.add(packageName);
if (_principal === principal) {
Expand Down

0 comments on commit 3d1fbe8

Please sign in to comment.