mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-20 15:41:11 +00:00
Compare commits
9 Commits
9126e5efae
...
dc32a45959
Author | SHA1 | Date | |
---|---|---|---|
|
dc32a45959 | ||
|
653d7862e3 | ||
|
4881259d41 | ||
|
4fdaffb9ef | ||
|
ab1f21b481 | ||
|
38bfe2a6bc | ||
|
06add6e7fb | ||
|
6aa5d12652 | ||
|
05403910ac |
@ -40,7 +40,11 @@ It hooks into [`page:loading:start`](/docs/api/advanced/hooks#app-hooks-runtime)
|
||||
|
||||
### `start()`
|
||||
|
||||
Set `isLoading` to true and start to increase the `progress` value.
|
||||
Set `isLoading` to true and start to increase the `progress` value. `start` accepts a `{ force: true }` option to skip the interval and show the loading state immediately.
|
||||
|
||||
### `set()`
|
||||
|
||||
Set the `progress` value to a specific value. `set` accepts a `{ force: true }` option to skip the interval and show the loading state immediately.
|
||||
|
||||
### `finish()`
|
||||
|
||||
@ -62,3 +66,12 @@ Used by `finish()`. Clear all timers and intervals used by the composable.
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
const { start, set } = useLoadingIndicator()
|
||||
// same as set(0, { force: true })
|
||||
// set the progress to 0, and show loading immediately
|
||||
start({ force: true })
|
||||
</script>
|
||||
```
|
||||
|
@ -134,7 +134,7 @@
|
||||
"vitest-environment-nuxt": "1.0.1",
|
||||
"vue": "3.5.13",
|
||||
"vue-tsc": "2.2.0",
|
||||
"webpack": "5.97.1"
|
||||
"webpack": "5.98.0"
|
||||
},
|
||||
"packageManager": "pnpm@10.3.0",
|
||||
"version": ""
|
||||
|
@ -56,7 +56,7 @@
|
||||
"unbuild": "3.3.1",
|
||||
"vite": "6.1.0",
|
||||
"vitest": "3.0.5",
|
||||
"webpack": "5.97.1"
|
||||
"webpack": "5.98.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.12.0"
|
||||
|
@ -32,5 +32,5 @@ export { addTemplate, addServerTemplate, addTypeTemplate, normalizeTemplate, upd
|
||||
export { logger, useLogger } from './logger'
|
||||
|
||||
// Internal Utils
|
||||
export { resolveModule, tryResolveModule, importModule, tryImportModule, requireModule, tryRequireModule } from './internal/esm'
|
||||
export { directoryToURL, resolveModule, tryResolveModule, importModule, tryImportModule, requireModule, tryRequireModule } from './internal/esm'
|
||||
export type { ImportModuleOptions, ResolveModuleOptions } from './internal/esm'
|
||||
|
@ -4,7 +4,13 @@ import { createJiti } from 'jiti'
|
||||
import { captureStackTrace } from 'errx'
|
||||
|
||||
export interface ResolveModuleOptions {
|
||||
/** @deprecated use `url` with URLs pointing at a file - never a directory */
|
||||
paths?: string | string[]
|
||||
url?: URL | URL[]
|
||||
}
|
||||
|
||||
export function directoryToURL (dir: string): URL {
|
||||
return pathToFileURL(dir + '/')
|
||||
}
|
||||
|
||||
/**
|
||||
@ -13,7 +19,10 @@ export interface ResolveModuleOptions {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export async function tryResolveModule (id: string, url: string | string[] = import.meta.url) {
|
||||
export async function tryResolveModule (id: string, url: URL | URL[]): Promise<string | undefined>
|
||||
/** @deprecated pass URLs pointing at files */
|
||||
export async function tryResolveModule (id: string, url: string | string[]): Promise<string | undefined>
|
||||
export async function tryResolveModule (id: string, url: string | string[] | URL | URL[] = import.meta.url) {
|
||||
try {
|
||||
return await resolvePath(id, { url })
|
||||
} catch {
|
||||
@ -22,7 +31,7 @@ export async function tryResolveModule (id: string, url: string | string[] = imp
|
||||
}
|
||||
|
||||
export function resolveModule (id: string, options?: ResolveModuleOptions) {
|
||||
return resolvePathSync(id, { url: options?.paths ?? [import.meta.url] })
|
||||
return resolvePathSync(id, { url: options?.url ?? options?.paths ?? [import.meta.url] })
|
||||
}
|
||||
|
||||
export interface ImportModuleOptions extends ResolveModuleOptions {
|
||||
@ -31,8 +40,8 @@ export interface ImportModuleOptions extends ResolveModuleOptions {
|
||||
}
|
||||
|
||||
export async function importModule<T = unknown> (id: string, opts?: ImportModuleOptions) {
|
||||
const resolvedPath = await resolveModule(id, opts)
|
||||
return import(pathToFileURL(resolvedPath).href).then(r => opts?.interopDefault !== false ? interopDefault(r) : r) as Promise<T>
|
||||
const resolvedPath = resolveModule(id, opts)
|
||||
return await import(pathToFileURL(resolvedPath).href).then(r => opts?.interopDefault !== false ? interopDefault(r) : r) as Promise<T>
|
||||
}
|
||||
|
||||
export function tryImportModule<T = unknown> (id: string, opts?: ImportModuleOptions) {
|
||||
|
@ -9,7 +9,7 @@ import { globby } from 'globby'
|
||||
import defu from 'defu'
|
||||
import { basename, join, relative } from 'pathe'
|
||||
import { isWindows } from 'std-env'
|
||||
import { tryResolveModule } from '../internal/esm'
|
||||
import { directoryToURL, tryResolveModule } from '../internal/esm'
|
||||
|
||||
export interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, 'overrides'> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
@ -108,11 +108,12 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
|
||||
}
|
||||
|
||||
async function loadNuxtSchema (cwd: string) {
|
||||
const paths = [cwd]
|
||||
const nuxtPath = await tryResolveModule('nuxt', cwd) ?? await tryResolveModule('nuxt-nightly', cwd)
|
||||
const url = directoryToURL(cwd)
|
||||
const urls = [url]
|
||||
const nuxtPath = await tryResolveModule('nuxt', url) ?? await tryResolveModule('nuxt-nightly', url)
|
||||
if (nuxtPath) {
|
||||
paths.unshift(nuxtPath)
|
||||
urls.unshift(pathToFileURL(nuxtPath))
|
||||
}
|
||||
const schemaPath = await tryResolveModule('@nuxt/schema', paths) ?? '@nuxt/schema'
|
||||
const schemaPath = await tryResolveModule('@nuxt/schema', urls) ?? '@nuxt/schema'
|
||||
return await import(isWindows ? pathToFileURL(schemaPath).href : schemaPath).then(r => r.NuxtConfigSchema)
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { readPackageJSON, resolvePackageJSON } from 'pkg-types'
|
||||
import type { Nuxt, NuxtConfig } from '@nuxt/schema'
|
||||
import { resolve } from 'pathe'
|
||||
import { withTrailingSlash } from 'ufo'
|
||||
import { importModule, tryImportModule } from '../internal/esm'
|
||||
import { directoryToURL, importModule, tryImportModule } from '../internal/esm'
|
||||
import { runWithNuxtContext } from '../context'
|
||||
import type { LoadNuxtConfigOptions } from './config'
|
||||
|
||||
@ -23,24 +21,24 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
|
||||
// Apply dev as config override
|
||||
opts.overrides.dev = !!opts.dev
|
||||
|
||||
const rootDir = withTrailingSlash(pathToFileURL(opts.cwd!).href)
|
||||
const rootURL = directoryToURL(opts.cwd!)
|
||||
|
||||
const nearestNuxtPkg = await Promise.all(['nuxt-nightly', 'nuxt']
|
||||
.map(pkg => resolvePackageJSON(pkg, { url: rootDir }).catch(() => null)))
|
||||
.map(pkg => resolvePackageJSON(pkg, { url: rootURL }).catch(() => null)))
|
||||
.then(r => (r.filter(Boolean) as string[]).sort((a, b) => b.length - a.length)[0])
|
||||
if (!nearestNuxtPkg) {
|
||||
throw new Error(`Cannot find any nuxt version from ${opts.cwd}`)
|
||||
}
|
||||
const pkg = await readPackageJSON(nearestNuxtPkg)
|
||||
|
||||
const { loadNuxt } = await importModule<typeof import('nuxt')>((pkg as any)._name || pkg.name, { paths: rootDir })
|
||||
const { loadNuxt } = await importModule<typeof import('nuxt')>((pkg as any)._name || pkg.name, { url: rootURL })
|
||||
const nuxt = await loadNuxt(opts)
|
||||
return nuxt
|
||||
}
|
||||
|
||||
export async function buildNuxt (nuxt: Nuxt): Promise<any> {
|
||||
const rootDir = withTrailingSlash(pathToFileURL(nuxt.options.rootDir).href)
|
||||
const rootURL = directoryToURL(nuxt.options.rootDir)
|
||||
|
||||
const { build } = await tryImportModule<typeof import('nuxt')>('nuxt-nightly', { paths: rootDir }) || await importModule<typeof import('nuxt')>('nuxt', { paths: rootDir })
|
||||
const { build } = await tryImportModule<typeof import('nuxt')>('nuxt-nightly', { url: rootURL }) || await importModule<typeof import('nuxt')>('nuxt', { url: rootURL })
|
||||
return runWithNuxtContext(nuxt, () => build(nuxt))
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import { defu } from 'defu'
|
||||
import { createJiti } from 'jiti'
|
||||
import { parseNodeModulePath, resolve as resolveModule } from 'mlly'
|
||||
import { isRelative } from 'ufo'
|
||||
import { directoryToURL } from '../internal/esm'
|
||||
import { useNuxt } from '../context'
|
||||
import { resolveAlias, resolvePath } from '../resolve'
|
||||
import { logger } from '../logger'
|
||||
@ -101,7 +102,10 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
|
||||
try {
|
||||
const src = isAbsolute(path)
|
||||
? pathToFileURL(await resolvePath(path, { fallbackToOriginal: false, extensions: nuxt.options.extensions })).href
|
||||
: await resolveModule(path, { url: nuxt.options.modulesDir.map(m => pathToFileURL(m.replace(/\/node_modules\/?$/, ''))), extensions: nuxt.options.extensions })
|
||||
: await resolveModule(path, {
|
||||
url: nuxt.options.modulesDir.map(m => directoryToURL(m.replace(/\/node_modules\/?$/, '/'))),
|
||||
extensions: nuxt.options.extensions,
|
||||
})
|
||||
|
||||
nuxtModule = await jiti.import(src, { default: true }) as NuxtModule
|
||||
resolvedModulePath = fileURLToPath(new URL(src))
|
||||
|
@ -4,6 +4,7 @@ import { basename, dirname, isAbsolute, join, normalize, resolve } from 'pathe'
|
||||
import { globby } from 'globby'
|
||||
import { resolvePath as _resolvePath } from 'mlly'
|
||||
import { resolveAlias as _resolveAlias } from 'pathe/utils'
|
||||
import { directoryToURL } from './internal/esm'
|
||||
import { tryUseNuxt } from './context'
|
||||
import { isIgnored } from './ignore'
|
||||
import { toArray } from './utils'
|
||||
@ -201,7 +202,7 @@ async function _resolvePathGranularly (path: string, opts: ResolvePathOptions =
|
||||
}
|
||||
|
||||
// Try to resolve as module id
|
||||
const resolvedModulePath = await _resolvePath(_path, { url: [cwd, ...modulesDir] }).catch(() => null)
|
||||
const resolvedModulePath = await _resolvePath(_path, { url: [cwd, ...modulesDir].map(d => directoryToURL(d)) }).catch(() => null)
|
||||
if (resolvedModulePath) {
|
||||
return {
|
||||
path: resolvedModulePath,
|
||||
|
@ -9,7 +9,7 @@ import { gte } from 'semver'
|
||||
import { readPackageJSON } from 'pkg-types'
|
||||
|
||||
import { filterInPlace } from './utils'
|
||||
import { tryResolveModule } from './internal/esm'
|
||||
import { directoryToURL, tryResolveModule } from './internal/esm'
|
||||
import { getDirectory } from './module/install'
|
||||
import { tryUseNuxt, useNuxt } from './context'
|
||||
import { resolveNuxtModule } from './resolve'
|
||||
@ -244,6 +244,8 @@ export async function _generateTypes (nuxt: Nuxt) {
|
||||
tsConfig.compilerOptions.paths ||= {}
|
||||
tsConfig.include ||= []
|
||||
|
||||
const importPaths = nuxt.options.modulesDir.map(d => directoryToURL(d))
|
||||
|
||||
for (const alias in aliases) {
|
||||
if (excludedAlias.some(re => re.test(alias))) {
|
||||
continue
|
||||
@ -251,7 +253,7 @@ export async function _generateTypes (nuxt: Nuxt) {
|
||||
let absolutePath = resolve(basePath, aliases[alias]!)
|
||||
let stats = await fsp.stat(absolutePath).catch(() => null /* file does not exist */)
|
||||
if (!stats) {
|
||||
const resolvedModule = await tryResolveModule(aliases[alias]!, nuxt.options.modulesDir)
|
||||
const resolvedModule = await tryResolveModule(aliases[alias]!, importPaths)
|
||||
if (resolvedModule) {
|
||||
absolutePath = resolvedModule
|
||||
stats = await fsp.stat(resolvedModule).catch(() => null)
|
||||
|
@ -24,8 +24,8 @@ export type LoadingIndicator = {
|
||||
progress: Ref<number>
|
||||
isLoading: Ref<boolean>
|
||||
error: Ref<boolean>
|
||||
start: () => void
|
||||
set: (value: number) => void
|
||||
start: (opts?: { force?: boolean }) => void
|
||||
set: (value: number, opts?: { force?: boolean }) => void
|
||||
finish: (opts?: { force?: boolean, error?: boolean }) => void
|
||||
clear: () => void
|
||||
}
|
||||
@ -49,23 +49,24 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
|
||||
let hideTimeout: number | NodeJS.Timeout
|
||||
let resetTimeout: number | NodeJS.Timeout
|
||||
|
||||
const start = () => {
|
||||
const start = (opts: { force?: boolean } = {}) => {
|
||||
error.value = false
|
||||
set(0)
|
||||
set(0, opts)
|
||||
}
|
||||
|
||||
function set (at = 0) {
|
||||
function set (at = 0, opts: { force?: boolean } = {}) {
|
||||
if (nuxtApp.isHydrating) {
|
||||
return
|
||||
}
|
||||
if (at >= 100) { return finish() }
|
||||
if (at >= 100) { return finish({ force: opts.force }) }
|
||||
clear()
|
||||
progress.value = at < 0 ? 0 : at
|
||||
if (throttle && import.meta.client) {
|
||||
const throttleTime = opts.force ? 0 : throttle
|
||||
if (throttleTime && import.meta.client) {
|
||||
throttleTimeout = setTimeout(() => {
|
||||
isLoading.value = true
|
||||
_startProgress()
|
||||
}, throttle)
|
||||
}, throttleTime)
|
||||
} else {
|
||||
isLoading.value = true
|
||||
_startProgress()
|
||||
|
@ -517,7 +517,7 @@ export function tryUseNuxtApp (id?: string): NuxtApp | null {
|
||||
nuxtAppInstance = getCurrentInstance()?.appContext.app.$nuxt
|
||||
}
|
||||
|
||||
nuxtAppInstance = nuxtAppInstance || getNuxtAppCtx(id).tryUse()
|
||||
nuxtAppInstance ||= getNuxtAppCtx(id).tryUse()
|
||||
|
||||
return nuxtAppInstance || null
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function pageToClientOnly<T extends ComponentOptions> (component: T) {
|
||||
if (isPromise(setupState)) {
|
||||
return Promise.resolve(setupState).then((setupState: any) => {
|
||||
if (typeof setupState !== 'function') {
|
||||
setupState = setupState || {}
|
||||
setupState ||= {}
|
||||
setupState.mounted$ = mounted$
|
||||
return setupState
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { EventType } from '@parcel/watcher'
|
||||
import type { FSWatcher } from 'chokidar'
|
||||
import { watch as chokidarWatch } from 'chokidar'
|
||||
import { createIsIgnored, importModule, isIgnored, tryResolveModule, useNuxt } from '@nuxt/kit'
|
||||
import { createIsIgnored, directoryToURL, importModule, isIgnored, tryResolveModule, useNuxt } from '@nuxt/kit'
|
||||
import { debounce } from 'perfect-debounce'
|
||||
import { normalize, relative, resolve } from 'pathe'
|
||||
import type { Nuxt, NuxtBuilder } from 'nuxt/schema'
|
||||
@ -193,7 +193,7 @@ async function createParcelWatcher () {
|
||||
// eslint-disable-next-line no-console
|
||||
console.time('[nuxt] builder:parcel:watch')
|
||||
}
|
||||
const watcherPath = await tryResolveModule('@parcel/watcher', [nuxt.options.rootDir, ...nuxt.options.modulesDir])
|
||||
const watcherPath = await tryResolveModule('@parcel/watcher', [nuxt.options.rootDir, ...nuxt.options.modulesDir].map(d => directoryToURL(d)))
|
||||
if (!watcherPath) {
|
||||
logger.warn('Falling back to `chokidar-granular` as `@parcel/watcher` cannot be resolved in your project.')
|
||||
return false
|
||||
@ -244,7 +244,7 @@ async function bundle (nuxt: Nuxt) {
|
||||
}
|
||||
|
||||
async function loadBuilder (nuxt: Nuxt, builder: string): Promise<NuxtBuilder> {
|
||||
const builderPath = await tryResolveModule(builder, [nuxt.options.rootDir, import.meta.url])
|
||||
const builderPath = await tryResolveModule(builder, [directoryToURL(nuxt.options.rootDir), new URL(import.meta.url)])
|
||||
|
||||
if (!builderPath) {
|
||||
throw new Error(`Loading \`${builder}\` builder failed. You can read more about the nuxt \`builder\` option at: \`https://nuxt.com/docs/api/nuxt-config#builder\``)
|
||||
|
@ -6,7 +6,7 @@ import { join, normalize, relative, resolve } from 'pathe'
|
||||
import { createDebugger, createHooks } from 'hookable'
|
||||
import ignore from 'ignore'
|
||||
import type { LoadNuxtOptions } from '@nuxt/kit'
|
||||
import { addBuildPlugin, addComponent, addPlugin, addPluginTemplate, addRouteMiddleware, addServerPlugin, addTypeTemplate, addVitePlugin, addWebpackPlugin, installModule, loadNuxtConfig, nuxtCtx, resolveAlias, resolveFiles, resolveIgnorePatterns, resolvePath, runWithNuxtContext, tryResolveModule, useNitro } from '@nuxt/kit'
|
||||
import { addBuildPlugin, addComponent, addPlugin, addPluginTemplate, addRouteMiddleware, addServerPlugin, addTypeTemplate, addVitePlugin, addWebpackPlugin, directoryToURL, installModule, loadNuxtConfig, nuxtCtx, resolveAlias, resolveFiles, resolveIgnorePatterns, resolvePath, runWithNuxtContext, tryResolveModule, useNitro } from '@nuxt/kit'
|
||||
import type { Nuxt, NuxtHooks, NuxtModule, NuxtOptions } from 'nuxt/schema'
|
||||
import type { PackageJson } from 'pkg-types'
|
||||
import { readPackageJSON } from 'pkg-types'
|
||||
@ -391,12 +391,13 @@ async function initNuxt (nuxt: Nuxt) {
|
||||
}
|
||||
|
||||
nuxt.hook('modules:done', async () => {
|
||||
const importPaths = nuxt.options.modulesDir.map(dir => directoryToURL((dir)))
|
||||
// Add unctx transform
|
||||
addBuildPlugin(UnctxTransformPlugin({
|
||||
sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client,
|
||||
transformerOptions: {
|
||||
...nuxt.options.optimization.asyncTransforms,
|
||||
helperModule: await tryResolveModule('unctx', nuxt.options.modulesDir) ?? 'unctx',
|
||||
helperModule: await tryResolveModule('unctx', importPaths) ?? 'unctx',
|
||||
},
|
||||
}))
|
||||
|
||||
|
@ -68,7 +68,7 @@ export const ComposableKeysPlugin = (options: ComposableKeysOptions) => createUn
|
||||
const name = node.callee.name
|
||||
if (!name || !keyedFunctions.has(name) || node.arguments.length >= maxLength) { return }
|
||||
|
||||
imports = imports || detectImportNames(script, composableMeta)
|
||||
imports ||= detectImportNames(script, composableMeta)
|
||||
if (imports.has(name)) { return }
|
||||
|
||||
const meta = composableMeta[name]
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { parseNodeModulePath, resolvePath } from 'mlly'
|
||||
import { isAbsolute, normalize } from 'pathe'
|
||||
import type { Plugin } from 'vite'
|
||||
import { resolveAlias } from '@nuxt/kit'
|
||||
import { directoryToURL, resolveAlias } from '@nuxt/kit'
|
||||
import type { Nuxt } from '@nuxt/schema'
|
||||
|
||||
import { pkgDir } from '../../dirs'
|
||||
@ -37,7 +37,7 @@ export function resolveDeepImportsPlugin (nuxt: Nuxt): Plugin {
|
||||
const dir = parseNodeModulePath(normalisedImporter).dir || pkgDir
|
||||
|
||||
return await this.resolve?.(normalisedId, dir, { skipSelf: true }) ?? await resolvePath(id, {
|
||||
url: [dir, ...nuxt.options.modulesDir],
|
||||
url: [dir, ...nuxt.options.modulesDir].map(d => directoryToURL(d)),
|
||||
conditions,
|
||||
}).catch(() => {
|
||||
logger.debug('Could not resolve id', id, importer)
|
||||
|
@ -5,7 +5,7 @@ import { resolve } from 'pathe'
|
||||
import { watch } from 'chokidar'
|
||||
import { defu } from 'defu'
|
||||
import { debounce } from 'perfect-debounce'
|
||||
import { createIsIgnored, createResolver, defineNuxtModule, importModule, tryResolveModule } from '@nuxt/kit'
|
||||
import { createIsIgnored, createResolver, defineNuxtModule, directoryToURL, importModule, tryResolveModule } from '@nuxt/kit'
|
||||
import { generateTypes, resolveSchema as resolveUntypedSchema } from 'untyped'
|
||||
import type { Schema, SchemaDefinition } from 'untyped'
|
||||
import untypedPlugin from 'untyped/babel-plugin'
|
||||
@ -54,7 +54,7 @@ export default defineNuxtModule({
|
||||
})
|
||||
|
||||
if (nuxt.options.experimental.watcher === 'parcel') {
|
||||
const watcherPath = await tryResolveModule('@parcel/watcher', [nuxt.options.rootDir, ...nuxt.options.modulesDir])
|
||||
const watcherPath = await tryResolveModule('@parcel/watcher', [nuxt.options.rootDir, ...nuxt.options.modulesDir].map(dir => directoryToURL(dir)))
|
||||
if (watcherPath) {
|
||||
const { subscribe } = await importModule<typeof import('@parcel/watcher')>(watcherPath)
|
||||
for (const layer of nuxt.options._layers) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { resolvePackageJSON } from 'pkg-types'
|
||||
import { resolvePath as _resolvePath } from 'mlly'
|
||||
import { dirname } from 'pathe'
|
||||
import { tryUseNuxt } from '@nuxt/kit'
|
||||
import { directoryToURL, tryUseNuxt } from '@nuxt/kit'
|
||||
|
||||
export async function resolveTypePath (path: string, subpath: string, searchPaths = tryUseNuxt()?.options.modulesDir) {
|
||||
try {
|
||||
const r = await _resolvePath(path, { url: searchPaths, conditions: ['types', 'import', 'require'] })
|
||||
const r = await _resolvePath(path, { url: searchPaths?.map(d => directoryToURL(d)), conditions: ['types', 'import', 'require'] })
|
||||
if (subpath) {
|
||||
return r.replace(/(?:\.d)?\.[mc]?[jt]s$/, '')
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { resolve } from 'pathe'
|
||||
import { addComponent, addImportsSources, addPlugin, addTemplate, defineNuxtModule, tryResolveModule } from '@nuxt/kit'
|
||||
import { addComponent, addImportsSources, addPlugin, addTemplate, defineNuxtModule, directoryToURL, tryResolveModule } from '@nuxt/kit'
|
||||
import type { NuxtOptions } from '@nuxt/schema'
|
||||
import { distDir } from '../dirs'
|
||||
|
||||
@ -52,7 +52,8 @@ export default defineNuxtModule<NuxtOptions['unhead']>({
|
||||
})
|
||||
|
||||
// Opt-out feature allowing dependencies using @vueuse/head to work
|
||||
const unheadVue = await tryResolveModule('@unhead/vue', nuxt.options.modulesDir) || '@unhead/vue'
|
||||
const importPaths = nuxt.options.modulesDir.map(d => directoryToURL(d))
|
||||
const unheadVue = await tryResolveModule('@unhead/vue', importPaths) || '@unhead/vue'
|
||||
|
||||
addTemplate({
|
||||
filename: 'unhead-plugins.mjs',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import { addBuildPlugin, addTemplate, addTypeTemplate, createIsIgnored, defineNuxtModule, resolveAlias, tryResolveModule, updateTemplates, useNuxt } from '@nuxt/kit'
|
||||
import { addBuildPlugin, addTemplate, addTypeTemplate, createIsIgnored, defineNuxtModule, directoryToURL, resolveAlias, tryResolveModule, updateTemplates, useNuxt } from '@nuxt/kit'
|
||||
import { isAbsolute, join, normalize, relative, resolve } from 'pathe'
|
||||
import type { Import, Unimport } from 'unimport'
|
||||
import { createUnimport, scanDirExports, toExports } from 'unimport'
|
||||
@ -134,7 +134,25 @@ export default defineNuxtModule<Partial<ImportsOptions>>({
|
||||
const scannedImports = await scanDirExports(composablesDirs, {
|
||||
fileFilter: file => !isIgnored(file),
|
||||
})
|
||||
|
||||
const presetMap = new Map<string, string>()
|
||||
|
||||
for (const preset of presets) {
|
||||
preset.imports = preset.imports ?? []
|
||||
for (const i of preset.imports) {
|
||||
presetMap.set(i, preset.from)
|
||||
}
|
||||
presetMap.set(preset.as, preset.from)
|
||||
}
|
||||
|
||||
for (const i of scannedImports) {
|
||||
const name = i.as ?? i.name
|
||||
const preset = presetMap.get(name)
|
||||
|
||||
if (preset) {
|
||||
console.warn(`[imports] "${name}" is already defined and auto imported from "${preset ?? 'unknown preset'}" within nuxt itself. Please consider renaming "${name}" at ${i.from}.`)
|
||||
}
|
||||
|
||||
i.priority = i.priority || priorities.find(([dir]) => i.from.startsWith(dir))?.[1]
|
||||
}
|
||||
imports.push(...scannedImports)
|
||||
@ -181,6 +199,8 @@ function addDeclarationTemplates (ctx: Unimport, options: Partial<ImportsOptions
|
||||
|
||||
const SUPPORTED_EXTENSION_RE = new RegExp(`\\.(${nuxt.options.extensions.map(i => i.replace('.', '')).join('|')})$`)
|
||||
|
||||
const importPaths = nuxt.options.modulesDir.map(dir => directoryToURL(dir))
|
||||
|
||||
async function cacheImportPaths (imports: Import[]) {
|
||||
const importSource = Array.from(new Set(imports.map(i => i.from)))
|
||||
// skip relative import paths for node_modules that are explicitly installed
|
||||
@ -190,7 +210,7 @@ function addDeclarationTemplates (ctx: Unimport, options: Partial<ImportsOptions
|
||||
}
|
||||
let path = resolveAlias(from)
|
||||
if (!isAbsolute(path)) {
|
||||
path = await tryResolveModule(from, nuxt.options.modulesDir).then(async (r) => {
|
||||
path = await tryResolveModule(from, importPaths).then(async (r) => {
|
||||
if (!r) { return r }
|
||||
|
||||
const { dir, name } = parseNodeModulePath(r)
|
||||
|
@ -72,7 +72,7 @@
|
||||
"vue-bundle-renderer": "2.1.1",
|
||||
"vue-loader": "17.4.2",
|
||||
"vue-router": "4.5.0",
|
||||
"webpack": "5.97.1",
|
||||
"webpack": "5.98.0",
|
||||
"webpack-dev-middleware": "7.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -2,7 +2,7 @@ import { resolve } from 'pathe'
|
||||
import * as vite from 'vite'
|
||||
import vuePlugin from '@vitejs/plugin-vue'
|
||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
||||
import { logger, resolvePath, tryImportModule } from '@nuxt/kit'
|
||||
import { directoryToURL, logger, resolvePath, tryImportModule } from '@nuxt/kit'
|
||||
import { joinURL, withTrailingSlash, withoutLeadingSlash } from 'ufo'
|
||||
import type { ViteConfig } from '@nuxt/schema'
|
||||
import defu from 'defu'
|
||||
@ -117,7 +117,7 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
|
||||
if (!ctx.nuxt.options.dev) {
|
||||
const { runtimeDependencies = [] } = await tryImportModule<typeof import('nitro/runtime/meta')>('nitro/runtime/meta', {
|
||||
paths: ctx.nuxt.options.modulesDir,
|
||||
url: ctx.nuxt.options.modulesDir.map(d => directoryToURL(d)),
|
||||
}) || {}
|
||||
if (Array.isArray(serverConfig.ssr!.external)) {
|
||||
serverConfig.ssr!.external.push(
|
||||
|
@ -65,7 +65,7 @@
|
||||
"url-loader": "^4.1.1",
|
||||
"vue-bundle-renderer": "^2.1.1",
|
||||
"vue-loader": "^17.4.2",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack": "^5.98.0",
|
||||
"webpack-bundle-analyzer": "^4.10.2",
|
||||
"webpack-dev-middleware": "^7.4.2",
|
||||
"webpack-hot-middleware": "^2.26.1",
|
||||
|
213
pnpm-lock.yaml
213
pnpm-lock.yaml
@ -228,8 +228,8 @@ importers:
|
||||
specifier: 2.2.0
|
||||
version: 2.2.0(typescript@5.7.3)
|
||||
webpack:
|
||||
specifier: 5.97.1
|
||||
version: 5.97.1
|
||||
specifier: 5.98.0
|
||||
version: 5.98.0
|
||||
|
||||
packages/kit:
|
||||
dependencies:
|
||||
@ -316,8 +316,8 @@ importers:
|
||||
specifier: 3.0.5
|
||||
version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.2)(happy-dom@17.1.0)(jiti@2.4.2)(sass@1.78.0)(terser@5.32.0)(tsx@4.19.2)(yaml@2.7.0)
|
||||
webpack:
|
||||
specifier: 5.97.1
|
||||
version: 5.97.1
|
||||
specifier: 5.98.0
|
||||
version: 5.98.0
|
||||
|
||||
packages/nuxt:
|
||||
dependencies:
|
||||
@ -549,7 +549,7 @@ importers:
|
||||
dependencies:
|
||||
'@nuxt/friendly-errors-webpack-plugin':
|
||||
specifier: ^2.6.0
|
||||
version: 2.6.0(webpack@5.97.1)
|
||||
version: 2.6.0(webpack@5.98.0)
|
||||
'@nuxt/kit':
|
||||
specifier: workspace:*
|
||||
version: link:../kit
|
||||
@ -561,10 +561,10 @@ importers:
|
||||
version: 10.4.20(postcss@8.5.2)
|
||||
css-loader:
|
||||
specifier: ^7.1.2
|
||||
version: 7.1.2(@rspack/core@1.2.3)(webpack@5.97.1)
|
||||
version: 7.1.2(@rspack/core@1.2.3)(webpack@5.98.0)
|
||||
css-minimizer-webpack-plugin:
|
||||
specifier: ^7.0.0
|
||||
version: 7.0.0(webpack@5.97.1)
|
||||
version: 7.0.0(webpack@5.98.0)
|
||||
cssnano:
|
||||
specifier: ^7.0.6
|
||||
version: 7.0.6(postcss@8.5.2)
|
||||
@ -573,16 +573,16 @@ importers:
|
||||
version: 6.1.4
|
||||
esbuild-loader:
|
||||
specifier: ^4.3.0
|
||||
version: 4.3.0(webpack@5.97.1)
|
||||
version: 4.3.0(webpack@5.98.0)
|
||||
escape-string-regexp:
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.0
|
||||
file-loader:
|
||||
specifier: ^6.2.0
|
||||
version: 6.2.0(webpack@5.97.1)
|
||||
version: 6.2.0(webpack@5.98.0)
|
||||
fork-ts-checker-webpack-plugin:
|
||||
specifier: ^9.0.2
|
||||
version: 9.0.2(typescript@5.7.3)(webpack@5.97.1)
|
||||
version: 9.0.2(typescript@5.7.3)(webpack@5.98.0)
|
||||
globby:
|
||||
specifier: ^14.1.0
|
||||
version: 14.1.0
|
||||
@ -621,7 +621,7 @@ importers:
|
||||
version: 2.0.0
|
||||
postcss-loader:
|
||||
specifier: ^8.1.1
|
||||
version: 8.1.1(@rspack/core@1.2.3)(postcss@8.5.2)(typescript@5.7.3)(webpack@5.97.1)
|
||||
version: 8.1.1(@rspack/core@1.2.3)(postcss@8.5.2)(typescript@5.7.3)(webpack@5.98.0)
|
||||
postcss-url:
|
||||
specifier: ^10.1.3
|
||||
version: 10.1.3(postcss@8.5.2)
|
||||
@ -633,7 +633,7 @@ importers:
|
||||
version: 3.8.0
|
||||
time-fix-plugin:
|
||||
specifier: ^2.0.7
|
||||
version: 2.0.7(webpack@5.97.1)
|
||||
version: 2.0.7(webpack@5.98.0)
|
||||
ufo:
|
||||
specifier: 1.5.4
|
||||
version: 1.5.4
|
||||
@ -645,25 +645,25 @@ importers:
|
||||
version: 2.2.0
|
||||
url-loader:
|
||||
specifier: ^4.1.1
|
||||
version: 4.1.1(file-loader@6.2.0(webpack@5.97.1))(webpack@5.97.1)
|
||||
version: 4.1.1(file-loader@6.2.0(webpack@5.98.0))(webpack@5.98.0)
|
||||
vue-bundle-renderer:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
vue-loader:
|
||||
specifier: ^17.4.2
|
||||
version: 17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.97.1)
|
||||
version: 17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.98.0)
|
||||
webpack-bundle-analyzer:
|
||||
specifier: ^4.10.2
|
||||
version: 4.10.2
|
||||
webpack-dev-middleware:
|
||||
specifier: ^7.4.2
|
||||
version: 7.4.2(webpack@5.97.1)
|
||||
version: 7.4.2(webpack@5.98.0)
|
||||
webpack-hot-middleware:
|
||||
specifier: ^2.26.1
|
||||
version: 2.26.1
|
||||
webpackbar:
|
||||
specifier: ^7.0.0
|
||||
version: 7.0.0(@rspack/core@1.2.3)(webpack@5.97.1)
|
||||
version: 7.0.0(@rspack/core@1.2.3)(webpack@5.98.0)
|
||||
devDependencies:
|
||||
'@nuxt/schema':
|
||||
specifier: workspace:*
|
||||
@ -743,16 +743,16 @@ importers:
|
||||
version: 0.1.8
|
||||
css-minimizer-webpack-plugin:
|
||||
specifier: 7.0.0
|
||||
version: 7.0.0(esbuild@0.25.0)(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 7.0.0(esbuild@0.25.0)(webpack@5.98.0(esbuild@0.25.0))
|
||||
esbuild:
|
||||
specifier: 0.25.0
|
||||
version: 0.25.0
|
||||
esbuild-loader:
|
||||
specifier: 4.3.0
|
||||
version: 4.3.0(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 4.3.0(webpack@5.98.0(esbuild@0.25.0))
|
||||
file-loader:
|
||||
specifier: 6.2.0
|
||||
version: 6.2.0(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 6.2.0(webpack@5.98.0(esbuild@0.25.0))
|
||||
h3:
|
||||
specifier: npm:h3-nightly@1.14.0-20250122-114730-3f9e703
|
||||
version: h3-nightly@1.14.0-20250122-114730-3f9e703
|
||||
@ -764,7 +764,7 @@ importers:
|
||||
version: 7.0.3
|
||||
mini-css-extract-plugin:
|
||||
specifier: 2.9.2
|
||||
version: 2.9.2(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 2.9.2(webpack@5.98.0(esbuild@0.25.0))
|
||||
nitro:
|
||||
specifier: npm:nitro-nightly@3.0.0-beta-28969273.f7aa9de6
|
||||
version: nitro-nightly@3.0.0-beta-28969273.f7aa9de6(typescript@5.7.3)
|
||||
@ -779,7 +779,7 @@ importers:
|
||||
version: 8.5.2
|
||||
sass-loader:
|
||||
specifier: 16.0.4
|
||||
version: 16.0.4(@rspack/core@1.2.3)(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 16.0.4(@rspack/core@1.2.3)(webpack@5.98.0(esbuild@0.25.0))
|
||||
scule:
|
||||
specifier: 1.3.0
|
||||
version: 1.3.0
|
||||
@ -806,16 +806,16 @@ importers:
|
||||
version: 2.1.1
|
||||
vue-loader:
|
||||
specifier: 17.4.2
|
||||
version: 17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.98.0(esbuild@0.25.0))
|
||||
vue-router:
|
||||
specifier: 4.5.0
|
||||
version: 4.5.0(vue@3.5.13(typescript@5.7.3))
|
||||
webpack:
|
||||
specifier: 5.97.1
|
||||
version: 5.97.1(esbuild@0.25.0)
|
||||
specifier: 5.98.0
|
||||
version: 5.98.0(esbuild@0.25.0)
|
||||
webpack-dev-middleware:
|
||||
specifier: 7.4.2
|
||||
version: 7.4.2(webpack@5.97.1(esbuild@0.25.0))
|
||||
version: 7.4.2(webpack@5.98.0(esbuild@0.25.0))
|
||||
|
||||
packages/ui-templates:
|
||||
devDependencies:
|
||||
@ -966,7 +966,7 @@ importers:
|
||||
dependencies:
|
||||
'@nuxt/friendly-errors-webpack-plugin':
|
||||
specifier: ^2.6.0
|
||||
version: 2.6.0(webpack@5.97.1)
|
||||
version: 2.6.0(webpack@5.98.0)
|
||||
'@nuxt/kit':
|
||||
specifier: workspace:*
|
||||
version: link:../kit
|
||||
@ -975,10 +975,10 @@ importers:
|
||||
version: 10.4.20(postcss@8.5.2)
|
||||
css-loader:
|
||||
specifier: ^7.1.2
|
||||
version: 7.1.2(@rspack/core@1.2.3)(webpack@5.97.1)
|
||||
version: 7.1.2(@rspack/core@1.2.3)(webpack@5.98.0)
|
||||
css-minimizer-webpack-plugin:
|
||||
specifier: ^7.0.0
|
||||
version: 7.0.0(webpack@5.97.1)
|
||||
version: 7.0.0(webpack@5.98.0)
|
||||
cssnano:
|
||||
specifier: ^7.0.6
|
||||
version: 7.0.6(postcss@8.5.2)
|
||||
@ -987,16 +987,16 @@ importers:
|
||||
version: 6.1.4
|
||||
esbuild-loader:
|
||||
specifier: ^4.3.0
|
||||
version: 4.3.0(webpack@5.97.1)
|
||||
version: 4.3.0(webpack@5.98.0)
|
||||
escape-string-regexp:
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.0
|
||||
file-loader:
|
||||
specifier: ^6.2.0
|
||||
version: 6.2.0(webpack@5.97.1)
|
||||
version: 6.2.0(webpack@5.98.0)
|
||||
fork-ts-checker-webpack-plugin:
|
||||
specifier: ^9.0.2
|
||||
version: 9.0.2(typescript@5.7.3)(webpack@5.97.1)
|
||||
version: 9.0.2(typescript@5.7.3)(webpack@5.98.0)
|
||||
globby:
|
||||
specifier: ^14.1.0
|
||||
version: 14.1.0
|
||||
@ -1017,7 +1017,7 @@ importers:
|
||||
version: 4.17.0
|
||||
mini-css-extract-plugin:
|
||||
specifier: ^2.9.2
|
||||
version: 2.9.2(webpack@5.97.1)
|
||||
version: 2.9.2(webpack@5.98.0)
|
||||
ohash:
|
||||
specifier: 1.1.4
|
||||
version: 1.1.4
|
||||
@ -1038,7 +1038,7 @@ importers:
|
||||
version: 2.0.0
|
||||
postcss-loader:
|
||||
specifier: ^8.1.1
|
||||
version: 8.1.1(@rspack/core@1.2.3)(postcss@8.5.2)(typescript@5.7.3)(webpack@5.97.1)
|
||||
version: 8.1.1(@rspack/core@1.2.3)(postcss@8.5.2)(typescript@5.7.3)(webpack@5.98.0)
|
||||
postcss-url:
|
||||
specifier: ^10.1.3
|
||||
version: 10.1.3(postcss@8.5.2)
|
||||
@ -1050,7 +1050,7 @@ importers:
|
||||
version: 3.8.0
|
||||
time-fix-plugin:
|
||||
specifier: ^2.0.7
|
||||
version: 2.0.7(webpack@5.97.1)
|
||||
version: 2.0.7(webpack@5.98.0)
|
||||
ufo:
|
||||
specifier: 1.5.4
|
||||
version: 1.5.4
|
||||
@ -1062,28 +1062,28 @@ importers:
|
||||
version: 2.2.0
|
||||
url-loader:
|
||||
specifier: ^4.1.1
|
||||
version: 4.1.1(file-loader@6.2.0(webpack@5.97.1))(webpack@5.97.1)
|
||||
version: 4.1.1(file-loader@6.2.0(webpack@5.98.0))(webpack@5.98.0)
|
||||
vue-bundle-renderer:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
vue-loader:
|
||||
specifier: ^17.4.2
|
||||
version: 17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.97.1)
|
||||
version: 17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.98.0)
|
||||
webpack:
|
||||
specifier: ^5.97.1
|
||||
version: 5.97.1
|
||||
specifier: ^5.98.0
|
||||
version: 5.98.0
|
||||
webpack-bundle-analyzer:
|
||||
specifier: ^4.10.2
|
||||
version: 4.10.2
|
||||
webpack-dev-middleware:
|
||||
specifier: ^7.4.2
|
||||
version: 7.4.2(webpack@5.97.1)
|
||||
version: 7.4.2(webpack@5.98.0)
|
||||
webpack-hot-middleware:
|
||||
specifier: ^2.26.1
|
||||
version: 2.26.1
|
||||
webpackbar:
|
||||
specifier: ^7.0.0
|
||||
version: 7.0.0(@rspack/core@1.2.3)(webpack@5.97.1)
|
||||
version: 7.0.0(@rspack/core@1.2.3)(webpack@5.98.0)
|
||||
devDependencies:
|
||||
'@nuxt/schema':
|
||||
specifier: workspace:*
|
||||
@ -6788,6 +6788,10 @@ packages:
|
||||
resolution: {integrity: sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==}
|
||||
engines: {node: '>= 12.13.0'}
|
||||
|
||||
schema-utils@4.3.0:
|
||||
resolution: {integrity: sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
|
||||
scslre@0.3.0:
|
||||
resolution: {integrity: sha512-3A6sD0WYP7+QrjbfNA2FN3FsOaGGFoekCVgTyypy53gPxhbkCIjtO6YWgdrfM+n/8sI8JeXZOIxsHjMTNxQ4nQ==}
|
||||
engines: {node: ^14.0.0 || >=16.0.0}
|
||||
@ -7130,8 +7134,8 @@ packages:
|
||||
resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
terser-webpack-plugin@5.3.10:
|
||||
resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==}
|
||||
terser-webpack-plugin@5.3.11:
|
||||
resolution: {integrity: sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
peerDependencies:
|
||||
'@swc/core': '*'
|
||||
@ -7815,8 +7819,8 @@ packages:
|
||||
webpack-virtual-modules@0.6.2:
|
||||
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
|
||||
|
||||
webpack@5.97.1:
|
||||
resolution: {integrity: sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==}
|
||||
webpack@5.98.0:
|
||||
resolution: {integrity: sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@ -8883,13 +8887,13 @@ snapshots:
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
'@nuxt/friendly-errors-webpack-plugin@2.6.0(webpack@5.97.1)':
|
||||
'@nuxt/friendly-errors-webpack-plugin@2.6.0(webpack@5.98.0)':
|
||||
dependencies:
|
||||
chalk: 2.4.2
|
||||
consola: 3.4.0
|
||||
error-stack-parser: 2.1.4
|
||||
string-width: 4.2.3
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
'@nuxt/scripts@0.10.1(@types/google.maps@3.58.1)(@types/vimeo__player@2.18.3)(@types/youtube@0.1.0)(@unhead/vue@1.11.18(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)':
|
||||
dependencies:
|
||||
@ -9704,7 +9708,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/node': 22.13.2
|
||||
tapable: 2.2.1
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
@ -9715,7 +9719,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/node': 22.13.2
|
||||
tapable: 2.2.1
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
@ -9726,7 +9730,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/connect': 3.4.38
|
||||
tapable: 2.2.1
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
@ -9737,7 +9741,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/connect': 3.4.38
|
||||
tapable: 2.2.1
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- esbuild
|
||||
@ -11025,7 +11029,7 @@ snapshots:
|
||||
dependencies:
|
||||
postcss: 8.5.2
|
||||
|
||||
css-loader@7.1.2(@rspack/core@1.2.3)(webpack@5.97.1):
|
||||
css-loader@7.1.2(@rspack/core@1.2.3)(webpack@5.98.0):
|
||||
dependencies:
|
||||
icss-utils: 5.1.0(postcss@8.5.2)
|
||||
postcss: 8.5.2
|
||||
@ -11037,9 +11041,9 @@ snapshots:
|
||||
semver: 7.7.1
|
||||
optionalDependencies:
|
||||
'@rspack/core': 1.2.3
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
css-minimizer-webpack-plugin@7.0.0(esbuild@0.25.0)(webpack@5.97.1(esbuild@0.25.0)):
|
||||
css-minimizer-webpack-plugin@7.0.0(esbuild@0.25.0)(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
cssnano: 7.0.6(postcss@8.5.2)
|
||||
@ -11047,11 +11051,11 @@ snapshots:
|
||||
postcss: 8.5.2
|
||||
schema-utils: 4.2.0
|
||||
serialize-javascript: 6.0.2
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
optionalDependencies:
|
||||
esbuild: 0.25.0
|
||||
|
||||
css-minimizer-webpack-plugin@7.0.0(webpack@5.97.1):
|
||||
css-minimizer-webpack-plugin@7.0.0(webpack@5.98.0):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
cssnano: 7.0.6(postcss@8.5.2)
|
||||
@ -11059,7 +11063,7 @@ snapshots:
|
||||
postcss: 8.5.2
|
||||
schema-utils: 4.2.0
|
||||
serialize-javascript: 6.0.2
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
css-select@5.1.0:
|
||||
dependencies:
|
||||
@ -11391,20 +11395,20 @@ snapshots:
|
||||
|
||||
es-module-lexer@1.6.0: {}
|
||||
|
||||
esbuild-loader@4.3.0(webpack@5.97.1(esbuild@0.25.0)):
|
||||
esbuild-loader@4.3.0(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
esbuild: 0.25.0
|
||||
get-tsconfig: 4.8.0
|
||||
loader-utils: 2.0.4
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
webpack-sources: 1.4.3
|
||||
|
||||
esbuild-loader@4.3.0(webpack@5.97.1):
|
||||
esbuild-loader@4.3.0(webpack@5.98.0):
|
||||
dependencies:
|
||||
esbuild: 0.25.0
|
||||
get-tsconfig: 4.8.0
|
||||
loader-utils: 2.0.4
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
webpack-sources: 1.4.3
|
||||
|
||||
esbuild@0.23.1:
|
||||
@ -11795,17 +11799,17 @@ snapshots:
|
||||
dependencies:
|
||||
flat-cache: 4.0.1
|
||||
|
||||
file-loader@6.2.0(webpack@5.97.1(esbuild@0.25.0)):
|
||||
file-loader@6.2.0(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
loader-utils: 2.0.4
|
||||
schema-utils: 3.3.0
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
|
||||
file-loader@6.2.0(webpack@5.97.1):
|
||||
file-loader@6.2.0(webpack@5.98.0):
|
||||
dependencies:
|
||||
loader-utils: 2.0.4
|
||||
schema-utils: 3.3.0
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
file-uri-to-path@1.0.0: {}
|
||||
|
||||
@ -11858,7 +11862,7 @@ snapshots:
|
||||
cross-spawn: 7.0.6
|
||||
signal-exit: 4.1.0
|
||||
|
||||
fork-ts-checker-webpack-plugin@9.0.2(typescript@5.7.3)(webpack@5.97.1):
|
||||
fork-ts-checker-webpack-plugin@9.0.2(typescript@5.7.3)(webpack@5.98.0):
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.26.2
|
||||
chalk: 4.1.2
|
||||
@ -11873,7 +11877,7 @@ snapshots:
|
||||
semver: 7.7.1
|
||||
tapable: 2.2.1
|
||||
typescript: 5.7.3
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
form-data@4.0.1:
|
||||
dependencies:
|
||||
@ -13242,17 +13246,17 @@ snapshots:
|
||||
|
||||
min-indent@1.0.1: {}
|
||||
|
||||
mini-css-extract-plugin@2.9.2(webpack@5.97.1(esbuild@0.25.0)):
|
||||
mini-css-extract-plugin@2.9.2(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
schema-utils: 4.2.0
|
||||
tapable: 2.2.1
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
|
||||
mini-css-extract-plugin@2.9.2(webpack@5.97.1):
|
||||
mini-css-extract-plugin@2.9.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
schema-utils: 4.2.0
|
||||
tapable: 2.2.1
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
minimatch@3.0.8:
|
||||
dependencies:
|
||||
@ -13871,7 +13875,7 @@ snapshots:
|
||||
read-cache: 1.0.0
|
||||
resolve: 1.22.8
|
||||
|
||||
postcss-loader@8.1.1(@rspack/core@1.2.3)(postcss@8.5.2)(typescript@5.7.3)(webpack@5.97.1):
|
||||
postcss-loader@8.1.1(@rspack/core@1.2.3)(postcss@8.5.2)(typescript@5.7.3)(webpack@5.98.0):
|
||||
dependencies:
|
||||
cosmiconfig: 9.0.0(typescript@5.7.3)
|
||||
jiti: 2.4.2
|
||||
@ -13879,7 +13883,7 @@ snapshots:
|
||||
semver: 7.7.1
|
||||
optionalDependencies:
|
||||
'@rspack/core': 1.2.3
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
transitivePeerDependencies:
|
||||
- typescript
|
||||
|
||||
@ -14522,12 +14526,12 @@ snapshots:
|
||||
|
||||
safe-buffer@5.2.1: {}
|
||||
|
||||
sass-loader@16.0.4(@rspack/core@1.2.3)(webpack@5.97.1(esbuild@0.25.0)):
|
||||
sass-loader@16.0.4(@rspack/core@1.2.3)(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
neo-async: 2.6.2
|
||||
optionalDependencies:
|
||||
'@rspack/core': 1.2.3
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
|
||||
sass@1.78.0:
|
||||
dependencies:
|
||||
@ -14549,6 +14553,13 @@ snapshots:
|
||||
ajv-formats: 2.1.1(ajv@8.17.1)
|
||||
ajv-keywords: 5.1.0(ajv@8.17.1)
|
||||
|
||||
schema-utils@4.3.0:
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.15
|
||||
ajv: 8.17.1
|
||||
ajv-formats: 2.1.1(ajv@8.17.1)
|
||||
ajv-keywords: 5.1.0(ajv@8.17.1)
|
||||
|
||||
scslre@0.3.0:
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.12.1
|
||||
@ -14905,25 +14916,25 @@ snapshots:
|
||||
mkdirp: 1.0.4
|
||||
yallist: 4.0.0
|
||||
|
||||
terser-webpack-plugin@5.3.10(esbuild@0.25.0)(webpack@5.97.1(esbuild@0.25.0)):
|
||||
terser-webpack-plugin@5.3.11(esbuild@0.25.0)(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 3.3.0
|
||||
schema-utils: 4.3.0
|
||||
serialize-javascript: 6.0.2
|
||||
terser: 5.32.0
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
optionalDependencies:
|
||||
esbuild: 0.25.0
|
||||
|
||||
terser-webpack-plugin@5.3.10(webpack@5.97.1):
|
||||
terser-webpack-plugin@5.3.11(webpack@5.98.0):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 3.3.0
|
||||
schema-utils: 4.3.0
|
||||
serialize-javascript: 6.0.2
|
||||
terser: 5.32.0
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
terser@5.32.0:
|
||||
dependencies:
|
||||
@ -14954,9 +14965,9 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.7.0
|
||||
|
||||
time-fix-plugin@2.0.7(webpack@5.97.1):
|
||||
time-fix-plugin@2.0.7(webpack@5.98.0):
|
||||
dependencies:
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
timsort@0.3.0: {}
|
||||
|
||||
@ -15350,14 +15361,14 @@ snapshots:
|
||||
|
||||
url-join@5.0.0: {}
|
||||
|
||||
url-loader@4.1.1(file-loader@6.2.0(webpack@5.97.1))(webpack@5.97.1):
|
||||
url-loader@4.1.1(file-loader@6.2.0(webpack@5.98.0))(webpack@5.98.0):
|
||||
dependencies:
|
||||
loader-utils: 2.0.4
|
||||
mime-types: 2.1.35
|
||||
schema-utils: 3.3.0
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
optionalDependencies:
|
||||
file-loader: 6.2.0(webpack@5.97.1)
|
||||
file-loader: 6.2.0(webpack@5.98.0)
|
||||
|
||||
urlpattern-polyfill@8.0.2: {}
|
||||
|
||||
@ -15599,22 +15610,22 @@ snapshots:
|
||||
dependencies:
|
||||
vue: 3.5.13(typescript@5.7.3)
|
||||
|
||||
vue-loader@17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.97.1(esbuild@0.25.0)):
|
||||
vue-loader@17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
hash-sum: 2.0.0
|
||||
watchpack: 2.4.2
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
optionalDependencies:
|
||||
'@vue/compiler-sfc': 3.5.13
|
||||
vue: 3.5.13(typescript@5.7.3)
|
||||
|
||||
vue-loader@17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.97.1):
|
||||
vue-loader@17.4.2(@vue/compiler-sfc@3.5.13)(vue@3.5.13(typescript@5.7.3))(webpack@5.98.0):
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
hash-sum: 2.0.0
|
||||
watchpack: 2.4.2
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
optionalDependencies:
|
||||
'@vue/compiler-sfc': 3.5.13
|
||||
vue: 3.5.13(typescript@5.7.3)
|
||||
@ -15686,7 +15697,7 @@ snapshots:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
webpack-dev-middleware@7.4.2(webpack@5.97.1(esbuild@0.25.0)):
|
||||
webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.0)):
|
||||
dependencies:
|
||||
colorette: 2.0.20
|
||||
memfs: 4.17.0
|
||||
@ -15695,9 +15706,9 @@ snapshots:
|
||||
range-parser: 1.2.1
|
||||
schema-utils: 4.2.0
|
||||
optionalDependencies:
|
||||
webpack: 5.97.1(esbuild@0.25.0)
|
||||
webpack: 5.98.0(esbuild@0.25.0)
|
||||
|
||||
webpack-dev-middleware@7.4.2(webpack@5.97.1):
|
||||
webpack-dev-middleware@7.4.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
colorette: 2.0.20
|
||||
memfs: 4.17.0
|
||||
@ -15706,7 +15717,7 @@ snapshots:
|
||||
range-parser: 1.2.1
|
||||
schema-utils: 4.2.0
|
||||
optionalDependencies:
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
webpack-hot-middleware@2.26.1:
|
||||
dependencies:
|
||||
@ -15723,7 +15734,7 @@ snapshots:
|
||||
|
||||
webpack-virtual-modules@0.6.2: {}
|
||||
|
||||
webpack@5.97.1:
|
||||
webpack@5.98.0:
|
||||
dependencies:
|
||||
'@types/eslint-scope': 3.7.7
|
||||
'@types/estree': 1.0.6
|
||||
@ -15743,9 +15754,9 @@ snapshots:
|
||||
loader-runner: 4.3.0
|
||||
mime-types: 2.1.35
|
||||
neo-async: 2.6.2
|
||||
schema-utils: 3.3.0
|
||||
schema-utils: 4.3.0
|
||||
tapable: 2.2.1
|
||||
terser-webpack-plugin: 5.3.10(webpack@5.97.1)
|
||||
terser-webpack-plugin: 5.3.11(webpack@5.98.0)
|
||||
watchpack: 2.4.2
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
@ -15753,7 +15764,7 @@ snapshots:
|
||||
- esbuild
|
||||
- uglify-js
|
||||
|
||||
webpack@5.97.1(esbuild@0.25.0):
|
||||
webpack@5.98.0(esbuild@0.25.0):
|
||||
dependencies:
|
||||
'@types/eslint-scope': 3.7.7
|
||||
'@types/estree': 1.0.6
|
||||
@ -15773,9 +15784,9 @@ snapshots:
|
||||
loader-runner: 4.3.0
|
||||
mime-types: 2.1.35
|
||||
neo-async: 2.6.2
|
||||
schema-utils: 3.3.0
|
||||
schema-utils: 4.3.0
|
||||
tapable: 2.2.1
|
||||
terser-webpack-plugin: 5.3.10(esbuild@0.25.0)(webpack@5.97.1(esbuild@0.25.0))
|
||||
terser-webpack-plugin: 5.3.11(esbuild@0.25.0)(webpack@5.98.0(esbuild@0.25.0))
|
||||
watchpack: 2.4.2
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
@ -15783,7 +15794,7 @@ snapshots:
|
||||
- esbuild
|
||||
- uglify-js
|
||||
|
||||
webpackbar@7.0.0(@rspack/core@1.2.3)(webpack@5.97.1):
|
||||
webpackbar@7.0.0(@rspack/core@1.2.3)(webpack@5.98.0):
|
||||
dependencies:
|
||||
ansis: 3.3.2
|
||||
consola: 3.4.0
|
||||
@ -15791,7 +15802,7 @@ snapshots:
|
||||
std-env: 3.8.0
|
||||
optionalDependencies:
|
||||
'@rspack/core': 1.2.3
|
||||
webpack: 5.97.1
|
||||
webpack: 5.98.0
|
||||
|
||||
whatwg-mimetype@3.0.0: {}
|
||||
|
||||
|
@ -527,6 +527,23 @@ describe('loading state', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('loading state', () => {
|
||||
it('expect state from set opts: { force: true }', async () => {
|
||||
vi.stubGlobal('setTimeout', vi.fn((cb: () => void) => cb()))
|
||||
const nuxtApp = useNuxtApp()
|
||||
const { isLoading, start, finish, set } = useLoadingIndicator()
|
||||
await nuxtApp.callHook('page:loading:start')
|
||||
start({ force: true })
|
||||
expect(isLoading.value).toBeTruthy()
|
||||
finish()
|
||||
expect(isLoading.value).toBeFalsy()
|
||||
set(0, { force: true })
|
||||
expect(isLoading.value).toBeTruthy()
|
||||
set(100, { force: true })
|
||||
expect(isLoading.value).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
describe.skipIf(process.env.TEST_MANIFEST === 'manifest-off')('app manifests', () => {
|
||||
it('getAppManifest', async () => {
|
||||
const manifest = await getAppManifest()
|
||||
|
Loading…
Reference in New Issue
Block a user