@scriptc/compiler 0.0.22 → 0.0.24
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/ambient/scriptc-node-fallback.d.ts +139 -14
- package/dist/backend/cc.d.ts +13 -0
- package/dist/backend/cc.js +11 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-async.d.ts +4 -0
- package/dist/backend/emission/emit-async.js +34 -2
- package/dist/backend/emission/emit-async.js.map +1 -1
- package/dist/backend/emission/emit-exprs.d.ts +10 -0
- package/dist/backend/emission/emit-exprs.js +272 -22
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-shapes.js +1 -0
- package/dist/backend/emission/emit-shapes.js.map +1 -1
- package/dist/backend/emission/emit-stmts.js +36 -9
- package/dist/backend/emission/emit-stmts.js.map +1 -1
- package/dist/backend/emission/emit-types.js +14 -1
- package/dist/backend/emission/emit-types.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +19 -1
- package/dist/backend/emission/emitter.js +81 -2
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.js +578 -36
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/shapes.js +12 -3
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/mangle.d.ts +3 -0
- package/dist/backend/mangle.js +5 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +10 -0
- package/dist/compat/fetch-profile.js +55 -6
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/surface-manifest.js +16 -1
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +10 -0
- package/dist/diagnostics/diagnostic.js +27 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +17 -16
- package/dist/frontend/lowering/lower-builtins.js +817 -117
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +3 -1
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +28 -8
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +2 -1
- package/dist/frontend/lowering/lower-containers.js +99 -32
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +1 -1
- package/dist/frontend/lowering/lower-exprs.js +78 -6
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +7 -1
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +59 -1
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +21 -0
- package/dist/frontend/lowering/lower-island.js +284 -10
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +5 -0
- package/dist/frontend/lowering/lower-server.js +1 -1
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +6 -2
- package/dist/frontend/lowering/lower-stmts.js +53 -14
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +3 -2
- package/dist/frontend/lowering/lowerer.js +17 -8
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +108 -25
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/program.d.ts +4 -4
- package/dist/frontend/program.js +264 -46
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +10 -0
- package/dist/frontend/resolve.js +37 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/ts7/enums.d.ts +9 -0
- package/dist/frontend/ts7/enums.js +8 -6
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/program.js +4 -1
- package/dist/frontend/ts7/program.js.map +1 -1
- package/dist/frontend/types.d.ts +7 -4
- package/dist/frontend/types.js +103 -8
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +23 -0
- package/dist/ir/integer-loops.js +82 -0
- package/dist/ir/integer-loops.js.map +1 -0
- package/dist/ir/nodes.d.ts +104 -28
- package/dist/ir/nodes.js +89 -1
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +136 -25
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/fence-eval.js +4 -3
- package/dist/library/fence-eval.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +186 -29
|
@@ -205,12 +205,18 @@ declare var process: {
|
|
|
205
205
|
/* The raw byte writes — no newline, no formatting. stdout shares
|
|
206
206
|
* console.log's stream, each call is submitted promptly, and ordering is
|
|
207
207
|
* preserved. The boolean is Node's backpressure signal — these synchronous
|
|
208
|
-
* writes always return true.
|
|
209
|
-
*
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
* writes always return true. Static BufferEncoding arguments and the
|
|
209
|
+
* completion callback overloads match Node's WritableStream surface. */
|
|
210
|
+
stdout: {
|
|
211
|
+
write(data: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
|
|
212
|
+
write(data: string | Uint8Array, encoding: BufferEncoding, callback?: (error?: Error | null) => void): boolean;
|
|
213
|
+
readonly isTTY: boolean;
|
|
214
|
+
};
|
|
215
|
+
stderr: {
|
|
216
|
+
write(data: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
|
|
217
|
+
write(data: string | Uint8Array, encoding: BufferEncoding, callback?: (error?: Error | null) => void): boolean;
|
|
218
|
+
readonly isTTY: boolean;
|
|
219
|
+
};
|
|
214
220
|
/* The stdin stream, the piped-input slice: the TTY probe, the
|
|
215
221
|
* data/end/error events (on and once — a 'data' listener keeps the
|
|
216
222
|
* event loop alive until EOF, like Node's flowing stdin), destroy()
|
|
@@ -475,8 +481,8 @@ declare var Buffer: BufferConstructor;
|
|
|
475
481
|
|
|
476
482
|
/* The WHATWG encoders (Node globals). The COMPOSED forms lower —
|
|
477
483
|
* `new TextEncoder().encode(s)` and `new TextDecoder().decode(bytes)` —
|
|
478
|
-
* as do same-scope const store-then-call forms.
|
|
479
|
-
*
|
|
484
|
+
* as do same-scope const store-then-call forms. Recognized literal WHATWG
|
|
485
|
+
* labels compile statically; runtime-valued/unknown labels and the
|
|
480
486
|
* fatal/ignoreBOM options fence at the use site). */
|
|
481
487
|
interface TextEncoder {
|
|
482
488
|
encode(input?: string): Uint8Array;
|
|
@@ -485,7 +491,7 @@ declare var TextEncoder: { new (): TextEncoder };
|
|
|
485
491
|
interface TextDecoder {
|
|
486
492
|
decode(input?: ArrayBufferView | ArrayBuffer): string;
|
|
487
493
|
}
|
|
488
|
-
declare var TextDecoder: { new (label?:
|
|
494
|
+
declare var TextDecoder: { new (label?: string): TextDecoder };
|
|
489
495
|
|
|
490
496
|
/* The WHATWG event surface (Node globals since v15): declared so the
|
|
491
497
|
* suite's event-plumbing tests typecheck and fence per SITE with the
|
|
@@ -688,6 +694,36 @@ interface Response {
|
|
|
688
694
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
689
695
|
bytes(): Promise<Uint8Array>;
|
|
690
696
|
}
|
|
697
|
+
interface ResponseInit {
|
|
698
|
+
headers?:
|
|
699
|
+
| Headers
|
|
700
|
+
| Record<string, string>
|
|
701
|
+
| readonly (readonly [string, string])[];
|
|
702
|
+
status?: number;
|
|
703
|
+
statusText?: string;
|
|
704
|
+
}
|
|
705
|
+
declare var Response: {
|
|
706
|
+
new (
|
|
707
|
+
body?: string | Uint8Array | ReadableStream<Uint8Array> | null,
|
|
708
|
+
init?: ResponseInit,
|
|
709
|
+
): Response;
|
|
710
|
+
readonly prototype: Response;
|
|
711
|
+
error(): Response;
|
|
712
|
+
json(data: unknown, init?: ResponseInit): Response;
|
|
713
|
+
redirect(url: string | URL, status?: number): Response;
|
|
714
|
+
};
|
|
715
|
+
interface Request {
|
|
716
|
+
readonly method: string;
|
|
717
|
+
readonly url: string;
|
|
718
|
+
readonly headers: Headers;
|
|
719
|
+
readonly signal: AbortSignal;
|
|
720
|
+
readonly body: ReadableStream<Uint8Array> | null;
|
|
721
|
+
readonly bodyUsed: boolean;
|
|
722
|
+
json(): Promise<unknown>;
|
|
723
|
+
text(): Promise<string>;
|
|
724
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
725
|
+
bytes(): Promise<Uint8Array>;
|
|
726
|
+
}
|
|
691
727
|
interface RequestInit {
|
|
692
728
|
method?: string;
|
|
693
729
|
headers?:
|
|
@@ -699,6 +735,10 @@ interface RequestInit {
|
|
|
699
735
|
redirect?: "follow" | "error" | "manual";
|
|
700
736
|
signal?: AbortSignal;
|
|
701
737
|
}
|
|
738
|
+
declare var Request: {
|
|
739
|
+
new (input: string | URL | Request, init?: RequestInit): Request;
|
|
740
|
+
readonly prototype: Request;
|
|
741
|
+
};
|
|
702
742
|
declare function fetch(input: string | URL, init?: RequestInit): Promise<Response>;
|
|
703
743
|
|
|
704
744
|
/* The repeating timer pair (setTimeout lives in scriptc.d.ts — always
|
|
@@ -941,6 +981,8 @@ declare module "node:fs" {
|
|
|
941
981
|
/* The 2-argument form only (Node's mode flags have no lowering). The
|
|
942
982
|
* destination is created or truncated carrying the SOURCE's mode. */
|
|
943
983
|
export function copyFileSync(src: string, dest: string): void;
|
|
984
|
+
export function rename(oldPath: string, newPath: string, callback: (err: NodeJS.ErrnoException | null) => void): void;
|
|
985
|
+
export function renameSync(oldPath: string, newPath: string): void;
|
|
944
986
|
export function rmSync(path: string): void;
|
|
945
987
|
/* maxRetries/retryDelay are accepted no-ops (Node retries around
|
|
946
988
|
* EBUSY-class races; the synchronous lowering has no re-entrancy that
|
|
@@ -976,12 +1018,16 @@ declare module "node:fs" {
|
|
|
976
1018
|
};
|
|
977
1019
|
/* A stat(2) snapshot (statSync follows symlinks, lstatSync does not —
|
|
978
1020
|
* Node's split) — immutable; the supported surface is exactly these
|
|
979
|
-
* members.
|
|
1021
|
+
* members. blocks is the allocated size in 512-byte units; the time
|
|
1022
|
+
* fields are milliseconds with their sub-second fractions. */
|
|
980
1023
|
export interface Stats {
|
|
981
1024
|
isFile(): boolean;
|
|
982
1025
|
isDirectory(): boolean;
|
|
983
1026
|
isSymbolicLink(): boolean;
|
|
984
1027
|
readonly size: number;
|
|
1028
|
+
readonly blocks: number;
|
|
1029
|
+
readonly nlink: number;
|
|
1030
|
+
readonly atimeMs: number;
|
|
985
1031
|
readonly mtimeMs: number;
|
|
986
1032
|
}
|
|
987
1033
|
export function statSync(path: string): Stats;
|
|
@@ -991,10 +1037,15 @@ declare module "node:fs" {
|
|
|
991
1037
|
* variants), closeSync(fd). */
|
|
992
1038
|
export function openSync(path: string, flags: string): number;
|
|
993
1039
|
export function closeSync(fd: number): void;
|
|
994
|
-
/*
|
|
995
|
-
*
|
|
996
|
-
*
|
|
1040
|
+
/* Read into a caller buffer from the fd's current position when position
|
|
1041
|
+
* is omitted/null, or from a numeric byte position without advancing the
|
|
1042
|
+
* fd. Answers the byte count, 0 at EOF. */
|
|
997
1043
|
export function readSync(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number | null): number;
|
|
1044
|
+
/* Write a caller-buffer window, or a utf8 string, at the fd's current
|
|
1045
|
+
* position when position is omitted/null (advancing it), or at a numeric
|
|
1046
|
+
* byte position without advancing it. Answers the byte count. */
|
|
1047
|
+
export function writeSync(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number | null): number;
|
|
1048
|
+
export function writeSync(fd: number, string: string, position?: number | null, encoding?: "utf8" | "utf-8"): number;
|
|
998
1049
|
/* statSync over an open fd — the same Stats snapshot. */
|
|
999
1050
|
export function fstatSync(fd: number): Stats;
|
|
1000
1051
|
/* realpath(3) — resolves symlinks, `.`/`..`, throwing Node's fs error
|
|
@@ -1056,15 +1107,52 @@ declare module "fs" {
|
|
|
1056
1107
|
* interleaves with timers or other fibers — observable only in concurrent
|
|
1057
1108
|
* code. readFile is utf8-only, like readFileSync. */
|
|
1058
1109
|
declare module "fs/promises" {
|
|
1110
|
+
export interface FileReadResult<T extends Uint8Array> {
|
|
1111
|
+
bytesRead: number;
|
|
1112
|
+
buffer: T;
|
|
1113
|
+
}
|
|
1114
|
+
export interface FileWriteResult<T> {
|
|
1115
|
+
bytesWritten: number;
|
|
1116
|
+
buffer: T;
|
|
1117
|
+
}
|
|
1118
|
+
export interface FileHandle {
|
|
1119
|
+
readonly fd: number;
|
|
1120
|
+
close(): Promise<void>;
|
|
1121
|
+
read<T extends Uint8Array>(
|
|
1122
|
+
buffer: T,
|
|
1123
|
+
offset?: number | null,
|
|
1124
|
+
length?: number | null,
|
|
1125
|
+
position?: number | null,
|
|
1126
|
+
): Promise<FileReadResult<T>>;
|
|
1127
|
+
write<T extends Uint8Array>(
|
|
1128
|
+
buffer: T,
|
|
1129
|
+
offset?: number | null,
|
|
1130
|
+
length?: number | null,
|
|
1131
|
+
position?: number | null,
|
|
1132
|
+
): Promise<FileWriteResult<T>>;
|
|
1133
|
+
write(data: string, position?: number | null, encoding?: "utf8" | "utf-8" | null): Promise<FileWriteResult<string>>;
|
|
1134
|
+
readFile(options?: null): Promise<Buffer>;
|
|
1135
|
+
readFile(encoding: "utf8" | "utf-8"): Promise<string>;
|
|
1136
|
+
writeFile(data: string | Uint8Array, encoding?: "utf8" | "utf-8" | null): Promise<void>;
|
|
1137
|
+
appendFile(data: string | Uint8Array, encoding?: "utf8" | "utf-8" | null): Promise<void>;
|
|
1138
|
+
stat(): Promise<import("node:fs").Stats>;
|
|
1139
|
+
}
|
|
1140
|
+
export function open(path: string, flags?: string, mode?: number): Promise<FileHandle>;
|
|
1059
1141
|
export function readFile(path: string, encoding: "utf8" | "utf-8"): Promise<string>;
|
|
1060
1142
|
export function readFile(path: string): Promise<Buffer>;
|
|
1061
|
-
export function writeFile(
|
|
1143
|
+
export function writeFile(
|
|
1144
|
+
path: string,
|
|
1145
|
+
data: string,
|
|
1146
|
+
options?: { mode?: number; encoding?: "utf8" | "utf-8"; flag?: string; [option: string]: unknown },
|
|
1147
|
+
): Promise<void>;
|
|
1148
|
+
export function writeFile(path: string, data: string, encoding: "utf8" | "utf-8"): Promise<void>;
|
|
1062
1149
|
export function mkdir(path: string, options?: { recursive?: boolean; mode?: number }): Promise<void>;
|
|
1063
1150
|
export function readdir(path: string): Promise<string[]>;
|
|
1064
1151
|
export function rm(path: string): Promise<void>;
|
|
1065
1152
|
export function stat(path: string): Promise<import("node:fs").Stats>;
|
|
1066
1153
|
export function unlink(path: string): Promise<void>;
|
|
1067
1154
|
export function chmod(path: string, mode: number): Promise<void>;
|
|
1155
|
+
export function rename(oldPath: string, newPath: string): Promise<void>;
|
|
1068
1156
|
}
|
|
1069
1157
|
declare module "node:fs/promises" {
|
|
1070
1158
|
export * from "fs/promises";
|
|
@@ -1550,6 +1638,41 @@ declare module "util" {
|
|
|
1550
1638
|
format?: unknown,
|
|
1551
1639
|
...args: unknown[]
|
|
1552
1640
|
): string;
|
|
1641
|
+
export type ParseArgsOptionsType = "boolean" | "string";
|
|
1642
|
+
export interface ParseArgsOptionDescriptor {
|
|
1643
|
+
type: ParseArgsOptionsType;
|
|
1644
|
+
multiple?: boolean;
|
|
1645
|
+
short?: string;
|
|
1646
|
+
default?: string | boolean | string[] | boolean[];
|
|
1647
|
+
}
|
|
1648
|
+
export interface ParseArgsOptionsConfig {
|
|
1649
|
+
[longOption: string]: ParseArgsOptionDescriptor;
|
|
1650
|
+
}
|
|
1651
|
+
export interface ParseArgsConfig {
|
|
1652
|
+
args?: readonly string[];
|
|
1653
|
+
options?: ParseArgsOptionsConfig;
|
|
1654
|
+
strict?: boolean;
|
|
1655
|
+
allowPositionals?: boolean;
|
|
1656
|
+
allowNegative?: boolean;
|
|
1657
|
+
tokens?: boolean;
|
|
1658
|
+
}
|
|
1659
|
+
export type ParseArgsToken =
|
|
1660
|
+
| {
|
|
1661
|
+
kind: "option";
|
|
1662
|
+
index: number;
|
|
1663
|
+
name: string;
|
|
1664
|
+
rawName: string;
|
|
1665
|
+
value: string | undefined;
|
|
1666
|
+
inlineValue: boolean | undefined;
|
|
1667
|
+
}
|
|
1668
|
+
| { kind: "positional"; index: number; value: string }
|
|
1669
|
+
| { kind: "option-terminator"; index: number };
|
|
1670
|
+
export interface ParseArgsResult {
|
|
1671
|
+
values: { [longOption: string]: undefined | string | boolean | Array<string | boolean> };
|
|
1672
|
+
positionals: string[];
|
|
1673
|
+
tokens?: ParseArgsToken[];
|
|
1674
|
+
}
|
|
1675
|
+
export function parseArgs(config?: ParseArgsConfig): ParseArgsResult;
|
|
1553
1676
|
/* util.getCallSites (Node ≥22.9): the captured-frame slice harness
|
|
1554
1677
|
* code reads. No stack bookkeeping exists in a compiled binary — every
|
|
1555
1678
|
* reached call fences per site. */
|
|
@@ -1996,6 +2119,8 @@ declare module "node:net" {
|
|
|
1996
2119
|
declare module "http" {
|
|
1997
2120
|
import { Server as NetServer, Socket } from "net";
|
|
1998
2121
|
export type Server = NetServer;
|
|
2122
|
+
export type RequestListener =
|
|
2123
|
+
(req: IncomingMessage, res: ServerResponse) => void;
|
|
1999
2124
|
/* The Server VALUE — Node's constructor works with and without `new`
|
|
2000
2125
|
* (test/parallel's http.Server(fn) spelling); both route to the
|
|
2001
2126
|
* createServer lowering. */
|
package/dist/backend/cc.d.ts
CHANGED
|
@@ -46,6 +46,15 @@ export interface CcOptions {
|
|
|
46
46
|
* implemented in scr_copying.c (index.ts detects them on the IR).
|
|
47
47
|
* Off keeps that optional TU out of unrelated binaries. */
|
|
48
48
|
copying?: boolean;
|
|
49
|
+
/** The program uses a statically-labelled non-UTF-8 TextDecoder. Its
|
|
50
|
+
* generated mapping tables live behind SCR_TEXT_DECODER_LEGACY so the
|
|
51
|
+
* always-compiled bytes TU stays in the historical size class otherwise. */
|
|
52
|
+
textDecoderLegacy?: boolean;
|
|
53
|
+
/** The program uses fs/promises.open or a FileHandle value
|
|
54
|
+
* (moduleUsesFileHandle on the IR): compiles scr_file_handle.c. Keeping
|
|
55
|
+
* the descriptor object and promise adapters in their own unit preserves
|
|
56
|
+
* the base runtime's size class for programs that never open a handle. */
|
|
57
|
+
fileHandle?: boolean;
|
|
49
58
|
/** The embedded npm graph references fetch (index.ts detects it on the
|
|
50
59
|
* IR): compiles the NATIVE fetch bridge (scr_fetch.c over scr_net +
|
|
51
60
|
* scr_tls + scr_http's client parser + zlib — the socket units join
|
|
@@ -134,6 +143,9 @@ export interface CcOptions {
|
|
|
134
143
|
* line (escape-only programs ride the always-linked component encoder
|
|
135
144
|
* and never flip this). */
|
|
136
145
|
qs?: boolean;
|
|
146
|
+
/** The program uses static util.parseArgs (index.ts detects its libCall):
|
|
147
|
+
* compiles scr_util.c, a pure checked-dynamic data transform. */
|
|
148
|
+
parseArgs?: boolean;
|
|
137
149
|
/** The program uses the node:stream class surface (moduleUsesStream on
|
|
138
150
|
* the IR): compiles scr_stream.c into the binary — always alongside
|
|
139
151
|
* scr_events_emitter.c, which moduleUsesEmitter answers true for
|
|
@@ -242,6 +254,7 @@ export interface LibArchiveOptions {
|
|
|
242
254
|
emitter?: boolean;
|
|
243
255
|
zlib?: boolean;
|
|
244
256
|
copying?: boolean;
|
|
257
|
+
textDecoderLegacy?: boolean;
|
|
245
258
|
}
|
|
246
259
|
export declare function compileLibArchive(opts: LibArchiveOptions): Promise<void>;
|
|
247
260
|
/** Resolve the build cache without touching the filesystem. Exported from this
|
package/dist/backend/cc.js
CHANGED
|
@@ -732,6 +732,7 @@ export async function compileLibArchive(opts) {
|
|
|
732
732
|
"-fno-strict-aliasing", // the emitted object model type-puns — see compileC's buildArgs
|
|
733
733
|
"-Wno-deprecated-declarations",
|
|
734
734
|
"-DSCR_LIB",
|
|
735
|
+
...(opts.textDecoderLegacy ? ["-DSCR_TEXT_DECODER_LEGACY"] : []),
|
|
735
736
|
"-I", rtDir,
|
|
736
737
|
...(regex ? ["-I", vendorEngineDir()] : []),
|
|
737
738
|
...(opts.zlib ? ["-I", vendorZlibDir()] : []),
|
|
@@ -2166,6 +2167,9 @@ export async function compileC(opts) {
|
|
|
2166
2167
|
const http = (opts.http ?? false) || nativeFetch || netIsland;
|
|
2167
2168
|
const tls = (opts.tls ?? false) || nativeFetch || netIsland;
|
|
2168
2169
|
const driver = resolveCc();
|
|
2170
|
+
// scr_async.c submits callback-style filesystem work to a native worker.
|
|
2171
|
+
// POSIX drivers need the thread compile/link mode; win32 uses CreateThread.
|
|
2172
|
+
const threadArgs = targetPlatform(driver) === "win32" ? [] : ["-pthread"];
|
|
2169
2173
|
if (driver.target !== null) {
|
|
2170
2174
|
// See the resolveCc block: these inputs are built on and for the HOST
|
|
2171
2175
|
// (vendored archives, system libs). Regex, zlib, and the engine archive
|
|
@@ -2290,9 +2294,11 @@ export async function compileC(opts) {
|
|
|
2290
2294
|
const buildArgs = (rt, build = {}) => [
|
|
2291
2295
|
"-std=c11",
|
|
2292
2296
|
...driver.targetArgs,
|
|
2297
|
+
...threadArgs,
|
|
2293
2298
|
...(sanitize
|
|
2294
2299
|
? ["-O1", "-fsanitize=address", "-DSCR_RC_AUDIT"]
|
|
2295
2300
|
: ["-O2"]),
|
|
2301
|
+
...(opts.textDecoderLegacy ? ["-DSCR_TEXT_DECODER_LEGACY"] : []),
|
|
2296
2302
|
"-fno-math-errno",
|
|
2297
2303
|
// The emitted object model is deliberately type-punned C: a hierarchy
|
|
2298
2304
|
// upcast is a raw pointer cast, so one object's header (rc, vt) and
|
|
@@ -2310,6 +2316,7 @@ export async function compileC(opts) {
|
|
|
2310
2316
|
"-I", rtDir,
|
|
2311
2317
|
...RUNTIME_SOURCES.map((f) => rt(join(rtDir, f))),
|
|
2312
2318
|
...(opts.copying ? [rt(join(rtDir, "scr_copying.c"))] : []),
|
|
2319
|
+
...(opts.fileHandle ? [rt(join(rtDir, "scr_file_handle.c"))] : []),
|
|
2313
2320
|
// win32 targets compile the libc-shim TU (stpcpy, arc4random_buf,
|
|
2314
2321
|
// gmtime_r, strcasestr — the _WIN32 block in scr_runtime.h declares
|
|
2315
2322
|
// them) and link advapi32 (the CSPRNG RtlGenRandom/SystemFunction036,
|
|
@@ -2354,6 +2361,7 @@ export async function compileC(opts) {
|
|
|
2354
2361
|
...(opts.symbol ? [rt(join(rtDir, "scr_symbol.c"))] : []),
|
|
2355
2362
|
...(opts.searchParams ? [rt(join(rtDir, "scr_url_params.c"))] : []),
|
|
2356
2363
|
...(opts.qs ? [rt(join(rtDir, "scr_qs.c"))] : []),
|
|
2364
|
+
...(opts.parseArgs ? [rt(join(rtDir, "scr_util.c"))] : []),
|
|
2357
2365
|
...(opts.stream ? [rt(join(rtDir, "scr_stream.c"))] : []),
|
|
2358
2366
|
// The readiness-poller backends (scr_platform.h): kqueue on macOS/BSD,
|
|
2359
2367
|
// epoll on Linux, WSAPoll on Windows — each TU is empty off its
|
|
@@ -2472,9 +2480,11 @@ export async function compileC(opts) {
|
|
|
2472
2480
|
const cflags = [
|
|
2473
2481
|
"-std=c11",
|
|
2474
2482
|
...driver.targetArgs,
|
|
2483
|
+
...threadArgs,
|
|
2475
2484
|
...(sanitize
|
|
2476
2485
|
? ["-O1", "-fsanitize=address", "-DSCR_RC_AUDIT"]
|
|
2477
2486
|
: ["-O2"]),
|
|
2487
|
+
...(opts.textDecoderLegacy ? ["-DSCR_TEXT_DECODER_LEGACY"] : []),
|
|
2478
2488
|
"-fno-math-errno",
|
|
2479
2489
|
"-fno-strict-aliasing", // the emitted object model type-puns — see buildArgs
|
|
2480
2490
|
"-Wno-deprecated-declarations",
|
|
@@ -2573,6 +2583,7 @@ export async function compileC(opts) {
|
|
|
2573
2583
|
}
|
|
2574
2584
|
const linkProbeArgs = [
|
|
2575
2585
|
...(sanitize ? ["-fsanitize=address"] : []),
|
|
2586
|
+
...threadArgs,
|
|
2576
2587
|
...(targetPlatform(driver) === "win32"
|
|
2577
2588
|
? ["-ladvapi32", "-liphlpapi", "-lws2_32"]
|
|
2578
2589
|
: []),
|