@vscode/component-explorer-cli 0.1.1-0 → 0.1.1-10

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.
Files changed (167) hide show
  1. package/README.md +177 -0
  2. package/dist/browserPage.js +4 -2
  3. package/dist/browserPage.js.map +1 -1
  4. package/dist/commands/acceptCommand.d.ts +3 -1
  5. package/dist/commands/acceptCommand.d.ts.map +1 -1
  6. package/dist/commands/acceptCommand.js +20 -8
  7. package/dist/commands/acceptCommand.js.map +1 -1
  8. package/dist/commands/compareCommand.d.ts +6 -1
  9. package/dist/commands/compareCommand.d.ts.map +1 -1
  10. package/dist/commands/compareCommand.js +51 -73
  11. package/dist/commands/compareCommand.js.map +1 -1
  12. package/dist/commands/mcpCommand.d.ts +10 -0
  13. package/dist/commands/mcpCommand.d.ts.map +1 -0
  14. package/dist/commands/mcpCommand.js +58 -0
  15. package/dist/commands/mcpCommand.js.map +1 -0
  16. package/dist/commands/screenshotCommand.d.ts +8 -2
  17. package/dist/commands/screenshotCommand.d.ts.map +1 -1
  18. package/dist/commands/screenshotCommand.js +70 -17
  19. package/dist/commands/screenshotCommand.js.map +1 -1
  20. package/dist/commands/serveCommand.d.ts +19 -0
  21. package/dist/commands/serveCommand.d.ts.map +1 -0
  22. package/dist/commands/serveCommand.js +194 -0
  23. package/dist/commands/serveCommand.js.map +1 -0
  24. package/dist/commands/watchCommand.d.ts +2 -2
  25. package/dist/commands/watchCommand.d.ts.map +1 -1
  26. package/dist/commands/watchCommand.js +39 -26
  27. package/dist/commands/watchCommand.js.map +1 -1
  28. package/dist/comparison.d.ts +60 -0
  29. package/dist/comparison.d.ts.map +1 -0
  30. package/dist/comparison.js +250 -0
  31. package/dist/comparison.js.map +1 -0
  32. package/dist/component-explorer-config.schema.json +183 -0
  33. package/dist/componentExplorer.d.ts +44 -2
  34. package/dist/componentExplorer.d.ts.map +1 -1
  35. package/dist/componentExplorer.js +103 -18
  36. package/dist/componentExplorer.js.map +1 -1
  37. package/dist/daemon/DaemonContext.d.ts +4 -0
  38. package/dist/daemon/DaemonContext.d.ts.map +1 -0
  39. package/dist/daemon/DaemonService.d.ts +188 -0
  40. package/dist/daemon/DaemonService.d.ts.map +1 -0
  41. package/dist/daemon/DaemonService.js +610 -0
  42. package/dist/daemon/DaemonService.js.map +1 -0
  43. package/dist/daemon/approvalStore.d.ts +51 -0
  44. package/dist/daemon/approvalStore.d.ts.map +1 -0
  45. package/dist/daemon/approvalStore.js +58 -0
  46. package/dist/daemon/approvalStore.js.map +1 -0
  47. package/dist/daemon/lifecycle.d.ts +13 -0
  48. package/dist/daemon/lifecycle.d.ts.map +1 -0
  49. package/dist/daemon/lifecycle.js +68 -0
  50. package/dist/daemon/lifecycle.js.map +1 -0
  51. package/dist/daemon/pipeClient.d.ts +9 -0
  52. package/dist/daemon/pipeClient.d.ts.map +1 -0
  53. package/dist/daemon/pipeClient.js +111 -0
  54. package/dist/daemon/pipeClient.js.map +1 -0
  55. package/dist/daemon/pipeName.d.ts +2 -0
  56. package/dist/daemon/pipeName.d.ts.map +1 -0
  57. package/dist/daemon/pipeName.js +14 -0
  58. package/dist/daemon/pipeName.js.map +1 -0
  59. package/dist/daemon/pipeServer.d.ts +4 -0
  60. package/dist/daemon/pipeServer.d.ts.map +1 -0
  61. package/dist/daemon/pipeServer.js +25 -0
  62. package/dist/daemon/pipeServer.js.map +1 -0
  63. package/dist/daemon/types.d.ts +12 -0
  64. package/dist/daemon/types.d.ts.map +1 -0
  65. package/dist/dependencyInstaller.js +8 -5
  66. package/dist/dependencyInstaller.js.map +1 -1
  67. package/dist/explorerSession.d.ts +5 -3
  68. package/dist/explorerSession.d.ts.map +1 -1
  69. package/dist/explorerSession.js +11 -5
  70. package/dist/explorerSession.js.map +1 -1
  71. package/dist/external/vscode-observables/observables/dist/disposables.js +66 -0
  72. package/dist/external/vscode-observables/observables/dist/disposables.js.map +1 -0
  73. package/dist/external/vscode-observables/observables/dist/observableInternal/base.js +22 -0
  74. package/dist/external/vscode-observables/observables/dist/observableInternal/base.js.map +1 -0
  75. package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js +37 -0
  76. package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js.map +1 -0
  77. package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js +77 -0
  78. package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js.map +1 -0
  79. package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js +114 -0
  80. package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js.map +1 -0
  81. package/dist/external/vscode-observables/observables/dist/observableInternal/index.js +22 -0
  82. package/dist/external/vscode-observables/observables/dist/observableInternal/index.js.map +1 -0
  83. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js +356 -0
  84. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js.map +1 -0
  85. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js +79 -0
  86. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js.map +1 -0
  87. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js +100 -0
  88. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js.map +1 -0
  89. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js +143 -0
  90. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +1 -0
  91. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js +28 -0
  92. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js.map +1 -0
  93. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js +362 -0
  94. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js.map +1 -0
  95. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js +123 -0
  96. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js.map +1 -0
  97. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js +81 -0
  98. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js.map +1 -0
  99. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js +23 -0
  100. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js.map +1 -0
  101. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js +226 -0
  102. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js.map +1 -0
  103. package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js +87 -0
  104. package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js.map +1 -0
  105. package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js +68 -0
  106. package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js.map +1 -0
  107. package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js +55 -0
  108. package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js.map +1 -0
  109. package/dist/formatValue.d.ts +2 -0
  110. package/dist/formatValue.d.ts.map +1 -0
  111. package/dist/formatValue.js +96 -0
  112. package/dist/formatValue.js.map +1 -0
  113. package/dist/formatValue.test.d.ts +2 -0
  114. package/dist/formatValue.test.d.ts.map +1 -0
  115. package/dist/git/gitCommitId.js +4 -2
  116. package/dist/git/gitCommitId.js.map +1 -1
  117. package/dist/git/gitCommitResolver.js +11 -3
  118. package/dist/git/gitCommitResolver.js.map +1 -1
  119. package/dist/git/gitService.js +5 -2
  120. package/dist/git/gitService.js.map +1 -1
  121. package/dist/git/gitUtils.js +10 -7
  122. package/dist/git/gitUtils.js.map +1 -1
  123. package/dist/git/gitWorktreeManager.js +5 -2
  124. package/dist/git/gitWorktreeManager.js.map +1 -1
  125. package/dist/httpServer.d.ts +9 -7
  126. package/dist/httpServer.d.ts.map +1 -1
  127. package/dist/httpServer.js +75 -11
  128. package/dist/httpServer.js.map +1 -1
  129. package/dist/index.js +6 -1
  130. package/dist/index.js.map +1 -1
  131. package/dist/logger.d.ts +17 -1
  132. package/dist/logger.d.ts.map +1 -1
  133. package/dist/logger.js +43 -6
  134. package/dist/logger.js.map +1 -1
  135. package/dist/mcp/McpServer.d.ts +58 -0
  136. package/dist/mcp/McpServer.d.ts.map +1 -0
  137. package/dist/mcp/McpServer.js +820 -0
  138. package/dist/mcp/McpServer.js.map +1 -0
  139. package/dist/packages/simple-api/dist/chunk-3R7GHWBM.js +137 -0
  140. package/dist/packages/simple-api/dist/chunk-3R7GHWBM.js.map +1 -0
  141. package/dist/packages/simple-api/dist/chunk-Q24JOMNK.js +27 -0
  142. package/dist/packages/simple-api/dist/chunk-Q24JOMNK.js.map +1 -0
  143. package/dist/packages/simple-api/dist/chunk-SGBCNXYH.js +24 -0
  144. package/dist/packages/simple-api/dist/chunk-SGBCNXYH.js.map +1 -0
  145. package/dist/packages/simple-api/dist/express.js +104 -0
  146. package/dist/packages/simple-api/dist/express.js.map +1 -0
  147. package/dist/resolveProject.d.ts +21 -0
  148. package/dist/resolveProject.d.ts.map +1 -0
  149. package/dist/resolveProject.js +39 -0
  150. package/dist/resolveProject.js.map +1 -0
  151. package/dist/screenshotCache.js +7 -4
  152. package/dist/screenshotCache.js.map +1 -1
  153. package/dist/sourceTreeId.js +4 -2
  154. package/dist/sourceTreeId.js.map +1 -1
  155. package/dist/storage.js +5 -2
  156. package/dist/storage.js.map +1 -1
  157. package/dist/utils.d.ts +24 -0
  158. package/dist/utils.d.ts.map +1 -0
  159. package/dist/utils.js +50 -0
  160. package/dist/utils.js.map +1 -0
  161. package/dist/viteProjectRef.js +5 -2
  162. package/dist/viteProjectRef.js.map +1 -1
  163. package/dist/watchConfig.d.ts +41 -0
  164. package/dist/watchConfig.d.ts.map +1 -1
  165. package/dist/watchConfig.js +48 -23
  166. package/dist/watchConfig.js.map +1 -1
  167. package/package.json +19 -6
@@ -0,0 +1,123 @@
1
+ import { subtransaction } from '../transaction.js';
2
+ import { strictEquals } from '../commonFacade/deps.js';
3
+ import { DebugNameData } from '../debugName.js';
4
+ import { getLogger } from '../logging/logging.js';
5
+ import { BaseObservable } from './baseObservable.js';
6
+ import { DebugLocation } from '../debugLocation.js';
7
+
8
+ /*---------------------------------------------------------------------------------------------
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License. See License.txt in the project root for license information.
11
+ *--------------------------------------------------------------------------------------------*/
12
+
13
+ /*---------------------------------------------------------------------------------------------
14
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15
+ * Licensed under the MIT License. See License.txt in the project root for license information.
16
+ *--------------------------------------------------------------------------------------------*/
17
+ function observableFromEvent(...args) {
18
+ let owner;
19
+ let event;
20
+ let getValue;
21
+ let debugLocation;
22
+ if (args.length === 2) {
23
+ [event, getValue] = args;
24
+ }
25
+ else {
26
+ [owner, event, getValue, debugLocation] = args;
27
+ }
28
+ return new FromEventObservable(new DebugNameData(owner, undefined, getValue), event, getValue, () => FromEventObservable.globalTransaction, strictEquals, debugLocation ?? DebugLocation.ofCaller());
29
+ }
30
+ class FromEventObservable extends BaseObservable {
31
+ constructor(_debugNameData, event, _getValue, _getTransaction, _equalityComparator, debugLocation) {
32
+ super(debugLocation);
33
+ this._debugNameData = _debugNameData;
34
+ this.event = event;
35
+ this._getValue = _getValue;
36
+ this._getTransaction = _getTransaction;
37
+ this._equalityComparator = _equalityComparator;
38
+ this._hasValue = false;
39
+ this.handleEvent = (args) => {
40
+ const newValue = this._getValue(args);
41
+ const oldValue = this._value;
42
+ const didChange = !this._hasValue || !(this._equalityComparator(oldValue, newValue));
43
+ let didRunTransaction = false;
44
+ if (didChange) {
45
+ this._value = newValue;
46
+ if (this._hasValue) {
47
+ didRunTransaction = true;
48
+ subtransaction(this._getTransaction(), (tx) => {
49
+ getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });
50
+ for (const o of this._observers) {
51
+ tx.updateObserver(o, this);
52
+ o.handleChange(this, undefined);
53
+ }
54
+ }, () => {
55
+ const name = this.getDebugName();
56
+ return 'Event fired' + (name ? `: ${name}` : '');
57
+ });
58
+ }
59
+ this._hasValue = true;
60
+ }
61
+ if (!didRunTransaction) {
62
+ getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });
63
+ }
64
+ };
65
+ }
66
+ getDebugName() {
67
+ return this._debugNameData.getDebugName(this);
68
+ }
69
+ get debugName() {
70
+ const name = this.getDebugName();
71
+ return 'From Event' + (name ? `: ${name}` : '');
72
+ }
73
+ onFirstObserverAdded() {
74
+ this._subscription = this.event(this.handleEvent);
75
+ }
76
+ onLastObserverRemoved() {
77
+ this._subscription.dispose();
78
+ this._subscription = undefined;
79
+ this._hasValue = false;
80
+ this._value = undefined;
81
+ }
82
+ get() {
83
+ if (this._subscription) {
84
+ if (!this._hasValue) {
85
+ this.handleEvent(undefined);
86
+ }
87
+ return this._value;
88
+ }
89
+ else {
90
+ // no cache, as there are no subscribers to keep it updated
91
+ const value = this._getValue(undefined);
92
+ return value;
93
+ }
94
+ }
95
+ debugSetValue(value) {
96
+ this._value = value;
97
+ }
98
+ debugGetState() {
99
+ return { value: this._value, hasValue: this._hasValue };
100
+ }
101
+ }
102
+ (function (observableFromEvent) {
103
+ observableFromEvent.Observer = FromEventObservable;
104
+ function batchEventsGlobally(tx, fn) {
105
+ let didSet = false;
106
+ if (FromEventObservable.globalTransaction === undefined) {
107
+ FromEventObservable.globalTransaction = tx;
108
+ didSet = true;
109
+ }
110
+ try {
111
+ fn();
112
+ }
113
+ finally {
114
+ if (didSet) {
115
+ FromEventObservable.globalTransaction = undefined;
116
+ }
117
+ }
118
+ }
119
+ observableFromEvent.batchEventsGlobally = batchEventsGlobally;
120
+ })(observableFromEvent || (observableFromEvent = {}));
121
+
122
+ export { FromEventObservable, observableFromEvent };
123
+ //# sourceMappingURL=observableFromEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observableFromEvent.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { subtransaction } from '../transaction.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableFromEvent(...args) {\n let owner;\n let event;\n let getValue;\n let debugLocation;\n if (args.length === 2) {\n [event, getValue] = args;\n }\n else {\n [owner, event, getValue, debugLocation] = args;\n }\n return new FromEventObservable(new DebugNameData(owner, undefined, getValue), event, getValue, () => FromEventObservable.globalTransaction, strictEquals, debugLocation ?? DebugLocation.ofCaller());\n}\nfunction observableFromEventOpts(options, event, getValue, debugLocation = DebugLocation.ofCaller()) {\n return new FromEventObservable(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? getValue), event, getValue, () => FromEventObservable.globalTransaction, options.equalsFn ?? strictEquals, debugLocation);\n}\nclass FromEventObservable extends BaseObservable {\n constructor(_debugNameData, event, _getValue, _getTransaction, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this.event = event;\n this._getValue = _getValue;\n this._getTransaction = _getTransaction;\n this._equalityComparator = _equalityComparator;\n this._hasValue = false;\n this.handleEvent = (args) => {\n const newValue = this._getValue(args);\n const oldValue = this._value;\n const didChange = !this._hasValue || !(this._equalityComparator(oldValue, newValue));\n let didRunTransaction = false;\n if (didChange) {\n this._value = newValue;\n if (this._hasValue) {\n didRunTransaction = true;\n subtransaction(this._getTransaction(), (tx) => {\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });\n for (const o of this._observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => {\n const name = this.getDebugName();\n return 'Event fired' + (name ? `: ${name}` : '');\n });\n }\n this._hasValue = true;\n }\n if (!didRunTransaction) {\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });\n }\n };\n }\n getDebugName() {\n return this._debugNameData.getDebugName(this);\n }\n get debugName() {\n const name = this.getDebugName();\n return 'From Event' + (name ? `: ${name}` : '');\n }\n onFirstObserverAdded() {\n this._subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this._subscription.dispose();\n this._subscription = undefined;\n this._hasValue = false;\n this._value = undefined;\n }\n get() {\n if (this._subscription) {\n if (!this._hasValue) {\n this.handleEvent(undefined);\n }\n return this._value;\n }\n else {\n // no cache, as there are no subscribers to keep it updated\n const value = this._getValue(undefined);\n return value;\n }\n }\n debugSetValue(value) {\n this._value = value;\n }\n debugGetState() {\n return { value: this._value, hasValue: this._hasValue };\n }\n}\n(function (observableFromEvent) {\n observableFromEvent.Observer = FromEventObservable;\n function batchEventsGlobally(tx, fn) {\n let didSet = false;\n if (FromEventObservable.globalTransaction === undefined) {\n FromEventObservable.globalTransaction = tx;\n didSet = true;\n }\n try {\n fn();\n }\n finally {\n if (didSet) {\n FromEventObservable.globalTransaction = undefined;\n }\n }\n }\n observableFromEvent.batchEventsGlobally = batchEventsGlobally;\n})(observableFromEvent || (observableFromEvent = {}));\n\nexport { FromEventObservable, observableFromEvent, observableFromEventOpts };\n//# sourceMappingURL=observableFromEvent.js.map\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,GAAG,IAAI,EAAE;AACtC,IAAI,IAAI,KAAK;AACb,IAAI,IAAI,KAAK;AACb,IAAI,I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AmB,CAAC,QAAQ,GAAG,mBAAmB;AACtD,IAAI,SAAS,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE;AACzC,QAAQ,IAAI,MAAM,GAAG,KAAK;AAC1B,QAAQ,IAAI,mBAAmB,CAAC,iBAAiB,KAAK,SAAS,EAAE;AACjE,YAAY,mBAAmB,CAAC,iBAAiB,GAAG,EAAE;AACtD,YAAY,MAAM,GAAG,IAAI;AACzB,QAAQ;AACR,QAAQ,IAAI;AACZ,YAAY,EAAE,EAAE;AAChB,QAAQ;AACR,gBAAgB;AAChB,YAAY,IAAI,MAAM,EAAE;AACxB,gBAAgB,mBAAmB,CAAC,iBAAiB,GAAG,SAAS;AACjE,YAAY;AACZ,QAAQ;AACR,IAAI;AACJ,IAAI,mBAAmB,CAAC,mBAAmB,GAAG,mBAAmB;AACjE,CAAC,EAAE,mBAAmB,KAAK,mBAAmB,GAAG,EAAE,CAAC,CAAC;;;;"}
@@ -0,0 +1,81 @@
1
+ import { TransactionImpl } from '../transaction.js';
2
+ import { BaseObservable } from './baseObservable.js';
3
+ import { strictEquals } from '../commonFacade/deps.js';
4
+ import { DebugNameData } from '../debugName.js';
5
+ import { getLogger } from '../logging/logging.js';
6
+ import { DebugLocation } from '../debugLocation.js';
7
+
8
+ /*---------------------------------------------------------------------------------------------
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License. See License.txt in the project root for license information.
11
+ *--------------------------------------------------------------------------------------------*/
12
+
13
+ /*---------------------------------------------------------------------------------------------
14
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15
+ * Licensed under the MIT License. See License.txt in the project root for license information.
16
+ *--------------------------------------------------------------------------------------------*/
17
+ function observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {
18
+ let debugNameData;
19
+ if (typeof nameOrOwner === 'string') {
20
+ debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);
21
+ }
22
+ else {
23
+ debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);
24
+ }
25
+ return new ObservableValue(debugNameData, initialValue, strictEquals, debugLocation);
26
+ }
27
+ class ObservableValue extends BaseObservable {
28
+ get debugName() {
29
+ return this._debugNameData.getDebugName(this) ?? 'ObservableValue';
30
+ }
31
+ constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {
32
+ super(debugLocation);
33
+ this._debugNameData = _debugNameData;
34
+ this._equalityComparator = _equalityComparator;
35
+ this._value = initialValue;
36
+ getLogger()?.handleObservableUpdated(this, { hadValue: false, newValue: initialValue, change: undefined, didChange: true, oldValue: undefined });
37
+ }
38
+ get() {
39
+ return this._value;
40
+ }
41
+ set(value, tx, change) {
42
+ if (change === undefined && this._equalityComparator(this._value, value)) {
43
+ return;
44
+ }
45
+ let _tx;
46
+ if (!tx) {
47
+ tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);
48
+ }
49
+ try {
50
+ const oldValue = this._value;
51
+ this._setValue(value);
52
+ getLogger()?.handleObservableUpdated(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });
53
+ for (const observer of this._observers) {
54
+ tx.updateObserver(observer, this);
55
+ observer.handleChange(this, change);
56
+ }
57
+ }
58
+ finally {
59
+ if (_tx) {
60
+ _tx.finish();
61
+ }
62
+ }
63
+ }
64
+ toString() {
65
+ return `${this.debugName}: ${this._value}`;
66
+ }
67
+ _setValue(newValue) {
68
+ this._value = newValue;
69
+ }
70
+ debugGetState() {
71
+ return {
72
+ value: this._value,
73
+ };
74
+ }
75
+ debugSetValue(value) {
76
+ this._value = value;
77
+ }
78
+ }
79
+
80
+ export { ObservableValue, observableValue };
81
+ //# sourceMappingURL=observableValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observableValue.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { TransactionImpl } from '../transaction.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new ObservableValue(debugNameData, initialValue, strictEquals, debugLocation);\n}\nclass ObservableValue extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? 'ObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._value = initialValue;\n getLogger()?.handleObservableUpdated(this, { hadValue: false, newValue: initialValue, change: undefined, didChange: true, oldValue: undefined });\n }\n get() {\n return this._value;\n }\n set(value, tx, change) {\n if (change === undefined && this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n const oldValue = this._value;\n this._setValue(value);\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });\n for (const observer of this._observers) {\n tx.updateObserver(observer, this);\n observer.handleChange(this, change);\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n debugGetState() {\n return {\n value: this._value,\n };\n }\n debugSetValue(value) {\n this._value = value;\n }\n}\n/**\n * A disposable observable. When disposed, its value is also disposed.\n * When a new value is set, the previous value is disposed.\n */\nfunction disposableObservableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new DisposableObservableValue(debugNameData, initialValue, strictEquals, debugLocation);\n}\nclass DisposableObservableValue extends ObservableValue {\n _setValue(newValue) {\n if (this._value === newValue) {\n return;\n }\n if (this._value) {\n this._value.dispose();\n }\n this._value = newValue;\n }\n dispose() {\n this._value?.dispose();\n }\n}\n\nexport { DisposableObservableValue, ObservableValue, disposableObservableValue, observableValue };\n//# sourceMappingURL=observableValue.js.map\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,GAAG,aAAa,CAAC,QAAQ,EAAE,EAAE;AAC9F,IAAI,IAAI,aAAa;AACrB,IAAI,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;AACzC,QAAQ,aAAa,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC;AAC5E,IAAI;AACJ,SAAS;AACT,QAAQ,aAAa,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC;AAC5E,IAAI;AACJ,IAAI,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC;AACxF;AACA,MAAM,eAAe,SAAS,cAAc,CAAC;AAC7C,IAAI,IAAI,SAAS,GAAG;AACpB,QAAQ,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,iBAAiB;AAC1E,IAAI;AACJ,IAAI,WAAW,CAAC,cAAc,EAAE,YAAY,EAAE,mBAAmB,EA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D,gBAAgB,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC;AACjD,gBAAgB,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;AACnD,YAAY;AACZ,QAAQ;AACR,gBAAgB;AAChB,YAAY,IAAI,GAAG,EAAE;AACrB,gBAAgB,GAAG,CAAC,MAAM,EAAE;AAC5B,YAAY;AACZ,QAAQ;AACR,IAAI;AACJ,IAAI,QAAQ,GAAG;AACf,QAAQ,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAClD,IAAI;AACJ,IAAI,SAAS,CAAC,QAAQ,EAAE;AACxB,QAAQ,IAAI,CAAC,MAAM,GAAG,QAAQ;AAC9B,IAAI;AACJ,IAAI,aAAa,GAAG;AACpB,QAAQ,OAAO;AACf,YAAY,KAAK,EAAE,IAAI,CAAC,MAAM;AAC9B,SAAS;AACT,IAAI;AACJ,IAAI,aAAa,CAAC,KAAK,EAAE;AACzB,QAAQ,IAAI,CAAC,MAAM,GAAG,KAAK;AAC3B,IAAI;AACJ;;;;"}
@@ -0,0 +1,23 @@
1
+ import { DebugNameData } from '../debugName.js';
2
+ import { AutorunObserver } from './autorunImpl.js';
3
+ import { DebugLocation } from '../debugLocation.js';
4
+
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+
10
+ /*---------------------------------------------------------------------------------------------
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License. See License.txt in the project root for license information.
13
+ *--------------------------------------------------------------------------------------------*/
14
+ /**
15
+ * Runs immediately and whenever a transaction ends and an observed observable changed.
16
+ * {@link fn} should start with a JS Doc using `@description` to name the autorun.
17
+ */
18
+ function autorun(fn, debugLocation = DebugLocation.ofCaller()) {
19
+ return new AutorunObserver(new DebugNameData(undefined, undefined, fn), fn, undefined, debugLocation);
20
+ }
21
+
22
+ export { autorun };
23
+ //# sourceMappingURL=autorun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autorun.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { toDisposable } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { AutorunObserver } from './autorunImpl.js';\nimport { DebugLocation } from '../debugLocation.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nfunction autorun(fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(undefined, undefined, fn), fn, undefined, debugLocation);\n}\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nfunction autorunOpts(options, fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, undefined, debugLocation);\n}\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n *\n * Use `changeTracker.createChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `changeTracker.handleChange` to add a reported change to the change summary.\n * The run function is given the last change summary.\n * The change summary is discarded after the run function was called.\n *\n * @see autorun\n */\nfunction autorunHandleChanges(options, fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, options.changeTracker, debugLocation);\n}\n/**\n * @see autorunHandleChanges (but with a disposable store that is cleared before the next run or on dispose)\n */\nfunction autorunWithStoreHandleChanges(options, fn) {\n const store = new DisposableStore();\n const disposable = autorunHandleChanges({\n owner: options.owner,\n debugName: options.debugName,\n debugReferenceFn: options.debugReferenceFn ?? fn,\n changeTracker: options.changeTracker,\n }, (reader, changeSummary) => {\n store.clear();\n fn(reader, changeSummary, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\n/**\n * @see autorun (but with a disposable store that is cleared before the next run or on dispose)\n *\n * @deprecated Use `autorun(reader => { reader.store.add(...) })` instead!\n */\nfunction autorunWithStore(fn) {\n const store = new DisposableStore();\n const disposable = autorunOpts({\n owner: undefined,\n debugName: undefined,\n debugReferenceFn: fn,\n }, reader => {\n store.clear();\n fn(reader, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\nfunction autorunDelta(observable, handler) {\n let _lastValue;\n return autorunOpts({ debugReferenceFn: handler }, (reader) => {\n const newValue = observable.read(reader);\n const lastValue = _lastValue;\n _lastValue = newValue;\n handler({ lastValue, newValue });\n });\n}\nfunction autorunIterableDelta(getValue, handler, getUniqueIdentifier = v => v) {\n const lastValues = new Map();\n return autorunOpts({ debugReferenceFn: getValue }, (reader) => {\n const newValues = new Map();\n const removedValues = new Map(lastValues);\n for (const value of getValue(reader)) {\n const id = getUniqueIdentifier(value);\n if (lastValues.has(id)) {\n removedValues.delete(id);\n }\n else {\n newValues.set(id, value);\n lastValues.set(id, value);\n }\n }\n for (const id of removedValues.keys()) {\n lastValues.delete(id);\n }\n if (newValues.size || removedValues.size) {\n handler({ addedValues: [...newValues.values()], removedValues: [...removedValues.values()] });\n }\n });\n}\n/**\n * An autorun with a `dispose()` method on its `reader` which cancels the autorun.\n * It it safe to call `dispose()` synchronously.\n */\nfunction autorunSelfDisposable(fn, debugLocation = DebugLocation.ofCaller()) {\n let ar;\n let disposed = false;\n // eslint-disable-next-line prefer-const\n ar = autorun(reader => {\n fn({\n delayedStore: reader.delayedStore,\n store: reader.store,\n readObservable: reader.readObservable.bind(reader),\n dispose: () => {\n ar?.dispose();\n disposed = true;\n }\n });\n }, debugLocation);\n if (disposed) {\n ar.dispose();\n }\n return ar;\n}\n\nexport { autorun, autorunDelta, autorunHandleChanges, autorunIterableDelta, autorunOpts, autorunSelfDisposable, autorunWithStore, autorunWithStoreHandleChanges };\n//# sourceMappingURL=autorun.js.map\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,EAAE,EAAE,aAAa,GAAG,aAAa,CAAC,QAAQ,EAAE,EAAE;AAC/D,IAAI,OAAO,IAAI,eAAe,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC;AACzG;;;;"}
@@ -0,0 +1,226 @@
1
+ import { onBugIndicatingError, BugIndicatingError } from '../commonFacade/deps.js';
2
+ import { getLogger } from '../logging/logging.js';
3
+ import { DisposableStore } from '../../disposables.js';
4
+
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+
10
+ /*---------------------------------------------------------------------------------------------
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License. See License.txt in the project root for license information.
13
+ *--------------------------------------------------------------------------------------------*/
14
+ function autorunStateToString(state) {
15
+ switch (state) {
16
+ case 1 /* AutorunState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';
17
+ case 2 /* AutorunState.stale */: return 'stale';
18
+ case 3 /* AutorunState.upToDate */: return 'upToDate';
19
+ default: return '<unknown>';
20
+ }
21
+ }
22
+ class AutorunObserver {
23
+ get debugName() {
24
+ return this._debugNameData.getDebugName(this) ?? '(anonymous)';
25
+ }
26
+ constructor(_debugNameData, _runFn, _changeTracker, debugLocation) {
27
+ this._debugNameData = _debugNameData;
28
+ this._runFn = _runFn;
29
+ this._changeTracker = _changeTracker;
30
+ this._state = 2 /* AutorunState.stale */;
31
+ this._updateCount = 0;
32
+ this._disposed = false;
33
+ this._dependencies = new Set();
34
+ this._dependenciesToBeRemoved = new Set();
35
+ this._isRunning = false;
36
+ this._store = undefined;
37
+ this._delayedStore = undefined;
38
+ this._changeSummary = this._changeTracker?.createChangeSummary(undefined);
39
+ getLogger()?.handleAutorunCreated(this, debugLocation);
40
+ this._run();
41
+ }
42
+ dispose() {
43
+ if (this._disposed) {
44
+ return;
45
+ }
46
+ this._disposed = true;
47
+ for (const o of this._dependencies) {
48
+ o.removeObserver(this); // Warning: external call!
49
+ }
50
+ this._dependencies.clear();
51
+ if (this._store !== undefined) {
52
+ this._store.dispose();
53
+ }
54
+ if (this._delayedStore !== undefined) {
55
+ this._delayedStore.dispose();
56
+ }
57
+ getLogger()?.handleAutorunDisposed(this);
58
+ }
59
+ _run() {
60
+ const emptySet = this._dependenciesToBeRemoved;
61
+ this._dependenciesToBeRemoved = this._dependencies;
62
+ this._dependencies = emptySet;
63
+ this._state = 3 /* AutorunState.upToDate */;
64
+ try {
65
+ if (!this._disposed) {
66
+ getLogger()?.handleAutorunStarted(this);
67
+ const changeSummary = this._changeSummary;
68
+ const delayedStore = this._delayedStore;
69
+ if (delayedStore !== undefined) {
70
+ this._delayedStore = undefined;
71
+ }
72
+ try {
73
+ this._isRunning = true;
74
+ if (this._changeTracker) {
75
+ this._changeTracker.beforeUpdate?.(this, changeSummary);
76
+ this._changeSummary = this._changeTracker.createChangeSummary(changeSummary); // Warning: external call!
77
+ }
78
+ if (this._store !== undefined) {
79
+ this._store.dispose();
80
+ this._store = undefined;
81
+ }
82
+ this._runFn(this, changeSummary); // Warning: external call!
83
+ }
84
+ catch (e) {
85
+ onBugIndicatingError(e);
86
+ }
87
+ finally {
88
+ this._isRunning = false;
89
+ if (delayedStore !== undefined) {
90
+ delayedStore.dispose();
91
+ }
92
+ }
93
+ }
94
+ }
95
+ finally {
96
+ if (!this._disposed) {
97
+ getLogger()?.handleAutorunFinished(this);
98
+ }
99
+ // We don't want our observed observables to think that they are (not even temporarily) not being observed.
100
+ // Thus, we only unsubscribe from observables that are definitely not read anymore.
101
+ for (const o of this._dependenciesToBeRemoved) {
102
+ o.removeObserver(this); // Warning: external call!
103
+ }
104
+ this._dependenciesToBeRemoved.clear();
105
+ }
106
+ }
107
+ toString() {
108
+ return `Autorun<${this.debugName}>`;
109
+ }
110
+ // IObserver implementation
111
+ beginUpdate(_observable) {
112
+ if (this._state === 3 /* AutorunState.upToDate */) {
113
+ this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;
114
+ }
115
+ this._updateCount++;
116
+ }
117
+ endUpdate(_observable) {
118
+ try {
119
+ if (this._updateCount === 1) {
120
+ do {
121
+ if (this._state === 1 /* AutorunState.dependenciesMightHaveChanged */) {
122
+ this._state = 3 /* AutorunState.upToDate */;
123
+ for (const d of this._dependencies) {
124
+ d.reportChanges(); // Warning: external call!
125
+ if (this._state === 2 /* AutorunState.stale */) {
126
+ // The other dependencies will refresh on demand
127
+ break;
128
+ }
129
+ }
130
+ }
131
+ if (this._state !== 3 /* AutorunState.upToDate */) {
132
+ this._run(); // Warning: indirect external call!
133
+ }
134
+ } while (this._state !== 3 /* AutorunState.upToDate */);
135
+ }
136
+ }
137
+ finally {
138
+ this._updateCount--;
139
+ }
140
+ }
141
+ handlePossibleChange(observable) {
142
+ if (this._state === 3 /* AutorunState.upToDate */ && this._isDependency(observable)) {
143
+ this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;
144
+ }
145
+ }
146
+ handleChange(observable, change) {
147
+ if (this._isDependency(observable)) {
148
+ getLogger()?.handleAutorunDependencyChanged(this, observable, change);
149
+ try {
150
+ // Warning: external call!
151
+ const shouldReact = this._changeTracker ? this._changeTracker.handleChange({
152
+ changedObservable: observable,
153
+ change,
154
+ didChange: (o) => o === observable,
155
+ }, this._changeSummary) : true;
156
+ if (shouldReact) {
157
+ this._state = 2 /* AutorunState.stale */;
158
+ }
159
+ }
160
+ catch (e) {
161
+ onBugIndicatingError(e);
162
+ }
163
+ }
164
+ }
165
+ _isDependency(observable) {
166
+ return this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable);
167
+ }
168
+ // IReader implementation
169
+ _ensureNoRunning() {
170
+ if (!this._isRunning) {
171
+ throw new BugIndicatingError('The reader object cannot be used outside its compute function!');
172
+ }
173
+ }
174
+ readObservable(observable) {
175
+ this._ensureNoRunning();
176
+ // In case the run action disposes the autorun
177
+ if (this._disposed) {
178
+ return observable.get(); // warning: external call!
179
+ }
180
+ observable.addObserver(this); // warning: external call!
181
+ const value = observable.get(); // warning: external call!
182
+ this._dependencies.add(observable);
183
+ this._dependenciesToBeRemoved.delete(observable);
184
+ return value;
185
+ }
186
+ get store() {
187
+ this._ensureNoRunning();
188
+ if (this._disposed) {
189
+ throw new BugIndicatingError('Cannot access store after dispose');
190
+ }
191
+ if (this._store === undefined) {
192
+ this._store = new DisposableStore();
193
+ }
194
+ return this._store;
195
+ }
196
+ get delayedStore() {
197
+ this._ensureNoRunning();
198
+ if (this._disposed) {
199
+ throw new BugIndicatingError('Cannot access store after dispose');
200
+ }
201
+ if (this._delayedStore === undefined) {
202
+ this._delayedStore = new DisposableStore();
203
+ }
204
+ return this._delayedStore;
205
+ }
206
+ debugGetState() {
207
+ return {
208
+ isRunning: this._isRunning,
209
+ updateCount: this._updateCount,
210
+ dependencies: this._dependencies,
211
+ state: this._state,
212
+ stateStr: autorunStateToString(this._state),
213
+ };
214
+ }
215
+ debugRerun() {
216
+ if (!this._isRunning) {
217
+ this._run();
218
+ }
219
+ else {
220
+ this._state = 2 /* AutorunState.stale */;
221
+ }
222
+ }
223
+ }
224
+
225
+ export { AutorunObserver };
226
+ //# sourceMappingURL=autorunImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autorunImpl.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { onBugIndicatingError, BugIndicatingError } from '../commonFacade/deps.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction autorunStateToString(state) {\n switch (state) {\n case 1 /* AutorunState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* AutorunState.stale */: return 'stale';\n case 3 /* AutorunState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass AutorunObserver {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _runFn, _changeTracker, debugLocation) {\n this._debugNameData = _debugNameData;\n this._runFn = _runFn;\n this._changeTracker = _changeTracker;\n this._state = 2 /* AutorunState.stale */;\n this._updateCount = 0;\n this._disposed = false;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._isRunning = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n getLogger()?.handleAutorunCreated(this, debugLocation);\n this._run();\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n for (const o of this._dependencies) {\n o.removeObserver(this); // Warning: external call!\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n }\n getLogger()?.handleAutorunDisposed(this);\n }\n _run() {\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n this._state = 3 /* AutorunState.upToDate */;\n try {\n if (!this._disposed) {\n getLogger()?.handleAutorunStarted(this);\n const changeSummary = this._changeSummary;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n this._isRunning = true;\n if (this._changeTracker) {\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._changeSummary = this._changeTracker.createChangeSummary(changeSummary); // Warning: external call!\n }\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n this._runFn(this, changeSummary); // Warning: external call!\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n finally {\n this._isRunning = false;\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n }\n }\n finally {\n if (!this._disposed) {\n getLogger()?.handleAutorunFinished(this);\n }\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this._dependenciesToBeRemoved) {\n o.removeObserver(this); // Warning: external call!\n }\n this._dependenciesToBeRemoved.clear();\n }\n }\n toString() {\n return `Autorun<${this.debugName}>`;\n }\n // IObserver implementation\n beginUpdate(_observable) {\n if (this._state === 3 /* AutorunState.upToDate */) {\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n this._updateCount++;\n }\n endUpdate(_observable) {\n try {\n if (this._updateCount === 1) {\n do {\n if (this._state === 1 /* AutorunState.dependenciesMightHaveChanged */) {\n this._state = 3 /* AutorunState.upToDate */;\n for (const d of this._dependencies) {\n d.reportChanges(); // Warning: external call!\n if (this._state === 2 /* AutorunState.stale */) {\n // The other dependencies will refresh on demand\n break;\n }\n }\n }\n if (this._state !== 3 /* AutorunState.upToDate */) {\n this._run(); // Warning: indirect external call!\n }\n } while (this._state !== 3 /* AutorunState.upToDate */);\n }\n }\n finally {\n this._updateCount--;\n }\n }\n handlePossibleChange(observable) {\n if (this._state === 3 /* AutorunState.upToDate */ && this._isDependency(observable)) {\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n }\n handleChange(observable, change) {\n if (this._isDependency(observable)) {\n getLogger()?.handleAutorunDependencyChanged(this, observable, change);\n try {\n // Warning: external call!\n const shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n if (shouldReact) {\n this._state = 2 /* AutorunState.stale */;\n }\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n }\n }\n _isDependency(observable) {\n return this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable);\n }\n // IReader implementation\n _ensureNoRunning() {\n if (!this._isRunning) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureNoRunning();\n // In case the run action disposes the autorun\n if (this._disposed) {\n return observable.get(); // warning: external call!\n }\n observable.addObserver(this); // warning: external call!\n const value = observable.get(); // warning: external call!\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n get store() {\n this._ensureNoRunning();\n if (this._disposed) {\n throw new BugIndicatingError('Cannot access store after dispose');\n }\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureNoRunning();\n if (this._disposed) {\n throw new BugIndicatingError('Cannot access store after dispose');\n }\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n debugGetState() {\n return {\n isRunning: this._isRunning,\n updateCount: this._updateCount,\n dependencies: this._dependencies,\n state: this._state,\n stateStr: autorunStateToString(this._state),\n };\n }\n debugRerun() {\n if (!this._isRunning) {\n this._run();\n }\n else {\n this._state = 2 /* AutorunState.stale */;\n }\n }\n}\n\nexport { AutorunObserver };\n//# sourceMappingURL=autorunImpl.js.map\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,S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9B,YAAY,IAAI,CAAC,IAAI,EAAE;AACvB,QAAQ;AACR,aAAa;AACb,YAAY,IAAI,CAAC,MAAM,GAAG,CAAC;AAC3B,QAAQ;AACR,IAAI;AACJ;;;;"}
@@ -0,0 +1,87 @@
1
+ import { handleBugIndicatingErrorRecovery } from './base.js';
2
+ import { getFunctionName } from './debugName.js';
3
+ import { getLogger } from './logging/logging.js';
4
+
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+
10
+ /*---------------------------------------------------------------------------------------------
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License. See License.txt in the project root for license information.
13
+ *--------------------------------------------------------------------------------------------*/
14
+ /**
15
+ * Starts a transaction in which many observables can be changed at once.
16
+ * {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name.
17
+ * Reaction run on demand or when the transaction ends.
18
+ */
19
+ function transaction(fn, getDebugName) {
20
+ const tx = new TransactionImpl(fn, getDebugName);
21
+ try {
22
+ fn(tx);
23
+ }
24
+ finally {
25
+ tx.finish();
26
+ }
27
+ }
28
+ /**
29
+ * Allows to chain transactions.
30
+ */
31
+ function subtransaction(tx, fn, getDebugName) {
32
+ if (!tx) {
33
+ transaction(fn, getDebugName);
34
+ }
35
+ else {
36
+ fn(tx);
37
+ }
38
+ }
39
+ class TransactionImpl {
40
+ constructor(_fn, _getDebugName) {
41
+ this._fn = _fn;
42
+ this._getDebugName = _getDebugName;
43
+ this._updatingObservers = [];
44
+ getLogger()?.handleBeginTransaction(this);
45
+ }
46
+ getDebugName() {
47
+ if (this._getDebugName) {
48
+ return this._getDebugName();
49
+ }
50
+ return getFunctionName(this._fn);
51
+ }
52
+ updateObserver(observer, observable) {
53
+ if (!this._updatingObservers) {
54
+ // This happens when a transaction is used in a callback or async function.
55
+ // If an async transaction is used, make sure the promise awaits all users of the transaction (e.g. no race).
56
+ handleBugIndicatingErrorRecovery('Transaction already finished!');
57
+ // Error recovery
58
+ transaction(tx => {
59
+ tx.updateObserver(observer, observable);
60
+ });
61
+ return;
62
+ }
63
+ // When this gets called while finish is active, they will still get considered
64
+ this._updatingObservers.push({ observer, observable });
65
+ observer.beginUpdate(observable);
66
+ }
67
+ finish() {
68
+ const updatingObservers = this._updatingObservers;
69
+ if (!updatingObservers) {
70
+ handleBugIndicatingErrorRecovery('transaction.finish() has already been called!');
71
+ return;
72
+ }
73
+ for (let i = 0; i < updatingObservers.length; i++) {
74
+ const { observer, observable } = updatingObservers[i];
75
+ observer.endUpdate(observable);
76
+ }
77
+ // Prevent anyone from updating observers from now on.
78
+ this._updatingObservers = null;
79
+ getLogger()?.handleEndTransaction(this);
80
+ }
81
+ debugGetUpdatingObservers() {
82
+ return this._updatingObservers;
83
+ }
84
+ }
85
+
86
+ export { TransactionImpl, subtransaction, transaction };
87
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sources":["../../../../../../../../external/vscode-observables/observables/dist/observableInternal/transaction.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { handleBugIndicatingErrorRecovery } from './base.js';\nimport { getFunctionName } from './debugName.js';\nimport { getLogger } from './logging/logging.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Starts a transaction in which many observables can be changed at once.\n * {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name.\n * Reaction run on demand or when the transaction ends.\n */\nfunction transaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n fn(tx);\n }\n finally {\n tx.finish();\n }\n}\nlet _globalTransaction = undefined;\nfunction globalTransaction(fn) {\n if (_globalTransaction) {\n fn(_globalTransaction);\n }\n else {\n const tx = new TransactionImpl(fn, undefined);\n _globalTransaction = tx;\n try {\n fn(tx);\n }\n finally {\n tx.finish(); // During finish, more actions might be added to the transaction.\n // Which is why we only clear the global transaction after finish.\n _globalTransaction = undefined;\n }\n }\n}\n/** @deprecated */\nasync function asyncTransaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n await fn(tx);\n }\n finally {\n tx.finish();\n }\n}\n/**\n * Allows to chain transactions.\n */\nfunction subtransaction(tx, fn, getDebugName) {\n if (!tx) {\n transaction(fn, getDebugName);\n }\n else {\n fn(tx);\n }\n}\nclass TransactionImpl {\n constructor(_fn, _getDebugName) {\n this._fn = _fn;\n this._getDebugName = _getDebugName;\n this._updatingObservers = [];\n getLogger()?.handleBeginTransaction(this);\n }\n getDebugName() {\n if (this._getDebugName) {\n return this._getDebugName();\n }\n return getFunctionName(this._fn);\n }\n updateObserver(observer, observable) {\n if (!this._updatingObservers) {\n // This happens when a transaction is used in a callback or async function.\n // If an async transaction is used, make sure the promise awaits all users of the transaction (e.g. no race).\n handleBugIndicatingErrorRecovery('Transaction already finished!');\n // Error recovery\n transaction(tx => {\n tx.updateObserver(observer, observable);\n });\n return;\n }\n // When this gets called while finish is active, they will still get considered\n this._updatingObservers.push({ observer, observable });\n observer.beginUpdate(observable);\n }\n finish() {\n const updatingObservers = this._updatingObservers;\n if (!updatingObservers) {\n handleBugIndicatingErrorRecovery('transaction.finish() has already been called!');\n return;\n }\n for (let i = 0; i < updatingObservers.length; i++) {\n const { observer, observable } = updatingObservers[i];\n observer.endUpdate(observable);\n }\n // Prevent anyone from updating observers from now on.\n this._updatingObservers = null;\n getLogger()?.handleEndTransaction(this);\n }\n debugGetUpdatingObservers() {\n return this._updatingObservers;\n }\n}\n\nexport { TransactionImpl, asyncTransaction, globalTransaction, subtransaction, transaction };\n//# sourceMappingURL=transaction.js.map\n"],"names":[],"mappings":";;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