@scriptc/compiler 0.0.12 → 0.0.14
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 +162 -19
- package/dist/backend/cc.d.ts +8 -0
- package/dist/backend/cc.js +12 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +146 -16
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/llvm/emitter.js +54 -7
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +7 -0
- package/dist/frontend/lowering/crypto-tables.js +139 -0
- package/dist/frontend/lowering/crypto-tables.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +38 -20
- package/dist/frontend/lowering/lower-builtins.js +111 -39
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +8 -0
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +10 -2
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +69 -7
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +1 -1
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +21 -0
- package/dist/frontend/lowering/lower-server.js +294 -23
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +4 -4
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +1 -1
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +21 -3
- package/dist/frontend/lowering/lowerer.js +48 -8
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +6 -0
- package/dist/frontend/lowering/surfaces.js +76 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/types.js +12 -0
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +103 -9
- package/dist/ir/nodes.js +56 -1
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +55 -4
- package/dist/ir/validate.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +286 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CRYPTO_CONSTANTS: Record<string, number | string>;
|
|
2
|
+
/** crypto.getCiphers() — Node v24.15.0 (OpenSSL 3.x) cipher names, sorted like Node answers them. */
|
|
3
|
+
export declare const CRYPTO_CIPHERS: readonly string[];
|
|
4
|
+
/** crypto.getHashes() — Node v24.15.0 digest names. */
|
|
5
|
+
export declare const CRYPTO_HASHES: readonly string[];
|
|
6
|
+
/** crypto.getCurves() — Node v24.15.0 EC curve names. */
|
|
7
|
+
export declare const CRYPTO_CURVES: readonly string[];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* node:crypto introspection tables — Node v24.15.0 answers, generated with
|
|
2
|
+
* node -p "require('crypto').constants" (and getCiphers/getHashes/getCurves)
|
|
3
|
+
* crypto.constants bakes as literals at every access site (the http2.constants
|
|
4
|
+
* precedent — the object itself never materializes at runtime); the three name
|
|
5
|
+
* lists bake as fresh string[] literals at their call sites. defaultCipherList
|
|
6
|
+
* and defaultCoreCipherList are strings; every other member is a number. */
|
|
7
|
+
export const CRYPTO_CONSTANTS = {
|
|
8
|
+
"OPENSSL_VERSION_NUMBER": 810549328,
|
|
9
|
+
"SSL_OP_ALL": 2147485776,
|
|
10
|
+
"SSL_OP_ALLOW_NO_DHE_KEX": 1024,
|
|
11
|
+
"SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144,
|
|
12
|
+
"SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304,
|
|
13
|
+
"SSL_OP_CISCO_ANYCONNECT": 32768,
|
|
14
|
+
"SSL_OP_COOKIE_EXCHANGE": 8192,
|
|
15
|
+
"SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648,
|
|
16
|
+
"SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048,
|
|
17
|
+
"SSL_OP_LEGACY_SERVER_CONNECT": 4,
|
|
18
|
+
"SSL_OP_NO_COMPRESSION": 131072,
|
|
19
|
+
"SSL_OP_NO_ENCRYPT_THEN_MAC": 524288,
|
|
20
|
+
"SSL_OP_NO_QUERY_MTU": 4096,
|
|
21
|
+
"SSL_OP_NO_RENEGOTIATION": 1073741824,
|
|
22
|
+
"SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536,
|
|
23
|
+
"SSL_OP_NO_SSLv2": 0,
|
|
24
|
+
"SSL_OP_NO_SSLv3": 33554432,
|
|
25
|
+
"SSL_OP_NO_TICKET": 16384,
|
|
26
|
+
"SSL_OP_NO_TLSv1": 67108864,
|
|
27
|
+
"SSL_OP_NO_TLSv1_1": 268435456,
|
|
28
|
+
"SSL_OP_NO_TLSv1_2": 134217728,
|
|
29
|
+
"SSL_OP_NO_TLSv1_3": 536870912,
|
|
30
|
+
"SSL_OP_PRIORITIZE_CHACHA": 2097152,
|
|
31
|
+
"SSL_OP_TLS_ROLLBACK_BUG": 8388608,
|
|
32
|
+
"ENGINE_METHOD_RSA": 1,
|
|
33
|
+
"ENGINE_METHOD_DSA": 2,
|
|
34
|
+
"ENGINE_METHOD_DH": 4,
|
|
35
|
+
"ENGINE_METHOD_RAND": 8,
|
|
36
|
+
"ENGINE_METHOD_EC": 2048,
|
|
37
|
+
"ENGINE_METHOD_CIPHERS": 64,
|
|
38
|
+
"ENGINE_METHOD_DIGESTS": 128,
|
|
39
|
+
"ENGINE_METHOD_PKEY_METHS": 512,
|
|
40
|
+
"ENGINE_METHOD_PKEY_ASN1_METHS": 1024,
|
|
41
|
+
"ENGINE_METHOD_ALL": 65535,
|
|
42
|
+
"ENGINE_METHOD_NONE": 0,
|
|
43
|
+
"DH_CHECK_P_NOT_SAFE_PRIME": 2,
|
|
44
|
+
"DH_CHECK_P_NOT_PRIME": 1,
|
|
45
|
+
"DH_UNABLE_TO_CHECK_GENERATOR": 4,
|
|
46
|
+
"DH_NOT_SUITABLE_GENERATOR": 8,
|
|
47
|
+
"RSA_PKCS1_PADDING": 1,
|
|
48
|
+
"RSA_NO_PADDING": 3,
|
|
49
|
+
"RSA_PKCS1_OAEP_PADDING": 4,
|
|
50
|
+
"RSA_X931_PADDING": 5,
|
|
51
|
+
"RSA_PKCS1_PSS_PADDING": 6,
|
|
52
|
+
"RSA_PSS_SALTLEN_DIGEST": -1,
|
|
53
|
+
"RSA_PSS_SALTLEN_MAX_SIGN": -2,
|
|
54
|
+
"RSA_PSS_SALTLEN_AUTO": -2,
|
|
55
|
+
"defaultCoreCipherList": "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",
|
|
56
|
+
"TLS1_VERSION": 769,
|
|
57
|
+
"TLS1_1_VERSION": 770,
|
|
58
|
+
"TLS1_2_VERSION": 771,
|
|
59
|
+
"TLS1_3_VERSION": 772,
|
|
60
|
+
"POINT_CONVERSION_COMPRESSED": 2,
|
|
61
|
+
"POINT_CONVERSION_UNCOMPRESSED": 4,
|
|
62
|
+
"POINT_CONVERSION_HYBRID": 6,
|
|
63
|
+
"defaultCipherList": "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",
|
|
64
|
+
};
|
|
65
|
+
/** crypto.getCiphers() — Node v24.15.0 (OpenSSL 3.x) cipher names, sorted like Node answers them. */
|
|
66
|
+
export const CRYPTO_CIPHERS = [
|
|
67
|
+
"aes-128-cbc", "aes-128-ccm", "aes-128-cfb", "aes-128-cfb1", "aes-128-cfb8",
|
|
68
|
+
"aes-128-ctr", "aes-128-ecb", "aes-128-gcm", "aes-128-ocb", "aes-128-ofb",
|
|
69
|
+
"aes-128-xts", "aes-192-cbc", "aes-192-ccm", "aes-192-cfb", "aes-192-cfb1",
|
|
70
|
+
"aes-192-cfb8", "aes-192-ctr", "aes-192-ecb", "aes-192-gcm", "aes-192-ocb",
|
|
71
|
+
"aes-192-ofb", "aes-256-cbc", "aes-256-ccm", "aes-256-cfb", "aes-256-cfb1",
|
|
72
|
+
"aes-256-cfb8", "aes-256-ctr", "aes-256-ecb", "aes-256-gcm", "aes-256-ocb",
|
|
73
|
+
"aes-256-ofb", "aes-256-xts", "aes128", "aes128-wrap", "aes128-wrap-pad",
|
|
74
|
+
"aes192", "aes192-wrap", "aes192-wrap-pad", "aes256", "aes256-wrap",
|
|
75
|
+
"aes256-wrap-pad", "aria-128-cbc", "aria-128-ccm", "aria-128-cfb",
|
|
76
|
+
"aria-128-cfb1", "aria-128-cfb8", "aria-128-ctr", "aria-128-ecb",
|
|
77
|
+
"aria-128-gcm", "aria-128-ofb", "aria-192-cbc", "aria-192-ccm",
|
|
78
|
+
"aria-192-cfb", "aria-192-cfb1", "aria-192-cfb8", "aria-192-ctr",
|
|
79
|
+
"aria-192-ecb", "aria-192-gcm", "aria-192-ofb", "aria-256-cbc",
|
|
80
|
+
"aria-256-ccm", "aria-256-cfb", "aria-256-cfb1", "aria-256-cfb8",
|
|
81
|
+
"aria-256-ctr", "aria-256-ecb", "aria-256-gcm", "aria-256-ofb", "aria128",
|
|
82
|
+
"aria192", "aria256", "camellia-128-cbc", "camellia-128-cfb",
|
|
83
|
+
"camellia-128-cfb1", "camellia-128-cfb8", "camellia-128-ctr",
|
|
84
|
+
"camellia-128-ecb", "camellia-128-ofb", "camellia-192-cbc",
|
|
85
|
+
"camellia-192-cfb", "camellia-192-cfb1", "camellia-192-cfb8",
|
|
86
|
+
"camellia-192-ctr", "camellia-192-ecb", "camellia-192-ofb",
|
|
87
|
+
"camellia-256-cbc", "camellia-256-cfb", "camellia-256-cfb1",
|
|
88
|
+
"camellia-256-cfb8", "camellia-256-ctr", "camellia-256-ecb",
|
|
89
|
+
"camellia-256-ofb", "camellia128", "camellia192", "camellia256", "chacha20",
|
|
90
|
+
"chacha20-poly1305", "des-ede", "des-ede-cbc", "des-ede-cfb", "des-ede-ecb",
|
|
91
|
+
"des-ede-ofb", "des-ede3", "des-ede3-cbc", "des-ede3-cfb", "des-ede3-cfb1",
|
|
92
|
+
"des-ede3-cfb8", "des-ede3-ecb", "des-ede3-ofb", "des3", "des3-wrap",
|
|
93
|
+
"id-aes128-CCM", "id-aes128-GCM", "id-aes128-wrap", "id-aes128-wrap-pad",
|
|
94
|
+
"id-aes192-CCM", "id-aes192-GCM", "id-aes192-wrap", "id-aes192-wrap-pad",
|
|
95
|
+
"id-aes256-CCM", "id-aes256-GCM", "id-aes256-wrap", "id-aes256-wrap-pad",
|
|
96
|
+
"id-smime-alg-CMS3DESwrap", "sm4", "sm4-cbc", "sm4-cfb", "sm4-ctr",
|
|
97
|
+
"sm4-ecb", "sm4-ofb",
|
|
98
|
+
];
|
|
99
|
+
/** crypto.getHashes() — Node v24.15.0 digest names. */
|
|
100
|
+
export const CRYPTO_HASHES = [
|
|
101
|
+
"RSA-MD5", "RSA-RIPEMD160", "RSA-SHA1", "RSA-SHA1-2", "RSA-SHA224",
|
|
102
|
+
"RSA-SHA256", "RSA-SHA3-224", "RSA-SHA3-256", "RSA-SHA3-384",
|
|
103
|
+
"RSA-SHA3-512", "RSA-SHA384", "RSA-SHA512", "RSA-SHA512/224",
|
|
104
|
+
"RSA-SHA512/256", "RSA-SM3", "blake2b512", "blake2s256",
|
|
105
|
+
"id-rsassa-pkcs1-v1_5-with-sha3-224", "id-rsassa-pkcs1-v1_5-with-sha3-256",
|
|
106
|
+
"id-rsassa-pkcs1-v1_5-with-sha3-384", "id-rsassa-pkcs1-v1_5-with-sha3-512",
|
|
107
|
+
"md5", "md5-sha1", "md5WithRSAEncryption", "ripemd", "ripemd160",
|
|
108
|
+
"ripemd160WithRSA", "rmd160", "sha1", "sha1WithRSAEncryption", "sha224",
|
|
109
|
+
"sha224WithRSAEncryption", "sha256", "sha256WithRSAEncryption", "sha3-224",
|
|
110
|
+
"sha3-256", "sha3-384", "sha3-512", "sha384", "sha384WithRSAEncryption",
|
|
111
|
+
"sha512", "sha512-224", "sha512-224WithRSAEncryption", "sha512-256",
|
|
112
|
+
"sha512-256WithRSAEncryption", "sha512WithRSAEncryption", "shake128",
|
|
113
|
+
"shake256", "sm3", "sm3WithRSAEncryption", "ssl3-md5", "ssl3-sha1",
|
|
114
|
+
];
|
|
115
|
+
/** crypto.getCurves() — Node v24.15.0 EC curve names. */
|
|
116
|
+
export const CRYPTO_CURVES = [
|
|
117
|
+
"Oakley-EC2N-3", "Oakley-EC2N-4", "SM2", "brainpoolP160r1",
|
|
118
|
+
"brainpoolP160t1", "brainpoolP192r1", "brainpoolP192t1", "brainpoolP224r1",
|
|
119
|
+
"brainpoolP224t1", "brainpoolP256r1", "brainpoolP256t1", "brainpoolP320r1",
|
|
120
|
+
"brainpoolP320t1", "brainpoolP384r1", "brainpoolP384t1", "brainpoolP512r1",
|
|
121
|
+
"brainpoolP512t1", "c2pnb163v1", "c2pnb163v2", "c2pnb163v3", "c2pnb176v1",
|
|
122
|
+
"c2pnb208w1", "c2pnb272w1", "c2pnb304w1", "c2pnb368w1", "c2tnb191v1",
|
|
123
|
+
"c2tnb191v2", "c2tnb191v3", "c2tnb239v1", "c2tnb239v2", "c2tnb239v3",
|
|
124
|
+
"c2tnb359v1", "c2tnb431r1", "prime192v1", "prime192v2", "prime192v3",
|
|
125
|
+
"prime239v1", "prime239v2", "prime239v3", "prime256v1", "secp112r1",
|
|
126
|
+
"secp112r2", "secp128r1", "secp128r2", "secp160k1", "secp160r1",
|
|
127
|
+
"secp160r2", "secp192k1", "secp224k1", "secp224r1", "secp256k1",
|
|
128
|
+
"secp384r1", "secp521r1", "sect113r1", "sect113r2", "sect131r1",
|
|
129
|
+
"sect131r2", "sect163k1", "sect163r1", "sect163r2", "sect193r1",
|
|
130
|
+
"sect193r2", "sect233k1", "sect233r1", "sect239k1", "sect283k1",
|
|
131
|
+
"sect283r1", "sect409k1", "sect409r1", "sect571k1", "sect571r1",
|
|
132
|
+
"wap-wsg-idm-ecid-wtls1", "wap-wsg-idm-ecid-wtls10",
|
|
133
|
+
"wap-wsg-idm-ecid-wtls11", "wap-wsg-idm-ecid-wtls12",
|
|
134
|
+
"wap-wsg-idm-ecid-wtls3", "wap-wsg-idm-ecid-wtls4",
|
|
135
|
+
"wap-wsg-idm-ecid-wtls5", "wap-wsg-idm-ecid-wtls6",
|
|
136
|
+
"wap-wsg-idm-ecid-wtls7", "wap-wsg-idm-ecid-wtls8",
|
|
137
|
+
"wap-wsg-idm-ecid-wtls9",
|
|
138
|
+
];
|
|
139
|
+
//# sourceMappingURL=crypto-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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W,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW;IAC/D,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW;IAC/D,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW;IAC/D,wBAAwB,EAAE,yBAAyB;IACnD,yBAAyB,EAAE,yBAAyB;IACpD,wBAAwB,EAAE,wBAAwB;IAClD,wBAAwB,EAAE,wBAAwB;IAClD,wBAAwB,EAAE,wBAAwB;IAClD,wBAAwB;CACzB,CAAC"}
|
|
@@ -90,16 +90,18 @@ export declare function createRequireNamespaceDecl(L: Lowerer, nameNode: ts.Node
|
|
|
90
90
|
* embedded it) and reports the requires-dynamic diagnostic in a static
|
|
91
91
|
* build. Null when the callee is not a createRequire require. */
|
|
92
92
|
export declare function lowerCreateRequireCall(L: Lowerer, call: ts.CallExpression, loc: SrcLoc): IrExpr | null;
|
|
93
|
-
/**
|
|
94
|
-
* spellings: `http2.constants` through a
|
|
95
|
-
* destructured or member-bound `constants`
|
|
96
|
-
* or `require("http2").constants` inline. The
|
|
97
|
-
* materializes; each member read bakes as its
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
|
|
93
|
+
/** The module whose baked-constants OBJECT `node` denotes, or null — any
|
|
94
|
+
* of the spellings: `http2.constants`/`crypto.constants` through a
|
|
95
|
+
* namespace/require binding, a destructured or member-bound `constants`
|
|
96
|
+
* alias from the module, or `require("http2").constants` inline. The
|
|
97
|
+
* object itself never materializes; each member read bakes as its
|
|
98
|
+
* literal. */
|
|
99
|
+
export declare function builtinConstantsModuleOf(L: Lowerer, node: ts.Expression): string | null;
|
|
100
|
+
/** `constants.NGHTTP2_CANCEL` / `constants.SSL_OP_NO_TICKET` (any baked-
|
|
101
|
+
* constants spelling) → the literal; unknown members fence by name.
|
|
102
|
+
* Null when the receiver is not a baked constants object (the property
|
|
103
|
+
* chain keeps trying). */
|
|
104
|
+
export declare function lowerBuiltinConstantsProperty(L: Lowerer, expr: ts.PropertyAccessExpression): IrExpr | null;
|
|
103
105
|
/** True for any spelling of node:perf_hooks' `performance` object — the
|
|
104
106
|
* named import binding, a namespace/default-import member, the require
|
|
105
107
|
* twins (all through the shared builtin tables), or the GLOBAL Node
|
|
@@ -116,16 +118,17 @@ export declare function isPerfHooksPerformanceExpr(L: Lowerer, node: ts.Expressi
|
|
|
116
118
|
* value. Other members on the performance object fence by name; null
|
|
117
119
|
* for non-perf_hooks callees (the call chain keeps trying). */
|
|
118
120
|
export declare function lowerPerfHooksCall(L: Lowerer, expr: ts.CallExpression, access: ts.PropertyAccessExpression): IrExpr | null;
|
|
119
|
-
/** True for `const { NGHTTP2_CANCEL, ... } = http2.constants`
|
|
120
|
-
*
|
|
121
|
-
* defaults/nesting) over
|
|
122
|
-
*
|
|
123
|
-
* (lowerVarDecl and collectGlobals both
|
|
124
|
-
* baked literal
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
/** True for `const { NGHTTP2_CANCEL, ... } = http2.constants` (and the
|
|
122
|
+
* crypto.constants twin) — a plain object destructure (identifier
|
|
123
|
+
* elements, renames allowed, no rest/defaults/nesting) over a baked
|
|
124
|
+
* constants object whose every name is in its table. The declaration is
|
|
125
|
+
* alias plumbing with no storage (lowerVarDecl and collectGlobals both
|
|
126
|
+
* skip it); each USE reads its baked literal
|
|
127
|
+
* (builtinConstantBindingOf). */
|
|
128
|
+
export declare function builtinConstantsDestructureDecl(L: Lowerer, nameNode: ts.Node, init: ts.Expression | undefined): boolean;
|
|
129
|
+
/** Resolves an identifier bound by a builtinConstantsDestructureDecl to
|
|
130
|
+
* its baked literal value. Null for every other binding. */
|
|
131
|
+
export declare function builtinConstantBindingOf(L: Lowerer, ident: ts.Identifier): IrExpr | null;
|
|
129
132
|
/** One builtin-module function call → its libCall. Completes the call to
|
|
130
133
|
* the table's exact shape: variadicPack functions (path.join/resolve)
|
|
131
134
|
* accept any arity — or ONE spread of a string[] — and pack the
|
|
@@ -326,6 +329,21 @@ export declare function fencedBuiltinImportOf(L: Lowerer, ident: ts.Identifier):
|
|
|
326
329
|
* bare randomBytes(n) — fences with the Buffer story. Null when this
|
|
327
330
|
* isn't a toString on a crypto.randomBytes call. */
|
|
328
331
|
export declare function lowerCryptoComposedCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression): IrExpr | null;
|
|
332
|
+
/** The node:crypto introspection statics — build-time constants of the
|
|
333
|
+
* compiled runtime, baked at the call site (the http2.constants stance
|
|
334
|
+
* extended to calls): getFips() answers 0 (no FIPS provider can ever
|
|
335
|
+
* load into a compiled binary — Node's own answer for a non-FIPS
|
|
336
|
+
* build), and getCiphers()/getHashes()/getCurves() answer Node v24's
|
|
337
|
+
* name lists as fresh string[] literals. The lists are INTROSPECTION
|
|
338
|
+
* data (Node's contract is "names the provider recognizes"); the
|
|
339
|
+
* operations behind the names keep their per-member fences — a program
|
|
340
|
+
* that probes the list and then constructs a cipher fences at the
|
|
341
|
+
* construction site, never here. Null for other members (the dispatch
|
|
342
|
+
* keeps trying). */
|
|
343
|
+
export declare function lowerCryptoModuleCall(L: Lowerer, expr: ts.CallExpression, bi: {
|
|
344
|
+
module: string;
|
|
345
|
+
member: string;
|
|
346
|
+
}, loc: SrcLoc): IrExpr | null;
|
|
329
347
|
/** Method calls on URL-typed receivers: `u.toString()` is Node's href
|
|
330
348
|
* serialization (the href getter's libCall). Everything else the lib
|
|
331
349
|
* declares fences member-qualified. Null for non-URL receivers. */
|
|
@@ -15,6 +15,7 @@ import { invalidJsonModuleDiag, requiresDynamicImportDiag } from "../../diagnost
|
|
|
15
15
|
import { builtinModuleFnOf, FS_READDIR_DOCUMENTED_OPTIONS, FS_WATCH_DOCUMENTED_OPTIONS, FS_WRITE_FILE_DOCUMENTED_OPTIONS, QS_PARSE_DOCUMENTED_OPTIONS, QS_STRINGIFY_DOCUMENTED_OPTIONS, READLINE_DOCUMENTED_OPTIONS, builtinConstLit, fenceOrDropOptionKey, isChildSurfaceMember, } from "./surfaces.js";
|
|
16
16
|
import { conditionalSpreadOf, lowerDynObjectLiteral } from "./lower-exprs.js";
|
|
17
17
|
import { HTTP2_CONSTANTS } from "./http2-constants.js";
|
|
18
|
+
import { CRYPTO_CIPHERS, CRYPTO_CONSTANTS, CRYPTO_CURVES, CRYPTO_HASHES } from "./crypto-tables.js";
|
|
18
19
|
import { timerStyleCallback } from "./lower-calls.js";
|
|
19
20
|
import { registerHttpClientFnBinding } from "./lower-server.js";
|
|
20
21
|
import { BOOL, BYTES_U8, CHILD_T, CHILDSTREAM_T, DYN, F64, FSWATCHER_T, PROCSTREAM_T, JSVAL, NULL_T, SEARCH_PARAMS_T, SPAWNRES_T, STRING, UNDEFINED_T, VOID, arrayOf, canBoxFuncIntoDyn, canConvertToDyn, funcOf, isUnitType, typeEquals, typeKey } from "../../ir/nodes.js";
|
|
@@ -376,38 +377,60 @@ export function lowerCreateRequireCall(L, call, loc) {
|
|
|
376
377
|
loc,
|
|
377
378
|
};
|
|
378
379
|
}
|
|
379
|
-
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
/** The builtin modules whose `constants` object bakes as literals at
|
|
381
|
+
* every access site (the fs.constants precedent, scaled up): http2's
|
|
382
|
+
* full Node v24 table, and crypto's OpenSSL-constant table. The object
|
|
383
|
+
* itself never materializes at runtime. */
|
|
384
|
+
const BUILTIN_CONSTANTS_TABLES = {
|
|
385
|
+
http2: {
|
|
386
|
+
table: HTTP2_CONSTANTS,
|
|
387
|
+
hint: "the table bakes Node v24's 240 members as literals — this name is not one of them",
|
|
388
|
+
},
|
|
389
|
+
crypto: {
|
|
390
|
+
table: CRYPTO_CONSTANTS,
|
|
391
|
+
hint: "the table bakes Node v24's crypto.constants members as literals — this name is not one of them",
|
|
392
|
+
},
|
|
393
|
+
};
|
|
394
|
+
/** The module whose baked-constants OBJECT `node` denotes, or null — any
|
|
395
|
+
* of the spellings: `http2.constants`/`crypto.constants` through a
|
|
396
|
+
* namespace/require binding, a destructured or member-bound `constants`
|
|
397
|
+
* alias from the module, or `require("http2").constants` inline. The
|
|
398
|
+
* object itself never materializes; each member read bakes as its
|
|
399
|
+
* literal. */
|
|
400
|
+
export function builtinConstantsModuleOf(L, node) {
|
|
401
|
+
let module = null;
|
|
385
402
|
if (ts.isPropertyAccessExpression(node) && !node.questionDotToken) {
|
|
386
403
|
if (node.name.text !== "constants")
|
|
387
|
-
return
|
|
404
|
+
return null;
|
|
388
405
|
const bi = L.builtinMemberOf(node);
|
|
389
|
-
if (bi
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
406
|
+
if (bi)
|
|
407
|
+
module = bi.module;
|
|
408
|
+
else {
|
|
409
|
+
const spec = requireSpecOf(node.expression);
|
|
410
|
+
module = spec !== null ? canonicalBuiltinModule(spec) : null;
|
|
411
|
+
}
|
|
393
412
|
}
|
|
394
|
-
if (ts.isIdentifier(node)) {
|
|
413
|
+
else if (ts.isIdentifier(node)) {
|
|
395
414
|
const bi = builtinImportOf(L, node);
|
|
396
|
-
|
|
415
|
+
if (bi !== null && bi.member === "constants")
|
|
416
|
+
module = bi.module;
|
|
397
417
|
}
|
|
398
|
-
return
|
|
418
|
+
return module !== null && own(BUILTIN_CONSTANTS_TABLES, module) !== undefined ? module : null;
|
|
399
419
|
}
|
|
400
|
-
/** `constants.NGHTTP2_CANCEL`
|
|
401
|
-
* literal; unknown members fence by name.
|
|
402
|
-
* the constants object (the property
|
|
403
|
-
|
|
420
|
+
/** `constants.NGHTTP2_CANCEL` / `constants.SSL_OP_NO_TICKET` (any baked-
|
|
421
|
+
* constants spelling) → the literal; unknown members fence by name.
|
|
422
|
+
* Null when the receiver is not a baked constants object (the property
|
|
423
|
+
* chain keeps trying). */
|
|
424
|
+
export function lowerBuiltinConstantsProperty(L, expr) {
|
|
404
425
|
if (expr.questionDotToken)
|
|
405
426
|
return null;
|
|
406
|
-
|
|
427
|
+
const module = builtinConstantsModuleOf(L, expr.expression);
|
|
428
|
+
if (module === null)
|
|
407
429
|
return null;
|
|
408
|
-
const
|
|
430
|
+
const entry = BUILTIN_CONSTANTS_TABLES[module];
|
|
431
|
+
const value = own(entry.table, expr.name.text);
|
|
409
432
|
if (value === undefined) {
|
|
410
|
-
L.noLowering(
|
|
433
|
+
L.noLowering(`${module}.constants.${expr.name.text}`, expr, entry.hint);
|
|
411
434
|
}
|
|
412
435
|
return builtinConstLit(value, locOf(expr));
|
|
413
436
|
}
|
|
@@ -487,27 +510,30 @@ function perfNowFnValueOf(L) {
|
|
|
487
510
|
}
|
|
488
511
|
return name;
|
|
489
512
|
}
|
|
490
|
-
/** True for `const { NGHTTP2_CANCEL, ... } = http2.constants`
|
|
491
|
-
*
|
|
492
|
-
* defaults/nesting) over
|
|
493
|
-
*
|
|
494
|
-
* (lowerVarDecl and collectGlobals both
|
|
495
|
-
* baked literal
|
|
496
|
-
|
|
513
|
+
/** True for `const { NGHTTP2_CANCEL, ... } = http2.constants` (and the
|
|
514
|
+
* crypto.constants twin) — a plain object destructure (identifier
|
|
515
|
+
* elements, renames allowed, no rest/defaults/nesting) over a baked
|
|
516
|
+
* constants object whose every name is in its table. The declaration is
|
|
517
|
+
* alias plumbing with no storage (lowerVarDecl and collectGlobals both
|
|
518
|
+
* skip it); each USE reads its baked literal
|
|
519
|
+
* (builtinConstantBindingOf). */
|
|
520
|
+
export function builtinConstantsDestructureDecl(L, nameNode, init) {
|
|
497
521
|
if (!ts.isObjectBindingPattern(nameNode) || !init)
|
|
498
522
|
return false;
|
|
499
|
-
|
|
523
|
+
const module = builtinConstantsModuleOf(L, init);
|
|
524
|
+
if (module === null)
|
|
500
525
|
return false;
|
|
526
|
+
const table = BUILTIN_CONSTANTS_TABLES[module].table;
|
|
501
527
|
return nameNode.elements.every((el) => !el.dotDotDotToken &&
|
|
502
528
|
el.initializer === undefined &&
|
|
503
529
|
el.name !== undefined &&
|
|
504
530
|
ts.isIdentifier(el.name) &&
|
|
505
531
|
(el.propertyName === undefined || ts.isIdentifier(el.propertyName)) &&
|
|
506
|
-
own(
|
|
532
|
+
own(table, (el.propertyName ?? el.name).text) !== undefined);
|
|
507
533
|
}
|
|
508
|
-
/** Resolves an identifier bound by
|
|
509
|
-
* baked literal value. Null for every other binding. */
|
|
510
|
-
export function
|
|
534
|
+
/** Resolves an identifier bound by a builtinConstantsDestructureDecl to
|
|
535
|
+
* its baked literal value. Null for every other binding. */
|
|
536
|
+
export function builtinConstantBindingOf(L, ident) {
|
|
511
537
|
const symbol = L.checker.getSymbolAtLocation(ident);
|
|
512
538
|
const decl = symbol ? L.checker.declarationsOf(symbol)[0] : undefined;
|
|
513
539
|
if (!decl || !ts.isBindingElement(decl) || decl.dotDotDotToken || decl.initializer)
|
|
@@ -517,14 +543,15 @@ export function http2ConstantBindingOf(L, ident) {
|
|
|
517
543
|
const varDecl = decl.parent.parent;
|
|
518
544
|
if (!ts.isVariableDeclaration(varDecl) || varDecl.initializer === undefined)
|
|
519
545
|
return null;
|
|
520
|
-
|
|
546
|
+
const module = builtinConstantsModuleOf(L, varDecl.initializer);
|
|
547
|
+
if (module === null)
|
|
521
548
|
return null;
|
|
522
549
|
const key = decl.propertyName && ts.isIdentifier(decl.propertyName)
|
|
523
550
|
? decl.propertyName.text
|
|
524
551
|
: decl.name !== undefined && ts.isIdentifier(decl.name) ? decl.name.text : null;
|
|
525
552
|
if (key === null)
|
|
526
553
|
return null;
|
|
527
|
-
const value = own(
|
|
554
|
+
const value = own(BUILTIN_CONSTANTS_TABLES[module].table, key);
|
|
528
555
|
if (value === undefined)
|
|
529
556
|
return null;
|
|
530
557
|
return builtinConstLit(value, locOf(ident));
|
|
@@ -3268,6 +3295,41 @@ function lowerHashDigestChain(L, call, access) {
|
|
|
3268
3295
|
}
|
|
3269
3296
|
L.noLowering(`Hash.update of '${dataIr ? L.fmt(dataIr) : L.checker.typeToString(L.typeOf(dataNode))}' values`, dataNode, "string and Buffer/Uint8Array inputs are the lowered update forms");
|
|
3270
3297
|
}
|
|
3298
|
+
/** The node:crypto introspection statics — build-time constants of the
|
|
3299
|
+
* compiled runtime, baked at the call site (the http2.constants stance
|
|
3300
|
+
* extended to calls): getFips() answers 0 (no FIPS provider can ever
|
|
3301
|
+
* load into a compiled binary — Node's own answer for a non-FIPS
|
|
3302
|
+
* build), and getCiphers()/getHashes()/getCurves() answer Node v24's
|
|
3303
|
+
* name lists as fresh string[] literals. The lists are INTROSPECTION
|
|
3304
|
+
* data (Node's contract is "names the provider recognizes"); the
|
|
3305
|
+
* operations behind the names keep their per-member fences — a program
|
|
3306
|
+
* that probes the list and then constructs a cipher fences at the
|
|
3307
|
+
* construction site, never here. Null for other members (the dispatch
|
|
3308
|
+
* keeps trying). */
|
|
3309
|
+
export function lowerCryptoModuleCall(L, expr, bi, loc) {
|
|
3310
|
+
if (bi.module !== "crypto")
|
|
3311
|
+
return null;
|
|
3312
|
+
const LISTS = {
|
|
3313
|
+
getCiphers: CRYPTO_CIPHERS,
|
|
3314
|
+
getHashes: CRYPTO_HASHES,
|
|
3315
|
+
getCurves: CRYPTO_CURVES,
|
|
3316
|
+
};
|
|
3317
|
+
const list = own(LISTS, bi.member);
|
|
3318
|
+
if (bi.member !== "getFips" && list === undefined)
|
|
3319
|
+
return null;
|
|
3320
|
+
if (expr.arguments.length !== 0) {
|
|
3321
|
+
L.noLowering(`crypto.${bi.member} with ${expr.arguments.length} arguments`, expr);
|
|
3322
|
+
}
|
|
3323
|
+
if (bi.member === "getFips") {
|
|
3324
|
+
return { kind: "numLit", value: 0, type: F64, loc };
|
|
3325
|
+
}
|
|
3326
|
+
return {
|
|
3327
|
+
kind: "arrayLit",
|
|
3328
|
+
elems: list.map((s) => ({ kind: "strLit", value: s, type: STRING, loc })),
|
|
3329
|
+
type: arrayOf(STRING),
|
|
3330
|
+
loc,
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3271
3333
|
/** Method calls on URL-typed receivers: `u.toString()` is Node's href
|
|
3272
3334
|
* serialization (the href getter's libCall). Everything else the lib
|
|
3273
3335
|
* declares fences member-qualified. Null for non-URL receivers. */
|
|
@@ -4848,13 +4910,23 @@ export function lowerProcessMethodCall(L, call, access) {
|
|
|
4848
4910
|
// the loop-end report dispatches it (reason, promise) per
|
|
4849
4911
|
// never-observed rejection instead of printing and exiting 1
|
|
4850
4912
|
// (scr_async.c; the end-of-turn timing is a SEMANTICS.md
|
|
4851
|
-
// divergence). `once
|
|
4852
|
-
|
|
4913
|
+
// divergence). `once` auto-removes after one delivery and
|
|
4914
|
+
// `off`/`removeListener` remove by closure identity — the warning
|
|
4915
|
+
// registry's story. 'rejectionHandled' is the sibling registry:
|
|
4916
|
+
// under the loop-exhaustion model its ONE firing window is a
|
|
4917
|
+
// handler attached during an unhandledRejection listener (earlier
|
|
4918
|
+
// handling never enters the report at all — the same documented
|
|
4919
|
+
// divergence), dispatched synchronously with the promise.
|
|
4920
|
+
if (event === "unhandledRejection" || event === "rejectionHandled") {
|
|
4853
4921
|
if (!ts.isExpressionStatement(call.parent)) {
|
|
4854
4922
|
L.unsupported("SC1090", call, "chaining process listener registration (the result is void here — register each listener as its own statement)");
|
|
4855
4923
|
}
|
|
4856
4924
|
const cb = dcSubscriberArg(L, call.arguments[1]);
|
|
4857
|
-
|
|
4925
|
+
const onceArg = { kind: "boolLit", value: member === "once", type: BOOL, loc };
|
|
4926
|
+
const fn = event === "unhandledRejection"
|
|
4927
|
+
? (isOff ? "process.offUnhandledRejection" : "process.onUnhandledRejection")
|
|
4928
|
+
: (isOff ? "process.offRejectionHandled" : "process.onRejectionHandled");
|
|
4929
|
+
return { kind: "libCall", fn, args: isOff ? [cb] : [cb, onceArg], type: VOID, loc };
|
|
4858
4930
|
}
|
|
4859
4931
|
// 'warning': the listener crosses as a dyn function; emitWarning
|
|
4860
4932
|
// and the runtime deprecation sites dispatch synchronously
|
|
@@ -4873,7 +4945,7 @@ export function lowerProcessMethodCall(L, call, access) {
|
|
|
4873
4945
|
};
|
|
4874
4946
|
}
|
|
4875
4947
|
if (signo === undefined && event !== "exit") {
|
|
4876
|
-
L.noLowering(`process.${member}(${event === null ? "non-literal event" : `"${event}"`}, ...)`, call.arguments[0], '"SIGINT", "SIGTERM", "exit", "warning", and "
|
|
4948
|
+
L.noLowering(`process.${member}(${event === null ? "non-literal event" : `"${event}"`}, ...)`, call.arguments[0], '"SIGINT", "SIGTERM", "exit", "warning", "unhandledRejection", and "rejectionHandled" are the supported process events (as literals)');
|
|
4877
4949
|
}
|
|
4878
4950
|
if (!ts.isExpressionStatement(call.parent)) {
|
|
4879
4951
|
L.unsupported("SC1090", call, "chaining process listener registration (the result is void here — register each listener as its own statement)");
|