Compare commits

...

9 Commits

Author SHA1 Message Date
Julien Huang
1cd9f2ebcd
Merge 77a96a27f4 into edc299a043 2024-11-20 06:35:52 -05:00
renovate[bot]
edc299a043
chore(deps): update all non-major dependencies (main) (#29995)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-20 06:35:43 -05:00
renovate[bot]
ad3ab4d310
chore(deps): update all non-major dependencies (main) (#29986)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-19 23:36:17 -05:00
Jan-Niklas W.
9bf8465806
docs: update getting started to include WebStorm (#29845) 2024-11-19 20:39:14 +00:00
Julien Huang
77a96a27f4 fix: try call instance related composables earlier 2024-08-24 18:04:05 +02:00
Julien Huang
2a47785ddd fix: wrap legacyasyncdata with runWithCOntext 2024-08-24 17:27:27 +02:00
Julien Huang
3161c1545e fix: move back into Promise.resolve 2024-08-23 00:16:33 +02:00
Julien Huang
1ac48fe0b7 fix: result 2024-08-23 00:14:54 +02:00
Julien Huang
47ac6bb843 fix(nuxt): don't wrap setup with runWithContext 2024-08-23 00:08:19 +02:00
5 changed files with 16 additions and 17 deletions

View File

@ -248,7 +248,7 @@ jobs:
TEST_PAYLOAD: ${{ matrix.payload }}
SKIP_BUNDLE_SIZE: ${{ github.event_name != 'push' || matrix.env == 'dev' || matrix.builder == 'webpack' || matrix.context == 'default' || matrix.payload == 'js' || runner.os == 'Windows' }}
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
- uses: codecov/codecov-action@985343d70564a82044c1b7fcb84c2fa05405c1a2 # v5.0.4
if: github.event_name != 'push' && matrix.env == 'built' && matrix.builder == 'vite' && matrix.context == 'default' && matrix.os == 'ubuntu-latest' && matrix.manifest == 'manifest-on'
with:
token: ${{ secrets.CODECOV_TOKEN }}

View File

@ -21,8 +21,8 @@ Or follow the steps below to set up a new Nuxt project on your computer.
<!-- markdownlint-disable-next-line MD001 -->
#### Prerequisites
- **Node.js** - [`v18.0.0`](https://nodejs.org/en) or newer
- **Text editor** - We recommend [Visual Studio Code](https://code.visualstudio.com/) with the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously known as Volar)
- **Node.js** - [`18.x`](https://nodejs.org/en) or newer (but we recommend the [active LTS release](https://github.com/nodejs/release#release-schedule))
- **Text editor** - There is no IDE requirement, but we recommend [Visual Studio Code](https://code.visualstudio.com/) with the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously known as Volar) or [WebStorm](https://www.jetbrains.com/webstorm/), which, along with [other JetBrains IDEs](https://www.jetbrains.com/ides/), offers great Nuxt support right out-of-the-box.
- **Terminal** - In order to run Nuxt commands
::note

View File

@ -91,7 +91,7 @@
"devalue": "5.1.1",
"eslint": "9.15.0",
"eslint-plugin-no-only-tests": "3.3.0",
"eslint-plugin-perfectionist": "4.0.2",
"eslint-plugin-perfectionist": "4.0.3",
"eslint-typegen": "0.3.2",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"happy-dom": "15.11.6",
@ -118,7 +118,7 @@
"vue-router": "4.4.5",
"vue-tsc": "2.1.10"
},
"packageManager": "pnpm@9.13.2",
"packageManager": "pnpm@9.14.1",
"engines": {
"node": "^16.10.0 || >=18.0.0"
},

View File

@ -1,5 +1,5 @@
import { getCurrentInstance, reactive, toRefs } from 'vue'
import type { DefineComponent, defineComponent } from 'vue'
import type { ComponentInternalInstance, DefineComponent, defineComponent } from 'vue'
import { useHead } from '@unhead/vue'
import type { NuxtApp } from '../nuxt'
import { useNuxtApp } from '../nuxt'
@ -9,10 +9,8 @@ import { createError } from './error'
export const NuxtComponentIndicator = '__nuxt_component'
async function runLegacyAsyncData (res: Record<string, any> | Promise<Record<string, any>>, fn: (nuxtApp: NuxtApp) => Promise<Record<string, any>>) {
async function runLegacyAsyncData (res: Record<string, any> | Promise<Record<string, any>>, vm: ComponentInternalInstance, route: ReturnType<typeof useRoute>, fn: (nuxtApp: NuxtApp) => Promise<Record<string, any>>) {
const nuxtApp = useNuxtApp()
const route = useRoute()
const vm = getCurrentInstance()!
const { fetchKey, _fetchKeyBase } = vm.proxy!.$options
const key = (typeof fetchKey === 'function' ? fetchKey(() => '') : fetchKey) ||
([_fetchKeyBase, route.fullPath, route.matched.findIndex(r => Object.values(r.components || {}).includes(vm.type))].join(':'))
@ -48,11 +46,12 @@ export const defineNuxtComponent: typeof defineComponent =
...options,
setup (props, ctx) {
const nuxtApp = useNuxtApp()
const res = setup ? Promise.resolve(nuxtApp.runWithContext(() => setup(props, ctx))).then(r => r || {}) : {}
const res = setup ? Promise.resolve(setup(props, ctx)).then(r => r || {}) : {}
const promises: Promise<any>[] = []
if (options.asyncData) {
promises.push(runLegacyAsyncData(res, options.asyncData))
const route = useRoute()
const vm = getCurrentInstance()!
promises.push(nuxtApp.runWithContext(() => runLegacyAsyncData(res, vm, route, options.asyncData)))
}
if (options.head) {

View File

@ -114,8 +114,8 @@ importers:
specifier: 3.3.0
version: 3.3.0
eslint-plugin-perfectionist:
specifier: 4.0.2
version: 4.0.2(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3)
specifier: 4.0.3
version: 4.0.3(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3)
eslint-typegen:
specifier: 0.3.2
version: 0.3.2(eslint@9.15.0(jiti@2.4.0))
@ -4373,8 +4373,8 @@ packages:
resolution: {integrity: sha512-brcKcxGnISN2CcVhXJ/kEQlNa0MEfGRtwKtWA16SkqXHKitaKIMrfemJKLKX1YqDU5C/5JY3PvZXd5jEW04e0Q==}
engines: {node: '>=5.0.0'}
eslint-plugin-perfectionist@4.0.2:
resolution: {integrity: sha512-zWdgyg2SdHqhp/P9d9vKwo5qD9is28xMAGzBslHqkZz5mVIikjyz1qvuJ4yS7Wrsf4KlbGorORefb4Kbe7Puzg==}
eslint-plugin-perfectionist@4.0.3:
resolution: {integrity: sha512-CyafnreF6boy4lf1XaF72U8NbkwrfjU/mOf1y6doaDMS9zGXhUU1DSk+ZPf/rVwCf1PL1m+rhHqFs+IcB8kDmA==}
engines: {node: ^18.0.0 || >=20.0.0}
peerDependencies:
eslint: '>=8.0.0'
@ -11519,7 +11519,7 @@ snapshots:
eslint-plugin-no-only-tests@3.3.0: {}
eslint-plugin-perfectionist@4.0.2(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3):
eslint-plugin-perfectionist@4.0.3(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3):
dependencies:
'@typescript-eslint/types': 8.15.0
'@typescript-eslint/utils': 8.15.0(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3)