Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit f5b7a29

Browse files
committed
feat(nuxt): support nuxt options field
1 parent 20fe442 commit f5b7a29

File tree

4 files changed

+37
-13
lines changed

4 files changed

+37
-13
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default {
5555
'@nuxtjs/composition-api/module',
5656
'unplugin-vue2-script-setup/nuxt',
5757
],
58+
scriptSetup: { /* options */ },
5859
}
5960
```
6061

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@antfu/utils": "^0.3.0",
7070
"@rollup/pluginutils": "^4.1.1",
7171
"@types/jest": "^27.0.1",
72-
"@types/node": "^16.7.8",
72+
"@types/node": "^16.7.10",
7373
"@vue/composition-api": "^1.1.4",
7474
"@vue/runtime-dom": "^3.2.6",
7575
"bumpp": "^6.0.6",
@@ -83,7 +83,7 @@
8383
"ts-jest": "^27.0.5",
8484
"tsup": "^4.14.0",
8585
"typescript": "^4.4.2",
86-
"vite": "^2.5.1"
86+
"vite": "^2.5.3"
8787
},
8888
"dependencies": {
8989
"@babel/core": "^7.15.0",
@@ -93,8 +93,9 @@
9393
"@babel/types": "^7.15.0",
9494
"@vue/ref-transform": "^3.2.6",
9595
"@vue/shared": "^3.2.6",
96+
"defu": "^5.0.0",
9697
"htmlparser2": "^6.1.0",
9798
"magic-string": "^0.25.7",
98-
"unplugin": "^0.2.6"
99+
"unplugin": "^0.2.7"
99100
}
100101
}

pnpm-lock.yaml

+28-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nuxt.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import defu from 'defu'
12
import { PluginOptions } from './types'
23
import unplugin from '.'
34

4-
export default function(this: any, options?: PluginOptions) {
5+
export default function(this: any, inlineOptions: PluginOptions = {}) {
6+
const options = defu(inlineOptions, this.nuxt.options.scriptSetup)
7+
58
// install webpack plugin
69
this.extendBuild((config: any) => {
710
config.plugins = config.plugins || []

0 commit comments

Comments
 (0)