chore(deps): update all non-major dependencies (main) (#28321)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
renovate[bot] 2024-08-05 16:33:27 +01:00 committed by GitHub
parent ede1f923fc
commit c906312034
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
53 changed files with 1276 additions and 1195 deletions

View File

@ -57,7 +57,7 @@ jobs:
run: pnpm build run: pnpm build
- name: Cache dist - name: Cache dist
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
with: with:
retention-days: 3 retention-days: 3
name: dist name: dist
@ -85,7 +85,7 @@ jobs:
run: pnpm install run: pnpm install
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # v3.25.14 uses: github/codeql-action/init@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
with: with:
languages: javascript languages: javascript
queries: +security-and-quality queries: +security-and-quality
@ -97,7 +97,7 @@ jobs:
path: packages path: packages
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # v3.25.14 uses: github/codeql-action/analyze@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
with: with:
category: "/language:javascript" category: "/language:javascript"

View File

@ -37,7 +37,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: "Run analysis" - name: "Run analysis"
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3 uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
@ -59,7 +59,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab. # format to the repository Actions tab.
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
if: github.repository == 'nuxt/nuxt' && success() if: github.repository == 'nuxt/nuxt' && success()
with: with:
name: SARIF file name: SARIF file
@ -68,7 +68,7 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # v3.25.14 uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
if: github.repository == 'nuxt/nuxt' && success() if: github.repository == 'nuxt/nuxt' && success()
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@ -579,7 +579,7 @@ For local development or automated deploy pipelines, testing against a separate
To utilize a separate target host for end-to-end tests, simply provide the `host` property of the `setup` function with the desired URL. To utilize a separate target host for end-to-end tests, simply provide the `host` property of the `setup` function with the desired URL.
```ts twoslash ```ts
import { setup, createPage } from '@nuxt/test-utils/e2e' import { setup, createPage } from '@nuxt/test-utils/e2e'
import { describe, it, expect } from 'vitest' import { describe, it, expect } from 'vitest'

View File

@ -39,42 +39,43 @@
"@nuxt/ui-templates": "workspace:*", "@nuxt/ui-templates": "workspace:*",
"@nuxt/vite-builder": "workspace:*", "@nuxt/vite-builder": "workspace:*",
"@nuxt/webpack-builder": "workspace:*", "@nuxt/webpack-builder": "workspace:*",
"@types/node": "*",
"c12": "2.0.0-beta.1", "c12": "2.0.0-beta.1",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"jiti": "2.0.0-beta.3", "jiti": "2.0.0-beta.3",
"magic-string": "^0.30.10", "magic-string": "^0.30.11",
"nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda", "nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda",
"nuxt": "workspace:*", "nuxt": "workspace:*",
"rollup": "^4.19.0", "rollup": "^4.20.0",
"typescript": "5.5.4", "typescript": "5.5.4",
"unbuild": "3.0.0-rc.7", "unbuild": "3.0.0-rc.7",
"vite": "5.3.5", "vite": "5.3.5",
"vue": "3.4.34" "vue": "3.4.34"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "9.7.0", "@eslint/js": "9.8.0",
"@nuxt/eslint-config": "0.3.13", "@nuxt/eslint-config": "0.5.0",
"@nuxt/kit": "workspace:*", "@nuxt/kit": "workspace:*",
"@nuxt/test-utils": "3.13.1", "@nuxt/test-utils": "3.14.0",
"@nuxt/webpack-builder": "workspace:*", "@nuxt/webpack-builder": "workspace:*",
"@testing-library/vue": "8.1.0", "@testing-library/vue": "8.1.0",
"@types/eslint__js": "8.42.3", "@types/eslint__js": "8.42.3",
"@types/node": "20.14.12", "@types/node": "20.14.14",
"@types/semver": "7.5.8", "@types/semver": "7.5.8",
"@unhead/schema": "1.9.16", "@unhead/schema": "1.9.16",
"@vitejs/plugin-vue": "5.1.0", "@vitejs/plugin-vue": "5.1.2",
"@vitest/coverage-v8": "2.0.5", "@vitest/coverage-v8": "2.0.5",
"@vue/test-utils": "2.4.6", "@vue/test-utils": "2.4.6",
"autoprefixer": "10.4.19", "autoprefixer": "10.4.20",
"case-police": "0.6.1", "case-police": "0.6.1",
"changelogen": "0.5.5", "changelogen": "0.5.5",
"consola": "3.2.3", "consola": "3.2.3",
"cssnano": "7.0.4", "cssnano": "7.0.4",
"devalue": "5.0.0", "devalue": "5.0.0",
"eslint": "9.7.0", "eslint": "9.8.0",
"eslint-plugin-no-only-tests": "3.1.0", "eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-perfectionist": "3.0.0", "eslint-plugin-perfectionist": "3.1.1",
"eslint-typegen": "0.2.4", "eslint-typegen": "0.3.0",
"execa": "9.3.0", "execa": "9.3.0",
"globby": "14.0.2", "globby": "14.0.2",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
@ -96,7 +97,7 @@
"vitest": "2.0.5", "vitest": "2.0.5",
"vitest-environment-nuxt": "1.0.0", "vitest-environment-nuxt": "1.0.0",
"vue": "3.4.34", "vue": "3.4.34",
"vue-router": "4.4.0", "vue-router": "4.4.2",
"vue-tsc": "2.0.29" "vue-tsc": "2.0.29"
}, },
"packageManager": "pnpm@9.6.0", "packageManager": "pnpm@9.6.0",

View File

@ -44,7 +44,7 @@
"semver": "^7.6.3", "semver": "^7.6.3",
"ufo": "^1.5.4", "ufo": "^1.5.4",
"unctx": "^2.3.1", "unctx": "^2.3.1",
"unimport": "^3.9.0", "unimport": "^3.10.0",
"untyped": "^1.4.2" "untyped": "^1.4.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -30,8 +30,10 @@ export interface ExtendConfigOptions {
prepend?: boolean prepend?: boolean
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface ExtendWebpackConfigOptions extends ExtendConfigOptions {} export interface ExtendWebpackConfigOptions extends ExtendConfigOptions {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface ExtendViteConfigOptions extends ExtendConfigOptions {} export interface ExtendViteConfigOptions extends ExtendConfigOptions {}
/** /**

View File

@ -8,6 +8,7 @@ import { globby } from 'globby'
import defu from 'defu' import defu from 'defu'
export interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, 'overrides'> { export interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, 'overrides'> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
overrides?: Exclude<LoadConfigOptions<NuxtConfig>['overrides'], Promise<any> | Function> overrides?: Exclude<LoadConfigOptions<NuxtConfig>['overrides'], Promise<any> | Function>
} }

View File

@ -1,6 +1,6 @@
import { pathToFileURL } from 'node:url' import { pathToFileURL } from 'node:url'
import { readPackageJSON, resolvePackageJSON } from 'pkg-types' import { readPackageJSON, resolvePackageJSON } from 'pkg-types'
import type { Nuxt } from '@nuxt/schema' import type { Nuxt, NuxtConfig } from '@nuxt/schema'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import { importModule, tryImportModule } from '../internal/esm' import { importModule, tryImportModule } from '../internal/esm'
import type { LoadNuxtConfigOptions } from './config' import type { LoadNuxtConfigOptions } from './config'
@ -16,7 +16,7 @@ export interface LoadNuxtOptions extends LoadNuxtConfigOptions {
export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> { export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Backward compatibility // Backward compatibility
opts.cwd = resolve(opts.cwd || (opts as any).rootDir /* backwards compat */ || '.') opts.cwd = resolve(opts.cwd || (opts as any).rootDir /* backwards compat */ || '.')
opts.overrides = opts.overrides || (opts as any).config as {} /* backwards compat */ || {} opts.overrides = opts.overrides || (opts as any).config as NuxtConfig /* backwards compat */ || {}
// Apply dev as config override // Apply dev as config override
opts.overrides.dev = !!opts.dev opts.overrides.dev = !!opts.dev

View File

@ -55,10 +55,10 @@ function _defineNuxtModule<
inlineOptions?: Partial<TOptions>, inlineOptions?: Partial<TOptions>,
nuxt: Nuxt = useNuxt(), nuxt: Nuxt = useNuxt(),
): Promise< ): Promise<
TWith extends true TWith extends true
? ResolvedModuleOptions<TOptions, TOptionsDefaults> ? ResolvedModuleOptions<TOptions, TOptionsDefaults>
: TOptions : TOptions
> { > {
const nuxtConfigOptionsKey = module.meta.configKey || module.meta.name const nuxtConfigOptionsKey = module.meta.configKey || module.meta.name
const nuxtConfigOptions: Partial<TOptions> = nuxtConfigOptionsKey && nuxtConfigOptionsKey in nuxt.options ? nuxt.options[<keyof NuxtOptions> nuxtConfigOptionsKey] : {} const nuxtConfigOptions: Partial<TOptions> = nuxtConfigOptionsKey && nuxtConfigOptionsKey in nuxt.options ? nuxt.options[<keyof NuxtOptions> nuxtConfigOptionsKey] : {}

View File

@ -59,7 +59,7 @@ export function getDirectory (p: string) {
// we need to target directories instead of module file paths themselves // we need to target directories instead of module file paths themselves
// /home/user/project/node_modules/module/index.js -> /home/user/project/node_modules/module // /home/user/project/node_modules/module/index.js -> /home/user/project/node_modules/module
return isAbsolute(p) && lstatSync(p).isFile() ? dirname(p) : p return isAbsolute(p) && lstatSync(p).isFile() ? dirname(p) : p
} catch (e) { } catch {
// maybe the path is absolute but does not exist, allow this to bubble up // maybe the path is absolute but does not exist, allow this to bubble up
} }
return p return p

View File

@ -3,5 +3,6 @@ import type { ConfigLayerMeta, DefineConfig } from 'c12'
export { NuxtConfig } from 'nuxt/schema' export { NuxtConfig } from 'nuxt/schema'
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface DefineNuxtConfig extends DefineConfig<NuxtConfig, ConfigLayerMeta> {} export interface DefineNuxtConfig extends DefineConfig<NuxtConfig, ConfigLayerMeta> {}
export declare const defineNuxtConfig: DefineNuxtConfig export declare const defineNuxtConfig: DefineNuxtConfig

View File

@ -89,7 +89,7 @@
"jiti": "^2.0.0-beta.3", "jiti": "^2.0.0-beta.3",
"klona": "^2.0.6", "klona": "^2.0.6",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"magic-string": "^0.30.10", "magic-string": "^0.30.11",
"mlly": "^1.7.1", "mlly": "^1.7.1",
"nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda", "nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda",
"nuxi": "^3.12.0", "nuxi": "^3.12.0",
@ -109,22 +109,22 @@
"uncrypto": "^0.1.3", "uncrypto": "^0.1.3",
"unctx": "^2.3.1", "unctx": "^2.3.1",
"unenv": "^1.10.0", "unenv": "^1.10.0",
"unimport": "^3.9.0", "unimport": "^3.10.0",
"unplugin": "^1.12.0", "unplugin": "^1.12.0",
"unplugin-vue-router": "^0.10.1", "unplugin-vue-router": "^0.10.2",
"unstorage": "^1.10.2", "unstorage": "^1.10.2",
"untyped": "^1.4.2", "untyped": "^1.4.2",
"vue": "^3.4.34", "vue": "^3.4.34",
"vue-bundle-renderer": "^2.1.0", "vue-bundle-renderer": "^2.1.0",
"vue-devtools-stub": "^0.1.0", "vue-devtools-stub": "^0.1.0",
"vue-router": "^4.4.0" "vue-router": "^4.4.2"
}, },
"devDependencies": { "devDependencies": {
"@nuxt/scripts": "0.6.4", "@nuxt/scripts": "0.6.5",
"@nuxt/ui-templates": "1.3.4", "@nuxt/ui-templates": "1.3.4",
"@parcel/watcher": "2.4.1", "@parcel/watcher": "2.4.1",
"@types/estree": "1.0.5", "@types/estree": "1.0.5",
"@vitejs/plugin-vue": "5.1.0", "@vitejs/plugin-vue": "5.1.2",
"@vue/compiler-sfc": "3.4.34", "@vue/compiler-sfc": "3.4.34",
"unbuild": "3.0.0-rc.7", "unbuild": "3.0.0-rc.7",
"vite": "5.3.5", "vite": "5.3.5",

View File

@ -23,6 +23,7 @@ export interface CookieOptions<T = any> extends _CookieOptions {
readonly?: boolean readonly?: boolean
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface CookieRef<T> extends Ref<T> {} export interface CookieRef<T> extends Ref<T> {}
const CookieDefaults = { const CookieDefaults = {

View File

@ -9,6 +9,7 @@ export const NUXT_ERROR_SIGNATURE = '__nuxt_error'
/** @since 3.0.0 */ /** @since 3.0.0 */
export const useError = () => toRef(useNuxtApp().payload, 'error') export const useError = () => toRef(useNuxtApp().payload, 'error')
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface NuxtError<DataT = unknown> extends H3Error<DataT> {} export interface NuxtError<DataT = unknown> extends H3Error<DataT> {}
/** @since 3.0.0 */ /** @since 3.0.0 */

View File

@ -17,6 +17,7 @@ type AvailableRouterMethod<R extends NitroFetchRequest> = _AvailableRouterMethod
export type FetchResult<ReqT extends NitroFetchRequest, M extends AvailableRouterMethod<ReqT>> = TypedInternalResponse<ReqT, unknown, Lowercase<M>> export type FetchResult<ReqT extends NitroFetchRequest, M extends AvailableRouterMethod<ReqT>> = TypedInternalResponse<ReqT, unknown, Lowercase<M>>
type ComputedOptions<T extends Record<string, any>> = { type ComputedOptions<T extends Record<string, any>> = {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
[K in keyof T]: T[K] extends Function ? T[K] : ComputedOptions<T[K]> | Ref<T[K]> | T[K] [K in keyof T]: T[K] extends Function ? T[K] : ComputedOptions<T[K]> | Ref<T[K]> | T[K]
} }

View File

@ -38,7 +38,7 @@ function _loadAsyncComponent (component: Component) {
} }
/** @since 3.0.0 */ /** @since 3.0.0 */
export async function preloadRouteComponents (to: RouteLocationRaw, router: Router & { _routePreloaded?: Set<string>, _preloadPromises?: Array<Promise<any>> } = useRouter()): Promise<void> { export async function preloadRouteComponents (to: RouteLocationRaw, router: Router & { _routePreloaded?: Set<string>, _preloadPromises?: Array<Promise<unknown>> } = useRouter()): Promise<void> {
if (import.meta.server) { return } if (import.meta.server) { return }
const { path, matched } = router.resolve(to) const { path, matched } = router.resolve(to)
@ -61,7 +61,7 @@ export async function preloadRouteComponents (to: RouteLocationRaw, router: Rout
.filter(component => typeof component === 'function') .filter(component => typeof component === 'function')
for (const component of components) { for (const component of components) {
const promise = Promise.resolve((component as Function)()) const promise = Promise.resolve((component as () => unknown)())
.catch(() => {}) .catch(() => {})
.finally(() => promises.splice(promises.indexOf(promise))) .finally(() => promises.splice(promises.indexOf(promise)))
promises.push(promise) promises.push(promise)

View File

@ -91,7 +91,7 @@ const isProcessingMiddleware = () => {
// Conditional types, either one or other // Conditional types, either one or other
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never } type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }
type XOR<T, U> = (T | U) extends Object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U
export type OpenWindowFeatures = { export type OpenWindowFeatures = {
popup?: boolean popup?: boolean

View File

@ -5,6 +5,7 @@ import { useNuxtApp } from './nuxt'
// @ts-expect-error virtual file // @ts-expect-error virtual file
import __appConfig from '#build/app.config.mjs' import __appConfig from '#build/app.config.mjs'
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
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
// Workaround for vite HMR with virtual modules // Workaround for vite HMR with virtual modules

View File

@ -185,6 +185,7 @@ interface _NuxtApp {
provide: (name: string, value: any) => void provide: (name: string, value: any) => void
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface NuxtApp extends _NuxtApp {} export interface NuxtApp extends _NuxtApp {}
export const NuxtPluginIndicator = '__nuxt_plugin' export const NuxtPluginIndicator = '__nuxt_plugin'

View File

@ -17,7 +17,11 @@ export default defineNuxtPlugin({
} }
} }
if (import.meta.server) { if (import.meta.server) {
nuxtApp.hook('app:rendered', ({ renderResult }) => { renderResult?.html && nextTick(checkIfLayoutUsed) }) nuxtApp.hook('app:rendered', ({ renderResult }) => {
if (renderResult?.html) {
nextTick(checkIfLayoutUsed)
}
})
} else { } else {
onNuxtReady(checkIfLayoutUsed) onNuxtReady(checkIfLayoutUsed)
} }

View File

@ -77,7 +77,7 @@ interface RouterHooks {
interface Router { interface Router {
currentRoute: Ref<Route> currentRoute: Ref<Route>
isReady: () => Promise<void> isReady: () => Promise<void>
options: {} options: Record<string, unknown>
install: () => Promise<void> install: () => Promise<void>
// Navigation // Navigation
push: (url: string) => Promise<void> push: (url: string) => Promise<void>

View File

@ -40,7 +40,7 @@ declare module 'vue' {
$nuxt: NuxtApp $nuxt: NuxtApp
} }
interface ComponentInternalInstance { interface ComponentInternalInstance {
_nuxtOnBeforeMountCbs: Function[] _nuxtOnBeforeMountCbs: Array<() => void | Promise<void>>
_nuxtIdIndex?: Record<string, number> _nuxtIdIndex?: Record<string, number>
} }
interface ComponentCustomOptions { interface ComponentCustomOptions {

View File

@ -13,7 +13,7 @@ import { componentsChunkPlugin, islandsTransform } from './islandsTransform'
import { createTransformPlugin } from './transform' import { createTransformPlugin } from './transform'
const isPureObjectOrString = (val: any) => (!Array.isArray(val) && typeof val === 'object') || typeof val === 'string' const isPureObjectOrString = (val: any) => (!Array.isArray(val) && typeof val === 'object') || typeof val === 'string'
const isDirectory = (p: string) => { try { return statSync(p).isDirectory() } catch (_e) { return false } } const isDirectory = (p: string) => { try { return statSync(p).isDirectory() } catch { return false } }
function compareDirByPathLength ({ path: pathA }: { path: string }, { path: pathB }: { path: string }) { function compareDirByPathLength ({ path: pathA }: { path: string }, { path: pathB }: { path: string }) {
return pathB.split(/[\\/]/).filter(Boolean).length - pathA.split(/[\\/]/).filter(Boolean).length return pathB.split(/[\\/]/).filter(Boolean).length - pathA.split(/[\\/]/).filter(Boolean).length
} }

View File

@ -6,6 +6,7 @@ import {
getRequestDependencies, getRequestDependencies,
renderResourceHeaders, renderResourceHeaders,
} from 'vue-bundle-renderer/runtime' } from 'vue-bundle-renderer/runtime'
import type { Manifest as ClientManifest } from 'vue-bundle-renderer'
import type { RenderResponse } from 'nitro/types' import type { RenderResponse } from 'nitro/types'
import type { Manifest } from 'vite' import type { Manifest } from 'vite'
import type { H3Event } from 'h3' import type { H3Event } from 'h3'
@ -94,8 +95,6 @@ export interface NuxtRenderResponse {
headers: Record<string, string> headers: Record<string, string>
} }
interface ClientManifest {}
// @ts-expect-error file will be produced after app build // @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)

View File

@ -42,6 +42,7 @@ export interface PageMeta {
} }
declare module 'vue-router' { declare module 'vue-router' {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface RouteMeta extends UnwrapRef<PageMeta> {} interface RouteMeta extends UnwrapRef<PageMeta> {}
} }

View File

@ -19,7 +19,11 @@ export default defineNuxtPlugin({
} }
if (import.meta.server) { if (import.meta.server) {
nuxtApp.hook('app:rendered', ({ renderResult }) => { renderResult?.html && nextTick(checkIfPageUnused) }) nuxtApp.hook('app:rendered', ({ renderResult }) => {
if (renderResult?.html) {
nextTick(checkIfPageUnused)
}
})
} else { } else {
onNuxtReady(checkIfPageUnused) onNuxtReady(checkIfPageUnused)
} }

View File

@ -23,6 +23,7 @@ describe('imports:transform', () => {
const transformPlugin = TransformPlugin.raw({ ctx, options: { transform: { exclude: [/node_modules/] } } }, { framework: 'rollup' }) as Plugin const transformPlugin = TransformPlugin.raw({ ctx, options: { transform: { exclude: [/node_modules/] } } }, { framework: 'rollup' }) as Plugin
const transform = async (source: string) => { const transform = async (source: string) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await (transformPlugin.transform! as Function).call({ error: null, warn: null } as any, source, '') const result = await (transformPlugin.transform! as Function).call({ error: null, warn: null } as any, source, '')
return typeof result === 'string' ? result : result?.code return typeof result === 'string' ? result : result?.code
} }

View File

@ -6,6 +6,7 @@ import { normalizeLineEndings } from './utils'
const pluginVite = DevOnlyPlugin.raw({}, { framework: 'vite' }) as Plugin const pluginVite = DevOnlyPlugin.raw({}, { framework: 'vite' }) as Plugin
const viteTransform = async (source: string, id: string) => { const viteTransform = async (source: string, id: string) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await (pluginVite.transform! as Function)(source, id) const result = await (pluginVite.transform! as Function)(source, id)
return typeof result === 'string' ? result : result?.code return typeof result === 'string' ? result : result?.code
} }

View File

@ -29,11 +29,13 @@ const viteTransform = async (source: string, id: string, selectiveClient = false
selectiveClient, selectiveClient,
}, { framework: 'vite' }) as Plugin }, { framework: 'vite' }) as Plugin
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await (vitePlugin.transform! as Function)(source, id) const result = await (vitePlugin.transform! as Function)(source, id)
return typeof result === 'string' ? result : result?.code return typeof result === 'string' ? result : result?.code
} }
const webpackTransform = async (source: string, id: string) => { const webpackTransform = async (source: string, id: string) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await ((pluginWebpack as UnpluginOptions).transform! as Function)(source, id) const result = await ((pluginWebpack as UnpluginOptions).transform! as Function)(source, id)
return typeof result === 'string' ? result : result?.code return typeof result === 'string' ? result : result?.code
} }

View File

@ -9,6 +9,7 @@ describe('route-injection:transform', () => {
const injectionPlugin = RouteInjectionPlugin({ options: { sourcemap: { client: false, server: false } } } as Nuxt).raw({}, { framework: 'rollup' }) as Plugin const injectionPlugin = RouteInjectionPlugin({ options: { sourcemap: { client: false, server: false } } } as Nuxt).raw({}, { framework: 'rollup' }) as Plugin
const transform = async (source: string) => { const transform = async (source: string) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await (injectionPlugin.transform! as Function).call({ error: null, warn: null } as any, source, 'test.vue') const result = await (injectionPlugin.transform! as Function).call({ error: null, warn: null } as any, source, 'test.vue')
const code: string = typeof result === 'string' ? result : result?.code const code: string = typeof result === 'string' ? result : result?.code
let depth = 0 let depth = 0

View File

@ -55,6 +55,7 @@ const treeshakeTemplatePlugin = TreeShakeTemplatePlugin.raw({
}, { framework: 'rollup' }) as Plugin }, { framework: 'rollup' }) as Plugin
const treeshake = async (source: string): Promise<string> => { const treeshake = async (source: string): Promise<string> => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await (treeshakeTemplatePlugin.transform! as Function).call({ const result = await (treeshakeTemplatePlugin.transform! as Function).call({
parse: (code: string, opts: any = {}) => Parser.parse(code, { parse: (code: string, opts: any = {}) => Parser.parse(code, {
sourceType: 'module', sourceType: 'module',
@ -79,6 +80,7 @@ async function SFCCompile (name: string, source: string, options: Options, ssr =
build: { sourcemap: false }, build: { sourcemap: false },
define: {}, define: {},
}) })
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const result = await (plugin.transform! as Function).call({ const result = await (plugin.transform! as Function).call({
parse: (code: string, opts: any = {}) => Parser.parse(code, { parse: (code: string, opts: any = {}) => Parser.parse(code, {
sourceType: 'module', sourceType: 'module',

View File

@ -20,6 +20,7 @@ declare module 'nitro/types' {
buildAssetsDir: string buildAssetsDir: string
cdnURL: string cdnURL: string
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface NitroRuntimeConfig extends RuntimeConfig {} interface NitroRuntimeConfig extends RuntimeConfig {}
interface NitroRouteConfig { interface NitroRouteConfig {
ssr?: boolean ssr?: boolean
@ -41,6 +42,7 @@ declare module 'nitropack/types' {
buildAssetsDir: string buildAssetsDir: string
cdnURL: string cdnURL: string
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface NitroRuntimeConfig extends RuntimeConfig {} interface NitroRuntimeConfig extends RuntimeConfig {}
interface NitroRouteConfig { interface NitroRouteConfig {
ssr?: boolean ssr?: boolean

View File

@ -20,6 +20,7 @@ declare module 'nitro/types' {
buildAssetsDir: string buildAssetsDir: string
cdnURL: string cdnURL: string
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface NitroRuntimeConfig extends RuntimeConfig {} interface NitroRuntimeConfig extends RuntimeConfig {}
interface NitroRouteConfig { interface NitroRouteConfig {
ssr?: boolean ssr?: boolean
@ -41,6 +42,7 @@ declare module 'nitropack/types' {
buildAssetsDir: string buildAssetsDir: string
cdnURL: string cdnURL: string
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface NitroRuntimeConfig extends RuntimeConfig {} interface NitroRuntimeConfig extends RuntimeConfig {}
interface NitroRouteConfig { interface NitroRouteConfig {
ssr?: boolean ssr?: boolean

View File

@ -38,9 +38,9 @@
"@nuxt/ui-templates": "1.3.4", "@nuxt/ui-templates": "1.3.4",
"@types/file-loader": "5.0.4", "@types/file-loader": "5.0.4",
"@types/pug": "2.0.10", "@types/pug": "2.0.10",
"@types/sass-loader": "8.0.8", "@types/sass-loader": "8.0.9",
"@unhead/schema": "1.9.16", "@unhead/schema": "1.9.16",
"@vitejs/plugin-vue": "5.1.0", "@vitejs/plugin-vue": "5.1.2",
"@vitejs/plugin-vue-jsx": "4.0.0", "@vitejs/plugin-vue-jsx": "4.0.0",
"@vue/compiler-core": "3.4.34", "@vue/compiler-core": "3.4.34",
"@vue/compiler-sfc": "3.4.34", "@vue/compiler-sfc": "3.4.34",
@ -58,7 +58,7 @@
"vue": "3.4.34", "vue": "3.4.34",
"vue-bundle-renderer": "2.1.0", "vue-bundle-renderer": "2.1.0",
"vue-loader": "17.4.2", "vue-loader": "17.4.2",
"vue-router": "4.4.0", "vue-router": "4.4.2",
"webpack": "5.93.0", "webpack": "5.93.0",
"webpack-dev-middleware": "7.3.0" "webpack-dev-middleware": "7.3.0"
}, },
@ -73,7 +73,7 @@
"std-env": "^3.7.0", "std-env": "^3.7.0",
"ufo": "^1.5.4", "ufo": "^1.5.4",
"uncrypto": "^0.1.3", "uncrypto": "^0.1.3",
"unimport": "^3.9.0", "unimport": "^3.10.0",
"untyped": "^1.4.2" "untyped": "^1.4.2"
}, },
"engines": { "engines": {

View File

@ -11,6 +11,7 @@ import type { AppHeadMetaObject } from './head'
export type { SchemaDefinition } from 'untyped' export type { SchemaDefinition } from 'untyped'
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
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
export type UpperSnakeCase<S extends string> = Uppercase<SnakeCase<S>> export type UpperSnakeCase<S extends string> = Uppercase<SnakeCase<S>>
@ -33,6 +34,7 @@ type Overrideable<T extends Record<string, any>, Path extends string = ''> = {
type RuntimeConfigNamespace = Record<string, unknown> type RuntimeConfigNamespace = Record<string, unknown>
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface PublicRuntimeConfig extends RuntimeConfigNamespace { } export interface PublicRuntimeConfig extends RuntimeConfigNamespace { }
export interface RuntimeConfig extends RuntimeConfigNamespace { export interface RuntimeConfig extends RuntimeConfigNamespace {
@ -136,6 +138,7 @@ export interface AppConfigInput extends CustomAppConfig {
server?: never server?: never
} }
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
type Serializable<T> = T extends Function ? never : T extends Promise<infer U> ? Serializable<U> : T extends string & {} ? T : T extends Record<string, any> ? { [K in keyof T]: Serializable<T[K]> } : T type Serializable<T> = T extends Function ? never : T extends Promise<infer U> ? Serializable<U> : T extends string & {} ? T : T extends Record<string, any> ? { [K in keyof T]: Serializable<T[K]> } : T
export interface NuxtAppConfig { export interface NuxtAppConfig {

View File

@ -3,13 +3,21 @@ import type { Head, MergeHead } from '@unhead/schema'
/** @deprecated Extend types from `@unhead/schema` directly. This may be removed in a future minor version. */ /** @deprecated Extend types from `@unhead/schema` directly. This may be removed in a future minor version. */
export interface HeadAugmentations extends MergeHead { export interface HeadAugmentations extends MergeHead {
// runtime type modifications // runtime type modifications
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
base?: {} base?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
link?: {} link?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
meta?: {} meta?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
style?: {} style?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
script?: {} script?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
noscript?: {} noscript?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
htmlAttrs?: {} htmlAttrs?: {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
bodyAttrs?: {} bodyAttrs?: {}
} }

View File

@ -59,6 +59,7 @@ export type NuxtLayout = {
file: string file: string
} }
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface ImportPresetWithDeprecation extends InlinePreset { export interface ImportPresetWithDeprecation extends InlinePreset {
} }

View File

@ -54,6 +54,7 @@ export interface NuxtTypeTemplate<Options = TemplateDefaultOptions> extends Omit
} }
type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options> type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options>
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface NuxtPluginTemplate<Options = TemplateDefaultOptions> extends _TemplatePlugin<Options> { } export interface NuxtPluginTemplate<Options = TemplateDefaultOptions> extends _TemplatePlugin<Options> { }
export interface NuxtApp { export interface NuxtApp {

View File

@ -19,7 +19,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/html-minifier": "4.0.5", "@types/html-minifier": "4.0.5",
"@unocss/reset": "0.61.5", "@unocss/reset": "0.61.9",
"critters": "0.0.24", "critters": "0.0.24",
"execa": "9.3.0", "execa": "9.3.0",
"globby": "14.0.2", "globby": "14.0.2",
@ -30,7 +30,7 @@
"pathe": "1.1.2", "pathe": "1.1.2",
"prettier": "3.3.3", "prettier": "3.3.3",
"scule": "1.3.0", "scule": "1.3.0",
"unocss": "0.61.5", "unocss": "0.61.9",
"vite": "5.3.5" "vite": "5.3.5"
} }
} }

View File

@ -27,16 +27,16 @@
"@nuxt/schema": "workspace:*", "@nuxt/schema": "workspace:*",
"@types/clear": "0.1.4", "@types/clear": "0.1.4",
"@types/estree": "1.0.5", "@types/estree": "1.0.5",
"rollup": "4.19.0", "rollup": "4.20.0",
"unbuild": "3.0.0-rc.7", "unbuild": "3.0.0-rc.7",
"vue": "3.4.34" "vue": "3.4.34"
}, },
"dependencies": { "dependencies": {
"@nuxt/kit": "workspace:*", "@nuxt/kit": "workspace:*",
"@rollup/plugin-replace": "^5.0.7", "@rollup/plugin-replace": "^5.0.7",
"@vitejs/plugin-vue": "^5.1.0", "@vitejs/plugin-vue": "^5.1.2",
"@vitejs/plugin-vue-jsx": "^4.0.0", "@vitejs/plugin-vue-jsx": "^4.0.0",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.20",
"clear": "^0.1.0", "clear": "^0.1.0",
"consola": "^3.2.3", "consola": "^3.2.3",
"cssnano": "^7.0.4", "cssnano": "^7.0.4",
@ -49,7 +49,7 @@
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"jiti": "^2.0.0-beta.3", "jiti": "^2.0.0-beta.3",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"magic-string": "^0.30.10", "magic-string": "^0.30.11",
"mlly": "^1.7.1", "mlly": "^1.7.1",
"ohash": "^1.1.3", "ohash": "^1.1.3",
"pathe": "^1.1.2", "pathe": "^1.1.2",

View File

@ -72,6 +72,7 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin {
: outputOptions.assetFileNames({ : outputOptions.assetFileNames({
type: 'asset', type: 'asset',
name: `${fileName}-styles.mjs`, name: `${fileName}-styles.mjs`,
originalFileName: `${fileName}-styles.mjs`,
source: '', source: '',
}) })
@ -97,6 +98,7 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin {
this.emitFile({ this.emitFile({
type: 'asset', type: 'asset',
fileName: 'styles.mjs', fileName: 'styles.mjs',
originalFileName: 'styles.mjs',
source: source:
[ [
'const interopDefault = r => r.default || r || []', 'const interopDefault = r => r.default || r || []',

View File

@ -40,7 +40,7 @@ export async function warmupViteServer (
entries: string[], entries: string[],
isServer: boolean, isServer: boolean,
) { ) {
const warmedUrls = new Set<String>() const warmedUrls = new Set<string>()
const warmup = async (url: string) => { const warmup = async (url: string) => {
try { try {

View File

@ -27,7 +27,7 @@
"dependencies": { "dependencies": {
"@nuxt/friendly-errors-webpack-plugin": "^2.6.0", "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
"@nuxt/kit": "workspace:*", "@nuxt/kit": "workspace:*",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.20",
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0", "css-minimizer-webpack-plugin": "^7.0.0",
"cssnano": "^7.0.4", "cssnano": "^7.0.4",
@ -43,8 +43,8 @@
"jiti": "^2.0.0-beta.3", "jiti": "^2.0.0-beta.3",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"magic-string": "^0.30.10", "magic-string": "^0.30.11",
"memfs": "^4.9.4", "memfs": "^4.11.1",
"mini-css-extract-plugin": "^2.9.0", "mini-css-extract-plugin": "^2.9.0",
"mlly": "^1.7.1", "mlly": "^1.7.1",
"ohash": "^1.1.3", "ohash": "^1.1.3",
@ -78,7 +78,7 @@
"@types/pify": "5.0.4", "@types/pify": "5.0.4",
"@types/webpack-bundle-analyzer": "4.7.0", "@types/webpack-bundle-analyzer": "4.7.0",
"@types/webpack-hot-middleware": "2.25.9", "@types/webpack-hot-middleware": "2.25.9",
"rollup": "4.19.0", "rollup": "4.20.0",
"unbuild": "3.0.0-rc.7", "unbuild": "3.0.0-rc.7",
"vue": "3.4.34" "vue": "3.4.34"
}, },

View File

@ -4,7 +4,7 @@ import { defu } from 'defu'
import { createJiti } from 'jiti' import { createJiti } from 'jiti'
import type { Plugin } from 'postcss' import type { Plugin } from 'postcss'
const isPureObject = (obj: unknown): obj is Object => obj !== null && !Array.isArray(obj) && typeof obj === 'object' const isPureObject = (obj: unknown): obj is object => obj !== null && !Array.isArray(obj) && typeof obj === 'object'
function sortPlugins ({ plugins, order }: NuxtOptions['postcss']): string[] { function sortPlugins ({ plugins, order }: NuxtOptions['postcss']): string[] {
const names = Object.keys(plugins) const names = Object.keys(plugins)

File diff suppressed because it is too large Load Diff

View File

@ -32,10 +32,10 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
const serverDir = join(rootDir, '.output/server') const serverDir = join(rootDir, '.output/server')
const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"211k"`) expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"205k"`)
const modules = await analyzeSizes('node_modules/**/*', serverDir) const modules = await analyzeSizes('node_modules/**/*', serverDir)
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"1347k"`) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"1346k"`)
const packages = modules.files const packages = modules.files
.filter(m => m.endsWith('package.json')) .filter(m => m.endsWith('package.json'))
@ -73,7 +73,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
const serverDir = join(rootDir, '.output-inline/server') const serverDir = join(rootDir, '.output-inline/server')
const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"534k"`) expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"528k"`)
const modules = await analyzeSizes('node_modules/**/*', serverDir) const modules = await analyzeSizes('node_modules/**/*', serverDir)
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"80.3k"`) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"80.3k"`)

View File

@ -567,6 +567,7 @@ describe('composables', () => {
describe('app config', () => { describe('app config', () => {
it('merges app config as expected', () => { it('merges app config as expected', () => {
interface ExpectedMergedAppConfig { interface ExpectedMergedAppConfig {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
nuxt: {} nuxt: {}
fromLayer: boolean fromLayer: boolean
fromNuxtConfig: boolean fromNuxtConfig: boolean

View File

@ -13,7 +13,7 @@ const serialisedMeta: Record<string, string> = {}
const meta = useRoute().meta const meta = useRoute().meta
for (const key in meta) { for (const key in meta) {
if (Array.isArray(meta[key])) { if (Array.isArray(meta[key])) {
serialisedMeta[key] = meta[key].map((fn: Function) => fn.toString()) serialisedMeta[key] = meta[key].map((fn: () => unknown) => fn.toString())
continue continue
} }
if (typeof meta[key] === 'string') { if (typeof meta[key] === 'string') {

View File

@ -1,2 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface MyInterface {} interface MyInterface {}
export {} export {}

View File

@ -51,6 +51,7 @@ describe('config typings', () => {
it('appConfig', () => { it('appConfig', () => {
expectTypeOf(useAppConfig().foo).toEqualTypeOf<unknown>() expectTypeOf(useAppConfig().foo).toEqualTypeOf<unknown>()
expectTypeOf(useAppConfig()).toEqualTypeOf<{ expectTypeOf(useAppConfig()).toEqualTypeOf<{
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
nuxt: {} nuxt: {}
[key: string]: unknown [key: string]: unknown
}>() }>()

View File

@ -486,7 +486,7 @@ describe('url', () => {
describe('loading state', () => { describe('loading state', () => {
it('expect loading state to be changed by hooks', async () => { it('expect loading state to be changed by hooks', async () => {
vi.stubGlobal('setTimeout', vi.fn((cb: Function) => cb())) vi.stubGlobal('setTimeout', vi.fn((cb: () => void) => cb()))
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
const { isLoading } = useLoadingIndicator() const { isLoading } = useLoadingIndicator()
expect(isLoading.value).toBeFalsy() expect(isLoading.value).toBeFalsy()
@ -501,7 +501,7 @@ describe('loading state', () => {
describe('loading state', () => { describe('loading state', () => {
it('expect loading state to be changed by force starting/stoping', async () => { it('expect loading state to be changed by force starting/stoping', async () => {
vi.stubGlobal('setTimeout', vi.fn((cb: Function) => cb())) vi.stubGlobal('setTimeout', vi.fn((cb: () => void) => cb()))
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
const { isLoading, start, finish } = useLoadingIndicator() const { isLoading, start, finish } = useLoadingIndicator()
expect(isLoading.value).toBeFalsy() expect(isLoading.value).toBeFalsy()
@ -516,7 +516,7 @@ describe('loading state', () => {
describe('loading state', () => { describe('loading state', () => {
it('expect error from loading state to be changed by finish({ error: true })', async () => { it('expect error from loading state to be changed by finish({ error: true })', async () => {
vi.stubGlobal('setTimeout', vi.fn((cb: Function) => cb())) vi.stubGlobal('setTimeout', vi.fn((cb: () => void) => cb()))
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
const { error, start, finish } = useLoadingIndicator() const { error, start, finish } = useLoadingIndicator()
expect(error.value).toBeFalsy() expect(error.value).toBeFalsy()

View File

@ -4,6 +4,7 @@ import { defineEventHandler } from 'h3'
import { registerEndpoint } from '@nuxt/test-utils/runtime' import { registerEndpoint } from '@nuxt/test-utils/runtime'
vi.mock('#app/compat/idle-callback', () => ({ vi.mock('#app/compat/idle-callback', () => ({
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
requestIdleCallback: (cb: Function) => cb(), requestIdleCallback: (cb: Function) => cb(),
cancelIdleCallback: () => {}, cancelIdleCallback: () => {},
})) }))

View File

@ -32,7 +32,7 @@ export async function renderPage (path = '/') {
page.on('request', (req) => { page.on('request', (req) => {
try { try {
requests.push(req.url().replace(url('/'), '/')) requests.push(req.url().replace(url('/'), '/'))
} catch (err) { } catch {
// TODO // TODO
} }
}) })