@lvce-editor/file-system-worker 1.7.0 → 1.8.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.
@@ -1015,11 +1015,11 @@ const create$2 = async ({
1015
1015
  const rpc = createRpc(ipc);
1016
1016
  return rpc;
1017
1017
  };
1018
- const Https = 'https:';
1018
+ const Https$1 = 'https:';
1019
1019
  const Ws = 'ws:';
1020
1020
  const Wss = 'wss:';
1021
1021
  const getWebSocketProtocol = locationProtocol => {
1022
- return locationProtocol === Https ? Wss : Ws;
1022
+ return locationProtocol === Https$1 ? Wss : Ws;
1023
1023
  };
1024
1024
  const getWebSocketUrl = (type, host, locationProtocol) => {
1025
1025
  const wsProtocol = getWebSocketProtocol(locationProtocol);
@@ -1064,6 +1064,15 @@ const WebWorkerRpcClient = {
1064
1064
  create: create$3
1065
1065
  };
1066
1066
 
1067
+ const readFile$2 = async uri => {
1068
+ const response = await fetch(uri);
1069
+ if (!response.ok) {
1070
+ throw new Error(response.statusText);
1071
+ }
1072
+ const result = await response.text();
1073
+ return result;
1074
+ };
1075
+
1067
1076
  const rpcs = Object.create(null);
1068
1077
  const set$g = (id, rpc) => {
1069
1078
  rpcs[id] = rpc;
@@ -1191,10 +1200,16 @@ const {
1191
1200
  remove: remove$1
1192
1201
  } = FileSystemProcess;
1193
1202
 
1203
+ const Http = 'http:';
1204
+ const Https = 'https:';
1205
+
1194
1206
  const remove = async dirent => {
1195
1207
  return remove$1(dirent);
1196
1208
  };
1197
1209
  const readFile = async uri => {
1210
+ if (uri.startsWith(Http) || uri.startsWith(Https)) {
1211
+ return readFile$2(uri);
1212
+ }
1198
1213
  return readFile$1(uri);
1199
1214
  };
1200
1215
  const readDirWithFileTypes = async uri => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-system-worker",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "File System Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"