@teambit/workspace 0.0.554 → 0.0.555
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-graph-from-fs.d.ts +30 -0
- package/dist/install.cmd.d.ts +17 -3
- package/dist/install.cmd.js.map +1 -1
- package/dist/link/link.cmd.d.ts +15 -1
- package/dist/types.d.ts +21 -0
- package/dist/ui/workspace/workspace-model.d.ts +32 -1
- package/dist/ui/workspace/workspace-provider.d.ts +9 -0
- package/dist/ui/workspace/workspace.d.ts +3 -0
- package/dist/watch/output-formatter.d.ts +6 -0
- package/dist/watch/watch.cmd.d.ts +22 -1
- package/dist/watch/watcher.d.ts +9 -0
- package/dist/workspace-component/component-status.d.ts +57 -1
- package/dist/workspace-component/workspace-component-loader.d.ts +7 -0
- package/dist/workspace-component/workspace-component.d.ts +36 -1
- package/dist/workspace.d.ts +236 -3
- package/dist/workspace.js +6 -0
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.ui-root.d.ts +18 -1
- package/dist/workspace.ui.runtime.d.ts +32 -1
- package/install.cmd.tsx +2 -2
- package/package-tar/teambit-workspace-0.0.555.tgz +0 -0
- package/package.json +50 -50
- package/tsconfig.json +0 -1
- package/workspace.ts +9 -4
- package/package-tar/teambit-workspace-0.0.554.tgz +0 -0
|
@@ -15,6 +15,36 @@ export declare class GraphFromFsBuilder {
|
|
|
15
15
|
private shouldThrowOnMissingDep;
|
|
16
16
|
private consumer;
|
|
17
17
|
constructor(workspace: Workspace, logger: Logger, ignoreIds?: BitIds, shouldLoadItsDeps?: ShouldIgnoreFunc | undefined);
|
|
18
|
+
/**
|
|
19
|
+
* create a graph with all dependencies and flattened dependencies of the given components.
|
|
20
|
+
* the nodes are components and the edges has a label of the dependency type.
|
|
21
|
+
*
|
|
22
|
+
* the way how it is done is iterations by depths. each depth we gather all the dependencies of
|
|
23
|
+
* that depths, make sure all objects exist and then check their dependencies for the next depth.
|
|
24
|
+
* once there is no dependency left, we're on the last depth level and the graph is ready.
|
|
25
|
+
*
|
|
26
|
+
* for example, imagine the following graph:
|
|
27
|
+
* A1 -> A2 -> A3
|
|
28
|
+
* B1 -> B2 -> B3
|
|
29
|
+
* C1 -> C2 -> C3
|
|
30
|
+
*
|
|
31
|
+
* where the buildGraph is given [A1, B1, C1].
|
|
32
|
+
* first, it saves all these components as nodes in the graph. then, it finds the dependencies of
|
|
33
|
+
* the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects
|
|
34
|
+
* are missing. then, it loads them all (some from FS, some from the model) and sets the edges
|
|
35
|
+
* between the component and the dependencies.
|
|
36
|
+
* once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process
|
|
37
|
+
* above. since there are no more dependencies, the graph is completed.
|
|
38
|
+
* in this case, the total depth levels are 3.
|
|
39
|
+
*
|
|
40
|
+
* even with a huge project, there are not many depth levels. by iterating through depth levels
|
|
41
|
+
* we keep performance sane as the importMany doesn't run multiple time and therefore the round
|
|
42
|
+
* trips to the remotes are minimal.
|
|
43
|
+
*
|
|
44
|
+
* normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.
|
|
45
|
+
* however, since this buildGraph is performed on the workspace, a dependency may be new or
|
|
46
|
+
* modified and as such, we don't know its flattened yet.
|
|
47
|
+
*/
|
|
18
48
|
buildGraph(ids: BitId[]): Promise<LegacyGraph>;
|
|
19
49
|
private getAllDepsUnfiltered;
|
|
20
50
|
private getAllDepsFiltered;
|
package/dist/install.cmd.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import {
|
|
2
|
+
import { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';
|
|
3
3
|
import { Logger } from '@teambit/logger';
|
|
4
4
|
import { Workspace } from './workspace';
|
|
5
5
|
declare type InstallCmdOptions = {
|
|
6
6
|
variants: string;
|
|
7
|
-
type:
|
|
7
|
+
type: WorkspaceDependencyLifecycleType;
|
|
8
8
|
skipDedupe: boolean;
|
|
9
9
|
skipImport: boolean;
|
|
10
10
|
updateExisting: boolean;
|
|
11
11
|
savePrefix: string;
|
|
12
12
|
};
|
|
13
13
|
export default class InstallCmd implements Command {
|
|
14
|
+
/**
|
|
15
|
+
* workspace extension.
|
|
16
|
+
*/
|
|
14
17
|
private workspace;
|
|
18
|
+
/**
|
|
19
|
+
* logger extension.
|
|
20
|
+
*/
|
|
15
21
|
private logger;
|
|
16
22
|
name: string;
|
|
17
23
|
description: string;
|
|
@@ -19,7 +25,15 @@ export default class InstallCmd implements Command {
|
|
|
19
25
|
group: string;
|
|
20
26
|
shortDescription: string;
|
|
21
27
|
options: CommandOptions;
|
|
22
|
-
constructor(
|
|
28
|
+
constructor(
|
|
29
|
+
/**
|
|
30
|
+
* workspace extension.
|
|
31
|
+
*/
|
|
32
|
+
workspace: Workspace,
|
|
33
|
+
/**
|
|
34
|
+
* logger extension.
|
|
35
|
+
*/
|
|
36
|
+
logger: Logger);
|
|
23
37
|
report([packages]: [string[]], options: InstallCmdOptions): Promise<string>;
|
|
24
38
|
}
|
|
25
39
|
export {};
|
package/dist/install.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["install.cmd.tsx"],"names":["InstallCmd","constructor","workspace","logger","report","packages","options","startTime","Date","now","console","chalk","cyan","name","installOpts","variants","lifecycleType","type","dedupe","skipDedupe","import","skipImport","updateExisting","savePrefix","components","install","endTime","executionTime","calculateTime","toArray","length","toString","diff"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAae,MAAMA,UAAN,CAAoC;AAejDC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,SAJC;AAMT;AACJ;AACA;AACYC,EAAAA,MATC,EAUT;AAAA,SANQD,SAMR,GANQA,SAMR;AAAA,SADQC,MACR,GADQA,MACR;AAAA,kDAxBK,uBAwBL;AAAA,yDAvBY,4CAuBZ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Cf,iBAAMC,IAAN,CAC/CY,UAAU,CAACK,OAAX,GAAqBC,MAArB,CAA4BC,QAA5B,EAD+C,CAE/C,oBAAmBpB,iBAAMC,IAAN,CAAWe,aAAa,CAACI,QAAd,EAAX,CAAqC,UAF1D;AAGD;;AA5CgD;;;;AA+CnD,SAASH,aAAT,CAAuBrB,SAAvB,EAA0CmB,OAA1C,EAA2D;AACzD,QAAMM,IAAI,GAAGN,OAAO,GAAGnB,SAAvB;AACA,SAAOyB,IAAI,GAAG,IAAd;AACD","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport {
|
|
1
|
+
{"version":3,"sources":["install.cmd.tsx"],"names":["InstallCmd","constructor","workspace","logger","report","packages","options","startTime","Date","now","console","chalk","cyan","name","installOpts","variants","lifecycleType","type","dedupe","skipDedupe","import","skipImport","updateExisting","savePrefix","components","install","endTime","executionTime","calculateTime","toArray","length","toString","diff"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAae,MAAMA,UAAN,CAAoC;AAejDC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,SAJC;AAMT;AACJ;AACA;AACYC,EAAAA,MATC,EAUT;AAAA,SANQD,SAMR,GANQA,SAMR;AAAA,SADQC,MACR,GADQA,MACR;AAAA,kDAxBK,uBAwBL;AAAA,yDAvBY,4CAuBZ;AAAA,mDAtBM,IAsBN;AAAA,mDArBM,aAqBN;AAAA,8DApBiB,EAoBjB;AAAA,qDAnBQ,CACR,CAAC,GAAD,EAAM,qBAAN,EAA6B,mCAA7B,CADQ,EAER,CAAC,GAAD,EAAM,sBAAN,EAA8B,2CAA9B,CAFQ,EAGR,CAAC,GAAD,EAAM,kCAAN,EAA0C,gDAA1C,CAHQ,EAIR,CAAC,EAAD,EAAK,0BAAL,EAAiC,iEAAjC,CAJQ,EAKR,CAAC,EAAD,EAAK,0BAAL,EAAiC,4CAAjC,CALQ,EAMR,CAAC,EAAD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port { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport chalk from 'chalk';\n\nimport { Workspace, WorkspaceInstallOptions } from './workspace';\n\ntype InstallCmdOptions = {\n variants: string;\n type: WorkspaceDependencyLifecycleType;\n skipDedupe: boolean;\n skipImport: boolean;\n updateExisting: boolean;\n savePrefix: string;\n};\n\nexport default class InstallCmd implements Command {\n name = 'install [packages...]';\n description = 'install development workspace dependencies';\n alias = 'in';\n group = 'development';\n shortDescription = '';\n options = [\n ['v', 'variants <variants>', 'add packages to specific variants'],\n ['t', 'type [lifecycleType]', 'runtime (default), dev or peer dependency'],\n ['u', 'update-existing [updateExisting]', 'update existing dependencies version and types'],\n ['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'],\n ['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'],\n ['', 'skip-import [skipImport]', 'do not import bit objects post installation'],\n ] as CommandOptions;\n\n constructor(\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * logger extension.\n */\n private logger: Logger\n ) {}\n\n async report([packages = []]: [string[]], options: InstallCmdOptions) {\n const startTime = Date.now();\n this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);\n const installOpts: WorkspaceInstallOptions = {\n variants: options.variants,\n lifecycleType: options.type,\n dedupe: !options.skipDedupe,\n import: !options.skipImport,\n updateExisting: options.updateExisting,\n savePrefix: options.savePrefix,\n };\n const components = await this.workspace.install(packages, installOpts);\n const endTime = Date.now();\n const executionTime = calculateTime(startTime, endTime);\n return `Successfully resolved dependencies for ${chalk.cyan(\n components.toArray().length.toString()\n )} component(s) in ${chalk.cyan(executionTime.toString())} seconds`;\n }\n}\n\nfunction calculateTime(startTime: number, endTime: number) {\n const diff = endTime - startTime;\n return diff / 1000;\n}\n"]}
|
package/dist/link/link.cmd.d.ts
CHANGED
|
@@ -9,7 +9,13 @@ declare type LinkCommandOpts = {
|
|
|
9
9
|
skipFetchingObjects?: boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare class LinkCommand implements Command {
|
|
12
|
+
/**
|
|
13
|
+
* workspace extension.
|
|
14
|
+
*/
|
|
12
15
|
private workspace;
|
|
16
|
+
/**
|
|
17
|
+
* logger extension.
|
|
18
|
+
*/
|
|
13
19
|
private logger;
|
|
14
20
|
name: string;
|
|
15
21
|
alias: string;
|
|
@@ -18,7 +24,15 @@ export declare class LinkCommand implements Command {
|
|
|
18
24
|
group: string;
|
|
19
25
|
private: boolean;
|
|
20
26
|
options: CommandOptions;
|
|
21
|
-
constructor(
|
|
27
|
+
constructor(
|
|
28
|
+
/**
|
|
29
|
+
* workspace extension.
|
|
30
|
+
*/
|
|
31
|
+
workspace: Workspace,
|
|
32
|
+
/**
|
|
33
|
+
* logger extension.
|
|
34
|
+
*/
|
|
35
|
+
logger: Logger);
|
|
22
36
|
report([ids]: [string[]], opts: LinkCommandOpts): Promise<string>;
|
|
23
37
|
json([ids]: [string[]], opts: LinkCommandOpts): Promise<LinkResults>;
|
|
24
38
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,12 +2,33 @@ interface VendorConfig {
|
|
|
2
2
|
directory: string;
|
|
3
3
|
}
|
|
4
4
|
export interface WorkspaceExtConfig {
|
|
5
|
+
/**
|
|
6
|
+
* name of the workspace.
|
|
7
|
+
*/
|
|
5
8
|
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* path to icon.
|
|
11
|
+
*/
|
|
6
12
|
icon: string;
|
|
13
|
+
/**
|
|
14
|
+
* applies only on bit.dev. configure the main owner of your workspace
|
|
15
|
+
*/
|
|
7
16
|
defaultOwner: string;
|
|
17
|
+
/**
|
|
18
|
+
* set the default scope when there is no matching for the component in the components array.
|
|
19
|
+
*/
|
|
8
20
|
defaultScope: string;
|
|
21
|
+
/**
|
|
22
|
+
* set the default directory when there is no matching for the component in the components array.
|
|
23
|
+
*/
|
|
9
24
|
defaultDirectory: string;
|
|
25
|
+
/**
|
|
26
|
+
* set the default structure of components in your project
|
|
27
|
+
*/
|
|
10
28
|
vendor: VendorConfig;
|
|
29
|
+
/**
|
|
30
|
+
* All component extensions applied by default on all components in the workspace (except vendor components)
|
|
31
|
+
*/
|
|
11
32
|
extensions: {
|
|
12
33
|
[extensionsId: string]: string;
|
|
13
34
|
};
|
|
@@ -15,11 +15,42 @@ export declare type WorkspaceProps = {
|
|
|
15
15
|
icon: string;
|
|
16
16
|
};
|
|
17
17
|
export declare class Workspace {
|
|
18
|
+
/**
|
|
19
|
+
* name of the workspace.
|
|
20
|
+
*/
|
|
18
21
|
readonly name: string;
|
|
22
|
+
/**
|
|
23
|
+
* absolute path of the workspace.
|
|
24
|
+
*/
|
|
19
25
|
readonly path: string;
|
|
26
|
+
/**
|
|
27
|
+
* icon of the workspace.
|
|
28
|
+
*/
|
|
20
29
|
readonly icon: string;
|
|
30
|
+
/**
|
|
31
|
+
* components container in the workspace.
|
|
32
|
+
*/
|
|
21
33
|
readonly components: ComponentModel[];
|
|
22
|
-
constructor(
|
|
34
|
+
constructor(
|
|
35
|
+
/**
|
|
36
|
+
* name of the workspace.
|
|
37
|
+
*/
|
|
38
|
+
name: string,
|
|
39
|
+
/**
|
|
40
|
+
* absolute path of the workspace.
|
|
41
|
+
*/
|
|
42
|
+
path: string,
|
|
43
|
+
/**
|
|
44
|
+
* icon of the workspace.
|
|
45
|
+
*/
|
|
46
|
+
icon: string,
|
|
47
|
+
/**
|
|
48
|
+
* components container in the workspace.
|
|
49
|
+
*/
|
|
50
|
+
components: ComponentModel[]);
|
|
51
|
+
/**
|
|
52
|
+
* return a component from the workspace.
|
|
53
|
+
*/
|
|
23
54
|
getComponent(id: ComponentID): ComponentModel | undefined;
|
|
24
55
|
static from({ name, path, components, icon }: WorkspaceProps): Workspace;
|
|
25
56
|
static empty(): Workspace;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Workspace } from './workspace-model';
|
|
3
3
|
export declare type WorkspaceProviderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* workspace model.
|
|
6
|
+
*/
|
|
4
7
|
workspace: Workspace;
|
|
8
|
+
/**
|
|
9
|
+
* react children.
|
|
10
|
+
*/
|
|
5
11
|
children: ReactNode;
|
|
6
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* context provider of the workspace
|
|
15
|
+
*/
|
|
7
16
|
export declare function WorkspaceProvider({ workspace, children }: WorkspaceProviderProps): JSX.Element;
|
|
@@ -8,4 +8,7 @@ export declare type WorkspaceProps = {
|
|
|
8
8
|
workspaceUI: WorkspaceUI;
|
|
9
9
|
onSidebarTogglerChange: (callback: () => void) => void;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* main workspace component.
|
|
13
|
+
*/
|
|
11
14
|
export declare function Workspace({ routeSlot, menuSlot, sidebar, workspaceUI, onSidebarTogglerChange }: WorkspaceProps): JSX.Element;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { OnComponentEventResult } from '../on-component-events';
|
|
2
2
|
export declare const formatWatchPathsSortByComponent: (trackDirs: any) => string;
|
|
3
|
+
/**
|
|
4
|
+
* todo: this was implemented incorrectly.
|
|
5
|
+
* the original idea of `SerializableResults` was to have each one of the aspects registered to the slot, the
|
|
6
|
+
* ability to have their own formatting to their results, and then `toString()` method to print them.
|
|
7
|
+
* Here, the printing is specifically to the Compiler aspect. It should move to where it belongs.
|
|
8
|
+
*/
|
|
3
9
|
export declare function formatCompileResults(compileResults: OnComponentEventResult[], verbose: boolean): string;
|
|
@@ -9,8 +9,17 @@ export declare type WatchCmdOpts = {
|
|
|
9
9
|
checkTypes?: string | boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare class WatchCommand implements Command {
|
|
12
|
+
/**
|
|
13
|
+
* logger extension.
|
|
14
|
+
*/
|
|
12
15
|
private pubsub;
|
|
16
|
+
/**
|
|
17
|
+
* logger extension.
|
|
18
|
+
*/
|
|
13
19
|
private logger;
|
|
20
|
+
/**
|
|
21
|
+
* watcher extension.
|
|
22
|
+
*/
|
|
14
23
|
private watcher;
|
|
15
24
|
msgs: {
|
|
16
25
|
onAll: (event: any, path: any) => void;
|
|
@@ -27,7 +36,19 @@ export declare class WatchCommand implements Command {
|
|
|
27
36
|
group: string;
|
|
28
37
|
shortDescription: string;
|
|
29
38
|
options: CommandOptions;
|
|
30
|
-
constructor(
|
|
39
|
+
constructor(
|
|
40
|
+
/**
|
|
41
|
+
* logger extension.
|
|
42
|
+
*/
|
|
43
|
+
pubsub: PubsubMain,
|
|
44
|
+
/**
|
|
45
|
+
* logger extension.
|
|
46
|
+
*/
|
|
47
|
+
logger: Logger,
|
|
48
|
+
/**
|
|
49
|
+
* watcher extension.
|
|
50
|
+
*/
|
|
51
|
+
watcher: Watcher);
|
|
31
52
|
private registerToEvents;
|
|
32
53
|
private eventsListener;
|
|
33
54
|
report(cliArgs: [], watchCmdOpts: WatchCmdOpts): Promise<string>;
|
package/dist/watch/watcher.d.ts
CHANGED
|
@@ -34,6 +34,9 @@ export declare class Watcher {
|
|
|
34
34
|
get consumer(): Consumer;
|
|
35
35
|
watchAll(opts: WatchOptions): Promise<unknown>;
|
|
36
36
|
private handleChange;
|
|
37
|
+
/**
|
|
38
|
+
* if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.
|
|
39
|
+
*/
|
|
37
40
|
private handleBitmapChanges;
|
|
38
41
|
private executeWatchOperationsOnRemove;
|
|
39
42
|
private executeWatchOperationsOnComponent;
|
|
@@ -42,6 +45,12 @@ export declare class Watcher {
|
|
|
42
45
|
private creatOnComponentAddEvent;
|
|
43
46
|
private completeWatch;
|
|
44
47
|
private isComponentWatchedExternally;
|
|
48
|
+
/**
|
|
49
|
+
* if a file was added/remove, once the component is loaded, it changes .bitmap, and then the
|
|
50
|
+
* entire cache is invalidated and the consumer is reloaded.
|
|
51
|
+
* when a file just changed, no need to reload the consumer, it is enough to just delete the
|
|
52
|
+
* component from the cache (both, workspace and consumer)
|
|
53
|
+
*/
|
|
45
54
|
private getComponentIdAndClearItsCache;
|
|
46
55
|
private findTrackDirByFilePathRecursively;
|
|
47
56
|
private createWatcher;
|
|
@@ -4,14 +4,70 @@ export declare type ModifyInfo = {
|
|
|
4
4
|
hasModifiedDependencies: boolean;
|
|
5
5
|
};
|
|
6
6
|
export declare class ComponentStatus {
|
|
7
|
+
/**
|
|
8
|
+
* is the component modified.
|
|
9
|
+
*/
|
|
7
10
|
readonly modifyInfo: ModifyInfo;
|
|
11
|
+
/**
|
|
12
|
+
* is the new component new.
|
|
13
|
+
*/
|
|
8
14
|
readonly isNew: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* is the component deleted from the workspace.
|
|
17
|
+
*/
|
|
9
18
|
readonly isDeleted: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* is the component staged.
|
|
21
|
+
*/
|
|
10
22
|
readonly isStaged: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* does the component exists in the workspace.
|
|
25
|
+
*/
|
|
11
26
|
readonly isInWorkspace: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* does the component exists in the scope.
|
|
29
|
+
*/
|
|
12
30
|
readonly isInScope: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* does the component is outdated (pending for update).
|
|
33
|
+
*/
|
|
13
34
|
readonly isOutdated: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* the component is not authored and not imported.
|
|
37
|
+
*/
|
|
14
38
|
readonly nested?: boolean | undefined;
|
|
15
|
-
constructor(
|
|
39
|
+
constructor(
|
|
40
|
+
/**
|
|
41
|
+
* is the component modified.
|
|
42
|
+
*/
|
|
43
|
+
modifyInfo: ModifyInfo,
|
|
44
|
+
/**
|
|
45
|
+
* is the new component new.
|
|
46
|
+
*/
|
|
47
|
+
isNew: boolean,
|
|
48
|
+
/**
|
|
49
|
+
* is the component deleted from the workspace.
|
|
50
|
+
*/
|
|
51
|
+
isDeleted: boolean,
|
|
52
|
+
/**
|
|
53
|
+
* is the component staged.
|
|
54
|
+
*/
|
|
55
|
+
isStaged: boolean,
|
|
56
|
+
/**
|
|
57
|
+
* does the component exists in the workspace.
|
|
58
|
+
*/
|
|
59
|
+
isInWorkspace: boolean,
|
|
60
|
+
/**
|
|
61
|
+
* does the component exists in the scope.
|
|
62
|
+
*/
|
|
63
|
+
isInScope: boolean,
|
|
64
|
+
/**
|
|
65
|
+
* does the component is outdated (pending for update).
|
|
66
|
+
*/
|
|
67
|
+
isOutdated: boolean,
|
|
68
|
+
/**
|
|
69
|
+
* the component is not authored and not imported.
|
|
70
|
+
*/
|
|
71
|
+
nested?: boolean | undefined);
|
|
16
72
|
static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean): ComponentStatus;
|
|
17
73
|
}
|
|
@@ -20,6 +20,13 @@ export declare class WorkspaceComponentLoader {
|
|
|
20
20
|
clearComponentCache(id: ComponentID): void;
|
|
21
21
|
private loadOne;
|
|
22
22
|
private saveInCache;
|
|
23
|
+
/**
|
|
24
|
+
* make sure that not only the id-str match, but also the legacy-id.
|
|
25
|
+
* this is needed because the ComponentID.toString() is the same whether or not the legacy-id has
|
|
26
|
+
* scope-name, as it includes the defaultScope if the scope is empty.
|
|
27
|
+
* as a result, when out-of-sync is happening and the id is changed to include scope-name in the
|
|
28
|
+
* legacy-id, the component is the cache has the old id.
|
|
29
|
+
*/
|
|
23
30
|
private getFromCache;
|
|
24
31
|
private getConsumerComponent;
|
|
25
32
|
private isComponentNotExistsError;
|
|
@@ -3,12 +3,47 @@ import { IssuesList } from '@teambit/component-issues';
|
|
|
3
3
|
import { Workspace } from '../workspace';
|
|
4
4
|
import { ComponentStatus } from './component-status';
|
|
5
5
|
export declare class WorkspaceComponent extends Component {
|
|
6
|
+
/**
|
|
7
|
+
* component ID represented by the `ComponentId` type.
|
|
8
|
+
*/
|
|
6
9
|
readonly id: ComponentID;
|
|
10
|
+
/**
|
|
11
|
+
* head version of the component. can be `null` for new components.
|
|
12
|
+
*/
|
|
7
13
|
readonly head: Snap | null;
|
|
14
|
+
/**
|
|
15
|
+
* tags of the component.
|
|
16
|
+
*/
|
|
8
17
|
readonly tags: TagMap;
|
|
18
|
+
/**
|
|
19
|
+
* workspace extension.
|
|
20
|
+
*/
|
|
9
21
|
readonly workspace: Workspace;
|
|
10
|
-
constructor(
|
|
22
|
+
constructor(
|
|
23
|
+
/**
|
|
24
|
+
* component ID represented by the `ComponentId` type.
|
|
25
|
+
*/
|
|
26
|
+
id: ComponentID,
|
|
27
|
+
/**
|
|
28
|
+
* head version of the component. can be `null` for new components.
|
|
29
|
+
*/
|
|
30
|
+
head: Snap | null,
|
|
31
|
+
/**
|
|
32
|
+
* state of the component.
|
|
33
|
+
*/
|
|
34
|
+
workspaceState: State,
|
|
35
|
+
/**
|
|
36
|
+
* tags of the component.
|
|
37
|
+
*/
|
|
38
|
+
tags: TagMap,
|
|
39
|
+
/**
|
|
40
|
+
* workspace extension.
|
|
41
|
+
*/
|
|
42
|
+
workspace: Workspace);
|
|
11
43
|
getStatus(): Promise<ComponentStatus>;
|
|
44
|
+
/**
|
|
45
|
+
* get all issues reported on the component.
|
|
46
|
+
*/
|
|
12
47
|
getIssues(): IssuesList | null;
|
|
13
48
|
static fromComponent(component: Component, workspace: Workspace): WorkspaceComponent;
|
|
14
49
|
}
|