mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
Merge branch 'main' into fix/20667-omit-usefetch-body-for-get-method
This commit is contained in:
commit
82353c1c3e
@ -1,4 +1,4 @@
|
||||
FROM node:lts@sha256:0e910f435308c36ea60b4cfd7b80208044d77a074d16b768a81901ce938a62dc
|
||||
FROM node:lts@sha256:1f097426a7ddd1c5d0eacfe0402fdf91e38e4ecc37d23780428f6b87145ad2aa
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -fy libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdbus-1-3 libdrm2 libxkbcommon0 libatspi2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 && \
|
||||
|
@ -166,6 +166,55 @@ export default createConfigForNuxt({
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
// manually specify dependencies for nuxt browser app
|
||||
{
|
||||
files: ['packages/nuxt/src/app/**', 'packages/nuxt/src/(components,head,imports,pages)/runtime/**'],
|
||||
name: 'local/client-packages',
|
||||
rules: {
|
||||
'@typescript-eslint/no-restricted-imports': ['error', {
|
||||
'patterns': [
|
||||
{
|
||||
allowTypeImports: true,
|
||||
group: [
|
||||
// disallow everything
|
||||
'[@a-z]*',
|
||||
// except certain dependencies
|
||||
...[
|
||||
// vue ecosystem
|
||||
'@unhead',
|
||||
'@vue',
|
||||
'@vue/shared',
|
||||
'vue/server-renderer',
|
||||
'vue',
|
||||
'vue-router',
|
||||
// other deps
|
||||
'devalue',
|
||||
'klona',
|
||||
// unjs ecosystem
|
||||
'defu',
|
||||
'ufo',
|
||||
'h3',
|
||||
'destr',
|
||||
'consola',
|
||||
'hookable',
|
||||
'unctx',
|
||||
'cookie-es',
|
||||
'perfect-debounce',
|
||||
'radix3',
|
||||
'ohash',
|
||||
'pathe',
|
||||
'uncrypto',
|
||||
// internal deps
|
||||
'nuxt/app',
|
||||
].map(r => `!${r}`),
|
||||
'!#[a-z]*/**', // aliases
|
||||
'!.*/**', // relative imports
|
||||
],
|
||||
},
|
||||
],
|
||||
}],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/fixtures/**', '**/fixture/**'],
|
||||
name: 'local/disables/fixtures',
|
||||
|
@ -173,7 +173,9 @@ export const PageMetaPlugin = (options: PageMetaPluginOptions = {}) => createUnp
|
||||
}
|
||||
}
|
||||
|
||||
const scopeTracker = new ScopeTracker()
|
||||
const scopeTracker = new ScopeTracker({
|
||||
keepExitedScopes: true,
|
||||
})
|
||||
|
||||
function processDeclaration (scopeTrackerNode: ScopeTrackerNode | null) {
|
||||
if (scopeTrackerNode?.type === 'Variable') {
|
||||
@ -210,7 +212,13 @@ export const PageMetaPlugin = (options: PageMetaPluginOptions = {}) => createUnp
|
||||
}
|
||||
}
|
||||
|
||||
parseAndWalk(code, id, {
|
||||
const ast = parseAndWalk(code, id, {
|
||||
scopeTracker,
|
||||
})
|
||||
|
||||
scopeTracker.freeze()
|
||||
|
||||
walk(ast, {
|
||||
scopeTracker,
|
||||
enter: (node) => {
|
||||
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier') { return }
|
||||
@ -221,6 +229,7 @@ export const PageMetaPlugin = (options: PageMetaPluginOptions = {}) => createUnp
|
||||
if (!meta) { return }
|
||||
|
||||
walk(meta, {
|
||||
scopeTracker,
|
||||
enter (node, parent) {
|
||||
if (
|
||||
isNotReferencePosition(node, parent)
|
||||
|
@ -497,6 +497,8 @@ function recursive () {
|
||||
recursive()
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
definePageMeta({
|
||||
middleware: [
|
||||
() => {
|
||||
@ -513,9 +515,19 @@ definePageMeta({
|
||||
prop = 'prop'
|
||||
test () {}
|
||||
}
|
||||
|
||||
console.log(hoisted.value)
|
||||
},
|
||||
],
|
||||
validate: (route) => {
|
||||
return route.params.id === 'test'
|
||||
}
|
||||
})
|
||||
|
||||
// the order of a ref relative to the 'definePageMeta' call should be preserved (in contrast to a simple const)
|
||||
// this tests whether the extraction handles all variables in the upper scope
|
||||
const hoisted = ref('hoisted')
|
||||
|
||||
</script>
|
||||
`
|
||||
const res = compileScript(parse(sfc).descriptor, { id: 'component.vue' })
|
||||
@ -534,6 +546,7 @@ definePageMeta({
|
||||
function recursive () {
|
||||
recursive()
|
||||
}
|
||||
const hoisted = ref('hoisted')
|
||||
const __nuxt_page_meta = {
|
||||
middleware: [
|
||||
() => {
|
||||
@ -550,8 +563,13 @@ definePageMeta({
|
||||
prop = 'prop'
|
||||
test () {}
|
||||
}
|
||||
|
||||
console.log(hoisted.value)
|
||||
},
|
||||
],
|
||||
validate: (route) => {
|
||||
return route.params.id === 'test'
|
||||
}
|
||||
}
|
||||
export default __nuxt_page_meta"
|
||||
`)
|
||||
|
Loading…
Reference in New Issue
Block a user