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: rolldown cli first implementation #610
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
yarn.lock
Outdated
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.
We have switched to pnpm
from yarn
6e2a9ed
to
b417cda
Compare
This should also be written in TypeScript. |
This is expected. We plan to move this to |
@kazupon You could delay the support for |
packages/cli/lib/main.js
Outdated
|
||
/** | ||
* NOTE: | ||
* currenctly, It's hard to customize usage with citty `renderUsage`. |
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.
Please let me know or feel free to open an issue for what you like to be customizable or better rendered in citty usage renderer 👍🏼 :)
packages/cli/lib/main.js
Outdated
import { getPackageJSON } from './utils.js' | ||
|
||
const __dirname = path.dirname(new URL(import.meta.url).pathname) | ||
const { version, description } = getPackageJSON(path.resolve(__dirname, '..')) |
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.
You should be able to import .json
file directly while using node.
Just write import { version, description } from '../package.json'
and it should works.
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 am implementing cli based on es module. So the rolldown package must have "type": "module"
.
And in that case, node throw the following error when importing json:
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///path/to/rolldown/packages/rolldown/package.json" needs an import attribute of type "json
We must use import assertion as follow:
import pkgJson from '../package.json' assert { type: 'json' }
I use jiti for TS config loading. another show case, jiti also used in tailwind config loading. So I understand that I may use it to resolve TS configs. @pi0 |
3364c78
to
cf844b1
Compare
Something wrong with the filename conventions. You could add |
Hmm, 🤔 I've done basic implementation of build with config, and rolldown
You can try that: CONSOLA_LEVEL=4 node ./bin/cli.js -c test/fixtures/basic/rolldown.config.js |
I think this PR is good to go. Thank your wonderful work! @kazupon Let me takes this PR from here. With some thoughts come to my head, I will do some refactor.
|
cd337d1
to
ab832b2
Compare
@hyf0 Regarding the |
Glod to know that. Will look into |
okay! 👌 |
if you will use cli library, you can bundle with unbuild. |
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.
Again. Thank @kazupon for his great work.
bcb24ac
to
7d8fa5b
Compare
Description
related #599
This PR is support rolldown cli.
The first rolldown cli supports the
--config
option.The following is usage:
.js
,.mjs
, and.ts
(support esm only).--configPlugin
. rolldown cli does not use plugin, rollodown cli resolve it.Test Plan