@lvce-editor/file-system-worker 1.23.0 → 1.25.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.
@@ -1098,6 +1098,14 @@ const exists$2 = async uri => {
1098
1098
  }
1099
1099
  return false;
1100
1100
  };
1101
+ const readJson$4 = async uri => {
1102
+ const response = await fetch(uri);
1103
+ if (!response.ok) {
1104
+ throw new Error(`${response.statusText}`);
1105
+ }
1106
+ const json = await response.json();
1107
+ return json;
1108
+ };
1101
1109
 
1102
1110
  const rpcs = Object.create(null);
1103
1111
  const set$g = (id, rpc) => {
@@ -1158,7 +1166,7 @@ const getPathSeparator$1$1 = async root => {
1158
1166
  // @ts-ignore
1159
1167
  return invoke$8('FileSystem.getPathSeparator', root);
1160
1168
  };
1161
- const readJson$2 = async root => {
1169
+ const readJson$3 = async root => {
1162
1170
  // @ts-ignore
1163
1171
  return invoke$8('FileSystem.readJson', root);
1164
1172
  };
@@ -1206,7 +1214,7 @@ const FileSystemProcess = {
1206
1214
  mkdir: mkdir$1$1,
1207
1215
  readDirWithFileTypes: readDirWithFileTypes$1$1,
1208
1216
  readFile: readFile$2$1,
1209
- readJson: readJson$2,
1217
+ readJson: readJson$3,
1210
1218
  remove: remove$1$1,
1211
1219
  rename: rename$1$1,
1212
1220
  set: set$8,
@@ -1275,6 +1283,9 @@ const invoke$1 = async (method, ...params) => {
1275
1283
  const readFile$2 = async uri => {
1276
1284
  return invoke$1('FileSystemMemory.readFile', uri);
1277
1285
  };
1286
+ const readJson$2 = async uri => {
1287
+ throw new Error('not implemented');
1288
+ };
1278
1289
  const writeFile$2 = async (uri, content) => {
1279
1290
  return invoke$1('FileSystemMemory.writeFile', uri, content);
1280
1291
  };
@@ -1332,6 +1343,12 @@ const getPathSeparator = async root => {
1332
1343
  return getPathSeparator$1(root);
1333
1344
  };
1334
1345
  const readJson = async uri => {
1346
+ if (isHttp(uri)) {
1347
+ return readJson$4(uri);
1348
+ }
1349
+ if (isMemory(uri)) {
1350
+ return readJson$2();
1351
+ }
1335
1352
  return readJson$1(uri);
1336
1353
  };
1337
1354
  const getRealPath = async path => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-system-worker",
3
- "version": "1.23.0",
3
+ "version": "1.25.0",
4
4
  "description": "File System Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"