-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
config.ts
163 lines (162 loc) · 4.1 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
import alias from '@rollup/plugin-alias';
import { defineConfig } from 'vitepress';
import { moduleAliases } from '../../build-plugins/aliases';
import { resolutions } from '../../build-plugins/replace-browser-modules';
import '../declarations.d';
import { examplesPlugin } from './create-examples';
import { renderMermaidGraphsPlugin } from './mermaid';
import { transposeTables } from './transpose-tables';
import { buildEnd, callback, transformPageData } from './verify-anchors';
export default defineConfig({
buildEnd,
description: 'compile JS code',
head: [
['link', { href: '/favicon.png', rel: 'icon', type: 'image/png' }],
['link', { href: '/favicon.png', rel: 'apple-touch-icon', sizes: '128x128' }],
['link', { href: '/manifest.json', rel: 'manifest' }],
['meta', { content: '#333333', name: 'theme-color' }],
['meta', { content: 'yes', name: 'mobile-web-app-capable' }],
['meta', { content: 'default', name: 'apple-mobile-web-app-status-bar-style' }],
['meta', { content: 'summary_large_image', name: 'twitter:card' }],
['meta', { content: '@rollupjs', name: 'twitter:site' }],
['meta', { content: '@rollupjs', name: 'twitter:creator' }],
['meta', { content: 'Rollup', name: 'twitter:title' }],
['meta', { content: 'The JavaScript module bundler', name: 'twitter:description' }],
['meta', { content: 'https://rollupjs.org/twitter-card.jpg', name: 'twitter:image' }]
],
markdown: {
anchor: {
callback,
level: 2
},
config(md) {
transposeTables(md);
},
linkify: false,
toc: {
level: [2, 3, 4]
}
},
themeConfig: {
algolia: {
apiKey: '233d24494bdf54811b5c3181883b5ee3',
appId: 'V5XQ4IDZSG',
indexName: 'rollupjs'
},
editLink: {
pattern: 'https://github.com/rollup/rollup/edit/master/docs/:path',
text: 'Edit this page on GitHub'
},
footer: {
copyright: 'Copyright © 2015-present Rollup contributors',
message: 'Released under the MIT License.'
},
logo: '/rollup-logo.svg',
nav: [
{ link: '/introduction/', text: 'guide' },
{ link: '/repl/', text: 'repl' },
{ link: 'https://is.gd/rollup_chat', text: 'chat' },
{ link: 'https://opencollective.com/rollup', text: 'opencollective' }
],
outline: 'deep',
sidebar: [
{
items: [
{
link: '/introduction/',
text: 'Introduction'
},
{
link: '/command-line-interface/',
text: 'Command Line Interface'
},
{
link: '/javascript-api/',
text: 'Javascript API'
}
],
text: 'Getting started'
},
{
items: [
{
link: '/tutorial/',
text: 'Tutorial'
},
{
link: '/es-module-syntax/',
text: 'ES Module Syntax'
},
{
link: '/faqs/',
text: 'Frequently Asked Questions'
},
{
link: '/troubleshooting/',
text: 'Troubleshooting'
},
{
link: '/migration/',
text: 'Migrating to Rollup 3'
},
{
link: '/tools/',
text: 'Other Tools'
}
],
text: 'More info'
},
{
items: [
{
link: '/configuration-options/',
text: 'Configuration Options'
},
{
link: '/plugin-development/',
text: 'Plugin Development'
}
],
text: 'API'
}
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/rollup/rollup' },
{ icon: 'mastodon', link: 'https://m.webtoo.ls/@rollupjs' }
]
},
title: 'Rollup',
transformPageData,
vite: {
plugins: [
renderMermaidGraphsPlugin(),
{
apply: 'serve',
enforce: 'pre',
name: 'replace-browser-modules',
resolveId(source, importer) {
if (importer && source.startsWith('/@fs')) {
return resolutions.get(source.slice(4));
}
},
transformIndexHtml(html) {
// Unfortunately, picomatch sneaks as a dedendency into the dev bundle.
// This fixes an error.
return html.replace('</head>', '<script>window.process={}</script></head>');
}
},
{
apply: 'build',
enforce: 'pre',
name: 'replace-local-rollup',
resolveId(source) {
if (source.includes('/browser-entry')) {
return false;
}
}
},
examplesPlugin(),
alias(moduleAliases)
]
}
});