forked from alibaba/hooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
208 lines (206 loc) · 5 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import { menus } from './hooks';
const packages = require('../packages/hooks/package.json');
export default {
// ssr: {},
exportStatic: {},
nodeModulesTransform: {
type: 'none',
exclude: [],
},
// https://github.com/alibaba/hooks/issues/2155
extraBabelIncludes: ['filter-obj'],
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
'antd',
],
[
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: false,
},
'fusion',
],
],
mode: 'site',
title: 'ahooks 3.0',
favicon: '/simple-logo.svg',
logo: '/logo.svg',
dynamicImport: {},
manifest: {},
hash: true,
alias: {
ahooks: process.cwd() + '/packages/hooks/src/index.ts',
'@ahooksjs/use-url-state': process.cwd() + '/packages/use-url-state/src/index.ts',
},
resolve: {
includes: ['docs', 'packages/hooks/src', 'packages/use-url-state'],
},
links: [
{
rel: 'stylesheet',
href: 'https://unpkg.com/@alifd/[email protected]/dist/next-noreset.min.css',
},
{ rel: 'stylesheet', href: '/style.css' },
],
navs: {
'zh-CN': [
{ title: '指南', path: '/zh-CN/guide' },
{ title: 'Hooks', path: '/zh-CN/hooks' },
{
title: '历史版本',
children: [
{
title: 'v2.x',
path: 'https://ahooks-v2.js.org/',
},
{
title: 'v1.x',
path: 'http://hooks.umijs.org/',
},
],
},
{ title: '更新日志', path: 'https://github.com/alibaba/hooks/releases' },
{ title: '国内镜像', path: 'https://ahooks.gitee.io/zh-CN' },
{ title: 'GitHub', path: 'https://github.com/alibaba/hooks' },
],
'en-US': [
{ title: 'Guide', path: '/guide' },
{ title: 'Hooks', path: '/hooks' },
{
title: 'Legacy Versions',
children: [
{
title: 'v2.x',
path: 'https://ahooks-v2.js.org/',
},
{
title: 'v1.x',
path: 'http://hooks.umijs.org/',
},
],
},
{ title: 'Releases', path: 'https://github.com/alibaba/hooks/releases' },
{ title: '国内镜像', path: 'https://ahooks.gitee.io/zh-CN' },
{ title: 'GitHub', path: 'https://github.com/alibaba/hooks' },
],
},
menus: {
'/': [
{
title: 'Home',
path: 'index',
},
],
'/zh-CN': [
{
title: '首页',
path: 'index',
},
],
'/guide': [
{
title: 'Intro',
path: '/guide',
},
{
title: 'v2 to v3',
path: '/guide/upgrade',
},
{
title: 'Hooks of dom specification',
path: '/guide/dom',
},
{
title: 'Blog',
children: [
{
title: 'ahooks function specification',
path: '/guide/blog/function',
},
{
title: 'React Hooks & SSR',
path: '/guide/blog/ssr',
},
{
title: 'React Hooks & react-refresh(HMR)',
path: '/guide/blog/hmr',
},
{
title: 'React Hooks & strict mode',
path: '/guide/blog/strict',
},
],
},
],
'/zh-CN/guide': [
{
title: '介绍',
path: '/guide',
},
{
title: 'v2 to v3',
path: '/guide/upgrade',
},
{
title: 'DOM 类 Hooks 使用规范',
path: '/guide/dom',
},
{
title: 'Blog',
children: [
{
title: 'ahooks 输入输出函数处理规范',
path: '/zh-CN/guide/blog/function',
},
{
title: 'React Hooks & SSR',
path: '/zh-CN/guide/blog/ssr',
},
{
title: 'React Hooks & react-refresh(HMR)',
path: '/zh-CN/guide/blog/hmr',
},
{
title: 'React Hooks & strict mode',
path: '/zh-CN/guide/blog/strict',
},
],
},
],
'/hooks': menus,
'/zh-CN/hooks': menus,
},
scripts: [
'https://s4.cnzz.com/z_stat.php?id=1278992092&web_id=1278992092',
`
const insertVersion = function() {
const logo = document.querySelector('.__dumi-default-navbar-logo');
if (!logo) return;
const dom = document.createElement('span');
dom.id = 'logo-version';
dom.innerHTML = '${packages.version}';
logo.parentNode.insertBefore(dom, logo.nextSibling);
};
const observer = new MutationObserver((mutationsList, observer) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
const logoVersion = document.querySelector('#logo-version');
if (logoVersion) {
observer.disconnect();
} else {
insertVersion();
}
}
}
});
observer.observe(document.body, { childList: true, subtree: true });
`,
],
};