@teambit/isolator
Version:
32 lines (31 loc) • 1.97 kB
TypeScript
import type { Component } from '@teambit/component';
import type { DependencyResolverMain } from '@teambit/dependency-resolver';
import { Graph } from '@teambit/graph.cleargraph';
import type { ComponentID } from '@teambit/component-id';
import type { Capsule } from './capsule';
export default class CapsuleList extends Array<Capsule> {
getCapsule(id: ComponentID): Capsule | undefined;
getCapsuleByLegacyId(id: ComponentID): Capsule | undefined;
getCapsuleIgnoreVersion(id: ComponentID): Capsule | undefined;
getAllCapsuleDirs(): string[];
getIdByPathInCapsule(pathInCapsule: string): ComponentID | null;
getAllComponents(): Component[];
getAllComponentIDs(): ComponentID[];
getGraphIds(): Graph<Component, string>;
toposort(depResolver: DependencyResolverMain): Promise<CapsuleList>;
static fromArray(capsules: Capsule[]): CapsuleList;
/**
* determines whether or not a capsule can theoretically use the dists saved in the last snap, rather than re-compile them.
* practically, this optimization is used for components that have typescript as their compiler.
*
* TODO: Consider removing this optimization. It was introduced to avoid TypeScript recompilation of
* unmodified components by downloading their dist artifacts from objects. However, this optimization
* is likely ineffective because:
* 1. TypeScript uses `tsconfig.tsbuildinfo` to determine if recompilation is needed, not just the presence of dists
* 2. `tsconfig.tsbuildinfo` is NOT saved in objects, so TypeScript will recompile anyway
* 3. After PR #9820, unmodified exported dependencies are installed as npm packages (not capsules),
* so this optimization only applies to dependents - which need compilation anyway
* See: CR #1009 (8e0b16fdc), CR #1010 (8e0f866dd), and PR #9820 for historical context.
*/
static capsuleUsePreviouslySavedDists(component: Component): Promise<boolean>;
}