@teambit/workspace 1.0.227 → 1.0.229
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_workspace_workspace-preview.js +1 -1
- package/artifacts/schema.json +2434 -568
- package/dist/aspects-merger.d.ts +58 -0
- package/dist/bit-map.d.ts +75 -0
- package/dist/build-graph-from-fs.d.ts +64 -0
- package/dist/build-graph-ids-from-fs.d.ts +48 -0
- package/dist/capsule.cmd.d.ts +81 -0
- package/dist/component-config-file/component-config-file.d.ts +34 -0
- package/dist/component-config-file/exceptions/already-exists.d.ts +4 -0
- package/dist/component-config-file/exceptions/index.d.ts +1 -0
- package/dist/component-config-file/index.d.ts +2 -0
- package/dist/component-tree.widget.d.ts +4 -0
- package/dist/constants.d.ts +1 -0
- package/dist/eject-conf.cmd.d.ts +20 -0
- package/dist/envs-subcommands/envs-replace.cmd.d.ts +19 -0
- package/dist/envs-subcommands/envs-set.cmd.d.ts +20 -0
- package/dist/envs-subcommands/envs-unset.cmd.d.ts +16 -0
- package/dist/envs-subcommands/envs-update.cmd.d.ts +19 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/on-component-add-event.d.ts +14 -0
- package/dist/events/on-component-change-event.d.ts +14 -0
- package/dist/events/on-component-removed-event.d.ts +12 -0
- package/dist/exceptions/incorrect-env-aspect.d.ts +4 -0
- package/dist/exceptions/merge-config-conflict.d.ts +4 -0
- package/dist/exceptions/outside-workspace.d.ts +4 -0
- package/dist/filter.d.ts +27 -0
- package/dist/index.d.ts +20 -0
- package/dist/merge-conflict-file.d.ts +23 -0
- package/dist/on-component-events.d.ts +16 -0
- package/dist/pattern.cmd.d.ts +19 -0
- package/dist/{preview-1712719054377.js → preview-1712822929999.js} +2 -2
- package/dist/scope-subcommands/scope-set.cmd.d.ts +16 -0
- package/dist/types.d.ts +65 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/workspace/default-component.d.ts +7 -0
- package/dist/ui/workspace/index.d.ts +1 -0
- package/dist/ui/workspace/use-workspace.d.ts +32 -0
- package/dist/ui/workspace/workspace-context.d.ts +3 -0
- package/dist/ui/workspace/workspace-model.d.ts +68 -0
- package/dist/ui/workspace/workspace-overview/index.d.ts +1 -0
- package/dist/ui/workspace/workspace-overview/link-plugin.d.ts +3 -0
- package/dist/ui/workspace/workspace-overview/workspace-overview.d.ts +6 -0
- package/dist/ui/workspace/workspace-provider.d.ts +16 -0
- package/dist/ui/workspace/workspace.d.ts +14 -0
- package/dist/use.cmd.d.ts +19 -0
- package/dist/workspace-aspects-loader.d.ts +121 -0
- package/dist/workspace-component/comp-files.d.ts +22 -0
- package/dist/workspace-component/component-status-loader.d.ts +38 -0
- package/dist/workspace-component/component-status.d.ts +75 -0
- package/dist/workspace-component/index.d.ts +2 -0
- package/dist/workspace-component/workspace-component-loader.d.ts +100 -0
- package/dist/workspace-component/workspace-component.d.ts +49 -0
- package/dist/workspace-section.d.ts +0 -0
- package/dist/workspace.aspect.d.ts +3 -0
- package/dist/workspace.composition.d.ts +1 -0
- package/dist/workspace.d.ts +543 -0
- package/dist/workspace.graphql.d.ts +44 -0
- package/dist/workspace.main.runtime.d.ts +64 -0
- package/dist/workspace.ui-root.d.ts +43 -0
- package/dist/workspace.ui.drawer.d.ts +13 -0
- package/dist/workspace.ui.runtime.d.ts +99 -0
- package/package.json +29 -29
- package/tsconfig.json +1 -67
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { Workspace } from './workspace';
|
|
3
|
+
export declare class PatternCommand implements Command {
|
|
4
|
+
private workspace;
|
|
5
|
+
name: string;
|
|
6
|
+
alias: string;
|
|
7
|
+
description: string;
|
|
8
|
+
extendedDescription: string;
|
|
9
|
+
examples: {
|
|
10
|
+
cmd: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}[];
|
|
13
|
+
group: string;
|
|
14
|
+
private: boolean;
|
|
15
|
+
options: CommandOptions;
|
|
16
|
+
constructor(workspace: Workspace);
|
|
17
|
+
report([pattern]: [string]): Promise<string>;
|
|
18
|
+
json([pattern]: [string]): Promise<import("@teambit/component-id").ComponentID[]>;
|
|
19
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.229/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.229/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@teambit/cli';
|
|
2
|
+
import { Workspace } from '../workspace';
|
|
3
|
+
export declare class ScopeSetCmd implements Command {
|
|
4
|
+
private workspace;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
arguments: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
options: never[];
|
|
12
|
+
group: string;
|
|
13
|
+
extendedDescription: string;
|
|
14
|
+
constructor(workspace: Workspace);
|
|
15
|
+
report([scopeName, pattern]: [string, string]): Promise<string>;
|
|
16
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
interface VendorConfig {
|
|
2
|
+
directory: string;
|
|
3
|
+
}
|
|
4
|
+
export interface WorkspaceExtConfig {
|
|
5
|
+
/**
|
|
6
|
+
* name of the workspace.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* path to icon.
|
|
11
|
+
*/
|
|
12
|
+
icon: string;
|
|
13
|
+
/**
|
|
14
|
+
* set the default scope when there is no matching for the component in the components array.
|
|
15
|
+
*/
|
|
16
|
+
defaultScope: string;
|
|
17
|
+
/**
|
|
18
|
+
* set the default directory when there is no matching for the component in the components array.
|
|
19
|
+
*/
|
|
20
|
+
defaultDirectory: string;
|
|
21
|
+
/**
|
|
22
|
+
* set the default structure of components in your project
|
|
23
|
+
*/
|
|
24
|
+
vendor: VendorConfig;
|
|
25
|
+
/**
|
|
26
|
+
* All component extensions applied by default on all components in the workspace (except vendor components)
|
|
27
|
+
*/
|
|
28
|
+
extensions: {
|
|
29
|
+
[extensionsId: string]: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* If set to
|
|
33
|
+
* `true`, it allows the workspace to resolve scope's aspects from node modules
|
|
34
|
+
* installed in the workspace's `node_modules` directory. If not set or set to `false`, aspects will only be resolved
|
|
35
|
+
* from the scope aspects capsule.
|
|
36
|
+
*/
|
|
37
|
+
resolveAspectsFromNodeModules?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* If set to `true`, it allows the workspace to resolve envs from node modules
|
|
40
|
+
* installed in the workspace's `node_modules` directory.
|
|
41
|
+
* the envs will be resolved from the node_modules of the env's root (workspace/node_modules/.bit_roots/{envId})
|
|
42
|
+
* and if not found (usually when the env was hoisted to the root node_modules) then from the node_modules of the
|
|
43
|
+
* workspace.
|
|
44
|
+
* If not set or set to `false`, envs will only be resolved from the scope envs capsule.
|
|
45
|
+
*/
|
|
46
|
+
resolveEnvsFromRoots?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* If set to `true`, bit will try to load aspects dependencies automatically.
|
|
49
|
+
* even if the aspects dependencies are not configured in the workspace.jsonc root config.
|
|
50
|
+
* for example having the aspect
|
|
51
|
+
* main aspect
|
|
52
|
+
* export class MainAspectMain {
|
|
53
|
+
* ...
|
|
54
|
+
* static dependencies = [MyDepAspect];
|
|
55
|
+
* }
|
|
56
|
+
* and the in the workspace.jsonc file:
|
|
57
|
+
* {
|
|
58
|
+
* ...
|
|
59
|
+
* main-aspect: {}
|
|
60
|
+
* }
|
|
61
|
+
* when set to true, bit will try to load MyDepAspect automatically.
|
|
62
|
+
*/
|
|
63
|
+
autoLoadAspectsDeps?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Workspace } from './workspace';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './workspace';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentModel } from '@teambit/component';
|
|
2
|
+
import { ComponentID } from '@teambit/component-id';
|
|
3
|
+
import { Workspace } from './workspace-model';
|
|
4
|
+
type UseWorkspaceOptions = {
|
|
5
|
+
onComponentAdded?: (component: ComponentModel[]) => void;
|
|
6
|
+
onComponentUpdated?: (component: ComponentModel[]) => void;
|
|
7
|
+
onComponentRemoved?: (compId: ComponentID[]) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function useWorkspace(options?: UseWorkspaceOptions): {
|
|
10
|
+
client: import("@apollo/client").ApolloClient<any>;
|
|
11
|
+
observable: import("@apollo/client").ObservableQuery<any, import("@apollo/client").OperationVariables>;
|
|
12
|
+
previousData?: any;
|
|
13
|
+
error?: import("@apollo/client").ApolloError | undefined;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
networkStatus: import("@apollo/client").NetworkStatus;
|
|
16
|
+
called: boolean;
|
|
17
|
+
startPolling: (pollInterval: number) => void;
|
|
18
|
+
stopPolling: () => void;
|
|
19
|
+
updateQuery: <TVars extends import("@apollo/client").OperationVariables = import("@apollo/client").OperationVariables>(mapFn: (previousQueryResult: any, options: Pick<import("@apollo/client").WatchQueryOptions<TVars, any>, "variables">) => any) => void;
|
|
20
|
+
refetch: (variables?: Partial<import("@apollo/client").OperationVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<any>>;
|
|
21
|
+
reobserve: (newOptions?: Partial<import("@apollo/client").WatchQueryOptions<import("@apollo/client").OperationVariables, any>> | undefined, newNetworkStatus?: import("@apollo/client").NetworkStatus | undefined) => Promise<import("@apollo/client").ApolloQueryResult<any>>;
|
|
22
|
+
variables: import("@apollo/client").OperationVariables | undefined;
|
|
23
|
+
fetchMore: <TFetchData = any, TFetchVars extends import("@apollo/client").OperationVariables = import("@apollo/client").OperationVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
24
|
+
updateQuery?: ((previousQueryResult: any, options: {
|
|
25
|
+
fetchMoreResult: TFetchData;
|
|
26
|
+
variables: TFetchVars;
|
|
27
|
+
}) => any) | undefined;
|
|
28
|
+
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>;
|
|
29
|
+
workspace: Workspace | undefined;
|
|
30
|
+
subscribeToMore: <TSubscriptionData = any, TSubscriptionVariables extends import("@apollo/client").OperationVariables = import("@apollo/client").OperationVariables>(options: import("@apollo/client").SubscribeToMoreOptions<any, TSubscriptionVariables, TSubscriptionData>) => () => void;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';
|
|
2
|
+
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
3
|
+
import { DeprecationInfo } from '@teambit/deprecation';
|
|
4
|
+
import { Descriptor } from '@teambit/envs';
|
|
5
|
+
import { ComponentStatus } from '../../workspace-component/component-status';
|
|
6
|
+
export type WorkspaceModelComponent = {
|
|
7
|
+
id: ComponentID;
|
|
8
|
+
status: ComponentStatus;
|
|
9
|
+
deprecation: DeprecationInfo;
|
|
10
|
+
env: Descriptor;
|
|
11
|
+
};
|
|
12
|
+
export type WorkspaceProps = {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
components: (ComponentModelProps & {
|
|
16
|
+
aspects: Record<string, any>;
|
|
17
|
+
})[];
|
|
18
|
+
icon: string;
|
|
19
|
+
};
|
|
20
|
+
export declare class Workspace {
|
|
21
|
+
/**
|
|
22
|
+
* name of the workspace.
|
|
23
|
+
*/
|
|
24
|
+
readonly name: string;
|
|
25
|
+
/**
|
|
26
|
+
* absolute path of the workspace.
|
|
27
|
+
*/
|
|
28
|
+
readonly path: string;
|
|
29
|
+
/**
|
|
30
|
+
* icon of the workspace.
|
|
31
|
+
*/
|
|
32
|
+
readonly icon: string;
|
|
33
|
+
/**
|
|
34
|
+
* components container in the workspace.
|
|
35
|
+
*/
|
|
36
|
+
readonly components: ComponentModel[];
|
|
37
|
+
/**
|
|
38
|
+
* components contained in the workspace.
|
|
39
|
+
*/
|
|
40
|
+
readonly componentDescriptors: ComponentDescriptor[];
|
|
41
|
+
constructor(
|
|
42
|
+
/**
|
|
43
|
+
* name of the workspace.
|
|
44
|
+
*/
|
|
45
|
+
name: string,
|
|
46
|
+
/**
|
|
47
|
+
* absolute path of the workspace.
|
|
48
|
+
*/
|
|
49
|
+
path: string,
|
|
50
|
+
/**
|
|
51
|
+
* icon of the workspace.
|
|
52
|
+
*/
|
|
53
|
+
icon: string,
|
|
54
|
+
/**
|
|
55
|
+
* components container in the workspace.
|
|
56
|
+
*/
|
|
57
|
+
components: ComponentModel[],
|
|
58
|
+
/**
|
|
59
|
+
* components contained in the workspace.
|
|
60
|
+
*/
|
|
61
|
+
componentDescriptors: ComponentDescriptor[]);
|
|
62
|
+
/**
|
|
63
|
+
* return a component from the workspace.
|
|
64
|
+
*/
|
|
65
|
+
getComponent(id: ComponentID): ComponentModel | undefined;
|
|
66
|
+
static from({ name, path, components, icon }: WorkspaceProps): Workspace;
|
|
67
|
+
static empty(): Workspace;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WorkspaceOverview } from './workspace-overview';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentModel } from '@teambit/component';
|
|
2
|
+
import type { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
|
|
3
|
+
export declare function WorkspaceOverview(): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function useCardPlugins({ compModelsById, }: {
|
|
5
|
+
compModelsById: Map<string, ComponentModel>;
|
|
6
|
+
}): ComponentCardPluginType<PluginProps>[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Workspace } from './workspace-model';
|
|
3
|
+
export type WorkspaceProviderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* workspace model.
|
|
6
|
+
*/
|
|
7
|
+
workspace: Workspace;
|
|
8
|
+
/**
|
|
9
|
+
* react children.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* context provider of the workspace
|
|
15
|
+
*/
|
|
16
|
+
export declare function WorkspaceProvider({ workspace, children }: WorkspaceProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'reset-css';
|
|
2
|
+
import type { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
3
|
+
import { WorkspaceUI } from '../../workspace.ui.runtime';
|
|
4
|
+
export type WorkspaceProps = {
|
|
5
|
+
routeSlot: RouteSlot;
|
|
6
|
+
menuSlot: RouteSlot;
|
|
7
|
+
sidebar: JSX.Element;
|
|
8
|
+
workspaceUI: WorkspaceUI;
|
|
9
|
+
onSidebarTogglerChange: (callback: () => void) => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* main workspace component.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Workspace({ routeSlot, menuSlot, sidebar, workspaceUI, onSidebarTogglerChange }: WorkspaceProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { Workspace } from './workspace';
|
|
3
|
+
export declare class UseCmd implements Command {
|
|
4
|
+
private workspace;
|
|
5
|
+
name: string;
|
|
6
|
+
group: string;
|
|
7
|
+
description: string;
|
|
8
|
+
helpUrl: string;
|
|
9
|
+
arguments: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}[];
|
|
13
|
+
alias: string;
|
|
14
|
+
options: CommandOptions;
|
|
15
|
+
loader: boolean;
|
|
16
|
+
remoteOp: boolean;
|
|
17
|
+
constructor(workspace: Workspace);
|
|
18
|
+
report([id]: [string]): Promise<any>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { GlobalConfigMain } from '@teambit/global-config';
|
|
2
|
+
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
|
|
3
|
+
import { Harmony } from '@teambit/harmony';
|
|
4
|
+
import { AspectDefinition, AspectLoaderMain } from '@teambit/aspect-loader';
|
|
5
|
+
import { ComponentID } from '@teambit/component-id';
|
|
6
|
+
import { LoadAspectsOptions, ResolveAspectsOptions } from '@teambit/component';
|
|
7
|
+
import { ScopeMain } from '@teambit/scope';
|
|
8
|
+
import { Logger } from '@teambit/logger';
|
|
9
|
+
import { EnvsMain } from '@teambit/envs';
|
|
10
|
+
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
11
|
+
import type { Workspace } from './workspace';
|
|
12
|
+
import { OnAspectsResolveSlot, OnRootAspectAddedSlot } from './workspace.main.runtime';
|
|
13
|
+
export type GetConfiguredUserAspectsPackagesOptions = {
|
|
14
|
+
externalsOnly?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {
|
|
17
|
+
useScopeAspectsCapsule?: boolean;
|
|
18
|
+
runSubscribers?: boolean;
|
|
19
|
+
skipDeps?: boolean;
|
|
20
|
+
resolveEnvsFromRoots?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type AspectPackage = {
|
|
23
|
+
packageName: string;
|
|
24
|
+
version: string;
|
|
25
|
+
};
|
|
26
|
+
export declare class WorkspaceAspectsLoader {
|
|
27
|
+
private workspace;
|
|
28
|
+
private scope;
|
|
29
|
+
private aspectLoader;
|
|
30
|
+
private envs;
|
|
31
|
+
private dependencyResolver;
|
|
32
|
+
private logger;
|
|
33
|
+
private globalConfig;
|
|
34
|
+
private harmony;
|
|
35
|
+
private onAspectsResolveSlot;
|
|
36
|
+
private onRootAspectAddedSlot;
|
|
37
|
+
private resolveAspectsFromNodeModules;
|
|
38
|
+
private resolveEnvsFromRoots;
|
|
39
|
+
private consumer;
|
|
40
|
+
private resolvedInstalledAspects;
|
|
41
|
+
constructor(workspace: Workspace, scope: ScopeMain, aspectLoader: AspectLoaderMain, envs: EnvsMain, dependencyResolver: DependencyResolverMain, logger: Logger, globalConfig: GlobalConfigMain, harmony: Harmony, onAspectsResolveSlot: OnAspectsResolveSlot, onRootAspectAddedSlot: OnRootAspectAddedSlot, resolveAspectsFromNodeModules?: boolean, resolveEnvsFromRoots?: boolean);
|
|
42
|
+
/**
|
|
43
|
+
* load aspects from the workspace and if not exists in the workspace, load from the node_modules.
|
|
44
|
+
* keep in mind that the graph may have circles.
|
|
45
|
+
*/
|
|
46
|
+
loadAspects(ids?: string[], throwOnError?: boolean, neededFor?: string, opts?: WorkspaceLoadAspectsOptions): Promise<string[]>;
|
|
47
|
+
private loadFromScopeAspectsCapsule;
|
|
48
|
+
throwWsJsoncAspectNotFoundError(err: any): void;
|
|
49
|
+
private loadAspectDefsByOrder;
|
|
50
|
+
resolveAspects(runtimeName?: string, componentIds?: ComponentID[], opts?: ResolveAspectsOptions): Promise<AspectDefinition[]>;
|
|
51
|
+
shouldUseHashForCapsules(): boolean;
|
|
52
|
+
getCapsulePath(): string;
|
|
53
|
+
private logFoundWorkspaceVsScope;
|
|
54
|
+
use(aspectIdStr: string): Promise<string>;
|
|
55
|
+
getConfiguredUserAspectsPackages(options?: GetConfiguredUserAspectsPackagesOptions): Promise<AspectPackage[]>;
|
|
56
|
+
private aspectDefsToRequireableComponents;
|
|
57
|
+
private linkIfMissingWorkspaceAspects;
|
|
58
|
+
/**
|
|
59
|
+
* This will return a resolver that knows to resolve aspects which are part of the workspace.
|
|
60
|
+
* means aspects exist in the bitmap file
|
|
61
|
+
* @param stringIds
|
|
62
|
+
* @param runtimeName
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
private getWorkspaceAspectResolver;
|
|
66
|
+
private runOnAspectsResolveFunctions;
|
|
67
|
+
private getOnAspectsResolveFunctions;
|
|
68
|
+
private runOnRootAspectAddedFunctions;
|
|
69
|
+
private getOnRootAspectAddedFunctions;
|
|
70
|
+
/**
|
|
71
|
+
* This will return a resolver that knows to resolve aspects which are not part of the workspace.
|
|
72
|
+
* means aspects that does not exist in the bitmap file
|
|
73
|
+
* instead it will resolve them from the node_modules recursively
|
|
74
|
+
* @param graph
|
|
75
|
+
* @param rootIds
|
|
76
|
+
* @param runtimeName
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
private getInstalledAspectResolver;
|
|
80
|
+
private resolveInstalledAspectRecursively;
|
|
81
|
+
/**
|
|
82
|
+
* Create a graph of aspects without the core aspects.
|
|
83
|
+
* @param components
|
|
84
|
+
* @param isAspect
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
private getAspectsGraphWithoutCore;
|
|
88
|
+
/**
|
|
89
|
+
* Load all unloaded extensions from an extension list
|
|
90
|
+
* this will resolve the extensions from the scope aspects capsules if they are not in the ws
|
|
91
|
+
* Only use it for component extensions
|
|
92
|
+
* for workspace/scope root aspect use the load aspects directly
|
|
93
|
+
*
|
|
94
|
+
* The reason we are loading component extensions with "scope aspects capsules" is because for component extensions
|
|
95
|
+
* we might have the same extension in multiple versions
|
|
96
|
+
* (for example I might have 2 components using different versions of the same env)
|
|
97
|
+
* in such case, I can't install both version into the root of the node_modules so I need to place it somewhere else (capsules)
|
|
98
|
+
* @param extensions list of extensions with config to load
|
|
99
|
+
*/
|
|
100
|
+
loadComponentsExtensions(extensions: ExtensionDataList, originatedFrom?: ComponentID, opts?: WorkspaceLoadAspectsOptions): Promise<void>;
|
|
101
|
+
private isAspect;
|
|
102
|
+
/**
|
|
103
|
+
* same as `this.importAndGetMany()` with a specific error handling of ComponentNotFound
|
|
104
|
+
*/
|
|
105
|
+
private importAndGetAspects;
|
|
106
|
+
/**
|
|
107
|
+
* split the provided components into 2 groups, one which are workspace components and the other which are not.
|
|
108
|
+
* @param components
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
private groupComponentsByWorkspaceExistence;
|
|
112
|
+
private groupComponentsByLoadFromRootComps;
|
|
113
|
+
private shouldLoadFromRootComps;
|
|
114
|
+
/**
|
|
115
|
+
* split the provided components into 2 groups, one which are workspace components and the other which are not.
|
|
116
|
+
* @param components
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
private groupAspectDefsByWorkspaceExistence;
|
|
120
|
+
private groupIdsByWorkspaceExistence;
|
|
121
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
2
|
+
import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';
|
|
3
|
+
import { SourceFileModel } from '@teambit/legacy/dist/scope/models/version';
|
|
4
|
+
import { Repository } from '@teambit/legacy/dist/scope/objects';
|
|
5
|
+
type FILE_STATUS = 'new' | 'modified' | 'deleted' | 'unchanged';
|
|
6
|
+
type PathLinux = string;
|
|
7
|
+
export type FilesStatus = {
|
|
8
|
+
[pathRelativeToCompDir: PathLinux]: FILE_STATUS;
|
|
9
|
+
};
|
|
10
|
+
export declare class CompFiles {
|
|
11
|
+
readonly id: ComponentID;
|
|
12
|
+
private repository;
|
|
13
|
+
private currentFiles;
|
|
14
|
+
readonly compDir: PathLinux;
|
|
15
|
+
private modelFiles;
|
|
16
|
+
constructor(id: ComponentID, repository: Repository, currentFiles: SourceFile[], compDir: PathLinux, modelFiles?: SourceFileModel[]);
|
|
17
|
+
isModified(): boolean;
|
|
18
|
+
getCurrentFiles(): SourceFile[];
|
|
19
|
+
getHeadFiles(): Promise<SourceFile[]>;
|
|
20
|
+
getFilesStatus(): FilesStatus;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
2
|
+
import { Consumer } from '@teambit/legacy/dist/consumer';
|
|
3
|
+
import { Workspace } from '..';
|
|
4
|
+
export type ComponentStatusLegacy = {
|
|
5
|
+
modified: boolean;
|
|
6
|
+
newlyCreated: boolean;
|
|
7
|
+
deleted: boolean;
|
|
8
|
+
staged: boolean;
|
|
9
|
+
notExist: boolean;
|
|
10
|
+
missingFromScope: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ComponentStatusResult = {
|
|
13
|
+
id: ComponentID;
|
|
14
|
+
status: ComponentStatusLegacy;
|
|
15
|
+
};
|
|
16
|
+
export declare class ComponentStatusLoader {
|
|
17
|
+
private workspace;
|
|
18
|
+
private _componentsStatusCache;
|
|
19
|
+
constructor(workspace: Workspace);
|
|
20
|
+
get consumer(): Consumer;
|
|
21
|
+
getManyComponentsStatuses(ids: ComponentID[]): Promise<ComponentStatusResult[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a component status by ID. Return a ComponentStatus object.
|
|
24
|
+
* Keep in mind that a result can be a partial object of ComponentStatus, e.g. { notExist: true }.
|
|
25
|
+
* Each one of the ComponentStatus properties can be undefined, true or false.
|
|
26
|
+
* As a result, in order to check whether a component is not modified use (status.modified === false).
|
|
27
|
+
* Don't use (!status.modified) because a component may not exist and the status.modified will be undefined.
|
|
28
|
+
*
|
|
29
|
+
* The status may have 'true' for several properties. For example, a component can be staged and modified at the
|
|
30
|
+
* same time.
|
|
31
|
+
*
|
|
32
|
+
* The result is cached per ID and can be called several times with no penalties.
|
|
33
|
+
*/
|
|
34
|
+
getComponentStatusById(id: ComponentID): Promise<ComponentStatusLegacy>;
|
|
35
|
+
private getStatus;
|
|
36
|
+
clearOneComponentCache(id: ComponentID): void;
|
|
37
|
+
clearCache(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ComponentStatusLegacy } from './component-status-loader';
|
|
2
|
+
export type ModifyInfo = {
|
|
3
|
+
hasModifiedFiles: boolean;
|
|
4
|
+
hasModifiedDependencies: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare class ComponentStatus {
|
|
7
|
+
/**
|
|
8
|
+
* is the component modified.
|
|
9
|
+
*/
|
|
10
|
+
readonly modifyInfo: ModifyInfo;
|
|
11
|
+
/**
|
|
12
|
+
* is the new component new.
|
|
13
|
+
*/
|
|
14
|
+
readonly isNew: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* is the component deleted from the workspace.
|
|
17
|
+
*/
|
|
18
|
+
readonly isDeleted: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* is the component staged.
|
|
21
|
+
*/
|
|
22
|
+
readonly isStaged: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* does the component exists in the workspace.
|
|
25
|
+
*/
|
|
26
|
+
readonly isInWorkspace: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* does the component exists in the scope.
|
|
29
|
+
*/
|
|
30
|
+
readonly isInScope: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* does the component is outdated (pending for update).
|
|
33
|
+
*/
|
|
34
|
+
readonly isOutdated: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated this was relevant for legacy only. can be deleted if it's not used elsewhere
|
|
37
|
+
* the component is not authored and not imported.
|
|
38
|
+
*/
|
|
39
|
+
readonly nested?: boolean | undefined;
|
|
40
|
+
constructor(
|
|
41
|
+
/**
|
|
42
|
+
* is the component modified.
|
|
43
|
+
*/
|
|
44
|
+
modifyInfo: ModifyInfo,
|
|
45
|
+
/**
|
|
46
|
+
* is the new component new.
|
|
47
|
+
*/
|
|
48
|
+
isNew: boolean,
|
|
49
|
+
/**
|
|
50
|
+
* is the component deleted from the workspace.
|
|
51
|
+
*/
|
|
52
|
+
isDeleted: boolean,
|
|
53
|
+
/**
|
|
54
|
+
* is the component staged.
|
|
55
|
+
*/
|
|
56
|
+
isStaged: boolean,
|
|
57
|
+
/**
|
|
58
|
+
* does the component exists in the workspace.
|
|
59
|
+
*/
|
|
60
|
+
isInWorkspace: boolean,
|
|
61
|
+
/**
|
|
62
|
+
* does the component exists in the scope.
|
|
63
|
+
*/
|
|
64
|
+
isInScope: boolean,
|
|
65
|
+
/**
|
|
66
|
+
* does the component is outdated (pending for update).
|
|
67
|
+
*/
|
|
68
|
+
isOutdated: boolean,
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated this was relevant for legacy only. can be deleted if it's not used elsewhere
|
|
71
|
+
* the component is not authored and not imported.
|
|
72
|
+
*/
|
|
73
|
+
nested?: boolean | undefined);
|
|
74
|
+
static fromLegacy(status: ComponentStatusLegacy, hasModifiedDependencies: boolean, isOutdated: boolean): ComponentStatus;
|
|
75
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Component, InvalidComponent } from '@teambit/component';
|
|
2
|
+
import { ComponentID } from '@teambit/component-id';
|
|
3
|
+
import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
|
|
4
|
+
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
5
|
+
import { Logger } from '@teambit/logger';
|
|
6
|
+
import { EnvsMain } from '@teambit/envs';
|
|
7
|
+
import { AspectLoaderMain } from '@teambit/aspect-loader';
|
|
8
|
+
import { ComponentLoadOptions as LegacyComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';
|
|
9
|
+
import { Workspace } from '../workspace';
|
|
10
|
+
type GetManyRes = {
|
|
11
|
+
components: Component[];
|
|
12
|
+
invalidComponents: InvalidComponent[];
|
|
13
|
+
};
|
|
14
|
+
export type ComponentLoadOptions = LegacyComponentLoadOptions & {
|
|
15
|
+
loadExtensions?: boolean;
|
|
16
|
+
executeLoadSlot?: boolean;
|
|
17
|
+
idsToNotLoadAsAspects?: string[];
|
|
18
|
+
loadSeedersAsAspects?: boolean;
|
|
19
|
+
resolveExtensionsVersions?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type ComponentGetOneOptions = {
|
|
22
|
+
resolveIdVersion?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type LoadCompAsAspectsOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* In case the component we are loading is app, whether to load it as app (in a scope aspects capsule)
|
|
27
|
+
*/
|
|
28
|
+
loadApps?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* In case the component we are loading is env, whether to load it as env (in a scope aspects capsule)
|
|
31
|
+
*/
|
|
32
|
+
loadEnvs?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* In case the component we are loading is a regular aspect, whether to load it as aspect (in a scope aspects capsule)
|
|
35
|
+
*/
|
|
36
|
+
loadAspects?: boolean;
|
|
37
|
+
idsToNotLoadAsAspects?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Are this core aspects
|
|
40
|
+
*/
|
|
41
|
+
core?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Are this aspects seeders of the load many operation
|
|
44
|
+
*/
|
|
45
|
+
seeders?: boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare class WorkspaceComponentLoader {
|
|
48
|
+
private workspace;
|
|
49
|
+
private logger;
|
|
50
|
+
private dependencyResolver;
|
|
51
|
+
private envs;
|
|
52
|
+
private aspectLoader;
|
|
53
|
+
private componentsCache;
|
|
54
|
+
/**
|
|
55
|
+
* Cache components that loaded from scope (especially for get many for perf improvements)
|
|
56
|
+
*/
|
|
57
|
+
private scopeComponentsCache;
|
|
58
|
+
/**
|
|
59
|
+
* Cache extension list for components. used by get many for perf improvements.
|
|
60
|
+
* And to make sure we load extensions first.
|
|
61
|
+
*/
|
|
62
|
+
private componentsExtensionsCache;
|
|
63
|
+
private componentLoadedSelfAsAspects;
|
|
64
|
+
constructor(workspace: Workspace, logger: Logger, dependencyResolver: DependencyResolverMain, envs: EnvsMain, aspectLoader: AspectLoaderMain);
|
|
65
|
+
getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions, throwOnFailure?: boolean): Promise<GetManyRes>;
|
|
66
|
+
private getAndLoadSlotOrdered;
|
|
67
|
+
private buildLoadGroups;
|
|
68
|
+
private regroupExtIdsFromTheList;
|
|
69
|
+
private getAndLoadSlot;
|
|
70
|
+
loadCompsAsAspects(components: Component[], opts?: LoadCompAsAspectsOptions): Promise<void>;
|
|
71
|
+
private populateScopeAndExtensionsCache;
|
|
72
|
+
private warnAboutMisconfiguredEnvs;
|
|
73
|
+
private groupAndUpdateIds;
|
|
74
|
+
private isInWsIncludeDeleted;
|
|
75
|
+
private getComponentsWithoutLoadExtensions;
|
|
76
|
+
getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]>;
|
|
77
|
+
get(componentId: ComponentID, legacyComponent?: ConsumerComponent, useCache?: boolean, storeInCache?: boolean, loadOpts?: ComponentLoadOptions, getOpts?: ComponentGetOneOptions): Promise<Component>;
|
|
78
|
+
getIfExist(componentId: ComponentID): Promise<Component | undefined>;
|
|
79
|
+
private resolveVersion;
|
|
80
|
+
private addMultipleEnvsIssueIfNeeded;
|
|
81
|
+
clearCache(): void;
|
|
82
|
+
clearComponentCache(id: ComponentID): void;
|
|
83
|
+
private loadOne;
|
|
84
|
+
private saveInCache;
|
|
85
|
+
/**
|
|
86
|
+
* make sure that not only the id-str match, but also the legacy-id.
|
|
87
|
+
* this is needed because the ComponentID.toString() is the same whether or not the legacy-id has
|
|
88
|
+
* scope-name, as it includes the defaultScope if the scope is empty.
|
|
89
|
+
* as a result, when out-of-sync is happening and the id is changed to include scope-name in the
|
|
90
|
+
* legacy-id, the component is the cache has the old id.
|
|
91
|
+
*/
|
|
92
|
+
private getFromCache;
|
|
93
|
+
private getConsumerComponent;
|
|
94
|
+
private isComponentNotExistsError;
|
|
95
|
+
private executeLoadSlot;
|
|
96
|
+
private newComponentFromState;
|
|
97
|
+
private upsertExtensionData;
|
|
98
|
+
private getDataEntry;
|
|
99
|
+
}
|
|
100
|
+
export {};
|