File tree 10 files changed +2134
-2766
lines changed
10 files changed +2134
-2766
lines changed Original file line number Diff line number Diff line change 38
38
"vant" : " >=4"
39
39
},
40
40
"dependencies" : {
41
- "@nuxt/kit" : " ^3.12.2 " ,
41
+ "@nuxt/kit" : " ^3.14.159 " ,
42
42
"magic-string" : " ^0.29.0" ,
43
- "unplugin" : " ^1.10.2 "
43
+ "unplugin" : " ^1.16.0 "
44
44
},
45
45
"devDependencies" : {
46
46
"@nuxt/module-builder" : " ^0.5.5" ,
47
- "@nuxt/schema" : " ^3.12.2 " ,
47
+ "@nuxt/schema" : " ^3.14.159 " ,
48
48
"@nuxtjs/eslint-config-typescript" : " ^12.1.0" ,
49
- "@types/node" : " ^18.19.39 " ,
50
- "eslint" : " ^8.57.0 " ,
51
- "nuxt" : " ^3.12.2 " ,
52
- "typescript" : " ^5.5.2 " ,
53
- "vant" : " ^4.9.1 " ,
54
- "vue" : " ^3.4.31 "
49
+ "@types/node" : " ^22.9.0 " ,
50
+ "eslint" : " ^8.57.1 " ,
51
+ "nuxt" : " ^3.14.159 " ,
52
+ "typescript" : " ^5.6.3 " ,
53
+ "vant" : " ^4.9.8 " ,
54
+ "vue" : " ^3.5.12 "
55
55
},
56
56
"publishConfig" : {
57
57
"access" : " public" ,
Original file line number Diff line number Diff line change 1
1
import { defineNuxtConfig } from 'nuxt/config'
2
- import Vant from '..'
2
+ import Vant from '../src/module '
3
3
4
4
export default defineNuxtConfig ( {
5
5
modules : [ Vant ] ,
Original file line number Diff line number Diff line change 1
1
import AllComponents from 'vant'
2
- import type { Options , PresetImport } from './types'
2
+ import type { ModuleOptions , PresetImport } from './types'
3
3
4
4
export const libraryName = 'vant'
5
5
@@ -47,7 +47,7 @@ const defaultExclude: RegExp[] = [
47
47
/ [ \\ / ] \. n u x t [ \\ / ] /
48
48
]
49
49
50
- export const defaults : Options = {
50
+ export const defaults : ModuleOptions = {
51
51
lazyload : false ,
52
52
importStyle : true ,
53
53
components : allComponents ,
Original file line number Diff line number Diff line change 1
1
import { addComponent , createResolver } from '@nuxt/kit'
2
2
import { libraryName } from '../config'
3
3
import { hyphenate , toArray } from '../utils'
4
- import type { Options } from '../types'
4
+ import type { ModuleOptions } from '../types'
5
5
6
- export function resolveComponents ( config : Options ) {
6
+ export function resolveComponents ( config : ModuleOptions ) {
7
7
const { components, excludeExports } = config
8
8
const { resolvePath } = createResolver ( import . meta. url )
9
9
Original file line number Diff line number Diff line change 1
1
import { addImportsSources } from '@nuxt/kit'
2
2
import { libraryName } from '../config'
3
- import type { Options } from '../types'
3
+ import type { ModuleOptions } from '../types'
4
4
5
- export function resolveImports ( config : Options ) {
5
+ export function resolveImports ( config : ModuleOptions ) {
6
6
const { imports } = config
7
7
8
8
addImportsSources ( {
Original file line number Diff line number Diff line change 1
1
import { libraryName } from '../config'
2
2
import { isObject } from '../utils'
3
- import type { Options } from '../types'
3
+ import type { ModuleOptions } from '../types'
4
4
5
- export function resolveLazyload ( config : Options ) {
5
+ export function resolveLazyload ( config : ModuleOptions ) {
6
6
const { lazyload } = config
7
7
const options = isObject ( lazyload ) ? `, ${ JSON . stringify ( lazyload ) } ` : ''
8
8
Original file line number Diff line number Diff line change 1
1
import { allImportsWithStyle , libraryName } from '../config'
2
2
import { hyphenate } from '../utils'
3
- import type { Options } from '../types'
3
+ import type { ModuleOptions } from '../types'
4
4
5
5
export function getStyleDir ( name : string ) {
6
6
return `${ libraryName } /es/${ hyphenate ( name ) } /style/index.mjs`
7
7
}
8
8
9
- export function resolveStyles ( config : Options , name : string ) {
9
+ export function resolveStyles ( config : ModuleOptions , name : string ) {
10
10
const { components, importStyle } = config
11
11
12
12
if ( importStyle === false ) { return undefined }
Original file line number Diff line number Diff line change @@ -9,17 +9,16 @@ import {
9
9
localePlugin ,
10
10
transformPlugin
11
11
} from './core/index'
12
- import type { Options } from './types'
12
+ import type { ModuleOptions } from './types'
13
+ export type { ModuleOptions } from './types'
13
14
14
- export default defineNuxtModule < Partial < Options > > ( {
15
+ export default defineNuxtModule < ModuleOptions > ( {
15
16
meta : {
16
17
name : libraryName ,
17
18
configKey : libraryName
18
19
} ,
19
20
defaults,
20
- setup ( _options , nuxt ) {
21
- const options = _options as Options
22
-
21
+ setup ( options , nuxt ) {
23
22
resolveOptions ( )
24
23
nuxt . options . imports . autoImport !== false && resolveImports ( options )
25
24
nuxt . options . components !== false && resolveComponents ( options )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export interface TransformOptions {
7
7
exclude : RegExp [ ]
8
8
}
9
9
10
- export interface Options extends TransformOptions {
10
+ export interface ModuleOptions extends TransformOptions {
11
11
/**
12
12
* Whether to automatically load lazyload directives and components.
13
13
*
@@ -49,12 +49,3 @@ export interface Options extends TransformOptions {
49
49
*/
50
50
imports : PresetImport [ ]
51
51
}
52
-
53
- declare module '@nuxt/schema' {
54
- interface NuxtConfig {
55
- vant ?: Partial < Options >
56
- }
57
- interface NuxtOptions {
58
- vant ?: Partial < Options >
59
- }
60
- }
You can’t perform that action at this time.
0 commit comments