@lvce-editor/explorer-view 5.18.0 → 5.20.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,3 +1,88 @@
1
+ const toCommandId = key => {
2
+ const dotIndex = key.indexOf('.');
3
+ return key.slice(dotIndex + 1);
4
+ };
5
+ const create$6 = () => {
6
+ const states = Object.create(null);
7
+ const commandMapRef = {};
8
+ return {
9
+ get(uid) {
10
+ return states[uid];
11
+ },
12
+ set(uid, oldState, newState) {
13
+ states[uid] = {
14
+ oldState,
15
+ newState
16
+ };
17
+ },
18
+ dispose(uid) {
19
+ delete states[uid];
20
+ },
21
+ getKeys() {
22
+ return Object.keys(states).map(key => {
23
+ return Number.parseInt(key);
24
+ });
25
+ },
26
+ clear() {
27
+ for (const key of Object.keys(states)) {
28
+ delete states[key];
29
+ }
30
+ },
31
+ wrapCommand(fn) {
32
+ const wrapped = async (uid, ...args) => {
33
+ const {
34
+ oldState,
35
+ newState
36
+ } = states[uid];
37
+ const newerState = await fn(newState, ...args);
38
+ if (oldState === newerState || newState === newerState) {
39
+ return;
40
+ }
41
+ const latest = states[uid];
42
+ states[uid] = {
43
+ oldState: latest.oldState,
44
+ newState: newerState
45
+ };
46
+ };
47
+ return wrapped;
48
+ },
49
+ wrapGetter(fn) {
50
+ const wrapped = (uid, ...args) => {
51
+ const {
52
+ newState
53
+ } = states[uid];
54
+ return fn(newState, ...args);
55
+ };
56
+ return wrapped;
57
+ },
58
+ diff(uid, modules, numbers) {
59
+ const {
60
+ oldState,
61
+ newState
62
+ } = states[uid];
63
+ const diffResult = [];
64
+ for (let i = 0; i < modules.length; i++) {
65
+ const fn = modules[i];
66
+ if (!fn(oldState, newState)) {
67
+ diffResult.push(numbers[i]);
68
+ }
69
+ }
70
+ return diffResult;
71
+ },
72
+ getCommandIds() {
73
+ const keys = Object.keys(commandMapRef);
74
+ const ids = keys.map(toCommandId);
75
+ return ids;
76
+ },
77
+ registerCommands(commandMap) {
78
+ Object.assign(commandMapRef, commandMap);
79
+ }
80
+ };
81
+ };
82
+ const terminate = () => {
83
+ globalThis.close();
84
+ };
85
+
1
86
  const normalizeLine = line => {
2
87
  if (line.startsWith('Error: ')) {
3
88
  return line.slice('Error: '.length);
@@ -54,6 +139,64 @@ class VError extends Error {
54
139
  }
55
140
  }
56
141
 
142
+ const CreateFolder$1 = 1;
143
+ const CreateFile$1 = 2;
144
+ const Copy$1 = 3;
145
+ const Rename$2 = 4;
146
+ const Remove = 5;
147
+
148
+ const Text = 12;
149
+
150
+ const Button$3 = 'event.button';
151
+ const ClientX = 'event.clientX';
152
+ const ClientY = 'event.clientY';
153
+ const CtrlKey = 'event.ctrlKey';
154
+ const DataTransferFiles = 'event.dataTransfer.files';
155
+ const DataTransferFiles2 = 'event.dataTransfer.files2';
156
+ const DefaultPrevented = 'event.defaultPrevented';
157
+ const DeltaMode = 'event.deltaMode';
158
+ const DeltaY = 'event.deltaY';
159
+ const EventTargetClassName = 'event.target.className';
160
+ const IsTrusted = 'event.isTrusted';
161
+ const ShiftKey = 'event.shiftKey';
162
+ const TargetName = 'event.target.name';
163
+ const TargetValue = 'event.target.value';
164
+
165
+ const Enter = 3;
166
+ const Escape = 8;
167
+ const Space = 9;
168
+ const End = 255;
169
+ const Home = 12;
170
+ const LeftArrow = 13;
171
+ const UpArrow = 14;
172
+ const RightArrow = 15;
173
+ const DownArrow = 16;
174
+ const Delete$1 = 18;
175
+ const KeyA = 29;
176
+ const KeyC = 31;
177
+ const KeyV = 50;
178
+ const KeyX = 52;
179
+ const F2 = 58;
180
+ const Star = 131;
181
+
182
+ const CtrlCmd = 1 << 11 >>> 0;
183
+ const Shift = 1 << 10 >>> 0;
184
+ const Alt = 1 << 9 >>> 0;
185
+
186
+ const FileSystemWorker$1 = 209;
187
+ const IconThemeWorker = 7009;
188
+ const RendererWorker = 1;
189
+ const SourceControlWorker = 66;
190
+
191
+ const FocusElementByName = 'Viewlet.focusElementByName';
192
+ const FocusSelector = 'Viewlet.focusSelector';
193
+ const SetCss = 'Viewlet.setCss';
194
+ const SetDom2 = 'Viewlet.setDom2';
195
+ const SetFocusContext = 'Viewlet.setFocusContext';
196
+
197
+ const FocusExplorer = 13;
198
+ const FocusExplorerEditBox = 14;
199
+
57
200
  class AssertionError extends Error {
58
201
  constructor(message) {
59
202
  super(message);
@@ -529,7 +672,7 @@ const callbacks = Object.create(null);
529
672
  const get$2 = id => {
530
673
  return callbacks[id];
531
674
  };
532
- const remove$2 = id => {
675
+ const remove$3 = id => {
533
676
  delete callbacks[id];
534
677
  };
535
678
  class JsonRpcError extends Error {
@@ -682,7 +825,7 @@ const resolve = (id, response) => {
682
825
  return;
683
826
  }
684
827
  fn(response);
685
- remove$2(id);
828
+ remove$3(id);
686
829
  };
687
830
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
688
831
  const getErrorType = prettyError => {
@@ -975,6 +1118,53 @@ const listen$1 = async (module, options) => {
975
1118
  const ipc = module.wrap(rawIpc);
976
1119
  return ipc;
977
1120
  };
1121
+
1122
+ /* eslint-disable @typescript-eslint/no-misused-promises */
1123
+
1124
+ const createSharedLazyRpc = factory => {
1125
+ let rpcPromise;
1126
+ const getOrCreate = () => {
1127
+ if (!rpcPromise) {
1128
+ rpcPromise = factory();
1129
+ }
1130
+ return rpcPromise;
1131
+ };
1132
+ return {
1133
+ async dispose() {
1134
+ const rpc = await getOrCreate();
1135
+ await rpc.dispose();
1136
+ },
1137
+ async invoke(method, ...params) {
1138
+ const rpc = await getOrCreate();
1139
+ return rpc.invoke(method, ...params);
1140
+ },
1141
+ async invokeAndTransfer(method, ...params) {
1142
+ const rpc = await getOrCreate();
1143
+ return rpc.invokeAndTransfer(method, ...params);
1144
+ },
1145
+ async send(method, ...params) {
1146
+ const rpc = await getOrCreate();
1147
+ rpc.send(method, ...params);
1148
+ }
1149
+ };
1150
+ };
1151
+ const create$i = async ({
1152
+ commandMap,
1153
+ isMessagePortOpen,
1154
+ send
1155
+ }) => {
1156
+ return createSharedLazyRpc(() => {
1157
+ return create$2({
1158
+ commandMap,
1159
+ isMessagePortOpen,
1160
+ send
1161
+ });
1162
+ });
1163
+ };
1164
+ const LazyTransferMessagePortRpcParent = {
1165
+ __proto__: null,
1166
+ create: create$i
1167
+ };
978
1168
  const create$4 = async ({
979
1169
  commandMap,
980
1170
  isMessagePortOpen = true,
@@ -992,7 +1182,7 @@ const create$4 = async ({
992
1182
  messagePort.start();
993
1183
  return rpc;
994
1184
  };
995
- const create$2$1 = async ({
1185
+ const create$2 = async ({
996
1186
  commandMap,
997
1187
  isMessagePortOpen,
998
1188
  send
@@ -1008,10 +1198,6 @@ const create$2$1 = async ({
1008
1198
  messagePort: port2
1009
1199
  });
1010
1200
  };
1011
- const TransferMessagePortRpcParent = {
1012
- __proto__: null,
1013
- create: create$2$1
1014
- };
1015
1201
  const create$1$1 = async ({
1016
1202
  commandMap
1017
1203
  }) => {
@@ -1046,35 +1232,6 @@ const createMockRpc = ({
1046
1232
  return mockRpc;
1047
1233
  };
1048
1234
 
1049
- const Button$3 = 'event.button';
1050
- const ClientX = 'event.clientX';
1051
- const ClientY = 'event.clientY';
1052
- const CtrlKey = 'event.ctrlKey';
1053
- const DataTransferFiles = 'event.dataTransfer.files';
1054
- const DataTransferFiles2 = 'event.dataTransfer.files2';
1055
- const DefaultPrevented = 'event.defaultPrevented';
1056
- const DeltaMode = 'event.deltaMode';
1057
- const DeltaY = 'event.deltaY';
1058
- const EventTargetClassName = 'event.target.className';
1059
- const IsTrusted = 'event.isTrusted';
1060
- const ShiftKey = 'event.shiftKey';
1061
- const TargetName = 'event.target.name';
1062
- const TargetValue = 'event.target.value';
1063
-
1064
- const FileSystemWorker$1 = 209;
1065
- const IconThemeWorker = 7009;
1066
- const RendererWorker = 1;
1067
- const SourceControlWorker = 66;
1068
-
1069
- const FocusElementByName = 'Viewlet.focusElementByName';
1070
- const FocusSelector = 'Viewlet.focusSelector';
1071
- const SetCss = 'Viewlet.setCss';
1072
- const SetDom2 = 'Viewlet.setDom2';
1073
- const SetFocusContext = 'Viewlet.setFocusContext';
1074
-
1075
- const FocusExplorer = 13;
1076
- const FocusExplorerEditBox = 14;
1077
-
1078
1235
  const rpcs = Object.create(null);
1079
1236
  const set$6 = (id, rpc) => {
1080
1237
  rpcs[id] = rpc;
@@ -1082,8 +1239,12 @@ const set$6 = (id, rpc) => {
1082
1239
  const get$1 = id => {
1083
1240
  return rpcs[id];
1084
1241
  };
1242
+ const remove$2 = id => {
1243
+ delete rpcs[id];
1244
+ };
1085
1245
 
1086
- const create$2 = rpcId => {
1246
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
1247
+ const create$1 = rpcId => {
1087
1248
  return {
1088
1249
  async dispose() {
1089
1250
  const rpc = get$1(rpcId);
@@ -1101,6 +1262,18 @@ const create$2 = rpcId => {
1101
1262
  // @ts-ignore
1102
1263
  return rpc.invokeAndTransfer(method, ...params);
1103
1264
  },
1265
+ registerMockRpc(commandMap) {
1266
+ const mockRpc = createMockRpc({
1267
+ commandMap
1268
+ });
1269
+ set$6(rpcId, mockRpc);
1270
+ // @ts-ignore
1271
+ mockRpc[Symbol.dispose] = () => {
1272
+ remove$2(rpcId);
1273
+ };
1274
+ // @ts-ignore
1275
+ return mockRpc;
1276
+ },
1104
1277
  set(rpc) {
1105
1278
  set$6(rpcId, rpc);
1106
1279
  }
@@ -1111,8 +1284,9 @@ const {
1111
1284
  dispose,
1112
1285
  invoke: invoke$4,
1113
1286
  invokeAndTransfer: invokeAndTransfer$1,
1287
+ registerMockRpc,
1114
1288
  set: set$5
1115
- } = create$2(FileSystemWorker$1);
1289
+ } = create$1(FileSystemWorker$1);
1116
1290
  const remove$1 = async dirent => {
1117
1291
  return invoke$4('FileSystem.remove', dirent);
1118
1292
  };
@@ -1164,13 +1338,6 @@ const watchFile = async (watchId, uri, rpcId) => {
1164
1338
  const unwatchFile = async watchId => {
1165
1339
  await invoke$4('FileSystem.unwatchFile', watchId);
1166
1340
  };
1167
- const registerMockRpc = commandMap => {
1168
- const mockRpc = createMockRpc({
1169
- commandMap
1170
- });
1171
- set$5(mockRpc);
1172
- return mockRpc;
1173
- };
1174
1341
 
1175
1342
  const FileSystemWorker = {
1176
1343
  __proto__: null,
@@ -1201,7 +1368,7 @@ const FileSystemWorker = {
1201
1368
  const {
1202
1369
  invoke: invoke$3,
1203
1370
  set: set$4
1204
- } = create$2(IconThemeWorker);
1371
+ } = create$1(IconThemeWorker);
1205
1372
  const getIcons = async iconRequests => {
1206
1373
  // @ts-ignore
1207
1374
  return invoke$3('IconTheme.getIcons', iconRequests);
@@ -1211,7 +1378,7 @@ const {
1211
1378
  invoke: invoke$2,
1212
1379
  invokeAndTransfer,
1213
1380
  set: set$3
1214
- } = create$2(RendererWorker);
1381
+ } = create$1(RendererWorker);
1215
1382
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1216
1383
  number(uid);
1217
1384
  number(menuId);
@@ -1251,98 +1418,7 @@ const sendMessagePortToSourceControlWorker = async port => {
1251
1418
  const {
1252
1419
  invoke: invoke$1,
1253
1420
  set: set$2
1254
- } = create$2(SourceControlWorker);
1255
-
1256
- const toCommandId = key => {
1257
- const dotIndex = key.indexOf('.');
1258
- return key.slice(dotIndex + 1);
1259
- };
1260
- const create$1 = () => {
1261
- const states = Object.create(null);
1262
- const commandMapRef = {};
1263
- return {
1264
- get(uid) {
1265
- return states[uid];
1266
- },
1267
- set(uid, oldState, newState) {
1268
- states[uid] = {
1269
- oldState,
1270
- newState
1271
- };
1272
- },
1273
- dispose(uid) {
1274
- delete states[uid];
1275
- },
1276
- getKeys() {
1277
- return Object.keys(states).map(key => {
1278
- return Number.parseInt(key);
1279
- });
1280
- },
1281
- clear() {
1282
- for (const key of Object.keys(states)) {
1283
- delete states[key];
1284
- }
1285
- },
1286
- wrapCommand(fn) {
1287
- const wrapped = async (uid, ...args) => {
1288
- const {
1289
- oldState,
1290
- newState
1291
- } = states[uid];
1292
- const newerState = await fn(newState, ...args);
1293
- if (oldState === newerState || newState === newerState) {
1294
- return;
1295
- }
1296
- const latest = states[uid];
1297
- states[uid] = {
1298
- oldState: latest.oldState,
1299
- newState: newerState
1300
- };
1301
- };
1302
- return wrapped;
1303
- },
1304
- wrapGetter(fn) {
1305
- const wrapped = (uid, ...args) => {
1306
- const {
1307
- newState
1308
- } = states[uid];
1309
- return fn(newState, ...args);
1310
- };
1311
- return wrapped;
1312
- },
1313
- diff(uid, modules, numbers) {
1314
- const {
1315
- oldState,
1316
- newState
1317
- } = states[uid];
1318
- const diffResult = [];
1319
- for (let i = 0; i < modules.length; i++) {
1320
- const fn = modules[i];
1321
- if (!fn(oldState, newState)) {
1322
- diffResult.push(numbers[i]);
1323
- }
1324
- }
1325
- return diffResult;
1326
- },
1327
- getCommandIds() {
1328
- const keys = Object.keys(commandMapRef);
1329
- const ids = keys.map(toCommandId);
1330
- return ids;
1331
- },
1332
- registerCommands(commandMap) {
1333
- Object.assign(commandMapRef, commandMap);
1334
- }
1335
- };
1336
- };
1337
- const terminate = () => {
1338
- globalThis.close();
1339
- };
1340
-
1341
- const CreateFolder$1 = 1;
1342
- const CreateFile$1 = 2;
1343
- const Copy$1 = 3;
1344
- const Rename$2 = 4;
1345
- const Remove = 5;
1421
+ } = create$1(SourceControlWorker);
1346
1422
 
1347
1423
  // TODO use direct connection
1348
1424
  const invoke = async (method, ...params) => {
@@ -1822,7 +1898,7 @@ const Copy = 'Copy';
1822
1898
  const CopyPath = 'Copy Path';
1823
1899
  const CopyRelativePath = 'Copy Relative Path';
1824
1900
  const Cut = 'Cut';
1825
- const Delete$1 = 'Delete';
1901
+ const Delete = 'Delete';
1826
1902
  const FileNameCannotStartWithSlash = 'A file or folder name cannot start with a slash.';
1827
1903
  const FileOrFolderAlreadyExists = 'A file or folder **{PH1}** already exists at this location. Please choose a different name.';
1828
1904
  const FileOrFolderNameMustBeProvider = 'A file or folder name must be provided.';
@@ -1871,7 +1947,7 @@ const rename = () => {
1871
1947
  return i18nString(Rename);
1872
1948
  };
1873
1949
  const deleteItem = () => {
1874
- return i18nString(Delete$1);
1950
+ return i18nString(Delete);
1875
1951
  };
1876
1952
  const refresh$1 = () => {
1877
1953
  return i18nString(RefreshExplorer);
@@ -2194,14 +2270,12 @@ const toCollapsedDirent = dirent => {
2194
2270
 
2195
2271
  const collapseAll = async state => {
2196
2272
  const {
2197
- focusedIndex,
2198
2273
  items
2199
2274
  } = state;
2200
2275
  const newDirents = items.filter(isTopLevel).map(toCollapsedDirent);
2201
- const newFocusedIndex = getFocusedIndexCancel(newDirents, focusedIndex);
2202
2276
  return {
2203
2277
  ...state,
2204
- focusedIndex: newFocusedIndex,
2278
+ focusedIndex: 0,
2205
2279
  items: newDirents
2206
2280
  };
2207
2281
  };
@@ -2445,29 +2519,6 @@ const Viewlet = 'Viewlet';
2445
2519
  const Welcome = 'Welcome';
2446
2520
  const WelcomeMessage = 'WelcomeMessage';
2447
2521
 
2448
- const Text = 12;
2449
-
2450
- const Enter = 3;
2451
- const Escape = 8;
2452
- const Space = 9;
2453
- const End = 255;
2454
- const Home = 12;
2455
- const LeftArrow = 13;
2456
- const UpArrow = 14;
2457
- const RightArrow = 15;
2458
- const DownArrow = 16;
2459
- const Delete = 18;
2460
- const KeyA = 29;
2461
- const KeyC = 31;
2462
- const KeyV = 50;
2463
- const KeyX = 52;
2464
- const F2 = 58;
2465
- const Star = 131;
2466
-
2467
- const CtrlCmd = 1 << 11 >>> 0;
2468
- const Shift = 1 << 10 >>> 0;
2469
- const Alt = 1 << 9 >>> 0;
2470
-
2471
2522
  const mergeClassNames = (...classNames) => {
2472
2523
  return classNames.filter(Boolean).join(' ');
2473
2524
  };
@@ -2481,9 +2532,9 @@ const position = (x, y) => {
2481
2532
 
2482
2533
  const text = data => {
2483
2534
  return {
2484
- type: Text,
2535
+ childCount: 0,
2485
2536
  text: data,
2486
- childCount: 0
2537
+ type: Text
2487
2538
  };
2488
2539
  };
2489
2540
 
@@ -2583,7 +2634,7 @@ const {
2583
2634
  registerCommands,
2584
2635
  set,
2585
2636
  wrapGetter
2586
- } = create$1();
2637
+ } = create$6();
2587
2638
  const wrapListItemCommand = fn => {
2588
2639
  const wrappedCommand = async (id, ...args) => {
2589
2640
  const {
@@ -3083,7 +3134,7 @@ const getKeyBindings = () => {
3083
3134
  when: FocusExplorerEditBox
3084
3135
  }, {
3085
3136
  command: 'Explorer.removeDirent',
3086
- key: Delete,
3137
+ key: Delete$1,
3087
3138
  when: FocusExplorer
3088
3139
  }, {
3089
3140
  command: 'Explorer.focusNone',
@@ -4189,6 +4240,9 @@ const getFileOperations = (root, uploadTree) => {
4189
4240
  };
4190
4241
 
4191
4242
  const uploadFileSystemHandles = async (root, pathSeparator, fileSystemHandles) => {
4243
+ if (fileSystemHandles.length === 0) {
4244
+ return true;
4245
+ }
4192
4246
  const uploadTree = await createUploadTree(root, fileSystemHandles);
4193
4247
  const fileOperations = getFileOperations(root, uploadTree);
4194
4248
  await applyFileOperations(fileOperations);
@@ -4369,6 +4423,9 @@ const getFileArray = fileList => {
4369
4423
  };
4370
4424
 
4371
4425
  const getFileHandles = async fileIds => {
4426
+ if (fileIds.length === 0) {
4427
+ return [];
4428
+ }
4372
4429
  const files = await getFileHandles$1(fileIds);
4373
4430
  return files;
4374
4431
  };
@@ -5058,75 +5115,8 @@ const handleWorkspaceRefresh = async state => {
5058
5115
  return refresh(state);
5059
5116
  };
5060
5117
 
5061
- const sendMessagePortToFileSystemWorker = async port => {
5062
- await sendMessagePortToFileSystemWorker$1(port, 0);
5063
- };
5064
-
5065
- const createFileSystemWorkerRpc = async () => {
5066
- try {
5067
- const rpc = await TransferMessagePortRpcParent.create({
5068
- commandMap: {},
5069
- send: sendMessagePortToFileSystemWorker
5070
- });
5071
- return rpc;
5072
- } catch (error) {
5073
- throw new VError(error, `Failed to create file system worker rpc`);
5074
- }
5075
- };
5076
-
5077
- const initializeFileSystemWorker = async () => {
5078
- const rpc = await createFileSystemWorkerRpc();
5079
- set$1(rpc);
5080
- };
5081
-
5082
- const send$1 = port => {
5083
- return sendMessagePortToIconThemeWorker(port, 0);
5084
- };
5085
- const createIconThemeWorkerRpc = async () => {
5086
- try {
5087
- const rpc = await TransferMessagePortRpcParent.create({
5088
- commandMap: {},
5089
- send: send$1
5090
- });
5091
- return rpc;
5092
- } catch (error) {
5093
- throw new VError(error, `Failed to create icon theme worker rpc`);
5094
- }
5095
- };
5096
-
5097
- const initializeIconThemeWorker = async () => {
5098
- const rpc = await createIconThemeWorkerRpc();
5099
- set$4(rpc);
5100
- };
5101
-
5102
- const send = port => {
5103
- // @ts-ignore
5104
- return sendMessagePortToSourceControlWorker(port);
5105
- };
5106
- const createSourceControlWorkerRpc = async () => {
5107
- try {
5108
- const rpc = await TransferMessagePortRpcParent.create({
5109
- commandMap: {},
5110
- send
5111
- });
5112
- return rpc;
5113
- } catch (error) {
5114
- throw new VError(error, `Failed to create source control worker rpc`);
5115
- }
5116
- };
5117
-
5118
- const initializeSourceControlWorker = async () => {
5119
- try {
5120
- const rpc = await createSourceControlWorkerRpc();
5121
- // TODO
5122
- set$2(rpc);
5123
- } catch {
5124
- // ignore
5125
- }
5126
- };
5127
-
5128
5118
  const initialize = async () => {
5129
- await Promise.all([initializeFileSystemWorker(), initializeIconThemeWorker(), initializeSourceControlWorker()]);
5119
+ // this function is not needed anymore
5130
5120
  };
5131
5121
 
5132
5122
  const getContainingFolder = (root, dirents, focusedIndex, pathSeparator) => {
@@ -6280,14 +6270,85 @@ const commandMap = {
6280
6270
  'Explorer.updateIcons': wrapListItemCommand(updateIcons)
6281
6271
  };
6282
6272
 
6283
- const listen = async () => {
6284
- registerCommands(commandMap);
6273
+ const sendMessagePortToFileSystemWorker = async port => {
6274
+ await sendMessagePortToFileSystemWorker$1(port, 0);
6275
+ };
6276
+
6277
+ const createFileSystemWorkerRpc = async () => {
6278
+ try {
6279
+ const rpc = await LazyTransferMessagePortRpcParent.create({
6280
+ commandMap: {},
6281
+ send: sendMessagePortToFileSystemWorker
6282
+ });
6283
+ return rpc;
6284
+ } catch (error) {
6285
+ throw new VError(error, `Failed to create file system worker rpc`);
6286
+ }
6287
+ };
6288
+
6289
+ const initializeFileSystemWorker = async () => {
6290
+ const rpc = await createFileSystemWorkerRpc();
6291
+ set$1(rpc);
6292
+ };
6293
+
6294
+ const send$1 = port => {
6295
+ return sendMessagePortToIconThemeWorker(port, 0);
6296
+ };
6297
+ const createIconThemeWorkerRpc = async () => {
6298
+ try {
6299
+ const rpc = await LazyTransferMessagePortRpcParent.create({
6300
+ commandMap: {},
6301
+ send: send$1
6302
+ });
6303
+ return rpc;
6304
+ } catch (error) {
6305
+ throw new VError(error, `Failed to create icon theme worker rpc`);
6306
+ }
6307
+ };
6308
+
6309
+ const initializeIconThemeWorker = async () => {
6310
+ const rpc = await createIconThemeWorkerRpc();
6311
+ set$4(rpc);
6312
+ };
6313
+
6314
+ const initializeRendererWorker = async () => {
6285
6315
  const rpc = await WebWorkerRpcClient.create({
6286
6316
  commandMap: commandMap
6287
6317
  });
6288
6318
  set$3(rpc);
6289
6319
  };
6290
6320
 
6321
+ const send = port => {
6322
+ // @ts-ignore
6323
+ return sendMessagePortToSourceControlWorker(port);
6324
+ };
6325
+ const createSourceControlWorkerRpc = async () => {
6326
+ try {
6327
+ const rpc = await LazyTransferMessagePortRpcParent.create({
6328
+ commandMap: {},
6329
+ send
6330
+ });
6331
+ return rpc;
6332
+ } catch (error) {
6333
+ throw new VError(error, `Failed to create source control worker rpc`);
6334
+ }
6335
+ };
6336
+
6337
+ const initializeSourceControlWorker = async () => {
6338
+ try {
6339
+ const rpc = await createSourceControlWorkerRpc();
6340
+ // TODO
6341
+ set$2(rpc);
6342
+ } catch {
6343
+ // ignore
6344
+ }
6345
+ };
6346
+
6347
+ const listen = async () => {
6348
+ registerCommands(commandMap);
6349
+ await Promise.all([initializeRendererWorker(), initializeFileSystemWorker(), initializeIconThemeWorker(), initializeSourceControlWorker()]);
6350
+ };
6351
+
6291
6352
  const main = async () => {
6292
6353
  await listen();
6293
6354
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "5.18.0",
3
+ "version": "5.20.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",