@lvce-editor/file-system-worker 5.18.1 → 5.19.1

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.
@@ -1995,6 +1995,12 @@ const isMemory = uri => {
1995
1995
  return uri.startsWith(Memory);
1996
1996
  };
1997
1997
 
1998
+ // Disk paths and built-in HTTP reads stay in this worker. Other URI schemes
1999
+ // need the renderer's filesystem dispatcher, which activates extension providers.
2000
+ const isProviderUri = uri => {
2001
+ return /^[a-z][a-z\d+.-]*:\/\//i.test(uri) && !uri.startsWith('file:') && !isHttp(uri);
2002
+ };
2003
+
1998
2004
  const remove = async dirent => {
1999
2005
  if (isMemory(dirent)) {
2000
2006
  return remove$1(dirent);
@@ -2008,7 +2014,7 @@ const readFile = async uri => {
2008
2014
  if (isHttp(uri)) {
2009
2015
  return readFile$3(uri);
2010
2016
  }
2011
- if (isMemory(uri)) {
2017
+ if (isMemory(uri) || isProviderUri(uri)) {
2012
2018
  return invoke$2('FileSystem.readFile', uri);
2013
2019
  }
2014
2020
  return readFile$2(uri);
@@ -2026,7 +2032,7 @@ const readDirWithFileTypes = async uri => {
2026
2032
  if (isFetch(uri) || isHtml(uri)) {
2027
2033
  return invoke$2('FileSystem.readDirWithFileTypes', uri);
2028
2034
  }
2029
- if (isMemory(uri)) {
2035
+ if (isMemory(uri) || isProviderUri(uri)) {
2030
2036
  return invoke$2('FileSystem.readDirWithFileTypes', uri);
2031
2037
  }
2032
2038
  return readDirWithFileTypes$2(uri);
@@ -2046,6 +2052,12 @@ const readJson = async uri => {
2046
2052
  const getRealPath = async path => {
2047
2053
  return getRealPath$2(path);
2048
2054
  };
2055
+ const getFileSize = async uri => {
2056
+ if (isHttp(uri) || isMemory(uri)) {
2057
+ throw new Error(`File size is not supported for ${uri}`);
2058
+ }
2059
+ return invoke$1('FileSystem.getFileSize', uri);
2060
+ };
2049
2061
  const readFileAsBlob = async uri => {
2050
2062
  if (isHttp(uri)) {
2051
2063
  return readFileAsBlob$2(uri);
@@ -2133,6 +2145,7 @@ const FileSystemDisk = {
2133
2145
  exists,
2134
2146
  getFileHash,
2135
2147
  getFileHashes,
2148
+ getFileSize,
2136
2149
  getFolderSize,
2137
2150
  getRealPath,
2138
2151
  isReadonly,
@@ -2590,6 +2603,7 @@ const commandMap = {
2590
2603
  'FileSystem.exists': exists,
2591
2604
  'FileSystem.getFileHash': getFileHash,
2592
2605
  'FileSystem.getFileHashes': getFileHashes,
2606
+ 'FileSystem.getFileSize': getFileSize,
2593
2607
  'FileSystem.getFolderSize': getFolderSize,
2594
2608
  'FileSystem.getRealPath': getRealPath,
2595
2609
  'FileSystem.glob': glob,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-system-worker",
3
- "version": "5.18.1",
3
+ "version": "5.19.1",
4
4
  "description": "File System Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"