mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 01:53:55 +00:00
style: enable sort-imports
eslint rule (#20133)
This commit is contained in:
parent
11a9780c80
commit
9878c5b6e4
@ -12,6 +12,12 @@
|
|||||||
"plugin:import/typescript"
|
"plugin:import/typescript"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"sort-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoreDeclarationSort": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"unicorn/prefer-node-protocol": "error",
|
"unicorn/prefer-node-protocol": "error",
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"vue/multi-word-component-names": "off",
|
"vue/multi-word-component-names": "off",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getQuery, defineEventHandler } from 'h3'
|
import { defineEventHandler, getQuery } from 'h3'
|
||||||
|
|
||||||
export default defineEventHandler((event) => {
|
export default defineEventHandler((event) => {
|
||||||
if ('api' in getQuery(event)) {
|
if ('api' in getQuery(event)) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { WebpackPluginInstance, Configuration as WebpackConfig } from 'webpack'
|
import type { Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack'
|
||||||
import type { Plugin as VitePlugin, UserConfig as ViteConfig } from 'vite'
|
import type { UserConfig as ViteConfig, Plugin as VitePlugin } from 'vite'
|
||||||
import { useNuxt } from './context'
|
import { useNuxt } from './context'
|
||||||
|
|
||||||
export interface ExtendConfigOptions {
|
export interface ExtendConfigOptions {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { pascalCase, kebabCase } from 'scule'
|
import { kebabCase, pascalCase } from 'scule'
|
||||||
import type { ComponentsDir, Component } from '@nuxt/schema'
|
import type { Component, ComponentsDir } from '@nuxt/schema'
|
||||||
import { useNuxt } from './context'
|
import { useNuxt } from './context'
|
||||||
import { assertNuxtCompatibility } from './compatibility'
|
import { assertNuxtCompatibility } from './compatibility'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { expect, it, describe } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { resolveGroupSyntax } from './ignore.js'
|
import { resolveGroupSyntax } from './ignore.js'
|
||||||
|
|
||||||
describe('resolveGroupSyntax', () => {
|
describe('resolveGroupSyntax', () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import lodashTemplate from 'lodash.template'
|
import lodashTemplate from 'lodash.template'
|
||||||
import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork'
|
import { genDynamicImport, genImport, genSafeVariableName } from 'knitwork'
|
||||||
|
|
||||||
import type { NuxtTemplate } from '@nuxt/schema'
|
import type { NuxtTemplate } from '@nuxt/schema'
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { resolve } from 'pathe'
|
|||||||
import { applyDefaults } from 'untyped'
|
import { applyDefaults } from 'untyped'
|
||||||
import type { LoadConfigOptions } from 'c12'
|
import type { LoadConfigOptions } from 'c12'
|
||||||
import { loadConfig } 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'
|
import { NuxtConfigSchema } from '@nuxt/schema'
|
||||||
|
|
||||||
export interface LoadNuxtConfigOptions extends LoadConfigOptions<NuxtConfig> {}
|
export interface LoadNuxtConfigOptions extends LoadConfigOptions<NuxtConfig> {}
|
||||||
|
@ -3,11 +3,11 @@ import { performance } from 'node:perf_hooks'
|
|||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { applyDefaults } from 'untyped'
|
import { applyDefaults } from 'untyped'
|
||||||
import { dirname } from 'pathe'
|
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 { logger } from '../logger'
|
||||||
import { useNuxt, nuxtCtx, tryUseNuxt } from '../context'
|
import { nuxtCtx, tryUseNuxt, useNuxt } from '../context'
|
||||||
import { isNuxt2, checkNuxtCompatibility } from '../compatibility'
|
import { checkNuxtCompatibility, isNuxt2 } from '../compatibility'
|
||||||
import { templateUtils, compileTemplate } from '../internal/template'
|
import { compileTemplate, templateUtils } from '../internal/template'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a Nuxt module, automatically merging defaults with user provided options, installing
|
* Define a Nuxt module, automatically merging defaults with user provided options, installing
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Nuxt, NuxtModule } from '@nuxt/schema'
|
import type { Nuxt, NuxtModule } from '@nuxt/schema'
|
||||||
import { isNuxt2 } from '../compatibility'
|
import { isNuxt2 } from '../compatibility'
|
||||||
import { useNuxt } from '../context'
|
import { useNuxt } from '../context'
|
||||||
import { resolveModule, requireModule } from '../internal/cjs'
|
import { requireModule, resolveModule } from '../internal/cjs'
|
||||||
import { importModule } from '../internal/esm'
|
import { importModule } from '../internal/esm'
|
||||||
import { resolveAlias } from '../resolve'
|
import { resolveAlias } from '../resolve'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack'
|
import type { Nitro, NitroDevEventHandler, NitroEventHandler } from 'nitropack'
|
||||||
import { normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
import { useNuxt } from './context'
|
import { useNuxt } from './context'
|
||||||
|
|
||||||
|
@ -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 { 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 { globby } from 'globby'
|
||||||
import { resolveAlias as _resolveAlias } from 'pathe/utils'
|
import { resolveAlias as _resolveAlias } from 'pathe/utils'
|
||||||
import { tryUseNuxt } from './context'
|
import { tryUseNuxt } from './context'
|
||||||
|
@ -2,7 +2,7 @@ import { existsSync } from 'node:fs'
|
|||||||
import { basename, parse, resolve } from 'pathe'
|
import { basename, parse, resolve } from 'pathe'
|
||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
import type { NuxtTemplate, ResolvedNuxtTemplate } from '@nuxt/schema'
|
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
|
* Renders given template using lodash template during build into the project buildDir
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { existsSync, promises as fsp } from 'node:fs'
|
import { existsSync, promises as fsp } from 'node:fs'
|
||||||
import { resolve, dirname } from 'pathe'
|
import { dirname, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
import { templates } from '../utils/templates'
|
import { templates } from '../utils/templates'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { AddressInfo } from 'node:net'
|
import type { AddressInfo } from 'node:net'
|
||||||
import type { RequestListener } from 'node:http'
|
import type { RequestListener } from 'node:http'
|
||||||
import { resolve, relative } from 'pathe'
|
import { relative, resolve } from 'pathe'
|
||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
import { debounce } from 'perfect-debounce'
|
import { debounce } from 'perfect-debounce'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
@ -12,7 +12,7 @@ import { writeTypes } from '../utils/prepare'
|
|||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
import { importModule } from '../utils/esm'
|
import { importModule } from '../utils/esm'
|
||||||
import { overrideEnv } from '../utils/env'
|
import { overrideEnv } from '../utils/env'
|
||||||
import { writeNuxtManifest, loadNuxtManifest, cleanupNuxtDirs } from '../utils/nuxt'
|
import { cleanupNuxtDirs, loadNuxtManifest, writeNuxtManifest } from '../utils/nuxt'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
|
||||||
export default defineNuxtCommand({
|
export default defineNuxtCommand({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createRequire } from 'node:module'
|
import { createRequire } from 'node:module'
|
||||||
import { normalize, dirname } from 'pathe'
|
import { dirname, normalize } from 'pathe'
|
||||||
|
|
||||||
export function getModulePaths (paths?: string | string[]): string[] {
|
export function getModulePaths (paths?: string | string[]): string[] {
|
||||||
return ([] as Array<string | undefined>)
|
return ([] as Array<string | undefined>)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import flatten from 'flat'
|
import flatten from 'flat'
|
||||||
import { detailedDiff } from 'deep-object-diff'
|
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[]) {
|
function normalizeDiff (diffObj: any, type: 'added' | 'deleted' | 'updated', ignore: string[]) {
|
||||||
return Object.entries(flatten(diffObj) as Record<string, any>)
|
return Object.entries(flatten(diffObj) as Record<string, any>)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import { resolve, dirname } from 'pathe'
|
import { dirname, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, createElementBlock } from 'vue'
|
import { createElementBlock, defineComponent } from 'vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'NuxtClientFallback',
|
name: 'NuxtClientFallback',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defineComponent, getCurrentInstance, onErrorCaptured } from 'vue'
|
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'
|
import { createBuffer } from './utils'
|
||||||
|
|
||||||
const NuxtClientFallbackServer = defineComponent({
|
const NuxtClientFallbackServer = defineComponent({
|
||||||
|
@ -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({
|
export default defineComponent({
|
||||||
name: 'ClientOnly',
|
name: 'ClientOnly',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { defineAsyncComponent } from 'vue'
|
import type { defineAsyncComponent } from 'vue'
|
||||||
import { defineComponent, createVNode } from 'vue'
|
import { createVNode, defineComponent } from 'vue'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as islandComponents from '#build/components.islands.mjs'
|
import * as islandComponents from '#build/components.islands.mjs'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { Ref, VNode } from 'vue'
|
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 type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||||
import { _wrapIf } from './utils'
|
import { _wrapIf } from './utils'
|
||||||
import { useRoute } from '#app/composables/router'
|
import { useRoute } from '#app/composables/router'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, ref, onErrorCaptured } from 'vue'
|
import { defineComponent, onErrorCaptured, ref } from 'vue'
|
||||||
import { useNuxtApp } from '#app/nuxt'
|
import { useNuxtApp } from '#app/nuxt'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -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 { debounce } from 'perfect-debounce'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import { appendHeader } from 'h3'
|
import { appendHeader } from 'h3'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { PropType, DefineComponent, ComputedRef } from 'vue'
|
import type { ComputedRef, DefineComponent, PropType } from 'vue'
|
||||||
import { defineComponent, h, ref, resolveComponent, computed, onMounted, onBeforeUnmount } from 'vue'
|
import { computed, defineComponent, h, onBeforeUnmount, onMounted, ref, resolveComponent } from 'vue'
|
||||||
import type { RouteLocation, RouteLocationRaw } from 'vue-router'
|
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 { preloadRouteComponents } from '../composables/preload'
|
||||||
import { onNuxtReady } from '../composables/ready'
|
import { onNuxtReady } from '../composables/ready'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, createElementBlock } from 'vue'
|
import { createElementBlock, defineComponent } from 'vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ServerPlaceholder',
|
name: 'ServerPlaceholder',
|
||||||
|
@ -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 { Ref, WatchSource } from 'vue'
|
||||||
import type { NuxtApp } from '../nuxt'
|
import type { NuxtApp } from '../nuxt'
|
||||||
import { useNuxtApp } from '../nuxt'
|
import { useNuxtApp } from '../nuxt'
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { FetchError } from 'ofetch'
|
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 type { Ref } from 'vue'
|
||||||
import { computed, unref, reactive } from 'vue'
|
import { computed, reactive, unref } from 'vue'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import { useRequestFetch } from './ssr'
|
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'
|
import { useAsyncData } from './asyncData'
|
||||||
|
|
||||||
export type FetchResult<ReqT extends NitroFetchRequest, M extends AvailableRouterMethod<ReqT>> = TypedInternalResponse<ReqT, unknown, M>
|
export type FetchResult<ReqT extends NitroFetchRequest, M extends AvailableRouterMethod<ReqT>> = TypedInternalResponse<ReqT, unknown, M>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { joinURL, hasProtocol } from 'ufo'
|
import { hasProtocol, joinURL } from 'ufo'
|
||||||
import { parse } from 'devalue'
|
import { parse } from 'devalue'
|
||||||
import { useHead } from '@unhead/vue'
|
import { useHead } from '@unhead/vue'
|
||||||
import { getCurrentInstance } from 'vue'
|
import { getCurrentInstance } from 'vue'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { getCurrentInstance, inject, onUnmounted } from 'vue'
|
import { getCurrentInstance, inject, onUnmounted } from 'vue'
|
||||||
import type { Ref } 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 { sendRedirect } from 'h3'
|
||||||
import { hasProtocol, joinURL, parseURL } from 'ufo'
|
import { hasProtocol, joinURL, parseURL } from 'ufo'
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// We set __webpack_public_path via this import with webpack builder
|
// 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'
|
import { $fetch } from 'ofetch'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { baseURL } from '#build/paths.mjs'
|
import { baseURL } from '#build/paths.mjs'
|
||||||
import type { CreateOptions } from '#app'
|
import type { CreateOptions } from '#app'
|
||||||
import { createNuxtApp, applyPlugins, normalizePlugins } from '#app/nuxt'
|
import { applyPlugins, createNuxtApp, normalizePlugins } from '#app/nuxt'
|
||||||
import '#build/css'
|
import '#build/css'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import _plugins from '#build/plugins'
|
import _plugins from '#build/plugins'
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/* eslint-disable no-use-before-define */
|
/* eslint-disable no-use-before-define */
|
||||||
import { getCurrentInstance, shallowReactive, reactive } from 'vue'
|
import { getCurrentInstance, reactive, shallowReactive } from 'vue'
|
||||||
import type { App, onErrorCaptured, VNode, Ref } from 'vue'
|
import type { App, Ref, VNode, onErrorCaptured } from 'vue'
|
||||||
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||||
import type { Hookable, HookCallback } from 'hookable'
|
import type { HookCallback, Hookable } from 'hookable'
|
||||||
import { createHooks } from 'hookable'
|
import { createHooks } from 'hookable'
|
||||||
import { getContext } from 'unctx'
|
import { getContext } from 'unctx'
|
||||||
import type { SSRContext } from 'vue-bundle-renderer/runtime'
|
import type { SSRContext } from 'vue-bundle-renderer/runtime'
|
||||||
import type { H3Event } from 'h3'
|
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
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'
|
import type { NuxtIslandContext } from '../core/runtime/nitro/renderer'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { parseURL } from 'ufo'
|
import { parseURL } from 'ufo'
|
||||||
import { defineNuxtPlugin } from '#app/nuxt'
|
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'
|
import { useRouter } from '#app/composables/router'
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
@ -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 { definePayloadReviver, getNuxtClientPayload } from '#app/composables/payload'
|
||||||
import { createError } from '#app/composables/error'
|
import { createError } from '#app/composables/error'
|
||||||
import { callWithNuxt, defineNuxtPlugin } from '#app/nuxt'
|
import { callWithNuxt, defineNuxtPlugin } from '#app/nuxt'
|
||||||
|
@ -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 { definePayloadReducer } from '#app/composables/payload'
|
||||||
import { isNuxtError } from '#app/composables/error'
|
import { isNuxtError } from '#app/composables/error'
|
||||||
import { defineNuxtPlugin } from '#app/nuxt'
|
import { defineNuxtPlugin } from '#app/nuxt'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { reactive, h, isReadonly } from 'vue'
|
import { h, isReadonly, reactive } from 'vue'
|
||||||
import { parseURL, stringifyParsedURL, parseQuery, stringifyQuery, withoutBase, isEqual, joinURL } from 'ufo'
|
import { isEqual, joinURL, parseQuery, parseURL, stringifyParsedURL, stringifyQuery, withoutBase } from 'ufo'
|
||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig } from '../nuxt'
|
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig } from '../nuxt'
|
||||||
import { clearError, showError } from '../composables/error'
|
import { clearError, showError } from '../composables/error'
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { statSync } from 'node:fs'
|
import { statSync } from 'node:fs'
|
||||||
import { relative, resolve } from 'pathe'
|
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 type { Component, ComponentsDir, ComponentsOptions } from 'nuxt/schema'
|
||||||
|
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { clientFallbackAutoIdPlugin } from './client-fallback-auto-id'
|
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 { scanComponents } from './scan'
|
||||||
import { loaderPlugin } from './loader'
|
import { loaderPlugin } from './loader'
|
||||||
import { TreeShakeTemplatePlugin } from './tree-shake'
|
import { TreeShakeTemplatePlugin } from './tree-shake'
|
||||||
|
@ -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 { debounce } from 'perfect-debounce'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import { appendHeader } from 'h3'
|
import { appendHeader } from 'h3'
|
||||||
|
@ -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 { globby } from 'globby'
|
||||||
import { pascalCase, splitByCase } from 'scule'
|
import { pascalCase, splitByCase } from 'scule'
|
||||||
import { isIgnored } from '@nuxt/kit'
|
import { isIgnored } from '@nuxt/kit'
|
||||||
|
@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url'
|
|||||||
import { parseURL } from 'ufo'
|
import { parseURL } from 'ufo'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
import { walk } from 'estree-walker'
|
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 { createUnplugin } from 'unplugin'
|
||||||
import type { Component } from '@nuxt/schema'
|
import type { Component } from '@nuxt/schema'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import { dirname, resolve, join } from 'pathe'
|
import { dirname, join, resolve } from 'pathe'
|
||||||
import { defu } from 'defu'
|
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 type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from 'nuxt/schema'
|
||||||
|
|
||||||
import * as defaultTemplates from './templates'
|
import * as defaultTemplates from './templates'
|
||||||
|
@ -5,7 +5,7 @@ import { debounce } from 'perfect-debounce'
|
|||||||
import { normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
import type { Nuxt } from 'nuxt/schema'
|
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) {
|
export async function build (nuxt: Nuxt) {
|
||||||
const app = createApp(nuxt)
|
const app = createApp(nuxt)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { existsSync, promises as fsp } from 'node:fs'
|
import { existsSync, promises as fsp } from 'node:fs'
|
||||||
import { resolve, join, relative } from 'pathe'
|
import { join, relative, resolve } from 'pathe'
|
||||||
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
|
import { build, copyPublicAssets, createDevServer, createNitro, prepare, prerender, scanHandlers, writeTypes } from 'nitropack'
|
||||||
import type { NitroConfig, Nitro } from 'nitropack'
|
import type { Nitro, NitroConfig } from 'nitropack'
|
||||||
import { logger, resolvePath } from '@nuxt/kit'
|
import { logger, resolvePath } from '@nuxt/kit'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { join, normalize, relative, resolve } from 'pathe'
|
import { join, normalize, relative, resolve } from 'pathe'
|
||||||
import { createHooks, createDebugger } from 'hookable'
|
import { createDebugger, createHooks } from 'hookable'
|
||||||
import type { LoadNuxtOptions } from '@nuxt/kit'
|
import type { LoadNuxtOptions } from '@nuxt/kit'
|
||||||
import { logger, resolvePath, resolveAlias, resolveFiles, loadNuxtConfig, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
|
import { addComponent, addPlugin, addVitePlugin, addWebpackPlugin, installModule, loadNuxtConfig, logger, nuxtCtx, resolveAlias, resolveFiles, resolvePath, tryResolveModule } from '@nuxt/kit'
|
||||||
import type { Nuxt, NuxtOptions, NuxtHooks } from 'nuxt/schema'
|
import type { Nuxt, NuxtHooks, NuxtOptions } from 'nuxt/schema'
|
||||||
|
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { joinURL, withQuery } from 'ufo'
|
import { joinURL, withQuery } from 'ufo'
|
||||||
import type { NitroErrorHandler } from 'nitropack'
|
import type { NitroErrorHandler } from 'nitropack'
|
||||||
import type { H3Error } from 'h3'
|
import type { H3Error } from 'h3'
|
||||||
import { setResponseHeader, getRequestHeaders, setResponseStatus } from 'h3'
|
import { getRequestHeaders, setResponseHeader, setResponseStatus } from 'h3'
|
||||||
import { useNitroApp, useRuntimeConfig } from '#internal/nitro'
|
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) {
|
export default <NitroErrorHandler> async function errorhandler (error: H3Error, event) {
|
||||||
// Parse and normalize error
|
// Parse and normalize error
|
||||||
|
@ -2,7 +2,7 @@ import { createRenderer, renderResourceHeaders } from 'vue-bundle-renderer/runti
|
|||||||
import type { RenderResponse } from 'nitropack'
|
import type { RenderResponse } from 'nitropack'
|
||||||
import type { Manifest } from 'vite'
|
import type { Manifest } from 'vite'
|
||||||
import type { H3Event } from 'h3'
|
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 devalue from '@nuxt/devalue'
|
||||||
import { stringify, uneval } from 'devalue'
|
import { stringify, uneval } from 'devalue'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
@ -10,7 +10,7 @@ import { joinURL, withoutTrailingSlash } from 'ufo'
|
|||||||
import { renderToString as _renderToString } from 'vue/server-renderer'
|
import { renderToString as _renderToString } from 'vue/server-renderer'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
|
|
||||||
import { useRuntimeConfig, defineRenderHandler, getRouteRules } from '#internal/nitro'
|
import { defineRenderHandler, getRouteRules, useRuntimeConfig } from '#internal/nitro'
|
||||||
import { useNitroApp } from '#internal/nitro/app'
|
import { useNitroApp } from '#internal/nitro/app'
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-restricted-paths
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { existsSync } from 'node:fs'
|
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 { dirname, resolve } from 'pathe'
|
||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { debounce } from 'perfect-debounce'
|
import { debounce } from 'perfect-debounce'
|
||||||
import { defineNuxtModule, createResolver } from '@nuxt/kit'
|
import { createResolver, defineNuxtModule } from '@nuxt/kit'
|
||||||
import {
|
import {
|
||||||
resolveSchema as resolveUntypedSchema,
|
generateTypes,
|
||||||
generateTypes
|
resolveSchema as resolveUntypedSchema
|
||||||
} from 'untyped'
|
} from 'untyped'
|
||||||
import type { Schema, SchemaDefinition } from 'untyped'
|
import type { Schema, SchemaDefinition } from 'untyped'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -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 { isAbsolute, join, relative, resolve } from 'pathe'
|
||||||
import { resolveSchema, generateTypes } from 'untyped'
|
import { generateTypes, resolveSchema } from 'untyped'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import { camelCase } from 'scule'
|
import { camelCase } from 'scule'
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, useNuxt, updateTemplates } from '@nuxt/kit'
|
import { addTemplate, addVitePlugin, addWebpackPlugin, defineNuxtModule, resolveAlias, updateTemplates, useNuxt } from '@nuxt/kit'
|
||||||
import { isAbsolute, join, relative, resolve, normalize } from 'pathe'
|
import { isAbsolute, join, normalize, relative, resolve } from 'pathe'
|
||||||
import type { Import, Unimport } from 'unimport'
|
import type { Import, Unimport } from 'unimport'
|
||||||
import { createUnimport, scanDirExports } 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 { TransformPlugin } from './transform'
|
||||||
import { defaultPresets } from './presets'
|
import { defaultPresets } from './presets'
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { existsSync, readdirSync } from 'node:fs'
|
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 { join, relative, resolve } from 'pathe'
|
||||||
import { genString, genImport, genObjectFromRawEntries } from 'knitwork'
|
import { genImport, genObjectFromRawEntries, genString } from 'knitwork'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
import type { NuxtApp, NuxtPage } from 'nuxt/schema'
|
import type { NuxtApp, NuxtPage } from 'nuxt/schema'
|
||||||
|
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { resolvePagesRoutes, normalizeRoutes } from './utils'
|
import { normalizeRoutes, resolvePagesRoutes } from './utils'
|
||||||
import type { PageMetaPluginOptions } from './page-meta'
|
import type { PageMetaPluginOptions } from './page-meta'
|
||||||
import { PageMetaPlugin } from './page-meta'
|
import { PageMetaPlugin } from './page-meta'
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ import { pathToFileURL } from 'node:url'
|
|||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
import { parseQuery, parseURL } from 'ufo'
|
import { parseQuery, parseURL } from 'ufo'
|
||||||
import type { StaticImport } from 'mlly'
|
import type { StaticImport } from 'mlly'
|
||||||
import { findStaticImports, findExports, parseStaticImport } from 'mlly'
|
import { findExports, findStaticImports, parseStaticImport } from 'mlly'
|
||||||
import type { CallExpression, Identifier, Expression } from 'estree'
|
import type { CallExpression, Expression, Identifier } from 'estree'
|
||||||
import type { Node } from 'estree-walker'
|
import type { Node } from 'estree-walker'
|
||||||
import { walk } from 'estree-walker'
|
import { walk } from 'estree-walker'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition } from 'vue'
|
import { Suspense, Transition, computed, defineComponent, h, nextTick, onMounted, provide, reactive } from 'vue'
|
||||||
import type { VNode, KeepAliveProps, TransitionProps } from 'vue'
|
import type { KeepAliveProps, TransitionProps, VNode } from 'vue'
|
||||||
import { RouterView } from 'vue-router'
|
import { RouterView } from 'vue-router'
|
||||||
import { defu } from 'defu'
|
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 type { RouterViewSlotProps } from './utils'
|
||||||
import { generateRouteKey, wrapInKeepAlive } from './utils'
|
import { generateRouteKey, wrapInKeepAlive } from './utils'
|
||||||
import { useNuxtApp } from '#app/nuxt'
|
import { useNuxtApp } from '#app/nuxt'
|
||||||
import { _wrapIf } from '#app/components/utils'
|
import { _wrapIf } from '#app/components/utils'
|
||||||
// @ts-ignore
|
// @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({
|
export default defineComponent({
|
||||||
name: 'NuxtPage',
|
name: 'NuxtPage',
|
||||||
|
@ -2,17 +2,17 @@ import { computed, isReadonly, reactive, shallowRef } from 'vue'
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import type { RouteLocation, Router } from 'vue-router'
|
import type { RouteLocation, Router } from 'vue-router'
|
||||||
import {
|
import {
|
||||||
createRouter,
|
|
||||||
createWebHistory,
|
|
||||||
createMemoryHistory,
|
createMemoryHistory,
|
||||||
createWebHashHistory
|
createRouter,
|
||||||
|
createWebHashHistory,
|
||||||
|
createWebHistory
|
||||||
} from 'vue-router'
|
} from 'vue-router'
|
||||||
import { createError } from 'h3'
|
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 { 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 { useRequestEvent } from '#app/composables/ssr'
|
||||||
import { useState } from '#app/composables/state'
|
import { useState } from '#app/composables/state'
|
||||||
import { navigateTo } from '#app/composables/router'
|
import { navigateTo } from '#app/composables/router'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { RouterScrollBehavior, RouteLocationNormalized } from 'vue-router'
|
import type { RouteLocationNormalized, RouterScrollBehavior } from 'vue-router'
|
||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
import type { RouterConfig } from 'nuxt/schema'
|
import type { RouterConfig } from 'nuxt/schema'
|
||||||
import { useNuxtApp } from '#app/nuxt'
|
import { useNuxtApp } from '#app/nuxt'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { KeepAlive, h } from 'vue'
|
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 InstanceOf<T> = T extends new (...args: any[]) => infer R ? R : never
|
||||||
type RouterViewSlot = Exclude<InstanceOf<typeof RouterView>['$slots']['default'], undefined>
|
type RouterViewSlot = Exclude<InstanceOf<typeof RouterView>['$slots']['default'], undefined>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { extname, normalize, relative, resolve } from 'pathe'
|
import { extname, normalize, relative, resolve } from 'pathe'
|
||||||
import { encodePath } from 'ufo'
|
import { encodePath } from 'ufo'
|
||||||
import { resolveFiles, useNuxt } from '@nuxt/kit'
|
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 escapeRE from 'escape-string-regexp'
|
||||||
import { filename } from 'pathe/utils'
|
import { filename } from 'pathe/utils'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
import { readFileSync } from 'node:fs'
|
import { readFileSync } from 'node:fs'
|
||||||
import { expect, describe, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { join } from 'pathe'
|
import { join } from 'pathe'
|
||||||
import { createCommonJS, findExports } from 'mlly'
|
import { createCommonJS, findExports } from 'mlly'
|
||||||
import * as VueFunctions from 'vue'
|
import * as VueFunctions from 'vue'
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
import { Treeshaken } from 'somepath'
|
import { Treeshaken } from 'somepath'
|
||||||
import HelloWorld from '../HelloWorld.vue'
|
import HelloWorld from '../HelloWorld.vue'
|
||||||
import DontRemoveThisSinceItIsUsedInSetup from './ComponentWithProps.vue'
|
import DontRemoveThisSinceItIsUsedInSetup from './ComponentWithProps.vue'
|
||||||
import { Glob, ClientImport } from '#components'
|
import { ClientImport, Glob } from '#components'
|
||||||
import { Both, AreTreeshaken } from '#imports'
|
import { AreTreeshaken, Both } from '#imports'
|
||||||
|
|
||||||
const hello = 'world'
|
const hello = 'world'
|
||||||
const ByeBye = defineAsyncComponent(() => import('./../some-glob.global.vue'))
|
const ByeBye = defineAsyncComponent(() => import('./../some-glob.global.vue'))
|
||||||
|
@ -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 { RouteLocation, RouteLocationRaw } from 'vue-router'
|
||||||
import type { NuxtLinkOptions, NuxtLinkProps } from '../src/app/components/nuxt-link'
|
import type { NuxtLinkOptions, NuxtLinkProps } from '../src/app/components/nuxt-link'
|
||||||
import { defineNuxtLink } from '../src/app/components/nuxt-link'
|
import { defineNuxtLink } from '../src/app/components/nuxt-link'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { expect, describe, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { generateRoutesFromFiles } from '../src/pages/utils'
|
import { generateRoutesFromFiles } from '../src/pages/utils'
|
||||||
import { generateRouteKey } from '../src/pages/runtime/utils'
|
import { generateRouteKey } from '../src/pages/runtime/utils'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { readFileSync } from 'node:fs'
|
import { readFileSync } from 'node:fs'
|
||||||
import path from 'node:path'
|
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 * as VueCompilerSFC from 'vue/compiler-sfc'
|
||||||
import type { Plugin } from 'vite'
|
import type { Plugin } from 'vite'
|
||||||
import { Parser } from 'acorn'
|
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 import of ClientImport to be treeshaken but not Glob since it is also used outside <ClientOnly>
|
||||||
expect(treeshaken).not.toContain('ClientImport')
|
expect(treeshaken).not.toContain('ClientImport')
|
||||||
expect(treeshaken).toContain('import { Glob, } from \'#components\'')
|
expect(treeshaken).toContain('import { Glob } from \'#components\'')
|
||||||
|
|
||||||
// treeshake .client slot
|
// treeshake .client slot
|
||||||
expect(treeshaken).not.toContain('ByeBye')
|
expect(treeshaken).not.toContain('ByeBye')
|
||||||
|
@ -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 * as _kit from '@nuxt/kit'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { stringifyQuery } from 'ufo'
|
import { stringifyQuery } from 'ufo'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { execa } from 'execa'
|
import { execa } from 'execa'
|
||||||
import { getRandomPort, waitForPort } from 'get-port-please'
|
import { getRandomPort, waitForPort } from 'get-port-please'
|
||||||
import type { FetchOptions } from 'ofetch'
|
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 * as _kit from '@nuxt/kit'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createTestContext, setTestContext } from '../context'
|
import { createTestContext, setTestContext } from '../context'
|
||||||
import { loadFixture, buildFixture } from '../nuxt'
|
import { buildFixture, loadFixture } from '../nuxt'
|
||||||
import { startServer, stopServer } from '../server'
|
import { startServer, stopServer } from '../server'
|
||||||
import { createBrowser } from '../browser'
|
import { createBrowser } from '../browser'
|
||||||
import type { TestHooks, TestOptions } from '../types'
|
import type { TestHooks, TestOptions } from '../types'
|
||||||
|
@ -3,7 +3,7 @@ import { join, resolve } from 'pathe'
|
|||||||
import * as vite from 'vite'
|
import * as vite from 'vite'
|
||||||
import vuePlugin from '@vitejs/plugin-vue'
|
import vuePlugin from '@vitejs/plugin-vue'
|
||||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
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 { logger } from '@nuxt/kit'
|
||||||
import { getPort } from 'get-port-please'
|
import { getPort } from 'get-port-please'
|
||||||
import { joinURL, withoutLeadingSlash } from 'ufo'
|
import { joinURL, withoutLeadingSlash } from 'ufo'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { withoutLeadingSlash, withTrailingSlash } from 'ufo'
|
import { withTrailingSlash, withoutLeadingSlash } from 'ufo'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import { normalizeViteManifest } from 'vue-bundle-renderer'
|
import { normalizeViteManifest } from 'vue-bundle-renderer'
|
||||||
import type { Manifest } from 'vue-bundle-renderer'
|
import type { Manifest } from 'vue-bundle-renderer'
|
||||||
|
@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks'
|
|||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
import { ViteNodeRunner } from 'vite-node/client'
|
import { ViteNodeRunner } from 'vite-node/client'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { viteNodeOptions, viteNodeFetch } from './vite-node-shared.mjs'
|
import { viteNodeFetch, viteNodeOptions } from './vite-node-shared.mjs'
|
||||||
|
|
||||||
const runner = createRunner()
|
const runner = createRunner()
|
||||||
let render
|
let render
|
||||||
|
@ -3,7 +3,7 @@ import * as vite from 'vite'
|
|||||||
import vuePlugin from '@vitejs/plugin-vue'
|
import vuePlugin from '@vitejs/plugin-vue'
|
||||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
||||||
import { logger, resolveModule, resolvePath } from '@nuxt/kit'
|
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 { ViteConfig } from '@nuxt/schema'
|
||||||
import type { ViteBuildContext } from './vite'
|
import type { ViteBuildContext } from './vite'
|
||||||
import { createViteLogger } from './utils/logger'
|
import { createViteLogger } from './utils/logger'
|
||||||
|
@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url'
|
|||||||
import { createApp, createError, defineEventHandler, defineLazyEventHandler, eventHandler, toNodeListener } from 'h3'
|
import { createApp, createError, defineEventHandler, defineLazyEventHandler, eventHandler, toNodeListener } from 'h3'
|
||||||
import { ViteNodeServer } from 'vite-node/server'
|
import { ViteNodeServer } from 'vite-node/server'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
import { resolve, normalize } from 'pathe'
|
import { normalize, resolve } from 'pathe'
|
||||||
import { addDevServerHandler } from '@nuxt/kit'
|
import { addDevServerHandler } from '@nuxt/kit'
|
||||||
import type { ModuleNode, Plugin as VitePlugin } from 'vite'
|
import type { ModuleNode, Plugin as VitePlugin } from 'vite'
|
||||||
import { normalizeViteManifest } from 'vue-bundle-renderer'
|
import { normalizeViteManifest } from 'vue-bundle-renderer'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as vite from 'vite'
|
import * as vite from 'vite'
|
||||||
import { join, resolve } from 'pathe'
|
import { join, resolve } from 'pathe'
|
||||||
import type { Nuxt, ViteConfig } from '@nuxt/schema'
|
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 replace from '@rollup/plugin-replace'
|
||||||
import { sanitizeFilePath } from 'mlly'
|
import { sanitizeFilePath } from 'mlly'
|
||||||
import { withoutLeadingSlash } from 'ufo'
|
import { withoutLeadingSlash } from 'ufo'
|
||||||
|
@ -11,7 +11,7 @@ import fse from 'fs-extra'
|
|||||||
|
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
import type { Compilation, Compiler } from 'webpack'
|
import type { Compilation, Compiler } from 'webpack'
|
||||||
import { isJS, isCSS, isHotUpdate } from './util'
|
import { isCSS, isHotUpdate, isJS } from './util'
|
||||||
|
|
||||||
interface PluginOptions {
|
interface PluginOptions {
|
||||||
filename: string
|
filename: string
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { Compilation, Compiler } from 'webpack'
|
import type { Compilation, Compiler } from 'webpack'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import { validate, isJS, extractQueryPartJS } from './util'
|
import { extractQueryPartJS, isJS, validate } from './util'
|
||||||
|
|
||||||
export interface VueSSRServerPluginOptions {
|
export interface VueSSRServerPluginOptions {
|
||||||
filename: string
|
filename: string
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { resolve, normalize } from 'pathe'
|
import { normalize, resolve } from 'pathe'
|
||||||
// @ts-expect-error missing types
|
// @ts-expect-error missing types
|
||||||
import TimeFixPlugin from 'time-fix-plugin'
|
import TimeFixPlugin from 'time-fix-plugin'
|
||||||
import WebpackBar from 'webpackbar'
|
import WebpackBar from 'webpackbar'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
|
||||||
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
|
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
|
||||||
import type { WebpackConfigContext } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
import { fileName, applyPresets } from '../utils/config'
|
import { applyPresets, fileName } from '../utils/config'
|
||||||
import { getPostcssConfig } from '../utils/postcss'
|
import { getPostcssConfig } from '../utils/postcss'
|
||||||
|
|
||||||
export function style (ctx: WebpackConfigContext) {
|
export function style (ctx: WebpackConfigContext) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createCommonJS } from 'mlly'
|
import { createCommonJS } from 'mlly'
|
||||||
import { defaults, merge, cloneDeep } from 'lodash-es'
|
import { cloneDeep, defaults, merge } from 'lodash-es'
|
||||||
import { requireModule } from '@nuxt/kit'
|
import { requireModule } from '@nuxt/kit'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import pify from 'pify'
|
import pify from 'pify'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import type { NodeMiddleware } from 'h3'
|
import type { NodeMiddleware } from 'h3'
|
||||||
import { fromNodeMiddleware, defineEventHandler } from 'h3'
|
import { defineEventHandler, fromNodeMiddleware } from 'h3'
|
||||||
import type { OutputFileSystem } from 'webpack-dev-middleware'
|
import type { OutputFileSystem } from 'webpack-dev-middleware'
|
||||||
import webpackDevMiddleware from 'webpack-dev-middleware'
|
import webpackDevMiddleware from 'webpack-dev-middleware'
|
||||||
import webpackHotMiddleware from 'webpack-hot-middleware'
|
import webpackHotMiddleware from 'webpack-hot-middleware'
|
||||||
@ -16,7 +16,7 @@ import { ChunkErrorPlugin } from './plugins/chunk'
|
|||||||
import { createMFS } from './utils/mfs'
|
import { createMFS } from './utils/mfs'
|
||||||
import { registerVirtualModules } from './virtual-modules'
|
import { registerVirtualModules } from './virtual-modules'
|
||||||
import { client, server } from './configs'
|
import { client, server } from './configs'
|
||||||
import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './utils/config'
|
import { applyPresets, createWebpackConfigContext, getWebpackConfig } from './utils/config'
|
||||||
|
|
||||||
// TODO: Support plugins
|
// TODO: Support plugins
|
||||||
// const plugins: string[] = []
|
// const plugins: string[] = []
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { execSync } from 'node:child_process'
|
import { execSync } from 'node:child_process'
|
||||||
import { $fetch } from 'ofetch'
|
import { $fetch } from 'ofetch'
|
||||||
import { inc } from 'semver'
|
import { inc } from 'semver'
|
||||||
import { getGitDiff, determineSemverChange, loadChangelogConfig, parseCommits } from 'changelogen'
|
import { determineSemverChange, getGitDiff, loadChangelogConfig, parseCommits } from 'changelogen'
|
||||||
import { execaSync } from 'execa'
|
import { execaSync } from 'execa'
|
||||||
import { loadWorkspace } from './_utils'
|
import { loadWorkspace } from './_utils'
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'
|
|||||||
import { joinURL, withQuery } from 'ufo'
|
import { joinURL, withQuery } from 'ufo'
|
||||||
import { isCI, isWindows } from 'std-env'
|
import { isCI, isWindows } from 'std-env'
|
||||||
import { normalize } from 'pathe'
|
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 { $fetchComponent } from '@nuxt/test-utils/experimental'
|
||||||
|
|
||||||
import type { NuxtIslandResponse } from '../packages/nuxt/src/core/runtime/nitro/renderer'
|
import type { NuxtIslandResponse } from '../packages/nuxt/src/core/runtime/nitro/renderer'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { createResolver, defineNuxtModule, addServerHandler } from 'nuxt/kit'
|
import { addServerHandler, createResolver, defineNuxtModule } from 'nuxt/kit'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
meta: {
|
meta: {
|
||||||
|
2
test/fixtures/basic/modules/example.ts
vendored
2
test/fixtures/basic/modules/example.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { defineNuxtModule, createResolver, addPlugin, useNuxt } from 'nuxt/kit'
|
import { addPlugin, createResolver, defineNuxtModule, useNuxt } from 'nuxt/kit'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
defaults: {
|
defaults: {
|
||||||
|
2
test/fixtures/basic/pages/index.vue
vendored
2
test/fixtures/basic/pages/index.vue
vendored
@ -34,7 +34,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { setupDevtoolsPlugin } from '@vue/devtools-api'
|
import { setupDevtoolsPlugin } from '@vue/devtools-api'
|
||||||
import { useRuntimeConfig } from '#imports'
|
import { useRuntimeConfig } from '#imports'
|
||||||
import { importedValue, importedRE } from '~/some-exports'
|
import { importedRE, importedValue } from '~/some-exports'
|
||||||
|
|
||||||
setupDevtoolsPlugin({}, () => {}) as any
|
setupDevtoolsPlugin({}, () => {}) as any
|
||||||
|
|
||||||
|
2
test/fixtures/basic/types.ts
vendored
2
test/fixtures/basic/types.ts
vendored
@ -3,7 +3,7 @@ import { describe, it } from 'vitest'
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import type { AppConfig, RuntimeValue } from '@nuxt/schema'
|
import type { AppConfig, RuntimeValue } from '@nuxt/schema'
|
||||||
import type { FetchError } from 'ofetch'
|
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 { defineNuxtConfig } from 'nuxt/config'
|
||||||
import { callWithNuxt, isVue3 } from '#app'
|
import { callWithNuxt, isVue3 } from '#app'
|
||||||
|
@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url'
|
|||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { isWindows } from 'std-env'
|
import { isWindows } from 'std-env'
|
||||||
import { join } from 'pathe'
|
import { join } from 'pathe'
|
||||||
import { setup, $fetch } from '@nuxt/test-utils'
|
import { $fetch, setup } from '@nuxt/test-utils'
|
||||||
|
|
||||||
import { expectWithPolling, renderPage } from './utils'
|
import { expectWithPolling, renderPage } from './utils'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import { isWindows } from 'std-env'
|
import { isWindows } from 'std-env'
|
||||||
import { describe, it, expect } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { setup, $fetch } from '@nuxt/test-utils'
|
import { $fetch, setup } from '@nuxt/test-utils'
|
||||||
import { expectNoClientErrors, renderPage } from './utils'
|
import { expectNoClientErrors, renderPage } from './utils'
|
||||||
const isWebpack = process.env.TEST_BUILDER === 'webpack'
|
const isWebpack = process.env.TEST_BUILDER === 'webpack'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect } from 'vitest'
|
import { expect } from 'vitest'
|
||||||
import type { Page } from 'playwright'
|
import type { Page } from 'playwright'
|
||||||
import { parse } from 'devalue'
|
import { parse } from 'devalue'
|
||||||
import { shallowReactive, shallowRef, reactive, ref } from 'vue'
|
import { reactive, ref, shallowReactive, shallowRef } from 'vue'
|
||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
import { createPage, getBrowser, url, useTestContext } from '@nuxt/test-utils'
|
import { createPage, getBrowser, url, useTestContext } from '@nuxt/test-utils'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user