@teambit/watcher 0.0.116 → 0.0.117

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.
@@ -1,5 +1,6 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
2
  import { SlotRegistry } from '@teambit/harmony';
3
+ import { ScopeMain } from '@teambit/scope';
3
4
  import { Component } from '@teambit/component';
4
5
  import { ComponentID } from '@teambit/component-id';
5
6
  import { LoggerMain } from '@teambit/logger';
@@ -10,15 +11,17 @@ export declare type OnPreWatch = (components: Component[], watchOpts: WatchOptio
10
11
  export declare type OnPreWatchSlot = SlotRegistry<OnPreWatch>;
11
12
  export declare class WatcherMain {
12
13
  private workspace;
14
+ private scope;
13
15
  private pubsub;
14
16
  private onPreWatchSlot;
15
- constructor(workspace: Workspace, pubsub: PubsubMain, onPreWatchSlot: OnPreWatchSlot);
17
+ constructor(workspace: Workspace, scope: ScopeMain, pubsub: PubsubMain, onPreWatchSlot: OnPreWatchSlot);
16
18
  watch(opts: WatchOptions): Promise<void>;
19
+ watchScopeInternalFiles(): Promise<void>;
17
20
  triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions): Promise<void>;
18
21
  registerOnPreWatch(onPreWatchFunc: OnPreWatch): this;
19
22
  static slots: ((registerFn: () => string) => SlotRegistry<OnPreWatch>)[];
20
23
  static dependencies: import("@teambit/harmony").Aspect[];
21
24
  static runtime: import("@teambit/harmony").RuntimeDefinition;
22
- static provider([cli, workspace, pubsub, loggerMain]: [CLIMain, Workspace, PubsubMain, LoggerMain], _: any, [onPreWatchSlot]: [OnPreWatchSlot]): Promise<WatcherMain>;
25
+ static provider([cli, workspace, scope, pubsub, loggerMain]: [CLIMain, Workspace, ScopeMain, PubsubMain, LoggerMain], _: any, [onPreWatchSlot]: [OnPreWatchSlot]): Promise<WatcherMain>;
23
26
  }
24
27
  export default WatcherMain;
@@ -28,6 +28,13 @@ function _harmony() {
28
28
  };
29
29
  return data;
30
30
  }
31
+ function _scope() {
32
+ const data = _interopRequireDefault(require("@teambit/scope"));
33
+ _scope = function () {
34
+ return data;
35
+ };
36
+ return data;
37
+ }
31
38
  function _logger() {
32
39
  const data = require("@teambit/logger");
33
40
  _logger = function () {
@@ -78,8 +85,9 @@ function _watcher2() {
78
85
  return data;
79
86
  }
80
87
  class WatcherMain {
81
- constructor(workspace, pubsub, onPreWatchSlot) {
88
+ constructor(workspace, scope, pubsub, onPreWatchSlot) {
82
89
  this.workspace = workspace;
90
+ this.scope = scope;
83
91
  this.pubsub = pubsub;
84
92
  this.onPreWatchSlot = onPreWatchSlot;
85
93
  }
@@ -87,6 +95,9 @@ class WatcherMain {
87
95
  const watcher = new (_watcher().Watcher)(this.workspace, this.pubsub, this);
88
96
  await watcher.watchAll(opts);
89
97
  }
98
+ async watchScopeInternalFiles() {
99
+ await this.scope.watchScopeInternalFiles();
100
+ }
90
101
  async triggerOnPreWatch(componentIds, watchOpts) {
91
102
  const components = await this.workspace.getMany(componentIds);
92
103
  const preWatchFunctions = this.onPreWatchSlot.values();
@@ -98,9 +109,9 @@ class WatcherMain {
98
109
  this.onPreWatchSlot.register(onPreWatchFunc);
99
110
  return this;
100
111
  }
101
- static async provider([cli, workspace, pubsub, loggerMain], _, [onPreWatchSlot]) {
112
+ static async provider([cli, workspace, scope, pubsub, loggerMain], _, [onPreWatchSlot]) {
102
113
  const logger = loggerMain.createLogger(_watcher2().WatcherAspect.id);
103
- const watcherMain = new WatcherMain(workspace, pubsub, onPreWatchSlot);
114
+ const watcherMain = new WatcherMain(workspace, scope, pubsub, onPreWatchSlot);
104
115
  const watchCmd = new (_watch().WatchCommand)(pubsub, logger, watcherMain);
105
116
  cli.register(watchCmd);
106
117
  return watcherMain;
@@ -108,7 +119,7 @@ class WatcherMain {
108
119
  }
109
120
  exports.WatcherMain = WatcherMain;
110
121
  (0, _defineProperty2().default)(WatcherMain, "slots", [_harmony().Slot.withType()]);
111
- (0, _defineProperty2().default)(WatcherMain, "dependencies", [_cli().CLIAspect, _workspace().default, _pubsub().PubsubAspect, _logger().LoggerAspect]);
122
+ (0, _defineProperty2().default)(WatcherMain, "dependencies", [_cli().CLIAspect, _workspace().default, _scope().default, _pubsub().PubsubAspect, _logger().LoggerAspect]);
112
123
  (0, _defineProperty2().default)(WatcherMain, "runtime", _cli().MainRuntime);
113
124
  _watcher2().WatcherAspect.addRuntime(WatcherMain);
114
125
  var _default = WatcherMain;
@@ -1 +1 @@
1
- {"version":3,"names":["WatcherMain","constructor","workspace","pubsub","onPreWatchSlot","watch","opts","watcher","Watcher","watchAll","triggerOnPreWatch","componentIds","watchOpts","components","getMany","preWatchFunctions","values","pMapSeries","func","registerOnPreWatch","onPreWatchFunc","register","provider","cli","loggerMain","_","logger","createLogger","WatcherAspect","id","watcherMain","watchCmd","WatchCommand","Slot","withType","CLIAspect","WorkspaceAspect","PubsubAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["watcher.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport { Component } from '@teambit/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { WatchCommand } from './watch.cmd';\nimport { Watcher, WatchOptions } from './watcher';\nimport { WatcherAspect } from './watcher.aspect';\n\nexport type OnPreWatch = (components: Component[], watchOpts: WatchOptions) => Promise<void>;\nexport type OnPreWatchSlot = SlotRegistry<OnPreWatch>;\n\nexport class WatcherMain {\n constructor(private workspace: Workspace, private pubsub: PubsubMain, private onPreWatchSlot: OnPreWatchSlot) {}\n\n async watch(opts: WatchOptions) {\n const watcher = new Watcher(this.workspace, this.pubsub, this);\n await watcher.watchAll(opts);\n }\n\n async triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n const components = await this.workspace.getMany(componentIds);\n const preWatchFunctions = this.onPreWatchSlot.values();\n await pMapSeries(preWatchFunctions, async (func) => {\n await func(components, watchOpts);\n });\n }\n\n registerOnPreWatch(onPreWatchFunc: OnPreWatch) {\n this.onPreWatchSlot.register(onPreWatchFunc);\n return this;\n }\n\n static slots = [Slot.withType<OnPreWatch>()];\n static dependencies = [CLIAspect, WorkspaceAspect, PubsubAspect, LoggerAspect];\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, pubsub, loggerMain]: [CLIMain, Workspace, PubsubMain, LoggerMain],\n _,\n [onPreWatchSlot]: [OnPreWatchSlot]\n ) {\n const logger = loggerMain.createLogger(WatcherAspect.id);\n const watcherMain = new WatcherMain(workspace, pubsub, onPreWatchSlot);\n const watchCmd = new WatchCommand(pubsub, logger, watcherMain);\n cli.register(watchCmd);\n return watcherMain;\n }\n}\n\nWatcherAspect.addRuntime(WatcherMain);\n\nexport default WatcherMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,WAAW,CAAC;EACvBC,WAAW,CAASC,SAAoB,EAAUC,MAAkB,EAAUC,cAA8B,EAAE;IAAA,KAA1FF,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,MAAkB,GAAlBA,MAAkB;IAAA,KAAUC,cAA8B,GAA9BA,cAA8B;EAAG;EAE/G,MAAMC,KAAK,CAACC,IAAkB,E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Y,EAAEC,sBAAY,CAAC;AAAA,gCAtBnEtC,WAAW,aAuBLuC,kBAAW;AAe9BX,yBAAa,CAACY,UAAU,CAACxC,WAAW,CAAC;AAAC,eAEvBA,WAAW;AAAA"}
1
+ {"version":3,"names":["WatcherMain","constructor","workspace","scope","pubsub","onPreWatchSlot","watch","opts","watcher","Watcher","watchAll","watchScopeInternalFiles","triggerOnPreWatch","componentIds","watchOpts","components","getMany","preWatchFunctions","values","pMapSeries","func","registerOnPreWatch","onPreWatchFunc","register","provider","cli","loggerMain","_","logger","createLogger","WatcherAspect","id","watcherMain","watchCmd","WatchCommand","Slot","withType","CLIAspect","WorkspaceAspect","ScopeAspect","PubsubAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["watcher.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport ScopeAspect, { ScopeMain } from '@teambit/scope';\nimport { Component } from '@teambit/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { WatchCommand } from './watch.cmd';\nimport { Watcher, WatchOptions } from './watcher';\nimport { WatcherAspect } from './watcher.aspect';\n\nexport type OnPreWatch = (components: Component[], watchOpts: WatchOptions) => Promise<void>;\nexport type OnPreWatchSlot = SlotRegistry<OnPreWatch>;\n\nexport class WatcherMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private pubsub: PubsubMain,\n private onPreWatchSlot: OnPreWatchSlot\n ) {}\n\n async watch(opts: WatchOptions) {\n const watcher = new Watcher(this.workspace, this.pubsub, this);\n await watcher.watchAll(opts);\n }\n\n async watchScopeInternalFiles() {\n await this.scope.watchScopeInternalFiles();\n }\n\n async triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n const components = await this.workspace.getMany(componentIds);\n const preWatchFunctions = this.onPreWatchSlot.values();\n await pMapSeries(preWatchFunctions, async (func) => {\n await func(components, watchOpts);\n });\n }\n\n registerOnPreWatch(onPreWatchFunc: OnPreWatch) {\n this.onPreWatchSlot.register(onPreWatchFunc);\n return this;\n }\n\n static slots = [Slot.withType<OnPreWatch>()];\n static dependencies = [CLIAspect, WorkspaceAspect, ScopeAspect, PubsubAspect, LoggerAspect];\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, scope, pubsub, loggerMain]: [CLIMain, Workspace, ScopeMain, PubsubMain, LoggerMain],\n _,\n [onPreWatchSlot]: [OnPreWatchSlot]\n ) {\n const logger = loggerMain.createLogger(WatcherAspect.id);\n const watcherMain = new WatcherMain(workspace, scope, pubsub, onPreWatchSlot);\n const watchCmd = new WatchCommand(pubsub, logger, watcherMain);\n cli.register(watchCmd);\n return watcherMain;\n }\n}\n\nWatcherAspect.addRuntime(WatcherMain);\n\nexport default WatcherMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,WAAW,CAAC;EACvBC,WAAW,CACDC,SAAoB,EACpBC,KAAgB,EAChBC,MAAkB,EAClBC,cAA8B,EACtC;IAAA,KAJQH,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,KAAgB,GAAhBA,KAA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WAAW,CAAC;IAC9DP,GAAG,CAACF,QAAQ,CAACU,QAAQ,CAAC;IACtB,OAAOD,WAAW;EACpB;AACF;AAAC;AAAA,gCA7CYhC,WAAW,WA8BP,CAACmC,eAAI,CAACC,QAAQ,EAAc,CAAC;AAAA,gCA9BjCpC,WAAW,kBA+BA,CAACqC,gBAAS,EAAEC,oBAAe,EAAEC,gBAAW,EAAEC,sBAAY,EAAEC,sBAAY,CAAC;AAAA,gCA/BhFzC,WAAW,aAgCL0C,kBAAW;AAe9BZ,yBAAa,CAACa,UAAU,CAAC3C,WAAW,CAAC;AAAC,eAEvBA,WAAW;AAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/watcher",
3
- "version": "0.0.116",
3
+ "version": "0.0.117",
4
4
  "homepage": "https://bit.cloud/teambit/workspace/watcher",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "watcher",
9
- "version": "0.0.116"
9
+ "version": "0.0.117"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -21,12 +21,13 @@
21
21
  "@teambit/harmony": "0.4.6",
22
22
  "@teambit/component-id": "0.0.427",
23
23
  "@teambit/legacy-bit-id": "0.0.423",
24
- "@teambit/workspace": "0.0.1104",
24
+ "@teambit/workspace": "0.0.1105",
25
25
  "@teambit/cli": "0.0.740",
26
- "@teambit/compiler": "0.0.1104",
26
+ "@teambit/compiler": "0.0.1105",
27
27
  "@teambit/logger": "0.0.833",
28
- "@teambit/pubsub": "0.0.1104",
29
- "@teambit/component": "0.0.1104"
28
+ "@teambit/pubsub": "0.0.1105",
29
+ "@teambit/component": "0.0.1105",
30
+ "@teambit/scope": "0.0.1105"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@types/fs-extra": "9.0.7",