-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: experimental native bun support #156
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
45d593d
feat: support native bun imports
pi0 fe37dac
use require
pi0 b3e741a
add bun check
pi0 4afd09b
enable typescript fixture
pi0 955acc2
ci: add bun tests
pi0 5f30123
fix comment
pi0 d5049ef
fix tests
pi0 0b041b2
disable env too
pi0 352156d
implement fallback and interopDefault support
pi0 491d2b3
improve logs
pi0 1568ed1
add `--bun` flag`
pi0 3928982
use bun test
pi0 ddce6e9
refactor: move test to the top
pi0 c22822e
Merge branch 'main' into feat/bun-support
pi0 354220a
add todo hmr test
pi0 74ffa88
update hmr (still failing)
pi0 31210f7
fix test (silly me!)
pi0 cd0ed6c
remove extra debug
pi0 fe3e65b
fix: skip native bun if transform options are set
pi0 c23a87b
add experimental bun flag
pi0 c9242cc
fix ci
pi0 911b367
update ci
pi0 406797f
exp: disable coverage to compare spee
pi0 39e92f2
revert back --coverage
pi0 193392b
add coverage to both
pi0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
dist | ||
*.log* | ||
coverage | ||
.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { fileURLToPath } from "node:url"; | ||
import { readdir, writeFile, mkdir } from "node:fs/promises"; | ||
import { join } from "node:path"; | ||
// @ts-ignore | ||
import { test, expect } from "bun:test"; | ||
|
||
import jiti from "../lib/index.js"; | ||
|
||
const fixturesDir = fileURLToPath(new URL("fixtures", import.meta.url)); | ||
|
||
const fixtures = await readdir(fixturesDir); | ||
|
||
const _jiti = jiti(fixturesDir, { | ||
debug: true, | ||
interopDefault: true, | ||
requireCache: false, | ||
cache: false, | ||
}); | ||
|
||
for (const fixture of fixtures) { | ||
if (fixture.startsWith("error-")) { | ||
continue; | ||
} | ||
test("fixtures/" + fixture, () => { | ||
_jiti("./" + fixture); | ||
}); | ||
} | ||
|
||
test("hmr", async () => { | ||
await mkdir(join(fixturesDir, "../.tmp"), { recursive: true }); | ||
const tmpFile = join(fixturesDir, "../.tmp/bun.mjs"); | ||
|
||
let value; | ||
|
||
await writeFile(tmpFile, "export default 1"); | ||
value = _jiti(tmpFile); | ||
expect(value).toBe(1); | ||
|
||
await writeFile(tmpFile, "export default 2"); | ||
value = _jiti(tmpFile); | ||
expect(value).toBe(2); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about moving Bun detection into https://github.com/unjs/std-env?