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>
52 lines
2.0 KiB
TypeScript
52 lines
2.0 KiB
TypeScript
import { execSync } from 'node:child_process'
|
|
import { existsSync } from 'node:fs'
|
|
import { readdir, rm } from 'node:fs/promises'
|
|
import { join, resolve } from 'node:path'
|
|
import process from 'node:process'
|
|
import c from 'ansis'
|
|
|
|
const isBun = !!process.versions.bun
|
|
|
|
const dir = resolve(import.meta.dirname, '../test/fixtures')
|
|
let fixtures = await readdir(dir)
|
|
|
|
if (process.argv[2])
|
|
fixtures = fixtures.filter(i => i.includes(process.argv[2]))
|
|
|
|
for (const name of fixtures) {
|
|
const path = join(dir, name)
|
|
if (existsSync(join(path, 'dist')))
|
|
await rm(join(path, 'dist')).catch(() => {})
|
|
|
|
if (isBun) {
|
|
console.log(c.magentaBright.inverse.bold`\n Bun `, name, '\n')
|
|
execSync('bun --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('bun bun.config.js', { cwd: path, stdio: 'inherit' })
|
|
continue // skip other builders in bun environment
|
|
}
|
|
|
|
console.log(c.yellow.inverse.bold`\n Vite `, name, '\n')
|
|
execSync('npx vite --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('npx vite build', { cwd: path, stdio: 'inherit' })
|
|
|
|
console.log(c.red.inverse.bold`\n Rollup `, name, '\n')
|
|
execSync('npx rollup --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('npx rollup --bundleConfigAsCjs -c', { cwd: path, stdio: 'inherit' })
|
|
|
|
console.log(c.blue.inverse.bold`\n Webpack `, name, '\n')
|
|
execSync('npx webpack --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('npx webpack', { cwd: path, stdio: 'inherit' })
|
|
|
|
console.log(c.yellow.inverse.bold`\n Esbuild `, name, '\n')
|
|
execSync('npx esbuild --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('node esbuild.config.js', { cwd: path, stdio: 'inherit' })
|
|
|
|
console.log(c.cyan.inverse.bold`\n Rspack `, name, '\n')
|
|
execSync('npx rspack --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('npx rspack', { cwd: path, stdio: 'inherit' })
|
|
|
|
console.log(c.magenta.inverse.bold`\n Farm `, name, '\n')
|
|
execSync('npx farm --version', { cwd: path, stdio: 'inherit' })
|
|
execSync('npx farm build', { cwd: path, stdio: 'inherit' })
|
|
}
|