@vscode/component-explorer-cli 0.2.1-50 → 0.2.1-52
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/_virtual/_build-info.js +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js +2 -3
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js +3 -3
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js +28 -171
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js +6 -9
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js +8 -11
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js +5 -7
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js +0 -16
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/package.json +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/experimental/manualObserver.js +0 -85
- package/dist/external/vscode-observables/observables/dist/observableInternal/experimental/manualObserver.js.map +0 -1
package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js
CHANGED
|
@@ -14,8 +14,7 @@ var DebugLocation;
|
|
|
14
14
|
}
|
|
15
15
|
DebugLocation.enable = enable;
|
|
16
16
|
function ofCaller() {
|
|
17
|
-
|
|
18
|
-
return result;
|
|
17
|
+
return ofNthCaller(1);
|
|
19
18
|
}
|
|
20
19
|
DebugLocation.ofCaller = ofCaller;
|
|
21
20
|
function ofNthCaller(n) {
|
|
@@ -24,7 +23,7 @@ var DebugLocation;
|
|
|
24
23
|
}
|
|
25
24
|
const Err = Error; // For the monaco editor checks, which don't have the nodejs types.
|
|
26
25
|
const l = Err.stackTraceLimit;
|
|
27
|
-
Err.stackTraceLimit =
|
|
26
|
+
Err.stackTraceLimit = 3;
|
|
28
27
|
const stack = new Error().stack;
|
|
29
28
|
Err.stackTraceLimit = l;
|
|
30
29
|
return DebugLocationImpl.fromStack(stack, n + 1);
|
package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugLocation.js","sources":["../../../../../../../../external/vscode-observables/observables/dist/observableInternal/debugLocation.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 *--------------------------------------------------------------------------------------------*/\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 *--------------------------------------------------------------------------------------------*/\nvar DebugLocation;\n(function (DebugLocation) {\n let enabled = false;\n function enable() {\n enabled = true;\n }\n DebugLocation.enable = enable;\n function ofCaller() {\n
|
|
1
|
+
{"version":3,"file":"debugLocation.js","sources":["../../../../../../../../external/vscode-observables/observables/dist/observableInternal/debugLocation.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 *--------------------------------------------------------------------------------------------*/\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 *--------------------------------------------------------------------------------------------*/\nvar DebugLocation;\n(function (DebugLocation) {\n let enabled = false;\n function enable() {\n enabled = true;\n }\n DebugLocation.enable = enable;\n function ofCaller() {\n return ofNthCaller(1);\n }\n DebugLocation.ofCaller = ofCaller;\n function ofNthCaller(n) {\n if (!enabled) {\n return undefined;\n }\n const Err = Error; // For the monaco editor checks, which don't have the nodejs types.\n const l = Err.stackTraceLimit;\n Err.stackTraceLimit = 3;\n const stack = new Error().stack;\n Err.stackTraceLimit = l;\n return DebugLocationImpl.fromStack(stack, n + 1);\n }\n DebugLocation.ofNthCaller = ofNthCaller;\n})(DebugLocation || (DebugLocation = {}));\nclass DebugLocationImpl {\n static fromStack(stack, parentIdx) {\n const lines = stack.split('\\n');\n const location = parseLine(lines[parentIdx + 1]);\n if (location) {\n return new DebugLocationImpl(location.fileName, location.line, location.column, location.id);\n }\n else {\n return undefined;\n }\n }\n constructor(fileName, line, column, id) {\n this.fileName = fileName;\n this.line = line;\n this.column = column;\n this.id = id;\n }\n}\nfunction parseLine(stackLine) {\n if (!stackLine) {\n return undefined;\n }\n const match = stackLine.match(/\\((.*):(\\d+):(\\d+)\\)/);\n if (match) {\n return {\n fileName: match[1],\n line: parseInt(match[2]),\n column: parseInt(match[3]),\n id: stackLine,\n };\n }\n const match2 = stackLine.match(/at ([^\\(\\)]*):(\\d+):(\\d+)/);\n if (match2) {\n return {\n fileName: match2[1],\n line: parseInt(match2[2]),\n column: parseInt(match2[3]),\n id: stackLine,\n };\n }\n return undefined;\n}\n\nexport { DebugLocation };\n//# sourceMappingURL=debugLocation.js.map\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACG,IAAC;AACJ,CAAC,UAAU,aAAa,EAAE;AAC1B,IAAI,IAAI,OAAO,GAAG,KAAK;AACvB,IAAI,SAAS,MAAM,GAAG;AACtB,QAAQ,OAAO,GAAG,IAAI;AACtB,IAAI;AACJ,IAAI,aAAa,CAAC,MAAM,GAAG,MAAM;AACjC,IAAI,SAAS,QAAQ,GAAG;AACxB,QAAQ,OAAO,WAAW,CAAC,CAAC,CAAC;AAC7B,IAAI;AACJ,I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G,IAAI;AACxB,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM;AAC5B,QAAQ,IAAI,CAAC,EAAE,GAAG,EAAE;AACpB,IAAI;AACJ;AACA,SAAS,SAAS,CAAC,SAAS,EAAE;AAC9B,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,sBAAsB,CAAC;AACzD,IAAI,IAAI,KAAK,EAAE;AACf,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9B,YAAY,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpC,YAAY,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtC,YAAY,EAAE,EAAE,SAAS;AACzB,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,2BAA2B,CAAC;AAC/D,IAAI,IAAI,MAAM,EAAE;AAChB,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/B,YAAY,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrC,YAAY,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACvC,YAAY,EAAE,EAAE,SAAS;AACzB,SAAS;AACT,IAAI;AACJ,IAAI,OAAO,SAAS;AACpB;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { setLogObservableFn } from './logging/logging.js';
|
|
2
|
-
import {
|
|
2
|
+
import { _setDebugGetDependencyGraph } from './observables/baseObservable.js';
|
|
3
3
|
export { DebugLocation } from './debugLocation.js';
|
|
4
4
|
export { derived, derivedOpts } from './observables/derived.js';
|
|
5
5
|
export { keepObserved, recomputeInitiallyAndOnChange } from './utils/utils.js';
|
|
6
6
|
export { observableFromEvent } from './observables/observableFromEvent.js';
|
|
7
7
|
import { logObservableToConsole } from './logging/consoleObservableLogger.js';
|
|
8
|
-
import {
|
|
8
|
+
import { debugGetDependencyGraph } from './logging/debugGetDependencyGraph.js';
|
|
9
9
|
|
|
10
10
|
/*---------------------------------------------------------------------------------------------
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -17,6 +17,6 @@ import { DebugHelper } from './logging/debugGetDependencyGraph.js';
|
|
|
17
17
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
18
18
|
*--------------------------------------------------------------------------------------------*/
|
|
19
19
|
// This is a facade for the observable implementation. Only import from here!
|
|
20
|
-
|
|
20
|
+
_setDebugGetDependencyGraph(debugGetDependencyGraph);
|
|
21
21
|
setLogObservableFn(logObservableToConsole);
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../external/vscode-observables/observables/dist/observableInternal/index.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 { setLogObservableFn } from './logging/logging.js';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../external/vscode-observables/observables/dist/observableInternal/index.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 { setLogObservableFn } from './logging/logging.js';\nimport { _setDebugGetDependencyGraph } from './observables/baseObservable.js';\nexport { DebugLocation } from './debugLocation.js';\nexport { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore } from './observables/derived.js';\nexport { debouncedObservable, debouncedObservableDeprecated, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently } from './utils/utils.js';\nexport { observableFromEvent, observableFromEventOpts } from './observables/observableFromEvent.js';\nimport { logObservableToConsole } from './logging/consoleObservableLogger.js';\nimport { debugGetDependencyGraph } from './logging/debugGetDependencyGraph.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// This is a facade for the observable implementation. Only import from here!\n_setDebugGetDependencyGraph(debugGetDependencyGraph);\nsetLogObservableFn(logObservableToConsole);\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA,2BAA2B,CAAC,uBAAuB,CAAC;AACpD,kBAAkB,CAAC,sBAAsB,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { Derived } from '../observables/derivedImpl.js';
|
|
|
2
2
|
import { FromEventObservable } from '../observables/observableFromEvent.js';
|
|
3
3
|
import { ObservableValue } from '../observables/observableValue.js';
|
|
4
4
|
import { AutorunObserver } from '../reactions/autorunImpl.js';
|
|
5
|
-
import { ManualObserver } from '../experimental/manualObserver.js';
|
|
6
5
|
import { formatValue } from './consoleObservableLogger.js';
|
|
7
6
|
|
|
8
7
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -14,209 +13,67 @@ import { formatValue } from './consoleObservableLogger.js';
|
|
|
14
13
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15
14
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
16
15
|
*--------------------------------------------------------------------------------------------*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.state = state;
|
|
26
|
-
this.children = children;
|
|
27
|
-
}
|
|
16
|
+
function debugGetDependencyGraph(obs, options) {
|
|
17
|
+
const debugNamePostProcessor = options?.debugNamePostProcessor ?? ((str) => str);
|
|
18
|
+
const info = Info.from(obs, debugNamePostProcessor);
|
|
19
|
+
if (!info) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
const alreadyListed = new Set();
|
|
23
|
+
return formatObservableInfo(info, 0, alreadyListed).trim();
|
|
28
24
|
}
|
|
29
|
-
function
|
|
30
|
-
const debugNamePostProcessor = options.debugNamePostProcessor ?? ((s) => s);
|
|
31
|
-
const visited = new Map();
|
|
32
|
-
function build(node) {
|
|
33
|
-
const existing = visited.get(node);
|
|
34
|
-
if (existing) {
|
|
35
|
-
return existing;
|
|
36
|
-
}
|
|
37
|
-
const info = RawInfo.from(node, debugNamePostProcessor) ?? RawInfo.unknown(node);
|
|
38
|
-
const children = options.type === 'observers' ? info.observers : info.dependencies;
|
|
39
|
-
const graphInfo = new GraphInfo(info.name, info.type, info.value, info.state, []);
|
|
40
|
-
visited.set(info.sourceObj, graphInfo);
|
|
41
|
-
graphInfo.children.push(...children.map(build));
|
|
42
|
-
return graphInfo;
|
|
43
|
-
}
|
|
44
|
-
const root = RawInfo.from(obs, debugNamePostProcessor);
|
|
45
|
-
if (!root) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
return build(obs);
|
|
49
|
-
}
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// Text backend
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
function formatAsText(graph) {
|
|
54
|
-
const visited = new Set();
|
|
55
|
-
return formatNodeAsText(graph, 0, visited).trim();
|
|
56
|
-
}
|
|
57
|
-
function formatNodeAsText(node, indentLevel, visited) {
|
|
25
|
+
function formatObservableInfo(info, indentLevel, alreadyListed) {
|
|
58
26
|
const indent = '\t\t'.repeat(indentLevel);
|
|
59
27
|
const lines = [];
|
|
60
|
-
|
|
61
|
-
|
|
28
|
+
const isAlreadyListed = alreadyListed.has(info.sourceObj);
|
|
29
|
+
if (isAlreadyListed) {
|
|
30
|
+
lines.push(`${indent}* ${info.type} ${info.name} (already listed)`);
|
|
62
31
|
return lines.join('\n');
|
|
63
32
|
}
|
|
64
|
-
|
|
65
|
-
lines.push(`${indent}* ${
|
|
66
|
-
lines.push(`${indent} value: ${formatValue(
|
|
67
|
-
lines.push(`${indent} state: ${
|
|
68
|
-
if (
|
|
69
|
-
lines.push(`${indent}
|
|
70
|
-
for (const
|
|
71
|
-
lines.push(
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return lines.join('\n');
|
|
75
|
-
}
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
// Mermaid backend
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
|
-
function formatAsMermaid(graph) {
|
|
80
|
-
const nodeIds = new Map();
|
|
81
|
-
let nextId = 0;
|
|
82
|
-
const getNodeId = (node) => {
|
|
83
|
-
let id = nodeIds.get(node);
|
|
84
|
-
if (!id) {
|
|
85
|
-
id = `n${nextId++}`;
|
|
86
|
-
nodeIds.set(node, id);
|
|
87
|
-
}
|
|
88
|
-
return id;
|
|
89
|
-
};
|
|
90
|
-
const lines = ['graph TD'];
|
|
91
|
-
const visited = new Set();
|
|
92
|
-
const escape = (s) => s.replace(/"/g, '#quot;');
|
|
93
|
-
function visit(node) {
|
|
94
|
-
if (visited.has(node)) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
visited.add(node);
|
|
98
|
-
const id = getNodeId(node);
|
|
99
|
-
const label = `${node.type}: ${node.name}\\nstate: ${node.state}${node.value !== undefined ? `\\nvalue: ${formatValue(node.value, 30)}` : ''}`;
|
|
100
|
-
lines.push(` ${id}["${escape(label)}"]`);
|
|
101
|
-
for (const child of node.children) {
|
|
102
|
-
lines.push(` ${id} --> ${getNodeId(child)}`);
|
|
103
|
-
visit(child);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
visit(graph);
|
|
107
|
-
return lines.join('\n');
|
|
108
|
-
}
|
|
109
|
-
// ---------------------------------------------------------------------------
|
|
110
|
-
// Graphviz DOT backend
|
|
111
|
-
// ---------------------------------------------------------------------------
|
|
112
|
-
function formatAsGraphviz(graph) {
|
|
113
|
-
const nodeIds = new Map();
|
|
114
|
-
let nextId = 0;
|
|
115
|
-
const getNodeId = (node) => {
|
|
116
|
-
let id = nodeIds.get(node);
|
|
117
|
-
if (!id) {
|
|
118
|
-
id = `n${nextId++}`;
|
|
119
|
-
nodeIds.set(node, id);
|
|
120
|
-
}
|
|
121
|
-
return id;
|
|
122
|
-
};
|
|
123
|
-
const lines = ['digraph {'];
|
|
124
|
-
const visited = new Set();
|
|
125
|
-
const escape = (s) => s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
126
|
-
function visit(node) {
|
|
127
|
-
if (visited.has(node)) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
visited.add(node);
|
|
131
|
-
const id = getNodeId(node);
|
|
132
|
-
const label = `${node.type}: ${node.name}\nstate: ${node.state}${node.value !== undefined ? `\nvalue: ${formatValue(node.value, 30)}` : ''}`;
|
|
133
|
-
lines.push(` ${id} [label="${escape(label)}"]`);
|
|
134
|
-
for (const child of node.children) {
|
|
135
|
-
lines.push(` ${id} -> ${getNodeId(child)}`);
|
|
136
|
-
visit(child);
|
|
33
|
+
alreadyListed.add(info.sourceObj);
|
|
34
|
+
lines.push(`${indent}* ${info.type} ${info.name}:`);
|
|
35
|
+
lines.push(`${indent} value: ${formatValue(info.value, 50)}`);
|
|
36
|
+
lines.push(`${indent} state: ${info.state}`);
|
|
37
|
+
if (info.dependencies.length > 0) {
|
|
38
|
+
lines.push(`${indent} dependencies:`);
|
|
39
|
+
for (const dep of info.dependencies) {
|
|
40
|
+
lines.push(formatObservableInfo(dep, indentLevel + 1, alreadyListed));
|
|
137
41
|
}
|
|
138
42
|
}
|
|
139
|
-
visit(graph);
|
|
140
|
-
lines.push('}');
|
|
141
43
|
return lines.join('\n');
|
|
142
44
|
}
|
|
143
|
-
|
|
144
|
-
// DebugHelper — the public API for .debug on observables and observers
|
|
145
|
-
// ---------------------------------------------------------------------------
|
|
146
|
-
class DebugHelper {
|
|
147
|
-
constructor(_node) {
|
|
148
|
-
this._node = _node;
|
|
149
|
-
}
|
|
150
|
-
buildDependencyGraph() {
|
|
151
|
-
return buildGraph(this._node, { type: 'dependencies' });
|
|
152
|
-
}
|
|
153
|
-
buildObserverGraph() {
|
|
154
|
-
return buildGraph(this._node, { type: 'observers' });
|
|
155
|
-
}
|
|
156
|
-
getDependencyGraph() {
|
|
157
|
-
const graph = this.buildDependencyGraph();
|
|
158
|
-
return graph ? formatAsText(graph) : '';
|
|
159
|
-
}
|
|
160
|
-
getObserverGraph() {
|
|
161
|
-
const graph = this.buildObserverGraph();
|
|
162
|
-
return graph ? formatAsText(graph) : '';
|
|
163
|
-
}
|
|
164
|
-
getDependencyMermaid() {
|
|
165
|
-
const graph = this.buildDependencyGraph();
|
|
166
|
-
return graph ? formatAsMermaid(graph) : '';
|
|
167
|
-
}
|
|
168
|
-
getObserverMermaid() {
|
|
169
|
-
const graph = this.buildObserverGraph();
|
|
170
|
-
return graph ? formatAsMermaid(graph) : '';
|
|
171
|
-
}
|
|
172
|
-
getDependencyGraphviz() {
|
|
173
|
-
const graph = this.buildDependencyGraph();
|
|
174
|
-
return graph ? formatAsGraphviz(graph) : '';
|
|
175
|
-
}
|
|
176
|
-
getObserverGraphviz() {
|
|
177
|
-
const graph = this.buildObserverGraph();
|
|
178
|
-
return graph ? formatAsGraphviz(graph) : '';
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// ---------------------------------------------------------------------------
|
|
182
|
-
// RawInfo — internal: extracts metadata from concrete observable/observer types
|
|
183
|
-
// ---------------------------------------------------------------------------
|
|
184
|
-
class RawInfo {
|
|
45
|
+
class Info {
|
|
185
46
|
static from(obs, debugNamePostProcessor) {
|
|
186
47
|
if (obs instanceof AutorunObserver) {
|
|
187
48
|
const state = obs.debugGetState();
|
|
188
|
-
return new
|
|
189
|
-
}
|
|
190
|
-
else if (obs instanceof ManualObserver) {
|
|
191
|
-
return new RawInfo(obs, debugNamePostProcessor(obs.debugName), 'manualObserver', undefined, 'active', Array.from(obs.getDependencies()), []);
|
|
49
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), 'autorun', undefined, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));
|
|
192
50
|
}
|
|
193
51
|
else if (obs instanceof Derived) {
|
|
194
52
|
const state = obs.debugGetState();
|
|
195
|
-
return new
|
|
53
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), 'derived', state.value, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));
|
|
196
54
|
}
|
|
197
55
|
else if (obs instanceof ObservableValue) {
|
|
198
56
|
const state = obs.debugGetState();
|
|
199
|
-
return new
|
|
57
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), 'observableValue', state.value, 'upToDate', []);
|
|
200
58
|
}
|
|
201
59
|
else if (obs instanceof FromEventObservable) {
|
|
202
60
|
const state = obs.debugGetState();
|
|
203
|
-
return new
|
|
61
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), 'fromEvent', state.value, state.hasValue ? 'upToDate' : 'initial', []);
|
|
204
62
|
}
|
|
205
63
|
return undefined;
|
|
206
64
|
}
|
|
207
65
|
static unknown(obs) {
|
|
208
|
-
return new
|
|
66
|
+
return new Info(obs, '(unknown)', 'unknown', undefined, 'unknown', []);
|
|
209
67
|
}
|
|
210
|
-
constructor(sourceObj, name, type, value, state, dependencies
|
|
68
|
+
constructor(sourceObj, name, type, value, state, dependencies) {
|
|
211
69
|
this.sourceObj = sourceObj;
|
|
212
70
|
this.name = name;
|
|
213
71
|
this.type = type;
|
|
214
72
|
this.value = value;
|
|
215
73
|
this.state = state;
|
|
216
74
|
this.dependencies = dependencies;
|
|
217
|
-
this.observers = observers;
|
|
218
75
|
}
|
|
219
76
|
}
|
|
220
77
|
|
|
221
|
-
export {
|
|
78
|
+
export { debugGetDependencyGraph };
|
|
222
79
|
//# sourceMappingURL=debugGetDependencyGraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugGetDependencyGraph.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.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 { Derived } from '../observables/derivedImpl.js';\nimport { FromEventObservable } from '../observables/observableFromEvent.js';\nimport { ObservableValue } from '../observables/observableValue.js';\nimport { AutorunObserver } from '../reactions/autorunImpl.js';\nimport { ManualObserver } from '../experimental/manualObserver.js';\nimport { formatValue } from './consoleObservableLogger.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// GraphInfo — the result of graph traversal, separated from rendering\n// ---------------------------------------------------------------------------\nclass GraphInfo {\n constructor(name, type, value, state, children) {\n this.name = name;\n this.type = type;\n this.value = value;\n this.state = state;\n this.children = children;\n }\n}\nfunction buildGraph(obs, options) {\n const debugNamePostProcessor = options.debugNamePostProcessor ?? ((s) => s);\n const visited = new Map();\n function build(node) {\n const existing = visited.get(node);\n if (existing) {\n return existing;\n }\n const info = RawInfo.from(node, debugNamePostProcessor) ?? RawInfo.unknown(node);\n const children = options.type === 'observers' ? info.observers : info.dependencies;\n const graphInfo = new GraphInfo(info.name, info.type, info.value, info.state, []);\n visited.set(info.sourceObj, graphInfo);\n graphInfo.children.push(...children.map(build));\n return graphInfo;\n }\n const root = RawInfo.from(obs, debugNamePostProcessor);\n if (!root) {\n return undefined;\n }\n return build(obs);\n}\n// ---------------------------------------------------------------------------\n// Text backend\n// ---------------------------------------------------------------------------\nfunction formatAsText(graph) {\n const visited = new Set();\n return formatNodeAsText(graph, 0, visited).trim();\n}\nfunction formatNodeAsText(node, indentLevel, visited) {\n const indent = '\\t\\t'.repeat(indentLevel);\n const lines = [];\n if (visited.has(node)) {\n lines.push(`${indent}* ${node.type} ${node.name} (already listed)`);\n return lines.join('\\n');\n }\n visited.add(node);\n lines.push(`${indent}* ${node.type} ${node.name}:`);\n lines.push(`${indent} value: ${formatValue(node.value, 50)}`);\n lines.push(`${indent} state: ${node.state}`);\n if (node.children.length > 0) {\n lines.push(`${indent} children:`);\n for (const child of node.children) {\n lines.push(formatNodeAsText(child, indentLevel + 1, visited));\n }\n }\n return lines.join('\\n');\n}\n// ---------------------------------------------------------------------------\n// Mermaid backend\n// ---------------------------------------------------------------------------\nfunction formatAsMermaid(graph) {\n const nodeIds = new Map();\n let nextId = 0;\n const getNodeId = (node) => {\n let id = nodeIds.get(node);\n if (!id) {\n id = `n${nextId++}`;\n nodeIds.set(node, id);\n }\n return id;\n };\n const lines = ['graph TD'];\n const visited = new Set();\n const escape = (s) => s.replace(/\"/g, '#quot;');\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n const id = getNodeId(node);\n const label = `${node.type}: ${node.name}\\\\nstate: ${node.state}${node.value !== undefined ? `\\\\nvalue: ${formatValue(node.value, 30)}` : ''}`;\n lines.push(` ${id}[\"${escape(label)}\"]`);\n for (const child of node.children) {\n lines.push(` ${id} --> ${getNodeId(child)}`);\n visit(child);\n }\n }\n visit(graph);\n return lines.join('\\n');\n}\n// ---------------------------------------------------------------------------\n// Graphviz DOT backend\n// ---------------------------------------------------------------------------\nfunction formatAsGraphviz(graph) {\n const nodeIds = new Map();\n let nextId = 0;\n const getNodeId = (node) => {\n let id = nodeIds.get(node);\n if (!id) {\n id = `n${nextId++}`;\n nodeIds.set(node, id);\n }\n return id;\n };\n const lines = ['digraph {'];\n const visited = new Set();\n const escape = (s) => s.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n const id = getNodeId(node);\n const label = `${node.type}: ${node.name}\\nstate: ${node.state}${node.value !== undefined ? `\\nvalue: ${formatValue(node.value, 30)}` : ''}`;\n lines.push(` ${id} [label=\"${escape(label)}\"]`);\n for (const child of node.children) {\n lines.push(` ${id} -> ${getNodeId(child)}`);\n visit(child);\n }\n }\n visit(graph);\n lines.push('}');\n return lines.join('\\n');\n}\n// ---------------------------------------------------------------------------\n// DebugHelper — the public API for .debug on observables and observers\n// ---------------------------------------------------------------------------\nclass DebugHelper {\n constructor(_node) {\n this._node = _node;\n }\n buildDependencyGraph() {\n return buildGraph(this._node, { type: 'dependencies' });\n }\n buildObserverGraph() {\n return buildGraph(this._node, { type: 'observers' });\n }\n getDependencyGraph() {\n const graph = this.buildDependencyGraph();\n return graph ? formatAsText(graph) : '';\n }\n getObserverGraph() {\n const graph = this.buildObserverGraph();\n return graph ? formatAsText(graph) : '';\n }\n getDependencyMermaid() {\n const graph = this.buildDependencyGraph();\n return graph ? formatAsMermaid(graph) : '';\n }\n getObserverMermaid() {\n const graph = this.buildObserverGraph();\n return graph ? formatAsMermaid(graph) : '';\n }\n getDependencyGraphviz() {\n const graph = this.buildDependencyGraph();\n return graph ? formatAsGraphviz(graph) : '';\n }\n getObserverGraphviz() {\n const graph = this.buildObserverGraph();\n return graph ? formatAsGraphviz(graph) : '';\n }\n}\n// ---------------------------------------------------------------------------\n// RawInfo — internal: extracts metadata from concrete observable/observer types\n// ---------------------------------------------------------------------------\nclass RawInfo {\n static from(obs, debugNamePostProcessor) {\n if (obs instanceof AutorunObserver) {\n const state = obs.debugGetState();\n return new RawInfo(obs, debugNamePostProcessor(obs.debugName), 'autorun', undefined, state.stateStr, Array.from(state.dependencies), []);\n }\n else if (obs instanceof ManualObserver) {\n return new RawInfo(obs, debugNamePostProcessor(obs.debugName), 'manualObserver', undefined, 'active', Array.from(obs.getDependencies()), []);\n }\n else if (obs instanceof Derived) {\n const state = obs.debugGetState();\n return new RawInfo(obs, debugNamePostProcessor(obs.debugName), 'derived', state.value, state.stateStr, Array.from(state.dependencies), Array.from(obs.debugGetObservers()));\n }\n else if (obs instanceof ObservableValue) {\n const state = obs.debugGetState();\n return new RawInfo(obs, debugNamePostProcessor(obs.debugName), 'observableValue', state.value, 'upToDate', [], Array.from(obs.debugGetObservers()));\n }\n else if (obs instanceof FromEventObservable) {\n const state = obs.debugGetState();\n return new RawInfo(obs, debugNamePostProcessor(obs.debugName), 'fromEvent', state.value, state.hasValue ? 'upToDate' : 'initial', [], Array.from(obs.debugGetObservers()));\n }\n return undefined;\n }\n static unknown(obs) {\n return new RawInfo(obs, '(unknown)', 'unknown', undefined, 'unknown', [], []);\n }\n constructor(sourceObj, name, type, value, state, dependencies, observers) {\n this.sourceObj = sourceObj;\n this.name = name;\n this.type = type;\n this.value = value;\n this.state = state;\n this.dependencies = dependencies;\n this.observers = observers;\n }\n}\n\nexport { DebugHelper, GraphInfo };\n//# sourceMappingURL=debugGetDependencyGraph.js.map\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,CAAC;AAChB,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE;AACpD,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ;AAChC,IAAI;AACJ;AACA,SAAS,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE;AAClC,IAAI,MAAM,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,KAA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,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAC/J,QAAQ;AACR,aAAa,IAAI,GAAG,YAAY,mBAAmB,EAAE;AACrD,YAAY,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,EAAE;AAC7C,YAAY,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,GAAG,UAAU,GAAG,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACtL,QAAQ;AACR,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,OAAO,OAAO,CAAC,GAAG,EAAE;AACxB,QAAQ,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;AACrF,IAAI;AACJ,IAAI,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE;AAC9E,QAAQ,IAAI,CAAC,SAAS,GAAG,SAAS;AAClC,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,YAAY,GAAG,YAAY;AACxC,QAAQ,IAAI,CAAC,SAAS,GAAG,SAAS;AAClC,IAAI;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"debugGetDependencyGraph.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.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 { Derived } from '../observables/derivedImpl.js';\nimport { FromEventObservable } from '../observables/observableFromEvent.js';\nimport { ObservableValue } from '../observables/observableValue.js';\nimport { AutorunObserver } from '../reactions/autorunImpl.js';\nimport { formatValue } from './consoleObservableLogger.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 debugGetDependencyGraph(obs, options) {\n const debugNamePostProcessor = options?.debugNamePostProcessor ?? ((str) => str);\n const info = Info.from(obs, debugNamePostProcessor);\n if (!info) {\n return '';\n }\n const alreadyListed = new Set();\n return formatObservableInfo(info, 0, alreadyListed).trim();\n}\nfunction formatObservableInfo(info, indentLevel, alreadyListed) {\n const indent = '\\t\\t'.repeat(indentLevel);\n const lines = [];\n const isAlreadyListed = alreadyListed.has(info.sourceObj);\n if (isAlreadyListed) {\n lines.push(`${indent}* ${info.type} ${info.name} (already listed)`);\n return lines.join('\\n');\n }\n alreadyListed.add(info.sourceObj);\n lines.push(`${indent}* ${info.type} ${info.name}:`);\n lines.push(`${indent} value: ${formatValue(info.value, 50)}`);\n lines.push(`${indent} state: ${info.state}`);\n if (info.dependencies.length > 0) {\n lines.push(`${indent} dependencies:`);\n for (const dep of info.dependencies) {\n lines.push(formatObservableInfo(dep, indentLevel + 1, alreadyListed));\n }\n }\n return lines.join('\\n');\n}\nclass Info {\n static from(obs, debugNamePostProcessor) {\n if (obs instanceof AutorunObserver) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'autorun', undefined, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));\n }\n else if (obs instanceof Derived) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'derived', state.value, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));\n }\n else if (obs instanceof ObservableValue) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'observableValue', state.value, 'upToDate', []);\n }\n else if (obs instanceof FromEventObservable) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'fromEvent', state.value, state.hasValue ? 'upToDate' : 'initial', []);\n }\n return undefined;\n }\n static unknown(obs) {\n return new Info(obs, '(unknown)', 'unknown', undefined, 'unknown', []);\n }\n constructor(sourceObj, name, type, value, state, dependencies) {\n this.sourceObj = sourceObj;\n this.name = name;\n this.type = type;\n this.value = value;\n this.state = state;\n this.dependencies = dependencies;\n }\n}\n\nexport { debugGetDependencyGraph };\n//# sourceMappingURL=debugGetDependencyGraph.js.map\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA,SAAS,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE;AAC/C,IAAI,MAAM,sBAAsB,GAAG,OAAO,EAAE,sBAAsB,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC;AACpF,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC;AACvD,IAAI,IAAI,CAAC,IAAI,EAAE;AACf,QAAQ,OAAO,EAAE;AACjB,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG,IAAI,GAAG,EAAE;AACnC,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,IAAI,EAAE;AAC9D;AACA,SAAS,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE;AAChE,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;AAC7C,IAAI,MAAM,KAA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AAmB,EAAE;AACrD,YAAY,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,EAAE;AAC7C,YAAY,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,GAAG,UAAU,GAAG,SAAS,EAAE,EAAE,CAAC;AAC9I,QAAQ;AACR,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,OAAO,OAAO,CAAC,GAAG,EAAE;AACxB,QAAQ,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC;AAC9E,IAAI;AACJ,IAAI,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE;AACnE,QAAQ,IAAI,CAAC,SAAS,GAAG,SAAS;AAClC,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,YAAY,GAAG,YAAY;AACxC,IAAI;AACJ;;;;"}
|
|
@@ -27,12 +27,9 @@ let _keepObserved;
|
|
|
27
27
|
function _setKeepObserved(keepObserved) {
|
|
28
28
|
_keepObserved = keepObserved;
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
function _getDebugHelperClass() {
|
|
35
|
-
return _debugHelperCtor;
|
|
30
|
+
let _debugGetDependencyGraph;
|
|
31
|
+
function _setDebugGetDependencyGraph(debugGetDependencyGraph) {
|
|
32
|
+
_debugGetDependencyGraph = debugGetDependencyGraph;
|
|
36
33
|
}
|
|
37
34
|
class ConvenientObservable {
|
|
38
35
|
get TChange() { return null; }
|
|
@@ -98,8 +95,8 @@ class ConvenientObservable {
|
|
|
98
95
|
get debugValue() {
|
|
99
96
|
return this.get();
|
|
100
97
|
}
|
|
101
|
-
|
|
102
|
-
return
|
|
98
|
+
debugGetDependencyGraph() {
|
|
99
|
+
return _debugGetDependencyGraph(this);
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
class BaseObservable extends ConvenientObservable {
|
|
@@ -142,5 +139,5 @@ class BaseObservable extends ConvenientObservable {
|
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
141
|
|
|
145
|
-
export { BaseObservable, ConvenientObservable,
|
|
142
|
+
export { BaseObservable, ConvenientObservable, _setDebugGetDependencyGraph, _setDerivedOpts, _setKeepObserved, _setRecomputeInitiallyAndOnChange };
|
|
146
143
|
//# sourceMappingURL=baseObservable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseObservable.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.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 { DebugLocation } from '../debugLocation.js';\nimport { getFunctionName } from '../debugName.js';\nimport { logObservable, 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 *--------------------------------------------------------------------------------------------*/\nlet _derived;\n/**\n * @internal\n * This is to allow splitting files.\n*/\nfunction _setDerivedOpts(derived) {\n _derived = derived;\n}\nlet _recomputeInitiallyAndOnChange;\nfunction _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) {\n _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;\n}\nlet _keepObserved;\nfunction _setKeepObserved(keepObserved) {\n _keepObserved = keepObserved;\n}\nlet
|
|
1
|
+
{"version":3,"file":"baseObservable.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.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 { DebugLocation } from '../debugLocation.js';\nimport { getFunctionName } from '../debugName.js';\nimport { logObservable, 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 *--------------------------------------------------------------------------------------------*/\nlet _derived;\n/**\n * @internal\n * This is to allow splitting files.\n*/\nfunction _setDerivedOpts(derived) {\n _derived = derived;\n}\nlet _recomputeInitiallyAndOnChange;\nfunction _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) {\n _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;\n}\nlet _keepObserved;\nfunction _setKeepObserved(keepObserved) {\n _keepObserved = keepObserved;\n}\nlet _debugGetDependencyGraph;\nfunction _setDebugGetDependencyGraph(debugGetDependencyGraph) {\n _debugGetDependencyGraph = debugGetDependencyGraph;\n}\nclass ConvenientObservable {\n get TChange() { return null; }\n reportChanges() {\n this.get();\n }\n /** @sealed */\n read(reader) {\n if (reader) {\n return reader.readObservable(this);\n }\n else {\n return this.get();\n }\n }\n map(fnOrOwner, fnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n const owner = fnOrUndefined === undefined ? undefined : fnOrOwner;\n const fn = fnOrUndefined === undefined ? fnOrOwner : fnOrUndefined;\n return _derived({\n owner,\n debugName: () => {\n const name = getFunctionName(fn);\n if (name !== undefined) {\n return name;\n }\n // regexp to match `x => x.y` or `x => x?.y` where x and y can be arbitrary identifiers (uses backref):\n const regexp = /^\\s*\\(?\\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*\\)?\\s*=>\\s*\\1(?:\\??)\\.([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*$/;\n const match = regexp.exec(fn.toString());\n if (match) {\n return `${this.debugName}.${match[2]}`;\n }\n if (!owner) {\n return `${this.debugName} (mapped)`;\n }\n return undefined;\n },\n debugReferenceFn: fn,\n }, (reader) => fn(this.read(reader), reader), debugLocation);\n }\n /**\n * @sealed\n * Converts an observable of an observable value into a direct observable of the value.\n */\n flatten() {\n return _derived({\n owner: undefined,\n debugName: () => `${this.debugName} (flattened)`,\n }, (reader) => this.read(reader).read(reader));\n }\n recomputeInitiallyAndOnChange(store, handleValue) {\n store.add(_recomputeInitiallyAndOnChange(this, handleValue));\n return this;\n }\n /**\n * Ensures that this observable is observed. This keeps the cache alive.\n * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).\n * Use `recomputeInitiallyAndOnChange` for eager evaluation.\n */\n keepObserved(store) {\n store.add(_keepObserved(this));\n return this;\n }\n get debugValue() {\n return this.get();\n }\n debugGetDependencyGraph() {\n return _debugGetDependencyGraph(this);\n }\n}\nclass BaseObservable extends ConvenientObservable {\n constructor(debugLocation) {\n super();\n this._observers = new Set();\n getLogger()?.handleObservableCreated(this, debugLocation);\n }\n addObserver(observer) {\n const len = this._observers.size;\n this._observers.add(observer);\n if (len === 0) {\n this.onFirstObserverAdded();\n }\n if (len !== this._observers.size) {\n getLogger()?.handleOnListenerCountChanged(this, this._observers.size);\n }\n }\n removeObserver(observer) {\n const deleted = this._observers.delete(observer);\n if (deleted && this._observers.size === 0) {\n this.onLastObserverRemoved();\n }\n if (deleted) {\n getLogger()?.handleOnListenerCountChanged(this, this._observers.size);\n }\n }\n onFirstObserverAdded() { }\n onLastObserverRemoved() { }\n log() {\n const hadLogger = !!getLogger();\n logObservable(this);\n if (!hadLogger) {\n getLogger()?.handleObservableCreated(this, DebugLocation.ofCaller());\n }\n return this;\n }\n debugGetObservers() {\n return this._observers;\n }\n}\n\nexport { BaseObservable, ConvenientObservable, _setDebugGetDependencyGra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,EAAE;AACnD,YAAY,IAAI,CAAC,qBAAqB,EAAE;AACxC,QAAQ;AACR,QAAQ,IAAI,OAAO,EAAE;AACrB,YAAY,SAAS,EAAE,EAAE,4BAA4B,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;AACjF,QAAQ;AACR,IAAI;AACJ,IAAI,oBAAoB,GAAG,EAAE;AAC7B,IAAI,qBAAqB,GAAG,EAAE;AAC9B,IAAI,GAAG,GAAG;AACV,QAAQ,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE;AACvC,QAAQ,aAAa,CAAC,IAAI,CAAC;AAC3B,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,SAAS,EAAE,EAAE,uBAAuB,CAAC,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC;AAChF,QAAQ;AACR,QAAQ,OAAO,IAAI;AACnB,IAAI;AACJ,IAAI,iBAAiB,GAAG;AACxB,QAAQ,OAAO,IAAI,CAAC,UAAU;AAC9B,IAAI;AACJ;;;;"}
|
|
@@ -310,7 +310,10 @@ class Derived extends BaseObservable {
|
|
|
310
310
|
const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCount > 0;
|
|
311
311
|
super.addObserver(observer);
|
|
312
312
|
if (shouldCallBeginUpdate) {
|
|
313
|
-
if (
|
|
313
|
+
if (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(observer)) {
|
|
314
|
+
this._removedObserverToCallEndUpdateOn.delete(observer);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
314
317
|
observer.beginUpdate(this);
|
|
315
318
|
}
|
|
316
319
|
}
|
|
@@ -338,17 +341,11 @@ class Derived extends BaseObservable {
|
|
|
338
341
|
this._value = newValue;
|
|
339
342
|
}
|
|
340
343
|
debugRecompute() {
|
|
341
|
-
this.
|
|
342
|
-
|
|
343
|
-
if (!this._isComputing) {
|
|
344
|
-
this._recompute();
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
this._state = 2 /* DerivedState.stale */;
|
|
348
|
-
}
|
|
344
|
+
if (!this._isComputing) {
|
|
345
|
+
this._recompute();
|
|
349
346
|
}
|
|
350
|
-
|
|
351
|
-
this.
|
|
347
|
+
else {
|
|
348
|
+
this._state = 2 /* DerivedState.stale */;
|
|
352
349
|
}
|
|
353
350
|
}
|
|
354
351
|
setValue(newValue, tx, change) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivedImpl.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.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 { BaseObservable } from './baseObservable.js';\nimport { BugIndicatingError, onBugIndicatingError } 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 derivedStateToString(state) {\n switch (state) {\n case 0 /* DerivedState.initial */: return 'initial';\n case 1 /* DerivedState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* DerivedState.stale */: return 'stale';\n case 3 /* DerivedState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass Derived extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _computeFn, _changeTracker, _handleLastObserverRemoved = undefined, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._computeFn = _computeFn;\n this._changeTracker = _changeTracker;\n this._handleLastObserverRemoved = _handleLastObserverRemoved;\n this._equalityComparator = _equalityComparator;\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n this._updateCount = 0;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._changeSummary = undefined;\n this._isUpdating = false;\n this._isComputing = false;\n this._didReportChange = false;\n this._isInBeforeUpdate = false;\n this._isReaderValid = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._removedObserverToCallEndUpdateOn = null;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n }\n onLastObserverRemoved() {\n /**\n * We are not tracking changes anymore, thus we have to assume\n * that our cache is invalid.\n */\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n getLogger()?.handleDerivedCleared(this);\n for (const d of this._dependencies) {\n d.removeObserver(this);\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n this._delayedStore = undefined;\n }\n this._handleLastObserverRemoved?.();\n }\n get() {\n const checkEnabled = false; // TODO set to true\n if (this._isComputing && checkEnabled) {\n // investigate why this fails in the diff editor!\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n if (this._observers.size === 0) {\n let result;\n // Without observers, we don't know when to clean up stuff.\n // Thus, we don't cache anything to prevent memory leaks.\n try {\n this._isReaderValid = true;\n let changeSummary = undefined;\n if (this._changeTracker) {\n changeSummary = this._changeTracker.createChangeSummary(undefined);\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n }\n result = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\n }\n // Clear new dependencies\n this.onLastObserverRemoved();\n return result;\n }\n else {\n do {\n // We might not get a notification for a dependency that changed while it is updating,\n // thus we also have to ask all our depedencies if they changed in this case.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n for (const d of this._dependencies) {\n /** might call {@link handleChange} indirectly, which could make us stale */\n d.reportChanges();\n if (this._state === 2 /* DerivedState.stale */) {\n // The other dependencies will refresh on demand, so early break\n break;\n }\n }\n }\n // We called report changes of all dependencies.\n // If we are still not stale, we can assume to be up to date again.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n this._state = 3 /* DerivedState.upToDate */;\n }\n if (this._state !== 3 /* DerivedState.upToDate */) {\n this._recompute();\n }\n // In case recomputation changed one of our dependencies, we need to recompute again.\n } while (this._state !== 3 /* DerivedState.upToDate */);\n return this._value;\n }\n }\n _recompute() {\n let didChange = false;\n this._isComputing = true;\n this._didReportChange = false;\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n try {\n const changeSummary = this._changeSummary;\n this._isReaderValid = true;\n if (this._changeTracker) {\n this._isInBeforeUpdate = true;\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._isInBeforeUpdate = false;\n this._changeSummary = this._changeTracker?.createChangeSummary(changeSummary);\n }\n const hadValue = this._state !== 0 /* DerivedState.initial */;\n const oldValue = this._value;\n this._state = 3 /* DerivedState.upToDate */;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n /** might call {@link handleChange} indirectly, which could invalidate us */\n this._value = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\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);\n }\n this._dependenciesToBeRemoved.clear();\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n didChange = this._didReportChange || (hadValue && !(this._equalityComparator(oldValue, this._value)));\n getLogger()?.handleObservableUpdated(this, {\n oldValue,\n newValue: this._value,\n change: undefined,\n didChange,\n hadValue,\n });\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n this._isComputing = false;\n if (!this._didReportChange && didChange) {\n for (const r of this._observers) {\n r.handleChange(this, undefined);\n }\n }\n else {\n this._didReportChange = false;\n }\n }\n toString() {\n return `LazyDerived<${this.debugName}>`;\n }\n // IObserver Implementation\n beginUpdate(_observable) {\n if (this._isUpdating) {\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n this._updateCount++;\n this._isUpdating = true;\n try {\n const propagateBeginUpdate = this._updateCount === 1;\n if (this._state === 3 /* DerivedState.upToDate */) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n // If we propagate begin update, that will already signal a possible change.\n if (!propagateBeginUpdate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n if (propagateBeginUpdate) {\n for (const r of this._observers) {\n r.beginUpdate(this); // This signals a possible change\n }\n }\n }\n finally {\n this._isUpdating = false;\n }\n }\n endUpdate(_observable) {\n this._updateCount--;\n if (this._updateCount === 0) {\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n if (this._removedObserverToCallEndUpdateOn) {\n const observers = [...this._removedObserverToCallEndUpdateOn];\n this._removedObserverToCallEndUpdateOn = null;\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n }\n handlePossibleChange(observable) {\n // In all other states, observers already know that we might have changed.\n if (this._state === 3 /* DerivedState.upToDate */ && this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable)) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n handleChange(observable, change) {\n if (this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable) || this._isInBeforeUpdate) {\n getLogger()?.handleDerivedDependencyChanged(this, observable, change);\n let shouldReact = false;\n try {\n shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n const wasUpToDate = this._state === 3 /* DerivedState.upToDate */;\n if (shouldReact && (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */ || wasUpToDate)) {\n this._state = 2 /* DerivedState.stale */;\n if (wasUpToDate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n }\n }\n // IReader Implementation\n _ensureReaderValid() {\n if (!this._isReaderValid) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureReaderValid();\n // Subscribe before getting the value to enable caching\n observable.addObserver(this);\n /** This might call {@link handleChange} indirectly, which could invalidate us */\n const value = observable.get();\n // Which is why we only add the observable to the dependencies now.\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n reportChange(change) {\n this._ensureReaderValid();\n this._didReportChange = true;\n // TODO add logging\n for (const r of this._observers) {\n r.handleChange(this, change);\n }\n }\n get store() {\n this._ensureReaderValid();\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureReaderValid();\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCount > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n if (!this._removedObserverToCallEndUpdateOn?.delete(observer)) {\n observer.beginUpdate(this);\n }\n }\n }\n removeObserver(observer) {\n if (this._observers.has(observer) && this._updateCount > 0) {\n if (!this._removedObserverToCallEndUpdateOn) {\n this._removedObserverToCallEndUpdateOn = new Set();\n }\n this._removedObserverToCallEndUpdateOn.add(observer);\n }\n super.removeObserver(observer);\n }\n debugGetState() {\n return {\n state: this._state,\n stateStr: derivedStateToString(this._state),\n updateCount: this._updateCount,\n isComputing: this._isComputing,\n dependencies: this._dependencies,\n value: this._value,\n };\n }\n debugSetValue(newValue) {\n this._value = newValue;\n }\n debugRecompute() {\n this.beginUpdate(this);\n try {\n if (!this._isComputing) {\n this._recompute();\n }\n else {\n this._state = 2 /* DerivedState.stale */;\n }\n }\n finally {\n this.endUpdate(this);\n }\n }\n setValue(newValue, tx, change) {\n this._value = newValue;\n const observers = this._observers;\n tx.updateObserver(this, this);\n for (const d of observers) {\n d.handleChange(this, change);\n }\n }\n}\nclass DerivedWithSetter extends Derived {\n constructor(debugNameData, computeFn, changeTracker, handleLastObserverRemoved = undefined, equalityComparator, set, debugLocation) {\n super(debugNameData, computeFn, changeTracker, handleLastObserverRemoved, equalityComparator, debugLocation);\n this.set = set;\n }\n}\n\nexport { Derived, DerivedWithSetter };\n//# sourceMappingURL=derivedImpl.js.map\n"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,QAAQ,KAAK;AACjB,QAAQ,KAAK,CAAC,6BAA6B,OAAO,SAAS;AAC3D,QAAQ,KAAK,CAAC,kDAAkD,OAAO,8BAA8B;AACrG,QAAQ,KAAK,CAAC,2BAA2B,OAAO,OAAO;AACvD,QAAQ,KAAK,CAAC,8BAA8B,OAAO,UAAU;AAC7D,QAAQ,SAAS,OAAO,WAAW;AACnC;AACA;AACA,MAAM,OAAO,SAAS,cAAc,CAAC;AACrC,IAAI,IAAI,SAAS,GAAG;AACpB,QAAQ,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,aAAa;AACtE,IAAI;AACJ,IAAI,WAAW,CAAC,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,0BAA0B,GAAG,SAAS,EAAE,mBAAmB,EAAE,aAAa,EAAE;AACxI,QAAQ,KAAK,CAAC,aAAa,CAAC;AAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc;AAC5C,QAAQ,IAAI,CAAC,UAAU,GAAG,UAAU;AACpC,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc;AAC5C,QAAQ,IAAI,CAAC,0BAA0B,GAAG,0BAA0B;AACpE,QAAQ,IAAI,CAAC,mBAAmB,GAAG,mBAAmB;AACtD,QAAQ,IAAI,CAAC,MAAM,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;AAC9B,IAAI;AACJ,IAAI,cAAc,GAAG;AACrB,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AAC9B,QAAQ,IAAI;AACZ,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACpC,gBAAgB,IAAI,CAAC,UAAU,EAAE;AACjC,YAAY;AACZ,iBAAiB;AACjB,gBAAgB,IAAI,CAAC,MAAM,GAAG,CAAC;AAC/B,YAAY;AACZ,QAAQ;AACR,gBAAgB;AAChB,YAAY,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;AAChC,QAAQ;AACR,IAAI;AACJ,IAAI,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE;AACnC,QAAQ,IAAI,CAAC,MAAM,GAAG,QAAQ;AAC9B,QAAQ,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU;AACzC,QAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC;AACrC,QAAQ,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE;AACnC,YAAY,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;AACxC,QAAQ;AACR,IAAI;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"derivedImpl.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.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 { BaseObservable } from './baseObservable.js';\nimport { BugIndicatingError, onBugIndicatingError } 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 derivedStateToString(state) {\n switch (state) {\n case 0 /* DerivedState.initial */: return 'initial';\n case 1 /* DerivedState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* DerivedState.stale */: return 'stale';\n case 3 /* DerivedState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass Derived extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _computeFn, _changeTracker, _handleLastObserverRemoved = undefined, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._computeFn = _computeFn;\n this._changeTracker = _changeTracker;\n this._handleLastObserverRemoved = _handleLastObserverRemoved;\n this._equalityComparator = _equalityComparator;\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n this._updateCount = 0;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._changeSummary = undefined;\n this._isUpdating = false;\n this._isComputing = false;\n this._didReportChange = false;\n this._isInBeforeUpdate = false;\n this._isReaderValid = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._removedObserverToCallEndUpdateOn = null;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n }\n onLastObserverRemoved() {\n /**\n * We are not tracking changes anymore, thus we have to assume\n * that our cache is invalid.\n */\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n getLogger()?.handleDerivedCleared(this);\n for (const d of this._dependencies) {\n d.removeObserver(this);\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n this._delayedStore = undefined;\n }\n this._handleLastObserverRemoved?.();\n }\n get() {\n const checkEnabled = false; // TODO set to true\n if (this._isComputing && checkEnabled) {\n // investigate why this fails in the diff editor!\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n if (this._observers.size === 0) {\n let result;\n // Without observers, we don't know when to clean up stuff.\n // Thus, we don't cache anything to prevent memory leaks.\n try {\n this._isReaderValid = true;\n let changeSummary = undefined;\n if (this._changeTracker) {\n changeSummary = this._changeTracker.createChangeSummary(undefined);\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n }\n result = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\n }\n // Clear new dependencies\n this.onLastObserverRemoved();\n return result;\n }\n else {\n do {\n // We might not get a notification for a dependency that changed while it is updating,\n // thus we also have to ask all our depedencies if they changed in this case.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n for (const d of this._dependencies) {\n /** might call {@link handleChange} indirectly, which could make us stale */\n d.reportChanges();\n if (this._state === 2 /* DerivedState.stale */) {\n // The other dependencies will refresh on demand, so early break\n break;\n }\n }\n }\n // We called report changes of all dependencies.\n // If we are still not stale, we can assume to be up to date again.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n this._state = 3 /* DerivedState.upToDate */;\n }\n if (this._state !== 3 /* DerivedState.upToDate */) {\n this._recompute();\n }\n // In case recomputation changed one of our dependencies, we need to recompute again.\n } while (this._state !== 3 /* DerivedState.upToDate */);\n return this._value;\n }\n }\n _recompute() {\n let didChange = false;\n this._isComputing = true;\n this._didReportChange = false;\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n try {\n const changeSummary = this._changeSummary;\n this._isReaderValid = true;\n if (this._changeTracker) {\n this._isInBeforeUpdate = true;\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._isInBeforeUpdate = false;\n this._changeSummary = this._changeTracker?.createChangeSummary(changeSummary);\n }\n const hadValue = this._state !== 0 /* DerivedState.initial */;\n const oldValue = this._value;\n this._state = 3 /* DerivedState.upToDate */;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n /** might call {@link handleChange} indirectly, which could invalidate us */\n this._value = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\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);\n }\n this._dependenciesToBeRemoved.clear();\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n didChange = this._didReportChange || (hadValue && !(this._equalityComparator(oldValue, this._value)));\n getLogger()?.handleObservableUpdated(this, {\n oldValue,\n newValue: this._value,\n change: undefined,\n didChange,\n hadValue,\n });\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n this._isComputing = false;\n if (!this._didReportChange && didChange) {\n for (const r of this._observers) {\n r.handleChange(this, undefined);\n }\n }\n else {\n this._didReportChange = false;\n }\n }\n toString() {\n return `LazyDerived<${this.debugName}>`;\n }\n // IObserver Implementation\n beginUpdate(_observable) {\n if (this._isUpdating) {\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n this._updateCount++;\n this._isUpdating = true;\n try {\n const propagateBeginUpdate = this._updateCount === 1;\n if (this._state === 3 /* DerivedState.upToDate */) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n // If we propagate begin update, that will already signal a possible change.\n if (!propagateBeginUpdate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n if (propagateBeginUpdate) {\n for (const r of this._observers) {\n r.beginUpdate(this); // This signals a possible change\n }\n }\n }\n finally {\n this._isUpdating = false;\n }\n }\n endUpdate(_observable) {\n this._updateCount--;\n if (this._updateCount === 0) {\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n if (this._removedObserverToCallEndUpdateOn) {\n const observers = [...this._removedObserverToCallEndUpdateOn];\n this._removedObserverToCallEndUpdateOn = null;\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n }\n handlePossibleChange(observable) {\n // In all other states, observers already know that we might have changed.\n if (this._state === 3 /* DerivedState.upToDate */ && this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable)) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n handleChange(observable, change) {\n if (this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable) || this._isInBeforeUpdate) {\n getLogger()?.handleDerivedDependencyChanged(this, observable, change);\n let shouldReact = false;\n try {\n shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n const wasUpToDate = this._state === 3 /* DerivedState.upToDate */;\n if (shouldReact && (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */ || wasUpToDate)) {\n this._state = 2 /* DerivedState.stale */;\n if (wasUpToDate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n }\n }\n // IReader Implementation\n _ensureReaderValid() {\n if (!this._isReaderValid) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureReaderValid();\n // Subscribe before getting the value to enable caching\n observable.addObserver(this);\n /** This might call {@link handleChange} indirectly, which could invalidate us */\n const value = observable.get();\n // Which is why we only add the observable to the dependencies now.\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n reportChange(change) {\n this._ensureReaderValid();\n this._didReportChange = true;\n // TODO add logging\n for (const r of this._observers) {\n r.handleChange(this, change);\n }\n }\n get store() {\n this._ensureReaderValid();\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureReaderValid();\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCount > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n if (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(observer)) {\n this._removedObserverToCallEndUpdateOn.delete(observer);\n }\n else {\n observer.beginUpdate(this);\n }\n }\n }\n removeObserver(observer) {\n if (this._observers.has(observer) && this._updateCount > 0) {\n if (!this._removedObserverToCallEndUpdateOn) {\n this._removedObserverToCallEndUpdateOn = new Set();\n }\n this._removedObserverToCallEndUpdateOn.add(observer);\n }\n super.removeObserver(observer);\n }\n debugGetState() {\n return {\n state: this._state,\n stateStr: derivedStateToString(this._state),\n updateCount: this._updateCount,\n isComputing: this._isComputing,\n dependencies: this._dependencies,\n value: this._value,\n };\n }\n debugSetValue(newValue) {\n this._value = newValue;\n }\n debugRecompute() {\n if (!this._isComputing) {\n this._recompute();\n }\n else {\n this._state = 2 /* DerivedState.stale */;\n }\n }\n setValue(newValue, tx, change) {\n this._value = newValue;\n const observers = this._observers;\n tx.updateObserver(this, this);\n for (const d of observers) {\n d.handleChange(this, change);\n }\n }\n}\nclass DerivedWithSetter extends Derived {\n constructor(debugNameData, computeFn, changeTracker, handleLastObserverRemoved = undefined, equalityComparator, set, debugLocation) {\n super(debugNameData, computeFn, changeTracker, handleLastObserverRemoved, equalityComparator, debugLocation);\n this.set = set;\n }\n}\n\nexport { Derived, DerivedWithSetter };\n//# sourceMappingURL=derivedImpl.js.map\n"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,QAAQ,KAAK;AACjB,QAAQ,KAAK,CAAC,6BAA6B,OAAO,SAAS;AAC3D,QAAQ,KAAK,CAAC,kDAAkD,OAAO,8BAA8B;AACrG,QAAQ,KAAK,CAAC,2BAA2B,OAAO,OAAO;AACvD,QAAQ,KAAK,CAAC,8BAA8B,OAAO,UAAU;AAC7D,QAAQ,SAAS,OAAO,WAAW;AACnC;AACA;AACA,MAAM,OAAO,SAAS,cAAc,CAAC;AACrC,IAAI,IAAI,SAAS,GAAG;AACpB,QAAQ,OAAO,IAA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14
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15
15
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
16
16
|
*--------------------------------------------------------------------------------------------*/
|
|
17
|
-
function
|
|
17
|
+
function observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {
|
|
18
|
+
let debugNameData;
|
|
18
19
|
if (typeof nameOrOwner === 'string') {
|
|
19
|
-
|
|
20
|
+
debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
|
-
|
|
23
|
+
debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);
|
|
23
24
|
}
|
|
24
|
-
}
|
|
25
|
-
function observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {
|
|
26
|
-
const debugNameData = toDebugNameData(nameOrOwner);
|
|
27
25
|
return new ObservableValue(debugNameData, initialValue, strictEquals, debugLocation);
|
|
28
26
|
}
|
|
29
27
|
class ObservableValue extends BaseObservable {
|
|
@@ -79,5 +77,5 @@ class ObservableValue extends BaseObservable {
|
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
export { ObservableValue, observableValue
|
|
80
|
+
export { ObservableValue, observableValue };
|
|
83
81
|
//# sourceMappingURL=observableValue.js.map
|
|
@@ -1 +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
|
|
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,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AC,MAAM;AACxC,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AACjC,YAAY,SAAS,EAAE,EAAE,uBAAuB,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC9H,YAAY,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;AACpD,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;;;;"}
|
|
@@ -33,7 +33,6 @@ class AutorunObserver {
|
|
|
33
33
|
this._dependencies = new Set();
|
|
34
34
|
this._dependenciesToBeRemoved = new Set();
|
|
35
35
|
this._isRunning = false;
|
|
36
|
-
this._iteration = 0;
|
|
37
36
|
this._store = undefined;
|
|
38
37
|
this._delayedStore = undefined;
|
|
39
38
|
this._changeSummary = this._changeTracker?.createChangeSummary(undefined);
|
|
@@ -111,7 +110,6 @@ class AutorunObserver {
|
|
|
111
110
|
// IObserver implementation
|
|
112
111
|
beginUpdate(_observable) {
|
|
113
112
|
if (this._state === 3 /* AutorunState.upToDate */) {
|
|
114
|
-
this._checkIterations();
|
|
115
113
|
this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;
|
|
116
114
|
}
|
|
117
115
|
this._updateCount++;
|
|
@@ -119,11 +117,7 @@ class AutorunObserver {
|
|
|
119
117
|
endUpdate(_observable) {
|
|
120
118
|
try {
|
|
121
119
|
if (this._updateCount === 1) {
|
|
122
|
-
this._iteration = 1;
|
|
123
120
|
do {
|
|
124
|
-
if (this._checkIterations()) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
121
|
if (this._state === 1 /* AutorunState.dependenciesMightHaveChanged */) {
|
|
128
122
|
this._state = 3 /* AutorunState.upToDate */;
|
|
129
123
|
for (const d of this._dependencies) {
|
|
@@ -134,7 +128,6 @@ class AutorunObserver {
|
|
|
134
128
|
}
|
|
135
129
|
}
|
|
136
130
|
}
|
|
137
|
-
this._iteration++;
|
|
138
131
|
if (this._state !== 3 /* AutorunState.upToDate */) {
|
|
139
132
|
this._run(); // Warning: indirect external call!
|
|
140
133
|
}
|
|
@@ -147,7 +140,6 @@ class AutorunObserver {
|
|
|
147
140
|
}
|
|
148
141
|
handlePossibleChange(observable) {
|
|
149
142
|
if (this._state === 3 /* AutorunState.upToDate */ && this._isDependency(observable)) {
|
|
150
|
-
this._checkIterations();
|
|
151
143
|
this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;
|
|
152
144
|
}
|
|
153
145
|
}
|
|
@@ -162,7 +154,6 @@ class AutorunObserver {
|
|
|
162
154
|
didChange: (o) => o === observable,
|
|
163
155
|
}, this._changeSummary) : true;
|
|
164
156
|
if (shouldReact) {
|
|
165
|
-
this._checkIterations();
|
|
166
157
|
this._state = 2 /* AutorunState.stale */;
|
|
167
158
|
}
|
|
168
159
|
}
|
|
@@ -229,13 +220,6 @@ class AutorunObserver {
|
|
|
229
220
|
this._state = 2 /* AutorunState.stale */;
|
|
230
221
|
}
|
|
231
222
|
}
|
|
232
|
-
_checkIterations() {
|
|
233
|
-
if (this._iteration > 100) {
|
|
234
|
-
onBugIndicatingError(new BugIndicatingError(`Autorun '${this.debugName}' is stuck in an infinite update loop.`));
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
223
|
}
|
|
240
224
|
|
|
241
225
|
export { AutorunObserver };
|
|
@@ -1 +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._iteration = 0;\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._checkIterations();\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n this._updateCount++;\n }\n endUpdate(_observable) {\n try {\n if (this._updateCount === 1) {\n this._iteration = 1;\n do {\n if (this._checkIterations()) {\n return;\n }\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 this._iteration++;\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._checkIterations();\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._checkIterations();\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 _checkIterations() {\n if (this._iteration > 100) {\n onBugIndicatingError(new BugIndicatingError(`Autorun '${this.debugName}' is stuck in an infinite update loop.`));\n return true;\n }\n return false;\n }\n}\n\nexport { AutorunObserver };\n//# sourceMappingURL=autorunImpl.js.map\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,QAAQ,KAAK;AACjB,QAAQ,KAAK,CAAC,kDAAkD,OAAO,8BAA8B;AACrG,QAAQ,KAAK,CAAC,2BAA2B,OAAO,OAAO;AACvD,QAAQ,KAAK,CAAC,8BAA8B,OAAO,UAAU;AAC7D,QAAQ,SAAS,OAAO,WAAW;AACnC;AACA;AACA,MAAM,eAAe,CAAC;AACtB,IAAI,IAAI,SAAS,GAAG;AACpB,QAAQ,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,aAAa;AACtE,IAAI;AACJ,IAAI,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE;AACvE,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc;AAC5C,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM;AAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc;AAC5C,QAAQ,IAAI,CAAC,MAAM,GAAG,CAAC;AACvB,QAAQ,IAAI,CAAC,YAAY,GAAG,CAAC;AAC7B,QAAQ,IAAI,CA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,OAAO,KAAK;AACpB,IAAI;AACJ;;;;"}
|
|
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;A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;AAC9B,YAAY,IAAI,CAAC,IAAI,EAAE;AACvB,QAAQ;AACR,aAAa;AACb,YAAY,IAAI,CAAC,MAAM,GAAG,CAAC;AAC3B,QAAQ;AACR,IAAI;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { DebugNameData } from '../debugName.js';
|
|
2
|
-
import { getLogger } from '../logging/logging.js';
|
|
3
|
-
import { DebugLocation } from '../debugLocation.js';
|
|
4
|
-
import { _getDebugHelperClass } from '../observables/baseObservable.js';
|
|
5
|
-
|
|
6
|
-
/*---------------------------------------------------------------------------------------------
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
9
|
-
*--------------------------------------------------------------------------------------------*/
|
|
10
|
-
|
|
11
|
-
/*---------------------------------------------------------------------------------------------
|
|
12
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
14
|
-
*--------------------------------------------------------------------------------------------*/
|
|
15
|
-
class ManualChangesHandler {
|
|
16
|
-
constructor(_run) {
|
|
17
|
-
this._run = _run;
|
|
18
|
-
this._changes = [];
|
|
19
|
-
this._updateCounter = 0;
|
|
20
|
-
}
|
|
21
|
-
beginUpdate(observable) {
|
|
22
|
-
this._updateCounter++;
|
|
23
|
-
this._changes.push(observable);
|
|
24
|
-
}
|
|
25
|
-
endUpdate(_observable) {
|
|
26
|
-
this._updateCounter--;
|
|
27
|
-
if (this._updateCounter === 0) {
|
|
28
|
-
if (this._changes.length > 0) {
|
|
29
|
-
const c = this._changes;
|
|
30
|
-
this._changes = [];
|
|
31
|
-
this._run(c);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
handlePossibleChange(observable) {
|
|
36
|
-
this._changes.push(observable);
|
|
37
|
-
}
|
|
38
|
-
handleChange(_observable, _change) {
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
class ManualObserver {
|
|
42
|
-
constructor(_run, debugName, debugLocation = DebugLocation.ofCaller()) {
|
|
43
|
-
this._run = _run;
|
|
44
|
-
this._dependencies = new Set();
|
|
45
|
-
this._disposed = false;
|
|
46
|
-
this.debugName = debugName ?? '(anonymous ManualObserver)';
|
|
47
|
-
this._debugNameData = new DebugNameData(undefined, this.debugName, undefined);
|
|
48
|
-
this._runFn = _run;
|
|
49
|
-
this._handler = new ManualChangesHandler(() => {
|
|
50
|
-
if (!this._disposed) {
|
|
51
|
-
this._run();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
getLogger()?.handleAutorunCreated(this, debugLocation);
|
|
55
|
-
}
|
|
56
|
-
get reader() {
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
readObservable(observable) {
|
|
60
|
-
observable.addObserver(this._handler);
|
|
61
|
-
const value = observable.get();
|
|
62
|
-
this._dependencies.add(observable);
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
getDependencies() {
|
|
66
|
-
return this._dependencies;
|
|
67
|
-
}
|
|
68
|
-
get debug() {
|
|
69
|
-
return new (_getDebugHelperClass())(this);
|
|
70
|
-
}
|
|
71
|
-
dispose() {
|
|
72
|
-
if (this._disposed) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
this._disposed = true;
|
|
76
|
-
for (const dep of this._dependencies) {
|
|
77
|
-
dep.removeObserver(this._handler);
|
|
78
|
-
}
|
|
79
|
-
this._dependencies.clear();
|
|
80
|
-
getLogger()?.handleAutorunDisposed(this);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export { ManualChangesHandler, ManualObserver };
|
|
85
|
-
//# sourceMappingURL=manualObserver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manualObserver.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/experimental/manualObserver.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 { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DebugLocation } from '../debugLocation.js';\nimport { _getDebugHelperClass } from '../observables/baseObservable.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 *--------------------------------------------------------------------------------------------*/\nclass ManualChangesHandler {\n constructor(_run) {\n this._run = _run;\n this._changes = [];\n this._updateCounter = 0;\n }\n beginUpdate(observable) {\n this._updateCounter++;\n this._changes.push(observable);\n }\n endUpdate(_observable) {\n this._updateCounter--;\n if (this._updateCounter === 0) {\n if (this._changes.length > 0) {\n const c = this._changes;\n this._changes = [];\n this._run(c);\n }\n }\n }\n handlePossibleChange(observable) {\n this._changes.push(observable);\n }\n handleChange(_observable, _change) {\n }\n}\nclass ManualObserver {\n constructor(_run, debugName, debugLocation = DebugLocation.ofCaller()) {\n this._run = _run;\n this._dependencies = new Set();\n this._disposed = false;\n this.debugName = debugName ?? '(anonymous ManualObserver)';\n this._debugNameData = new DebugNameData(undefined, this.debugName, undefined);\n this._runFn = _run;\n this._handler = new ManualChangesHandler(() => {\n if (!this._disposed) {\n this._run();\n }\n });\n getLogger()?.handleAutorunCreated(this, debugLocation);\n }\n get reader() {\n return this;\n }\n readObservable(observable) {\n observable.addObserver(this._handler);\n const value = observable.get();\n this._dependencies.add(observable);\n return value;\n }\n getDependencies() {\n return this._dependencies;\n }\n get debug() {\n return new (_getDebugHelperClass())(this);\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n for (const dep of this._dependencies) {\n dep.removeObserver(this._handler);\n }\n this._dependencies.clear();\n getLogger()?.handleAutorunDisposed(this);\n }\n}\n\nexport { ManualChangesHandler, ManualObserver };\n//# sourceMappingURL=manualObserver.js.map\n"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