-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Bun section to Getting started #2517
Conversation
Signed-off-by: Karl Horky <karl.horky@gmail.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2517 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 2693 2712 +19
Branches 2 2
=========================================
+ Hits 2693 2712 +19 ☔ View full report in Codecov by Sentry. |
|
|
|
Reading your alternatives section again, have you considered my point 6? It solves both the problems you highlight with the alternatives. |
Our use case was to run a Node.js script which imports We wanted to continue using So instead of taking the long way around by first using the |
Signed-off-by: Karl Horky <karl.horky@gmail.com>
Changes added for 4 and 6 in f188aa9 |
I was confused by this word because it is often used to differentiate between scripts vs modules. Scripts in browsers not having a way to import/export things. Or in Node, scripts using CJS.
Similarly,
The document you are editing contains a section on Node. We have a specific package for Node ( |
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.
I think it makes more sense to have the bun example in the bun section
No, actually I was not aware of this package until now. But since we were using |
Co-authored-by: Titus <tituswormer@gmail.com> Signed-off-by: Karl Horky <karl.horky@gmail.com>
Co-authored-by: Titus <tituswormer@gmail.com> Signed-off-by: Karl Horky <karl.horky@gmail.com>
Co-authored-by: Titus <tituswormer@gmail.com> Signed-off-by: Karl Horky <karl.horky@gmail.com>
Am I correct in understanding that currently you replaced Node/TSX with Bun? You dropped them? So, the earlier problem you had was how to use MDX with TSX but that was impossible? Are you still interested in using MDX with TSX? Or is Bun enough? |
Yes, from the reply in the tsx issue, I concluded that it is not possible to use For us, switching from tsx to Bun has no downsides and gives us a perf boost (we've done this for other scripts using tsx before too - for
Although we already have a solution for our projects, I'm interested in the option for other users / the ecosystem! It could potentially be an important thing for tsx users to have. Maybe with the Node.js loader it would be possible somehow? |
(Personally I don’t see the need for them, I believe URLs with
TSX is a Node loader and we have a Node loader too. You can use two loaders together |
docs/docs/getting-started.mdx
Outdated
preload = ["./bunMdxEsbuild.ts"] | ||
``` | ||
|
||
```js twoslash path="bunMdxEsbuild.ts" |
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.
One thing I wonder about is this casing in the filename? Is this a very strong recommendation by bun, to use camelcasing? Seems like that would fail on some file systems?
Should the name include esbuild, or is that a side effect of what the focus is: Bun + MDX?
How about a short:
preload = ["./bunMdxEsbuild.ts"] | |
``` | |
```js twoslash path="bunMdxEsbuild.ts" | |
preload = ["./mdx.ts"] | |
``` | |
```js twoslash path="mdx.ts" |
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.
bun-preload.ts
also seems viable?
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.
Is this a very strong recommendation by bun, to use camelcasing?
It was my own choice. Camel case in filenames are pretty common in JavaScript and TypeScript ecosystems. Seeing beginners work with camel case on a variety of operating systems, the errors that it causes are not very common and they can be warned against using ESLint and other tools. So I'm pretty pro-camel case I guess.
I think mdx.ts
is not expressive enough. If it should be lowercase (kebab case?) then at least bun-mdx.ts
or bun-mdx-plugin.ts
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.
OK, I’m very 👎 on camelcase in filenames, I only sometimes see React people use it more recently. It’s not used anywhere in the things I work on.
Did you see my 2nd suggestion, bun-preload.ts
?
My acceptable preferences in order are: bun-preload.ts
, mdx.ts
, bun.ts
, bun-mdx.ts
. All fine. They all answer “wait, why is this file here again?”. Can you choose which one you prefer?
I think the inclusion of “plugin” in bun-mdx-plugin.ts
is unneeded. Similar to “esbuild” bunMdxEsbuild.ts
. These terms have to do with how that file currently works internally.
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.
Ok, switched to bun-mdx.ts
in 3de41ee
Signed-off-by: Karl Horky <karl.horky@gmail.com>
@mdx-js/esbuild
section
Thank you! |
Glad to help, thanks for the review and merge! |
cc @Jarred-Sumner Bun in MDX docs 😍 |
Initial checklist
Description of changes
Add footnote to
@mdx-js/esbuild
section that Bun is supported via the esbuild-compatible plugin API (I confirmed support and Bun docs confirm it too)This actually also enables MDX eval support in scripts, which is not a straightforward thing to set up with
esbuild
(because the Transform API, used by programs liketsx
, does not support plugins)Alternatives considered
@mdx-js/esbuild
, so it could disappear at any timecmd-f
-> search for "Bun" on "Getting Started" page)