@lvce-editor/test-worker 13.21.0 → 13.23.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.
- package/dist/api.d.ts +1 -0
- package/dist/testWorkerMain.js +7 -3
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -462,6 +462,7 @@ interface FileSystem {
|
|
|
462
462
|
readonly createDroppedFileHandle: () => Promise<DroppedFileHandle>;
|
|
463
463
|
readonly createExecutable: (content: string) => Promise<string>;
|
|
464
464
|
readonly createExecutableFrom: (uri: string) => Promise<string>;
|
|
465
|
+
readonly getOpfsRoot: () => Promise<FileSystemDirectoryHandle>;
|
|
465
466
|
readonly getTmpDir: ({ scheme }?: FileSystemTmpDirOptions) => Promise<string>;
|
|
466
467
|
readonly loadFixture: (url: string) => Promise<string>;
|
|
467
468
|
readonly mkdir: (uri: string) => Promise<void>;
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -3118,10 +3118,10 @@ const readFile = async uri => {
|
|
|
3118
3118
|
return invoke('FileSystem.readFile', uri);
|
|
3119
3119
|
};
|
|
3120
3120
|
const addFileHandle = async file => {
|
|
3121
|
-
|
|
3121
|
+
return invoke('FileSystem.addFileHandle', file);
|
|
3122
3122
|
};
|
|
3123
3123
|
const mkdir = async uri => {
|
|
3124
|
-
|
|
3124
|
+
return invoke('FileSystem.mkdir', uri);
|
|
3125
3125
|
};
|
|
3126
3126
|
const setFiles = async files => {
|
|
3127
3127
|
// TODO maybe have a method to send all the files to file system worker directly
|
|
@@ -3165,8 +3165,11 @@ const createExecutableFrom = async uri => {
|
|
|
3165
3165
|
const content = await invoke('Ajax.getText', absolutePath);
|
|
3166
3166
|
return createExecutable(content);
|
|
3167
3167
|
};
|
|
3168
|
+
const getOpfsRoot = async () => {
|
|
3169
|
+
return navigator.storage.getDirectory();
|
|
3170
|
+
};
|
|
3168
3171
|
const createDroppedFileHandle = async () => {
|
|
3169
|
-
const directory = await
|
|
3172
|
+
const directory = await getOpfsRoot();
|
|
3170
3173
|
const fileHandle = await directory.getFileHandle('dropped-file.txt', {
|
|
3171
3174
|
create: true
|
|
3172
3175
|
});
|
|
@@ -3193,6 +3196,7 @@ const FileSystem = {
|
|
|
3193
3196
|
createDroppedFileHandle,
|
|
3194
3197
|
createExecutable,
|
|
3195
3198
|
createExecutableFrom,
|
|
3199
|
+
getOpfsRoot,
|
|
3196
3200
|
getTmpDir,
|
|
3197
3201
|
loadFixture,
|
|
3198
3202
|
mkdir,
|