@scriptc/compiler 0.0.5 → 0.0.7
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/backend/emission/emit-exprs.js +25 -2
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-walkers.js +47 -0
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.js +7 -0
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/emission/may-throw.js +12 -0
- package/dist/backend/emission/may-throw.js.map +1 -1
- package/dist/backend/llvm/dyn.js +23 -1
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +28 -4
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +5 -0
- package/dist/backend/llvm/walkers.js +65 -5
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -0
- package/dist/diagnostics/diagnostic.js +16 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lib-contract.d.ts +96 -0
- package/dist/frontend/lib-contract.js +291 -0
- package/dist/frontend/lib-contract.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.js +41 -1
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +19 -4
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +7 -0
- package/dist/frontend/lowering/lower-inspect.js +130 -28
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +9 -1
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +1 -1
- package/dist/frontend/lowering/lowerer.js +16 -6
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/types.d.ts +68 -6
- package/dist/frontend/types.js +285 -57
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +60 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +27 -4
- package/dist/ir/nodes.js +105 -13
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +10 -0
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/profile.d.ts +36 -0
- package/dist/library/profile.js +105 -3
- package/dist/library/profile.js.map +1 -1
- package/dist/library/sidecar-validate.d.ts +4 -0
- package/dist/library/sidecar-validate.js +506 -0
- package/dist/library/sidecar-validate.js.map +1 -0
- package/dist/library/sidecar.d.ts +191 -0
- package/dist/library/sidecar.js +568 -0
- package/dist/library/sidecar.js.map +1 -0
- package/dist/library/wyhash.d.ts +12 -0
- package/dist/library/wyhash.js +116 -0
- package/dist/library/wyhash.js.map +1 -0
- package/package.json +2 -2
- package/surface-manifest.json +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { type ScrDiagnostic } from "../diagnostics/diagnostic.js";
|
|
2
|
+
import type { ContractFacts } from "../frontend/lib-contract.js";
|
|
3
|
+
import type { LibraryProfile } from "./profile.js";
|
|
4
|
+
/** The sidecar schema's format this emitter writes. */
|
|
5
|
+
export declare const SIDECAR_FORMAT = 1;
|
|
6
|
+
export type TypeRef = {
|
|
7
|
+
kind: "bool";
|
|
8
|
+
} | {
|
|
9
|
+
kind: "f64";
|
|
10
|
+
} | {
|
|
11
|
+
kind: "i64";
|
|
12
|
+
} | {
|
|
13
|
+
kind: "bytes";
|
|
14
|
+
} | {
|
|
15
|
+
kind: "void";
|
|
16
|
+
} | {
|
|
17
|
+
kind: "optional";
|
|
18
|
+
inner: TypeRef;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "slice";
|
|
21
|
+
elem: TypeRef;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "node";
|
|
24
|
+
name: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "value";
|
|
27
|
+
name: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "enum";
|
|
30
|
+
name: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "union";
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
export type PayloadDescriptor = {
|
|
36
|
+
kind: "void";
|
|
37
|
+
} | {
|
|
38
|
+
kind: "bytes";
|
|
39
|
+
} | {
|
|
40
|
+
kind: "number";
|
|
41
|
+
class: "f64" | "i64";
|
|
42
|
+
} | {
|
|
43
|
+
kind: "number_bytes";
|
|
44
|
+
number_field: string;
|
|
45
|
+
number_class: "f64" | "i64";
|
|
46
|
+
bytes_field: string;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "record";
|
|
49
|
+
name: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "union";
|
|
52
|
+
name: string;
|
|
53
|
+
} | {
|
|
54
|
+
kind: "enum";
|
|
55
|
+
name: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: "scalar";
|
|
58
|
+
type: TypeRef;
|
|
59
|
+
};
|
|
60
|
+
export interface SidecarStruct {
|
|
61
|
+
name: string;
|
|
62
|
+
synthesized?: true;
|
|
63
|
+
fields: {
|
|
64
|
+
name: string;
|
|
65
|
+
type: TypeRef;
|
|
66
|
+
}[];
|
|
67
|
+
}
|
|
68
|
+
export interface SidecarEnum {
|
|
69
|
+
name: string;
|
|
70
|
+
members: string[];
|
|
71
|
+
}
|
|
72
|
+
export interface SidecarUnion {
|
|
73
|
+
name: string;
|
|
74
|
+
arms: {
|
|
75
|
+
name: string;
|
|
76
|
+
payload: TypeRef;
|
|
77
|
+
}[];
|
|
78
|
+
}
|
|
79
|
+
export interface SidecarHelper {
|
|
80
|
+
name: string;
|
|
81
|
+
params: TypeRef[];
|
|
82
|
+
returns: TypeRef;
|
|
83
|
+
arena: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** The whole document, property-ordered exactly as §1 lists the fields
|
|
86
|
+
* (JSON.stringify preserves insertion order — the construction order IS
|
|
87
|
+
* the serialization order). */
|
|
88
|
+
export interface SidecarDoc {
|
|
89
|
+
format: number;
|
|
90
|
+
wire_version: number;
|
|
91
|
+
abi_version: number;
|
|
92
|
+
compiler_version: string;
|
|
93
|
+
entry: string;
|
|
94
|
+
source_hash: string;
|
|
95
|
+
build_id: string;
|
|
96
|
+
types: {
|
|
97
|
+
structs: SidecarStruct[];
|
|
98
|
+
enums: SidecarEnum[];
|
|
99
|
+
unions: SidecarUnion[];
|
|
100
|
+
};
|
|
101
|
+
model: string;
|
|
102
|
+
model_helpers: SidecarHelper[];
|
|
103
|
+
model_unbound: string[];
|
|
104
|
+
msg: {
|
|
105
|
+
name: string;
|
|
106
|
+
arms: {
|
|
107
|
+
name: string;
|
|
108
|
+
payload: PayloadDescriptor;
|
|
109
|
+
}[];
|
|
110
|
+
unbound: string[];
|
|
111
|
+
};
|
|
112
|
+
init_returns_cmd: boolean;
|
|
113
|
+
update_returns_cmd: boolean;
|
|
114
|
+
has_subscriptions: boolean;
|
|
115
|
+
channels: {
|
|
116
|
+
command_msg: boolean;
|
|
117
|
+
frame_msg: boolean;
|
|
118
|
+
key_msg: boolean;
|
|
119
|
+
pinch_msg: boolean;
|
|
120
|
+
appearance_msg: string | null;
|
|
121
|
+
chrome_msg: string | null;
|
|
122
|
+
env_msgs: {
|
|
123
|
+
env: string;
|
|
124
|
+
msg: string;
|
|
125
|
+
}[];
|
|
126
|
+
};
|
|
127
|
+
abi: {
|
|
128
|
+
prefix: string;
|
|
129
|
+
exports: string[];
|
|
130
|
+
snapshot_format: number;
|
|
131
|
+
};
|
|
132
|
+
integer_slots: {
|
|
133
|
+
slot: string;
|
|
134
|
+
class: "i64";
|
|
135
|
+
}[];
|
|
136
|
+
deterministic: boolean;
|
|
137
|
+
async_free: boolean;
|
|
138
|
+
}
|
|
139
|
+
/** The compiler's exact release identifier — the published package
|
|
140
|
+
* version, read once from the compiler package's own package.json (this
|
|
141
|
+
* module lives two levels below the package root in src/ and dist/
|
|
142
|
+
* alike). build_id input 1 and the sidecar's `compiler_version`. */
|
|
143
|
+
export declare function compilerReleaseVersion(): string;
|
|
144
|
+
/** One path under the sidecar's canonical rules: compilation-root-relative
|
|
145
|
+
* POSIX, or `profile:`-namespaced when the file sits outside the root
|
|
146
|
+
* (never absolute, no `.`/`..` segments). */
|
|
147
|
+
export declare function canonicalPath(rootDir: string, file: string): string;
|
|
148
|
+
export interface CanonicalModule {
|
|
149
|
+
/** Compilation-root-relative POSIX path (or `profile:`-namespaced when
|
|
150
|
+
* outside the root), never absolute, no `.`/`..` segments. */
|
|
151
|
+
canonical: string;
|
|
152
|
+
bytes: Uint8Array;
|
|
153
|
+
}
|
|
154
|
+
/** Canonicalize + sort the module graph for hashing: root-relative POSIX
|
|
155
|
+
* paths, ascending by plain bytewise comparison of the path strings. A
|
|
156
|
+
* module outside the compilation root (the profile file's directory)
|
|
157
|
+
* cannot spell a canonical relative path, so it rides the `profile:`
|
|
158
|
+
* namespace under its basename — deterministic and absolute-path-free. */
|
|
159
|
+
export declare function canonicalModuleGraph(rootDir: string, sources: ReadonlyMap<string, string>): CanonicalModule[];
|
|
160
|
+
/** build_id (schema §2: compiler version, profile bytes, sorted module
|
|
161
|
+
* graph — every input length-prefixed) and source_hash (the
|
|
162
|
+
* "module-graph" contract: the sorted module graph alone, so the value is
|
|
163
|
+
* stable across compiler releases). Both 16 lowercase hex digits. */
|
|
164
|
+
export declare function libraryIdentityHashes(compilerVersion: string, profileBytes: Uint8Array, modules: readonly CanonicalModule[]): {
|
|
165
|
+
buildId: string;
|
|
166
|
+
sourceHash: string;
|
|
167
|
+
};
|
|
168
|
+
/** The profile's canonical `abi.exports` suffix order: the identity
|
|
169
|
+
* getters first (abi_version, then build_id), the mode-provided entries
|
|
170
|
+
* (sink registration, init, collect, reset — declared ones only), then
|
|
171
|
+
* the export map in profile order. Suffix = symbol minus prefix. */
|
|
172
|
+
export declare function abiExportSuffixes(profile: LibraryProfile): string[];
|
|
173
|
+
export interface SidecarBuildInput {
|
|
174
|
+
profile: LibraryProfile;
|
|
175
|
+
facts: ContractFacts;
|
|
176
|
+
compilerVersion: string;
|
|
177
|
+
/** Entry module path, compilation-root-relative, POSIX separators. */
|
|
178
|
+
entry: string;
|
|
179
|
+
buildId: string;
|
|
180
|
+
sourceHash: string;
|
|
181
|
+
deterministic: boolean;
|
|
182
|
+
}
|
|
183
|
+
export type SidecarBuildResult = {
|
|
184
|
+
ok: true;
|
|
185
|
+
doc: SidecarDoc;
|
|
186
|
+
json: string;
|
|
187
|
+
} | {
|
|
188
|
+
ok: false;
|
|
189
|
+
diagnostics: ScrDiagnostic[];
|
|
190
|
+
};
|
|
191
|
+
export declare function buildSidecar(input: SidecarBuildInput): SidecarBuildResult;
|