Skip to content

Commit

Permalink
fix(nuxt): add declaration file with correct node16 imports (#25266)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jan 18, 2024
1 parent 210a559 commit 8e4905c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/nuxt/package.json
Expand Up @@ -17,7 +17,7 @@
},
"exports": {
".": {
"types": "./types.d.ts",
"types": "./types.d.mts",
"import": "./dist/index.mjs"
},
"./config": {
Expand Down Expand Up @@ -49,6 +49,7 @@
"app.d.ts",
"bin",
"types.d.ts",
"types.d.mts",
"dist",
"config.*",
"kit.*",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/nuxt.ts
Expand Up @@ -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'

Expand Down
33 changes: 33 additions & 0 deletions packages/nuxt/types.d.mts
@@ -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>
}
}

0 comments on commit 8e4905c

Please sign in to comment.