@teambit/watcher 1.0.460 → 1.0.461

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.workspace/watcher@1.0.460" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.workspace/watcher@1.0.461" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -20,7 +20,7 @@
20
20
  "line": 3,
21
21
  "character": 15
22
22
  },
23
- "signature": "type WatchOptions = {\n msgs?: EventMessages | undefined;\n initiator?: CompilationInitiator | undefined;\n verbose?: boolean | undefined;\n spawnTSServer?: boolean | undefined;\n checkTypes?: CheckTypes | undefined;\n preCompile?: boolean | undefined;\n compile?: boolean | undefined;\n import?: boolean | undefined;\n}",
23
+ "signature": "type WatchOptions = {\n msgs?: EventMessages | undefined;\n initiator?: CompilationInitiator | undefined;\n verbose?: boolean | undefined;\n spawnTSServer?: boolean | undefined;\n ... 4 more ...;\n trigger?: ComponentID | undefined;\n}",
24
24
  "name": "WatchOptions",
25
25
  "exportNode": {
26
26
  "__schema": "TypeSchema",
@@ -29,7 +29,7 @@
29
29
  "line": 50,
30
30
  "character": 1
31
31
  },
32
- "signature": "type WatchOptions = {\n msgs?: EventMessages | undefined;\n initiator?: CompilationInitiator | undefined;\n verbose?: boolean | undefined;\n spawnTSServer?: boolean | undefined;\n checkTypes?: CheckTypes | undefined;\n preCompile?: boolean | undefined;\n compile?: boolean | undefined;\n import?: boolean | undefined;\n}",
32
+ "signature": "type WatchOptions = {\n msgs?: EventMessages | undefined;\n initiator?: CompilationInitiator | undefined;\n verbose?: boolean | undefined;\n spawnTSServer?: boolean | undefined;\n ... 4 more ...;\n trigger?: ComponentID | undefined;\n}",
33
33
  "name": "WatchOptions",
34
34
  "type": {
35
35
  "__schema": "TypeLiteralSchema",
@@ -203,6 +203,31 @@
203
203
  "name": "boolean"
204
204
  },
205
205
  "isOptional": true
206
+ },
207
+ {
208
+ "__schema": "VariableLikeSchema",
209
+ "location": {
210
+ "filePath": "watcher.ts",
211
+ "line": 59,
212
+ "character": 3
213
+ },
214
+ "signature": "(property) trigger?: ComponentID | undefined",
215
+ "name": "trigger",
216
+ "type": {
217
+ "__schema": "TypeRefSchema",
218
+ "location": {
219
+ "filePath": "watcher.ts",
220
+ "line": 59,
221
+ "character": 13
222
+ },
223
+ "name": "ComponentID",
224
+ "componentId": {
225
+ "scope": "teambit.component",
226
+ "name": "component-id",
227
+ "version": "1.2.2"
228
+ }
229
+ },
230
+ "isOptional": true
206
231
  }
207
232
  ]
208
233
  }
@@ -1388,7 +1413,7 @@
1388
1413
  "line": 50,
1389
1414
  "character": 1
1390
1415
  },
1391
- "signature": "type WatchOptions = {\n msgs?: EventMessages | undefined;\n initiator?: CompilationInitiator | undefined;\n verbose?: boolean | undefined;\n spawnTSServer?: boolean | undefined;\n checkTypes?: CheckTypes | undefined;\n preCompile?: boolean | undefined;\n compile?: boolean | undefined;\n import?: boolean | undefined;\n}",
1416
+ "signature": "type WatchOptions = {\n msgs?: EventMessages | undefined;\n initiator?: CompilationInitiator | undefined;\n verbose?: boolean | undefined;\n spawnTSServer?: boolean | undefined;\n ... 4 more ...;\n trigger?: ComponentID | undefined;\n}",
1392
1417
  "name": "WatchOptions",
1393
1418
  "type": {
1394
1419
  "__schema": "TypeLiteralSchema",
@@ -1562,6 +1587,31 @@
1562
1587
  "name": "boolean"
1563
1588
  },
1564
1589
  "isOptional": true
1590
+ },
1591
+ {
1592
+ "__schema": "VariableLikeSchema",
1593
+ "location": {
1594
+ "filePath": "watcher.ts",
1595
+ "line": 59,
1596
+ "character": 3
1597
+ },
1598
+ "signature": "(property) trigger?: ComponentID | undefined",
1599
+ "name": "trigger",
1600
+ "type": {
1601
+ "__schema": "TypeRefSchema",
1602
+ "location": {
1603
+ "filePath": "watcher.ts",
1604
+ "line": 59,
1605
+ "character": 13
1606
+ },
1607
+ "name": "ComponentID",
1608
+ "componentId": {
1609
+ "scope": "teambit.component",
1610
+ "name": "component-id",
1611
+ "version": "1.2.2"
1612
+ }
1613
+ },
1614
+ "isOptional": true
1565
1615
  }
1566
1616
  ]
1567
1617
  }
@@ -1570,7 +1620,7 @@
1570
1620
  "__schema": "TypeSchema",
1571
1621
  "location": {
1572
1622
  "filePath": "watcher.ts",
1573
- "line": 61,
1623
+ "line": 62,
1574
1624
  "character": 1
1575
1625
  },
1576
1626
  "signature": "type RootDirs = {\n [dir: string]: ComponentID;\n}",
@@ -1579,7 +1629,7 @@
1579
1629
  "__schema": "TypeLiteralSchema",
1580
1630
  "location": {
1581
1631
  "filePath": "watcher.ts",
1582
- "line": 61,
1632
+ "line": 62,
1583
1633
  "character": 24
1584
1634
  },
1585
1635
  "members": [
@@ -1587,14 +1637,14 @@
1587
1637
  "__schema": "IndexSignatureSchema",
1588
1638
  "location": {
1589
1639
  "filePath": "watcher.ts",
1590
- "line": 61,
1640
+ "line": 62,
1591
1641
  "character": 26
1592
1642
  },
1593
1643
  "keyType": {
1594
1644
  "__schema": "ParameterSchema",
1595
1645
  "location": {
1596
1646
  "filePath": "watcher.ts",
1597
- "line": 61,
1647
+ "line": 62,
1598
1648
  "character": 27
1599
1649
  },
1600
1650
  "name": "dir",
@@ -1602,7 +1652,7 @@
1602
1652
  "__schema": "TypeRefSchema",
1603
1653
  "location": {
1604
1654
  "filePath": "watcher.ts",
1605
- "line": 61,
1655
+ "line": 62,
1606
1656
  "character": 32
1607
1657
  },
1608
1658
  "name": "PathLinux",
@@ -1615,7 +1665,7 @@
1615
1665
  "__schema": "TypeRefSchema",
1616
1666
  "location": {
1617
1667
  "filePath": "watcher.ts",
1618
- "line": 61,
1668
+ "line": 62,
1619
1669
  "character": 44
1620
1670
  },
1621
1671
  "name": "ComponentID",
@@ -1633,7 +1683,7 @@
1633
1683
  "__schema": "ClassSchema",
1634
1684
  "location": {
1635
1685
  "filePath": "watcher.ts",
1636
- "line": 66,
1686
+ "line": 67,
1637
1687
  "character": 1
1638
1688
  },
1639
1689
  "signature": "class Watcher",
@@ -1643,7 +1693,7 @@
1643
1693
  "__schema": "ConstructorSchema",
1644
1694
  "location": {
1645
1695
  "filePath": "watcher.ts",
1646
- "line": 75,
1696
+ "line": 76,
1647
1697
  "character": 3
1648
1698
  },
1649
1699
  "signature": "constructor Watcher(workspace: Workspace, pubsub: PubsubMain, watcherMain: WatcherMain, options: WatchOptions): Watcher",
@@ -1653,7 +1703,7 @@
1653
1703
  "__schema": "ParameterSchema",
1654
1704
  "location": {
1655
1705
  "filePath": "watcher.ts",
1656
- "line": 76,
1706
+ "line": 77,
1657
1707
  "character": 5
1658
1708
  },
1659
1709
  "name": "workspace",
@@ -1661,7 +1711,7 @@
1661
1711
  "__schema": "TypeRefSchema",
1662
1712
  "location": {
1663
1713
  "filePath": "watcher.ts",
1664
- "line": 76,
1714
+ "line": 77,
1665
1715
  "character": 24
1666
1716
  },
1667
1717
  "name": "Workspace",
@@ -1677,7 +1727,7 @@
1677
1727
  "__schema": "ParameterSchema",
1678
1728
  "location": {
1679
1729
  "filePath": "watcher.ts",
1680
- "line": 77,
1730
+ "line": 78,
1681
1731
  "character": 5
1682
1732
  },
1683
1733
  "name": "pubsub",
@@ -1685,7 +1735,7 @@
1685
1735
  "__schema": "TypeRefSchema",
1686
1736
  "location": {
1687
1737
  "filePath": "watcher.ts",
1688
- "line": 77,
1738
+ "line": 78,
1689
1739
  "character": 21
1690
1740
  },
1691
1741
  "name": "PubsubMain",
@@ -1701,7 +1751,7 @@
1701
1751
  "__schema": "ParameterSchema",
1702
1752
  "location": {
1703
1753
  "filePath": "watcher.ts",
1704
- "line": 78,
1754
+ "line": 79,
1705
1755
  "character": 5
1706
1756
  },
1707
1757
  "name": "watcherMain",
@@ -1709,7 +1759,7 @@
1709
1759
  "__schema": "TypeRefSchema",
1710
1760
  "location": {
1711
1761
  "filePath": "watcher.ts",
1712
- "line": 78,
1762
+ "line": 79,
1713
1763
  "character": 26
1714
1764
  },
1715
1765
  "name": "WatcherMain"
@@ -1721,7 +1771,7 @@
1721
1771
  "__schema": "ParameterSchema",
1722
1772
  "location": {
1723
1773
  "filePath": "watcher.ts",
1724
- "line": 79,
1774
+ "line": 80,
1725
1775
  "character": 5
1726
1776
  },
1727
1777
  "name": "options",
@@ -1729,7 +1779,7 @@
1729
1779
  "__schema": "TypeRefSchema",
1730
1780
  "location": {
1731
1781
  "filePath": "watcher.ts",
1732
- "line": 79,
1782
+ "line": 80,
1733
1783
  "character": 22
1734
1784
  },
1735
1785
  "name": "WatchOptions"
@@ -1742,7 +1792,7 @@
1742
1792
  "__schema": "ThisTypeSchema",
1743
1793
  "location": {
1744
1794
  "filePath": "watcher.ts",
1745
- "line": 66,
1795
+ "line": 67,
1746
1796
  "character": 1
1747
1797
  },
1748
1798
  "name": "Watcher"
@@ -1753,7 +1803,7 @@
1753
1803
  "__schema": "GetAccessorSchema",
1754
1804
  "location": {
1755
1805
  "filePath": "watcher.ts",
1756
- "line": 85,
1806
+ "line": 86,
1757
1807
  "character": 3
1758
1808
  },
1759
1809
  "signature": "(getter) Watcher.consumer: Consumer",
@@ -1762,7 +1812,7 @@
1762
1812
  "__schema": "TypeRefSchema",
1763
1813
  "location": {
1764
1814
  "filePath": "watcher.ts",
1765
- "line": 85,
1815
+ "line": 86,
1766
1816
  "character": 3
1767
1817
  },
1768
1818
  "name": "Consumer",
@@ -1773,7 +1823,7 @@
1773
1823
  "__schema": "FunctionLikeSchema",
1774
1824
  "location": {
1775
1825
  "filePath": "watcher.ts",
1776
- "line": 89,
1826
+ "line": 90,
1777
1827
  "character": 3
1778
1828
  },
1779
1829
  "signature": "(method) Watcher.watch(): Promise<unknown>",
@@ -1783,7 +1833,7 @@
1783
1833
  "__schema": "InferenceTypeSchema",
1784
1834
  "location": {
1785
1835
  "filePath": "watcher.ts",
1786
- "line": 89,
1836
+ "line": 90,
1787
1837
  "character": 3
1788
1838
  },
1789
1839
  "type": "Promise<unknown>"
@@ -1802,7 +1852,7 @@
1802
1852
  "__schema": "ModuleSchema",
1803
1853
  "location": {
1804
1854
  "filePath": "watcher.ts",
1805
- "line": 63,
1855
+ "line": 64,
1806
1856
  "character": 1
1807
1857
  },
1808
1858
  "exports": [
@@ -1810,7 +1860,7 @@
1810
1860
  "__schema": "VariableLikeSchema",
1811
1861
  "location": {
1812
1862
  "filePath": "watcher.ts",
1813
- "line": 63,
1863
+ "line": 64,
1814
1864
  "character": 7
1815
1865
  },
1816
1866
  "signature": "const DEBOUNCE_WAIT_MS: 100",
@@ -1819,7 +1869,7 @@
1819
1869
  "__schema": "InferenceTypeSchema",
1820
1870
  "location": {
1821
1871
  "filePath": "watcher.ts",
1822
- "line": 63,
1872
+ "line": 64,
1823
1873
  "character": 7
1824
1874
  },
1825
1875
  "type": "100"
@@ -1834,7 +1884,7 @@
1834
1884
  "__schema": "TypeSchema",
1835
1885
  "location": {
1836
1886
  "filePath": "watcher.ts",
1837
- "line": 64,
1887
+ "line": 65,
1838
1888
  "character": 1
1839
1889
  },
1840
1890
  "signature": "type PathLinux = string",
@@ -1843,7 +1893,7 @@
1843
1893
  "__schema": "KeywordTypeSchema",
1844
1894
  "location": {
1845
1895
  "filePath": "watcher.ts",
1846
- "line": 64,
1896
+ "line": 65,
1847
1897
  "character": 18
1848
1898
  },
1849
1899
  "name": "string"
@@ -2695,7 +2745,7 @@
2695
2745
  "componentId": {
2696
2746
  "scope": "teambit.workspace",
2697
2747
  "name": "watcher",
2698
- "version": "1.0.460"
2748
+ "version": "1.0.461"
2699
2749
  },
2700
2750
  "taggedModuleExports": []
2701
2751
  }
@@ -8,6 +8,7 @@ type WatchCmdOpts = {
8
8
  checkTypes?: string | boolean;
9
9
  import?: boolean;
10
10
  skipImport?: boolean;
11
+ trigger?: string;
11
12
  };
12
13
  export declare class WatchCommand implements Command {
13
14
  /**
package/dist/watch.cmd.js CHANGED
@@ -18,6 +18,13 @@ function _moment() {
18
18
  };
19
19
  return data;
20
20
  }
21
+ function _componentId() {
22
+ const data = require("@teambit/component-id");
23
+ _componentId = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
21
28
  function _compiler() {
22
29
  const data = require("@teambit/compiler");
23
30
  _compiler = function () {
@@ -42,7 +49,7 @@ function _checkTypes() {
42
49
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
43
50
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
44
51
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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); } // import IDs and events
52
+ 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); }
46
53
  class WatchCommand {
47
54
  constructor(
48
55
  /**
@@ -67,7 +74,7 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
67
74
  _defineProperty(this, "helpUrl", 'reference/compiling/compiler-overview');
68
75
  _defineProperty(this, "alias", '');
69
76
  _defineProperty(this, "group", 'development');
70
- _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']]);
77
+ _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'], ['', 'trigger <comp-id>', 'trigger recompilation of the specified component regardless of what changed. helpful when this comp-id must be a bundle']]);
71
78
  _defineProperty(this, "eventsListener", event => {
72
79
  switch (event.type) {
73
80
  case _compiler().CompilerErrorEvent.TYPE:
@@ -86,7 +93,8 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
86
93
  verbose,
87
94
  checkTypes,
88
95
  import: importIfNeeded,
89
- skipImport
96
+ skipImport,
97
+ trigger
90
98
  } = watchCmdOpts;
91
99
  if (importIfNeeded) {
92
100
  this.logger.consoleWarning('the "--import" flag is deprecated and is now the default behavior');
@@ -114,7 +122,8 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
114
122
  spawnTSServer: Boolean(checkTypes),
115
123
  // if check-types is enabled, it must spawn the tsserver.
116
124
  checkTypes: getCheckTypesEnum(),
117
- import: !skipImport
125
+ import: !skipImport,
126
+ trigger: trigger ? _componentId().ComponentID.fromString(trigger) : undefined
118
127
  };
119
128
  await this.watcher.watch(watchOpts);
120
129
  return 'watcher terminated';
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_moment","_compiler","_outputFormatter","_checkTypes","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WatchCommand","constructor","pubsub","logger","watcher","event","type","CompilerErrorEvent","TYPE","console","error","registerToEvents","sub","CompilerAspect","id","eventsListener","report","cliArgs","watchCmdOpts","verbose","checkTypes","import","importIfNeeded","skipImport","consoleWarning","getCheckTypesEnum","undefined","CheckTypes","None","EntireProject","ChangedFile","Error","watchOpts","msgs","getMessages","compile","preCompile","skipPreCompilation","spawnTSServer","Boolean","watch","exports","onAll","path","onStart","onReady","workspace","watchPathsSortByComponent","clearOutdatedData","formatWatchPathsSortByComponent","chalk","yellow","name","moment","format","onChange","args","printOnFileEvent","onAdd","onUnlink","onError","err","eventMsgPlaceholder","filePaths","buildResults","duration","failureMsg","files","join","length","formatCompileResults","process","stdout","write"],"sources":["watch.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport moment from 'moment';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { BitBaseEvent, PubsubMain } from '@teambit/pubsub';\nimport { OnComponentEventResult, Workspace } from '@teambit/workspace';\n\n// import IDs and events\nimport { CompilerAspect, CompilerErrorEvent } from '@teambit/compiler';\n\nimport { EventMessages, RootDirs, WatchOptions } from './watcher';\nimport { formatCompileResults, formatWatchPathsSortByComponent } from './output-formatter';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\n\ntype WatchCmdOpts = {\n verbose?: boolean;\n skipPreCompilation?: boolean;\n checkTypes?: string | boolean;\n import?: boolean;\n skipImport?: boolean;\n};\n\nexport class WatchCommand implements Command {\n name = 'watch';\n description = 'automatically recompile modified components (on save)';\n extendedDescription = `by default, the watcher doesn't use polling, to keep the CPU idle.\nif this doesn't work well for you, run \"bit config set watch_use_polling true\" to use polling.`;\n helpUrl = 'reference/compiling/compiler-overview';\n alias = '';\n group = 'development';\n options = [\n ['v', 'verbose', 'show all watch events and compiler verbose output'],\n ['', 'skip-pre-compilation', 'skip compilation step before starting to watch'],\n [\n 't',\n 'check-types [string]',\n 'show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project',\n ],\n [\n 'i',\n 'import',\n 'DEPRECATED. it is now the default. helpful when using git. import component objects if .bitmap changed not by bit',\n ],\n ['', 'skip-import', 'do not import component objects if .bitmap changed not by bit'],\n ] as CommandOptions;\n\n constructor(\n /**\n * logger extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * watcher extension.\n */\n private watcher: WatcherMain\n ) {\n this.registerToEvents();\n }\n\n private registerToEvents() {\n this.pubsub.sub(CompilerAspect.id, this.eventsListener);\n }\n\n private eventsListener = (event: BitBaseEvent<any>) => {\n switch (event.type) {\n case CompilerErrorEvent.TYPE:\n this.logger.console(`Watcher error ${event.data.error}, 'error'`);\n break;\n default:\n }\n };\n\n async report(cliArgs: [], watchCmdOpts: WatchCmdOpts) {\n const { verbose, checkTypes, import: importIfNeeded, skipImport } = watchCmdOpts;\n if (importIfNeeded) {\n this.logger.consoleWarning('the \"--import\" flag is deprecated and is now the default behavior');\n }\n const getCheckTypesEnum = () => {\n switch (checkTypes) {\n case undefined:\n case false:\n return CheckTypes.None;\n case 'project':\n case true: // project is the default\n return CheckTypes.EntireProject;\n case 'file':\n return CheckTypes.ChangedFile;\n default:\n throw new Error(`check-types can be either \"file\" or \"project\". got \"${checkTypes}\"`);\n }\n };\n const watchOpts: WatchOptions = {\n msgs: getMessages(this.logger),\n verbose,\n compile: true,\n preCompile: !watchCmdOpts.skipPreCompilation,\n spawnTSServer: Boolean(checkTypes), // if check-types is enabled, it must spawn the tsserver.\n checkTypes: getCheckTypesEnum(),\n import: !skipImport,\n };\n await this.watcher.watch(watchOpts);\n return 'watcher terminated';\n }\n}\n\nfunction getMessages(logger: Logger): EventMessages {\n return {\n onAll: (event: string, path: string) => logger.console(`Event: \"${event}\". Path: ${path}`),\n onStart: () => {},\n onReady: (workspace: Workspace, watchPathsSortByComponent: RootDirs, verbose?: boolean) => {\n clearOutdatedData();\n if (verbose) {\n logger.console(formatWatchPathsSortByComponent(watchPathsSortByComponent));\n }\n logger.console(\n chalk.yellow(\n `Watching for component changes in workspace ${workspace.name} (${moment().format('HH:mm:ss')})...\\n`\n )\n );\n },\n onChange: (...args) => {\n printOnFileEvent(logger, 'changed', ...args);\n },\n onAdd: (...args) => {\n printOnFileEvent(logger, 'added', ...args);\n },\n onUnlink: (...args) => {\n printOnFileEvent(logger, 'removed', ...args);\n },\n onError: (err) => {\n logger.console(`Watcher error ${err}`);\n },\n };\n}\n\nfunction printOnFileEvent(\n logger: Logger,\n eventMsgPlaceholder: 'changed' | 'added' | 'removed',\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) {\n const files = filePaths.join(', ');\n if (!buildResults.length) {\n if (!failureMsg) {\n if (verbose) logger.console(`The files ${files} have been ${eventMsgPlaceholder}, but nothing to compile\\n\\n`);\n return;\n }\n logger.console(`${failureMsg}\\n\\n`);\n return;\n }\n logger.console(`The file(s) ${files} have been ${eventMsgPlaceholder}.\\n`);\n logger.console(formatCompileResults(buildResults));\n logger.console(`Finished (${duration}ms).`);\n logger.console(chalk.yellow(`Watching for component changes (${moment().format('HH:mm:ss')})...`));\n}\n\n/**\n * with console.clear() all history is deleted from the console. this function preserver the history.\n */\nfunction clearOutdatedData() {\n process.stdout.write('\\x1Bc');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,iBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,gBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;A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M,CAAC,CAAC;AACpG;;AAEA;AACA;AACA;AACA,SAASN,iBAAiBA,CAAA,EAAG;EAC3BuB,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC,OAAO,CAAC;AAC/B","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_moment","_componentId","_compiler","_outputFormatter","_checkTypes","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WatchCommand","constructor","pubsub","logger","watcher","event","type","CompilerErrorEvent","TYPE","console","error","registerToEvents","sub","CompilerAspect","id","eventsListener","report","cliArgs","watchCmdOpts","verbose","checkTypes","import","importIfNeeded","skipImport","trigger","consoleWarning","getCheckTypesEnum","undefined","CheckTypes","None","EntireProject","ChangedFile","Error","watchOpts","msgs","getMessages","compile","preCompile","skipPreCompilation","spawnTSServer","Boolean","ComponentID","fromString","watch","exports","onAll","path","onStart","onReady","workspace","watchPathsSortByComponent","clearOutdatedData","formatWatchPathsSortByComponent","chalk","yellow","name","moment","format","onChange","args","printOnFileEvent","onAdd","onUnlink","onError","err","eventMsgPlaceholder","filePaths","buildResults","duration","failureMsg","files","join","length","formatCompileResults","process","stdout","write"],"sources":["watch.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport moment from 'moment';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { BitBaseEvent, PubsubMain } from '@teambit/pubsub';\nimport { OnComponentEventResult, Workspace } from '@teambit/workspace';\nimport { ComponentID } from '@teambit/component-id';\nimport { CompilerAspect, CompilerErrorEvent } from '@teambit/compiler';\nimport { EventMessages, RootDirs, WatchOptions } from './watcher';\nimport { formatCompileResults, formatWatchPathsSortByComponent } from './output-formatter';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\n\ntype WatchCmdOpts = {\n verbose?: boolean;\n skipPreCompilation?: boolean;\n checkTypes?: string | boolean;\n import?: boolean;\n skipImport?: boolean;\n trigger?: string;\n};\n\nexport class WatchCommand implements Command {\n name = 'watch';\n description = 'automatically recompile modified components (on save)';\n extendedDescription = `by default, the watcher doesn't use polling, to keep the CPU idle.\nif this doesn't work well for you, run \"bit config set watch_use_polling true\" to use polling.`;\n helpUrl = 'reference/compiling/compiler-overview';\n alias = '';\n group = 'development';\n options = [\n ['v', 'verbose', 'show all watch events and compiler verbose output'],\n ['', 'skip-pre-compilation', 'skip compilation step before starting to watch'],\n [\n 't',\n 'check-types [string]',\n 'show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project',\n ],\n [\n 'i',\n 'import',\n 'DEPRECATED. it is now the default. helpful when using git. import component objects if .bitmap changed not by bit',\n ],\n ['', 'skip-import', 'do not import component objects if .bitmap changed not by bit'],\n [\n '',\n 'trigger <comp-id>',\n 'trigger recompilation of the specified component regardless of what changed. helpful when this comp-id must be a bundle',\n ],\n ] as CommandOptions;\n\n constructor(\n /**\n * logger extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * watcher extension.\n */\n private watcher: WatcherMain\n ) {\n this.registerToEvents();\n }\n\n private registerToEvents() {\n this.pubsub.sub(CompilerAspect.id, this.eventsListener);\n }\n\n private eventsListener = (event: BitBaseEvent<any>) => {\n switch (event.type) {\n case CompilerErrorEvent.TYPE:\n this.logger.console(`Watcher error ${event.data.error}, 'error'`);\n break;\n default:\n }\n };\n\n async report(cliArgs: [], watchCmdOpts: WatchCmdOpts) {\n const { verbose, checkTypes, import: importIfNeeded, skipImport, trigger } = watchCmdOpts;\n if (importIfNeeded) {\n this.logger.consoleWarning('the \"--import\" flag is deprecated and is now the default behavior');\n }\n const getCheckTypesEnum = () => {\n switch (checkTypes) {\n case undefined:\n case false:\n return CheckTypes.None;\n case 'project':\n case true: // project is the default\n return CheckTypes.EntireProject;\n case 'file':\n return CheckTypes.ChangedFile;\n default:\n throw new Error(`check-types can be either \"file\" or \"project\". got \"${checkTypes}\"`);\n }\n };\n const watchOpts: WatchOptions = {\n msgs: getMessages(this.logger),\n verbose,\n compile: true,\n preCompile: !watchCmdOpts.skipPreCompilation,\n spawnTSServer: Boolean(checkTypes), // if check-types is enabled, it must spawn the tsserver.\n checkTypes: getCheckTypesEnum(),\n import: !skipImport,\n trigger: trigger ? ComponentID.fromString(trigger) : undefined,\n };\n await this.watcher.watch(watchOpts);\n return 'watcher terminated';\n }\n}\n\nfunction getMessages(logger: Logger): EventMessages {\n return {\n onAll: (event: string, path: string) => logger.console(`Event: \"${event}\". Path: ${path}`),\n onStart: () => {},\n onReady: (workspace: Workspace, watchPathsSortByComponent: RootDirs, verbose?: boolean) => {\n clearOutdatedData();\n if (verbose) {\n logger.console(formatWatchPathsSortByComponent(watchPathsSortByComponent));\n }\n logger.console(\n chalk.yellow(\n `Watching for component changes in workspace ${workspace.name} (${moment().format('HH:mm:ss')})...\\n`\n )\n );\n },\n onChange: (...args) => {\n printOnFileEvent(logger, 'changed', ...args);\n },\n onAdd: (...args) => {\n printOnFileEvent(logger, 'added', ...args);\n },\n onUnlink: (...args) => {\n printOnFileEvent(logger, 'removed', ...args);\n },\n onError: (err) => {\n logger.console(`Watcher error ${err}`);\n },\n };\n}\n\nfunction printOnFileEvent(\n logger: Logger,\n eventMsgPlaceholder: 'changed' | 'added' | 'removed',\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) {\n const files = filePaths.join(', ');\n if (!buildResults.length) {\n if (!failureMsg) {\n if (verbose) logger.console(`The files ${files} have been ${eventMsgPlaceholder}, but nothing to compile\\n\\n`);\n return;\n }\n logger.console(`${failureMsg}\\n\\n`);\n return;\n }\n logger.console(`The file(s) ${files} have been ${eventMsgPlaceholder}.\\n`);\n logger.console(formatCompileResults(buildResults));\n logger.console(`Finished (${duration}ms).`);\n logger.console(chalk.yellow(`Watching for component changes (${moment().format('HH:mm:ss')})...`));\n}\n\n/**\n * with console.clear() all history is deleted from the console. this function preserver the history.\n */\nfunction clearOutdatedData() {\n process.stdout.write('\\x1Bc');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,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,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,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AAI,CAAC;IAC9C,CAAC;IACDI,OAAO,EAAGC,GAAG,IAAK;MAChB7D,MAAM,CAACM,OAAO,CAAC,iBAAiBuD,GAAG,EAAE,CAAC;IACxC;EACF,CAAC;AACH;AAEA,SAASJ,gBAAgBA,CACvBzD,MAAc,EACd8D,mBAAoD,EACpDC,SAAmB,EACnBC,YAAsC,EACtChD,OAAgB,EAChBiD,QAAgB,EAChBC,UAAmB,EACnB;EACA,MAAMC,KAAK,GAAGJ,SAAS,CAACK,IAAI,CAAC,IAAI,CAAC;EAClC,IAAI,CAACJ,YAAY,CAACK,MAAM,EAAE;IACxB,IAAI,CAACH,UAAU,EAAE;MACf,IAAIlD,OAAO,EAAEhB,MAAM,CAACM,OAAO,CAAC,aAAa6D,KAAK,cAAcL,mBAAmB,8BAA8B,CAAC;MAC9G;IACF;IACA9D,MAAM,CAACM,OAAO,CAAC,GAAG4D,UAAU,MAAM,CAAC;IACnC;EACF;EACAlE,MAAM,CAACM,OAAO,CAAC,eAAe6D,KAAK,cAAcL,mBAAmB,KAAK,CAAC;EAC1E9D,MAAM,CAACM,OAAO,CAAC,IAAAgE,uCAAoB,EAACN,YAAY,CAAC,CAAC;EAClDhE,MAAM,CAACM,OAAO,CAAC,aAAa2D,QAAQ,MAAM,CAAC;EAC3CjE,MAAM,CAACM,OAAO,CAAC4C,gBAAK,CAACC,MAAM,CAAC,mCAAmC,IAAAE,iBAAM,EAAC,CAAC,CAACC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACpG;;AAEA;AACA;AACA;AACA,SAASN,iBAAiBA,CAAA,EAAG;EAC3BuB,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC,OAAO,CAAC;AAC/B","ignoreList":[]}
package/dist/watcher.d.ts CHANGED
@@ -30,6 +30,7 @@ export type WatchOptions = {
30
30
  preCompile?: boolean;
31
31
  compile?: boolean;
32
32
  import?: boolean;
33
+ trigger?: ComponentID;
33
34
  };
34
35
  export type RootDirs = {
35
36
  [dir: PathLinux]: ComponentID;
package/dist/watcher.js CHANGED
@@ -334,6 +334,9 @@ class Watcher {
334
334
  }
335
335
  this.consumer.bitMap.updateComponentPaths(componentId, compFiles.map(f => this.consumer.getPathRelativeToConsumer(f)), removedFiles.map(f => this.consumer.getPathRelativeToConsumer(f)));
336
336
  const buildResults = await this.executeWatchOperationsOnComponent(updatedComponentId, compFiles, removedFiles, true);
337
+ if (this.options.trigger && !updatedComponentId.isEqual(this.options.trigger)) {
338
+ await this.workspace.triggerOnComponentChange(this.options.trigger, [], [], this.options);
339
+ }
337
340
  return buildResults;
338
341
  }
339
342
 
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_loader","_constants","_logger","_legacy","_pMapSeries","_chalk","_unmergedComponents","_chokidar","_workspace","_watchQueue","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","s","includes","propertyIsEnumerable","call","n","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","DEBOUNCE_WAIT_MS","Watcher","constructor","workspace","pubsub","watcherMain","options","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","consumer","watch","_this$options","msgs","watchOpts","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","createWatcher","watcher","fsWatcher","onStart","scope","watchScopeInternalFiles","Promise","resolve","reject","onAll","on","onReady","watched","getWatched","totalWatched","flat","logger","console","chalk","bold","JSON","stringify","toString","loader","stop","event","filePath","startTime","Date","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","err","onError","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","warn","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","message","ms","setTimeout","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","debug","clearComponentCache","component","get","componentMap","state","_consumer","Error","compFilesRelativeToWorkspace","getFilesRelativeToConsumer","compFiles","nonCompFiles","partition","relativeFile","getRelativePathLinux","Boolean","p","removedFiles","compact","all","map","fs","pathExists","toStringWithoutVersion","bitMap","updateComponentPaths","f","getPathRelativeToConsumer","executeWatchOperationsOnComponent","previewsRootDirs","previewsIds","getAllBitIds","_reloadConsumer","importObjectsIfNeeded","triggerOnBitmapChange","newDirs","difference","removedDirs","addResults","mapSeries","dir","executeWatchOperationsOnRemove","import","currentIds","hasVersionChanges","prevId","searchWithoutVersion","version","existsInScope","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentChange","triggerOnComponentAdd","OnComponentRemovedEvent","now","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","pathNormalizeToLinux","parentDir","usePollingConf","globalConfig","CFG_WATCH_USE_POLLING","usePolling","workspacePathLinux","path","ignoreLocalScope","pathToCheck","startsWith","chokidar","ignoreInitial","ignored","persistent","componentsFromBitMap","getAllComponents","getRootDir","exports"],"sources":["watcher.ts"],"sourcesContent":["import { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { BIT_MAP, CFG_WATCH_USE_POLLING, WORKSPACE_JSONC } from '@teambit/legacy/dist/constants';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy/dist/scope/lanes/unmerged-components';\nimport chokidar, { FSWatcher } from 'chokidar';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport {\n WorkspaceAspect,\n Workspace,\n OnComponentEventResult,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\n\nexport type WatcherProcessData = { watchProcess: ChildProcess; compilerId: ComponentID; componentIds: ComponentID[] };\n\nexport type EventMessages = {\n onAll: Function;\n onStart: Function;\n onReady: Function;\n onChange: OnFileEventFunc;\n onAdd: OnFileEventFunc;\n onUnlink: OnFileEventFunc;\n onError: Function;\n};\n\nexport type OnFileEventFunc = (\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) => void;\n\nexport type WatchOptions = {\n msgs?: EventMessages;\n initiator?: CompilationInitiator;\n verbose?: boolean; // print watch events to the console. (also ts-server events if spawnTSServer is true)\n spawnTSServer?: boolean; // needed for check types and extract API/docs.\n checkTypes?: CheckTypes; // if enabled, the spawnTSServer becomes true.\n preCompile?: boolean; // whether compile all components before start watching\n compile?: boolean; // whether compile modified/added components during watch process\n import?: boolean; // whether import objects when .bitmap got version changes\n};\n\nexport type RootDirs = { [dir: PathLinux]: ComponentID };\n\nconst DEBOUNCE_WAIT_MS = 100;\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\n\nexport class Watcher {\n private fsWatcher: FSWatcher;\n private changedFilesPerComponent: { [componentId: string]: string[] } = {};\n private watchQueue = new WatchQueue();\n private bitMapChangesInProgress = false;\n private ipcEventsDir: string;\n private rootDirs: RootDirs = {};\n private verbose = false;\n private multipleWatchers: WatcherProcessData[] = [];\n constructor(\n private workspace: Workspace,\n private pubsub: PubsubMain,\n private watcherMain: WatcherMain,\n private options: WatchOptions\n ) {\n this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;\n this.verbose = this.options.verbose || false;\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async watch() {\n const { msgs, ...watchOpts } = this.options;\n await this.setRootDirs();\n const componentIds = Object.values(this.rootDirs);\n await this.watcherMain.triggerOnPreWatch(componentIds, watchOpts);\n await this.createWatcher();\n const watcher = this.fsWatcher;\n msgs?.onStart(this.workspace);\n\n await this.workspace.scope.watchScopeInternalFiles();\n\n return new Promise((resolve, reject) => {\n if (this.verbose) {\n // @ts-ignore\n if (msgs?.onAll) watcher.on('all', msgs?.onAll);\n }\n watcher.on('ready', () => {\n msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n if (this.verbose) {\n const watched = this.fsWatcher.getWatched();\n const totalWatched = Object.values(watched).flat().length;\n logger.console(\n `${chalk.bold('the following files are being watched:')}\\n${JSON.stringify(watched, null, 2)}`\n );\n logger.console(`\\nTotal files being watched: ${chalk.bold(totalWatched.toString())}`);\n }\n\n loader.stop();\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 loader.stop();\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 !== 'onPostInstall') {\n this.watcherMain.logger.warn(`eventName ${eventName} is not recognized, please handle it`);\n }\n await this.watcherMain.ipcEvents.triggerGotEvent(eventName as 'onPostInstall');\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 loader.stop();\n return { results: [], files: [], irrelevant: true };\n }\n const compIdStr = componentId.toString();\n if (this.changedFilesPerComponent[compIdStr]) {\n this.changedFilesPerComponent[compIdStr].push(filePath);\n loader.stop();\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 loader.stop();\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 loader.stop();\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 return buildResults;\n }\n\n /**\n * if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.\n */\n private async handleBitmapChanges(): Promise<OnComponentEventResult[]> {\n const previewsRootDirs = { ...this.rootDirs };\n const previewsIds = this.consumer.bitMap.getAllBitIds();\n await this.workspace._reloadConsumer();\n await this.setRootDirs();\n await this.importObjectsIfNeeded(previewsIds);\n await this.workspace.triggerOnBitmapChange();\n const newDirs: string[] = difference(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));\n const removedDirs: string[] = difference(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));\n const results: OnComponentEventResult[] = [];\n if (newDirs.length) {\n const addResults = await mapSeries(newDirs, async (dir) =>\n this.executeWatchOperationsOnComponent(this.rootDirs[dir], [], [], false)\n );\n results.push(...addResults.flat());\n }\n if (removedDirs.length) {\n await mapSeries(removedDirs, (dir) => this.executeWatchOperationsOnRemove(previewsRootDirs[dir]));\n }\n\n return results;\n }\n\n /**\n * needed when using git.\n * it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.\n * because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.\n * as soon as the watcher gets an event about a file change, it loads the component which throws\n * ComponentsPendingImport error.\n * to resolve this, we import the new objects as soon as the .bitmap file changes.\n * for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is\n * not already in the scope.\n */\n private async importObjectsIfNeeded(previewsIds: ComponentIdList) {\n if (!this.options.import) {\n return;\n }\n const currentIds = this.consumer.bitMap.getAllBitIds();\n const hasVersionChanges = currentIds.find((id) => {\n const prevId = previewsIds.searchWithoutVersion(id);\n return prevId && prevId.version !== id.version;\n });\n if (!hasVersionChanges) {\n return;\n }\n const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);\n if (existsInScope) {\n // the .bitmap change was probably a result of tag/snap/merge, no need to import.\n return;\n }\n if (this.options.verbose) {\n logger.console(\n `Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`\n );\n }\n await this.workspace.scope.import(currentIds, {\n useCache: true,\n lane: await this.workspace.getCurrentLaneObject(),\n });\n }\n\n private async executeWatchOperationsOnRemove(componentId: ComponentID) {\n logger.debug(`running OnComponentRemove hook for ${chalk.bold(componentId.toString())}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));\n await this.workspace.triggerOnComponentRemove(componentId);\n }\n\n private async executeWatchOperationsOnComponent(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[],\n removedFiles: PathOsBasedAbsolute[] = [],\n isChange = true\n ): Promise<OnComponentEventResult[]> {\n if (this.isComponentWatchedExternally(componentId)) {\n // update capsule, once done, it automatically triggers the external watcher\n await this.workspace.get(componentId);\n return [];\n }\n const idStr = componentId.toString();\n\n if (isChange) {\n logger.debug(`running OnComponentChange hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentChangeEvent(idStr, 'OnComponentChange'));\n } else {\n logger.debug(`running OnComponentAdd hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentAddEvent(idStr, 'OnComponentAdd'));\n }\n\n const buildResults = isChange\n ? await this.workspace.triggerOnComponentChange(componentId, files, removedFiles, this.options)\n : await this.workspace.triggerOnComponentAdd(componentId, this.options);\n\n return buildResults;\n }\n\n private createOnComponentRemovedEvent(idStr) {\n return new OnComponentRemovedEvent(Date.now(), idStr);\n }\n\n private createOnComponentChangeEvent(idStr, hook) {\n return new OnComponentChangeEvent(Date.now(), idStr, hook);\n }\n\n private createOnComponentAddEvent(idStr, hook) {\n return new OnComponentAddEvent(Date.now(), idStr, hook);\n }\n\n private isComponentWatchedExternally(componentId: ComponentID) {\n const watcherData = this.multipleWatchers.find((m) => m.componentIds.find((id) => id.isEqual(componentId)));\n if (watcherData) {\n logger.debug(`${componentId.toString()} is watched by ${watcherData.compilerId.toString()}`);\n return true;\n }\n return false;\n }\n\n private getComponentIdByPath(filePath: string): ComponentID | null {\n const relativeFile = this.getRelativePathLinux(filePath);\n const rootDir = this.findRootDirByFilePathRecursively(relativeFile);\n if (!rootDir) {\n // the file is not part of any component. If it was a new component, or a new file of\n // existing component, then, handleBitmapChanges() should deal with it.\n return null;\n }\n return this.rootDirs[rootDir];\n }\n\n private getRelativePathLinux(filePath: string) {\n return pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(filePath));\n }\n\n private findRootDirByFilePathRecursively(filePath: string): string | null {\n if (this.rootDirs[filePath]) return filePath;\n const parentDir = dirname(filePath);\n if (parentDir === filePath) return null;\n return this.findRootDirByFilePathRecursively(parentDir);\n }\n\n private async createWatcher() {\n const usePollingConf = await this.watcherMain.globalConfig.get(CFG_WATCH_USE_POLLING);\n const usePolling = usePollingConf === 'true';\n const workspacePathLinux = pathNormalizeToLinux(this.workspace.path);\n const ignoreLocalScope = (pathToCheck: string) => {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(`${workspacePathLinux}/.git/`) || pathToCheck.startsWith(`${workspacePathLinux}/.bit/`)\n );\n };\n this.fsWatcher = chokidar.watch(this.workspace.path, {\n ignoreInitial: true,\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 ignored: ['**/node_modules/**', '**/package.json', ignoreLocalScope],\n usePolling,\n // useFsEvents,\n persistent: true,\n });\n if (this.verbose) {\n logger.console(`${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.fsWatcher.options, undefined, 2)}`);\n }\n }\n\n private async setRootDirs() {\n this.rootDirs = {};\n const componentsFromBitMap = this.consumer.bitMap.getAllComponents();\n componentsFromBitMap.map((componentMap) => {\n const componentId = componentMap.id;\n const rootDir = componentMap.getRootDir();\n this.rootDirs[rootDir] = componentId;\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,M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AU,CAAC,GAAGJ,kBAAkB,QAAQ,CAAC,IAAIG,WAAW,CAACC,UAAU,CAAC,GAAGJ,kBAAkB,QAAQ,CAAC;IAElH,CAAC;IACD,IAAI,CAAC7J,SAAS,GAAGkK,mBAAQ,CAAC7K,KAAK,CAAC,IAAI,CAACV,SAAS,CAACmL,IAAI,EAAE;MACnDK,aAAa,EAAE,IAAI;MACnB;MACA;MACAC,OAAO,EAAE,CAAC,oBAAoB,EAAE,iBAAiB,EAAEL,gBAAgB,CAAC;MACpEH,UAAU;MACV;MACAS,UAAU,EAAE;IACd,CAAC,CAAC;IACF,IAAI,IAAI,CAAClL,OAAO,EAAE;MAChB2B,iBAAM,CAACC,OAAO,CAAC,GAAGC,gBAAK,CAACC,IAAI,CAAC,qBAAqB,CAAC,IAAIC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACnB,SAAS,CAAClB,OAAO,EAAE+E,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IAChH;EACF;EAEA,MAAcpE,WAAWA,CAAA,EAAG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAM0K,oBAAoB,GAAG,IAAI,CAAClL,QAAQ,CAACgH,MAAM,CAACmE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAACtE,GAAG,CAAEhB,YAAY,IAAK;MACzC,MAAMzB,WAAW,GAAGyB,YAAY,CAACP,EAAE;MACnC,MAAM4E,OAAO,GAAGrE,YAAY,CAACwF,UAAU,CAAC,CAAC;MACzC,IAAI,CAAC5K,QAAQ,CAACyJ,OAAO,CAAC,GAAG9F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAACkH,OAAA,CAAAhM,OAAA,GAAAA,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_loader","_constants","_logger","_legacy","_pMapSeries","_chalk","_unmergedComponents","_chokidar","_workspace","_watchQueue","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","s","includes","propertyIsEnumerable","call","n","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","DEBOUNCE_WAIT_MS","Watcher","constructor","workspace","pubsub","watcherMain","options","WatchQueue","ipcEventsDir","ipcEvents","eventsDir","verbose","consumer","watch","_this$options","msgs","watchOpts","setRootDirs","componentIds","values","rootDirs","triggerOnPreWatch","createWatcher","watcher","fsWatcher","onStart","scope","watchScopeInternalFiles","Promise","resolve","reject","onAll","on","onReady","watched","getWatched","totalWatched","flat","logger","console","chalk","bold","JSON","stringify","toString","loader","stop","event","filePath","startTime","Date","getTime","files","results","debounced","irrelevant","failureMsg","handleChange","duration","onChange","err","onError","endsWith","BIT_MAP","bitMapChangesInProgress","buildResults","watchQueue","add","handleBitmapChanges","onIdle","dirname","eventName","basename","warn","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","message","ms","setTimeout","updatedComponentId","hasId","ids","listIds","find","id","isEqual","ignoreVersion","debug","clearComponentCache","component","get","componentMap","state","_consumer","Error","compFilesRelativeToWorkspace","getFilesRelativeToConsumer","compFiles","nonCompFiles","partition","relativeFile","getRelativePathLinux","Boolean","p","removedFiles","compact","all","map","fs","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","isComponentInScope","useCache","lane","getCurrentLaneObject","pub","WorkspaceAspect","createOnComponentRemovedEvent","triggerOnComponentRemove","isChange","isComponentWatchedExternally","idStr","createOnComponentChangeEvent","createOnComponentAddEvent","triggerOnComponentAdd","OnComponentRemovedEvent","now","hook","OnComponentChangeEvent","OnComponentAddEvent","watcherData","multipleWatchers","m","compilerId","rootDir","findRootDirByFilePathRecursively","pathNormalizeToLinux","parentDir","usePollingConf","globalConfig","CFG_WATCH_USE_POLLING","usePolling","workspacePathLinux","path","ignoreLocalScope","pathToCheck","startsWith","chokidar","ignoreInitial","ignored","persistent","componentsFromBitMap","getAllComponents","getRootDir","exports"],"sources":["watcher.ts"],"sourcesContent":["import { PubsubMain } from '@teambit/pubsub';\nimport fs from 'fs-extra';\nimport { dirname, basename } from 'path';\nimport { compact, difference, partition } from 'lodash';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { BIT_MAP, CFG_WATCH_USE_POLLING, WORKSPACE_JSONC } from '@teambit/legacy/dist/constants';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport mapSeries from 'p-map-series';\nimport chalk from 'chalk';\nimport { ChildProcess } from 'child_process';\nimport { UNMERGED_FILENAME } from '@teambit/legacy/dist/scope/lanes/unmerged-components';\nimport chokidar, { FSWatcher } from 'chokidar';\nimport { ComponentMap } from '@teambit/legacy.bit-map';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport {\n WorkspaceAspect,\n Workspace,\n OnComponentEventResult,\n OnComponentChangeEvent,\n OnComponentAddEvent,\n OnComponentRemovedEvent,\n} from '@teambit/workspace';\nimport { CheckTypes } from './check-types';\nimport { WatcherMain } from './watcher.main.runtime';\nimport { WatchQueue } from './watch-queue';\n\nexport type WatcherProcessData = { watchProcess: ChildProcess; compilerId: ComponentID; componentIds: ComponentID[] };\n\nexport type EventMessages = {\n onAll: Function;\n onStart: Function;\n onReady: Function;\n onChange: OnFileEventFunc;\n onAdd: OnFileEventFunc;\n onUnlink: OnFileEventFunc;\n onError: Function;\n};\n\nexport type OnFileEventFunc = (\n filePaths: string[],\n buildResults: OnComponentEventResult[],\n verbose: boolean,\n duration: number,\n failureMsg?: string\n) => void;\n\nexport type WatchOptions = {\n msgs?: EventMessages;\n initiator?: CompilationInitiator;\n verbose?: boolean; // print watch events to the console. (also ts-server events if spawnTSServer is true)\n spawnTSServer?: boolean; // needed for check types and extract API/docs.\n checkTypes?: CheckTypes; // if enabled, the spawnTSServer becomes true.\n preCompile?: boolean; // whether compile all components before start watching\n compile?: boolean; // whether compile modified/added components during watch process\n import?: boolean; // whether import objects when .bitmap got version changes\n trigger?: ComponentID; // trigger onComponentChange for the specified component-id. helpful when this comp must be a bundle, and needs to be recompile on any dep change.\n};\n\nexport type RootDirs = { [dir: PathLinux]: ComponentID };\n\nconst DEBOUNCE_WAIT_MS = 100;\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\n\nexport class Watcher {\n private fsWatcher: FSWatcher;\n private changedFilesPerComponent: { [componentId: string]: string[] } = {};\n private watchQueue = new WatchQueue();\n private bitMapChangesInProgress = false;\n private ipcEventsDir: string;\n private rootDirs: RootDirs = {};\n private verbose = false;\n private multipleWatchers: WatcherProcessData[] = [];\n constructor(\n private workspace: Workspace,\n private pubsub: PubsubMain,\n private watcherMain: WatcherMain,\n private options: WatchOptions\n ) {\n this.ipcEventsDir = this.watcherMain.ipcEvents.eventsDir;\n this.verbose = this.options.verbose || false;\n }\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async watch() {\n const { msgs, ...watchOpts } = this.options;\n await this.setRootDirs();\n const componentIds = Object.values(this.rootDirs);\n await this.watcherMain.triggerOnPreWatch(componentIds, watchOpts);\n await this.createWatcher();\n const watcher = this.fsWatcher;\n msgs?.onStart(this.workspace);\n\n await this.workspace.scope.watchScopeInternalFiles();\n\n return new Promise((resolve, reject) => {\n if (this.verbose) {\n // @ts-ignore\n if (msgs?.onAll) watcher.on('all', msgs?.onAll);\n }\n watcher.on('ready', () => {\n msgs?.onReady(this.workspace, this.rootDirs, this.verbose);\n if (this.verbose) {\n const watched = this.fsWatcher.getWatched();\n const totalWatched = Object.values(watched).flat().length;\n logger.console(\n `${chalk.bold('the following files are being watched:')}\\n${JSON.stringify(watched, null, 2)}`\n );\n logger.console(`\\nTotal files being watched: ${chalk.bold(totalWatched.toString())}`);\n }\n\n loader.stop();\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 loader.stop();\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 !== 'onPostInstall') {\n this.watcherMain.logger.warn(`eventName ${eventName} is not recognized, please handle it`);\n }\n await this.watcherMain.ipcEvents.triggerGotEvent(eventName as 'onPostInstall');\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 loader.stop();\n return { results: [], files: [], irrelevant: true };\n }\n const compIdStr = componentId.toString();\n if (this.changedFilesPerComponent[compIdStr]) {\n this.changedFilesPerComponent[compIdStr].push(filePath);\n loader.stop();\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 loader.stop();\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 loader.stop();\n return { results: [], files: [filePath], failureMsg: err.message };\n }\n }\n\n private async sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n private async triggerCompChanges(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[]\n ): Promise<OnComponentEventResult[]> {\n let updatedComponentId: ComponentID | undefined = componentId;\n if (!this.workspace.hasId(componentId)) {\n // bitmap has changed meanwhile, which triggered `handleBitmapChanges`, which re-loaded consumer and updated versions\n // so the original componentId might not be in the workspace now, and we need to find the updated one\n const ids = this.workspace.listIds();\n updatedComponentId = ids.find((id) => id.isEqual(componentId, { ignoreVersion: true }));\n if (!updatedComponentId) {\n logger.debug(`triggerCompChanges, the component ${componentId.toString()} was probably removed from .bitmap`);\n return [];\n }\n }\n this.workspace.clearComponentCache(updatedComponentId);\n const component = await this.workspace.get(updatedComponentId);\n const componentMap: ComponentMap = component.state._consumer.componentMap;\n if (!componentMap) {\n throw new Error(\n `unable to find componentMap for ${updatedComponentId.toString()}, make sure this component is in .bitmap`\n );\n }\n const compFilesRelativeToWorkspace = componentMap.getFilesRelativeToConsumer();\n const [compFiles, nonCompFiles] = partition(files, (filePath) => {\n const relativeFile = this.getRelativePathLinux(filePath);\n return Boolean(compFilesRelativeToWorkspace.find((p) => p === relativeFile));\n });\n // nonCompFiles are either, files that were removed from the filesystem or existing files that are ignored.\n // the compiler takes care of removedFiles differently, e.g. removes dists dir and old symlinks.\n const removedFiles = compact(\n await Promise.all(nonCompFiles.map(async (filePath) => ((await fs.pathExists(filePath)) ? null : filePath)))\n );\n\n if (!compFiles.length && !removedFiles.length) {\n logger.debug(\n `the following files are part of the component ${componentId.toStringWithoutVersion()} but configured to be ignored:\\n${files.join(\n '\\n'\n )}'`\n );\n return [];\n }\n this.consumer.bitMap.updateComponentPaths(\n componentId,\n compFiles.map((f) => this.consumer.getPathRelativeToConsumer(f)),\n removedFiles.map((f) => this.consumer.getPathRelativeToConsumer(f))\n );\n const buildResults = await this.executeWatchOperationsOnComponent(\n updatedComponentId,\n compFiles,\n removedFiles,\n true\n );\n if (this.options.trigger && !updatedComponentId.isEqual(this.options.trigger)) {\n await this.workspace.triggerOnComponentChange(this.options.trigger, [], [], this.options);\n }\n\n return buildResults;\n }\n\n /**\n * if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.\n */\n private async handleBitmapChanges(): Promise<OnComponentEventResult[]> {\n const previewsRootDirs = { ...this.rootDirs };\n const previewsIds = this.consumer.bitMap.getAllBitIds();\n await this.workspace._reloadConsumer();\n await this.setRootDirs();\n await this.importObjectsIfNeeded(previewsIds);\n await this.workspace.triggerOnBitmapChange();\n const newDirs: string[] = difference(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));\n const removedDirs: string[] = difference(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));\n const results: OnComponentEventResult[] = [];\n if (newDirs.length) {\n const addResults = await mapSeries(newDirs, async (dir) =>\n this.executeWatchOperationsOnComponent(this.rootDirs[dir], [], [], false)\n );\n results.push(...addResults.flat());\n }\n if (removedDirs.length) {\n await mapSeries(removedDirs, (dir) => this.executeWatchOperationsOnRemove(previewsRootDirs[dir]));\n }\n\n return results;\n }\n\n /**\n * needed when using git.\n * it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.\n * because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.\n * as soon as the watcher gets an event about a file change, it loads the component which throws\n * ComponentsPendingImport error.\n * to resolve this, we import the new objects as soon as the .bitmap file changes.\n * for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is\n * not already in the scope.\n */\n private async importObjectsIfNeeded(previewsIds: ComponentIdList) {\n if (!this.options.import) {\n return;\n }\n const currentIds = this.consumer.bitMap.getAllBitIds();\n const hasVersionChanges = currentIds.find((id) => {\n const prevId = previewsIds.searchWithoutVersion(id);\n return prevId && prevId.version !== id.version;\n });\n if (!hasVersionChanges) {\n return;\n }\n const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);\n if (existsInScope) {\n // the .bitmap change was probably a result of tag/snap/merge, no need to import.\n return;\n }\n if (this.options.verbose) {\n logger.console(\n `Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`\n );\n }\n await this.workspace.scope.import(currentIds, {\n useCache: true,\n lane: await this.workspace.getCurrentLaneObject(),\n });\n }\n\n private async executeWatchOperationsOnRemove(componentId: ComponentID) {\n logger.debug(`running OnComponentRemove hook for ${chalk.bold(componentId.toString())}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));\n await this.workspace.triggerOnComponentRemove(componentId);\n }\n\n private async executeWatchOperationsOnComponent(\n componentId: ComponentID,\n files: PathOsBasedAbsolute[],\n removedFiles: PathOsBasedAbsolute[] = [],\n isChange = true\n ): Promise<OnComponentEventResult[]> {\n if (this.isComponentWatchedExternally(componentId)) {\n // update capsule, once done, it automatically triggers the external watcher\n await this.workspace.get(componentId);\n return [];\n }\n const idStr = componentId.toString();\n\n if (isChange) {\n logger.debug(`running OnComponentChange hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentChangeEvent(idStr, 'OnComponentChange'));\n } else {\n logger.debug(`running OnComponentAdd hook for ${chalk.bold(idStr)}`);\n this.pubsub.pub(WorkspaceAspect.id, this.createOnComponentAddEvent(idStr, 'OnComponentAdd'));\n }\n\n const buildResults = isChange\n ? await this.workspace.triggerOnComponentChange(componentId, files, removedFiles, this.options)\n : await this.workspace.triggerOnComponentAdd(componentId, this.options);\n\n return buildResults;\n }\n\n private createOnComponentRemovedEvent(idStr) {\n return new OnComponentRemovedEvent(Date.now(), idStr);\n }\n\n private createOnComponentChangeEvent(idStr, hook) {\n return new OnComponentChangeEvent(Date.now(), idStr, hook);\n }\n\n private createOnComponentAddEvent(idStr, hook) {\n return new OnComponentAddEvent(Date.now(), idStr, hook);\n }\n\n private isComponentWatchedExternally(componentId: ComponentID) {\n const watcherData = this.multipleWatchers.find((m) => m.componentIds.find((id) => id.isEqual(componentId)));\n if (watcherData) {\n logger.debug(`${componentId.toString()} is watched by ${watcherData.compilerId.toString()}`);\n return true;\n }\n return false;\n }\n\n private getComponentIdByPath(filePath: string): ComponentID | null {\n const relativeFile = this.getRelativePathLinux(filePath);\n const rootDir = this.findRootDirByFilePathRecursively(relativeFile);\n if (!rootDir) {\n // the file is not part of any component. If it was a new component, or a new file of\n // existing component, then, handleBitmapChanges() should deal with it.\n return null;\n }\n return this.rootDirs[rootDir];\n }\n\n private getRelativePathLinux(filePath: string) {\n return pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(filePath));\n }\n\n private findRootDirByFilePathRecursively(filePath: string): string | null {\n if (this.rootDirs[filePath]) return filePath;\n const parentDir = dirname(filePath);\n if (parentDir === filePath) return null;\n return this.findRootDirByFilePathRecursively(parentDir);\n }\n\n private async createWatcher() {\n const usePollingConf = await this.watcherMain.globalConfig.get(CFG_WATCH_USE_POLLING);\n const usePolling = usePollingConf === 'true';\n const workspacePathLinux = pathNormalizeToLinux(this.workspace.path);\n const ignoreLocalScope = (pathToCheck: string) => {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(`${workspacePathLinux}/.git/`) || pathToCheck.startsWith(`${workspacePathLinux}/.bit/`)\n );\n };\n this.fsWatcher = chokidar.watch(this.workspace.path, {\n ignoreInitial: true,\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 ignored: ['**/node_modules/**', '**/package.json', ignoreLocalScope],\n usePolling,\n // useFsEvents,\n persistent: true,\n });\n if (this.verbose) {\n logger.console(`${chalk.bold('chokidar.options:\\n')} ${JSON.stringify(this.fsWatcher.options, undefined, 2)}`);\n }\n }\n\n private async setRootDirs() {\n this.rootDirs = {};\n const componentsFromBitMap = this.consumer.bitMap.getAllComponents();\n componentsFromBitMap.map((componentMap) => {\n const componentId = componentMap.id;\n const rootDir = componentMap.getRootDir();\n this.rootDirs[rootDir] = componentId;\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,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,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAE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,CAAC;IAElH,CAAC;IACD,IAAI,CAAC9J,SAAS,GAAGmK,mBAAQ,CAAC9K,KAAK,CAAC,IAAI,CAACV,SAAS,CAACoL,IAAI,EAAE;MACnDK,aAAa,EAAE,IAAI;MACnB;MACA;MACAC,OAAO,EAAE,CAAC,oBAAoB,EAAE,iBAAiB,EAAEL,gBAAgB,CAAC;MACpEH,UAAU;MACV;MACAS,UAAU,EAAE;IACd,CAAC,CAAC;IACF,IAAI,IAAI,CAACnL,OAAO,EAAE;MAChB2B,iBAAM,CAACC,OAAO,CAAC,GAAGC,gBAAK,CAACC,IAAI,CAAC,qBAAqB,CAAC,IAAIC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACnB,SAAS,CAAClB,OAAO,EAAE+E,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IAChH;EACF;EAEA,MAAcpE,WAAWA,CAAA,EAAG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAM2K,oBAAoB,GAAG,IAAI,CAACnL,QAAQ,CAACgH,MAAM,CAACoE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAACvE,GAAG,CAAEhB,YAAY,IAAK;MACzC,MAAMzB,WAAW,GAAGyB,YAAY,CAACP,EAAE;MACnC,MAAM6E,OAAO,GAAGtE,YAAY,CAACyF,UAAU,CAAC,CAAC;MACzC,IAAI,CAAC7K,QAAQ,CAAC0J,OAAO,CAAC,GAAG/F,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAACmH,OAAA,CAAAjM,OAAA,GAAAA,OAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/watcher",
3
- "version": "1.0.460",
3
+ "version": "1.0.461",
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.460"
9
+ "version": "1.0.461"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -16,17 +16,17 @@
16
16
  "p-map-series": "2.1.0",
17
17
  "chokidar": "3.6.0",
18
18
  "fs-extra": "10.0.0",
19
- "@teambit/harmony": "0.4.6",
20
19
  "@teambit/component-id": "1.2.2",
21
- "@teambit/compiler": "1.0.460",
22
- "@teambit/logger": "0.0.1130",
23
- "@teambit/workspace": "1.0.460",
24
- "@teambit/cli": "0.0.1037",
25
- "@teambit/pubsub": "1.0.460",
26
- "@teambit/global-config": "0.0.1040",
27
- "@teambit/ipc-events": "1.0.460",
28
- "@teambit/scope": "1.0.460",
29
- "@teambit/legacy.bit-map": "0.0.47",
20
+ "@teambit/harmony": "0.4.6",
21
+ "@teambit/compiler": "1.0.461",
22
+ "@teambit/logger": "0.0.1131",
23
+ "@teambit/workspace": "1.0.461",
24
+ "@teambit/cli": "0.0.1038",
25
+ "@teambit/pubsub": "1.0.461",
26
+ "@teambit/global-config": "0.0.1041",
27
+ "@teambit/ipc-events": "1.0.461",
28
+ "@teambit/scope": "1.0.461",
29
+ "@teambit/legacy.bit-map": "0.0.48",
30
30
  "@teambit/legacy.utils": "0.0.6"
31
31
  },
32
32
  "devDependencies": {