perf(kit,nuxt,schema,vite,webpack): use explicit exports (#27998)

This commit is contained in:
Daniel Roe 2024-07-03 17:46:42 +01:00 committed by GitHub
parent 7b98c27ebc
commit 128edc76fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 52 additions and 39 deletions

View File

@ -1,28 +1,35 @@
// Module // Module
export * from './module/define' export { defineNuxtModule } from './module/define'
export * from './module/install' export { getDirectory, installModule, loadNuxtModuleInstance, normalizeModuleTranspilePath } from './module/install'
export * from './module/compatibility' export { getNuxtModuleVersion, hasNuxtModule, hasNuxtModuleCompatibility } from './module/compatibility'
// Loader // Loader
export * from './loader/config' export { loadNuxtConfig } from './loader/config'
export * from './loader/schema' export type { LoadNuxtConfigOptions } from './loader/config'
export * from './loader/nuxt' export { extendNuxtSchema } from './loader/schema'
export { buildNuxt, loadNuxt } from './loader/nuxt'
export type { LoadNuxtOptions } from './loader/nuxt'
// Utils // Utils
export * from './imports' export { addImports, addImportsDir, addImportsSources } from './imports'
export { updateRuntimeConfig, useRuntimeConfig } from './runtime-config' export { updateRuntimeConfig, useRuntimeConfig } from './runtime-config'
export * from './build' export { addBuildPlugin, addVitePlugin, addWebpackPlugin, extendViteConfig, extendWebpackConfig } from './build'
export * from './compatibility' export type { ExtendConfigOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions } from './build'
export * from './components' export { assertNuxtCompatibility, checkNuxtCompatibility, getNuxtVersion, hasNuxtCompatibility, isNuxtMajorVersion, normalizeSemanticVersion, isNuxt2, isNuxt3 } from './compatibility'
export * from './context' export { addComponent, addComponentsDir } from './components'
export type { AddComponentOptions } from './components'
export { nuxtCtx, tryUseNuxt, useNuxt } from './context'
export { isIgnored, resolveIgnorePatterns } from './ignore' export { isIgnored, resolveIgnorePatterns } from './ignore'
export * from './layout' export { addLayout } from './layout'
export * from './pages' export { addRouteMiddleware, extendPages, extendRouteRules } from './pages'
export * from './plugin' export type { AddRouteMiddlewareOptions, ExtendRouteRulesOptions } from './pages'
export * from './resolve' export { addPlugin, addPluginTemplate, normalizePlugin } from './plugin'
export * from './nitro' export type { AddPluginOptions } from './plugin'
export { createResolver, findPath, resolveAlias, resolveFiles, resolveNuxtModule, resolvePath } from './resolve'
export type { ResolvePathOptions, Resolver } from './resolve'
export { addServerHandler, addDevServerHandler, addServerPlugin, addPrerenderRoutes, useNitro, addServerImports, addServerImportsDir, addServerScanDir } from './nitro'
export { addTemplate, addTypeTemplate, normalizeTemplate, updateTemplates, writeTypes } from './template' export { addTemplate, addTypeTemplate, normalizeTemplate, updateTemplates, writeTypes } from './template'
export * from './logger' export { logger, useLogger } from './logger'
// Internal Utils // Internal Utils
// TODO // TODO

View File

@ -1,11 +1,14 @@
export * from './nuxt' export { applyPlugin, applyPlugins, callWithNuxt, createNuxtApp, defineAppConfig, defineNuxtPlugin, definePayloadPlugin, isNuxtPlugin, registerPluginHooks, tryUseNuxtApp, useNuxtApp, useRuntimeConfig } from './nuxt'
export type { CreateOptions, NuxtApp, NuxtPayload, NuxtPluginIndicator, NuxtSSRContext, ObjectPlugin, Plugin, PluginEnvContext, PluginMeta, ResolvedPluginMeta, RuntimeNuxtHooks } from './nuxt'
export * from './composables/index' export { defineNuxtComponent, useAsyncData, useLazyAsyncData, useNuxtData, refreshNuxtData, clearNuxtData, useHydration, callOnce, useState, clearNuxtState, clearError, createError, isNuxtError, showError, useError, useFetch, useLazyFetch, useCookie, refreshCookie, onPrehydrate, prerenderRoutes, useRequestHeaders, useRequestEvent, useRequestFetch, setResponseStatus, onNuxtReady, abortNavigation, addRouteMiddleware, defineNuxtRouteMiddleware, onBeforeRouteLeave, onBeforeRouteUpdate, setPageLayout, navigateTo, useRoute, useRouter, preloadComponents, prefetchComponents, preloadRouteComponents, isPrerendered, loadPayload, preloadPayload, definePayloadReducer, definePayloadReviver, getAppManifest, getRouteRules, reloadNuxtApp, useRequestURL, usePreviewMode, useId, useRouteAnnouncer, useHead, useSeoMeta, useServerSeoMeta } from './composables/index'
export type { AddRouteMiddlewareOptions, AsyncData, AsyncDataOptions, AsyncDataRequestStatus, CookieOptions, CookieRef, FetchResult, NuxtAppManifest, NuxtAppManifestMeta, NuxtError, ReloadNuxtAppOptions, RouteMiddleware, UseFetchOptions } from './composables/index'
export * from './components/index' export { defineNuxtLink } from './components/index'
export * from './config' export type { NuxtLinkOptions, NuxtLinkProps } from './components/index'
export * from './compat/idle-callback' export { _getAppConfig, updateAppConfig, useAppConfig } from './config'
export * from './types' export { cancelIdleCallback, requestIdleCallback } from './compat/idle-callback'
export type { NuxtAppLiterals, NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext, PageMeta } from './types'
export const isVue2 = false export const isVue2 = false
export const isVue3 = true export const isVue3 = true

View File

@ -1,5 +1,5 @@
export * from './names' export { getNameFromPath, hasSuffix, resolveComponentNameSegments } from './names'
export * from './plugins' export { isJS, isVue } from './plugins'
export function uniqueBy<T, K extends keyof T> (arr: T[], key: K) { export function uniqueBy<T, K extends keyof T> (arr: T[], key: K) {
if (arr.length < 2) { if (arr.length < 2) {

View File

@ -1,2 +1,2 @@
export * from './core/nuxt' export { createNuxt, loadNuxt } from './core/nuxt'
export * from './core/builder' export { build } from './core/builder'

View File

@ -1 +1,2 @@
export * from './composables' export { definePageMeta, defineRouteRules } from './composables'
export type { PageMeta } from './composables'

View File

@ -1,13 +1,13 @@
// Types // Types
export * from './types/compatibility' export type { NuxtCompatibility, NuxtCompatibilityIssue, NuxtCompatibilityIssues } from './types/compatibility'
export * from './types/components' export type { Component, ComponentMeta, ComponentsDir, ComponentsOptions, ScanDir } from './types/components'
export * from './types/config' export type { AppConfig, AppConfigInput, CustomAppConfig, NuxtAppConfig, NuxtBuilder, NuxtConfig, NuxtConfigLayer, NuxtOptions, PublicRuntimeConfig, RuntimeConfig, RuntimeValue, SchemaDefinition, UpperSnakeCase, ViteConfig } from './types/config'
export * from './types/hooks' export type { GenerateAppOptions, HookResult, ImportPresetWithDeprecation, NuxtAnalyzeMeta, NuxtHookName, NuxtHooks, NuxtLayout, NuxtMiddleware, NuxtPage, TSReference, VueTSConfig, WatchEvent } from './types/hooks'
export * from './types/imports' export type { ImportsOptions } from './types/imports'
export * from './types/head' export type { AppHeadMetaObject, MetaObject, MetaObjectRaw, HeadAugmentations } from './types/head'
export * from './types/module' export type { ModuleDefinition, ModuleMeta, ModuleOptions, ModuleSetupInstallResult, ModuleSetupReturn, NuxtModule, ResolvedModuleOptions } from './types/module'
export * from './types/nuxt' export type { Nuxt, NuxtApp, NuxtPlugin, NuxtPluginTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate } from './types/nuxt'
export * from './types/router' export type { RouterConfig, RouterConfigSerializable, RouterOptions } from './types/router'
// Schema // Schema
export { default as NuxtConfigSchema } from './config/index' export { default as NuxtConfigSchema } from './config/index'

View File

@ -1 +1,2 @@
export * from './vite' export { bundle } from './vite'
export type { ViteBuildContext } from './vite'

View File

@ -1 +1 @@
export * from './webpack' export { bundle } from './webpack'

View File

@ -5,6 +5,7 @@ import { registerEndpoint } from '@nuxt/test-utils/runtime'
vi.mock('#app/compat/idle-callback', () => ({ vi.mock('#app/compat/idle-callback', () => ({
requestIdleCallback: (cb: Function) => cb(), requestIdleCallback: (cb: Function) => cb(),
cancelIdleCallback: () => {},
})) }))
const timestamp = Date.now() const timestamp = Date.now()