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

feat(docs): Локализация content/7.blog/v3-3.md #72

Merged
merged 6 commits into from
Aug 11, 2024
Merged
Changes from 1 commit
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
84 changes: 42 additions & 42 deletions content/7.blog/10.v3-3.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Nuxt 3.3'
description: "The 3.3.0 is a minor (feature) release with lots of performance and DX improvements, bug fixes and new features to play with."
description: "3.3.0 - это минорный (функциональный) релиз с большим количеством улучшений производительности и DX, исправлений ошибок и новых возможностей, которые можно попробовать."
image: /assets/blog/v3-3.png
authors:
- name: Дэниел Ро
Expand All @@ -11,13 +11,13 @@ date: 2023-03-14
category: Релиз
---

## ✨ Local module development DX
## ✨ Разработка локального модуля DX
mnenie marked this conversation as resolved.
Show resolved Hide resolved

We've landed a raft of changes to enable local modules and improve DX.
Мы внесли множество изменений, чтобы включить локальные модули и улучшить DX.

We now auto-scan your [`~/modules`](/docs/guide/directory-structure/modules) folder and register top level files there as modules in your project ([#19394](https://github.com/nuxt/nuxt/pull/19394)).
Теперь мы автоматически отсканируем вашу папку [`~/modules`](/docs/guide/directory-structure/modules) и зарегистрируем в ней файлы верхнего уровня как модули в вашем проекте ([#19394](https://github.com/nuxt/nuxt/pull/19394)).

When these files are changed, we'll automatically restart the nuxt server.
Когда эти файлы будут изменены, мы автоматически перезапустим сервер nuxt.

```diff
export default defineNuxtConfig({
Expand All @@ -28,27 +28,27 @@ export default defineNuxtConfig({
})
```

We also now expose `nuxt/kit` for easy access to kit composables in your local project without having to install `@nuxt/kit` ([#19422](https://github.com/nuxt/nuxt/pull/19422)).
Мы также теперь передаем `nuxt/kit` для легкого доступа к композаблам набора в вашем локальном проекте без необходимости устанавливать `@nuxt/kit` ([#19422](https://github.com/nuxt/nuxt/pull/19422)).
mnenie marked this conversation as resolved.
Show resolved Hide resolved

[Read the documentation about local modules](/docs/guide/directory-structure/modules).
[Читайте документацию о локальных модулях](/docs/guide/directory-structure/modules).

## ♻️ Restarting Nuxt
## ♻️ Перезапуск Nuxt

You can add files to the `watch` array to automatically restart the server ([#19530](https://github.com/nuxt/nuxt/pull/19530)). This is likely to be particularly useful for module authors. You can also trigger a restart of the Nuxt server with the new `restart` hook ([#19084](https://github.com/nuxt/nuxt/pull/19084)).
Вы можете добавлять файлы в массив `watch` для автоматического перезапуска сервера ([#19530](https://github.com/nuxt/nuxt/pull/19530)). Это может быть особенно полезно для авторов модулей. Вы также можете инициировать перезапуск сервера Nuxt с помощью нового хука `restart` ([#19084](https://github.com/nuxt/nuxt/pull/19084)).

## 🔥 Performance improvements
## 🔥 Улучшение производительности

We've increased static asset maxAge to 1 year as a matter of best practice ([#19335](https://github.com/nuxt/nuxt/pull/19335)), and support tree-shaking more of your build ([#19508](https://github.com/nuxt/nuxt/pull/19508)).
Мы увеличили maxAge статических ассетов maxAge до 1 года в соответствии с лучшими практиками ([#19335](https://github.com/nuxt/nuxt/pull/19335)), а также поддерживаем tree-shaking вашей сборки ([#19508](https://github.com/nuxt/nuxt/pull/19508)).
mnenie marked this conversation as resolved.
Show resolved Hide resolved

![nuxt-performance-improvements](https://user-images.githubusercontent.com/28706372/224999169-6c047cca-9a5c-4637-8e4d-be6268964e08.png)

We also now support preloading [`<NuxtLink>`](/docs/api/components/nuxt-link) with a route in object-syntax ([#19120](https://github.com/nuxt/nuxt/pull/19120)):
Также теперь мы поддерживаем предварительную загрузку [`<NuxtLink>`](/docs/api/components/nuxt-link) с маршрутом в объектном синтаксисе ([#19120](https://github.com/nuxt/nuxt/pull/19120)):

```html
<NuxtLink :to="{ name: 'home', query: { year: '2023' } }">Home</NuxtLink>
```

We also track how long it takes each module you use to perform its setup, and warn if it takes too long. You can see all these values by running your dev server with `DEBUG=1` ([#18648](https://github.com/nuxt/nuxt/pull/18648)).
Мы также отслеживаем, сколько времени занимает настройка каждого используемого вами модуля, и предупреждаем, если это занимает слишком много времени. Вы можете увидеть все эти значения, запустив свой dev-сервер с `DEBUG=1` ([#18648](https://github.com/nuxt/nuxt/pull/18648)).

```sh
DEBUG=1 npx nuxt dev
Expand All @@ -58,15 +58,15 @@ DEBUG=1 npx nuxt dev
...
```

You can also opt-in to some of Nuxt's internal optimisations by configuring composables to be treeshaken in a particular environment ([#19383](https://github.com/nuxt/nuxt/pull/19383)) or to have magic keys automatically injected ([#19490](https://github.com/nuxt/nuxt/pull/19490)).
Вы также можете воспользоваться некоторыми внутренними оптимизациями Nuxt, настроив композаблы так, чтобы они были treeshaken в определенном окружении ([#19383](https://github.com/nuxt/nuxt/pull/19383)) или чтобы магические ключи инжектировались автоматически ([#19490](https://github.com/nuxt/nuxt/pull/19490)).

## 🐛 Error handling
## 🐛 Обработка ошибок

We now handle chunk errors by default ([#19086](https://github.com/nuxt/nuxt/pull/19086)), meaning if your site updates with a redeploy, **we automatically handle reloading it on navigation**.
Теперь мы по умолчанию обрабатываем ошибки чанков ([#19086](https://github.com/nuxt/nuxt/pull/19086)), то есть если ваш сайт обновляется с помощью редеплоя, **мы автоматически обрабатываем его перезагрузку при навигации**.

To disable this behavior, set `experimental.emitRouteChunkError` option to `'manual'` and handle it yourself with the new [`reloadNuxtApp`](https://nuxt.com/docs/api/utils/reload-nuxt-app) composable. Learn more how we implemented in our [chunk-reload.client.ts plugin](https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/plugins/chunk-reload.client.ts).
Чтобы отключить это поведение, установите для опции `experimental.emitRouteChunkError` значение `'manual'` и обрабатывайте его самостоятельно с помощью нового композабла [`reloadNuxtApp`](https://nuxt.com/docs/api/utils/reload-nuxt-app). Подробнее о том, как мы реализовали это в нашем [плагине chunk-reload.client.ts](https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/plugins/chunk-reload.client.ts).

You can also set `experimental.restoreState` to preserve some of your app state across reloads:
Вы также можете установить `experimental.restoreState`, чтобы сохранить часть состояния вашего приложения при перезагрузке:

```ts [nuxt.config.ts]
defineNuxtConfig({
Expand All @@ -76,53 +76,53 @@ defineNuxtConfig({
})
```

We also have a new experimental error handling component: [`<NuxtClientFallback>`](/docs/api/components/nuxt-client-fallback) ([#8216](https://github.com/nuxt/framework/pull/8216)) which can capture errors rendering on server, replace them with fallback content, and granularly trigger rerendering the part with an error on the client. This can be enabled with `experimental.clientFallback` - feedback very welcome!
У нас также появился новый экспериментальный компонент обработки ошибок: [`<NuxtClientFallback>`](/docs/api/components/nuxt-client-fallback) ([#8216](https://github.com/nuxt/framework/pull/8216)) , который может перехватывать ошибки рендеринга на сервере, заменять их на fallback-контент, и гранулярно запускать повторный рендеринг части с ошибкой на клиенте. Это можно включить с помощью `experimental.clientFallback` - отзывы приветствуются!

## ⚡️ Head improvements
## ⚡️ Улучшения в head

We've migrated to use [unhead](https://github.com/unjs/unhead) directly ([#19519](https://github.com/nuxt/nuxt/pull/19519)) - and automatically tree-shake server-only head composables like `useServerHead` from your client build ([#19576](https://github.com/nuxt/nuxt/pull/19576)), meaning you can have great SEO without needing to include meta tag logic that's relevant only for crawlers in your client build.
Мы мигрировали на прямое использование [unhead](https://github.com/unjs/unhead) ([#19519](https://github.com/nuxt/nuxt/pull/19519)) - и автоматически tree-shake серверные head композаблы, такие как `useServerHead` из вашей клиентской сборки ([#19576](https://github.com/nuxt/nuxt/pull/19576)), что означает, что вы можете иметь отличное SEO без необходимости включать логику метатегов, которая имеет значение только для краулеров в вашей клиентской сборке.

There's also a new [`useHeadSafe`](/docs/api/composables/use-head-safe) composable that handles sanitising untrusted user input ([#19548](https://github.com/nuxt/nuxt/pull/19548)).
Также появился новый композабл[`useHeadSafe`](/docs/api/composables/use-head-safe), который обрабатывает ввод недоверенного пользователя ([#19548](https://github.com/nuxt/nuxt/pull/19548)).

## 🪵 Better logging in browser DevTools
## 🪵 Улучшенное логирование в браузерных DevTools

Working with the Chrome DevTools team, we've landed a couple of features across the unjs + Nuxt ecosystem meaning we now have first-class support for hiding Nuxt internal stack traces from logs in your (Chromium-based, for now) browser [#19243](https://github.com/nuxt/nuxt/pull/19243). We also landed a couple of improvements with stacktraces involving Nuxt hooks ([unjs/hookable#69](https://github.com/unjs/hookable/pull/69) and [unjs/hookable#68](https://github.com/unjs/hookable/pull/68)) implementing [`console.createTask`](https://developer.chrome.com/blog/devtools-modern-web-debugging/#linked-stack-traces).
Работая с командой Chrome DevTools, мы добавили несколько функций в экосистему unjs + Nuxt, что означает, что теперь у нас есть первоклассная поддержка скрытия внутренних трассировок стека Nuxt из логов в вашем браузере (сейчас на базе Chromium) [#19243](https://github.com/nuxt/nuxt/pull/19243). Мы также внесли несколько улучшений в трассировку стека с использованием хуков Nuxt ([unjs/hookable#69](https://github.com/unjs/hookable/pull/69) и [unjs/hookable#68](https://github.com/unjs/hookable/pull/68)), имплементирующих [`console.createTask`](https://developer.chrome.com/blog/devtools-modern-web-debugging/#linked-stack-traces).

| Before | After |
| До | После |
| - | - |
| <img width="529" alt="before-nuxt-console-improvements" src="https://user-images.githubusercontent.com/28706372/220933126-56d9a0e5-e846-4958-a40a-e528a48bcb32.png"> | <img width="534" alt="after-nuxt-console-improvements" src="https://user-images.githubusercontent.com/28706372/220932932-932f193b-59a6-4385-8796-a62dcfd59c20.png"> |


## 💪 Type improvements
## 💪 Улучшения типа
mnenie marked this conversation as resolved.
Show resolved Hide resolved

Types for server API routes are now more correct - with non-serialisable types stripped out of the return type ([unjs/nitro#1002](https://github.com/unjs/nitro/pull/1002)).
Типы для серверных API-маршрутов теперь более корректны - из возвращаемого типа удалены несериализуемые типы ([unjs/nitro#1002](https://github.com/unjs/nitro/pull/1002)).

We also now type more of `NuxtApp` and correctly type unknown injections for greater type-safety ([#19643](https://github.com/nuxt/nuxt/pull/19643)).
Мы также теперь лучше типизируем `NuxtApp` и правильно типизируем неизвестные инъекции для большей безопасности типов ([#19643](https://github.com/nuxt/nuxt/pull/19643)).

And if you were struggling with correct types when using `transform` + `default` with Nuxt data fetching composables, fear no more - we now infer the types correctly ([#19487](https://github.com/nuxt/nuxt/pull/19487)).
И если у вас были проблемы с правильными типами при использовании `transform` + `default` с композаблами Nuxt, которые получают данные, больше не бойтесь - теперь мы определяем типы правильно ([#19487](https://github.com/nuxt/nuxt/pull/19487)).

## ⚗️ Nitro enhancements
## ⚗️ Улучшения Nitro

This release comes with Nitro v2.3, which brings lots of improvements of its own. Check out [the release](https://github.com/unjs/nitro/releases/tag/v2.3.0) for more info.
Этот релиз поставляется с Nitro v2.3, в котором реализовано множество собственных улучшений. Более подробную информацию можно найти в [релизе](https://github.com/unjs/nitro/releases/tag/v2.3.0).

We now support [`useAppConfig`](/docs/api/composables/use-app-config) in nitro server routes ([#19489](https://github.com/nuxt/nuxt/pull/19489)) - a long-awaited change. Now [`useAppConfig`](/docs/api/composables/use-app-config) is consistently available throughout your app for non-runtime configuration from layers, modules, etc.
Теперь мы поддерживаем [`useAppConfig`](/docs/api/composables/use-app-config) в маршрутах сервера nitro ([#19489](https://github.com/nuxt/nuxt/pull/19489)) - долгожданное изменение. Теперь [`useAppConfig`](/docs/api/composables/use-app-config) постоянно доступен во всем вашем приложении для non-runtime-конфигурации из слоев, модулей и т.д.

We've also added a `nitro:build:public-assets` hook to allow modifying assets output from nitro's prerender/build phase ([#19638](https://github.com/nuxt/nuxt/pull/19638)).
Мы также добавили хук `nitro:build:public-assets`, позволяющий модифицировать ассеты, выводимые на этапе пререндера/билда nitro ([#19638](https://github.com/nuxt/nuxt/pull/19638)).

## 🛠️ Build changes
## 🛠️ Изменения в сборке

As part of moving towards [first-class support for PNP and pnpm support without `--shamefully-hoist`](https://github.com/nuxt/nuxt/issues/14146), we've dropped support for some internal (deprecated) utilities using CJS resolve patterns ([#19537](https://github.com/nuxt/nuxt/pull/19537) and [#19608](https://github.com/nuxt/nuxt/pull/19608)).
В рамках перехода к [первоклассной поддержке PNP и поддержке pnpm без `--shamefully-hoist`](https://github.com/nuxt/nuxt/issues/14146)мы отказались от поддержки некоторых внутренних (устаревших) утилит, использующих паттерны разрешения CJS ([#19537](https://github.com/nuxt/nuxt/pull/19537) и [#19608](https://github.com/nuxt/nuxt/pull/19608)).
mnenie marked this conversation as resolved.
Show resolved Hide resolved

We also now resolve dependencies like `nuxt`, `@nuxt/kit` and more using ESM search-paths. We'll be keeping a close eye on this.
Также теперь мы разрешаем такие зависимости, как `nuxt`, `@nuxt/kit` и другие, используя пути поиска ESM. Мы будем внимательно следить за этим.

We're also preparing the groundwork for support of new TypeScript Node16 module resolution ([#19606](https://github.com/nuxt/nuxt/issues/19606)), and as part of this have changed the format of our runtime output (using `.js` instead of `.mjs` extensions, providing `types` fields for subpath exports, and more).
Мы также готовим почву для поддержки нового разрешения модулей TypeScript Node16 ([#19606](https://github.com/nuxt/nuxt/issues/19606)), и в рамках этого мы изменили формат нашего вывода рантайма (используя расширения `.js` вместо `.mjs`, предоставляя поля `types` для экспорта подпутей, и многое другое).

## 🗺️ Custom config schema (advanced)
## 🗺️ Пользовательская схема конфигурации (продвинутый уровень)

We've been testing out an experimental feature to allow modules and users to extend the Nuxt config schema ([#15592](https://github.com/nuxt/nuxt/issues/15592)), and we've now enabled this by default ([#19172](https://github.com/nuxt/nuxt/pull/19172)). We expect this will be particularly useful for module and layer/theme authors, and should result in some nicer DX for their users.
Мы тестировали экспериментальную функцию, позволяющую модулям и пользователям расширять схему конфигурации Nuxt ([#15592](https://github.com/nuxt/nuxt/issues/15592)), и теперь мы включили ее по умолчанию ([#19172](https://github.com/nuxt/nuxt/pull/19172)). Мы ожидаем, что это будет особенно полезно для авторов как модулей, так и слоев/тем, и должно привести к появлению более приятных DX для их пользователей.

## Changelog
## Журнал изменений

See the full changelog by [comparing the changes](https://github.com/nuxt/nuxt/compare/v3.2.3...v3.3.0) or checkout the [release on GitHub](https://github.com/nuxt/nuxt/releases/tag/v3.3.0).
Ознакомьтесь с полным журналом изменений, [сравнив изменения](https://github.com/nuxt/nuxt/compare/v3.2.3...v3.3.0) или ознакомьтесь с [релизом на GitHub](https://github.com/nuxt/nuxt/releases/tag/v3.3.0).

We would like to thank all the 28 contributors who helped on this release 💚
Мы хотели бы поблагодарить всех 28 соавторов, которые помогали в работе над этим релизом 💚
Loading