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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/browserPage.js +4 -2
  2. package/dist/browserPage.js.map +1 -1
  3. package/dist/commands/acceptCommand.d.ts +1 -0
  4. package/dist/commands/acceptCommand.d.ts.map +1 -1
  5. package/dist/commands/acceptCommand.js +8 -2
  6. package/dist/commands/acceptCommand.js.map +1 -1
  7. package/dist/commands/compareCommand.d.ts +1 -0
  8. package/dist/commands/compareCommand.d.ts.map +1 -1
  9. package/dist/commands/compareCommand.js +8 -2
  10. package/dist/commands/compareCommand.js.map +1 -1
  11. package/dist/commands/screenshotCommand.d.ts +1 -0
  12. package/dist/commands/screenshotCommand.d.ts.map +1 -1
  13. package/dist/commands/screenshotCommand.js +10 -4
  14. package/dist/commands/screenshotCommand.js.map +1 -1
  15. package/dist/commands/watchCommand.d.ts +1 -0
  16. package/dist/commands/watchCommand.d.ts.map +1 -1
  17. package/dist/commands/watchCommand.js +17 -8
  18. package/dist/commands/watchCommand.js.map +1 -1
  19. package/dist/componentExplorer.js +5 -2
  20. package/dist/componentExplorer.js.map +1 -1
  21. package/dist/dependencyInstaller.js +7 -4
  22. package/dist/dependencyInstaller.js.map +1 -1
  23. package/dist/explorerSession.js +6 -3
  24. package/dist/explorerSession.js.map +1 -1
  25. package/dist/external/vscode-observables/observables/dist/disposables.js +43 -0
  26. package/dist/external/vscode-observables/observables/dist/disposables.js.map +1 -0
  27. package/dist/external/vscode-observables/observables/dist/observableInternal/base.js +22 -0
  28. package/dist/external/vscode-observables/observables/dist/observableInternal/base.js.map +1 -0
  29. package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js +40 -0
  30. package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js.map +1 -0
  31. package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js +74 -0
  32. package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js.map +1 -0
  33. package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js +114 -0
  34. package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js.map +1 -0
  35. package/dist/external/vscode-observables/observables/dist/observableInternal/index.js +25 -0
  36. package/dist/external/vscode-observables/observables/dist/observableInternal/index.js.map +1 -0
  37. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js +332 -0
  38. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js.map +1 -0
  39. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js +79 -0
  40. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js.map +1 -0
  41. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js +72 -0
  42. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js.map +1 -0
  43. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/devToolsLogger.js +447 -0
  44. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/devToolsLogger.js.map +1 -0
  45. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/rpc.js +64 -0
  46. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/rpc.js.map +1 -0
  47. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/utils.js +52 -0
  48. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/utils.js.map +1 -0
  49. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js +100 -0
  50. package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js.map +1 -0
  51. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js +143 -0
  52. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +1 -0
  53. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js +17 -0
  54. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js.map +1 -0
  55. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js +362 -0
  56. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js.map +1 -0
  57. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js +123 -0
  58. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js.map +1 -0
  59. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js +81 -0
  60. package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js.map +1 -0
  61. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js +23 -0
  62. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js.map +1 -0
  63. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js +226 -0
  64. package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js.map +1 -0
  65. package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js +87 -0
  66. package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js.map +1 -0
  67. package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js +68 -0
  68. package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js.map +1 -0
  69. package/dist/git/gitCommitId.js +4 -2
  70. package/dist/git/gitCommitId.js.map +1 -1
  71. package/dist/git/gitCommitResolver.js +11 -3
  72. package/dist/git/gitCommitResolver.js.map +1 -1
  73. package/dist/git/gitService.js +5 -2
  74. package/dist/git/gitService.js.map +1 -1
  75. package/dist/git/gitUtils.js +9 -6
  76. package/dist/git/gitUtils.js.map +1 -1
  77. package/dist/git/gitWorktreeManager.js +5 -2
  78. package/dist/git/gitWorktreeManager.js.map +1 -1
  79. package/dist/httpServer.d.ts +3 -2
  80. package/dist/httpServer.d.ts.map +1 -1
  81. package/dist/httpServer.js +27 -10
  82. package/dist/httpServer.js.map +1 -1
  83. package/dist/index.js +2 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/logger.d.ts +17 -1
  86. package/dist/logger.d.ts.map +1 -1
  87. package/dist/logger.js +43 -6
  88. package/dist/logger.js.map +1 -1
  89. package/dist/screenshotCache.js +7 -4
  90. package/dist/screenshotCache.js.map +1 -1
  91. package/dist/sourceTreeId.js +4 -2
  92. package/dist/sourceTreeId.js.map +1 -1
  93. package/dist/storage.js +5 -2
  94. package/dist/storage.js.map +1 -1
  95. package/dist/viteProjectRef.js +5 -2
  96. package/dist/viteProjectRef.js.map +1 -1
  97. package/dist/watchConfig.js +8 -5
  98. package/dist/watchConfig.js.map +1 -1
  99. package/package.json +7 -4
@@ -0,0 +1,40 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+ function toDisposable(fn) {
10
+ return {
11
+ dispose: fn
12
+ };
13
+ }
14
+ class BugIndicatingError extends Error {
15
+ constructor(message) {
16
+ super(message || 'An unexpected bug occurred.');
17
+ Object.setPrototypeOf(this, BugIndicatingError.prototype);
18
+ // Because we know for sure only buggy code throws this,
19
+ // we definitely want to break here and fix the bug.
20
+ // eslint-disable-next-line no-debugger
21
+ // debugger;
22
+ }
23
+ }
24
+ function onBugIndicatingError(error) {
25
+ // debugger;
26
+ throw error;
27
+ }
28
+ function onUnexpectedError(error) {
29
+ console.error('Unexpected error:', error);
30
+ }
31
+ /**
32
+ * Compares two items for equality using strict equality.
33
+ */
34
+ const strictEquals = (a, b) => a === b;
35
+ function isDefined(arg) {
36
+ return arg !== undefined && arg !== null;
37
+ }
38
+
39
+ export { BugIndicatingError, isDefined, onBugIndicatingError, onUnexpectedError, strictEquals, toDisposable };
40
+ //# sourceMappingURL=deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.js","sources":["../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.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 *--------------------------------------------------------------------------------------------*/\nfunction toDisposable(fn) {\n return {\n dispose: fn\n };\n}\nclass BugIndicatingError extends Error {\n constructor(message) {\n super(message || 'An unexpected bug occurred.');\n Object.setPrototypeOf(this, BugIndicatingError.prototype);\n // Because we know for sure only buggy code throws this,\n // we definitely want to break here and fix the bug.\n // eslint-disable-next-line no-debugger\n // debugger;\n }\n}\nfunction onBugIndicatingError(error) {\n // debugger;\n throw error;\n}\nfunction onUnexpectedError(error) {\n console.error('Unexpected error:', error);\n}\n/**\n * Compares two items for equality using strict equality.\n*/\nconst strictEquals = (a, b) => a === b;\nfunction isDefined(arg) {\n return arg !== undefined && arg !== null;\n}\n\nexport { BugIndicatingError, isDefined, onBugIndicatingError, onUnexpectedError, strictEquals, toDisposable };\n//# sourceMappingURL=deps.js.map\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,YAAY,CAAC,EAAE,EAAE;AAC1B,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE;AACjB,KAAK;AACL;AACA,MAAM,kBAAkB,SAAS,KAAK,CAAC;AACvC,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,KAAK,CAAC,OAAO,IAAI,6BAA6B,CAAC;AACvD,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC;AACjE;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC;AACA,IAAI,MAAM,KAAK;AACf;AACA,SAAS,iBAAiB,CAAC,KAAK,EAAE;AAClC,IAAI,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC;AAC7C;AACA;AACA;AACA;AACK,MAAC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK;AACrC,SAAS,SAAS,CAAC,GAAG,EAAE;AACxB,IAAI,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;AAC5C;;;;"}
@@ -0,0 +1,74 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+ var DebugLocation;
10
+ (function (DebugLocation) {
11
+ let enabled = false;
12
+ function enable() {
13
+ enabled = true;
14
+ }
15
+ DebugLocation.enable = enable;
16
+ function ofCaller() {
17
+ return ofNthCaller(1);
18
+ }
19
+ DebugLocation.ofCaller = ofCaller;
20
+ function ofNthCaller(n) {
21
+ if (!enabled) {
22
+ return undefined;
23
+ }
24
+ const Err = Error; // For the monaco editor checks, which don't have the nodejs types.
25
+ const l = Err.stackTraceLimit;
26
+ Err.stackTraceLimit = 3;
27
+ const stack = new Error().stack;
28
+ Err.stackTraceLimit = l;
29
+ return DebugLocationImpl.fromStack(stack, n + 1);
30
+ }
31
+ DebugLocation.ofNthCaller = ofNthCaller;
32
+ })(DebugLocation || (DebugLocation = {}));
33
+ class DebugLocationImpl {
34
+ static fromStack(stack, parentIdx) {
35
+ const lines = stack.split('\n');
36
+ const location = parseLine(lines[parentIdx + 1]);
37
+ if (location) {
38
+ return new DebugLocationImpl(location.fileName, location.line, location.column, location.id);
39
+ }
40
+ else {
41
+ return undefined;
42
+ }
43
+ }
44
+ constructor(fileName, line, column, id) {
45
+ this.fileName = fileName;
46
+ this.line = line;
47
+ this.column = column;
48
+ this.id = id;
49
+ }
50
+ }
51
+ function parseLine(stackLine) {
52
+ const match = stackLine.match(/\((.*):(\d+):(\d+)\)/);
53
+ if (match) {
54
+ return {
55
+ fileName: match[1],
56
+ line: parseInt(match[2]),
57
+ column: parseInt(match[3]),
58
+ id: stackLine,
59
+ };
60
+ }
61
+ const match2 = stackLine.match(/at ([^\(\)]*):(\d+):(\d+)/);
62
+ if (match2) {
63
+ return {
64
+ fileName: match2[1],
65
+ line: parseInt(match2[2]),
66
+ column: parseInt(match2[3]),
67
+ id: stackLine,
68
+ };
69
+ }
70
+ return undefined;
71
+ }
72
+
73
+ export { DebugLocation };
74
+ //# sourceMappingURL=debugLocation.js.map
@@ -0,0 +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 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 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,IAAI,aAAa,CAAC,QAAQ,GAAG,QAAQ;AACrC,IAAI,SAAS,WAAW,CAAC,CAAC,EAAE;AAC5B,QAAQ,IAAI,CAAC,OAAO,EAAE;AACtB,YAAY,OAAO,SAAS;AAC5B,QAAQ;AACR,QAAQ,MAAM,GAAG,GAAG,KAAK,CAAC;AAC1B,QAAQ,MAAM,CAAC,GAAG,GAAG,CAAC,eAAe;AACrC,QAAQ,GAAG,CAAC,eAAe,GAA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,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;;;;"}
@@ -0,0 +1,114 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+ class DebugNameData {
10
+ constructor(owner, debugNameSource, referenceFn) {
11
+ this.owner = owner;
12
+ this.debugNameSource = debugNameSource;
13
+ this.referenceFn = referenceFn;
14
+ }
15
+ getDebugName(target) {
16
+ return getDebugName(target, this);
17
+ }
18
+ }
19
+ const countPerName = new Map();
20
+ const cachedDebugName = new WeakMap();
21
+ function getDebugName(target, data) {
22
+ const cached = cachedDebugName.get(target);
23
+ if (cached) {
24
+ return cached;
25
+ }
26
+ const dbgName = computeDebugName(target, data);
27
+ if (dbgName) {
28
+ let count = countPerName.get(dbgName) ?? 0;
29
+ count++;
30
+ countPerName.set(dbgName, count);
31
+ const result = count === 1 ? dbgName : `${dbgName}#${count}`;
32
+ cachedDebugName.set(target, result);
33
+ return result;
34
+ }
35
+ return undefined;
36
+ }
37
+ function computeDebugName(self, data) {
38
+ const cached = cachedDebugName.get(self);
39
+ if (cached) {
40
+ return cached;
41
+ }
42
+ const ownerStr = data.owner ? formatOwner(data.owner) + `.` : '';
43
+ let result;
44
+ const debugNameSource = data.debugNameSource;
45
+ if (debugNameSource !== undefined) {
46
+ if (typeof debugNameSource === 'function') {
47
+ result = debugNameSource();
48
+ if (result !== undefined) {
49
+ return ownerStr + result;
50
+ }
51
+ }
52
+ else {
53
+ return ownerStr + debugNameSource;
54
+ }
55
+ }
56
+ const referenceFn = data.referenceFn;
57
+ if (referenceFn !== undefined) {
58
+ result = getFunctionName(referenceFn);
59
+ if (result !== undefined) {
60
+ return ownerStr + result;
61
+ }
62
+ }
63
+ if (data.owner !== undefined) {
64
+ const key = findKey(data.owner, self);
65
+ if (key !== undefined) {
66
+ return ownerStr + key;
67
+ }
68
+ }
69
+ return undefined;
70
+ }
71
+ function findKey(obj, value) {
72
+ for (const key in obj) {
73
+ if (obj[key] === value) {
74
+ return key;
75
+ }
76
+ }
77
+ return undefined;
78
+ }
79
+ const countPerClassName = new Map();
80
+ const ownerId = new WeakMap();
81
+ function formatOwner(owner) {
82
+ const id = ownerId.get(owner);
83
+ if (id) {
84
+ return id;
85
+ }
86
+ const className = getClassName(owner) ?? 'Object';
87
+ let count = countPerClassName.get(className) ?? 0;
88
+ count++;
89
+ countPerClassName.set(className, count);
90
+ const result = count === 1 ? className : `${className}#${count}`;
91
+ ownerId.set(owner, result);
92
+ return result;
93
+ }
94
+ function getClassName(obj) {
95
+ const ctor = obj.constructor;
96
+ if (ctor) {
97
+ if (ctor.name === 'Object') {
98
+ return undefined;
99
+ }
100
+ return ctor.name;
101
+ }
102
+ return undefined;
103
+ }
104
+ function getFunctionName(fn) {
105
+ const fnSrc = fn.toString();
106
+ // Pattern: /** @description ... */
107
+ const regexp = /\/\*\*\s*@description\s*([^*]*)\*\//;
108
+ const match = regexp.exec(fnSrc);
109
+ const result = match ? match[1] : undefined;
110
+ return result?.trim();
111
+ }
112
+
113
+ export { DebugNameData, getClassName, getDebugName, getFunctionName };
114
+ //# sourceMappingURL=debugName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugName.js","sources":["../../../../../../../../external/vscode-observables/observables/dist/observableInternal/debugName.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 *--------------------------------------------------------------------------------------------*/\nclass DebugNameData {\n constructor(owner, debugNameSource, referenceFn) {\n this.owner = owner;\n this.debugNameSource = debugNameSource;\n this.referenceFn = referenceFn;\n }\n getDebugName(target) {\n return getDebugName(target, this);\n }\n}\nconst countPerName = new Map();\nconst cachedDebugName = new WeakMap();\nfunction getDebugName(target, data) {\n const cached = cachedDebugName.get(target);\n if (cached) {\n return cached;\n }\n const dbgName = computeDebugName(target, data);\n if (dbgName) {\n let count = countPerName.get(dbgName) ?? 0;\n count++;\n countPerName.set(dbgName, count);\n const result = count === 1 ? dbgName : `${dbgName}#${count}`;\n cachedDebugName.set(target, result);\n return result;\n }\n return undefined;\n}\nfunction computeDebugName(self, data) {\n const cached = cachedDebugName.get(self);\n if (cached) {\n return cached;\n }\n const ownerStr = data.owner ? formatOwner(data.owner) + `.` : '';\n let result;\n const debugNameSource = data.debugNameSource;\n if (debugNameSource !== undefined) {\n if (typeof debugNameSource === 'function') {\n result = debugNameSource();\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n else {\n return ownerStr + debugNameSource;\n }\n }\n const referenceFn = data.referenceFn;\n if (referenceFn !== undefined) {\n result = getFunctionName(referenceFn);\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n if (data.owner !== undefined) {\n const key = findKey(data.owner, self);\n if (key !== undefined) {\n return ownerStr + key;\n }\n }\n return undefined;\n}\nfunction findKey(obj, value) {\n for (const key in obj) {\n if (obj[key] === value) {\n return key;\n }\n }\n return undefined;\n}\nconst countPerClassName = new Map();\nconst ownerId = new WeakMap();\nfunction formatOwner(owner) {\n const id = ownerId.get(owner);\n if (id) {\n return id;\n }\n const className = getClassName(owner) ?? 'Object';\n let count = countPerClassName.get(className) ?? 0;\n count++;\n countPerClassName.set(className, count);\n const result = count === 1 ? className : `${className}#${count}`;\n ownerId.set(owner, result);\n return result;\n}\nfunction getClassName(obj) {\n const ctor = obj.constructor;\n if (ctor) {\n if (ctor.name === 'Object') {\n return undefined;\n }\n return ctor.name;\n }\n return undefined;\n}\nfunction getFunctionName(fn) {\n const fnSrc = fn.toString();\n // Pattern: /** @description ... */\n const regexp = /\\/\\*\\*\\s*@description\\s*([^*]*)\\*\\//;\n const match = regexp.exec(fnSrc);\n const result = match ? match[1] : undefined;\n return result?.trim();\n}\n\nexport { DebugNameData, getClassName, getDebugName, getFunctionName };\n//# sourceMappingURL=debugName.js.map\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,CAAC;AACpB,IAAI,WAAW,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE;AACrD,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,eAAe,GAAG,eAAe;AAC9C,QAAQ,IAAI,CAAC,WAAW,GAAG,WAAW;AACtC,IAAI;AACJ,IAAI,YAAY,CAAC,MAAM,EAAE;AACzB,QAAQ,OAAO,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;AACzC,IAAI;AACJ;AACA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE;AAC9B,MAAM,eAAe,GAA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K,CAAC,IAAI,QAAQ;AACrD,IAAI,IAAI,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;AACrD,IAAI,KAAK,EAAE;AACX,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC;AAC3C,IAAI,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACpE,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC;AAC9B,IAAI,OAAO,MAAM;AACjB;AACA,SAAS,YAAY,CAAC,GAAG,EAAE;AAC3B,IAAI,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW;AAChC,IAAI,IAAI,IAAI,EAAE;AACd,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;AACpC,YAAY,OAAO,SAAS;AAC5B,QAAQ;AACR,QAAQ,OAAO,IAAI,CAAC,IAAI;AACxB,IAAI;AACJ,IAAI,OAAO,SAAS;AACpB;AACA,SAAS,eAAe,CAAC,EAAE,EAAE;AAC7B,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE;AAC/B;AACA,IAAI,MAAM,MAAM,GAAG,qCAAqC;AACxD,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;AACpC,IAAI,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS;AAC/C,IAAI,OAAO,MAAM,EAAE,IAAI,EAAE;AACzB;;;;"}
@@ -0,0 +1,25 @@
1
+ import { addLogger, setLogObservableFn } from './logging/logging.js';
2
+ import { _setDebugGetDependencyGraph } from './observables/baseObservable.js';
3
+ export { DebugLocation } from './debugLocation.js';
4
+ export { derivedOpts } from './observables/derived.js';
5
+ export { keepObserved, recomputeInitiallyAndOnChange } from './utils/utils.js';
6
+ export { observableFromEvent } from './observables/observableFromEvent.js';
7
+ import { logObservableToConsole } from './logging/consoleObservableLogger.js';
8
+ import { DevToolsLogger } from './logging/debugger/devToolsLogger.js';
9
+ import { debugGetDependencyGraph } from './logging/debugGetDependencyGraph.js';
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
+
16
+ /*---------------------------------------------------------------------------------------------
17
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18
+ * Licensed under the MIT License. See License.txt in the project root for license information.
19
+ *--------------------------------------------------------------------------------------------*/
20
+ // This is a facade for the observable implementation. Only import from here!
21
+ _setDebugGetDependencyGraph(debugGetDependencyGraph);
22
+ setLogObservableFn(logObservableToConsole);
23
+ // To debug observables you also need the extension "ms-vscode.debug-value-editor"
24
+ addLogger(DevToolsLogger.getInstance());
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 { addLogger, 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 { DevToolsLogger } from './logging/debugger/devToolsLogger.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// To debug observables you also need the extension \"ms-vscode.debug-value-editor\"\naddLogger(DevToolsLogger.getInstance());\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA,2BAA2B,CAAC,uBAAuB,CAAC;AACpD,kBAAkB,CAAC,sBAAsB,CAAC;AAC1C;AACA,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC"}
@@ -0,0 +1,332 @@
1
+ import { addLogger } from './logging.js';
2
+ import { getClassName } from '../debugName.js';
3
+ import { Derived } from '../observables/derivedImpl.js';
4
+
5
+ /*---------------------------------------------------------------------------------------------
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License. See License.txt in the project root for license information.
8
+ *--------------------------------------------------------------------------------------------*/
9
+
10
+ /*---------------------------------------------------------------------------------------------
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License. See License.txt in the project root for license information.
13
+ *--------------------------------------------------------------------------------------------*/
14
+ let consoleObservableLogger;
15
+ function logObservableToConsole(obs) {
16
+ if (!consoleObservableLogger) {
17
+ consoleObservableLogger = new ConsoleObservableLogger();
18
+ addLogger(consoleObservableLogger);
19
+ }
20
+ consoleObservableLogger.addFilteredObj(obs);
21
+ }
22
+ class ConsoleObservableLogger {
23
+ constructor() {
24
+ this.indentation = 0;
25
+ this.changedObservablesSets = new WeakMap();
26
+ }
27
+ addFilteredObj(obj) {
28
+ if (!this._filteredObjects) {
29
+ this._filteredObjects = new Set();
30
+ }
31
+ this._filteredObjects.add(obj);
32
+ }
33
+ _isIncluded(obj) {
34
+ return this._filteredObjects?.has(obj) ?? true;
35
+ }
36
+ textToConsoleArgs(text) {
37
+ return consoleTextToArgs([
38
+ normalText(repeat('| ', this.indentation)),
39
+ text,
40
+ ]);
41
+ }
42
+ formatInfo(info) {
43
+ if (!info.hadValue) {
44
+ return [
45
+ normalText(` `),
46
+ styled(formatValue(info.newValue, 60), {
47
+ color: 'green',
48
+ }),
49
+ normalText(` (initial)`),
50
+ ];
51
+ }
52
+ return info.didChange
53
+ ? [
54
+ normalText(` `),
55
+ styled(formatValue(info.oldValue, 70), {
56
+ color: 'red',
57
+ strikeThrough: true,
58
+ }),
59
+ normalText(` `),
60
+ styled(formatValue(info.newValue, 60), {
61
+ color: 'green',
62
+ }),
63
+ ]
64
+ : [normalText(` (unchanged)`)];
65
+ }
66
+ handleObservableCreated(observable) {
67
+ if (observable instanceof Derived) {
68
+ const derived = observable;
69
+ this.changedObservablesSets.set(derived, new Set());
70
+ }
71
+ }
72
+ handleOnListenerCountChanged(observable, newCount) {
73
+ }
74
+ handleObservableUpdated(observable, info) {
75
+ if (!this._isIncluded(observable)) {
76
+ return;
77
+ }
78
+ if (observable instanceof Derived) {
79
+ this._handleDerivedRecomputed(observable, info);
80
+ return;
81
+ }
82
+ console.log(...this.textToConsoleArgs([
83
+ formatKind('observable value changed'),
84
+ styled(observable.debugName, { color: 'BlueViolet' }),
85
+ ...this.formatInfo(info),
86
+ ]));
87
+ }
88
+ formatChanges(changes) {
89
+ if (changes.size === 0) {
90
+ return undefined;
91
+ }
92
+ return styled(' (changed deps: ' +
93
+ [...changes].map((o) => o.debugName).join(', ') +
94
+ ')', { color: 'gray' });
95
+ }
96
+ handleDerivedDependencyChanged(derived, observable, change) {
97
+ if (!this._isIncluded(derived)) {
98
+ return;
99
+ }
100
+ this.changedObservablesSets.get(derived)?.add(observable);
101
+ }
102
+ _handleDerivedRecomputed(derived, info) {
103
+ if (!this._isIncluded(derived)) {
104
+ return;
105
+ }
106
+ const changedObservables = this.changedObservablesSets.get(derived);
107
+ if (!changedObservables) {
108
+ return;
109
+ }
110
+ console.log(...this.textToConsoleArgs([
111
+ formatKind('derived recomputed'),
112
+ styled(derived.debugName, { color: 'BlueViolet' }),
113
+ ...this.formatInfo(info),
114
+ this.formatChanges(changedObservables),
115
+ { data: [{ fn: derived._debugNameData.referenceFn ?? derived._computeFn }] }
116
+ ]));
117
+ changedObservables.clear();
118
+ }
119
+ handleDerivedCleared(derived) {
120
+ if (!this._isIncluded(derived)) {
121
+ return;
122
+ }
123
+ console.log(...this.textToConsoleArgs([
124
+ formatKind('derived cleared'),
125
+ styled(derived.debugName, { color: 'BlueViolet' }),
126
+ ]));
127
+ }
128
+ handleFromEventObservableTriggered(observable, info) {
129
+ if (!this._isIncluded(observable)) {
130
+ return;
131
+ }
132
+ console.log(...this.textToConsoleArgs([
133
+ formatKind('observable from event triggered'),
134
+ styled(observable.debugName, { color: 'BlueViolet' }),
135
+ ...this.formatInfo(info),
136
+ { data: [{ fn: observable._getValue }] }
137
+ ]));
138
+ }
139
+ handleAutorunCreated(autorun) {
140
+ if (!this._isIncluded(autorun)) {
141
+ return;
142
+ }
143
+ this.changedObservablesSets.set(autorun, new Set());
144
+ }
145
+ handleAutorunDisposed(autorun) {
146
+ }
147
+ handleAutorunDependencyChanged(autorun, observable, change) {
148
+ if (!this._isIncluded(autorun)) {
149
+ return;
150
+ }
151
+ this.changedObservablesSets.get(autorun).add(observable);
152
+ }
153
+ handleAutorunStarted(autorun) {
154
+ const changedObservables = this.changedObservablesSets.get(autorun);
155
+ if (!changedObservables) {
156
+ return;
157
+ }
158
+ if (this._isIncluded(autorun)) {
159
+ console.log(...this.textToConsoleArgs([
160
+ formatKind('autorun'),
161
+ styled(autorun.debugName, { color: 'BlueViolet' }),
162
+ this.formatChanges(changedObservables),
163
+ { data: [{ fn: autorun._debugNameData.referenceFn ?? autorun._runFn }] }
164
+ ]));
165
+ }
166
+ changedObservables.clear();
167
+ this.indentation++;
168
+ }
169
+ handleAutorunFinished(autorun) {
170
+ this.indentation--;
171
+ }
172
+ handleBeginTransaction(transaction) {
173
+ let transactionName = transaction.getDebugName();
174
+ if (transactionName === undefined) {
175
+ transactionName = '';
176
+ }
177
+ if (this._isIncluded(transaction)) {
178
+ console.log(...this.textToConsoleArgs([
179
+ formatKind('transaction'),
180
+ styled(transactionName, { color: 'BlueViolet' }),
181
+ { data: [{ fn: transaction._fn }] }
182
+ ]));
183
+ }
184
+ this.indentation++;
185
+ }
186
+ handleEndTransaction() {
187
+ this.indentation--;
188
+ }
189
+ }
190
+ function consoleTextToArgs(text) {
191
+ const styles = new Array();
192
+ const data = [];
193
+ let firstArg = '';
194
+ function process(t) {
195
+ if ('length' in t) {
196
+ for (const item of t) {
197
+ if (item) {
198
+ process(item);
199
+ }
200
+ }
201
+ }
202
+ else if ('text' in t) {
203
+ firstArg += `%c${t.text}`;
204
+ styles.push(t.style);
205
+ if (t.data) {
206
+ data.push(...t.data);
207
+ }
208
+ }
209
+ else if ('data' in t) {
210
+ data.push(...t.data);
211
+ }
212
+ }
213
+ process(text);
214
+ const result = [firstArg, ...styles];
215
+ result.push(...data);
216
+ return result;
217
+ }
218
+ function normalText(text) {
219
+ return styled(text, { color: 'black' });
220
+ }
221
+ function formatKind(kind) {
222
+ return styled(padStr(`${kind}: `, 10), { color: 'black', bold: true });
223
+ }
224
+ function styled(text, options = {
225
+ color: 'black',
226
+ }) {
227
+ function objToCss(styleObj) {
228
+ return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {
229
+ return `${styleString}${propName}:${propValue};`;
230
+ }, '');
231
+ }
232
+ const style = {
233
+ color: options.color,
234
+ };
235
+ if (options.strikeThrough) {
236
+ style['text-decoration'] = 'line-through';
237
+ }
238
+ if (options.bold) {
239
+ style['font-weight'] = 'bold';
240
+ }
241
+ return {
242
+ text,
243
+ style: objToCss(style),
244
+ };
245
+ }
246
+ function formatValue(value, availableLen) {
247
+ switch (typeof value) {
248
+ case 'number':
249
+ return '' + value;
250
+ case 'string':
251
+ if (value.length + 2 <= availableLen) {
252
+ return `"${value}"`;
253
+ }
254
+ return `"${value.substr(0, availableLen - 7)}"+...`;
255
+ case 'boolean':
256
+ return value ? 'true' : 'false';
257
+ case 'undefined':
258
+ return 'undefined';
259
+ case 'object':
260
+ if (value === null) {
261
+ return 'null';
262
+ }
263
+ if (Array.isArray(value)) {
264
+ return formatArray(value, availableLen);
265
+ }
266
+ return formatObject(value, availableLen);
267
+ case 'symbol':
268
+ return value.toString();
269
+ case 'function':
270
+ return `[[Function${value.name ? ' ' + value.name : ''}]]`;
271
+ default:
272
+ return '' + value;
273
+ }
274
+ }
275
+ function formatArray(value, availableLen) {
276
+ let result = '[ ';
277
+ let first = true;
278
+ for (const val of value) {
279
+ if (!first) {
280
+ result += ', ';
281
+ }
282
+ if (result.length - 5 > availableLen) {
283
+ result += '...';
284
+ break;
285
+ }
286
+ first = false;
287
+ result += `${formatValue(val, availableLen - result.length)}`;
288
+ }
289
+ result += ' ]';
290
+ return result;
291
+ }
292
+ function formatObject(value, availableLen) {
293
+ if (typeof value.toString === 'function' && value.toString !== Object.prototype.toString) {
294
+ const val = value.toString();
295
+ if (val.length <= availableLen) {
296
+ return val;
297
+ }
298
+ return val.substring(0, availableLen - 3) + '...';
299
+ }
300
+ const className = getClassName(value);
301
+ let result = className ? className + '(' : '{ ';
302
+ let first = true;
303
+ for (const [key, val] of Object.entries(value)) {
304
+ if (!first) {
305
+ result += ', ';
306
+ }
307
+ if (result.length - 5 > availableLen) {
308
+ result += '...';
309
+ break;
310
+ }
311
+ first = false;
312
+ result += `${key}: ${formatValue(val, availableLen - result.length)}`;
313
+ }
314
+ result += className ? ')' : ' }';
315
+ return result;
316
+ }
317
+ function repeat(str, count) {
318
+ let result = '';
319
+ for (let i = 1; i <= count; i++) {
320
+ result += str;
321
+ }
322
+ return result;
323
+ }
324
+ function padStr(str, length) {
325
+ while (str.length < length) {
326
+ str += ' ';
327
+ }
328
+ return str;
329
+ }
330
+
331
+ export { ConsoleObservableLogger, formatValue, logObservableToConsole };
332
+ //# sourceMappingURL=consoleObservableLogger.js.map