DrSensor / DrSensor/lume-plugins
Integrate some plugins with other plugins
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
- [ ] prevent duplicate plugins
```js
export default function(config) {
//...
const plugins = new Set(
options.plugins.map(its => its.name)
)
//...
return site => {
// ...
site.hooks.addXyzPlugin = plugin => {
if (!plugins.has(plugin.name)) {
// add plugin
}
}
site.hooks.hasXyzPlugin = plugin => plugins.has(
typeof plugin === "string" ? plugin : plugin.name
)
/** @example
```js
if (matchEsbuildConfig({
extensions, options: { target:"es5" }
})) addEsbuildPlugin(babel)
``` */
site.hooks.matchXyzConfig = config => {/* ... */}
}
}
```
---
- [ ] add plugin before/after other plugin
```js
site.hooks.afterXyzPlugin("plugin-a1", plugin({...}))
if (!site.hooks.hasXyzPlugin("plugin-a1"))
site.hooks.beforeXyzPlugin("plugin-b2", plugin({...}))
```
---
- [ ] babel for others
```js
import { babel as rollupBabel } from 'npm:@rollup/plugin-babel'
export default function(config) {
//...
return site => {
// ...
site.hooks.addRollupPlugin?.(rollupBabel(sameBabelConfig))
}
}
```
---
- [ ] rollup with others
```js
site.use(rollup())
import rollupEsbuild from "npm:rollup-plugin-esbuild"
site.hooks.addRollupPlugin(rollupEsbuild)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.