mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
refactor: split out type imports from value imports (#9225)
This commit is contained in:
parent
ce4d29031e
commit
ab2456c295
@ -45,6 +45,12 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"disallowTypeAnnotations": false
|
||||||
|
}
|
||||||
|
],
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { applyDefaults } from 'untyped'
|
import { applyDefaults } from 'untyped'
|
||||||
import { loadConfig, LoadConfigOptions } from 'c12'
|
import type { LoadConfigOptions } from 'c12'
|
||||||
|
import { loadConfig } from 'c12'
|
||||||
import type { NuxtOptions, NuxtConfig } from '@nuxt/schema'
|
import type { NuxtOptions, NuxtConfig } from '@nuxt/schema'
|
||||||
import { NuxtConfigSchema } from '@nuxt/schema'
|
import { NuxtConfigSchema } from '@nuxt/schema'
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { readPackageJSON, resolvePackageJSON } from 'pkg-types'
|
import { readPackageJSON, resolvePackageJSON } from 'pkg-types'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
import { importModule, tryImportModule, RequireModuleOptions } from '../internal/cjs'
|
import type { RequireModuleOptions } from '../internal/cjs'
|
||||||
|
import { importModule, tryImportModule } from '../internal/cjs'
|
||||||
import type { LoadNuxtConfigOptions } from './config'
|
import type { LoadNuxtConfigOptions } from './config'
|
||||||
|
|
||||||
export interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
export interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import mri from 'mri'
|
import mri from 'mri'
|
||||||
import { red } from 'colorette'
|
import { red } from 'colorette'
|
||||||
import consola, { ConsolaReporter } from 'consola'
|
import type { ConsolaReporter } from 'consola'
|
||||||
|
import consola from 'consola'
|
||||||
import { checkEngines } from './utils/engines'
|
import { checkEngines } from './utils/engines'
|
||||||
import { commands, Command, NuxtCommand } from './commands'
|
import type { Command, NuxtCommand } from './commands'
|
||||||
|
import { commands } from './commands'
|
||||||
import { showHelp } from './utils/help'
|
import { showHelp } from './utils/help'
|
||||||
import { showBanner } from './utils/banner'
|
import { showBanner } from './utils/banner'
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { AddressInfo } from 'node:net'
|
import type { AddressInfo } from 'node:net'
|
||||||
import { RequestListener } from 'node:http'
|
import type { RequestListener } from 'node:http'
|
||||||
import { existsSync, readdirSync } from 'node:fs'
|
import { existsSync, readdirSync } from 'node:fs'
|
||||||
import { resolve, relative, normalize } from 'pathe'
|
import { resolve, relative, normalize } from 'pathe'
|
||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
|
@ -6,7 +6,7 @@ import jiti from 'jiti'
|
|||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
import { splitByCase } from 'scule'
|
import { splitByCase } from 'scule'
|
||||||
import clipboardy from 'clipboardy'
|
import clipboardy from 'clipboardy'
|
||||||
import { NuxtModule } from '@nuxt/schema'
|
import type { NuxtModule } from '@nuxt/schema'
|
||||||
import { getPackageManager, getPackageManagerVersion } from '../utils/packageManagers'
|
import { getPackageManager, getPackageManagerVersion } from '../utils/packageManagers'
|
||||||
import { findup } from '../utils/fs'
|
import { findup } from '../utils/fs'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import mri from 'mri'
|
import mri from 'mri'
|
||||||
import { commands, Command, NuxtCommand } from './commands'
|
import type { Command, NuxtCommand } from './commands'
|
||||||
|
import { commands } from './commands'
|
||||||
|
|
||||||
export async function runCommand (command: string, argv = process.argv.slice(2)) {
|
export async function runCommand (command: string, argv = process.argv.slice(2)) {
|
||||||
const args = mri(argv)
|
const args = mri(argv)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { cyan, magenta } from 'colorette'
|
import { cyan, magenta } from 'colorette'
|
||||||
import { NuxtCommandMeta } from '../commands'
|
import type { NuxtCommandMeta } from '../commands'
|
||||||
|
|
||||||
export function showHelp (meta?: Partial<NuxtCommandMeta>) {
|
export function showHelp (meta?: Partial<NuxtCommandMeta>) {
|
||||||
const sections: string[] = []
|
const sections: string[] = []
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import { isAbsolute, join, relative, resolve } from 'pathe'
|
import { isAbsolute, join, relative, resolve } from 'pathe'
|
||||||
import { Nuxt, TSReference } from '@nuxt/schema'
|
import type { Nuxt, TSReference } from '@nuxt/schema'
|
||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import type { TSConfig } from 'pkg-types'
|
import type { TSConfig } from 'pkg-types'
|
||||||
import { getModulePaths, getNearestPackage } from './cjs'
|
import { getModulePaths, getNearestPackage } from './cjs'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineBuildConfig, BuildEntry } from 'unbuild'
|
import type { BuildEntry } from 'unbuild'
|
||||||
|
import { defineBuildConfig } from 'unbuild'
|
||||||
|
|
||||||
export default defineBuildConfig({
|
export default defineBuildConfig({
|
||||||
declaration: true,
|
declaration: true,
|
||||||
|
2
packages/nuxt/config.d.ts
vendored
2
packages/nuxt/config.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { NuxtConfig } from '@nuxt/schema'
|
import type { NuxtConfig } from '@nuxt/schema'
|
||||||
export { NuxtConfig } from '@nuxt/schema'
|
export { NuxtConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
export declare function defineNuxtConfig(config: NuxtConfig): NuxtConfig
|
export declare function defineNuxtConfig(config: NuxtConfig): NuxtConfig
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { computed, defineComponent, h, inject, nextTick, onMounted, Ref, Transition, unref, VNode } from 'vue'
|
import type { Ref, VNode } from 'vue'
|
||||||
|
import { computed, defineComponent, h, inject, nextTick, onMounted, Transition, unref } from 'vue'
|
||||||
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||||
import { _wrapIf } from './utils'
|
import { _wrapIf } from './utils'
|
||||||
import { useRoute } from '#app'
|
import { useRoute } from '#app'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineComponent, h, ref, resolveComponent, PropType, computed, DefineComponent, ComputedRef, onMounted, onBeforeUnmount } from 'vue'
|
import type { PropType, DefineComponent, ComputedRef } from 'vue'
|
||||||
|
import { defineComponent, h, ref, resolveComponent, computed, onMounted, onBeforeUnmount } from 'vue'
|
||||||
import type { RouteLocationRaw } from 'vue-router'
|
import type { RouteLocationRaw } from 'vue-router'
|
||||||
import { hasProtocol } from 'ufo'
|
import { hasProtocol } from 'ufo'
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch, unref, toRef } from 'vue'
|
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch, unref, toRef } from 'vue'
|
||||||
import type { Ref, WatchSource } from 'vue'
|
import type { Ref, WatchSource } from 'vue'
|
||||||
import { NuxtApp, useNuxtApp } from '../nuxt'
|
import type { NuxtApp } from '../nuxt'
|
||||||
|
import { useNuxtApp } from '../nuxt'
|
||||||
import { createError } from './error'
|
import { createError } from './error'
|
||||||
|
|
||||||
export type _Transform<Input = any, Output = any> = (input: Input) => Output
|
export type _Transform<Input = any, Output = any> = (input: Input) => Output
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { defineComponent, getCurrentInstance, reactive, toRefs } from 'vue'
|
import { getCurrentInstance, reactive, toRefs } from 'vue'
|
||||||
import type { DefineComponent } from 'vue'
|
import type { DefineComponent, defineComponent } from 'vue'
|
||||||
import { NuxtApp, useNuxtApp } from '../nuxt'
|
import type { NuxtApp } from '../nuxt'
|
||||||
|
import { useNuxtApp } from '../nuxt'
|
||||||
import { useAsyncData } from './asyncData'
|
import { useAsyncData } from './asyncData'
|
||||||
import { useRoute } from './router'
|
import { useRoute } from './router'
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { ref, Ref, watch } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { parse, serialize, CookieParseOptions, CookieSerializeOptions } from 'cookie-es'
|
import { ref, watch } from 'vue'
|
||||||
|
import type { CookieParseOptions, CookieSerializeOptions } from 'cookie-es'
|
||||||
|
import { parse, serialize } from 'cookie-es'
|
||||||
import { appendHeader } from 'h3'
|
import { appendHeader } from 'h3'
|
||||||
import type { H3Event } from 'h3'
|
import type { H3Event } from 'h3'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createError as _createError, H3Error } from 'h3'
|
import type { H3Error } from 'h3'
|
||||||
|
import { createError as _createError } from 'h3'
|
||||||
import { toRef } from 'vue'
|
import { toRef } from 'vue'
|
||||||
import { useNuxtApp } from '../nuxt'
|
import { useNuxtApp } from '../nuxt'
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import type { FetchError, FetchOptions } from 'ofetch'
|
import type { FetchError, FetchOptions } from 'ofetch'
|
||||||
import type { TypedInternalResponse, NitroFetchRequest } from 'nitropack'
|
import type { TypedInternalResponse, NitroFetchRequest } from 'nitropack'
|
||||||
import { computed, unref, Ref, reactive } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
|
import { computed, unref, reactive } from 'vue'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import type { AsyncDataOptions, _Transform, KeyOfRes, AsyncData, PickFrom } from './asyncData'
|
import type { AsyncDataOptions, _Transform, KeyOfRes, AsyncData, PickFrom } from './asyncData'
|
||||||
import { useAsyncData } from './asyncData'
|
import { useAsyncData } from './asyncData'
|
||||||
|
@ -3,7 +3,8 @@ import type { Router, RouteLocationNormalizedLoaded, NavigationGuard, RouteLocat
|
|||||||
import { sendRedirect } from 'h3'
|
import { sendRedirect } from 'h3'
|
||||||
import { hasProtocol, joinURL, parseURL } from 'ufo'
|
import { hasProtocol, joinURL, parseURL } from 'ufo'
|
||||||
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
|
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
|
||||||
import { createError, NuxtError } from './error'
|
import type { NuxtError } from './error'
|
||||||
|
import { createError } from './error'
|
||||||
import { useState } from './state'
|
import { useState } from './state'
|
||||||
|
|
||||||
export const useRouter = () => {
|
export const useRouter = () => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable no-redeclare */
|
/* eslint-disable no-redeclare */
|
||||||
import type { H3Event } from 'h3'
|
import type { H3Event } from 'h3'
|
||||||
import { useNuxtApp, NuxtApp } from '../nuxt'
|
import type { NuxtApp } from '../nuxt'
|
||||||
|
import { useNuxtApp } from '../nuxt'
|
||||||
|
|
||||||
export function useRequestHeaders<K extends string = string> (include: K[]): Record<Lowercase<K>, string | undefined>
|
export function useRequestHeaders<K extends string = string> (include: K[]): Record<Lowercase<K>, string | undefined>
|
||||||
export function useRequestHeaders (): Readonly<Record<string, string | undefined>>
|
export function useRequestHeaders (): Readonly<Record<string, string | undefined>>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { CreateOptions } from '#app'
|
import type { CreateOptions } from '#app'
|
||||||
|
|
||||||
const entry = process.server
|
const entry = process.server
|
||||||
? (ctx?: CreateOptions['ssrContext']) => import('#app/entry').then(m => m.default(ctx))
|
? (ctx?: CreateOptions['ssrContext']) => import('#app/entry').then(m => m.default(ctx))
|
||||||
|
@ -3,7 +3,8 @@ import { createSSRApp, createApp, 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 { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
|
import type { CreateOptions } from '#app'
|
||||||
|
import { createNuxtApp, applyPlugins, normalizePlugins } from '#app'
|
||||||
import '#build/css'
|
import '#build/css'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import _plugins from '#build/plugins'
|
import _plugins from '#build/plugins'
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/* eslint-disable no-use-before-define */
|
/* eslint-disable no-use-before-define */
|
||||||
import { getCurrentInstance, reactive, Ref } from 'vue'
|
import { getCurrentInstance, reactive } from 'vue'
|
||||||
import type { App, onErrorCaptured, VNode } from 'vue'
|
import type { App, onErrorCaptured, VNode, Ref } from 'vue'
|
||||||
import { createHooks, Hookable } from 'hookable'
|
import type { Hookable } from 'hookable'
|
||||||
|
import { createHooks } from 'hookable'
|
||||||
import type { RuntimeConfig, AppConfigInput } from '@nuxt/schema'
|
import type { RuntimeConfig, AppConfigInput } from '@nuxt/schema'
|
||||||
import { getContext } from 'unctx'
|
import { getContext } from 'unctx'
|
||||||
import type { SSRContext } from 'vue-bundle-renderer/runtime'
|
import type { SSRContext } from 'vue-bundle-renderer/runtime'
|
||||||
|
2
packages/nuxt/src/app/types/augments.d.ts
vendored
2
packages/nuxt/src/app/types/augments.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { NuxtApp } from '../nuxt'
|
import type { NuxtApp } from '../nuxt'
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace NodeJS {
|
namespace NodeJS {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
import { parseQuery, parseURL } from 'ufo'
|
import { parseQuery, parseURL } from 'ufo'
|
||||||
import { Component, ComponentsOptions } from '@nuxt/schema'
|
import type { Component, ComponentsOptions } from '@nuxt/schema'
|
||||||
import { genDynamicImport, genImport } from 'knitwork'
|
import { genDynamicImport, genImport } from 'knitwork'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
import { pascalCase } from 'scule'
|
import { pascalCase } from 'scule'
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
import { parseURL } from 'ufo'
|
import { parseURL } from 'ufo'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
import { parse, walk, ELEMENT_NODE, Node } from 'ultrahtml'
|
import type { Node } from 'ultrahtml'
|
||||||
|
import { parse, walk, ELEMENT_NODE } from 'ultrahtml'
|
||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
import type { Component } from '@nuxt/schema'
|
import type { Component } from '@nuxt/schema'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { existsSync, promises as fsp } from 'node:fs'
|
import { existsSync, promises as fsp } from 'node:fs'
|
||||||
import { resolve, join } from 'pathe'
|
import { resolve, join } from 'pathe'
|
||||||
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender, Nitro } from 'nitropack'
|
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
|
||||||
import type { NitroConfig } from 'nitropack'
|
import type { NitroConfig, Nitro } from 'nitropack'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
import { resolvePath } from '@nuxt/kit'
|
import { resolvePath } from '@nuxt/kit'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { join, normalize, resolve } from 'pathe'
|
import { join, normalize, resolve } from 'pathe'
|
||||||
import { createHooks, createDebugger } from 'hookable'
|
import { createHooks, createDebugger } from 'hookable'
|
||||||
import type { Nuxt, NuxtOptions, NuxtHooks } from '@nuxt/schema'
|
import type { Nuxt, NuxtOptions, NuxtHooks } from '@nuxt/schema'
|
||||||
import { loadNuxtConfig, LoadNuxtOptions, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
|
import type { LoadNuxtOptions } from '@nuxt/kit'
|
||||||
|
import { loadNuxtConfig, nuxtCtx, installModule, addComponent, addVitePlugin, addWebpackPlugin, tryResolveModule, addPlugin } from '@nuxt/kit'
|
||||||
/* eslint-disable import/no-restricted-paths */
|
/* eslint-disable import/no-restricted-paths */
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Nuxt, NuxtApp } from '@nuxt/schema'
|
import type { Nuxt, NuxtApp } from '@nuxt/schema'
|
||||||
import { normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
import { createTransformer } from 'unctx/transform'
|
import { createTransformer } from 'unctx/transform'
|
||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { joinURL, withQuery } from 'ufo'
|
import { joinURL, withQuery } from 'ufo'
|
||||||
import type { NitroErrorHandler } from 'nitropack'
|
import type { NitroErrorHandler } from 'nitropack'
|
||||||
import { H3Error, setResponseHeader, getRequestHeaders } from 'h3'
|
import type { H3Error } from 'h3'
|
||||||
|
import { setResponseHeader, getRequestHeaders } from 'h3'
|
||||||
import { useNitroApp, useRuntimeConfig } from '#internal/nitro'
|
import { useNitroApp, useRuntimeConfig } from '#internal/nitro'
|
||||||
import { normalizeError, isJsonRequest } from '#internal/nitro/utils'
|
import { normalizeError, isJsonRequest } from '#internal/nitro/utils'
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { createRenderer, renderResourceHeaders } from 'vue-bundle-renderer/runtime'
|
import { createRenderer, renderResourceHeaders } from 'vue-bundle-renderer/runtime'
|
||||||
import type { RenderResponse } from 'nitropack'
|
import type { RenderResponse } from 'nitropack'
|
||||||
import type { Manifest } from 'vite'
|
import type { Manifest } from 'vite'
|
||||||
import { appendHeader, getQuery, H3Event, writeEarlyHints, readBody, createError } from 'h3'
|
import type { H3Event } from 'h3'
|
||||||
|
import { appendHeader, getQuery, writeEarlyHints, readBody, createError } from 'h3'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, useNuxt, addPluginTemplate, updateTemplates } from '@nuxt/kit'
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, useNuxt, addPluginTemplate, updateTemplates } from '@nuxt/kit'
|
||||||
import { isAbsolute, join, relative, resolve, normalize } from 'pathe'
|
import { isAbsolute, join, relative, resolve, normalize } from 'pathe'
|
||||||
import { createUnimport, Import, scanDirExports, toImports, Unimport } from 'unimport'
|
import type { Import, Unimport } from 'unimport'
|
||||||
import { ImportsOptions, ImportPresetWithDeprecation } from '@nuxt/schema'
|
import { createUnimport, scanDirExports, toImports } from 'unimport'
|
||||||
|
import type { ImportsOptions, ImportPresetWithDeprecation } from '@nuxt/schema'
|
||||||
import { TransformPlugin } from './transform'
|
import { TransformPlugin } from './transform'
|
||||||
import { defaultPresets } from './presets'
|
import { defaultPresets } from './presets'
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineUnimportPreset, InlinePreset } from 'unimport'
|
import type { InlinePreset } from 'unimport'
|
||||||
|
import { defineUnimportPreset } from 'unimport'
|
||||||
|
|
||||||
const commonPresets: InlinePreset[] = [
|
const commonPresets: InlinePreset[] = [
|
||||||
// #head
|
// #head
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
import { parseQuery, parseURL } from 'ufo'
|
import { parseQuery, parseURL } from 'ufo'
|
||||||
import { Unimport } from 'unimport'
|
import type { Unimport } from 'unimport'
|
||||||
import { ImportsOptions } from '@nuxt/schema'
|
import type { ImportsOptions } from '@nuxt/schema'
|
||||||
import { normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
|
|
||||||
export const TransformPlugin = createUnplugin(({ ctx, options, sourcemap }: { ctx: Unimport, options: Partial<ImportsOptions>, sourcemap?: boolean }) => {
|
export const TransformPlugin = createUnplugin(({ ctx, options, sourcemap }: { ctx: Unimport, options: Partial<ImportsOptions>, sourcemap?: boolean }) => {
|
||||||
|
@ -7,7 +7,8 @@ import type { NuxtApp, NuxtPage } from '@nuxt/schema'
|
|||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { resolvePagesRoutes, normalizeRoutes } from './utils'
|
import { resolvePagesRoutes, normalizeRoutes } from './utils'
|
||||||
import { PageMetaPlugin, PageMetaPluginOptions } from './page-meta'
|
import type { PageMetaPluginOptions } from './page-meta'
|
||||||
|
import { PageMetaPlugin } from './page-meta'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
import { parseQuery, parseURL, stringifyQuery } from 'ufo'
|
import { parseQuery, parseURL, stringifyQuery } from 'ufo'
|
||||||
import { findStaticImports, findExports, StaticImport, parseStaticImport } from 'mlly'
|
import type { StaticImport } from 'mlly'
|
||||||
|
import { findStaticImports, findExports, parseStaticImport } from 'mlly'
|
||||||
import type { CallExpression, Identifier, Expression } from 'estree'
|
import type { CallExpression, Identifier, Expression } from 'estree'
|
||||||
import { walk } from 'estree-walker'
|
import { walk } from 'estree-walker'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { KeepAliveProps, TransitionProps, UnwrapRef } from 'vue'
|
import type { KeepAliveProps, TransitionProps, UnwrapRef } from 'vue'
|
||||||
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteRecordRedirectOption } from 'vue-router'
|
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteRecordRedirectOption } from 'vue-router'
|
||||||
import type { NuxtError } from '#app'
|
import type { NuxtError } from '#app'
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition, KeepAliveProps, TransitionProps } from 'vue'
|
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition } from 'vue'
|
||||||
import type { DefineComponent, VNode } from 'vue'
|
import type { DefineComponent, VNode, KeepAliveProps, TransitionProps } 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 { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteLocation } from 'vue-router'
|
||||||
|
|
||||||
import { generateRouteKey, RouterViewSlotProps, wrapInKeepAlive } from './utils'
|
import type { RouterViewSlotProps } from './utils'
|
||||||
|
import { generateRouteKey, wrapInKeepAlive } from './utils'
|
||||||
import { useNuxtApp } from '#app'
|
import { useNuxtApp } from '#app'
|
||||||
import { _wrapIf } from '#app/components/utils'
|
import { _wrapIf } from '#app/components/utils'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
import { computed, reactive, shallowRef } from 'vue'
|
import { computed, reactive, shallowRef } from 'vue'
|
||||||
|
import type {
|
||||||
|
NavigationGuard,
|
||||||
|
RouteLocation
|
||||||
|
} from 'vue-router'
|
||||||
import {
|
import {
|
||||||
createRouter,
|
createRouter,
|
||||||
createWebHistory,
|
createWebHistory,
|
||||||
createMemoryHistory,
|
createMemoryHistory,
|
||||||
createWebHashHistory,
|
createWebHashHistory
|
||||||
NavigationGuard,
|
|
||||||
RouteLocation
|
|
||||||
} from 'vue-router'
|
} from 'vue-router'
|
||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
import { withoutBase, isEqual } from 'ufo'
|
import { withoutBase, isEqual } from 'ufo'
|
||||||
import NuxtPage from './page'
|
import type NuxtPage from './page'
|
||||||
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig, showError, clearError, navigateTo, useError, useState } from '#app'
|
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig, showError, clearError, navigateTo, useError, useState } from '#app'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import _routes from '#build/routes'
|
import _routes from '#build/routes'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { extname, normalize, relative, resolve } from 'pathe'
|
import { extname, normalize, relative, resolve } from 'pathe'
|
||||||
import { encodePath } from 'ufo'
|
import { encodePath } from 'ufo'
|
||||||
import { NuxtPage } from '@nuxt/schema'
|
import type { NuxtPage } from '@nuxt/schema'
|
||||||
import { resolveFiles, useNuxt } from '@nuxt/kit'
|
import { resolveFiles, useNuxt } from '@nuxt/kit'
|
||||||
import { genImport, genDynamicImport, genArrayFromRaw, genSafeVariableName } from 'knitwork'
|
import { genImport, genDynamicImport, genArrayFromRaw, genSafeVariableName } from 'knitwork'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
|
@ -3,8 +3,9 @@ import { expect, describe, 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'
|
||||||
import { createUnimport, Import } from 'unimport'
|
import type { Import } from 'unimport'
|
||||||
import { Plugin } from 'vite'
|
import { createUnimport } from 'unimport'
|
||||||
|
import type { Plugin } from 'vite'
|
||||||
import { TransformPlugin } from '../src/imports/transform'
|
import { TransformPlugin } from '../src/imports/transform'
|
||||||
import { defaultPresets } from '../src/imports/presets'
|
import { defaultPresets } from '../src/imports/presets'
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { expect, describe, it, vi } from 'vitest'
|
import { expect, describe, it, vi } from 'vitest'
|
||||||
import { RouteLocationRaw } from 'vue-router'
|
import type { RouteLocationRaw } from 'vue-router'
|
||||||
import { NuxtLinkOptions, NuxtLinkProps, defineNuxtLink } from '../src/app/components/nuxt-link'
|
import type { NuxtLinkOptions, NuxtLinkProps } from '../src/app/components/nuxt-link'
|
||||||
|
import { defineNuxtLink } from '../src/app/components/nuxt-link'
|
||||||
|
|
||||||
// Mocks `h()`
|
// Mocks `h()`
|
||||||
vi.mock('vue', async () => {
|
vi.mock('vue', async () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { resolve } from 'node:path'
|
import { resolve } from 'node:path'
|
||||||
import { ComponentsDir } from '@nuxt/schema'
|
import type { ComponentsDir } from '@nuxt/schema'
|
||||||
import { expect, it, vi } from 'vitest'
|
import { expect, it, vi } from 'vitest'
|
||||||
import { scanComponents } from '../src/components/scan'
|
import { scanComponents } from '../src/components/scan'
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { join, resolve } from 'pathe'
|
|||||||
import { isDebug, isDevelopment } from 'std-env'
|
import { isDebug, isDevelopment } from 'std-env'
|
||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import { findWorkspaceDir } from 'pkg-types'
|
import { findWorkspaceDir } from 'pkg-types'
|
||||||
import { RuntimeConfig } from '../types/config'
|
import type { RuntimeConfig } from '../types/config'
|
||||||
|
|
||||||
export default defineUntypedSchema({
|
export default defineUntypedSchema({
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { KeepAliveProps, TransitionProps } from 'vue'
|
import type { KeepAliveProps, TransitionProps } from 'vue'
|
||||||
import { ConfigSchema } from '../../schema/config'
|
import type { ConfigSchema } from '../../schema/config'
|
||||||
import type { ServerOptions as ViteServerOptions, UserConfig as ViteUserConfig } from 'vite'
|
import type { ServerOptions as ViteServerOptions, UserConfig as ViteUserConfig } from 'vite'
|
||||||
import type { Options as VuePluginOptions } from '@vitejs/plugin-vue'
|
import type { Options as VuePluginOptions } from '@vitejs/plugin-vue'
|
||||||
import type { AppHeadMetaObject } from './meta'
|
import type { AppHeadMetaObject } from './meta'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ViteImportMeta } from './vite'
|
import type { ViteImportMeta } from './vite'
|
||||||
import { WebpackImportMeta } from './webpack'
|
import type { WebpackImportMeta } from './webpack'
|
||||||
|
|
||||||
export type BundlerImportMeta = ViteImportMeta & WebpackImportMeta
|
export type BundlerImportMeta = ViteImportMeta & WebpackImportMeta
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import type { Compiler, Configuration, Stats } from 'webpack'
|
|||||||
import type { Nuxt, NuxtApp, ResolvedNuxtTemplate } from './nuxt'
|
import type { Nuxt, NuxtApp, ResolvedNuxtTemplate } from './nuxt'
|
||||||
import type { Nitro, NitroConfig } from 'nitropack'
|
import type { Nitro, NitroConfig } from 'nitropack'
|
||||||
import type { Component, ComponentsOptions } from './components'
|
import type { Component, ComponentsOptions } from './components'
|
||||||
import { NuxtCompatibility, NuxtCompatibilityIssues } from '..'
|
import type { NuxtCompatibility, NuxtCompatibilityIssues } from '..'
|
||||||
|
|
||||||
export type HookResult = Promise<void> | void
|
export type HookResult = Promise<void> | void
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { UnimportOptions } from 'unimport'
|
import type { UnimportOptions } from 'unimport'
|
||||||
|
|
||||||
export interface ImportsOptions extends UnimportOptions {
|
export interface ImportsOptions extends UnimportOptions {
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NuxtHooks } from './hooks'
|
import type { NuxtHooks } from './hooks'
|
||||||
import type { Nuxt } from "./nuxt"
|
import type { Nuxt } from "./nuxt"
|
||||||
import type { NuxtCompatibility } from './compatibility'
|
import type { NuxtCompatibility } from './compatibility'
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { resolve } from 'node:path'
|
import { resolve } from 'node:path'
|
||||||
import { execa } from 'execa'
|
import { execa } from 'execa'
|
||||||
import { getRandomPort, waitForPort } from 'get-port-please'
|
import { getRandomPort, waitForPort } from 'get-port-please'
|
||||||
import { fetch as _fetch, $fetch as _$fetch, FetchOptions } from 'ofetch'
|
import type { FetchOptions } from 'ofetch'
|
||||||
|
import { fetch as _fetch, $fetch as _$fetch } from 'ofetch'
|
||||||
import * as _kit from '@nuxt/kit'
|
import * as _kit from '@nuxt/kit'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ import { pathToFileURL } from 'node:url'
|
|||||||
import { existsSync } from 'node:fs'
|
import { existsSync } from 'node:fs'
|
||||||
import { builtinModules } from 'node:module'
|
import { builtinModules } from 'node:module'
|
||||||
import { isAbsolute, normalize, resolve } from 'pathe'
|
import { isAbsolute, normalize, resolve } from 'pathe'
|
||||||
import * as vite from 'vite'
|
import type * as vite from 'vite'
|
||||||
import { isExternal } from 'externality'
|
import type { isExternal } from 'externality'
|
||||||
import { genDynamicImport, genObjectFromRawEntries } from 'knitwork'
|
import { genDynamicImport, genObjectFromRawEntries } from 'knitwork'
|
||||||
import fse from 'fs-extra'
|
import fse from 'fs-extra'
|
||||||
import { debounce } from 'perfect-debounce'
|
import { debounce } from 'perfect-debounce'
|
||||||
@ -11,7 +11,7 @@ import { isIgnored, logger } from '@nuxt/kit'
|
|||||||
import { hashId, isCSS, uniq } from './utils'
|
import { hashId, isCSS, uniq } from './utils'
|
||||||
import { createIsExternal } from './utils/external'
|
import { createIsExternal } from './utils/external'
|
||||||
import { writeManifest } from './manifest'
|
import { writeManifest } from './manifest'
|
||||||
import { ViteBuildContext } from './vite'
|
import type { ViteBuildContext } from './vite'
|
||||||
|
|
||||||
export interface TransformChunk {
|
export interface TransformChunk {
|
||||||
id: string,
|
id: string,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Plugin } from 'vite'
|
import type { Plugin } from 'vite'
|
||||||
import { transform } from 'esbuild'
|
import { transform } from 'esbuild'
|
||||||
import { visualizer } from 'rollup-plugin-visualizer'
|
import { visualizer } from 'rollup-plugin-visualizer'
|
||||||
import { ViteBuildContext } from '../vite'
|
import type { ViteBuildContext } from '../vite'
|
||||||
|
|
||||||
export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
||||||
return [
|
return [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
import { Plugin } from 'vite'
|
import type { Plugin } from 'vite'
|
||||||
import { isCSS } from '../utils'
|
import { isCSS } from '../utils'
|
||||||
|
|
||||||
export interface DevStyleSSRPluginOptions {
|
export interface DevStyleSSRPluginOptions {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
import { Plugin } from 'vite'
|
import type { Plugin } from 'vite'
|
||||||
import { findStaticImports } from 'mlly'
|
import { findStaticImports } from 'mlly'
|
||||||
import { dirname, relative } from 'pathe'
|
import { dirname, relative } from 'pathe'
|
||||||
import { genObjectFromRawEntries } from 'knitwork'
|
import { genObjectFromRawEntries } from 'knitwork'
|
||||||
|
@ -4,7 +4,7 @@ import vuePlugin from '@vitejs/plugin-vue'
|
|||||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
||||||
import { logger, resolveModule } from '@nuxt/kit'
|
import { logger, resolveModule } from '@nuxt/kit'
|
||||||
import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo'
|
import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo'
|
||||||
import { ViteBuildContext, ViteOptions } from './vite'
|
import type { ViteBuildContext, ViteOptions } from './vite'
|
||||||
import { cacheDirPlugin } from './plugins/cache-dir'
|
import { cacheDirPlugin } from './plugins/cache-dir'
|
||||||
import { initViteNodeServer } from './vite-node'
|
import { initViteNodeServer } from './vite-node'
|
||||||
import { ssrStylesPlugin } from './plugins/ssr-styles'
|
import { ssrStylesPlugin } from './plugins/ssr-styles'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ExternalsOptions, ExternalsDefaults, isExternal } from 'externality'
|
import type { ExternalsOptions } from 'externality'
|
||||||
import { ViteDevServer } from 'vite'
|
import { ExternalsDefaults, isExternal } from 'externality'
|
||||||
|
import type { ViteDevServer } from 'vite'
|
||||||
|
|
||||||
export function createIsExternal (viteServer: ViteDevServer, rootDir: string) {
|
export function createIsExternal (viteServer: ViteDevServer, rootDir: string) {
|
||||||
const externalOpts: ExternalsOptions = {
|
const externalOpts: ExternalsOptions = {
|
||||||
|
@ -4,7 +4,8 @@ import webpack from 'webpack'
|
|||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
||||||
|
|
||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
import { applyPresets, WebpackConfigContext } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
import { applyPresets } from '../utils/config'
|
||||||
import { nuxt } from '../presets/nuxt'
|
import { nuxt } from '../presets/nuxt'
|
||||||
|
|
||||||
export function client (ctx: WebpackConfigContext) {
|
export function client (ctx: WebpackConfigContext) {
|
||||||
|
@ -2,7 +2,8 @@ import { isAbsolute } from 'pathe'
|
|||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import ForkTSCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
|
import ForkTSCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
|
||||||
import { logger } from '@nuxt/kit'
|
import { logger } from '@nuxt/kit'
|
||||||
import { WebpackConfigContext, applyPresets, getWebpackConfig } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
import { applyPresets, getWebpackConfig } from '../utils/config'
|
||||||
import { nuxt } from '../presets/nuxt'
|
import { nuxt } from '../presets/nuxt'
|
||||||
import { node } from '../presets/node'
|
import { node } from '../presets/node'
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import webpack, { Compilation, Compiler } from 'webpack'
|
import type { Compilation, Compiler } from 'webpack'
|
||||||
|
import webpack from 'webpack'
|
||||||
import { validate, isJS, extractQueryPartJS } from './util'
|
import { validate, isJS, extractQueryPartJS } from './util'
|
||||||
|
|
||||||
export interface VueSSRServerPluginOptions {
|
export interface VueSSRServerPluginOptions {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { fileName, WebpackConfigContext } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
import { fileName } from '../utils/config'
|
||||||
|
|
||||||
export function assets (ctx: WebpackConfigContext) {
|
export function assets (ctx: WebpackConfigContext) {
|
||||||
ctx.config.module!.rules!.push(
|
ctx.config.module!.rules!.push(
|
||||||
|
@ -8,8 +8,10 @@ import { logger } from '@nuxt/kit'
|
|||||||
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin'
|
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin'
|
||||||
import escapeRegExp from 'escape-string-regexp'
|
import escapeRegExp from 'escape-string-regexp'
|
||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
import WarningIgnorePlugin, { WarningFilter } from '../plugins/warning-ignore'
|
import type { WarningFilter } from '../plugins/warning-ignore'
|
||||||
import { WebpackConfigContext, applyPresets, fileName } from '../utils/config'
|
import WarningIgnorePlugin from '../plugins/warning-ignore'
|
||||||
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
import { applyPresets, fileName } from '../utils/config'
|
||||||
|
|
||||||
export function base (ctx: WebpackConfigContext) {
|
export function base (ctx: WebpackConfigContext) {
|
||||||
applyPresets(ctx, [
|
applyPresets(ctx, [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import esbuildLoader from 'esbuild-loader'
|
import esbuildLoader from 'esbuild-loader'
|
||||||
import { WebpackConfigContext } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
|
||||||
export function esbuild (ctx: WebpackConfigContext) {
|
export function esbuild (ctx: WebpackConfigContext) {
|
||||||
const { config } = ctx
|
const { config } = ctx
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { WebpackConfigContext, applyPresets } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
import { applyPresets } from '../utils/config'
|
||||||
|
|
||||||
import { assets } from './assets'
|
import { assets } from './assets'
|
||||||
import { base } from './base'
|
import { base } from './base'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { WebpackConfigContext } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
|
||||||
export function pug (ctx: WebpackConfigContext) {
|
export function pug (ctx: WebpackConfigContext) {
|
||||||
ctx.config.module!.rules!.push({
|
ctx.config.module!.rules!.push({
|
||||||
|
@ -1,6 +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 { fileName, WebpackConfigContext, applyPresets } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
import { fileName, applyPresets } from '../utils/config'
|
||||||
import { getPostcssConfig } from '../utils/postcss'
|
import { getPostcssConfig } from '../utils/postcss'
|
||||||
|
|
||||||
export function style (ctx: WebpackConfigContext) {
|
export function style (ctx: WebpackConfigContext) {
|
||||||
|
@ -3,7 +3,7 @@ import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js'
|
|||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import VueSSRClientPlugin from '../plugins/vue/client'
|
import VueSSRClientPlugin from '../plugins/vue/client'
|
||||||
import VueSSRServerPlugin from '../plugins/vue/server'
|
import VueSSRServerPlugin from '../plugins/vue/server'
|
||||||
import { WebpackConfigContext } from '../utils/config'
|
import type { WebpackConfigContext } from '../utils/config'
|
||||||
|
|
||||||
export function vue (ctx: WebpackConfigContext) {
|
export function vue (ctx: WebpackConfigContext) {
|
||||||
const { options, config } = ctx
|
const { options, config } = ctx
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import pify from 'pify'
|
import pify from 'pify'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import { fromNodeMiddleware, defineEventHandler, NodeMiddleware } from 'h3'
|
import type { NodeMiddleware } from 'h3'
|
||||||
import webpackDevMiddleware, { OutputFileSystem } from 'webpack-dev-middleware'
|
import { fromNodeMiddleware, defineEventHandler } from 'h3'
|
||||||
|
import type { OutputFileSystem } from 'webpack-dev-middleware'
|
||||||
|
import webpackDevMiddleware from 'webpack-dev-middleware'
|
||||||
import webpackHotMiddleware from 'webpack-hot-middleware'
|
import webpackHotMiddleware from 'webpack-hot-middleware'
|
||||||
import type { Compiler, Watching } from 'webpack'
|
import type { Compiler, Watching } from 'webpack'
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
type Comp = Ref<{ add: () => void }>
|
type Comp = Ref<{ add: () => void }>
|
||||||
|
|
||||||
const stringStatefulComp = ref(null) as any as Comp
|
const stringStatefulComp = ref(null) as any as Comp
|
||||||
|
2
test/fixtures/basic/types.ts
vendored
2
test/fixtures/basic/types.ts
vendored
@ -4,7 +4,7 @@ import type { Ref } from 'vue'
|
|||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
import type { FetchError } from 'ofetch'
|
import type { FetchError } from 'ofetch'
|
||||||
import { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
|
import type { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
|
||||||
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
|
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
|
||||||
// eslint-disable-next-line import/order
|
// eslint-disable-next-line import/order
|
||||||
import { isVue3 } from '#app'
|
import { isVue3 } from '#app'
|
||||||
|
Loading…
Reference in New Issue
Block a user