diff --git a/packages/nitro/src/runtime/app/config.ts b/packages/nitro/src/runtime/app/config.ts index a98105f3d4..b026f824ea 100644 --- a/packages/nitro/src/runtime/app/config.ts +++ b/packages/nitro/src/runtime/app/config.ts @@ -1,6 +1,6 @@ import destr from 'destr' -const runtimeConfig = process.env.RUNTIME_CONFIG +const runtimeConfig = process.env.RUNTIME_CONFIG as any for (const type of ['private', 'public']) { for (const key in runtimeConfig[type]) { diff --git a/packages/nitro/src/runtime/app/render.ts b/packages/nitro/src/runtime/app/render.ts index 80fa655dd4..151cee3c65 100644 --- a/packages/nitro/src/runtime/app/render.ts +++ b/packages/nitro/src/runtime/app/render.ts @@ -1,9 +1,13 @@ import { createRenderer } from 'vue-bundle-renderer' import devalue from '@nuxt/devalue' import config from './config' +// @ts-ignore import { renderToString } from '~renderer' +// @ts-ignore import server from '~build/dist/server/server' +// @ts-ignore import clientManifest from '~build/dist/server/client.manifest.json' +// @ts-ignore import htmlTemplate from '~build/views/document.template.js' const renderer = createRenderer(server, { diff --git a/packages/nitro/src/runtime/app/vue2.ts b/packages/nitro/src/runtime/app/vue2.ts index 7c03d09c0d..0de42f4c57 100644 --- a/packages/nitro/src/runtime/app/vue2.ts +++ b/packages/nitro/src/runtime/app/vue2.ts @@ -1,3 +1,4 @@ +// @ts-ignore import { createRenderer } from '~vueServerRenderer' const _renderer = createRenderer({}) diff --git a/packages/nitro/src/runtime/app/vue3.ts b/packages/nitro/src/runtime/app/vue3.ts index 0d6b6c4190..f3fd7daa59 100644 --- a/packages/nitro/src/runtime/app/vue3.ts +++ b/packages/nitro/src/runtime/app/vue3.ts @@ -1 +1,2 @@ +// @ts-ignore export { renderToString } from '@vue/server-renderer' diff --git a/packages/nitro/src/runtime/entries/cli.ts b/packages/nitro/src/runtime/entries/cli.ts index f412abf5bf..91d3141266 100644 --- a/packages/nitro/src/runtime/entries/cli.ts +++ b/packages/nitro/src/runtime/entries/cli.ts @@ -1,5 +1,5 @@ import '~polyfill' -import { localCall } from '../server/call' +import { localCall } from '../server' async function cli () { const url = process.argv[2] || '/' @@ -9,6 +9,7 @@ async function cli () { debug('URL', url) debug('StatusCode', r.status) debug('StatusMessage', r.statusText) + // @ts-ignore for (const header of r.headers.entries()) { debug(header[0], header[1]) } diff --git a/packages/nitro/src/runtime/entries/cloudflare.ts b/packages/nitro/src/runtime/entries/cloudflare.ts index cd38d749fd..1658fb8bf0 100644 --- a/packages/nitro/src/runtime/entries/cloudflare.ts +++ b/packages/nitro/src/runtime/entries/cloudflare.ts @@ -4,7 +4,7 @@ import { localCall } from '../server' const PUBLIC_PATH = process.env.PUBLIC_PATH // Default: /_nuxt/ -addEventListener('fetch', (event) => { +addEventListener('fetch', (event: any) => { event.respondWith(handleEvent(event)) }) @@ -29,6 +29,7 @@ async function handleEvent (event) { }) return new Response(r.body, { + // @ts-ignore headers: r.headers, status: r.status, statusText: r.statusText diff --git a/packages/nitro/src/runtime/entries/server.ts b/packages/nitro/src/runtime/entries/server.ts index 301c872964..a03ce951e7 100644 --- a/packages/nitro/src/runtime/entries/server.ts +++ b/packages/nitro/src/runtime/entries/server.ts @@ -1,18 +1,20 @@ import '~polyfill' import { Server } from 'http' +import destr from 'destr' import { handle } from '../server' const server = new Server(handle) -const port = process.env.NUXT_PORT || process.env.PORT || 3000 -const host = process.env.NUXT_HOST || process.env.HOST || 'localhost' +const port = (destr(process.env.NUXT_PORT || process.env.PORT) || 3000) as number +const hostname = process.env.NUXT_HOST || process.env.HOST || 'localhost' -server.listen(port, host, (err) => { +// @ts-ignore +server.listen(port, hostname, (err) => { if (err) { console.error(err) process.exit(1) } - console.log(`Listening on http://${host}:${port}`) + console.log(`Listening on http://${hostname}:${port}`) }) export default {} diff --git a/packages/nitro/src/runtime/entries/service-worker.ts b/packages/nitro/src/runtime/entries/service-worker.ts index c23486b653..6db71038cc 100644 --- a/packages/nitro/src/runtime/entries/service-worker.ts +++ b/packages/nitro/src/runtime/entries/service-worker.ts @@ -1,3 +1,4 @@ +// @ts-nocheck import '~polyfill' import { localCall } from '../server' diff --git a/packages/nitro/src/runtime/server/index.ts b/packages/nitro/src/runtime/server/index.ts index c42384a1b3..67714eac9c 100644 --- a/packages/nitro/src/runtime/server/index.ts +++ b/packages/nitro/src/runtime/server/index.ts @@ -5,6 +5,7 @@ import destr from 'destr' import { createCall, createFetch as createLocalFetch } from '@nuxt/un/runtime/fetch' import { timingMiddleware } from './timing' import { handleError } from './error' +// @ts-ignore import serverMiddleware from '~serverMiddleware' const app = createApp({ diff --git a/packages/nitro/src/runtime/server/static.ts b/packages/nitro/src/runtime/server/static.ts index c1ef0b935f..cf639430c7 100644 --- a/packages/nitro/src/runtime/server/static.ts +++ b/packages/nitro/src/runtime/server/static.ts @@ -1,4 +1,5 @@ -import { sendError } from 'h3' +import { createError } from 'h3' +// @ts-ignore import { getAsset, readAsset } from '~static' const METHODS = ['HEAD', 'GET'] @@ -23,7 +24,10 @@ export default async function serveStatic(req, res) { if (!asset) { if (id.startsWith(PUBLIC_PATH)) { - sendError(res, 'Asset not found: ' + id, false, 404) + throw createError({ + message: 'Asset not found: ' + id, + statusCode: 404 + }) } return }