Repository navigation
Bun support #632
Description
Activity
I tried this earlier and I don't think bun can work with node-gyp so it can't compile and package the binary
- addedfeature-requestRequest for new features or functionalityRequest for new features or functionality
on Sep 26, 2023 any new on this? all i can find is an unanswered stackoverflow: https://stackoverflow.com/questions/77950299/alternatives-to-node-pty-for-bun
it would be very useful combined with the bun shellAs far as I'm aware bun doesn't work with
nan/napi/node-gypso this isn't possible.There are two bugs here:
-
node-gyp is supported in bun install, but there's a subtle bug with lifecycle scripts that cause it to not run correctly when there's a postinstall script and bindings.gyp both. Dylan Conway (@dylan-conway) is working on a fix. This bug impacts
bun install, but does not impact the runtime. -
Bun's runtime implements napi, but node-pty depends on many Nan/V8 C++ API & libuv symbols which Bun does not implement yet.
Those include:
__Z10PtyGetProcRKN3Nan20FunctionCallbackInfoIN2v85ValueEEE_Z4initN2v85LocalINS_6ObjectEEE_Z7PtyForkRKN3Nan20FunctionCallbackInfoIN2v85ValueEEE_Z7PtyOpenRKN3Nan20FunctionCallbackInfoIN2v85ValueEEE_Z9PtyResizeRKN3Nan20FunctionCallbackInfoIN2v85ValueEEE_ZN2v811HandleScope12CreateHandleEPNS_8internal7IsolateEm_ZN2v811HandleScopeC1EPNS_7IsolateE_ZN2v811HandleScopeD1Ev_ZN2v811HandleScopeD2Ev_ZN2v812api_internal12ToLocalEmptyEv_ZN2v812api_internal13DisposeGlobalEPm_ZN2v812api_internal17FromJustIsNothingEv_ZN2v812api_internal18GlobalizeReferenceEPNS_8internal7IsolateEm_ZN2v814ObjectTemplate11NewInstanceENS_5LocalINS_7ContextEEE_ZN2v814ObjectTemplate21SetInternalFieldCountEi_ZN2v814ObjectTemplate3NewEPNS_7IsolateENS_5LocalINS_16FunctionTemplateEEE_ZN2v816FunctionTemplate11GetFunctionENS_5LocalINS_7ContextEEE_ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionEttt_ZN2v820EscapableHandleScope6EscapeEPm_ZN2v820EscapableHandleScopeC1EPNS_7IsolateE_ZN2v86Number3NewEPNS_7IsolateEd_ZN2v86Object16SetInternalFieldEiNS_5LocalINS_4DataEEE_ZN2v86Object20SlowGetInternalFieldEi_ZN2v86Object3GetENS_5LocalINS_7ContextEEEj_ZN2v86Object3NewEPNS_7IsolateE_ZN2v86Object3SetENS_5LocalINS_7ContextEEENS1_INS_5ValueEEES5__ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi_ZN2v87Context6GlobalEv_ZN2v87Integer3NewEPNS_7IsolateEi_ZN2v87Isolate10GetCurrentEv_ZN2v87Isolate14ThrowExceptionENS_5LocalINS_5ValueEEE_ZN2v87Isolate17GetCurrentContextEv_ZN2v88External3NewEPNS_7IsolateEPv_ZN2v88internal35IsolateFromNeverReadOnlySpaceObjectEm_ZN2v89Exception5ErrorENS_5LocalINS_6StringEEE_ZN4node12MakeCallbackEPN2v87IsolateENS0_5LocalINS0_6ObjectEEENS3_INS0_8FunctionEEEiPNS3_INS0_5ValueEEENS_13async_contextE_ZN4node13EmitAsyncInitEPN2v87IsolateENS0_5LocalINS0_6ObjectEEENS3_INS0_6StringEEEd_ZN4node16EmitAsyncDestroyEPN2v87IsolateENS_13async_contextE_ZNK2v85Array6LengthEv_ZNK2v85Value10IsFunctionEv_ZNK2v85Value12BooleanValueEPNS_7IsolateE_ZNK2v85Value12IntegerValueENS_5LocalINS_7ContextEEE_ZNK2v85Value7IsArrayEv_ZNK2v85Value8IsNumberEv_ZNK2v85Value8ToStringENS_5LocalINS_7ContextEEE_ZNK2v85Value9IsBooleanEv_ZNK2v85Value9ToIntegerENS_5LocalINS_7ContextEEE_ZNK2v86String6LengthEv_ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii_ZNK2v88External5ValueEvuv_async_inituv_async_senduv_closeuv_default_loopuv_thread_create
To find this information, I ran
nm -g build/Release/pty.node.-
Jarred Sumner (@Jarred-Sumner) thanks for the info. Can you clarify whether there's anything that should happen in this repo or if it's all on bun's side? I don't mind accepting changes to improve compatibility but don't plan on doing them myself as we don't use bun currently.
Closing this as out of scope, but contributions are always welcome to improve compatibility.
Environment details
Issue description
Does not work with bun (https://bun.sh)
index.ts
error
I've tried building it with
node-gypThis creates the build/Release folders and its contents, but now it gives this vague error:
package.json
{ "name": "app", "version": "1.0.0", "module": "src/index.ts", "devDependencies": { "bun-types": "latest" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "bun run --watch src/index.ts" }, "dependencies": { "node-pty": "^1.0.0" } }tsconfig.json
{ "compilerOptions": { "target": "ES2021", "module": "ES2022", "moduleResolution": "node", "types": [ "bun-types" ], "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true } }