@utoo/web 0.0.1-alpha.9 → 1.0.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/esm/forkedProject.d.ts +24 -0
- package/esm/forkedProject.js +40 -0
- package/esm/index.d.ts +1 -21
- package/esm/index.js +1 -102
- package/esm/installServiceWorker.d.ts +1 -0
- package/esm/installServiceWorker.js +36 -0
- package/esm/message.d.ts +1 -0
- package/esm/message.js +1 -0
- package/esm/project.d.ts +30 -0
- package/esm/project.js +120 -0
- package/esm/serviceWorker.d.ts +1 -0
- package/esm/serviceWorker.js +62 -0
- package/esm/threadWorker.d.ts +1 -0
- package/esm/threadWorker.js +10 -0
- package/esm/type.d.ts +29 -3
- package/esm/utoo/index.d.ts +58 -19
- package/esm/utoo/index.js +635 -363
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/worker.d.ts +1 -4
- package/esm/worker.js +43 -5
- package/package.json +13 -8
package/esm/utoo/index_bg.wasm
CHANGED
|
Binary file
|
package/esm/worker.d.ts
CHANGED
package/esm/worker.js
CHANGED
|
@@ -6,14 +6,27 @@ const projectEndpoint = {
|
|
|
6
6
|
wasmInit: undefined,
|
|
7
7
|
// This should be called only once
|
|
8
8
|
async mount(opt) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
const { cwd, wasmUrl, threadWorkerUrl, logFilter } = opt;
|
|
11
|
+
// Set global log filter before wasm init
|
|
12
|
+
if (logFilter) {
|
|
13
|
+
globalThis.__UTOO_LOG_FILTER__ = logFilter;
|
|
14
|
+
}
|
|
15
|
+
(_a = this.wasmInit) !== null && _a !== void 0 ? _a : (this.wasmInit = initWasm(wasmUrl));
|
|
16
|
+
await this.wasmInit;
|
|
17
|
+
// Pass logFilter to thread worker via URL query string
|
|
18
|
+
let finalThreadWorkerUrl = threadWorkerUrl;
|
|
19
|
+
if (logFilter) {
|
|
20
|
+
const url = new URL(threadWorkerUrl, self.location.href);
|
|
21
|
+
url.searchParams.set("logFilter", logFilter);
|
|
22
|
+
finalThreadWorkerUrl = url.toString();
|
|
23
|
+
}
|
|
24
|
+
this.projectInternal = new ProjectInternal(cwd, finalThreadWorkerUrl);
|
|
12
25
|
return;
|
|
13
26
|
},
|
|
14
|
-
async install(packageLock) {
|
|
27
|
+
async install(packageLock, maxConcurrentDownloads) {
|
|
15
28
|
await this.wasmInit;
|
|
16
|
-
await this.projectInternal.install(packageLock);
|
|
29
|
+
await this.projectInternal.install(packageLock, maxConcurrentDownloads);
|
|
17
30
|
return;
|
|
18
31
|
},
|
|
19
32
|
async build() {
|
|
@@ -69,6 +82,31 @@ const projectEndpoint = {
|
|
|
69
82
|
return await this.projectInternal.createDir(path);
|
|
70
83
|
}
|
|
71
84
|
},
|
|
85
|
+
async rm(path, options) {
|
|
86
|
+
await this.wasmInit;
|
|
87
|
+
let metadata = (await this.projectInternal.metadata(path)).toJSON();
|
|
88
|
+
switch (metadata.type) {
|
|
89
|
+
case "file":
|
|
90
|
+
return await this.projectInternal.removeFile(path);
|
|
91
|
+
case "directory":
|
|
92
|
+
return await this.projectInternal.removeDir(path, !!(options === null || options === void 0 ? void 0 : options.recursive));
|
|
93
|
+
default:
|
|
94
|
+
// nothing to remove now
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
async rmdir(path, options) {
|
|
99
|
+
await this.wasmInit;
|
|
100
|
+
return await this.projectInternal.removeDir(path, !!(options === null || options === void 0 ? void 0 : options.recursive));
|
|
101
|
+
},
|
|
102
|
+
async gzip(files) {
|
|
103
|
+
await this.wasmInit;
|
|
104
|
+
return await this.projectInternal.gzip(files);
|
|
105
|
+
},
|
|
106
|
+
async sigMd5(content) {
|
|
107
|
+
await this.wasmInit;
|
|
108
|
+
return await this.projectInternal.sigMd5(content);
|
|
109
|
+
},
|
|
72
110
|
};
|
|
73
111
|
const ConnectedPorts = new Set();
|
|
74
112
|
self.addEventListener("message", (e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/web",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"module": "esm/index.js",
|
|
5
5
|
"types": "esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -11,15 +11,20 @@
|
|
|
11
11
|
"build-wasm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown -Z build-std=panic_abort,std",
|
|
12
12
|
"build-wasm:pm": "cargo build -p utoo-wasm --target wasm32-unknown-unknown --no-default-features -Z build-std=panic_abort,std",
|
|
13
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/
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
14
|
+
"bindgen-build": "wasm-bindgen ../../target/wasm32-unknown-unknown/release/utoo_wasm.wasm --out-dir src/utoo --out-name index --target web",
|
|
15
|
+
"bindgen-build:local": "wasm-bindgen ../../target/wasm32-unknown-unknown/release-local/utoo_wasm.wasm --out-dir src/utoo --out-name index --target web",
|
|
16
|
+
"pretsc": "npm run build --workspace @utoo/pack-shared",
|
|
17
|
+
"tsc": "rm -rf esm && tsc -p ./tsconfig.json",
|
|
18
|
+
"dev": "npm run build-wasm -- --profile wasm-dev && npm run bindgen-dev && npm run tsc && cp src/utoo/index_bg.wasm esm/utoo",
|
|
19
|
+
"dev:pm": "npm run build-wasm:pm -- --profile wasm-dev && npm run bindgen-dev && npm run tsc && cp src/utoo/index_bg.wasm esm/utoo",
|
|
20
|
+
"wasm-opt": "wasm-opt src/utoo/index_bg.wasm -o esm/utoo/index_bg.wasm --enable-threads --enable-bulk-memory --enable-nontrapping-float-to-int -Oz",
|
|
21
|
+
"build": "npm run build-wasm -- --release && npm run bindgen-build && npm run tsc && npm run wasm-opt",
|
|
22
|
+
"build:local": "npm run build-wasm -- --profile release-local && npm run bindgen-build:local && npm run tsc && cp src/utoo/index_bg.wasm esm/utoo",
|
|
19
23
|
"prepublishOnly": "npm run build"
|
|
20
24
|
},
|
|
21
25
|
"dependencies": {
|
|
22
|
-
"comlink": "^4.4.2"
|
|
26
|
+
"comlink": "^4.4.2",
|
|
27
|
+
"@utoo/pack-shared": "^0.0.7"
|
|
23
28
|
},
|
|
24
29
|
"devDependencies": {
|
|
25
30
|
"typescript": "^5.8.3"
|
|
@@ -29,5 +34,5 @@
|
|
|
29
34
|
},
|
|
30
35
|
"author": "xusd320",
|
|
31
36
|
"license": "MIT",
|
|
32
|
-
"repository": "git@github.com:
|
|
37
|
+
"repository": "git@github.com:utooland/utoo.git"
|
|
33
38
|
}
|