@lvce-editor/test-worker 11.2.0 → 11.4.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.
@@ -1171,6 +1171,9 @@ const sendMessagePortToEditorWorker = async (port, rpcId) => {
1171
1171
  // @ts-ignore
1172
1172
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1173
1173
  };
1174
+ const readFile$1 = async uri => {
1175
+ return invoke('FileSystem.readFile', uri);
1176
+ };
1174
1177
  const getPreference = async key => {
1175
1178
  return await invoke('Preferences.get', key);
1176
1179
  };
@@ -1191,8 +1194,8 @@ const clearConsole = () => {
1191
1194
  console.clear();
1192
1195
  };
1193
1196
 
1194
- const createUrlWithQueryParameter = url => {
1195
- const parsedUrl = new URL(url, location.href);
1197
+ const createUrlWithQueryParameter = (url, locationHref) => {
1198
+ const parsedUrl = new URL(url, locationHref);
1196
1199
  parsedUrl.searchParams.set('time', `${Date.now()}`);
1197
1200
  const string = parsedUrl.toString();
1198
1201
  return string;
@@ -2606,24 +2609,25 @@ const toFileUrl = url => {
2606
2609
  return `file://${rest}`;
2607
2610
  };
2608
2611
 
2609
- /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
2610
- const getDirents = async (allDirents, fileUrl) => {
2612
+ const getDirents = async fileUrl => {
2613
+ const allDirents = [];
2611
2614
  const dirents = await invoke('FileSystem.readDirWithFileTypes', fileUrl);
2612
2615
  for (const dirent of dirents) {
2613
2616
  if (dirent.type === Directory) {
2614
- await getDirents(allDirents, `${fileUrl}/${dirent.name}`);
2617
+ const subDirents = await getDirents(`${fileUrl}/${dirent.name}`);
2618
+ allDirents.push(...subDirents);
2615
2619
  } else {
2616
2620
  allDirents.push(`${fileUrl}/${dirent.name}`);
2617
2621
  }
2618
2622
  }
2623
+ return allDirents;
2619
2624
  };
2620
2625
  const getFileMapNode = async url => {
2621
2626
  const fileUrl = toFileUrl(url);
2622
- const allFiles = [];
2623
- await getDirents(allFiles, fileUrl);
2627
+ const allFiles = await getDirents(fileUrl);
2624
2628
  const fileMap = Object.create(null);
2625
2629
  for (const filePath of allFiles) {
2626
- const content = await invoke(`FileSystem.readFile`, filePath);
2630
+ const content = await readFile$1(filePath);
2627
2631
  const relativePaths = filePath.slice(fileUrl.length + 1);
2628
2632
  fileMap[relativePaths] = content;
2629
2633
  }
@@ -3461,7 +3465,7 @@ const handleInputContextMenu = async (name, button, x, y) => {
3461
3465
  await invoke('Search.handleInputConextMenu', name, button, x, y);
3462
3466
  };
3463
3467
  const handleContextMenu$2 = async (button, x, y) => {
3464
- await invoke('Search.handleContextMenu', name, button, x, y);
3468
+ await invoke('Search.handleContextMenu', button, x, y);
3465
3469
  };
3466
3470
 
3467
3471
  const Search = {
@@ -3519,8 +3523,7 @@ const clear = async searchValue => {
3519
3523
  return invoke('Settings.clear', searchValue, Script);
3520
3524
  };
3521
3525
  const clearHistory = async () => {
3522
- // @ts-ignore
3523
- return invoke('Settings.clearHistory', searchValue, Script);
3526
+ return invoke('Settings.clearHistory');
3524
3527
  };
3525
3528
  const selectTab = async tabId => {
3526
3529
  return invoke('Settings.handleClickTab', tabId);
@@ -4030,7 +4033,7 @@ const execute = async (href, platform, assetDir) => {
4030
4033
  }
4031
4034
  };
4032
4035
 
4033
- const hotReloadTest = async () => {
4036
+ const hotReloadTest = async locationHref => {
4034
4037
  if (!hasItems()) {
4035
4038
  return;
4036
4039
  }
@@ -4044,13 +4047,14 @@ const hotReloadTest = async () => {
4044
4047
  if (inProgress) {
4045
4048
  return;
4046
4049
  }
4047
- const withQueryParameter = createUrlWithQueryParameter(url);
4050
+ const withQueryParameter = createUrlWithQueryParameter(url, locationHref);
4048
4051
  clearConsole();
4049
4052
  await execute(withQueryParameter, platform, assetDir);
4050
4053
  };
4051
4054
 
4052
4055
  const handleFileWatcherEvent = async event => {
4053
- await hotReloadTest();
4056
+ const locationHref = location.href;
4057
+ await hotReloadTest(locationHref);
4054
4058
  };
4055
4059
 
4056
4060
  const commandMap = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "11.2.0",
3
+ "version": "11.4.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",