@lvce-editor/api 9.33.0 → 9.33.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.
- package/dist/parts/FileSystemProvider/FileSystemProvider.d.ts +1 -0
- package/dist/parts/FileSystemProviderRegistry/FileSystemProviderRegistry.d.ts +1 -0
- package/dist/parts/FileSystemProviderRegistry/FileSystemProviderRegistry.js +9 -0
- package/dist/parts/RegisteredFileSystemProvider/RegisteredFileSystemProvider.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,5 +7,6 @@ export interface FileSystemProvider {
|
|
|
7
7
|
readonly readFile: (uri: string) => Blob | Promise<Blob | string> | string;
|
|
8
8
|
readonly remove?: (uri: string) => void | Promise<void>;
|
|
9
9
|
readonly rename?: (oldUri: string, newUri: string) => void | Promise<void>;
|
|
10
|
+
readonly stat?: (uri: string) => number | Promise<number>;
|
|
10
11
|
readonly writeFile?: (uri: string, content: string) => void | Promise<void>;
|
|
11
12
|
}
|
|
@@ -8,6 +8,7 @@ export declare const executeFileSystemProviderRemove: (id: string, uri: string)
|
|
|
8
8
|
export declare const executeFileSystemProviderRename: (id: string, oldUri: string, newUri: string) => Promise<void>;
|
|
9
9
|
export declare const executeFileSystemProviderWriteFile: (id: string, uri: string, content: string) => Promise<void>;
|
|
10
10
|
export declare const executeFileSystemProviderReadDirWithFileTypes: (id: string, uri: string) => Promise<readonly FileSystemDirent[]>;
|
|
11
|
+
export declare const executeFileSystemProviderStat: (id: string, uri: string) => Promise<number>;
|
|
11
12
|
export declare const executeFileSystemProviderIsReadonly: (id: string) => Promise<boolean>;
|
|
12
13
|
export declare const getFileSystemProviderRegistrySnapshot: () => FileSystemProviderRegistrySnapshot;
|
|
13
14
|
export declare const registerFileSystemProvider: (provider: FileSystemProvider) => Disposable;
|
|
@@ -71,6 +71,13 @@ export const executeFileSystemProviderReadDirWithFileTypes = async (id, uri) =>
|
|
|
71
71
|
}
|
|
72
72
|
return provider.readDirWithFileTypes(uri);
|
|
73
73
|
};
|
|
74
|
+
export const executeFileSystemProviderStat = async (id, uri) => {
|
|
75
|
+
const provider = getProvider(id);
|
|
76
|
+
if (!provider.stat) {
|
|
77
|
+
throw new ExtensionApiError(`file system provider ${id} is missing stat function`);
|
|
78
|
+
}
|
|
79
|
+
return provider.stat(uri);
|
|
80
|
+
};
|
|
74
81
|
export const executeFileSystemProviderIsReadonly = async (id) => {
|
|
75
82
|
const provider = getProvider(id);
|
|
76
83
|
return provider.isReadonly ? provider.isReadonly() : false;
|
|
@@ -92,6 +99,7 @@ export const registerFileSystemProvider = (provider) => {
|
|
|
92
99
|
readFile: (uri) => provider.readFile(uri),
|
|
93
100
|
remove: provider.remove,
|
|
94
101
|
rename: provider.rename,
|
|
102
|
+
stat: provider.stat,
|
|
95
103
|
writeFile: provider.writeFile,
|
|
96
104
|
};
|
|
97
105
|
ExtensionApiCommandRegistry.registerCommandMap(commandMap);
|
|
@@ -108,6 +116,7 @@ const commandMap = {
|
|
|
108
116
|
'ExtensionApi.executeFileSystemProviderReadFile': executeFileSystemProviderReadFile,
|
|
109
117
|
'ExtensionApi.executeFileSystemProviderRemove': executeFileSystemProviderRemove,
|
|
110
118
|
'ExtensionApi.executeFileSystemProviderRename': executeFileSystemProviderRename,
|
|
119
|
+
'ExtensionApi.executeFileSystemProviderStat': executeFileSystemProviderStat,
|
|
111
120
|
'ExtensionApi.executeFileSystemProviderWriteFile': executeFileSystemProviderWriteFile,
|
|
112
121
|
'ExtensionApi.getFileSystemProviderRegistrySnapshot': getFileSystemProviderRegistrySnapshot,
|
|
113
122
|
};
|
|
@@ -7,5 +7,6 @@ export interface RegisteredFileSystemProvider {
|
|
|
7
7
|
readonly readFile: (uri: string) => Blob | Promise<Blob | string> | string;
|
|
8
8
|
readonly remove?: (uri: string) => void | Promise<void>;
|
|
9
9
|
readonly rename?: (oldUri: string, newUri: string) => void | Promise<void>;
|
|
10
|
+
readonly stat?: (uri: string) => number | Promise<number>;
|
|
10
11
|
readonly writeFile?: (uri: string, content: string) => void | Promise<void>;
|
|
11
12
|
}
|