mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-02 00:30:29 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
parent
ef4f7f5b88
commit
0b4781e28e
@ -24,7 +24,8 @@ export function useNuxt (): Nuxt {
|
|||||||
const fallbackInstance = fallbackNuxtCtx.tryUse()
|
const fallbackInstance = fallbackNuxtCtx.tryUse()
|
||||||
if (fallbackInstance) {
|
if (fallbackInstance) {
|
||||||
logger.warn('Using fallback global Nuxt instance. You may be using a @nuxt/kit composable outside of a Nuxt context, this behavior is deprecated and will be removed in v4.')
|
logger.warn('Using fallback global Nuxt instance. You may be using a @nuxt/kit composable outside of a Nuxt context, this behavior is deprecated and will be removed in v4.')
|
||||||
return fallbackInstance }
|
return fallbackInstance
|
||||||
|
}
|
||||||
|
|
||||||
throw new Error('Nuxt instance is unavailable!')
|
throw new Error('Nuxt instance is unavailable!')
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ import { readPackageJSON, resolvePackageJSON } from 'pkg-types'
|
|||||||
import type { Nuxt, NuxtConfig } 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 { asyncNameStorage } from '../utils'
|
import { asyncNameStorage } from '../utils'
|
||||||
|
import type { LoadNuxtConfigOptions } from './config'
|
||||||
|
|
||||||
export interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
export interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
||||||
/** Load nuxt with development mode */
|
/** Load nuxt with development mode */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AsyncLocalStorage } from "node:async_hooks"
|
import { AsyncLocalStorage } from 'node:async_hooks'
|
||||||
|
|
||||||
/** @since 3.9.0 */
|
/** @since 3.9.0 */
|
||||||
export function toArray<T> (value: T | T[]): T[] {
|
export function toArray<T> (value: T | T[]): T[] {
|
||||||
|
@ -4,7 +4,7 @@ import { join, normalize, relative, resolve } from 'pathe'
|
|||||||
import { createDebugger, createHooks } from 'hookable'
|
import { createDebugger, createHooks } from 'hookable'
|
||||||
import ignore from 'ignore'
|
import ignore from 'ignore'
|
||||||
import type { LoadNuxtOptions } from '@nuxt/kit'
|
import type { LoadNuxtOptions } from '@nuxt/kit'
|
||||||
import { addBuildPlugin, addComponent, addPlugin, addPluginTemplate, addRouteMiddleware, addServerPlugin, addTypeTemplate, addVitePlugin, addWebpackPlugin, installModule, loadNuxtConfig, nuxtCtx, resolveAlias, resolveFiles, resolveIgnorePatterns, resolvePath, tryResolveModule, useNitro, asyncNameStorage, fallbackNuxtCtx } from '@nuxt/kit'
|
import { addBuildPlugin, addComponent, addPlugin, addPluginTemplate, addRouteMiddleware, addServerPlugin, addTypeTemplate, addVitePlugin, addWebpackPlugin, asyncNameStorage, fallbackNuxtCtx, installModule, loadNuxtConfig, nuxtCtx, resolveAlias, resolveFiles, resolveIgnorePatterns, resolvePath, tryResolveModule, useNitro } from '@nuxt/kit'
|
||||||
import type { Nuxt, NuxtHooks, NuxtModule, NuxtOptions } from 'nuxt/schema'
|
import type { Nuxt, NuxtHooks, NuxtModule, NuxtOptions } from 'nuxt/schema'
|
||||||
import type { PackageJson } from 'pkg-types'
|
import type { PackageJson } from 'pkg-types'
|
||||||
import { readPackageJSON } from 'pkg-types'
|
import { readPackageJSON } from 'pkg-types'
|
||||||
@ -22,6 +22,7 @@ import { gt, satisfies } from 'semver'
|
|||||||
import { hasTTY, isCI } from 'std-env'
|
import { hasTTY, isCI } from 'std-env'
|
||||||
import { genImport } from 'knitwork'
|
import { genImport } from 'knitwork'
|
||||||
|
|
||||||
|
import { randomUUID } from 'uncrypto'
|
||||||
import { installNuxtModule } from '../core/features'
|
import { installNuxtModule } from '../core/features'
|
||||||
import pagesModule from '../pages/module'
|
import pagesModule from '../pages/module'
|
||||||
import metaModule from '../head/module'
|
import metaModule from '../head/module'
|
||||||
@ -47,7 +48,6 @@ import { ComposableKeysPlugin } from './plugins/composable-keys'
|
|||||||
import { resolveDeepImportsPlugin } from './plugins/resolve-deep-imports'
|
import { resolveDeepImportsPlugin } from './plugins/resolve-deep-imports'
|
||||||
import { PrehydrateTransformPlugin } from './plugins/prehydrate'
|
import { PrehydrateTransformPlugin } from './plugins/prehydrate'
|
||||||
import { VirtualFSPlugin } from './plugins/virtual'
|
import { VirtualFSPlugin } from './plugins/virtual'
|
||||||
import { randomUUID } from 'uncrypto'
|
|
||||||
|
|
||||||
export function createNuxt (options: NuxtOptions): Nuxt {
|
export function createNuxt (options: NuxtOptions): Nuxt {
|
||||||
const hooks = createHooks<NuxtHooks>()
|
const hooks = createHooks<NuxtHooks>()
|
||||||
|
@ -51,7 +51,7 @@ describe('loadNuxt', () => {
|
|||||||
}),
|
}),
|
||||||
loadNuxt({
|
loadNuxt({
|
||||||
cwd: repoRoot,
|
cwd: repoRoot,
|
||||||
})
|
}),
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -99,7 +99,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(`"560k"`)
|
expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"561k"`)
|
||||||
|
|
||||||
const modules = await analyzeSizes(['node_modules/**/*'], serverDir)
|
const modules = await analyzeSizes(['node_modules/**/*'], serverDir)
|
||||||
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"94.4k"`)
|
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"94.4k"`)
|
||||||
|
Loading…
Reference in New Issue
Block a user