@antv/g6
Version:
graph visualization frame work
65 lines (59 loc) • 2.85 kB
JavaScript
var plugins = [{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_gatsby-plugin-react-helmet@3.1.14@gatsby-plugin-react-helmet/gatsby-ssr'),
options: {"plugins":[]},
},{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_gatsby-remark-autolink-headers@2.1.17@gatsby-remark-autolink-headers/gatsby-ssr'),
options: {"plugins":[]},
},{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_gatsby-plugin-offline@3.0.20@gatsby-plugin-offline/gatsby-ssr'),
options: {"plugins":[]},
},{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_gatsby-plugin-manifest@2.2.27@gatsby-plugin-manifest/gatsby-ssr'),
options: {"plugins":[],"name":"gatsby-starter-default","short_name":"starter","start_url":"/","background_color":"#722ED1","theme_color":"#722ED1","display":"minimal-ui","icon":"/Users/moyee/ant-repo/github/g6/node_modules/_@antv_gatsby-theme-antv@0.9.49@@antv/gatsby-theme-antv/site/images/favicon.png"},
},{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_gatsby-plugin-layout@1.1.14@gatsby-plugin-layout/gatsby-ssr'),
options: {"plugins":[],"component":"/Users/moyee/ant-repo/github/g6/node_modules/_@antv_gatsby-theme-antv@0.9.49@@antv/gatsby-theme-antv/site/layouts/layout.tsx"},
},{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_gatsby-plugin-google-analytics@2.1.26@gatsby-plugin-google-analytics/gatsby-ssr'),
options: {"plugins":[],"trackingId":"UA-148148901-4"},
},{
plugin: require('/Users/moyee/ant-repo/github/g6/node_modules/_@antv_gatsby-theme-antv@0.9.49@@antv/gatsby-theme-antv/gatsby-ssr'),
options: {"plugins":[],"GATrackingId":"UA-148148901-4","pathPrefix":"/G6"},
}]
// During bootstrap, we write requires at top of this file which looks like:
// var plugins = [
// {
// plugin: require("/path/to/plugin1/gatsby-ssr.js"),
// options: { ... },
// },
// {
// plugin: require("/path/to/plugin2/gatsby-ssr.js"),
// options: { ... },
// },
// ]
const apis = require(`./api-ssr-docs`)
// Run the specified API in any plugins that have implemented it
module.exports = (api, args, defaultReturn, argTransform) => {
if (!apis[api]) {
console.log(`This API doesn't exist`, api)
}
// Run each plugin in series.
// eslint-disable-next-line no-undef
let results = plugins.map(plugin => {
if (!plugin.plugin[api]) {
return undefined
}
const result = plugin.plugin[api](args, plugin.options)
if (result && argTransform) {
args = argTransform({ args, result })
}
return result
})
// Filter out undefined results.
results = results.filter(result => typeof result !== `undefined`)
if (results.length > 0) {
return results
} else {
return [defaultReturn]
}
}