mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
refactor: update internal modules signature(#2610)
This commit is contained in:
parent
70fe5e72e6
commit
11becef735
@ -17,10 +17,12 @@ Nuxt provides helper functions (accessed from `@nuxt/kit`) to assist in creating
|
|||||||
import { defineNuxtModule } from '@nuxt/kit'
|
import { defineNuxtModule } from '@nuxt/kit'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
|
meta: {
|
||||||
// The npm package name of your module
|
// The npm package name of your module
|
||||||
name: '@nuxtjs/sample-module',
|
name: '@nuxtjs/sample-module',
|
||||||
// The key in `nuxt.config` that holds your module options
|
// The key in `nuxt.config` that holds your module options
|
||||||
configKey: 'sample',
|
configKey: 'sample',
|
||||||
|
},
|
||||||
// Default configuration options for your module
|
// Default configuration options for your module
|
||||||
defaults: {},
|
defaults: {},
|
||||||
hooks: {},
|
hooks: {},
|
||||||
|
@ -8,8 +8,10 @@ import { toExports, toImports } from './utils'
|
|||||||
import { AutoImportContext, createAutoImportContext, updateAutoImportContext } from './context'
|
import { AutoImportContext, createAutoImportContext, updateAutoImportContext } from './context'
|
||||||
|
|
||||||
export default defineNuxtModule<AutoImportsOptions>({
|
export default defineNuxtModule<AutoImportsOptions>({
|
||||||
|
meta: {
|
||||||
name: 'auto-imports',
|
name: 'auto-imports',
|
||||||
configKey: 'autoImports',
|
configKey: 'autoImports'
|
||||||
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
sources: Nuxt3AutoImports,
|
sources: Nuxt3AutoImports,
|
||||||
global: false,
|
global: false,
|
||||||
|
@ -10,8 +10,10 @@ const isPureObjectOrString = (val: any) => (!Array.isArray(val) && typeof val ==
|
|||||||
const isDirectory = (p: string) => { try { return statSync(p).isDirectory() } catch (_e) { return false } }
|
const isDirectory = (p: string) => { try { return statSync(p).isDirectory() } catch (_e) { return false } }
|
||||||
|
|
||||||
export default defineNuxtModule<ComponentsOptions>({
|
export default defineNuxtModule<ComponentsOptions>({
|
||||||
|
meta: {
|
||||||
name: 'components',
|
name: 'components',
|
||||||
configKey: 'components',
|
configKey: 'components'
|
||||||
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
dirs: ['~/components']
|
dirs: ['~/components']
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,9 @@ import { distDir } from '../dirs'
|
|||||||
import type { MetaObject } from './runtime'
|
import type { MetaObject } from './runtime'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
name: 'meta',
|
meta: {
|
||||||
|
name: 'meta'
|
||||||
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
charset: 'utf-8',
|
charset: 'utf-8',
|
||||||
viewport: 'width=device-width, initial-scale=1'
|
viewport: 'width=device-width, initial-scale=1'
|
||||||
|
@ -5,7 +5,9 @@ import { distDir } from '../dirs'
|
|||||||
import { resolveLayouts, resolvePagesRoutes, addComponentToRoutes } from './utils'
|
import { resolveLayouts, resolvePagesRoutes, addComponentToRoutes } from './utils'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
name: 'router',
|
meta: {
|
||||||
|
name: 'router'
|
||||||
|
},
|
||||||
setup (_options, nuxt) {
|
setup (_options, nuxt) {
|
||||||
const pagesDir = resolve(nuxt.options.srcDir, nuxt.options.dir.pages)
|
const pagesDir = resolve(nuxt.options.srcDir, nuxt.options.dir.pages)
|
||||||
const runtimeDir = resolve(distDir, 'pages/runtime')
|
const runtimeDir = resolve(distDir, 'pages/runtime')
|
||||||
|
Loading…
Reference in New Issue
Block a user