forked from timreichen/Bundler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
43 lines (41 loc) · 1.13 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Bundler } from "./bundler.ts";
import { HTMLPlugin } from "./plugins/html/html_plugin.ts";
import { CSSPlugin } from "./plugins/css/css_plugin.ts";
import { JSONPlugin } from "./plugins/json/json_plugin.ts";
import { WebManifestPlugin } from "./plugins/json/webmanifest_plugin.ts";
import { TypescriptPlugin } from "./plugins/typescript/typescript_plugin.ts";
import { TerserPlugin } from "./plugins/typescript/terser_plugin.ts";
import { FilePlugin } from "./plugins/file/file.ts";
import {
CreateAssetsContext,
CreateBundlesContext,
CreateChunksContext,
} from "./plugins/plugin.ts";
export {
Bundler,
CSSPlugin,
FilePlugin,
HTMLPlugin,
JSONPlugin,
TerserPlugin,
TypescriptPlugin,
WebManifestPlugin,
};
export function bundle(
inputs: string[],
options?: Partial<
CreateAssetsContext & CreateChunksContext & CreateBundlesContext
>,
) {
const plugins = [
new HTMLPlugin(),
new CSSPlugin(),
new TypescriptPlugin(),
new JSONPlugin(),
new WebManifestPlugin(),
new TerserPlugin(),
new FilePlugin(),
];
const bundler = new Bundler({ plugins });
return bundler.bundle(inputs, options);
}