MCPcopy
hub / github.com/unjs/unplugin / createUnplugin

Function createUnplugin

src/define.ts:13–51  ·  view source on GitHub ↗
(
  factory: UnpluginFactory<UserOptions, Nested>,
)

Source from the content-addressed store, hash-verified

11import { getWebpackPlugin } from './webpack'
12
13export function createUnplugin<UserOptions, Nested extends boolean = boolean>(
14 factory: UnpluginFactory<UserOptions, Nested>,
15): UnpluginInstance<UserOptions, Nested> {
16 return {
17 get esbuild() {
18 return getEsbuildPlugin(factory)
19 },
20 get rollup() {
21 return getRollupPlugin(factory)
22 },
23 get vite() {
24 return getVitePlugin(factory)
25 },
26 get rolldown() {
27 return getRolldownPlugin(factory)
28 },
29 get webpack() {
30 return getWebpackPlugin(factory)
31 },
32 get rspack() {
33 return getRspackPlugin(factory)
34 },
35 get rsbuild() {
36 return getRsbuildPlugin(factory)
37 },
38 get farm() {
39 return getFarmPlugin(factory)
40 },
41 get unloader() {
42 return getUnloaderPlugin(factory)
43 },
44 get bun() {
45 return getBunPlugin(factory)
46 },
47 get raw() {
48 return factory
49 },
50 }
51}
52
53export function createEsbuildPlugin<UserOptions, Nested extends boolean = boolean>(
54 factory: UnpluginFactory<UserOptions, Nested>,

Callers 13

index.test.tsFile · 0.90
createMockedUnpluginFunction · 0.85
createUnpluginWithHooksFunction · 0.85
index.test.tsFile · 0.85
nested.test.tsFile · 0.85
namespace.test.tsFile · 0.85
unplugin.jsFile · 0.85
unplugin.jsFile · 0.85

Calls

no outgoing calls

Tested by 6

createMockedUnpluginFunction · 0.68
createUnpluginWithHooksFunction · 0.68