@teambit/watcher 1.0.673 → 1.0.675
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/output-formatter.js +8 -8
- package/dist/output-formatter.js.map +1 -1
- package/dist/watch.cmd.d.ts +0 -11
- package/dist/watch.cmd.js +0 -24
- package/dist/watch.cmd.js.map +1 -1
- package/dist/watcher.d.ts +1 -2
- package/dist/watcher.js.map +1 -1
- package/dist/watcher.main.runtime.js +1 -1
- package/dist/watcher.main.runtime.js.map +1 -1
- package/package.json +10 -11
- /package/dist/{preview-1753920449877.js → preview-1753990279797.js} +0 -0
package/dist/output-formatter.js
CHANGED
@@ -12,13 +12,6 @@ function _logger() {
|
|
12
12
|
};
|
13
13
|
return data;
|
14
14
|
}
|
15
|
-
function _compiler() {
|
16
|
-
const data = require("@teambit/compiler");
|
17
|
-
_compiler = function () {
|
18
|
-
return data;
|
19
|
-
};
|
20
|
-
return data;
|
21
|
-
}
|
22
15
|
function _chalk() {
|
23
16
|
const data = _interopRequireDefault(require("chalk"));
|
24
17
|
_chalk = function () {
|
@@ -33,6 +26,13 @@ function _lodash() {
|
|
33
26
|
};
|
34
27
|
return data;
|
35
28
|
}
|
29
|
+
function _legacy() {
|
30
|
+
const data = require("@teambit/legacy.constants");
|
31
|
+
_legacy = function () {
|
32
|
+
return data;
|
33
|
+
};
|
34
|
+
return data;
|
35
|
+
}
|
36
36
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
37
37
|
function formatWatchPathsSortByComponent(trackDirs) {
|
38
38
|
const title = ` ${_chalk().default.underline('STATUS\tCOMPONENT ID')}\n`;
|
@@ -46,7 +46,7 @@ function formatCompileResults(compileResults) {
|
|
46
46
|
if (!compileResults.length) return '';
|
47
47
|
return (0, _lodash().compact)(compileResults
|
48
48
|
// currently, we are interested only in the compiler results
|
49
|
-
.filter(compileResult => compileResult.extensionId ===
|
49
|
+
.filter(compileResult => compileResult.extensionId === _legacy().Extensions.compiler).map(compileResult => compileResult.results.toString())).join('\n');
|
50
50
|
}
|
51
51
|
|
52
52
|
//# sourceMappingURL=output-formatter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_logger","data","require","
|
1
|
+
{"version":3,"names":["_logger","data","require","_chalk","_interopRequireDefault","_lodash","_legacy","e","__esModule","default","formatWatchPathsSortByComponent","trackDirs","title","chalk","underline","Object","keys","reduce","outputString","watchPath","componentId","formattedWatchPath","Logger","successSymbol","formatCompileResults","compileResults","length","compact","filter","compileResult","extensionId","Extensions","compiler","map","results","toString","join"],"sources":["output-formatter.ts"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport type { OnComponentEventResult } from '@teambit/workspace';\nimport chalk from 'chalk';\nimport type { RootDirs } from './watcher';\nimport { compact } from 'lodash';\nimport { Extensions } from '@teambit/legacy.constants';\n\nexport function formatWatchPathsSortByComponent(trackDirs: RootDirs) {\n const title = ` ${chalk.underline('STATUS\\tCOMPONENT ID')}\\n`;\n return Object.keys(trackDirs).reduce((outputString, watchPath) => {\n const componentId = trackDirs[watchPath];\n const formattedWatchPath = `\\t\\t - ${watchPath}\\n`;\n return `${outputString}${Logger.successSymbol()} SUCCESS\\t${componentId}\\n${formattedWatchPath}`;\n }, title);\n}\n\nexport function formatCompileResults(compileResults: OnComponentEventResult[]) {\n if (!compileResults.length) return '';\n return compact(\n compileResults\n // currently, we are interested only in the compiler results\n .filter((compileResult) => compileResult.extensionId === Extensions.compiler)\n .map((compileResult) => compileResult.results.toString())\n ).join('\\n');\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,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@ -1,6 +1,5 @@
|
|
1
1
|
import type { Command, CommandOptions } from '@teambit/cli';
|
2
2
|
import type { Logger } from '@teambit/logger';
|
3
|
-
import type { PubsubMain } from '@teambit/pubsub';
|
4
3
|
import type { WatcherMain } from './watcher.main.runtime';
|
5
4
|
type WatchCmdOpts = {
|
6
5
|
verbose?: boolean;
|
@@ -12,10 +11,6 @@ type WatchCmdOpts = {
|
|
12
11
|
trigger?: string;
|
13
12
|
};
|
14
13
|
export declare class WatchCommand implements Command {
|
15
|
-
/**
|
16
|
-
* logger extension.
|
17
|
-
*/
|
18
|
-
private pubsub;
|
19
14
|
/**
|
20
15
|
* logger extension.
|
21
16
|
*/
|
@@ -32,10 +27,6 @@ export declare class WatchCommand implements Command {
|
|
32
27
|
group: string;
|
33
28
|
options: CommandOptions;
|
34
29
|
constructor(
|
35
|
-
/**
|
36
|
-
* logger extension.
|
37
|
-
*/
|
38
|
-
pubsub: PubsubMain,
|
39
30
|
/**
|
40
31
|
* logger extension.
|
41
32
|
*/
|
@@ -44,8 +35,6 @@ export declare class WatchCommand implements Command {
|
|
44
35
|
* watcher extension.
|
45
36
|
*/
|
46
37
|
watcher: WatcherMain);
|
47
|
-
private registerToEvents;
|
48
|
-
private eventsListener;
|
49
38
|
wait(cliArgs: [], watchCmdOpts: WatchCmdOpts): Promise<void>;
|
50
39
|
}
|
51
40
|
export {};
|
package/dist/watch.cmd.js
CHANGED
@@ -25,13 +25,6 @@ function _componentId() {
|
|
25
25
|
};
|
26
26
|
return data;
|
27
27
|
}
|
28
|
-
function _compiler() {
|
29
|
-
const data = require("@teambit/compiler");
|
30
|
-
_compiler = function () {
|
31
|
-
return data;
|
32
|
-
};
|
33
|
-
return data;
|
34
|
-
}
|
35
28
|
function _outputFormatter() {
|
36
29
|
const data = require("./output-formatter");
|
37
30
|
_outputFormatter = function () {
|
@@ -52,10 +45,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
52
45
|
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); }
|
53
46
|
class WatchCommand {
|
54
47
|
constructor(
|
55
|
-
/**
|
56
|
-
* logger extension.
|
57
|
-
*/
|
58
|
-
pubsub,
|
59
48
|
/**
|
60
49
|
* logger extension.
|
61
50
|
*/
|
@@ -64,7 +53,6 @@ class WatchCommand {
|
|
64
53
|
* watcher extension.
|
65
54
|
*/
|
66
55
|
watcher) {
|
67
|
-
this.pubsub = pubsub;
|
68
56
|
this.logger = logger;
|
69
57
|
this.watcher = watcher;
|
70
58
|
_defineProperty(this, "name", 'watch');
|
@@ -75,18 +63,6 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
|
|
75
63
|
_defineProperty(this, "alias", '');
|
76
64
|
_defineProperty(this, "group", 'component-development');
|
77
65
|
_defineProperty(this, "options", [['v', 'verbose', 'show all watch events and compiler verbose output'], ['', 'skip-pre-compilation', 'skip compilation step before starting to watch'], ['t', 'check-types [string]', 'show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project'], ['i', 'import', 'DEPRECATED. it is now the default. helpful when using git. import component objects if .bitmap changed not by bit'], ['', 'skip-import', 'do not import component objects if .bitmap changed not by bit'], ['', 'generate-types', 'EXPERIMENTAL. generate d.ts files for typescript components (hurts performance)'], ['', 'trigger <comp-id>', 'trigger recompilation of the specified component regardless of what changed. helpful when this comp-id must be a bundle']]);
|
78
|
-
_defineProperty(this, "eventsListener", event => {
|
79
|
-
switch (event.type) {
|
80
|
-
case _compiler().CompilerErrorEvent.TYPE:
|
81
|
-
this.logger.console(`Watcher error ${event.data.error}, 'error'`);
|
82
|
-
break;
|
83
|
-
default:
|
84
|
-
}
|
85
|
-
});
|
86
|
-
this.registerToEvents();
|
87
|
-
}
|
88
|
-
registerToEvents() {
|
89
|
-
this.pubsub.sub(_compiler().CompilerAspect.id, this.eventsListener);
|
90
66
|
}
|
91
67
|
async wait(cliArgs, watchCmdOpts) {
|
92
68
|
const {
|
package/dist/watch.cmd.js.map
CHANGED
@@ -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","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","preImport","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 type { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { BitBaseEvent, PubsubMain } from '@teambit/pubsub';\nimport type { OnComponentEventResult, Workspace } from '@teambit/workspace';\nimport { ComponentID } from '@teambit/component-id';\nimport { CompilerAspect, CompilerErrorEvent } from '@teambit/compiler';\nimport type { EventMessages, RootDirs, WatchOptions } from './watcher';\nimport { formatCompileResults, formatWatchPathsSortByComponent } from './output-formatter';\nimport { CheckTypes } from './check-types';\nimport type { 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 = 'component-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 preImport: !skipImport,\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,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,iBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,gBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2C,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAA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C,OAAO,CAAC;AAC/B","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_moment","_componentId","_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","logger","watcher","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","preImport","watch","getMessages","exports","onAll","event","path","console","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 type { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { OnComponentEventResult, Workspace } from '@teambit/workspace';\nimport { ComponentID } from '@teambit/component-id';\nimport type { EventMessages, RootDirs, WatchOptions } from './watcher';\nimport { formatCompileResults, formatWatchPathsSortByComponent } from './output-formatter';\nimport { CheckTypes } from './check-types';\nimport type { 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 = 'component-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 logger: Logger,\n\n /**\n * watcher extension.\n */\n private watcher: WatcherMain\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 preImport: !skipImport,\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;AAA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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
@@ -2,7 +2,6 @@ import type { PubsubMain } from '@teambit/pubsub';
|
|
2
2
|
import type { ComponentID } from '@teambit/component-id';
|
3
3
|
import type { Consumer } from '@teambit/legacy.consumer';
|
4
4
|
import type { ChildProcess } from 'child_process';
|
5
|
-
import type { CompilationInitiator } from '@teambit/compiler';
|
6
5
|
import type { Workspace, OnComponentEventResult } from '@teambit/workspace';
|
7
6
|
import type { CheckTypes } from './check-types';
|
8
7
|
import type { WatcherMain } from './watcher.main.runtime';
|
@@ -22,7 +21,7 @@ export type EventMessages = {
|
|
22
21
|
};
|
23
22
|
export type OnFileEventFunc = (filePaths: string[], buildResults: OnComponentEventResult[], verbose: boolean, duration: number, failureMsg?: string) => void;
|
24
23
|
export type WatchOptions = {
|
25
|
-
initiator?:
|
24
|
+
initiator?: any;
|
26
25
|
verbose?: boolean;
|
27
26
|
spawnTSServer?: boolean;
|
28
27
|
checkTypes?: CheckTypes;
|
package/dist/watcher.js.map
CHANGED
@@ -1 +1 @@
|
|
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","err","message","includes","Error","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","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","ms","setTimeout","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","clearComponentCache","component","get","componentMap","state","_consumer","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","componentsFromBitMap","getAllComponents","getRootDir","exports"],"sources":["watcher.ts"],"sourcesContent":["import type { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename, join, sep } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport type { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BIT_MAP, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport type { PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport type { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy.scope';\nimport type { FSWatcher } from 'chokidar';\nimport chokidar from 'chokidar';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport type { CompilationInitiator } from '@teambit/compiler';\nimport type { Workspace, OnComponentEventResult } from '@teambit/workspace';\nimport {\n WorkspaceAspect,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport type { CheckTypes } from './check-types';\nimport type { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\nimport type { Logger } from '@teambit/logger';\nimport type { Event } from '@parcel/watcher';\nimport ParcelWatcher 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 during watch when .bitmap got version changes\n preImport?: boolean; // whether import objects before starting the watch process in case .bitmap is more updated than local scope.\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 try {\n await ParcelWatcher.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {\n ignore: ['**/node_modules/**', '**/package.json'],\n });\n } catch (err: any) {\n if (err.message.includes('Error starting FSEvents stream')) {\n throw new Error(`Failed to start the watcher: ${err.message}\nThis is usually caused by too many watchers running in the same workspace (e.g., bit-watch, bit-start, bit-run, or VSCode with the Bit plugin).\nTry closing the other watchers and re-running the command.\n\nIn general, if you're using \"bit start\" or \"bit run\", you don't need to run \"bit watch\" as well.\nSimilarly, if you're using VSCode with the Bit extension, you can enable \"Compile on Change\" instead of running a watcher manually.\n\nIf the issue persists, please refer to the Watchman troubleshooting guide:\nhttps://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`);\n }\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/`) ||\n 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 (\n pathToCheck.startsWith(join(this.workspace.path, '.git') + sep) ||\n pathToCheck.startsWith(join(this.workspace.path, '.bit') + sep)\n );\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 = [\n '**/node_modules/**',\n '**/package.json',\n this.shouldIgnoreFromLocalScopeChokidar.bind(this),\n ];\n this.chokidarWatcher = chokidar.watch(this.workspace.path, chokidarOpts);\n if (this.verbose) {\n logger.console(\n `${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.chokidarWatcher.options, undefined, 2)}`\n );\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 if (!err.message.includes('Events were dropped by the FSEvents client')) {\n // the message above shows up too many times and it doesn't affect the watcher.\n msgs?.onError(err);\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;EA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,GAAGuB,YAAY,CAACN,EAAE;MACnC,MAAM2E,OAAO,GAAGrE,YAAY,CAACsF,UAAU,CAAC,CAAC;MACzC,IAAI,CAACrL,QAAQ,CAACoK,OAAO,CAAC,GAAG5F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAAC8G,OAAA,CAAA/M,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","err","message","includes","Error","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","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","ms","setTimeout","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","clearComponentCache","component","get","componentMap","state","_consumer","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","componentsFromBitMap","getAllComponents","getRootDir","exports"],"sources":["watcher.ts"],"sourcesContent":["import type { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename, join, sep } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport type { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BIT_MAP, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport type { PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport type { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy.scope';\nimport type { FSWatcher } from 'chokidar';\nimport chokidar from 'chokidar';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport type { Workspace, OnComponentEventResult } from '@teambit/workspace';\nimport {\n WorkspaceAspect,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport type { CheckTypes } from './check-types';\nimport type { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\nimport type { Logger } from '@teambit/logger';\nimport type { Event } from '@parcel/watcher';\nimport ParcelWatcher 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?: any; // the real type is CompilationInitiator, however it creates a circular dependency with the compiler aspect.\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 during watch when .bitmap got version changes\n preImport?: boolean; // whether import objects before starting the watch process in case .bitmap is more updated than local scope.\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 try {\n await ParcelWatcher.subscribe(this.workspace.path, this.onParcelWatch.bind(this), {\n ignore: ['**/node_modules/**', '**/package.json'],\n });\n } catch (err: any) {\n if (err.message.includes('Error starting FSEvents stream')) {\n throw new Error(`Failed to start the watcher: ${err.message}\nThis is usually caused by too many watchers running in the same workspace (e.g., bit-watch, bit-start, bit-run, or VSCode with the Bit plugin).\nTry closing the other watchers and re-running the command.\n\nIn general, if you're using \"bit start\" or \"bit run\", you don't need to run \"bit watch\" as well.\nSimilarly, if you're using VSCode with the Bit extension, you can enable \"Compile on Change\" instead of running a watcher manually.\n\nIf the issue persists, please refer to the Watchman troubleshooting guide:\nhttps://facebook.github.io/watchman/docs/troubleshooting#fseventstreamstart-register_with_server-error-f2d_register_rpc--null--21`);\n }\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/`) ||\n 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 (\n pathToCheck.startsWith(join(this.workspace.path, '.git') + sep) ||\n pathToCheck.startsWith(join(this.workspace.path, '.bit') + sep)\n );\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 = [\n '**/node_modules/**',\n '**/package.json',\n this.shouldIgnoreFromLocalScopeChokidar.bind(this),\n ];\n this.chokidarWatcher = chokidar.watch(this.workspace.path, chokidarOpts);\n if (this.verbose) {\n logger.console(\n `${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.chokidarWatcher.options, undefined, 2)}`\n );\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 if (!err.message.includes('Events were dropped by the FSEvents client')) {\n // the message above shows up too many times and it doesn't affect the watcher.\n msgs?.onError(err);\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;AAEA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,Q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AAEC,OAAO;QAAEC,SAAS;QAAEC,UAAU;QAAEC;MAAW,CAAC,GAAG,MAAM,IAAI,CAACC,YAAY,CAACV,KAAK,CAAC7C,IAAI,CAAC;MACjG,IAAIoD,SAAS,IAAIC,UAAU,EAAE;QAC3B;MACF;MACA,MAAMG,QAAQ,GAAG,IAAIR,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,GAAGF,SAAS;MACjDxD,IAAI,EAAEkE,QAAQ,CAACP,KAAK,EAAEC,OAAO,EAAE,IAAI,CAACvD,OAAO,EAAE4D,QAAQ,EAAEF,UAAU,CAAC;IACpE,CAAC,CAAC;EACJ;EAEA,MAAc/C,WAAWA,CAAA,EAAG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAMmL,oBAAoB,GAAG,IAAI,CAACxL,QAAQ,CAACsH,MAAM,CAACmE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAACrE,GAAG,CAAEf,YAAY,IAAK;MACzC,MAAMvB,WAAW,GAAGuB,YAAY,CAACN,EAAE;MACnC,MAAM2E,OAAO,GAAGrE,YAAY,CAACsF,UAAU,CAAC,CAAC;MACzC,IAAI,CAACrL,QAAQ,CAACoK,OAAO,CAAC,GAAG5F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAAC8G,OAAA,CAAA/M,OAAA,GAAAA,OAAA","ignoreList":[]}
|
@@ -143,7 +143,7 @@ class WatcherMain {
|
|
143
143
|
static async provider([cli, workspace, scope, pubsub, loggerMain, ipcEvents, configStore], _, [onPreWatchSlot]) {
|
144
144
|
const logger = loggerMain.createLogger(_watcher2().WatcherAspect.id);
|
145
145
|
const watcherMain = new WatcherMain(workspace, scope, pubsub, onPreWatchSlot, ipcEvents, logger, configStore);
|
146
|
-
const watchCmd = new (_watch().WatchCommand)(
|
146
|
+
const watchCmd = new (_watch().WatchCommand)(logger, watcherMain);
|
147
147
|
cli.register(watchCmd);
|
148
148
|
return watcherMain;
|
149
149
|
}
|
@@ -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","msgs","OutsideWorkspaceError","preImport","importObjectsIfOutdatedAgainstBitmap","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 type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { WatchOptions as ChokidarWatchOptions } from 'chokidar';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { IpcEventsMain } from '@teambit/ipc-events';\nimport { IpcEventsAspect } from '@teambit/ipc-events';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { PubsubAspect } from '@teambit/pubsub';\nimport { CFG_WATCH_USE_POLLING } from '@teambit/legacy.constants';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { WatchCommand } from './watch.cmd';\nimport type { EventMessages, WatchOptions } from './watcher';\nimport { Watcher } from './watcher';\nimport { WatcherAspect } from './watcher.aspect';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } 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 if (opts.preImport) {\n await this.workspace.importObjectsIfOutdatedAgainstBitmap();\n }\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(
|
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","preImport","importObjectsIfOutdatedAgainstBitmap","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 type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { WatchOptions as ChokidarWatchOptions } from 'chokidar';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { IpcEventsMain } from '@teambit/ipc-events';\nimport { IpcEventsAspect } from '@teambit/ipc-events';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { PubsubAspect } from '@teambit/pubsub';\nimport { CFG_WATCH_USE_POLLING } from '@teambit/legacy.constants';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { WatchCommand } from './watch.cmd';\nimport type { EventMessages, WatchOptions } from './watcher';\nimport { Watcher } from './watcher';\nimport { WatcherAspect } from './watcher.aspect';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } 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 if (opts.preImport) {\n await this.workspace.importObjectsIfOutdatedAgainstBitmap();\n }\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(logger, watcherMain);\n cli.register(watchCmd);\n return watcherMain;\n }\n}\n\nWatcherAspect.addRuntime(WatcherMain);\n\nexport default WatcherMain;\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,WAAA;EAAA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OAAO,IAAI;EACb;EAcA,aAAaE,QAAQA,CACnB,CAACC,GAAG,EAAEnC,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEkC,UAAU,EAAEhC,SAAS,EAAEE,WAAW,CAQjE,EACD+B,CAAC,EACD,CAAClC,cAAc,CAAmB,EAClC;IACA,MAAME,MAAM,GAAG+B,UAAU,CAACE,YAAY,CAACC,yBAAa,CAACC,EAAE,CAAC;IACxD,MAAMC,WAAW,GAAG,IAAI3C,WAAW,CAACE,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEC,cAAc,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,CAAC;IAC7G,MAAMoC,QAAQ,GAAG,KAAIC,qBAAY,EAACtC,MAAM,EAAEoC,WAAW,CAAC;IACtDN,GAAG,CAACF,QAAQ,CAACS,QAAQ,CAAC;IACtB,OAAOD,WAAW;EACpB;AACF;AAACG,OAAA,CAAA9C,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CA9EYkB,WAAW,WA+CP,CAAC+C,eAAI,CAACC,QAAQ,CAAa,CAAC,CAAC;AAAAlE,eAAA,CA/CjCkB,WAAW,kBAgDA,CACpBiD,gBAAS,EACTC,4BAAe,EACfC,oBAAW,EACXC,sBAAY,EACZC,sBAAY,EACZC,4BAAe,EACfC,gCAAiB,CAClB;AAAAzE,eAAA,CAxDUkB,WAAW,aAyDLwD,kBAAW;AAuB9Bf,yBAAa,CAACgB,UAAU,CAACzD,WAAW,CAAC;AAAC,IAAA0D,QAAA,GAAAZ,OAAA,CAAAjE,OAAA,GAEvBmB,WAAW","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/watcher",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.675",
|
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.
|
9
|
+
"version": "1.0.675"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "4.1.2",
|
@@ -17,23 +17,22 @@
|
|
17
17
|
"p-map-series": "2.1.0",
|
18
18
|
"@parcel/watcher": "^2.5.1",
|
19
19
|
"fs-extra": "10.0.0",
|
20
|
+
"@teambit/legacy.constants": "0.0.14",
|
21
|
+
"@teambit/logger": "0.0.1343",
|
22
|
+
"@teambit/cli": "0.0.1250",
|
20
23
|
"@teambit/component-id": "1.2.4",
|
21
24
|
"@teambit/harmony": "0.4.7",
|
22
|
-
"@teambit/
|
25
|
+
"@teambit/config-store": "0.0.130",
|
23
26
|
"@teambit/harmony.modules.send-server-sent-events": "0.0.8",
|
24
27
|
"@teambit/legacy.bit-map": "0.0.117",
|
25
28
|
"@teambit/legacy.consumer": "0.0.60",
|
26
29
|
"@teambit/legacy.logger": "0.0.24",
|
27
30
|
"@teambit/legacy.scope": "0.0.60",
|
28
31
|
"@teambit/legacy.utils": "0.0.23",
|
29
|
-
"@teambit/
|
30
|
-
"@teambit/
|
31
|
-
"@teambit/
|
32
|
-
"@teambit/
|
33
|
-
"@teambit/pubsub": "1.0.673",
|
34
|
-
"@teambit/config-store": "0.0.130",
|
35
|
-
"@teambit/ipc-events": "1.0.673",
|
36
|
-
"@teambit/scope": "1.0.673"
|
32
|
+
"@teambit/workspace": "1.0.675",
|
33
|
+
"@teambit/ipc-events": "1.0.675",
|
34
|
+
"@teambit/pubsub": "1.0.675",
|
35
|
+
"@teambit/scope": "1.0.675"
|
37
36
|
},
|
38
37
|
"devDependencies": {
|
39
38
|
"@types/lodash": "4.14.165",
|
File without changes
|