UNPKG

beesbuild

Version:

构建工具链

25 lines (24 loc) 552 B
import { createFilter } from "@rollup/pluginutils"; import { mergeWith } from "lodash-unified"; const defaults = { include: [/\.(md|txt|css|htm|html)$/], exclude: [] }; function rawPlugin(options = {}) { options = mergeWith({}, defaults, options); const filter = createFilter(options.include, options.exclude); return { name: "cli-raw", transform(code, id) { if (filter(id)) { return { code: `export default ${JSON.stringify(code)}`, map: null }; } } }; } export { rawPlugin };