-
Notifications
You must be signed in to change notification settings - Fork 7
/
rocket.config.js
66 lines (63 loc) · 2.18 KB
/
rocket.config.js
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
import { rocketLaunch } from "@rocket/launch"
import { rocketSearch } from "@rocket/search"
import { esbuildPlugin } from "@web/dev-server-esbuild"
import esbuild from "rollup-plugin-esbuild"
import { addPlugin } from "plugins-manager"
import markdownIt from "markdown-it"
import prism from "markdown-it-prism"
import addWebComponentDefinitions from "eleventy-plugin-add-web-component-definitions"
import helmet from "eleventy-plugin-helmet"
// eslint-disable-next-line import/no-anonymous-default-export
export default {
presets: [rocketLaunch(), rocketSearch()],
markdownTemplateEngine: "njk",
eleventy(eleventyConfig) {
eleventyConfig.addPassthroughCopy(`./**/CNAME`)
eleventyConfig.addPairedShortcode("markdown", function markdown(content) {
const md = new markdownIt({ html: true })
md.use(prism)
return md.render(content)
})
eleventyConfig.addFilter("getProperties", (x) =>
(x?.children ?? []).filter((child) => child.kindString === "Property")
)
eleventyConfig.addFilter("getMethods", (x) => (x?.children ?? []).filter((child) => child.kindString === "Method"))
eleventyConfig.addFilter("getSummary", (x) => x?.comment?.tags?.find?.((t) => t.tag === "summary")?.text)
eleventyConfig.addFilter(
"json",
(x) =>
`<json-viewer><script type="application/json">${
typeof x === "string" ? x : JSON.stringify(x)
}</script></json-viewer>`
)
eleventyConfig.addPlugin(helmet)
eleventyConfig.addPlugin(addWebComponentDefinitions, {
quiet: true,
singleScript: true,
specifiers: {
"type-doc": "atom-community.github.io/components/type-doc",
"json-viewer": "https://unpkg.com/@power-elements/[email protected]/json-viewer.js?module",
},
})
},
devServer: {
nodeResolve: {
exportConditions: ["default", "esbuild", "import"],
extensions: [".mjs", ".js", ".ts"],
},
plugins: [esbuildPlugin({ ts: true })],
},
setupBuildPlugins: [
addPlugin({
name: "esbuild-rollup",
plugin: esbuild,
options: {
include: "components/*.ts",
sourceMap: true,
loaders: {
".ts": "ts",
},
},
}),
],
}