Dylan Conway
8fad98ffdb
Add Bun.YAML.parse and YAML imports ( #22073 )
...
### What does this PR do?
This PR adds builtin YAML parsing with `Bun.YAML.parse`
```js
import { YAML } from "bun";
const items = YAML.parse("- item1");
console.log(items); // [ "item1" ]
```
Also YAML imports work just like JSON and TOML imports
```js
import pkg from "./package.yaml"
console.log({ pkg }); // { pkg: { name: "pkg", version: "1.1.1" } }
```
### How did you verify your code works?
Added some tests for YAML imports and parsed values.
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-08-23 06:55:30 -07:00
Zack Radisic
5ca1580427
Fix assertion failure on Windows in resolver ( #21510 )
...
### What does this PR do?
We had `bun.strings.assertIsValidWindowsPath(...)` in the resolver, but
we can't do this because the path may come from the user. Instead, let
our error handling code handle it.
Also fixes #21065
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-07-30 23:33:09 -07:00
pfg
cb2887feee
Fix Bun.resolve() returning a promise throwing a raw exception instead of an Error ( #21302 )
...
I haven't checked all uses of tryTakeException but this bug is probably
not the only one.
Caught by running fuzzy-wuzzy with debug logging enabled. It tried to
print the exception. Updates fuzzy-wuzzy to have improved logging that
can tell you what was last executed before a crash.
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-25 12:46:33 -07:00
Dylan Conway
1a9bc5da09
fix(install): isolated install aliased dependency name fix ( #21138 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com >
Co-authored-by: Meghan Denny <meghan@bun.sh >
2025-07-19 01:59:52 -07:00
Meghan Denny
cc4f840e8b
test: remove accidental uses of test.only ( #20097 )
2025-07-16 23:07:23 -07:00
Jarred Sumner
2e02d9de28
Use ReadableStream.prototype.* in tests instead of new Response(...).* ( #20937 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Alistair Smith <hi@alistair.sh >
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
2025-07-14 00:47:53 -07:00
Jarred Sumner
2801cb1f4a
Fix TOML parser to handle inline tables and table arrays correctly ( #20291 )
...
Co-authored-by: Cursor Agent <cursoragent@cursor.com >
2025-06-09 18:52:30 -07:00
Jarred Sumner
14b439a115
Fix formatters not running in CI + delete unnecessary files ( #19433 )
2025-05-08 23:22:16 -07:00
Jarred Sumner
b47c3bb356
Fix crash involving importing invalid file URLs ( #19451 )
2025-05-02 22:44:07 -07:00
Christoph
b7c5bd0922
Fix crash on empty text file import ( #19165 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-04-25 23:42:41 -07:00
chloe caruso
5f9f200e7e
require.resolve with paths option ( #18851 )
2025-04-08 14:07:03 -07:00
Don Isaac
75144ab881
fix: reflect-metadata import order ( #18086 )
...
Co-authored-by: DonIsaac <22823424+DonIsaac@users.noreply.github.com >
2025-03-26 16:19:45 -07:00
nmarks
27cf0d5eaf
Remove references to developers former name ( #18319 )
...
Co-authored-by: chloe caruso <git@paperclover.net >
2025-03-20 00:53:46 -07:00
chloe caruso
b5cbf16cb8
module pr 2 ( #18266 )
2025-03-20 00:45:44 -07:00
pfg
d502df353c
Support import with { type: "json" } and others ( #16624 )
2025-03-06 15:04:29 -08:00
chloe caruso
322098fa54
allow resolution to work when the source file does not exist ( #16851 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-01-31 05:24:57 -08:00
Aiello
dd93f08215
feat(resolver): Add NODE_PATH support ( #14089 )
...
Co-authored-by: chloe caruso <git@paperclover.net >
2025-01-27 20:16:04 -08:00
Jarred Sumner
58678574a1
Fix importing with query strings at the end ( #16456 )
2025-01-16 23:16:11 -08:00
Michael H
70362c316e
allow importing bun.lock (+ types for it) ( #16244 )
...
Co-authored-by: RiskyMH <RiskyMH@users.noreply.github.com >
2025-01-12 20:08:56 -08:00
Don Isaac
81ecf7556c
ci: repair lint setup and run it in CI ( #15720 )
...
Co-authored-by: Don Isaac <don@bun.sh >
2025-01-08 07:12:18 +00:00
Jarred Sumner
c89a958299
Fixes #11754 ( #14948 )
2024-11-01 15:35:28 -07:00
Ciro Spaciari
f8d5b2e6e2
Fix module resolution cache keys ( #14901 )
...
Co-authored-by: dave caruso <me@paperdave.net >
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com >
2024-10-30 22:06:21 -07:00
Meghan Denny
6f60523e6c
" -> ' (#14776 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2024-10-23 19:21:36 -07:00
Jarred Sumner
8063e9d6b8
Fixes #14411 ( #14691 )
2024-10-20 22:02:44 +00:00
Jarred Sumner
4d4dd1c180
Refactor node:module ( #14227 )
2024-10-03 00:54:56 -07:00
Meghan Denny
25083a4252
pm: print command name to stdout ( #14266 )
2024-10-02 02:24:37 -07:00
snwy
c3197948c4
fixes --conditions for bun test ( #13902 )
2024-09-11 18:04:21 -07:00
Jarred Sumner
f0a4b9f96f
Copy fix from #13756 into separate PR ( #13783 )
...
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com >
2024-09-06 20:16:20 -07:00
Jarred Sumner
cd6785771e
run prettier and add back format action ( #13722 )
2024-09-03 21:32:52 -07:00
Jarred Sumner
9fd6a04460
Fix importing empty toml file at runtime ( #13252 )
2024-08-13 00:21:18 -07:00
Ashcon Partovi
d105b048b1
Use Buildkite for CI ( #11477 )
2024-06-27 14:56:07 -07:00
Jarred Sumner
40fcf25e01
Fixes "column must be greater than or equal to 0" error ( #11211 )
2024-05-21 11:19:18 -07:00
Jarred Sumner
024c274a3d
Support type import attribute with "text", "json", "toml", and "file" ( #10456 )
...
* Fixes #3449
Fixes https://github.com/oven-sh/bun/issues/10206
Fixes https://github.com/oven-sh/bun/issues/5710
* Apply formatting changes
* Update loaders.md
* Update text-loader-fixture-import.ts
* Add guide
* Update bundler_loader.test.ts
* Address comment
---------
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com >
2024-04-23 15:35:34 -07:00
Jarred Sumner
8a3b6f0439
Fixes #6730 ( #9930 )
...
* Fixes #6730
* Fix test
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2024-04-04 07:26:53 -07:00
Jarred Sumner
c8f5c9f29c
Fixes #9851 ( #9886 )
...
* Fixes #9851
* Fix
* Fix
2024-04-03 21:02:02 -07:00
dave caruso
9e6e8b0234
feat(runtime): align import.meta.resolve with node.js's implementation ( #5827 )
...
* works
* works
* a
* fix zig compiler error
* fix things
* [autofix.ci] apply automated fixes
* a
* not done
* finish this
* [autofix.ci] apply automated fixes
* self check
* delete committed generated file (#9717 )
* Fix bug with PipeWriter (#9714 )
* fix!: do not lookup cwd in which (#9691 )
* do not lookup cwd in which
* fix webkit submodule
* fix compilation on linux
* feedback
* default process.env.NODE_ENV to undefined (#9695 )
* small changes
* [autofix.ci] apply automated fixes
* fix(windows) fix node-stream tests/ windows file reader/writer (#9718 )
* fix canceled onFileRead
* report continue errors and fix closing
* also fix pipe writer
* avoid possible memory leaks
* Propagate errors in open
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
* posix failures
* windows fixes
* avoid using c++ labels
* add a resolver
* fix compile test AGAIN
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Meghan Denny <hello@nektro.net >
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com >
2024-04-01 02:21:34 -07:00
Meghan Denny
7f71f10ad1
import-meta.test.js: isolate the query param test into separate cases for esm and cjs ( #9750 )
...
* import-meta.test.js: isolate the query param test into separate cases for esm and cos
* make name more accurate
2024-03-30 20:09:01 -07:00
Jarred Sumner
0948727243
Fixes #9521 ( #9530 )
...
* Fixes #9521
* Another test
* Update load-file-loader-a-lot.test.ts
* Update module_loader.zig
* comments
* Rename variable
* Update module_loader.zig
* Update exports.zig
* small cleanup
* bundows
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2024-03-21 00:06:24 -07:00
dave caruso
b1719f3a70
make import.meta behave better when query string is provided ( #9399 )
...
* make import.meta actually use a vali url
* a
2024-03-15 22:44:23 -07:00
Igor Wessel
dcf6f244a4
feat: add support --conditions flag ( #9106 )
...
* feat(options): add possibility to append a custom esm condition
* feat(cli): parse --conditions flag
* test: add case for custom conditions
* fix(cli): not get short-hand --conditions flag
* test: add case using cjs with custom condition
* fix(options): address possible memory issues for esm conditions
* refactor(cli): remove -c alias for --conditions flag
* test: add cases for multiple --conditions specified
* test(bundler): add support to test --conditions
* chore(cli): fix grammar mistakes in --conditions
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2024-03-01 18:57:45 -08:00
James Anderson
00cc2eae67
Fix tsconfig path longest prefix matching ( #8892 )
2024-02-14 08:23:45 -08:00
Jarred Sumner
47e7e004b1
Remove @known-failing-on-windows for tests which are no longer failing on windows
2024-01-24 21:03:32 -08:00
Georgijs
80bd3254cc
fix argv parsing on windows ( #8458 )
...
* fix argv parsing on windows
* directly use zig stdlib
* remove debug comments, fix double deinit
* change bun.argv() to return slices, not null-terminated pointers
* fix test on windows to escape file paths correctly
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2024-01-24 20:54:01 -08:00
dave caruso
eeb10f3f7d
fix(windows): fix node:url pathFromFileURL and fileURLFromPath and file url tests ( #8442 )
...
* yay for file urls
* swag
* oops
* merge conf
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-24 01:19:47 -08:00
Jarred Sumner
82b6a42a3c
Normalize more paths
2024-01-23 20:48:48 -08:00
Jarred Sumner
0974479655
Normalize slashes
2024-01-23 20:47:37 -08:00
Jarred Sumner
e848c3f226
Get Bun.write tests to pass on Windows and bun:sqlite tests to pass ( #8393 )
...
* Move ReadFile and WriteFile to separate file
* Use libuv for Bun.write()
* Update windows_event_loop.zig
* build
* Get bun-write tests to pass. Implement Bun.write with two files.
* UPdate
* Update
* Update failing test list
* update
* More
* More
* More
* More
* Mark the rest
* ok
* oops
* Update bun-write.test.js
* Update blob.zig
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Dave Caruso <me@paperdave.net >
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com >
2024-01-23 20:03:56 -08:00
dave caruso
072f2f15ea
ci: run windows tests and also run them concurrently ( #7758 )
2024-01-12 17:02:20 -08:00
Jarred Sumner
0783b4bf0e
Implement import.meta.{dirname, filename} for Node.js compatibility ( #8127 )
...
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2024-01-12 14:26:50 -08:00
James Anderson
c0ccdccbeb
fix(resolver): wildcard tsconfig path not including suffix ( #7612 )
...
* fix(resolver): wildcard tsconfig path not including suffix
* different approach
2023-12-13 23:19:20 -08:00