@utoo/web 1.3.4 → 1.4.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/esm/loaderWorker.js +1 -1
- package/esm/project/ForkedProject.d.ts +9 -2
- package/esm/project/ForkedProject.js +4 -4
- package/esm/project/InternalProject.d.ts +9 -3
- package/esm/project/InternalProject.js +13 -7
- package/esm/project/Project.d.ts +9 -3
- package/esm/project/Project.js +13 -10
- package/esm/types.d.ts +9 -3
- package/esm/utoo/index.d.ts +30 -2
- package/esm/utoo/index.js +89 -27
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/webpackLoaders/cjs.js +12 -1
- package/esm/webpackLoaders/polyfills/fsPolyfill/index.js +10 -25
- package/package.json +2 -2
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { type ConfigComplete } from "@utoo/pack-shared";
|
|
1
2
|
import { DepsOptions, InstallOptions, PackFile, ProjectEndpoint, Stats, UpdateMessage } from "../types";
|
|
2
3
|
export declare class ForkedProject implements ProjectEndpoint {
|
|
3
4
|
private endpoint;
|
|
4
5
|
constructor(port: MessagePort);
|
|
5
6
|
deps(options?: DepsOptions): Promise<string>;
|
|
6
7
|
install(packageLock: string, options?: InstallOptions): Promise<void>;
|
|
7
|
-
build(
|
|
8
|
-
|
|
8
|
+
build(options?: {
|
|
9
|
+
config?: ConfigComplete;
|
|
10
|
+
cleanup?: boolean;
|
|
11
|
+
}): Promise<import("..").BuildOutput>;
|
|
12
|
+
dev(options?: {
|
|
13
|
+
config?: ConfigComplete;
|
|
14
|
+
onUpdate?: (result: any) => void;
|
|
15
|
+
}): void;
|
|
9
16
|
hmrSubscribe(identifier: string, callback: (update: unknown) => void): Promise<void>;
|
|
10
17
|
updateInfoSubscribe(aggregationMs: number, callback: (message: UpdateMessage) => void): void;
|
|
11
18
|
readFile(path: string, encoding?: "utf8"): Promise<any>;
|
|
@@ -17,11 +17,11 @@ export class ForkedProject {
|
|
|
17
17
|
maxConcurrentDownloads: options === null || options === void 0 ? void 0 : options.maxConcurrentDownloads,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
async build() {
|
|
21
|
-
return await this.endpoint.build();
|
|
20
|
+
async build(options) {
|
|
21
|
+
return await this.endpoint.build(options);
|
|
22
22
|
}
|
|
23
|
-
dev(
|
|
24
|
-
this.endpoint.dev(
|
|
23
|
+
dev(options) {
|
|
24
|
+
this.endpoint.dev(options);
|
|
25
25
|
}
|
|
26
26
|
async hmrSubscribe(identifier, callback) {
|
|
27
27
|
await this.endpoint.hmrSubscribe(identifier, comlink.proxy(callback));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UpdateMessage } from "@utoo/pack-shared";
|
|
1
|
+
import { type ConfigComplete, type UpdateMessage } from "@utoo/pack-shared";
|
|
2
2
|
import { DepsOptions, InstallOptions, PackFile, ProjectEndpoint, ProjectOptions, Stats } from "../types";
|
|
3
3
|
import initWasm from "../utoo";
|
|
4
4
|
declare class InternalEndpoint implements ProjectEndpoint {
|
|
@@ -10,8 +10,14 @@ declare class InternalEndpoint implements ProjectEndpoint {
|
|
|
10
10
|
mount(opt: Omit<ProjectOptions, "workerUrl" | "serviceWorker">): Promise<void>;
|
|
11
11
|
deps(options?: DepsOptions): Promise<string>;
|
|
12
12
|
install(packageLock: string, options?: InstallOptions): Promise<void>;
|
|
13
|
-
build(
|
|
14
|
-
|
|
13
|
+
build(options?: {
|
|
14
|
+
config?: ConfigComplete;
|
|
15
|
+
cleanup?: boolean;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
dev(options?: {
|
|
18
|
+
config?: ConfigComplete;
|
|
19
|
+
onUpdate?: (result: any) => void;
|
|
20
|
+
}): Promise<void>;
|
|
15
21
|
readFile(path: string, encoding?: "utf8"): Promise<any>;
|
|
16
22
|
writeFile(path: string, content: string | Uint8Array, _encoding?: "utf8"): Promise<void>;
|
|
17
23
|
copyFile(src: string, dst: string): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import initWasm, { Fs, initLogFilter, Project as ProjectInternal, } from "../utoo";
|
|
1
|
+
import initWasm, { BuildOptions, Fs, initLogFilter, Project as ProjectInternal, } from "../utoo";
|
|
2
2
|
import { runLoaderWorkerPool } from "../webpackLoaders/loaderWorkerPool";
|
|
3
3
|
class InternalEndpoint {
|
|
4
4
|
constructor() {
|
|
@@ -37,23 +37,29 @@ class InternalEndpoint {
|
|
|
37
37
|
await ProjectInternal.install(packageLock, concurrency);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
async build() {
|
|
41
|
-
var _a, _b;
|
|
40
|
+
async build(options) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
42
|
await this.wasmInit;
|
|
43
43
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.loaderWorkerUrl) && !this.loaderWorkerPoolInitialized) {
|
|
44
44
|
runLoaderWorkerPool(this.options.cwd, this.options.loaderWorkerUrl, (_b = this.options) === null || _b === void 0 ? void 0 : _b.loadersImportMap);
|
|
45
45
|
this.loaderWorkerPoolInitialized = true;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
const buildOptions = new BuildOptions();
|
|
48
|
+
buildOptions.cleanup = (_c = options === null || options === void 0 ? void 0 : options.cleanup) !== null && _c !== void 0 ? _c : false;
|
|
49
|
+
if (options === null || options === void 0 ? void 0 : options.config) {
|
|
50
|
+
buildOptions.config = options.config;
|
|
51
|
+
}
|
|
52
|
+
return await ProjectInternal.build(buildOptions);
|
|
48
53
|
}
|
|
49
|
-
async dev(
|
|
54
|
+
async dev(options) {
|
|
50
55
|
var _a, _b;
|
|
51
56
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.loaderWorkerUrl) && !this.loaderWorkerPoolInitialized) {
|
|
52
57
|
runLoaderWorkerPool(this.options.cwd, this.options.loaderWorkerUrl, (_b = this.options) === null || _b === void 0 ? void 0 : _b.loadersImportMap);
|
|
53
58
|
this.loaderWorkerPoolInitialized = true;
|
|
54
59
|
}
|
|
55
|
-
this.rootTask = await ProjectInternal.entrypointsSubscribe((result) => {
|
|
56
|
-
|
|
60
|
+
this.rootTask = await ProjectInternal.entrypointsSubscribe(options === null || options === void 0 ? void 0 : options.config, (result) => {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = options === null || options === void 0 ? void 0 : options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, result);
|
|
57
63
|
});
|
|
58
64
|
}
|
|
59
65
|
async readFile(path, encoding) {
|
package/esm/project/Project.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UpdateMessage } from "@utoo/pack-shared";
|
|
1
|
+
import { type ConfigComplete, type UpdateMessage } from "@utoo/pack-shared";
|
|
2
2
|
import { HmrClient } from "../hmr";
|
|
3
3
|
import { BuildOutput, DepsOptions, Dirent, InstallOptions, PackFile, ProjectEndpoint, ProjectOptions, ServiceWorkerOptions, Stats } from "../types";
|
|
4
4
|
export declare class Project implements ProjectEndpoint {
|
|
@@ -15,8 +15,14 @@ export declare class Project implements ProjectEndpoint {
|
|
|
15
15
|
mount(): Promise<void>;
|
|
16
16
|
deps(options?: DepsOptions): Promise<string>;
|
|
17
17
|
install(packageLock: string, options?: InstallOptions): Promise<void>;
|
|
18
|
-
build(
|
|
19
|
-
|
|
18
|
+
build(options?: {
|
|
19
|
+
config?: ConfigComplete;
|
|
20
|
+
cleanup?: boolean;
|
|
21
|
+
}): Promise<BuildOutput>;
|
|
22
|
+
dev(options?: {
|
|
23
|
+
config?: ConfigComplete;
|
|
24
|
+
onUpdate?: (result: BuildOutput) => void;
|
|
25
|
+
}): void;
|
|
20
26
|
hmrSubscribe(identifier: string, callback: (update: unknown) => void): Promise<void>;
|
|
21
27
|
updateInfoSubscribe(aggregationMs: number, callback: (message: UpdateMessage) => void): void;
|
|
22
28
|
readFile(path: string, encoding?: "utf8"): Promise<any>;
|
package/esm/project/Project.js
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _Project_mount;
|
|
13
|
-
import { handleIssues } from "@utoo/pack-shared";
|
|
13
|
+
import { handleIssues, } from "@utoo/pack-shared";
|
|
14
14
|
import * as comlink from "comlink";
|
|
15
15
|
import { HmrServer } from "../hmr";
|
|
16
16
|
import { WorkerMessageType } from "../message";
|
|
@@ -75,13 +75,13 @@ export class Project {
|
|
|
75
75
|
await __classPrivateFieldGet(this, _Project_mount, "f");
|
|
76
76
|
return await this.remote.install(packageLock, options);
|
|
77
77
|
}
|
|
78
|
-
async build() {
|
|
78
|
+
async build(options) {
|
|
79
79
|
await __classPrivateFieldGet(this, _Project_mount, "f");
|
|
80
|
-
const res = await this.remote.build();
|
|
80
|
+
const res = await this.remote.build(options);
|
|
81
81
|
handleIssues(res.issues, false, false);
|
|
82
82
|
return res;
|
|
83
83
|
}
|
|
84
|
-
dev(
|
|
84
|
+
dev(options) {
|
|
85
85
|
// Create HmrServer lazily on first dev() call
|
|
86
86
|
if (!this.hmrServer) {
|
|
87
87
|
this.hmrServer = new HmrServer({
|
|
@@ -92,12 +92,15 @@ export class Project {
|
|
|
92
92
|
},
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
this.remote.dev(
|
|
96
|
-
?
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
this.remote.dev({
|
|
96
|
+
onUpdate: (options === null || options === void 0 ? void 0 : options.onUpdate)
|
|
97
|
+
? comlink.proxy((result) => {
|
|
98
|
+
handleIssues(result.issues, false, false);
|
|
99
|
+
options.onUpdate(result);
|
|
100
|
+
})
|
|
101
|
+
: undefined,
|
|
102
|
+
config: options === null || options === void 0 ? void 0 : options.config,
|
|
103
|
+
});
|
|
101
104
|
}
|
|
102
105
|
async hmrSubscribe(identifier, callback) {
|
|
103
106
|
await this.remote.hmrSubscribe(identifier, comlink.proxy(callback));
|
package/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Issue, type UpdateMessage } from "@utoo/pack-shared";
|
|
1
|
+
import { ConfigComplete, Issue, type UpdateMessage } from "@utoo/pack-shared";
|
|
2
2
|
import initWasm, { DirEntryType } from "./utoo";
|
|
3
3
|
export { type UpdateMessage } from "@utoo/pack-shared";
|
|
4
4
|
export interface RawDirent {
|
|
@@ -69,9 +69,15 @@ export interface InstallOptions {
|
|
|
69
69
|
export interface ProjectEndpoint {
|
|
70
70
|
deps: (options?: DepsOptions) => Promise<string>;
|
|
71
71
|
install: (packageLock: string, options?: InstallOptions) => Promise<void>;
|
|
72
|
-
build: (
|
|
72
|
+
build: (options?: {
|
|
73
|
+
config?: ConfigComplete;
|
|
74
|
+
cleanup?: boolean;
|
|
75
|
+
}) => Promise<BuildOutput>;
|
|
73
76
|
/** Start dev mode with file watching. onUpdate is called on each rebuild. */
|
|
74
|
-
dev: (
|
|
77
|
+
dev: (options?: {
|
|
78
|
+
config?: ConfigComplete;
|
|
79
|
+
onUpdate?: (result: BuildOutput) => void;
|
|
80
|
+
}) => void;
|
|
75
81
|
/**
|
|
76
82
|
* Subscribe to HMR events for a specific identifier.
|
|
77
83
|
* Returns a Promise that resolves when the subscription is set up.
|
package/esm/utoo/index.d.ts
CHANGED
|
@@ -67,6 +67,32 @@ export function wasm_thread_entry_point(ptr: number): void;
|
|
|
67
67
|
* @param {number} worker_id
|
|
68
68
|
*/
|
|
69
69
|
export function workerCreated(worker_id: number): void;
|
|
70
|
+
/**
|
|
71
|
+
* Options for the build operation, exposed to JS with auto-generated typings.
|
|
72
|
+
*/
|
|
73
|
+
export class BuildOptions {
|
|
74
|
+
__destroy_into_raw(): number;
|
|
75
|
+
__wbg_ptr: number;
|
|
76
|
+
free(): void;
|
|
77
|
+
/**
|
|
78
|
+
* @param {any} val
|
|
79
|
+
*/
|
|
80
|
+
set config(val: any);
|
|
81
|
+
/**
|
|
82
|
+
* @returns {any}
|
|
83
|
+
*/
|
|
84
|
+
get config(): any;
|
|
85
|
+
/**
|
|
86
|
+
* When true, drops the existing global project and creates a fresh instance.
|
|
87
|
+
* @param {boolean} arg0
|
|
88
|
+
*/
|
|
89
|
+
set cleanup(arg0: boolean);
|
|
90
|
+
/**
|
|
91
|
+
* When true, drops the existing global project and creates a fresh instance.
|
|
92
|
+
* @returns {boolean}
|
|
93
|
+
*/
|
|
94
|
+
get cleanup(): boolean;
|
|
95
|
+
}
|
|
70
96
|
export class CreateSyncAccessHandleOptions {
|
|
71
97
|
__destroy_into_raw(): number | undefined;
|
|
72
98
|
__wbg_ptr: number | undefined;
|
|
@@ -234,9 +260,10 @@ export class Metadata {
|
|
|
234
260
|
}
|
|
235
261
|
export class Project {
|
|
236
262
|
/**
|
|
263
|
+
* @param {BuildOptions} options
|
|
237
264
|
* @returns {Promise<any>}
|
|
238
265
|
*/
|
|
239
|
-
static build(): Promise<any>;
|
|
266
|
+
static build(options: BuildOptions): Promise<any>;
|
|
240
267
|
/**
|
|
241
268
|
* @returns {string}
|
|
242
269
|
*/
|
|
@@ -252,10 +279,11 @@ export class Project {
|
|
|
252
279
|
* Subscribe to entrypoints changes with HMR support.
|
|
253
280
|
* This will watch for file changes and automatically rebuild.
|
|
254
281
|
* Returns a RootTask that must be held by JS to keep the subscription active.
|
|
282
|
+
* @param {any} config
|
|
255
283
|
* @param {Function} callback
|
|
256
284
|
* @returns {Promise<RootTask>}
|
|
257
285
|
*/
|
|
258
|
-
static entrypointsSubscribe(callback: Function): Promise<RootTask>;
|
|
286
|
+
static entrypointsSubscribe(config: any, callback: Function): Promise<RootTask>;
|
|
259
287
|
/**
|
|
260
288
|
* Create a tar.gz archive and return bytes (no file I/O)
|
|
261
289
|
* @param {any} files
|
package/esm/utoo/index.js
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
/* @ts-self-types="./index.d.ts" */
|
|
2
|
+
/**
|
|
3
|
+
* Options for the build operation, exposed to JS with auto-generated typings.
|
|
4
|
+
*/
|
|
5
|
+
export class BuildOptions {
|
|
6
|
+
__destroy_into_raw() {
|
|
7
|
+
const ptr = this.__wbg_ptr;
|
|
8
|
+
this.__wbg_ptr = 0;
|
|
9
|
+
BuildOptionsFinalization.unregister(this);
|
|
10
|
+
return ptr;
|
|
11
|
+
}
|
|
12
|
+
free() {
|
|
13
|
+
const ptr = this.__destroy_into_raw();
|
|
14
|
+
wasm.__wbg_buildoptions_free(ptr, 0);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @returns {any}
|
|
18
|
+
*/
|
|
19
|
+
get config() {
|
|
20
|
+
const ret = wasm.buildoptions_config(this.__wbg_ptr);
|
|
21
|
+
return takeObject(ret);
|
|
22
|
+
}
|
|
23
|
+
constructor() {
|
|
24
|
+
const ret = wasm.buildoptions_new();
|
|
25
|
+
this.__wbg_ptr = ret >>> 0;
|
|
26
|
+
BuildOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param {any} val
|
|
31
|
+
*/
|
|
32
|
+
set config(val) {
|
|
33
|
+
wasm.buildoptions_set_config(this.__wbg_ptr, addHeapObject(val));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* When true, drops the existing global project and creates a fresh instance.
|
|
37
|
+
* @returns {boolean}
|
|
38
|
+
*/
|
|
39
|
+
get cleanup() {
|
|
40
|
+
const ret = wasm.__wbg_get_buildoptions_cleanup(this.__wbg_ptr);
|
|
41
|
+
return ret !== 0;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* When true, drops the existing global project and creates a fresh instance.
|
|
45
|
+
* @param {boolean} arg0
|
|
46
|
+
*/
|
|
47
|
+
set cleanup(arg0) {
|
|
48
|
+
wasm.__wbg_set_buildoptions_cleanup(this.__wbg_ptr, arg0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (Symbol.dispose)
|
|
52
|
+
BuildOptions.prototype[Symbol.dispose] = BuildOptions.prototype.free;
|
|
2
53
|
export class CreateSyncAccessHandleOptions {
|
|
3
54
|
__destroy_into_raw() {
|
|
4
55
|
const ptr = this.__wbg_ptr;
|
|
@@ -632,10 +683,13 @@ export class Project {
|
|
|
632
683
|
wasm.__wbg_project_free(ptr, 0);
|
|
633
684
|
}
|
|
634
685
|
/**
|
|
686
|
+
* @param {BuildOptions} options
|
|
635
687
|
* @returns {Promise<any>}
|
|
636
688
|
*/
|
|
637
|
-
static build() {
|
|
638
|
-
|
|
689
|
+
static build(options) {
|
|
690
|
+
_assertClass(options, BuildOptions);
|
|
691
|
+
var ptr0 = options.__destroy_into_raw();
|
|
692
|
+
const ret = wasm.project_build(ptr0);
|
|
639
693
|
return takeObject(ret);
|
|
640
694
|
}
|
|
641
695
|
/**
|
|
@@ -674,11 +728,12 @@ export class Project {
|
|
|
674
728
|
* Subscribe to entrypoints changes with HMR support.
|
|
675
729
|
* This will watch for file changes and automatically rebuild.
|
|
676
730
|
* Returns a RootTask that must be held by JS to keep the subscription active.
|
|
731
|
+
* @param {any} config
|
|
677
732
|
* @param {Function} callback
|
|
678
733
|
* @returns {Promise<RootTask>}
|
|
679
734
|
*/
|
|
680
|
-
static entrypointsSubscribe(callback) {
|
|
681
|
-
const ret = wasm.project_entrypointsSubscribe(addHeapObject(callback));
|
|
735
|
+
static entrypointsSubscribe(config, callback) {
|
|
736
|
+
const ret = wasm.project_entrypointsSubscribe(addHeapObject(config), addHeapObject(callback));
|
|
682
737
|
return takeObject(ret);
|
|
683
738
|
}
|
|
684
739
|
/**
|
|
@@ -1066,6 +1121,10 @@ function __wbg_get_imports(memory) {
|
|
|
1066
1121
|
const ret = typeof (getObject(arg0)) === 'function';
|
|
1067
1122
|
return ret;
|
|
1068
1123
|
},
|
|
1124
|
+
__wbg___wbindgen_is_null_ac34f5003991759a: function (arg0) {
|
|
1125
|
+
const ret = getObject(arg0) === null;
|
|
1126
|
+
return ret;
|
|
1127
|
+
},
|
|
1069
1128
|
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function (arg0) {
|
|
1070
1129
|
const val = getObject(arg0);
|
|
1071
1130
|
const ret = typeof (val) === 'object' && val !== null;
|
|
@@ -1421,7 +1480,7 @@ function __wbg_get_imports(memory) {
|
|
|
1421
1480
|
const a = state0.a;
|
|
1422
1481
|
state0.a = 0;
|
|
1423
1482
|
try {
|
|
1424
|
-
return
|
|
1483
|
+
return __wasm_bindgen_func_elem_3879(a, state0.b, arg0, arg1);
|
|
1425
1484
|
}
|
|
1426
1485
|
finally {
|
|
1427
1486
|
state0.a = a;
|
|
@@ -1748,33 +1807,33 @@ function __wbg_get_imports(memory) {
|
|
|
1748
1807
|
}, arguments);
|
|
1749
1808
|
},
|
|
1750
1809
|
__wbindgen_cast_0000000000000001: function (arg0, arg1) {
|
|
1751
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1752
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1810
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1458, function: Function { arguments: [Externref], shim_idx: 5646, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1811
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_21941, __wasm_bindgen_func_elem_80607);
|
|
1753
1812
|
return addHeapObject(ret);
|
|
1754
1813
|
},
|
|
1755
1814
|
__wbindgen_cast_0000000000000002: function (arg0, arg1) {
|
|
1756
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1757
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
1815
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1458, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 5628, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
1816
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_21941, __wasm_bindgen_func_elem_80437);
|
|
1758
1817
|
return addHeapObject(ret);
|
|
1759
1818
|
},
|
|
1760
1819
|
__wbindgen_cast_0000000000000003: function (arg0, arg1) {
|
|
1761
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1762
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1820
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1458, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 5646, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1821
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_21941, __wasm_bindgen_func_elem_80607);
|
|
1763
1822
|
return addHeapObject(ret);
|
|
1764
1823
|
},
|
|
1765
1824
|
__wbindgen_cast_0000000000000004: function (arg0, arg1) {
|
|
1766
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1767
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1825
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1458, function: Function { arguments: [Ref(NamedExternref("MessageEvent"))], shim_idx: 5649, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1826
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_21941, __wasm_bindgen_func_elem_80643);
|
|
1768
1827
|
return addHeapObject(ret);
|
|
1769
1828
|
},
|
|
1770
1829
|
__wbindgen_cast_0000000000000005: function (arg0, arg1) {
|
|
1771
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1772
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1830
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1458, function: Function { arguments: [], shim_idx: 1459, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1831
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_21941, __wasm_bindgen_func_elem_21942);
|
|
1773
1832
|
return addHeapObject(ret);
|
|
1774
1833
|
},
|
|
1775
1834
|
__wbindgen_cast_0000000000000006: function (arg0, arg1) {
|
|
1776
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1777
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1835
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 5652, function: Function { arguments: [], shim_idx: 1459, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1836
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_80663, __wasm_bindgen_func_elem_21942);
|
|
1778
1837
|
return addHeapObject(ret);
|
|
1779
1838
|
},
|
|
1780
1839
|
__wbindgen_cast_0000000000000007: function (arg0) {
|
|
@@ -1822,25 +1881,25 @@ function __wbg_get_imports(memory) {
|
|
|
1822
1881
|
"./index_bg.js": import0,
|
|
1823
1882
|
};
|
|
1824
1883
|
}
|
|
1825
|
-
function
|
|
1826
|
-
wasm.
|
|
1884
|
+
function __wasm_bindgen_func_elem_21942(arg0, arg1) {
|
|
1885
|
+
wasm.__wasm_bindgen_func_elem_21942(arg0, arg1);
|
|
1827
1886
|
}
|
|
1828
|
-
function
|
|
1829
|
-
wasm.
|
|
1887
|
+
function __wasm_bindgen_func_elem_80607(arg0, arg1, arg2) {
|
|
1888
|
+
wasm.__wasm_bindgen_func_elem_80607(arg0, arg1, addHeapObject(arg2));
|
|
1830
1889
|
}
|
|
1831
|
-
function
|
|
1832
|
-
wasm.
|
|
1890
|
+
function __wasm_bindgen_func_elem_80437(arg0, arg1, arg2) {
|
|
1891
|
+
wasm.__wasm_bindgen_func_elem_80437(arg0, arg1, addHeapObject(arg2));
|
|
1833
1892
|
}
|
|
1834
|
-
function
|
|
1893
|
+
function __wasm_bindgen_func_elem_80643(arg0, arg1, arg2) {
|
|
1835
1894
|
try {
|
|
1836
|
-
wasm.
|
|
1895
|
+
wasm.__wasm_bindgen_func_elem_80643(arg0, arg1, addBorrowedObject(arg2));
|
|
1837
1896
|
}
|
|
1838
1897
|
finally {
|
|
1839
1898
|
heap[stack_pointer++] = undefined;
|
|
1840
1899
|
}
|
|
1841
1900
|
}
|
|
1842
|
-
function
|
|
1843
|
-
wasm.
|
|
1901
|
+
function __wasm_bindgen_func_elem_3879(arg0, arg1, arg2, arg3) {
|
|
1902
|
+
wasm.__wasm_bindgen_func_elem_3879(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
1844
1903
|
}
|
|
1845
1904
|
const __wbindgen_enum_DirEntryType = ["file", "directory"];
|
|
1846
1905
|
const __wbindgen_enum_FileSystemChangeRecordType = ["appeared", "disappeared", "errored", "modified", "moved", "unknown"];
|
|
@@ -1849,6 +1908,9 @@ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache
|
|
|
1849
1908
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
1850
1909
|
const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
1851
1910
|
const __wbindgen_enum_WorkerType = ["classic", "module"];
|
|
1911
|
+
const BuildOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1912
|
+
? { register: () => { }, unregister: () => { } }
|
|
1913
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_buildoptions_free(ptr >>> 0, 1));
|
|
1852
1914
|
const CreateSyncAccessHandleOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1853
1915
|
? { register: () => { }, unregister: () => { } }
|
|
1854
1916
|
: new FinalizationRegistry(ptr => wasm.__wbg_createsyncaccesshandleoptions_free(ptr >>> 0, 1));
|
package/esm/utoo/index_bg.wasm
CHANGED
|
Binary file
|
|
@@ -44,7 +44,9 @@ const executeModule = (moduleCode, moduleId, id, importMaps, entrypoint) => {
|
|
|
44
44
|
const moduleRequire = (childId) => loadModule(childId, context, importMaps, entrypoint);
|
|
45
45
|
moduleRequire.resolve = (request) => request;
|
|
46
46
|
const module = { exports: finalExports, require: moduleRequire };
|
|
47
|
-
if (moduleId.includes("node_modules")
|
|
47
|
+
if (moduleId.includes("node_modules") ||
|
|
48
|
+
id in importMaps ||
|
|
49
|
+
moduleId in importMaps) {
|
|
48
50
|
installedModules[moduleId] = module;
|
|
49
51
|
}
|
|
50
52
|
if (moduleId === entrypoint) {
|
|
@@ -93,6 +95,15 @@ const loadModule = (id, context, importMaps, entrypoint) => {
|
|
|
93
95
|
const cachedId = resolutionCache[cacheKey];
|
|
94
96
|
if (installedModules[cachedId])
|
|
95
97
|
return installedModules[cachedId].exports;
|
|
98
|
+
const sysCached = System.get(cachedId) || (id !== cachedId && System.get(id));
|
|
99
|
+
if (sysCached)
|
|
100
|
+
return sysCached.default;
|
|
101
|
+
// importMaps takes priority over cached FS path
|
|
102
|
+
const importMapCode = importMaps[cachedId] || importMaps[id];
|
|
103
|
+
if (importMapCode) {
|
|
104
|
+
const mid = importMaps[cachedId] ? cachedId : id;
|
|
105
|
+
return executeModule(importMapCode, mid, id, importMaps, entrypoint);
|
|
106
|
+
}
|
|
96
107
|
const code = tryReadFile(cachedId);
|
|
97
108
|
if (code !== null) {
|
|
98
109
|
return executeModule(code, cachedId, id, importMaps, entrypoint);
|
|
@@ -211,11 +211,7 @@ export function readFile(path, options, cb) {
|
|
|
211
211
|
const promise = encoding
|
|
212
212
|
? fs.readToString(resolvedPath)
|
|
213
213
|
: fs.read(resolvedPath);
|
|
214
|
-
promise
|
|
215
|
-
.then((data) => {
|
|
216
|
-
cb(null, encoding ? data : Buffer.from(data));
|
|
217
|
-
})
|
|
218
|
-
.catch((e) => cb(translateError(e, path, "open")));
|
|
214
|
+
promise.then((data) => cb(null, encoding ? data : Buffer.from(data)), (e) => cb(translateError(e, path, "open")));
|
|
219
215
|
}
|
|
220
216
|
export function readdir(path, options, cb) {
|
|
221
217
|
if (typeof options === "function") {
|
|
@@ -238,8 +234,7 @@ export function readdir(path, options, cb) {
|
|
|
238
234
|
return json.name;
|
|
239
235
|
});
|
|
240
236
|
cb(null, result);
|
|
241
|
-
})
|
|
242
|
-
.catch((e) => cb(translateError(e, path, "scandir")));
|
|
237
|
+
}, (e) => cb(translateError(e, path, "scandir")));
|
|
243
238
|
}
|
|
244
239
|
export function writeFile(path, data, options, cb) {
|
|
245
240
|
if (typeof options === "function") {
|
|
@@ -251,9 +246,7 @@ export function writeFile(path, data, options, cb) {
|
|
|
251
246
|
const promise = typeof data === "string"
|
|
252
247
|
? fs.writeString(resolvedPath, data)
|
|
253
248
|
: fs.write(resolvedPath, data);
|
|
254
|
-
promise
|
|
255
|
-
.then(() => cb(null))
|
|
256
|
-
.catch((e) => cb(translateError(e, path, "open")));
|
|
249
|
+
promise.then(() => cb(null), (e) => cb(translateError(e, path, "open")));
|
|
257
250
|
}
|
|
258
251
|
export function mkdir(path, options, cb) {
|
|
259
252
|
if (typeof options === "function") {
|
|
@@ -265,9 +258,7 @@ export function mkdir(path, options, cb) {
|
|
|
265
258
|
const promise = (options === null || options === void 0 ? void 0 : options.recursive)
|
|
266
259
|
? fs.createDirAll(resolvedPath)
|
|
267
260
|
: fs.createDir(resolvedPath);
|
|
268
|
-
promise
|
|
269
|
-
.then(() => cb(null))
|
|
270
|
-
.catch((e) => cb(translateError(e, path, "mkdir")));
|
|
261
|
+
promise.then(() => cb(null), (e) => cb(translateError(e, path, "mkdir")));
|
|
271
262
|
}
|
|
272
263
|
export function rm(path, options, cb) {
|
|
273
264
|
if (typeof options === "function") {
|
|
@@ -286,8 +277,7 @@ export function rm(path, options, cb) {
|
|
|
286
277
|
return fs.removeDir(resolvedPath, !!(options === null || options === void 0 ? void 0 : options.recursive));
|
|
287
278
|
}
|
|
288
279
|
})
|
|
289
|
-
.then(() => cb(null))
|
|
290
|
-
.catch((e) => cb(translateError(e, path, "rm")));
|
|
280
|
+
.then(() => cb(null), (e) => cb(translateError(e, path, "rm")));
|
|
291
281
|
}
|
|
292
282
|
export function rmdir(path, options, cb) {
|
|
293
283
|
if (typeof options === "function") {
|
|
@@ -296,14 +286,12 @@ export function rmdir(path, options, cb) {
|
|
|
296
286
|
}
|
|
297
287
|
getFs()
|
|
298
288
|
.removeDir(resolvePath(path), !!(options === null || options === void 0 ? void 0 : options.recursive))
|
|
299
|
-
.then(() => cb(null))
|
|
300
|
-
.catch((e) => cb(translateError(e, path, "rmdir")));
|
|
289
|
+
.then(() => cb(null), (e) => cb(translateError(e, path, "rmdir")));
|
|
301
290
|
}
|
|
302
291
|
export function copyFile(src, dst, cb) {
|
|
303
292
|
getFs()
|
|
304
293
|
.copyFile(resolvePath(src), resolvePath(dst))
|
|
305
|
-
.then(() => cb(null))
|
|
306
|
-
.catch((e) => cb(translateError(e, src, "copyfile")));
|
|
294
|
+
.then(() => cb(null), (e) => cb(translateError(e, src, "copyfile")));
|
|
307
295
|
}
|
|
308
296
|
export function stat(p, cb) {
|
|
309
297
|
getFs()
|
|
@@ -314,8 +302,7 @@ export function stat(p, cb) {
|
|
|
314
302
|
type: json.type,
|
|
315
303
|
size: Number(json.file_size || 0),
|
|
316
304
|
}));
|
|
317
|
-
})
|
|
318
|
-
.catch((e) => cb(translateError(e, p, "stat")));
|
|
305
|
+
}, (e) => cb(translateError(e, p, "stat")));
|
|
319
306
|
}
|
|
320
307
|
export function lstat(p, cb) {
|
|
321
308
|
getFs()
|
|
@@ -326,8 +313,7 @@ export function lstat(p, cb) {
|
|
|
326
313
|
type: json.type,
|
|
327
314
|
size: Number(json.file_size || 0),
|
|
328
315
|
}));
|
|
329
|
-
})
|
|
330
|
-
.catch((e) => cb(translateError(e, p, "lstat")));
|
|
316
|
+
}, (e) => cb(translateError(e, p, "lstat")));
|
|
331
317
|
}
|
|
332
318
|
export function realpath(p, cb) {
|
|
333
319
|
cb(null, p);
|
|
@@ -342,8 +328,7 @@ export function access(p, mode, cb) {
|
|
|
342
328
|
.then(() => {
|
|
343
329
|
if (cb)
|
|
344
330
|
cb(null);
|
|
345
|
-
})
|
|
346
|
-
.catch((e) => {
|
|
331
|
+
}, (e) => {
|
|
347
332
|
if (cb)
|
|
348
333
|
cb(translateError(e, p, "access"));
|
|
349
334
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"module": "esm/index.js",
|
|
5
5
|
"types": "esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"prepublishOnly": "turbo run build --filter=@utoo/web"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@utoo/pack-shared": "1.
|
|
29
|
+
"@utoo/pack-shared": "1.3.1",
|
|
30
30
|
"comlink": "^4.4.2",
|
|
31
31
|
"systemjs": "^6.15.1"
|
|
32
32
|
},
|