@teambit/workspace 0.0.988 → 0.0.990

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 (40) hide show
  1. package/dist/index.d.ts +0 -2
  2. package/dist/index.js +0 -14
  3. package/dist/index.js.map +1 -1
  4. package/dist/on-component-events.d.ts +0 -1
  5. package/dist/on-component-events.js.map +1 -1
  6. package/dist/{preview-1676604673087.js → preview-1676811569495.js} +2 -2
  7. package/dist/workspace.d.ts +4 -14
  8. package/dist/workspace.js +5 -35
  9. package/dist/workspace.js.map +1 -1
  10. package/dist/workspace.main.runtime.d.ts +2 -2
  11. package/dist/workspace.main.runtime.js +1 -1
  12. package/dist/workspace.main.runtime.js.map +1 -1
  13. package/dist/workspace.provider.d.ts +4 -10
  14. package/dist/workspace.provider.js +3 -18
  15. package/dist/workspace.provider.js.map +1 -1
  16. package/package-tar/teambit-workspace-0.0.990.tgz +0 -0
  17. package/package.json +38 -41
  18. package/dist/watch/REFACTOR_GUIDE.md +0 -12
  19. package/dist/watch/check-types.d.ts +0 -5
  20. package/dist/watch/check-types.js +0 -15
  21. package/dist/watch/check-types.js.map +0 -1
  22. package/dist/watch/output-formatter.d.ts +0 -9
  23. package/dist/watch/output-formatter.js +0 -54
  24. package/dist/watch/output-formatter.js.map +0 -1
  25. package/dist/watch/watch-queue.d.ts +0 -8
  26. package/dist/watch/watch-queue.js +0 -44
  27. package/dist/watch/watch-queue.js.map +0 -1
  28. package/dist/watch/watch.cmd.d.ts +0 -55
  29. package/dist/watch/watch.cmd.js +0 -173
  30. package/dist/watch/watch.cmd.js.map +0 -1
  31. package/dist/watch/watcher.d.ts +0 -108
  32. package/dist/watch/watcher.js +0 -461
  33. package/dist/watch/watcher.js.map +0 -1
  34. package/package-tar/teambit-workspace-0.0.988.tgz +0 -0
  35. package/watch/REFACTOR_GUIDE.md +0 -12
  36. package/watch/check-types.ts +0 -5
  37. package/watch/output-formatter.ts +0 -50
  38. package/watch/watch-queue.ts +0 -17
  39. package/watch/watch.cmd.tsx +0 -162
  40. package/watch/watcher.ts +0 -409
package/dist/index.d.ts CHANGED
@@ -3,8 +3,6 @@ export type { default as Workspace, ExtensionsOrigin } from './workspace';
3
3
  export type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';
4
4
  export type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';
5
5
  export type { WorkspaceMain } from './workspace.main.runtime';
6
- export type { WatchOptions } from './watch/watcher';
7
- export { CheckTypes } from './watch/check-types';
8
6
  export * from './events';
9
7
  export type { WorkspaceUI } from './workspace.ui.runtime';
10
8
  export type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';
package/dist/index.js CHANGED
@@ -5,19 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  WorkspaceAspect: true,
8
- CheckTypes: true,
9
8
  ComponentStatus: true,
10
9
  WorkspaceModelComponent: true,
11
10
  WorkspaceModel: true,
12
11
  WorkspaceContext: true,
13
12
  OutsideWorkspaceError: true
14
13
  };
15
- Object.defineProperty(exports, "CheckTypes", {
16
- enumerable: true,
17
- get: function () {
18
- return _checkTypes().CheckTypes;
19
- }
20
- });
21
14
  Object.defineProperty(exports, "ComponentStatus", {
22
15
  enumerable: true,
23
16
  get: function () {
@@ -62,13 +55,6 @@ function _workspace() {
62
55
  };
63
56
  return data;
64
57
  }
65
- function _checkTypes() {
66
- const data = require("./watch/check-types");
67
- _checkTypes = function () {
68
- return data;
69
- };
70
- return data;
71
- }
72
58
  var _events = require("./events");
73
59
  Object.keys(_events).forEach(function (key) {
74
60
  if (key === "default" || key === "__esModule") return;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["WorkspaceAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceAspect } from './workspace.aspect';\n// eslint-disable-next-line import/prefer-default-export\nexport type { default as Workspace, ExtensionsOrigin } from './workspace';\n// TODO: change to module path once track the utils folder\nexport type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';\nexport type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';\nexport type { WorkspaceMain } from './workspace.main.runtime';\nexport type { WatchOptions } from './watch/watcher';\nexport { CheckTypes } from './watch/check-types';\nexport * from './events';\nexport type { WorkspaceUI } from './workspace.ui.runtime';\nexport type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';\nexport { ComponentStatus } from './workspace-component';\nexport { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';\nexport { WorkspaceContext } from './ui/workspace/workspace-context';\nexport { OutsideWorkspaceError } from './exceptions/outside-workspace';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\n\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuE,eAKxDA,4BAAe;AAAA"}
1
+ {"version":3,"names":["WorkspaceAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceAspect } from './workspace.aspect';\n// eslint-disable-next-line import/prefer-default-export\nexport type { default as Workspace, ExtensionsOrigin } from './workspace';\n// TODO: change to module path once track the utils folder\nexport type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';\nexport type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';\nexport type { WorkspaceMain } from './workspace.main.runtime';\nexport * from './events';\nexport type { WorkspaceUI } from './workspace.ui.runtime';\nexport type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';\nexport { ComponentStatus } from './workspace-component';\nexport { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';\nexport { WorkspaceContext } from './ui/workspace/workspace-context';\nexport { OutsideWorkspaceError } from './exceptions/outside-workspace';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\n\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuE,eAKxDA,4BAAe;AAAA"}
@@ -12,5 +12,4 @@ export declare type OnComponentEventResult = {
12
12
  extensionId: string;
13
13
  results: SerializableResults;
14
14
  };
15
- export declare type OnMultipleComponentsAdd = () => Promise<void>;
16
15
  export declare type OnComponentLoad = (component: Component, loadOpts?: ComponentLoadOptions) => Promise<AspectData | undefined>;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["on-component-events.ts"],"sourcesContent":["import { Component, ComponentID, AspectData } from '@teambit/component';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\n\nexport type SerializableResults = { results: any; toString: () => string };\nexport type OnComponentChange = (\n component: Component,\n files: string[],\n initiator?: CompilationInitiator\n) => Promise<SerializableResults>;\nexport type OnComponentAdd = (component: Component, files: string[]) => Promise<SerializableResults>;\nexport type OnComponentRemove = (componentId: ComponentID) => Promise<SerializableResults>;\nexport type OnComponentEventResult = { extensionId: string; results: SerializableResults };\nexport type OnMultipleComponentsAdd = () => Promise<void>;\n\nexport type OnComponentLoad = (\n component: Component,\n loadOpts?: ComponentLoadOptions\n) => Promise<AspectData | undefined>;\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["on-component-events.ts"],"sourcesContent":["import { Component, ComponentID, AspectData } from '@teambit/component';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\n\nexport type SerializableResults = { results: any; toString: () => string };\nexport type OnComponentChange = (\n component: Component,\n files: string[],\n initiator?: CompilationInitiator\n) => Promise<SerializableResults>;\nexport type OnComponentAdd = (component: Component, files: string[]) => Promise<SerializableResults>;\nexport type OnComponentRemove = (componentId: ComponentID) => Promise<SerializableResults>;\nexport type OnComponentEventResult = { extensionId: string; results: SerializableResults };\n\nexport type OnComponentLoad = (\n component: Component,\n loadOpts?: ComponentLoadOptions\n) => Promise<AspectData | undefined>;\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.988/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.988/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.990/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.990/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -26,11 +26,10 @@ import { CompilationInitiator } from '@teambit/compiler';
26
26
  import { Lane } from '@teambit/legacy/dist/scope/models';
27
27
  import { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';
28
28
  import { ComponentConfigFile } from './component-config-file';
29
- import { OnComponentAdd, OnComponentChange, OnComponentEventResult, OnComponentLoad, OnComponentRemove, OnMultipleComponentsAdd } from './on-component-events';
29
+ import { OnComponentAdd, OnComponentChange, OnComponentEventResult, OnComponentLoad, OnComponentRemove } from './on-component-events';
30
30
  import { WorkspaceExtConfig } from './types';
31
- import { Watcher, WatchOptions } from './watch/watcher';
32
31
  import { ComponentStatus } from './workspace-component/component-status';
33
- import { OnComponentAddSlot, OnComponentChangeSlot, OnComponentLoadSlot, OnComponentRemoveSlot, OnMultipleComponentsAddSlot, OnPreWatch, OnPreWatchSlot } from './workspace.provider';
32
+ import { OnComponentAddSlot, OnComponentChangeSlot, OnComponentLoadSlot, OnComponentRemoveSlot } from './workspace.provider';
34
33
  import { WorkspaceComponentLoader } from './workspace-component/workspace-component-loader';
35
34
  import { ShouldLoadFunc } from './build-graph-from-fs';
36
35
  import { BitMap } from './bit-map';
@@ -91,8 +90,6 @@ export declare class Workspace implements ComponentFactory {
91
90
  */
92
91
  private onComponentAddSlot;
93
92
  private onComponentRemoveSlot;
94
- private onMultipleComponentsAddSlot;
95
- private onPreWatchSlot;
96
93
  private graphql;
97
94
  priority: boolean;
98
95
  owner?: string;
@@ -134,12 +131,8 @@ export declare class Workspace implements ComponentFactory {
134
131
  /**
135
132
  * on component add slot.
136
133
  */
137
- onComponentAddSlot: OnComponentAddSlot, onComponentRemoveSlot: OnComponentRemoveSlot, onMultipleComponentsAddSlot: OnMultipleComponentsAddSlot, onPreWatchSlot: OnPreWatchSlot, graphql: GraphqlMain);
134
+ onComponentAddSlot: OnComponentAddSlot, onComponentRemoveSlot: OnComponentRemoveSlot, graphql: GraphqlMain);
138
135
  private validateConfig;
139
- /**
140
- * watcher api.
141
- */
142
- readonly watcher: Watcher;
143
136
  /**
144
137
  * root path of the Workspace.
145
138
  */
@@ -150,9 +143,7 @@ export declare class Workspace implements ComponentFactory {
150
143
  onComponentLoad(loadFn: OnComponentLoad): this;
151
144
  registerOnComponentChange(onComponentChangeFunc: OnComponentChange): this;
152
145
  registerOnComponentAdd(onComponentAddFunc: OnComponentAdd): this;
153
- registerOnMultipleComponentsAdd(onMultipleComponentsAddFunc: OnMultipleComponentsAdd): this;
154
146
  registerOnComponentRemove(onComponentRemoveFunc: OnComponentRemove): this;
155
- registerOnPreWatch(onPreWatchFunc: OnPreWatch): this;
156
147
  /**
157
148
  * name of the workspace as configured in either `workspace.json`.
158
149
  * defaults to workspace root directory name.
@@ -235,7 +226,6 @@ export declare class Workspace implements ComponentFactory {
235
226
  triggerOnComponentChange(id: ComponentID, files: string[], initiator?: CompilationInitiator): Promise<OnComponentEventResult[]>;
236
227
  triggerOnComponentAdd(id: ComponentID): Promise<OnComponentEventResult[]>;
237
228
  triggerOnComponentRemove(id: ComponentID): Promise<OnComponentEventResult[]>;
238
- triggerOnMultipleComponentsAdd(): Promise<void>;
239
229
  getState(id: ComponentID, hash: string): Promise<import("@teambit/component").State>;
240
230
  getSnap(id: ComponentID, hash: string): Promise<import("@teambit/component").Snap>;
241
231
  getCurrentLaneId(): LaneId;
@@ -312,6 +302,7 @@ export declare class Workspace implements ComponentFactory {
312
302
  componentPackageDir(component: Component, options?: {
313
303
  relative: boolean;
314
304
  }): string;
305
+ componentPackageName(component: Component): string;
315
306
  private componentDirFromLegacyId;
316
307
  componentDirToAbsolute(relativeComponentDir: PathOsBasedRelative): PathOsBasedAbsolute;
317
308
  componentDefaultScope(componentId: ComponentID): Promise<string | undefined>;
@@ -341,7 +332,6 @@ export declare class Workspace implements ComponentFactory {
341
332
  listComponentsDuringMerge(): Promise<ComponentID[]>;
342
333
  getUnmergedComponent(componentId: ComponentID): Promise<Component | undefined>;
343
334
  isModified(component: Component): Promise<boolean>;
344
- triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions): Promise<void>;
345
335
  /**
346
336
  * filter the given component-ids and set default-scope only to the new ones.
347
337
  * returns the affected components.
package/dist/workspace.js CHANGED
@@ -263,13 +263,6 @@ function _componentConfigFile() {
263
263
  };
264
264
  return data;
265
265
  }
266
- function _watcher() {
267
- const data = require("./watch/watcher");
268
- _watcher = function () {
269
- return data;
270
- };
271
- return data;
272
- }
273
266
  function _componentStatus() {
274
267
  const data = require("./workspace-component/component-status");
275
268
  _componentStatus = function () {
@@ -369,7 +362,7 @@ class Workspace {
369
362
  /**
370
363
  * on component add slot.
371
364
  */
372
- onComponentAddSlot, onComponentRemoveSlot, onMultipleComponentsAddSlot, onPreWatchSlot, graphql) {
365
+ onComponentAddSlot, onComponentRemoveSlot, graphql) {
373
366
  var _this$config;
374
367
  this.pubsub = pubsub;
375
368
  this.config = config;
@@ -387,8 +380,6 @@ class Workspace {
387
380
  this.envs = envs;
388
381
  this.onComponentAddSlot = onComponentAddSlot;
389
382
  this.onComponentRemoveSlot = onComponentRemoveSlot;
390
- this.onMultipleComponentsAddSlot = onMultipleComponentsAddSlot;
391
- this.onPreWatchSlot = onPreWatchSlot;
392
383
  this.graphql = graphql;
393
384
  (0, _defineProperty2().default)(this, "priority", true);
394
385
  (0, _defineProperty2().default)(this, "owner", void 0);
@@ -398,7 +389,6 @@ class Workspace {
398
389
  (0, _defineProperty2().default)(this, "_cachedListIds", void 0);
399
390
  (0, _defineProperty2().default)(this, "componentLoadedSelfAsAspects", void 0);
400
391
  (0, _defineProperty2().default)(this, "aspectsMerger", void 0);
401
- (0, _defineProperty2().default)(this, "watcher", new (_watcher().Watcher)(this, this.pubsub));
402
392
  this.componentLoadedSelfAsAspects = (0, _cacheFactory().createInMemoryCache)({
403
393
  maxSize: (0, _inMemoryCache().getMaxSizeForComponents)()
404
394
  });
@@ -425,10 +415,6 @@ class Workspace {
425
415
  if (!(0, _legacyBitId().isValidScopeName)(defaultScope)) throw new (_legacyBitId().InvalidScopeName)(defaultScope);
426
416
  }
427
417
 
428
- /**
429
- * watcher api.
430
- */
431
-
432
418
  /**
433
419
  * root path of the Workspace.
434
420
  */
@@ -455,18 +441,10 @@ class Workspace {
455
441
  this.onComponentAddSlot.register(onComponentAddFunc);
456
442
  return this;
457
443
  }
458
- registerOnMultipleComponentsAdd(onMultipleComponentsAddFunc) {
459
- this.onMultipleComponentsAddSlot.register(onMultipleComponentsAddFunc);
460
- return this;
461
- }
462
444
  registerOnComponentRemove(onComponentRemoveFunc) {
463
445
  this.onComponentRemoveSlot.register(onComponentRemoveFunc);
464
446
  return this;
465
447
  }
466
- registerOnPreWatch(onPreWatchFunc) {
467
- this.onPreWatchSlot.register(onPreWatchFunc);
468
- return this;
469
- }
470
448
 
471
449
  /**
472
450
  * name of the workspace as configured in either `workspace.json`.
@@ -818,10 +796,6 @@ class Workspace {
818
796
  });
819
797
  return results;
820
798
  }
821
- async triggerOnMultipleComponentsAdd() {
822
- const onAddEntries = this.onMultipleComponentsAddSlot.toArray();
823
- await (0, _pMapSeries().default)(onAddEntries, async ([, onAddFunc]) => onAddFunc());
824
- }
825
799
  getState(id, hash) {
826
800
  return this.scope.getState(id, hash);
827
801
  }
@@ -1093,10 +1067,13 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1093
1067
  componentPackageDir(component, options = {
1094
1068
  relative: false
1095
1069
  }) {
1096
- const packageName = (0, _componentIdToPackageName().default)(component.state._consumer);
1070
+ const packageName = this.componentPackageName(component);
1097
1071
  const packageDir = _path2().default.join('node_modules', packageName);
1098
1072
  return options.relative ? packageDir : this.consumer.toAbsolutePath(packageDir);
1099
1073
  }
1074
+ componentPackageName(component) {
1075
+ return (0, _componentIdToPackageName().default)(component.state._consumer);
1076
+ }
1100
1077
  componentDirFromLegacyId(bitId, bitMapOptions, options = {
1101
1078
  relative: false
1102
1079
  }) {
@@ -1191,13 +1168,6 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1191
1168
  const componentStatus = await this.consumer.getComponentStatusById(component.id._legacy);
1192
1169
  return componentStatus.modified === true;
1193
1170
  }
1194
- async triggerOnPreWatch(componentIds, watchOpts) {
1195
- const components = await this.getMany(componentIds);
1196
- const preWatchFunctions = this.onPreWatchSlot.values();
1197
- await (0, _pMapSeries().default)(preWatchFunctions, async func => {
1198
- await func(components, watchOpts);
1199
- });
1200
- }
1201
1171
 
1202
1172
  /**
1203
1173
  * filter the given component-ids and set default-scope only to the new ones.