Skip to content

Commit 73953de

Browse files
committed
fix(docs-site): prevent OOM in CI by hoisting HTML5 Set and increasing heap
The isCustomElement callback was allocating a new 80-element Set on every tag evaluation — thousands of times across 110+ archive pages. Hoist to module scope. Also set NODE_OPTIONS=--max-old-space-size=4096 in CI.
1 parent b9a90a2 commit 73953de

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
- name: Build VitePress site
3939
run: npm run build
4040
working-directory: docs-site
41+
env:
42+
NODE_OPTIONS: '--max-old-space-size=4096'
4143
- uses: actions/upload-pages-artifact@v3
4244
with:
4345
path: docs-site/.vitepress/dist

docs-site/.vitepress/config.mts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ const archiveEscapePlugin: Plugin = {
3232
},
3333
}
3434

35+
const HTML5_ELEMENTS = new Set([
36+
'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base',
37+
'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption',
38+
'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del',
39+
'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset',
40+
'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5',
41+
'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img',
42+
'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map',
43+
'mark', 'menu', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol',
44+
'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q',
45+
'rp', 'rt', 'ruby', 's', 'samp', 'script', 'search', 'section', 'select',
46+
'slot', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary',
47+
'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th',
48+
'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr',
49+
])
50+
3551
export default defineConfig({
3652
title: 'sap-devs',
3753
description: 'SAP developer knowledge, injected into your AI coding tools',
@@ -55,22 +71,7 @@ export default defineConfig({
5571
compilerOptions: {
5672
isCustomElement: (tag) => {
5773
if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(tag)) return false
58-
const html5 = new Set([
59-
'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base',
60-
'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption',
61-
'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del',
62-
'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset',
63-
'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5',
64-
'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img',
65-
'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map',
66-
'mark', 'menu', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol',
67-
'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q',
68-
'rp', 'rt', 'ruby', 's', 'samp', 'script', 'search', 'section', 'select',
69-
'slot', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary',
70-
'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th',
71-
'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr',
72-
])
73-
return !html5.has(tag)
74+
return !HTML5_ELEMENTS.has(tag)
7475
},
7576
},
7677
},

0 commit comments

Comments
 (0)