mirror of
https://github.com/unjs/unplugin.git
synced 2025-12-08 20:26:33 +00:00
* loose start for bun plugin * implement bun * support emitFile() * fix Bun cases in integration test * add bun to other test files * remove bun-types-no-globals from github * restore bun-types-no-globals from npm @^1.2 * bun does not yet support .onEnd, so for now we shouldn't fake it with brittle workarounds * add Bun in the documentation * some missing bun references in docs * support multiple plugins * use Bun namespace instead of importing module that won't necessarily exist * Bun is a cute pink color! * fix the transform hook * fix for virtual modules * tidy up * setup bun in ci * revert unplugin require path * ignore bun in test-out folders * update tests * support onEnd * remove * implement guessLoader(), bun also now supports onEnd() * don't eat errors/warnings * we dont need to outdir for bun in this test * bun writebundle test * Update to bun@1.2.22 (supports onEnd and onResolve) * use onStart() * define onStart() in mocks * onStart * ci: run vitest in Bun so we can run bun's tests * Bun error message if building outside of Bun * skip bun specific tests when not running in bun * refactor * allow only * ci: fix typecheck --------- Co-authored-by: Kevin Deng <sxzz@sxzz.moe>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import * as rspack from '@rspack/core'
|
|
import * as esbuild from 'esbuild'
|
|
import * as rolldown from 'rolldown'
|
|
import * as rollup from 'rollup'
|
|
import * as vite from 'vite'
|
|
import * as webpack from 'webpack'
|
|
|
|
export * from '../../src/utils/general'
|
|
|
|
export const viteBuild: typeof vite.build = vite.build
|
|
export const rollupBuild: typeof rollup.rollup = rollup.rollup
|
|
export const rolldownBuild: typeof rolldown.build = rolldown.build
|
|
export const esbuildBuild: typeof esbuild.build = esbuild.build
|
|
export const webpackBuild: typeof webpack.webpack = webpack.webpack || (webpack as any).default || webpack
|
|
export const rspackBuild: typeof rspack.rspack = rspack.rspack
|
|
export const bunBuild: typeof Bun.build = typeof Bun !== 'undefined'
|
|
? Bun.build
|
|
: () => {
|
|
throw new ReferenceError('Bun.build does not exist in this environment. Please run your app with the Bun runtime.')
|
|
}
|
|
|
|
export const webpackVersion: string = ((webpack as any).default || webpack).version
|
|
|
|
export const build: {
|
|
webpack: typeof webpack.webpack
|
|
rspack: typeof rspackBuild
|
|
rollup: typeof rollupBuild
|
|
rolldown: typeof rolldownBuild
|
|
vite: typeof viteBuild
|
|
esbuild: typeof esbuildBuild
|
|
bun: typeof bunBuild
|
|
} = {
|
|
webpack: webpackBuild,
|
|
rspack: rspackBuild,
|
|
rollup: rollupBuild,
|
|
rolldown: rolldownBuild,
|
|
vite(config) {
|
|
return viteBuild(vite.mergeConfig(config || {}, {
|
|
build: {
|
|
rollupOptions: {
|
|
logLevel: 'silent',
|
|
},
|
|
},
|
|
logLevel: 'silent',
|
|
}))
|
|
},
|
|
esbuild: esbuildBuild,
|
|
bun: bunBuild,
|
|
}
|