Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
203 additions
and
323 deletions.
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 |
---|---|---|
|
@@ -100,8 +100,6 @@ | |
"transpiling", | ||
"treeshake", | ||
"consola", | ||
"jiti", | ||
"JITI", | ||
"citty", | ||
"underfin", | ||
"UNKEYED", | ||
|
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/usr/bin/env node | ||
import('../cli/main.js') | ||
import('../dist/cli.mjs') |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
import { performance } from 'node:perf_hooks' | ||
import consola from 'consola' | ||
import { colors } from 'consola/utils' | ||
import { RolldownOptions, rolldown } from '../../index' | ||
import { RolldownConfigExport } from '../../types/rolldown-config-export' | ||
import { arraify } from '../../utils' | ||
|
||
export async function bundle(configExport: RolldownConfigExport) { | ||
const options = arraify(configExport) | ||
|
||
for (const option of options) { | ||
await bundleInner(option) | ||
} | ||
} | ||
|
||
async function bundleInner(options: RolldownOptions) { | ||
const start = performance.now() | ||
|
||
const build = await rolldown(options) | ||
|
||
const _output = await build.write(options?.output) | ||
|
||
consola.log( | ||
`Finished in ${colors.bold((performance.now() - start).toFixed(2))} ms`, | ||
) | ||
} |
File renamed without changes.
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,52 @@ | ||
import { defineCommand, runMain, showUsage } from 'citty' | ||
import consola from 'consola' | ||
import process from 'node:process' | ||
import path from 'node:path' | ||
import pkgJson from '../../package.json' assert { type: 'json' } | ||
import { loadConfig } from './utils.js' | ||
import { bundle } from './commands/bundle' | ||
|
||
const main = defineCommand({ | ||
meta: { | ||
name: 'rolldown', | ||
version: pkgJson.version, | ||
description: pkgJson.description, | ||
}, | ||
args: { | ||
config: { | ||
type: 'string', | ||
alias: 'c', | ||
description: | ||
'Use this config file (if argument is used but value is unspecified, defaults to rolldown.config.js)', | ||
}, | ||
help: { | ||
type: 'boolean', | ||
alias: 'h', | ||
description: 'Show this help message', | ||
}, | ||
}, | ||
async run(ctx) { | ||
if (ctx.args.help) { | ||
await showUsage(ctx.cmd) | ||
return | ||
} | ||
const cwd = process.cwd() | ||
let configPath | ||
if (ctx.args.config) { | ||
configPath = path.resolve(cwd, ctx.args.config) | ||
} else { | ||
configPath = path.resolve(cwd, 'rolldown.config.js') | ||
} | ||
|
||
const config = await loadConfig(configPath) | ||
|
||
if (!config) { | ||
consola.error(`No configuration found at ${configPath}`) | ||
process.exit(1) | ||
} | ||
|
||
await bundle(config) | ||
}, | ||
}) | ||
|
||
runMain(main) |
Oops, something went wrong.