@teambit/watcher 1.0.241 → 1.0.243
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/schema.json +69 -29
- package/dist/watch.cmd.d.ts +1 -0
- package/dist/watch.cmd.js +5 -3
- package/dist/watch.cmd.js.map +1 -1
- package/dist/watcher.d.ts +12 -0
- package/dist/watcher.js +38 -0
- package/dist/watcher.js.map +1 -1
- package/package.json +7 -7
- /package/dist/{preview-1713323989441.js → preview-1713410404591.js} +0 -0
|
@@ -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.
|
|
3
|
+
<testsuite name="teambit.workspace/watcher@1.0.243" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
package/artifacts/schema.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"line": 51,
|
|
21
21
|
"character": 1
|
|
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}",
|
|
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}",
|
|
24
24
|
"name": "WatchOptions",
|
|
25
25
|
"type": {
|
|
26
26
|
"__schema": "TypeLiteralSchema",
|
|
@@ -174,6 +174,26 @@
|
|
|
174
174
|
"name": "boolean"
|
|
175
175
|
},
|
|
176
176
|
"isOptional": true
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"__schema": "VariableLikeSchema",
|
|
180
|
+
"location": {
|
|
181
|
+
"filePath": "watcher.ts",
|
|
182
|
+
"line": 59,
|
|
183
|
+
"character": 3
|
|
184
|
+
},
|
|
185
|
+
"signature": "(property) import?: boolean | undefined",
|
|
186
|
+
"name": "import",
|
|
187
|
+
"type": {
|
|
188
|
+
"__schema": "KeywordTypeSchema",
|
|
189
|
+
"location": {
|
|
190
|
+
"filePath": "watcher.ts",
|
|
191
|
+
"line": 59,
|
|
192
|
+
"character": 12
|
|
193
|
+
},
|
|
194
|
+
"name": "boolean"
|
|
195
|
+
},
|
|
196
|
+
"isOptional": true
|
|
177
197
|
}
|
|
178
198
|
]
|
|
179
199
|
}
|
|
@@ -1328,7 +1348,7 @@
|
|
|
1328
1348
|
"line": 51,
|
|
1329
1349
|
"character": 1
|
|
1330
1350
|
},
|
|
1331
|
-
"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}",
|
|
1351
|
+
"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}",
|
|
1332
1352
|
"name": "WatchOptions",
|
|
1333
1353
|
"type": {
|
|
1334
1354
|
"__schema": "TypeLiteralSchema",
|
|
@@ -1482,6 +1502,26 @@
|
|
|
1482
1502
|
"name": "boolean"
|
|
1483
1503
|
},
|
|
1484
1504
|
"isOptional": true
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
"__schema": "VariableLikeSchema",
|
|
1508
|
+
"location": {
|
|
1509
|
+
"filePath": "watcher.ts",
|
|
1510
|
+
"line": 59,
|
|
1511
|
+
"character": 3
|
|
1512
|
+
},
|
|
1513
|
+
"signature": "(property) import?: boolean | undefined",
|
|
1514
|
+
"name": "import",
|
|
1515
|
+
"type": {
|
|
1516
|
+
"__schema": "KeywordTypeSchema",
|
|
1517
|
+
"location": {
|
|
1518
|
+
"filePath": "watcher.ts",
|
|
1519
|
+
"line": 59,
|
|
1520
|
+
"character": 12
|
|
1521
|
+
},
|
|
1522
|
+
"name": "boolean"
|
|
1523
|
+
},
|
|
1524
|
+
"isOptional": true
|
|
1485
1525
|
}
|
|
1486
1526
|
]
|
|
1487
1527
|
}
|
|
@@ -1490,7 +1530,7 @@
|
|
|
1490
1530
|
"__schema": "TypeSchema",
|
|
1491
1531
|
"location": {
|
|
1492
1532
|
"filePath": "watcher.ts",
|
|
1493
|
-
"line":
|
|
1533
|
+
"line": 62,
|
|
1494
1534
|
"character": 1
|
|
1495
1535
|
},
|
|
1496
1536
|
"signature": "type RootDirs = {\n [dir: string]: ComponentID;\n}",
|
|
@@ -1499,7 +1539,7 @@
|
|
|
1499
1539
|
"__schema": "TypeLiteralSchema",
|
|
1500
1540
|
"location": {
|
|
1501
1541
|
"filePath": "watcher.ts",
|
|
1502
|
-
"line":
|
|
1542
|
+
"line": 62,
|
|
1503
1543
|
"character": 24
|
|
1504
1544
|
},
|
|
1505
1545
|
"members": [
|
|
@@ -1507,14 +1547,14 @@
|
|
|
1507
1547
|
"__schema": "IndexSignatureSchema",
|
|
1508
1548
|
"location": {
|
|
1509
1549
|
"filePath": "watcher.ts",
|
|
1510
|
-
"line":
|
|
1550
|
+
"line": 62,
|
|
1511
1551
|
"character": 26
|
|
1512
1552
|
},
|
|
1513
1553
|
"keyType": {
|
|
1514
1554
|
"__schema": "ParameterSchema",
|
|
1515
1555
|
"location": {
|
|
1516
1556
|
"filePath": "watcher.ts",
|
|
1517
|
-
"line":
|
|
1557
|
+
"line": 62,
|
|
1518
1558
|
"character": 27
|
|
1519
1559
|
},
|
|
1520
1560
|
"name": "dir",
|
|
@@ -1522,7 +1562,7 @@
|
|
|
1522
1562
|
"__schema": "TypeRefSchema",
|
|
1523
1563
|
"location": {
|
|
1524
1564
|
"filePath": "watcher.ts",
|
|
1525
|
-
"line":
|
|
1565
|
+
"line": 62,
|
|
1526
1566
|
"character": 32
|
|
1527
1567
|
},
|
|
1528
1568
|
"name": "PathLinux",
|
|
@@ -1535,7 +1575,7 @@
|
|
|
1535
1575
|
"__schema": "TypeRefSchema",
|
|
1536
1576
|
"location": {
|
|
1537
1577
|
"filePath": "watcher.ts",
|
|
1538
|
-
"line":
|
|
1578
|
+
"line": 62,
|
|
1539
1579
|
"character": 44
|
|
1540
1580
|
},
|
|
1541
1581
|
"name": "ComponentID",
|
|
@@ -1553,7 +1593,7 @@
|
|
|
1553
1593
|
"__schema": "ClassSchema",
|
|
1554
1594
|
"location": {
|
|
1555
1595
|
"filePath": "watcher.ts",
|
|
1556
|
-
"line":
|
|
1596
|
+
"line": 67,
|
|
1557
1597
|
"character": 1
|
|
1558
1598
|
},
|
|
1559
1599
|
"signature": "class Watcher",
|
|
@@ -1563,7 +1603,7 @@
|
|
|
1563
1603
|
"__schema": "ConstructorSchema",
|
|
1564
1604
|
"location": {
|
|
1565
1605
|
"filePath": "watcher.ts",
|
|
1566
|
-
"line":
|
|
1606
|
+
"line": 76,
|
|
1567
1607
|
"character": 3
|
|
1568
1608
|
},
|
|
1569
1609
|
"signature": "constructor Watcher(workspace: Workspace, pubsub: PubsubMain, watcherMain: WatcherMain, options: WatchOptions): Watcher",
|
|
@@ -1573,7 +1613,7 @@
|
|
|
1573
1613
|
"__schema": "ParameterSchema",
|
|
1574
1614
|
"location": {
|
|
1575
1615
|
"filePath": "watcher.ts",
|
|
1576
|
-
"line":
|
|
1616
|
+
"line": 77,
|
|
1577
1617
|
"character": 5
|
|
1578
1618
|
},
|
|
1579
1619
|
"name": "workspace",
|
|
@@ -1581,7 +1621,7 @@
|
|
|
1581
1621
|
"__schema": "TypeRefSchema",
|
|
1582
1622
|
"location": {
|
|
1583
1623
|
"filePath": "watcher.ts",
|
|
1584
|
-
"line":
|
|
1624
|
+
"line": 77,
|
|
1585
1625
|
"character": 24
|
|
1586
1626
|
},
|
|
1587
1627
|
"name": "Workspace",
|
|
@@ -1597,7 +1637,7 @@
|
|
|
1597
1637
|
"__schema": "ParameterSchema",
|
|
1598
1638
|
"location": {
|
|
1599
1639
|
"filePath": "watcher.ts",
|
|
1600
|
-
"line":
|
|
1640
|
+
"line": 78,
|
|
1601
1641
|
"character": 5
|
|
1602
1642
|
},
|
|
1603
1643
|
"name": "pubsub",
|
|
@@ -1605,7 +1645,7 @@
|
|
|
1605
1645
|
"__schema": "TypeRefSchema",
|
|
1606
1646
|
"location": {
|
|
1607
1647
|
"filePath": "watcher.ts",
|
|
1608
|
-
"line":
|
|
1648
|
+
"line": 78,
|
|
1609
1649
|
"character": 21
|
|
1610
1650
|
},
|
|
1611
1651
|
"name": "PubsubMain",
|
|
@@ -1621,7 +1661,7 @@
|
|
|
1621
1661
|
"__schema": "ParameterSchema",
|
|
1622
1662
|
"location": {
|
|
1623
1663
|
"filePath": "watcher.ts",
|
|
1624
|
-
"line":
|
|
1664
|
+
"line": 79,
|
|
1625
1665
|
"character": 5
|
|
1626
1666
|
},
|
|
1627
1667
|
"name": "watcherMain",
|
|
@@ -1629,7 +1669,7 @@
|
|
|
1629
1669
|
"__schema": "TypeRefSchema",
|
|
1630
1670
|
"location": {
|
|
1631
1671
|
"filePath": "watcher.ts",
|
|
1632
|
-
"line":
|
|
1672
|
+
"line": 79,
|
|
1633
1673
|
"character": 26
|
|
1634
1674
|
},
|
|
1635
1675
|
"name": "WatcherMain"
|
|
@@ -1641,7 +1681,7 @@
|
|
|
1641
1681
|
"__schema": "ParameterSchema",
|
|
1642
1682
|
"location": {
|
|
1643
1683
|
"filePath": "watcher.ts",
|
|
1644
|
-
"line":
|
|
1684
|
+
"line": 80,
|
|
1645
1685
|
"character": 5
|
|
1646
1686
|
},
|
|
1647
1687
|
"name": "options",
|
|
@@ -1649,7 +1689,7 @@
|
|
|
1649
1689
|
"__schema": "TypeRefSchema",
|
|
1650
1690
|
"location": {
|
|
1651
1691
|
"filePath": "watcher.ts",
|
|
1652
|
-
"line":
|
|
1692
|
+
"line": 80,
|
|
1653
1693
|
"character": 22
|
|
1654
1694
|
},
|
|
1655
1695
|
"name": "WatchOptions"
|
|
@@ -1662,7 +1702,7 @@
|
|
|
1662
1702
|
"__schema": "ThisTypeSchema",
|
|
1663
1703
|
"location": {
|
|
1664
1704
|
"filePath": "watcher.ts",
|
|
1665
|
-
"line":
|
|
1705
|
+
"line": 67,
|
|
1666
1706
|
"character": 1
|
|
1667
1707
|
},
|
|
1668
1708
|
"name": "Watcher"
|
|
@@ -1673,7 +1713,7 @@
|
|
|
1673
1713
|
"__schema": "GetAccessorSchema",
|
|
1674
1714
|
"location": {
|
|
1675
1715
|
"filePath": "watcher.ts",
|
|
1676
|
-
"line":
|
|
1716
|
+
"line": 86,
|
|
1677
1717
|
"character": 3
|
|
1678
1718
|
},
|
|
1679
1719
|
"signature": "(getter) Watcher.consumer: Consumer",
|
|
@@ -1682,7 +1722,7 @@
|
|
|
1682
1722
|
"__schema": "TypeRefSchema",
|
|
1683
1723
|
"location": {
|
|
1684
1724
|
"filePath": "watcher.ts",
|
|
1685
|
-
"line":
|
|
1725
|
+
"line": 86,
|
|
1686
1726
|
"character": 3
|
|
1687
1727
|
},
|
|
1688
1728
|
"name": "Consumer",
|
|
@@ -1693,7 +1733,7 @@
|
|
|
1693
1733
|
"__schema": "FunctionLikeSchema",
|
|
1694
1734
|
"location": {
|
|
1695
1735
|
"filePath": "watcher.ts",
|
|
1696
|
-
"line":
|
|
1736
|
+
"line": 90,
|
|
1697
1737
|
"character": 3
|
|
1698
1738
|
},
|
|
1699
1739
|
"signature": "(method) Watcher.watch(): Promise<unknown>",
|
|
@@ -1703,7 +1743,7 @@
|
|
|
1703
1743
|
"__schema": "InferenceTypeSchema",
|
|
1704
1744
|
"location": {
|
|
1705
1745
|
"filePath": "watcher.ts",
|
|
1706
|
-
"line":
|
|
1746
|
+
"line": 90,
|
|
1707
1747
|
"character": 3
|
|
1708
1748
|
},
|
|
1709
1749
|
"type": "Promise<unknown>"
|
|
@@ -1722,7 +1762,7 @@
|
|
|
1722
1762
|
"__schema": "ModuleSchema",
|
|
1723
1763
|
"location": {
|
|
1724
1764
|
"filePath": "watcher.ts",
|
|
1725
|
-
"line":
|
|
1765
|
+
"line": 64,
|
|
1726
1766
|
"character": 1
|
|
1727
1767
|
},
|
|
1728
1768
|
"exports": [
|
|
@@ -1730,7 +1770,7 @@
|
|
|
1730
1770
|
"__schema": "VariableLikeSchema",
|
|
1731
1771
|
"location": {
|
|
1732
1772
|
"filePath": "watcher.ts",
|
|
1733
|
-
"line":
|
|
1773
|
+
"line": 64,
|
|
1734
1774
|
"character": 7
|
|
1735
1775
|
},
|
|
1736
1776
|
"signature": "const DEBOUNCE_WAIT_MS: 100",
|
|
@@ -1739,7 +1779,7 @@
|
|
|
1739
1779
|
"__schema": "InferenceTypeSchema",
|
|
1740
1780
|
"location": {
|
|
1741
1781
|
"filePath": "watcher.ts",
|
|
1742
|
-
"line":
|
|
1782
|
+
"line": 64,
|
|
1743
1783
|
"character": 7
|
|
1744
1784
|
},
|
|
1745
1785
|
"type": "100"
|
|
@@ -1754,7 +1794,7 @@
|
|
|
1754
1794
|
"__schema": "TypeSchema",
|
|
1755
1795
|
"location": {
|
|
1756
1796
|
"filePath": "watcher.ts",
|
|
1757
|
-
"line":
|
|
1797
|
+
"line": 65,
|
|
1758
1798
|
"character": 1
|
|
1759
1799
|
},
|
|
1760
1800
|
"signature": "type PathLinux = string",
|
|
@@ -1763,7 +1803,7 @@
|
|
|
1763
1803
|
"__schema": "KeywordTypeSchema",
|
|
1764
1804
|
"location": {
|
|
1765
1805
|
"filePath": "watcher.ts",
|
|
1766
|
-
"line":
|
|
1806
|
+
"line": 65,
|
|
1767
1807
|
"character": 18
|
|
1768
1808
|
},
|
|
1769
1809
|
"name": "string"
|
|
@@ -2615,7 +2655,7 @@
|
|
|
2615
2655
|
"componentId": {
|
|
2616
2656
|
"scope": "teambit.workspace",
|
|
2617
2657
|
"name": "watcher",
|
|
2618
|
-
"version": "1.0.
|
|
2658
|
+
"version": "1.0.243"
|
|
2619
2659
|
},
|
|
2620
2660
|
"taggedModuleExports": []
|
|
2621
2661
|
}
|
package/dist/watch.cmd.d.ts
CHANGED
package/dist/watch.cmd.js
CHANGED
|
@@ -67,7 +67,7 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
|
|
|
67
67
|
_defineProperty(this, "helpUrl", 'reference/compiling/compiler-overview');
|
|
68
68
|
_defineProperty(this, "alias", '');
|
|
69
69
|
_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]', 'EXPERIMENTAL. show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project']]);
|
|
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]', 'EXPERIMENTAL. show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project'], ['i', 'import', 'helpful when using git. import component objects if .bitmap changed not by bit']]);
|
|
71
71
|
_defineProperty(this, "eventsListener", event => {
|
|
72
72
|
switch (event.type) {
|
|
73
73
|
case _compiler().CompilerErrorEvent.TYPE:
|
|
@@ -84,7 +84,8 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
|
|
|
84
84
|
async report(cliArgs, watchCmdOpts) {
|
|
85
85
|
const {
|
|
86
86
|
verbose,
|
|
87
|
-
checkTypes
|
|
87
|
+
checkTypes,
|
|
88
|
+
import: importIfNeeded
|
|
88
89
|
} = watchCmdOpts;
|
|
89
90
|
const getCheckTypesEnum = () => {
|
|
90
91
|
switch (checkTypes) {
|
|
@@ -108,7 +109,8 @@ if this doesn't work well for you, run "bit config set watch_use_polling true" t
|
|
|
108
109
|
preCompile: !watchCmdOpts.skipPreCompilation,
|
|
109
110
|
spawnTSServer: Boolean(checkTypes),
|
|
110
111
|
// if check-types is enabled, it must spawn the tsserver.
|
|
111
|
-
checkTypes: getCheckTypesEnum()
|
|
112
|
+
checkTypes: getCheckTypesEnum(),
|
|
113
|
+
import: importIfNeeded
|
|
112
114
|
};
|
|
113
115
|
await this.watcher.watch(watchOpts);
|
|
114
116
|
return 'watcher terminated';
|
package/dist/watch.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_moment","_compiler","_outputFormatter","_checkTypes","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","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","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\nexport type WatchCmdOpts = {\n verbose?: boolean;\n skipPreCompilation?: boolean;\n checkTypes?: string | 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 'EXPERIMENTAL. show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project',\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 } = watchCmdOpts;\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 };\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,SA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,mBAAoB,KAAI,CAAC;EAC1EvD,MAAM,CAACM,OAAO,CAAC,IAAAyD,uCAAoB,EAACN,YAAY,CAAC,CAAC;EAClDzD,MAAM,CAACM,OAAO,CAAE,aAAYoD,QAAS,MAAK,CAAC;EAC3C1D,MAAM,CAACM,OAAO,CAACqC,gBAAK,CAACC,MAAM,CAAE,mCAAkC,IAAAE,iBAAM,EAAC,CAAC,CAACC,MAAM,CAAC,UAAU,CAAE,MAAK,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","_compiler","_outputFormatter","_checkTypes","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","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","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\nexport type WatchCmdOpts = {\n verbose?: boolean;\n skipPreCompilation?: boolean;\n checkTypes?: string | boolean;\n import?: 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 'EXPERIMENTAL. show errors/warnings for types. options are [file, project] to investigate only changed file or entire project. defaults to project',\n ],\n ['i', 'import', 'helpful when using git. 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 } = watchCmdOpts;\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: importIfNeeded,\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 dele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AM,CAACM,OAAO,CAAE,aAAYwD,KAAM,cAAaL,mBAAoB,8BAA6B,CAAC;MAC9G;IACF;IACAzD,MAAM,CAACM,OAAO,CAAE,GAAEuD,UAAW,MAAK,CAAC;IACnC;EACF;EACA7D,MAAM,CAACM,OAAO,CAAE,eAAcwD,KAAM,cAAaL,mBAAoB,KAAI,CAAC;EAC1EzD,MAAM,CAACM,OAAO,CAAC,IAAA2D,uCAAoB,EAACN,YAAY,CAAC,CAAC;EAClD3D,MAAM,CAACM,OAAO,CAAE,aAAYsD,QAAS,MAAK,CAAC;EAC3C5D,MAAM,CAACM,OAAO,CAACuC,gBAAK,CAACC,MAAM,CAAE,mCAAkC,IAAAE,iBAAM,EAAC,CAAC,CAACC,MAAM,CAAC,UAAU,CAAE,MAAK,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
|
checkTypes?: CheckTypes;
|
|
31
31
|
preCompile?: boolean;
|
|
32
32
|
compile?: boolean;
|
|
33
|
+
import?: boolean;
|
|
33
34
|
};
|
|
34
35
|
export type RootDirs = {
|
|
35
36
|
[dir: PathLinux]: ComponentID;
|
|
@@ -93,6 +94,17 @@ export declare class Watcher {
|
|
|
93
94
|
* if .bitmap changed, it's possible that a new component has been added. trigger onComponentAdd.
|
|
94
95
|
*/
|
|
95
96
|
private handleBitmapChanges;
|
|
97
|
+
/**
|
|
98
|
+
* needed when using git.
|
|
99
|
+
* it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.
|
|
100
|
+
* because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.
|
|
101
|
+
* as soon as the watcher gets an event about a file change, it loads the component which throws
|
|
102
|
+
* ComponentsPendingImport error.
|
|
103
|
+
* to resolve this, we import the new objects as soon as the .bitmap file changes.
|
|
104
|
+
* for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is
|
|
105
|
+
* not already in the scope.
|
|
106
|
+
*/
|
|
107
|
+
private importObjectsIfNeeded;
|
|
96
108
|
private executeWatchOperationsOnRemove;
|
|
97
109
|
private executeWatchOperationsOnComponent;
|
|
98
110
|
private createOnComponentRemovedEvent;
|
package/dist/watcher.js
CHANGED
|
@@ -337,8 +337,10 @@ class Watcher {
|
|
|
337
337
|
*/
|
|
338
338
|
async handleBitmapChanges() {
|
|
339
339
|
const previewsRootDirs = _objectSpread({}, this.rootDirs);
|
|
340
|
+
const previewsIds = this.consumer.bitMap.getAllBitIds();
|
|
340
341
|
await this.workspace._reloadConsumer();
|
|
341
342
|
await this.setRootDirs();
|
|
343
|
+
await this.importObjectsIfNeeded(previewsIds);
|
|
342
344
|
await this.workspace.triggerOnBitmapChange();
|
|
343
345
|
const newDirs = (0, _lodash().difference)(Object.keys(this.rootDirs), Object.keys(previewsRootDirs));
|
|
344
346
|
const removedDirs = (0, _lodash().difference)(Object.keys(previewsRootDirs), Object.keys(this.rootDirs));
|
|
@@ -352,6 +354,42 @@ class Watcher {
|
|
|
352
354
|
}
|
|
353
355
|
return results;
|
|
354
356
|
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* needed when using git.
|
|
360
|
+
* it resolves the following issue - a user is running `git pull` which updates the components and the .bitmap file.
|
|
361
|
+
* because the objects locally are not updated, the .bitmap has new versions that don't exist in the local scope.
|
|
362
|
+
* as soon as the watcher gets an event about a file change, it loads the component which throws
|
|
363
|
+
* ComponentsPendingImport error.
|
|
364
|
+
* to resolve this, we import the new objects as soon as the .bitmap file changes.
|
|
365
|
+
* for performance reasons, we import only when: 1) the .bitmap file has version changes and 2) this new version is
|
|
366
|
+
* not already in the scope.
|
|
367
|
+
*/
|
|
368
|
+
async importObjectsIfNeeded(previewsIds) {
|
|
369
|
+
if (!this.options.import) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const currentIds = this.consumer.bitMap.getAllBitIds();
|
|
373
|
+
const hasVersionChanges = currentIds.find(id => {
|
|
374
|
+
const prevId = previewsIds.searchWithoutVersion(id);
|
|
375
|
+
return prevId && prevId.version !== id.version;
|
|
376
|
+
});
|
|
377
|
+
if (!hasVersionChanges) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const existsInScope = await this.workspace.scope.isComponentInScope(hasVersionChanges);
|
|
381
|
+
if (existsInScope) {
|
|
382
|
+
// the .bitmap change was probably a result of tag/snap/merge, no need to import.
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (this.options.verbose) {
|
|
386
|
+
_logger().default.console(`Watcher: .bitmap has changed with new versions which do not exist locally, importing the objects...`);
|
|
387
|
+
}
|
|
388
|
+
await this.workspace.scope.import(currentIds, {
|
|
389
|
+
useCache: true,
|
|
390
|
+
lane: (await this.workspace.getCurrentLaneObject()) || undefined
|
|
391
|
+
});
|
|
392
|
+
}
|
|
355
393
|
async executeWatchOperationsOnRemove(componentId) {
|
|
356
394
|
_logger().default.debug(`running OnComponentRemove hook for ${_chalk().default.bold(componentId.toString())}`);
|
|
357
395
|
this.pubsub.pub(_workspace().WorkspaceAspect.id, this.createOnComponentRemovedEvent(componentId.toString()));
|
package/dist/watcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_loader","_constants","_logger","_utils","_pMapSeries","_chalk","_unmergedComponents","_chokidar","_workspace","_watchQueue","_excluded","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","sourceSymbolKeys","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","value","_toPropertyKey","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","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","logger","warn","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","toString","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","console","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","_reloadConsumer","triggerOnBitmapChange","newDirs","difference","removedDirs","addResults","mapSeries","dir","flat","executeWatchOperationsOnRemove","chalk","bold","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","ignoreLocalScope","pathToCheck","startsWith","path","chokidar","ignoreInitial","ignored","persistent","JSON","stringify","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 } 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 } from '@teambit/legacy/dist/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 '@teambit/chokidar';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\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};\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 // console.log(this.fsWatcher.getWatched());\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 (!(await 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 await this.workspace._reloadConsumer();\n await this.setRootDirs();\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 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 useFsEventsConf = await this.watcherMain.globalConfig.get(CFG_WATCH_USE_FS_EVENTS);\n // const useFsEvents = useFsEventsConf === 'true';\n const ignoreLocalScope = (pathToCheck: string) => {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(`${this.workspace.path}/.git/`) || pathToCheck.startsWith(`${this.workspace.path}/.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 /**\n * default to false, although it causes high CPU usage.\n * see: https://github.com/paulmillr/chokidar/issues/1196#issuecomment-1711033539\n * there is a fix for this in master. once a new version of Chokidar is released, we can upgrade it and then\n * default to true.\n */\n usePolling,\n // useFsEvents,\n persistent: true,\n });\n if (this.verbose) {\n logger.console(`chokidar.options ${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;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AG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAMwJ,oBAAoB,GAAG,IAAI,CAAChK,QAAQ,CAACwG,MAAM,CAACyD,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAAC5D,GAAG,CAAEhB,YAAY,IAAK;MACzC,MAAM3B,WAAW,GAAG2B,YAAY,CAACP,EAAE;MACnC,MAAMiE,OAAO,GAAG1D,YAAY,CAAC8E,UAAU,CAAC,CAAC;MACzC,IAAI,CAAC1J,QAAQ,CAACsI,OAAO,CAAC,GAAGrF,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAAC0G,OAAA,CAAA9K,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_loader","_constants","_logger","_utils","_pMapSeries","_chalk","_unmergedComponents","_chokidar","_workspace","_watchQueue","_excluded","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","sourceSymbolKeys","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","value","_toPropertyKey","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","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","logger","warn","triggerGotEvent","WORKSPACE_JSONC","triggerOnWorkspaceConfigChange","UNMERGED_FILENAME","clearCache","componentId","getComponentIdByPath","compIdStr","toString","changedFilesPerComponent","sleep","triggerCompChanges","undefined","join","msg","error","console","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","flat","executeWatchOperationsOnRemove","import","currentIds","hasVersionChanges","prevId","searchWithoutVersion","version","existsInScope","isComponentInScope","useCache","lane","getCurrentLaneObject","chalk","bold","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","ignoreLocalScope","pathToCheck","startsWith","path","chokidar","ignoreInitial","ignored","persistent","JSON","stringify","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 } from '@teambit/legacy/dist/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 '@teambit/chokidar';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\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 // console.log(this.fsWatcher.getWatched());\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 (!(await 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()) || undefined,\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 useFsEventsConf = await this.watcherMain.globalConfig.get(CFG_WATCH_USE_FS_EVENTS);\n // const useFsEvents = useFsEventsConf === 'true';\n const ignoreLocalScope = (pathToCheck: string) => {\n if (pathToCheck.startsWith(this.ipcEventsDir) || pathToCheck.endsWith(UNMERGED_FILENAME)) return false;\n return (\n pathToCheck.startsWith(`${this.workspace.path}/.git/`) || pathToCheck.startsWith(`${this.workspace.path}/.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 /**\n * default to false, although it causes high CPU usage.\n * see: https://github.com/paulmillr/chokidar/issues/1196#issuecomment-1711033539\n * there is a fix for this in master. once a new version of Chokidar is released, we can upgrade it and then\n * default to true.\n */\n usePolling,\n // useFsEvents,\n persistent: true,\n });\n if (this.verbose) {\n logger.console(`chokidar.options ${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,IA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B;MACA;MACAC,OAAO,EAAE,CAAC,oBAAoB,EAAE,iBAAiB,EAAEN,gBAAgB,CAAC;MACpE;AACN;AACA;AACA;AACA;AACA;MACMD,UAAU;MACV;MACAQ,UAAU,EAAE;IACd,CAAC,CAAC;IACF,IAAI,IAAI,CAAC5K,OAAO,EAAE;MAChBmD,iBAAM,CAACkB,OAAO,CAAE,oBAAmBwG,IAAI,CAACC,SAAS,CAAC,IAAI,CAACjK,SAAS,CAAClB,OAAO,EAAEsE,SAAS,EAAE,CAAC,CAAE,EAAC,CAAC;IAC5F;EACF;EAEA,MAAc3D,WAAWA,CAAA,EAAG;IAC1B,IAAI,CAACG,QAAQ,GAAG,CAAC,CAAC;IAClB,MAAMsK,oBAAoB,GAAG,IAAI,CAAC9K,QAAQ,CAACwG,MAAM,CAACuE,gBAAgB,CAAC,CAAC;IACpED,oBAAoB,CAAC1E,GAAG,CAAEhB,YAAY,IAAK;MACzC,MAAM3B,WAAW,GAAG2B,YAAY,CAACP,EAAE;MACnC,MAAM+E,OAAO,GAAGxE,YAAY,CAAC4F,UAAU,CAAC,CAAC;MACzC,IAAI,CAACxK,QAAQ,CAACoJ,OAAO,CAAC,GAAGnG,WAAW;IACtC,CAAC,CAAC;EACJ;AACF;AAACwH,OAAA,CAAA5L,OAAA,GAAAA,OAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/watcher",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.243",
|
|
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.243"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"fs-extra": "10.0.0",
|
|
19
19
|
"@teambit/harmony": "0.4.6",
|
|
20
20
|
"@teambit/component-id": "1.2.0",
|
|
21
|
-
"@teambit/compiler": "1.0.
|
|
21
|
+
"@teambit/compiler": "1.0.243",
|
|
22
22
|
"@teambit/logger": "0.0.955",
|
|
23
|
-
"@teambit/workspace": "1.0.
|
|
23
|
+
"@teambit/workspace": "1.0.243",
|
|
24
24
|
"@teambit/cli": "0.0.862",
|
|
25
|
-
"@teambit/pubsub": "1.0.
|
|
25
|
+
"@teambit/pubsub": "1.0.243",
|
|
26
26
|
"@teambit/global-config": "0.0.865",
|
|
27
|
-
"@teambit/ipc-events": "1.0.
|
|
28
|
-
"@teambit/scope": "1.0.
|
|
27
|
+
"@teambit/ipc-events": "1.0.243",
|
|
28
|
+
"@teambit/scope": "1.0.243"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/lodash": "4.14.165",
|
|
File without changes
|