@teambit/watcher 1.0.588 → 1.0.592

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.
@@ -46,6 +46,6 @@ export declare class WatchCommand implements Command {
46
46
  watcher: WatcherMain);
47
47
  private registerToEvents;
48
48
  private eventsListener;
49
- report(cliArgs: [], watchCmdOpts: WatchCmdOpts): Promise<string>;
49
+ wait(cliArgs: [], watchCmdOpts: WatchCmdOpts): Promise<void>;
50
50
  }
51
51
  export {};
package/dist/watch.cmd.js CHANGED
@@ -88,7 +88,7 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
88
88
  registerToEvents() {
89
89
  this.pubsub.sub(_compiler().CompilerAspect.id, this.eventsListener);
90
90
  }
91
- async report(cliArgs, watchCmdOpts) {
91
+ async wait(cliArgs, watchCmdOpts) {
92
92
  const {
93
93
  verbose,
94
94
  checkTypes,
@@ -115,7 +115,6 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
115
115
  }
116
116
  };
117
117
  const watchOpts = {
118
- msgs: getMessages(this.logger),
119
118
  verbose,
120
119
  compile: true,
121
120
  preCompile: !watchCmdOpts.skipPreCompilation,
@@ -126,8 +125,7 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
126
125
  trigger: trigger ? _componentId().ComponentID.fromString(trigger) : undefined,
127
126
  generateTypes: watchCmdOpts.generateTypes
128
127
  };
129
- await this.watcher.watch(watchOpts);
130
- return 'watcher terminated';
128
+ await this.watcher.watch(watchOpts, getMessages(this.logger));
131
129
  }
132
130
  }
133
131
  exports.WatchCommand = WatchCommand;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_moment","_componentId","_compiler","_outputFormatter","_checkTypes","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WatchCommand","constructor","pubsub","logger","watcher","event","type","CompilerErrorEvent","TYPE","console","error","registerToEvents","sub","CompilerAspect","id","eventsListener","report","cliArgs","watchCmdOpts","verbose","checkTypes","import","importIfNeeded","skipImport","trigger","consoleWarning","getCheckTypesEnum","undefined","CheckTypes","None","EntireProject","ChangedFile","Error","watchOpts","msgs","getMessages","compile","preCompile","skipPreCompilation","spawnTSServer","Boolean","ComponentID","fromString","generateTypes","watch","exports","onAll","path","onStart","onReady","workspace","watchPathsSortByComponent","clearOutdatedData","formatWatchPathsSortByComponent","chalk","yellow","name","moment","format","onChange","args","printOnFileEvent","onAdd","onUnlink","onError","err","eventMsgPlaceholder","filePaths","buildResults","duration","failureMsg","files","join","length","formatCompileResults","process","stdout","write"],"sources":["watch.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport moment from 'moment';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { BitBaseEvent, PubsubMain } from '@teambit/pubsub';\nimport { OnComponentEventResult, Workspace } from '@teambit/workspace';\nimport { ComponentID } from '@teambit/component-id';\nimport { CompilerAspect, CompilerErrorEvent } from '@teambit/compiler';\nimport { EventMessages, RootDirs, WatchOptions } from './watcher';\nimport { formatCompileResults, formatWatchPathsSortByComponent } from './output-formatter';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\n\ntype WatchCmdOpts = {\n verbose?: boolean;\n skipPreCompilation?: boolean;\n checkTypes?: string | boolean;\n import?: boolean;\n skipImport?: boolean;\n generateTypes?: boolean;\n trigger?: string;\n};\n\nexport class WatchCommand implements Command {\n name = 'watch';\n description = 'automatically recompile modified components (on save)';\n extendedDescription = `by default, the watcher doesn't use polling, to keep the CPU idle.\nif this doesn't work well for you, run \"bit config set watch_use_polling true\" to use polling.`;\n helpUrl = 'reference/compiling/compiler-overview';\n alias = '';\n group = 'development';\n options = [\n ['v', 'verbose', 'show all watch events and compiler verbose output'],\n ['', 'skip-pre-compilation', 'skip compilation step before starting to watch'],\n [\n 't',\n 'check-types [string]',\n 'show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project',\n ],\n [\n 'i',\n 'import',\n 'DEPRECATED. it is now the default. helpful when using git. import component objects if .bitmap changed not by bit',\n ],\n ['', 'skip-import', 'do not import component objects if .bitmap changed not by bit'],\n ['', 'generate-types', 'EXPERIMENTAL. generate d.ts files for typescript components (hurts performance)'],\n [\n '',\n 'trigger <comp-id>',\n 'trigger recompilation of the specified component regardless of what changed. helpful when this comp-id must be a bundle',\n ],\n ] as CommandOptions;\n\n constructor(\n /**\n * logger extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * watcher extension.\n */\n private watcher: WatcherMain\n ) {\n this.registerToEvents();\n }\n\n private registerToEvents() {\n this.pubsub.sub(CompilerAspect.id, this.eventsListener);\n }\n\n private eventsListener = (event: BitBaseEvent<any>) => {\n switch (event.type) {\n case CompilerErrorEvent.TYPE:\n this.logger.console(`Watcher error ${event.data.error}, 'error'`);\n break;\n default:\n }\n };\n\n async report(cliArgs: [], watchCmdOpts: WatchCmdOpts) {\n const { verbose, checkTypes, import: importIfNeeded, skipImport, trigger } = watchCmdOpts;\n if (importIfNeeded) {\n this.logger.consoleWarning('the \"--import\" flag is deprecated and is now the default behavior');\n }\n const getCheckTypesEnum = () => {\n switch (checkTypes) {\n case undefined:\n case false:\n return CheckTypes.None;\n case 'project':\n case true: // project is the default\n return CheckTypes.EntireProject;\n case 'file':\n return CheckTypes.ChangedFile;\n default:\n throw new Error(`check-types can be either \"file\" or \"project\". got \"${checkTypes}\"`);\n }\n };\n const watchOpts: WatchOptions = {\n msgs: getMessages(this.logger),\n verbose,\n compile: true,\n preCompile: !watchCmdOpts.skipPreCompilation,\n spawnTSServer: Boolean(checkTypes), // if check-types is enabled, it must spawn the tsserver.\n checkTypes: getCheckTypesEnum(),\n import: !skipImport,\n trigger: trigger ? ComponentID.fromString(trigger) : undefined,\n generateTypes: watchCmdOpts.generateTypes,\n };\n await this.watcher.watch(watchOpts);\n return 'watcher terminated';\n }\n}\n\nfunction getMessages(logger: Logger): EventMessages {\n return {\n onAll: (event: string, path: string) => logger.console(`Event: \"${event}\". Path: ${path}`),\n onStart: () => {},\n onReady: (workspace: Workspace, watchPathsSortByComponent: RootDirs, verbose?: boolean) => {\n clearOutdatedData();\n if (verbose) {\n logger.console(formatWatchPathsSortByComponent(watchPathsSortByComponent));\n }\n logger.console(\n chalk.yellow(\n `Watching for component changes in workspace ${workspace.name} (${moment().format('HH:mm:ss')})...\\n`\n )\n );\n },\n onChange: (...args) => {\n printOnFileEvent(logger, 'changed', ...args);\n },\n onAdd: (...args) => {\n printOnFileEvent(logger, 'added', ...args);\n },\n onUnlink: (...args) => {\n printOnFileEvent(logger, 'removed', ...args);\n },\n onError: (err) => {\n logger.console(`Watcher error ${err}`);\n },\n };\n}\n\nfunction printOnFileEvent(\n logger: Logger,\n eventMsgPlaceholder: 'changed' | 'added' | 'removed',\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) {\n const files = filePaths.join(', ');\n if (!buildResults.length) {\n if (!failureMsg) {\n if (verbose) logger.console(`The files ${files} have been ${eventMsgPlaceholder}, but nothing to compile\\n\\n`);\n return;\n }\n logger.console(`${failureMsg}\\n\\n`);\n return;\n }\n logger.console(`The file(s) ${files} have been ${eventMsgPlaceholder}.\\n`);\n logger.console(formatCompileResults(buildResults));\n logger.console(`Finished (${duration}ms).`);\n logger.console(chalk.yellow(`Watching for component changes (${moment().format('HH:mm:ss')})...`));\n}\n\n/**\n * with console.clear() all history is deleted from the console. this function preserver the history.\n */\nfunction clearOutdatedData() {\n process.stdout.write('\\x1Bc');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,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1D,MAAc,EACd+D,mBAAoD,EACpDC,SAAmB,EACnBC,YAAsC,EACtCjD,OAAgB,EAChBkD,QAAgB,EAChBC,UAAmB,EACnB;EACA,MAAMC,KAAK,GAAGJ,SAAS,CAACK,IAAI,CAAC,IAAI,CAAC;EAClC,IAAI,CAACJ,YAAY,CAACK,MAAM,EAAE;IACxB,IAAI,CAACH,UAAU,EAAE;MACf,IAAInD,OAAO,EAAEhB,MAAM,CAACM,OAAO,CAAC,aAAa8D,KAAK,cAAcL,mBAAmB,8BAA8B,CAAC;MAC9G;IACF;IACA/D,MAAM,CAACM,OAAO,CAAC,GAAG6D,UAAU,MAAM,CAAC;IACnC;EACF;EACAnE,MAAM,CAACM,OAAO,CAAC,eAAe8D,KAAK,cAAcL,mBAAmB,KAAK,CAAC;EAC1E/D,MAAM,CAACM,OAAO,CAAC,IAAAiE,uCAAoB,EAACN,YAAY,CAAC,CAAC;EAClDjE,MAAM,CAACM,OAAO,CAAC,aAAa4D,QAAQ,MAAM,CAAC;EAC3ClE,MAAM,CAACM,OAAO,CAAC6C,gBAAK,CAACC,MAAM,CAAC,mCAAmC,IAAAE,iBAAM,EAAC,CAAC,CAACC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACpG;;AAEA;AACA;AACA;AACA,SAASN,iBAAiBA,CAAA,EAAG;EAC3BuB,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC,OAAO,CAAC;AAC/B","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_moment","_componentId","_compiler","_outputFormatter","_checkTypes","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WatchCommand","constructor","pubsub","logger","watcher","event","type","CompilerErrorEvent","TYPE","console","error","registerToEvents","sub","CompilerAspect","id","eventsListener","wait","cliArgs","watchCmdOpts","verbose","checkTypes","import","importIfNeeded","skipImport","trigger","consoleWarning","getCheckTypesEnum","undefined","CheckTypes","None","EntireProject","ChangedFile","Error","watchOpts","compile","preCompile","skipPreCompilation","spawnTSServer","Boolean","ComponentID","fromString","generateTypes","watch","getMessages","exports","onAll","path","onStart","onReady","workspace","watchPathsSortByComponent","clearOutdatedData","formatWatchPathsSortByComponent","chalk","yellow","name","moment","format","onChange","args","printOnFileEvent","onAdd","onUnlink","onError","err","eventMsgPlaceholder","filePaths","buildResults","duration","failureMsg","files","join","length","formatCompileResults","process","stdout","write"],"sources":["watch.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport moment from 'moment';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { BitBaseEvent, PubsubMain } from '@teambit/pubsub';\nimport { OnComponentEventResult, Workspace } from '@teambit/workspace';\nimport { ComponentID } from '@teambit/component-id';\nimport { CompilerAspect, CompilerErrorEvent } from '@teambit/compiler';\nimport { EventMessages, RootDirs, WatchOptions } from './watcher';\nimport { formatCompileResults, formatWatchPathsSortByComponent } from './output-formatter';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\n\ntype WatchCmdOpts = {\n verbose?: boolean;\n skipPreCompilation?: boolean;\n checkTypes?: string | boolean;\n import?: boolean;\n skipImport?: boolean;\n generateTypes?: boolean;\n trigger?: string;\n};\n\nexport class WatchCommand implements Command {\n name = 'watch';\n description = 'automatically recompile modified components (on save)';\n extendedDescription = `by default, the watcher doesn't use polling, to keep the CPU idle.\nif this doesn't work well for you, run \"bit config set watch_use_polling true\" to use polling.`;\n helpUrl = 'reference/compiling/compiler-overview';\n alias = '';\n group = 'development';\n options = [\n ['v', 'verbose', 'show all watch events and compiler verbose output'],\n ['', 'skip-pre-compilation', 'skip compilation step before starting to watch'],\n [\n 't',\n 'check-types [string]',\n 'show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project',\n ],\n [\n 'i',\n 'import',\n 'DEPRECATED. it is now the default. helpful when using git. import component objects if .bitmap changed not by bit',\n ],\n ['', 'skip-import', 'do not import component objects if .bitmap changed not by bit'],\n ['', 'generate-types', 'EXPERIMENTAL. generate d.ts files for typescript components (hurts performance)'],\n [\n '',\n 'trigger <comp-id>',\n 'trigger recompilation of the specified component regardless of what changed. helpful when this comp-id must be a bundle',\n ],\n ] as CommandOptions;\n\n constructor(\n /**\n * logger extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * watcher extension.\n */\n private watcher: WatcherMain\n ) {\n this.registerToEvents();\n }\n\n private registerToEvents() {\n this.pubsub.sub(CompilerAspect.id, this.eventsListener);\n }\n\n private eventsListener = (event: BitBaseEvent<any>) => {\n switch (event.type) {\n case CompilerErrorEvent.TYPE:\n this.logger.console(`Watcher error ${event.data.error}, 'error'`);\n break;\n default:\n }\n };\n\n async wait(cliArgs: [], watchCmdOpts: WatchCmdOpts) {\n const { verbose, checkTypes, import: importIfNeeded, skipImport, trigger } = watchCmdOpts;\n if (importIfNeeded) {\n this.logger.consoleWarning('the \"--import\" flag is deprecated and is now the default behavior');\n }\n const getCheckTypesEnum = () => {\n switch (checkTypes) {\n case undefined:\n case false:\n return CheckTypes.None;\n case 'project':\n case true: // project is the default\n return CheckTypes.EntireProject;\n case 'file':\n return CheckTypes.ChangedFile;\n default:\n throw new Error(`check-types can be either \"file\" or \"project\". got \"${checkTypes}\"`);\n }\n };\n const watchOpts: WatchOptions = {\n verbose,\n compile: true,\n preCompile: !watchCmdOpts.skipPreCompilation,\n spawnTSServer: Boolean(checkTypes), // if check-types is enabled, it must spawn the tsserver.\n checkTypes: getCheckTypesEnum(),\n import: !skipImport,\n trigger: trigger ? ComponentID.fromString(trigger) : undefined,\n generateTypes: watchCmdOpts.generateTypes,\n };\n await this.watcher.watch(watchOpts, getMessages(this.logger));\n }\n}\n\nfunction getMessages(logger: Logger): EventMessages {\n return {\n onAll: (event: string, path: string) => logger.console(`Event: \"${event}\". Path: ${path}`),\n onStart: () => {},\n onReady: (workspace: Workspace, watchPathsSortByComponent: RootDirs, verbose?: boolean) => {\n clearOutdatedData();\n if (verbose) {\n logger.console(formatWatchPathsSortByComponent(watchPathsSortByComponent));\n }\n logger.console(\n chalk.yellow(\n `Watching for component changes in workspace ${workspace.name} (${moment().format('HH:mm:ss')})...\\n`\n )\n );\n },\n onChange: (...args) => {\n printOnFileEvent(logger, 'changed', ...args);\n },\n onAdd: (...args) => {\n printOnFileEvent(logger, 'added', ...args);\n },\n onUnlink: (...args) => {\n printOnFileEvent(logger, 'removed', ...args);\n },\n onError: (err) => {\n logger.console(`Watcher error ${err}`);\n },\n };\n}\n\nfunction printOnFileEvent(\n logger: Logger,\n eventMsgPlaceholder: 'changed' | 'added' | 'removed',\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) {\n const files = filePaths.join(', ');\n if (!buildResults.length) {\n if (!failureMsg) {\n if (verbose) logger.console(`The files ${files} have been ${eventMsgPlaceholder}, but nothing to compile\\n\\n`);\n return;\n }\n logger.console(`${failureMsg}\\n\\n`);\n return;\n }\n logger.console(`The file(s) ${files} have been ${eventMsgPlaceholder}.\\n`);\n logger.console(formatCompileResults(buildResults));\n logger.console(`Finished (${duration}ms).`);\n logger.console(chalk.yellow(`Watching for component changes (${moment().format('HH:mm:ss')})...`));\n}\n\n/**\n * with console.clear() all history is deleted from the console. this function preserver the history.\n */\nfunction clearOutdatedData() {\n process.stdout.write('\\x1Bc');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAA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EAClC,IAAI,CAACJ,YAAY,CAACK,MAAM,EAAE;IACxB,IAAI,CAACH,UAAU,EAAE;MACf,IAAIlD,OAAO,EAAEhB,MAAM,CAACM,OAAO,CAAC,aAAa6D,KAAK,cAAcL,mBAAmB,8BAA8B,CAAC;MAC9G;IACF;IACA9D,MAAM,CAACM,OAAO,CAAC,GAAG4D,UAAU,MAAM,CAAC;IACnC;EACF;EACAlE,MAAM,CAACM,OAAO,CAAC,eAAe6D,KAAK,cAAcL,mBAAmB,KAAK,CAAC;EAC1E9D,MAAM,CAACM,OAAO,CAAC,IAAAgE,uCAAoB,EAACN,YAAY,CAAC,CAAC;EAClDhE,MAAM,CAACM,OAAO,CAAC,aAAa2D,QAAQ,MAAM,CAAC;EAC3CjE,MAAM,CAACM,OAAO,CAAC4C,gBAAK,CAACC,MAAM,CAAC,mCAAmC,IAAAE,iBAAM,EAAC,CAAC,CAACC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACpG;;AAEA;AACA;AACA;AACA,SAASN,iBAAiBA,CAAA,EAAG;EAC3BuB,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC,OAAO,CAAC;AAC/B","ignoreList":[]}
package/dist/watcher.d.ts CHANGED
@@ -22,7 +22,6 @@ export type EventMessages = {
22
22
  };
23
23
  export type OnFileEventFunc = (filePaths: string[], buildResults: OnComponentEventResult[], verbose: boolean, duration: number, failureMsg?: string) => void;
24
24
  export type WatchOptions = {
25
- msgs?: EventMessages;
26
25
  initiator?: CompilationInitiator;
27
26
  verbose?: boolean;
28
27
  spawnTSServer?: boolean;
@@ -42,7 +41,9 @@ export declare class Watcher {
42
41
  private pubsub;
43
42
  private watcherMain;
44
43
  private options;
45
- private fsWatcher;
44
+ private msgs?;
45
+ private watcherType;
46
+ private chokidarWatcher;
46
47
  private changedFilesPerComponent;
47
48
  private watchQueue;
48
49
  private bitMapChangesInProgress;
@@ -51,9 +52,12 @@ export declare class Watcher {
51
52
  private verbose;
52
53
  private multipleWatchers;
53
54
  private logger;
54
- constructor(workspace: Workspace, pubsub: PubsubMain, watcherMain: WatcherMain, options: WatchOptions);
55
+ private workspacePathLinux;
56
+ constructor(workspace: Workspace, pubsub: PubsubMain, watcherMain: WatcherMain, options: WatchOptions, msgs?: EventMessages | undefined);
55
57
  get consumer(): Consumer;
56
- watch(): Promise<unknown>;
58
+ watch(): Promise<void>;
59
+ private watchParcel;
60
+ private watchChokidar;
57
61
  /**
58
62
  * *** DEBOUNCING ***
59
63
  * some actions trigger multiple files changes at (almost) the same time. e.g. "git pull".
@@ -116,7 +120,10 @@ export declare class Watcher {
116
120
  private getComponentIdByPath;
117
121
  private getRelativePathLinux;
118
122
  private findRootDirByFilePathRecursively;
119
- private createWatcher;
123
+ private shouldIgnoreFromLocalScopeChokidar;
124
+ private shouldIgnoreFromLocalScopeParcel;
125
+ private createChokidarWatcher;
126
+ private onParcelWatch;
120
127
  private setRootDirs;
121
128
  }
122
129
  export {};
package/dist/watcher.js CHANGED
@@ -88,6 +88,13 @@ function _watchQueue() {
88
88
  };
89
89
  return data;
90
90
  }
91
+ function _watcher() {
92
+ const data = _interopRequireDefault(require("@parcel/watcher"));
93
+ _watcher = function () {
94
+ return data;
95
+ };
96
+ return data;
97
+ }
91
98
  function _harmonyModules() {
92
99
  const data = require("@teambit/harmony.modules.send-server-sent-events");
93
100
  _harmonyModules = function () {
@@ -95,12 +102,9 @@ function _harmonyModules() {
95
102
  };
96
103
  return data;
97
104
  }
98
- const _excluded = ["msgs"];
99
105
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
100
106
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
101
107
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
102
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
103
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
104
108
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
105
109
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
106
110
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -108,12 +112,14 @@ const DEBOUNCE_WAIT_MS = 100;
108
112
  // ts fails when importing it from @teambit/legacy/dist/utils/path.
109
113
 
110
114
  class Watcher {
111
- constructor(workspace, pubsub, watcherMain, options) {
115
+ constructor(workspace, pubsub, watcherMain, options, msgs) {
112
116
  this.workspace = workspace;
113
117
  this.pubsub = pubsub;
114
118
  this.watcherMain = watcherMain;
115
119
  this.options = options;
116
- _defineProperty(this, "fsWatcher", void 0);
120
+ this.msgs = msgs;
121
+ _defineProperty(this, "watcherType", 'parcel');
122
+ _defineProperty(this, "chokidarWatcher", void 0);
117
123
  _defineProperty(this, "changedFilesPerComponent", {});
118
124
  _defineProperty(this, "watchQueue", new (_watchQueue().WatchQueue)());
119
125
  _defineProperty(this, "bitMapChangesInProgress", false);
@@ -122,35 +128,47 @@ class Watcher {
122
128
  _defineProperty(this, "verbose", false);
123
129
  _defineProperty(this, "multipleWatchers", []);
124
130
  _defineProperty(this, "logger", void 0);
131
+ _defineProperty(this, "workspacePathLinux", void 0);
125
132
  this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;
126
133
  this.verbose = this.options.verbose || false;
127
134
  this.logger = this.watcherMain.logger;
135
+ this.workspacePathLinux = (0, _legacy3().pathNormalizeToLinux)(this.workspace.path);
136
+ if (process.env.BIT_WATCHER_USE_CHOKIDAR === 'true' || process.env.BIT_WATCHER_USE_CHOKIDAR === '1') {
137
+ this.watcherType = 'chokidar';
138
+ }
128
139
  }
129
140
  get consumer() {
130
141
  return this.workspace.consumer;
131
142
  }
132
143
  async watch() {
133
- const _this$options = this.options,
134
- {
135
- msgs
136
- } = _this$options,
137
- watchOpts = _objectWithoutProperties(_this$options, _excluded);
138
144
  await this.setRootDirs();
139
145
  const componentIds = Object.values(this.rootDirs);
140
- await this.watcherMain.triggerOnPreWatch(componentIds, watchOpts);
146
+ await this.watcherMain.triggerOnPreWatch(componentIds, this.options);
141
147
  await this.watcherMain.watchScopeInternalFiles();
142
- await this.createWatcher();
143
- const watcher = this.fsWatcher;
148
+ this.watcherType === 'parcel' ? await this.watchParcel() : await this.watchChokidar();
149
+ }
150
+ async watchParcel() {
151
+ this.msgs?.onStart(this.workspace);
152
+ await _watcher().default.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {
153
+ ignore: ['**/node_modules/**', '**/package.json']
154
+ });
155
+ this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);
156
+ this.logger.clearStatusLine();
157
+ }
158
+ async watchChokidar() {
159
+ await this.createChokidarWatcher();
160
+ const watcher = this.chokidarWatcher;
161
+ const msgs = this.msgs;
144
162
  msgs?.onStart(this.workspace);
145
163
  return new Promise((resolve, reject) => {
146
164
  if (this.verbose) {
147
165
  // @ts-ignore
148
- if (msgs?.onAll) watcher.on('all', msgs?.onAll);
166
+ if (msgs?.onAll) watcher.on('all', msgs.onAll);
149
167
  }
150
168
  watcher.on('ready', () => {
151
169
  msgs?.onReady(this.workspace, this.rootDirs, this.verbose);
152
170
  if (this.verbose) {
153
- const watched = this.fsWatcher.getWatched();
171
+ const watched = this.chokidarWatcher.getWatched();
154
172
  const totalWatched = Object.values(watched).flat().length;
155
173
  _legacy2().logger.console(`${_chalk().default.bold('the following files are being watched:')}\n${JSON.stringify(watched, null, 2)}`);
156
174
  _legacy2().logger.console(`\nTotal files being watched: ${_chalk().default.bold(totalWatched.toString())}`);
@@ -462,21 +480,61 @@ class Watcher {
462
480
  if (parentDir === filePath) return null;
463
481
  return this.findRootDirByFilePathRecursively(parentDir);
464
482
  }
465
- async createWatcher() {
466
- const workspacePathLinux = (0, _legacy3().pathNormalizeToLinux)(this.workspace.path);
467
- const ignoreLocalScope = pathToCheck => {
468
- if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(_legacy4().UNMERGED_FILENAME)) return false;
469
- return pathToCheck.startsWith(`${workspacePathLinux}/.git/`) || pathToCheck.startsWith(`${workspacePathLinux}/.bit/`);
470
- };
483
+ shouldIgnoreFromLocalScopeChokidar(pathToCheck) {
484
+ if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(_legacy4().UNMERGED_FILENAME)) return false;
485
+ return pathToCheck.startsWith(`${this.workspacePathLinux}/.git/`) || pathToCheck.startsWith(`${this.workspacePathLinux}/.bit/`);
486
+ }
487
+ shouldIgnoreFromLocalScopeParcel(pathToCheck) {
488
+ if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(_legacy4().UNMERGED_FILENAME)) return false;
489
+ return pathToCheck.startsWith((0, _path().join)(this.workspace.path, '.git') + _path().sep) || pathToCheck.startsWith((0, _path().join)(this.workspace.path, '.bit') + _path().sep);
490
+ }
491
+ async createChokidarWatcher() {
471
492
  const chokidarOpts = await this.watcherMain.getChokidarWatchOptions();
472
493
  // `chokidar` matchers have Bash-parity, so Windows-style backslashes are not supported as separators.
473
494
  // (windows-style backslashes are converted to forward slashes)
474
- chokidarOpts.ignored = ['**/node_modules/**', '**/package.json', ignoreLocalScope];
475
- this.fsWatcher = _chokidar().default.watch(this.workspace.path, chokidarOpts);
495
+ chokidarOpts.ignored = ['**/node_modules/**', '**/package.json', this.shouldIgnoreFromLocalScopeChokidar.bind(this)];
496
+ this.chokidarWatcher = _chokidar().default.watch(this.workspace.path, chokidarOpts);
476
497
  if (this.verbose) {
477
- _legacy2().logger.console(`${_chalk().default.bold('chokidar.options:\n')} ${JSON.stringify(this.fsWatcher.options, undefined, 2)}`);
498
+ _legacy2().logger.console(`${_chalk().default.bold('chokidar.options:\n')} ${JSON.stringify(this.chokidarWatcher.options, undefined, 2)}`);
478
499
  }
479
500
  }
501
+ async onParcelWatch(err, allEvents) {
502
+ const events = allEvents.filter(event => !this.shouldIgnoreFromLocalScopeParcel(event.path));
503
+ if (!events.length) {
504
+ return;
505
+ }
506
+ const msgs = this.msgs;
507
+ if (this.verbose) {
508
+ if (msgs?.onAll) events.forEach(event => msgs.onAll(event.type, event.path));
509
+ }
510
+ if (err) {
511
+ msgs?.onError(err);
512
+ if (err.message.includes('Error starting FSEvents stream')) {
513
+ throw new Error(`failed to start the watcher: ${err.message}.
514
+ try rerunning the command. if that doesn't help, please refer to this Watchman troubleshooting guide:
515
+ https://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`);
516
+ }
517
+ // don't throw on other errors, just log them.
518
+ // for example, when running "bit install" on a big project, it might error out with:
519
+ // "Error: Events were dropped by the FSEvents client. File system must be re-scanned."
520
+ // but it still works for the future events.
521
+ }
522
+ const startTime = new Date().getTime();
523
+ await (0, _pMapSeries().default)(events, async event => {
524
+ const {
525
+ files,
526
+ results,
527
+ debounced,
528
+ irrelevant,
529
+ failureMsg
530
+ } = await this.handleChange(event.path);
531
+ if (debounced || irrelevant) {
532
+ return;
533
+ }
534
+ const duration = new Date().getTime() - startTime;
535
+ msgs?.onChange(files, results, this.verbose, duration, failureMsg);
536
+ });
537
+ }
480
538
  async setRootDirs() {
481
539
  this.rootDirs = {};
482
540
  const componentsFromBitMap = this.consumer.bitMap.getAllComponents();
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_legacy","_legacy2","_legacy3","_pMapSeries","_chalk","_legacy4","_chokidar","_workspace","_watchQueue","_harmonyModules","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","DEBOUNCE_WAIT_MS","Watcher","constructor","workspace","pubsub","watcherMain","options","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","logger","consumer","watch","_this$options","msgs","watchOpts","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","watchScopeInternalFiles","createWatcher","watcher","fsWatcher","onStart","Promise","resolve","reject","onAll","on","onReady","watched","getWatched","totalWatched","flat","console","chalk","bold","JSON","stringify","toString","clearStatusLine","event","filePath","startTime","Date","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","err","onError","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","content","fs","readFile","debug","parsed","parse","sendEventsToClients","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","message","ms","setTimeout","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","clearComponentCache","component","get","componentMap","state","_consumer","Error","compFilesRelativeToWorkspace","getFilesRelativeToConsumer","compFiles","nonCompFiles","partition","relativeFile","getRelativePathLinux","Boolean","p","removedFiles","compact","all","map","pathExists","toStringWithoutVersion","bitMap","updateComponentPaths","f","getPathRelativeToConsumer","executeWatchOperationsOnComponent","trigger","triggerOnComponentChange","previewsRootDirs","previewsIds","getAllBitIds","_reloadConsumer","importObjectsIfNeeded","triggerOnBitmapChange","newDirs","difference","removedDirs","addResults","mapSeries","dir","executeWatchOperationsOnRemove","import","currentIds","hasVersionChanges","prevId","searchWithoutVersion","version","existsInScope","scope","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentAdd","OnComponentRemovedEvent","now","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","pathNormalizeToLinux","parentDir","workspacePathLinux","path","ignoreLocalScope","pathToCheck","startsWith","chokidarOpts","getChokidarWatchOptions","ignored","chokidar","componentsFromBitMap","getAllComponents","getRootDir","exports"],"sources":["watcher.ts"],"sourcesContent":["import { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BIT_MAP, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy.scope';\nimport chokidar, { FSWatcher } from 'chokidar';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport {\n WorkspaceAspect,\n Workspace,\n OnComponentEventResult,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\nimport { Logger } from '@teambit/logger';\nimport { sendEventsToClients } from '@teambit/harmony.modules.send-server-sent-events';\n\nexport type WatcherProcessData = { watchProcess: ChildProcess; compilerId: ComponentID; componentIds: ComponentID[] };\n\nexport type EventMessages = {\n onAll: Function;\n onStart: Function;\n onReady: Function;\n onChange: OnFileEventFunc;\n onAdd: OnFileEventFunc;\n onUnlink: OnFileEventFunc;\n onError: Function;\n};\n\nexport type OnFileEventFunc = (\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) => void;\n\nexport type WatchOptions = {\n msgs?: EventMessages;\n initiator?: CompilationInitiator;\n verbose?: boolean; // print watch events to the console. (also ts-server events if spawnTSServer is true)\n spawnTSServer?: boolean; // needed for check types and extract API/docs.\n checkTypes?: CheckTypes; // if enabled, the spawnTSServer becomes true.\n preCompile?: boolean; // whether compile all components before start watching\n compile?: boolean; // whether compile modified/added components during watch process\n import?: boolean; // whether import objects when .bitmap got version changes\n generateTypes?: boolean; // whether generate d.ts files for typescript files during watch process (hurts performance)\n trigger?: ComponentID; // trigger onComponentChange for the specified component-id. helpful when this comp must be a bundle, and needs to be recompile on any dep change.\n};\n\nexport type RootDirs = { [dir: PathLinux]: ComponentID };\n\nconst DEBOUNCE_WAIT_MS = 100;\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\n\nexport class Watcher {\n private fsWatcher: FSWatcher;\n private changedFilesPerComponent: { [componentId: string]: string[] } = {};\n private watchQueue = new WatchQueue();\n private bitMapChangesInProgress = false;\n private ipcEventsDir: string;\n private rootDirs: RootDirs = {};\n private verbose = false;\n private multipleWatchers: WatcherProcessData[] = [];\n private logger: Logger;\n constructor(\n private workspace: Workspace,\n private pubsub: PubsubMain,\n private watcherMain: WatcherMain,\n private options: WatchOptions\n ) {\n this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;\n this.verbose = this.options.verbose || false;\n this.logger = this.watcherMain.logger;\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async watch() {\n const { msgs, ...watchOpts } = this.options;\n await this.setRootDirs();\n const componentIds = Object.values(this.rootDirs);\n await this.watcherMain.triggerOnPreWatch(componentIds, watchOpts);\n await this.watcherMain.watchScopeInternalFiles();\n\n await this.createWatcher();\n const watcher = this.fsWatcher;\n msgs?.onStart(this.workspace);\n\n return new Promise((resolve, reject) => {\n if (this.verbose) {\n // @ts-ignore\n if (msgs?.onAll) watcher.on('all', msgs?.onAll);\n }\n watcher.on('ready', () => {\n msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n if (this.verbose) {\n const watched = this.fsWatcher.getWatched();\n const totalWatched = Object.values(watched).flat().length;\n logger.console(\n `${chalk.bold('the following files are being watched:')}\\n${JSON.stringify(watched, null, 2)}`\n );\n logger.console(`\\nTotal files being watched: ${chalk.bold(totalWatched.toString())}`);\n }\n\n this.logger.clearStatusLine();\n });\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n watcher.on('all', async (event, filePath) => {\n if (event !== 'change' && event !== 'add' && event !== 'unlink') return;\n const startTime = new Date().getTime();\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(filePath);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n });\n watcher.on('error', (err) => {\n msgs?.onError(err);\n reject(err);\n });\n });\n }\n\n /**\n * *** DEBOUNCING ***\n * some actions trigger multiple files changes at (almost) the same time. e.g. \"git pull\".\n * this causes some performance and instability issues. a debouncing mechanism was implemented to help with this.\n * the way how it works is that the first file of the same component starts the execution with a delay (e.g. 200ms).\n * if, in the meanwhile, another file of the same component was changed, it won't start a new execution, instead,\n * it'll only add the file to `this.changedFilesPerComponent` prop.\n * once the execution starts, it'll delete this component-id from the `this.changedFilesPerComponent` array,\n * indicating the next file-change to start a new execution.\n *\n * implementation wise, `lodash.debounce` doesn't help here, because:\n * A) it doesn't return the results, unless \"leading\" option is true. here, it must be false, otherwise, it'll start\n * the execution immediately.\n * B) it debounces the method regardless the param passes to it. so it'll disregard the component-id and will delay\n * other components undesirably.\n *\n * *** QUEUE ***\n * the debouncing helps to not execute the same component multiple times concurrently. however, multiple components\n * and .bitmap changes execution can still be processed concurrently.\n * the following example explains why this is an issue.\n * compA is changed in the .bitmap file from version 0.0.1 to 0.0.2. its files were changed as well.\n * all these changes get pulled at the same time by \"git pull\", as a result, the execution of compA and the .bitmap\n * happen at the same time.\n * during the execution of compA, the component id is parsed as compA@0.0.1, later, it asks for the Workspace for this\n * id. while the workspace is looking for this id, the .bitmap execution reloaded the consumer and changed all versions.\n * after this change, the workspace doesn't have this id anymore, which will trigger an error.\n * to ensure this won't happen, we keep a flag to indicate whether the .bitmap execution is running, and if so, all\n * other executions are paused until the queue is empty (this is done by awaiting for queue.onIdle).\n * once the queue is empty, we know the .bitmap process was done and the workspace has all new ids.\n * in the example above, at this stage, the id will be resolved to compA@0.0.2.\n * one more thing, the queue is configured to have concurrency of 1. to make sure two components are not processed at\n * the same time. (the same way is done when loading all components from the filesystem/scope).\n * this way we can also ensure that if compA was started before the .bitmap execution, it will complete before the\n * .bitmap execution starts.\n */\n private async handleChange(filePath: string): Promise<{\n results: OnComponentEventResult[];\n files: string[];\n failureMsg?: string;\n debounced?: boolean;\n irrelevant?: boolean; // file/dir is not part of any component\n }> {\n try {\n if (filePath.endsWith(BIT_MAP)) {\n this.bitMapChangesInProgress = true;\n const buildResults = await this.watchQueue.add(() => this.handleBitmapChanges());\n this.bitMapChangesInProgress = false;\n this.logger.clearStatusLine();\n return { results: buildResults, files: [filePath] };\n }\n if (this.bitMapChangesInProgress) {\n await this.watchQueue.onIdle();\n }\n if (dirname(filePath) === this.ipcEventsDir) {\n const eventName = basename(filePath);\n if (eventName === 'onNotifySSE') {\n const content = await fs.readFile(filePath, 'utf8');\n this.logger.debug(`Watcher, onNotifySSE ${content}`);\n const parsed = JSON.parse(content);\n sendEventsToClients(parsed.event, parsed);\n } else {\n await this.watcherMain.ipcEvents.triggerGotEvent(eventName as any);\n }\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(WORKSPACE_JSONC)) {\n await this.workspace.triggerOnWorkspaceConfigChange();\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(UNMERGED_FILENAME)) {\n await this.workspace.clearCache();\n return { results: [], files: [filePath] };\n }\n const componentId = this.getComponentIdByPath(filePath);\n if (!componentId) {\n this.logger.clearStatusLine();\n return { results: [], files: [], irrelevant: true };\n }\n const compIdStr = componentId.toString();\n if (this.changedFilesPerComponent[compIdStr]) {\n this.changedFilesPerComponent[compIdStr].push(filePath);\n this.logger.clearStatusLine();\n return { results: [], files: [], debounced: true };\n }\n this.changedFilesPerComponent[compIdStr] = [filePath];\n await this.sleep(DEBOUNCE_WAIT_MS);\n const files = this.changedFilesPerComponent[compIdStr];\n delete this.changedFilesPerComponent[compIdStr];\n\n const buildResults = await this.watchQueue.add(() => this.triggerCompChanges(componentId, files));\n const failureMsg = buildResults.length\n ? undefined\n : `files ${files.join(', ')} are inside the component ${compIdStr} but configured to be ignored`;\n this.logger.clearStatusLine();\n return { results: buildResults, files, failureMsg };\n } catch (err: any) {\n const msg = `watcher found an error while handling ${filePath}`;\n logger.error(msg, err);\n logger.console(`${msg}, ${err.message}`);\n this.logger.clearStatusLine();\n return { results: [], files: [filePath], failureMsg: err.message };\n }\n }\n\n private async sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async triggerCompChanges(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[]\n ): Promise<OnComponentEventResult[]> {\n let updatedComponentId: ComponentID | undefined = componentId;\n if (!this.workspace.hasId(componentId)) {\n // bitmap has changed meanwhile, which triggered `handleBitmapChanges`, which re-loaded consumer and updated versions\n // so the original componentId might not be in the workspace now, and we need to find the updated one\n const ids = this.workspace.listIds();\n updatedComponentId = ids.find((id) => id.isEqual(componentId, { ignoreVersion: true }));\n if (!updatedComponentId) {\n logger.debug(`triggerCompChanges, the component ${componentId.toString()} was probably removed from .bitmap`);\n return [];\n }\n }\n this.workspace.clearComponentCache(updatedComponentId);\n const component = await this.workspace.get(updatedComponentId);\n const componentMap: ComponentMap = component.state._consumer.componentMap;\n if (!componentMap) {\n throw new Error(\n `unable to find componentMap for ${updatedComponentId.toString()}, make sure this component is in .bitmap`\n );\n }\n const compFilesRelativeToWorkspace = componentMap.getFilesRelativeToConsumer();\n const [compFiles, nonCompFiles] = partition(files, (filePath) => {\n const relativeFile = this.getRelativePathLinux(filePath);\n return Boolean(compFilesRelativeToWorkspace.find((p) => p === relativeFile));\n });\n // nonCompFiles are either, files that were removed from the filesystem or existing files that are ignored.\n // the compiler takes care of removedFiles differently, e.g. removes dists dir and old symlinks.\n const removedFiles = compact(\n await Promise.all(nonCompFiles.map(async (filePath) => ((await fs.pathExists(filePath)) ? null : filePath)))\n );\n\n if (!compFiles.length && !removedFiles.length) {\n logger.debug(\n `the following files are part of the component ${componentId.toStringWithoutVersion()} but configured to be ignored:\\n${files.join(\n '\\n'\n )}'`\n );\n return [];\n }\n this.consumer.bitMap.updateComponentPaths(\n componentId,\n compFiles.map((f) => this.consumer.getPathRelativeToConsumer(f)),\n removedFiles.map((f) => this.consumer.getPathRelativeToConsumer(f))\n );\n const buildResults = await this.executeWatchOperationsOnComponent(\n updatedComponentId,\n compFiles,\n removedFiles,\n true\n );\n if (this.options.trigger && !updatedComponentId.isEqual(this.options.trigger)) {\n await this.workspace.triggerOnComponentChange(this.options.trigger, [], [], this.options);\n }\n\n return buildResults;\n }\n\n /**\n * if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.\n */\n private async handleBitmapChanges(): Promise<OnComponentEventResult[]> {\n const previewsRootDirs = { ...this.rootDirs };\n const previewsIds = this.consumer.bitMap.getAllBitIds();\n await this.workspace._reloadConsumer();\n await this.setRootDirs();\n await this.importObjectsIfNeeded(previewsIds);\n await this.workspace.triggerOnBitmapChange();\n const newDirs: string[] = difference(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));\n const removedDirs: string[] = difference(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));\n const results: OnComponentEventResult[] = [];\n if (newDirs.length) {\n const addResults = await mapSeries(newDirs, async (dir) =>\n this.executeWatchOperationsOnComponent(this.rootDirs[dir], [], [], false)\n );\n results.push(...addResults.flat());\n }\n if (removedDirs.length) {\n await mapSeries(removedDirs, (dir) => this.executeWatchOperationsOnRemove(previewsRootDirs[dir]));\n }\n\n return results;\n }\n\n /**\n * needed when using git.\n * it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.\n * because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.\n * as soon as the watcher gets an event about a file change, it loads the component which throws\n * ComponentsPendingImport error.\n * to resolve this, we import the new objects as soon as the .bitmap file changes.\n * for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is\n * not already in the scope.\n */\n private async importObjectsIfNeeded(previewsIds: ComponentIdList) {\n if (!this.options.import) {\n return;\n }\n const currentIds = this.consumer.bitMap.getAllBitIds();\n const hasVersionChanges = currentIds.find((id) => {\n const prevId = previewsIds.searchWithoutVersion(id);\n return prevId && prevId.version !== id.version;\n });\n if (!hasVersionChanges) {\n return;\n }\n const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);\n if (existsInScope) {\n // the .bitmap change was probably a result of tag/snap/merge, no need to import.\n return;\n }\n if (this.options.verbose) {\n logger.console(\n `Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`\n );\n }\n await this.workspace.scope.import(currentIds, {\n useCache: true,\n lane: await this.workspace.getCurrentLaneObject(),\n });\n }\n\n private async executeWatchOperationsOnRemove(componentId: ComponentID) {\n logger.debug(`running OnComponentRemove hook for ${chalk.bold(componentId.toString())}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));\n await this.workspace.triggerOnComponentRemove(componentId);\n }\n\n private async executeWatchOperationsOnComponent(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[],\n removedFiles: PathOsBasedAbsolute[] = [],\n isChange = true\n ): Promise<OnComponentEventResult[]> {\n if (this.isComponentWatchedExternally(componentId)) {\n // update capsule, once done, it automatically triggers the external watcher\n await this.workspace.get(componentId);\n return [];\n }\n const idStr = componentId.toString();\n\n if (isChange) {\n logger.debug(`running OnComponentChange hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentChangeEvent(idStr, 'OnComponentChange'));\n } else {\n logger.debug(`running OnComponentAdd hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentAddEvent(idStr, 'OnComponentAdd'));\n }\n\n const buildResults = isChange\n ? await this.workspace.triggerOnComponentChange(componentId, files, removedFiles, this.options)\n : await this.workspace.triggerOnComponentAdd(componentId, this.options);\n\n return buildResults;\n }\n\n private createOnComponentRemovedEvent(idStr) {\n return new OnComponentRemovedEvent(Date.now(), idStr);\n }\n\n private createOnComponentChangeEvent(idStr, hook) {\n return new OnComponentChangeEvent(Date.now(), idStr, hook);\n }\n\n private createOnComponentAddEvent(idStr, hook) {\n return new OnComponentAddEvent(Date.now(), idStr, hook);\n }\n\n private isComponentWatchedExternally(componentId: ComponentID) {\n const watcherData = this.multipleWatchers.find((m) => m.componentIds.find((id) => id.isEqual(componentId)));\n if (watcherData) {\n logger.debug(`${componentId.toString()} is watched by ${watcherData.compilerId.toString()}`);\n return true;\n }\n return false;\n }\n\n private getComponentIdByPath(filePath: string): ComponentID | null {\n const relativeFile = this.getRelativePathLinux(filePath);\n const rootDir = this.findRootDirByFilePathRecursively(relativeFile);\n if (!rootDir) {\n // the file is not part of any component. If it was a new component, or a new file of\n // existing component, then, handleBitmapChanges() should deal with it.\n return null;\n }\n return this.rootDirs[rootDir];\n }\n\n private getRelativePathLinux(filePath: string) {\n return pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(filePath));\n }\n\n private findRootDirByFilePathRecursively(filePath: string): string | null {\n if (this.rootDirs[filePath]) return filePath;\n const parentDir = dirname(filePath);\n if (parentDir === filePath) return null;\n return this.findRootDirByFilePathRecursively(parentDir);\n }\n\n private async createWatcher() {\n const workspacePathLinux = pathNormalizeToLinux(this.workspace.path);\n const ignoreLocalScope = (pathToCheck: string) => {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(`${workspacePathLinux}/.git/`) || pathToCheck.startsWith(`${workspacePathLinux}/.bit/`)\n );\n };\n const chokidarOpts = await this.watcherMain.getChokidarWatchOptions();\n // `chokidar` matchers have Bash-parity, so Windows-style backslashes are not supported as separators.\n // (windows-style backslashes are converted to forward slashes)\n chokidarOpts.ignored = ['**/node_modules/**', '**/package.json', ignoreLocalScope];\n this.fsWatcher = chokidar.watch(this.workspace.path, chokidarOpts);\n if (this.verbose) {\n logger.console(`${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.fsWatcher.options, undefined, 2)}`);\n }\n }\n\n private async setRootDirs() {\n this.rootDirs = {};\n const componentsFromBitMap = this.consumer.bitMap.getAllComponents();\n componentsFromBitMap.map((componentMap) => {\n const componentId = componentMap.id;\n const rootDir = componentMap.getRootDir();\n this.rootDirs[rootDir] = componentId;\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,M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AC;IAChH;EACF;EAEA,MAAcvE,WAAWA,CAAA,EAAG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAMyK,oBAAoB,GAAG,IAAI,CAACjL,QAAQ,CAACiH,MAAM,CAACiE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAACnE,GAAG,CAAEhB,YAAY,IAAK;MACzC,MAAMxB,WAAW,GAAGwB,YAAY,CAACN,EAAE;MACnC,MAAM4E,OAAO,GAAGtE,YAAY,CAACqF,UAAU,CAAC,CAAC;MACzC,IAAI,CAAC3K,QAAQ,CAAC4J,OAAO,CAAC,GAAG9F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAAC8G,OAAA,CAAAhM,OAAA,GAAAA,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_legacy","_legacy2","_legacy3","_pMapSeries","_chalk","_legacy4","_chokidar","_workspace","_watchQueue","_watcher","_harmonyModules","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEBOUNCE_WAIT_MS","Watcher","constructor","workspace","pubsub","watcherMain","options","msgs","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","logger","workspacePathLinux","pathNormalizeToLinux","path","process","env","BIT_WATCHER_USE_CHOKIDAR","watcherType","consumer","watch","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","watchScopeInternalFiles","watchParcel","watchChokidar","onStart","ParcelWatcher","subscribe","onParcelWatch","bind","ignore","onReady","clearStatusLine","createChokidarWatcher","watcher","chokidarWatcher","Promise","resolve","reject","onAll","on","watched","getWatched","totalWatched","flat","console","chalk","bold","JSON","stringify","toString","event","filePath","startTime","Date","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","err","onError","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","content","fs","readFile","debug","parsed","parse","sendEventsToClients","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","message","ms","setTimeout","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","clearComponentCache","component","get","componentMap","state","_consumer","Error","compFilesRelativeToWorkspace","getFilesRelativeToConsumer","compFiles","nonCompFiles","partition","relativeFile","getRelativePathLinux","Boolean","p","removedFiles","compact","all","map","pathExists","toStringWithoutVersion","bitMap","updateComponentPaths","f","getPathRelativeToConsumer","executeWatchOperationsOnComponent","trigger","triggerOnComponentChange","previewsRootDirs","previewsIds","getAllBitIds","_reloadConsumer","importObjectsIfNeeded","triggerOnBitmapChange","newDirs","difference","removedDirs","addResults","mapSeries","dir","executeWatchOperationsOnRemove","import","currentIds","hasVersionChanges","prevId","searchWithoutVersion","version","existsInScope","scope","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentAdd","OnComponentRemovedEvent","now","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","parentDir","shouldIgnoreFromLocalScopeChokidar","pathToCheck","startsWith","shouldIgnoreFromLocalScopeParcel","sep","chokidarOpts","getChokidarWatchOptions","ignored","chokidar","allEvents","events","type","includes","componentsFromBitMap","getAllComponents","getRootDir","exports"],"sources":["watcher.ts"],"sourcesContent":["import { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename, join, sep } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BIT_MAP, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy.scope';\nimport chokidar, { FSWatcher } from 'chokidar';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport {\n WorkspaceAspect,\n Workspace,\n OnComponentEventResult,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\nimport { Logger } from '@teambit/logger';\nimport ParcelWatcher, { Event } from '@parcel/watcher';\nimport { sendEventsToClients } from '@teambit/harmony.modules.send-server-sent-events';\n\nexport type WatcherProcessData = { watchProcess: ChildProcess; compilerId: ComponentID; componentIds: ComponentID[] };\n\nexport type EventMessages = {\n onAll: Function;\n onStart: Function;\n onReady: Function;\n onChange: OnFileEventFunc;\n onAdd: OnFileEventFunc;\n onUnlink: OnFileEventFunc;\n onError: Function;\n};\n\nexport type OnFileEventFunc = (\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) => void;\n\nexport type WatchOptions = {\n initiator?: CompilationInitiator;\n verbose?: boolean; // print watch events to the console. (also ts-server events if spawnTSServer is true)\n spawnTSServer?: boolean; // needed for check types and extract API/docs.\n checkTypes?: CheckTypes; // if enabled, the spawnTSServer becomes true.\n preCompile?: boolean; // whether compile all components before start watching\n compile?: boolean; // whether compile modified/added components during watch process\n import?: boolean; // whether import objects when .bitmap got version changes\n generateTypes?: boolean; // whether generate d.ts files for typescript files during watch process (hurts performance)\n trigger?: ComponentID; // trigger onComponentChange for the specified component-id. helpful when this comp must be a bundle, and needs to be recompile on any dep change.\n};\n\nexport type RootDirs = { [dir: PathLinux]: ComponentID };\n\ntype WatcherType = 'chokidar' | 'parcel';\n\nconst DEBOUNCE_WAIT_MS = 100;\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\n\nexport class Watcher {\n private watcherType: WatcherType = 'parcel';\n private chokidarWatcher: FSWatcher;\n private changedFilesPerComponent: { [componentId: string]: string[] } = {};\n private watchQueue = new WatchQueue();\n private bitMapChangesInProgress = false;\n private ipcEventsDir: PathOsBasedAbsolute;\n private rootDirs: RootDirs = {};\n private verbose = false;\n private multipleWatchers: WatcherProcessData[] = [];\n private logger: Logger;\n private workspacePathLinux: string;\n constructor(\n private workspace: Workspace,\n private pubsub: PubsubMain,\n private watcherMain: WatcherMain,\n private options: WatchOptions,\n private msgs?: EventMessages\n ) {\n this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;\n this.verbose = this.options.verbose || false;\n this.logger = this.watcherMain.logger;\n this.workspacePathLinux = pathNormalizeToLinux(this.workspace.path);\n\n if (process.env.BIT_WATCHER_USE_CHOKIDAR === 'true' || process.env.BIT_WATCHER_USE_CHOKIDAR === '1') {\n this.watcherType = 'chokidar';\n }\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async watch() {\n await this.setRootDirs();\n const componentIds = Object.values(this.rootDirs);\n await this.watcherMain.triggerOnPreWatch(componentIds, this.options);\n await this.watcherMain.watchScopeInternalFiles();\n this.watcherType === 'parcel' ? await this.watchParcel() : await this.watchChokidar();\n }\n\n private async watchParcel() {\n this.msgs?.onStart(this.workspace);\n await ParcelWatcher.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {\n ignore: ['**/node_modules/**', '**/package.json'],\n });\n this.msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n this.logger.clearStatusLine();\n }\n\n private async watchChokidar() {\n await this.createChokidarWatcher();\n const watcher = this.chokidarWatcher;\n const msgs = this.msgs;\n msgs?.onStart(this.workspace);\n\n return new Promise((resolve, reject) => {\n if (this.verbose) {\n // @ts-ignore\n if (msgs?.onAll) watcher.on('all', msgs.onAll);\n }\n watcher.on('ready', () => {\n msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n if (this.verbose) {\n const watched = this.chokidarWatcher.getWatched();\n const totalWatched = Object.values(watched).flat().length;\n logger.console(\n `${chalk.bold('the following files are being watched:')}\\n${JSON.stringify(watched, null, 2)}`\n );\n logger.console(`\\nTotal files being watched: ${chalk.bold(totalWatched.toString())}`);\n }\n\n this.logger.clearStatusLine();\n });\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n watcher.on('all', async (event, filePath) => {\n if (event !== 'change' && event !== 'add' && event !== 'unlink') return;\n const startTime = new Date().getTime();\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(filePath);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n });\n watcher.on('error', (err) => {\n msgs?.onError(err);\n reject(err);\n });\n });\n }\n\n /**\n * *** DEBOUNCING ***\n * some actions trigger multiple files changes at (almost) the same time. e.g. \"git pull\".\n * this causes some performance and instability issues. a debouncing mechanism was implemented to help with this.\n * the way how it works is that the first file of the same component starts the execution with a delay (e.g. 200ms).\n * if, in the meanwhile, another file of the same component was changed, it won't start a new execution, instead,\n * it'll only add the file to `this.changedFilesPerComponent` prop.\n * once the execution starts, it'll delete this component-id from the `this.changedFilesPerComponent` array,\n * indicating the next file-change to start a new execution.\n *\n * implementation wise, `lodash.debounce` doesn't help here, because:\n * A) it doesn't return the results, unless \"leading\" option is true. here, it must be false, otherwise, it'll start\n * the execution immediately.\n * B) it debounces the method regardless the param passes to it. so it'll disregard the component-id and will delay\n * other components undesirably.\n *\n * *** QUEUE ***\n * the debouncing helps to not execute the same component multiple times concurrently. however, multiple components\n * and .bitmap changes execution can still be processed concurrently.\n * the following example explains why this is an issue.\n * compA is changed in the .bitmap file from version 0.0.1 to 0.0.2. its files were changed as well.\n * all these changes get pulled at the same time by \"git pull\", as a result, the execution of compA and the .bitmap\n * happen at the same time.\n * during the execution of compA, the component id is parsed as compA@0.0.1, later, it asks for the Workspace for this\n * id. while the workspace is looking for this id, the .bitmap execution reloaded the consumer and changed all versions.\n * after this change, the workspace doesn't have this id anymore, which will trigger an error.\n * to ensure this won't happen, we keep a flag to indicate whether the .bitmap execution is running, and if so, all\n * other executions are paused until the queue is empty (this is done by awaiting for queue.onIdle).\n * once the queue is empty, we know the .bitmap process was done and the workspace has all new ids.\n * in the example above, at this stage, the id will be resolved to compA@0.0.2.\n * one more thing, the queue is configured to have concurrency of 1. to make sure two components are not processed at\n * the same time. (the same way is done when loading all components from the filesystem/scope).\n * this way we can also ensure that if compA was started before the .bitmap execution, it will complete before the\n * .bitmap execution starts.\n */\n private async handleChange(filePath: string): Promise<{\n results: OnComponentEventResult[];\n files: string[];\n failureMsg?: string;\n debounced?: boolean;\n irrelevant?: boolean; // file/dir is not part of any component\n }> {\n try {\n if (filePath.endsWith(BIT_MAP)) {\n this.bitMapChangesInProgress = true;\n const buildResults = await this.watchQueue.add(() => this.handleBitmapChanges());\n this.bitMapChangesInProgress = false;\n this.logger.clearStatusLine();\n return { results: buildResults, files: [filePath] };\n }\n if (this.bitMapChangesInProgress) {\n await this.watchQueue.onIdle();\n }\n if (dirname(filePath) === this.ipcEventsDir) {\n const eventName = basename(filePath);\n if (eventName === 'onNotifySSE') {\n const content = await fs.readFile(filePath, 'utf8');\n this.logger.debug(`Watcher, onNotifySSE ${content}`);\n const parsed = JSON.parse(content);\n sendEventsToClients(parsed.event, parsed);\n } else {\n await this.watcherMain.ipcEvents.triggerGotEvent(eventName as any);\n }\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(WORKSPACE_JSONC)) {\n await this.workspace.triggerOnWorkspaceConfigChange();\n return { results: [], files: [filePath] };\n }\n if (filePath.endsWith(UNMERGED_FILENAME)) {\n await this.workspace.clearCache();\n return { results: [], files: [filePath] };\n }\n const componentId = this.getComponentIdByPath(filePath);\n if (!componentId) {\n this.logger.clearStatusLine();\n return { results: [], files: [], irrelevant: true };\n }\n const compIdStr = componentId.toString();\n if (this.changedFilesPerComponent[compIdStr]) {\n this.changedFilesPerComponent[compIdStr].push(filePath);\n this.logger.clearStatusLine();\n return { results: [], files: [], debounced: true };\n }\n this.changedFilesPerComponent[compIdStr] = [filePath];\n await this.sleep(DEBOUNCE_WAIT_MS);\n const files = this.changedFilesPerComponent[compIdStr];\n delete this.changedFilesPerComponent[compIdStr];\n\n const buildResults = await this.watchQueue.add(() => this.triggerCompChanges(componentId, files));\n const failureMsg = buildResults.length\n ? undefined\n : `files ${files.join(', ')} are inside the component ${compIdStr} but configured to be ignored`;\n this.logger.clearStatusLine();\n return { results: buildResults, files, failureMsg };\n } catch (err: any) {\n const msg = `watcher found an error while handling ${filePath}`;\n logger.error(msg, err);\n logger.console(`${msg}, ${err.message}`);\n this.logger.clearStatusLine();\n return { results: [], files: [filePath], failureMsg: err.message };\n }\n }\n\n private async sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async triggerCompChanges(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[]\n ): Promise<OnComponentEventResult[]> {\n let updatedComponentId: ComponentID | undefined = componentId;\n if (!this.workspace.hasId(componentId)) {\n // bitmap has changed meanwhile, which triggered `handleBitmapChanges`, which re-loaded consumer and updated versions\n // so the original componentId might not be in the workspace now, and we need to find the updated one\n const ids = this.workspace.listIds();\n updatedComponentId = ids.find((id) => id.isEqual(componentId, { ignoreVersion: true }));\n if (!updatedComponentId) {\n logger.debug(`triggerCompChanges, the component ${componentId.toString()} was probably removed from .bitmap`);\n return [];\n }\n }\n this.workspace.clearComponentCache(updatedComponentId);\n const component = await this.workspace.get(updatedComponentId);\n const componentMap: ComponentMap = component.state._consumer.componentMap;\n if (!componentMap) {\n throw new Error(\n `unable to find componentMap for ${updatedComponentId.toString()}, make sure this component is in .bitmap`\n );\n }\n const compFilesRelativeToWorkspace = componentMap.getFilesRelativeToConsumer();\n const [compFiles, nonCompFiles] = partition(files, (filePath) => {\n const relativeFile = this.getRelativePathLinux(filePath);\n return Boolean(compFilesRelativeToWorkspace.find((p) => p === relativeFile));\n });\n // nonCompFiles are either, files that were removed from the filesystem or existing files that are ignored.\n // the compiler takes care of removedFiles differently, e.g. removes dists dir and old symlinks.\n const removedFiles = compact(\n await Promise.all(nonCompFiles.map(async (filePath) => ((await fs.pathExists(filePath)) ? null : filePath)))\n );\n\n if (!compFiles.length && !removedFiles.length) {\n logger.debug(\n `the following files are part of the component ${componentId.toStringWithoutVersion()} but configured to be ignored:\\n${files.join(\n '\\n'\n )}'`\n );\n return [];\n }\n this.consumer.bitMap.updateComponentPaths(\n componentId,\n compFiles.map((f) => this.consumer.getPathRelativeToConsumer(f)),\n removedFiles.map((f) => this.consumer.getPathRelativeToConsumer(f))\n );\n const buildResults = await this.executeWatchOperationsOnComponent(\n updatedComponentId,\n compFiles,\n removedFiles,\n true\n );\n if (this.options.trigger && !updatedComponentId.isEqual(this.options.trigger)) {\n await this.workspace.triggerOnComponentChange(this.options.trigger, [], [], this.options);\n }\n\n return buildResults;\n }\n\n /**\n * if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.\n */\n private async handleBitmapChanges(): Promise<OnComponentEventResult[]> {\n const previewsRootDirs = { ...this.rootDirs };\n const previewsIds = this.consumer.bitMap.getAllBitIds();\n await this.workspace._reloadConsumer();\n await this.setRootDirs();\n await this.importObjectsIfNeeded(previewsIds);\n await this.workspace.triggerOnBitmapChange();\n const newDirs: string[] = difference(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));\n const removedDirs: string[] = difference(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));\n const results: OnComponentEventResult[] = [];\n if (newDirs.length) {\n const addResults = await mapSeries(newDirs, async (dir) =>\n this.executeWatchOperationsOnComponent(this.rootDirs[dir], [], [], false)\n );\n results.push(...addResults.flat());\n }\n if (removedDirs.length) {\n await mapSeries(removedDirs, (dir) => this.executeWatchOperationsOnRemove(previewsRootDirs[dir]));\n }\n\n return results;\n }\n\n /**\n * needed when using git.\n * it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.\n * because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.\n * as soon as the watcher gets an event about a file change, it loads the component which throws\n * ComponentsPendingImport error.\n * to resolve this, we import the new objects as soon as the .bitmap file changes.\n * for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is\n * not already in the scope.\n */\n private async importObjectsIfNeeded(previewsIds: ComponentIdList) {\n if (!this.options.import) {\n return;\n }\n const currentIds = this.consumer.bitMap.getAllBitIds();\n const hasVersionChanges = currentIds.find((id) => {\n const prevId = previewsIds.searchWithoutVersion(id);\n return prevId && prevId.version !== id.version;\n });\n if (!hasVersionChanges) {\n return;\n }\n const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);\n if (existsInScope) {\n // the .bitmap change was probably a result of tag/snap/merge, no need to import.\n return;\n }\n if (this.options.verbose) {\n logger.console(\n `Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`\n );\n }\n await this.workspace.scope.import(currentIds, {\n useCache: true,\n lane: await this.workspace.getCurrentLaneObject(),\n });\n }\n\n private async executeWatchOperationsOnRemove(componentId: ComponentID) {\n logger.debug(`running OnComponentRemove hook for ${chalk.bold(componentId.toString())}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));\n await this.workspace.triggerOnComponentRemove(componentId);\n }\n\n private async executeWatchOperationsOnComponent(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[],\n removedFiles: PathOsBasedAbsolute[] = [],\n isChange = true\n ): Promise<OnComponentEventResult[]> {\n if (this.isComponentWatchedExternally(componentId)) {\n // update capsule, once done, it automatically triggers the external watcher\n await this.workspace.get(componentId);\n return [];\n }\n const idStr = componentId.toString();\n\n if (isChange) {\n logger.debug(`running OnComponentChange hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentChangeEvent(idStr, 'OnComponentChange'));\n } else {\n logger.debug(`running OnComponentAdd hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentAddEvent(idStr, 'OnComponentAdd'));\n }\n\n const buildResults = isChange\n ? await this.workspace.triggerOnComponentChange(componentId, files, removedFiles, this.options)\n : await this.workspace.triggerOnComponentAdd(componentId, this.options);\n\n return buildResults;\n }\n\n private createOnComponentRemovedEvent(idStr) {\n return new OnComponentRemovedEvent(Date.now(), idStr);\n }\n\n private createOnComponentChangeEvent(idStr, hook) {\n return new OnComponentChangeEvent(Date.now(), idStr, hook);\n }\n\n private createOnComponentAddEvent(idStr, hook) {\n return new OnComponentAddEvent(Date.now(), idStr, hook);\n }\n\n private isComponentWatchedExternally(componentId: ComponentID) {\n const watcherData = this.multipleWatchers.find((m) => m.componentIds.find((id) => id.isEqual(componentId)));\n if (watcherData) {\n logger.debug(`${componentId.toString()} is watched by ${watcherData.compilerId.toString()}`);\n return true;\n }\n return false;\n }\n\n private getComponentIdByPath(filePath: string): ComponentID | null {\n const relativeFile = this.getRelativePathLinux(filePath);\n const rootDir = this.findRootDirByFilePathRecursively(relativeFile);\n if (!rootDir) {\n // the file is not part of any component. If it was a new component, or a new file of\n // existing component, then, handleBitmapChanges() should deal with it.\n return null;\n }\n return this.rootDirs[rootDir];\n }\n\n private getRelativePathLinux(filePath: string) {\n return pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(filePath));\n }\n\n private findRootDirByFilePathRecursively(filePath: string): string | null {\n if (this.rootDirs[filePath]) return filePath;\n const parentDir = dirname(filePath);\n if (parentDir === filePath) return null;\n return this.findRootDirByFilePathRecursively(parentDir);\n }\n\n private shouldIgnoreFromLocalScopeChokidar(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(`${this.workspacePathLinux}/.git/`) || pathToCheck.startsWith(`${this.workspacePathLinux}/.bit/`)\n );\n }\n\n private shouldIgnoreFromLocalScopeParcel(pathToCheck: string) {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return pathToCheck.startsWith(join(this.workspace.path, '.git') + sep)\n || pathToCheck.startsWith(join(this.workspace.path, '.bit') + sep);\n }\n\n private async createChokidarWatcher() {\n const chokidarOpts = await this.watcherMain.getChokidarWatchOptions();\n // `chokidar` matchers have Bash-parity, so Windows-style backslashes are not supported as separators.\n // (windows-style backslashes are converted to forward slashes)\n chokidarOpts.ignored = ['**/node_modules/**', '**/package.json', this.shouldIgnoreFromLocalScopeChokidar.bind(this)];\n this.chokidarWatcher = chokidar.watch(this.workspace.path, chokidarOpts);\n if (this.verbose) {\n logger.console(`${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.chokidarWatcher.options, undefined, 2)}`);\n }\n }\n\n private async onParcelWatch(err: Error | null, allEvents: Event[]) {\n const events = allEvents.filter((event) => !this.shouldIgnoreFromLocalScopeParcel(event.path));\n if (!events.length) {\n return;\n }\n\n const msgs = this.msgs;\n if (this.verbose) {\n if (msgs?.onAll) events.forEach((event) => msgs.onAll(event.type, event.path));\n }\n if (err) {\n msgs?.onError(err);\n if (err.message.includes('Error starting FSEvents stream')) {\n throw new Error(`failed to start the watcher: ${err.message}.\ntry rerunning the command. if that doesn't help, please refer to this Watchman troubleshooting guide:\nhttps://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`);\n }\n // don't throw on other errors, just log them.\n // for example, when running \"bit install\" on a big project, it might error out with:\n // \"Error: Events were dropped by the FSEvents client. File system must be re-scanned.\"\n // but it still works for the future events.\n }\n const startTime = new Date().getTime();\n await mapSeries(events, async (event) => {\n const { files, results, debounced, irrelevant, failureMsg } = await this.handleChange(event.path);\n if (debounced || irrelevant) {\n return;\n }\n const duration = new Date().getTime() - startTime;\n msgs?.onChange(files, results, this.verbose, duration, failureMsg);\n });\n }\n\n private async setRootDirs() {\n this.rootDirs = {};\n const componentsFromBitMap = this.consumer.bitMap.getAllComponents();\n componentsFromBitMap.map((componentMap) => {\n const componentId = componentMap.id;\n const rootDir = componentMap.getRootDir();\n this.rootDirs[rootDir] = componentId;\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,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AEA,MAAc3C,WAAWA,CAAA,EAAG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAMmL,oBAAoB,GAAG,IAAI,CAACxL,QAAQ,CAACqH,MAAM,CAACoE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAACtE,GAAG,CAAEhB,YAAY,IAAK;MACzC,MAAMxB,WAAW,GAAGwB,YAAY,CAACN,EAAE;MACnC,MAAM4E,OAAO,GAAGtE,YAAY,CAACwF,UAAU,CAAC,CAAC;MACzC,IAAI,CAACrL,QAAQ,CAACmK,OAAO,CAAC,GAAG9F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAACiH,OAAA,CAAA/M,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -7,7 +7,7 @@ import { IpcEventsMain } from '@teambit/ipc-events';
7
7
  import { Logger, LoggerMain } from '@teambit/logger';
8
8
  import { PubsubMain } from '@teambit/pubsub';
9
9
  import { Workspace } from '@teambit/workspace';
10
- import { WatchOptions } from './watcher';
10
+ import { EventMessages, WatchOptions } from './watcher';
11
11
  import { ConfigStoreMain } from '@teambit/config-store';
12
12
  export type OnPreWatch = (componentIds: ComponentID[], watchOpts: WatchOptions) => Promise<void>;
13
13
  export type OnPreWatchSlot = SlotRegistry<OnPreWatch>;
@@ -20,7 +20,7 @@ export declare class WatcherMain {
20
20
  readonly logger: Logger;
21
21
  readonly configStore: ConfigStoreMain;
22
22
  constructor(workspace: Workspace, scope: ScopeMain, pubsub: PubsubMain, onPreWatchSlot: OnPreWatchSlot, ipcEvents: IpcEventsMain, logger: Logger, configStore: ConfigStoreMain);
23
- watch(opts: WatchOptions): Promise<void>;
23
+ watch(opts: WatchOptions, msgs?: EventMessages): Promise<void>;
24
24
  getChokidarWatchOptions(): Promise<ChokidarWatchOptions>;
25
25
  watchScopeInternalFiles(): Promise<void>;
26
26
  triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions): Promise<void>;
@@ -109,9 +109,9 @@ class WatcherMain {
109
109
  this.logger = logger;
110
110
  this.configStore = configStore;
111
111
  }
112
- async watch(opts) {
112
+ async watch(opts, msgs) {
113
113
  if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
114
- const watcher = new (_watcher().Watcher)(this.workspace, this.pubsub, this, opts);
114
+ const watcher = new (_watcher().Watcher)(this.workspace, this.pubsub, this, opts, msgs);
115
115
  await watcher.watch();
116
116
  }
117
117
  async getChokidarWatchOptions() {
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_harmony","_scope","_ipcEvents","_logger","_pubsub","_legacy","_workspace","_pMapSeries","_interopRequireDefault","_watch","_watcher","_watcher2","_configStore","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WatcherMain","constructor","workspace","scope","pubsub","onPreWatchSlot","ipcEvents","logger","configStore","watch","opts","OutsideWorkspaceError","watcher","Watcher","getChokidarWatchOptions","usePollingConf","getConfig","CFG_WATCH_USE_POLLING","usePolling","ignoreInitial","persistent","watchScopeInternalFiles","chokidarOpts","triggerOnPreWatch","componentIds","watchOpts","preWatchFunctions","values","pMapSeries","func","registerOnPreWatch","onPreWatchFunc","register","provider","cli","loggerMain","_","createLogger","WatcherAspect","id","watcherMain","watchCmd","WatchCommand","exports","Slot","withType","CLIAspect","WorkspaceAspect","ScopeAspect","PubsubAspect","LoggerAspect","IpcEventsAspect","ConfigStoreAspect","MainRuntime","addRuntime","_default"],"sources":["watcher.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WatchOptions as ChokidarWatchOptions } from 'chokidar';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { ComponentID } from '@teambit/component-id';\nimport { IpcEventsAspect, IpcEventsMain } from '@teambit/ipc-events';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport { CFG_WATCH_USE_POLLING } from '@teambit/legacy.constants';\nimport { WorkspaceAspect, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { WatchCommand } from './watch.cmd';\nimport { Watcher, WatchOptions } from './watcher';\nimport { WatcherAspect } from './watcher.aspect';\nimport { ConfigStoreAspect, ConfigStoreMain } from '@teambit/config-store';\n\nexport type OnPreWatch = (componentIds: ComponentID[], 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 readonly ipcEvents: IpcEventsMain,\n readonly logger: Logger,\n readonly configStore: ConfigStoreMain\n ) {}\n\n async watch(opts: WatchOptions) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const watcher = new Watcher(this.workspace, this.pubsub, this, opts);\n await watcher.watch();\n }\n\n async getChokidarWatchOptions(): Promise<ChokidarWatchOptions> {\n const usePollingConf = this.configStore.getConfig(CFG_WATCH_USE_POLLING);\n const usePolling = usePollingConf === 'true';\n return {\n ignoreInitial: true,\n persistent: true,\n usePolling,\n };\n }\n\n async watchScopeInternalFiles() {\n const chokidarOpts = await this.getChokidarWatchOptions();\n await this.scope.watchScopeInternalFiles(chokidarOpts);\n }\n\n async triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n const preWatchFunctions = this.onPreWatchSlot.values();\n await pMapSeries(preWatchFunctions, async (func) => {\n await func(componentIds, 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 = [\n CLIAspect,\n WorkspaceAspect,\n ScopeAspect,\n PubsubAspect,\n LoggerAspect,\n IpcEventsAspect,\n ConfigStoreAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, scope, pubsub, loggerMain, ipcEvents, configStore]: [\n CLIMain,\n Workspace,\n ScopeMain,\n PubsubMain,\n LoggerMain,\n IpcEventsMain,\n ConfigStoreMain,\n ],\n _,\n [onPreWatchSlot]: [OnPreWatchSlot]\n ) {\n const logger = loggerMain.createLogger(WatcherAspect.id);\n const watcherMain = new WatcherMain(workspace, scope, pubsub, onPreWatchSlot, ipcEvents, logger, configStore);\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,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA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,GAAG,CAACF,QAAQ,CAACS,QAAQ,CAAC;IACtB,OAAOD,WAAW;EACpB;AACF;AAACG,OAAA,CAAA3C,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CA3EYkB,WAAW,WA4CP,CAAC4C,eAAI,CAACC,QAAQ,CAAa,CAAC,CAAC;AAAA/D,eAAA,CA5CjCkB,WAAW,kBA6CA,CACpB8C,gBAAS,EACTC,4BAAe,EACfC,oBAAW,EACXC,sBAAY,EACZC,sBAAY,EACZC,4BAAe,EACfC,gCAAiB,CAClB;AAAAtE,eAAA,CArDUkB,WAAW,aAsDLqD,kBAAW;AAuB9Bf,yBAAa,CAACgB,UAAU,CAACtD,WAAW,CAAC;AAAC,IAAAuD,QAAA,GAAAZ,OAAA,CAAA9D,OAAA,GAEvBmB,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_harmony","_scope","_ipcEvents","_logger","_pubsub","_legacy","_workspace","_pMapSeries","_interopRequireDefault","_watch","_watcher","_watcher2","_configStore","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WatcherMain","constructor","workspace","scope","pubsub","onPreWatchSlot","ipcEvents","logger","configStore","watch","opts","msgs","OutsideWorkspaceError","watcher","Watcher","getChokidarWatchOptions","usePollingConf","getConfig","CFG_WATCH_USE_POLLING","usePolling","ignoreInitial","persistent","watchScopeInternalFiles","chokidarOpts","triggerOnPreWatch","componentIds","watchOpts","preWatchFunctions","values","pMapSeries","func","registerOnPreWatch","onPreWatchFunc","register","provider","cli","loggerMain","_","createLogger","WatcherAspect","id","watcherMain","watchCmd","WatchCommand","exports","Slot","withType","CLIAspect","WorkspaceAspect","ScopeAspect","PubsubAspect","LoggerAspect","IpcEventsAspect","ConfigStoreAspect","MainRuntime","addRuntime","_default"],"sources":["watcher.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WatchOptions as ChokidarWatchOptions } from 'chokidar';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { ComponentID } from '@teambit/component-id';\nimport { IpcEventsAspect, IpcEventsMain } from '@teambit/ipc-events';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport { CFG_WATCH_USE_POLLING } from '@teambit/legacy.constants';\nimport { WorkspaceAspect, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { WatchCommand } from './watch.cmd';\nimport { EventMessages, Watcher, WatchOptions } from './watcher';\nimport { WatcherAspect } from './watcher.aspect';\nimport { ConfigStoreAspect, ConfigStoreMain } from '@teambit/config-store';\n\nexport type OnPreWatch = (componentIds: ComponentID[], 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 readonly ipcEvents: IpcEventsMain,\n readonly logger: Logger,\n readonly configStore: ConfigStoreMain\n ) {}\n\n async watch(opts: WatchOptions, msgs?: EventMessages) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const watcher = new Watcher(this.workspace, this.pubsub, this, opts, msgs);\n await watcher.watch();\n }\n\n async getChokidarWatchOptions(): Promise<ChokidarWatchOptions> {\n const usePollingConf = this.configStore.getConfig(CFG_WATCH_USE_POLLING);\n const usePolling = usePollingConf === 'true';\n return {\n ignoreInitial: true,\n persistent: true,\n usePolling,\n };\n }\n\n async watchScopeInternalFiles() {\n const chokidarOpts = await this.getChokidarWatchOptions();\n await this.scope.watchScopeInternalFiles(chokidarOpts);\n }\n\n async triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n const preWatchFunctions = this.onPreWatchSlot.values();\n await pMapSeries(preWatchFunctions, async (func) => {\n await func(componentIds, 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 = [\n CLIAspect,\n WorkspaceAspect,\n ScopeAspect,\n PubsubAspect,\n LoggerAspect,\n IpcEventsAspect,\n ConfigStoreAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, scope, pubsub, loggerMain, ipcEvents, configStore]: [\n CLIMain,\n Workspace,\n ScopeMain,\n PubsubMain,\n LoggerMain,\n IpcEventsMain,\n ConfigStoreMain,\n ],\n _,\n [onPreWatchSlot]: [OnPreWatchSlot]\n ) {\n const logger = loggerMain.createLogger(WatcherAspect.id);\n const watcherMain = new WatcherMain(workspace, scope, pubsub, onPreWatchSlot, ipcEvents, logger, configStore);\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,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAA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YAAY,CAACC,yBAAa,CAACC,EAAE,CAAC;IACxD,MAAMC,WAAW,GAAG,IAAIzC,WAAW,CAACE,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEC,cAAc,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,CAAC;IAC7G,MAAMkC,QAAQ,GAAG,KAAIC,qBAAY,EAACvC,MAAM,EAAEG,MAAM,EAAEkC,WAAW,CAAC;IAC9DN,GAAG,CAACF,QAAQ,CAACS,QAAQ,CAAC;IACtB,OAAOD,WAAW;EACpB;AACF;AAACG,OAAA,CAAA5C,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CA3EYkB,WAAW,WA4CP,CAAC6C,eAAI,CAACC,QAAQ,CAAa,CAAC,CAAC;AAAAhE,eAAA,CA5CjCkB,WAAW,kBA6CA,CACpB+C,gBAAS,EACTC,4BAAe,EACfC,oBAAW,EACXC,sBAAY,EACZC,sBAAY,EACZC,4BAAe,EACfC,gCAAiB,CAClB;AAAAvE,eAAA,CArDUkB,WAAW,aAsDLsD,kBAAW;AAuB9Bf,yBAAa,CAACgB,UAAU,CAACvD,WAAW,CAAC;AAAC,IAAAwD,QAAA,GAAAZ,OAAA,CAAA/D,OAAA,GAEvBmB,WAAW","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/watcher",
3
- "version": "1.0.588",
3
+ "version": "1.0.592",
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": "1.0.588"
9
+ "version": "1.0.592"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -15,18 +15,19 @@
15
15
  "moment": "2.29.4",
16
16
  "chokidar": "3.6.0",
17
17
  "p-map-series": "2.1.0",
18
+ "@parcel/watcher": "^2.5.1",
18
19
  "fs-extra": "10.0.0",
19
20
  "@teambit/component-id": "1.2.3",
20
21
  "@teambit/harmony": "0.4.7",
21
- "@teambit/compiler": "1.0.588",
22
- "@teambit/logger": "0.0.1258",
23
- "@teambit/workspace": "1.0.588",
24
- "@teambit/cli": "0.0.1165",
25
- "@teambit/pubsub": "1.0.588",
26
- "@teambit/config-store": "0.0.45",
27
- "@teambit/ipc-events": "1.0.588",
22
+ "@teambit/compiler": "1.0.592",
23
+ "@teambit/logger": "0.0.1262",
24
+ "@teambit/workspace": "1.0.592",
25
+ "@teambit/cli": "0.0.1169",
26
+ "@teambit/pubsub": "1.0.592",
27
+ "@teambit/config-store": "0.0.49",
28
+ "@teambit/ipc-events": "1.0.592",
28
29
  "@teambit/legacy.constants": "0.0.11",
29
- "@teambit/scope": "1.0.588",
30
+ "@teambit/scope": "1.0.592",
30
31
  "@teambit/harmony.modules.send-server-sent-events": "0.0.7",
31
32
  "@teambit/legacy.bit-map": "0.0.104",
32
33
  "@teambit/legacy.consumer": "0.0.47",