@uione/compiler 0.4.1 → 0.5.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/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/one.wasm +0 -0
- package/dist/project.d.ts +22 -0
- package/dist/project.js +7 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Built, Checked, Files, Shown } from "./project.js";
|
|
2
|
-
export type { Built, Checked, Files, GeneratedFile, Problem, Shown, ShownFile, Source } from "./project.js";
|
|
2
|
+
export type { Built, Checked, Files, GeneratedFile, Outline, OutlinedEnvironment, OutlinedSetting, Problem, Shown, ShownFile, Source } from "./project.js";
|
|
3
3
|
export interface Compiler {
|
|
4
4
|
version(): Promise<string>;
|
|
5
5
|
check(files: Files): Promise<Checked>;
|
|
6
|
-
build(files: Files): Promise<Built>;
|
|
6
|
+
build(files: Files, environment?: string): Promise<Built>;
|
|
7
7
|
show(files: Files, path: string, from: number, to?: number): Promise<Shown>;
|
|
8
8
|
stop(): void;
|
|
9
9
|
}
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ export function createCompiler(port = new Worker(new URL("./worker.js", import.m
|
|
|
22
22
|
return {
|
|
23
23
|
version: () => ask({ kind: "version" }),
|
|
24
24
|
check: (files) => ask({ kind: "check", files }),
|
|
25
|
-
build: (files) => ask({ kind: "build", files }),
|
|
25
|
+
build: (files, environment) => ask({ kind: "build", files, ...(environment === undefined ? {} : { environment }) }),
|
|
26
26
|
show: (files, path, from, to) => ask({ kind: "show", files, path, from, ...(to === undefined ? {} : { to }) }),
|
|
27
27
|
stop: () => {
|
|
28
28
|
port.terminate?.();
|
package/dist/one.wasm
CHANGED
|
Binary file
|
package/dist/project.d.ts
CHANGED
|
@@ -15,14 +15,35 @@ export interface GeneratedFile {
|
|
|
15
15
|
executable: boolean;
|
|
16
16
|
sources: Source[];
|
|
17
17
|
}
|
|
18
|
+
export interface OutlinedSetting {
|
|
19
|
+
key: string;
|
|
20
|
+
value: string;
|
|
21
|
+
line: number;
|
|
22
|
+
}
|
|
23
|
+
export interface OutlinedEnvironment {
|
|
24
|
+
name: string;
|
|
25
|
+
line: number;
|
|
26
|
+
end: number;
|
|
27
|
+
settings: OutlinedSetting[];
|
|
28
|
+
}
|
|
29
|
+
export interface Outline {
|
|
30
|
+
path: string;
|
|
31
|
+
name: string;
|
|
32
|
+
line: number;
|
|
33
|
+
end: number;
|
|
34
|
+
settings: OutlinedSetting[];
|
|
35
|
+
environments: OutlinedEnvironment[];
|
|
36
|
+
}
|
|
18
37
|
export interface Checked {
|
|
19
38
|
problems: Problem[];
|
|
20
39
|
files: number;
|
|
40
|
+
project: Outline | null;
|
|
21
41
|
}
|
|
22
42
|
export interface Built {
|
|
23
43
|
problems: Problem[];
|
|
24
44
|
refusal: string;
|
|
25
45
|
note: string;
|
|
46
|
+
environment: string;
|
|
26
47
|
files: GeneratedFile[];
|
|
27
48
|
}
|
|
28
49
|
export interface ShownFile {
|
|
@@ -41,6 +62,7 @@ export type Request = {
|
|
|
41
62
|
} | {
|
|
42
63
|
kind: "build";
|
|
43
64
|
files: Files;
|
|
65
|
+
environment?: string;
|
|
44
66
|
} | {
|
|
45
67
|
kind: "show";
|
|
46
68
|
files: Files;
|
package/dist/project.js
CHANGED
|
@@ -6,10 +6,14 @@ export function run(one, request) {
|
|
|
6
6
|
return one.ccall("one_version", "string", [], []);
|
|
7
7
|
place(one, request.files);
|
|
8
8
|
const call = (name, ...args) => JSON.parse(one.ccall(name, "string", args.map(() => "string"), args));
|
|
9
|
-
if (request.kind === "check")
|
|
10
|
-
|
|
9
|
+
if (request.kind === "check") {
|
|
10
|
+
const checked = within(call("one_check", project));
|
|
11
|
+
if (checked.project)
|
|
12
|
+
checked.project.path = inside(checked.project.path);
|
|
13
|
+
return checked;
|
|
14
|
+
}
|
|
11
15
|
if (request.kind === "build") {
|
|
12
|
-
const built = within(call("one_build", project, `${project}/build
|
|
16
|
+
const built = within(call("one_build", project, `${project}/build`, request.environment ?? ""));
|
|
13
17
|
for (const file of built.files) {
|
|
14
18
|
file.sources = file.sources.map((s) => (s && s !== "same" ? { path: inside(s.path), line: s.line } : s));
|
|
15
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uione/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The uione compiler, built for the browser and run in a Web Worker: check a project, build it, and see what each line becomes.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"author": "Daher Alfawares",
|