@utoo/web 0.0.1-alpha.3 → 0.0.1-alpha.8
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/esm/index.d.ts +11 -8
- package/esm/index.js +27 -29
- package/esm/type.d.ts +20 -7
- package/esm/type.js +12 -1
- package/esm/utoo/index.d.ts +13 -28
- package/esm/utoo/index.js +134 -117
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/worker.js +49 -13
- package/package.json +9 -4
package/esm/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dirent, ProjectEndpoint } from "./type";
|
|
2
2
|
export declare class Project implements ProjectEndpoint {
|
|
3
3
|
#private;
|
|
4
4
|
private cwd;
|
|
5
5
|
private remote;
|
|
6
|
-
constructor(cwd: string);
|
|
6
|
+
constructor(cwd: string, worker?: Worker);
|
|
7
7
|
install(packageLock: string): Promise<void>;
|
|
8
8
|
build(): Promise<void>;
|
|
9
|
-
readFile(path: string): Promise<
|
|
10
|
-
writeFile(path: string, content: string): Promise<void>;
|
|
9
|
+
readFile(path: string, encoding?: "utf8"): Promise<any>;
|
|
10
|
+
writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
|
|
11
11
|
copyFile(src: string, dst: string): Promise<void>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
readdir(path: string, options?: {
|
|
13
|
+
recursive?: boolean;
|
|
14
|
+
}): Promise<Dirent[]>;
|
|
15
|
+
mkdir(path: string, options?: {
|
|
16
|
+
recursive?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
static fork(channel: MessageChannel): ProjectEndpoint;
|
|
16
19
|
}
|
|
17
20
|
export * from "./type";
|
package/esm/index.js
CHANGED
|
@@ -12,17 +12,19 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
12
12
|
var _Project_tunnel;
|
|
13
13
|
import * as comlink from "comlink";
|
|
14
14
|
import { Fork, HandShake } from "./message";
|
|
15
|
+
import { Dirent } from "./type";
|
|
15
16
|
let ProjectWorker;
|
|
16
17
|
const ConnectedPorts = new Set();
|
|
17
18
|
export class Project {
|
|
18
|
-
constructor(cwd) {
|
|
19
|
+
constructor(cwd, worker) {
|
|
19
20
|
var _a, _b;
|
|
20
21
|
_Project_tunnel.set(this, void 0);
|
|
21
22
|
this.cwd = cwd;
|
|
22
23
|
const { port1, port2 } = new MessageChannel();
|
|
23
24
|
(_a = this.remote) !== null && _a !== void 0 ? _a : (this.remote = comlink.wrap(port1));
|
|
24
25
|
if (!ProjectWorker) {
|
|
25
|
-
ProjectWorker =
|
|
26
|
+
ProjectWorker =
|
|
27
|
+
worker || new Worker(new URL("./worker", import.meta.url));
|
|
26
28
|
self.addEventListener("message", (e) => {
|
|
27
29
|
const port = e.ports[0];
|
|
28
30
|
if (e.data === Fork && !ConnectedPorts.has(port)) {
|
|
@@ -41,34 +43,33 @@ export class Project {
|
|
|
41
43
|
await __classPrivateFieldGet(this, _Project_tunnel, "f");
|
|
42
44
|
return await this.remote.build();
|
|
43
45
|
}
|
|
44
|
-
async readFile(path) {
|
|
46
|
+
async readFile(path, encoding) {
|
|
45
47
|
await __classPrivateFieldGet(this, _Project_tunnel, "f");
|
|
46
|
-
return await this.remote.readFile(path);
|
|
48
|
+
return (await this.remote.readFile(path, encoding));
|
|
47
49
|
}
|
|
48
|
-
async writeFile(path, content) {
|
|
50
|
+
async writeFile(path, content, encoding) {
|
|
49
51
|
await __classPrivateFieldGet(this, _Project_tunnel, "f");
|
|
50
|
-
return await this.remote.writeFile(path, content);
|
|
52
|
+
return await this.remote.writeFile(path, content, encoding);
|
|
51
53
|
}
|
|
52
54
|
async copyFile(src, dst) {
|
|
53
55
|
await __classPrivateFieldGet(this, _Project_tunnel, "f");
|
|
54
56
|
return await this.remote.copyFile(src, dst);
|
|
55
57
|
}
|
|
56
|
-
async
|
|
58
|
+
async readdir(path, options) {
|
|
57
59
|
await __classPrivateFieldGet(this, _Project_tunnel, "f");
|
|
58
|
-
|
|
60
|
+
const dirEntry = (await this.remote.readdir(path, options));
|
|
61
|
+
return dirEntry.map((e) => new Dirent(e));
|
|
59
62
|
}
|
|
60
|
-
async
|
|
63
|
+
async mkdir(path, options) {
|
|
61
64
|
await __classPrivateFieldGet(this, _Project_tunnel, "f");
|
|
62
|
-
return await this.remote.
|
|
65
|
+
return await this.remote.mkdir(path, options);
|
|
63
66
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
self.postMessage(Fork, [port2]);
|
|
71
|
-
return new ForkedProject(port1);
|
|
67
|
+
static fork(channel) {
|
|
68
|
+
self.postMessage(Fork, {
|
|
69
|
+
targetOrigin: "*",
|
|
70
|
+
transfer: [channel.port2],
|
|
71
|
+
});
|
|
72
|
+
return new ForkedProject(channel.port1);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
_Project_tunnel = new WeakMap();
|
|
@@ -83,23 +84,20 @@ class ForkedProject {
|
|
|
83
84
|
async build() {
|
|
84
85
|
return await this.endpoint.build();
|
|
85
86
|
}
|
|
86
|
-
async readFile(path) {
|
|
87
|
-
return await this.endpoint.readFile(path);
|
|
87
|
+
async readFile(path, encoding) {
|
|
88
|
+
return (await this.endpoint.readFile(path, encoding));
|
|
88
89
|
}
|
|
89
|
-
async writeFile(path, content) {
|
|
90
|
-
return await this.endpoint.writeFile(path, content);
|
|
90
|
+
async writeFile(path, content, encoding) {
|
|
91
|
+
return await this.endpoint.writeFile(path, content, encoding);
|
|
91
92
|
}
|
|
92
93
|
async copyFile(src, dst) {
|
|
93
94
|
return await this.endpoint.copyFile(src, dst);
|
|
94
95
|
}
|
|
95
|
-
async
|
|
96
|
-
return await this.endpoint.
|
|
97
|
-
}
|
|
98
|
-
async createDir(path) {
|
|
99
|
-
return await this.endpoint.createDir(path);
|
|
96
|
+
async readdir(path, options) {
|
|
97
|
+
return await this.endpoint.readdir(path, options);
|
|
100
98
|
}
|
|
101
|
-
async
|
|
102
|
-
return await this.endpoint.
|
|
99
|
+
async mkdir(path, options) {
|
|
100
|
+
return await this.endpoint.mkdir(path, options);
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
export * from "./type";
|
package/esm/type.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface
|
|
1
|
+
import { DirEntryType } from "./utoo";
|
|
2
|
+
export interface RawDirent {
|
|
3
3
|
name: string;
|
|
4
4
|
type: DirEntryType;
|
|
5
5
|
}
|
|
6
|
+
export declare class Dirent {
|
|
7
|
+
private rawDirent;
|
|
8
|
+
name: string;
|
|
9
|
+
constructor(rawDirent: RawDirent);
|
|
10
|
+
isDirectory(): boolean;
|
|
11
|
+
isFile(): boolean;
|
|
12
|
+
}
|
|
6
13
|
export interface ProjectEndpoint {
|
|
7
14
|
install: (packageLock: string) => Promise<void>;
|
|
8
15
|
build: () => Promise<void>;
|
|
9
|
-
readFile(path: string): Promise<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
17
|
+
readFile(path: string, encoding?: "utf8"): Promise<string>;
|
|
18
|
+
writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
|
|
19
|
+
readdir(path: string, options?: {
|
|
20
|
+
recursive?: boolean;
|
|
21
|
+
}): Promise<Dirent[]>;
|
|
22
|
+
mkdir(path: string, options?: {
|
|
23
|
+
recursive?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
14
25
|
copyFile(src: string, dst: string): Promise<void>;
|
|
15
26
|
}
|
|
27
|
+
export interface ProjectEndpoint {
|
|
28
|
+
}
|
package/esm/type.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export class Dirent {
|
|
2
|
+
constructor(rawDirent) {
|
|
3
|
+
this.rawDirent = rawDirent;
|
|
4
|
+
this.name = this.rawDirent.name;
|
|
5
|
+
}
|
|
6
|
+
isDirectory() {
|
|
7
|
+
return this.rawDirent.type === "directory";
|
|
8
|
+
}
|
|
9
|
+
isFile() {
|
|
10
|
+
return this.rawDirent.type === "file";
|
|
11
|
+
}
|
|
12
|
+
}
|
package/esm/utoo/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {PartialProjectOptions} partial_options
|
|
3
|
-
* @returns {Promise<void>}
|
|
4
|
-
*/
|
|
5
|
-
export function build(partial_options: PartialProjectOptions): Promise<void>;
|
|
6
1
|
export function init_pack(): void;
|
|
7
2
|
export class CreateSyncAccessHandleOptions {
|
|
8
3
|
static __wrap(ptr: any): any;
|
|
@@ -40,27 +35,6 @@ export class DirEntry {
|
|
|
40
35
|
*/
|
|
41
36
|
get type(): DirEntryType;
|
|
42
37
|
}
|
|
43
|
-
export class PartialProjectOptions {
|
|
44
|
-
__destroy_into_raw(): number | undefined;
|
|
45
|
-
__wbg_ptr: number | undefined;
|
|
46
|
-
free(): void;
|
|
47
|
-
/**
|
|
48
|
-
* @param {string} arg0
|
|
49
|
-
*/
|
|
50
|
-
set project_path(arg0: string);
|
|
51
|
-
/**
|
|
52
|
-
* @returns {string}
|
|
53
|
-
*/
|
|
54
|
-
get project_path(): string;
|
|
55
|
-
/**
|
|
56
|
-
* @param {string | null} [arg0]
|
|
57
|
-
*/
|
|
58
|
-
set config(arg0: string | null);
|
|
59
|
-
/**
|
|
60
|
-
* @returns {string | undefined}
|
|
61
|
-
*/
|
|
62
|
-
get config(): string | undefined;
|
|
63
|
-
}
|
|
64
38
|
export class Project {
|
|
65
39
|
/**
|
|
66
40
|
* @param {string} cwd
|
|
@@ -82,17 +56,28 @@ export class Project {
|
|
|
82
56
|
* @returns {Promise<void>}
|
|
83
57
|
*/
|
|
84
58
|
build(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* @param {string} path
|
|
61
|
+
* @returns {Promise<Uint8Array>}
|
|
62
|
+
*/
|
|
63
|
+
read(path: string): Promise<Uint8Array>;
|
|
85
64
|
/**
|
|
86
65
|
* @param {string} path
|
|
87
66
|
* @returns {Promise<string>}
|
|
88
67
|
*/
|
|
89
|
-
|
|
68
|
+
readToString(path: string): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} path
|
|
71
|
+
* @param {Uint8Array} content
|
|
72
|
+
* @returns {Promise<void>}
|
|
73
|
+
*/
|
|
74
|
+
write(path: string, content: Uint8Array): Promise<void>;
|
|
90
75
|
/**
|
|
91
76
|
* @param {string} path
|
|
92
77
|
* @param {string} content
|
|
93
78
|
* @returns {Promise<void>}
|
|
94
79
|
*/
|
|
95
|
-
|
|
80
|
+
writeString(path: string, content: string): Promise<void>;
|
|
96
81
|
/**
|
|
97
82
|
* @param {string} path
|
|
98
83
|
* @returns {Promise<DirEntry[]>}
|
package/esm/utoo/index.js
CHANGED
|
@@ -108,7 +108,7 @@ function isLikeNone(x) {
|
|
|
108
108
|
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
109
109
|
? { register: () => { }, unregister: () => { } }
|
|
110
110
|
: new FinalizationRegistry(state => {
|
|
111
|
-
wasm.
|
|
111
|
+
wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
|
|
112
112
|
});
|
|
113
113
|
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
114
114
|
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
@@ -124,7 +124,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
124
124
|
}
|
|
125
125
|
finally {
|
|
126
126
|
if (--state.cnt === 0) {
|
|
127
|
-
wasm.
|
|
127
|
+
wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
|
|
128
128
|
CLOSURE_DTORS.unregister(state);
|
|
129
129
|
}
|
|
130
130
|
else {
|
|
@@ -204,32 +204,26 @@ function debugString(val) {
|
|
|
204
204
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
205
205
|
return className;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* @param {PartialProjectOptions} partial_options
|
|
214
|
-
* @returns {Promise<void>}
|
|
215
|
-
*/
|
|
216
|
-
export function build(partial_options) {
|
|
217
|
-
_assertClass(partial_options, PartialProjectOptions);
|
|
218
|
-
var ptr0 = partial_options.__destroy_into_raw();
|
|
219
|
-
const ret = wasm.build(ptr0);
|
|
220
|
-
return takeObject(ret);
|
|
207
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
208
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
209
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
210
|
+
WASM_VECTOR_LEN = arg.length;
|
|
211
|
+
return ptr;
|
|
221
212
|
}
|
|
222
213
|
export function init_pack() {
|
|
223
214
|
wasm.init_pack();
|
|
224
215
|
}
|
|
225
|
-
function
|
|
216
|
+
function __wbg_adapter_30(arg0, arg1) {
|
|
226
217
|
wasm.__wbindgen_export_5(arg0, arg1);
|
|
227
218
|
}
|
|
228
|
-
function
|
|
219
|
+
function __wbg_adapter_33(arg0, arg1, arg2) {
|
|
229
220
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
230
221
|
}
|
|
231
|
-
function
|
|
232
|
-
wasm.__wbindgen_export_7(arg0, arg1
|
|
222
|
+
function __wbg_adapter_36(arg0, arg1) {
|
|
223
|
+
wasm.__wbindgen_export_7(arg0, arg1);
|
|
224
|
+
}
|
|
225
|
+
function __wbg_adapter_71(arg0, arg1, arg2, arg3) {
|
|
226
|
+
wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
233
227
|
}
|
|
234
228
|
const __wbindgen_enum_DirEntryType = ["file", "directory"];
|
|
235
229
|
const __wbindgen_enum_FileSystemHandleKind = ["file", "directory"];
|
|
@@ -307,14 +301,14 @@ export class DirEntry {
|
|
|
307
301
|
}
|
|
308
302
|
finally {
|
|
309
303
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
310
|
-
wasm.
|
|
304
|
+
wasm.__wbindgen_export_1(deferred1_0, deferred1_1, 1);
|
|
311
305
|
}
|
|
312
306
|
}
|
|
313
307
|
/**
|
|
314
308
|
* @param {string} arg0
|
|
315
309
|
*/
|
|
316
310
|
set name(arg0) {
|
|
317
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
311
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
318
312
|
const len0 = WASM_VECTOR_LEN;
|
|
319
313
|
wasm.__wbg_set_direntry_name(this.__wbg_ptr, ptr0, len0);
|
|
320
314
|
}
|
|
@@ -332,77 +326,6 @@ export class DirEntry {
|
|
|
332
326
|
wasm.__wbg_set_direntry_type(this.__wbg_ptr, (__wbindgen_enum_DirEntryType.indexOf(arg0) + 1 || 3) - 1);
|
|
333
327
|
}
|
|
334
328
|
}
|
|
335
|
-
const PartialProjectOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
336
|
-
? { register: () => { }, unregister: () => { } }
|
|
337
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_partialprojectoptions_free(ptr >>> 0, 1));
|
|
338
|
-
export class PartialProjectOptions {
|
|
339
|
-
__destroy_into_raw() {
|
|
340
|
-
const ptr = this.__wbg_ptr;
|
|
341
|
-
this.__wbg_ptr = 0;
|
|
342
|
-
PartialProjectOptionsFinalization.unregister(this);
|
|
343
|
-
return ptr;
|
|
344
|
-
}
|
|
345
|
-
free() {
|
|
346
|
-
const ptr = this.__destroy_into_raw();
|
|
347
|
-
wasm.__wbg_partialprojectoptions_free(ptr, 0);
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* @returns {string}
|
|
351
|
-
*/
|
|
352
|
-
get project_path() {
|
|
353
|
-
let deferred1_0;
|
|
354
|
-
let deferred1_1;
|
|
355
|
-
try {
|
|
356
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
357
|
-
wasm.__wbg_get_partialprojectoptions_project_path(retptr, this.__wbg_ptr);
|
|
358
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
359
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
360
|
-
deferred1_0 = r0;
|
|
361
|
-
deferred1_1 = r1;
|
|
362
|
-
return getStringFromWasm0(r0, r1);
|
|
363
|
-
}
|
|
364
|
-
finally {
|
|
365
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
366
|
-
wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* @param {string} arg0
|
|
371
|
-
*/
|
|
372
|
-
set project_path(arg0) {
|
|
373
|
-
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
374
|
-
const len0 = WASM_VECTOR_LEN;
|
|
375
|
-
wasm.__wbg_set_partialprojectoptions_project_path(this.__wbg_ptr, ptr0, len0);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* @returns {string | undefined}
|
|
379
|
-
*/
|
|
380
|
-
get config() {
|
|
381
|
-
try {
|
|
382
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
383
|
-
wasm.__wbg_get_partialprojectoptions_config(retptr, this.__wbg_ptr);
|
|
384
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
385
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
386
|
-
let v1;
|
|
387
|
-
if (r0 !== 0) {
|
|
388
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
389
|
-
wasm.__wbindgen_export_4(r0, r1 * 1, 1);
|
|
390
|
-
}
|
|
391
|
-
return v1;
|
|
392
|
-
}
|
|
393
|
-
finally {
|
|
394
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* @param {string | null} [arg0]
|
|
399
|
-
*/
|
|
400
|
-
set config(arg0) {
|
|
401
|
-
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
402
|
-
var len0 = WASM_VECTOR_LEN;
|
|
403
|
-
wasm.__wbg_set_partialprojectoptions_config(this.__wbg_ptr, ptr0, len0);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
329
|
const ProjectFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
407
330
|
? { register: () => { }, unregister: () => { } }
|
|
408
331
|
: new FinalizationRegistry(ptr => wasm.__wbg_project_free(ptr >>> 0, 1));
|
|
@@ -421,7 +344,7 @@ export class Project {
|
|
|
421
344
|
* @param {string} cwd
|
|
422
345
|
*/
|
|
423
346
|
constructor(cwd) {
|
|
424
|
-
const ptr0 = passStringToWasm0(cwd, wasm.
|
|
347
|
+
const ptr0 = passStringToWasm0(cwd, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
425
348
|
const len0 = WASM_VECTOR_LEN;
|
|
426
349
|
const ret = wasm.project_new(ptr0, len0);
|
|
427
350
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -445,7 +368,7 @@ export class Project {
|
|
|
445
368
|
}
|
|
446
369
|
finally {
|
|
447
370
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
448
|
-
wasm.
|
|
371
|
+
wasm.__wbindgen_export_1(deferred1_0, deferred1_1, 1);
|
|
449
372
|
}
|
|
450
373
|
}
|
|
451
374
|
/**
|
|
@@ -453,7 +376,7 @@ export class Project {
|
|
|
453
376
|
* @returns {Promise<void>}
|
|
454
377
|
*/
|
|
455
378
|
install(package_lock) {
|
|
456
|
-
const ptr0 = passStringToWasm0(package_lock, wasm.
|
|
379
|
+
const ptr0 = passStringToWasm0(package_lock, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
457
380
|
const len0 = WASM_VECTOR_LEN;
|
|
458
381
|
const ret = wasm.project_install(this.__wbg_ptr, ptr0, len0);
|
|
459
382
|
return takeObject(ret);
|
|
@@ -465,14 +388,37 @@ export class Project {
|
|
|
465
388
|
const ret = wasm.project_build(this.__wbg_ptr);
|
|
466
389
|
return takeObject(ret);
|
|
467
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* @param {string} path
|
|
393
|
+
* @returns {Promise<Uint8Array>}
|
|
394
|
+
*/
|
|
395
|
+
read(path) {
|
|
396
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
397
|
+
const len0 = WASM_VECTOR_LEN;
|
|
398
|
+
const ret = wasm.project_read(this.__wbg_ptr, ptr0, len0);
|
|
399
|
+
return takeObject(ret);
|
|
400
|
+
}
|
|
468
401
|
/**
|
|
469
402
|
* @param {string} path
|
|
470
403
|
* @returns {Promise<string>}
|
|
471
404
|
*/
|
|
472
|
-
|
|
473
|
-
const ptr0 = passStringToWasm0(path, wasm.
|
|
405
|
+
readToString(path) {
|
|
406
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
474
407
|
const len0 = WASM_VECTOR_LEN;
|
|
475
|
-
const ret = wasm.
|
|
408
|
+
const ret = wasm.project_readToString(this.__wbg_ptr, ptr0, len0);
|
|
409
|
+
return takeObject(ret);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* @param {string} path
|
|
413
|
+
* @param {Uint8Array} content
|
|
414
|
+
* @returns {Promise<void>}
|
|
415
|
+
*/
|
|
416
|
+
write(path, content) {
|
|
417
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
418
|
+
const len0 = WASM_VECTOR_LEN;
|
|
419
|
+
const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_export_2);
|
|
420
|
+
const len1 = WASM_VECTOR_LEN;
|
|
421
|
+
const ret = wasm.project_write(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
476
422
|
return takeObject(ret);
|
|
477
423
|
}
|
|
478
424
|
/**
|
|
@@ -480,12 +426,12 @@ export class Project {
|
|
|
480
426
|
* @param {string} content
|
|
481
427
|
* @returns {Promise<void>}
|
|
482
428
|
*/
|
|
483
|
-
|
|
484
|
-
const ptr0 = passStringToWasm0(path, wasm.
|
|
429
|
+
writeString(path, content) {
|
|
430
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
485
431
|
const len0 = WASM_VECTOR_LEN;
|
|
486
|
-
const ptr1 = passStringToWasm0(content, wasm.
|
|
432
|
+
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
487
433
|
const len1 = WASM_VECTOR_LEN;
|
|
488
|
-
const ret = wasm.
|
|
434
|
+
const ret = wasm.project_writeString(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
489
435
|
return takeObject(ret);
|
|
490
436
|
}
|
|
491
437
|
/**
|
|
@@ -493,7 +439,7 @@ export class Project {
|
|
|
493
439
|
* @returns {Promise<DirEntry[]>}
|
|
494
440
|
*/
|
|
495
441
|
readDir(path) {
|
|
496
|
-
const ptr0 = passStringToWasm0(path, wasm.
|
|
442
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
497
443
|
const len0 = WASM_VECTOR_LEN;
|
|
498
444
|
const ret = wasm.project_readDir(this.__wbg_ptr, ptr0, len0);
|
|
499
445
|
return takeObject(ret);
|
|
@@ -503,7 +449,7 @@ export class Project {
|
|
|
503
449
|
* @returns {Promise<void>}
|
|
504
450
|
*/
|
|
505
451
|
createDir(path) {
|
|
506
|
-
const ptr0 = passStringToWasm0(path, wasm.
|
|
452
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
507
453
|
const len0 = WASM_VECTOR_LEN;
|
|
508
454
|
const ret = wasm.project_createDir(this.__wbg_ptr, ptr0, len0);
|
|
509
455
|
return takeObject(ret);
|
|
@@ -513,7 +459,7 @@ export class Project {
|
|
|
513
459
|
* @returns {Promise<void>}
|
|
514
460
|
*/
|
|
515
461
|
createDirAll(path) {
|
|
516
|
-
const ptr0 = passStringToWasm0(path, wasm.
|
|
462
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
517
463
|
const len0 = WASM_VECTOR_LEN;
|
|
518
464
|
const ret = wasm.project_createDirAll(this.__wbg_ptr, ptr0, len0);
|
|
519
465
|
return takeObject(ret);
|
|
@@ -524,9 +470,9 @@ export class Project {
|
|
|
524
470
|
* @returns {Promise<void>}
|
|
525
471
|
*/
|
|
526
472
|
copyFile(src, dst) {
|
|
527
|
-
const ptr0 = passStringToWasm0(src, wasm.
|
|
473
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
528
474
|
const len0 = WASM_VECTOR_LEN;
|
|
529
|
-
const ptr1 = passStringToWasm0(dst, wasm.
|
|
475
|
+
const ptr1 = passStringToWasm0(dst, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
530
476
|
const len1 = WASM_VECTOR_LEN;
|
|
531
477
|
const ret = wasm.project_copyFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
532
478
|
return takeObject(ret);
|
|
@@ -607,6 +553,12 @@ function __wbg_get_imports() {
|
|
|
607
553
|
const ret = CreateSyncAccessHandleOptions.__wrap(arg0);
|
|
608
554
|
return addHeapObject(ret);
|
|
609
555
|
};
|
|
556
|
+
imports.wbg.__wbg_debug_3cb59063b29f58c1 = function (arg0) {
|
|
557
|
+
console.debug(getObject(arg0));
|
|
558
|
+
};
|
|
559
|
+
imports.wbg.__wbg_debug_e17b51583ca6a632 = function (arg0, arg1, arg2, arg3) {
|
|
560
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
561
|
+
};
|
|
610
562
|
imports.wbg.__wbg_direntry_new = function (arg0) {
|
|
611
563
|
const ret = DirEntry.__wrap(arg0);
|
|
612
564
|
return addHeapObject(ret);
|
|
@@ -619,6 +571,24 @@ function __wbg_get_imports() {
|
|
|
619
571
|
const ret = getObject(arg0).entries();
|
|
620
572
|
return addHeapObject(ret);
|
|
621
573
|
};
|
|
574
|
+
imports.wbg.__wbg_error_524f506f44df1645 = function (arg0) {
|
|
575
|
+
console.error(getObject(arg0));
|
|
576
|
+
};
|
|
577
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
|
|
578
|
+
let deferred0_0;
|
|
579
|
+
let deferred0_1;
|
|
580
|
+
try {
|
|
581
|
+
deferred0_0 = arg0;
|
|
582
|
+
deferred0_1 = arg1;
|
|
583
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
584
|
+
}
|
|
585
|
+
finally {
|
|
586
|
+
wasm.__wbindgen_export_1(deferred0_0, deferred0_1, 1);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
imports.wbg.__wbg_error_80de38b3f7cc3c3c = function (arg0, arg1, arg2, arg3) {
|
|
590
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
591
|
+
};
|
|
622
592
|
imports.wbg.__wbg_fetch_11bff8299d0ecd2b = function (arg0) {
|
|
623
593
|
const ret = fetch(getObject(arg0));
|
|
624
594
|
return addHeapObject(ret);
|
|
@@ -674,6 +644,12 @@ function __wbg_get_imports() {
|
|
|
674
644
|
const ret = getObject(arg0).headers;
|
|
675
645
|
return addHeapObject(ret);
|
|
676
646
|
};
|
|
647
|
+
imports.wbg.__wbg_info_033d8b8a0838f1d3 = function (arg0, arg1, arg2, arg3) {
|
|
648
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
649
|
+
};
|
|
650
|
+
imports.wbg.__wbg_info_3daf2e093e091b66 = function (arg0) {
|
|
651
|
+
console.info(getObject(arg0));
|
|
652
|
+
};
|
|
677
653
|
imports.wbg.__wbg_instanceof_DomException_ed1ccb7aaf39034c = function (arg0) {
|
|
678
654
|
let result;
|
|
679
655
|
try {
|
|
@@ -721,7 +697,7 @@ function __wbg_get_imports() {
|
|
|
721
697
|
};
|
|
722
698
|
imports.wbg.__wbg_name_f2d27098bfd843e7 = function (arg0, arg1) {
|
|
723
699
|
const ret = getObject(arg1).name;
|
|
724
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
700
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
725
701
|
const len1 = WASM_VECTOR_LEN;
|
|
726
702
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
727
703
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
@@ -743,7 +719,7 @@ function __wbg_get_imports() {
|
|
|
743
719
|
const a = state0.a;
|
|
744
720
|
state0.a = 0;
|
|
745
721
|
try {
|
|
746
|
-
return
|
|
722
|
+
return __wbg_adapter_71(a, state0.b, arg0, arg1);
|
|
747
723
|
}
|
|
748
724
|
finally {
|
|
749
725
|
state0.a = a;
|
|
@@ -760,6 +736,10 @@ function __wbg_get_imports() {
|
|
|
760
736
|
const ret = new Object();
|
|
761
737
|
return addHeapObject(ret);
|
|
762
738
|
};
|
|
739
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {
|
|
740
|
+
const ret = new Error();
|
|
741
|
+
return addHeapObject(ret);
|
|
742
|
+
};
|
|
763
743
|
imports.wbg.__wbg_new_a12002a7f91c75be = function (arg0) {
|
|
764
744
|
const ret = new Uint8Array(getObject(arg0));
|
|
765
745
|
return addHeapObject(ret);
|
|
@@ -800,6 +780,14 @@ function __wbg_get_imports() {
|
|
|
800
780
|
return addHeapObject(ret);
|
|
801
781
|
}, arguments);
|
|
802
782
|
};
|
|
783
|
+
imports.wbg.__wbg_now_e1163c67115ff874 = function (arg0) {
|
|
784
|
+
const ret = getObject(arg0).now();
|
|
785
|
+
return ret;
|
|
786
|
+
};
|
|
787
|
+
imports.wbg.__wbg_performance_7fe0928f3ab059e5 = function (arg0) {
|
|
788
|
+
const ret = getObject(arg0).performance;
|
|
789
|
+
return addHeapObject(ret);
|
|
790
|
+
};
|
|
803
791
|
imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function (arg0) {
|
|
804
792
|
queueMicrotask(getObject(arg0));
|
|
805
793
|
};
|
|
@@ -821,6 +809,12 @@ function __wbg_get_imports() {
|
|
|
821
809
|
const ret = Promise.resolve(getObject(arg0));
|
|
822
810
|
return addHeapObject(ret);
|
|
823
811
|
};
|
|
812
|
+
imports.wbg.__wbg_setTimeout_42370cb3051b8c2c = function () {
|
|
813
|
+
return handleError(function (arg0, arg1, arg2) {
|
|
814
|
+
const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
|
|
815
|
+
return addHeapObject(ret);
|
|
816
|
+
}, arguments);
|
|
817
|
+
};
|
|
824
818
|
imports.wbg.__wbg_setTimeout_73ce8df12de4f2f2 = function (arg0, arg1) {
|
|
825
819
|
const ret = setTimeout(getObject(arg0), arg1);
|
|
826
820
|
return addHeapObject(ret);
|
|
@@ -862,6 +856,13 @@ function __wbg_get_imports() {
|
|
|
862
856
|
const ret = getObject(arg0).signal;
|
|
863
857
|
return addHeapObject(ret);
|
|
864
858
|
};
|
|
859
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
|
|
860
|
+
const ret = getObject(arg1).stack;
|
|
861
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
862
|
+
const len1 = WASM_VECTOR_LEN;
|
|
863
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
864
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
865
|
+
};
|
|
865
866
|
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function () {
|
|
866
867
|
const ret = typeof global === 'undefined' ? null : global;
|
|
867
868
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
@@ -911,7 +912,7 @@ function __wbg_get_imports() {
|
|
|
911
912
|
};
|
|
912
913
|
imports.wbg.__wbg_url_ae10c34ca209681d = function (arg0, arg1) {
|
|
913
914
|
const ret = getObject(arg1).url;
|
|
914
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
915
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
915
916
|
const len1 = WASM_VECTOR_LEN;
|
|
916
917
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
917
918
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
@@ -920,6 +921,12 @@ function __wbg_get_imports() {
|
|
|
920
921
|
const ret = getObject(arg0).value;
|
|
921
922
|
return addHeapObject(ret);
|
|
922
923
|
};
|
|
924
|
+
imports.wbg.__wbg_warn_4ca3906c248c47c4 = function (arg0) {
|
|
925
|
+
console.warn(getObject(arg0));
|
|
926
|
+
};
|
|
927
|
+
imports.wbg.__wbg_warn_aaf1f4664a035bd6 = function (arg0, arg1, arg2, arg3) {
|
|
928
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
929
|
+
};
|
|
923
930
|
imports.wbg.__wbg_write_530d3c84df874f53 = function () {
|
|
924
931
|
return handleError(function (arg0, arg1, arg2, arg3) {
|
|
925
932
|
const ret = getObject(arg0).write(getArrayU8FromWasm0(arg1, arg2), getObject(arg3));
|
|
@@ -942,17 +949,21 @@ function __wbg_get_imports() {
|
|
|
942
949
|
const ret = false;
|
|
943
950
|
return ret;
|
|
944
951
|
};
|
|
945
|
-
imports.wbg.
|
|
946
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
952
|
+
imports.wbg.__wbindgen_closure_wrapper220138 = function (arg0, arg1, arg2) {
|
|
953
|
+
const ret = makeMutClosure(arg0, arg1, 148252, __wbg_adapter_33);
|
|
954
|
+
return addHeapObject(ret);
|
|
955
|
+
};
|
|
956
|
+
imports.wbg.__wbindgen_closure_wrapper220295 = function (arg0, arg1, arg2) {
|
|
957
|
+
const ret = makeMutClosure(arg0, arg1, 148274, __wbg_adapter_36);
|
|
947
958
|
return addHeapObject(ret);
|
|
948
959
|
};
|
|
949
|
-
imports.wbg.
|
|
950
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
960
|
+
imports.wbg.__wbindgen_closure_wrapper33472 = function (arg0, arg1, arg2) {
|
|
961
|
+
const ret = makeMutClosure(arg0, arg1, 19113, __wbg_adapter_30);
|
|
951
962
|
return addHeapObject(ret);
|
|
952
963
|
};
|
|
953
964
|
imports.wbg.__wbindgen_debug_string = function (arg0, arg1) {
|
|
954
965
|
const ret = debugString(getObject(arg1));
|
|
955
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
966
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
956
967
|
const len1 = WASM_VECTOR_LEN;
|
|
957
968
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
958
969
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
@@ -984,7 +995,7 @@ function __wbg_get_imports() {
|
|
|
984
995
|
imports.wbg.__wbindgen_string_get = function (arg0, arg1) {
|
|
985
996
|
const obj = getObject(arg1);
|
|
986
997
|
const ret = typeof (obj) === 'string' ? obj : undefined;
|
|
987
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.
|
|
998
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
|
|
988
999
|
var len1 = WASM_VECTOR_LEN;
|
|
989
1000
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
990
1001
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
@@ -996,6 +1007,12 @@ function __wbg_get_imports() {
|
|
|
996
1007
|
imports.wbg.__wbindgen_throw = function (arg0, arg1) {
|
|
997
1008
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
998
1009
|
};
|
|
1010
|
+
imports.wbg.__wbindgen_uint8_array_new = function (arg0, arg1) {
|
|
1011
|
+
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
1012
|
+
wasm.__wbindgen_export_1(arg0, arg1 * 1, 1);
|
|
1013
|
+
const ret = v0;
|
|
1014
|
+
return addHeapObject(ret);
|
|
1015
|
+
};
|
|
999
1016
|
return imports;
|
|
1000
1017
|
}
|
|
1001
1018
|
function __wbg_init_memory(imports, memory) {
|
package/esm/utoo/index_bg.wasm
CHANGED
|
Binary file
|
package/esm/worker.js
CHANGED
|
@@ -1,35 +1,71 @@
|
|
|
1
1
|
import * as comlink from "comlink";
|
|
2
2
|
import { HandShake } from "./message";
|
|
3
3
|
import initWasm, { Project as ProjectInternal } from "./utoo";
|
|
4
|
+
const WasmInit = initWasm();
|
|
4
5
|
const projectEndpoint = {
|
|
5
6
|
projectInternal: undefined,
|
|
6
7
|
async mount(cwd) {
|
|
7
|
-
await
|
|
8
|
+
await WasmInit;
|
|
8
9
|
this.projectInternal = new ProjectInternal(cwd);
|
|
10
|
+
return;
|
|
9
11
|
},
|
|
10
12
|
async install(packageLock) {
|
|
13
|
+
await WasmInit;
|
|
11
14
|
await this.projectInternal.install(packageLock);
|
|
15
|
+
return;
|
|
12
16
|
},
|
|
13
17
|
async build() {
|
|
14
|
-
await
|
|
18
|
+
await WasmInit;
|
|
19
|
+
return await this.projectInternal.build();
|
|
15
20
|
},
|
|
16
|
-
async readFile(path) {
|
|
17
|
-
|
|
21
|
+
async readFile(path, encoding) {
|
|
22
|
+
await WasmInit;
|
|
23
|
+
let ret;
|
|
24
|
+
if (encoding === "utf8") {
|
|
25
|
+
ret = await this.projectInternal.readToString(path);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
ret = await this.projectInternal.read(path);
|
|
29
|
+
}
|
|
30
|
+
return ret;
|
|
18
31
|
},
|
|
19
|
-
async writeFile(path, content) {
|
|
20
|
-
|
|
32
|
+
async writeFile(path, content, _encoding) {
|
|
33
|
+
await WasmInit;
|
|
34
|
+
if (typeof content === "string") {
|
|
35
|
+
return await this.projectInternal.writeString(path, content);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return await this.projectInternal.write(path, content);
|
|
39
|
+
}
|
|
21
40
|
},
|
|
22
41
|
async copyFile(src, dst) {
|
|
42
|
+
await WasmInit;
|
|
23
43
|
return await this.projectInternal.copyFile(src, dst);
|
|
24
44
|
},
|
|
25
|
-
async
|
|
26
|
-
|
|
45
|
+
async readdir(path, options) {
|
|
46
|
+
await WasmInit;
|
|
47
|
+
const dirEntries = (options === null || options === void 0 ? void 0 : options.recursive)
|
|
48
|
+
? await this.projectInternal.readDir(path)
|
|
49
|
+
: // TODO: support recursive readDirAll
|
|
50
|
+
await this.projectInternal.readDir(path);
|
|
51
|
+
const rawDirents = dirEntries.map((e) => {
|
|
52
|
+
const dir = e.toJSON();
|
|
53
|
+
return {
|
|
54
|
+
name: dir.name,
|
|
55
|
+
type: dir.type,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
// WARN: This is a hack, functions can not be structurally cloned
|
|
59
|
+
return rawDirents;
|
|
27
60
|
},
|
|
28
|
-
async
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
61
|
+
async mkdir(path, options) {
|
|
62
|
+
await WasmInit;
|
|
63
|
+
if (options === null || options === void 0 ? void 0 : options.recursive) {
|
|
64
|
+
return await this.projectInternal.createDirAll(path);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return await this.projectInternal.createDir(path);
|
|
68
|
+
}
|
|
33
69
|
},
|
|
34
70
|
};
|
|
35
71
|
const ConnectedPorts = new Set();
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/web",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.8",
|
|
4
4
|
"module": "esm/index.js",
|
|
5
5
|
"types": "esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"esm/*"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
10
|
+
"install-toolchain": "cargo install wasm-bindgen-cli && brew install binaryen",
|
|
11
|
+
"build-wasm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown",
|
|
12
|
+
"build-wasm:pm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown --no-default-features",
|
|
13
|
+
"bindgen-dev": "wasm-bindgen ../../target/wasm32-unknown-unknown/wasm-dev/utoo_wasm.wasm --out-dir src/utoo --out-name index --target web --debug --keep-debug --no-demangle",
|
|
14
|
+
"bindgen-build": "wasm-bindgen ../../target/wasm32-unknown-unknown/wasm-release/utoo_wasm.wasm --out-dir src/utoo --out-name index --target web",
|
|
11
15
|
"tsx": "rm -rf esm && tsc -p ./tsconfig.json",
|
|
12
|
-
"dev": "npm run
|
|
13
|
-
"
|
|
16
|
+
"dev": "npm run build-wasm -- --profile wasm-dev && npm run bindgen-dev && npm run tsx && cp src/utoo/index_bg.wasm esm/utoo",
|
|
17
|
+
"dev:pm": "npm run build-wasm:pm -- --profile wasm-dev && npm run bindgen-dev && npm run tsx && cp src/utoo/index_bg.wasm esm/utoo",
|
|
18
|
+
"build": "npm run build-wasm -- --profile wasm-release && npm run bindgen-build && npm run tsx && wasm-opt src/utoo/index_bg.wasm -o esm/utoo/index_bg.wasm -O4 --enable-bulk-memory --enable-nontrapping-float-to-int",
|
|
14
19
|
"prepublishOnly": "npm run build"
|
|
15
20
|
},
|
|
16
21
|
"dependencies": {
|