mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
refactor(nuxi): extract nitro types to corresponding modules (#668)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
accbe6445c
commit
cc2279bd8a
1
packages/bridge/types.d.ts
vendored
1
packages/bridge/types.d.ts
vendored
@ -1,3 +1,4 @@
|
||||
import type {} from '@nuxt/nitro'
|
||||
import type { NuxtConfig as _NuxtConfig } from '@nuxt/kit'
|
||||
|
||||
export interface BridgeConfig {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { promises as fsp } from 'fs'
|
||||
import { relative, resolve } from 'pathe'
|
||||
import { cyan } from 'colorette'
|
||||
import { isNuxt3, TSReference } from '@nuxt/kit'
|
||||
import { TSReference } from '@nuxt/kit'
|
||||
import { importModule, getModulePaths, getNearestPackage } from '../utils/cjs'
|
||||
import { success } from '../utils/log'
|
||||
import { defineNuxtCommand } from './index'
|
||||
@ -19,15 +19,9 @@ export default defineNuxtCommand({
|
||||
const { loadNuxt } = await importModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit')
|
||||
const nuxt = await loadNuxt({ rootDir })
|
||||
|
||||
const adHocModules = isNuxt3()
|
||||
? ['@nuxt/kit', '@nuxt/nitro']
|
||||
: ['@nuxt/kit']
|
||||
|
||||
const modulePaths = getModulePaths(nuxt.options.modulesDir)
|
||||
|
||||
const references: TSReference[] = [
|
||||
...isNuxt3() ? ['nuxt3'] : [],
|
||||
...adHocModules,
|
||||
...nuxt.options.buildModules,
|
||||
...nuxt.options.modules,
|
||||
...nuxt.options._modules
|
||||
|
@ -39,6 +39,11 @@ async function initNuxt (nuxt: Nuxt) {
|
||||
// Init nitro
|
||||
await initNitro(nuxt)
|
||||
|
||||
// Add nuxt3 types
|
||||
nuxt.hook('prepare:types', (opts) => {
|
||||
opts.references.push({ types: 'nuxt3' })
|
||||
})
|
||||
|
||||
// Init user modules
|
||||
await nuxt.callHook('modules:before', { nuxt } as ModuleContainer)
|
||||
const modulesToInstall = [
|
||||
|
1
packages/nuxt3/types.d.ts
vendored
1
packages/nuxt3/types.d.ts
vendored
@ -1,2 +1,3 @@
|
||||
import type { } from '@nuxt/nitro'
|
||||
export * from './dist/index'
|
||||
export * from './dist/app/types/index'
|
||||
|
2
playground/nuxt.d.ts
vendored
2
playground/nuxt.d.ts
vendored
@ -2,8 +2,6 @@
|
||||
// Please do not manually modify this file.
|
||||
|
||||
/// <reference types="nuxt3" />
|
||||
/// <reference types="@nuxt/kit" />
|
||||
/// <reference types="@nuxt/nitro" />
|
||||
/// <reference path=".nuxt/components.d.ts" />
|
||||
/// <reference path=".nuxt/global-imports.d.ts" />
|
||||
export {}
|
||||
|
Loading…
Reference in New Issue
Block a user