@lvce-editor/extension-host-worker 5.13.0 → 5.15.0

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.
@@ -1,6 +1,6 @@
1
1
  const Property = 1;
2
2
  const Value = 2;
3
- const Function = 3;
3
+ const Function$1 = 3;
4
4
  const Variable = 4;
5
5
  const Keyword = 5;
6
6
  const Folder = 6;
@@ -12,7 +12,7 @@ const EditorCompletionType = {
12
12
  Field,
13
13
  File: File$4,
14
14
  Folder,
15
- Function,
15
+ Function: Function$1,
16
16
  Keyword,
17
17
  Property,
18
18
  Value,
@@ -51,55 +51,63 @@ class AssertionError extends Error {
51
51
  this.name = 'AssertionError';
52
52
  }
53
53
  }
54
+ const Object$1$1 = 1;
55
+ const Number$1 = 2;
56
+ const Array$1$1 = 3;
57
+ const String$2 = 4;
58
+ const Boolean$2 = 5;
59
+ const Function = 6;
60
+ const Null = 7;
61
+ const Unknown = 8;
54
62
  const getType$1 = value => {
55
63
  switch (typeof value) {
56
64
  case 'number':
57
- return 'number';
65
+ return Number$1;
58
66
  case 'function':
59
- return 'function';
67
+ return Function;
60
68
  case 'string':
61
- return 'string';
69
+ return String$2;
62
70
  case 'object':
63
71
  if (value === null) {
64
- return 'null';
72
+ return Null;
65
73
  }
66
74
  if (Array.isArray(value)) {
67
- return 'array';
75
+ return Array$1$1;
68
76
  }
69
- return 'object';
77
+ return Object$1$1;
70
78
  case 'boolean':
71
- return 'boolean';
79
+ return Boolean$2;
72
80
  default:
73
- return 'unknown';
81
+ return Unknown;
74
82
  }
75
83
  };
76
84
  const object = value => {
77
85
  const type = getType$1(value);
78
- if (type !== 'object') {
86
+ if (type !== Object$1$1) {
79
87
  throw new AssertionError('expected value to be of type object');
80
88
  }
81
89
  };
82
90
  const number = value => {
83
91
  const type = getType$1(value);
84
- if (type !== 'number') {
92
+ if (type !== Number$1) {
85
93
  throw new AssertionError('expected value to be of type number');
86
94
  }
87
95
  };
88
96
  const array = value => {
89
97
  const type = getType$1(value);
90
- if (type !== 'array') {
98
+ if (type !== Array$1$1) {
91
99
  throw new AssertionError('expected value to be of type array');
92
100
  }
93
101
  };
94
102
  const string = value => {
95
103
  const type = getType$1(value);
96
- if (type !== 'string') {
104
+ if (type !== String$2) {
97
105
  throw new AssertionError('expected value to be of type string');
98
106
  }
99
107
  };
100
108
  const fn = value => {
101
109
  const type = getType$1(value);
102
- if (type !== 'function') {
110
+ if (type !== Function) {
103
111
  throw new AssertionError('expected value to be of type function');
104
112
  }
105
113
  };
@@ -316,7 +324,7 @@ const syncIncremental = (textDocumentId, changes) => {
316
324
  textDocument.text = before + syntheticChange.inserted + after;
317
325
  runListenersSafe(getDidChangeListeners(), textDocument, syntheticChanges);
318
326
  };
319
- const get$b = textDocumentId => {
327
+ const get$c = textDocumentId => {
320
328
  const textDocument = getDocument(textDocumentId);
321
329
  return textDocument;
322
330
  };
@@ -535,7 +543,7 @@ const registerMethod = ({
535
543
  }) => {
536
544
  context[`execute${name}Provider`] = async function (textDocumentId, ...params) {
537
545
  try {
538
- const textDocument = get$b(textDocumentId);
546
+ const textDocument = get$c(textDocumentId);
539
547
  if (!textDocument) {
540
548
  throw new Error(`textDocument with id ${textDocumentId} not found`);
541
549
  }
@@ -568,7 +576,7 @@ const registerMethod = ({
568
576
  }
569
577
  };
570
578
  };
571
- const create$d = ({
579
+ const create$b = ({
572
580
  name,
573
581
  resultShape,
574
582
  executeKey = '',
@@ -621,7 +629,7 @@ const String$1 = 'string';
621
629
 
622
630
  const {
623
631
  registerBraceCompletionProvider,
624
- executeBraceCompletionProvider} = create$d({
632
+ executeBraceCompletionProvider} = create$b({
625
633
  name: 'BraceCompletion',
626
634
  resultShape: {
627
635
  type: Boolean$1
@@ -631,7 +639,7 @@ const {
631
639
  const {
632
640
  registerClosingTagProvider,
633
641
  executeClosingTagProvider
634
- } = create$d({
642
+ } = create$b({
635
643
  name: 'ClosingTag',
636
644
  returnUndefinedWhenNoProviderFound: true,
637
645
  resultShape: {
@@ -643,7 +651,7 @@ const {
643
651
  const {
644
652
  registerCodeActionProvider,
645
653
  executeCodeActionProvider
646
- } = create$d({
654
+ } = create$b({
647
655
  name: 'CodeAction',
648
656
  resultShape: {
649
657
  type: Array$1,
@@ -668,7 +676,7 @@ const executeOrganizeImports = async uid => {
668
676
  if (!organizeImportsAction) {
669
677
  return [];
670
678
  }
671
- const textDocument = get$b(uid);
679
+ const textDocument = get$c(uid);
672
680
  const edits = await organizeImportsAction.execute(textDocument);
673
681
  return edits;
674
682
  };
@@ -726,7 +734,7 @@ const {
726
734
  registerCompletionProvider,
727
735
  executeCompletionProvider,
728
736
  executeresolveCompletionItemProvider
729
- } = create$d({
737
+ } = create$b({
730
738
  name: 'Completion',
731
739
  resultShape: {
732
740
  type: Array$1,
@@ -760,23 +768,23 @@ const rpcs$2 = Object.create(null);
760
768
  const set$g = (id, rpc) => {
761
769
  rpcs$2[id] = rpc;
762
770
  };
763
- const get$a = id => {
771
+ const get$b = id => {
764
772
  return rpcs$2[id];
765
773
  };
766
774
 
767
775
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
768
776
 
769
- const create$c = rpcId => {
777
+ const create$a = rpcId => {
770
778
  return {
771
779
  // @ts-ignore
772
780
  invoke(method, ...params) {
773
- const rpc = get$a(rpcId);
781
+ const rpc = get$b(rpcId);
774
782
  // @ts-ignore
775
783
  return rpc.invoke(method, ...params);
776
784
  },
777
785
  // @ts-ignore
778
786
  invokeAndTransfer(method, ...params) {
779
- const rpc = get$a(rpcId);
787
+ const rpc = get$b(rpcId);
780
788
  // @ts-ignore
781
789
  return rpc.invokeAndTransfer(method, ...params);
782
790
  },
@@ -784,14 +792,14 @@ const create$c = rpcId => {
784
792
  set$g(rpcId, rpc);
785
793
  },
786
794
  async dispose() {
787
- const rpc = get$a(rpcId);
795
+ const rpc = get$b(rpcId);
788
796
  await rpc.dispose();
789
797
  }
790
798
  };
791
799
  };
792
800
  const DebugWorker$1 = 55;
793
801
  const {
794
- invoke: invoke$d} = create$c(DebugWorker$1);
802
+ invoke: invoke$d} = create$a(DebugWorker$1);
795
803
  const DebugWorker = {
796
804
  __proto__: null,
797
805
  invoke: invoke$d};
@@ -984,7 +992,7 @@ const setPauseOnExceptions = async (protocol, value) => {
984
992
 
985
993
  const {
986
994
  registerDefinitionProvider,
987
- executeDefinitionProvider} = create$d({
995
+ executeDefinitionProvider} = create$b({
988
996
  name: 'Definition',
989
997
  resultShape: {
990
998
  allowUndefined: true,
@@ -1006,7 +1014,7 @@ const {
1006
1014
  const {
1007
1015
  registerDiagnosticProvider,
1008
1016
  executeDiagnosticProvider
1009
- } = create$d({
1017
+ } = create$b({
1010
1018
  name: 'Diagnostic',
1011
1019
  resultShape: {
1012
1020
  type: Array$1,
@@ -1019,11 +1027,11 @@ const {
1019
1027
  const RendererWorker = 1;
1020
1028
 
1021
1029
  const invoke$2 = (method, ...params) => {
1022
- const rpc = get$a(RendererWorker);
1030
+ const rpc = get$b(RendererWorker);
1023
1031
  return rpc.invoke(method, ...params);
1024
1032
  };
1025
1033
  const invokeAndTransfer$2 = (method, ...params) => {
1026
- const rpc = get$a(RendererWorker);
1034
+ const rpc = get$b(RendererWorker);
1027
1035
  return rpc.invokeAndTransfer(method, ...params);
1028
1036
  };
1029
1037
 
@@ -1040,7 +1048,7 @@ const exec = async (command, args, options) => {
1040
1048
  };
1041
1049
 
1042
1050
  const fileSystemProviderMap = Object.create(null);
1043
- const get$9 = protocol => {
1051
+ const get$a = protocol => {
1044
1052
  const provider = fileSystemProviderMap[protocol];
1045
1053
  if (!provider) {
1046
1054
  // @ts-ignore
@@ -1048,7 +1056,7 @@ const get$9 = protocol => {
1048
1056
  }
1049
1057
  return provider;
1050
1058
  };
1051
- const set$8 = (id, provider) => {
1059
+ const set$9 = (id, provider) => {
1052
1060
  if (!id) {
1053
1061
  throw new Error('Failed to register file system provider: missing id');
1054
1062
  }
@@ -1059,11 +1067,11 @@ const registerFileSystemProvider = fileSystemProvider => {
1059
1067
  if (!fileSystemProvider.id) {
1060
1068
  throw new Error('Failed to register file system provider: missing id');
1061
1069
  }
1062
- set$8(fileSystemProvider.id, fileSystemProvider);
1070
+ set$9(fileSystemProvider.id, fileSystemProvider);
1063
1071
  };
1064
1072
  const readDirWithFileTypes$2 = async (protocol, path) => {
1065
1073
  try {
1066
- const provider = get$9(protocol);
1074
+ const provider = get$a(protocol);
1067
1075
  return await provider.readDirWithFileTypes(path);
1068
1076
  } catch (error) {
1069
1077
  throw new VError(error, 'Failed to execute file system provider');
@@ -1071,7 +1079,7 @@ const readDirWithFileTypes$2 = async (protocol, path) => {
1071
1079
  };
1072
1080
  const readFile$2 = async (protocol, path) => {
1073
1081
  try {
1074
- const provider = get$9(protocol);
1082
+ const provider = get$a(protocol);
1075
1083
  return await provider.readFile(path);
1076
1084
  } catch (error) {
1077
1085
  throw new VError(error, 'Failed to execute file system provider');
@@ -1099,7 +1107,7 @@ const readDirWithFileTypesExternal = async path => {
1099
1107
  };
1100
1108
  const rename$1 = async (protocol, oldUri, newUri) => {
1101
1109
  try {
1102
- const provider = get$9(protocol);
1110
+ const provider = get$a(protocol);
1103
1111
  return await provider.rename(oldUri, newUri);
1104
1112
  } catch (error) {
1105
1113
  throw new VError(error, 'Failed to execute file system provider');
@@ -1107,7 +1115,7 @@ const rename$1 = async (protocol, oldUri, newUri) => {
1107
1115
  };
1108
1116
  const writeFile$2 = async (protocol, uri, content) => {
1109
1117
  try {
1110
- const provider = get$9(protocol);
1118
+ const provider = get$a(protocol);
1111
1119
  return await provider.writeFile(uri, content);
1112
1120
  } catch (error) {
1113
1121
  throw new VError(error, 'Failed to execute file system provider');
@@ -1115,7 +1123,7 @@ const writeFile$2 = async (protocol, uri, content) => {
1115
1123
  };
1116
1124
  const getPathSeparator = protocol => {
1117
1125
  try {
1118
- const provider = get$9(protocol);
1126
+ const provider = get$a(protocol);
1119
1127
  return provider.pathSeparator;
1120
1128
  } catch (error) {
1121
1129
  throw new VError(error, 'Failed to execute file system provider');
@@ -1124,7 +1132,7 @@ const getPathSeparator = protocol => {
1124
1132
 
1125
1133
  const {
1126
1134
  registerFormattingProvider,
1127
- executeFormattingProvider} = create$d({
1135
+ executeFormattingProvider} = create$b({
1128
1136
  name: 'Formatting',
1129
1137
  executeKey: 'format',
1130
1138
  resultShape: {
@@ -1186,7 +1194,7 @@ const getPosition = (textDocument, offset) => {
1186
1194
 
1187
1195
  const {
1188
1196
  registerHoverProvider,
1189
- executeHoverProvider} = create$d({
1197
+ executeHoverProvider} = create$b({
1190
1198
  name: 'Hover',
1191
1199
  resultShape: {
1192
1200
  allowUndefined: true,
@@ -1197,7 +1205,7 @@ const {
1197
1205
 
1198
1206
  const {
1199
1207
  registerImplementationProvider,
1200
- executeImplementationProvider} = create$d({
1208
+ executeImplementationProvider} = create$b({
1201
1209
  name: 'Implementation',
1202
1210
  resultShape: {
1203
1211
  type: Array$1,
@@ -1606,7 +1614,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
1606
1614
  return promise;
1607
1615
  };
1608
1616
  const Message$1 = 3;
1609
- const create$5$1 = async ({
1617
+ const create$5$2 = async ({
1610
1618
  messagePort,
1611
1619
  isMessagePortOpen
1612
1620
  }) => {
@@ -1657,7 +1665,7 @@ const wrap$5 = messagePort => {
1657
1665
  };
1658
1666
  const IpcParentWithMessagePort$1 = {
1659
1667
  __proto__: null,
1660
- create: create$5$1,
1668
+ create: create$5$2,
1661
1669
  signal: signal$1,
1662
1670
  wrap: wrap$5
1663
1671
  };
@@ -1681,7 +1689,7 @@ const waitForWebSocketToBeOpen = webSocket => {
1681
1689
  error: Error$3
1682
1690
  });
1683
1691
  };
1684
- const create$b = async ({
1692
+ const create$9 = async ({
1685
1693
  webSocket
1686
1694
  }) => {
1687
1695
  const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
@@ -1718,12 +1726,12 @@ const wrap$1 = webSocket => {
1718
1726
  };
1719
1727
  const IpcParentWithWebSocket$1$1 = {
1720
1728
  __proto__: null,
1721
- create: create$b,
1729
+ create: create$9,
1722
1730
  wrap: wrap$1
1723
1731
  };
1724
1732
 
1725
1733
  const Two = '2.0';
1726
- const create$4$1 = (method, params) => {
1734
+ const create$4$2 = (method, params) => {
1727
1735
  return {
1728
1736
  jsonrpc: Two,
1729
1737
  method,
@@ -1731,26 +1739,26 @@ const create$4$1 = (method, params) => {
1731
1739
  };
1732
1740
  };
1733
1741
  const callbacks = Object.create(null);
1734
- const set$7 = (id, fn) => {
1742
+ const set$8 = (id, fn) => {
1735
1743
  callbacks[id] = fn;
1736
1744
  };
1737
- const get$8 = id => {
1745
+ const get$9 = id => {
1738
1746
  return callbacks[id];
1739
1747
  };
1740
1748
  const remove$3 = id => {
1741
1749
  delete callbacks[id];
1742
1750
  };
1743
1751
  let id$1 = 0;
1744
- const create$3$2 = () => {
1752
+ const create$3$1 = () => {
1745
1753
  return ++id$1;
1746
1754
  };
1747
1755
  const registerPromise = () => {
1748
- const id = create$3$2();
1756
+ const id = create$3$1();
1749
1757
  const {
1750
1758
  resolve,
1751
1759
  promise
1752
1760
  } = Promise.withResolvers();
1753
- set$7(id, resolve);
1761
+ set$8(id, resolve);
1754
1762
  return {
1755
1763
  id,
1756
1764
  promise
@@ -1914,7 +1922,7 @@ const warn$1 = (...args) => {
1914
1922
  console.warn(...args);
1915
1923
  };
1916
1924
  const resolve = (id, response) => {
1917
- const fn = get$8(id);
1925
+ const fn = get$9(id);
1918
1926
  if (!fn) {
1919
1927
  console.log(response);
1920
1928
  warn$1(`callback ${id} may already be disposed`);
@@ -1964,7 +1972,7 @@ const getErrorProperty = (error, prettyError) => {
1964
1972
  }
1965
1973
  };
1966
1974
  };
1967
- const create$1$2 = (id, error) => {
1975
+ const create$1$1 = (id, error) => {
1968
1976
  return {
1969
1977
  jsonrpc: Two,
1970
1978
  id,
@@ -1975,7 +1983,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
1975
1983
  const prettyError = preparePrettyError(error);
1976
1984
  logError(error, prettyError);
1977
1985
  const errorProperty = getErrorProperty(error, prettyError);
1978
- return create$1$2(id, errorProperty);
1986
+ return create$1$1(id, errorProperty);
1979
1987
  };
1980
1988
  const create$8 = (message, result) => {
1981
1989
  return {
@@ -2091,7 +2099,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
2091
2099
  return unwrapJsonRpcResult(responseMessage);
2092
2100
  };
2093
2101
  const send = (transport, method, ...params) => {
2094
- const message = create$4$1(method, params);
2102
+ const message = create$4$2(method, params);
2095
2103
  transport.send(message);
2096
2104
  };
2097
2105
  const invoke$1 = (ipc, method, ...params) => {
@@ -2168,7 +2176,7 @@ const listen$1 = async (module, options) => {
2168
2176
  const ipc = module.wrap(rawIpc);
2169
2177
  return ipc;
2170
2178
  };
2171
- const create$a = async ({
2179
+ const create$e = async ({
2172
2180
  commandMap,
2173
2181
  messagePort
2174
2182
  }) => {
@@ -2183,9 +2191,9 @@ const create$a = async ({
2183
2191
  };
2184
2192
  const MessagePortRpcClient = {
2185
2193
  __proto__: null,
2186
- create: create$a
2194
+ create: create$e
2187
2195
  };
2188
- const create$9 = async ({
2196
+ const create$d = async ({
2189
2197
  commandMap,
2190
2198
  messagePort,
2191
2199
  isMessagePortOpen
@@ -2203,9 +2211,9 @@ const create$9 = async ({
2203
2211
  };
2204
2212
  const MessagePortRpcParent = {
2205
2213
  __proto__: null,
2206
- create: create$9
2214
+ create: create$d
2207
2215
  };
2208
- const create$3$1 = async ({
2216
+ const create$5$1 = async ({
2209
2217
  commandMap,
2210
2218
  messagePort
2211
2219
  }) => {
@@ -2221,20 +2229,20 @@ const create$3$1 = async ({
2221
2229
  messagePort.start();
2222
2230
  return rpc;
2223
2231
  };
2224
- const create$2$1 = async ({
2232
+ const create$4$1 = async ({
2225
2233
  commandMap,
2226
2234
  messagePort
2227
2235
  }) => {
2228
- return create$3$1({
2236
+ return create$5$1({
2229
2237
  commandMap,
2230
2238
  messagePort
2231
2239
  });
2232
2240
  };
2233
2241
  const PlainMessagePortRpcParent = {
2234
2242
  __proto__: null,
2235
- create: create$2$1
2243
+ create: create$4$1
2236
2244
  };
2237
- const create$1$1 = async ({
2245
+ const create$2$1 = async ({
2238
2246
  commandMap,
2239
2247
  webSocket
2240
2248
  }) => {
@@ -2250,7 +2258,7 @@ const create$1$1 = async ({
2250
2258
  };
2251
2259
  const WebSocketRpcParent = {
2252
2260
  __proto__: null,
2253
- create: create$1$1
2261
+ create: create$2$1
2254
2262
  };
2255
2263
  const create$7 = async ({
2256
2264
  commandMap
@@ -2506,7 +2514,7 @@ const {
2506
2514
  executeReferenceProvider,
2507
2515
  executefileReferenceProvider,
2508
2516
  getProvider: getProvider$1
2509
- } = create$d({
2517
+ } = create$b({
2510
2518
  name: 'Reference',
2511
2519
  resultShape: {
2512
2520
  type: Array$1,
@@ -2539,7 +2547,7 @@ const executeReferenceProvider2 = (uri, languageId, offset, position) => {
2539
2547
  const {
2540
2548
  registerRenameProvider,
2541
2549
  executeRenameProvider,
2542
- executeprepareRenameProvider} = create$d({
2550
+ executeprepareRenameProvider} = create$b({
2543
2551
  name: 'Rename',
2544
2552
  resultShape: {
2545
2553
  type: Object$1,
@@ -2562,7 +2570,7 @@ const getExtensionHostSubWorkerUrl = () => {
2562
2570
  };
2563
2571
  const extensionHostSubWorkerUrl = getExtensionHostSubWorkerUrl();
2564
2572
 
2565
- const set$6 = async (url, contentSecurityPolicy) => {
2573
+ const set$7 = async (url, contentSecurityPolicy) => {
2566
2574
  const pathName = new URL(url).pathname;
2567
2575
  await invoke$2('ExtensionHostWorkerContentSecurityPolicy.set', pathName, contentSecurityPolicy);
2568
2576
  };
@@ -2582,7 +2590,7 @@ const createLegacyRpc = async ({
2582
2590
  string(name);
2583
2591
  object(commandMap);
2584
2592
  if (contentSecurityPolicy) {
2585
- await set$6(url, contentSecurityPolicy);
2593
+ await set$7(url, contentSecurityPolicy);
2586
2594
  }
2587
2595
  const rpc = await create$2({
2588
2596
  method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug$1,
@@ -2603,7 +2611,7 @@ const rpcs$1 = Object.create(null);
2603
2611
  const add$1 = (id, rpc) => {
2604
2612
  rpcs$1[id] = rpc;
2605
2613
  };
2606
- const get$7 = id => {
2614
+ const get$8 = id => {
2607
2615
  return rpcs$1[id];
2608
2616
  };
2609
2617
 
@@ -2612,15 +2620,15 @@ const rpcs = Object.create(null);
2612
2620
  const register = (id, execute) => {
2613
2621
  registry[id] = execute;
2614
2622
  };
2615
- const get$6 = id => {
2623
+ const get$7 = id => {
2616
2624
  return rpcs[id];
2617
2625
  };
2618
- const set$5 = (id, rpc) => {
2626
+ const set$6 = (id, rpc) => {
2619
2627
  rpcs[id] = rpc;
2620
2628
  };
2621
2629
 
2622
2630
  const createRpcWithId$1 = async (id, commandMap, execute) => {
2623
- const info = get$7(id);
2631
+ const info = get$8(id);
2624
2632
  if (!info) {
2625
2633
  throw new Error(`rpc with id ${id} not found`);
2626
2634
  }
@@ -2636,16 +2644,16 @@ const createRpcWithId$1 = async (id, commandMap, execute) => {
2636
2644
  rpc.ipc.execute = execute;
2637
2645
  }
2638
2646
  await rpc.invoke('LoadFile.loadFile', info.url);
2639
- set$5(id, rpc);
2647
+ set$6(id, rpc);
2640
2648
  return rpc;
2641
2649
  };
2642
2650
 
2643
2651
  const getOrCreateRpc = async (id, commandMap, execute) => {
2644
- const rpc = get$6(id);
2652
+ const rpc = get$7(id);
2645
2653
  if (!rpc) {
2646
- set$5(id, createRpcWithId$1(id, commandMap, execute));
2654
+ set$6(id, createRpcWithId$1(id, commandMap, execute));
2647
2655
  }
2648
- return get$6(id);
2656
+ return get$7(id);
2649
2657
  };
2650
2658
  const createRpcWithId = ({
2651
2659
  id,
@@ -2699,7 +2707,7 @@ const createRpc = ({
2699
2707
 
2700
2708
  const {
2701
2709
  registerSelectionProvider,
2702
- executeSelectionProvider} = create$d({
2710
+ executeSelectionProvider} = create$b({
2703
2711
  name: 'Selection',
2704
2712
  resultShape: {
2705
2713
  allowUndefined: true,
@@ -2805,7 +2813,7 @@ const getEnabledProviderIds = async (scheme, root) => {
2805
2813
 
2806
2814
  const {
2807
2815
  registerTabCompletionProvider,
2808
- executeTabCompletionProvider} = create$d({
2816
+ executeTabCompletionProvider} = create$b({
2809
2817
  name: 'TabCompletion',
2810
2818
  resultShape: {
2811
2819
  type: Object$1,
@@ -2844,7 +2852,7 @@ const executeTextSearchProvider = async (scheme, query) => {
2844
2852
 
2845
2853
  const {
2846
2854
  registerTypeDefinitionProvider,
2847
- executeTypeDefinitionProvider} = create$d({
2855
+ executeTypeDefinitionProvider} = create$b({
2848
2856
  name: 'TypeDefinition',
2849
2857
  resultShape: {
2850
2858
  allowUndefined: true,
@@ -3245,13 +3253,13 @@ const state$5 = {
3245
3253
 
3246
3254
  const cache = Object.create(null);
3247
3255
  const id = 1;
3248
- const get$5 = () => {
3256
+ const get$6 = () => {
3249
3257
  return cache[id];
3250
3258
  };
3251
3259
  const has = () => {
3252
3260
  return id in cache;
3253
3261
  };
3254
- const set$4 = value => {
3262
+ const set$5 = value => {
3255
3263
  cache[id] = value;
3256
3264
  };
3257
3265
  const clear = () => {
@@ -3716,7 +3724,7 @@ const getDbMemoized$1 = async () => {
3716
3724
 
3717
3725
  // TODO high memory usage in idb because of transactionDoneMap
3718
3726
 
3719
- const set$3 = async (key, value) => {
3727
+ const set$4 = async (key, value) => {
3720
3728
  try {
3721
3729
  const db = await getDbMemoized$1();
3722
3730
  await db.put(storeId, value, key);
@@ -3724,7 +3732,7 @@ const set$3 = async (key, value) => {
3724
3732
  throw new VError(error, 'Failed to save value to indexed db');
3725
3733
  }
3726
3734
  };
3727
- const get$4 = async key => {
3735
+ const get$5 = async key => {
3728
3736
  try {
3729
3737
  const db = await getDbMemoized$1();
3730
3738
  const value = await db.get(storeId, key);
@@ -3737,19 +3745,19 @@ const get$4 = async key => {
3737
3745
  const getCacheKey$1 = colorThemeId => {
3738
3746
  return 'color-theme-' + colorThemeId;
3739
3747
  };
3740
- const get$3 = colorThemeId => {
3748
+ const get$4 = colorThemeId => {
3741
3749
  const cacheKey = getCacheKey$1(colorThemeId);
3742
- return get$4(cacheKey);
3750
+ return get$5(cacheKey);
3743
3751
  };
3744
- const set$2 = (colorThemeId, data) => {
3752
+ const set$3 = (colorThemeId, data) => {
3745
3753
  const cacheKey = getCacheKey$1(colorThemeId);
3746
- return set$3(cacheKey, data);
3754
+ return set$4(cacheKey, data);
3747
3755
  };
3748
3756
 
3749
3757
  const GetColorThemeCssCachedIndexedDb = {
3750
3758
  __proto__: null,
3751
- get: get$3,
3752
- set: set$2
3759
+ get: get$4,
3760
+ set: set$3
3753
3761
  };
3754
3762
 
3755
3763
  const getText$1 = key => {
@@ -3762,35 +3770,35 @@ const setText = (key, value) => {
3762
3770
  const getCacheKey = colorThemeId => {
3763
3771
  return 'lvce-color-theme-' + colorThemeId;
3764
3772
  };
3765
- const get$2 = colorThemeId => {
3773
+ const get$3 = colorThemeId => {
3766
3774
  const cacheKey = getCacheKey(colorThemeId);
3767
3775
  return getText$1(cacheKey);
3768
3776
  };
3769
- const set$1 = (colorThemeId, data) => {
3777
+ const set$2 = (colorThemeId, data) => {
3770
3778
  const cacheKey = getCacheKey(colorThemeId);
3771
3779
  return setText(cacheKey, data);
3772
3780
  };
3773
3781
 
3774
3782
  const GetColorThemeCssCachedLocalStorage = {
3775
3783
  __proto__: null,
3776
- get: get$2,
3777
- set: set$1
3784
+ get: get$3,
3785
+ set: set$2
3778
3786
  };
3779
3787
 
3780
- const get$1 = colorThemeId => {
3788
+ const get$2 = colorThemeId => {
3781
3789
  return '';
3782
3790
  };
3783
- const set = (colorThemeId, data) => {
3791
+ const set$1 = (colorThemeId, data) => {
3784
3792
  // noop
3785
3793
  };
3786
3794
 
3787
3795
  const GetColorThemeCssCachedNoop = {
3788
3796
  __proto__: null,
3789
- get: get$1,
3790
- set
3797
+ get: get$2,
3798
+ set: set$1
3791
3799
  };
3792
3800
 
3793
- const get = key => {
3801
+ const get$1 = key => {
3794
3802
  return invoke$2('Preferences.get', key);
3795
3803
  };
3796
3804
 
@@ -3805,7 +3813,7 @@ const getCacheFn = config => {
3805
3813
  }
3806
3814
  };
3807
3815
  const getColorThemeCssCached = async (colorThemeId, getData) => {
3808
- const config = await get('colorTheme.cache');
3816
+ const config = await get$1('colorTheme.cache');
3809
3817
  const module = await getCacheFn(config);
3810
3818
  const cachedData = await module.get(colorThemeId);
3811
3819
  if (cachedData) {
@@ -3897,9 +3905,9 @@ const getExtensions$1 = async () => {
3897
3905
  // TODO getExtensions is still called 6 times on startup instead of 1
3898
3906
  const getExtensions = () => {
3899
3907
  if (!has()) {
3900
- set$4(getExtensions$1());
3908
+ set$5(getExtensions$1());
3901
3909
  }
3902
- return get$5();
3910
+ return get$6();
3903
3911
  };
3904
3912
 
3905
3913
  const getColorThemeJson$2 = async colorThemeId => {
@@ -3968,7 +3976,7 @@ const applyColorTheme = async colorThemeId => {
3968
3976
  const themeColor = getMetaThemeColor(colorThemeId) || '';
3969
3977
  await setThemeColor(themeColor);
3970
3978
  }
3971
- if (platform !== Web && (await get('development.watchColorTheme'))) {
3979
+ if (platform !== Web && (await get$1('development.watchColorTheme'))) {
3972
3980
  watch(colorThemeId);
3973
3981
  }
3974
3982
  } catch (error) {
@@ -3983,7 +3991,7 @@ const watch = async id => {
3983
3991
  await invoke$2('ExtensionHost.watchColorTheme', id);
3984
3992
  };
3985
3993
  const getPreferredColorTheme = () => {
3986
- const preferredColorTheme = get('workbench.colorTheme');
3994
+ const preferredColorTheme = get$1('workbench.colorTheme');
3987
3995
  return preferredColorTheme;
3988
3996
  };
3989
3997
 
@@ -4006,7 +4014,7 @@ const hydrate$1 = async () => {
4006
4014
  const iframeWorkerUrl = `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/iframe-worker/dist/iframeWorkerMain.js`;
4007
4015
 
4008
4016
  const getConfiguredIframeWorkerUrl = async () => {
4009
- let configuredWorkerUrl = (await get('develop.iframeWorkerPath')) || '';
4017
+ let configuredWorkerUrl = (await get$1('develop.iframeWorkerPath')) || '';
4010
4018
  if (configuredWorkerUrl) {
4011
4019
  configuredWorkerUrl = '/remote' + configuredWorkerUrl;
4012
4020
  }
@@ -4586,6 +4594,26 @@ const importScript = async url => {
4586
4594
  }
4587
4595
  };
4588
4596
 
4597
+ const states = Object.create(null);
4598
+ const set = status => {
4599
+ states[status.id] = status;
4600
+ };
4601
+ const get = extensionId => {
4602
+ return states[extensionId];
4603
+ };
4604
+ const update = (id, update) => {
4605
+ states[id] = {
4606
+ ...states[id],
4607
+ ...update
4608
+ };
4609
+ };
4610
+
4611
+ const None = 0;
4612
+ const Importing = 1;
4613
+ const Activating = 2;
4614
+ const Activated = 3;
4615
+ const Error$1 = 4;
4616
+
4589
4617
  const activationTimeout = 10_000;
4590
4618
  const rejectAfterTimeout = async (timeout, token) => {
4591
4619
  await sleep(timeout);
@@ -4594,16 +4622,36 @@ const rejectAfterTimeout = async (timeout, token) => {
4594
4622
  }
4595
4623
  throw new Error(`Activation timeout of ${timeout}ms exceeded`);
4596
4624
  };
4597
- const activate = async (extension, absolutePath) => {
4625
+
4626
+ // TODO separate importing extension and activating extension for smaller functions
4627
+ // and better error handling
4628
+ const activate = async (extension, absolutePath, activationEvent) => {
4629
+ const extensionId = extension.id;
4598
4630
  try {
4599
4631
  string(extension.path);
4600
4632
  string(extension.browser);
4601
4633
  string(absolutePath);
4634
+ set({
4635
+ activationEvent: activationEvent,
4636
+ id: extensionId,
4637
+ activationTime: 0,
4638
+ status: Importing
4639
+ });
4640
+ const startTime = performance.now();
4602
4641
  const module = await importScript(absolutePath);
4603
4642
  handleRpcInfos(extension, platform);
4643
+ update(extensionId, {
4644
+ status: Activating
4645
+ });
4604
4646
  const token = create();
4605
4647
  try {
4606
4648
  await Promise.race([module.activate(extension), rejectAfterTimeout(activationTimeout, token)]);
4649
+ const endTime = performance.now();
4650
+ const time = endTime - startTime;
4651
+ update(extensionId, {
4652
+ status: Activated,
4653
+ activationTime: time
4654
+ });
4607
4655
  } catch (error) {
4608
4656
  if (isImportError(error)) {
4609
4657
  const actualErrorMessage = await tryToGetActualImportErrorMessage(absolutePath, error);
@@ -4614,6 +4662,9 @@ const activate = async (extension, absolutePath) => {
4614
4662
  cancel(token);
4615
4663
  }
4616
4664
  } catch (error) {
4665
+ update(extensionId, {
4666
+ status: Error$1 // TODO maybe store error also in runtime status state
4667
+ });
4617
4668
  const id = getExtensionId(extension);
4618
4669
  throw new VError(error, `Failed to activate extension ${id}`);
4619
4670
  }
@@ -5084,13 +5135,23 @@ const getIconThemeJson = async iconThemeId => {
5084
5135
  };
5085
5136
 
5086
5137
  const getRpcInfo = rpcId => {
5087
- const info = get$7(rpcId);
5138
+ const info = get$8(rpcId);
5088
5139
  if (!info) {
5089
5140
  throw new Error(`Rpc not found ${rpcId}`);
5090
5141
  }
5091
5142
  return info;
5092
5143
  };
5093
5144
 
5145
+ const emptyStatus = {
5146
+ status: None,
5147
+ id: '',
5148
+ activationEvent: '',
5149
+ activationTime: 0
5150
+ };
5151
+ const getRuntimeStatus = extensionId => {
5152
+ return get(extensionId) || emptyStatus;
5153
+ };
5154
+
5094
5155
  const getWebViewInfo2 = providerId => {
5095
5156
  return invoke('WebView.getWebViewInfo', providerId);
5096
5157
  };
@@ -5193,7 +5254,7 @@ const setIconTheme = async iconThemeId => {
5193
5254
  }
5194
5255
  };
5195
5256
  const hydrate = async () => {
5196
- const iconThemeId = (await get('icon-theme')) || 'vscode-icons';
5257
+ const iconThemeId = (await get$1('icon-theme')) || 'vscode-icons';
5197
5258
  await setIconTheme(iconThemeId);
5198
5259
  };
5199
5260
 
@@ -5714,11 +5775,17 @@ const commandMap = {
5714
5775
  'ColorTheme.getColorThemeJson': getColorThemeJson,
5715
5776
  'ColorTheme.getColorThemeNames': getColorThemeNames,
5716
5777
  'ColorTheme.hydrate': hydrate$1,
5717
- 'ExtensionHost.launchIframeWorker': launchIframeWorker,
5718
5778
  'ExecuteExternalCommand.executeExternalCommand': executeExternalCommand,
5779
+ 'ExtensionHost.getRuntimeStatus': getRuntimeStatus,
5780
+ 'ExtensionHost.launchIframeWorker': launchIframeWorker,
5719
5781
  'ExtensionHostDebug.evaluate': evaluate,
5782
+ 'ExtensionHostDebug.getCallStack': getCallStack,
5783
+ 'ExtensionHostDebug.getPausedStatus': getPausedStatus,
5720
5784
  'ExtensionHostDebug.getProperties': getProperties,
5785
+ 'ExtensionHostDebug.getScopeChain': getScopeChain,
5786
+ 'ExtensionHostDebug.getScripts': getScripts,
5721
5787
  'ExtensionHostDebug.getScriptSource': getScriptSource,
5788
+ 'ExtensionHostDebug.getStatus': getStatus,
5722
5789
  'ExtensionHostDebug.listProcesses': listProcesses,
5723
5790
  'ExtensionHostDebug.pause': pause,
5724
5791
  'ExtensionHostDebug.resume': resume,
@@ -5728,11 +5795,6 @@ const commandMap = {
5728
5795
  'ExtensionHostDebug.stepInto': stepInto,
5729
5796
  'ExtensionHostDebug.stepOut': stepOut,
5730
5797
  'ExtensionHostDebug.stepOver': stepOver,
5731
- 'ExtensionHostDebug.getStatus': getStatus,
5732
- 'ExtensionHostDebug.getCallStack': getCallStack,
5733
- 'ExtensionHostDebug.getScopeChain': getScopeChain,
5734
- 'ExtensionHostDebug.getScripts': getScripts,
5735
- 'ExtensionHostDebug.getPausedStatus': getPausedStatus,
5736
5798
  'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
5737
5799
  'ExtensionHostRename.executeRenameProvider': executeRenameProvider,
5738
5800
  'ExtensionHostWebView.create': createWebView,
@@ -5751,15 +5813,15 @@ const commandMap = {
5751
5813
  'FileSystemFetch.remove': remove$2,
5752
5814
  'FileSystemFetch.writeFile': writeFile$1,
5753
5815
  'FileSystemMemory.chmod': chmod,
5816
+ 'FileSystemMemory.copy': copy,
5754
5817
  'FileSystemMemory.getBlob': getBlob,
5755
5818
  'FileSystemMemory.getBlobUrl': getBlobUrl,
5756
5819
  'FileSystemMemory.getFiles': getFiles,
5757
5820
  'FileSystemMemory.mkdir': mkdir,
5758
5821
  'FileSystemMemory.readDirWithFileTypes': readDirWithFileTypes,
5759
5822
  'FileSystemMemory.readFile': readFile,
5760
- 'FileSystemMemory.rename': rename,
5761
- 'FileSystemMemory.copy': copy,
5762
5823
  'FileSystemMemory.remove': remove,
5824
+ 'FileSystemMemory.rename': rename,
5763
5825
  'FileSystemMemory.writeFile': writeFile,
5764
5826
  'HandleBeforeUnload.handleBeforeUnload': handleBeforeUnload,
5765
5827
  'HandleMessagePort.handleMessagePort': handleMessagePort,
@@ -5769,12 +5831,12 @@ const commandMap = {
5769
5831
  'IconTheme.hydrate': hydrate,
5770
5832
  'IconTheme.setIconTheme': setIconTheme,
5771
5833
  'IndexedDb.addHandle': addHandle,
5772
- 'IndexedDb.get': get$4,
5834
+ 'IndexedDb.get': get$5,
5773
5835
  'IndexedDb.getHandle': getHandle$1,
5774
5836
  'IndexedDb.getValues': getValues,
5775
5837
  'IndexedDb.getValuesByIndexName': getValuesByIndexName,
5776
5838
  'IndexedDb.saveValue': saveValue,
5777
- 'IndexedDb.set': set$3,
5839
+ 'IndexedDb.set': set$4,
5778
5840
  'Languages.getLanguages': getLanguages,
5779
5841
  'SaveState.saveState': saveState,
5780
5842
  'SearchFileWithFetch.searchFileWithFetch': searchFile$2,
@@ -5785,10 +5847,10 @@ const commandMap = {
5785
5847
  'TextSearchMemory.textSearch': textSearch,
5786
5848
  'WebView.create3': createWebView3,
5787
5849
  'WebView.createWebViewWorkerRpc': createWebViewWorkerRpc,
5788
- 'WebView.registerInterceptor': registerInterceptor,
5789
- 'WebView.unregisterInterceptor': unregisterInterceptor,
5790
5850
  'WebView.createWebViewWorkerRpc2': createWebViewWorkerRpc2,
5791
5851
  'WebView.getRpcInfo': getRpcInfo,
5852
+ 'WebView.registerInterceptor': registerInterceptor,
5853
+ 'WebView.unregisterInterceptor': unregisterInterceptor,
5792
5854
  'WebViews.getWebViews': getWebViews,
5793
5855
  [BraceCompletionExecuteBraceCompletionProvider]: executeBraceCompletionProvider,
5794
5856
  [ClosingTagExecuteClosingTagProvider]: executeClosingTagProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "5.13.0",
3
+ "version": "5.15.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"