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>
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import fs from 'node:fs/promises'
|
|
import { resolve } from 'node:path'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { onlyBun } from '../../../utils'
|
|
|
|
const r = (...args: string[]) => resolve(__dirname, '../dist', ...args)
|
|
|
|
describe('load-called-before-transform', () => {
|
|
it('vite', async () => {
|
|
const content = await fs.readFile(r('vite/main.js.mjs'), 'utf-8')
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Vite]')
|
|
})
|
|
|
|
it('rollup', async () => {
|
|
const content = await fs.readFile(r('rollup/main.js'), 'utf-8')
|
|
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Rollup]')
|
|
})
|
|
|
|
it('webpack', async () => {
|
|
const content = await fs.readFile(r('webpack/main.js'), 'utf-8')
|
|
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Webpack]')
|
|
})
|
|
|
|
it('esbuild', async () => {
|
|
const content = await fs.readFile(r('esbuild/main.js'), 'utf-8')
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Esbuild]')
|
|
})
|
|
|
|
it('rspack', async () => {
|
|
const content = await fs.readFile(r('rspack/main.js'), 'utf-8')
|
|
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Rspack]')
|
|
})
|
|
|
|
it('farm', async () => {
|
|
const content = await fs.readFile(r('farm/main.js'), 'utf-8')
|
|
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Farm]')
|
|
})
|
|
|
|
onlyBun('bun', async () => {
|
|
const content = await fs.readFile(r('bun/main.js'), 'utf-8')
|
|
|
|
expect(content).toContain('it is a msg -> through the load hook -> transform-[Injected Bun]')
|
|
})
|
|
})
|