style: enable `sort-imports` eslint rule (#20133)

This commit is contained in:
Daniel Roe 2023-04-07 17:02:47 +01:00 committed by GitHub
parent 11a9780c80
commit 9878c5b6e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 135 additions and 129 deletions

View File

@ -12,6 +12,12 @@
"plugin:import/typescript"
],
"rules": {
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true
}
],
"unicorn/prefer-node-protocol": "error",
"no-console": "off",
"vue/multi-word-component-names": "off",

View File

@ -1,4 +1,4 @@
import { getQuery, defineEventHandler } from 'h3'
import { defineEventHandler, getQuery } from 'h3'
export default defineEventHandler((event) => {
if ('api' in getQuery(event)) {

View File

@ -1,5 +1,5 @@
import type { WebpackPluginInstance, Configuration as WebpackConfig } from 'webpack'
import type { Plugin as VitePlugin, UserConfig as ViteConfig } from 'vite'
import type { Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack'
import type { UserConfig as ViteConfig, Plugin as VitePlugin } from 'vite'
import { useNuxt } from './context'
export interface ExtendConfigOptions {

View File

@ -1,5 +1,5 @@
import { pascalCase, kebabCase } from 'scule'
import type { ComponentsDir, Component } from '@nuxt/schema'
import { kebabCase, pascalCase } from 'scule'
import type { Component, ComponentsDir } from '@nuxt/schema'
import { useNuxt } from './context'
import { assertNuxtCompatibility } from './compatibility'

View File

@ -1,4 +1,4 @@
import { expect, it, describe } from 'vitest'
import { describe, expect, it } from 'vitest'
import { resolveGroupSyntax } from './ignore.js'
describe('resolveGroupSyntax', () => {

View File

@ -1,6 +1,6 @@
import { promises as fsp } from 'node:fs'
import lodashTemplate from 'lodash.template'
import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork'
import { genDynamicImport, genImport, genSafeVariableName } from 'knitwork'
import type { NuxtTemplate } from '@nuxt/schema'

View File

@ -2,7 +2,7 @@ import { resolve } from 'pathe'
import { applyDefaults } from 'untyped'
import type { LoadConfigOptions } from 'c12'
import { loadConfig } from 'c12'
import type { NuxtOptions, NuxtConfig } from '@nuxt/schema'
import type { NuxtConfig, NuxtOptions } from '@nuxt/schema'
import { NuxtConfigSchema } from '@nuxt/schema'
export interface LoadNuxtConfigOptions extends LoadConfigOptions<NuxtConfig> {}

View File

@ -3,11 +3,11 @@ import { performance } from 'node:perf_hooks'
import { defu } from 'defu'
import { applyDefaults } from 'untyped'
import { dirname } from 'pathe'
import type { Nuxt, NuxtModule, ModuleOptions, ModuleSetupReturn, ModuleDefinition, NuxtOptions, ResolvedNuxtTemplate } from '@nuxt/schema'
import type { ModuleDefinition, ModuleOptions, ModuleSetupReturn, Nuxt, NuxtModule, NuxtOptions, ResolvedNuxtTemplate } from '@nuxt/schema'
import { logger } from '../logger'
import { useNuxt, nuxtCtx, tryUseNuxt } from '../context'
import { isNuxt2, checkNuxtCompatibility } from '../compatibility'
import { templateUtils, compileTemplate } from '../internal/template'
import { nuxtCtx, tryUseNuxt, useNuxt } from '../context'
import { checkNuxtCompatibility, isNuxt2 } from '../compatibility'
import { compileTemplate, templateUtils } from '../internal/template'
/**
* Define a Nuxt module, automatically merging defaults with user provided options, installing

View File

@ -1,7 +1,7 @@
import type { Nuxt, NuxtModule } from '@nuxt/schema'
import { isNuxt2 } from '../compatibility'
import { useNuxt } from '../context'
import { resolveModule, requireModule } from '../internal/cjs'
import { requireModule, resolveModule } from '../internal/cjs'
import { importModule } from '../internal/esm'
import { resolveAlias } from '../resolve'

View File

@ -1,4 +1,4 @@
import type { NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack'
import type { Nitro, NitroDevEventHandler, NitroEventHandler } from 'nitropack'
import { normalize } from 'pathe'
import { useNuxt } from './context'

View File

@ -1,6 +1,6 @@
import { promises as fsp, existsSync } from 'node:fs'
import { existsSync, promises as fsp } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { basename, dirname, resolve, join, normalize, isAbsolute } from 'pathe'
import { basename, dirname, isAbsolute, join, normalize, resolve } from 'pathe'
import { globby } from 'globby'
import { resolveAlias as _resolveAlias } from 'pathe/utils'
import { tryUseNuxt } from './context'

View File

@ -2,7 +2,7 @@ import { existsSync } from 'node:fs'
import { basename, parse, resolve } from 'pathe'
import hash from 'hash-sum'
import type { NuxtTemplate, ResolvedNuxtTemplate } from '@nuxt/schema'
import { useNuxt, tryUseNuxt } from './context'
import { tryUseNuxt, useNuxt } from './context'
/**
* Renders given template using lodash template during build into the project buildDir

View File

@ -1,5 +1,5 @@
import { existsSync, promises as fsp } from 'node:fs'
import { resolve, dirname } from 'pathe'
import { dirname, resolve } from 'pathe'
import consola from 'consola'
import { loadKit } from '../utils/kit'
import { templates } from '../utils/templates'

View File

@ -1,6 +1,6 @@
import type { AddressInfo } from 'node:net'
import type { RequestListener } from 'node:http'
import { resolve, relative } from 'pathe'
import { relative, resolve } from 'pathe'
import chokidar from 'chokidar'
import { debounce } from 'perfect-debounce'
import type { Nuxt } from '@nuxt/schema'
@ -12,7 +12,7 @@ import { writeTypes } from '../utils/prepare'
import { loadKit } from '../utils/kit'
import { importModule } from '../utils/esm'
import { overrideEnv } from '../utils/env'
import { writeNuxtManifest, loadNuxtManifest, cleanupNuxtDirs } from '../utils/nuxt'
import { cleanupNuxtDirs, loadNuxtManifest, writeNuxtManifest } from '../utils/nuxt'
import { defineNuxtCommand } from './index'
export default defineNuxtCommand({

View File

@ -1,5 +1,5 @@
import { createRequire } from 'node:module'
import { normalize, dirname } from 'pathe'
import { dirname, normalize } from 'pathe'
export function getModulePaths (paths?: string | string[]): string[] {
return ([] as Array<string | undefined>)

View File

@ -1,6 +1,6 @@
import flatten from 'flat'
import { detailedDiff } from 'deep-object-diff'
import { green, red, blue, cyan } from 'colorette'
import { blue, cyan, green, red } from 'colorette'
function normalizeDiff (diffObj: any, type: 'added' | 'deleted' | 'updated', ignore: string[]) {
return Object.entries(flatten(diffObj) as Record<string, any>)

View File

@ -1,5 +1,5 @@
import { promises as fsp } from 'node:fs'
import { resolve, dirname } from 'pathe'
import { dirname, resolve } from 'pathe'
import consola from 'consola'
import { hash } from 'ohash'
import type { Nuxt } from '@nuxt/schema'

View File

@ -1,4 +1,4 @@
import { defineComponent, createElementBlock } from 'vue'
import { createElementBlock, defineComponent } from 'vue'
export default defineComponent({
name: 'NuxtClientFallback',

View File

@ -1,5 +1,5 @@
import { defineComponent, getCurrentInstance, onErrorCaptured } from 'vue'
import { ssrRenderVNode, ssrRenderAttrs, ssrRenderSlot } from 'vue/server-renderer'
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderVNode } from 'vue/server-renderer'
import { createBuffer } from './utils'
const NuxtClientFallbackServer = defineComponent({

View File

@ -1,4 +1,4 @@
import { mergeProps, ref, onMounted, defineComponent, createElementBlock, h, createElementVNode } from 'vue'
import { createElementBlock, createElementVNode, defineComponent, h, mergeProps, onMounted, ref } from 'vue'
export default defineComponent({
name: 'ClientOnly',

View File

@ -1,5 +1,5 @@
import type { defineAsyncComponent } from 'vue'
import { defineComponent, createVNode } from 'vue'
import { createVNode, defineComponent } from 'vue'
// @ts-ignore
import * as islandComponents from '#build/components.islands.mjs'

View File

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

View File

@ -1,4 +1,4 @@
import { defineComponent, ref, onErrorCaptured } from 'vue'
import { defineComponent, onErrorCaptured, ref } from 'vue'
import { useNuxtApp } from '#app/nuxt'
export default defineComponent({

View File

@ -1,4 +1,4 @@
import { defineComponent, createStaticVNode, computed, ref, watch, getCurrentInstance } from 'vue'
import { computed, createStaticVNode, defineComponent, getCurrentInstance, ref, watch } from 'vue'
import { debounce } from 'perfect-debounce'
import { hash } from 'ohash'
import { appendHeader } from 'h3'

View File

@ -1,7 +1,7 @@
import type { PropType, DefineComponent, ComputedRef } from 'vue'
import { defineComponent, h, ref, resolveComponent, computed, onMounted, onBeforeUnmount } from 'vue'
import type { ComputedRef, DefineComponent, PropType } from 'vue'
import { computed, defineComponent, h, onBeforeUnmount, onMounted, ref, resolveComponent } from 'vue'
import type { RouteLocation, RouteLocationRaw } from 'vue-router'
import { hasProtocol, parseQuery, parseURL, withoutTrailingSlash, withTrailingSlash } from 'ufo'
import { hasProtocol, parseQuery, parseURL, withTrailingSlash, withoutTrailingSlash } from 'ufo'
import { preloadRouteComponents } from '../composables/preload'
import { onNuxtReady } from '../composables/ready'

View File

@ -1,4 +1,4 @@
import { defineComponent, createElementBlock } from 'vue'
import { createElementBlock, defineComponent } from 'vue'
export default defineComponent({
name: 'ServerPlaceholder',

View File

@ -1,4 +1,4 @@
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch, unref, toRef } from 'vue'
import { getCurrentInstance, onBeforeMount, onServerPrefetch, onUnmounted, ref, toRef, unref, watch } from 'vue'
import type { Ref, WatchSource } from 'vue'
import type { NuxtApp } from '../nuxt'
import { useNuxtApp } from '../nuxt'

View File

@ -1,10 +1,10 @@
import type { FetchError } from 'ofetch'
import type { TypedInternalResponse, NitroFetchOptions, NitroFetchRequest, AvailableRouterMethod } from 'nitropack'
import type { AvailableRouterMethod, NitroFetchOptions, NitroFetchRequest, TypedInternalResponse } from 'nitropack'
import type { Ref } from 'vue'
import { computed, unref, reactive } from 'vue'
import { computed, reactive, unref } from 'vue'
import { hash } from 'ohash'
import { useRequestFetch } from './ssr'
import type { AsyncDataOptions, _Transform, KeysOf, AsyncData, PickFrom, MultiWatchSources } from './asyncData'
import type { AsyncData, AsyncDataOptions, KeysOf, MultiWatchSources, PickFrom, _Transform } from './asyncData'
import { useAsyncData } from './asyncData'
export type FetchResult<ReqT extends NitroFetchRequest, M extends AvailableRouterMethod<ReqT>> = TypedInternalResponse<ReqT, unknown, M>

View File

@ -1,4 +1,4 @@
import { joinURL, hasProtocol } from 'ufo'
import { hasProtocol, joinURL } from 'ufo'
import { parse } from 'devalue'
import { useHead } from '@unhead/vue'
import { getCurrentInstance } from 'vue'

View File

@ -1,6 +1,6 @@
import { getCurrentInstance, inject, onUnmounted } from 'vue'
import type { Ref } from 'vue'
import type { Router, RouteLocationNormalizedLoaded, NavigationGuard, RouteLocationNormalized, RouteLocationRaw, NavigationFailure, RouteLocationPathRaw } from 'vue-router'
import type { NavigationFailure, NavigationGuard, RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteLocationPathRaw, RouteLocationRaw, Router } from 'vue-router'
import { sendRedirect } from 'h3'
import { hasProtocol, joinURL, parseURL } from 'ufo'

View File

@ -1,10 +1,10 @@
// We set __webpack_public_path via this import with webpack builder
import { createSSRApp, createApp, nextTick } from 'vue'
import { createApp, createSSRApp, nextTick } from 'vue'
import { $fetch } from 'ofetch'
// @ts-ignore
import { baseURL } from '#build/paths.mjs'
import type { CreateOptions } from '#app'
import { createNuxtApp, applyPlugins, normalizePlugins } from '#app/nuxt'
import { applyPlugins, createNuxtApp, normalizePlugins } from '#app/nuxt'
import '#build/css'
// @ts-ignore
import _plugins from '#build/plugins'

View File

@ -1,13 +1,13 @@
/* eslint-disable no-use-before-define */
import { getCurrentInstance, shallowReactive, reactive } from 'vue'
import type { App, onErrorCaptured, VNode, Ref } from 'vue'
import { getCurrentInstance, reactive, shallowReactive } from 'vue'
import type { App, Ref, VNode, onErrorCaptured } from 'vue'
import type { RouteLocationNormalizedLoaded } from 'vue-router'
import type { Hookable, HookCallback } from 'hookable'
import type { HookCallback, Hookable } from 'hookable'
import { createHooks } from 'hookable'
import { getContext } from 'unctx'
import type { SSRContext } from 'vue-bundle-renderer/runtime'
import type { H3Event } from 'h3'
import type { RuntimeConfig, AppConfigInput, AppConfig } from 'nuxt/schema'
import type { AppConfig, AppConfigInput, RuntimeConfig } from 'nuxt/schema'
// eslint-disable-next-line import/no-restricted-paths
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'

View File

@ -1,6 +1,6 @@
import { parseURL } from 'ufo'
import { defineNuxtPlugin } from '#app/nuxt'
import { loadPayload, isPrerendered } from '#app/composables/payload'
import { isPrerendered, loadPayload } from '#app/composables/payload'
import { useRouter } from '#app/composables/router'
export default defineNuxtPlugin((nuxtApp) => {

View File

@ -1,4 +1,4 @@
import { reactive, ref, shallowRef, shallowReactive } from 'vue'
import { reactive, ref, shallowReactive, shallowRef } from 'vue'
import { definePayloadReviver, getNuxtClientPayload } from '#app/composables/payload'
import { createError } from '#app/composables/error'
import { callWithNuxt, defineNuxtPlugin } from '#app/nuxt'

View File

@ -1,4 +1,4 @@
import { isShallow, isRef, isReactive, toRaw } from 'vue'
import { isReactive, isRef, isShallow, toRaw } from 'vue'
import { definePayloadReducer } from '#app/composables/payload'
import { isNuxtError } from '#app/composables/error'
import { defineNuxtPlugin } from '#app/nuxt'

View File

@ -1,5 +1,5 @@
import { reactive, h, isReadonly } from 'vue'
import { parseURL, stringifyParsedURL, parseQuery, stringifyQuery, withoutBase, isEqual, joinURL } from 'ufo'
import { h, isReadonly, reactive } from 'vue'
import { isEqual, joinURL, parseQuery, parseURL, stringifyParsedURL, stringifyQuery, withoutBase } from 'ufo'
import { createError } from 'h3'
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig } from '../nuxt'
import { clearError, showError } from '../composables/error'

View File

@ -1,11 +1,11 @@
import { statSync } from 'node:fs'
import { relative, resolve } from 'pathe'
import { defineNuxtModule, resolveAlias, addTemplate, addPluginTemplate, updateTemplates } from '@nuxt/kit'
import { addPluginTemplate, addTemplate, defineNuxtModule, resolveAlias, updateTemplates } from '@nuxt/kit'
import type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema'
import { distDir } from '../dirs'
import { clientFallbackAutoIdPlugin } from './client-fallback-auto-id'
import { componentsPluginTemplate, componentsTemplate, componentsIslandsTemplate, componentsTypeTemplate } from './templates'
import { componentsIslandsTemplate, componentsPluginTemplate, componentsTemplate, componentsTypeTemplate } from './templates'
import { scanComponents } from './scan'
import { loaderPlugin } from './loader'
import { TreeShakeTemplatePlugin } from './tree-shake'

View File

@ -1,4 +1,4 @@
import { defineComponent, createStaticVNode, computed, h, watch } from 'vue'
import { computed, createStaticVNode, defineComponent, h, watch } from 'vue'
import { debounce } from 'perfect-debounce'
import { hash } from 'ohash'
import { appendHeader } from 'h3'

View File

@ -1,4 +1,4 @@
import { basename, extname, join, dirname, relative } from 'pathe'
import { basename, dirname, extname, join, relative } from 'pathe'
import { globby } from 'globby'
import { pascalCase, splitByCase } from 'scule'
import { isIgnored } from '@nuxt/kit'

View File

@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url'
import { parseURL } from 'ufo'
import MagicString from 'magic-string'
import { walk } from 'estree-walker'
import type { CallExpression, Property, Identifier, MemberExpression, Literal, ReturnStatement, VariableDeclaration, ObjectExpression, Node, Pattern, AssignmentProperty, Program } from 'estree'
import type { AssignmentProperty, CallExpression, Identifier, Literal, MemberExpression, Node, ObjectExpression, Pattern, Program, Property, ReturnStatement, VariableDeclaration } from 'estree'
import { createUnplugin } from 'unplugin'
import type { Component } from '@nuxt/schema'
import { resolve } from 'pathe'

View File

@ -1,7 +1,7 @@
import { promises as fsp } from 'node:fs'
import { dirname, resolve, join } from 'pathe'
import { dirname, join, resolve } from 'pathe'
import { defu } from 'defu'
import { findPath, resolveFiles, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils, tryResolveModule, resolvePath, resolveAlias } from '@nuxt/kit'
import { compileTemplate, findPath, normalizePlugin, normalizeTemplate, resolveAlias, resolveFiles, resolvePath, templateUtils, tryResolveModule } from '@nuxt/kit'
import type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from 'nuxt/schema'
import * as defaultTemplates from './templates'

View File

@ -5,7 +5,7 @@ import { debounce } from 'perfect-debounce'
import { normalize } from 'pathe'
import type { Nuxt } from 'nuxt/schema'
import { createApp, generateApp as _generateApp } from './app'
import { generateApp as _generateApp, createApp } from './app'
export async function build (nuxt: Nuxt) {
const app = createApp(nuxt)

View File

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

View File

@ -1,8 +1,8 @@
import { join, normalize, relative, resolve } from 'pathe'
import { createHooks, createDebugger } from 'hookable'
import { createDebugger, createHooks } from 'hookable'
import type { LoadNuxtOptions } from '@nuxt/kit'
import { logger, resolvePath, resolveAlias, resolveFiles, loadNuxtConfig, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
import type { Nuxt, NuxtOptions, NuxtHooks } from 'nuxt/schema'
import { addComponent, addPlugin, addVitePlugin, addWebpackPlugin, installModule, loadNuxtConfig, logger, nuxtCtx, resolveAlias, resolveFiles, resolvePath, tryResolveModule } from '@nuxt/kit'
import type { Nuxt, NuxtHooks, NuxtOptions } from 'nuxt/schema'
import escapeRE from 'escape-string-regexp'
import fse from 'fs-extra'

View File

@ -1,9 +1,9 @@
import { joinURL, withQuery } from 'ufo'
import type { NitroErrorHandler } from 'nitropack'
import type { H3Error } from 'h3'
import { setResponseHeader, getRequestHeaders, setResponseStatus } from 'h3'
import { getRequestHeaders, setResponseHeader, setResponseStatus } from 'h3'
import { useNitroApp, useRuntimeConfig } from '#internal/nitro'
import { normalizeError, isJsonRequest } from '#internal/nitro/utils'
import { isJsonRequest, normalizeError } from '#internal/nitro/utils'
export default <NitroErrorHandler> async function errorhandler (error: H3Error, event) {
// Parse and normalize error

View File

@ -2,7 +2,7 @@ import { createRenderer, renderResourceHeaders } from 'vue-bundle-renderer/runti
import type { RenderResponse } from 'nitropack'
import type { Manifest } from 'vite'
import type { H3Event } from 'h3'
import { appendHeader, getQuery, writeEarlyHints, readBody, createError } from 'h3'
import { appendHeader, createError, getQuery, readBody, writeEarlyHints } from 'h3'
import devalue from '@nuxt/devalue'
import { stringify, uneval } from 'devalue'
import destr from 'destr'
@ -10,7 +10,7 @@ import { joinURL, withoutTrailingSlash } from 'ufo'
import { renderToString as _renderToString } from 'vue/server-renderer'
import { hash } from 'ohash'
import { useRuntimeConfig, defineRenderHandler, getRouteRules } from '#internal/nitro'
import { defineRenderHandler, getRouteRules, useRuntimeConfig } from '#internal/nitro'
import { useNitroApp } from '#internal/nitro/app'
// eslint-disable-next-line import/no-restricted-paths

View File

@ -1,13 +1,13 @@
import { existsSync } from 'node:fs'
import { writeFile, mkdir } from 'node:fs/promises'
import { mkdir, writeFile } from 'node:fs/promises'
import { dirname, resolve } from 'pathe'
import chokidar from 'chokidar'
import { defu } from 'defu'
import { debounce } from 'perfect-debounce'
import { defineNuxtModule, createResolver } from '@nuxt/kit'
import { createResolver, defineNuxtModule } from '@nuxt/kit'
import {
resolveSchema as resolveUntypedSchema,
generateTypes
generateTypes,
resolveSchema as resolveUntypedSchema
} from 'untyped'
import type { Schema, SchemaDefinition } from 'untyped'
// @ts-ignore

View File

@ -1,6 +1,6 @@
import { genArrayFromRaw, genDynamicImport, genExport, genImport, genObjectFromRawEntries, genString, genSafeVariableName } from 'knitwork'
import { genArrayFromRaw, genDynamicImport, genExport, genImport, genObjectFromRawEntries, genSafeVariableName, genString } from 'knitwork'
import { isAbsolute, join, relative, resolve } from 'pathe'
import { resolveSchema, generateTypes } from 'untyped'
import { generateTypes, resolveSchema } from 'untyped'
import escapeRE from 'escape-string-regexp'
import { hash } from 'ohash'
import { camelCase } from 'scule'

View File

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

View File

@ -1,13 +1,13 @@
import { existsSync, readdirSync } from 'node:fs'
import { defineNuxtModule, addTemplate, addPlugin, addVitePlugin, addWebpackPlugin, findPath, addComponent, updateTemplates } from '@nuxt/kit'
import { addComponent, addPlugin, addTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, findPath, updateTemplates } from '@nuxt/kit'
import { join, relative, resolve } from 'pathe'
import { genString, genImport, genObjectFromRawEntries } from 'knitwork'
import { genImport, genObjectFromRawEntries, genString } from 'knitwork'
import escapeRE from 'escape-string-regexp'
import { joinURL } from 'ufo'
import type { NuxtApp, NuxtPage } from 'nuxt/schema'
import { distDir } from '../dirs'
import { resolvePagesRoutes, normalizeRoutes } from './utils'
import { normalizeRoutes, resolvePagesRoutes } from './utils'
import type { PageMetaPluginOptions } from './page-meta'
import { PageMetaPlugin } from './page-meta'

View File

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

View File

@ -1,15 +1,15 @@
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition } from 'vue'
import type { VNode, KeepAliveProps, TransitionProps } from 'vue'
import { Suspense, Transition, computed, defineComponent, h, nextTick, onMounted, provide, reactive } from 'vue'
import type { KeepAliveProps, TransitionProps, VNode } from 'vue'
import { RouterView } from 'vue-router'
import { defu } from 'defu'
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteLocation } from 'vue-router'
import type { RouteLocation, RouteLocationNormalized, RouteLocationNormalizedLoaded } from 'vue-router'
import type { RouterViewSlotProps } from './utils'
import { generateRouteKey, wrapInKeepAlive } from './utils'
import { useNuxtApp } from '#app/nuxt'
import { _wrapIf } from '#app/components/utils'
// @ts-ignore
import { appPageTransition as defaultPageTransition, appKeepalive as defaultKeepaliveConfig } from '#build/nuxt.config.mjs'
import { appKeepalive as defaultKeepaliveConfig, appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
export default defineComponent({
name: 'NuxtPage',

View File

@ -2,17 +2,17 @@ import { computed, isReadonly, reactive, shallowRef } from 'vue'
import type { Ref } from 'vue'
import type { RouteLocation, Router } from 'vue-router'
import {
createRouter,
createWebHistory,
createMemoryHistory,
createWebHashHistory
createRouter,
createWebHashHistory,
createWebHistory
} from 'vue-router'
import { createError } from 'h3'
import { withoutBase, isEqual } from 'ufo'
import { isEqual, withoutBase } from 'ufo'
import type { PageMeta, RouteMiddleware, Plugin } from '../../../app/index'
import type { PageMeta, Plugin, RouteMiddleware } from '../../../app/index'
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig } from '#app/nuxt'
import { showError, clearError, useError } from '#app/composables/error'
import { clearError, showError, useError } from '#app/composables/error'
import { useRequestEvent } from '#app/composables/ssr'
import { useState } from '#app/composables/state'
import { navigateTo } from '#app/composables/router'

View File

@ -1,4 +1,4 @@
import type { RouterScrollBehavior, RouteLocationNormalized } from 'vue-router'
import type { RouteLocationNormalized, RouterScrollBehavior } from 'vue-router'
import { nextTick } from 'vue'
import type { RouterConfig } from 'nuxt/schema'
import { useNuxtApp } from '#app/nuxt'

View File

@ -1,5 +1,5 @@
import { KeepAlive, h } from 'vue'
import type { RouterView, RouteLocationMatched, RouteLocationNormalizedLoaded } from 'vue-router'
import type { RouteLocationMatched, RouteLocationNormalizedLoaded, RouterView } from 'vue-router'
type InstanceOf<T> = T extends new (...args: any[]) => infer R ? R : never
type RouterViewSlot = Exclude<InstanceOf<typeof RouterView>['$slots']['default'], undefined>

View File

@ -1,7 +1,7 @@
import { extname, normalize, relative, resolve } from 'pathe'
import { encodePath } from 'ufo'
import { resolveFiles, useNuxt } from '@nuxt/kit'
import { genImport, genDynamicImport, genArrayFromRaw, genSafeVariableName } from 'knitwork'
import { genArrayFromRaw, genDynamicImport, genImport, genSafeVariableName } from 'knitwork'
import escapeRE from 'escape-string-regexp'
import { filename } from 'pathe/utils'
import { hash } from 'ohash'

View File

@ -1,5 +1,5 @@
import { readFileSync } from 'node:fs'
import { expect, describe, it } from 'vitest'
import { describe, expect, it } from 'vitest'
import { join } from 'pathe'
import { createCommonJS, findExports } from 'mlly'
import * as VueFunctions from 'vue'

View File

@ -51,8 +51,8 @@
import { Treeshaken } from 'somepath'
import HelloWorld from '../HelloWorld.vue'
import DontRemoveThisSinceItIsUsedInSetup from './ComponentWithProps.vue'
import { Glob, ClientImport } from '#components'
import { Both, AreTreeshaken } from '#imports'
import { ClientImport, Glob } from '#components'
import { AreTreeshaken, Both } from '#imports'
const hello = 'world'
const ByeBye = defineAsyncComponent(() => import('./../some-glob.global.vue'))

View File

@ -1,4 +1,4 @@
import { expect, describe, it, vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import type { RouteLocation, RouteLocationRaw } from 'vue-router'
import type { NuxtLinkOptions, NuxtLinkProps } from '../src/app/components/nuxt-link'
import { defineNuxtLink } from '../src/app/components/nuxt-link'

View File

@ -1,4 +1,4 @@
import { expect, describe, it } from 'vitest'
import { describe, expect, it } from 'vitest'
import { generateRoutesFromFiles } from '../src/pages/utils'
import { generateRouteKey } from '../src/pages/runtime/utils'

View File

@ -1,6 +1,6 @@
import { readFileSync } from 'node:fs'
import path from 'node:path'
import { describe, it, expect, vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import * as VueCompilerSFC from 'vue/compiler-sfc'
import type { Plugin } from 'vite'
import { Parser } from 'acorn'
@ -165,7 +165,7 @@ describe('treeshake client only in ssr', () => {
// expect import of ClientImport to be treeshaken but not Glob since it is also used outside <ClientOnly>
expect(treeshaken).not.toContain('ClientImport')
expect(treeshaken).toContain('import { Glob, } from \'#components\'')
expect(treeshaken).toContain('import { Glob } from \'#components\'')
// treeshake .client slot
expect(treeshaken).not.toContain('ByeBye')

View File

@ -1,4 +1,4 @@
import { fetch as _fetch, $fetch as _$fetch } from 'ofetch'
import { $fetch as _$fetch, fetch as _fetch } from 'ofetch'
import * as _kit from '@nuxt/kit'
import { resolve } from 'pathe'
import { stringifyQuery } from 'ufo'

View File

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

View File

@ -1,5 +1,5 @@
import { createTestContext, setTestContext } from '../context'
import { loadFixture, buildFixture } from '../nuxt'
import { buildFixture, loadFixture } from '../nuxt'
import { startServer, stopServer } from '../server'
import { createBrowser } from '../browser'
import type { TestHooks, TestOptions } from '../types'

View File

@ -3,7 +3,7 @@ import { join, resolve } from 'pathe'
import * as vite from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
import type { ServerOptions, BuildOptions } from 'vite'
import type { BuildOptions, ServerOptions } from 'vite'
import { logger } from '@nuxt/kit'
import { getPort } from 'get-port-please'
import { joinURL, withoutLeadingSlash } from 'ufo'

View File

@ -1,6 +1,6 @@
import fse from 'fs-extra'
import { resolve } from 'pathe'
import { withoutLeadingSlash, withTrailingSlash } from 'ufo'
import { withTrailingSlash, withoutLeadingSlash } from 'ufo'
import escapeRE from 'escape-string-regexp'
import { normalizeViteManifest } from 'vue-bundle-renderer'
import type { Manifest } from 'vue-bundle-renderer'

View File

@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks'
import { createError } from 'h3'
import { ViteNodeRunner } from 'vite-node/client'
import consola from 'consola'
import { viteNodeOptions, viteNodeFetch } from './vite-node-shared.mjs'
import { viteNodeFetch, viteNodeOptions } from './vite-node-shared.mjs'
const runner = createRunner()
let render

View File

@ -3,7 +3,7 @@ import * as vite from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
import { logger, resolveModule, resolvePath } from '@nuxt/kit'
import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo'
import { joinURL, withTrailingSlash, withoutLeadingSlash } from 'ufo'
import type { ViteConfig } from '@nuxt/schema'
import type { ViteBuildContext } from './vite'
import { createViteLogger } from './utils/logger'

View File

@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url'
import { createApp, createError, defineEventHandler, defineLazyEventHandler, eventHandler, toNodeListener } from 'h3'
import { ViteNodeServer } from 'vite-node/server'
import fse from 'fs-extra'
import { resolve, normalize } from 'pathe'
import { normalize, resolve } from 'pathe'
import { addDevServerHandler } from '@nuxt/kit'
import type { ModuleNode, Plugin as VitePlugin } from 'vite'
import { normalizeViteManifest } from 'vue-bundle-renderer'

View File

@ -1,7 +1,7 @@
import * as vite from 'vite'
import { join, resolve } from 'pathe'
import type { Nuxt, ViteConfig } from '@nuxt/schema'
import { logger, isIgnored, resolvePath, addVitePlugin } from '@nuxt/kit'
import { addVitePlugin, isIgnored, logger, resolvePath } from '@nuxt/kit'
import replace from '@rollup/plugin-replace'
import { sanitizeFilePath } from 'mlly'
import { withoutLeadingSlash } from 'ufo'

View File

@ -11,7 +11,7 @@ import fse from 'fs-extra'
import type { Nuxt } from '@nuxt/schema'
import type { Compilation, Compiler } from 'webpack'
import { isJS, isCSS, isHotUpdate } from './util'
import { isCSS, isHotUpdate, isJS } from './util'
interface PluginOptions {
filename: string

View File

@ -1,6 +1,6 @@
import type { Compilation, Compiler } from 'webpack'
import webpack from 'webpack'
import { validate, isJS, extractQueryPartJS } from './util'
import { extractQueryPartJS, isJS, validate } from './util'
export interface VueSSRServerPluginOptions {
filename: string

View File

@ -1,4 +1,4 @@
import { resolve, normalize } from 'pathe'
import { normalize, resolve } from 'pathe'
// @ts-expect-error missing types
import TimeFixPlugin from 'time-fix-plugin'
import WebpackBar from 'webpackbar'

View File

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

View File

@ -1,5 +1,5 @@
import { createCommonJS } from 'mlly'
import { defaults, merge, cloneDeep } from 'lodash-es'
import { cloneDeep, defaults, merge } from 'lodash-es'
import { requireModule } from '@nuxt/kit'
import type { Nuxt } from '@nuxt/schema'

View File

@ -1,7 +1,7 @@
import pify from 'pify'
import webpack from 'webpack'
import type { NodeMiddleware } from 'h3'
import { fromNodeMiddleware, defineEventHandler } from 'h3'
import { defineEventHandler, fromNodeMiddleware } from 'h3'
import type { OutputFileSystem } from 'webpack-dev-middleware'
import webpackDevMiddleware from 'webpack-dev-middleware'
import webpackHotMiddleware from 'webpack-hot-middleware'
@ -16,7 +16,7 @@ import { ChunkErrorPlugin } from './plugins/chunk'
import { createMFS } from './utils/mfs'
import { registerVirtualModules } from './virtual-modules'
import { client, server } from './configs'
import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './utils/config'
import { applyPresets, createWebpackConfigContext, getWebpackConfig } from './utils/config'
// TODO: Support plugins
// const plugins: string[] = []

View File

@ -1,7 +1,7 @@
import { execSync } from 'node:child_process'
import { $fetch } from 'ofetch'
import { inc } from 'semver'
import { getGitDiff, determineSemverChange, loadChangelogConfig, parseCommits } from 'changelogen'
import { determineSemverChange, getGitDiff, loadChangelogConfig, parseCommits } from 'changelogen'
import { execaSync } from 'execa'
import { loadWorkspace } from './_utils'

View File

@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'
import { joinURL, withQuery } from 'ufo'
import { isCI, isWindows } from 'std-env'
import { normalize } from 'pathe'
import { setup, fetch, $fetch, startServer, isDev, createPage, url } from '@nuxt/test-utils'
import { $fetch, createPage, fetch, isDev, setup, startServer, url } from '@nuxt/test-utils'
import { $fetchComponent } from '@nuxt/test-utils/experimental'
import type { NuxtIslandResponse } from '../packages/nuxt/src/core/runtime/nitro/renderer'

View File

@ -1,4 +1,4 @@
import { createResolver, defineNuxtModule, addServerHandler } from 'nuxt/kit'
import { addServerHandler, createResolver, defineNuxtModule } from 'nuxt/kit'
export default defineNuxtModule({
meta: {

View File

@ -1,4 +1,4 @@
import { defineNuxtModule, createResolver, addPlugin, useNuxt } from 'nuxt/kit'
import { addPlugin, createResolver, defineNuxtModule, useNuxt } from 'nuxt/kit'
export default defineNuxtModule({
defaults: {

View File

@ -34,7 +34,7 @@
<script setup lang="ts">
import { setupDevtoolsPlugin } from '@vue/devtools-api'
import { useRuntimeConfig } from '#imports'
import { importedValue, importedRE } from '~/some-exports'
import { importedRE, importedValue } from '~/some-exports'
setupDevtoolsPlugin({}, () => {}) as any

View File

@ -3,7 +3,7 @@ import { describe, it } from 'vitest'
import type { Ref } from 'vue'
import type { AppConfig, RuntimeValue } from '@nuxt/schema'
import type { FetchError } from 'ofetch'
import type { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter, Router } from 'vue-router'
import type { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, Router, useRouter as vueUseRouter } from 'vue-router'
import { defineNuxtConfig } from 'nuxt/config'
import { callWithNuxt, isVue3 } from '#app'

View File

@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { isWindows } from 'std-env'
import { join } from 'pathe'
import { setup, $fetch } from '@nuxt/test-utils'
import { $fetch, setup } from '@nuxt/test-utils'
import { expectWithPolling, renderPage } from './utils'

View File

@ -1,7 +1,7 @@
import { fileURLToPath } from 'node:url'
import { isWindows } from 'std-env'
import { describe, it, expect } from 'vitest'
import { setup, $fetch } from '@nuxt/test-utils'
import { describe, expect, it } from 'vitest'
import { $fetch, setup } from '@nuxt/test-utils'
import { expectNoClientErrors, renderPage } from './utils'
const isWebpack = process.env.TEST_BUILDER === 'webpack'

View File

@ -1,7 +1,7 @@
import { expect } from 'vitest'
import type { Page } from 'playwright'
import { parse } from 'devalue'
import { shallowReactive, shallowRef, reactive, ref } from 'vue'
import { reactive, ref, shallowReactive, shallowRef } from 'vue'
import { createError } from 'h3'
import { createPage, getBrowser, url, useTestContext } from '@nuxt/test-utils'