@lvce-editor/file-system-worker 5.19.0 → 5.19.2
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.
- package/dist/fileSystemWorkerMain.js +12 -3
- package/package.json +1 -1
|
@@ -1995,10 +1995,19 @@ 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);
|
|
2001
2007
|
}
|
|
2008
|
+
if (isProviderUri(dirent)) {
|
|
2009
|
+
return invoke$2('FileSystem.remove', dirent);
|
|
2010
|
+
}
|
|
2002
2011
|
return remove$2(dirent);
|
|
2003
2012
|
};
|
|
2004
2013
|
const readFile = async uri => {
|
|
@@ -2008,7 +2017,7 @@ const readFile = async uri => {
|
|
|
2008
2017
|
if (isHttp(uri)) {
|
|
2009
2018
|
return readFile$3(uri);
|
|
2010
2019
|
}
|
|
2011
|
-
if (isMemory(uri)) {
|
|
2020
|
+
if (isMemory(uri) || isProviderUri(uri)) {
|
|
2012
2021
|
return invoke$2('FileSystem.readFile', uri);
|
|
2013
2022
|
}
|
|
2014
2023
|
return readFile$2(uri);
|
|
@@ -2026,7 +2035,7 @@ const readDirWithFileTypes = async uri => {
|
|
|
2026
2035
|
if (isFetch(uri) || isHtml(uri)) {
|
|
2027
2036
|
return invoke$2('FileSystem.readDirWithFileTypes', uri);
|
|
2028
2037
|
}
|
|
2029
|
-
if (isMemory(uri)) {
|
|
2038
|
+
if (isMemory(uri) || isProviderUri(uri)) {
|
|
2030
2039
|
return invoke$2('FileSystem.readDirWithFileTypes', uri);
|
|
2031
2040
|
}
|
|
2032
2041
|
return readDirWithFileTypes$2(uri);
|
|
@@ -2093,7 +2102,7 @@ const createFile = async uri => {
|
|
|
2093
2102
|
return writeFile$2(uri, '');
|
|
2094
2103
|
};
|
|
2095
2104
|
const writeFile = async (uri, content) => {
|
|
2096
|
-
if (isMemory(uri)) {
|
|
2105
|
+
if (isMemory(uri) || isProviderUri(uri)) {
|
|
2097
2106
|
return invoke$2('FileSystem.writeFile', uri, content);
|
|
2098
2107
|
}
|
|
2099
2108
|
return writeFile$2(uri, content);
|