From 8508c45daaa8d0f1779eea3912d5ee19f32c498d Mon Sep 17 00:00:00 2001 From: David First Date: Tue, 6 Oct 2026 15:10:30 -0400 Subject: [PATCH 1/6] refactor: move aspect-loader and dependency-resolver contracts to leaf components --- .bitmap | 28 ++++++ .../component/component-dependencies.ts | 32 ++++++ .../component/component/component-factory.ts | 8 +- .../component/component.main.runtime.ts | 20 +++- scopes/component/component/component.ts | 7 +- scopes/component/component/index.ts | 7 +- scopes/component/component/show/show.cmd.ts | 2 +- .../dependency-resolver.main.runtime.ts | 2 +- .../dependency-resolver/detector-hook.ts | 56 ++--------- .../policy/env-policy/env-policy.ts | 63 +++--------- .../dependency-resolver/policy/policy.ts | 21 ++-- .../policy/variant-policy/variant-policy.ts | 49 +++------- .../dependency-detector.ts | 51 ++++++++++ .../dependency-resolver-contracts/index.ts | 19 ++++ .../policy-config.ts | 97 +++++++++++++++++++ scopes/envs/envs/env-jsonc.detector.ts | 2 +- scopes/envs/envs/env.plugin.ts | 2 +- scopes/envs/envs/environments.main.runtime.ts | 6 +- scopes/envs/envs/runtime/env-runtime.ts | 4 +- scopes/harmony/api-server/api-for-ide.ts | 2 +- .../aspect-loader/aspect-definition.ts | 54 +---------- .../aspect-loader.main.runtime.ts | 2 +- .../aspect-loader/plugin-definition.ts | 25 +---- .../aspect-definition.ts | 62 ++++++++++++ .../modules/aspect-loader-contracts/index.ts | 3 + .../plugin-definition.ts | 24 +++++ .../circular-deps-check/cycles-baseline.json | 26 +---- 27 files changed, 412 insertions(+), 262 deletions(-) create mode 100644 scopes/component/component/component-dependencies.ts create mode 100644 scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts create mode 100644 scopes/dependencies/modules/dependency-resolver-contracts/index.ts create mode 100644 scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts create mode 100644 scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts create mode 100644 scopes/harmony/modules/aspect-loader-contracts/index.ts create mode 100644 scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts diff --git a/.bitmap b/.bitmap index 11d57bfbbd9a..b23213204dfa 100644 --- a/.bitmap +++ b/.bitmap @@ -1017,6 +1017,20 @@ "mainFile": "index.ts", "rootDir": "scopes/scope/models/scope-model" }, + "modules/aspect-loader-contracts": { + "name": "modules/aspect-loader-contracts", + "scope": "", + "version": "", + "defaultScope": "teambit.harmony", + "mainFile": "index.ts", + "rootDir": "scopes/harmony/modules/aspect-loader-contracts", + "config": { + "teambit.node/envs/node-babel-mocha@2.1.3": {}, + "teambit.envs/envs": { + "env": "teambit.node/envs/node-babel-mocha" + } + } + }, "modules/babel-compiler": { "name": "modules/babel-compiler", "scope": "teambit.compilation", @@ -1066,6 +1080,20 @@ "mainFile": "index.ts", "rootDir": "scopes/lanes/modules/create-lane" }, + "modules/dependency-resolver-contracts": { + "name": "modules/dependency-resolver-contracts", + "scope": "", + "version": "", + "defaultScope": "teambit.dependencies", + "mainFile": "index.ts", + "rootDir": "scopes/dependencies/modules/dependency-resolver-contracts", + "config": { + "teambit.node/envs/node-babel-mocha@2.1.3": {}, + "teambit.envs/envs": { + "env": "teambit.node/envs/node-babel-mocha" + } + } + }, "modules/diff": { "name": "modules/diff", "scope": "teambit.lanes", diff --git a/scopes/component/component/component-dependencies.ts b/scopes/component/component/component-dependencies.ts new file mode 100644 index 000000000000..d0d5dd6212e8 --- /dev/null +++ b/scopes/component/component/component-dependencies.ts @@ -0,0 +1,32 @@ +/** + * a dependency of a component, as the dependency-resolver resolves it (its `Dependency`). + * defined here so the component aspect doesn't depend on the dependency-resolver aspect. + */ +export type ComponentDependencyEntry = { + id: string; + version: string; + type: string; + lifecycle: string; + source?: string; + hidden?: boolean; + optional?: boolean; + getPackageName?: () => string; +}; + +export type ComponentDependenciesManifest = { + dependencies: Record; + optionalDependencies: Record; + devDependencies: Record; + peerDependencies: Record; +}; + +/** + * the dependencies of a component, as the dependency-resolver resolves them (its `DependencyList`). + * defined here so the component aspect doesn't depend on the dependency-resolver aspect. + */ +export interface ComponentDependencyList { + readonly dependencies: ComponentDependencyEntry[]; + forEach(predicate: (dep: ComponentDependencyEntry, index?: number) => void): void; + map(predicate: (dep: ComponentDependencyEntry, index?: number) => any): any[]; + toDependenciesManifest(): ComponentDependenciesManifest; +} diff --git a/scopes/component/component/component-factory.ts b/scopes/component/component/component-factory.ts index 3bc604fe249e..055726a6f9c6 100644 --- a/scopes/component/component/component-factory.ts +++ b/scopes/component/component/component-factory.ts @@ -3,8 +3,8 @@ import type { BitId } from '@teambit/legacy-bit-id'; import type { ComponentID } from '@teambit/component-id'; import type { ConsumerComponent } from '@teambit/legacy.consumer-component'; import type { ComponentLog } from '@teambit/objects'; -import type { AspectDefinition } from '@teambit/aspect-loader'; -import type { DependencyList } from '@teambit/dependency-resolver'; +import type { AspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; +import type { ComponentDependencyList } from './component-dependencies'; import type { Component, InvalidComponent } from './component'; import type { State } from './state'; import type { Snap } from './snap'; @@ -145,7 +145,7 @@ export interface ComponentFactory { getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise; - getDependencies(component: Component): DependencyList; + getDependencies(component: Component): ComponentDependencyList; componentPackageName(component: Component): string; @@ -172,7 +172,7 @@ export interface ComponentFactory { runtimeName?: string, componentIds?: ComponentID[], opts?: ResolveAspectsOptions - ) => Promise; + ) => Promise[]>; /** * list all components in the host. diff --git a/scopes/component/component/component.main.runtime.ts b/scopes/component/component/component.main.runtime.ts index 631b5ad3a2bb..38bfaf9911b2 100644 --- a/scopes/component/component/component.main.runtime.ts +++ b/scopes/component/component/component.main.runtime.ts @@ -11,7 +11,6 @@ import type { ComponentID } from '@teambit/component-id'; import { flatten, orderBy } from 'lodash'; import type { LoggerMain } from '@teambit/logger'; import { LoggerAspect } from '@teambit/logger'; -import type { DependencyResolverMain } from '@teambit/dependency-resolver'; import type { ExtensionDataList } from '@teambit/legacy.extension-data'; import type { ComponentFactory } from './component-factory'; import { ComponentAspect } from './component.aspect'; @@ -37,8 +36,13 @@ export type ComponentHostSlot = SlotRegistry; export type ShowFragmentSlot = SlotRegistry; +/** + * fetches the manifest of a package from the registry (implemented by the dependency-resolver). + */ +export type PackageManifestFetcher = { fetchFullPackageManifest: (packageName: string) => Promise }; + export class ComponentMain { - dependencyResolver: DependencyResolverMain; + private packageManifestFetcher?: PackageManifestFetcher; constructor( /** * slot for component hosts to register. @@ -152,6 +156,18 @@ export class ComponentMain { /** * register a show fragment to display further information in the `bit show` command. */ + /** + * lets the commands of this aspect fetch package manifests, e.g. `bit show `. + */ + registerPackageManifestFetcher(packageManifestFetcher: PackageManifestFetcher) { + this.packageManifestFetcher = packageManifestFetcher; + } + + getPackageManifestFetcher(): PackageManifestFetcher { + if (!this.packageManifestFetcher) throw new Error('no package-manifest fetcher was registered'); + return this.packageManifestFetcher; + } + registerShowFragments(showFragments: ShowFragment[]) { this.showFragmentSlot.register(showFragments); return this; diff --git a/scopes/component/component/component.ts b/scopes/component/component/component.ts index 38a6bd4d4cb4..b81dcffde87c 100644 --- a/scopes/component/component/component.ts +++ b/scopes/component/component/component.ts @@ -5,9 +5,9 @@ import type { ComponentID } from '@teambit/component-id'; import { BitError } from '@teambit/bit-error'; import type { BuildStatus } from '@teambit/legacy.constants'; import type { ComponentLog } from '@teambit/objects'; -import type { DependencyList } from '@teambit/dependency-resolver'; import { slice } from 'lodash'; import type { ComponentFactory } from './component-factory'; +import type { ComponentDependencyList } from './component-dependencies'; import type ComponentFS from './component-fs'; // import { NothingToSnap } from './exceptions'; import type { Config as ComponentConfig } from './config'; @@ -150,7 +150,10 @@ export class Component implements IComponent { return filteredLogs; } - getDependencies(): DependencyList { + /** + * @deprecated use `DependencyResolverMain.getDependencies(component)`, which returns the full `DependencyList`. + */ + getDependencies(): ComponentDependencyList { return this.factory.getDependencies(this); } diff --git a/scopes/component/component/index.ts b/scopes/component/component/index.ts index 239b398a430d..054fac77f588 100644 --- a/scopes/component/component/index.ts +++ b/scopes/component/component/index.ts @@ -30,7 +30,12 @@ export { State } from './state'; export type { Hash } from './hash'; export { TagMap } from './tag-map'; export { ComponentMap } from './component-map'; -export type { ComponentMain } from './component.main.runtime'; +export type { ComponentMain, PackageManifestFetcher } from './component.main.runtime'; +export type { + ComponentDependencyList, + ComponentDependencyEntry, + ComponentDependenciesManifest, +} from './component-dependencies'; export type { ComponentUI } from './component.ui.runtime'; export type { Section } from './section'; export { ComponentContext, ComponentDescriptorContext, useComponentDescriptor } from './ui/context/component-context'; diff --git a/scopes/component/component/show/show.cmd.ts b/scopes/component/component/show/show.cmd.ts index 99c000ad6fdb..e0d3f42efdbe 100644 --- a/scopes/component/component/show/show.cmd.ts +++ b/scopes/component/component/show/show.cmd.ts @@ -64,7 +64,7 @@ to see the legacy bit show, please use "--legacy" flag`); private async resolveIdWithoutWorkspace(id: string): Promise { if (isLikelyPackageName(id)) { try { - const compId = await resolveComponentIdFromPackageName(id, this.component.dependencyResolver); + const compId = await resolveComponentIdFromPackageName(id, this.component.getPackageManifestFetcher()); return compId.toString(); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); diff --git a/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts b/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts index 1988e1bd2abb..9e375953083d 100644 --- a/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts +++ b/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts @@ -1975,7 +1975,7 @@ as an alternative, you can use "+" to keep the same version installed in the wor new DevDependenciesFragment(dependencyResolver), new PeerDependenciesFragment(dependencyResolver), ]); - componentAspect.dependencyResolver = dependencyResolver; + componentAspect.registerPackageManifestFetcher(dependencyResolver); // TODO: solve this generics issue and remove the ts-ignore // @ts-ignore dependencyResolver.registerDependencyFactories([new ComponentDependencyFactory(componentAspect)]); diff --git a/scopes/dependencies/dependency-resolver/detector-hook.ts b/scopes/dependencies/dependency-resolver/detector-hook.ts index 5b5e66dcbf90..cdf35e9f6ae4 100644 --- a/scopes/dependencies/dependency-resolver/detector-hook.ts +++ b/scopes/dependencies/dependency-resolver/detector-hook.ts @@ -1,54 +1,10 @@ -export type FileContext = { - /** - * extension of the file. (e.g. `.js`, '.jsx', '.ts', etc.) - */ - ext: string; +import type { DependencyDetector } from '@teambit/dependencies.modules.dependency-resolver-contracts'; - filename: string; -}; - -export type DependencyContext = { - /** - * name of the dependency. - * e.g. `lodash` in `import _ from 'lodash'` - */ - dependency: string; - - /** - * name of the file. - */ - filename: string; - - /** - * directory of the file. - */ - directory: string; -}; - -export interface DependencyDetector { - /** - * determine whether to apply on given file. - */ - isSupported(context: FileContext): boolean; - - /** - * determine what type of content the detector is for. - * by default, the type is the extension name of the file (without the dot) - * if no type provided. - */ - type?: string; - - /** - * detect file dependencies. list of file dependencies of the module. - */ - detect(fileContent: string): string[]; - - /** - * resolve the imported file location - * @param file - */ - dependencyLookup?(file: DependencyContext): string; -} +export type { + FileContext, + DependencyContext, + DependencyDetector, +} from '@teambit/dependencies.modules.dependency-resolver-contracts'; export class DetectorHook { static hooks: DependencyDetector[] = []; diff --git a/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts b/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts index 4bf047e775a6..2bdf372912e1 100644 --- a/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts +++ b/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts @@ -6,54 +6,23 @@ import type { } from '../variant-policy'; import { createVariantPolicyEntry, VariantPolicy } from '../variant-policy'; import type { DependencyLifecycleType } from '../../dependencies'; +import type { + EnvJsoncPolicyEntry, + EnvJsoncPolicyPeerEntry, + VersionKeyName, + EnvJsoncPolicyConfigKey, + EnvPolicyConfigObject, +} from '@teambit/dependencies.modules.dependency-resolver-contracts'; -export type EnvJsoncPolicyEntry = { - name: string; - version: string; - /** - * hide the dependency from the component's package.json / dependencies list - */ - hidden?: boolean; - /** - * force add to component dependencies even if it's not used by the component. - */ - force?: boolean; - optional?: boolean; -}; - -export type EnvJsoncPolicyPeerEntry = EnvJsoncPolicyEntry & { - supportedRange: string; - /** - * When true, this peer dependency will be resolved as a single version at the workspace root, - * even if different envs specify different versions. Useful for @types packages and workspace-level - * tools (eslint, prettier) that must resolve from the workspace root. - * When false (default), conflicts are resolved per-component via env roots. - */ - workspaceSingleton?: boolean; - /** - * When true, generates a pnpm override for this peer using its version, - * forcing all transitive dependencies to use the same version. - * Useful to prevent old versions from being pulled by published packages. - */ - override?: boolean; -}; - -export type VersionKeyName = 'version' | 'supportedRange'; - -export type EnvJsoncPolicyConfigKey = 'peers' | 'dev' | 'runtime'; - -export type EnvPolicyEnvJsoncConfigObject = { - peers?: EnvJsoncPolicyPeerEntry[]; - dev?: EnvJsoncPolicyEntry[]; - runtime?: EnvJsoncPolicyEntry[]; -}; - -/** - * Config that is used before the new env.jsonc format was introduced. - */ -export type EnvPolicyLegacyConfigObject = Pick & VariantPolicyConfigObject; - -export type EnvPolicyConfigObject = EnvPolicyEnvJsoncConfigObject | EnvPolicyLegacyConfigObject; +export type { + EnvJsoncPolicyEntry, + EnvJsoncPolicyPeerEntry, + VersionKeyName, + EnvJsoncPolicyConfigKey, + EnvPolicyEnvJsoncConfigObject, + EnvPolicyLegacyConfigObject, + EnvPolicyConfigObject, +} from '@teambit/dependencies.modules.dependency-resolver-contracts'; export class EnvPolicy extends VariantPolicy { constructor( diff --git a/scopes/dependencies/dependency-resolver/policy/policy.ts b/scopes/dependencies/dependency-resolver/policy/policy.ts index 622b5bfb79d7..20ee8d4fa786 100644 --- a/scopes/dependencies/dependency-resolver/policy/policy.ts +++ b/scopes/dependencies/dependency-resolver/policy/policy.ts @@ -1,13 +1,15 @@ import type { DependencyLifecycleType } from '../dependencies'; +import type { SemverVersion } from '@teambit/dependencies.modules.dependency-resolver-contracts'; + +export type { + SemverVersion, + PolicyConfigKeys, + PolicyConfigKeysNames, +} from '@teambit/dependencies.modules.dependency-resolver-contracts'; // TODO: add DetailedDependencyPolicy once support the force prop // export type DependencyPolicy = SemverVersionRule | DetailedDependencyPolicy; -/** - * Allowed values are valid semver values - */ -export type SemverVersion = string; - export type GitUrlVersion = string; export type FileSystemPath = string; @@ -23,15 +25,6 @@ export type PolicySemver = SemverVersion | RemoveDepSign; */ export type PolicyVersion = PolicySemver | GitUrlVersion | FileSystemPath; -// TODO: think if it might need to be in another place and just reference there -export type PolicyConfigKeys = { - dependencies: 'dependencies'; - devDependencies: 'devDependencies'; - peerDependencies: 'peerDependencies'; -}; - -export type PolicyConfigKeysNames = keyof PolicyConfigKeys; - export interface Policy { toConfigObject(): T; } diff --git a/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts b/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts index 716c93dc3f5e..3bdd3a1d81b0 100644 --- a/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts +++ b/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts @@ -2,48 +2,27 @@ import { sha1 } from '@teambit/toolbox.crypto.sha1'; import { compact, sortBy, uniqWith } from 'lodash'; import { snapToSemver } from '@teambit/component-package-version'; import type { DependenciesOverridesData } from '@teambit/legacy.consumer-config'; -import type { Policy, PolicyConfigKeys, PolicyConfigKeysNames, PolicyEntry, SemverVersion } from '../policy'; +import type { + VariantPolicyConfigObject, + VariantPolicyConfigEntryValue, + VariantPolicyEntryVersion, + VariantPolicyEntryValue, + VariantPolicyLifecycleConfigEntryObject, +} from '@teambit/dependencies.modules.dependency-resolver-contracts'; +import type { Policy, PolicyConfigKeysNames, PolicyEntry } from '../policy'; import type { DependencyLifecycleType } from '../../dependencies'; import { KEY_NAME_BY_LIFECYCLE_TYPE, LIFECYCLE_TYPE_BY_KEY_NAME } from '../../dependencies'; -export type VariantPolicyConfigObject = Partial>; - -type VariantPolicyLifecycleConfigObject = { - [dependencyId: string]: VariantPolicyConfigEntryValue; -}; - -type VariantPolicyLifecycleConfigEntryObject = { - name: string; - version: string; - /** - * hide the dependency from the component's package.json / dependencies list - */ - hidden?: boolean; - /** - * force add to component dependencies even if it's not used by the component. - */ - force?: boolean; - optional?: boolean; -}; +export type { + VariantPolicyConfigObject, + VariantPolicyConfigEntryValue, + VariantPolicyEntryVersion, + VariantPolicyEntryValue, +} from '@teambit/dependencies.modules.dependency-resolver-contracts'; export type VariantPolicyConfigArr = Partial>; type VariantPolicyConfigObj = Partial>>; -export type VariantPolicyConfigEntryValue = VariantPolicyEntryValue | VariantPolicyEntryVersion; - -/** - * Allowed values are valid semver values, git urls, fs path. - */ -export type VariantPolicyEntryVersion = SemverVersion; - -export type VariantPolicyEntryValue = { - version: VariantPolicyEntryVersion; - resolveFromEnv?: boolean; - optional?: boolean; - workspaceSingleton?: boolean; - override?: boolean; -}; - export type DependencySource = 'auto' | 'env' | 'env-own' | 'slots' | 'config'; export type VariantPolicyEntry = PolicyEntry & { diff --git a/scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts b/scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts new file mode 100644 index 000000000000..39df38fc4231 --- /dev/null +++ b/scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts @@ -0,0 +1,51 @@ +export type FileContext = { + /** + * extension of the file. (e.g. `.js`, '.jsx', '.ts', etc.) + */ + ext: string; + + filename: string; +}; + +export type DependencyContext = { + /** + * name of the dependency. + * e.g. `lodash` in `import _ from 'lodash'` + */ + dependency: string; + + /** + * name of the file. + */ + filename: string; + + /** + * directory of the file. + */ + directory: string; +}; + +export interface DependencyDetector { + /** + * determine whether to apply on given file. + */ + isSupported(context: FileContext): boolean; + + /** + * determine what type of content the detector is for. + * by default, the type is the extension name of the file (without the dot) + * if no type provided. + */ + type?: string; + + /** + * detect file dependencies. list of file dependencies of the module. + */ + detect(fileContent: string): string[]; + + /** + * resolve the imported file location + * @param file + */ + dependencyLookup?(file: DependencyContext): string; +} diff --git a/scopes/dependencies/modules/dependency-resolver-contracts/index.ts b/scopes/dependencies/modules/dependency-resolver-contracts/index.ts new file mode 100644 index 000000000000..02dcabc773d7 --- /dev/null +++ b/scopes/dependencies/modules/dependency-resolver-contracts/index.ts @@ -0,0 +1,19 @@ +export type { FileContext, DependencyContext, DependencyDetector } from './dependency-detector'; +export type { + SemverVersion, + PolicyConfigKeys, + PolicyConfigKeysNames, + VariantPolicyConfigObject, + VariantPolicyLifecycleConfigObject, + VariantPolicyLifecycleConfigEntryObject, + VariantPolicyConfigEntryValue, + VariantPolicyEntryVersion, + VariantPolicyEntryValue, + EnvJsoncPolicyEntry, + EnvJsoncPolicyPeerEntry, + VersionKeyName, + EnvJsoncPolicyConfigKey, + EnvPolicyEnvJsoncConfigObject, + EnvPolicyLegacyConfigObject, + EnvPolicyConfigObject, +} from './policy-config'; diff --git a/scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts b/scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts new file mode 100644 index 000000000000..ed412c37969e --- /dev/null +++ b/scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts @@ -0,0 +1,97 @@ +// the shape of the dependency policies in the config files (workspace.jsonc variants, env.jsonc). + +/** + * Allowed values are valid semver values + */ +export type SemverVersion = string; + +export type PolicyConfigKeys = { + dependencies: 'dependencies'; + devDependencies: 'devDependencies'; + peerDependencies: 'peerDependencies'; +}; + +export type PolicyConfigKeysNames = keyof PolicyConfigKeys; + +export type VariantPolicyConfigObject = Partial>; + +export type VariantPolicyLifecycleConfigObject = { + [dependencyId: string]: VariantPolicyConfigEntryValue; +}; + +export type VariantPolicyLifecycleConfigEntryObject = { + name: string; + version: string; + /** + * hide the dependency from the component's package.json / dependencies list + */ + hidden?: boolean; + /** + * force add to component dependencies even if it's not used by the component. + */ + force?: boolean; + optional?: boolean; +}; + +export type VariantPolicyConfigEntryValue = VariantPolicyEntryValue | VariantPolicyEntryVersion; + +/** + * Allowed values are valid semver values, git urls, fs path. + */ +export type VariantPolicyEntryVersion = SemverVersion; + +export type VariantPolicyEntryValue = { + version: VariantPolicyEntryVersion; + resolveFromEnv?: boolean; + optional?: boolean; + workspaceSingleton?: boolean; + override?: boolean; +}; + +export type EnvJsoncPolicyEntry = { + name: string; + version: string; + /** + * hide the dependency from the component's package.json / dependencies list + */ + hidden?: boolean; + /** + * force add to component dependencies even if it's not used by the component. + */ + force?: boolean; + optional?: boolean; +}; + +export type EnvJsoncPolicyPeerEntry = EnvJsoncPolicyEntry & { + supportedRange: string; + /** + * When true, this peer dependency will be resolved as a single version at the workspace root, + * even if different envs specify different versions. Useful for @types packages and workspace-level + * tools (eslint, prettier) that must resolve from the workspace root. + * When false (default), conflicts are resolved per-component via env roots. + */ + workspaceSingleton?: boolean; + /** + * When true, generates a pnpm override for this peer using its version, + * forcing all transitive dependencies to use the same version. + * Useful to prevent old versions from being pulled by published packages. + */ + override?: boolean; +}; + +export type VersionKeyName = 'version' | 'supportedRange'; + +export type EnvJsoncPolicyConfigKey = 'peers' | 'dev' | 'runtime'; + +export type EnvPolicyEnvJsoncConfigObject = { + peers?: EnvJsoncPolicyPeerEntry[]; + dev?: EnvJsoncPolicyEntry[]; + runtime?: EnvJsoncPolicyEntry[]; +}; + +/** + * Config that is used before the new env.jsonc format was introduced. + */ +export type EnvPolicyLegacyConfigObject = Pick & VariantPolicyConfigObject; + +export type EnvPolicyConfigObject = EnvPolicyEnvJsoncConfigObject | EnvPolicyLegacyConfigObject; diff --git a/scopes/envs/envs/env-jsonc.detector.ts b/scopes/envs/envs/env-jsonc.detector.ts index 706e0c101966..cbe529456e53 100644 --- a/scopes/envs/envs/env-jsonc.detector.ts +++ b/scopes/envs/envs/env-jsonc.detector.ts @@ -1,5 +1,5 @@ import { parse } from 'comment-json'; -import type { DependencyDetector, FileContext } from '@teambit/dependency-resolver'; +import type { DependencyDetector, FileContext } from '@teambit/dependencies.modules.dependency-resolver-contracts'; export class EnvJsoncDetector implements DependencyDetector { isSupported(context: FileContext): boolean { diff --git a/scopes/envs/envs/env.plugin.ts b/scopes/envs/envs/env.plugin.ts index 5a38dbd43e49..3e695ec0a81f 100644 --- a/scopes/envs/envs/env.plugin.ts +++ b/scopes/envs/envs/env.plugin.ts @@ -1,4 +1,4 @@ -import type { PluginDefinition } from '@teambit/aspect-loader'; +import type { PluginDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; import type { Harmony } from '@teambit/harmony'; import { ComponentID } from '@teambit/component'; import type { WorkerMain } from '@teambit/worker'; diff --git a/scopes/envs/envs/environments.main.runtime.ts b/scopes/envs/envs/environments.main.runtime.ts index e120db2d3c8c..756c68955de9 100644 --- a/scopes/envs/envs/environments.main.runtime.ts +++ b/scopes/envs/envs/environments.main.runtime.ts @@ -7,7 +7,7 @@ import { MainRuntime } from '@teambit/harmony.modules.runtimes'; import { CLIAspect } from '@teambit/cli'; import type { Component, ComponentMain, RegularCompDescriptor } from '@teambit/component'; import { ComponentAspect } from '@teambit/component'; -import type { EnvPolicyConfigObject } from '@teambit/dependency-resolver'; +import type { EnvPolicyConfigObject } from '@teambit/dependencies.modules.dependency-resolver-contracts'; import type { GraphqlMain } from '@teambit/graphql'; import { GraphqlAspect } from '@teambit/graphql'; import type { IssuesMain } from '@teambit/issues'; @@ -18,7 +18,7 @@ import type { Harmony, SlotRegistry } from '@teambit/harmony'; import { Slot } from '@teambit/harmony'; import type { Logger, LoggerMain } from '@teambit/logger'; import { LoggerAspect } from '@teambit/logger'; -import type { AspectDefinition } from '@teambit/aspect-loader'; +import type { AspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; import type { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy.extension-data'; import { BitError } from '@teambit/bit-error'; import { findDuplications } from '@teambit/toolbox.array.duplications-finder'; @@ -1243,7 +1243,7 @@ if needed, use "bit env set" command to align the env id`; ); } - private async getEnvAspectDef(envId: string): Promise { + private async getEnvAspectDef(envId: string): Promise> { const host = this.componentMain.getHost(); const id = await host.resolveComponentId(envId); // We don't want to filter by runtime here as we want to also get envs that configured as plugins. so they don't diff --git a/scopes/envs/envs/runtime/env-runtime.ts b/scopes/envs/envs/runtime/env-runtime.ts index f49c501f0666..86bc9f15faf4 100644 --- a/scopes/envs/envs/runtime/env-runtime.ts +++ b/scopes/envs/envs/runtime/env-runtime.ts @@ -1,4 +1,4 @@ -import type { AspectDefinition } from '@teambit/aspect-loader'; +import type { AspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; import type { Component } from '@teambit/component'; import type { Environment } from '../environment'; @@ -26,6 +26,6 @@ export class EnvRuntime { /** * Aspect definition of the env. */ - readonly envAspectDefinition: AspectDefinition + readonly envAspectDefinition: AspectDefinition ) {} } diff --git a/scopes/harmony/api-server/api-for-ide.ts b/scopes/harmony/api-server/api-for-ide.ts index 347eb6894cb3..2e010a88f7db 100644 --- a/scopes/harmony/api-server/api-for-ide.ts +++ b/scopes/harmony/api-server/api-for-ide.ts @@ -750,7 +750,7 @@ export class APIForIDE { }) ); - const deps = comp.getDependencies(); + const deps = this.snapping.dependencyResolver.getDependencies(comp); showResults.dependencies = deps.map((dep) => { const pkg = dep.getPackageName?.() || dep.id; const pkgWithVer = `${pkg}@${dep.version}`; diff --git a/scopes/harmony/aspect-loader/aspect-definition.ts b/scopes/harmony/aspect-loader/aspect-definition.ts index 8253095e5c87..cab16903bf36 100644 --- a/scopes/harmony/aspect-loader/aspect-definition.ts +++ b/scopes/harmony/aspect-loader/aspect-definition.ts @@ -1,51 +1,7 @@ import type { Component } from '@teambit/component'; +import { AspectDefinition as GenericAspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; +import type { AspectDefinitionProps as GenericAspectDefinitionProps } from '@teambit/harmony.modules.aspect-loader-contracts'; -export type AspectDefinitionProps = { - id?: string; - component?: Component; - aspectPath: string; - runtimePath: string | null; - aspectFilePath: string | null; - local?: boolean; -}; - -export class AspectDefinition { - constructor( - /** - * path to the root directory of the aspect module. - */ - readonly aspectPath: string, - - /** - * path to the aspect file (.aspect). - */ - readonly aspectFilePath: string | null, - - /** - * path to the runtime entry - */ - readonly runtimePath: string | null, - /** - * aspect component - */ - readonly component?: Component, - /** - * id of the component (used instead of component in the case of core aspect) - */ - readonly id?: string, - /** - * aspect defined using 'file://' protocol - */ - readonly local?: boolean - ) {} - - get getId() { - if (this.component) return this.component.id.toString(); - if (this.id) return this.id; - return null; - } - - static from({ component, aspectPath, aspectFilePath, runtimePath, id, local }: AspectDefinitionProps) { - return new AspectDefinition(aspectPath, aspectFilePath, runtimePath, component, id, local); - } -} +export const AspectDefinition = GenericAspectDefinition; +export type AspectDefinition = GenericAspectDefinition; +export type AspectDefinitionProps = GenericAspectDefinitionProps; diff --git a/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts b/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts index 4ce7c40b8455..3261dc128980 100644 --- a/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts +++ b/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts @@ -863,7 +863,7 @@ export class AspectLoaderMain { const runtimeManifest = srcRuntimeManifest ? join(dir, 'dist', srcRuntimeManifest) : null; const aspectId = aspectFilePath ? this.getAspectIdFromAspectFile(aspectFilePath) : undefined; - return new AspectDefinition(dir, aspectFilePath, runtimeManifest, undefined, aspectId, true); + return new AspectDefinition(dir, aspectFilePath, runtimeManifest, undefined, aspectId, true); }); } diff --git a/scopes/harmony/aspect-loader/plugin-definition.ts b/scopes/harmony/aspect-loader/plugin-definition.ts index f8e1fe5038cc..8e8e3cabfbd6 100644 --- a/scopes/harmony/aspect-loader/plugin-definition.ts +++ b/scopes/harmony/aspect-loader/plugin-definition.ts @@ -1,24 +1 @@ -import type { Aspect } from '@teambit/harmony'; - -export interface PluginDefinition { - /** - * regex pattern for detecting the definition file within a component. - */ - pattern: string | RegExp; - - /** - * runtimes for the plugin to apply. - */ - runtimes: string[]; - - /** - * register the plugin to its slot registry. - */ - - /** - * Plugin implementation. - * @param object The object that was exported as default by the *.plugin-pattern file. - * @param sourceAspect Pointer to the aspect that is using the plugin (the aspect that contain the *.plugin-pattern file). - */ - register(object: T, sourceAspect: Aspect): void; -} +export type { PluginDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; diff --git a/scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts b/scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts new file mode 100644 index 000000000000..3eee5ac9b58c --- /dev/null +++ b/scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts @@ -0,0 +1,62 @@ +/** + * the component an aspect definition may hold. generic, so this module doesn't depend on the component aspect + * (`@teambit/aspect-loader` exports it bound to its `Component`). + */ +export type AspectDefinitionComponent = { id: { toString(): string } }; + +export type AspectDefinitionProps = { + id?: string; + component?: C; + aspectPath: string; + runtimePath: string | null; + aspectFilePath: string | null; + local?: boolean; +}; + +export class AspectDefinition { + constructor( + /** + * path to the root directory of the aspect module. + */ + readonly aspectPath: string, + + /** + * path to the aspect file (.aspect). + */ + readonly aspectFilePath: string | null, + + /** + * path to the runtime entry + */ + readonly runtimePath: string | null, + /** + * aspect component + */ + readonly component?: C, + /** + * id of the component (used instead of component in the case of core aspect) + */ + readonly id?: string, + /** + * aspect defined using 'file://' protocol + */ + readonly local?: boolean + ) {} + + get getId() { + if (this.component) return this.component.id.toString(); + if (this.id) return this.id; + return null; + } + + static from({ + component, + aspectPath, + aspectFilePath, + runtimePath, + id, + local, + }: AspectDefinitionProps) { + return new AspectDefinition(aspectPath, aspectFilePath, runtimePath, component, id, local); + } +} diff --git a/scopes/harmony/modules/aspect-loader-contracts/index.ts b/scopes/harmony/modules/aspect-loader-contracts/index.ts new file mode 100644 index 000000000000..519e7fb9e0ad --- /dev/null +++ b/scopes/harmony/modules/aspect-loader-contracts/index.ts @@ -0,0 +1,3 @@ +export { AspectDefinition } from './aspect-definition'; +export type { AspectDefinitionProps, AspectDefinitionComponent } from './aspect-definition'; +export type { PluginDefinition } from './plugin-definition'; diff --git a/scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts b/scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts new file mode 100644 index 000000000000..f8e1fe5038cc --- /dev/null +++ b/scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts @@ -0,0 +1,24 @@ +import type { Aspect } from '@teambit/harmony'; + +export interface PluginDefinition { + /** + * regex pattern for detecting the definition file within a component. + */ + pattern: string | RegExp; + + /** + * runtimes for the plugin to apply. + */ + runtimes: string[]; + + /** + * register the plugin to its slot registry. + */ + + /** + * Plugin implementation. + * @param object The object that was exported as default by the *.plugin-pattern file. + * @param sourceAspect Pointer to the aspect that is using the plugin (the aspect that contain the *.plugin-pattern file). + */ + register(object: T, sourceAspect: Aspect): void; +} diff --git a/scripts/circular-deps-check/cycles-baseline.json b/scripts/circular-deps-check/cycles-baseline.json index a41e55004b96..fc072ffc8d9b 100644 --- a/scripts/circular-deps-check/cycles-baseline.json +++ b/scripts/circular-deps-check/cycles-baseline.json @@ -2,11 +2,10 @@ "summary": { "groups": [ 27, - 16, - 5 + 16 ], - "components": 48, - "edges": 168 + "components": 43, + "edges": 156 }, "groups": [ [ @@ -55,13 +54,6 @@ "teambit.scope/remote-actions", "teambit.scope/remotes", "teambit.semantics/doc-parser" - ], - [ - "teambit.component/component", - "teambit.component/issues", - "teambit.dependencies/dependency-resolver", - "teambit.envs/envs", - "teambit.harmony/aspect-loader" ] ], "edges": [ @@ -74,8 +66,6 @@ "teambit.compilation/compiler -> teambit.ui-foundation/ui", "teambit.compilation/compiler -> teambit.workspace/watcher", "teambit.compilation/compiler -> teambit.workspace/workspace", - "teambit.component/component -> teambit.dependencies/dependency-resolver", - "teambit.component/component -> teambit.harmony/aspect-loader", "teambit.component/component-compare -> teambit.component/dev-files", "teambit.component/component-compare -> teambit.pipelines/builder", "teambit.component/component-compare -> teambit.scope/importer", @@ -92,7 +82,6 @@ "teambit.component/dev-files -> teambit.workspace/workspace", "teambit.component/graph -> teambit.component/component-compare", "teambit.component/isolator -> teambit.component/graph", - "teambit.component/issues -> teambit.component/component", "teambit.component/lister -> teambit.workspace/workspace", "teambit.component/mover -> teambit.workspace/workspace", "teambit.component/new-component-helper -> teambit.component/tracker", @@ -103,13 +92,6 @@ "teambit.component/sources -> teambit.legacy/scope", "teambit.component/sources -> teambit.pkg/modules/component-package-name", "teambit.component/tracker -> teambit.workspace/workspace", - "teambit.dependencies/dependency-resolver -> teambit.component/component", - "teambit.dependencies/dependency-resolver -> teambit.envs/envs", - "teambit.dependencies/dependency-resolver -> teambit.harmony/aspect-loader", - "teambit.envs/envs -> teambit.component/component", - "teambit.envs/envs -> teambit.component/issues", - "teambit.envs/envs -> teambit.dependencies/dependency-resolver", - "teambit.envs/envs -> teambit.harmony/aspect-loader", "teambit.explorer/command-bar -> teambit.ui-foundation/ui", "teambit.generator/generator -> teambit.component/new-component-helper", "teambit.generator/generator -> teambit.component/tracker", @@ -123,8 +105,6 @@ "teambit.harmony/application -> teambit.scope/scope", "teambit.harmony/application -> teambit.workspace/watcher", "teambit.harmony/application -> teambit.workspace/workspace", - "teambit.harmony/aspect-loader -> teambit.component/component", - "teambit.harmony/aspect-loader -> teambit.envs/envs", "teambit.harmony/ipc-events -> teambit.scope/scope", "teambit.legacy/bit-map -> teambit.legacy/consumer-component", "teambit.legacy/bit-map -> teambit.legacy/extension-data", From 6fa4cbf8c25666a3a617c541e1a54363d270c9fe Mon Sep 17 00:00:00 2001 From: David First Date: Fri, 9 Oct 2026 13:11:43 -0400 Subject: [PATCH 2/6] chore: update lockfile for the new contracts components --- pnpm-lock.yaml | 193 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 184 insertions(+), 9 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 007ab352107a..0883666c6e01 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6854,7 +6854,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@5.2.1)(react@19.2.7)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -7026,6 +7026,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -7134,6 +7137,9 @@ importers: '@teambit/harmony.envs.core-aspect-env': specifier: 2.1.2 version: 2.1.2(@babel/core@7.28.3)(@babel/traverse@7.29.8)(eslint@8.56.0)(react-refresh@0.10.0)(react-test-renderer@19.2.7)(rollup@2.80.0)(sass-embedded@1.102.0)(supports-color@9.4.0)(webpack@5.109.2) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -7931,7 +7937,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@4.3.0)(react@19.2.7)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -8103,6 +8109,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -8211,6 +8220,9 @@ importers: '@teambit/harmony.envs.core-react-env': specifier: 1.0.2 version: 1.0.2(@babel/core@7.28.3)(@babel/traverse@7.29.8)(@parcel/css@1.14.0)(@swc/css@0.0.20)(@types/webpack@5.28.5)(babel-plugin-macros@3.1.0)(browserslist@4.23.3)(bufferutil@4.0.3)(clean-css@5.3.3)(cssnano@6.1.2)(csso@5.0.5)(debug@4.3.4)(esbuild@0.14.29)(eslint@8.56.0)(html-minifier-terser@6.1.0)(less@4.9.0)(lightningcss@1.33.0)(postcss@8.4.45)(react-refresh@0.10.0)(rollup@2.80.0)(sass-embedded@1.102.0)(supports-color@9.4.0)(type-fest@0.21.3)(uglify-js@3.19.3)(utf-8-validate@5.0.5)(webpack-dev-server@4.15.2)(webpack-hot-middleware@2.26.1)(webpack@5.109.2) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -8990,7 +9002,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@18.3.1)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@4.3.0)(react@18.3.1)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -9162,6 +9174,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@18.3.1)(supports-color@9.4.0) @@ -9270,6 +9285,9 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@18.3.1) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -10061,7 +10079,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@4.3.0)(react@19.2.7)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -10233,6 +10251,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -10338,6 +10359,9 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -11108,7 +11132,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@4.3.0)(react@19.2.7)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -11280,6 +11304,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -11385,6 +11412,9 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -12155,7 +12185,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@4.3.0)(react@19.2.7)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -12327,6 +12357,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -12432,6 +12465,9 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -13214,7 +13250,7 @@ importers: version: file:components/ui/queries/get-file-content(@apollo/client@3.12.11)(@testing-library/dom@10.4.1) '@teambit/command-bar': specifier: workspace:* - version: file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0) + version: file:scopes/explorer/command-bar(chai@4.3.0)(react@19.2.7)(supports-color@9.4.0) '@teambit/community': specifier: workspace:* version: file:scopes/community/community @@ -13386,6 +13422,9 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': + specifier: workspace:* + version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -13491,6 +13530,9 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) + '@teambit/harmony.modules.aspect-loader-contracts': + specifier: workspace:* + version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -18497,6 +18539,34 @@ importers: specifier: 9.1.0 version: 9.1.0 + scopes/dependencies/modules/dependency-resolver-contracts: + dependencies: + '@types/node': + specifier: 22.10.5 + version: 22.10.5 + '@types/react': + specifier: ^19.0.0 + version: 19.2.18 + '@types/react-dom': + specifier: ^19.0.0 + version: 19.2.4(@types/react@19.2.18) + react: + specifier: 19.2.7 + version: 19.2.7 + react-dom: + specifier: 19.2.7 + version: 19.2.7(react@19.2.7) + react-router-dom: + specifier: ^6.30.1 + version: 6.30.4(react-dom@19.2.7)(react@19.2.7) + devDependencies: + '@teambit/node.envs.node-babel-mocha': + specifier: 2.1.3 + version: 2.1.3(@babel/core@7.28.3)(supports-color@9.4.0) + '@types/mocha': + specifier: 9.1.0 + version: 9.1.0 + scopes/dependencies/pnpm: dependencies: '@pnpm/deps.path': @@ -19011,6 +19081,9 @@ importers: '@types/react-dom': specifier: ^19.0.0 version: 19.2.4(@types/react@19.2.18) + chai: + specifier: 5.2.1 + version: 5.2.1 classnames: specifier: ^2.5.1 version: 2.5.1 @@ -20760,6 +20833,37 @@ importers: specifier: ^1.1.5 version: 1.1.5 + scopes/harmony/modules/aspect-loader-contracts: + dependencies: + '@teambit/harmony': + specifier: 0.4.12 + version: 0.4.12 + '@types/node': + specifier: 22.10.5 + version: 22.10.5 + '@types/react': + specifier: ^19.0.0 + version: 19.2.18 + '@types/react-dom': + specifier: ^19.0.0 + version: 19.2.4(@types/react@19.2.18) + react: + specifier: 19.2.7 + version: 19.2.7 + react-dom: + specifier: 19.2.7 + version: 19.2.7(react@19.2.7) + react-router-dom: + specifier: ^6.30.1 + version: 6.30.4(react-dom@19.2.7)(react@19.2.7) + devDependencies: + '@teambit/node.envs.node-babel-mocha': + specifier: 2.1.3 + version: 2.1.3(@babel/core@7.28.3)(supports-color@9.4.0) + '@types/mocha': + specifier: 9.1.0 + version: 9.1.0 + scopes/harmony/modules/concurrency: dependencies: '@types/node': @@ -31430,6 +31534,7 @@ packages: '@teambit/command-bar@file:scopes/explorer/command-bar': resolution: {directory: scopes/explorer/command-bar, type: directory} peerDependencies: + chai: 5.2.1 react: 19.2.7 '@teambit/community.constants.links@0.0.2': @@ -32371,6 +32476,9 @@ packages: '@teambit/dependencies.fs.linked-dependencies@file:scopes/dependencies/fs/linked-dependencies': resolution: {directory: scopes/dependencies/fs/linked-dependencies, type: directory} + '@teambit/dependencies.modules.dependency-resolver-contracts@file:scopes/dependencies/modules/dependency-resolver-contracts': + resolution: {directory: scopes/dependencies/modules/dependency-resolver-contracts, type: directory} + '@teambit/dependencies.modules.packages-excluder@1.0.8': resolution: {integrity: sha512-PsA3S56Zw6mMKuUm+RkQ5HzxrgEC0XzBSlICjgejpjXqSA8eKFn4IJfhPCpH4KPeaCMvWIkaRoJ5FZZMDYSJqw==} engines: {node: '>=12.22.0'} @@ -33715,6 +33823,9 @@ packages: '@teambit/harmony.envs.core-react-env@1.0.2': resolution: {integrity: sha512-eNA/p8hiJePQOOEVmpqPharIsEQZZWaHXIEr1Z6GzjgkL6/4k4L23Pfq7q6J90TLOiP3hgRYgvVtTJKYzHV2lg==} + '@teambit/harmony.modules.aspect-loader-contracts@file:scopes/harmony/modules/aspect-loader-contracts': + resolution: {directory: scopes/harmony/modules/aspect-loader-contracts, type: directory} + '@teambit/harmony.modules.concurrency@0.0.12': resolution: {integrity: sha512-j8u/QH0wyXpoEvpATqspcBcf1wbJ70PR82c7Na/ZbOu8+9w2tQIHl+ME7kozcDMX2wSG3cM9TjhJcWS+goRxMg==} engines: {node: '>=16.0.0'} @@ -54321,6 +54432,7 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.load-trace': file:scopes/harmony/modules/load-trace '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes @@ -54353,6 +54465,7 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.load-trace': file:scopes/harmony/modules/load-trace '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes @@ -54385,6 +54498,7 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.load-trace': file:scopes/harmony/modules/load-trace '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes @@ -58850,7 +58964,7 @@ snapshots: - graphql - supports-color - '@teambit/command-bar@file:scopes/explorer/command-bar(react@18.3.1)(supports-color@9.4.0)': + '@teambit/command-bar@file:scopes/explorer/command-bar(chai@4.3.0)(react@18.3.1)(supports-color@9.4.0)': dependencies: '@teambit/base-ui.text.muted-text': 1.0.3(react-dom@19.2.7)(react@18.3.1) '@teambit/bit-error': 0.0.404 @@ -58865,6 +58979,7 @@ snapshots: '@types/node': 22.10.5 '@types/react': 19.2.18 '@types/react-dom': 19.2.4(@types/react@19.2.18) + chai: 4.3.0 classnames: 2.5.1 is-primitive: 3.0.1 lodash.flatten: 4.4.0 @@ -58875,7 +58990,33 @@ snapshots: transitivePeerDependencies: - supports-color - '@teambit/command-bar@file:scopes/explorer/command-bar(react@19.2.7)(supports-color@9.4.0)': + '@teambit/command-bar@file:scopes/explorer/command-bar(chai@4.3.0)(react@19.2.7)(supports-color@9.4.0)': + dependencies: + '@teambit/base-ui.text.muted-text': 1.0.3(react-dom@19.2.7)(react@19.2.7) + '@teambit/bit-error': 0.0.404 + '@teambit/design.buttons.action-button': 0.0.4(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react@19.2.7)(supports-color@9.4.0) + '@teambit/design.ui.styles.ellipsis': 0.0.357(react-dom@19.2.7)(react@19.2.7) + '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@19.2.7) + '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes + '@teambit/ui-foundation.ui.is-browser': 0.0.500(react-dom@19.2.7)(react@19.2.7) + '@teambit/ui-foundation.ui.keycap': 0.0.500(react-dom@19.2.7)(react@19.2.7) + '@testing-library/react': 14.3.1(@types/react@19.2.18)(react-dom@19.2.7)(react@19.2.7) + '@types/node': 22.10.5 + '@types/react': 19.2.18 + '@types/react-dom': 19.2.4(@types/react@19.2.18) + chai: 4.3.0 + classnames: 2.5.1 + is-primitive: 3.0.1 + lodash.flatten: 4.4.0 + mousetrap: 1.6.5 + react: 19.2.7 + react-dom: 19.2.7(react@19.2.7) + react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) + transitivePeerDependencies: + - supports-color + + '@teambit/command-bar@file:scopes/explorer/command-bar(chai@5.2.1)(react@19.2.7)(supports-color@9.4.0)': dependencies: '@teambit/base-ui.text.muted-text': 1.0.3(react-dom@19.2.7)(react@19.2.7) '@teambit/bit-error': 0.0.404 @@ -58890,6 +59031,7 @@ snapshots: '@types/node': 22.10.5 '@types/react': 19.2.18 '@types/react-dom': 19.2.4(@types/react@19.2.18) + chai: 5.2.1 classnames: 2.5.1 is-primitive: 3.0.1 lodash.flatten: 4.4.0 @@ -62073,6 +62215,7 @@ snapshots: '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@18.3.1) '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.ui.aspect-box': file:scopes/harmony/ui/aspect-box(@testing-library/dom@10.4.1)(react@18.3.1) '@teambit/lanes.hooks.use-lanes': file:components/hooks/use-lanes(@apollo/client@3.12.11)(@teambit/base-react.navigation.link@2.0.33)(@testing-library/dom@10.4.1)(react@18.3.1) @@ -62162,6 +62305,7 @@ snapshots: '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@19.2.7) '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.ui.aspect-box': file:scopes/harmony/ui/aspect-box(@testing-library/dom@10.4.1)(react@19.2.7) '@teambit/lanes.hooks.use-lanes': file:components/hooks/use-lanes(@apollo/client@3.12.11)(@teambit/base-react.navigation.link@2.0.33)(@testing-library/dom@10.4.1)(react@19.2.7) @@ -62251,6 +62395,7 @@ snapshots: '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@19.2.7) '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.ui.aspect-box': file:scopes/harmony/ui/aspect-box(@testing-library/dom@10.4.1)(react@19.2.7) '@teambit/lanes.hooks.use-lanes': file:components/hooks/use-lanes(@apollo/client@3.12.11)(@teambit/base-react.navigation.link@2.0.33)(@testing-library/dom@10.4.1)(react@19.2.7) @@ -63491,6 +63636,15 @@ snapshots: react-dom: 19.2.7(react@19.2.7) react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) + '@teambit/dependencies.modules.dependency-resolver-contracts@file:scopes/dependencies/modules/dependency-resolver-contracts': + dependencies: + '@types/node': 22.10.5 + '@types/react': 19.2.18 + '@types/react-dom': 19.2.4(@types/react@19.2.18) + react: 19.2.7 + react-dom: 19.2.7(react@19.2.7) + react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) + '@teambit/dependencies.modules.packages-excluder@1.0.8(react@18.3.1)': dependencies: react: 18.3.1 @@ -64000,6 +64154,7 @@ snapshots: '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/dependencies.aspect-docs.dependency-resolver': file:scopes/dependencies/aspect-docs/dependency-resolver(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@18.3.1) '@teambit/dependencies.fs.linked-dependencies': file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/harmony': 0.4.12 '@teambit/harmony.modules.feature-toggle': file:scopes/harmony/modules/feature-toggle '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component @@ -64062,6 +64217,7 @@ snapshots: '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/dependencies.aspect-docs.dependency-resolver': file:scopes/dependencies/aspect-docs/dependency-resolver(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/dependencies.fs.linked-dependencies': file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/harmony': 0.4.12 '@teambit/harmony.modules.feature-toggle': file:scopes/harmony/modules/feature-toggle '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component @@ -64124,6 +64280,7 @@ snapshots: '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/dependencies.aspect-docs.dependency-resolver': file:scopes/dependencies/aspect-docs/dependency-resolver(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/dependencies.fs.linked-dependencies': file:scopes/dependencies/fs/linked-dependencies + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/harmony': 0.4.12 '@teambit/harmony.modules.feature-toggle': file:scopes/harmony/modules/feature-toggle '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component @@ -68780,8 +68937,10 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -68863,8 +69022,10 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@18.3.1) '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -68946,8 +69107,10 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -69029,8 +69192,10 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) + '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/harmony': 0.4.12 + '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -70633,6 +70798,16 @@ snapshots: - webpack-hot-middleware - webpack-plugin-serve + '@teambit/harmony.modules.aspect-loader-contracts@file:scopes/harmony/modules/aspect-loader-contracts': + dependencies: + '@teambit/harmony': 0.4.12 + '@types/node': 22.10.5 + '@types/react': 19.2.18 + '@types/react-dom': 19.2.4(@types/react@19.2.18) + react: 19.2.7 + react-dom: 19.2.7(react@19.2.7) + react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) + '@teambit/harmony.modules.concurrency@0.0.12': dependencies: '@teambit/legacy.constants': 0.0.11 From 778ff9af25a9d0aadb70430a9d001cadaa0ec077 Mon Sep 17 00:00:00 2001 From: David First Date: Fri, 9 Oct 2026 13:12:20 -0400 Subject: [PATCH 3/6] docs(component): restore registerShowFragments doc comment --- scopes/component/component/component.main.runtime.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scopes/component/component/component.main.runtime.ts b/scopes/component/component/component.main.runtime.ts index 38bfaf9911b2..c2d5d876d9c1 100644 --- a/scopes/component/component/component.main.runtime.ts +++ b/scopes/component/component/component.main.runtime.ts @@ -153,9 +153,6 @@ export class ComponentMain { return !!this.hostSlot.get(name); } - /** - * register a show fragment to display further information in the `bit show` command. - */ /** * lets the commands of this aspect fetch package manifests, e.g. `bit show `. */ @@ -168,6 +165,9 @@ export class ComponentMain { return this.packageManifestFetcher; } + /** + * register a show fragment to display further information in the `bit show` command. + */ registerShowFragments(showFragments: ShowFragment[]) { this.showFragmentSlot.register(showFragments); return this; From 0235ac6b0efb42a86ef213bd0ca253eed81a5589 Mon Sep 17 00:00:00 2001 From: David First Date: Fri, 9 Oct 2026 13:38:24 -0400 Subject: [PATCH 4/6] refactor: host contracts in existing aspects instead of new leaf components --- .bitmap | 28 ---- .../modules/component-package-name/index.ts | 1 + .../package-name-to-component-id.ts | 4 +- pnpm-lock.yaml | 143 ------------------ .../component}/aspect-definition.ts | 23 +-- .../component/component/component-factory.ts | 4 +- .../component/component.main.runtime.ts | 2 +- scopes/component/component/index.ts | 10 +- .../dependencies/dependency.ts | 6 +- .../dependency-resolver/detector-hook.ts | 56 ++++++- .../policy/env-policy/env-policy.ts | 4 +- .../dependency-resolver/policy/policy.ts | 8 +- .../policy/variant-policy/variant-policy.ts | 4 +- .../dependency-detector.ts | 51 ------- .../dependency-resolver-contracts/index.ts | 19 --- scopes/envs/envs/env-jsonc.detector.ts | 8 +- .../envs/env-policy-config.ts} | 18 +-- scopes/envs/envs/env.plugin.ts | 3 +- scopes/envs/envs/environments.main.runtime.ts | 7 +- scopes/envs/envs/index.ts | 17 +++ scopes/envs/envs/runtime/env-runtime.ts | 5 +- scopes/harmony/api-server/api-for-ide.ts | 2 +- .../aspect-loader/aspect-definition.ts | 9 +- .../aspect-loader.main.runtime.ts | 2 +- .../aspect-loader/plugin-definition.ts | 25 ++- .../modules/aspect-loader-contracts/index.ts | 3 - .../plugin-definition.ts | 24 --- 27 files changed, 134 insertions(+), 352 deletions(-) rename scopes/{harmony/modules/aspect-loader-contracts => component/component}/aspect-definition.ts (58%) delete mode 100644 scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts delete mode 100644 scopes/dependencies/modules/dependency-resolver-contracts/index.ts rename scopes/{dependencies/modules/dependency-resolver-contracts/policy-config.ts => envs/envs/env-policy-config.ts} (86%) delete mode 100644 scopes/harmony/modules/aspect-loader-contracts/index.ts delete mode 100644 scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts diff --git a/.bitmap b/.bitmap index b23213204dfa..11d57bfbbd9a 100644 --- a/.bitmap +++ b/.bitmap @@ -1017,20 +1017,6 @@ "mainFile": "index.ts", "rootDir": "scopes/scope/models/scope-model" }, - "modules/aspect-loader-contracts": { - "name": "modules/aspect-loader-contracts", - "scope": "", - "version": "", - "defaultScope": "teambit.harmony", - "mainFile": "index.ts", - "rootDir": "scopes/harmony/modules/aspect-loader-contracts", - "config": { - "teambit.node/envs/node-babel-mocha@2.1.3": {}, - "teambit.envs/envs": { - "env": "teambit.node/envs/node-babel-mocha" - } - } - }, "modules/babel-compiler": { "name": "modules/babel-compiler", "scope": "teambit.compilation", @@ -1080,20 +1066,6 @@ "mainFile": "index.ts", "rootDir": "scopes/lanes/modules/create-lane" }, - "modules/dependency-resolver-contracts": { - "name": "modules/dependency-resolver-contracts", - "scope": "", - "version": "", - "defaultScope": "teambit.dependencies", - "mainFile": "index.ts", - "rootDir": "scopes/dependencies/modules/dependency-resolver-contracts", - "config": { - "teambit.node/envs/node-babel-mocha@2.1.3": {}, - "teambit.envs/envs": { - "env": "teambit.node/envs/node-babel-mocha" - } - } - }, "modules/diff": { "name": "modules/diff", "scope": "teambit.lanes", diff --git a/components/modules/component-package-name/index.ts b/components/modules/component-package-name/index.ts index 0d210131a8ac..f09b8505256d 100644 --- a/components/modules/component-package-name/index.ts +++ b/components/modules/component-package-name/index.ts @@ -1,3 +1,4 @@ export { componentIdToPackageName } from './component-id-to-package-name'; export { getNodeModulesPathOfComponent } from './component-node-modules-path'; export { resolveComponentIdFromPackageName, isLikelyPackageName } from './package-name-to-component-id'; +export type { PackageManifestFetcher } from './package-name-to-component-id'; diff --git a/components/modules/component-package-name/package-name-to-component-id.ts b/components/modules/component-package-name/package-name-to-component-id.ts index 7c7ae71226fd..28c523987141 100644 --- a/components/modules/component-package-name/package-name-to-component-id.ts +++ b/components/modules/component-package-name/package-name-to-component-id.ts @@ -2,6 +2,8 @@ import type { ComponentIdObj } from '@teambit/component-id'; import { ComponentID } from '@teambit/component-id'; import { BitError } from '@teambit/bit-error'; +export type PackageManifestFetcher = { fetchFullPackageManifest: (packageName: string) => Promise }; + /** * Utility function to check if a string looks like a package name vs component ID * @param id - The string to check @@ -23,7 +25,7 @@ export function isLikelyPackageName(id: string): boolean { */ export async function resolveComponentIdFromPackageName( packageName: string, - dependencyResolver: { fetchFullPackageManifest: (name: string) => Promise } + dependencyResolver: PackageManifestFetcher ): Promise { if (!packageName.startsWith('@')) { throw new BitError( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0883666c6e01..07d15fc131c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7026,9 +7026,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -7137,9 +7134,6 @@ importers: '@teambit/harmony.envs.core-aspect-env': specifier: 2.1.2 version: 2.1.2(@babel/core@7.28.3)(@babel/traverse@7.29.8)(eslint@8.56.0)(react-refresh@0.10.0)(react-test-renderer@19.2.7)(rollup@2.80.0)(sass-embedded@1.102.0)(supports-color@9.4.0)(webpack@5.109.2) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -8109,9 +8103,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -8220,9 +8211,6 @@ importers: '@teambit/harmony.envs.core-react-env': specifier: 1.0.2 version: 1.0.2(@babel/core@7.28.3)(@babel/traverse@7.29.8)(@parcel/css@1.14.0)(@swc/css@0.0.20)(@types/webpack@5.28.5)(babel-plugin-macros@3.1.0)(browserslist@4.23.3)(bufferutil@4.0.3)(clean-css@5.3.3)(cssnano@6.1.2)(csso@5.0.5)(debug@4.3.4)(esbuild@0.14.29)(eslint@8.56.0)(html-minifier-terser@6.1.0)(less@4.9.0)(lightningcss@1.33.0)(postcss@8.4.45)(react-refresh@0.10.0)(rollup@2.80.0)(sass-embedded@1.102.0)(supports-color@9.4.0)(type-fest@0.21.3)(uglify-js@3.19.3)(utf-8-validate@5.0.5)(webpack-dev-server@4.15.2)(webpack-hot-middleware@2.26.1)(webpack@5.109.2) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -9174,9 +9162,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@18.3.1)(supports-color@9.4.0) @@ -9285,9 +9270,6 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@18.3.1) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -10251,9 +10233,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -10359,9 +10338,6 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -11304,9 +11280,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -11412,9 +11385,6 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -12357,9 +12327,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -12465,9 +12432,6 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -13422,9 +13386,6 @@ importers: '@teambit/dependencies.fs.linked-dependencies': specifier: workspace:* version: file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': - specifier: workspace:* - version: file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/dependencies.ui.deps-diff-table': specifier: workspace:* version: file:components/ui/deps-diff-table(@testing-library/dom@10.4.1)(react@19.2.7)(supports-color@9.4.0) @@ -13530,9 +13491,6 @@ importers: '@teambit/harmony.content.cli-reference': specifier: workspace:* version: file:scopes/harmony/cli-reference(react@19.2.7) - '@teambit/harmony.modules.aspect-loader-contracts': - specifier: workspace:* - version: file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.concurrency': specifier: workspace:* version: file:scopes/harmony/modules/concurrency @@ -18539,34 +18497,6 @@ importers: specifier: 9.1.0 version: 9.1.0 - scopes/dependencies/modules/dependency-resolver-contracts: - dependencies: - '@types/node': - specifier: 22.10.5 - version: 22.10.5 - '@types/react': - specifier: ^19.0.0 - version: 19.2.18 - '@types/react-dom': - specifier: ^19.0.0 - version: 19.2.4(@types/react@19.2.18) - react: - specifier: 19.2.7 - version: 19.2.7 - react-dom: - specifier: 19.2.7 - version: 19.2.7(react@19.2.7) - react-router-dom: - specifier: ^6.30.1 - version: 6.30.4(react-dom@19.2.7)(react@19.2.7) - devDependencies: - '@teambit/node.envs.node-babel-mocha': - specifier: 2.1.3 - version: 2.1.3(@babel/core@7.28.3)(supports-color@9.4.0) - '@types/mocha': - specifier: 9.1.0 - version: 9.1.0 - scopes/dependencies/pnpm: dependencies: '@pnpm/deps.path': @@ -20833,37 +20763,6 @@ importers: specifier: ^1.1.5 version: 1.1.5 - scopes/harmony/modules/aspect-loader-contracts: - dependencies: - '@teambit/harmony': - specifier: 0.4.12 - version: 0.4.12 - '@types/node': - specifier: 22.10.5 - version: 22.10.5 - '@types/react': - specifier: ^19.0.0 - version: 19.2.18 - '@types/react-dom': - specifier: ^19.0.0 - version: 19.2.4(@types/react@19.2.18) - react: - specifier: 19.2.7 - version: 19.2.7 - react-dom: - specifier: 19.2.7 - version: 19.2.7(react@19.2.7) - react-router-dom: - specifier: ^6.30.1 - version: 6.30.4(react-dom@19.2.7)(react@19.2.7) - devDependencies: - '@teambit/node.envs.node-babel-mocha': - specifier: 2.1.3 - version: 2.1.3(@babel/core@7.28.3)(supports-color@9.4.0) - '@types/mocha': - specifier: 9.1.0 - version: 9.1.0 - scopes/harmony/modules/concurrency: dependencies: '@types/node': @@ -32476,9 +32375,6 @@ packages: '@teambit/dependencies.fs.linked-dependencies@file:scopes/dependencies/fs/linked-dependencies': resolution: {directory: scopes/dependencies/fs/linked-dependencies, type: directory} - '@teambit/dependencies.modules.dependency-resolver-contracts@file:scopes/dependencies/modules/dependency-resolver-contracts': - resolution: {directory: scopes/dependencies/modules/dependency-resolver-contracts, type: directory} - '@teambit/dependencies.modules.packages-excluder@1.0.8': resolution: {integrity: sha512-PsA3S56Zw6mMKuUm+RkQ5HzxrgEC0XzBSlICjgejpjXqSA8eKFn4IJfhPCpH4KPeaCMvWIkaRoJ5FZZMDYSJqw==} engines: {node: '>=12.22.0'} @@ -33823,9 +33719,6 @@ packages: '@teambit/harmony.envs.core-react-env@1.0.2': resolution: {integrity: sha512-eNA/p8hiJePQOOEVmpqPharIsEQZZWaHXIEr1Z6GzjgkL6/4k4L23Pfq7q6J90TLOiP3hgRYgvVtTJKYzHV2lg==} - '@teambit/harmony.modules.aspect-loader-contracts@file:scopes/harmony/modules/aspect-loader-contracts': - resolution: {directory: scopes/harmony/modules/aspect-loader-contracts, type: directory} - '@teambit/harmony.modules.concurrency@0.0.12': resolution: {integrity: sha512-j8u/QH0wyXpoEvpATqspcBcf1wbJ70PR82c7Na/ZbOu8+9w2tQIHl+ME7kozcDMX2wSG3cM9TjhJcWS+goRxMg==} engines: {node: '>=16.0.0'} @@ -54432,7 +54325,6 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.load-trace': file:scopes/harmony/modules/load-trace '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes @@ -54465,7 +54357,6 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.load-trace': file:scopes/harmony/modules/load-trace '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes @@ -54498,7 +54389,6 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.load-trace': file:scopes/harmony/modules/load-trace '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes @@ -62215,7 +62105,6 @@ snapshots: '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@18.3.1) '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.ui.aspect-box': file:scopes/harmony/ui/aspect-box(@testing-library/dom@10.4.1)(react@18.3.1) '@teambit/lanes.hooks.use-lanes': file:components/hooks/use-lanes(@apollo/client@3.12.11)(@teambit/base-react.navigation.link@2.0.33)(@testing-library/dom@10.4.1)(react@18.3.1) @@ -62305,7 +62194,6 @@ snapshots: '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@19.2.7) '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.ui.aspect-box': file:scopes/harmony/ui/aspect-box(@testing-library/dom@10.4.1)(react@19.2.7) '@teambit/lanes.hooks.use-lanes': file:components/hooks/use-lanes(@apollo/client@3.12.11)(@teambit/base-react.navigation.link@2.0.33)(@testing-library/dom@10.4.1)(react@19.2.7) @@ -62395,7 +62283,6 @@ snapshots: '@teambit/explorer.ui.command-bar': 2.0.19(@testing-library/react@14.3.1)(@types/react@19.2.18)(react-dom@19.2.7)(react-router-dom@6.30.4)(react@19.2.7) '@teambit/graph.cleargraph': 0.0.11 '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.ui.aspect-box': file:scopes/harmony/ui/aspect-box(@testing-library/dom@10.4.1)(react@19.2.7) '@teambit/lanes.hooks.use-lanes': file:components/hooks/use-lanes(@apollo/client@3.12.11)(@teambit/base-react.navigation.link@2.0.33)(@testing-library/dom@10.4.1)(react@19.2.7) @@ -63636,15 +63523,6 @@ snapshots: react-dom: 19.2.7(react@19.2.7) react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) - '@teambit/dependencies.modules.dependency-resolver-contracts@file:scopes/dependencies/modules/dependency-resolver-contracts': - dependencies: - '@types/node': 22.10.5 - '@types/react': 19.2.18 - '@types/react-dom': 19.2.4(@types/react@19.2.18) - react: 19.2.7 - react-dom: 19.2.7(react@19.2.7) - react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) - '@teambit/dependencies.modules.packages-excluder@1.0.8(react@18.3.1)': dependencies: react: 18.3.1 @@ -64154,7 +64032,6 @@ snapshots: '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/dependencies.aspect-docs.dependency-resolver': file:scopes/dependencies/aspect-docs/dependency-resolver(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@18.3.1) '@teambit/dependencies.fs.linked-dependencies': file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/harmony': 0.4.12 '@teambit/harmony.modules.feature-toggle': file:scopes/harmony/modules/feature-toggle '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component @@ -64217,7 +64094,6 @@ snapshots: '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/dependencies.aspect-docs.dependency-resolver': file:scopes/dependencies/aspect-docs/dependency-resolver(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/dependencies.fs.linked-dependencies': file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/harmony': 0.4.12 '@teambit/harmony.modules.feature-toggle': file:scopes/harmony/modules/feature-toggle '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component @@ -64280,7 +64156,6 @@ snapshots: '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/dependencies.aspect-docs.dependency-resolver': file:scopes/dependencies/aspect-docs/dependency-resolver(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/dependencies.fs.linked-dependencies': file:scopes/dependencies/fs/linked-dependencies - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/harmony': 0.4.12 '@teambit/harmony.modules.feature-toggle': file:scopes/harmony/modules/feature-toggle '@teambit/harmony.modules.requireable-component': file:scopes/harmony/modules/requireable-component @@ -68937,10 +68812,8 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -69022,10 +68895,8 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@18.3.1) '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -69107,10 +68978,8 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -69192,10 +69061,8 @@ snapshots: '@teambit/component-id': 1.2.5 '@teambit/component-issues': file:components/component-issues '@teambit/component.sources': file:scopes/component/sources(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) - '@teambit/dependencies.modules.dependency-resolver-contracts': file:scopes/dependencies/modules/dependency-resolver-contracts '@teambit/envs.aspect-docs.envs': file:scopes/envs/aspect-docs/envs(@teambit/documenter.theme.theme-compositions@4.1.5)(@teambit/mdx.ui.mdx-layout@1.0.14)(react@19.2.7) '@teambit/harmony': 0.4.12 - '@teambit/harmony.modules.aspect-loader-contracts': file:scopes/harmony/modules/aspect-loader-contracts '@teambit/harmony.modules.runtimes': file:scopes/harmony/modules/runtimes '@teambit/harmony.testing.load-aspect': file:scopes/harmony/testing/load-aspect(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) '@teambit/legacy.consumer-component': file:components/legacy/consumer-component(domexception@4.0.0)(graphql@15.8.0)(supports-color@9.4.0) @@ -70798,16 +70665,6 @@ snapshots: - webpack-hot-middleware - webpack-plugin-serve - '@teambit/harmony.modules.aspect-loader-contracts@file:scopes/harmony/modules/aspect-loader-contracts': - dependencies: - '@teambit/harmony': 0.4.12 - '@types/node': 22.10.5 - '@types/react': 19.2.18 - '@types/react-dom': 19.2.4(@types/react@19.2.18) - react: 19.2.7 - react-dom: 19.2.7(react@19.2.7) - react-router-dom: 6.30.4(react-dom@19.2.7)(react@19.2.7) - '@teambit/harmony.modules.concurrency@0.0.12': dependencies: '@teambit/legacy.constants': 0.0.11 diff --git a/scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts b/scopes/component/component/aspect-definition.ts similarity index 58% rename from scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts rename to scopes/component/component/aspect-definition.ts index 3eee5ac9b58c..4fe22166dec6 100644 --- a/scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts +++ b/scopes/component/component/aspect-definition.ts @@ -1,19 +1,15 @@ -/** - * the component an aspect definition may hold. generic, so this module doesn't depend on the component aspect - * (`@teambit/aspect-loader` exports it bound to its `Component`). - */ -export type AspectDefinitionComponent = { id: { toString(): string } }; +import type { Component } from './component'; -export type AspectDefinitionProps = { +export type AspectDefinitionProps = { id?: string; - component?: C; + component?: Component; aspectPath: string; runtimePath: string | null; aspectFilePath: string | null; local?: boolean; }; -export class AspectDefinition { +export class AspectDefinition { constructor( /** * path to the root directory of the aspect module. @@ -32,7 +28,7 @@ export class AspectDefinition({ - component, - aspectPath, - aspectFilePath, - runtimePath, - id, - local, - }: AspectDefinitionProps) { + static from({ component, aspectPath, aspectFilePath, runtimePath, id, local }: AspectDefinitionProps) { return new AspectDefinition(aspectPath, aspectFilePath, runtimePath, component, id, local); } } diff --git a/scopes/component/component/component-factory.ts b/scopes/component/component/component-factory.ts index 055726a6f9c6..617aebbb4cb0 100644 --- a/scopes/component/component/component-factory.ts +++ b/scopes/component/component/component-factory.ts @@ -3,7 +3,7 @@ import type { BitId } from '@teambit/legacy-bit-id'; import type { ComponentID } from '@teambit/component-id'; import type { ConsumerComponent } from '@teambit/legacy.consumer-component'; import type { ComponentLog } from '@teambit/objects'; -import type { AspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; +import type { AspectDefinition } from './aspect-definition'; import type { ComponentDependencyList } from './component-dependencies'; import type { Component, InvalidComponent } from './component'; import type { State } from './state'; @@ -172,7 +172,7 @@ export interface ComponentFactory { runtimeName?: string, componentIds?: ComponentID[], opts?: ResolveAspectsOptions - ) => Promise[]>; + ) => Promise; /** * list all components in the host. diff --git a/scopes/component/component/component.main.runtime.ts b/scopes/component/component/component.main.runtime.ts index c2d5d876d9c1..8669560cf754 100644 --- a/scopes/component/component/component.main.runtime.ts +++ b/scopes/component/component/component.main.runtime.ts @@ -12,6 +12,7 @@ import { flatten, orderBy } from 'lodash'; import type { LoggerMain } from '@teambit/logger'; import { LoggerAspect } from '@teambit/logger'; import type { ExtensionDataList } from '@teambit/legacy.extension-data'; +import type { PackageManifestFetcher } from '@teambit/pkg.modules.component-package-name'; import type { ComponentFactory } from './component-factory'; import { ComponentAspect } from './component.aspect'; import { componentSchema } from './component.graphql'; @@ -39,7 +40,6 @@ export type ShowFragmentSlot = SlotRegistry; /** * fetches the manifest of a package from the registry (implemented by the dependency-resolver). */ -export type PackageManifestFetcher = { fetchFullPackageManifest: (packageName: string) => Promise }; export class ComponentMain { private packageManifestFetcher?: PackageManifestFetcher; diff --git a/scopes/component/component/index.ts b/scopes/component/component/index.ts index 054fac77f588..5049e44287f7 100644 --- a/scopes/component/component/index.ts +++ b/scopes/component/component/index.ts @@ -30,12 +30,8 @@ export { State } from './state'; export type { Hash } from './hash'; export { TagMap } from './tag-map'; export { ComponentMap } from './component-map'; -export type { ComponentMain, PackageManifestFetcher } from './component.main.runtime'; -export type { - ComponentDependencyList, - ComponentDependencyEntry, - ComponentDependenciesManifest, -} from './component-dependencies'; +export type { ComponentMain } from './component.main.runtime'; +export type { ComponentDependencyList } from './component-dependencies'; export type { ComponentUI } from './component.ui.runtime'; export type { Section } from './section'; export { ComponentContext, ComponentDescriptorContext, useComponentDescriptor } from './ui/context/component-context'; @@ -62,3 +58,5 @@ export { useComponent, useIdFromLocation, useComponentLogs, ComponentLogsResult, // export { AspectEntry } from './aspect-entry'; export { ComponentAspect }; export default ComponentAspect; +export { AspectDefinition } from './aspect-definition'; +export type { AspectDefinitionProps } from './aspect-definition'; diff --git a/scopes/dependencies/dependency-resolver/dependencies/dependency.ts b/scopes/dependencies/dependency-resolver/dependencies/dependency.ts index 42e7381d1332..8600ec678cb1 100644 --- a/scopes/dependencies/dependency-resolver/dependencies/dependency.ts +++ b/scopes/dependencies/dependency-resolver/dependencies/dependency.ts @@ -1,3 +1,4 @@ +import type { SemverVersion } from '@teambit/envs'; import type { DependencySource } from '../policy/variant-policy/variant-policy'; export type WorkspaceDependencyLifecycleType = 'runtime' | 'peer'; @@ -16,10 +17,7 @@ export interface SerializedDependency { packageName?: string; } -/** - * Allowed values are valid semver values and the "-" sign. - */ -export type SemverVersion = string; +export type { SemverVersion }; export type PackageName = string; export type DependencyManifest = { diff --git a/scopes/dependencies/dependency-resolver/detector-hook.ts b/scopes/dependencies/dependency-resolver/detector-hook.ts index cdf35e9f6ae4..5b5e66dcbf90 100644 --- a/scopes/dependencies/dependency-resolver/detector-hook.ts +++ b/scopes/dependencies/dependency-resolver/detector-hook.ts @@ -1,10 +1,54 @@ -import type { DependencyDetector } from '@teambit/dependencies.modules.dependency-resolver-contracts'; +export type FileContext = { + /** + * extension of the file. (e.g. `.js`, '.jsx', '.ts', etc.) + */ + ext: string; -export type { - FileContext, - DependencyContext, - DependencyDetector, -} from '@teambit/dependencies.modules.dependency-resolver-contracts'; + filename: string; +}; + +export type DependencyContext = { + /** + * name of the dependency. + * e.g. `lodash` in `import _ from 'lodash'` + */ + dependency: string; + + /** + * name of the file. + */ + filename: string; + + /** + * directory of the file. + */ + directory: string; +}; + +export interface DependencyDetector { + /** + * determine whether to apply on given file. + */ + isSupported(context: FileContext): boolean; + + /** + * determine what type of content the detector is for. + * by default, the type is the extension name of the file (without the dot) + * if no type provided. + */ + type?: string; + + /** + * detect file dependencies. list of file dependencies of the module. + */ + detect(fileContent: string): string[]; + + /** + * resolve the imported file location + * @param file + */ + dependencyLookup?(file: DependencyContext): string; +} export class DetectorHook { static hooks: DependencyDetector[] = []; diff --git a/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts b/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts index 2bdf372912e1..4f682e5cd2d5 100644 --- a/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts +++ b/scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts @@ -12,7 +12,7 @@ import type { VersionKeyName, EnvJsoncPolicyConfigKey, EnvPolicyConfigObject, -} from '@teambit/dependencies.modules.dependency-resolver-contracts'; +} from '@teambit/envs'; export type { EnvJsoncPolicyEntry, @@ -22,7 +22,7 @@ export type { EnvPolicyEnvJsoncConfigObject, EnvPolicyLegacyConfigObject, EnvPolicyConfigObject, -} from '@teambit/dependencies.modules.dependency-resolver-contracts'; +} from '@teambit/envs'; export class EnvPolicy extends VariantPolicy { constructor( diff --git a/scopes/dependencies/dependency-resolver/policy/policy.ts b/scopes/dependencies/dependency-resolver/policy/policy.ts index 20ee8d4fa786..cdb5640acd40 100644 --- a/scopes/dependencies/dependency-resolver/policy/policy.ts +++ b/scopes/dependencies/dependency-resolver/policy/policy.ts @@ -1,11 +1,7 @@ import type { DependencyLifecycleType } from '../dependencies'; -import type { SemverVersion } from '@teambit/dependencies.modules.dependency-resolver-contracts'; +import type { SemverVersion } from '@teambit/envs'; -export type { - SemverVersion, - PolicyConfigKeys, - PolicyConfigKeysNames, -} from '@teambit/dependencies.modules.dependency-resolver-contracts'; +export type { SemverVersion, PolicyConfigKeys, PolicyConfigKeysNames } from '@teambit/envs'; // TODO: add DetailedDependencyPolicy once support the force prop // export type DependencyPolicy = SemverVersionRule | DetailedDependencyPolicy; diff --git a/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts b/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts index 3bdd3a1d81b0..8ec4f0dfbec0 100644 --- a/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts +++ b/scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts @@ -8,7 +8,7 @@ import type { VariantPolicyEntryVersion, VariantPolicyEntryValue, VariantPolicyLifecycleConfigEntryObject, -} from '@teambit/dependencies.modules.dependency-resolver-contracts'; +} from '@teambit/envs'; import type { Policy, PolicyConfigKeysNames, PolicyEntry } from '../policy'; import type { DependencyLifecycleType } from '../../dependencies'; import { KEY_NAME_BY_LIFECYCLE_TYPE, LIFECYCLE_TYPE_BY_KEY_NAME } from '../../dependencies'; @@ -18,7 +18,7 @@ export type { VariantPolicyConfigEntryValue, VariantPolicyEntryVersion, VariantPolicyEntryValue, -} from '@teambit/dependencies.modules.dependency-resolver-contracts'; +} from '@teambit/envs'; export type VariantPolicyConfigArr = Partial>; type VariantPolicyConfigObj = Partial>>; diff --git a/scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts b/scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts deleted file mode 100644 index 39df38fc4231..000000000000 --- a/scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts +++ /dev/null @@ -1,51 +0,0 @@ -export type FileContext = { - /** - * extension of the file. (e.g. `.js`, '.jsx', '.ts', etc.) - */ - ext: string; - - filename: string; -}; - -export type DependencyContext = { - /** - * name of the dependency. - * e.g. `lodash` in `import _ from 'lodash'` - */ - dependency: string; - - /** - * name of the file. - */ - filename: string; - - /** - * directory of the file. - */ - directory: string; -}; - -export interface DependencyDetector { - /** - * determine whether to apply on given file. - */ - isSupported(context: FileContext): boolean; - - /** - * determine what type of content the detector is for. - * by default, the type is the extension name of the file (without the dot) - * if no type provided. - */ - type?: string; - - /** - * detect file dependencies. list of file dependencies of the module. - */ - detect(fileContent: string): string[]; - - /** - * resolve the imported file location - * @param file - */ - dependencyLookup?(file: DependencyContext): string; -} diff --git a/scopes/dependencies/modules/dependency-resolver-contracts/index.ts b/scopes/dependencies/modules/dependency-resolver-contracts/index.ts deleted file mode 100644 index 02dcabc773d7..000000000000 --- a/scopes/dependencies/modules/dependency-resolver-contracts/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -export type { FileContext, DependencyContext, DependencyDetector } from './dependency-detector'; -export type { - SemverVersion, - PolicyConfigKeys, - PolicyConfigKeysNames, - VariantPolicyConfigObject, - VariantPolicyLifecycleConfigObject, - VariantPolicyLifecycleConfigEntryObject, - VariantPolicyConfigEntryValue, - VariantPolicyEntryVersion, - VariantPolicyEntryValue, - EnvJsoncPolicyEntry, - EnvJsoncPolicyPeerEntry, - VersionKeyName, - EnvJsoncPolicyConfigKey, - EnvPolicyEnvJsoncConfigObject, - EnvPolicyLegacyConfigObject, - EnvPolicyConfigObject, -} from './policy-config'; diff --git a/scopes/envs/envs/env-jsonc.detector.ts b/scopes/envs/envs/env-jsonc.detector.ts index cbe529456e53..218cce703b02 100644 --- a/scopes/envs/envs/env-jsonc.detector.ts +++ b/scopes/envs/envs/env-jsonc.detector.ts @@ -1,8 +1,10 @@ import { parse } from 'comment-json'; -import type { DependencyDetector, FileContext } from '@teambit/dependencies.modules.dependency-resolver-contracts'; -export class EnvJsoncDetector implements DependencyDetector { - isSupported(context: FileContext): boolean { +/** + * a dependency-resolver detector (registered by dependency-resolver) that reports the env an env.jsonc extends. + */ +export class EnvJsoncDetector { + isSupported(context: { filename: string }): boolean { return context.filename.endsWith('env.jsonc'); } diff --git a/scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts b/scopes/envs/envs/env-policy-config.ts similarity index 86% rename from scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts rename to scopes/envs/envs/env-policy-config.ts index ed412c37969e..25f12a3100f6 100644 --- a/scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts +++ b/scopes/envs/envs/env-policy-config.ts @@ -1,7 +1,7 @@ // the shape of the dependency policies in the config files (workspace.jsonc variants, env.jsonc). /** - * Allowed values are valid semver values + * Allowed values are valid semver values and the "-" sign. */ export type SemverVersion = string; @@ -15,7 +15,7 @@ export type PolicyConfigKeysNames = keyof PolicyConfigKeys; export type VariantPolicyConfigObject = Partial>; -export type VariantPolicyLifecycleConfigObject = { +type VariantPolicyLifecycleConfigObject = { [dependencyId: string]: VariantPolicyConfigEntryValue; }; @@ -48,19 +48,7 @@ export type VariantPolicyEntryValue = { override?: boolean; }; -export type EnvJsoncPolicyEntry = { - name: string; - version: string; - /** - * hide the dependency from the component's package.json / dependencies list - */ - hidden?: boolean; - /** - * force add to component dependencies even if it's not used by the component. - */ - force?: boolean; - optional?: boolean; -}; +export type EnvJsoncPolicyEntry = VariantPolicyLifecycleConfigEntryObject; export type EnvJsoncPolicyPeerEntry = EnvJsoncPolicyEntry & { supportedRange: string; diff --git a/scopes/envs/envs/env.plugin.ts b/scopes/envs/envs/env.plugin.ts index 3e695ec0a81f..f6b36cb49719 100644 --- a/scopes/envs/envs/env.plugin.ts +++ b/scopes/envs/envs/env.plugin.ts @@ -1,4 +1,3 @@ -import type { PluginDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; import type { Harmony } from '@teambit/harmony'; import { ComponentID } from '@teambit/component'; import type { WorkerMain } from '@teambit/worker'; @@ -15,7 +14,7 @@ import type { EnvsRegistry, ServicesRegistry } from './environments.main.runtime */ export const BIT_ENV_PATTERN = '*.bit-env.*'; -export class EnvPlugin implements PluginDefinition { +export class EnvPlugin { constructor( private envSlot: EnvsRegistry, private servicesRegistry: ServicesRegistry, diff --git a/scopes/envs/envs/environments.main.runtime.ts b/scopes/envs/envs/environments.main.runtime.ts index 756c68955de9..ed72ab258b46 100644 --- a/scopes/envs/envs/environments.main.runtime.ts +++ b/scopes/envs/envs/environments.main.runtime.ts @@ -5,9 +5,9 @@ import type { SourceFile } from '@teambit/component.sources'; import type { CLIMain } from '@teambit/cli'; import { MainRuntime } from '@teambit/harmony.modules.runtimes'; import { CLIAspect } from '@teambit/cli'; -import type { Component, ComponentMain, RegularCompDescriptor } from '@teambit/component'; +import type { AspectDefinition, Component, ComponentMain, RegularCompDescriptor } from '@teambit/component'; import { ComponentAspect } from '@teambit/component'; -import type { EnvPolicyConfigObject } from '@teambit/dependencies.modules.dependency-resolver-contracts'; +import type { EnvPolicyConfigObject } from './env-policy-config'; import type { GraphqlMain } from '@teambit/graphql'; import { GraphqlAspect } from '@teambit/graphql'; import type { IssuesMain } from '@teambit/issues'; @@ -18,7 +18,6 @@ import type { Harmony, SlotRegistry } from '@teambit/harmony'; import { Slot } from '@teambit/harmony'; import type { Logger, LoggerMain } from '@teambit/logger'; import { LoggerAspect } from '@teambit/logger'; -import type { AspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; import type { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy.extension-data'; import { BitError } from '@teambit/bit-error'; import { findDuplications } from '@teambit/toolbox.array.duplications-finder'; @@ -1243,7 +1242,7 @@ if needed, use "bit env set" command to align the env id`; ); } - private async getEnvAspectDef(envId: string): Promise> { + private async getEnvAspectDef(envId: string): Promise { const host = this.componentMain.getHost(); const id = await host.resolveComponentId(envId); // We don't want to filter by runtime here as we want to also get envs that configured as plugins. so they don't diff --git a/scopes/envs/envs/index.ts b/scopes/envs/envs/index.ts index 35d82c54e5df..763bc9b17948 100644 --- a/scopes/envs/envs/index.ts +++ b/scopes/envs/envs/index.ts @@ -29,3 +29,20 @@ export { EnvsExecutionResult } from './runtime/envs-execution-result'; export type { EnvServiceList } from './env-service-list'; export { EnvDefinition } from './env-definition'; export default EnvsAspect; +export type { + SemverVersion, + PolicyConfigKeys, + PolicyConfigKeysNames, + VariantPolicyConfigObject, + VariantPolicyLifecycleConfigEntryObject, + VariantPolicyConfigEntryValue, + VariantPolicyEntryVersion, + VariantPolicyEntryValue, + EnvJsoncPolicyEntry, + EnvJsoncPolicyPeerEntry, + VersionKeyName, + EnvJsoncPolicyConfigKey, + EnvPolicyEnvJsoncConfigObject, + EnvPolicyLegacyConfigObject, + EnvPolicyConfigObject, +} from './env-policy-config'; diff --git a/scopes/envs/envs/runtime/env-runtime.ts b/scopes/envs/envs/runtime/env-runtime.ts index 86bc9f15faf4..a4d34711ecfb 100644 --- a/scopes/envs/envs/runtime/env-runtime.ts +++ b/scopes/envs/envs/runtime/env-runtime.ts @@ -1,5 +1,4 @@ -import type { AspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; -import type { Component } from '@teambit/component'; +import type { AspectDefinition, Component } from '@teambit/component'; import type { Environment } from '../environment'; @@ -26,6 +25,6 @@ export class EnvRuntime { /** * Aspect definition of the env. */ - readonly envAspectDefinition: AspectDefinition + readonly envAspectDefinition: AspectDefinition ) {} } diff --git a/scopes/harmony/api-server/api-for-ide.ts b/scopes/harmony/api-server/api-for-ide.ts index 2e010a88f7db..8b0ff6ee8bf8 100644 --- a/scopes/harmony/api-server/api-for-ide.ts +++ b/scopes/harmony/api-server/api-for-ide.ts @@ -750,7 +750,7 @@ export class APIForIDE { }) ); - const deps = this.snapping.dependencyResolver.getDependencies(comp); + const deps = this.workspace.getDependencies(comp); showResults.dependencies = deps.map((dep) => { const pkg = dep.getPackageName?.() || dep.id; const pkgWithVer = `${pkg}@${dep.version}`; diff --git a/scopes/harmony/aspect-loader/aspect-definition.ts b/scopes/harmony/aspect-loader/aspect-definition.ts index cab16903bf36..9b1110c8b2d5 100644 --- a/scopes/harmony/aspect-loader/aspect-definition.ts +++ b/scopes/harmony/aspect-loader/aspect-definition.ts @@ -1,7 +1,2 @@ -import type { Component } from '@teambit/component'; -import { AspectDefinition as GenericAspectDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; -import type { AspectDefinitionProps as GenericAspectDefinitionProps } from '@teambit/harmony.modules.aspect-loader-contracts'; - -export const AspectDefinition = GenericAspectDefinition; -export type AspectDefinition = GenericAspectDefinition; -export type AspectDefinitionProps = GenericAspectDefinitionProps; +export { AspectDefinition } from '@teambit/component'; +export type { AspectDefinitionProps } from '@teambit/component'; diff --git a/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts b/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts index 3261dc128980..4ce7c40b8455 100644 --- a/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts +++ b/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts @@ -863,7 +863,7 @@ export class AspectLoaderMain { const runtimeManifest = srcRuntimeManifest ? join(dir, 'dist', srcRuntimeManifest) : null; const aspectId = aspectFilePath ? this.getAspectIdFromAspectFile(aspectFilePath) : undefined; - return new AspectDefinition(dir, aspectFilePath, runtimeManifest, undefined, aspectId, true); + return new AspectDefinition(dir, aspectFilePath, runtimeManifest, undefined, aspectId, true); }); } diff --git a/scopes/harmony/aspect-loader/plugin-definition.ts b/scopes/harmony/aspect-loader/plugin-definition.ts index 8e8e3cabfbd6..f8e1fe5038cc 100644 --- a/scopes/harmony/aspect-loader/plugin-definition.ts +++ b/scopes/harmony/aspect-loader/plugin-definition.ts @@ -1 +1,24 @@ -export type { PluginDefinition } from '@teambit/harmony.modules.aspect-loader-contracts'; +import type { Aspect } from '@teambit/harmony'; + +export interface PluginDefinition { + /** + * regex pattern for detecting the definition file within a component. + */ + pattern: string | RegExp; + + /** + * runtimes for the plugin to apply. + */ + runtimes: string[]; + + /** + * register the plugin to its slot registry. + */ + + /** + * Plugin implementation. + * @param object The object that was exported as default by the *.plugin-pattern file. + * @param sourceAspect Pointer to the aspect that is using the plugin (the aspect that contain the *.plugin-pattern file). + */ + register(object: T, sourceAspect: Aspect): void; +} diff --git a/scopes/harmony/modules/aspect-loader-contracts/index.ts b/scopes/harmony/modules/aspect-loader-contracts/index.ts deleted file mode 100644 index 519e7fb9e0ad..000000000000 --- a/scopes/harmony/modules/aspect-loader-contracts/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { AspectDefinition } from './aspect-definition'; -export type { AspectDefinitionProps, AspectDefinitionComponent } from './aspect-definition'; -export type { PluginDefinition } from './plugin-definition'; diff --git a/scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts b/scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts deleted file mode 100644 index f8e1fe5038cc..000000000000 --- a/scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { Aspect } from '@teambit/harmony'; - -export interface PluginDefinition { - /** - * regex pattern for detecting the definition file within a component. - */ - pattern: string | RegExp; - - /** - * runtimes for the plugin to apply. - */ - runtimes: string[]; - - /** - * register the plugin to its slot registry. - */ - - /** - * Plugin implementation. - * @param object The object that was exported as default by the *.plugin-pattern file. - * @param sourceAspect Pointer to the aspect that is using the plugin (the aspect that contain the *.plugin-pattern file). - */ - register(object: T, sourceAspect: Aspect): void; -} From 52d337a75930415dd846f5f201461c0f056be7d9 Mon Sep 17 00:00:00 2001 From: David First Date: Fri, 9 Oct 2026 14:04:51 -0400 Subject: [PATCH 5/6] fix(component): export AspectDefinition from esm, add peerDependenciesMeta, drop stray doc --- scopes/component/component/component-dependencies.ts | 1 + scopes/component/component/component.main.runtime.ts | 4 ---- scopes/component/component/esm.mjs | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scopes/component/component/component-dependencies.ts b/scopes/component/component/component-dependencies.ts index d0d5dd6212e8..9f02945ec106 100644 --- a/scopes/component/component/component-dependencies.ts +++ b/scopes/component/component/component-dependencies.ts @@ -18,6 +18,7 @@ export type ComponentDependenciesManifest = { optionalDependencies: Record; devDependencies: Record; peerDependencies: Record; + peerDependenciesMeta?: Record; }; /** diff --git a/scopes/component/component/component.main.runtime.ts b/scopes/component/component/component.main.runtime.ts index 8669560cf754..9d4ac4f9fb91 100644 --- a/scopes/component/component/component.main.runtime.ts +++ b/scopes/component/component/component.main.runtime.ts @@ -37,10 +37,6 @@ export type ComponentHostSlot = SlotRegistry; export type ShowFragmentSlot = SlotRegistry; -/** - * fetches the manifest of a package from the registry (implemented by the dependency-resolver). - */ - export class ComponentMain { private packageManifestFetcher?: PackageManifestFetcher; constructor( diff --git a/scopes/component/component/esm.mjs b/scopes/component/component/esm.mjs index 0edda7084f61..585a34d57275 100644 --- a/scopes/component/component/esm.mjs +++ b/scopes/component/component/esm.mjs @@ -7,6 +7,7 @@ export const Component = cjsModule.Component; export const ComponentID = cjsModule.ComponentID; export const ComponentAspect = cjsModule.ComponentAspect; export const AspectEntry = cjsModule.AspectEntry; +export const AspectDefinition = cjsModule.AspectDefinition; export const Snap = cjsModule.Snap; export const Tag = cjsModule.Tag; export const State = cjsModule.State; From 3c77381e6a64c6a1abe2b10fa7937e02ae1efbc9 Mon Sep 17 00:00:00 2001 From: David First Date: Thu, 22 Oct 2026 13:57:49 -0400 Subject: [PATCH 6/6] fix(component): add filter to ComponentDependencyList --- scopes/component/component/component-dependencies.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scopes/component/component/component-dependencies.ts b/scopes/component/component/component-dependencies.ts index 9f02945ec106..0e483159505a 100644 --- a/scopes/component/component/component-dependencies.ts +++ b/scopes/component/component/component-dependencies.ts @@ -28,6 +28,7 @@ export type ComponentDependenciesManifest = { export interface ComponentDependencyList { readonly dependencies: ComponentDependencyEntry[]; forEach(predicate: (dep: ComponentDependencyEntry, index?: number) => void): void; + filter(predicate: (dep: ComponentDependencyEntry, index?: number) => boolean): ComponentDependencyList; map(predicate: (dep: ComponentDependencyEntry, index?: number) => any): any[]; toDependenciesManifest(): ComponentDependenciesManifest; }