mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-30 06:56:22 +00:00
34 lines
735 B
TypeScript
34 lines
735 B
TypeScript
|
import { StaticResources } from '../resources'
|
||
|
import { PluginTypes } from './types'
|
||
|
|
||
|
export function getStaticResourcesFromPlugins(plugins: PluginTypes) {
|
||
|
const staticResources: StaticResources = {
|
||
|
css: [],
|
||
|
js: [],
|
||
|
}
|
||
|
|
||
|
for (const plugin of plugins.transformers) {
|
||
|
const res = plugin.externalResources
|
||
|
if (res?.js) {
|
||
|
staticResources.js = staticResources.js.concat(res.js)
|
||
|
}
|
||
|
if (res?.css) {
|
||
|
staticResources.css = staticResources.css.concat(res.css)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return staticResources
|
||
|
}
|
||
|
|
||
|
export * from './transformers'
|
||
|
export * from './filters'
|
||
|
export * from './emitters'
|
||
|
|
||
|
declare module 'vfile' {
|
||
|
// inserted in processors.ts
|
||
|
interface DataMap {
|
||
|
slug: string
|
||
|
filePath: string
|
||
|
}
|
||
|
}
|