@vscode/component-explorer-cli 0.1.1-0 → 0.1.1-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browserPage.js +4 -2
- package/dist/browserPage.js.map +1 -1
- package/dist/commands/acceptCommand.d.ts +1 -0
- package/dist/commands/acceptCommand.d.ts.map +1 -1
- package/dist/commands/acceptCommand.js +8 -2
- package/dist/commands/acceptCommand.js.map +1 -1
- package/dist/commands/compareCommand.d.ts +1 -0
- package/dist/commands/compareCommand.d.ts.map +1 -1
- package/dist/commands/compareCommand.js +8 -2
- package/dist/commands/compareCommand.js.map +1 -1
- package/dist/commands/mcpCommand.d.ts +8 -0
- package/dist/commands/mcpCommand.d.ts.map +1 -0
- package/dist/commands/mcpCommand.js +24 -0
- package/dist/commands/mcpCommand.js.map +1 -0
- package/dist/commands/screenshotCommand.d.ts +1 -0
- package/dist/commands/screenshotCommand.d.ts.map +1 -1
- package/dist/commands/screenshotCommand.js +10 -4
- package/dist/commands/screenshotCommand.js.map +1 -1
- package/dist/commands/serveCommand.d.ts +16 -0
- package/dist/commands/serveCommand.d.ts.map +1 -0
- package/dist/commands/serveCommand.js +137 -0
- package/dist/commands/serveCommand.js.map +1 -0
- package/dist/commands/watchCommand.d.ts +1 -0
- package/dist/commands/watchCommand.d.ts.map +1 -1
- package/dist/commands/watchCommand.js +22 -10
- package/dist/commands/watchCommand.js.map +1 -1
- package/dist/componentExplorer.js +5 -2
- package/dist/componentExplorer.js.map +1 -1
- package/dist/daemon/DaemonService.d.ts +131 -0
- package/dist/daemon/DaemonService.d.ts.map +1 -0
- package/dist/daemon/DaemonService.js +450 -0
- package/dist/daemon/DaemonService.js.map +1 -0
- package/dist/daemon/approvalStore.d.ts +51 -0
- package/dist/daemon/approvalStore.d.ts.map +1 -0
- package/dist/daemon/approvalStore.js +58 -0
- package/dist/daemon/approvalStore.js.map +1 -0
- package/dist/daemon/lifecycle.d.ts +8 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -0
- package/dist/daemon/lifecycle.js +51 -0
- package/dist/daemon/lifecycle.js.map +1 -0
- package/dist/daemon/pipeClient.d.ts +4 -0
- package/dist/daemon/pipeClient.d.ts.map +1 -0
- package/dist/daemon/pipeClient.js +97 -0
- package/dist/daemon/pipeClient.js.map +1 -0
- package/dist/daemon/pipeName.d.ts +2 -0
- package/dist/daemon/pipeName.d.ts.map +1 -0
- package/dist/daemon/pipeName.js +14 -0
- package/dist/daemon/pipeName.js.map +1 -0
- package/dist/daemon/pipeServer.d.ts +4 -0
- package/dist/daemon/pipeServer.d.ts.map +1 -0
- package/dist/daemon/pipeServer.js +23 -0
- package/dist/daemon/pipeServer.js.map +1 -0
- package/dist/dependencyInstaller.js +7 -4
- package/dist/dependencyInstaller.js.map +1 -1
- package/dist/explorerSession.d.ts +5 -3
- package/dist/explorerSession.d.ts.map +1 -1
- package/dist/explorerSession.js +11 -5
- package/dist/explorerSession.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/disposables.js +43 -0
- package/dist/external/vscode-observables/observables/dist/disposables.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/base.js +22 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/base.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js +40 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js +77 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js +114 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js +25 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js +332 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js +79 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js +72 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/devToolsLogger.js +447 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/devToolsLogger.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/rpc.js +64 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/rpc.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/utils.js +52 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/utils.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js +100 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js +143 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js +17 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js +362 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js +123 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js +81 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js +23 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js +226 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js +87 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js.map +1 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js +68 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js.map +1 -0
- package/dist/git/gitCommitId.js +4 -2
- package/dist/git/gitCommitId.js.map +1 -1
- package/dist/git/gitCommitResolver.js +11 -3
- package/dist/git/gitCommitResolver.js.map +1 -1
- package/dist/git/gitService.js +5 -2
- package/dist/git/gitService.js.map +1 -1
- package/dist/git/gitUtils.js +9 -6
- package/dist/git/gitUtils.js.map +1 -1
- package/dist/git/gitWorktreeManager.js +5 -2
- package/dist/git/gitWorktreeManager.js.map +1 -1
- package/dist/httpServer.d.ts +9 -7
- package/dist/httpServer.d.ts.map +1 -1
- package/dist/httpServer.js +67 -10
- package/dist/httpServer.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +17 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +43 -6
- package/dist/logger.js.map +1 -1
- package/dist/mcp/McpServer.d.ts +28 -0
- package/dist/mcp/McpServer.d.ts.map +1 -0
- package/dist/mcp/McpServer.js +386 -0
- package/dist/mcp/McpServer.js.map +1 -0
- package/dist/screenshotCache.js +7 -4
- package/dist/screenshotCache.js.map +1 -1
- package/dist/sourceTreeId.js +4 -2
- package/dist/sourceTreeId.js.map +1 -1
- package/dist/storage.js +5 -2
- package/dist/storage.js.map +1 -1
- package/dist/viteProjectRef.js +5 -2
- package/dist/viteProjectRef.js.map +1 -1
- package/dist/watchConfig.d.ts +5 -0
- package/dist/watchConfig.d.ts.map +1 -1
- package/dist/watchConfig.js +22 -7
- package/dist/watchConfig.js.map +1 -1
- package/package.json +11 -4
package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js
ADDED
|
@@ -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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J,IAAI,UAAU,GAAG;AACjB,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AAC9B,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
|
package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js.map
ADDED
|
@@ -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":";;;;AAAA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,WAAW,CAAC,EAAE,EAAE,YAAY,EAAE;AACvC,IAAI,MAAM,EAAE,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,YAAY,CAAC;AACpD,IAAI,IAAI;AACR,QAAQ,EAAE,CAAC,EAAE,CAAC;AACd,IAAI;AACJ,YAAY;AACZ,QAAQ,EAAE,CAAC,MAAM,EAAE;AACnB,IAAI;AACJ;AA6BA;AACA;AACA;AACA,SAAS,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE;AAC9C,IAAI,IAAI,CAAC,EAAE,EAAE;AACb,QAAQ,WAAW,CAAC,E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I,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC3D,YAAY,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC;AACjE,YAAY,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC;AAC1C,QAAQ;AACR;AACA,QAAQ,IAAI,CAAC,kBAAkB,GAAG,IAAI;AACtC,QAAQ,SAAS,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC;AAC/C,IAAI;AACJ,IAAI,yBAAyB,GAAG;AAChC,QAAQ,OAAO,IAAI,CAAC,kBAAkB;AACtC,IAAI;AACJ;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { toDisposable } from '../commonFacade/deps.js';
|
|
2
|
+
import '../debugLocation.js';
|
|
3
|
+
import { _setKeepObserved, _setRecomputeInitiallyAndOnChange } from '../observables/baseObservable.js';
|
|
4
|
+
import '../observables/derived.js';
|
|
5
|
+
import '../observables/observableFromEvent.js';
|
|
6
|
+
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
/**
|
|
12
|
+
* This makes sure the observable is being observed and keeps its cache alive.
|
|
13
|
+
*/
|
|
14
|
+
function keepObserved(observable) {
|
|
15
|
+
const o = new KeepAliveObserver(false, undefined);
|
|
16
|
+
observable.addObserver(o);
|
|
17
|
+
return toDisposable(() => {
|
|
18
|
+
observable.removeObserver(o);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
_setKeepObserved(keepObserved);
|
|
22
|
+
/**
|
|
23
|
+
* This converts the given observable into an autorun.
|
|
24
|
+
*/
|
|
25
|
+
function recomputeInitiallyAndOnChange(observable, handleValue) {
|
|
26
|
+
const o = new KeepAliveObserver(true, handleValue);
|
|
27
|
+
observable.addObserver(o);
|
|
28
|
+
try {
|
|
29
|
+
o.beginUpdate(observable);
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
o.endUpdate(observable);
|
|
33
|
+
}
|
|
34
|
+
return toDisposable(() => {
|
|
35
|
+
observable.removeObserver(o);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);
|
|
39
|
+
class KeepAliveObserver {
|
|
40
|
+
constructor(_forceRecompute, _handleValue) {
|
|
41
|
+
this._forceRecompute = _forceRecompute;
|
|
42
|
+
this._handleValue = _handleValue;
|
|
43
|
+
this._counter = 0;
|
|
44
|
+
}
|
|
45
|
+
beginUpdate(observable) {
|
|
46
|
+
this._counter++;
|
|
47
|
+
}
|
|
48
|
+
endUpdate(observable) {
|
|
49
|
+
if (this._counter === 1 && this._forceRecompute) {
|
|
50
|
+
if (this._handleValue) {
|
|
51
|
+
this._handleValue(observable.get());
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
observable.reportChanges();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
this._counter--;
|
|
58
|
+
}
|
|
59
|
+
handlePossibleChange(observable) {
|
|
60
|
+
// NO OP
|
|
61
|
+
}
|
|
62
|
+
handleChange(observable, change) {
|
|
63
|
+
// NO OP
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { KeepAliveObserver, keepObserved, recomputeInitiallyAndOnChange };
|
|
68
|
+
//# sourceMappingURL=utils.js.map
|
package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/utils/utils.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 { autorun } from '../reactions/autorun.js';\nimport { transaction } from '../transaction.js';\nimport { observableValue } from '../observables/observableValue.js';\nimport { toDisposable } from '../commonFacade/deps.js';\nimport { derivedOpts, derived } from '../observables/derived.js';\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { observableSignal } from '../observables/observableSignal.js';\nimport { _setKeepObserved, _setRecomputeInitiallyAndOnChange } from '../observables/baseObservable.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 observableFromPromise(promise) {\n const observable = observableValue('promiseValue', {});\n promise.then((value) => {\n observable.set({ value }, undefined);\n });\n return observable;\n}\nfunction signalFromObservable(owner, observable) {\n return derivedOpts({\n owner,\n equalsFn: () => false,\n }, reader => {\n observable.read(reader);\n });\n}\n/**\n * @deprecated Use `debouncedObservable` instead.\n */\nfunction debouncedObservableDeprecated(observable, debounceMs, disposableStore) {\n const debouncedObservable = observableValue('debounced', undefined);\n let timeout = undefined;\n disposableStore.add(autorun(reader => {\n /** @description debounce */\n const value = observable.read(reader);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n transaction(tx => {\n debouncedObservable.set(value, tx);\n });\n }, debounceMs);\n }));\n return debouncedObservable;\n}\n/**\n * Creates an observable that debounces the input observable.\n */\nfunction debouncedObservable(observable, debounceMs) {\n let hasValue = false;\n let lastValue;\n let timeout = undefined;\n return observableFromEvent(cb => {\n const d = autorun(reader => {\n const value = observable.read(reader);\n if (!hasValue) {\n hasValue = true;\n lastValue = value;\n }\n else {\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n lastValue = value;\n cb();\n }, debounceMs);\n }\n });\n return {\n dispose() {\n d.dispose();\n hasValue = false;\n lastValue = undefined;\n },\n };\n }, () => {\n if (hasValue) {\n return lastValue;\n }\n else {\n return observable.get();\n }\n });\n}\nfunction wasEventTriggeredRecently(event, timeoutMs, disposableStore) {\n const observable = observableValue('triggeredRecently', false);\n let timeout = undefined;\n disposableStore.add(event(() => {\n observable.set(true, undefined);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n observable.set(false, undefined);\n }, timeoutMs);\n }));\n return observable;\n}\n/**\n * This makes sure the observable is being observed and keeps its cache alive.\n */\nfunction keepObserved(observable) {\n const o = new KeepAliveObserver(false, undefined);\n observable.addObserver(o);\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setKeepObserved(keepObserved);\n/**\n * This converts the given observable into an autorun.\n */\nfunction recomputeInitiallyAndOnChange(observable, handleValue) {\n const o = new KeepAliveObserver(true, handleValue);\n observable.addObserver(o);\n try {\n o.beginUpdate(observable);\n }\n finally {\n o.endUpdate(observable);\n }\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);\nclass KeepAliveObserver {\n constructor(_forceRecompute, _handleValue) {\n this._forceRecompute = _forceRecompute;\n this._handleValue = _handleValue;\n this._counter = 0;\n }\n beginUpdate(observable) {\n this._counter++;\n }\n endUpdate(observable) {\n if (this._counter === 1 && this._forceRecompute) {\n if (this._handleValue) {\n this._handleValue(observable.get());\n }\n else {\n observable.reportChanges();\n }\n }\n this._counter--;\n }\n handlePossibleChange(observable) {\n // NO OP\n }\n handleChange(observable, change) {\n // NO OP\n }\n}\nfunction derivedObservableWithCache(owner, computeFn) {\n let lastValue = undefined;\n const observable = derivedOpts({ owner, debugReferenceFn: computeFn }, reader => {\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return observable;\n}\nfunction derivedObservableWithWritableCache(owner, computeFn) {\n let lastValue = undefined;\n const onChange = observableSignal('derivedObservableWithWritableCache');\n const observable = derived(owner, reader => {\n onChange.read(reader);\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return Object.assign(observable, {\n clearCache: (tx) => {\n lastValue = undefined;\n onChange.trigger(tx);\n },\n setCache: (newValue, tx) => {\n lastValue = newValue;\n onChange.trigger(tx);\n }\n });\n}\n/**\n * When the items array changes, referential equal items are not mapped again.\n */\nfunction mapObservableArrayCached(owner, items, map, keySelector) {\n let m = new ArrayMap(map, keySelector);\n const self = derivedOpts({\n debugReferenceFn: map,\n owner,\n onLastObserverRemoved: () => {\n m.dispose();\n m = new ArrayMap(map);\n }\n }, (reader) => {\n m.setItems(items.read(reader));\n return m.getItems();\n });\n return self;\n}\nclass ArrayMap {\n constructor(_map, _keySelector) {\n this._map = _map;\n this._keySelector = _keySelector;\n this._cache = new Map();\n this._items = [];\n }\n dispose() {\n this._cache.forEach(entry => entry.store.dispose());\n this._cache.clear();\n }\n setItems(items) {\n const newItems = [];\n const itemsToRemove = new Set(this._cache.keys());\n for (const item of items) {\n const key = this._keySelector ? this._keySelector(item) : item;\n let entry = this._cache.get(key);\n if (!entry) {\n const store = new DisposableStore();\n const out = this._map(item, store);\n entry = { out, store };\n this._cache.set(key, entry);\n }\n else {\n itemsToRemove.delete(key);\n }\n newItems.push(entry.out);\n }\n for (const item of itemsToRemove) {\n const entry = this._cache.get(item);\n entry.store.dispose();\n this._cache.delete(item);\n }\n this._items = newItems;\n }\n getItems() {\n return this._items;\n }\n}\n\nexport { KeepAliveObserver, debouncedObservable, debouncedObservableDeprecated, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently };\n//# sourceMappingURL=utils.js.map\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAwGA;AACA;AACA;AACA,SAAS,YAAY,CAAC,UAAU,EAAE;AAClC,IAAI,MAAM,CAAC,GAAG,IAAI,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC;AACrD,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AAC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EAAE;AAC1C,YAAY;AACZ,QAAQ;AACR,QAAQ,IAAI,CAAC,QAAQ,EAAE;AACvB,IAAI;AACJ,IAAI,oBAAoB,CAAC,UAAU,EAAE;AACrC;AACA,IAAI;AACJ,IAAI,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE;AACrC;AACA,IAAI;AACJ;;;;"}
|
package/dist/git/gitCommitId.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
class GitCommitId {
|
|
2
2
|
hash;
|
|
3
3
|
constructor(hash) {
|
|
4
4
|
this.hash = hash;
|
|
@@ -13,4 +13,6 @@ export class GitCommitId {
|
|
|
13
13
|
return this.hash;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
export { GitCommitId };
|
|
18
|
+
//# sourceMappingURL=gitCommitId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitCommitId.js","
|
|
1
|
+
{"version":3,"file":"gitCommitId.js","sources":["../../src/git/gitCommitId.ts"],"sourcesContent":[null],"names":[],"mappings":"MAAa,WAAW,CAAA;AACF,IAAA,IAAA;AAArB,IAAA,WAAA,CAAqB,IAAY,EAAA;QAAZ,IAAA,CAAA,IAAI,GAAJ,IAAI;IAAW;AAEpC,IAAA,MAAM,CAAC,KAAkB,EAAA;AACxB,QAAA,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;IAChC;IAEA,OAAO,GAAA;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7B;IAEA,QAAQ,GAAA;QACP,OAAO,IAAI,CAAC,IAAI;IACjB;AACA;;;;"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import
|
|
3
|
+
import '../external/vscode-observables/observables/dist/observableInternal/index.js';
|
|
4
|
+
import { observableValue } from '../external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js';
|
|
5
|
+
import '../external/vscode-observables/observables/dist/observableInternal/debugLocation.js';
|
|
6
|
+
import '../external/vscode-observables/observables/dist/observableInternal/observables/derived.js';
|
|
7
|
+
import '../external/vscode-observables/observables/dist/observableInternal/utils/utils.js';
|
|
8
|
+
import '../external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js';
|
|
4
9
|
import { GitCommitId } from './gitCommitId.js';
|
|
5
10
|
import { execGit, isConcreteCommitHash } from './gitUtils.js';
|
|
6
|
-
|
|
11
|
+
|
|
12
|
+
class GitCommitResolver {
|
|
7
13
|
ref;
|
|
8
14
|
_gitRoot;
|
|
9
15
|
_resolvedCommit;
|
|
@@ -82,4 +88,6 @@ export class GitCommitResolver {
|
|
|
82
88
|
this._watchers.length = 0;
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
|
-
|
|
91
|
+
|
|
92
|
+
export { GitCommitResolver };
|
|
93
|
+
//# sourceMappingURL=gitCommitResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitCommitResolver.js","
|
|
1
|
+
{"version":3,"file":"gitCommitResolver.js","sources":["../../src/git/gitCommitResolver.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;MAYa,iBAAiB,CAAA;AAWnB,IAAA,GAAA;AACQ,IAAA,QAAA;AAXD,IAAA,eAAe;IACf,SAAS,GAAmB,EAAE;AACvC,IAAA,cAAc;IACd,SAAS,GAAG,KAAK;AAEzB,IAAA,IAAI,cAAc,GAAA;QACjB,OAAO,IAAI,CAAC,eAAe;IAC5B;AAEA,IAAA,WAAA,CACU,GAAW,EACH,QAAgB,EACjC,aAA0B,EAAA;QAFjB,IAAA,CAAA,GAAG,GAAH,GAAG;QACK,IAAA,CAAA,QAAQ,GAAR,QAAQ;QAGzB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAc,CAAA,eAAA,EAAkB,GAAG,CAAA,CAAA,CAAG,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} from './gitWorktreeManager.js';
|
|
3
3
|
import { getGitRoot, resolveRef, worktreeRootPath } from './gitUtils.js';
|
|
4
4
|
import { GitCommitId } from './gitCommitId.js';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
class GitService {
|
|
6
7
|
async getRootRepoFromDir(fromDir) {
|
|
7
8
|
const gitRoot = await getGitRoot(fromDir);
|
|
8
9
|
return new GitRepo(gitRoot);
|
|
@@ -35,4 +36,6 @@ class GitRepo {
|
|
|
35
36
|
this._resolvers.clear();
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
|
|
40
|
+
export { GitService };
|
|
41
|
+
//# sourceMappingURL=gitService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitService.js","
|
|
1
|
+
{"version":3,"file":"gitService.js","sources":["../../src/git/gitService.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAmBa,UAAU,CAAA;IACtB,MAAM,kBAAkB,CAAC,OAAe,EAAA;AACvC,QAAA,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;AACzC,QAAA,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAC5B;AACA;AAED,MAAM,OAAO,CAAA;AAIS,IAAA,OAAA;AAHZ,IAAA,SAAS;AACD,IAAA,UAAU,GAAG,IAAI,GAAG,EAAsB;AAE3D,IAAA,WAAA,CAAqB,OAAe,EAAA;QAAf,IAAA,CAAA,OAAO,GAAP,OAAO;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,yBAAyB,CAAC,OAAO,CAAC;IACxD;IAEA,MAAM,oBAAoB,CAAC,GAAW,EAAA;AACrC,QAAA,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC;AAClE,QAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC7B,QAAA,OAAO,QAAQ;IAChB;IAEA,MAAM,UAAU,CAAC,GAAW,EAAA;QAC3B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC;AAChD,QAAA,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC;IAC7B;IAEA,gBAAgB,GAAA;AACf,QAAA,OAAO,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;IACtC;IAEA,OAAO,GAAA;AACN,QAAA,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;YACvC,QAAQ,CAAC,OAAO,EAAE;QACnB;AACA,QAAA,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;IACxB;AACA;;;;"}
|
package/dist/git/gitUtils.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
async function getGitRoot(fromDir) {
|
|
4
5
|
const output = await execGit(fromDir, ['rev-parse', '--show-toplevel']);
|
|
5
6
|
return output.trim();
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
async function resolveRef(gitRoot, ref) {
|
|
8
9
|
const output = await execGit(gitRoot, ['rev-parse', ref]);
|
|
9
10
|
return output.trim();
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
function isConcreteCommitHash(ref) {
|
|
12
13
|
return /^[0-9a-f]{40}$/i.test(ref);
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
function worktreeRootPath(gitRoot) {
|
|
15
16
|
const repoName = path.basename(gitRoot);
|
|
16
17
|
return path.resolve(gitRoot, '..', `${repoName}.worktrees`);
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
function execGit(cwd, args) {
|
|
19
20
|
return new Promise((resolve, reject) => {
|
|
20
21
|
execFile('git', ['-C', cwd, ...args], { encoding: 'utf-8' }, (err, stdout, stderr) => {
|
|
21
22
|
if (err) {
|
|
@@ -27,4 +28,6 @@ export function execGit(cwd, args) {
|
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
export { execGit, getGitRoot, isConcreteCommitHash, resolveRef, worktreeRootPath };
|
|
33
|
+
//# sourceMappingURL=gitUtils.js.map
|