refactor: split out type imports from value imports (#9225)

This commit is contained in:
Daniil Chudo 2022-12-12 01:44:52 +04:00 committed by GitHub
parent ce4d29031e
commit ab2456c295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 140 additions and 91 deletions

View File

@ -45,6 +45,12 @@
]
}
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
"disallowTypeAnnotations": false
}
],
"@typescript-eslint/no-unused-vars": [
"error",
{

View File

@ -1,6 +1,7 @@
import { resolve } from 'pathe'
import { applyDefaults } from 'untyped'
import { loadConfig, LoadConfigOptions } from 'c12'
import type { LoadConfigOptions } from 'c12'
import { loadConfig } from 'c12'
import type { NuxtOptions, NuxtConfig } from '@nuxt/schema'
import { NuxtConfigSchema } from '@nuxt/schema'

View File

@ -1,6 +1,7 @@
import { readPackageJSON, resolvePackageJSON } from 'pkg-types'
import type { Nuxt } from '@nuxt/schema'
import { importModule, tryImportModule, RequireModuleOptions } from '../internal/cjs'
import type { RequireModuleOptions } from '../internal/cjs'
import { importModule, tryImportModule } from '../internal/cjs'
import type { LoadNuxtConfigOptions } from './config'
export interface LoadNuxtOptions extends LoadNuxtConfigOptions {

View File

@ -1,8 +1,10 @@
import mri from 'mri'
import { red } from 'colorette'
import consola, { ConsolaReporter } from 'consola'
import type { ConsolaReporter } from 'consola'
import consola from 'consola'
import { checkEngines } from './utils/engines'
import { commands, Command, NuxtCommand } from './commands'
import type { Command, NuxtCommand } from './commands'
import { commands } from './commands'
import { showHelp } from './utils/help'
import { showBanner } from './utils/banner'

View File

@ -1,5 +1,5 @@
import type { AddressInfo } from 'node:net'
import { RequestListener } from 'node:http'
import type { RequestListener } from 'node:http'
import { existsSync, readdirSync } from 'node:fs'
import { resolve, relative, normalize } from 'pathe'
import chokidar from 'chokidar'

View File

@ -6,7 +6,7 @@ import jiti from 'jiti'
import destr from 'destr'
import { splitByCase } from 'scule'
import clipboardy from 'clipboardy'
import { NuxtModule } from '@nuxt/schema'
import type { NuxtModule } from '@nuxt/schema'
import { getPackageManager, getPackageManagerVersion } from '../utils/packageManagers'
import { findup } from '../utils/fs'
import { defineNuxtCommand } from './index'

View File

@ -1,5 +1,6 @@
import mri from 'mri'
import { commands, Command, NuxtCommand } from './commands'
import type { Command, NuxtCommand } from './commands'
import { commands } from './commands'
export async function runCommand (command: string, argv = process.argv.slice(2)) {
const args = mri(argv)

View File

@ -1,5 +1,5 @@
import { cyan, magenta } from 'colorette'
import { NuxtCommandMeta } from '../commands'
import type { NuxtCommandMeta } from '../commands'
export function showHelp (meta?: Partial<NuxtCommandMeta>) {
const sections: string[] = []

View File

@ -1,6 +1,6 @@
import { promises as fsp } from 'node:fs'
import { isAbsolute, join, relative, resolve } from 'pathe'
import { Nuxt, TSReference } from '@nuxt/schema'
import type { Nuxt, TSReference } from '@nuxt/schema'
import defu from 'defu'
import type { TSConfig } from 'pkg-types'
import { getModulePaths, getNearestPackage } from './cjs'

View File

@ -1,4 +1,5 @@
import { defineBuildConfig, BuildEntry } from 'unbuild'
import type { BuildEntry } from 'unbuild'
import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
declaration: true,

View File

@ -1,4 +1,4 @@
import { NuxtConfig } from '@nuxt/schema'
import type { NuxtConfig } from '@nuxt/schema'
export { NuxtConfig } from '@nuxt/schema'
export declare function defineNuxtConfig(config: NuxtConfig): NuxtConfig

View File

@ -1,4 +1,5 @@
import { computed, defineComponent, h, inject, nextTick, onMounted, Ref, Transition, unref, VNode } from 'vue'
import type { Ref, VNode } from 'vue'
import { computed, defineComponent, h, inject, nextTick, onMounted, Transition, unref } from 'vue'
import type { RouteLocationNormalizedLoaded } from 'vue-router'
import { _wrapIf } from './utils'
import { useRoute } from '#app'

View File

@ -1,4 +1,5 @@
import { defineComponent, h, ref, resolveComponent, PropType, computed, DefineComponent, ComputedRef, onMounted, onBeforeUnmount } from 'vue'
import type { PropType, DefineComponent, ComputedRef } from 'vue'
import { defineComponent, h, ref, resolveComponent, computed, onMounted, onBeforeUnmount } from 'vue'
import type { RouteLocationRaw } from 'vue-router'
import { hasProtocol } from 'ufo'

View File

@ -1,6 +1,7 @@
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch, unref, toRef } from 'vue'
import type { Ref, WatchSource } from 'vue'
import { NuxtApp, useNuxtApp } from '../nuxt'
import type { NuxtApp } from '../nuxt'
import { useNuxtApp } from '../nuxt'
import { createError } from './error'
export type _Transform<Input = any, Output = any> = (input: Input) => Output

View File

@ -1,6 +1,7 @@
import { defineComponent, getCurrentInstance, reactive, toRefs } from 'vue'
import type { DefineComponent } from 'vue'
import { NuxtApp, useNuxtApp } from '../nuxt'
import { getCurrentInstance, reactive, toRefs } from 'vue'
import type { DefineComponent, defineComponent } from 'vue'
import type { NuxtApp } from '../nuxt'
import { useNuxtApp } from '../nuxt'
import { useAsyncData } from './asyncData'
import { useRoute } from './router'

View File

@ -1,5 +1,7 @@
import { ref, Ref, watch } from 'vue'
import { parse, serialize, CookieParseOptions, CookieSerializeOptions } from 'cookie-es'
import type { Ref } from 'vue'
import { ref, watch } from 'vue'
import type { CookieParseOptions, CookieSerializeOptions } from 'cookie-es'
import { parse, serialize } from 'cookie-es'
import { appendHeader } from 'h3'
import type { H3Event } from 'h3'
import destr from 'destr'

View File

@ -1,4 +1,5 @@
import { createError as _createError, H3Error } from 'h3'
import type { H3Error } from 'h3'
import { createError as _createError } from 'h3'
import { toRef } from 'vue'
import { useNuxtApp } from '../nuxt'

View File

@ -1,6 +1,7 @@
import type { FetchError, FetchOptions } from 'ofetch'
import type { TypedInternalResponse, NitroFetchRequest } from 'nitropack'
import { computed, unref, Ref, reactive } from 'vue'
import type { Ref } from 'vue'
import { computed, unref, reactive } from 'vue'
import { hash } from 'ohash'
import type { AsyncDataOptions, _Transform, KeyOfRes, AsyncData, PickFrom } from './asyncData'
import { useAsyncData } from './asyncData'

View File

@ -3,7 +3,8 @@ import type { Router, RouteLocationNormalizedLoaded, NavigationGuard, RouteLocat
import { sendRedirect } from 'h3'
import { hasProtocol, joinURL, parseURL } from 'ufo'
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
import { createError, NuxtError } from './error'
import type { NuxtError } from './error'
import { createError } from './error'
import { useState } from './state'
export const useRouter = () => {

View File

@ -1,6 +1,7 @@
/* eslint-disable no-redeclare */
import type { H3Event } from 'h3'
import { useNuxtApp, NuxtApp } from '../nuxt'
import type { NuxtApp } from '../nuxt'
import { useNuxtApp } from '../nuxt'
export function useRequestHeaders<K extends string = string> (include: K[]): Record<Lowercase<K>, string | undefined>
export function useRequestHeaders (): Readonly<Record<string, string | undefined>>

View File

@ -1,4 +1,4 @@
import { CreateOptions } from '#app'
import type { CreateOptions } from '#app'
const entry = process.server
? (ctx?: CreateOptions['ssrContext']) => import('#app/entry').then(m => m.default(ctx))

View File

@ -3,7 +3,8 @@ import { createSSRApp, createApp, nextTick } from 'vue'
import { $fetch } from 'ofetch'
// @ts-ignore
import { baseURL } from '#build/paths.mjs'
import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
import type { CreateOptions } from '#app'
import { createNuxtApp, applyPlugins, normalizePlugins } from '#app'
import '#build/css'
// @ts-ignore
import _plugins from '#build/plugins'

View File

@ -1,7 +1,8 @@
/* eslint-disable no-use-before-define */
import { getCurrentInstance, reactive, Ref } from 'vue'
import type { App, onErrorCaptured, VNode } from 'vue'
import { createHooks, Hookable } from 'hookable'
import { getCurrentInstance, reactive } from 'vue'
import type { App, onErrorCaptured, VNode, Ref } from 'vue'
import type { Hookable } from 'hookable'
import { createHooks } from 'hookable'
import type { RuntimeConfig, AppConfigInput } from '@nuxt/schema'
import { getContext } from 'unctx'
import type { SSRContext } from 'vue-bundle-renderer/runtime'

View File

@ -1,4 +1,4 @@
import { NuxtApp } from '../nuxt'
import type { NuxtApp } from '../nuxt'
declare global {
namespace NodeJS {

View File

@ -1,7 +1,7 @@
import { pathToFileURL } from 'node:url'
import { createUnplugin } from 'unplugin'
import { parseQuery, parseURL } from 'ufo'
import { Component, ComponentsOptions } from '@nuxt/schema'
import type { Component, ComponentsOptions } from '@nuxt/schema'
import { genDynamicImport, genImport } from 'knitwork'
import MagicString from 'magic-string'
import { pascalCase } from 'scule'

View File

@ -1,7 +1,8 @@
import { pathToFileURL } from 'node:url'
import { parseURL } from 'ufo'
import MagicString from 'magic-string'
import { parse, walk, ELEMENT_NODE, Node } from 'ultrahtml'
import type { Node } from 'ultrahtml'
import { parse, walk, ELEMENT_NODE } from 'ultrahtml'
import { createUnplugin } from 'unplugin'
import type { Component } from '@nuxt/schema'

View File

@ -1,7 +1,7 @@
import { existsSync, promises as fsp } from 'node:fs'
import { resolve, join } from 'pathe'
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender, Nitro } from 'nitropack'
import type { NitroConfig } from 'nitropack'
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
import type { NitroConfig, Nitro } from 'nitropack'
import type { Nuxt } from '@nuxt/schema'
import { resolvePath } from '@nuxt/kit'
import escapeRE from 'escape-string-regexp'

View File

@ -1,7 +1,8 @@
import { join, normalize, resolve } from 'pathe'
import { createHooks, createDebugger } from 'hookable'
import type { Nuxt, NuxtOptions, NuxtHooks } from '@nuxt/schema'
import { loadNuxtConfig, LoadNuxtOptions, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
import type { LoadNuxtOptions } from '@nuxt/kit'
import { loadNuxtConfig, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
/* eslint-disable import/no-restricted-paths */
import escapeRE from 'escape-string-regexp'
import fse from 'fs-extra'

View File

@ -1,4 +1,4 @@
import { Nuxt, NuxtApp } from '@nuxt/schema'
import type { Nuxt, NuxtApp } from '@nuxt/schema'
import { normalize } from 'pathe'
import { createTransformer } from 'unctx/transform'
import { createUnplugin } from 'unplugin'

View File

@ -1,6 +1,7 @@
import { joinURL, withQuery } from 'ufo'
import type { NitroErrorHandler } from 'nitropack'
import { H3Error, setResponseHeader, getRequestHeaders } from 'h3'
import type { H3Error } from 'h3'
import { setResponseHeader, getRequestHeaders } from 'h3'
import { useNitroApp, useRuntimeConfig } from '#internal/nitro'
import { normalizeError, isJsonRequest } from '#internal/nitro/utils'

View File

@ -1,7 +1,8 @@
import { createRenderer, renderResourceHeaders } from 'vue-bundle-renderer/runtime'
import type { RenderResponse } from 'nitropack'
import type { Manifest } from 'vite'
import { appendHeader, getQuery, H3Event, writeEarlyHints, readBody, createError } from 'h3'
import type { H3Event } from 'h3'
import { appendHeader, getQuery, writeEarlyHints, readBody, createError } from 'h3'
import devalue from '@nuxt/devalue'
import destr from 'destr'
import { joinURL } from 'ufo'

View File

@ -1,7 +1,8 @@
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, useNuxt, addPluginTemplate, updateTemplates } from '@nuxt/kit'
import { isAbsolute, join, relative, resolve, normalize } from 'pathe'
import { createUnimport, Import, scanDirExports, toImports, Unimport } from 'unimport'
import { ImportsOptions, ImportPresetWithDeprecation } from '@nuxt/schema'
import type { Import, Unimport } from 'unimport'
import { createUnimport, scanDirExports, toImports } from 'unimport'
import type { ImportsOptions, ImportPresetWithDeprecation } from '@nuxt/schema'
import { TransformPlugin } from './transform'
import { defaultPresets } from './presets'

View File

@ -1,4 +1,5 @@
import { defineUnimportPreset, InlinePreset } from 'unimport'
import type { InlinePreset } from 'unimport'
import { defineUnimportPreset } from 'unimport'
const commonPresets: InlinePreset[] = [
// #head

View File

@ -1,8 +1,8 @@
import { pathToFileURL } from 'node:url'
import { createUnplugin } from 'unplugin'
import { parseQuery, parseURL } from 'ufo'
import { Unimport } from 'unimport'
import { ImportsOptions } from '@nuxt/schema'
import type { Unimport } from 'unimport'
import type { ImportsOptions } from '@nuxt/schema'
import { normalize } from 'pathe'
export const TransformPlugin = createUnplugin(({ ctx, options, sourcemap }: { ctx: Unimport, options: Partial<ImportsOptions>, sourcemap?: boolean }) => {

View File

@ -7,7 +7,8 @@ import type { NuxtApp, NuxtPage } from '@nuxt/schema'
import { joinURL } from 'ufo'
import { distDir } from '../dirs'
import { resolvePagesRoutes, normalizeRoutes } from './utils'
import { PageMetaPlugin, PageMetaPluginOptions } from './page-meta'
import type { PageMetaPluginOptions } from './page-meta'
import { PageMetaPlugin } from './page-meta'
export default defineNuxtModule({
meta: {

View File

@ -1,7 +1,8 @@
import { pathToFileURL } from 'node:url'
import { createUnplugin } from 'unplugin'
import { parseQuery, parseURL, stringifyQuery } from 'ufo'
import { findStaticImports, findExports, StaticImport, parseStaticImport } from 'mlly'
import type { StaticImport } from 'mlly'
import { findStaticImports, findExports, parseStaticImport } from 'mlly'
import type { CallExpression, Identifier, Expression } from 'estree'
import { walk } from 'estree-walker'
import MagicString from 'magic-string'

View File

@ -1,4 +1,4 @@
import { KeepAliveProps, TransitionProps, UnwrapRef } from 'vue'
import type { KeepAliveProps, TransitionProps, UnwrapRef } from 'vue'
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteRecordRedirectOption } from 'vue-router'
import type { NuxtError } from '#app'

View File

@ -1,10 +1,11 @@
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition, KeepAliveProps, TransitionProps } from 'vue'
import type { DefineComponent, VNode } from 'vue'
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition } from 'vue'
import type { DefineComponent, VNode, KeepAliveProps, TransitionProps } from 'vue'
import { RouterView } from 'vue-router'
import { defu } from 'defu'
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteLocation } from 'vue-router'
import { generateRouteKey, RouterViewSlotProps, wrapInKeepAlive } from './utils'
import type { RouterViewSlotProps } from './utils'
import { generateRouteKey, wrapInKeepAlive } from './utils'
import { useNuxtApp } from '#app'
import { _wrapIf } from '#app/components/utils'
// @ts-ignore

View File

@ -1,15 +1,17 @@
import { computed, reactive, shallowRef } from 'vue'
import type {
NavigationGuard,
RouteLocation
} from 'vue-router'
import {
createRouter,
createWebHistory,
createMemoryHistory,
createWebHashHistory,
NavigationGuard,
RouteLocation
createWebHashHistory
} from 'vue-router'
import { createError } from 'h3'
import { withoutBase, isEqual } from 'ufo'
import NuxtPage from './page'
import type NuxtPage from './page'
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig, showError, clearError, navigateTo, useError, useState } from '#app'
// @ts-ignore
import _routes from '#build/routes'

View File

@ -1,6 +1,6 @@
import { extname, normalize, relative, resolve } from 'pathe'
import { encodePath } from 'ufo'
import { NuxtPage } from '@nuxt/schema'
import type { NuxtPage } from '@nuxt/schema'
import { resolveFiles, useNuxt } from '@nuxt/kit'
import { genImport, genDynamicImport, genArrayFromRaw, genSafeVariableName } from 'knitwork'
import escapeRE from 'escape-string-regexp'

View File

@ -3,8 +3,9 @@ import { expect, describe, it } from 'vitest'
import { join } from 'pathe'
import { createCommonJS, findExports } from 'mlly'
import * as VueFunctions from 'vue'
import { createUnimport, Import } from 'unimport'
import { Plugin } from 'vite'
import type { Import } from 'unimport'
import { createUnimport } from 'unimport'
import type { Plugin } from 'vite'
import { TransformPlugin } from '../src/imports/transform'
import { defaultPresets } from '../src/imports/presets'

View File

@ -1,6 +1,7 @@
import { expect, describe, it, vi } from 'vitest'
import { RouteLocationRaw } from 'vue-router'
import { NuxtLinkOptions, NuxtLinkProps, defineNuxtLink } from '../src/app/components/nuxt-link'
import type { RouteLocationRaw } from 'vue-router'
import type { NuxtLinkOptions, NuxtLinkProps } from '../src/app/components/nuxt-link'
import { defineNuxtLink } from '../src/app/components/nuxt-link'
// Mocks `h()`
vi.mock('vue', async () => {

View File

@ -1,5 +1,5 @@
import { resolve } from 'node:path'
import { ComponentsDir } from '@nuxt/schema'
import type { ComponentsDir } from '@nuxt/schema'
import { expect, it, vi } from 'vitest'
import { scanComponents } from '../src/components/scan'

View File

@ -3,7 +3,7 @@ import { join, resolve } from 'pathe'
import { isDebug, isDevelopment } from 'std-env'
import defu from 'defu'
import { findWorkspaceDir } from 'pkg-types'
import { RuntimeConfig } from '../types/config'
import type { RuntimeConfig } from '../types/config'
export default defineUntypedSchema({
/**

View File

@ -1,5 +1,5 @@
import type { KeepAliveProps, TransitionProps } from 'vue'
import { ConfigSchema } from '../../schema/config'
import type { ConfigSchema } from '../../schema/config'
import type { ServerOptions as ViteServerOptions, UserConfig as ViteUserConfig } from 'vite'
import type { Options as VuePluginOptions } from '@vitejs/plugin-vue'
import type { AppHeadMetaObject } from './meta'

View File

@ -1,5 +1,5 @@
import { ViteImportMeta } from './vite'
import { WebpackImportMeta } from './webpack'
import type { ViteImportMeta } from './vite'
import type { WebpackImportMeta } from './webpack'
export type BundlerImportMeta = ViteImportMeta & WebpackImportMeta

View File

@ -9,7 +9,7 @@ import type { Compiler, Configuration, Stats } from 'webpack'
import type { Nuxt, NuxtApp, ResolvedNuxtTemplate } from './nuxt'
import type { Nitro, NitroConfig } from 'nitropack'
import type { Component, ComponentsOptions } from './components'
import { NuxtCompatibility, NuxtCompatibilityIssues } from '..'
import type { NuxtCompatibility, NuxtCompatibilityIssues } from '..'
export type HookResult = Promise<void> | void

View File

@ -1,4 +1,4 @@
import { UnimportOptions } from 'unimport'
import type { UnimportOptions } from 'unimport'
export interface ImportsOptions extends UnimportOptions {
/**

View File

@ -1,4 +1,4 @@
import { NuxtHooks } from './hooks'
import type { NuxtHooks } from './hooks'
import type { Nuxt } from "./nuxt"
import type { NuxtCompatibility } from './compatibility'

View File

@ -1,7 +1,8 @@
import { resolve } from 'node:path'
import { execa } from 'execa'
import { getRandomPort, waitForPort } from 'get-port-please'
import { fetch as _fetch, $fetch as _$fetch, FetchOptions } from 'ofetch'
import type { FetchOptions } from 'ofetch'
import { fetch as _fetch, $fetch as _$fetch } from 'ofetch'
import * as _kit from '@nuxt/kit'
import { useTestContext } from './context'

View File

@ -2,8 +2,8 @@ import { pathToFileURL } from 'node:url'
import { existsSync } from 'node:fs'
import { builtinModules } from 'node:module'
import { isAbsolute, normalize, resolve } from 'pathe'
import * as vite from 'vite'
import { isExternal } from 'externality'
import type * as vite from 'vite'
import type { isExternal } from 'externality'
import { genDynamicImport, genObjectFromRawEntries } from 'knitwork'
import fse from 'fs-extra'
import { debounce } from 'perfect-debounce'
@ -11,7 +11,7 @@ import { isIgnored, logger } from '@nuxt/kit'
import { hashId, isCSS, uniq } from './utils'
import { createIsExternal } from './utils/external'
import { writeManifest } from './manifest'
import { ViteBuildContext } from './vite'
import type { ViteBuildContext } from './vite'
export interface TransformChunk {
id: string,

View File

@ -1,7 +1,7 @@
import { Plugin } from 'vite'
import type { Plugin } from 'vite'
import { transform } from 'esbuild'
import { visualizer } from 'rollup-plugin-visualizer'
import { ViteBuildContext } from '../vite'
import type { ViteBuildContext } from '../vite'
export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
return [

View File

@ -1,5 +1,5 @@
import { joinURL } from 'ufo'
import { Plugin } from 'vite'
import type { Plugin } from 'vite'
import { isCSS } from '../utils'
export interface DevStyleSSRPluginOptions {

View File

@ -1,5 +1,5 @@
import { pathToFileURL } from 'node:url'
import { Plugin } from 'vite'
import type { Plugin } from 'vite'
import { findStaticImports } from 'mlly'
import { dirname, relative } from 'pathe'
import { genObjectFromRawEntries } from 'knitwork'

View File

@ -4,7 +4,7 @@ import vuePlugin from '@vitejs/plugin-vue'
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
import { logger, resolveModule } from '@nuxt/kit'
import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo'
import { ViteBuildContext, ViteOptions } from './vite'
import type { ViteBuildContext, ViteOptions } from './vite'
import { cacheDirPlugin } from './plugins/cache-dir'
import { initViteNodeServer } from './vite-node'
import { ssrStylesPlugin } from './plugins/ssr-styles'

View File

@ -1,5 +1,6 @@
import { ExternalsOptions, ExternalsDefaults, isExternal } from 'externality'
import { ViteDevServer } from 'vite'
import type { ExternalsOptions } from 'externality'
import { ExternalsDefaults, isExternal } from 'externality'
import type { ViteDevServer } from 'vite'
export function createIsExternal (viteServer: ViteDevServer, rootDir: string) {
const externalOpts: ExternalsOptions = {

View File

@ -4,7 +4,8 @@ import webpack from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import { joinURL } from 'ufo'
import { applyPresets, WebpackConfigContext } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
import { applyPresets } from '../utils/config'
import { nuxt } from '../presets/nuxt'
export function client (ctx: WebpackConfigContext) {

View File

@ -2,7 +2,8 @@ import { isAbsolute } from 'pathe'
import webpack from 'webpack'
import ForkTSCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
import { logger } from '@nuxt/kit'
import { WebpackConfigContext, applyPresets, getWebpackConfig } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
import { applyPresets, getWebpackConfig } from '../utils/config'
import { nuxt } from '../presets/nuxt'
import { node } from '../presets/node'

View File

@ -1,4 +1,5 @@
import webpack, { Compilation, Compiler } from 'webpack'
import type { Compilation, Compiler } from 'webpack'
import webpack from 'webpack'
import { validate, isJS, extractQueryPartJS } from './util'
export interface VueSSRServerPluginOptions {

View File

@ -1,4 +1,5 @@
import { fileName, WebpackConfigContext } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
import { fileName } from '../utils/config'
export function assets (ctx: WebpackConfigContext) {
ctx.config.module!.rules!.push(

View File

@ -8,8 +8,10 @@ import { logger } from '@nuxt/kit'
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin'
import escapeRegExp from 'escape-string-regexp'
import { joinURL } from 'ufo'
import WarningIgnorePlugin, { WarningFilter } from '../plugins/warning-ignore'
import { WebpackConfigContext, applyPresets, fileName } from '../utils/config'
import type { WarningFilter } from '../plugins/warning-ignore'
import WarningIgnorePlugin from '../plugins/warning-ignore'
import type { WebpackConfigContext } from '../utils/config'
import { applyPresets, fileName } from '../utils/config'
export function base (ctx: WebpackConfigContext) {
applyPresets(ctx, [

View File

@ -1,5 +1,5 @@
import esbuildLoader from 'esbuild-loader'
import { WebpackConfigContext } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
export function esbuild (ctx: WebpackConfigContext) {
const { config } = ctx

View File

@ -1,4 +1,5 @@
import { WebpackConfigContext, applyPresets } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
import { applyPresets } from '../utils/config'
import { assets } from './assets'
import { base } from './base'

View File

@ -1,4 +1,4 @@
import { WebpackConfigContext } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
export function pug (ctx: WebpackConfigContext) {
ctx.config.module!.rules!.push({

View File

@ -1,6 +1,7 @@
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
import { fileName, WebpackConfigContext, applyPresets } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
import { fileName, applyPresets } from '../utils/config'
import { getPostcssConfig } from '../utils/postcss'
export function style (ctx: WebpackConfigContext) {

View File

@ -3,7 +3,7 @@ import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js'
import webpack from 'webpack'
import VueSSRClientPlugin from '../plugins/vue/client'
import VueSSRServerPlugin from '../plugins/vue/server'
import { WebpackConfigContext } from '../utils/config'
import type { WebpackConfigContext } from '../utils/config'
export function vue (ctx: WebpackConfigContext) {
const { options, config } = ctx

View File

@ -1,7 +1,9 @@
import pify from 'pify'
import webpack from 'webpack'
import { fromNodeMiddleware, defineEventHandler, NodeMiddleware } from 'h3'
import webpackDevMiddleware, { OutputFileSystem } from 'webpack-dev-middleware'
import type { NodeMiddleware } from 'h3'
import { fromNodeMiddleware, defineEventHandler } from 'h3'
import type { OutputFileSystem } from 'webpack-dev-middleware'
import webpackDevMiddleware from 'webpack-dev-middleware'
import webpackHotMiddleware from 'webpack-hot-middleware'
import type { Compiler, Watching } from 'webpack'

View File

@ -58,7 +58,7 @@
</template>
<script setup lang="ts">
import { Ref } from 'vue'
import type { Ref } from 'vue'
type Comp = Ref<{ add: () => void }>
const stringStatefulComp = ref(null) as any as Comp

View File

@ -4,7 +4,7 @@ import type { Ref } from 'vue'
import type { AppConfig } from '@nuxt/schema'
import type { FetchError } from 'ofetch'
import { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
import type { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
// eslint-disable-next-line import/order
import { isVue3 } from '#app'