24 Commits

Author SHA1 Message Date
Jarred Sumner
ecd23df4ca Fix banner positioning with --format=cjs --target=bun (#22641)
## Summary
- Fixes incorrect banner positioning when using `--banner` with
`--format=cjs` and `--target=bun`
- Ensures Bun-specific comments (`// @bun @bun-cjs`) appear before user
banner content
- Properly extracts and positions hashbangs from banner content

## Problem
When using `--banner` with `--format=cjs --target=bun`, the banner was
incorrectly placed before the `// @bun @bun-cjs` comment and CJS wrapper
function, breaking the module format that Bun expects.

## Solution
Implemented proper ordering:
1. **Hashbang** (from source file or extracted from banner if it starts
with `#!`)
2. **@bun comments** (e.g., `// @bun`, `// @bun @bun-cjs`, `// @bun
@bytecode`)
3. **CJS wrapper** `(function(exports, require, module, __filename,
__dirname) {`
4. **Banner content** (excluding any extracted hashbang)

## Test plan
- [x] Added comprehensive tests for banner positioning with CJS/ESM and
Bun target
- [x] Tests cover hashbang extraction from banners
- [x] Tests verify proper ordering with bytecode generation
- [x] All existing tests pass

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-14 01:01:22 -07:00
Jarred Sumner
822445d922 Unskip more bundler tests (#22244)
### What does this PR do?

### How did you verify your code works?


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
* Enabled multiple previously skipped bundler and esbuild test cases by
removing todo flags, increasing test suite coverage.
* Broadened cross-platform applicability by removing OS-specific gating
in certain tests, ensuring they run consistently across environments.
* Activated additional scenarios around resolve/load behavior, dead code
elimination, package.json handling, and extra edge cases.
* No impact on runtime behavior or public APIs; changes are limited to
test execution and reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-29 18:16:02 -07:00
Alistair Smith
300f486125 Bundler changes to bring us closer to esbuild's api (#22076)
### What does this PR do?

- Implements .onEnd

Fixes #22061

Once #22144 is merged, this also fixes:
Fixes #9862
Fixes #20806

### How did you verify your code works?

Tests

---

TODO in a followup (#22144)
> ~~Make all entrypoints be called in onResolve~~
> ~~Fixes # 9862~~
> ~~Fixes # 20806~~

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-26 01:50:32 -07:00
Zack Radisic
dacb75dc1f Fix crash in bundler related to onLoad plugins that return file loader for HTML imports (#20849) 2025-07-07 01:07:03 -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
77a5906123 Enable locally-passing bundler plugin tests (#16411) 2025-01-15 03:07:00 -08:00
Ashcon Partovi
e8b85cff40 ci: Retry and detect flaky tests (#15798) 2024-12-16 17:04:33 -08:00
dave caruso
dc01a5d6a8 feat(DevServer): batch bundles & run them asynchronously (#15181)
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2024-11-25 18:55:47 -08:00
dave caruso
dd6554294e bake: release to canary only (#14258)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-10-03 00:52:14 -07:00
Jarred Sumner
cd6785771e run prettier and add back format action (#13722) 2024-09-03 21:32:52 -07:00
Ashcon Partovi
d105b048b1 Use Buildkite for CI (#11477) 2024-06-27 14:56:07 -07:00
Meghan Denny
8afcb39055 windows: more tests are passing (#8873) 2024-02-12 17:52:14 -08:00
dave caruso
2d7df726fd fix: get bun build working on window (#8712)
* work on bundler

* a

* YAAAAYYAYAYAYYAYA

* get some more bundler tests working

* Update src/bundler/bundle_v2.zig

* rev

* ok

* i converted the cmakelists into LF

* personal review

* we didnt win

* okey they pass

* revert :(

* a

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-08 17:56:26 -08:00
dave caruso
072f2f15ea ci: run windows tests and also run them concurrently (#7758) 2024-01-12 17:02:20 -08:00
Colin McDonnell
c4f237572d Update macro/test docs (#3180)
* Add test and fix plugin type

* Update docs and config pages
2023-06-02 17:43:51 -07:00
dave caruso
4378ef8e97 mark currently known test fails as .todo (#3052)
* start this

* commit

* mark all failing tests as todo

* fasdfad

* bundler tests

* tests

* adjust failing tests to todo

* comment out some more tests

* png as test
2023-06-01 14:37:35 -07:00
dave caruso
29572737ab bundler testing (#2886)
* bundler testing

* add requireVarThenExport test

* work towards adding more esbuild tests

* tests

* remove this file
2023-05-15 21:18:52 -07:00
Jarred Sumner
02a8f99629 sort more 2023-05-12 07:27:15 -07:00
dave caruso
dfd0f3e252 Allow reading config from within plugins, and partially implement esbuild initialOptions (#2861)
* Implement plugin build.config and initialOptions

* update types

* default initialoptions entrypoints
2023-05-11 22:58:41 -04:00
dave caruso
5e366872f6 implement build api define and loaders (#2805)
* parse error logs

* clean up types

* remove --jsx-production. use NODE_ENV instead

* add define to js api

* add loaders to js api

* fixups

* sourcemap

* typo fix

* remove label, comment dir just for now

* test tweaks

* test work

* make optional enums actually optional.
allows `sourcemap: undefined`

* overload host ram test

* string tests

* tests

* test for 2815

* requested changes

* sort this list

* remove this test file now that it passes

* oops

* add --format

* finish ts tests

* doc typos related to define and loader
2023-05-08 21:55:21 -07:00
Jarred Sumner
2d0eaf9842 Fix broken test 2023-05-03 15:32:15 -07:00
dave caruso
96e113f41c bundler tests: rest of default.test.ts and starting jsx tests (#2765) 2023-04-28 21:08:48 -07:00
dave caruso
5b76ee769e bundler tests! (#2741)
* bundler tests!

* tests
2023-04-26 21:57:49 -07:00
dave caruso
0846a4fa80 bundler tests, testing plugins (#2740)
* add cjs2esm stuff

* tests

* plugin testing
2023-04-25 19:13:39 -07:00