@teambit/workspace 0.0.555 → 0.0.559

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.
Files changed (69) hide show
  1. package/dist/build-graph-from-fs.js +4 -1
  2. package/dist/build-graph-from-fs.js.map +1 -1
  3. package/dist/workspace.d.ts +7 -0
  4. package/dist/workspace.js +23 -0
  5. package/dist/workspace.js.map +1 -1
  6. package/package.json +65 -50
  7. package/tsconfig.json +1 -1
  8. package/build-graph-from-fs.ts +0 -160
  9. package/capsule.cmd.ts +0 -136
  10. package/component-config-file/component-config-file.ts +0 -98
  11. package/component-config-file/exceptions/already-exists.ts +0 -7
  12. package/component-config-file/exceptions/index.ts +0 -1
  13. package/component-config-file/index.ts +0 -2
  14. package/component-tree.widget.tsx +0 -16
  15. package/constants.ts +0 -1
  16. package/eject-conf.cmd.tsx +0 -62
  17. package/events/index.ts +0 -3
  18. package/events/on-component-add-event.ts +0 -14
  19. package/events/on-component-change-event.ts +0 -14
  20. package/events/on-component-removed-event.ts +0 -14
  21. package/exceptions/dependency-type-not-supported-in-policy.ts +0 -7
  22. package/exceptions/incorrect-env-aspect.ts +0 -8
  23. package/exceptions/index.ts +0 -1
  24. package/index.ts +0 -19
  25. package/install.cmd.tsx +0 -67
  26. package/link/component-list-links.ts +0 -50
  27. package/link/core-aspects-links.ts +0 -50
  28. package/link/get-package-name-from-target.ts +0 -5
  29. package/link/index.ts +0 -1
  30. package/link/link-row.ts +0 -20
  31. package/link/link-to-dir.ts +0 -13
  32. package/link/link.cmd.ts +0 -96
  33. package/link/nested-deps-in-nm-links.ts +0 -47
  34. package/link/rewire-row.ts +0 -17
  35. package/list.cmd.tsx +0 -30
  36. package/on-component-events.ts +0 -14
  37. package/package-tar/teambit-workspace-0.0.555.tgz +0 -0
  38. package/tag-cmd.ts +0 -247
  39. package/types/asset.d.ts +0 -29
  40. package/types/style.d.ts +0 -42
  41. package/types.ts +0 -40
  42. package/ui/index.ts +0 -1
  43. package/ui/workspace/default-component.ts +0 -7
  44. package/ui/workspace/index.ts +0 -1
  45. package/ui/workspace/use-workspace.ts +0 -193
  46. package/ui/workspace/workspace-context.tsx +0 -5
  47. package/ui/workspace/workspace-model.ts +0 -66
  48. package/ui/workspace/workspace-overview/index.ts +0 -1
  49. package/ui/workspace/workspace-overview/workspace-overview.tsx +0 -21
  50. package/ui/workspace/workspace-provider.tsx +0 -23
  51. package/ui/workspace/workspace.tsx +0 -99
  52. package/ui/workspace-components-drawer/index.ts +0 -1
  53. package/ui/workspace-components-drawer/workspace-components.drawer.tsx +0 -49
  54. package/watch/check-types.ts +0 -5
  55. package/watch/output-formatter.ts +0 -50
  56. package/watch/watch.cmd.tsx +0 -142
  57. package/watch/watcher.ts +0 -289
  58. package/workspace-component/component-status.ts +0 -67
  59. package/workspace-component/index.ts +0 -2
  60. package/workspace-component/workspace-component-loader.ts +0 -276
  61. package/workspace-component/workspace-component.ts +0 -51
  62. package/workspace-section.ts +0 -14
  63. package/workspace.aspect.ts +0 -9
  64. package/workspace.graphql.ts +0 -133
  65. package/workspace.main.runtime.ts +0 -50
  66. package/workspace.provider.ts +0 -218
  67. package/workspace.ts +0 -1539
  68. package/workspace.ui-root.ts +0 -64
  69. package/workspace.ui.runtime.tsx +0 -215
@@ -1,67 +0,0 @@
1
- import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';
2
-
3
- export type ModifyInfo = {
4
- hasModifiedFiles: boolean;
5
- hasModifiedDependencies: boolean;
6
- };
7
-
8
- export class ComponentStatus {
9
- constructor(
10
- /**
11
- * is the component modified.
12
- */
13
- readonly modifyInfo: ModifyInfo,
14
-
15
- /**
16
- * is the new component new.
17
- */
18
- readonly isNew: boolean,
19
-
20
- /**
21
- * is the component deleted from the workspace.
22
- */
23
- readonly isDeleted: boolean,
24
-
25
- /**
26
- * is the component staged.
27
- */
28
- readonly isStaged: boolean,
29
-
30
- /**
31
- * does the component exists in the workspace.
32
- */
33
- readonly isInWorkspace: boolean,
34
-
35
- /**
36
- * does the component exists in the scope.
37
- */
38
- readonly isInScope: boolean,
39
-
40
- /**
41
- * does the component is outdated (pending for update).
42
- */
43
- readonly isOutdated: boolean,
44
-
45
- /**
46
- * the component is not authored and not imported.
47
- */
48
- readonly nested?: boolean
49
- ) {}
50
-
51
- static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean) {
52
- const modify: ModifyInfo = {
53
- hasModifiedFiles: !!status.modified,
54
- hasModifiedDependencies,
55
- };
56
- return new ComponentStatus(
57
- modify,
58
- !!status.newlyCreated,
59
- !!status.deleted,
60
- !!status.staged,
61
- !status.notExist,
62
- !status.missingFromScope,
63
- isOutdated,
64
- !!status.nested
65
- );
66
- }
67
- }
@@ -1,2 +0,0 @@
1
- export { WorkspaceComponent } from './workspace-component';
2
- export { ComponentStatus } from './component-status';
@@ -1,276 +0,0 @@
1
- import { Component, ComponentFS, ComponentID, Config, InvalidComponent, State, TagMap } from '@teambit/component';
2
- import { BitId } from '@teambit/legacy-bit-id';
3
- import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
4
- import mapSeries from 'p-map-series';
5
- import { compact } from 'lodash';
6
- import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
7
- import { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';
8
- import { getLatestVersionNumber } from '@teambit/legacy/dist/utils';
9
- import { IssuesClasses } from '@teambit/component-issues';
10
- import { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';
11
- import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';
12
- import { Logger } from '@teambit/logger';
13
- import { EnvsAspect, EnvsMain } from '@teambit/envs';
14
- import { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config';
15
- import { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';
16
- import { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';
17
- import ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';
18
- import { Workspace } from '../workspace';
19
- import { WorkspaceComponent } from './workspace-component';
20
-
21
- export class WorkspaceComponentLoader {
22
- private componentsCache: InMemoryCache<Component>; // cache loaded components
23
- private componentsCacheForCapsule: InMemoryCache<Component>; // cache loaded components for capsule, must not use the cache for the workspace
24
- constructor(
25
- private workspace: Workspace,
26
- private logger: Logger,
27
- private dependencyResolver: DependencyResolverMain,
28
- private envs: EnvsMain
29
- ) {
30
- this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });
31
- this.componentsCacheForCapsule = createInMemoryCache({ maxSize: getMaxSizeForComponents() });
32
- }
33
-
34
- async getMany(ids: Array<ComponentID>, forCapsule = false): Promise<Component[]> {
35
- const idsWithoutEmpty = compact(ids);
36
- const errors: { id: ComponentID; err: Error }[] = [];
37
- const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);
38
- const componentsP = mapSeries(idsWithoutEmpty, async (id: ComponentID) => {
39
- longProcessLogger.logProgress(id.toString());
40
- return this.get(id, forCapsule).catch((err) => {
41
- if (this.isComponentNotExistsError(err)) {
42
- errors.push({
43
- id,
44
- err,
45
- });
46
- return undefined;
47
- }
48
- throw err;
49
- });
50
- });
51
- const components = await componentsP;
52
- errors.forEach((err) => {
53
- if (!this.workspace.consumer.isLegacy) {
54
- this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);
55
- }
56
- this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);
57
- });
58
- // remove errored components
59
- const filteredComponents: Component[] = compact(components);
60
- longProcessLogger.end();
61
- return filteredComponents;
62
- }
63
-
64
- async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {
65
- const idsWithoutEmpty = compact(ids);
66
- const errors: InvalidComponent[] = [];
67
- const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);
68
- await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {
69
- longProcessLogger.logProgress(id.toString());
70
- try {
71
- await this.workspace.consumer.loadComponent(id._legacy);
72
- } catch (err: any) {
73
- if (ConsumerComponent.isComponentInvalidByErrorType(err)) {
74
- errors.push({
75
- id,
76
- err,
77
- });
78
- return;
79
- }
80
- throw err;
81
- }
82
- });
83
- return errors;
84
- }
85
-
86
- async get(
87
- componentId: ComponentID,
88
- forCapsule = false,
89
- legacyComponent?: ConsumerComponent,
90
- useCache = true,
91
- storeInCache = true
92
- ): Promise<Component> {
93
- const bitIdWithVersion: BitId = getLatestVersionNumber(
94
- this.workspace.consumer.bitmapIdsFromCurrentLane,
95
- componentId._legacy
96
- );
97
- const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;
98
- const fromCache = this.getFromCache(id, forCapsule);
99
- if (fromCache && useCache) {
100
- return fromCache;
101
- }
102
- const consumerComponent = legacyComponent || (await this.getConsumerComponent(id, forCapsule));
103
- // in case of out-of-sync, the id may changed during the load process
104
- const updatedId = consumerComponent ? ComponentID.fromLegacy(consumerComponent.id, id.scope) : id;
105
- const component = await this.loadOne(updatedId, consumerComponent);
106
- if (storeInCache) {
107
- this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded
108
- this.saveInCache(component, forCapsule);
109
- }
110
- return component;
111
- }
112
-
113
- private addMultipleEnvsIssueIfNeeded(component: Component) {
114
- const envs = this.envs.getAllEnvsConfiguredOnComponent(component);
115
- if (envs.length < 2) {
116
- return;
117
- }
118
- component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envs.map((e) => e.id);
119
- }
120
-
121
- clearCache() {
122
- this.componentsCache.deleteAll();
123
- this.componentsCacheForCapsule.deleteAll();
124
- }
125
- clearComponentCache(id: ComponentID) {
126
- const idStr = id.toString();
127
- this.componentsCache.delete(idStr);
128
- this.componentsCacheForCapsule.delete(idStr);
129
- }
130
-
131
- private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent) {
132
- const componentFromScope = await this.workspace.scope.get(id);
133
- if (!consumerComponent) {
134
- if (!componentFromScope) throw new MissingBitMapComponent(id.toString());
135
- return componentFromScope;
136
- }
137
-
138
- let extensionDataList = await this.workspace.componentExtensions(id, componentFromScope);
139
- const extensionsFromConsumerComponent = consumerComponent.extensions || new ExtensionDataList();
140
- // Merge extensions added by the legacy code in memory (for example data of dependency resolver)
141
- extensionDataList = ExtensionDataList.mergeConfigs([
142
- extensionsFromConsumerComponent,
143
- extensionDataList,
144
- ]).filterRemovedExtensions();
145
-
146
- // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data
147
- // TODO: remove this once we remove all direct access from legacy code to extensions data
148
- consumerComponent.extensions = extensionDataList;
149
-
150
- const state = new State(
151
- new Config(consumerComponent.mainFile, extensionDataList),
152
- await this.workspace.createAspectList(extensionDataList),
153
- ComponentFS.fromVinyls(consumerComponent.files),
154
- consumerComponent.dependencies,
155
- consumerComponent
156
- );
157
- if (componentFromScope) {
158
- // Removed by @gilad. do not mutate the component from the scope
159
- // componentFromScope.state = state;
160
- // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);
161
- const workspaceComponent = new WorkspaceComponent(
162
- componentFromScope.id,
163
- componentFromScope.head,
164
- state,
165
- componentFromScope.tags,
166
- this.workspace
167
- );
168
- return this.executeLoadSlot(workspaceComponent);
169
- }
170
- return this.executeLoadSlot(this.newComponentFromState(id, state));
171
- }
172
-
173
- private saveInCache(component: Component, forCapsule: boolean): void {
174
- if (forCapsule) {
175
- this.componentsCacheForCapsule.set(component.id.toString(), component);
176
- } else {
177
- this.componentsCache.set(component.id.toString(), component);
178
- }
179
- }
180
-
181
- /**
182
- * make sure that not only the id-str match, but also the legacy-id.
183
- * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has
184
- * scope-name, as it includes the defaultScope if the scope is empty.
185
- * as a result, when out-of-sync is happening and the id is changed to include scope-name in the
186
- * legacy-id, the component is the cache has the old id.
187
- */
188
- private getFromCache(id: ComponentID, forCapsule: boolean): Component | undefined {
189
- const fromCache = forCapsule
190
- ? this.componentsCacheForCapsule.get(id.toString())
191
- : this.componentsCache.get(id.toString());
192
- if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {
193
- return fromCache;
194
- }
195
- return undefined;
196
- }
197
-
198
- private async getConsumerComponent(id: ComponentID, forCapsule = false): Promise<ConsumerComponent | undefined> {
199
- try {
200
- return forCapsule
201
- ? // eslint-disable-next-line @typescript-eslint/return-await
202
- await this.workspace.consumer.loadComponentForCapsule(id._legacy)
203
- : // eslint-disable-next-line @typescript-eslint/return-await
204
- await this.workspace.consumer.loadComponent(id._legacy);
205
- } catch (err: any) {
206
- // don't return undefined for any error. otherwise, if the component is invalid (e.g. main
207
- // file is missing) it returns the model component later unexpectedly, or if it's new, it
208
- // shows MissingBitMapComponent error incorrectly.
209
- if (this.isComponentNotExistsError(err)) {
210
- this.logger.debug(
211
- `failed loading component "${id.toString()}" from the workspace due to "${err.name}" error\n${err.message}`
212
- );
213
- return undefined;
214
- }
215
- throw err;
216
- }
217
- }
218
-
219
- private isComponentNotExistsError(err: Error): boolean {
220
- return (
221
- err instanceof ComponentNotFound ||
222
- err instanceof MissingBitMapComponent ||
223
- err instanceof ComponentNotFoundInPath
224
- );
225
- }
226
-
227
- private async executeLoadSlot(component: Component) {
228
- const entries = this.workspace.onComponentLoadSlot.toArray();
229
- const promises = entries.map(async ([extension, onLoad]) => {
230
- const data = await onLoad(component);
231
- return this.upsertExtensionData(component, extension, data);
232
- });
233
-
234
- // Special load events which runs from the workspace but should run from the correct aspect
235
- // TODO: remove this once those extensions dependent on workspace
236
- const envsData = await this.workspace.getEnvSystemDescriptor(component);
237
-
238
- // Move to deps resolver main runtime once we switch ws<> deps resolver direction
239
- const policy = await this.dependencyResolver.mergeVariantPolicies(component.config.extensions);
240
- const dependencies = await this.dependencyResolver.extractDepsFromLegacy(component, policy);
241
-
242
- const depResolverData = {
243
- dependencies,
244
- policy: policy.serialize(),
245
- };
246
-
247
- promises.push(this.upsertExtensionData(component, EnvsAspect.id, envsData));
248
- promises.push(this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData));
249
-
250
- await Promise.all(promises);
251
-
252
- // Update the aspect list to have changes happened during the on load slot (new data added above)
253
- const updatedAspectList = await this.workspace.createAspectList(component.state.config.extensions);
254
- component.state.aspects = updatedAspectList;
255
- return component;
256
- }
257
-
258
- private newComponentFromState(id: ComponentID, state: State): Component {
259
- return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);
260
- }
261
-
262
- private async upsertExtensionData(component: Component, extension: string, data: any) {
263
- const existingExtension = component.state.config.extensions.findExtension(extension);
264
- if (existingExtension) {
265
- // Only merge top level of extension data
266
- Object.assign(existingExtension.data, data);
267
- return;
268
- }
269
- component.state.config.extensions.push(await this.getDataEntry(extension, data));
270
- }
271
-
272
- private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {
273
- // TODO: @gilad we need to refactor the extension data entry api.
274
- return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);
275
- }
276
- }
@@ -1,51 +0,0 @@
1
- import { Component, ComponentID, Snap, State, TagMap } from '@teambit/component';
2
- import { IssuesList } from '@teambit/component-issues';
3
- import { Workspace } from '../workspace';
4
- import { ComponentStatus } from './component-status';
5
-
6
- // TODO: refactor this to a composition rather than to use inheritance
7
- export class WorkspaceComponent extends Component {
8
- constructor(
9
- /**
10
- * component ID represented by the `ComponentId` type.
11
- */
12
- readonly id: ComponentID,
13
-
14
- /**
15
- * head version of the component. can be `null` for new components.
16
- */
17
- readonly head: Snap | null = null,
18
-
19
- /**
20
- * state of the component.
21
- */
22
- workspaceState: State,
23
-
24
- /**
25
- * tags of the component.
26
- */
27
- readonly tags: TagMap = new TagMap(),
28
-
29
- /**
30
- * workspace extension.
31
- */
32
- readonly workspace: Workspace
33
- ) {
34
- super(id, head, workspaceState, tags, workspace);
35
- }
36
-
37
- async getStatus(): Promise<ComponentStatus> {
38
- return this.workspace.getComponentStatus(this);
39
- }
40
-
41
- /**
42
- * get all issues reported on the component.
43
- */
44
- getIssues(): IssuesList | null {
45
- return this.workspace.getComponentIssues(this);
46
- }
47
-
48
- static fromComponent(component: Component, workspace: Workspace) {
49
- return new WorkspaceComponent(component.id, component.head, component.state, component.tags, workspace);
50
- }
51
- }
@@ -1,14 +0,0 @@
1
- // export class WorkspaceSection {
2
- // constructor(
3
- // readonly route: string
4
- // ) {}
5
-
6
- // toRoute() {
7
- // return {
8
- // path: this.toRoute
9
- // children:
10
- // };
11
- // }
12
- // };
13
-
14
- // export interface WorkspaceSection {}
@@ -1,9 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const WorkspaceAspect = Aspect.create({
4
- id: 'teambit.workspace/workspace',
5
- dependencies: [],
6
- defaultConfig: {},
7
- });
8
-
9
- export default WorkspaceAspect;
@@ -1,133 +0,0 @@
1
- import { GraphqlMain } from '@teambit/graphql';
2
- import gql from 'graphql-tag';
3
-
4
- import { ComponentAdded, ComponentChanged, ComponentRemoved, Workspace } from './workspace';
5
- import { WorkspaceComponent } from './workspace-component';
6
-
7
- export default (workspace: Workspace, graphql: GraphqlMain) => {
8
- return {
9
- typeDefs: gql`
10
- type ModifyInfo {
11
- # is the component modified.
12
- hasModifiedFiles: Boolean
13
-
14
- # the component has Modified Dependencies
15
- hasModifiedDependencies: Boolean
16
- }
17
-
18
- type ComponentStatus {
19
- # component is pending to be tagged automatically.
20
- modifyInfo: ModifyInfo
21
-
22
- # is the new component new.
23
- isNew: Boolean
24
-
25
- # is the component deleted from the workspace.
26
- isDeleted: Boolean
27
-
28
- # is the component staged.
29
- isStaged: Boolean
30
-
31
- # does the component exists in the workspace.
32
- isInWorkspace: Boolean
33
-
34
- # does the component exists in the scope.
35
- isInScope: Boolean
36
-
37
- # does the component is outdated (pending for update).
38
- isOutdated: Boolean
39
- }
40
-
41
- extend type Component {
42
- status: ComponentStatus
43
- }
44
-
45
- type Issue {
46
- type: String!
47
- description: String!
48
- solution: String
49
- data: String
50
- }
51
-
52
- extend type Component {
53
- # the count of errors in component in workspace
54
- issuesCount: Int
55
- issues: [Issue]
56
- }
57
-
58
- type Workspace {
59
- name: String
60
- path: String
61
- icon: String
62
- components(offset: Int, limit: Int): [Component]
63
- getComponent(id: String!): Component
64
- }
65
-
66
- type Subscription {
67
- componentAdded: ComponentAdded
68
- componentChanged: ComponentChanged
69
- componentRemoved: ComponentRemoved
70
- }
71
-
72
- type ComponentAdded {
73
- component: Component
74
- }
75
-
76
- type ComponentChanged {
77
- component: Component
78
- }
79
-
80
- type ComponentRemoved {
81
- componentIds: [ComponentID]
82
- }
83
-
84
- type Query {
85
- workspace: Workspace
86
- }
87
- `,
88
- resolvers: {
89
- Subscription: {
90
- componentAdded: {
91
- subscribe: () => graphql.pubsub.asyncIterator(ComponentAdded),
92
- },
93
- componentChanged: {
94
- subscribe: () => graphql.pubsub.asyncIterator(ComponentChanged),
95
- },
96
- componentRemoved: {
97
- subscribe: () => graphql.pubsub.asyncIterator(ComponentRemoved),
98
- },
99
- },
100
- Component: {
101
- status: async (wsComponent: WorkspaceComponent) => {
102
- return wsComponent.getStatus();
103
- },
104
- issuesCount: (wsComponent: WorkspaceComponent): number => {
105
- return wsComponent.getIssues()?.count || 0;
106
- },
107
- issues: (wsComponent: WorkspaceComponent) => {
108
- return wsComponent.getIssues()?.toObjectWithDataAsString();
109
- },
110
- },
111
- Workspace: {
112
- path: (ws) => ws.path,
113
- name: (ws) => ws.name,
114
- icon: (ws) => ws.icon,
115
- components: async (ws: Workspace, { offset, limit }: { offset: number; limit: number }) => {
116
- return ws.list({ offset, limit });
117
- },
118
- getComponent: async (ws: Workspace, { id }: { id: string }) => {
119
- try {
120
- const componentID = await ws.resolveComponentId(id);
121
- const component = await ws.get(componentID);
122
- return component;
123
- } catch (error: any) {
124
- return null;
125
- }
126
- },
127
- },
128
- Query: {
129
- workspace: () => workspace,
130
- },
131
- },
132
- };
133
- };
@@ -1,50 +0,0 @@
1
- import { PubsubAspect } from '@teambit/pubsub';
2
- import { AspectLoaderAspect } from '@teambit/aspect-loader';
3
- import { BundlerAspect } from '@teambit/bundler';
4
- import { CLIAspect, MainRuntime } from '@teambit/cli';
5
- import { ComponentAspect } from '@teambit/component';
6
- import { DependencyResolverAspect } from '@teambit/dependency-resolver';
7
- import { EnvsAspect } from '@teambit/envs';
8
- import { GraphqlAspect } from '@teambit/graphql';
9
- import { Slot } from '@teambit/harmony';
10
- import { IsolatorAspect } from '@teambit/isolator';
11
- import { LoggerAspect } from '@teambit/logger';
12
- import { ScopeAspect } from '@teambit/scope';
13
- import { UIAspect } from '@teambit/ui';
14
- import { VariantsAspect } from '@teambit/variants';
15
-
16
- import { EXT_NAME } from './constants';
17
- import { OnComponentAdd, OnComponentChange, OnComponentRemove, OnComponentLoad } from './on-component-events';
18
- import { WorkspaceAspect } from './workspace.aspect';
19
- import workspaceProvider, { OnPreWatch } from './workspace.provider';
20
-
21
- export const WorkspaceMain = {
22
- name: EXT_NAME,
23
- runtime: MainRuntime,
24
- dependencies: [
25
- PubsubAspect,
26
- CLIAspect,
27
- ScopeAspect,
28
- ComponentAspect,
29
- IsolatorAspect,
30
- DependencyResolverAspect,
31
- VariantsAspect,
32
- LoggerAspect,
33
- GraphqlAspect,
34
- UIAspect,
35
- BundlerAspect,
36
- AspectLoaderAspect,
37
- EnvsAspect,
38
- ],
39
- slots: [
40
- Slot.withType<OnComponentLoad>(),
41
- Slot.withType<OnComponentChange>(),
42
- Slot.withType<OnComponentAdd>(),
43
- Slot.withType<OnComponentRemove>(),
44
- Slot.withType<OnPreWatch>(),
45
- ],
46
- provider: workspaceProvider,
47
- defineRuntime: 'browser',
48
- };
49
-
50
- WorkspaceAspect.addRuntime(WorkspaceMain);