Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Локализация content/7.blog/11.v3-5.md (#38) #60

Merged
merged 6 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 46 additions & 47 deletions content/7.blog/12.v3-5.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Nuxt 3.5'
description: "Nuxt 3.5.0 is out, bringing Vue 3.3, new defaults, interactive server components, typed pages, environment config - and much more."
description: "Вышел Nuxt 3.5.0, в который вошли Vue 3.3, новые значения по умолчанию, интерактивные серверные компоненты, типизированные страницы, конфигурация окружения и многое другое."
image: /assets/blog/v3-5.png
authors:
- name: Дэниел Ро
Expand All @@ -11,24 +11,24 @@ date: 2023-05-16
category: Релиз
---

## ⚡️ Vue 3.3 released
## ⚡️ Выпущена версия Vue 3.3

Vue 3.3 has been released, with lots of exciting features, particularly around type support.
Вышел Vue 3.3 с множеством интересных функций, особенно касающихся поддержки типов.

* new `defineOptions` macro
* 'generic' components
* typed slots and using external types in defineProps
* ... and more
* новый макрос `defineOptions`
* 'generic'-компоненты
* типизированные слоты и использование внешних типов в defineProps
* ... и многое другое

This also brings a significant improvement to data fetching when navigating between nested pages ([#20777](https://github.com/nuxt/nuxt/pull/20777)), thanks to [@antfu](https://github.com/antfu) and [@baiwusanyu-c](https://github.com/baiwusanyu-c).
Также значительно улучшено извлечение данных при навигации между вложенными страницами ([#20777](https://github.com/nuxt/nuxt/pull/20777)), спасибо [@antfu](https://github.com/antfu) и [@baiwusanyu-c](https://github.com/baiwusanyu-c).

Read **[the full release announcement](https://blog.vuejs.org/posts/vue-3-3)** for more details.
Более подробную информацию читайте в **[полном анонсе о релизе](https://blog.vuejs.org/posts/vue-3-3)**.

### 🙌 Nitropack v2.4

We've been working on lots of improvements to Nitro and these have landed already in Nitro v2.4 - you may already have this upgrade, which contains a lot of bug fixes, updates to the module worker format for Cloudflare, Vercel KV support and more.
Мы работали над множеством улучшений Nitro, и они уже появились в Nitro v2.4. Возможно, у вас уже установлено это обновление, которое содержит множество исправлений ошибок, обновления формата модуля worker для Cloudflare, поддержку Vercel KV и многое другое.

One note: if you're deploying to Vercel or Netlify and want to benefit from incremental static regeneration, you should now update your route rules:
Одно замечание: если вы выполняете деплой на Vercel или Netlify и хотите воспользоваться преимуществами инкрементальной статической регенерации, вам следует обновить правила маршрутизации:

```diff
routeRules: {
Expand All @@ -37,19 +37,19 @@ routeRules: {
}
```

Read **[the full release notes](https://github.com/unjs/nitro/releases/tag/v2.4.0)**.
Читайте **[полное описание релиза](https://github.com/unjs/nitro/releases/tag/v2.4.0)**.

### 💖 Rich JSON payloads
### 💖 Улучшенный JSON-payload

**Rich JSON payload serialisation** is now enabled by default ([#19205](https://github.com/nuxt/nuxt/pull/19205), [#20770](https://github.com/nuxt/nuxt/pull/20770)). This is both faster and allows serialising complex objects in the payload passed from the Nuxt server to client (and also when extracting payload data for prerendered sites).
**Расширенная сериализация полезной нагрузки (payload) в формате JSON** теперь включена по умолчанию ([#19205](https://github.com/nuxt/nuxt/pull/19205), [#20770](https://github.com/nuxt/nuxt/pull/20770)). Это и быстрее, и позволяет сериализовать сложные объекты в полезной нагрузке, передаваемой с сервера Nuxt клиенту (а также при извлечении данных полезной нагрузки для предварительно отрисованных сайтов).

This now means that **various rich JS types are supported out-of-the-box**: regular expressions, dates, Map and Set and BigInt as well as NuxtError - and Vue-specific objects like `ref`, `reactive`, `shallowRef` and `shallowReactive`.
Теперь это означает, что **различные расширенные типы JS поддерживаются из коробки**: регулярные выражения, даты, Map и Set, BigInt, а также NuxtError и специфичные для Vue объекты, такие как `ref`, `reactive`, `shallowRef` и `shallowReactive`.

You can find [an example](https://github.com/nuxt/nuxt/blob/main/test/fixtures/basic/pages/json-payload.vue) in our test suite.
Вы можете найти [пример](https://github.com/nuxt/nuxt/blob/main/test/fixtures/basic/pages/json-payload.vue) в нашем наборе тестов.

This is all possible due to [Rich-Harris/devalue#58](https://github.com/Rich-Harris/devalue/pull/58). For a long time, Nuxt has been using our own fork of devalue owing to issues serialising Errors and other non-POJO objects, but we now have transitioned back to the original.
Все это стало возможным благодаря [Rich-Harris/devalue#58](https://github.com/Rich-Harris/devalue/pull/58). Долгое время Nuxt использовал нашу собственную ветку devalue из-за проблем с сериализацией Errors и других не-POJO-объектов, но теперь мы вернулись к оригиналу.

You can even register your own custom types with a new object-syntax Nuxt plugin:
Вы даже можете зарегистрировать свои собственные типы с помощью нового плагина объектного синтаксиса Nuxt:

```ts [plugins/custom-payload-type.ts]
export default definePayloadPlugin(() => {
Expand All @@ -58,17 +58,17 @@ export default definePayloadPlugin(() => {
})
```

You can read more about how this works [here](https://github.com/rich-harris/devalue#custom-types).
Подробнее о том, как это работает, можно прочитать [здесь](https://github.com/rich-harris/devalue#custom-types).

## 🛝 Interactive server components
## 🛝 Интерактивные серверные компоненты

This feature should be considered highly experimental, but thanks to some great work from @huang-julien we now support interactive content within server components via _slots_ ([#20284](https://github.com/nuxt/nuxt/pull/20284)).
Эту функцию следует считать в высшей степени экспериментальной, но благодаря отличной работе @huang-julien мы теперь поддерживаем интерактивный контент в серверных компонентах через _слоты_ ([#20284](https://github.com/nuxt/nuxt/pull/20284)).

You can follow the server component roadmap at [#19772](https://github.com/nuxt/nuxt/issues/19772).
Вы можете следить за дорожной картой серверных компонентов по адресу [#19772](https://github.com/nuxt/nuxt/issues/19772).

## ⏰ Environment config
## ⏰ Конфигурация окружения

You can now configure fully typed, per-environment overrides in your `nuxt.config`:
Теперь вы можете настроить полностью типизированные переопределения для каждого окружения в `nuxt.config`:

```js
export default defineNuxtConfig({
Expand All @@ -83,19 +83,19 @@ export default defineNuxtConfig({
})
```

If you're authoring layers, you can also use the `$meta` key to provide metadata that you or the consumers of your layer might use.
Если вы создаете слои, вы также можете использовать ключ `$meta` для предоставления метаданных, которые можете использовать вы или потребители вашего слоя.

Read more [about per-environment overrides](https://github.com/nuxt/nuxt/pull/20329).
Подробнее [о переопределениях для каждого окружения](https://github.com/nuxt/nuxt/pull/20329).

## 💪 Fully typed pages
## 💪 Полностью типизированные страницы

You can benefit from fully typed routing within your Nuxt app via this experimental integration with [unplugin-vue-router](https://github.com/posva/unplugin-vue-router) - thanks to some great work from [@posva](https://github.com/posva)!
Вы можете воспользоваться преимуществами полностью типизированной маршрутизации в приложении Nuxt с помощью этой экспериментальной интеграции с [unplugin-vue-router](https://github.com/posva/unplugin-vue-router) — спасибо за отличную работу [@posva](https://github.com/posva)!

Out of the box, this will enable typed usage of [`navigateTo`](/docs/api/utils/navigate-to), [`<NuxtLink>`](/docs/api/components/nuxt-link), `router.push()` and more.
Это позволит использовать типизированные [`navigateTo`](/docs/api/utils/navigate-to), [`<NuxtLink>`](/docs/api/components/nuxt-link), `router.push()` и многое другое из коробки.

You can even get typed params within a page by using `const route = useRoute('route-name')`{lang=ts}.
Вы даже можете получить типизированные параметры внутри страницы, используя `const route = useRoute('route-name')`{lang=ts}.

Enable this feature directly in your `nuxt.config`:
Включите эту функцию непосредственно в `nuxt.config`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand All @@ -105,11 +105,11 @@ export default defineNuxtConfig({
})
```

## 🔎 'Bundler' module resolution
## 🔎 Разрешение модуля 'Bundler'

We now have full support within Nuxt for the `bundler` strategy of [module resolution](https://www.typescriptlang.org/docs/handbook/module-resolution.html).
Теперь в Nuxt есть полная поддержка стратегии [разрешения модулей](https://www.typescriptlang.org/docs/handbook/module-resolution.html) `bundler`.

We would recommend adopting this if possible. It has type support for subpath exports, for example, but more exactly matches the behaviour of build tools like Vite and Nuxt than `Node16` resolution.
Мы бы рекомендовали использовать это, если возможно. Например, в нем есть поддержка типов для экспорта вложенных путей, но он более точно соответствует поведению инструментов сборки, таких как Vite и Nuxt, чем разрешение `Node16`.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand All @@ -123,37 +123,36 @@ export default defineNuxtConfig({
})
```

This turns on TypeScript's ability to 'follow' Node subpath exports. For example, if a library has a subpath export like `mylib/path` that is mapped to `mylib/dist/path.mjs` then the types for this can be pulled in from `mylib/dist/path.d.ts` rather than requiring the library author to create `mylib/path.d.ts`.
Это включает способность TypeScript «следовать» за экспортами подпутей Node. Например, если библиотека имеет экспорт подпутей, например `mylib/path`, который сопоставлен с `mylib/dist/path.mjs`, то типы для этого можно извлечь из `mylib/dist/path.d.ts`, а не требовать от автора библиотеки создания `mylib/path.d.ts`.

## ⚗️ Отдельные серверные типы

## ⚗️ Separate server types
Мы планируем улучшение ясности в IDE между частями 'nitro' и 'vue' вашего приложения, мы отправили первую часть улучшения с помощью отдельного сгенерированного файла `tsconfig.json` для директории [`~/server`](/docs/guide/directory-structure/server) ([#20559](https://github.com/nuxt/nuxt/pull/20559)).

We plan to improve clarity within your IDE between the 'nitro' and 'vue' part of your app, we've shipped the first part of this via a separate generated `tsconfig.json` for your [`~/server`](/docs/guide/directory-structure/server) directory ([#20559](https://github.com/nuxt/nuxt/pull/20559)).

You can use by adding an additional `~/server/tsconfig.json` with the following content:
Вы можете использовать его, добавив дополнительный `~/server/tsconfig.json` со следующим содержимым:

```json
{
"extends": "../.nuxt/tsconfig.server.json"
}
```

Although right now these values won't be respected when type checking (`nuxi typecheck`), you should get better type hints in your IDE.
Хотя сейчас эти значения не будут учитываться при проверке типов (`nuxi typecheck`), вы должны получить более точные подсказки типов в своей IDE.

## 💀 Deprecations
## 💀 Устаревания

Although we have not typed or documented the `build.extend` hook from Nuxt 2, we have been calling it within the webpack builder. We are now explicitly deprecating this and will remove it in a future minor version.
Хотя мы не вводили и не документировали хук `build.extend` из Nuxt 2, мы вызывали его в конструкторе webpack. Теперь мы явно объявляем его устаревшим и удалим его в будущей минорной версии.

## ✅ Upgrading
## ✅ Обновление

As usual, our recommendation for upgrading is to run:
Как обычно, мы рекомендуем выполнить обновление следующим образом:

```sh
npx nuxi upgrade --force
```

This will refresh your lockfile as well, and ensures that you pull in updates from other dependencies that Nuxt relies on, particularly in the unjs ecosystem.
Это также обновит ваш lockfile и обеспечит получение обновлений из других зависимостей, на которые опирается Nuxt, особенно в экосистеме unjs.

## 📃 Full changelog
## 📃 Полный журнал изменений

Read the full release note on https://github.com/nuxt/nuxt/releases/tag/v3.5.0
Полное описание релиза читайте на https://github.com/nuxt/nuxt/releases/tag/v3.5.0