Skip to content

Commit f57233b

Browse files
committed
process: report features.typescript as "strip" to match Node 26
Node 26 removed the "transform" value (nodejs/node#61803); the getter returns "strip" by default or false under --no-strip-types. Code feature-detecting TypeScript support against Node 26 checks for "strip", so returning "transform" breaks strict comparisons.
1 parent 618f2f6 commit f57233b

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

‎src/jsc/bindings/BunProcess.cpp‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,17 +4150,6 @@ JSC_DEFINE_CUSTOM_SETTER(setProcessNoDeprecation, (JSC::JSGlobalObject * globalO
41504150

41514151
static JSValue constructFeatures(VM& vm, JSObject* processObject)
41524152
{
4153-
// {
4154-
// inspector: true,
4155-
// debug: false,
4156-
// uv: true,
4157-
// ipv6: true,
4158-
// tls_alpn: true,
4159-
// tls_sni: true,
4160-
// tls_ocsp: true,
4161-
// tls: true,
4162-
// cached_builtins: [Getter]
4163-
// }
41644153
auto* globalObject = processObject->globalObject();
41654154
auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm);
41664155
auto* object = constructEmptyObject(globalObject);
@@ -4186,7 +4175,9 @@ static JSValue constructFeatures(VM& vm, JSObject* processObject)
41864175
object->putDirect(vm, Identifier::fromString(vm, "openssl_is_boringssl"_s), jsBoolean(true));
41874176
object->putDirect(vm, Identifier::fromString(vm, "quic"_s), jsBoolean(true));
41884177
object->putDirect(vm, Identifier::fromString(vm, "require_module"_s), jsBoolean(true));
4189-
object->putDirect(vm, Identifier::fromString(vm, "typescript"_s), jsString(vm, String("transform"_s)));
4178+
// Matches Node 26 ("strip" or false; "transform" was removed in nodejs/node#61803):
4179+
// https://github.com/nodejs/node/blob/v26.3.0/lib/internal/bootstrap/node.js#L335-L349
4180+
object->putDirect(vm, Identifier::fromString(vm, "typescript"_s), jsString(vm, String("strip"_s)));
41904181

41914182
RETURN_IF_EXCEPTION(scope, {});
41924183
return object;

‎test/js/node/process/process.test.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ it("process.release", () => {
206206
expect(process.release.sourceUrl).toBeOneOf([nonbaseline, baseline]);
207207
});
208208

209+
it("process.features.typescript", () => {
210+
// Node 26 returns "strip" by default and false under --no-strip-types;
211+
// "transform" was removed upstream, so feature detection expects "strip".
212+
expect(process.features.typescript).toBe("strip");
213+
});
214+
209215
it("process.env", () => {
210216
process.env["LOL SMILE UTF16 😂"] = "😂";
211217
expect(process.env["LOL SMILE UTF16 😂"]).toBe("😂");

0 commit comments

Comments
 (0)