ant-design/site/theme/index.js
偏右 8501b708ea refactor: 📦 smaller bundlesize limit (#20356)
* 📦 samller bundlesize limit

* 🗑️ remove React static PropTypes

* 🗑️ remove react-lifecycles-compat

* 🗑️ remove matchMedia polyfill

* 🗑️ remove Transfer buggy lazy prop

* 🗑️ remove enquire.js dep

* 🗑️ remove Transfer lazy related code and fix ci

* 🗑️ remove used dom-closest

*  replace dom-scroll-into-view to scroll-into-view for bundle size

*  fix eslint

* 🆙 upgrade browserslist

*  fix test cases

* 🗑️ remove @ant-design/create-react-context

* 🆙 upgrade @ant-design/bisheng-plugin

* 🆙 upgrade rc-slider

*  fix ci

* 🆙 upgrade rc-tabs and rc-mentions

* 📦 scroll-into-view -> scroll-into-view-if-needed

* remove unused devDep

* docs: 📝 update instruction about IE9/10

* 📦 reduce css bundle size by drop IE9/10 support

* 🆙 upgrade rc-upload

* 🗑️ drop unused swing motion css

*  update upload snapshots

* 📦 lift css bundlesize limit to 55kb
2019-12-23 18:33:08 +08:00

98 lines
2.2 KiB
JavaScript

const path = require('path');
const homeTmpl = './template/Home/index';
const contentTmpl = './template/Content/index';
const appShellTmpl = './template/AppShell';
function pickerGenerator(module) {
const tester = new RegExp(`^docs/${module}`);
return markdownData => {
const { filename } = markdownData.meta;
if (tester.test(filename) && !/\/demo$/.test(path.dirname(filename))) {
return {
meta: markdownData.meta,
};
}
return null;
};
}
module.exports = {
lazyLoad(nodePath, nodeValue) {
if (typeof nodeValue === 'string') {
return true;
}
return nodePath.endsWith('/demo');
},
pick: {
components(markdownData) {
const { filename } = markdownData.meta;
if (!/^components/.test(filename) || /[/\\]demo$/.test(path.dirname(filename))) {
return null;
}
return {
meta: markdownData.meta,
};
},
changelog(markdownData) {
if (/CHANGELOG/.test(markdownData.meta.filename)) {
return {
meta: markdownData.meta,
};
}
return null;
},
'docs/react': pickerGenerator('react'),
'docs/spec': pickerGenerator('spec'),
},
plugins: [
'bisheng-plugin-description',
'bisheng-plugin-toc?maxDepth=2&keepElem',
'@ant-design/bisheng-plugin?injectProvider',
'bisheng-plugin-react?lang=__react',
],
routes: {
path: '/',
component: './template/Layout/index',
indexRoute: { component: homeTmpl },
childRoutes: [
{
path: 'app-shell',
component: appShellTmpl,
},
{
path: 'index-cn',
component: homeTmpl,
},
{
path: 'docs/react/:children',
component: contentTmpl,
},
{
path: 'changelog',
component: contentTmpl,
},
{
path: 'changelog-cn',
component: contentTmpl,
},
{
path: 'components/form/v3',
component: contentTmpl,
},
{
path: 'components/form/v3-cn',
component: contentTmpl,
},
{
path: 'components/:children/',
component: contentTmpl,
},
{
path: 'docs/spec/:children',
component: contentTmpl,
},
],
},
};