@lvce-editor/text-search-worker 4.13.0 → 5.1.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.
@@ -591,7 +591,7 @@ const callbacks = Object.create(null);
591
591
  const set$4 = (id, fn) => {
592
592
  callbacks[id] = fn;
593
593
  };
594
- const get$2 = id => {
594
+ const get$3 = id => {
595
595
  return callbacks[id];
596
596
  };
597
597
  const remove$1 = id => {
@@ -771,7 +771,7 @@ const warn = (...args) => {
771
771
  console.warn(...args);
772
772
  };
773
773
  const resolve = (id, response) => {
774
- const fn = get$2(id);
774
+ const fn = get$3(id);
775
775
  if (!fn) {
776
776
  console.log(response);
777
777
  warn(`callback ${id} may already be disposed`);
@@ -1144,7 +1144,7 @@ const rpcs = Object.create(null);
1144
1144
  const set$g = (id, rpc) => {
1145
1145
  rpcs[id] = rpc;
1146
1146
  };
1147
- const get$1 = id => {
1147
+ const get$2 = id => {
1148
1148
  return rpcs[id];
1149
1149
  };
1150
1150
 
@@ -1154,13 +1154,13 @@ const create$3 = rpcId => {
1154
1154
  return {
1155
1155
  // @ts-ignore
1156
1156
  invoke(method, ...params) {
1157
- const rpc = get$1(rpcId);
1157
+ const rpc = get$2(rpcId);
1158
1158
  // @ts-ignore
1159
1159
  return rpc.invoke(method, ...params);
1160
1160
  },
1161
1161
  // @ts-ignore
1162
1162
  invokeAndTransfer(method, ...params) {
1163
- const rpc = get$1(rpcId);
1163
+ const rpc = get$2(rpcId);
1164
1164
  // @ts-ignore
1165
1165
  return rpc.invokeAndTransfer(method, ...params);
1166
1166
  },
@@ -1168,20 +1168,23 @@ const create$3 = rpcId => {
1168
1168
  set$g(rpcId, rpc);
1169
1169
  },
1170
1170
  async dispose() {
1171
- const rpc = get$1(rpcId);
1171
+ const rpc = get$2(rpcId);
1172
1172
  await rpc.dispose();
1173
1173
  }
1174
1174
  };
1175
1175
  };
1176
1176
  const RendererWorker$1 = 1;
1177
1177
  const SearchProcess$1 = 77;
1178
+ const RpcId = {
1179
+ __proto__: null,
1180
+ SearchProcess: SearchProcess$1};
1178
1181
  const {
1179
- invoke: invoke$3,
1182
+ invoke: invoke$4,
1180
1183
  invokeAndTransfer: invokeAndTransfer$3,
1181
1184
  set: set$3} = create$3(RendererWorker$1);
1182
1185
  const RendererWorker = {
1183
1186
  __proto__: null,
1184
- invoke: invoke$3,
1187
+ invoke: invoke$4,
1185
1188
  invokeAndTransfer: invokeAndTransfer$3,
1186
1189
  set: set$3
1187
1190
  };
@@ -1272,7 +1275,7 @@ const create$2 = () => {
1272
1275
  };
1273
1276
 
1274
1277
  const {
1275
- get,
1278
+ get: get$1,
1276
1279
  set: set$1,
1277
1280
  wrapCommand
1278
1281
  } = create$2();
@@ -1414,7 +1417,7 @@ const diff2 = uid => {
1414
1417
  const {
1415
1418
  oldState,
1416
1419
  newState
1417
- } = get(uid);
1420
+ } = get$1(uid);
1418
1421
  const diffResult = diff$1(oldState, newState);
1419
1422
  return diffResult;
1420
1423
  };
@@ -2067,204 +2070,23 @@ const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
2067
2070
  };
2068
2071
  const getScrollBarY$1 = getScrollBarOffset$1;
2069
2072
 
2070
- const textSearch$6 = async (scheme, root, query) => {
2071
- string(scheme);
2072
- string(query);
2073
- const result = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
2074
- return result;
2075
- };
2076
-
2077
- const textSearch$5 = async (scheme, root, query, options, assetDir) => {
2078
- return invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
2073
+ const providers = Object.create(null);
2074
+ const add = providerMap => {
2075
+ Object.assign(providers, providerMap);
2079
2076
  };
2080
-
2081
- const textSearch$4 = async (scheme, root, query) => {
2082
- return invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
2077
+ const get = protocol => {
2078
+ return providers[protocol] || providers['default'];
2083
2079
  };
2084
2080
 
2085
- const textSearch$3 = async (scheme, root, query, options, assetDir) => {
2086
- return invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
2081
+ const getTextSearchProvider = scheme => {
2082
+ return get(scheme);
2087
2083
  };
2088
2084
 
2089
- const getRipGrepArgs = ({
2090
- threads,
2091
- isCaseSensitive,
2092
- searchString,
2093
- useRegularExpression
2094
- }) => {
2095
- const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json'];
2096
- ripGrepArgs.push('--threads', `${threads}`);
2097
- if (isCaseSensitive) {
2098
- ripGrepArgs.push('--case-sensitive');
2099
- } else {
2100
- ripGrepArgs.push('--ignore-case');
2101
- }
2102
- if (useRegularExpression) {
2103
- ripGrepArgs.push('--regexp', searchString);
2104
- } else {
2105
- ripGrepArgs.push('--fixed-strings');
2106
- ripGrepArgs.push('--');
2107
- ripGrepArgs.push(searchString);
2108
- }
2109
- ripGrepArgs.push('.');
2110
- return ripGrepArgs;
2111
- };
2112
-
2113
- const Electron = 2;
2114
- const Remote = 3;
2115
-
2116
- const Https = 'https:';
2117
- const Ws = 'ws:';
2118
- const Wss = 'wss:';
2119
-
2120
- const getWebSocketProtocol = locationProtocol => {
2121
- return locationProtocol === Https ? Wss : Ws;
2122
- };
2123
-
2124
- const getWebSocketUrl = (type, host, locationProtocol) => {
2125
- const wsProtocol = getWebSocketProtocol(locationProtocol);
2126
- return `${wsProtocol}//${host}/websocket/${type}`;
2127
- };
2128
-
2129
- const getHost = () => {
2130
- return location.host;
2131
- };
2132
- const getProtocol = () => {
2133
- return location.protocol;
2134
- };
2135
-
2136
- const launchSearchProcess = async () => {
2137
- const host = getHost();
2138
- const protocol = getProtocol();
2139
- const wsUrl = getWebSocketUrl('search-process', host, protocol);
2140
- const webSocket = new WebSocket(wsUrl);
2141
- const rpc = await WebSocketRpcParent.create({
2142
- webSocket,
2143
- commandMap: {}
2144
- });
2145
- return rpc;
2146
- };
2147
-
2148
- const state$1 = {
2149
- rpc: undefined
2150
- };
2151
- const getOrCreate$1 = () => {
2152
- if (!state$1.rpc) {
2153
- state$1.rpc = launchSearchProcess();
2154
- }
2155
- return state$1.rpc;
2156
- };
2157
-
2158
- const getPortTuple = () => {
2159
- const {
2160
- port1,
2161
- port2
2162
- } = new MessageChannel();
2163
- return {
2164
- port1,
2165
- port2
2166
- };
2167
- };
2168
-
2169
- const launchSearchProcessElectron = async () => {
2170
- const {
2171
- port1,
2172
- port2
2173
- } = getPortTuple();
2174
- const rpcPromise = MessagePortRpcParent.create({
2175
- messagePort: port2,
2176
- commandMap: {},
2177
- isMessagePortOpen: true
2178
- });
2179
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port1, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
2180
- port2.start();
2181
- const rpc = await rpcPromise;
2182
- set(rpc);
2183
- return rpc;
2184
- };
2185
-
2186
- const state = {
2187
- rpc: undefined
2188
- };
2189
- const getOrCreate = () => {
2190
- if (!state.rpc) {
2191
- // @ts-ignore
2192
- state.rpc = launchSearchProcessElectron();
2193
- }
2194
- return state.rpc;
2195
- };
2196
-
2197
- const {
2198
- set} = SearchProcess;
2199
- const lazyInvoke = async (platform, method, ...params) => {
2200
- if (platform === Electron) {
2201
- await getOrCreate();
2202
- } else if (platform === Remote) {
2203
- await getOrCreate$1();
2204
- }
2205
- // @ts-ignore
2206
- return invoke(method, ...params);
2207
- };
2208
-
2209
- const textSearch$2 = async (scheme, root, query, options, assetDir, platform) => {
2210
- const ripGrepArgs = getRipGrepArgs({
2211
- ...options,
2212
- searchString: query
2213
- });
2214
- const actualOptions = {
2215
- ripGrepArgs,
2216
- searchDir: root
2217
- };
2218
- if (platform === Remote || platform === Electron) {
2219
- // @ts-ignore
2220
- const result = await lazyInvoke(platform, 'TextSearch.search', actualOptions);
2221
- // TODO api is weird
2222
- // @ts-ignore
2223
- return result.results;
2224
- }
2225
- const results = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
2226
- // TODO api is weird
2227
- return results.results;
2228
- };
2229
-
2230
- const textSearch$1 = async (scheme, root, query) => {
2231
- // TODO ask renderer worker for files
2232
- const entries = Object.entries({});
2233
- const results = [];
2234
- for (const [key, value] of entries) {
2235
- // @ts-ignore
2236
- if (value.includes(query)) {
2237
- results.push([key, [{
2238
- absoluteOffset: 0,
2239
- preview: value
2240
- }]]);
2241
- }
2242
- }
2243
- return results;
2244
- };
2245
-
2246
- const getProvider = scheme => {
2247
- switch (scheme) {
2248
- case '':
2249
- return textSearch$2;
2250
- case 'web':
2251
- return textSearch$1;
2252
- case 'fetch':
2253
- return textSearch$5;
2254
- case 'html':
2255
- return textSearch$4;
2256
- case 'memfs':
2257
- return textSearch$3;
2258
- default:
2259
- return textSearch$6;
2260
- }
2261
- };
2262
-
2263
- const textSearch = async (root, query, options, assetDir, platform) => {
2085
+ const textSearch$6 = async (root, query, options, assetDir, platform) => {
2264
2086
  string(root);
2265
2087
  string(query);
2266
2088
  const scheme = getProtocol$1(root);
2267
- const provider = getProvider(scheme);
2089
+ const provider = getTextSearchProvider(scheme);
2268
2090
  const results = await provider(scheme, root, query, options, assetDir, platform);
2269
2091
  return results;
2270
2092
  };
@@ -2283,23 +2105,25 @@ const handleUpdateFull = async (state, update) => {
2283
2105
  value,
2284
2106
  threads,
2285
2107
  includeValue,
2286
- excludeValue
2108
+ excludeValue,
2109
+ assetDir,
2110
+ platform
2287
2111
  } = partialNewState;
2288
2112
  const root = state.workspacePath;
2289
2113
  const scheme = getProtocol$1(root);
2290
- const results = await textSearch(root, value, {
2114
+ const results = await textSearch$6(root, value, {
2291
2115
  threads,
2292
2116
  isCaseSensitive: Boolean(flags & MatchCase$2),
2293
2117
  useRegularExpression: Boolean(flags & UseRegularExpression$2),
2294
2118
  exclude: excludeValue,
2295
2119
  include: includeValue,
2296
- assetDir: state.assetDir,
2120
+ assetDir: assetDir,
2297
2121
  root,
2298
2122
  query: value,
2299
2123
  scheme,
2300
2124
  flags,
2301
2125
  matchWholeWord: Boolean(flags & MatchWholeWord$2)
2302
- }, state.assetDir, state.platform);
2126
+ }, assetDir, platform);
2303
2127
  if (!Array.isArray(results)) {
2304
2128
  throw new TypeError('results must be of type array');
2305
2129
  }
@@ -2337,6 +2161,62 @@ const handleUpdateFull = async (state, update) => {
2337
2161
  };
2338
2162
  };
2339
2163
 
2164
+ const getRipGrepArgs = ({
2165
+ threads,
2166
+ isCaseSensitive,
2167
+ searchString,
2168
+ useRegularExpression
2169
+ }) => {
2170
+ const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json'];
2171
+ ripGrepArgs.push('--threads', `${threads}`);
2172
+ if (isCaseSensitive) {
2173
+ ripGrepArgs.push('--case-sensitive');
2174
+ } else {
2175
+ ripGrepArgs.push('--ignore-case');
2176
+ }
2177
+ if (useRegularExpression) {
2178
+ ripGrepArgs.push('--regexp', searchString);
2179
+ } else {
2180
+ ripGrepArgs.push('--fixed-strings');
2181
+ ripGrepArgs.push('--');
2182
+ ripGrepArgs.push(searchString);
2183
+ }
2184
+ ripGrepArgs.push('.');
2185
+ return ripGrepArgs;
2186
+ };
2187
+
2188
+ const createLazyRpc = rpcId => {
2189
+ let rpcPromise;
2190
+ let factory;
2191
+ const createRpc = async () => {
2192
+ const rpc = await factory();
2193
+ set$g(rpcId, rpc);
2194
+ };
2195
+ const ensureRpc = async () => {
2196
+ if (!rpcPromise) {
2197
+ rpcPromise = createRpc();
2198
+ }
2199
+ await rpcPromise;
2200
+ };
2201
+ return {
2202
+ setFactory(value) {
2203
+ factory = value;
2204
+ },
2205
+ async invoke(method, ...params) {
2206
+ await ensureRpc();
2207
+ const rpc = get$2(rpcId);
2208
+ return rpc.invoke(method, ...params);
2209
+ }
2210
+ };
2211
+ };
2212
+
2213
+ const {
2214
+ set} = SearchProcess;
2215
+ const {
2216
+ invoke,
2217
+ setFactory
2218
+ } = createLazyRpc(RpcId.SearchProcess);
2219
+
2340
2220
  const waitForNextFrame = async () => {
2341
2221
  await new Promise(r => {
2342
2222
  requestAnimationFrame(r);
@@ -2354,9 +2234,9 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2354
2234
  searchDir: root,
2355
2235
  id: searchId
2356
2236
  };
2357
- const resultPromise = lazyInvoke(platform, 'TextSearch.searchIncremental', actualOptions);
2237
+ const resultPromise = invoke('TextSearch.searchIncremental', actualOptions);
2358
2238
  for (let i = 0; i < 100; i++) {
2359
- const latest = get(uid);
2239
+ const latest = get$1(uid);
2360
2240
  const {
2361
2241
  newState
2362
2242
  } = latest;
@@ -2368,8 +2248,8 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2368
2248
  } = newState;
2369
2249
  const listHeight = height - headerHeight;
2370
2250
  const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
2371
- const visible = await lazyInvoke(platform, 'TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
2372
- const latest2 = get(uid);
2251
+ const visible = await invoke('TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
2252
+ const latest2 = get$1(uid);
2373
2253
  if (!latest2 || latest2.newState.searchId !== searchId) {
2374
2254
  return;
2375
2255
  }
@@ -2406,7 +2286,7 @@ const handleUpdateIncremental = async (state, update) => {
2406
2286
  const root = state.workspacePath;
2407
2287
  const scheme = getProtocol$1(root);
2408
2288
  const searchId = crypto.randomUUID(); // TODO try to avoid side effect
2409
- const latest1 = get(uid);
2289
+ const latest1 = get$1(uid);
2410
2290
  const updatedState1 = {
2411
2291
  ...latest1.newState,
2412
2292
  ...partialNewState,
@@ -2762,7 +2642,75 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
2762
2642
  return fn(state, value, inputSource);
2763
2643
  };
2764
2644
 
2645
+ const getPortTuple = () => {
2646
+ const {
2647
+ port1,
2648
+ port2
2649
+ } = new MessageChannel();
2650
+ return {
2651
+ port1,
2652
+ port2
2653
+ };
2654
+ };
2655
+
2656
+ const launchSearchProcessElectron = async () => {
2657
+ const {
2658
+ port1,
2659
+ port2
2660
+ } = getPortTuple();
2661
+ const rpcPromise = MessagePortRpcParent.create({
2662
+ messagePort: port2,
2663
+ commandMap: {},
2664
+ isMessagePortOpen: true
2665
+ });
2666
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port1, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
2667
+ port2.start();
2668
+ const rpc = await rpcPromise;
2669
+ set(rpc);
2670
+ return rpc;
2671
+ };
2672
+
2673
+ const Https = 'https:';
2674
+ const Ws = 'ws:';
2675
+ const Wss = 'wss:';
2676
+
2677
+ const getWebSocketProtocol = locationProtocol => {
2678
+ return locationProtocol === Https ? Wss : Ws;
2679
+ };
2680
+
2681
+ const getWebSocketUrl = (type, host, locationProtocol) => {
2682
+ const wsProtocol = getWebSocketProtocol(locationProtocol);
2683
+ return `${wsProtocol}//${host}/websocket/${type}`;
2684
+ };
2685
+
2686
+ const getHost = () => {
2687
+ return location.host;
2688
+ };
2689
+ const getProtocol = () => {
2690
+ return location.protocol;
2691
+ };
2692
+
2693
+ const launchSearchProcessNode = async () => {
2694
+ const host = getHost();
2695
+ const protocol = getProtocol();
2696
+ const wsUrl = getWebSocketUrl('search-process', host, protocol);
2697
+ const webSocket = new WebSocket(wsUrl);
2698
+ const rpc = await WebSocketRpcParent.create({
2699
+ webSocket,
2700
+ commandMap: {}
2701
+ });
2702
+ return rpc;
2703
+ };
2704
+
2705
+ const Electron = 2;
2706
+ const Remote = 3;
2707
+
2765
2708
  const initialize = async platform => {
2709
+ if (platform === Electron) {
2710
+ setFactory(launchSearchProcessElectron);
2711
+ } else if (platform === Remote) {
2712
+ setFactory(launchSearchProcessNode);
2713
+ }
2766
2714
  // TODO
2767
2715
  };
2768
2716
 
@@ -3532,7 +3480,7 @@ const Highlight = 'Highlight';
3532
3480
  const HighlightDeleted = 'HighlightDeleted';
3533
3481
  const HighlightInserted = 'HighlightInserted';
3534
3482
  const IconButton = 'IconButton';
3535
- const Label = 'Label';
3483
+ const Label$1 = 'Label';
3536
3484
  const List = 'List';
3537
3485
  const MaskIcon = 'MaskIcon';
3538
3486
  const MaskIconBook = 'MaskIconBook';
@@ -3577,34 +3525,66 @@ const TreeItems$1 = 'TreeItems';
3577
3525
  const Viewlet = 'Viewlet';
3578
3526
  const ViewletSearchMessage = 'ViewletSearchMessage';
3579
3527
  const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
3580
-
3581
- const Alert = 'alert';
3582
- const Button$2 = 'button';
3583
- const CheckBox = 'checkbox';
3584
- const None = 'none';
3585
- const ScrollBar = 'scrollbar';
3586
- const Status = 'status';
3587
- const ToolBar = 'toolbar';
3588
- const Tree = 'tree';
3589
- const TreeItem = 'treeitem';
3590
-
3591
- const HandleClick = 'handleClick';
3592
- const HandleContextMenu = 'handleContextMenu';
3593
- const HandleHeaderContextMenu = 'handleHeaderContextMenu';
3594
- const HandleExcludeInput = 'handleExcludeInput';
3595
- const HandleHeaderClick2 = 'handleHeaderClick2';
3596
- const HandleHeaderFocusIn = 'handleHeaderFocusIn';
3597
- const HandleHeaderFocusOut = 'handleHeaderFocusOut';
3598
- const HandleIncludeInput = 'handleIncludeInput';
3599
- const HandleInput = 'handleInput';
3600
- const HandleInput2 = 'handleInput2';
3601
- const HandleListBlur = 'handleListBlur';
3602
- const HandleListFocus = 'handleListFocus';
3603
- const HandleReplaceInput = 'handleReplaceInput';
3604
- const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
3605
- const HandleToggleButtonClick = 'handleToggleButtonClick';
3606
- const HandleWheel = 'handleWheel';
3607
-
3528
+ const ClassNames = {
3529
+ __proto__: null,
3530
+ Actions,
3531
+ Badge,
3532
+ Chevron,
3533
+ CloseMaskIcon,
3534
+ Empty,
3535
+ FileIcon,
3536
+ FocusOutline,
3537
+ Grow,
3538
+ Highlight,
3539
+ HighlightDeleted,
3540
+ HighlightInserted,
3541
+ IconButton,
3542
+ Label: Label$1,
3543
+ List,
3544
+ MaskIcon,
3545
+ MaskIconBook,
3546
+ MaskIconCaseSensitive,
3547
+ MaskIconChevronDown,
3548
+ MaskIconChevronRight,
3549
+ MaskIconEllipsis,
3550
+ MaskIconExclude,
3551
+ MaskIconPreserveCase,
3552
+ MaskIconRegex,
3553
+ MaskIconReplaceAll,
3554
+ MaskIconWholeWord,
3555
+ MultilineInputBox,
3556
+ ScrollBar: ScrollBar$1,
3557
+ ScrollBarThumb,
3558
+ ScrollBarVertical,
3559
+ Search: Search$1,
3560
+ SearchField,
3561
+ SearchFieldButton,
3562
+ SearchFieldButtonChecked,
3563
+ SearchFieldButtonDisabled,
3564
+ SearchFieldButtons,
3565
+ SearchFieldContainer,
3566
+ SearchFieldError,
3567
+ SearchHeader,
3568
+ SearchHeaderDetails,
3569
+ SearchHeaderDetailsExpanded,
3570
+ SearchHeaderDetailsExpandedTop,
3571
+ SearchHeaderDetailsHeading,
3572
+ SearchHeaderTop,
3573
+ SearchHeaderTopRight,
3574
+ SearchInputError,
3575
+ SearchRemove,
3576
+ SearchToggleButton,
3577
+ SearchToggleButtonExpanded,
3578
+ SourceControlBadge,
3579
+ ToggleDetails,
3580
+ Tree: Tree$1,
3581
+ TreeItem: TreeItem$1,
3582
+ TreeItemActive,
3583
+ TreeItems: TreeItems$1,
3584
+ Viewlet,
3585
+ ViewletSearchMessage,
3586
+ ViewletSearchMessageIndented
3587
+ };
3608
3588
  const mergeClassNames = (...classNames) => {
3609
3589
  return classNames.filter(Boolean).join(' ');
3610
3590
  };
@@ -3820,6 +3800,33 @@ const diff = (oldNodes, newNodes) => {
3820
3800
  return patches;
3821
3801
  };
3822
3802
 
3803
+ const Alert = 'alert';
3804
+ const Button$2 = 'button';
3805
+ const CheckBox = 'checkbox';
3806
+ const None = 'none';
3807
+ const ScrollBar = 'scrollbar';
3808
+ const Status = 'status';
3809
+ const ToolBar = 'toolbar';
3810
+ const Tree = 'tree';
3811
+ const TreeItem = 'treeitem';
3812
+
3813
+ const HandleClick = 'handleClick';
3814
+ const HandleContextMenu = 'handleContextMenu';
3815
+ const HandleHeaderContextMenu = 'handleHeaderContextMenu';
3816
+ const HandleExcludeInput = 'handleExcludeInput';
3817
+ const HandleHeaderClick2 = 'handleHeaderClick2';
3818
+ const HandleHeaderFocusIn = 'handleHeaderFocusIn';
3819
+ const HandleHeaderFocusOut = 'handleHeaderFocusOut';
3820
+ const HandleIncludeInput = 'handleIncludeInput';
3821
+ const HandleInput = 'handleInput';
3822
+ const HandleInput2 = 'handleInput2';
3823
+ const HandleListBlur = 'handleListBlur';
3824
+ const HandleListFocus = 'handleListFocus';
3825
+ const HandleReplaceInput = 'handleReplaceInput';
3826
+ const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
3827
+ const HandleToggleButtonClick = 'handleToggleButtonClick';
3828
+ const HandleWheel = 'handleWheel';
3829
+
3823
3830
  const Button$1 = 1;
3824
3831
  const Del = 21;
3825
3832
  const Div = 4;
@@ -3833,7 +3840,7 @@ const TextArea = 62;
3833
3840
  const getSearchDetailsToggleVirtualDom = () => {
3834
3841
  return [{
3835
3842
  type: Div,
3836
- className: ToggleDetails,
3843
+ className: ClassNames.ToggleDetails,
3837
3844
  role: Button$2,
3838
3845
  tabIndex: 0,
3839
3846
  ariaLabel: toggleSearchDetails(),
@@ -3842,7 +3849,7 @@ const getSearchDetailsToggleVirtualDom = () => {
3842
3849
  childCount: 1
3843
3850
  }, {
3844
3851
  type: Div,
3845
- className: mergeClassNames(MaskIcon, MaskIconEllipsis),
3852
+ className: mergeClassNames(ClassNames.MaskIcon, ClassNames.MaskIconEllipsis),
3846
3853
  childCount: 0
3847
3854
  }];
3848
3855
  };
@@ -3857,9 +3864,9 @@ const text = data => {
3857
3864
 
3858
3865
  const getClassName = indented => {
3859
3866
  if (indented) {
3860
- return mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented);
3867
+ return mergeClassNames(ClassNames.ViewletSearchMessage, ClassNames.ViewletSearchMessageIndented);
3861
3868
  }
3862
- return ViewletSearchMessage;
3869
+ return ClassNames.ViewletSearchMessage;
3863
3870
  };
3864
3871
  const getSearchMessageVirtualDom = (message, indented) => {
3865
3872
  return [{
@@ -3874,7 +3881,7 @@ const getSearchMessageVirtualDom = (message, indented) => {
3874
3881
  const getSearchHeaderDetailsCollapsedVirtualDom = message => {
3875
3882
  return [{
3876
3883
  type: Div,
3877
- className: SearchHeaderDetails,
3884
+ className: ClassNames.SearchHeaderDetails,
3878
3885
  childCount: 2
3879
3886
  }, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
3880
3887
  };
@@ -3886,7 +3893,7 @@ const ButtonDisabled = 3;
3886
3893
 
3887
3894
  const getInputActionsExclude = flags => {
3888
3895
  const inside = [{
3889
- icon: MaskIconExclude,
3896
+ icon: ClassNames.MaskIconExclude,
3890
3897
  title: useExcludeSettings(),
3891
3898
  command: 'toggleUseExcludeSettings',
3892
3899
  flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
@@ -3901,7 +3908,7 @@ const getInputActionsExclude = flags => {
3901
3908
 
3902
3909
  const getInputActionsInclude = flags => {
3903
3910
  const inside = [{
3904
- icon: MaskIconBook,
3911
+ icon: ClassNames.MaskIconBook,
3905
3912
  title: searchOnlyOpenEditors(),
3906
3913
  command: 'searchOnlyOpenEditors',
3907
3914
  flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
@@ -3915,7 +3922,7 @@ const getInputActionsInclude = flags => {
3915
3922
  };
3916
3923
 
3917
3924
  const getSearchFieldButtonClassName = flag => {
3918
- return mergeClassNames(SearchFieldButton, flag === CheckBoxEnabled ? SearchFieldButtonChecked : '', flag === ButtonDisabled ? SearchFieldButtonDisabled : '');
3925
+ return mergeClassNames(ClassNames.SearchFieldButton, flag === CheckBoxEnabled ? ClassNames.SearchFieldButtonChecked : '', flag === ButtonDisabled ? ClassNames.SearchFieldButtonDisabled : '');
3919
3926
  };
3920
3927
 
3921
3928
  // TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
@@ -3970,7 +3977,7 @@ const getSearchFieldButtonVirtualDom = button => {
3970
3977
  childCount: 1
3971
3978
  }, {
3972
3979
  type: Span,
3973
- className: mergeClassNames(MaskIcon, icon),
3980
+ className: mergeClassNames(ClassNames.MaskIcon, icon),
3974
3981
  childCount: 0
3975
3982
  }];
3976
3983
  };
@@ -3985,7 +3992,7 @@ const getOutSideButtonsDom = outsideButtons => {
3985
3992
  return {
3986
3993
  preNodes: [{
3987
3994
  type: Div,
3988
- className: SearchFieldContainer,
3995
+ className: ClassNames.SearchFieldContainer,
3989
3996
  role: None,
3990
3997
  childCount: 1 + outsideButtons.length
3991
3998
  }],
@@ -3998,7 +4005,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
3998
4005
  preNodes,
3999
4006
  postNodes
4000
4007
  } = getOutSideButtonsDom(outsideButtons);
4001
- const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
4008
+ const searchFieldClassName = hasError ? mergeClassNames(ClassNames.SearchField, ClassNames.SearchFieldError) : ClassNames.SearchField;
4002
4009
  const dom = [...preNodes, {
4003
4010
  type: Div,
4004
4011
  className: searchFieldClassName,
@@ -4006,7 +4013,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4006
4013
  childCount: 2
4007
4014
  }, {
4008
4015
  type: TextArea,
4009
- className: MultilineInputBox,
4016
+ className: ClassNames.MultilineInputBox,
4010
4017
  spellcheck: false,
4011
4018
  autocapitalize: 'off',
4012
4019
  autocorrect: 'off',
@@ -4017,7 +4024,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4017
4024
  childCount: 0
4018
4025
  }, {
4019
4026
  type: Div,
4020
- className: SearchFieldButtons,
4027
+ className: ClassNames.SearchFieldButtons,
4021
4028
  childCount: insideButtons.length
4022
4029
  }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
4023
4030
  return dom;
@@ -4030,19 +4037,19 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
4030
4037
  const excludePlaceholder = exclude();
4031
4038
  return [{
4032
4039
  type: Div,
4033
- className: SearchHeaderDetailsExpanded,
4040
+ className: ClassNames.SearchHeaderDetailsExpanded,
4034
4041
  childCount: 5
4035
4042
  }, {
4036
4043
  type: Div,
4037
- className: SearchHeaderDetailsExpandedTop,
4044
+ className: ClassNames.SearchHeaderDetailsExpandedTop,
4038
4045
  childCount: 2
4039
4046
  }, ...getSearchDetailsToggleVirtualDom(), {
4040
4047
  type: H4,
4041
- className: SearchHeaderDetailsHeading,
4048
+ className: ClassNames.SearchHeaderDetailsHeading,
4042
4049
  childCount: 1
4043
4050
  }, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
4044
4051
  type: H4,
4045
- className: SearchHeaderDetailsHeading,
4052
+ className: ClassNames.SearchHeaderDetailsHeading,
4046
4053
  childCount: 1
4047
4054
  }, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
4048
4055
  };
@@ -4056,17 +4063,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
4056
4063
 
4057
4064
  const getInputActionsInput = flags => {
4058
4065
  const inside = [{
4059
- icon: MaskIconCaseSensitive,
4066
+ icon: ClassNames.MaskIconCaseSensitive,
4060
4067
  flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
4061
4068
  title: matchCase(),
4062
4069
  name: MatchCase
4063
4070
  }, {
4064
- icon: MaskIconWholeWord,
4071
+ icon: ClassNames.MaskIconWholeWord,
4065
4072
  flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
4066
4073
  title: matchWholeWord(),
4067
4074
  name: MatchWholeWord
4068
4075
  }, {
4069
- icon: MaskIconRegex,
4076
+ icon: ClassNames.MaskIconRegex,
4070
4077
  flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
4071
4078
  title: useRegularExpression(),
4072
4079
  name: UseRegularExpression
@@ -4080,13 +4087,13 @@ const getInputActionsInput = flags => {
4080
4087
 
4081
4088
  const getInputActionsReplace = (flags, matchCount) => {
4082
4089
  const inside = [{
4083
- icon: MaskIconPreserveCase,
4090
+ icon: ClassNames.MaskIconPreserveCase,
4084
4091
  flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
4085
4092
  title: preserveCase(),
4086
4093
  name: PreserveCase
4087
4094
  }];
4088
4095
  const outside = [{
4089
- icon: MaskIconReplaceAll,
4096
+ icon: ClassNames.MaskIconReplaceAll,
4090
4097
  flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
4091
4098
  title: replaceAll$1(),
4092
4099
  name: ReplaceAll
@@ -4114,7 +4121,7 @@ const getSearchPlaceholder = focus => {
4114
4121
  const getSearchToggleVirtualDom = replaceExpanded => {
4115
4122
  return [{
4116
4123
  type: Button$1,
4117
- className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
4124
+ className: mergeClassNames(ClassNames.IconButton, ClassNames.SearchToggleButton, replaceExpanded ? ClassNames.SearchToggleButtonExpanded : ''),
4118
4125
  title: toggleReplace$1(),
4119
4126
  ariaLabel: toggleReplace$1(),
4120
4127
  ariaExpanded: Boolean(replaceExpanded),
@@ -4123,7 +4130,7 @@ const getSearchToggleVirtualDom = replaceExpanded => {
4123
4130
  name: ToggleReplace
4124
4131
  }, {
4125
4132
  type: Div,
4126
- className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
4133
+ className: mergeClassNames(ClassNames.MaskIcon, replaceExpanded ? ClassNames.MaskIconChevronDown : ClassNames.MaskIconChevronRight),
4127
4134
  childCount: 0
4128
4135
  }];
4129
4136
  };
@@ -4136,12 +4143,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4136
4143
  const replaceExpanded = flags & ReplaceExpanded;
4137
4144
  const dom = [{
4138
4145
  type: Div,
4139
- className: SearchHeaderTop,
4146
+ className: ClassNames.SearchHeaderTop,
4140
4147
  role: None,
4141
4148
  childCount: 2
4142
4149
  }, ...getSearchToggleVirtualDom(replaceExpanded), {
4143
4150
  type: Div,
4144
- className: SearchHeaderTopRight,
4151
+ className: ClassNames.SearchHeaderTopRight,
4145
4152
  role: None,
4146
4153
  childCount: replaceExpanded ? 2 : 1
4147
4154
  }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
@@ -4153,7 +4160,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4153
4160
 
4154
4161
  const parentNode = {
4155
4162
  type: Div,
4156
- className: SearchHeader,
4163
+ className: ClassNames.SearchHeader,
4157
4164
  role: None,
4158
4165
  childCount: 2,
4159
4166
  onClick: HandleHeaderClick2,
@@ -4172,7 +4179,7 @@ const getSearchInputErrorVirtualDom = errorMessage => {
4172
4179
  }
4173
4180
  return [{
4174
4181
  type: Div,
4175
- className: SearchInputError,
4182
+ className: ClassNames.SearchInputError,
4176
4183
  role: Alert,
4177
4184
  childCount: 1
4178
4185
  }, text(errorMessage)];
@@ -4186,7 +4193,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4186
4193
  }
4187
4194
  return [{
4188
4195
  type: Div,
4189
- className: mergeClassNames(ScrollBar$1, ScrollBarVertical),
4196
+ className: mergeClassNames(ClassNames.ScrollBar, ClassNames.ScrollBarVertical),
4190
4197
  childCount: 1,
4191
4198
  onPointerDown: HandleScrollBarPointerDown,
4192
4199
  role: ScrollBar,
@@ -4194,7 +4201,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4194
4201
  ariaValueNow: scrollBarValue
4195
4202
  }, {
4196
4203
  type: Div,
4197
- className: ScrollBarThumb,
4204
+ className: ClassNames.ScrollBarThumb,
4198
4205
  height: scrollBarHeight,
4199
4206
  translate: `0 ${scrollBarY}px`,
4200
4207
  childCount: 0
@@ -4220,26 +4227,26 @@ const getBadgeVirtualDom = (className, badgeText) => {
4220
4227
  }
4221
4228
  return [{
4222
4229
  type: Div,
4223
- className: mergeClassNames(Badge, className),
4230
+ className: mergeClassNames(ClassNames.Badge, className),
4224
4231
  childCount: 1
4225
4232
  }, text(badgeText)];
4226
4233
  };
4227
4234
 
4228
4235
  const chevronDownVirtualDom = {
4229
4236
  type: Div,
4230
- className: mergeClassNames(Chevron, MaskIconChevronDown),
4237
+ className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronDown),
4231
4238
  childCount: 0
4232
4239
  };
4233
4240
  const chevronRightVirtualDom = {
4234
4241
  type: Div,
4235
- className: mergeClassNames(Chevron, MaskIconChevronRight),
4242
+ className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronRight),
4236
4243
  childCount: 0
4237
4244
  };
4238
4245
 
4239
4246
  const getFileIconVirtualDom = icon => {
4240
4247
  return {
4241
4248
  type: Img,
4242
- className: FileIcon,
4249
+ className: ClassNames.FileIcon,
4243
4250
  src: icon,
4244
4251
  role: None,
4245
4252
  childCount: 0
@@ -4259,22 +4266,22 @@ const getIconsVirtualDom = (expanded, icon) => {
4259
4266
 
4260
4267
  const deleted = {
4261
4268
  type: Del,
4262
- className: HighlightDeleted,
4269
+ className: ClassNames.HighlightDeleted,
4263
4270
  childCount: 1
4264
4271
  };
4265
4272
  const inserted = {
4266
4273
  type: Ins,
4267
- className: HighlightInserted,
4274
+ className: ClassNames.HighlightInserted,
4268
4275
  childCount: 1
4269
4276
  };
4270
4277
  const highlighted = {
4271
4278
  type: Span,
4272
- className: Highlight,
4279
+ className: ClassNames.Highlight,
4273
4280
  childCount: 1
4274
4281
  };
4275
4282
  const label1 = {
4276
4283
  type: Div,
4277
- className: mergeClassNames(Label, Grow),
4284
+ className: mergeClassNames(ClassNames.Label, ClassNames.Grow),
4278
4285
  childCount: 1
4279
4286
  };
4280
4287
  const label3 = {
@@ -4304,9 +4311,9 @@ const getPaddingLeft = depth => {
4304
4311
 
4305
4312
  const getSearchResultClassName = focused => {
4306
4313
  if (focused) {
4307
- return TreeItem$1 + ' ' + TreeItemActive;
4314
+ return ClassNames.TreeItem + ' ' + ClassNames.TreeItemActive;
4308
4315
  }
4309
- return TreeItem$1;
4316
+ return ClassNames.TreeItem;
4310
4317
  };
4311
4318
 
4312
4319
  const PaddingRight = '12px';
@@ -4341,13 +4348,13 @@ const getSearchResultVirtualDom = rowInfo => {
4341
4348
  paddingLeft: getPaddingLeft(depth),
4342
4349
  paddingRight: PaddingRight,
4343
4350
  ariaExpanded: getAriaExpanded(expanded)
4344
- }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(SourceControlBadge, badgeText), {
4351
+ }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(ClassNames.SourceControlBadge, badgeText), {
4345
4352
  type: Div,
4346
- className: SearchRemove,
4353
+ className: ClassNames.SearchRemove,
4347
4354
  childCount: 1
4348
4355
  }, {
4349
4356
  type: Div,
4350
- className: CloseMaskIcon,
4357
+ className: ClassNames.CloseMaskIcon,
4351
4358
  childCount: 0
4352
4359
  }];
4353
4360
  return dom;
@@ -4357,7 +4364,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
4357
4364
  const pixelOffset = deltaY % itemHeight;
4358
4365
  return [{
4359
4366
  type: Div,
4360
- className: TreeItems$1,
4367
+ className: ClassNames.TreeItems,
4361
4368
  childCount: visibleItems.length,
4362
4369
  onClick: HandleClick,
4363
4370
  onBlur: HandleListBlur,
@@ -4372,7 +4379,7 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
4372
4379
  const scrollBarDomNodes = scrollbarHeight === 0 ? 0 : 1;
4373
4380
  return [{
4374
4381
  type: Div,
4375
- className: mergeClassNames(Viewlet, List, Tree$1, focusOutline ? FocusOutline : Empty),
4382
+ className: mergeClassNames(ClassNames.Viewlet, ClassNames.List, ClassNames.Tree, focusOutline ? ClassNames.FocusOutline : ClassNames.Empty),
4376
4383
  role: Tree,
4377
4384
  tabIndex: 0,
4378
4385
  childCount: 1 + scrollBarDomNodes
@@ -4384,7 +4391,7 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
4384
4391
  const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
4385
4392
  return [{
4386
4393
  type: Div,
4387
- className: mergeClassNames(Viewlet, Search$1),
4394
+ className: mergeClassNames(ClassNames.Viewlet, ClassNames.Search),
4388
4395
  childCount
4389
4396
  }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
4390
4397
  };
@@ -4442,7 +4449,7 @@ const render2 = (uid, diffResult) => {
4442
4449
  const {
4443
4450
  oldState,
4444
4451
  newState
4445
- } = get(uid);
4452
+ } = get$1(uid);
4446
4453
  set$1(uid, newState, newState);
4447
4454
  const commands = applyRender(oldState, newState, diffResult);
4448
4455
  return commands;
@@ -4453,7 +4460,7 @@ const Button = 1;
4453
4460
  const getIconVirtualDom = (icon, type = Div) => {
4454
4461
  return {
4455
4462
  type,
4456
- className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
4463
+ className: mergeClassNames(ClassNames.MaskIcon, `MaskIcon${icon}`),
4457
4464
  role: None,
4458
4465
  childCount: 0
4459
4466
  };
@@ -4467,7 +4474,7 @@ const getActionButtonVirtualDom = action => {
4467
4474
  } = action;
4468
4475
  return [{
4469
4476
  type: Button$1,
4470
- className: IconButton,
4477
+ className: ClassNames.IconButton,
4471
4478
  title: id,
4472
4479
  'data-command': command,
4473
4480
  childCount: 1
@@ -4486,7 +4493,7 @@ const getActionVirtualDom = action => {
4486
4493
  const getActionsVirtualDom = actions => {
4487
4494
  return [{
4488
4495
  type: Div,
4489
- className: Actions,
4496
+ className: ClassNames.Actions,
4490
4497
  role: ToolBar,
4491
4498
  childCount: actions.length
4492
4499
  }, ...actions.flatMap(getActionVirtualDom)];
@@ -4602,7 +4609,7 @@ const renderIncremental = uid => {
4602
4609
  const {
4603
4610
  oldState,
4604
4611
  newState
4605
- } = get(uid);
4612
+ } = get$1(uid);
4606
4613
  const oldDom = getDom(oldState);
4607
4614
  const newDom = getDom(newState);
4608
4615
  const patches = diff(oldDom, newDom);
@@ -4662,7 +4669,7 @@ const rerender = state => {
4662
4669
  const saveState = uid => {
4663
4670
  const {
4664
4671
  newState
4665
- } = get(uid);
4672
+ } = get$1(uid);
4666
4673
  const {
4667
4674
  value,
4668
4675
  replacement,
@@ -4921,10 +4928,75 @@ const commandMap = {
4921
4928
  'TextSearch.renderActions': renderActions,
4922
4929
  // TODO needed?
4923
4930
  'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
4924
- 'TextSearch.textSearch': textSearch
4931
+ 'TextSearch.textSearch': textSearch$6
4932
+ };
4933
+
4934
+ const textSearch$5 = async (scheme, root, query) => {
4935
+ string(scheme);
4936
+ string(query);
4937
+ const result = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
4938
+ return result;
4939
+ };
4940
+
4941
+ const textSearch$4 = async (scheme, root, query, options, assetDir) => {
4942
+ return invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
4943
+ };
4944
+
4945
+ const textSearch$3 = async (scheme, root, query) => {
4946
+ return invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
4947
+ };
4948
+
4949
+ const textSearch$2 = async (scheme, root, query, options, assetDir) => {
4950
+ return invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
4951
+ };
4952
+
4953
+ const textSearch$1 = async (scheme, root, query, options, assetDir, platform) => {
4954
+ const ripGrepArgs = getRipGrepArgs({
4955
+ ...options,
4956
+ searchString: query
4957
+ });
4958
+ const actualOptions = {
4959
+ ripGrepArgs,
4960
+ searchDir: root
4961
+ };
4962
+ if (platform === Remote || platform === Electron) {
4963
+ const result = await invoke('TextSearch.search', actualOptions);
4964
+ // TODO api is weird
4965
+ // @ts-ignore
4966
+ return result.results;
4967
+ }
4968
+ const results = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
4969
+ // TODO api is weird
4970
+ return results.results;
4971
+ };
4972
+
4973
+ const textSearch = async (scheme, root, query) => {
4974
+ // TODO ask renderer worker for files
4975
+ const entries = Object.entries({});
4976
+ const results = [];
4977
+ for (const [key, value] of entries) {
4978
+ // @ts-ignore
4979
+ if (value.includes(query)) {
4980
+ results.push([key, [{
4981
+ absoluteOffset: 0,
4982
+ preview: value
4983
+ }]]);
4984
+ }
4985
+ }
4986
+ return results;
4987
+ };
4988
+
4989
+ const textSearchProviderMap = {
4990
+ '': textSearch$1,
4991
+ web: textSearch,
4992
+ fetch: textSearch$4,
4993
+ html: textSearch$3,
4994
+ memfs: textSearch$2,
4995
+ default: textSearch$5
4925
4996
  };
4926
4997
 
4927
4998
  const listen = async () => {
4999
+ add(textSearchProviderMap);
4928
5000
  const rpc = await WebWorkerRpcClient.create({
4929
5001
  commandMap: commandMap
4930
5002
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "4.13.0",
3
+ "version": "5.1.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"