fix(nuxt): add declaration file with correct node16 imports (#25266)

This commit is contained in:
Daniel Roe 2024-01-18 10:04:59 +00:00 committed by GitHub
parent 210a559350
commit 8e4905c2fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 2 deletions

View File

@ -17,7 +17,7 @@
},
"exports": {
".": {
"types": "./types.d.ts",
"types": "./types.d.mts",
"import": "./dist/index.mjs"
},
"./config": {
@ -49,6 +49,7 @@
"app.d.ts",
"bin",
"types.d.ts",
"types.d.mts",
"dist",
"config.*",
"kit.*",

View File

@ -17,7 +17,7 @@ import type { RouteMiddleware } from '../app/composables/router'
import type { NuxtError } from '../app/composables/error'
import type { AsyncDataRequestStatus } from '../app/composables/asyncData'
import type { NuxtAppManifestMeta } from '../app/composables/manifest'
import type { LoadingIndicator } from '#app/composables/loading-indicator'
import type { LoadingIndicator } from '../app/composables/loading-indicator'
import type { NuxtAppLiterals } from '#app'

33
packages/nuxt/types.d.mts Normal file
View File

@ -0,0 +1,33 @@
/// <reference types="nitropack" />
export * from './dist/index.js'
import type { DefineNuxtConfig } from 'nuxt/config'
import type { RuntimeConfig, SchemaDefinition } from 'nuxt/schema'
import type { H3Event } from 'h3'
import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from './dist/core/runtime/nitro/renderer.js'
declare global {
const defineNuxtConfig: DefineNuxtConfig
const defineNuxtSchema: (schema: SchemaDefinition) => SchemaDefinition
}
// Note: Keep in sync with packages/nuxt/src/core/templates.ts
declare module 'nitropack' {
interface NitroRuntimeConfigApp {
buildAssetsDir: string
cdnURL: string
}
interface NitroRuntimeConfig extends RuntimeConfig {}
interface NitroRouteConfig {
ssr?: boolean
experimentalNoScripts?: boolean
}
interface NitroRouteRules {
ssr?: boolean
experimentalNoScripts?: boolean
}
interface NitroRuntimeHooks {
'render:html': (htmlContext: NuxtRenderHTMLContext, context: { event: H3Event }) => void | Promise<void>
'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise<void>
}
}