mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-21 16:09:52 +00:00
Compare commits
8 Commits
f97189b1d8
...
fd25b58e8f
Author | SHA1 | Date | |
---|---|---|---|
|
fd25b58e8f | ||
|
160efe7a7f | ||
|
323745d0d4 | ||
|
c96bf6048e | ||
|
203c6b14ff | ||
|
be28c16104 | ||
|
78887bca23 | ||
|
3cd8a04cfc |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -236,7 +236,7 @@ jobs:
|
||||
path: packages
|
||||
|
||||
- name: Run benchmarks
|
||||
uses: CodSpeedHQ/action@da7c57859a7a565a3a92789ac64c41aca031ca1f # v3.3.0
|
||||
uses: CodSpeedHQ/action@1015f4f828ff74b7a950909897fe581d6ba868cc # v3.3.1
|
||||
with:
|
||||
run: pnpm vitest bench
|
||||
token: ${{ secrets.CODSPEED_TOKEN }}
|
||||
|
@ -332,7 +332,7 @@ globalThis.Buffer = globalThis.Buffer || Buffer
|
||||
|
||||
## scanPageMeta
|
||||
|
||||
This option allows exposing some route metadata defined in `definePageMeta` at build-time to modules (specifically `alias`, `name`, `path`, `redirect`).
|
||||
This option allows exposing some route metadata defined in `definePageMeta` at build-time to modules (specifically `alias`, `name`, `path`, `redirect`, `props` and `middleware`).
|
||||
|
||||
This only works with static or strings/arrays rather than variables or conditional assignment. See [original issue](https://github.com/nuxt/nuxt/issues/24770) for more information and context.
|
||||
|
||||
|
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"
|
||||
},
|
||||
"resolutions": {
|
||||
"@babel/core": "7.26.8",
|
||||
"@babel/core": "7.26.9",
|
||||
"@babel/helper-plugin-utils": "7.26.5",
|
||||
"@nuxt/cli": "3.21.1",
|
||||
"@nuxt/kit": "workspace:*",
|
||||
@ -45,12 +45,12 @@
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@nuxt/webpack-builder": "workspace:*",
|
||||
"@types/node": "22.13.2",
|
||||
"@unhead/dom": "1.11.18",
|
||||
"@unhead/schema": "1.11.18",
|
||||
"@unhead/shared": "1.11.18",
|
||||
"@unhead/ssr": "1.11.18",
|
||||
"@unhead/vue": "1.11.18",
|
||||
"@types/node": "22.13.4",
|
||||
"@unhead/dom": "1.11.19",
|
||||
"@unhead/schema": "1.11.19",
|
||||
"@unhead/shared": "1.11.19",
|
||||
"@unhead/ssr": "1.11.19",
|
||||
"@unhead/vue": "1.11.19",
|
||||
"@vue/compiler-core": "3.5.13",
|
||||
"@vue/compiler-dom": "3.5.13",
|
||||
"@vue/shared": "3.5.13",
|
||||
@ -62,19 +62,19 @@
|
||||
"nuxt": "workspace:*",
|
||||
"ohash": "1.1.4",
|
||||
"postcss": "8.5.2",
|
||||
"rollup": "4.34.6",
|
||||
"rollup": "4.34.8",
|
||||
"send": ">=1.1.0",
|
||||
"typescript": "5.7.3",
|
||||
"ufo": "1.5.4",
|
||||
"unbuild": "3.3.1",
|
||||
"unhead": "1.11.18",
|
||||
"unimport": "4.1.1",
|
||||
"unhead": "1.11.19",
|
||||
"unimport": "4.1.2",
|
||||
"vite": "6.1.0",
|
||||
"vue": "3.5.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "0.17.3",
|
||||
"@babel/core": "7.26.8",
|
||||
"@babel/core": "7.26.9",
|
||||
"@babel/helper-plugin-utils": "7.26.5",
|
||||
"@codspeed/vitest-plugin": "4.0.0",
|
||||
"@nuxt/cli": "3.21.1",
|
||||
@ -86,10 +86,10 @@
|
||||
"@testing-library/vue": "8.1.0",
|
||||
"@types/babel__core": "7.20.5",
|
||||
"@types/babel__helper-plugin-utils": "7.10.3",
|
||||
"@types/node": "22.13.2",
|
||||
"@types/node": "22.13.4",
|
||||
"@types/semver": "7.5.8",
|
||||
"@unhead/schema": "1.11.18",
|
||||
"@unhead/vue": "1.11.18",
|
||||
"@unhead/schema": "1.11.19",
|
||||
"@unhead/vue": "1.11.19",
|
||||
"@vitest/coverage-v8": "3.0.5",
|
||||
"@vue/test-utils": "2.4.6",
|
||||
"acorn": "8.14.0",
|
||||
@ -120,12 +120,12 @@
|
||||
"pathe": "2.0.3",
|
||||
"pkg-pr-new": "0.0.39",
|
||||
"playwright-core": "1.50.1",
|
||||
"rollup": "4.34.6",
|
||||
"rollup": "4.34.8",
|
||||
"semver": "7.7.1",
|
||||
"sherif": "1.3.0",
|
||||
"std-env": "3.8.0",
|
||||
"tinyexec": "0.3.2",
|
||||
"tinyglobby": "0.2.10",
|
||||
"tinyglobby": "0.2.11",
|
||||
"ts-blank-space": "0.6.0",
|
||||
"typescript": "5.7.3",
|
||||
"ufo": "1.5.4",
|
||||
@ -133,9 +133,9 @@
|
||||
"vitest": "3.0.5",
|
||||
"vitest-environment-nuxt": "1.0.1",
|
||||
"vue": "3.5.13",
|
||||
"vue-tsc": "2.2.0",
|
||||
"vue-tsc": "2.2.2",
|
||||
"webpack": "5.98.0"
|
||||
},
|
||||
"packageManager": "pnpm@10.3.0",
|
||||
"packageManager": "pnpm@10.4.1",
|
||||
"version": ""
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
"std-env": "^3.8.0",
|
||||
"ufo": "^1.5.4",
|
||||
"unctx": "^2.4.1",
|
||||
"unimport": "^4.1.1",
|
||||
"unimport": "^4.1.2",
|
||||
"untyped": "^1.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -66,15 +66,15 @@
|
||||
"dependencies": {
|
||||
"@nuxt/cli": "^3.21.1",
|
||||
"@nuxt/devalue": "^2.0.2",
|
||||
"@nuxt/devtools": "^2.0.0",
|
||||
"@nuxt/devtools": "^2.1.0",
|
||||
"@nuxt/kit": "workspace:*",
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@nuxt/telemetry": "^2.6.5",
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@unhead/dom": "^1.11.18",
|
||||
"@unhead/shared": "^1.11.18",
|
||||
"@unhead/ssr": "^1.11.18",
|
||||
"@unhead/vue": "^1.11.18",
|
||||
"@unhead/dom": "^1.11.19",
|
||||
"@unhead/shared": "^1.11.19",
|
||||
"@unhead/ssr": "^1.11.19",
|
||||
"@unhead/vue": "^1.11.19",
|
||||
"@vue/shared": "^3.5.13",
|
||||
"acorn": "8.14.0",
|
||||
"c12": "^2.0.2",
|
||||
@ -113,14 +113,14 @@
|
||||
"semver": "^7.7.1",
|
||||
"std-env": "^3.8.0",
|
||||
"strip-literal": "^3.0.0",
|
||||
"tinyglobby": "0.2.10",
|
||||
"tinyglobby": "0.2.11",
|
||||
"ufo": "^1.5.4",
|
||||
"ultrahtml": "^1.5.3",
|
||||
"uncrypto": "^0.1.3",
|
||||
"unctx": "^2.4.1",
|
||||
"unenv": "^1.10.0",
|
||||
"unhead": "^1.11.18",
|
||||
"unimport": "^4.1.1",
|
||||
"unhead": "^1.11.19",
|
||||
"unimport": "^4.1.2",
|
||||
"unplugin": "^2.2.0",
|
||||
"unplugin-vue-router": "^0.11.2",
|
||||
"unstorage": "^1.14.4",
|
||||
@ -131,7 +131,7 @@
|
||||
"vue-router": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/scripts": "0.10.1",
|
||||
"@nuxt/scripts": "0.10.3",
|
||||
"@parcel/watcher": "2.5.1",
|
||||
"@types/estree": "1.0.6",
|
||||
"@vitejs/plugin-vue": "5.2.1",
|
||||
|
@ -202,7 +202,7 @@ export function extractScriptContent (sfc: string) {
|
||||
}
|
||||
|
||||
const PAGE_META_RE = /definePageMeta\([\s\S]*?\)/
|
||||
const defaultExtractionKeys = ['name', 'path', 'props', 'alias', 'redirect'] as const
|
||||
const defaultExtractionKeys = ['name', 'path', 'props', 'alias', 'redirect', 'middleware'] as const
|
||||
const DYNAMIC_META_KEY = '__nuxt_dynamic_meta_key' as const
|
||||
|
||||
const pageContentsCache: Record<string, string> = {}
|
||||
@ -254,6 +254,10 @@ export async function getRouteMeta (contents: string, absolutePath: string, extr
|
||||
if (!property) { continue }
|
||||
|
||||
const propertyValue = withLocations(property.value)
|
||||
|
||||
if (key === 'middleware') {
|
||||
dynamicProperties.add('meta')
|
||||
}
|
||||
|
||||
if (propertyValue.type === 'ObjectExpression') {
|
||||
const valueString = js.code.slice(propertyValue.start, propertyValue.end)
|
||||
|
@ -124,9 +124,11 @@ definePageMeta({ name: 'bar' })
|
||||
"meta": {
|
||||
"__nuxt_dynamic_meta_key": Set {
|
||||
"props",
|
||||
"middleware",
|
||||
"meta",
|
||||
},
|
||||
},
|
||||
"middleware": [],
|
||||
"name": "some-custom-name",
|
||||
"path": "/some-custom-path",
|
||||
"props": {
|
||||
@ -162,9 +164,11 @@ definePageMeta({ name: 'bar' })
|
||||
{
|
||||
"meta": {
|
||||
"__nuxt_dynamic_meta_key": Set {
|
||||
"middleware",
|
||||
"meta",
|
||||
},
|
||||
},
|
||||
"middleware": [],
|
||||
"name": "some-custom-name",
|
||||
"path": "/some-custom-path",
|
||||
}
|
||||
@ -190,7 +194,7 @@ definePageMeta({ name: 'bar' })
|
||||
{
|
||||
"meta": {
|
||||
"__nuxt_dynamic_meta_key": Set {
|
||||
"meta",
|
||||
"middleware",
|
||||
},
|
||||
},
|
||||
"name": "some-custom-name",
|
||||
|
@ -75,7 +75,7 @@
|
||||
"@types/pify": "5.0.4",
|
||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||
"@types/webpack-hot-middleware": "2.25.9",
|
||||
"rollup": "4.34.6",
|
||||
"rollup": "4.34.8",
|
||||
"unbuild": "3.3.1",
|
||||
"vue": "3.5.13"
|
||||
},
|
||||
|
@ -40,12 +40,12 @@
|
||||
"@types/rollup-plugin-visualizer": "4.2.4",
|
||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||
"@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-jsx": "4.1.1",
|
||||
"@vue/compiler-core": "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",
|
||||
"chokidar": "4.0.3",
|
||||
"compatx": "0.1.8",
|
||||
@ -61,11 +61,11 @@
|
||||
"ofetch": "1.4.1",
|
||||
"pkg-types": "1.3.1",
|
||||
"postcss": "8.5.2",
|
||||
"sass-loader": "16.0.4",
|
||||
"sass-loader": "16.0.5",
|
||||
"scule": "1.3.0",
|
||||
"unbuild": "3.3.1",
|
||||
"unctx": "2.4.1",
|
||||
"unimport": "4.1.1",
|
||||
"unimport": "4.1.2",
|
||||
"untyped": "1.5.2",
|
||||
"vite": "6.1.0",
|
||||
"vue": "3.5.13",
|
||||
|
@ -325,7 +325,7 @@ export default defineResolvers({
|
||||
inlineRouteRules: false,
|
||||
|
||||
/**
|
||||
* Allow exposing some route metadata defined in `definePageMeta` at build-time to modules (alias, name, path, redirect).
|
||||
* Allow exposing some route metadata defined in `definePageMeta` at build-time to modules (alias, name, path, redirect, props, middleware).
|
||||
*
|
||||
* This only works with static or strings/arrays rather than variables or conditional assignment.
|
||||
*
|
||||
|
@ -34,6 +34,7 @@ export type NuxtPage = {
|
||||
alias?: string[] | string
|
||||
redirect?: RouteLocationRaw
|
||||
children?: NuxtPage[]
|
||||
middleware?: string[] | string
|
||||
/**
|
||||
* Set the render mode.
|
||||
*
|
||||
|
@ -17,9 +17,9 @@
|
||||
"prerender": "pnpm build && jiti ./lib/prerender"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@unocss/reset": "65.4.3",
|
||||
"@unocss/reset": "66.0.0",
|
||||
"beasties": "0.2.0",
|
||||
"html-validate": "9.2.2",
|
||||
"html-validate": "9.3.0",
|
||||
"htmlnano": "2.1.1",
|
||||
"jiti": "2.4.2",
|
||||
"knitwork": "1.2.0",
|
||||
@ -28,8 +28,8 @@
|
||||
"scule": "1.3.0",
|
||||
"svgo": "3.3.2",
|
||||
"tinyexec": "0.3.2",
|
||||
"tinyglobby": "0.2.10",
|
||||
"unocss": "65.4.3",
|
||||
"tinyglobby": "0.2.11",
|
||||
"unocss": "66.0.0",
|
||||
"vite": "6.1.0"
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"rollup": "4.34.6",
|
||||
"rollup": "4.34.8",
|
||||
"unbuild": "3.3.1",
|
||||
"vue": "3.5.13"
|
||||
},
|
||||
|
@ -77,7 +77,7 @@
|
||||
"@types/pify": "5.0.4",
|
||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||
"@types/webpack-hot-middleware": "2.25.9",
|
||||
"rollup": "4.34.6",
|
||||
"rollup": "4.34.8",
|
||||
"unbuild": "3.3.1",
|
||||
"vue": "3.5.13"
|
||||
},
|
||||
|
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