mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
chore: remove @ts-ignore
and fix some issues (#20273)
This commit is contained in:
parent
b602b66a8e
commit
f366ab4eb8
@ -73,6 +73,13 @@
|
|||||||
"disallowTypeAnnotations": false
|
"disallowTypeAnnotations": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"@typescript-eslint/ban-ts-comment": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ts-expect-error": "allow-with-description",
|
||||||
|
"ts-ignore": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ import { defineLazyEventHandler } from 'h3'
|
|||||||
|
|
||||||
export default defineLazyEventHandler(async () => {
|
export default defineLazyEventHandler(async () => {
|
||||||
const { exports: { sum } } = await loadWasmInstance(
|
const { exports: { sum } } = await loadWasmInstance(
|
||||||
// @ts-ignore
|
// @ts-expect-error TODO: https://github.com/nuxt/nuxt/issues/14131
|
||||||
() => import('~/server/wasm/sum.wasm')
|
() => import('~/server/wasm/sum.wasm')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
6
packages/kit/index.d.ts
vendored
Normal file
6
packages/kit/index.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
declare global {
|
||||||
|
var __NUXT_PREPATHS__: string[] | string | undefined
|
||||||
|
var __NUXT_PATHS__: string[] | string | undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
export {}
|
@ -85,14 +85,12 @@ export function getRequireCacheItem (id: string) {
|
|||||||
/** @deprecated Do not use CJS utils */
|
/** @deprecated Do not use CJS utils */
|
||||||
export function resolveModule (id: string, opts: ResolveModuleOptions = {}) {
|
export function resolveModule (id: string, opts: ResolveModuleOptions = {}) {
|
||||||
return normalize(_require.resolve(id, {
|
return normalize(_require.resolve(id, {
|
||||||
paths: ([] as string[]).concat(
|
paths: ([] as Array<string | undefined>).concat(
|
||||||
// @ts-ignore
|
|
||||||
global.__NUXT_PREPATHS__,
|
global.__NUXT_PREPATHS__,
|
||||||
opts.paths || [],
|
opts.paths || [],
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
// @ts-ignore
|
|
||||||
global.__NUXT_PATHS__
|
global.__NUXT_PATHS__
|
||||||
).filter(Boolean)
|
).filter(Boolean) as string[]
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +135,7 @@ export function importModule (id: string, opts: RequireModuleOptions = {}) {
|
|||||||
export function tryImportModule (id: string, opts: RequireModuleOptions = {}) {
|
export function tryImportModule (id: string, opts: RequireModuleOptions = {}) {
|
||||||
try {
|
try {
|
||||||
return importModule(id, opts).catch(() => undefined)
|
return importModule(id, opts).catch(() => undefined)
|
||||||
} catch { }
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Do not use CJS utils */
|
/** @deprecated Do not use CJS utils */
|
||||||
|
@ -103,10 +103,8 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
|
|||||||
const NUXT2_SHIMS_KEY = '__nuxt2_shims_key__'
|
const NUXT2_SHIMS_KEY = '__nuxt2_shims_key__'
|
||||||
function nuxt2Shims (nuxt: Nuxt) {
|
function nuxt2Shims (nuxt: Nuxt) {
|
||||||
// Avoid duplicate install and only apply to Nuxt2
|
// Avoid duplicate install and only apply to Nuxt2
|
||||||
// @ts-ignore
|
if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY as keyof Nuxt]) { return }
|
||||||
if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY]) { return }
|
nuxt[NUXT2_SHIMS_KEY as keyof Nuxt] = true
|
||||||
// @ts-ignore
|
|
||||||
nuxt[NUXT2_SHIMS_KEY] = true
|
|
||||||
|
|
||||||
// Allow using nuxt.hooks
|
// Allow using nuxt.hooks
|
||||||
// @ts-expect-error Nuxt 2 extends hookable
|
// @ts-expect-error Nuxt 2 extends hookable
|
||||||
@ -120,14 +118,14 @@ function nuxt2Shims (nuxt: Nuxt) {
|
|||||||
|
|
||||||
// Support virtual templates with getContents() by writing them to .nuxt directory
|
// Support virtual templates with getContents() by writing them to .nuxt directory
|
||||||
let virtualTemplates: ResolvedNuxtTemplate[]
|
let virtualTemplates: ResolvedNuxtTemplate[]
|
||||||
// @ts-ignore Nuxt 2 hook
|
// @ts-expect-error Nuxt 2 hook
|
||||||
nuxt.hook('builder:prepared', (_builder, buildOptions) => {
|
nuxt.hook('builder:prepared', (_builder, buildOptions) => {
|
||||||
virtualTemplates = buildOptions.templates.filter((t: any) => t.getContents)
|
virtualTemplates = buildOptions.templates.filter((t: any) => t.getContents)
|
||||||
for (const template of virtualTemplates) {
|
for (const template of virtualTemplates) {
|
||||||
buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1)
|
buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// @ts-ignore Nuxt 2 hook
|
// @ts-expect-error Nuxt 2 hook
|
||||||
nuxt.hook('build:templates', async (templates) => {
|
nuxt.hook('build:templates', async (templates) => {
|
||||||
const context = {
|
const context = {
|
||||||
nuxt,
|
nuxt,
|
||||||
|
@ -7,7 +7,7 @@ import { isNuxt2 } from './compatibility'
|
|||||||
export function extendPages (cb: NuxtHooks['pages:extend']) {
|
export function extendPages (cb: NuxtHooks['pages:extend']) {
|
||||||
const nuxt = useNuxt()
|
const nuxt = useNuxt()
|
||||||
if (isNuxt2(nuxt)) {
|
if (isNuxt2(nuxt)) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error TODO: Nuxt 2 hook
|
||||||
nuxt.hook('build:extendRoutes', cb)
|
nuxt.hook('build:extendRoutes', cb)
|
||||||
} else {
|
} else {
|
||||||
nuxt.hook('pages:extend', cb)
|
nuxt.hook('pages:extend', cb)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-expect-error internal property for tracking start time
|
||||||
process._startTime = Date.now()
|
process._startTime = Date.now()
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error `default` property is not declared
|
||||||
import('./cli').then(r => (r.default || r).main())
|
import('./cli').then(r => (r.default || r).main())
|
||||||
|
@ -15,7 +15,6 @@ async function _main () {
|
|||||||
'no-clear'
|
'no-clear'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
// @ts-ignore
|
|
||||||
const command = args._.shift() || 'usage'
|
const command = args._.shift() || 'usage'
|
||||||
|
|
||||||
showBanner(command === 'dev' && args.clear !== false && !args.help)
|
showBanner(command === 'dev' && args.clear !== false && !args.help)
|
||||||
@ -30,7 +29,6 @@ async function _main () {
|
|||||||
// Check Node.js version in background
|
// Check Node.js version in background
|
||||||
setTimeout(() => { checkEngines().catch(() => {}) }, 1000)
|
setTimeout(() => { checkEngines().catch(() => {}) }, 1000)
|
||||||
|
|
||||||
// @ts-ignore default.default is hotfix for #621
|
|
||||||
const cmd = await commands[command as Command]() as NuxtCommand
|
const cmd = await commands[command as Command]() as NuxtCommand
|
||||||
if (args.h || args.help) {
|
if (args.h || args.help) {
|
||||||
showHelp(cmd.meta)
|
showHelp(cmd.meta)
|
||||||
|
@ -7,6 +7,7 @@ import destr from 'destr'
|
|||||||
import { splitByCase } from 'scule'
|
import { splitByCase } from 'scule'
|
||||||
import clipboardy from 'clipboardy'
|
import clipboardy from 'clipboardy'
|
||||||
import type { NuxtModule } from '@nuxt/schema'
|
import type { NuxtModule } from '@nuxt/schema'
|
||||||
|
import type { packageManagerLocks } from '../utils/packageManagers'
|
||||||
import { getPackageManager, getPackageManagerVersion } from '../utils/packageManagers'
|
import { getPackageManager, getPackageManagerVersion } from '../utils/packageManagers'
|
||||||
import { findup } from '../utils/fs'
|
import { findup } from '../utils/fs'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
@ -51,11 +52,10 @@ export default defineNuxtCommand({
|
|||||||
? 'vite' /* nuxt-vite */
|
? 'vite' /* nuxt-vite */
|
||||||
: 'webpack')
|
: 'webpack')
|
||||||
|
|
||||||
let packageManager = getPackageManager(rootDir)
|
let packageManager: keyof typeof packageManagerLocks | 'unknown' | null = getPackageManager(rootDir)
|
||||||
if (packageManager) {
|
if (packageManager) {
|
||||||
packageManager += '@' + getPackageManagerVersion(packageManager)
|
packageManager += '@' + getPackageManagerVersion(packageManager)
|
||||||
} else {
|
} else {
|
||||||
// @ts-expect-error
|
|
||||||
packageManager = 'unknown'
|
packageManager = 'unknown'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,9 @@ import { dirname, normalize } from 'pathe'
|
|||||||
export function getModulePaths (paths?: string | string[]): string[] {
|
export function getModulePaths (paths?: string | string[]): string[] {
|
||||||
return ([] as Array<string | undefined>)
|
return ([] as Array<string | undefined>)
|
||||||
.concat(
|
.concat(
|
||||||
// @ts-expect-error global object
|
|
||||||
global.__NUXT_PREPATHS__,
|
global.__NUXT_PREPATHS__,
|
||||||
paths,
|
paths,
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
// @ts-expect-error global object
|
|
||||||
global.__NUXT_PATHS__
|
global.__NUXT_PATHS__
|
||||||
)
|
)
|
||||||
.filter(Boolean) as string[]
|
.filter(Boolean) as string[]
|
||||||
@ -30,7 +28,7 @@ export function tryRequireModule (id: string, paths?: string | string[]) {
|
|||||||
|
|
||||||
export function getNearestPackage (id: string, paths?: string | string[]) {
|
export function getNearestPackage (id: string, paths?: string | string[]) {
|
||||||
while (dirname(id) !== id) {
|
while (dirname(id) !== id) {
|
||||||
try { return requireModule(id + '/package.json', paths) } catch { }
|
try { return requireModule(id + '/package.json', paths) } catch {}
|
||||||
id = dirname(id)
|
id = dirname(id)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
@ -104,7 +104,7 @@ export const writeTypes = async (nuxt: Nuxt) => {
|
|||||||
|
|
||||||
// This is needed for Nuxt 2 which clears the build directory again before building
|
// This is needed for Nuxt 2 which clears the build directory again before building
|
||||||
// https://github.com/nuxt/nuxt/blob/2.x/packages/builder/src/builder.js#L144
|
// https://github.com/nuxt/nuxt/blob/2.x/packages/builder/src/builder.js#L144
|
||||||
// @ts-expect-error
|
// @ts-expect-error TODO: Nuxt 2 hook
|
||||||
nuxt.hook('builder:prepared', writeFile)
|
nuxt.hook('builder:prepared', writeFile)
|
||||||
|
|
||||||
await writeFile()
|
await writeFile()
|
||||||
|
4
packages/nuxt/index.d.ts
vendored
4
packages/nuxt/index.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
declare global {
|
declare global {
|
||||||
const __NUXT_VERSION__: string
|
var __NUXT_VERSION__: string
|
||||||
|
var __NUXT_PREPATHS__: string[] | string | undefined
|
||||||
|
var __NUXT_PATHS__: string[] | string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export {}
|
export {}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { defineAsyncComponent } from 'vue'
|
import type { defineAsyncComponent } from 'vue'
|
||||||
import { createVNode, defineComponent } from 'vue'
|
import { createVNode, defineComponent } from 'vue'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import * as islandComponents from '#build/components.islands.mjs'
|
import * as islandComponents from '#build/components.islands.mjs'
|
||||||
import { createError } from '#app/composables/error'
|
import { createError } from '#app/composables/error'
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ import { Transition, computed, defineComponent, h, inject, nextTick, onMounted,
|
|||||||
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||||
import { _wrapIf } from './utils'
|
import { _wrapIf } from './utils'
|
||||||
import { useRoute } from '#app/composables/router'
|
import { useRoute } from '#app/composables/router'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { useRoute as useVueRouterRoute } from '#build/pages'
|
import { useRoute as useVueRouterRoute } from '#build/pages'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import layouts from '#build/layouts'
|
import layouts from '#build/layouts'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { appLayoutTransition as defaultLayoutTransition } from '#build/nuxt.config.mjs'
|
import { appLayoutTransition as defaultLayoutTransition } from '#build/nuxt.config.mjs'
|
||||||
|
|
||||||
// TODO: revert back to defineAsyncComponent when https://github.com/vuejs/core/issues/6638 is resolved
|
// TODO: revert back to defineAsyncComponent when https://github.com/vuejs/core/issues/6638 is resolved
|
||||||
|
@ -29,7 +29,7 @@ export type MultiWatchSources = (WatchSource<unknown> | object)[]
|
|||||||
export interface AsyncDataOptions<
|
export interface AsyncDataOptions<
|
||||||
ResT,
|
ResT,
|
||||||
DataT = ResT,
|
DataT = ResT,
|
||||||
PickKeys extends KeysOf<DataT> =KeysOf<DataT>,
|
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
|
||||||
> {
|
> {
|
||||||
server?: boolean
|
server?: boolean
|
||||||
lazy?: boolean
|
lazy?: boolean
|
||||||
@ -270,7 +270,7 @@ export function useLazyAsyncData<
|
|||||||
const autoKey = typeof args[args.length - 1] === 'string' ? args.pop() : undefined
|
const autoKey = typeof args[args.length - 1] === 'string' ? args.pop() : undefined
|
||||||
if (typeof args[0] !== 'string') { args.unshift(autoKey) }
|
if (typeof args[0] !== 'string') { args.unshift(autoKey) }
|
||||||
const [key, handler, options] = args as [string, (ctx?: NuxtApp) => Promise<ResT>, AsyncDataOptions<ResT, DataT, PickKeys>]
|
const [key, handler, options] = args as [string, (ctx?: NuxtApp) => Promise<ResT>, AsyncDataOptions<ResT, DataT, PickKeys>]
|
||||||
// @ts-ignore
|
// @ts-expect-error we pass an extra argument to prevent a key being injected
|
||||||
return useAsyncData(key, handler, { ...options, lazy: true }, null)
|
return useAsyncData(key, handler, { ...options, lazy: true }, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,6 @@ export function useLazyFetch<
|
|||||||
...opts,
|
...opts,
|
||||||
lazy: true
|
lazy: true
|
||||||
},
|
},
|
||||||
// @ts-ignore
|
// @ts-expect-error we pass an extra argument with the resolved auto-key to prevent another from being injected
|
||||||
autoKey)
|
autoKey)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import type { AppConfig } from 'nuxt/schema'
|
import type { AppConfig } from 'nuxt/schema'
|
||||||
import { useNuxtApp } from './nuxt'
|
import { useNuxtApp } from './nuxt'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import __appConfig from '#build/app.config.mjs'
|
import __appConfig from '#build/app.config.mjs'
|
||||||
|
|
||||||
type DeepPartial<T> = T extends Function ? T : T extends Record<string, any> ? { [P in keyof T]?: DeepPartial<T[P]> } : T
|
type DeepPartial<T> = T extends Function ? T : T extends Record<string, any> ? { [P in keyof T]?: DeepPartial<T[P]> } : T
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
// We set __webpack_public_path via this import with webpack builder
|
// We set __webpack_public_path via this import with webpack builder
|
||||||
import { createApp, createSSRApp, nextTick } from 'vue'
|
import { createApp, createSSRApp, nextTick } from 'vue'
|
||||||
import { $fetch } from 'ofetch'
|
import { $fetch } from 'ofetch'
|
||||||
// @ts-ignore
|
import type { $Fetch, NitroFetchRequest } from 'nitropack'
|
||||||
|
|
||||||
|
// This file must be imported first for webpack as we set __webpack_public_path__ there
|
||||||
|
// @ts-expect-error virtual file
|
||||||
import { baseURL } from '#build/paths.mjs'
|
import { baseURL } from '#build/paths.mjs'
|
||||||
|
|
||||||
import type { CreateOptions } from '#app'
|
import type { CreateOptions } from '#app'
|
||||||
import { applyPlugins, createNuxtApp, normalizePlugins } from '#app/nuxt'
|
import { applyPlugins, createNuxtApp, normalizePlugins } from '#app/nuxt'
|
||||||
|
|
||||||
import '#build/css'
|
import '#build/css'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import _plugins from '#build/plugins'
|
import _plugins from '#build/plugins'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import RootComponent from '#build/root-component.mjs'
|
import RootComponent from '#build/root-component.mjs'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { appRootId } from '#build/nuxt.config.mjs'
|
import { appRootId } from '#build/nuxt.config.mjs'
|
||||||
|
|
||||||
if (!globalThis.$fetch) {
|
if (!globalThis.$fetch) {
|
||||||
// @ts-ignore
|
|
||||||
globalThis.$fetch = $fetch.create({
|
globalThis.$fetch = $fetch.create({
|
||||||
baseURL: baseURL()
|
baseURL: baseURL()
|
||||||
})
|
}) as $Fetch<unknown, NitroFetchRequest>
|
||||||
}
|
}
|
||||||
|
|
||||||
let entry: Function
|
let entry: Function
|
||||||
@ -45,9 +49,7 @@ if (process.server) {
|
|||||||
if (process.client) {
|
if (process.client) {
|
||||||
// TODO: temporary webpack 5 HMR fix
|
// TODO: temporary webpack 5 HMR fix
|
||||||
// https://github.com/webpack-contrib/webpack-hot-middleware/issues/390
|
// https://github.com/webpack-contrib/webpack-hot-middleware/issues/390
|
||||||
// @ts-ignore
|
|
||||||
if (process.dev && import.meta.webpackHot) {
|
if (process.dev && import.meta.webpackHot) {
|
||||||
// @ts-ignore
|
|
||||||
import.meta.webpackHot.accept()
|
import.meta.webpackHot.accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,6 @@ export function createNuxtApp (options: CreateOptions) {
|
|||||||
|
|
||||||
// Inject $nuxt
|
// Inject $nuxt
|
||||||
defineGetter(nuxtApp.vueApp, '$nuxt', nuxtApp)
|
defineGetter(nuxtApp.vueApp, '$nuxt', nuxtApp)
|
||||||
// @ts-expect-error
|
|
||||||
defineGetter(nuxtApp.vueApp.config.globalProperties, '$nuxt', nuxtApp)
|
defineGetter(nuxtApp.vueApp.config.globalProperties, '$nuxt', nuxtApp)
|
||||||
|
|
||||||
if (process.server) {
|
if (process.server) {
|
||||||
|
@ -7,7 +7,7 @@ import { navigateTo } from '../composables/router'
|
|||||||
import { useState } from '../composables/state'
|
import { useState } from '../composables/state'
|
||||||
import { useRequestEvent } from '../composables/ssr'
|
import { useRequestEvent } from '../composables/ssr'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { globalMiddleware } from '#build/middleware'
|
import { globalMiddleware } from '#build/middleware'
|
||||||
|
|
||||||
interface Route {
|
interface Route {
|
||||||
|
3
packages/nuxt/src/app/types/augments.d.ts
vendored
3
packages/nuxt/src/app/types/augments.d.ts
vendored
@ -22,6 +22,9 @@ declare module 'vue' {
|
|||||||
interface App<HostElement> {
|
interface App<HostElement> {
|
||||||
$nuxt: NuxtApp
|
$nuxt: NuxtApp
|
||||||
}
|
}
|
||||||
|
interface ComponentCustomProperties {
|
||||||
|
$nuxt: NuxtApp
|
||||||
|
}
|
||||||
interface ComponentInternalInstance {
|
interface ComponentInternalInstance {
|
||||||
_nuxtOnBeforeMountCbs: Function[]
|
_nuxtOnBeforeMountCbs: Function[]
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,9 @@ export default <NitroErrorHandler> async function errorhandler (error: H3Error,
|
|||||||
// Fallback to static rendered error page
|
// Fallback to static rendered error page
|
||||||
if (!res) {
|
if (!res) {
|
||||||
const { template } = process.dev
|
const { template } = process.dev
|
||||||
// @ts-ignore
|
// @ts-expect-error TODO: add legacy type support for subpath imports
|
||||||
? await import('@nuxt/ui-templates/templates/error-dev.mjs')
|
? await import('@nuxt/ui-templates/templates/error-dev.mjs')
|
||||||
// @ts-ignore
|
// @ts-expect-error TODO: add legacy type support for subpath imports
|
||||||
: await import('@nuxt/ui-templates/templates/error-500.mjs')
|
: await import('@nuxt/ui-templates/templates/error-500.mjs')
|
||||||
if (process.dev) {
|
if (process.dev) {
|
||||||
// TODO: Support `message` in template
|
// TODO: Support `message` in template
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
// @ts-ignore
|
|
||||||
import { useRuntimeConfig } from '#internal/nitro'
|
import { useRuntimeConfig } from '#internal/nitro'
|
||||||
|
|
||||||
export function baseURL (): string {
|
export function baseURL (): string {
|
||||||
|
@ -15,14 +15,14 @@ import { useNitroApp } from '#internal/nitro/app'
|
|||||||
|
|
||||||
// eslint-disable-next-line import/no-restricted-paths
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
import type { NuxtApp, NuxtSSRContext } from '#app/nuxt'
|
import type { NuxtApp, NuxtSSRContext } from '#app/nuxt'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { appRootId, appRootTag } from '#internal/nuxt.config.mjs'
|
import { appRootId, appRootTag } from '#internal/nuxt.config.mjs'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { buildAssetsURL, publicAssetsURL } from '#paths'
|
import { buildAssetsURL, publicAssetsURL } from '#paths'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error private property consumed by vite-generated url helpers
|
||||||
globalThis.__buildAssetsURL = buildAssetsURL
|
globalThis.__buildAssetsURL = buildAssetsURL
|
||||||
// @ts-ignore
|
// @ts-expect-error private property consumed by vite-generated url helpers
|
||||||
globalThis.__publicAssetsURL = publicAssetsURL
|
globalThis.__publicAssetsURL = publicAssetsURL
|
||||||
|
|
||||||
export interface NuxtRenderHTMLContext {
|
export interface NuxtRenderHTMLContext {
|
||||||
@ -61,18 +61,18 @@ export interface NuxtRenderResponse {
|
|||||||
|
|
||||||
interface ClientManifest {}
|
interface ClientManifest {}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error file will be produced after app build
|
||||||
const getClientManifest: () => Promise<Manifest> = () => import('#build/dist/server/client.manifest.mjs')
|
const getClientManifest: () => Promise<Manifest> = () => import('#build/dist/server/client.manifest.mjs')
|
||||||
.then(r => r.default || r)
|
.then(r => r.default || r)
|
||||||
.then(r => typeof r === 'function' ? r() : r) as Promise<ClientManifest>
|
.then(r => typeof r === 'function' ? r() : r) as Promise<ClientManifest>
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
const getStaticRenderedHead = (): Promise<NuxtMeta> => import('#head-static').then(r => r.default || r)
|
const getStaticRenderedHead = (): Promise<NuxtMeta> => import('#head-static').then(r => r.default || r)
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error file will be produced after app build
|
||||||
const getServerEntry = () => import('#build/dist/server/server.mjs').then(r => r.default || r)
|
const getServerEntry = () => import('#build/dist/server/server.mjs').then(r => r.default || r)
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error file will be produced after app build
|
||||||
const getSSRStyles = lazyCachedFunction((): Promise<Record<string, () => Promise<string[]>>> => import('#build/dist/server/styles.mjs').then(r => r.default || r))
|
const getSSRStyles = lazyCachedFunction((): Promise<Record<string, () => Promise<string[]>>> => import('#build/dist/server/styles.mjs').then(r => r.default || r))
|
||||||
|
|
||||||
// -- SSR Renderer --
|
// -- SSR Renderer --
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
resolveSchema as resolveUntypedSchema
|
resolveSchema as resolveUntypedSchema
|
||||||
} from 'untyped'
|
} from 'untyped'
|
||||||
import type { Schema, SchemaDefinition } from 'untyped'
|
import type { Schema, SchemaDefinition } from 'untyped'
|
||||||
// @ts-ignore
|
// @ts-expect-error TODO: add upstream type
|
||||||
import untypedPlugin from 'untyped/babel-plugin'
|
import untypedPlugin from 'untyped/babel-plugin'
|
||||||
import jiti from 'jiti'
|
import jiti from 'jiti'
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ export default defineNuxtModule({
|
|||||||
|
|
||||||
async function resolveSchema () {
|
async function resolveSchema () {
|
||||||
// Global import
|
// Global import
|
||||||
// @ts-ignore
|
// @ts-expect-error adding to globalThis for 'auto-import' support within nuxt.config file
|
||||||
globalThis.defineNuxtSchema = (val: any) => val
|
globalThis.defineNuxtSchema = (val: any) => val
|
||||||
|
|
||||||
// Load schema from layers
|
// Load schema from layers
|
||||||
@ -107,9 +107,8 @@ export default defineNuxtModule({
|
|||||||
schemaDefs.map(schemaDef => resolveUntypedSchema(schemaDef))
|
schemaDefs.map(schemaDef => resolveUntypedSchema(schemaDef))
|
||||||
)
|
)
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
// Merge after normalization
|
// Merge after normalization
|
||||||
const schema = defu(...schemas)
|
const schema = defu(...schemas as [Schema, Schema])
|
||||||
|
|
||||||
// Allow hooking to extend resolved schema
|
// Allow hooking to extend resolved schema
|
||||||
await nuxt.hooks.callHook('schema:resolved', schema)
|
await nuxt.hooks.callHook('schema:resolved', schema)
|
||||||
|
@ -306,12 +306,10 @@ export const nuxtConfigTemplate = {
|
|||||||
function _resolveId (id: string) {
|
function _resolveId (id: string) {
|
||||||
return resolvePath(id, {
|
return resolvePath(id, {
|
||||||
url: [
|
url: [
|
||||||
// @ts-ignore
|
...(typeof global.__NUXT_PREPATHS__ === 'string' ? [global.__NUXT_PREPATHS__] : global.__NUXT_PREPATHS__ || []),
|
||||||
global.__NUXT_PREPATHS__,
|
|
||||||
import.meta.url,
|
import.meta.url,
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
// @ts-ignore
|
...(typeof global.__NUXT_PATHS__ === 'string' ? [global.__NUXT_PATHS__] : global.__NUXT_PATHS__ || [])
|
||||||
global.__NUXT_PATHS__
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import type { RouterViewSlotProps } from './utils'
|
|||||||
import { generateRouteKey, wrapInKeepAlive } from './utils'
|
import { generateRouteKey, wrapInKeepAlive } from './utils'
|
||||||
import { useNuxtApp } from '#app/nuxt'
|
import { useNuxtApp } from '#app/nuxt'
|
||||||
import { _wrapIf } from '#app/components/utils'
|
import { _wrapIf } from '#app/components/utils'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { appKeepalive as defaultKeepaliveConfig, appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
|
import { appKeepalive as defaultKeepaliveConfig, appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -73,8 +73,7 @@ function _mergeTransitionProps (routeProps: TransitionProps[]): TransitionProps
|
|||||||
...prop,
|
...prop,
|
||||||
onAfterLeave: _toArray(prop.onAfterLeave)
|
onAfterLeave: _toArray(prop.onAfterLeave)
|
||||||
}))
|
}))
|
||||||
// @ts-ignore
|
return defu(..._props as [TransitionProps, TransitionProps])
|
||||||
return defu(..._props)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const RouteProvider = defineComponent({
|
const RouteProvider = defineComponent({
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { hasProtocol } from 'ufo'
|
import { hasProtocol } from 'ufo'
|
||||||
import { defineNuxtPlugin } from '#app/nuxt'
|
import { defineNuxtPlugin } from '#app/nuxt'
|
||||||
import { useRouter } from '#app/composables/router'
|
import { useRouter } from '#app/composables/router'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import layouts from '#build/layouts'
|
import layouts from '#build/layouts'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { namedMiddleware } from '#build/middleware'
|
import { namedMiddleware } from '#build/middleware'
|
||||||
|
|
||||||
export default defineNuxtPlugin({
|
export default defineNuxtPlugin({
|
||||||
|
@ -16,11 +16,11 @@ import { clearError, showError, useError } from '#app/composables/error'
|
|||||||
import { useState } from '#app/composables/state'
|
import { useState } from '#app/composables/state'
|
||||||
import { navigateTo } from '#app/composables/router'
|
import { navigateTo } from '#app/composables/router'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import _routes from '#build/routes'
|
import _routes from '#build/routes'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import routerOptions from '#build/router.options'
|
import routerOptions from '#build/router.options'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { globalMiddleware, namedMiddleware } from '#build/middleware'
|
import { globalMiddleware, namedMiddleware } from '#build/middleware'
|
||||||
|
|
||||||
// https://github.com/vuejs/router/blob/4a0cc8b9c1e642cdf47cc007fa5bbebde70afc66/packages/router/src/history/html5.ts#L37
|
// https://github.com/vuejs/router/blob/4a0cc8b9c1e642cdf47cc007fa5bbebde70afc66/packages/router/src/history/html5.ts#L37
|
||||||
|
@ -2,7 +2,7 @@ import type { RouteLocationNormalized, RouterScrollBehavior } from 'vue-router'
|
|||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
import type { RouterConfig } from 'nuxt/schema'
|
import type { RouterConfig } from 'nuxt/schema'
|
||||||
import { useNuxtApp } from '#app/nuxt'
|
import { useNuxtApp } from '#app/nuxt'
|
||||||
// @ts-ignore
|
// @ts-expect-error virtual file
|
||||||
import { appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
|
import { appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
|
||||||
|
|
||||||
type ScrollPosition = Awaited<ReturnType<RouterScrollBehavior>>
|
type ScrollPosition = Awaited<ReturnType<RouterScrollBehavior>>
|
||||||
|
@ -225,7 +225,7 @@ const srcDir = rFixture('.')
|
|||||||
it('components:scanComponents', async () => {
|
it('components:scanComponents', async () => {
|
||||||
const scannedComponents = await scanComponents(dirs, srcDir)
|
const scannedComponents = await scanComponents(dirs, srcDir)
|
||||||
for (const c of scannedComponents) {
|
for (const c of scannedComponents) {
|
||||||
// @ts-ignore
|
// @ts-expect-error filePath is not optional but we don't want it to be in the snapshot
|
||||||
delete c.filePath
|
delete c.filePath
|
||||||
}
|
}
|
||||||
expect(scannedComponents).deep.eq(expectedComponents)
|
expect(scannedComponents).deep.eq(expectedComponents)
|
||||||
|
@ -258,9 +258,10 @@ export default defineUntypedSchema({
|
|||||||
/**
|
/**
|
||||||
* Customize PostCSS Loader.
|
* Customize PostCSS Loader.
|
||||||
* Same options as https://github.com/webpack-contrib/postcss-loader#options
|
* Same options as https://github.com/webpack-contrib/postcss-loader#options
|
||||||
|
*
|
||||||
|
* @type {{ execute?: boolean, postcssOptions: typeof import('postcss').ProcessOptions, sourceMap?: boolean, implementation?: any }}
|
||||||
*/
|
*/
|
||||||
postcss: {
|
postcss: {
|
||||||
execute: undefined,
|
|
||||||
postcssOptions: {
|
postcssOptions: {
|
||||||
config: {
|
config: {
|
||||||
$resolve: async (val, get) => val ?? (await get('postcss.config'))
|
$resolve: async (val, get) => val ?? (await get('postcss.config'))
|
||||||
@ -269,9 +270,6 @@ export default defineUntypedSchema({
|
|||||||
$resolve: async (val, get) => val ?? (await get('postcss.plugins'))
|
$resolve: async (val, get) => val ?? (await get('postcss.plugins'))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sourceMap: undefined,
|
|
||||||
implementation: undefined,
|
|
||||||
order: ''
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@ import { defu } from 'defu'
|
|||||||
import * as _kit from '@nuxt/kit'
|
import * as _kit from '@nuxt/kit'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
// @ts-ignore type cast
|
// @ts-expect-error type cast
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const kit: typeof _kit = _kit.default || _kit
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as _kit from '@nuxt/kit'
|
import * as _kit from '@nuxt/kit'
|
||||||
import { createTest, exposeContextToEnv } from '@nuxt/test-utils'
|
import { createTest, exposeContextToEnv } from '@nuxt/test-utils'
|
||||||
|
|
||||||
// @ts-ignore type cast
|
// @ts-expect-error type cast
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const kit: typeof _kit = _kit.default || _kit
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import * as _kit from '@nuxt/kit'
|
|||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
// @ts-ignore type cast
|
// @ts-expect-error type cast
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const kit: typeof _kit = _kit.default || _kit
|
const kit: typeof _kit = _kit.default || _kit
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { TestHooks } from '../types'
|
import type { TestHooks } from '../types'
|
||||||
|
|
||||||
export default async function setupJest (hooks: TestHooks) {
|
export default async function setupJest (hooks: TestHooks) {
|
||||||
// @ts-ignore
|
// @ts-expect-error jest is not a dependency
|
||||||
const jest = await import('jest')
|
const jest = await import('jest')
|
||||||
|
|
||||||
hooks.ctx.mockFn = jest.fn
|
hooks.ctx.mockFn = jest.fn
|
||||||
|
@ -4,6 +4,8 @@ import { visualizer } from 'rollup-plugin-visualizer'
|
|||||||
import type { ViteBuildContext } from '../vite'
|
import type { ViteBuildContext } from '../vite'
|
||||||
|
|
||||||
export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
||||||
|
if (typeof ctx.nuxt.options.build.analyze === 'boolean') { return [] }
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
name: 'nuxt:analyze-minify',
|
name: 'nuxt:analyze-minify',
|
||||||
@ -19,11 +21,9 @@ export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// @ts-ignore
|
|
||||||
visualizer({
|
visualizer({
|
||||||
...ctx.nuxt.options.build.analyze as any,
|
...ctx.nuxt.options.build.analyze,
|
||||||
// @ts-ignore
|
filename: 'filename' in ctx.nuxt.options.build.analyze ? ctx.nuxt.options.build.analyze.filename!.replace('{name}', 'client') : undefined,
|
||||||
filename: ctx.nuxt.options.build.analyze.filename.replace('{name}', 'client'),
|
|
||||||
title: 'Client bundle stats',
|
title: 'Client bundle stats',
|
||||||
gzipSize: true
|
gzipSize: true
|
||||||
})
|
})
|
||||||
|
@ -88,15 +88,15 @@ function basePlugins (ctx: WebpackConfigContext) {
|
|||||||
name: ctx.name,
|
name: ctx.name,
|
||||||
color: colors[ctx.name as keyof typeof colors],
|
color: colors[ctx.name as keyof typeof colors],
|
||||||
reporters: ['stats'],
|
reporters: ['stats'],
|
||||||
|
// @ts-expect-error TODO: this is a valid option for Webpack.ProgressPlugin and needs to be declared for WebpackBar
|
||||||
stats: !ctx.isDev,
|
stats: !ctx.isDev,
|
||||||
reporter: {
|
reporter: {
|
||||||
// @ts-ignore
|
reporter: {
|
||||||
change: (_, { shortPath }) => {
|
change: (_, { shortPath }) => {
|
||||||
if (!ctx.isServer) {
|
if (!ctx.isServer) {
|
||||||
nuxt.callHook('webpack:change', shortPath)
|
nuxt.callHook('webpack:change', shortPath)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// @ts-ignore
|
|
||||||
done: ({ state }) => {
|
done: ({ state }) => {
|
||||||
if (state.hasErrors) {
|
if (state.hasErrors) {
|
||||||
nuxt.callHook('webpack:error')
|
nuxt.callHook('webpack:error')
|
||||||
@ -107,11 +107,11 @@ function basePlugins (ctx: WebpackConfigContext) {
|
|||||||
allDone: () => {
|
allDone: () => {
|
||||||
nuxt.callHook('webpack:done')
|
nuxt.callHook('webpack:done')
|
||||||
},
|
},
|
||||||
// @ts-ignore
|
|
||||||
progress ({ statesArray }) {
|
progress ({ statesArray }) {
|
||||||
nuxt.callHook('webpack:progress', statesArray)
|
nuxt.callHook('webpack:progress', statesArray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import type { WebpackConfigContext } from '../utils/config'
|
|||||||
export function vue (ctx: WebpackConfigContext) {
|
export function vue (ctx: WebpackConfigContext) {
|
||||||
const { options, config } = ctx
|
const { options, config } = ctx
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error de-default vue-loader
|
||||||
config.plugins.push(new (VueLoaderPlugin.default || VueLoaderPlugin)())
|
config.plugins!.push(new (VueLoaderPlugin.default || VueLoaderPlugin)())
|
||||||
|
|
||||||
config.module!.rules!.push({
|
config.module!.rules!.push({
|
||||||
test: /\.vue$/i,
|
test: /\.vue$/i,
|
||||||
|
@ -3,7 +3,7 @@ import type { Configuration } from 'webpack'
|
|||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
import { logger } from '@nuxt/kit'
|
import { logger } from '@nuxt/kit'
|
||||||
|
|
||||||
export interface WebpackConfigContext extends ReturnType<typeof createWebpackConfigContext>{ }
|
export interface WebpackConfigContext extends ReturnType<typeof createWebpackConfigContext> {}
|
||||||
|
|
||||||
type WebpackConfigPreset = (ctx: WebpackConfigContext, options?: object) => void
|
type WebpackConfigPreset = (ctx: WebpackConfigContext, options?: object) => void
|
||||||
type WebpackConfigPresetItem = WebpackConfigPreset | [WebpackConfigPreset, any]
|
type WebpackConfigPresetItem = WebpackConfigPreset | [WebpackConfigPreset, any]
|
||||||
@ -63,7 +63,7 @@ export function getWebpackConfig (ctx: WebpackConfigContext): Configuration {
|
|||||||
const builder = {}
|
const builder = {}
|
||||||
const loaders: any[] = []
|
const loaders: any[] = []
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error TODO: remove support for `build.extend` in v3.5
|
||||||
const { extend } = options.build
|
const { extend } = options.build
|
||||||
if (typeof extend === 'function') {
|
if (typeof extend === 'function') {
|
||||||
const extendedConfig = extend.call(
|
const extendedConfig = extend.call(
|
||||||
|
@ -17,7 +17,7 @@ export function createMFS () {
|
|||||||
|
|
||||||
// Used by vue-renderer
|
// Used by vue-renderer
|
||||||
_fs.exists = p => Promise.resolve(_fs.existsSync(p))
|
_fs.exists = p => Promise.resolve(_fs.existsSync(p))
|
||||||
// @ts-ignore
|
// @ts-expect-error need better types for `pify`
|
||||||
_fs.readFile = pify(_fs.readFile)
|
_fs.readFile = pify(_fs.readFile)
|
||||||
|
|
||||||
return _fs as IFs & { join?(...paths: string[]): string }
|
return _fs as IFs & { join?(...paths: string[]): string }
|
||||||
|
@ -71,11 +71,7 @@ export const getPostcssConfig = (nuxt: Nuxt) => {
|
|||||||
loadPlugins(postcssOptions)
|
loadPlugins(postcssOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
delete nuxt.options.webpack.postcss.order
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// @ts-expect-error
|
|
||||||
sourceMap: nuxt.options.webpack.cssSourceMap,
|
sourceMap: nuxt.options.webpack.cssSourceMap,
|
||||||
...nuxt.options.webpack.postcss,
|
...nuxt.options.webpack.postcss,
|
||||||
postcssOptions
|
postcssOptions
|
||||||
|
@ -90,7 +90,7 @@ async function createDevMiddleware (compiler: Compiler) {
|
|||||||
...nuxt.options.webpack.devMiddleware
|
...nuxt.options.webpack.devMiddleware
|
||||||
})
|
})
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error need better types for `pify`
|
||||||
nuxt.hook('close', () => pify(devMiddleware.close.bind(devMiddleware))())
|
nuxt.hook('close', () => pify(devMiddleware.close.bind(devMiddleware))())
|
||||||
|
|
||||||
const { client: _client, ...hotMiddlewareOptions } = nuxt.options.webpack.hotMiddleware || {}
|
const { client: _client, ...hotMiddlewareOptions } = nuxt.options.webpack.hotMiddleware || {}
|
||||||
|
@ -67,7 +67,6 @@ const crawler = new Crawler({
|
|||||||
callback (error, res, done) {
|
callback (error, res, done) {
|
||||||
const { $ } = res
|
const { $ } = res
|
||||||
const { uri } = res.options
|
const { uri } = res.options
|
||||||
// @ts-ignore
|
|
||||||
const { statusCode } = res.request.response
|
const { statusCode } = res.request.response
|
||||||
|
|
||||||
if (error || ![200, 301, 302].includes(statusCode) || !$) {
|
if (error || ![200, 301, 302].includes(statusCode) || !$) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// @ts-ignore
|
// @ts-expect-error assigning property to window object to break SSR
|
||||||
window.test = true
|
window.test = true
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
6
test/fixtures/basic/types.ts
vendored
6
test/fixtures/basic/types.ts
vendored
@ -120,9 +120,9 @@ describe('layouts', () => {
|
|||||||
describe('modules', () => {
|
describe('modules', () => {
|
||||||
it('augments schema automatically', () => {
|
it('augments schema automatically', () => {
|
||||||
defineNuxtConfig({ sampleModule: { enabled: false } })
|
defineNuxtConfig({ sampleModule: { enabled: false } })
|
||||||
// @ts-expect-error
|
// @ts-expect-error we want to ensure we throw type error on invalid option
|
||||||
defineNuxtConfig({ sampleModule: { other: false } })
|
defineNuxtConfig({ sampleModule: { other: false } })
|
||||||
// @ts-expect-error
|
// @ts-expect-error we want to ensure we throw type error on invalid key
|
||||||
defineNuxtConfig({ undeclaredKey: { other: false } })
|
defineNuxtConfig({ undeclaredKey: { other: false } })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -158,7 +158,7 @@ describe('runtimeConfig', () => {
|
|||||||
const val = defineNuxtConfig({
|
const val = defineNuxtConfig({
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
public: {
|
public: {
|
||||||
// @ts-expect-error
|
// @ts-expect-error this should be a number
|
||||||
testConfig: 'test',
|
testConfig: 'test',
|
||||||
ids: [1, 2]
|
ids: [1, 2]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user