oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.81k stars 2.64k forks source link

Support Analog (Vite framework for Angular) #3772

Open birkskyum opened 1 year ago

birkskyum commented 1 year ago

Analog GitHub - Website, @brandonroberts

What version of Bun is running?

0.7.0

What platform is your computer?

Darwin 22.5.0 arm64 arm

What steps can reproduce the bug?

What is the expected behavior?

➜ bun --bun run dev

> analog-project@0.0.0 dev
> ng serve

? Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.io/analytics. No
Global setting: not set
Local setting: disabled
Effective status: disabled

The '@analogjs/platform' successfully started.
The server endpoints are accessible under the "/api" path.
  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
Angular is running in development mode.

What do you see instead?

➜ bun --bun run dev
$ ng serve
50 |                 return true;
51 |             default:
52 |                 return false;
53 |         }
54 |     }
55 |     if (process.stdout instanceof tty_1.WriteStream) {
           ^
TypeError: instanceof called on an object with an invalid prototype property.
      at supportColor (/Users/admin/repos/analog-project/node_modules/@angular/cli/src/utilities/color.js:55:8)
      at /Users/admin/repos/analog-project/node_modules/@angular/cli/src/utilities/color.js:69:17
      at globalThis (/Users/admin/repos/analog-project/node_modules/@angular/cli/src/utilities/color.js:69:30)
      at /Users/admin/repos/analog-project/node_modules/@angular/cli/lib/init.js:39:6
      at globalThis (/Users/admin/repos/analog-project/node_modules/@angular/cli/lib/init.js:153:1)
error: script "dev" exited with code 1 (SIGHUP)

Additional information

Blocked by

sp90 commented 1 year ago

2081 added for tracking

birkskyum commented 1 year ago

Update: There has been good progress here, due to increased Angular CLI and Nitro support. The server almost start now:

This is the expected:

➜ bun run dev
$ ng serve

The '@analogjs/platform' successfully started.
The server endpoints are accessible under the "/api" path.
  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
Angular is running in development mode.

This is the current result:

➜ bun --bun run dev
$ ng serve

The '@analogjs/platform' successfully started.
The server endpoints are accessible under the "/api" path.
error: script "dev" exited with code 11 (SIGSEGV)
Here is a debug log ```sh [stream] length less than watermark true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.constructed? true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] reading, ended or constructing false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] n @ fromList 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] ret @ read null undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.length while ret = null 0 undefined [JSC] fromFIFO (src/bun.js/webcore/streams.zig:288) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [JSC] fromNative (src/bun.js/webcore/streams.zig:248) [JSC] fromJS (src/bun.js/webcore/streams.zig:200) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] in flowing mode! undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] resume undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read - n = 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] need readable false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] length less than watermark true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] do read undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable._read undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] ptr @ NativeReadable._read 5647885796864 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable not constructed yet undefined [JSC] start (src/bun.js/webcore/streams.zig:2971) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable internal `start` result 65536 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable resized undefined [JSC] drain (src/bun.js/webcore/streams.zig:3038) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable drain result undefined undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] chunk @ #getRemainingChunk undefined undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] #internalRead() undefined [JSC] pull (src/bun.js/webcore/streams.zig:2957) [CPP] JSValue__asArrayBuffer_ [FilePoll] register: readable (19) [bun] poll(19) readable: true (17) [SYS] read(19, 16384) = 0 (0.002ms) [FilePoll] unregister: readable (19) [SYS] close(19) [CPP] JSValue__jsBoolean [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] result, isClosed @ #handleResult false false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] n @ fromList 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] ret @ read null undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.length while ret = null 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read - n = undefined undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] need readable true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] length less than watermark true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.constructed? true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] reading, ended or constructing false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] n @ fromList 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] ret @ read null undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.length while ret = null 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read - n = undefined undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] need readable false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] length less than watermark true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.constructed? true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] reading, ended or constructing false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] n @ fromList 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] ret @ read null undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] state.length while ret = null 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] readableAddChunk null undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read - n = undefined undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read: calling endReadable if length 0 -- length, state.ended 0 true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] endEmitted @ endReadable false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] readableAddChunk null undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read - n = undefined undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] read: calling endReadable if length 0 -- length, state.ended 0 true undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] endEmitted @ endReadable false undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] endReadableNT -- endEmitted, state.length false 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] end emitted @ endReadableNT undefined [JSC] updateRef (src/bun.js/webcore/streams.zig:3016) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable destroyed undefined [JSC] cancel (src/bun.js/webcore/streams.zig:3000) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] endReadableNT -- endEmitted, state.length false 0 undefined [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] end emitted @ endReadableNT undefined [JSC] updateRef (src/bun.js/webcore/streams.zig:3016) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSValue__isBoolean [CPP] JSValue__jsType [CPP] JSGlobalObject__vm [CPP] JSValue__isCallable [CPP] JSValue__toZigString [JSC] ascii (src/bun.js/bindings/bun-simdutf.zig:105) [stream] NativeReadable destroyed undefined [JSC] cancel (src/bun.js/webcore/streams.zig:3000) [CPP] JSGlobalObject__handleRejectedPromises [CPP] JSGlobalObject__vm [CPP] VM__releaseWeakRefs [CPP] VM__drainMicrotasks [CPP] JSGlobalObject__vm [CPP] JSGlobalObject__handleRejectedPromises [FilePoll] writable [FilePoll] hup [FilePoll] onUpdate kevent (fd: 16) FileSink [FilePoll] proc [FilePoll] onUpdate kevent (fd: 92925) Subprocess [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [FilePoll] unregister: process (92925) skipped due to needs_rearm [JSC] get (src/bun.js/Strong.zig:11) [JSC] clear (src/bun.js/Strong.zig:21) [JSC] callWithThis (src/bun.js/bindings/bindings.zig:3493) [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__bunVM [CPP] JSGlobalObject__vm [CPP] VM__collectAsync [CPP] VM__blockBytesAllocated [CPP] JSGlobalObject__vm [CPP] VM__blockBytesAllocated [CPP] VM__collectAsync [JSC] dispatchOnBeforeExit (src/bun.js/javascript.zig:351) [CPP] JSGlobalObject__handleRejectedPromises [JSC] dispatchOnExit (src/bun.js/javascript.zig:343) [JSC] fixDeadCodeElimination (src/napi/napi.zig:1500) ```
birkskyum commented 11 months ago

Progress here, the server now starts:

➜ bun --bun run dev        
$ ng serve

The server endpoints are accessible under the "/api" path.
  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose

.. But the browser console prints:

chunk-5IIG6E4R.js?v=75eac2fb:6307 Uncaught Error: 
The injectable '_PlatformLocation' needs to be compiled using the
JIT compiler, but '@angular/compiler' is not available.
birkskyum commented 11 months ago

Finds this too:

➜ bun --bun run dev     
$ ng serve

The '@analogjs/platform' successfully started.
The server endpoints are accessible under the "/api" path.
[bun] Warning: worker_threads.Worker option "argv" is not implemented.
[bun] Warning: worker_threads.Worker option "execArgv" is not implemented.
[bun] Warning: worker_threads.Worker option "resourceLimits" is not implemented.
  ➜  Local:   http://localhost:5173/
birkskyum commented 11 months ago

The error is:

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
12:06:04 AM [vite] Error when evaluating SSR module ~analog/entry-server: failed to import "zone.js/node"
|- TypeError: undefined is not an object (evaluating 'proto.hasOwnProperty(name)')
    at hasOwnProperty (native)
    at patchMethod (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:933:46)
    at <anonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:1515:86)
    at <anonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:115:57)
    at <anonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:1006:52)
    at <anonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:20:16)
    at <anonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:22:4)
    at global code (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:1574:8)
    at processTicksAndRejections (:55:39)

If I open the browser, I see the html printed out like this:


              <!DOCTYPE html>
              <html lang="en">
                <head>
                  <meta charset="UTF-8" />
                  <title>Error</title>
                  <script type="module">
                    import { ErrorOverlay } from '/@vite/client'
                    document.body.appendChild(new ErrorOverlay({"message":"An error occured while server rendering /index.html:\n\n\tundefined is not an object (evaluating 'proto.hasOwnProperty(name)') ","stack":"TypeError: undefined is not an object (evaluating 'proto.hasOwnProperty(name)')\n    at hasOwnProperty (native)\n    at patchMethod (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:933:46)\n    at \u003canonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:1515:86)\n    at \u003canonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:115:57)\n    at \u003canonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:1006:52)\n    at \u003canonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:20:16)\n    at \u003canonymous> (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:22:4)\n    at global code (/Users/admin/repos/analog-project/node_modules/zone.js/bundles/zone-node.umd.js:1574:8)\n    at processTicksAndRejections (:55:39)"}))
                  </script>
                </head>
                <body>
                </body>
              </html>       
benpsnyder commented 11 months ago

This issue with zone.js is also where I am stuck when using the --bun option. I tweeted @brandonroberts on this as well though I am almost sure he's seen this thread.

sp90 commented 11 months ago

@benpsnyder Yeah but its not a zone.js problem its a bun problem or atleast i believe it should be fixed here instead of having a workaround in angular to make bun a true drop in replacement

It's basically a problem with using hasOwnProperty() on the globalThis that breaks the bun runtime

birkskyum commented 8 months ago
birkskyum commented 7 months ago

For angular-17, the bun --bun run dev gives this:

⇣7% ➜ bun --bun run dev
$ ng serve
An unhandled exception occurred: Failed to set property with field ``
See "/private/var/folders/8y/htw2q5ss5ms9zy4z8rfv393c0000gn/T/ng-cUsgF8/angular-errors.log" for further details.
error: script "dev" exited with code 127
birkskyum commented 7 months ago

For angular-16, the bun --bun run dev gives this:

The server endpoints are accessible under the "/api" path.
  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
Failed to resolve entry for package "@analogjs/router". The package may have incorrect main/module/exports specified in its package.json: undefined is not an object (evaluating 'data.browser["."]')
Angular is running in development mode.
Angular is running in development mode.
3:36:48 PM [vite] Internal server error: Failed to resolve entry for package "@analogjs/router". The package may have incorrect main/module/exports specified in its package.json: undefined is not an object (evaluating 'data.browser["."]')
  Plugin: vite:import-analysis
  File: /Users/admin/repos/bun-kitchensink/analog-project/src/app/app.config.ts:8270:18
      at packageEntryFailure (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:28726:40)
      at resolvePackageEntry (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:8265:24)
      at tryNodeResolve (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:8125:25)
      at <anonymous> (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:7955:33)
      at processTicksAndRejections (:61:39)
3:36:48 PM [vite] Internal server error: Failed to resolve entry for package "@analogjs/router". The package may have incorrect main/module/exports specified in its package.json: undefined is not an object (evaluating 'data.browser["."]')
  Plugin: vite:import-analysis
  File: /Users/admin/repos/bun-kitchensink/analog-project/src/app/app.config.ts:8270:18
      at packageEntryFailure (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:28726:40)
      at resolvePackageEntry (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:8265:24)
      at tryNodeResolve (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:8125:25)
      at <anonymous> (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:7955:33)
      at processTicksAndRejections (:61:39) (x2)
^C
TypeError: client.terminate is not a function. (In 'client.terminate()', 'client.terminate' is undefined)                          
    at <anonymous> (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:61943:27)
    at forEach (:1:11)
    at <anonymous> (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:22094:28)
    at new ZoneAwarePromise (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/zone.js/fesm2015/zone-node.js:1249:31)
    at close (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:22093:25)
    at <anonymous> (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:22726:17)
    at close (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/dist/node/chunks/dep-68d1a114.js:22719:21)
    at <anonymous> (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/@analogjs/platform/node_modules/@nx/vite/src/executors/dev-server/dev-server.impl.js:50:25)
    at processOnExit (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/@analogjs/platform/node_modules/@nx/vite/src/executors/dev-server/dev-server.impl.js:49:38) {
  originalLine: 22095,
  originalColumn: 27
}
1105 |                   command: "rebuild",
1106 |                   key: buildKey
1107 |                 };
1108 |                 sendRequest(refs, request2, (error2, response2) => {
1109 |                   if (error2) {
1110 |                     reject(new Error(error2));
                                  ^
error: The service was stopped
      at /Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/node_modules/esbuild/lib/main.js:1110:28
      at /Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/node_modules/esbuild/lib/main.js:703:9
      at afterClose (/Users/admin/repos/bun-kitchensink/analog-project/node_modules/vite/node_modules/esbuild/lib/main.js:693:7)
      at endReadableNT (node:stream:2387:53)
      at processTicksAndRejections (:61:77)
vicentematus commented 6 months ago

Thanks for keeping updated this thread. I'm trying to migrate from Jest to Vitest using the analog package. Plus using Bun as a runtime in Angular would be a great help to make test run more faster. We have a lot of test suites and Jest takes like 20min to run on our pipelines on Github Actions. On AWS its 10 minutes.

sp90 commented 6 months ago

@vicentematus I got bun tests and running angular/ssr on this repo also going zoneless https://github.com/sp90/treaty maybe you can find some resolutions to your challanges

We're still blocked by a few things in a bun to build angular as well using bun which we hope to get through post windows support aka 1.1

vicentematus commented 6 months ago

@sp90 this looks good. Specially SSR on Angular for heavy enterprises applications + Bun = Speed. Also nice detach from using Zone.js.

We are on Angular 16 as SPA, but the main blocker is using Jest (and jest-preset-angular) as the testing runner. From what I've read from Jarred twitter is there's some issues with Bun and the CLI of Jest (idk if they fixed it yet).

Maybe an alternative I was thinking was to migrate to Vitest using the @analog package and then use Bun from there. What are your thoughts on that to speed up the test runners?

birkskyum commented 6 months ago

@sp90 this looks good. Specially SSR on Angular for heavy enterprises applications + Bun = Speed. Also nice detach from using Zone.js.

We are on Angular 16 as SPA, but the main blocker is using Jest (and jest-preset-angular) as the testing runner. From what I've read from Jarred twitter is there's some issues with Bun and the CLI of Jest (idk if they fixed it yet).

Maybe an alternative I was thinking was to migrate to Vitest using the @analog package and then use Bun from there. What are your thoughts on that to speed up the test runners?

It doesn't really belong in this ticket, but there is also bun test.

birkskyum commented 3 months ago

getting this (i do not have node 21 installed):

➜ bun --bun run dev
$ ng serve
Node.js version v21.6.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/previous-releases/.
  🔍 @nx/nx-darwin-universal [1/1] 
error: package "@nx/nx-darwin-universal" not found registry.npmjs.org/@nx%2fnx-darwin-universal 404
An unexpected error occurred: ResolveMessage: Cannot find module "nx/src/utils/code-frames" from "/Users/admin/.bun/install/cache/@nx/js@18.0.8/src/utils/typescript/run-type-check.js"
  🔍 Resolving [2/1] error: script "dev" exited with code 1
birkskyum commented 2 months ago

Getting this now:

➜ bun --bun run dev
$ ng serve
  🔍 @nx/nx-darwin-universal [1/1] 
error: package "@nx/nx-darwin-universal" not found registry.npmjs.org/@nx%2fnx-darwin-universal 404

 NX   Failed to parse bun lockfile

Please open an issue at `https://github.com/nrwl/nx/issues/new?template=1-bug.yml` and provide a reproduction.

Original error: FileNotFound while resolving package "@yarnpkg/parsers" from "/Users/admin/.bun/install/cache/nx@19.1.1/src/plugins/js/lock-file/yarn-parser.js"

An unhandled exception occurred: undefined is not an object (evaluating 'error.stack.split')
See "/private/var/folders/8y/htw2q5ss5ms9zy4z8rfv393c0000gn/T/ng-2G4cXQ/angular-errors.log" for further details.
undefined

error: script "dev" exited with code 127
benpsnyder commented 2 months ago

FYI this testing repo is also relevant. https://github.com/benpsnyder/nx-bun-testing

brandonroberts commented 2 months ago

I also put together a repo a while back that builds using the bun runtime. The exception is that it uses the vite commands directly instead ng for serving and building.

https://github.com/brandonroberts/analog-bun-ssr-example