@utoo/web 0.0.1 → 1.0.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/forkedProject.d.ts +24 -0
- package/esm/forkedProject.js +40 -0
- package/esm/index.d.ts +1 -17
- package/esm/index.js +1 -104
- package/esm/installServiceWorker.d.ts +1 -0
- package/esm/installServiceWorker.js +36 -0
- package/esm/internalProject.d.ts +29 -0
- package/esm/internalProject.js +184 -0
- package/esm/message.d.ts +1 -0
- package/esm/message.js +1 -0
- package/esm/project.d.ts +31 -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 +4 -0
- package/esm/type.d.ts +53 -8
- package/esm/type.js +12 -1
- package/esm/utoo/index.d.ts +156 -20
- package/esm/utoo/index.js +1079 -242
- package/esm/utoo/index_bg.wasm +0 -0
- package/esm/webpackLoaders/loaders/lessLoader/index.d.ts +3 -0
- package/esm/webpackLoaders/loaders/lessLoader/index.js +103 -0
- package/esm/webpackLoaders/loaders/lessLoader/options.json +67 -0
- package/esm/webpackLoaders/loaders/lessLoader/utils.d.ts +14 -0
- package/esm/webpackLoaders/loaders/lessLoader/utils.js +217 -0
- package/esm/webpackLoaders/worker/cjs.d.ts +2 -0
- package/esm/webpackLoaders/worker/cjs.js +77 -0
- package/esm/webpackLoaders/worker/index.d.ts +2 -0
- package/esm/webpackLoaders/worker/index.js +31 -0
- package/esm/webpackLoaders/worker/nodePolyFills.d.ts +14 -0
- package/esm/webpackLoaders/worker/nodePolyFills.js +24 -0
- package/esm/webpackLoaders/worker/type.d.ts +11 -0
- package/esm/webpackLoaders/worker/type.js +1 -0
- package/esm/webpackLoaders/workerContent.d.ts +2 -0
- package/esm/webpackLoaders/workerContent.js +1 -0
- package/esm/worker.js +2 -33
- package/package.json +29 -8
package/esm/type.d.ts
CHANGED
|
@@ -1,11 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Issue } from "@utoo/pack-shared";
|
|
2
|
+
import initWasm, { DirEntryType } from "./utoo";
|
|
3
|
+
export interface RawDirent {
|
|
4
|
+
name: string;
|
|
5
|
+
type: DirEntryType;
|
|
6
|
+
}
|
|
7
|
+
export declare class Dirent {
|
|
8
|
+
private rawDirent;
|
|
9
|
+
name: string;
|
|
10
|
+
constructor(rawDirent: RawDirent);
|
|
11
|
+
isDirectory(): boolean;
|
|
12
|
+
isFile(): boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface BuildOutput {
|
|
15
|
+
issues: Issue[];
|
|
16
|
+
}
|
|
17
|
+
export interface PackFile {
|
|
18
|
+
path: string;
|
|
19
|
+
content: Uint8Array;
|
|
20
|
+
}
|
|
2
21
|
export interface ProjectEndpoint {
|
|
3
|
-
install: (packageLock: string) => Promise<void>;
|
|
4
|
-
build: () => Promise<
|
|
5
|
-
readFile(path: string): Promise<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
install: (packageLock: string, maxConcurrentDownloads?: number) => Promise<void>;
|
|
23
|
+
build: () => Promise<BuildOutput>;
|
|
24
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
25
|
+
readFile(path: string, encoding?: "utf8"): Promise<string>;
|
|
26
|
+
writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
|
|
27
|
+
readdir(path: string, options?: {
|
|
28
|
+
recursive?: boolean;
|
|
29
|
+
}): Promise<Dirent[]>;
|
|
30
|
+
mkdir(path: string, options?: {
|
|
31
|
+
recursive?: boolean;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
rm(path: string, options?: {
|
|
34
|
+
recursive?: boolean;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
rmdir(path: string, options?: {
|
|
37
|
+
recursive?: boolean;
|
|
38
|
+
}): Promise<void>;
|
|
10
39
|
copyFile(src: string, dst: string): Promise<void>;
|
|
40
|
+
gzip: (files: PackFile[]) => Promise<Uint8Array>;
|
|
41
|
+
sigMd5: (content: Uint8Array) => Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
export interface ProjectOptions {
|
|
44
|
+
cwd: string;
|
|
45
|
+
workerUrl: string;
|
|
46
|
+
threadWorkerUrl: string;
|
|
47
|
+
wasmUrl?: string;
|
|
48
|
+
serviceWorker?: ServiceWorkerOptions;
|
|
49
|
+
logFilter?: string;
|
|
50
|
+
loadersImportMap?: Record<string, string>;
|
|
51
|
+
}
|
|
52
|
+
export interface ServiceWorkerOptions {
|
|
53
|
+
url: string;
|
|
54
|
+
scope: string;
|
|
11
55
|
}
|
|
56
|
+
export type Binding = Awaited<ReturnType<typeof initWasm>>;
|
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,14 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns {Promise<WorkerTermination>}
|
|
3
|
+
*/
|
|
4
|
+
export function recvWorkerTermination(): Promise<WorkerTermination>;
|
|
5
|
+
/**
|
|
6
|
+
* @param {number} task_id
|
|
7
|
+
* @param {number} worker_id
|
|
8
|
+
* @returns {Promise<void>}
|
|
9
|
+
*/
|
|
10
|
+
export function notifyWorkerAck(task_id: number, worker_id: number): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* @param {number} task_id
|
|
13
|
+
* @param {string} message
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
16
|
+
export function sendTaskMessage(task_id: number, message: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* @param {number} worker_id
|
|
19
|
+
* @returns {Promise<string>}
|
|
20
|
+
*/
|
|
21
|
+
export function recvMessageInWorker(worker_id: number): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} pool_id
|
|
24
|
+
* @returns {Promise<number>}
|
|
25
|
+
*/
|
|
26
|
+
export function recvWorkerRequest(pool_id: string): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* @returns {Promise<PoolOptions>}
|
|
29
|
+
*/
|
|
30
|
+
export function recvPoolRequest(): Promise<PoolOptions>;
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} filter
|
|
33
|
+
*/
|
|
34
|
+
export function init_log_filter(filter: string): void;
|
|
35
|
+
export function init_pack(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Entry point for web workers
|
|
38
|
+
* @param {number} ptr
|
|
39
|
+
*/
|
|
40
|
+
export function wasm_thread_entry_point(ptr: number): void;
|
|
1
41
|
export class CreateSyncAccessHandleOptions {
|
|
2
42
|
static __wrap(ptr: any): any;
|
|
3
43
|
__destroy_into_raw(): number | undefined;
|
|
4
44
|
__wbg_ptr: number | undefined;
|
|
5
45
|
free(): void;
|
|
6
46
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Directory entry with name and type information
|
|
9
|
-
*/
|
|
10
47
|
export class DirEntry {
|
|
11
48
|
static __wrap(ptr: any): any;
|
|
49
|
+
toJSON(): {
|
|
50
|
+
name: string;
|
|
51
|
+
type: DirEntryType;
|
|
52
|
+
};
|
|
53
|
+
toString(): string;
|
|
12
54
|
__destroy_into_raw(): number | undefined;
|
|
13
55
|
__wbg_ptr: number | undefined;
|
|
14
56
|
free(): void;
|
|
@@ -29,53 +71,125 @@ export class DirEntry {
|
|
|
29
71
|
*/
|
|
30
72
|
get type(): DirEntryType;
|
|
31
73
|
}
|
|
74
|
+
export class Metadata {
|
|
75
|
+
static __wrap(ptr: any): any;
|
|
76
|
+
toJSON(): {};
|
|
77
|
+
toString(): string;
|
|
78
|
+
__destroy_into_raw(): number | undefined;
|
|
79
|
+
__wbg_ptr: number | undefined;
|
|
80
|
+
free(): void;
|
|
81
|
+
}
|
|
82
|
+
export class PoolOptions {
|
|
83
|
+
static __wrap(ptr: any): any;
|
|
84
|
+
__destroy_into_raw(): number | undefined;
|
|
85
|
+
__wbg_ptr: number | undefined;
|
|
86
|
+
free(): void;
|
|
87
|
+
/**
|
|
88
|
+
* @param {string} arg0
|
|
89
|
+
*/
|
|
90
|
+
set filename(arg0: string);
|
|
91
|
+
/**
|
|
92
|
+
* @returns {string}
|
|
93
|
+
*/
|
|
94
|
+
get filename(): string;
|
|
95
|
+
/**
|
|
96
|
+
* @param {number} arg0
|
|
97
|
+
*/
|
|
98
|
+
set maxConcurrency(arg0: number);
|
|
99
|
+
/**
|
|
100
|
+
* @returns {number}
|
|
101
|
+
*/
|
|
102
|
+
get maxConcurrency(): number;
|
|
103
|
+
}
|
|
32
104
|
export class Project {
|
|
33
105
|
/**
|
|
34
106
|
* @param {string} cwd
|
|
107
|
+
* @param {string} thread_url
|
|
35
108
|
*/
|
|
36
|
-
constructor(cwd: string);
|
|
109
|
+
constructor(cwd: string, thread_url: string);
|
|
37
110
|
__destroy_into_raw(): number;
|
|
38
111
|
__wbg_ptr: number;
|
|
39
112
|
free(): void;
|
|
40
113
|
/**
|
|
41
|
-
* @
|
|
114
|
+
* @param {string} path
|
|
115
|
+
* @returns {Promise<void>}
|
|
42
116
|
*/
|
|
43
|
-
|
|
117
|
+
createDir(path: string): Promise<void>;
|
|
44
118
|
/**
|
|
45
|
-
* @param {string}
|
|
119
|
+
* @param {string} path
|
|
120
|
+
* @param {boolean} recursive
|
|
46
121
|
* @returns {Promise<void>}
|
|
47
122
|
*/
|
|
48
|
-
|
|
123
|
+
removeDir(path: string, recursive: boolean): Promise<void>;
|
|
49
124
|
/**
|
|
125
|
+
* @param {string} path
|
|
50
126
|
* @returns {Promise<void>}
|
|
51
127
|
*/
|
|
52
|
-
|
|
128
|
+
removeFile(path: string): Promise<void>;
|
|
53
129
|
/**
|
|
54
130
|
* @param {string} path
|
|
55
|
-
* @
|
|
131
|
+
* @param {string} content
|
|
132
|
+
* @returns {Promise<void>}
|
|
56
133
|
*/
|
|
57
|
-
|
|
134
|
+
writeString(path: string, content: string): Promise<void>;
|
|
58
135
|
/**
|
|
59
136
|
* @param {string} path
|
|
60
|
-
* @param {string} content
|
|
61
137
|
* @returns {Promise<void>}
|
|
62
138
|
*/
|
|
63
|
-
|
|
139
|
+
createDirAll(path: string): Promise<void>;
|
|
64
140
|
/**
|
|
65
141
|
* @param {string} path
|
|
66
|
-
* @returns {Promise<
|
|
142
|
+
* @returns {Promise<string>}
|
|
67
143
|
*/
|
|
68
|
-
|
|
144
|
+
readToString(path: string): Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
get cwd(): string;
|
|
149
|
+
/**
|
|
150
|
+
* Create a tar.gz archive and return bytes (no file I/O)
|
|
151
|
+
* This is useful for main thread execution without OPFS access
|
|
152
|
+
* @param {any} files
|
|
153
|
+
* @returns {Uint8Array}
|
|
154
|
+
*/
|
|
155
|
+
gzip(files: any): Uint8Array;
|
|
69
156
|
/**
|
|
70
157
|
* @param {string} path
|
|
71
|
-
* @returns {Promise<
|
|
158
|
+
* @returns {Promise<Uint8Array>}
|
|
72
159
|
*/
|
|
73
|
-
|
|
160
|
+
read(path: string): Promise<Uint8Array>;
|
|
161
|
+
/**
|
|
162
|
+
* @returns {Promise<any>}
|
|
163
|
+
*/
|
|
164
|
+
build(): Promise<any>;
|
|
74
165
|
/**
|
|
75
166
|
* @param {string} path
|
|
167
|
+
* @param {Uint8Array} content
|
|
76
168
|
* @returns {Promise<void>}
|
|
77
169
|
*/
|
|
78
|
-
|
|
170
|
+
write(path: string, content: Uint8Array): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* @param {string} package_lock
|
|
173
|
+
* @param {number | null} [max_concurrent_downloads]
|
|
174
|
+
* @returns {Promise<void>}
|
|
175
|
+
*/
|
|
176
|
+
install(package_lock: string, max_concurrent_downloads?: number | null): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Calculate MD5 hash of byte content
|
|
179
|
+
* @param {Uint8Array} content
|
|
180
|
+
* @returns {string}
|
|
181
|
+
*/
|
|
182
|
+
sigMd5(content: Uint8Array): string;
|
|
183
|
+
/**
|
|
184
|
+
* @param {string} path
|
|
185
|
+
* @returns {Promise<Metadata>}
|
|
186
|
+
*/
|
|
187
|
+
metadata(path: string): Promise<Metadata>;
|
|
188
|
+
/**
|
|
189
|
+
* @param {string} path
|
|
190
|
+
* @returns {Promise<DirEntry[]>}
|
|
191
|
+
*/
|
|
192
|
+
readDir(path: string): Promise<DirEntry[]>;
|
|
79
193
|
/**
|
|
80
194
|
* @param {string} src
|
|
81
195
|
* @param {string} dst
|
|
@@ -83,6 +197,28 @@ export class Project {
|
|
|
83
197
|
*/
|
|
84
198
|
copyFile(src: string, dst: string): Promise<void>;
|
|
85
199
|
}
|
|
200
|
+
export class WorkerTermination {
|
|
201
|
+
static __wrap(ptr: any): any;
|
|
202
|
+
__destroy_into_raw(): number | undefined;
|
|
203
|
+
__wbg_ptr: number | undefined;
|
|
204
|
+
free(): void;
|
|
205
|
+
/**
|
|
206
|
+
* @param {string} arg0
|
|
207
|
+
*/
|
|
208
|
+
set filename(arg0: string);
|
|
209
|
+
/**
|
|
210
|
+
* @returns {string}
|
|
211
|
+
*/
|
|
212
|
+
get filename(): string;
|
|
213
|
+
/**
|
|
214
|
+
* @param {number} arg0
|
|
215
|
+
*/
|
|
216
|
+
set workerId(arg0: number);
|
|
217
|
+
/**
|
|
218
|
+
* @returns {number}
|
|
219
|
+
*/
|
|
220
|
+
get workerId(): number;
|
|
221
|
+
}
|
|
86
222
|
export default __wbg_init;
|
|
87
|
-
export function initSync(module: any): any;
|
|
88
|
-
declare function __wbg_init(module_or_path: any): Promise<any>;
|
|
223
|
+
export function initSync(module: any, memory: any): any;
|
|
224
|
+
declare function __wbg_init(module_or_path: any, memory: any): Promise<any>;
|