mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-22 08:29:46 +00:00
Compare commits
15 Commits
324577f627
...
d53f8845a0
Author | SHA1 | Date | |
---|---|---|---|
|
d53f8845a0 | ||
|
160efe7a7f | ||
|
323745d0d4 | ||
|
b435af1f58 | ||
|
16984b7c7e | ||
|
c6c4f4efc8 | ||
|
f5bb1aad1c | ||
|
e155e0483e | ||
|
6613d9fedf | ||
|
f2a9a568b0 | ||
|
9b501e1dd3 | ||
|
ee6f91b7e3 | ||
|
dc4d032246 | ||
|
f49c0497ad | ||
|
83465c241a |
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 }}
|
||||||
|
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": {
|
||||||
|
@ -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",
|
||||||
|
@ -33,7 +33,8 @@ async function loadComponents (source = appBaseURL, paths: NuxtIslandResponse['c
|
|||||||
|
|
||||||
const promises: Array<Promise<void>> = []
|
const promises: Array<Promise<void>> = []
|
||||||
|
|
||||||
for (const [component, item] of Object.entries(paths)) {
|
for (const component in paths) {
|
||||||
|
const item = paths[component]!
|
||||||
if (!(components!.has(component))) {
|
if (!(components!.has(component))) {
|
||||||
promises.push((async () => {
|
promises.push((async () => {
|
||||||
const chunkSource = joinURL(source, item.chunk)
|
const chunkSource = joinURL(source, item.chunk)
|
||||||
@ -146,10 +147,10 @@ export default defineComponent({
|
|||||||
html = html.replace(ISLAND_SCOPE_ID_RE, full => full + ' ' + props.scopeId)
|
html = html.replace(ISLAND_SCOPE_ID_RE, full => full + ' ' + props.scopeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.client && !canLoadClientComponent.value) {
|
if (import.meta.client && !canLoadClientComponent.value && payloads.components) {
|
||||||
for (const [key, value] of Object.entries(payloads.components || {})) {
|
for (const key in payloads.components) {
|
||||||
html = html.replace(new RegExp(` data-island-uid="${uid.value}" data-island-component="${key}"[^>]*>`), (full) => {
|
html = html.replace(new RegExp(` data-island-uid="${uid.value}" data-island-component="${key}"[^>]*>`), (full) => {
|
||||||
return full + value.html
|
return full + payloads.components![key]!.html
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,8 +288,8 @@ export default defineComponent({
|
|||||||
if (selectiveClient) {
|
if (selectiveClient) {
|
||||||
if (import.meta.server) {
|
if (import.meta.server) {
|
||||||
if (payloads.components) {
|
if (payloads.components) {
|
||||||
for (const [id, info] of Object.entries(payloads.components)) {
|
for (const id in payloads.components) {
|
||||||
const { html, slots } = info
|
const { html, slots } = payloads.components[id]!
|
||||||
let replaced = html.replaceAll('data-island-uid', `data-island-uid="${uid.value}"`)
|
let replaced = html.replaceAll('data-island-uid', `data-island-uid="${uid.value}"`)
|
||||||
for (const slot in slots) {
|
for (const slot in slots) {
|
||||||
replaced = replaced.replaceAll(`data-island-slot="${slot}">`, full => full + slots[slot])
|
replaced = replaced.replaceAll(`data-island-slot="${slot}">`, full => full + slots[slot])
|
||||||
@ -299,8 +300,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (canLoadClientComponent.value && payloads.components) {
|
} else if (canLoadClientComponent.value && payloads.components) {
|
||||||
for (const [id, info] of Object.entries(payloads.components)) {
|
for (const id in payloads.components) {
|
||||||
const { props, slots } = info
|
const { props, slots } = payloads.components[id]!
|
||||||
const component = components!.get(id)!
|
const component = components!.get(id)!
|
||||||
// use different selectors for even and odd teleportKey to force trigger the teleport
|
// use different selectors for even and odd teleportKey to force trigger the teleport
|
||||||
const vnode = createVNode(Teleport, { to: `${isKeyOdd ? 'div' : ''}[data-island-uid='${uid.value}'][data-island-component="${id}"]` }, {
|
const vnode = createVNode(Teleport, { to: `${isKeyOdd ? 'div' : ''}[data-island-uid='${uid.value}'][data-island-component="${id}"]` }, {
|
||||||
|
@ -250,8 +250,8 @@ function generateOptionSegments<_ResT, DataT, DefaultT> (opts: UseFetchOptions<_
|
|||||||
if (!obj) { continue }
|
if (!obj) { continue }
|
||||||
|
|
||||||
const unwrapped: Record<string, string> = {}
|
const unwrapped: Record<string, string> = {}
|
||||||
for (const [key, value] of Object.entries(obj)) {
|
for (const key in obj) {
|
||||||
unwrapped[toValue(key)] = toValue(value)
|
unwrapped[toValue(key)] = toValue(obj[key])
|
||||||
}
|
}
|
||||||
segments.push(unwrapped)
|
segments.push(unwrapped)
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,8 @@ export default defineNuxtModule<ComponentsOptions>({
|
|||||||
nuxt.hook('build:manifest', (manifest) => {
|
nuxt.hook('build:manifest', (manifest) => {
|
||||||
const sourceFiles = getComponents().filter(c => c.global).map(c => relative(nuxt.options.srcDir, c.filePath))
|
const sourceFiles = getComponents().filter(c => c.global).map(c => relative(nuxt.options.srcDir, c.filePath))
|
||||||
|
|
||||||
for (const chunk of Object.values(manifest)) {
|
for (const chunkId in manifest) {
|
||||||
|
const chunk = manifest[chunkId]!
|
||||||
if (chunk.isEntry) {
|
if (chunk.isEntry) {
|
||||||
chunk.dynamicImports =
|
chunk.dynamicImports =
|
||||||
chunk.dynamicImports?.filter(i => !sourceFiles.includes(i))
|
chunk.dynamicImports?.filter(i => !sourceFiles.includes(i))
|
||||||
|
@ -211,7 +211,8 @@ export const ComponentsChunkPlugin = createUnplugin((options: ComponentChunkOpti
|
|||||||
async generateBundle (_opts, bundle) {
|
async generateBundle (_opts, bundle) {
|
||||||
const components = options.getComponents().filter(c => c.mode === 'client' || c.mode === 'all')
|
const components = options.getComponents().filter(c => c.mode === 'client' || c.mode === 'all')
|
||||||
const pathAssociation: Record<string, string> = {}
|
const pathAssociation: Record<string, string> = {}
|
||||||
for (const [chunkPath, chunkInfo] of Object.entries(bundle)) {
|
for (const chunkPath in bundle) {
|
||||||
|
const chunkInfo = bundle[chunkPath]!
|
||||||
if (chunkInfo.type !== 'chunk') { continue }
|
if (chunkInfo.type !== 'chunk') { continue }
|
||||||
|
|
||||||
for (const component of components) {
|
for (const component of components) {
|
||||||
|
@ -449,7 +449,8 @@ async function initNuxt (nuxt: Nuxt) {
|
|||||||
// TODO: [Experimental] Avoid emitting assets when flag is enabled
|
// TODO: [Experimental] Avoid emitting assets when flag is enabled
|
||||||
if (nuxt.options.features.noScripts && !nuxt.options.dev) {
|
if (nuxt.options.features.noScripts && !nuxt.options.dev) {
|
||||||
nuxt.hook('build:manifest', async (manifest) => {
|
nuxt.hook('build:manifest', async (manifest) => {
|
||||||
for (const chunk of Object.values(manifest)) {
|
for (const chunkId in manifest) {
|
||||||
|
const chunk = manifest[chunkId]!
|
||||||
if (chunk.resourceType === 'script') {
|
if (chunk.resourceType === 'script') {
|
||||||
await rm(resolve(nuxt.options.buildDir, 'dist/client', withoutLeadingSlash(nuxt.options.app.buildAssetsDir), chunk.file), { force: true })
|
await rm(resolve(nuxt.options.buildDir, 'dist/client', withoutLeadingSlash(nuxt.options.app.buildAssetsDir), chunk.file), { force: true })
|
||||||
chunk.file = ''
|
chunk.file = ''
|
||||||
|
@ -412,7 +412,8 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
|||||||
}
|
}
|
||||||
if (!isRenderingIsland || import.meta.dev) {
|
if (!isRenderingIsland || import.meta.dev) {
|
||||||
const link: Link[] = []
|
const link: Link[] = []
|
||||||
for (const resource of Object.values(styles)) {
|
for (const resourceId in styles) {
|
||||||
|
const resource = styles[resourceId]!
|
||||||
// Do not add links to resources that are inlined (vite v5+)
|
// Do not add links to resources that are inlined (vite v5+)
|
||||||
if (import.meta.dev && 'inline' in getURLQuery(resource.file)) {
|
if (import.meta.dev && 'inline' in getURLQuery(resource.file)) {
|
||||||
continue
|
continue
|
||||||
@ -478,7 +479,9 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
|||||||
if (isRenderingIsland && islandContext) {
|
if (isRenderingIsland && islandContext) {
|
||||||
const islandHead: Head = {}
|
const islandHead: Head = {}
|
||||||
for (const entry of head.headEntries()) {
|
for (const entry of head.headEntries()) {
|
||||||
for (const [key, value] of Object.entries(resolveUnrefHeadInput(entry.input) as Head)) {
|
const currentEntry = resolveUnrefHeadInput(entry.input)
|
||||||
|
for (const key in currentEntry as Head) {
|
||||||
|
const value = currentEntry[key]
|
||||||
const currentValue = islandHead[key as keyof Head]
|
const currentValue = islandHead[key as keyof Head]
|
||||||
if (Array.isArray(currentValue)) {
|
if (Array.isArray(currentValue)) {
|
||||||
currentValue.push(...value)
|
currentValue.push(...value)
|
||||||
@ -677,9 +680,9 @@ const SSR_CLIENT_SLOT_MARKER = /^island-slot=([^;]*);(.*)$/
|
|||||||
function getSlotIslandResponse (ssrContext: NuxtSSRContext): NuxtIslandResponse['slots'] {
|
function getSlotIslandResponse (ssrContext: NuxtSSRContext): NuxtIslandResponse['slots'] {
|
||||||
if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.slots).length) { return undefined }
|
if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.slots).length) { return undefined }
|
||||||
const response: NuxtIslandResponse['slots'] = {}
|
const response: NuxtIslandResponse['slots'] = {}
|
||||||
for (const [name, slot] of Object.entries(ssrContext.islandContext.slots)) {
|
for (const name in ssrContext.islandContext.slots) {
|
||||||
response[name] = {
|
response[name] = {
|
||||||
...slot,
|
...ssrContext.islandContext.slots[name]!,
|
||||||
fallback: ssrContext.teleports?.[`island-fallback=${name}`],
|
fallback: ssrContext.teleports?.[`island-fallback=${name}`],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -690,11 +693,11 @@ function getClientIslandResponse (ssrContext: NuxtSSRContext): NuxtIslandRespons
|
|||||||
if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.components).length) { return undefined }
|
if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.components).length) { return undefined }
|
||||||
const response: NuxtIslandResponse['components'] = {}
|
const response: NuxtIslandResponse['components'] = {}
|
||||||
|
|
||||||
for (const [clientUid, component] of Object.entries(ssrContext.islandContext.components)) {
|
for (const clientUid in ssrContext.islandContext.components) {
|
||||||
// remove teleport anchor to avoid hydration issues
|
// remove teleport anchor to avoid hydration issues
|
||||||
const html = ssrContext.teleports?.[clientUid]?.replaceAll('<!--teleport start anchor-->', '') || ''
|
const html = ssrContext.teleports?.[clientUid]?.replaceAll('<!--teleport start anchor-->', '') || ''
|
||||||
response[clientUid] = {
|
response[clientUid] = {
|
||||||
...component,
|
...ssrContext.islandContext.components[clientUid]!,
|
||||||
html,
|
html,
|
||||||
slots: getComponentSlotTeleport(clientUid, ssrContext.teleports ?? {}),
|
slots: getComponentSlotTeleport(clientUid, ssrContext.teleports ?? {}),
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,8 @@ export default defineNuxtModule({
|
|||||||
nuxt.hook('pages:extend', (routes) => {
|
nuxt.hook('pages:extend', (routes) => {
|
||||||
const nitro = useNitro()
|
const nitro = useNitro()
|
||||||
let resolvedRoutes: string[]
|
let resolvedRoutes: string[]
|
||||||
for (const [path, rule] of Object.entries(nitro.options.routeRules)) {
|
for (const path in nitro.options.routeRules) {
|
||||||
|
const rule = nitro.options.routeRules[path]!
|
||||||
if (!rule.redirect) { continue }
|
if (!rule.redirect) { continue }
|
||||||
resolvedRoutes ||= routes.flatMap(route => resolveRoutePaths(route))
|
resolvedRoutes ||= routes.flatMap(route => resolveRoutePaths(route))
|
||||||
// skip if there's already a route matching this path
|
// skip if there's already a route matching this path
|
||||||
@ -496,7 +497,8 @@ export default defineNuxtModule({
|
|||||||
if (nuxt.options.dev) { return }
|
if (nuxt.options.dev) { return }
|
||||||
const sourceFiles = nuxt.apps.default?.pages?.length ? getSources(nuxt.apps.default.pages) : []
|
const sourceFiles = nuxt.apps.default?.pages?.length ? getSources(nuxt.apps.default.pages) : []
|
||||||
|
|
||||||
for (const [key, chunk] of Object.entries(manifest)) {
|
for (const key in manifest) {
|
||||||
|
const chunk = manifest[key]!
|
||||||
if (chunk.src && Object.values(nuxt.apps).some(app => app.pages?.some(page => page.mode === 'server' && page.file === join(nuxt.options.srcDir, chunk.src!)))) {
|
if (chunk.src && Object.values(nuxt.apps).some(app => app.pages?.some(page => page.mode === 'server' && page.file === join(nuxt.options.srcDir, chunk.src!)))) {
|
||||||
delete manifest[key]
|
delete manifest[key]
|
||||||
continue
|
continue
|
||||||
|
@ -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"
|
||||||
},
|
},
|
||||||
|
@ -18,7 +18,8 @@ export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
|||||||
const bundle = outputBundle[_bundleId]
|
const bundle = outputBundle[_bundleId]
|
||||||
if (!bundle || bundle.type !== 'chunk') { continue }
|
if (!bundle || bundle.type !== 'chunk') { continue }
|
||||||
const minifiedModuleEntryPromises: Array<Promise<[string, RenderedModule]>> = []
|
const minifiedModuleEntryPromises: Array<Promise<[string, RenderedModule]>> = []
|
||||||
for (const [moduleId, module] of Object.entries(bundle.modules)) {
|
for (const moduleId in bundle.modules) {
|
||||||
|
const module = bundle.modules[moduleId]!
|
||||||
minifiedModuleEntryPromises.push(
|
minifiedModuleEntryPromises.push(
|
||||||
transform(module.code || '', { minify: true })
|
transform(module.code || '', { minify: true })
|
||||||
.then(result => [moduleId, { ...module, code: result.code }]),
|
.then(result => [moduleId, { ...module, code: result.code }]),
|
||||||
|
@ -14,7 +14,8 @@ export const createSourcemapPreserver = () => {
|
|||||||
outputDir = config.build.outDir
|
outputDir = config.build.outDir
|
||||||
},
|
},
|
||||||
async writeBundle (_options, bundle) {
|
async writeBundle (_options, bundle) {
|
||||||
for (const chunk of Object.values(bundle)) {
|
for (const chunkId in bundle) {
|
||||||
|
const chunk = bundle[chunkId]!
|
||||||
if (chunk.type !== 'chunk' || !chunk.map) { continue }
|
if (chunk.type !== 'chunk' || !chunk.map) { continue }
|
||||||
|
|
||||||
const id = resolve(outputDir, chunk.fileName)
|
const id = resolve(outputDir, chunk.fileName)
|
||||||
|
@ -87,7 +87,8 @@ export const VitePublicDirsPlugin = createUnplugin((options: VitePublicDirsPlugi
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
generateBundle (_outputOptions, bundle) {
|
generateBundle (_outputOptions, bundle) {
|
||||||
for (const [file, chunk] of Object.entries(bundle)) {
|
for (const file in bundle) {
|
||||||
|
const chunk = bundle[file]!
|
||||||
if (!file.endsWith('.css') || chunk.type !== 'asset') { continue }
|
if (!file.endsWith('.css') || chunk.type !== 'asset') { continue }
|
||||||
|
|
||||||
let css = chunk.source.toString()
|
let css = chunk.source.toString()
|
||||||
|
@ -62,7 +62,8 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin {
|
|||||||
if (options.mode === 'client') { return }
|
if (options.mode === 'client') { return }
|
||||||
|
|
||||||
const emitted: Record<string, string> = {}
|
const emitted: Record<string, string> = {}
|
||||||
for (const [file, { files, inBundle }] of Object.entries(cssMap)) {
|
for (const file in cssMap) {
|
||||||
|
const { files, inBundle } = cssMap[file]!
|
||||||
// File has been tree-shaken out of build (or there are no styles to inline)
|
// File has been tree-shaken out of build (or there are no styles to inline)
|
||||||
if (!files.length || !inBundle) { continue }
|
if (!files.length || !inBundle) { continue }
|
||||||
const fileName = filename(file)
|
const fileName = filename(file)
|
||||||
|
@ -197,7 +197,8 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
|
|||||||
|
|
||||||
// Remove CSS entries for files that will have inlined styles
|
// Remove CSS entries for files that will have inlined styles
|
||||||
ctx.nuxt.hook('build:manifest', (manifest) => {
|
ctx.nuxt.hook('build:manifest', (manifest) => {
|
||||||
for (const [key, entry] of Object.entries(manifest)) {
|
for (const key in manifest) {
|
||||||
|
const entry = manifest[key]!
|
||||||
const shouldRemoveCSS = chunksWithInlinedCSS.has(key) && !entry.isEntry
|
const shouldRemoveCSS = chunksWithInlinedCSS.has(key) && !entry.isEntry
|
||||||
if (entry.isEntry && chunksWithInlinedCSS.has(key)) {
|
if (entry.isEntry && chunksWithInlinedCSS.has(key)) {
|
||||||
// @ts-expect-error internal key
|
// @ts-expect-error internal key
|
||||||
|
@ -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"
|
||||||
},
|
},
|
||||||
|
@ -33,7 +33,8 @@ export default class VueSSRClientPlugin {
|
|||||||
const stats = compilation.getStats().toJson()
|
const stats = compilation.getStats().toJson()
|
||||||
|
|
||||||
const initialFiles = new Set<string>()
|
const initialFiles = new Set<string>()
|
||||||
for (const { assets } of Object.values(stats.entrypoints!)) {
|
for (const assetId in stats.entrypoints!) {
|
||||||
|
const { assets } = stats.entrypoints[assetId]!
|
||||||
if (!assets) { continue }
|
if (!assets) { continue }
|
||||||
|
|
||||||
for (const asset of assets) {
|
for (const asset of assets) {
|
||||||
|
1447
pnpm-lock.yaml
1447
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user