Skip to content

Commit e158424

Browse files
authored
feat!: mdc.config.js support, improve shiki bundle (#129)
1 parent 820d5d7 commit e158424

35 files changed

+1526
-853
lines changed

build.config.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
import fs from 'fs'
3+
4+
export default defineBuildConfig({
5+
entries: [
6+
'src/config.ts',
7+
],
8+
hooks: {
9+
'rollup:done': () => {
10+
fs.writeFileSync('dist/config.cjs', 'module.exports = {}; module.exports.defineConfig = configs => configs', 'utf-8')
11+
}
12+
},
13+
externals: [
14+
'hast'
15+
]
16+
})

docs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"@nuxt/devtools": "^1.0.8",
1717
"@nuxt/eslint-config": "^0.2.0",
1818
"@nuxtjs/plausible": "^0.2.4",
19-
"@types/node": "^20.11.5",
19+
"@types/node": "^20.11.13",
2020
"eslint": "^8.56.0",
21-
"nuxt": "^3.9.3"
21+
"nuxt": "^3.10.0"
2222
}
2323
}

nuxt.config.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { fileURLToPath } from 'url'
2+
3+
export default defineNuxtConfig({
4+
typescript: {
5+
tsConfig: {
6+
compilerOptions: {
7+
paths: {
8+
'@nuxtjs/mdc/config': [
9+
fileURLToPath(new URL('./src/config.ts', import.meta.url))
10+
],
11+
}
12+
}
13+
}
14+
}
15+
})

package.json

+31-14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
"import": "./dist/module.mjs",
1212
"require": "./dist/module.cjs"
1313
},
14+
"./config": {
15+
"types": "./dist/config.d.ts",
16+
"import": "./dist/config.mjs",
17+
"require": "./dist/config.cjs"
18+
},
1419
"./runtime": "./dist/runtime/index.mjs",
1520
"./dist/runtime": "./dist/runtime/index.mjs",
1621
"./runtime/*": "./dist/runtime/*.mjs",
@@ -21,6 +26,17 @@
2126
"files": [
2227
"dist"
2328
],
29+
"typesVersions": {
30+
"*": {
31+
"*": [
32+
"./dist/*",
33+
"./dist/index.d.ts"
34+
],
35+
"config": [
36+
"./dist/config.d.ts"
37+
]
38+
}
39+
},
2440
"scripts": {
2541
"prepack": "nuxt-module-build prepare; nuxt-module-build",
2642
"build": "nuxt-module-build prepare; nuxt-module-build build",
@@ -34,8 +50,9 @@
3450
"test:watch": "vitest watch"
3551
},
3652
"dependencies": {
37-
"@nuxt/kit": "^3.9.3",
38-
"@types/hast": "^3.0.3",
53+
"@nuxt/kit": "^3.10.0",
54+
"@shikijs/transformers": "^1.0.0-beta.2",
55+
"@types/hast": "^3.0.4",
3956
"@types/mdast": "^4.0.3",
4057
"@vue/compiler-core": "^3.4.15",
4158
"consola": "^3.2.3",
@@ -49,20 +66,20 @@
4966
"micromark-util-sanitize-uri": "^2.0.0",
5067
"ohash": "^1.1.3",
5168
"parse5": "^7.1.2",
52-
"property-information": "^6.4.0",
69+
"pathe": "^1.1.2",
70+
"property-information": "^6.4.1",
5371
"rehype-external-links": "^3.0.0",
5472
"rehype-raw": "^7.0.0",
5573
"rehype-slug": "^6.0.0",
5674
"rehype-sort-attribute-values": "^5.0.0",
5775
"rehype-sort-attributes": "^5.0.0",
5876
"remark-emoji": "^4.0.1",
5977
"remark-gfm": "^4.0.0",
60-
"remark-mdc": "^3.0.1",
78+
"remark-mdc": "^3.0.2",
6179
"remark-parse": "^11.0.0",
6280
"remark-rehype": "^11.1.0",
6381
"scule": "^1.2.0",
64-
"shikiji": "^0.9.19",
65-
"shikiji-transformers": "^0.9.19",
82+
"shiki": "^1.0.0-beta.2",
6683
"ufo": "^1.3.2",
6784
"unified": "^11.0.4",
6885
"unist-builder": "^4.0.0",
@@ -73,19 +90,19 @@
7390
"@nuxt/devtools": "latest",
7491
"@nuxt/eslint-config": "^0.2.0",
7592
"@nuxt/module-builder": "^0.5.5",
76-
"@nuxt/schema": "^3.9.3",
77-
"@nuxt/test-utils": "^3.10.0",
78-
"@nuxt/ui": "^2.12.2",
93+
"@nuxt/schema": "^3.10.0",
94+
"@nuxt/test-utils": "^3.11.0",
95+
"@nuxt/ui": "^2.13.0",
7996
"@types/mdurl": "^1.0.5",
80-
"@types/node": "^20.11.5",
97+
"@types/node": "^20.11.13",
8198
"changelogen": "^0.5.5",
8299
"eslint": "^8.56.0",
83-
"nuxt": "^3.9.3",
100+
"nuxt": "^3.10.0",
84101
"rehype": "^13.0.1",
85-
"release-it": "^17.0.1",
86-
"vitest": "^1.2.1"
102+
"release-it": "^17.0.3",
103+
"vitest": "^1.2.2"
87104
},
88-
"packageManager": "pnpm@8.14.1",
105+
"packageManager": "pnpm@8.15.1",
89106
"release-it": {
90107
"git": {
91108
"commitMessage": "chore(release): release v${version}"

playground/mdc.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from '@nuxtjs/mdc/config'
2+
3+
export default defineConfig({
4+
})
5+
6+
console.log('Hello from playground/mdc.config.ts')

0 commit comments

Comments
 (0)