Skip to content

Commit f56a4d6

Browse files
Jinbao1001xiaoxiaozombieJafc163
authored
feat: support mako build (ant-design#49109)
* feat: mako build init * chore: unlock * dep: overrides dumi@alpha1 * chore: lock * deps: update dumi version * test: 查看磁盘 * chore: ping dumi * chore: update deps * chore: update deps * chore: update deps * chore: fix loading * chore: ignore lint * deps: update dumi * fix: hydrate failed caused by modifyHtml * deps: update dumi * deps: update dumi * deps: update dumi version --------- Co-authored-by: xiaoxiao <[email protected]> Co-authored-by: 二货机器人 <[email protected]> Co-authored-by: afc163 <[email protected]>
1 parent fdee444 commit f56a4d6

File tree

5 files changed

+69
-93
lines changed

5 files changed

+69
-93
lines changed

.dumi/theme/common/ComponentChangelog/ComponentChangelog.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable global-require */
1+
/* eslint-disable global-require, import/no-unresolved */
22
import React from 'react';
33
import { BugOutlined, HistoryOutlined } from '@ant-design/icons';
44
import { Button, Drawer, Grid, Popover, Timeline, Typography } from 'antd';
@@ -142,9 +142,11 @@ interface ChangelogInfo {
142142
}
143143

144144
const useChangelog = (componentPath: string, lang: 'cn' | 'en'): ChangelogInfo[] => {
145+
const logFileName = `components-changelog-${lang}.json`;
146+
145147
const data = useFetch({
146148
key: `component-changelog-${lang}`,
147-
request: () => import(`../../../preset/components-changelog-${lang}.json`),
149+
request: () => import(`../../../preset/${logFileName}`),
148150
});
149151
return React.useMemo(() => {
150152
const component = componentPath.replace(/-/g, '');

.dumi/theme/plugin.ts

-44
Original file line numberDiff line numberDiff line change
@@ -181,26 +181,6 @@ const RoutesPlugin = (api: IApi) => {
181181
// exclude dynamic route path, to avoid deploy failed by `:id` directory
182182
.filter((f) => !f.path.includes(':'))
183183
.map((file) => {
184-
let globalStyles = '';
185-
186-
// Debug for file content: uncomment this if need check raw out
187-
// const tmpFileName = `_${file.path.replace(/\//g, '-')}`;
188-
// const tmpFilePath = path.join(api.paths.absOutputPath, tmpFileName);
189-
// fs.writeFileSync(tmpFilePath, file.content, 'utf8');
190-
191-
// extract all emotion style tags from body
192-
file.content = file.content.replace(
193-
/<style (data-emotion|data-sandpack)[\S\s]+?<\/style>/g,
194-
(s) => {
195-
globalStyles += s;
196-
197-
return '';
198-
},
199-
);
200-
201-
// insert emotion style tags to head
202-
file.content = file.content.replace('</head>', `${globalStyles}</head>`);
203-
204184
// 1. 提取 antd-style 样式
205185
const styles = extractEmotionStyle(file.content);
206186

@@ -217,30 +197,6 @@ const RoutesPlugin = (api: IApi) => {
217197
file.content = addLinkStyle(file.content, cssFile);
218198
});
219199

220-
// Insert antd style to head
221-
const matchRegex = /<style data-type="antd-cssinjs">([\S\s]+?)<\/style>/;
222-
const matchList = file.content.match(matchRegex) || [];
223-
224-
// Init to order the `@layer`
225-
let antdStyle = '@layer global, antd;';
226-
227-
matchList.forEach((text) => {
228-
file.content = file.content.replace(text, '');
229-
antdStyle += text.replace(matchRegex, '$1');
230-
});
231-
232-
const cssFile = writeCSSFile('antd', antdStyle, antdStyle);
233-
file.content = addLinkStyle(file.content, cssFile, true);
234-
235-
// Insert antd cssVar to head
236-
const cssVarMatchRegex = /<style data-type="antd-css-var"[\S\s]+?<\/style>/;
237-
const cssVarMatchList = file.content.match(cssVarMatchRegex) || [];
238-
239-
cssVarMatchList.forEach((text) => {
240-
file.content = file.content.replace(text, '');
241-
file.content = file.content.replace('<head>', `<head>${text}`);
242-
});
243-
244200
return file;
245201
}),
246202
);

.dumirc.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ import { version } from './package.json';
88

99
export default defineConfig({
1010
plugins: ['dumi-plugin-color-chunk'],
11+
manifest: {},
1112
conventionRoutes: {
1213
// to avoid generate routes for .dumi/pages/index/components/xx
1314
exclude: [new RegExp('index/components/')],
1415
},
15-
ssr: process.env.NODE_ENV === 'production' ? {} : false,
16+
ssr:
17+
process.env.NODE_ENV === 'production'
18+
? {
19+
builder: 'mako',
20+
}
21+
: false,
1622
hash: true,
1723
mfsu: false,
24+
mako: {},
1825
crossorigin: {},
1926
outputPath: '_site',
2027
favicons: ['https://gw.alipayobjects.com/zos/rmsportal/rlpTLlbMzTNYuZGGCVYM.png'],

mako.config.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"optimization": {
3+
"skipModules": false,
4+
"concatenateModules": false
5+
}
6+
}

package.json

+51-46
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@
117117
],
118118
"dependencies": {
119119
"@ant-design/colors": "^7.0.2",
120-
"@ant-design/cssinjs": "^1.19.1",
120+
"@ant-design/cssinjs": "^1.20.0",
121121
"@ant-design/icons": "^5.3.7",
122122
"@ant-design/react-slick": "~1.1.2",
123-
"@babel/runtime": "^7.24.5",
123+
"@babel/runtime": "^7.24.7",
124124
"@ctrl/tinycolor": "^3.6.1",
125125
"@rc-component/color-picker": "~1.5.3",
126126
"@rc-component/mutate-observer": "^1.1.0",
127127
"@rc-component/tour": "~1.15.0",
128128
"@rc-component/trigger": "^2.2.0",
129129
"classnames": "^2.5.1",
130130
"copy-to-clipboard": "^3.3.3",
131-
"dayjs": "^1.11.10",
131+
"dayjs": "^1.11.11",
132132
"qrcode.react": "^3.1.0",
133133
"rc-cascader": "~3.26.0",
134134
"rc-checkbox": "~3.3.0",
@@ -166,13 +166,13 @@
166166
"throttle-debounce": "^5.0.0"
167167
},
168168
"devDependencies": {
169-
"@ant-design/compatible": "^5.1.2",
169+
"@ant-design/compatible": "^5.1.3",
170170
"@ant-design/happy-work-theme": "^1.0.0",
171171
"@ant-design/tools": "^18.0.2",
172172
"@antv/g6": "^4.8.24",
173-
"@babel/eslint-plugin": "^7.24.5",
174-
"@biomejs/biome": "^1.7.2",
175-
"@codesandbox/sandpack-react": "^2.13.10",
173+
"@babel/eslint-plugin": "^7.24.7",
174+
"@biomejs/biome": "^1.8.1",
175+
"@codesandbox/sandpack-react": "^2.14.2",
176176
"@dnd-kit/core": "^6.1.0",
177177
"@dnd-kit/modifiers": "^7.0.0",
178178
"@dnd-kit/sortable": "^8.0.0",
@@ -183,12 +183,12 @@
183183
"@madccc/duplicate-package-checker-webpack-plugin": "^1.0.0",
184184
"@microflash/rehype-figure": "^2.1.0",
185185
"@npmcli/run-script": "^8.1.0",
186-
"@octokit/rest": "^20.1.0",
187-
"@qixian.cs/github-contributors-list": "^2.0.1",
188-
"@size-limit/file": "^11.1.2",
189-
"@stackblitz/sdk": "^1.9.0",
186+
"@octokit/rest": "^20.1.1",
187+
"@qixian.cs/github-contributors-list": "^2.0.2",
188+
"@size-limit/file": "^11.1.4",
189+
"@stackblitz/sdk": "^1.10.0",
190190
"@testing-library/dom": "^10.1.0",
191-
"@testing-library/jest-dom": "^6.4.2",
191+
"@testing-library/jest-dom": "^6.4.6",
192192
"@testing-library/react": "^16.0.0",
193193
"@testing-library/user-event": "^14.5.2",
194194
"@types/adm-zip": "^0.5.5",
@@ -203,19 +203,19 @@
203203
"@types/jest-axe": "^3.5.9",
204204
"@types/jest-environment-puppeteer": "^5.0.6",
205205
"@types/jest-image-snapshot": "^6.4.0",
206-
"@types/jquery": "^3.5.29",
207-
"@types/jsdom": "^21.1.6",
208-
"@types/lodash": "^4.17.0",
206+
"@types/jquery": "^3.5.30",
207+
"@types/jsdom": "^21.1.7",
208+
"@types/lodash": "^4.17.5",
209209
"@types/minimist": "^1.2.5",
210-
"@types/node": "^20.12.7",
210+
"@types/node": "^20.14.2",
211211
"@types/nprogress": "^0.2.3",
212212
"@types/ora": "^3.2.0",
213213
"@types/pixelmatch": "^5.2.6",
214-
"@types/pngjs": "^6.0.4",
215-
"@types/prismjs": "^1.26.3",
214+
"@types/pngjs": "^6.0.5",
215+
"@types/prismjs": "^1.26.4",
216216
"@types/progress": "^2.0.7",
217217
"@types/qs": "^6.9.15",
218-
"@types/react": "^18.3.1",
218+
"@types/react": "^18.3.3",
219219
"@types/react-copy-to-clipboard": "^5.0.7",
220220
"@types/react-dom": "^18.3.0",
221221
"@types/react-highlight-words": "^0.20.0",
@@ -225,14 +225,14 @@
225225
"@types/tar": "^6.1.13",
226226
"@types/throttle-debounce": "^5.0.2",
227227
"@types/warning": "^3.0.3",
228-
"@typescript-eslint/eslint-plugin": "^7.8.0",
229-
"@typescript-eslint/parser": "^7.8.0",
230-
"adm-zip": "^0.5.12",
228+
"@typescript-eslint/eslint-plugin": "^7.13.0",
229+
"@typescript-eslint/parser": "^7.13.0",
230+
"adm-zip": "^0.5.14",
231231
"ali-oss": "^6.20.0",
232-
"antd-img-crop": "^4.21.0",
232+
"antd-img-crop": "^4.22.0",
233233
"antd-style": "^3.6.2",
234234
"antd-token-previewer": "^2.0.8",
235-
"axios": "^1.6.8",
235+
"axios": "^1.7.2",
236236
"chalk": "^4.1.2",
237237
"cheerio": "1.0.0-rc.12",
238238
"circular-dependency-plugin": "^5.2.2",
@@ -241,7 +241,7 @@
241241
"cross-fetch": "^4.0.0",
242242
"crypto": "^1.0.1",
243243
"dekko": "^0.2.1",
244-
"dumi": "^2.3.2",
244+
"dumi": "2.4.0-alpha.12",
245245
"dumi-plugin-color-chunk": "^1.1.0",
246246
"esbuild-loader": "^4.1.0",
247247
"eslint": "^8.57.0",
@@ -250,24 +250,24 @@
250250
"eslint-import-resolver-typescript": "^3.6.1",
251251
"eslint-plugin-compat": "^4.2.0",
252252
"eslint-plugin-import": "^2.29.1",
253-
"eslint-plugin-jest": "^28.3.0",
253+
"eslint-plugin-jest": "^28.6.0",
254254
"eslint-plugin-jsx-a11y": "^6.8.0",
255255
"eslint-plugin-lodash": "^7.4.0",
256256
"eslint-plugin-markdown": "^5.0.0",
257-
"eslint-plugin-react": "^7.34.1",
257+
"eslint-plugin-react": "^7.34.2",
258258
"eslint-plugin-react-hooks": "^4.6.2",
259259
"eslint-plugin-unicorn": "^53.0.0",
260260
"fast-glob": "^3.3.2",
261261
"fetch-jsonp": "^1.3.0",
262262
"fs-extra": "^11.2.0",
263263
"gh-pages": "^6.1.1",
264-
"glob": "^10.3.12",
264+
"glob": "^10.4.1",
265265
"html2sketch": "^1.0.2",
266266
"http-server": "^14.1.1",
267267
"husky": "^9.0.11",
268268
"identity-obj-proxy": "^3.0.0",
269269
"immer": "^10.1.1",
270-
"inquirer": "^9.2.20",
270+
"inquirer": "^9.2.23",
271271
"is-ci": "^3.0.1",
272272
"isomorphic-fetch": "^3.0.0",
273273
"jest": "^29.7.0",
@@ -278,10 +278,10 @@
278278
"jest-image-snapshot": "^6.4.0",
279279
"jest-puppeteer": "^10.0.1",
280280
"jquery": "^3.7.1",
281-
"jsdom": "^24.0.0",
281+
"jsdom": "^24.1.0",
282282
"jsonml-to-react-element": "^1.1.11",
283283
"jsonml.js": "^0.1.0",
284-
"lint-staged": "^15.2.2",
284+
"lint-staged": "^15.2.7",
285285
"lodash": "^4.17.21",
286286
"lunar-typescript": "^1.7.5",
287287
"lz-string": "^1.5.0",
@@ -294,15 +294,15 @@
294294
"ora": "^8.0.1",
295295
"pixelmatch": "^5.3.0",
296296
"pngjs": "^7.0.0",
297-
"prettier": "^3.2.5",
297+
"prettier": "^3.3.2",
298298
"prettier-plugin-jsdoc": "^1.3.0",
299299
"pretty-format": "^29.7.0",
300300
"prismjs": "^1.29.0",
301-
"puppeteer": "^22.7.1",
301+
"puppeteer": "^22.11.0",
302302
"qs": "^6.12.1",
303303
"rc-footer": "^0.6.8",
304304
"rc-tween-one": "^3.0.6",
305-
"rc-virtual-list": "^3.11.5",
305+
"rc-virtual-list": "^3.14.3",
306306
"react": "^18.3.1",
307307
"react-copy-to-clipboard": "^5.1.0",
308308
"react-countup": "^6.5.3",
@@ -311,9 +311,9 @@
311311
"react-fast-marquee": "^1.6.4",
312312
"react-highlight-words": "^0.20.0",
313313
"react-infinite-scroll-component": "^6.1.0",
314-
"react-intersection-observer": "^9.10.1",
314+
"react-intersection-observer": "^9.10.3",
315315
"react-resizable": "^3.0.5",
316-
"react-router-dom": "^6.23.0",
316+
"react-router-dom": "^6.23.1",
317317
"react-sticky-box": "^2.0.5",
318318
"regenerator-runtime": "^0.14.1",
319319
"rehype-stringify": "^10.0.0",
@@ -325,25 +325,25 @@
325325
"remark-preset-lint-recommended": "^7.0.0",
326326
"remark-rehype": "^11.1.0",
327327
"runes2": "^1.1.4",
328-
"semver": "^7.6.0",
329-
"sharp": "^0.33.3",
330-
"simple-git": "^3.24.0",
331-
"size-limit": "^11.1.2",
328+
"semver": "^7.6.2",
329+
"sharp": "^0.33.4",
330+
"simple-git": "^3.25.0",
331+
"size-limit": "^11.1.4",
332332
"spinnies": "^0.5.1",
333-
"stylelint": "^16.4.0",
333+
"stylelint": "^16.6.1",
334334
"stylelint-config-rational-order": "^0.1.2",
335335
"stylelint-config-standard": "^36.0.0",
336336
"stylelint-prettier": "^5.0.0",
337337
"sylvanas": "^0.6.1",
338-
"tar": "^7.0.1",
338+
"tar": "^7.2.0",
339339
"tar-fs": "^3.0.6",
340-
"terser": "^5.31.0",
341-
"tsx": "^4.15.1",
340+
"terser": "^5.31.1",
341+
"tsx": "^4.15.4",
342342
"typedoc": "^0.25.13",
343343
"typescript": "~5.4.5",
344-
"vanilla-jsoneditor": "^0.23.2",
344+
"vanilla-jsoneditor": "^0.23.7",
345345
"vanilla-tilt": "^1.8.1",
346-
"webpack": "^5.91.0",
346+
"webpack": "^5.92.0",
347347
"webpack-bundle-analyzer": "^4.10.2",
348348
"xhr-mock": "^2.5.1"
349349
},
@@ -354,6 +354,11 @@
354354
"publishConfig": {
355355
"registry": "https://registry.npmjs.org/"
356356
},
357+
"overrides": {
358+
"dumi-plugin-color-chunk": {
359+
"dumi": "^2.4.0-alpha.12"
360+
}
361+
},
357362
"size-limit": [
358363
{
359364
"path": "./dist/antd.min.js",

0 commit comments

Comments
 (0)