mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-22 16:39:58 +00:00
Merge branch 'main' into patch-2
This commit is contained in:
commit
baa68a6491
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -236,7 +236,7 @@ jobs:
|
|||||||
path: packages
|
path: packages
|
||||||
|
|
||||||
- name: Run benchmarks
|
- name: Run benchmarks
|
||||||
uses: CodSpeedHQ/action@da7c57859a7a565a3a92789ac64c41aca031ca1f # v3.3.0
|
uses: CodSpeedHQ/action@1015f4f828ff74b7a950909897fe581d6ba868cc # v3.3.1
|
||||||
with:
|
with:
|
||||||
run: pnpm vitest bench
|
run: pnpm vitest bench
|
||||||
token: ${{ secrets.CODSPEED_TOKEN }}
|
token: ${{ secrets.CODSPEED_TOKEN }}
|
||||||
|
@ -39,10 +39,8 @@ function captureStackTrace () {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for (const key of ['line', 'column']) {
|
for (const key of ['line', 'column']) {
|
||||||
if (parsed[key]) {
|
// @ts-expect-error
|
||||||
// @ts-expect-error
|
parsed[key] &&= Number(parsed[key])
|
||||||
parsed[key] = Number(parsed[key])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
trace.push(parsed)
|
trace.push(parsed)
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ export default createConfigForNuxt({
|
|||||||
rules: {
|
rules: {
|
||||||
'curly': ['error', 'all'], // Including if blocks with a single statement
|
'curly': ['error', 'all'], // Including if blocks with a single statement
|
||||||
'dot-notation': 'error',
|
'dot-notation': 'error',
|
||||||
|
'logical-assignment-operators': ['error', 'always', { enforceForIfStatements: true }],
|
||||||
'no-console': ['warn', { allow: ['warn', 'error', 'debug'] }],
|
'no-console': ['warn', { allow: ['warn', 'error', 'debug'] }],
|
||||||
'no-lonely-if': 'error', // No single if in an "else" block
|
'no-lonely-if': 'error', // No single if in an "else" block
|
||||||
'no-useless-rename': 'error',
|
'no-useless-rename': 'error',
|
||||||
|
36
package.json
36
package.json
@ -37,7 +37,7 @@
|
|||||||
"typecheck:docs": "DOCS_TYPECHECK=true pnpm nuxi prepare && nuxt-content-twoslash verify --content-dir docs --languages html"
|
"typecheck:docs": "DOCS_TYPECHECK=true pnpm nuxi prepare && nuxt-content-twoslash verify --content-dir docs --languages html"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@babel/core": "7.26.8",
|
"@babel/core": "7.26.9",
|
||||||
"@babel/helper-plugin-utils": "7.26.5",
|
"@babel/helper-plugin-utils": "7.26.5",
|
||||||
"@nuxt/cli": "3.21.1",
|
"@nuxt/cli": "3.21.1",
|
||||||
"@nuxt/kit": "workspace:*",
|
"@nuxt/kit": "workspace:*",
|
||||||
@ -45,12 +45,12 @@
|
|||||||
"@nuxt/schema": "workspace:*",
|
"@nuxt/schema": "workspace:*",
|
||||||
"@nuxt/vite-builder": "workspace:*",
|
"@nuxt/vite-builder": "workspace:*",
|
||||||
"@nuxt/webpack-builder": "workspace:*",
|
"@nuxt/webpack-builder": "workspace:*",
|
||||||
"@types/node": "22.13.2",
|
"@types/node": "22.13.4",
|
||||||
"@unhead/dom": "1.11.18",
|
"@unhead/dom": "1.11.19",
|
||||||
"@unhead/schema": "1.11.18",
|
"@unhead/schema": "1.11.19",
|
||||||
"@unhead/shared": "1.11.18",
|
"@unhead/shared": "1.11.19",
|
||||||
"@unhead/ssr": "1.11.18",
|
"@unhead/ssr": "1.11.19",
|
||||||
"@unhead/vue": "1.11.18",
|
"@unhead/vue": "1.11.19",
|
||||||
"@vue/compiler-core": "3.5.13",
|
"@vue/compiler-core": "3.5.13",
|
||||||
"@vue/compiler-dom": "3.5.13",
|
"@vue/compiler-dom": "3.5.13",
|
||||||
"@vue/shared": "3.5.13",
|
"@vue/shared": "3.5.13",
|
||||||
@ -62,19 +62,19 @@
|
|||||||
"nuxt": "workspace:*",
|
"nuxt": "workspace:*",
|
||||||
"ohash": "1.1.4",
|
"ohash": "1.1.4",
|
||||||
"postcss": "8.5.2",
|
"postcss": "8.5.2",
|
||||||
"rollup": "4.34.6",
|
"rollup": "4.34.8",
|
||||||
"send": ">=1.1.0",
|
"send": ">=1.1.0",
|
||||||
"typescript": "5.7.3",
|
"typescript": "5.7.3",
|
||||||
"ufo": "1.5.4",
|
"ufo": "1.5.4",
|
||||||
"unbuild": "3.3.1",
|
"unbuild": "3.3.1",
|
||||||
"unhead": "1.11.18",
|
"unhead": "1.11.19",
|
||||||
"unimport": "4.1.1",
|
"unimport": "4.1.2",
|
||||||
"vite": "6.1.0",
|
"vite": "6.1.0",
|
||||||
"vue": "3.5.13"
|
"vue": "3.5.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@arethetypeswrong/cli": "0.17.3",
|
"@arethetypeswrong/cli": "0.17.3",
|
||||||
"@babel/core": "7.26.8",
|
"@babel/core": "7.26.9",
|
||||||
"@babel/helper-plugin-utils": "7.26.5",
|
"@babel/helper-plugin-utils": "7.26.5",
|
||||||
"@codspeed/vitest-plugin": "4.0.0",
|
"@codspeed/vitest-plugin": "4.0.0",
|
||||||
"@nuxt/cli": "3.21.1",
|
"@nuxt/cli": "3.21.1",
|
||||||
@ -86,10 +86,10 @@
|
|||||||
"@testing-library/vue": "8.1.0",
|
"@testing-library/vue": "8.1.0",
|
||||||
"@types/babel__core": "7.20.5",
|
"@types/babel__core": "7.20.5",
|
||||||
"@types/babel__helper-plugin-utils": "7.10.3",
|
"@types/babel__helper-plugin-utils": "7.10.3",
|
||||||
"@types/node": "22.13.2",
|
"@types/node": "22.13.4",
|
||||||
"@types/semver": "7.5.8",
|
"@types/semver": "7.5.8",
|
||||||
"@unhead/schema": "1.11.18",
|
"@unhead/schema": "1.11.19",
|
||||||
"@unhead/vue": "1.11.18",
|
"@unhead/vue": "1.11.19",
|
||||||
"@vitest/coverage-v8": "3.0.5",
|
"@vitest/coverage-v8": "3.0.5",
|
||||||
"@vue/test-utils": "2.4.6",
|
"@vue/test-utils": "2.4.6",
|
||||||
"acorn": "8.14.0",
|
"acorn": "8.14.0",
|
||||||
@ -120,12 +120,12 @@
|
|||||||
"pathe": "2.0.3",
|
"pathe": "2.0.3",
|
||||||
"pkg-pr-new": "0.0.39",
|
"pkg-pr-new": "0.0.39",
|
||||||
"playwright-core": "1.50.1",
|
"playwright-core": "1.50.1",
|
||||||
"rollup": "4.34.6",
|
"rollup": "4.34.8",
|
||||||
"semver": "7.7.1",
|
"semver": "7.7.1",
|
||||||
"sherif": "1.3.0",
|
"sherif": "1.3.0",
|
||||||
"std-env": "3.8.0",
|
"std-env": "3.8.0",
|
||||||
"tinyexec": "0.3.2",
|
"tinyexec": "0.3.2",
|
||||||
"tinyglobby": "0.2.10",
|
"tinyglobby": "0.2.11",
|
||||||
"ts-blank-space": "0.6.0",
|
"ts-blank-space": "0.6.0",
|
||||||
"typescript": "5.7.3",
|
"typescript": "5.7.3",
|
||||||
"ufo": "1.5.4",
|
"ufo": "1.5.4",
|
||||||
@ -133,9 +133,9 @@
|
|||||||
"vitest": "3.0.5",
|
"vitest": "3.0.5",
|
||||||
"vitest-environment-nuxt": "1.0.1",
|
"vitest-environment-nuxt": "1.0.1",
|
||||||
"vue": "3.5.13",
|
"vue": "3.5.13",
|
||||||
"vue-tsc": "2.2.0",
|
"vue-tsc": "2.2.2",
|
||||||
"webpack": "5.98.0"
|
"webpack": "5.98.0"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.3.0",
|
"packageManager": "pnpm@10.4.1",
|
||||||
"version": ""
|
"version": ""
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
"std-env": "^3.8.0",
|
"std-env": "^3.8.0",
|
||||||
"ufo": "^1.5.4",
|
"ufo": "^1.5.4",
|
||||||
"unctx": "^2.4.1",
|
"unctx": "^2.4.1",
|
||||||
"unimport": "^4.1.1",
|
"unimport": "^4.1.2",
|
||||||
"untyped": "^1.5.2"
|
"untyped": "^1.5.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -34,7 +34,7 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
|
|||||||
delete (globalThis as any).defineNuxtConfig
|
delete (globalThis as any).defineNuxtConfig
|
||||||
|
|
||||||
// Fill config
|
// Fill config
|
||||||
nuxtConfig.rootDir = nuxtConfig.rootDir || cwd
|
nuxtConfig.rootDir ||= cwd
|
||||||
nuxtConfig._nuxtConfigFile = configFile
|
nuxtConfig._nuxtConfigFile = configFile
|
||||||
nuxtConfig._nuxtConfigFiles = [configFile]
|
nuxtConfig._nuxtConfigFiles = [configFile]
|
||||||
nuxtConfig.alias ||= {}
|
nuxtConfig.alias ||= {}
|
||||||
@ -64,7 +64,7 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
|
|||||||
for (const layer of layers) {
|
for (const layer of layers) {
|
||||||
// Resolve `rootDir` & `srcDir` of layers
|
// Resolve `rootDir` & `srcDir` of layers
|
||||||
layer.config ||= {}
|
layer.config ||= {}
|
||||||
layer.config.rootDir = layer.config.rootDir ?? layer.cwd!
|
layer.config.rootDir ??= layer.cwd!
|
||||||
|
|
||||||
// Only process/resolve layers once
|
// Only process/resolve layers once
|
||||||
if (processedLayers.has(layer.config.rootDir)) { continue }
|
if (processedLayers.has(layer.config.rootDir)) { continue }
|
||||||
|
@ -72,9 +72,7 @@ export async function findPath (paths: string | string[], opts?: ResolvePathOpti
|
|||||||
* Resolve path aliases respecting Nuxt alias options
|
* Resolve path aliases respecting Nuxt alias options
|
||||||
*/
|
*/
|
||||||
export function resolveAlias (path: string, alias?: Record<string, string>): string {
|
export function resolveAlias (path: string, alias?: Record<string, string>): string {
|
||||||
if (!alias) {
|
alias ||= tryUseNuxt()?.options.alias || {}
|
||||||
alias = tryUseNuxt()?.options.alias || {}
|
|
||||||
}
|
|
||||||
return _resolveAlias(path, alias)
|
return _resolveAlias(path, alias)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,7 @@ export function normalizeTemplate<T> (template: NuxtTemplate<T> | string, buildD
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve dst
|
// Resolve dst
|
||||||
if (!template.dst) {
|
template.dst ||= resolve(buildDir ?? useNuxt().options.buildDir, template.filename)
|
||||||
template.dst = resolve(buildDir ?? useNuxt().options.buildDir, template.filename)
|
|
||||||
}
|
|
||||||
|
|
||||||
return template as ResolvedNuxtTemplate<T>
|
return template as ResolvedNuxtTemplate<T>
|
||||||
}
|
}
|
||||||
|
@ -66,15 +66,15 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/cli": "^3.21.1",
|
"@nuxt/cli": "^3.21.1",
|
||||||
"@nuxt/devalue": "^2.0.2",
|
"@nuxt/devalue": "^2.0.2",
|
||||||
"@nuxt/devtools": "^2.0.0",
|
"@nuxt/devtools": "^2.1.0",
|
||||||
"@nuxt/kit": "workspace:*",
|
"@nuxt/kit": "workspace:*",
|
||||||
"@nuxt/schema": "workspace:*",
|
"@nuxt/schema": "workspace:*",
|
||||||
"@nuxt/telemetry": "^2.6.5",
|
"@nuxt/telemetry": "^2.6.5",
|
||||||
"@nuxt/vite-builder": "workspace:*",
|
"@nuxt/vite-builder": "workspace:*",
|
||||||
"@unhead/dom": "^1.11.18",
|
"@unhead/dom": "^1.11.19",
|
||||||
"@unhead/shared": "^1.11.18",
|
"@unhead/shared": "^1.11.19",
|
||||||
"@unhead/ssr": "^1.11.18",
|
"@unhead/ssr": "^1.11.19",
|
||||||
"@unhead/vue": "^1.11.18",
|
"@unhead/vue": "^1.11.19",
|
||||||
"@vue/shared": "^3.5.13",
|
"@vue/shared": "^3.5.13",
|
||||||
"acorn": "8.14.0",
|
"acorn": "8.14.0",
|
||||||
"c12": "^2.0.2",
|
"c12": "^2.0.2",
|
||||||
@ -113,14 +113,14 @@
|
|||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
"std-env": "^3.8.0",
|
"std-env": "^3.8.0",
|
||||||
"strip-literal": "^3.0.0",
|
"strip-literal": "^3.0.0",
|
||||||
"tinyglobby": "0.2.10",
|
"tinyglobby": "0.2.11",
|
||||||
"ufo": "^1.5.4",
|
"ufo": "^1.5.4",
|
||||||
"ultrahtml": "^1.5.3",
|
"ultrahtml": "^1.5.3",
|
||||||
"uncrypto": "^0.1.3",
|
"uncrypto": "^0.1.3",
|
||||||
"unctx": "^2.4.1",
|
"unctx": "^2.4.1",
|
||||||
"unenv": "^1.10.0",
|
"unenv": "^1.10.0",
|
||||||
"unhead": "^1.11.18",
|
"unhead": "^1.11.19",
|
||||||
"unimport": "^4.1.1",
|
"unimport": "^4.1.2",
|
||||||
"unplugin": "^2.2.0",
|
"unplugin": "^2.2.0",
|
||||||
"unplugin-vue-router": "^0.11.2",
|
"unplugin-vue-router": "^0.11.2",
|
||||||
"unstorage": "^1.14.4",
|
"unstorage": "^1.14.4",
|
||||||
@ -131,7 +131,7 @@
|
|||||||
"vue-router": "^4.5.0"
|
"vue-router": "^4.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/scripts": "0.10.1",
|
"@nuxt/scripts": "0.10.3",
|
||||||
"@parcel/watcher": "2.5.1",
|
"@parcel/watcher": "2.5.1",
|
||||||
"@types/estree": "1.0.6",
|
"@types/estree": "1.0.6",
|
||||||
"@vitejs/plugin-vue": "5.2.1",
|
"@vitejs/plugin-vue": "5.2.1",
|
||||||
|
@ -59,9 +59,9 @@ export function createClientOnly<T extends ComponentOptions> (component: T) {
|
|||||||
}
|
}
|
||||||
return elToStaticVNode(ctx._.vnode.el, STATIC_DIV)
|
return elToStaticVNode(ctx._.vnode.el, STATIC_DIV)
|
||||||
}
|
}
|
||||||
} else if (clone.template) {
|
} else {
|
||||||
// handle runtime-compiler template
|
// handle runtime-compiler template
|
||||||
clone.template = `
|
clone.template &&= `
|
||||||
<template v-if="mounted$">${component.template}</template>
|
<template v-if="mounted$">${component.template}</template>
|
||||||
<template v-else>${STATIC_DIV}</template>
|
<template v-else>${STATIC_DIV}</template>
|
||||||
`
|
`
|
||||||
|
@ -197,12 +197,10 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchComponent (force = false) {
|
async function fetchComponent (force = false) {
|
||||||
nuxtApp[pKey] = nuxtApp[pKey] || {}
|
nuxtApp[pKey] ||= {}
|
||||||
if (!nuxtApp[pKey][uid.value]) {
|
nuxtApp[pKey][uid.value] ||= _fetchComponent(force).finally(() => {
|
||||||
nuxtApp[pKey][uid.value] = _fetchComponent(force).finally(() => {
|
delete nuxtApp[pKey]![uid.value]
|
||||||
delete nuxtApp[pKey]![uid.value]
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const res: NuxtIslandResponse = await nuxtApp[pKey][uid.value]
|
const res: NuxtIslandResponse = await nuxtApp[pKey][uid.value]
|
||||||
|
|
||||||
|
@ -506,15 +506,13 @@ function useObserver (): { observe: ObserveFn } | undefined {
|
|||||||
const callbacks = new Map<Element, CallbackFn>()
|
const callbacks = new Map<Element, CallbackFn>()
|
||||||
|
|
||||||
const observe: ObserveFn = (element, callback) => {
|
const observe: ObserveFn = (element, callback) => {
|
||||||
if (!observer) {
|
observer ||= new IntersectionObserver((entries) => {
|
||||||
observer = new IntersectionObserver((entries) => {
|
for (const entry of entries) {
|
||||||
for (const entry of entries) {
|
const callback = callbacks.get(entry.target)
|
||||||
const callback = callbacks.get(entry.target)
|
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0
|
||||||
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0
|
if (isVisible && callback) { callback() }
|
||||||
if (isVisible && callback) { callback() }
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
callbacks.set(element, callback)
|
callbacks.set(element, callback)
|
||||||
observer.observe(element)
|
observer.observe(element)
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -230,14 +230,14 @@ export function useAsyncData<
|
|||||||
const getDefaultCachedData = () => nuxtApp.isHydrating ? nuxtApp.payload.data[key] : nuxtApp.static.data[key]
|
const getDefaultCachedData = () => nuxtApp.isHydrating ? nuxtApp.payload.data[key] : nuxtApp.static.data[key]
|
||||||
|
|
||||||
// Apply defaults
|
// Apply defaults
|
||||||
options.server = options.server ?? true
|
options.server ??= true
|
||||||
options.default = options.default ?? (getDefault as () => DefaultT)
|
options.default ??= getDefault as () => DefaultT
|
||||||
options.getCachedData = options.getCachedData ?? getDefaultCachedData
|
options.getCachedData ??= getDefaultCachedData
|
||||||
|
|
||||||
options.lazy = options.lazy ?? false
|
options.lazy ??= false
|
||||||
options.immediate = options.immediate ?? true
|
options.immediate ??= true
|
||||||
options.deep = options.deep ?? asyncDataDefaults.deep
|
options.deep ??= asyncDataDefaults.deep
|
||||||
options.dedupe = options.dedupe ?? 'cancel'
|
options.dedupe ??= 'cancel'
|
||||||
|
|
||||||
// Create or use a shared asyncData entity
|
// Create or use a shared asyncData entity
|
||||||
const initialCachedData = options.getCachedData!(key, nuxtApp)
|
const initialCachedData = options.getCachedData!(key, nuxtApp)
|
||||||
|
@ -31,7 +31,7 @@ export const showError = <DataT = unknown>(
|
|||||||
nuxtApp.hooks.callHook('app:error', nuxtError)
|
nuxtApp.hooks.callHook('app:error', nuxtError)
|
||||||
}
|
}
|
||||||
|
|
||||||
error.value = error.value || nuxtError
|
error.value ||= nuxtError
|
||||||
} catch {
|
} catch {
|
||||||
throw nuxtError
|
throw nuxtError
|
||||||
}
|
}
|
||||||
|
@ -170,9 +170,9 @@ export function useLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}):
|
|||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
// Initialise global loading indicator if it doesn't exist already
|
// Initialise global loading indicator if it doesn't exist already
|
||||||
const indicator = nuxtApp._loadingIndicator = nuxtApp._loadingIndicator || createLoadingIndicator(opts)
|
const indicator = nuxtApp._loadingIndicator ||= createLoadingIndicator(opts)
|
||||||
if (import.meta.client && getCurrentScope()) {
|
if (import.meta.client && getCurrentScope()) {
|
||||||
nuxtApp._loadingIndicatorDeps = nuxtApp._loadingIndicatorDeps || 0
|
nuxtApp._loadingIndicatorDeps ||= 0
|
||||||
nuxtApp._loadingIndicatorDeps++
|
nuxtApp._loadingIndicatorDeps++
|
||||||
onScopeDispose(() => {
|
onScopeDispose(() => {
|
||||||
nuxtApp._loadingIndicatorDeps!--
|
nuxtApp._loadingIndicatorDeps!--
|
||||||
|
@ -38,7 +38,7 @@ export async function callOnce (...args: any): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nuxtApp._once ||= {}
|
nuxtApp._once ||= {}
|
||||||
nuxtApp._once[_key] = nuxtApp._once[_key] || fn() || true
|
nuxtApp._once[_key] ||= fn() || true
|
||||||
await nuxtApp._once[_key]
|
await nuxtApp._once[_key]
|
||||||
nuxtApp.payload.once.add(_key)
|
nuxtApp.payload.once.add(_key)
|
||||||
delete nuxtApp._once[_key]
|
delete nuxtApp._once[_key]
|
||||||
|
@ -21,7 +21,7 @@ export async function loadPayload (url: string, opts: LoadPayloadOptions = {}):
|
|||||||
if (import.meta.server || !payloadExtraction) { return null }
|
if (import.meta.server || !payloadExtraction) { return null }
|
||||||
const payloadURL = await _getPayloadURL(url, opts)
|
const payloadURL = await _getPayloadURL(url, opts)
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
const cache = nuxtApp._payloadCache = nuxtApp._payloadCache || {}
|
const cache = nuxtApp._payloadCache ||= {}
|
||||||
if (payloadURL in cache) {
|
if (payloadURL in cache) {
|
||||||
return cache[payloadURL] || null
|
return cache[payloadURL] || null
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,10 @@ export async function preloadRouteComponents (to: RouteLocationRaw, router: Rout
|
|||||||
const { path, matched } = router.resolve(to)
|
const { path, matched } = router.resolve(to)
|
||||||
|
|
||||||
if (!matched.length) { return }
|
if (!matched.length) { return }
|
||||||
if (!router._routePreloaded) { router._routePreloaded = new Set() }
|
router._routePreloaded ||= new Set()
|
||||||
if (router._routePreloaded.has(path)) { return }
|
if (router._routePreloaded.has(path)) { return }
|
||||||
|
|
||||||
const promises = router._preloadPromises = router._preloadPromises || []
|
const promises = router._preloadPromises ||= []
|
||||||
|
|
||||||
if (promises.length > 4) {
|
if (promises.length > 4) {
|
||||||
// Defer adding new preload requests until the existing ones have resolved
|
// Defer adding new preload requests until the existing ones have resolved
|
||||||
|
@ -69,12 +69,12 @@ export function useRouteAnnouncer (opts: Partial<NuxtRouteAnnouncerOpts> = {}):
|
|||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
// Initialise global route announcer if it doesn't exist already
|
// Initialise global route announcer if it doesn't exist already
|
||||||
const announcer = nuxtApp._routeAnnouncer = nuxtApp._routeAnnouncer || createRouteAnnouncer(opts)
|
const announcer = nuxtApp._routeAnnouncer ||= createRouteAnnouncer(opts)
|
||||||
if (opts.politeness !== announcer.politeness.value) {
|
if (opts.politeness !== announcer.politeness.value) {
|
||||||
announcer.politeness.value = opts.politeness || 'polite'
|
announcer.politeness.value = opts.politeness || 'polite'
|
||||||
}
|
}
|
||||||
if (import.meta.client && getCurrentScope()) {
|
if (import.meta.client && getCurrentScope()) {
|
||||||
nuxtApp._routeAnnouncerDeps = nuxtApp._routeAnnouncerDeps || 0
|
nuxtApp._routeAnnouncerDeps ||= 0
|
||||||
nuxtApp._routeAnnouncerDeps++
|
nuxtApp._routeAnnouncerDeps++
|
||||||
onScopeDispose(() => {
|
onScopeDispose(() => {
|
||||||
nuxtApp._routeAnnouncerDeps!--
|
nuxtApp._routeAnnouncerDeps!--
|
||||||
|
@ -117,9 +117,7 @@ export interface NavigateToOptions {
|
|||||||
const URL_QUOTE_RE = /"/g
|
const URL_QUOTE_RE = /"/g
|
||||||
/** @since 3.0.0 */
|
/** @since 3.0.0 */
|
||||||
export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: NavigateToOptions): Promise<void | NavigationFailure | false> | false | void | RouteLocationRaw => {
|
export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: NavigateToOptions): Promise<void | NavigationFailure | false> | false | void | RouteLocationRaw => {
|
||||||
if (!to) {
|
to ||= '/'
|
||||||
to = '/'
|
|
||||||
}
|
|
||||||
|
|
||||||
const toPath = typeof to === 'string' ? to : 'path' in to ? resolveRouteObject(to) : useRouter().resolve(to).href
|
const toPath = typeof to === 'string' ? to : 'path' in to ? resolveRouteObject(to) : useRouter().resolve(to).href
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ function deepAssign (obj: any, newObj: any) {
|
|||||||
const val = newObj[key]
|
const val = newObj[key]
|
||||||
if (isPojoOrArray(val)) {
|
if (isPojoOrArray(val)) {
|
||||||
const defaultVal = Array.isArray(val) ? [] : {}
|
const defaultVal = Array.isArray(val) ? [] : {}
|
||||||
obj[key] = obj[key] || defaultVal
|
obj[key] ||= defaultVal
|
||||||
deepAssign(obj[key], val)
|
deepAssign(obj[key], val)
|
||||||
} else {
|
} else {
|
||||||
obj[key] = val
|
obj[key] = val
|
||||||
@ -48,9 +48,7 @@ function deepAssign (obj: any, newObj: any) {
|
|||||||
|
|
||||||
export function useAppConfig (): AppConfig {
|
export function useAppConfig (): AppConfig {
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
if (!nuxtApp._appConfig) {
|
nuxtApp._appConfig ||= (import.meta.server ? klona(__appConfig) : reactive(__appConfig)) as AppConfig
|
||||||
nuxtApp._appConfig = (import.meta.server ? klona(__appConfig) : reactive(__appConfig)) as AppConfig
|
|
||||||
}
|
|
||||||
return nuxtApp._appConfig
|
return nuxtApp._appConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ if (import.meta.server) {
|
|||||||
await nuxt.hooks.callHook('app:created', vueApp)
|
await nuxt.hooks.callHook('app:created', vueApp)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await nuxt.hooks.callHook('app:error', error)
|
await nuxt.hooks.callHook('app:error', error)
|
||||||
nuxt.payload.error = nuxt.payload.error || createError(error as any)
|
nuxt.payload.error ||= createError(error as any)
|
||||||
}
|
}
|
||||||
if (ssrContext?._renderResponse) { throw new Error('skipping render') }
|
if (ssrContext?._renderResponse) { throw new Error('skipping render') }
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ if (import.meta.client) {
|
|||||||
|
|
||||||
async function handleVueError (error: any) {
|
async function handleVueError (error: any) {
|
||||||
await nuxt.callHook('app:error', error)
|
await nuxt.callHook('app:error', error)
|
||||||
nuxt.payload.error = nuxt.payload.error || createError(error as any)
|
nuxt.payload.error ||= createError(error as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
vueApp.config.errorHandler = handleVueError
|
vueApp.config.errorHandler = handleVueError
|
||||||
|
@ -377,7 +377,7 @@ export function createNuxtApp (options: CreateOptions) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
window.useNuxtApp = window.useNuxtApp || useNuxtApp
|
window.useNuxtApp ||= useNuxtApp
|
||||||
|
|
||||||
// Log errors captured when running plugins, in the `app:created` and `app:beforeMount` hooks
|
// Log errors captured when running plugins, in the `app:created` and `app:beforeMount` hooks
|
||||||
// as well as when mounting the app.
|
// as well as when mounting the app.
|
||||||
|
@ -21,7 +21,7 @@ if (componentIslands) {
|
|||||||
revivers.push(['Island', ({ key, params, result }: any) => {
|
revivers.push(['Island', ({ key, params, result }: any) => {
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
if (!nuxtApp.isHydrating) {
|
if (!nuxtApp.isHydrating) {
|
||||||
nuxtApp.payload.data[key] = nuxtApp.payload.data[key] || $fetch(`/__nuxt_island/${key}.json`, {
|
nuxtApp.payload.data[key] ||= $fetch(`/__nuxt_island/${key}.json`, {
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
...params ? { params } : {},
|
...params ? { params } : {},
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
|
@ -230,7 +230,7 @@ export default defineNuxtPlugin<{ route: Route, router: Router }>({
|
|||||||
nuxtApp._route = route
|
nuxtApp._route = route
|
||||||
|
|
||||||
// Handle middleware
|
// Handle middleware
|
||||||
nuxtApp._middleware = nuxtApp._middleware || {
|
nuxtApp._middleware ||= {
|
||||||
global: [],
|
global: [],
|
||||||
named: {},
|
named: {},
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ function pageToClientOnly<T extends ComponentOptions> (component: T) {
|
|||||||
clone.render = (ctx: any, cache: any, $props: any, $setup: any, $data: any, $options: any) => ($setup.mounted$ ?? ctx.mounted$)
|
clone.render = (ctx: any, cache: any, $props: any, $setup: any, $data: any, $options: any) => ($setup.mounted$ ?? ctx.mounted$)
|
||||||
? h(component.render?.bind(ctx)(ctx, cache, $props, $setup, $data, $options))
|
? h(component.render?.bind(ctx)(ctx, cache, $props, $setup, $data, $options))
|
||||||
: h('div')
|
: h('div')
|
||||||
} else if (clone.template) {
|
} else {
|
||||||
// handle runtime-compiler template
|
// handle runtime-compiler template
|
||||||
clone.template = `
|
clone.template &&= `
|
||||||
<template v-if="mounted$">${component.template}</template>
|
<template v-if="mounted$">${component.template}</template>
|
||||||
<template v-else><div></div></template>
|
<template v-else><div></div></template>
|
||||||
`
|
`
|
||||||
|
@ -136,29 +136,21 @@ async function compileTemplate<T> (template: NuxtTemplate<T>, ctx: { nuxt: Nuxt,
|
|||||||
|
|
||||||
export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
||||||
// Resolve main (app.vue)
|
// Resolve main (app.vue)
|
||||||
if (!app.mainComponent) {
|
app.mainComponent ||= await findPath(
|
||||||
app.mainComponent = await findPath(
|
nuxt.options._layers.flatMap(layer => [
|
||||||
nuxt.options._layers.flatMap(layer => [
|
join(layer.config.srcDir, 'App'),
|
||||||
join(layer.config.srcDir, 'App'),
|
join(layer.config.srcDir, 'app'),
|
||||||
join(layer.config.srcDir, 'app'),
|
]),
|
||||||
]),
|
)
|
||||||
)
|
app.mainComponent ||= resolve(nuxt.options.appDir, 'components/welcome.vue')
|
||||||
}
|
|
||||||
if (!app.mainComponent) {
|
|
||||||
app.mainComponent = resolve(nuxt.options.appDir, 'components/welcome.vue')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve root component
|
// Resolve root component
|
||||||
if (!app.rootComponent) {
|
app.rootComponent ||= await findPath(['~/app.root', resolve(nuxt.options.appDir, 'components/nuxt-root.vue')])
|
||||||
app.rootComponent = await findPath(['~/app.root', resolve(nuxt.options.appDir, 'components/nuxt-root.vue')])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve error component
|
// Resolve error component
|
||||||
if (!app.errorComponent) {
|
app.errorComponent ||= (await findPath(
|
||||||
app.errorComponent = (await findPath(
|
nuxt.options._layers.map(layer => join(layer.config.srcDir, 'error')),
|
||||||
nuxt.options._layers.map(layer => join(layer.config.srcDir, 'error')),
|
)) ?? resolve(nuxt.options.appDir, 'components/nuxt-error-page.vue')
|
||||||
)) ?? resolve(nuxt.options.appDir, 'components/nuxt-error-page.vue')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve layouts/ from all config layers
|
// Resolve layouts/ from all config layers
|
||||||
const layerConfigs = nuxt.options._layers.map(layer => layer.config)
|
const layerConfigs = nuxt.options._layers.map(layer => layer.config)
|
||||||
@ -174,7 +166,7 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
|||||||
logger.warn(`No layout name could be resolved for \`~/${relative(nuxt.options.srcDir, file)}\`. Bear in mind that \`index\` is ignored for the purpose of creating a layout name.`)
|
logger.warn(`No layout name could be resolved for \`~/${relative(nuxt.options.srcDir, file)}\`. Bear in mind that \`index\` is ignored for the purpose of creating a layout name.`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
app.layouts[name] = app.layouts[name] || { name, file }
|
app.layouts[name] ||= { name, file }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,7 +942,7 @@ function createPortalProperties (sourceValue: any, options: NuxtOptions, paths:
|
|||||||
|
|
||||||
while (segments.length) {
|
while (segments.length) {
|
||||||
const key = segments.shift()!
|
const key = segments.shift()!
|
||||||
parent = parent[key] || (parent[key] = {})
|
parent = parent[key] ||= {}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete parent[key]
|
delete parent[key]
|
||||||
|
@ -70,7 +70,7 @@ export async function extractMetadata (code: string, loader = 'ts' as 'ts' | 'ts
|
|||||||
meta = defu(extractMetaFromObject(plugin.properties), meta)
|
meta = defu(extractMetaFromObject(plugin.properties), meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.order = meta.order || orderMap[meta.enforce || 'default'] || orderMap.default
|
meta.order ||= orderMap[meta.enforce || 'default'] || orderMap.default
|
||||||
delete meta.enforce
|
delete meta.enforce
|
||||||
})
|
})
|
||||||
metaCache[code] = meta
|
metaCache[code] = meta
|
||||||
|
@ -11,9 +11,7 @@ export function useAppConfig (event?: H3Event) {
|
|||||||
if (!event) {
|
if (!event) {
|
||||||
return _sharedAppConfig
|
return _sharedAppConfig
|
||||||
}
|
}
|
||||||
if (!event.context.nuxt) {
|
event.context.nuxt ||= {}
|
||||||
event.context.nuxt = {}
|
|
||||||
}
|
|
||||||
// Reuse cached app config from event context
|
// Reuse cached app config from event context
|
||||||
if (event.context.nuxt.appConfig) {
|
if (event.context.nuxt.appConfig) {
|
||||||
return event.context.nuxt.appConfig
|
return event.context.nuxt.appConfig
|
||||||
|
@ -167,7 +167,7 @@ const getSPARenderer = lazyCachedFunction(async () => {
|
|||||||
|
|
||||||
const renderToString = (ssrContext: NuxtSSRContext) => {
|
const renderToString = (ssrContext: NuxtSSRContext) => {
|
||||||
const config = useRuntimeConfig(ssrContext.event)
|
const config = useRuntimeConfig(ssrContext.event)
|
||||||
ssrContext.modules = ssrContext.modules || new Set<string>()
|
ssrContext.modules ||= new Set<string>()
|
||||||
ssrContext.payload.serverRendered = false
|
ssrContext.payload.serverRendered = false
|
||||||
ssrContext.config = {
|
ssrContext.config = {
|
||||||
public: config.public,
|
public: config.public,
|
||||||
|
@ -135,7 +135,7 @@ export default defineNuxtModule<Partial<ImportsOptions>>({
|
|||||||
fileFilter: file => !isIgnored(file),
|
fileFilter: file => !isIgnored(file),
|
||||||
})
|
})
|
||||||
for (const i of scannedImports) {
|
for (const i of scannedImports) {
|
||||||
i.priority = i.priority || priorities.find(([dir]) => i.from.startsWith(dir))?.[1]
|
i.priority ||= priorities.find(([dir]) => i.from.startsWith(dir))?.[1]
|
||||||
}
|
}
|
||||||
imports.push(...scannedImports)
|
imports.push(...scannedImports)
|
||||||
}
|
}
|
||||||
|
@ -269,9 +269,7 @@ export default defineNuxtModule({
|
|||||||
}
|
}
|
||||||
|
|
||||||
nuxt.hooks.hookOnce('app:templates', async (app) => {
|
nuxt.hooks.hookOnce('app:templates', async (app) => {
|
||||||
if (!app.pages) {
|
app.pages ||= await resolvePagesRoutes(nuxt)
|
||||||
app.pages = await resolvePagesRoutes(nuxt)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
nuxt.hook('builder:watch', async (event, relativePath) => {
|
nuxt.hook('builder:watch', async (event, relativePath) => {
|
||||||
|
@ -29,9 +29,7 @@ export const RouteInjectionPlugin = (nuxt: Nuxt) => createUnplugin(() => {
|
|||||||
const start = match.index!
|
const start = match.index!
|
||||||
const end = start + match[0].length
|
const end = start + match[0].length
|
||||||
s.overwrite(start, end, replacement)
|
s.overwrite(start, end, replacement)
|
||||||
if (!replaced) {
|
replaced ||= true
|
||||||
replaced = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ const plugin: Plugin<{ router: Router }> = defineNuxtPlugin({
|
|||||||
|
|
||||||
nuxtApp._route = shallowReactive(route)
|
nuxtApp._route = shallowReactive(route)
|
||||||
|
|
||||||
nuxtApp._middleware = nuxtApp._middleware || {
|
nuxtApp._middleware ||= {
|
||||||
global: [],
|
global: [],
|
||||||
named: {},
|
named: {},
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ export function extractScriptContent (sfc: string) {
|
|||||||
for (const match of sfc.matchAll(SFC_SCRIPT_RE)) {
|
for (const match of sfc.matchAll(SFC_SCRIPT_RE)) {
|
||||||
if (match?.groups?.content) {
|
if (match?.groups?.content) {
|
||||||
contents.push({
|
contents.push({
|
||||||
loader: match.groups.attrs?.includes('tsx') ? 'tsx' : 'ts',
|
loader: match.groups.attrs && /[tj]sx/.test(match.groups.attrs) ? 'tsx' : 'ts',
|
||||||
code: match.groups.content.trim(),
|
code: match.groups.content.trim(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,19 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should parse lang="jsx" from vue files', async () => {
|
||||||
|
const fileContents = `
|
||||||
|
<script setup lang="jsx">
|
||||||
|
const foo = <></>;
|
||||||
|
definePageMeta({ name: 'bar' })
|
||||||
|
</script>`
|
||||||
|
|
||||||
|
const meta = await getRouteMeta(fileContents, `/app/pages/index.vue`)
|
||||||
|
expect(meta).toStrictEqual({
|
||||||
|
name: 'bar',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// TODO: https://github.com/nuxt/nuxt/pull/30066
|
// TODO: https://github.com/nuxt/nuxt/pull/30066
|
||||||
it.todo('should handle experimental decorators', async () => {
|
it.todo('should handle experimental decorators', async () => {
|
||||||
const fileContents = `
|
const fileContents = `
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
"@types/pify": "5.0.4",
|
"@types/pify": "5.0.4",
|
||||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||||
"@types/webpack-hot-middleware": "2.25.9",
|
"@types/webpack-hot-middleware": "2.25.9",
|
||||||
"rollup": "4.34.6",
|
"rollup": "4.34.8",
|
||||||
"unbuild": "3.3.1",
|
"unbuild": "3.3.1",
|
||||||
"vue": "3.5.13"
|
"vue": "3.5.13"
|
||||||
},
|
},
|
||||||
|
@ -40,12 +40,12 @@
|
|||||||
"@types/rollup-plugin-visualizer": "4.2.4",
|
"@types/rollup-plugin-visualizer": "4.2.4",
|
||||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||||
"@types/webpack-hot-middleware": "2.25.9",
|
"@types/webpack-hot-middleware": "2.25.9",
|
||||||
"@unhead/schema": "1.11.18",
|
"@unhead/schema": "1.11.19",
|
||||||
"@vitejs/plugin-vue": "5.2.1",
|
"@vitejs/plugin-vue": "5.2.1",
|
||||||
"@vitejs/plugin-vue-jsx": "4.1.1",
|
"@vitejs/plugin-vue-jsx": "4.1.1",
|
||||||
"@vue/compiler-core": "3.5.13",
|
"@vue/compiler-core": "3.5.13",
|
||||||
"@vue/compiler-sfc": "3.5.13",
|
"@vue/compiler-sfc": "3.5.13",
|
||||||
"@vue/language-core": "2.2.0",
|
"@vue/language-core": "2.2.2",
|
||||||
"c12": "2.0.2",
|
"c12": "2.0.2",
|
||||||
"chokidar": "4.0.3",
|
"chokidar": "4.0.3",
|
||||||
"compatx": "0.1.8",
|
"compatx": "0.1.8",
|
||||||
@ -61,11 +61,11 @@
|
|||||||
"ofetch": "1.4.1",
|
"ofetch": "1.4.1",
|
||||||
"pkg-types": "1.3.1",
|
"pkg-types": "1.3.1",
|
||||||
"postcss": "8.5.2",
|
"postcss": "8.5.2",
|
||||||
"sass-loader": "16.0.4",
|
"sass-loader": "16.0.5",
|
||||||
"scule": "1.3.0",
|
"scule": "1.3.0",
|
||||||
"unbuild": "3.3.1",
|
"unbuild": "3.3.1",
|
||||||
"unctx": "2.4.1",
|
"unctx": "2.4.1",
|
||||||
"unimport": "4.1.1",
|
"unimport": "4.1.2",
|
||||||
"untyped": "1.5.2",
|
"untyped": "1.5.2",
|
||||||
"vite": "6.1.0",
|
"vite": "6.1.0",
|
||||||
"vue": "3.5.13",
|
"vue": "3.5.13",
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
"prerender": "pnpm build && jiti ./lib/prerender"
|
"prerender": "pnpm build && jiti ./lib/prerender"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@unocss/reset": "65.4.3",
|
"@unocss/reset": "66.0.0",
|
||||||
"beasties": "0.2.0",
|
"beasties": "0.2.0",
|
||||||
"html-validate": "9.2.2",
|
"html-validate": "9.3.0",
|
||||||
"htmlnano": "2.1.1",
|
"htmlnano": "2.1.1",
|
||||||
"jiti": "2.4.2",
|
"jiti": "2.4.2",
|
||||||
"knitwork": "1.2.0",
|
"knitwork": "1.2.0",
|
||||||
@ -28,8 +28,8 @@
|
|||||||
"scule": "1.3.0",
|
"scule": "1.3.0",
|
||||||
"svgo": "3.3.2",
|
"svgo": "3.3.2",
|
||||||
"tinyexec": "0.3.2",
|
"tinyexec": "0.3.2",
|
||||||
"tinyglobby": "0.2.10",
|
"tinyglobby": "0.2.11",
|
||||||
"unocss": "65.4.3",
|
"unocss": "66.0.0",
|
||||||
"vite": "6.1.0"
|
"vite": "6.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/schema": "workspace:*",
|
"@nuxt/schema": "workspace:*",
|
||||||
"rollup": "4.34.6",
|
"rollup": "4.34.8",
|
||||||
"unbuild": "3.3.1",
|
"unbuild": "3.3.1",
|
||||||
"vue": "3.5.13"
|
"vue": "3.5.13"
|
||||||
},
|
},
|
||||||
|
@ -39,13 +39,9 @@ export async function writeManifest (ctx: ViteBuildContext) {
|
|||||||
const BASE_RE = new RegExp(`^${escapeRE(buildAssetsDir)}`)
|
const BASE_RE = new RegExp(`^${escapeRE(buildAssetsDir)}`)
|
||||||
|
|
||||||
for (const entry of manifestEntries) {
|
for (const entry of manifestEntries) {
|
||||||
if (entry.file) {
|
entry.file &&= entry.file.replace(BASE_RE, '')
|
||||||
entry.file = entry.file.replace(BASE_RE, '')
|
|
||||||
}
|
|
||||||
for (const item of ['css', 'assets'] as const) {
|
for (const item of ['css', 'assets'] as const) {
|
||||||
if (entry[item]) {
|
entry[item] &&= entry[item].map((i: string) => i.replace(BASE_RE, ''))
|
||||||
entry[item] = entry[item].map((i: string) => i.replace(BASE_RE, ''))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
"@types/pify": "5.0.4",
|
"@types/pify": "5.0.4",
|
||||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||||
"@types/webpack-hot-middleware": "2.25.9",
|
"@types/webpack-hot-middleware": "2.25.9",
|
||||||
"rollup": "4.34.6",
|
"rollup": "4.34.8",
|
||||||
"unbuild": "3.3.1",
|
"unbuild": "3.3.1",
|
||||||
"vue": "3.5.13"
|
"vue": "3.5.13"
|
||||||
},
|
},
|
||||||
|
@ -104,9 +104,7 @@ export default class VueSSRClientPlugin {
|
|||||||
if (Array.isArray(m.modules)) {
|
if (Array.isArray(m.modules)) {
|
||||||
for (const concatenatedModule of m.modules) {
|
for (const concatenatedModule of m.modules) {
|
||||||
const id = hash(concatenatedModule.identifier!.replace(/\s\w+$/, ''))
|
const id = hash(concatenatedModule.identifier!.replace(/\s\w+$/, ''))
|
||||||
if (!webpackManifest.modules[id]) {
|
webpackManifest.modules[id] ||= files
|
||||||
webpackManifest.modules[id] = files
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ function createCssLoadersRule (ctx: WebpackConfigContext, cssLoaderOptions: any)
|
|||||||
if (ctx.isServer) {
|
if (ctx.isServer) {
|
||||||
// https://webpack.js.org/loaders/css-loader/#exportonlylocals
|
// https://webpack.js.org/loaders/css-loader/#exportonlylocals
|
||||||
if (cssLoader.options.modules) {
|
if (cssLoader.options.modules) {
|
||||||
cssLoader.options.modules.exportOnlyLocals = cssLoader.options.modules.exportOnlyLocals ?? true
|
cssLoader.options.modules.exportOnlyLocals ??= true
|
||||||
}
|
}
|
||||||
return [cssLoader]
|
return [cssLoader]
|
||||||
}
|
}
|
||||||
|
1447
pnpm-lock.yaml
1447
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@ export async function loadPackage (dir: string) {
|
|||||||
const dep: Dep = { name: e[0], range: e[1] as string, type }
|
const dep: Dep = { name: e[0], range: e[1] as string, type }
|
||||||
delete data[type][dep.name]
|
delete data[type][dep.name]
|
||||||
const updated = reviver(dep) || dep
|
const updated = reviver(dep) || dep
|
||||||
data[updated.type] = data[updated.type] || {}
|
data[updated.type] ||= {}
|
||||||
data[updated.type][updated.name] = updated.range
|
data[updated.type][updated.name] = updated.range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2405,9 +2405,7 @@ describe('component islands', () => {
|
|||||||
for (const key in result.head) {
|
for (const key in result.head) {
|
||||||
if (key === 'link') {
|
if (key === 'link') {
|
||||||
result.head[key] = result.head[key]?.map((h) => {
|
result.head[key] = result.head[key]?.map((h) => {
|
||||||
if (h.href) {
|
h.href &&= resolveUnrefHeadInput(h.href).replace(fixtureDir, '/<rootDir>').replaceAll('//', '/')
|
||||||
h.href = resolveUnrefHeadInput(h.href).replace(fixtureDir, '/<rootDir>').replaceAll('//', '/')
|
|
||||||
}
|
|
||||||
return h
|
return h
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -2800,16 +2798,12 @@ function normaliseIslandResult (result: NuxtIslandResponse) {
|
|||||||
if (result.head.style) {
|
if (result.head.style) {
|
||||||
for (const style of result.head.style) {
|
for (const style of result.head.style) {
|
||||||
if (typeof style !== 'string') {
|
if (typeof style !== 'string') {
|
||||||
if (style.innerHTML) {
|
style.innerHTML &&=
|
||||||
style.innerHTML =
|
|
||||||
(style.innerHTML as string)
|
(style.innerHTML as string)
|
||||||
.replace(/data-v-[a-z0-9]+/g, 'data-v-xxxxx')
|
.replace(/data-v-[a-z0-9]+/g, 'data-v-xxxxx')
|
||||||
// Vite 6 enables CSS minify by default for SSR
|
// Vite 6 enables CSS minify by default for SSR
|
||||||
.replace(/blue/, '#00f')
|
.replace(/blue/, '#00f')
|
||||||
}
|
style.key &&= style.key.replace(/-[a-z0-9]+$/i, '')
|
||||||
if (style.key) {
|
|
||||||
style.key = style.key.replace(/-[a-z0-9]+$/i, '')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user