@utoo/web 0.0.1-alpha.27 → 0.0.1-alpha.29
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 +1 -1
- package/esm/project.d.ts +2 -2
- package/esm/project.js +4 -1
- package/esm/serviceWorker.js +1 -1
- package/esm/type.d.ts +5 -1
- package/esm/utoo/index.d.ts +33 -33
- package/esm/utoo/index.js +454 -424
- package/esm/utoo/index_bg.wasm +0 -0
- package/package.json +4 -2
package/esm/forkedProject.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare class ForkedProject implements ProjectEndpoint {
|
|
|
3
3
|
private endpoint;
|
|
4
4
|
constructor(port: MessagePort);
|
|
5
5
|
install(packageLock: string): Promise<void>;
|
|
6
|
-
build(): Promise<
|
|
6
|
+
build(): Promise<import("./type").BuildOutput>;
|
|
7
7
|
readFile(path: string, encoding?: "utf8"): Promise<any>;
|
|
8
8
|
writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
|
|
9
9
|
copyFile(src: string, dst: string): Promise<void>;
|
package/esm/project.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dirent, ProjectEndpoint, ProjectOptions } from "./type";
|
|
1
|
+
import { BuildOutput, Dirent, ProjectEndpoint, ProjectOptions } from "./type";
|
|
2
2
|
export declare class Project implements ProjectEndpoint {
|
|
3
3
|
#private;
|
|
4
4
|
private serviceWorkerOptions?;
|
|
@@ -8,7 +8,7 @@ export declare class Project implements ProjectEndpoint {
|
|
|
8
8
|
installServiceWorker(): Promise<void>;
|
|
9
9
|
mount(): Promise<void>;
|
|
10
10
|
install(packageLock: string): Promise<void>;
|
|
11
|
-
build(): Promise<
|
|
11
|
+
build(): Promise<BuildOutput>;
|
|
12
12
|
readFile(path: string, encoding?: "utf8"): Promise<any>;
|
|
13
13
|
writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
|
|
14
14
|
copyFile(src: string, dst: string): Promise<void>;
|
package/esm/project.js
CHANGED
|
@@ -10,6 +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
14
|
import * as comlink from "comlink";
|
|
14
15
|
import { ForkedProject } from "./forkedProject";
|
|
15
16
|
import { installServiceWorker } from "./installServiceWorker";
|
|
@@ -67,7 +68,9 @@ export class Project {
|
|
|
67
68
|
}
|
|
68
69
|
async build() {
|
|
69
70
|
await __classPrivateFieldGet(this, _Project_mount, "f");
|
|
70
|
-
|
|
71
|
+
const res = await this.remote.build();
|
|
72
|
+
handleIssues(res.issues, false);
|
|
73
|
+
return res;
|
|
71
74
|
}
|
|
72
75
|
async readFile(path, encoding) {
|
|
73
76
|
await __classPrivateFieldGet(this, _Project_mount, "f");
|
package/esm/serviceWorker.js
CHANGED
|
@@ -14,10 +14,10 @@ self.addEventListener("message", (event) => {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
self.addEventListener("fetch", async (event) => {
|
|
17
|
+
await _promise;
|
|
17
18
|
const { url, referrer } = event.request;
|
|
18
19
|
if (new URL(url).pathname.startsWith(_serviceWorkerScope) ||
|
|
19
20
|
(referrer && new URL(referrer).pathname.startsWith(_serviceWorkerScope))) {
|
|
20
|
-
await _promise;
|
|
21
21
|
const projectPath = "." + new URL(url).pathname.replace(_serviceWorkerScope, "");
|
|
22
22
|
event.respondWith(readFileFromProject(projectPath));
|
|
23
23
|
}
|
package/esm/type.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Issue } from "@utoo/pack-shared";
|
|
1
2
|
import { DirEntryType } from "./utoo";
|
|
2
3
|
export interface RawDirent {
|
|
3
4
|
name: string;
|
|
@@ -10,9 +11,12 @@ export declare class Dirent {
|
|
|
10
11
|
isDirectory(): boolean;
|
|
11
12
|
isFile(): boolean;
|
|
12
13
|
}
|
|
14
|
+
export interface BuildOutput {
|
|
15
|
+
issues: Issue[];
|
|
16
|
+
}
|
|
13
17
|
export interface ProjectEndpoint {
|
|
14
18
|
install: (packageLock: string) => Promise<void>;
|
|
15
|
-
build: () => Promise<
|
|
19
|
+
build: () => Promise<BuildOutput>;
|
|
16
20
|
readFile(path: string): Promise<Uint8Array>;
|
|
17
21
|
readFile(path: string, encoding?: "utf8"): Promise<string>;
|
|
18
22
|
writeFile(path: string, content: string | Uint8Array, encoding?: "utf8"): Promise<void>;
|
package/esm/utoo/index.d.ts
CHANGED
|
@@ -54,35 +54,22 @@ export class Project {
|
|
|
54
54
|
__destroy_into_raw(): number;
|
|
55
55
|
__wbg_ptr: number;
|
|
56
56
|
free(): void;
|
|
57
|
-
/**
|
|
58
|
-
* @returns {string}
|
|
59
|
-
*/
|
|
60
|
-
get cwd(): string;
|
|
61
|
-
/**
|
|
62
|
-
* @param {string} package_lock
|
|
63
|
-
* @returns {Promise<void>}
|
|
64
|
-
*/
|
|
65
|
-
install(package_lock: string): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* @returns {Promise<any>}
|
|
68
|
-
*/
|
|
69
|
-
build(): Promise<any>;
|
|
70
57
|
/**
|
|
71
58
|
* @param {string} path
|
|
72
|
-
* @returns {Promise<
|
|
59
|
+
* @returns {Promise<void>}
|
|
73
60
|
*/
|
|
74
|
-
|
|
61
|
+
createDir(path: string): Promise<void>;
|
|
75
62
|
/**
|
|
76
63
|
* @param {string} path
|
|
77
|
-
* @
|
|
64
|
+
* @param {boolean} recursive
|
|
65
|
+
* @returns {Promise<void>}
|
|
78
66
|
*/
|
|
79
|
-
|
|
67
|
+
removeDir(path: string, recursive: boolean): Promise<void>;
|
|
80
68
|
/**
|
|
81
69
|
* @param {string} path
|
|
82
|
-
* @param {Uint8Array} content
|
|
83
70
|
* @returns {Promise<void>}
|
|
84
71
|
*/
|
|
85
|
-
|
|
72
|
+
removeFile(path: string): Promise<void>;
|
|
86
73
|
/**
|
|
87
74
|
* @param {string} path
|
|
88
75
|
* @param {string} content
|
|
@@ -91,41 +78,54 @@ export class Project {
|
|
|
91
78
|
writeString(path: string, content: string): Promise<void>;
|
|
92
79
|
/**
|
|
93
80
|
* @param {string} path
|
|
94
|
-
* @returns {Promise<
|
|
81
|
+
* @returns {Promise<void>}
|
|
95
82
|
*/
|
|
96
|
-
|
|
83
|
+
createDirAll(path: string): Promise<void>;
|
|
97
84
|
/**
|
|
98
85
|
* @param {string} path
|
|
99
|
-
* @returns {Promise<
|
|
86
|
+
* @returns {Promise<string>}
|
|
100
87
|
*/
|
|
101
|
-
|
|
88
|
+
readToString(path: string): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
get cwd(): string;
|
|
102
93
|
/**
|
|
103
94
|
* @param {string} path
|
|
104
|
-
* @returns {Promise<
|
|
95
|
+
* @returns {Promise<Uint8Array>}
|
|
105
96
|
*/
|
|
106
|
-
|
|
97
|
+
read(path: string): Promise<Uint8Array>;
|
|
107
98
|
/**
|
|
108
|
-
* @
|
|
109
|
-
* @param {string} dst
|
|
110
|
-
* @returns {Promise<void>}
|
|
99
|
+
* @returns {Promise<any>}
|
|
111
100
|
*/
|
|
112
|
-
|
|
101
|
+
build(): Promise<any>;
|
|
113
102
|
/**
|
|
114
103
|
* @param {string} path
|
|
104
|
+
* @param {Uint8Array} content
|
|
115
105
|
* @returns {Promise<void>}
|
|
116
106
|
*/
|
|
117
|
-
|
|
107
|
+
write(path: string, content: Uint8Array): Promise<void>;
|
|
118
108
|
/**
|
|
119
|
-
* @param {string}
|
|
120
|
-
* @param {boolean} recursive
|
|
109
|
+
* @param {string} package_lock
|
|
121
110
|
* @returns {Promise<void>}
|
|
122
111
|
*/
|
|
123
|
-
|
|
112
|
+
install(package_lock: string): Promise<void>;
|
|
124
113
|
/**
|
|
125
114
|
* @param {string} path
|
|
126
115
|
* @returns {Promise<Metadata>}
|
|
127
116
|
*/
|
|
128
117
|
metadata(path: string): Promise<Metadata>;
|
|
118
|
+
/**
|
|
119
|
+
* @param {string} path
|
|
120
|
+
* @returns {Promise<DirEntry[]>}
|
|
121
|
+
*/
|
|
122
|
+
readDir(path: string): Promise<DirEntry[]>;
|
|
123
|
+
/**
|
|
124
|
+
* @param {string} src
|
|
125
|
+
* @param {string} dst
|
|
126
|
+
* @returns {Promise<void>}
|
|
127
|
+
*/
|
|
128
|
+
copyFile(src: string, dst: string): Promise<void>;
|
|
129
129
|
}
|
|
130
130
|
export default __wbg_init;
|
|
131
131
|
export function initSync(module: any, memory: any): any;
|