@lvce-editor/explorer-view 5.0.0 → 5.2.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.
@@ -533,7 +533,7 @@ const create$4$1 = (method, params) => {
533
533
  };
534
534
  };
535
535
  const callbacks = Object.create(null);
536
- const set$6 = (id, fn) => {
536
+ const set$7 = (id, fn) => {
537
537
  callbacks[id] = fn;
538
538
  };
539
539
  const get$2 = id => {
@@ -552,7 +552,7 @@ const registerPromise = () => {
552
552
  resolve,
553
553
  promise
554
554
  } = Promise.withResolvers();
555
- set$6(id, resolve);
555
+ set$7(id, resolve);
556
556
  return {
557
557
  id,
558
558
  promise
@@ -893,11 +893,11 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
893
893
  const responseMessage = await promise;
894
894
  return unwrapJsonRpcResult(responseMessage);
895
895
  };
896
- const send$1 = (transport, method, ...params) => {
896
+ const send$2 = (transport, method, ...params) => {
897
897
  const message = create$4$1(method, params);
898
898
  transport.send(message);
899
899
  };
900
- const invoke$4 = (ipc, method, ...params) => {
900
+ const invoke$5 = (ipc, method, ...params) => {
901
901
  return invokeHelper(ipc, method, params, false);
902
902
  };
903
903
  const invokeAndTransfer$2 = (ipc, method, ...params) => {
@@ -933,10 +933,10 @@ const createRpc = ipc => {
933
933
  * @deprecated
934
934
  */
935
935
  send(method, ...params) {
936
- send$1(ipc, method, ...params);
936
+ send$2(ipc, method, ...params);
937
937
  },
938
938
  invoke(method, ...params) {
939
- return invoke$4(ipc, method, ...params);
939
+ return invoke$5(ipc, method, ...params);
940
940
  },
941
941
  invokeAndTransfer(method, ...params) {
942
942
  return invokeAndTransfer$2(ipc, method, ...params);
@@ -1084,6 +1084,7 @@ const Alt = 1 << 9 >>> 0;
1084
1084
 
1085
1085
  const FileSystemWorker$1 = 209;
1086
1086
  const RendererWorker = 1;
1087
+ const SourceControlWorker = 66;
1087
1088
  const IconThemeWorker = 7009;
1088
1089
 
1089
1090
  const FocusElementByName = 'Viewlet.focusElementByName';
@@ -1096,7 +1097,7 @@ const FocusExplorer = 13;
1096
1097
  const FocusExplorerEditBox = 14;
1097
1098
 
1098
1099
  const rpcs = Object.create(null);
1099
- const set$5 = (id, rpc) => {
1100
+ const set$6 = (id, rpc) => {
1100
1101
  rpcs[id] = rpc;
1101
1102
  };
1102
1103
  const get$1 = id => {
@@ -1118,7 +1119,7 @@ const create$2 = rpcId => {
1118
1119
  return rpc.invokeAndTransfer(method, ...params);
1119
1120
  },
1120
1121
  set(rpc) {
1121
- set$5(rpcId, rpc);
1122
+ set$6(rpcId, rpc);
1122
1123
  },
1123
1124
  async dispose() {
1124
1125
  const rpc = get$1(rpcId);
@@ -1128,66 +1129,66 @@ const create$2 = rpcId => {
1128
1129
  };
1129
1130
 
1130
1131
  const {
1131
- invoke: invoke$3,
1132
+ invoke: invoke$4,
1132
1133
  invokeAndTransfer: invokeAndTransfer$1,
1133
- set: set$4,
1134
+ set: set$5,
1134
1135
  dispose
1135
1136
  } = create$2(FileSystemWorker$1);
1136
1137
  const remove$1 = async dirent => {
1137
- return invoke$3('FileSystem.remove', dirent);
1138
+ return invoke$4('FileSystem.remove', dirent);
1138
1139
  };
1139
1140
  const readDirWithFileTypes$1 = async uri => {
1140
- return invoke$3('FileSystem.readDirWithFileTypes', uri);
1141
+ return invoke$4('FileSystem.readDirWithFileTypes', uri);
1141
1142
  };
1142
1143
  const getPathSeparator$2 = async root => {
1143
1144
  // @ts-ignore
1144
- return invoke$3('FileSystem.getPathSeparator', root);
1145
+ return invoke$4('FileSystem.getPathSeparator', root);
1145
1146
  };
1146
1147
  const getRealPath$1 = async path => {
1147
- return invoke$3('FileSystem.getRealPath', path);
1148
+ return invoke$4('FileSystem.getRealPath', path);
1148
1149
  };
1149
1150
  const stat$1 = async dirent => {
1150
- return invoke$3('FileSystem.stat', dirent);
1151
+ return invoke$4('FileSystem.stat', dirent);
1151
1152
  };
1152
1153
  const createFile = async uri => {
1153
- return invoke$3('FileSystem.writeFile', uri, '');
1154
+ return invoke$4('FileSystem.writeFile', uri, '');
1154
1155
  };
1155
1156
  const readFile = async uri => {
1156
- return invoke$3('FileSystem.readFile', uri);
1157
+ return invoke$4('FileSystem.readFile', uri);
1157
1158
  };
1158
1159
  const writeFile$1 = async (uri, content) => {
1159
- return invoke$3('FileSystem.writeFile', uri, content);
1160
+ return invoke$4('FileSystem.writeFile', uri, content);
1160
1161
  };
1161
1162
  const mkdir$1 = async uri => {
1162
- return invoke$3('FileSystem.mkdir', uri);
1163
+ return invoke$4('FileSystem.mkdir', uri);
1163
1164
  };
1164
1165
  const rename$2 = async (oldUri, newUri) => {
1165
- return invoke$3('FileSystem.rename', oldUri, newUri);
1166
+ return invoke$4('FileSystem.rename', oldUri, newUri);
1166
1167
  };
1167
1168
  const copy$2 = async (oldUri, newUri) => {
1168
- return invoke$3('FileSystem.copy', oldUri, newUri);
1169
+ return invoke$4('FileSystem.copy', oldUri, newUri);
1169
1170
  };
1170
1171
  const exists = async uri => {
1171
1172
  // @ts-ignore
1172
- return invoke$3('FileSystem.exists', uri);
1173
+ return invoke$4('FileSystem.exists', uri);
1173
1174
  };
1174
1175
  const getFolderSize = async uri => {
1175
1176
  // @ts-ignore
1176
- return invoke$3('FileSystem.getFolderSize', uri);
1177
+ return invoke$4('FileSystem.getFolderSize', uri);
1177
1178
  };
1178
1179
  const readFileAsBlob = async uri => {
1179
1180
  // @ts-ignore
1180
- return invoke$3('FileSystem.readFileAsBlob', uri);
1181
+ return invoke$4('FileSystem.readFileAsBlob', uri);
1181
1182
  };
1182
1183
  const appendFile = async (uri, text) => {
1183
1184
  // @ts-ignore
1184
- return invoke$3('FileSystem.appendFile', uri, text);
1185
+ return invoke$4('FileSystem.appendFile', uri, text);
1185
1186
  };
1186
1187
  const registerMockRpc = commandMap => {
1187
1188
  const mockRpc = createMockRpc({
1188
1189
  commandMap
1189
1190
  });
1190
- set$4(mockRpc);
1191
+ set$5(mockRpc);
1191
1192
  return mockRpc;
1192
1193
  };
1193
1194
 
@@ -1201,7 +1202,7 @@ const FileSystemWorker = {
1201
1202
  getFolderSize,
1202
1203
  getPathSeparator: getPathSeparator$2,
1203
1204
  getRealPath: getRealPath$1,
1204
- invoke: invoke$3,
1205
+ invoke: invoke$4,
1205
1206
  invokeAndTransfer: invokeAndTransfer$1,
1206
1207
  mkdir: mkdir$1,
1207
1208
  readDirWithFileTypes: readDirWithFileTypes$1,
@@ -1210,30 +1211,30 @@ const FileSystemWorker = {
1210
1211
  registerMockRpc,
1211
1212
  remove: remove$1,
1212
1213
  rename: rename$2,
1213
- set: set$4,
1214
+ set: set$5,
1214
1215
  stat: stat$1,
1215
1216
  writeFile: writeFile$1
1216
1217
  };
1217
1218
 
1218
1219
  const {
1219
- invoke: invoke$2,
1220
- set: set$3} = create$2(IconThemeWorker);
1220
+ invoke: invoke$3,
1221
+ set: set$4} = create$2(IconThemeWorker);
1221
1222
  const getIcons = async iconRequests => {
1222
1223
  // @ts-ignore
1223
- return invoke$2('IconTheme.getIcons', iconRequests);
1224
+ return invoke$3('IconTheme.getIcons', iconRequests);
1224
1225
  };
1225
1226
 
1226
1227
  const {
1227
- invoke: invoke$1,
1228
+ invoke: invoke$2,
1228
1229
  invokeAndTransfer,
1229
- set: set$2} = create$2(RendererWorker);
1230
+ set: set$3} = create$2(RendererWorker);
1230
1231
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1231
1232
  number(uid);
1232
1233
  number(menuId);
1233
1234
  number(x);
1234
1235
  number(y);
1235
1236
  // @ts-ignore
1236
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1237
+ await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1237
1238
  };
1238
1239
  const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1239
1240
  const command = 'IconTheme.handleMessagePort';
@@ -1247,13 +1248,22 @@ const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
1247
1248
  };
1248
1249
  const confirm = async (message, options) => {
1249
1250
  // @ts-ignore
1250
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1251
+ const result = await invoke$2('ConfirmPrompt.prompt', message, options);
1251
1252
  return result;
1252
1253
  };
1253
1254
  const writeClipBoardText = async text => {
1254
- await invoke$1('ClipBoard.writeText', /* text */text);
1255
+ await invoke$2('ClipBoard.writeText', /* text */text);
1256
+ };
1257
+ const sendMessagePortToSourceControlWorker = async port => {
1258
+ const command = 'SourceControl.handleMessagePort';
1259
+ // @ts-ignore
1260
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
1255
1261
  };
1256
1262
 
1263
+ const {
1264
+ invoke: invoke$1,
1265
+ set: set$2} = create$2(SourceControlWorker);
1266
+
1257
1267
  const toCommandId = key => {
1258
1268
  const dotIndex = key.indexOf('.');
1259
1269
  return key.slice(dotIndex + 1);
@@ -1287,10 +1297,11 @@ const create$1 = () => {
1287
1297
  wrapCommand(fn) {
1288
1298
  const wrapped = async (uid, ...args) => {
1289
1299
  const {
1300
+ oldState,
1290
1301
  newState
1291
1302
  } = states[uid];
1292
1303
  const newerState = await fn(newState, ...args);
1293
- if (newState === newerState) {
1304
+ if (oldState === newerState || newState === newerState) {
1294
1305
  return;
1295
1306
  }
1296
1307
  const latest = states[uid];
@@ -1346,7 +1357,7 @@ const Remove = 5;
1346
1357
 
1347
1358
  // TODO use direct connection
1348
1359
  const invoke = async (method, ...params) => {
1349
- return invoke$1(method, ...params);
1360
+ return invoke$2(method, ...params);
1350
1361
  };
1351
1362
  const {
1352
1363
  set: set$1
@@ -2209,10 +2220,10 @@ const writeText = async text => {
2209
2220
  };
2210
2221
  const readNativeFiles = async () => {
2211
2222
  // @ts-ignore
2212
- return invoke$1('ClipBoard.readNativeFiles');
2223
+ return invoke$2('ClipBoard.readNativeFiles');
2213
2224
  };
2214
2225
  const writeNativeFiles = async (type, files) => {
2215
- return invoke$1('ClipBoard.writeNativeFiles', type, files);
2226
+ return invoke$2('ClipBoard.writeNativeFiles', type, files);
2216
2227
  };
2217
2228
 
2218
2229
  const copyRelativePath = async state => {
@@ -2329,6 +2340,25 @@ const None$4 = 0;
2329
2340
  const Right = 1;
2330
2341
  const Down = 2;
2331
2342
 
2343
+ const ensureUri = item => {
2344
+ if (item.startsWith('/')) {
2345
+ return `file://` + item;
2346
+ }
2347
+ return item;
2348
+ };
2349
+ const ensureUris = maybeUris => {
2350
+ return maybeUris.map(ensureUri);
2351
+ };
2352
+
2353
+ const createDecorationMap = decorations => {
2354
+ const map = Object.create(null);
2355
+ for (const decoration of decorations) {
2356
+ const uri = ensureUri(decoration.uri);
2357
+ map[uri] = decoration.decoration;
2358
+ }
2359
+ return map;
2360
+ };
2361
+
2332
2362
  const getChevronType = (type, useChevrons) => {
2333
2363
  if (!useChevrons) {
2334
2364
  return None$4;
@@ -2419,7 +2449,7 @@ const text = data => {
2419
2449
  };
2420
2450
  };
2421
2451
 
2422
- const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, indent) => {
2452
+ const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, indent, decoration) => {
2423
2453
  let className = TreeItem$1;
2424
2454
  className = mergeClassNames(className, `Indent-${indent}`);
2425
2455
  if (isSelected || isFocused) {
@@ -2428,6 +2458,9 @@ const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, in
2428
2458
  if (isDropping) {
2429
2459
  className = mergeClassNames(className, 'DropTarget');
2430
2460
  }
2461
+ if (decoration) {
2462
+ className = mergeClassNames(className, `decoration-${decoration}`);
2463
+ }
2431
2464
  return className;
2432
2465
  };
2433
2466
 
@@ -2459,7 +2492,8 @@ const getEditingChevron = direntType => {
2459
2492
  return None$4;
2460
2493
  }
2461
2494
  };
2462
- const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = []) => {
2495
+ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = [], decorations) => {
2496
+ const decorationMap = createDecorationMap(decorations);
2463
2497
  const visible = [];
2464
2498
  const indentFn = useChevrons ? getTreeItemIndentWithChevron : getTreeItemIndent;
2465
2499
  let iconIndex = 0;
@@ -2473,7 +2507,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
2473
2507
  const isDropping = dropTargets.includes(i);
2474
2508
  const isIgnored = sourceControlIgnoredUris.includes(item.path);
2475
2509
  const indent = indentFn(item.depth, chevron);
2476
- const className = getTreeItemClassName(isSelected, isFocused, isDropping, useChevrons, indent);
2510
+ const decoration = decorationMap[item.path] || '';
2511
+ const className = getTreeItemClassName(isSelected, isFocused, isDropping, useChevrons, indent, decoration);
2477
2512
  const expanded = getExpandedType(item.type);
2478
2513
  const ariaExpanded = ariaExpandedValues[expanded];
2479
2514
  const isEditing = i === editingIndex;
@@ -2496,7 +2531,9 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
2496
2531
  className,
2497
2532
  isCut,
2498
2533
  isIgnored,
2499
- index: i
2534
+ index: i,
2535
+ // @ts-ignore
2536
+ decoration
2500
2537
  });
2501
2538
  }
2502
2539
  return visible;
@@ -2528,12 +2565,13 @@ const wrapListItemCommand = fn => {
2528
2565
  sourceControlIgnoredUris,
2529
2566
  height,
2530
2567
  itemHeight,
2531
- fileIconCache
2568
+ fileIconCache,
2569
+ decorations
2532
2570
  } = updatedState;
2533
2571
  const intermediate = get(id);
2534
2572
  set(id, intermediate.oldState, updatedState);
2535
2573
  const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, items.length);
2536
- if (items === intermediate.newState.items && minLineY === intermediate.newState.minLineY && editingIcon === intermediate.newState.editingIcon && cutItems === intermediate.newState.cutItems && editingErrorMessage === intermediate.newState.editingErrorMessage && dropTargets === intermediate.newState.dropTargets && fileIconCache === intermediate.newState.fileIconCache) {
2574
+ if (items === intermediate.newState.items && minLineY === intermediate.newState.minLineY && editingIcon === intermediate.newState.editingIcon && cutItems === intermediate.newState.cutItems && editingErrorMessage === intermediate.newState.editingErrorMessage && dropTargets === intermediate.newState.dropTargets && fileIconCache === intermediate.newState.fileIconCache && decorations === intermediate.newState.decorations) {
2537
2575
  return;
2538
2576
  }
2539
2577
  const visible = items.slice(minLineY, maxLineY);
@@ -2541,7 +2579,7 @@ const wrapListItemCommand = fn => {
2541
2579
  icons,
2542
2580
  newFileIconCache
2543
2581
  } = await getFileIcons(visible, fileIconCache);
2544
- const visibleExplorerItems = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris);
2582
+ const visibleExplorerItems = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris, decorations);
2545
2583
  const finalState = {
2546
2584
  ...updatedState,
2547
2585
  visibleExplorerItems,
@@ -2611,7 +2649,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
2611
2649
  errorMessageLeft: 0,
2612
2650
  errorMessageTop: 0,
2613
2651
  visibleExplorerItems: [],
2614
- errorMessageWidth: 0
2652
+ errorMessageWidth: 0,
2653
+ decorations: []
2615
2654
  };
2616
2655
  set(state.uid, state, state);
2617
2656
  return state;
@@ -3304,7 +3343,7 @@ const handleClickDirectory = async (state, dirent, index, keepFocus) => {
3304
3343
  };
3305
3344
 
3306
3345
  const openUri = async (uri, focus) => {
3307
- await invoke$1(/* Main.openAbsolutePath */'Main.openUri', /* absolutePath */uri, /* focus */focus);
3346
+ await invoke$2(/* Main.openAbsolutePath */'Main.openUri', /* absolutePath */uri, /* focus */focus);
3308
3347
  };
3309
3348
 
3310
3349
  const handleClickFile = async (state, dirent, index, keepFocus = false) => {
@@ -3597,7 +3636,7 @@ const handleClickCurrentButKeepFocus = state => {
3597
3636
 
3598
3637
  const openFolder = async () => {
3599
3638
  // @ts-ignore
3600
- await invoke$1(`Dialog.openFolder`);
3639
+ await invoke$2(`Dialog.openFolder`);
3601
3640
  };
3602
3641
 
3603
3642
  const handleClickOpenFolder = async state => {
@@ -4134,12 +4173,12 @@ const getFileArray = fileList => {
4134
4173
  };
4135
4174
 
4136
4175
  const getFileHandles = async fileIds => {
4137
- const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
4176
+ const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
4138
4177
  return files;
4139
4178
  };
4140
4179
 
4141
4180
  const getFilePathElectron = async file => {
4142
- return invoke$1('FileSystemHandle.getFilePathElectron', file);
4181
+ return invoke$2('FileSystemHandle.getFilePathElectron', file);
4143
4182
  };
4144
4183
 
4145
4184
  const getFilepath = async file => {
@@ -4274,7 +4313,7 @@ const handleKeyDown = (state, key) => {
4274
4313
 
4275
4314
  // @ts-ignore
4276
4315
  timeout = setTimeout(async () => {
4277
- await invoke$1('Explorer.cancelTypeAhead');
4316
+ await invoke$2('Explorer.cancelTypeAhead');
4278
4317
  }, focusWordTimeout);
4279
4318
  if (matchingIndex === -1) {
4280
4319
  return {
@@ -4593,16 +4632,37 @@ const handleWheel = (state, deltaMode, deltaY) => {
4593
4632
  };
4594
4633
 
4595
4634
  const getWorkspacePath = () => {
4596
- return invoke$1('Workspace.getPath');
4635
+ return invoke$2('Workspace.getPath');
4636
+ };
4637
+
4638
+ const DecorationsEnabled = false;
4639
+
4640
+ const getFileDecorations = async (scheme, root, maybeUris) => {
4641
+ try {
4642
+ if (!DecorationsEnabled) {
4643
+ return [];
4644
+ }
4645
+ const providerIds = await invoke$1('SourceControl.getEnabledProviderIds', scheme, root);
4646
+ if (providerIds.length === 0) {
4647
+ return [];
4648
+ }
4649
+ const providerId = providerIds[0];
4650
+ const uris = ensureUris(maybeUris);
4651
+ const decorations = await invoke$1('SourceControl.getFileDecorations', providerId, uris);
4652
+ return decorations;
4653
+ } catch (error) {
4654
+ console.error(error);
4655
+ return [];
4656
+ }
4597
4657
  };
4598
4658
 
4599
4659
  const getSettings = async () => {
4600
4660
  // TODO get all settings at once
4601
- const useChevronsRaw = await invoke$1('Preferences.get', 'explorer.useChevrons');
4661
+ const useChevronsRaw = await invoke$2('Preferences.get', 'explorer.useChevrons');
4602
4662
  const useChevrons = useChevronsRaw === false ? false : true;
4603
- const confirmDeleteRaw = await invoke$1('Preferences.get', 'explorer.confirmdelete');
4663
+ const confirmDeleteRaw = await invoke$2('Preferences.get', 'explorer.confirmdelete');
4604
4664
  const confirmDelete = confirmDeleteRaw === false ? false : false;
4605
- const confirmPasteRaw = await invoke$1('Preferences.get', 'explorer.confirmpaste');
4665
+ const confirmPasteRaw = await invoke$2('Preferences.get', 'explorer.confirmpaste');
4606
4666
  const confirmPaste = confirmPasteRaw === false ? false : false;
4607
4667
  return {
4608
4668
  useChevrons,
@@ -4720,6 +4780,14 @@ const getExcluded = () => {
4720
4780
  const getSavedRoot = (savedState, workspacePath) => {
4721
4781
  return workspacePath;
4722
4782
  };
4783
+ const RE_PROTOCOL = /^[a-z+]:\/\//;
4784
+ const getScheme = uri => {
4785
+ const match = uri.match(RE_PROTOCOL);
4786
+ if (!match) {
4787
+ return '';
4788
+ }
4789
+ return match[0];
4790
+ };
4723
4791
  const loadContent = async (state, savedState) => {
4724
4792
  const {
4725
4793
  useChevrons,
@@ -4739,6 +4807,8 @@ const loadContent = async (state, savedState) => {
4739
4807
  if (savedState && typeof savedState.deltaY === 'number') {
4740
4808
  deltaY = savedState.deltaY;
4741
4809
  }
4810
+ const scheme = getScheme(root);
4811
+ const decorations = await getFileDecorations(scheme, root, restoredDirents.filter(item => item.depth === 1).map(item => item.path));
4742
4812
  return {
4743
4813
  ...state,
4744
4814
  confirmDelete,
@@ -4749,7 +4819,8 @@ const loadContent = async (state, savedState) => {
4749
4819
  minLineY,
4750
4820
  pathSeparator,
4751
4821
  root,
4752
- useChevrons
4822
+ useChevrons,
4823
+ decorations
4753
4824
  };
4754
4825
  };
4755
4826
 
@@ -4784,14 +4855,14 @@ const initializeFileSystemWorker = async () => {
4784
4855
  set$1(rpc);
4785
4856
  };
4786
4857
 
4787
- const send = port => {
4858
+ const send$1 = port => {
4788
4859
  return sendMessagePortToIconThemeWorker(port, 0);
4789
4860
  };
4790
4861
  const createIconThemeWorkerRpc = async () => {
4791
4862
  try {
4792
4863
  const rpc = await TransferMessagePortRpcParent.create({
4793
4864
  commandMap: {},
4794
- send
4865
+ send: send$1
4795
4866
  });
4796
4867
  return rpc;
4797
4868
  } catch (error) {
@@ -4801,11 +4872,40 @@ const createIconThemeWorkerRpc = async () => {
4801
4872
 
4802
4873
  const initializeIconThemeWorker = async () => {
4803
4874
  const rpc = await createIconThemeWorkerRpc();
4804
- set$3(rpc);
4875
+ set$4(rpc);
4876
+ };
4877
+
4878
+ const send = port => {
4879
+ // @ts-ignore
4880
+ return sendMessagePortToSourceControlWorker(port);
4881
+ };
4882
+ const createSourceControlWorkerRpc = async () => {
4883
+ try {
4884
+ const rpc = await TransferMessagePortRpcParent.create({
4885
+ commandMap: {},
4886
+ send
4887
+ });
4888
+ return rpc;
4889
+ } catch (error) {
4890
+ throw new VError(error, `Failed to create source control worker rpc`);
4891
+ }
4892
+ };
4893
+
4894
+ const initializeSourceControlWorker = async () => {
4895
+ try {
4896
+ if (!DecorationsEnabled) {
4897
+ return;
4898
+ }
4899
+ const rpc = await createSourceControlWorkerRpc();
4900
+ // TODO
4901
+ set$2(rpc);
4902
+ } catch {
4903
+ // ignore
4904
+ }
4805
4905
  };
4806
4906
 
4807
4907
  const initialize = async () => {
4808
- await Promise.all([initializeFileSystemWorker(), initializeIconThemeWorker()]);
4908
+ await Promise.all([initializeFileSystemWorker(), initializeIconThemeWorker(), initializeSourceControlWorker()]);
4809
4909
  };
4810
4910
 
4811
4911
  const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntType) => {
@@ -4942,7 +5042,7 @@ const getContainingFolder = (root, dirents, focusedIndex, pathSeparator) => {
4942
5042
  };
4943
5043
 
4944
5044
  const openNativeFolder = async path => {
4945
- await invoke$1('OpenNativeFolder.openNativeFolder', /* path */path);
5045
+ await invoke$2('OpenNativeFolder.openNativeFolder', /* path */path);
4946
5046
  };
4947
5047
 
4948
5048
  const openContainingFolder = async state => {
@@ -5930,24 +6030,24 @@ const selectUp = state => {
5930
6030
 
5931
6031
  const getEditingIcon = async (editingType, value, direntType) => {
5932
6032
  if (editingType === CreateFile) {
5933
- return invoke$1('IconTheme.getFileIcon', {
6033
+ return invoke$2('IconTheme.getFileIcon', {
5934
6034
  name: value
5935
6035
  });
5936
6036
  }
5937
6037
  if (editingType === Rename$1) {
5938
6038
  if (direntType === File || direntType === EditingFile) {
5939
- return invoke$1('IconTheme.getFileIcon', {
6039
+ return invoke$2('IconTheme.getFileIcon', {
5940
6040
  name: value
5941
6041
  });
5942
6042
  }
5943
6043
  if (direntType === Directory || direntType === EditingFolder || direntType === EditingDirectoryExpanded) {
5944
- return invoke$1('IconTheme.getFolderIcon', {
6044
+ return invoke$2('IconTheme.getFolderIcon', {
5945
6045
  name: value
5946
6046
  });
5947
6047
  }
5948
6048
  }
5949
6049
  if (editingType === CreateFolder) {
5950
- return invoke$1('IconTheme.getFolderIcon', {
6050
+ return invoke$2('IconTheme.getFolderIcon', {
5951
6051
  name: value
5952
6052
  });
5953
6053
  }
@@ -6062,7 +6162,7 @@ const listen = async () => {
6062
6162
  const rpc = await WebWorkerRpcClient.create({
6063
6163
  commandMap: commandMap
6064
6164
  });
6065
- set$2(rpc);
6165
+ set$3(rpc);
6066
6166
  };
6067
6167
 
6068
6168
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",