Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/1.getting-started/3.configuration.md
#	docs/1.getting-started/3.views.md
#	docs/3.api/1.components/8.nuxt-island.md
#	docs/3.api/2.composables/use-nuxt-data.md
#	docs/5.community/6.roadmap.md
  • Loading branch information
Ivan Bochkarev committed Nov 16, 2024
2 parents 307287c + 51c9d34 commit 2e755ec
Show file tree
Hide file tree
Showing 31 changed files with 1,063 additions and 1,059 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:lts@sha256:de4c8be8232b7081d8846360d73ce6dbff33c6636f2259cd14d82c0de1ac3ff2
FROM node:lts@sha256:5c76d05034644fa8ecc9c2aa84e0a83cd981d0ef13af5455b87b9adf5b216561

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 && \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
with:
config: |
paths:
Expand All @@ -91,7 +91,7 @@ jobs:
queries: +security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
with:
category: "/language:javascript-typescript"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Lychee link checker
uses: lycheeverse/lychee-action@ae4699150ab670dcfb64cc74e8680e776d9caae2 # for v1.8.0
uses: lycheeverse/lychee-action@5cd5ba7877bce8b3973756ae3c9474ce1e50be2f # for v1.8.0
with:
# arguments with file types to check
args: >-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
if: github.repository == 'nuxt/nuxt' && success()
with:
sarif_file: results.sarif
7 changes: 3 additions & 4 deletions docs/1.getting-started/10.deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ NITRO_PRESET=node-server nuxt build

Соответственно, вы должны убедиться, что следующие опции сняты / отключены в Cloudflare. В противном случае ненужный повторный рендеринг или ошибки гидратации могут повлиять на ваше продакшн-приложение.

1. Speed > Optimization > Content Optimization > Auto Minify: Uncheck JavaScript, CSS and HTML
2. Speed > Optimization > Content Optimization > Disable "Rocket Loader™"
3. Speed > Optimization > Image Optimization > Disable "Mirage"
4. Scrape Shield > Disable "Email Address Obfuscation"
1. Speed > Optimization > Content Optimization > Disable "Rocket Loader™"
2. Speed > Optimization > Image Optimization > Disable "Mirage"
3. Scrape Shield > Disable "Email Address Obfuscation"

Благодаря этим настройкам вы можете быть уверены, что Cloudflare не будет внедрять в ваше приложение Nuxt скрипты, которые могут вызвать нежелательные побочные эффекты.

Expand Down
9 changes: 5 additions & 4 deletions docs/1.getting-started/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default defineNuxtConfig({
Вы можете настроить полностью типизованные переопределения для каждого окружения в вашем nuxt.config

```ts twoslash [nuxt.config.ts]
// @errors: 2353
export default defineNuxtConfig({
$production: {
routeRules: {
Expand All @@ -43,13 +42,15 @@ export default defineNuxtConfig({
$development: {
//
},
$myCustomName: {
//
$env: {
staging: {
//
}
},
})
```

Чтобы выбрать окружение при запуске команды Nuxt CLI, просто передайте его имя во флаг `--envName`, например: `nuxi build --envName myCustomName`.
Чтобы выбрать окружение при запуске команды Nuxt CLI, просто передайте его имя во флаг `--envName`, например: `nuxi build --envName staging`.

Чтобы узнать больше о механизме, лежащем в основе этих переопределений, обратитесь к документации `c12` по [конфигурации, зависящей от окружения](https://github.com/unjs/c12?tab=readme-ov-file#environment-specific-configuration).

Expand Down
3 changes: 1 addition & 2 deletions docs/2.guide/2.directory-structure/3.package.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ navigation.icon: i-ph-file
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"dependencies": {
"nuxt": "latest",
"vue": "latest",
"vue-router": "latest"
Expand Down
4 changes: 4 additions & 0 deletions docs/3.api/1.components/8.nuxt-island.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ links:
Настоятельно не рекомендуется включать `dangerouslyLoadClientComponents`, так как вы не можете доверять javascript удаленного сервера.
::

::note
By default, component islands are scanned from the `~/components/islands/` directory. So the `~/components/islands/MyIsland.vue` component could be rendered with `<NuxtIsland name="MyIsland" />`.
::

## Слоты

Слоты могут быть переданы островному компоненту, если они объявлены.
Expand Down
2 changes: 1 addition & 1 deletion docs/3.api/2.composables/use-nuxt-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const { data } = await useAsyncData('todos', () => $fetch('/api/todos'))
const newTodo = ref('')
const previousTodos = ref([])
// Доступ к кэшированному значению useFetch в файле todos.vue
// Доступ к кэшированному значению useAsyncData в файле todos.vue
const { data: todos } = useNuxtData('todos')
const { data } = await useFetch('/api/addTodo', {
Expand Down
2 changes: 1 addition & 1 deletion docs/5.community/6.roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Translations | - | [nuxt/translations#4](https://github.com/nuxt/tr
Модуль | Статус | Поддержка Nuxt | Репозиторий | Описание
------------------------------------|--------------------|----------------|-------------------------------------------------|-------------------------------------------------------------------------------------------------
[Scripts](https://scripts.nuxt.com) | Общедоступная бета | 3.x | [nuxt/scripts](https://github.com/nuxt/scripts) | Простое управление сторонними скриптами.
Auth Utils | Планируется | 3.x | `nuxt/auth-utils` будет объявлено | The temporary repository [atinux/nuxt-auth-utils](https://github.com/atinux/nuxt-auth-utils) is available while awaiting its official integration into Nuxt via RFC.
A11y | Планируется | 3.x | `nuxt/a11y` будет объявлено | Подсказки и утилиты для доступности [nuxt/nuxt#23255](https://github.com/nuxt/nuxt/issues/23255)
Auth | Планируется | 3.x | `nuxt/auth` будет объявлено | Поддержка Nuxt планируется после поддержки сеансов.
Hints | Планируется | 3.x | `nuxt/hints` будет объявлено | Руководство и рекомендации по улучшению практики разработки.

## Цикл выпуска
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export default createConfigForNuxt({
'error',
{
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
varsIgnorePattern: '^_',
varsIgnorePattern: '',
},
],
'@typescript-eslint/triple-slash-reference': 'off',
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
"nitro": "npm:[email protected]",
"nuxt": "workspace:*",
"ohash": "1.1.4",
"postcss": "8.4.47",
"rollup": "4.24.4",
"postcss": "8.4.49",
"rollup": "4.26.0",
"send": ">=1.1.0",
"typescript": "5.6.3",
"ufo": "1.5.4",
"unbuild": "3.0.0-rc.11",
"unhead": "1.11.11",
"vite": "5.4.10",
"vite": "5.4.11",
"vue": "3.5.12"
},
"devDependencies": {
Expand All @@ -79,8 +79,8 @@
"@types/semver": "7.5.8",
"@unhead/schema": "1.11.11",
"@unhead/vue": "1.11.11",
"@vitejs/plugin-vue": "5.1.4",
"@vitest/coverage-v8": "2.1.4",
"@vitejs/plugin-vue": "5.2.0",
"@vitest/coverage-v8": "2.1.5",
"@vue/test-utils": "2.4.6",
"autoprefixer": "10.4.20",
"case-police": "0.7.0",
Expand All @@ -94,7 +94,7 @@
"eslint-plugin-perfectionist": "3.9.1",
"eslint-typegen": "0.3.2",
"h3": "npm:[email protected]",
"happy-dom": "15.9.0",
"happy-dom": "15.11.6",
"jiti": "2.4.0",
"markdownlint-cli": "0.42.0",
"nitro": "npm:[email protected]",
Expand All @@ -107,18 +107,18 @@
"rimraf": "6.0.1",
"semver": "7.6.3",
"sherif": "1.0.1",
"std-env": "3.7.0",
"std-env": "3.8.0",
"tinyexec": "0.3.1",
"tinyglobby": "0.2.10",
"typescript": "5.6.3",
"ufo": "1.5.4",
"vitest": "2.1.4",
"vitest": "2.1.5",
"vitest-environment-nuxt": "1.0.1",
"vue": "3.5.12",
"vue-router": "4.4.5",
"vue-tsc": "2.1.10"
},
"packageManager": "pnpm@9.12.3",
"packageManager": "pnpm@9.13.2",
"engines": {
"node": "^16.10.0 || >=18.0.0"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxt/kit",
"version": "3.12.2",
"version": "4.0.0-0",
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/nuxt.git",
Expand Down Expand Up @@ -37,24 +37,24 @@
"ignore": "^6.0.2",
"jiti": "^2.4.0",
"klona": "^2.0.6",
"mlly": "^1.7.2",
"mlly": "^1.7.3",
"pathe": "^1.1.2",
"pkg-types": "^1.2.1",
"scule": "^1.3.0",
"semver": "^7.6.3",
"ufo": "^1.5.4",
"unctx": "^2.3.1",
"unimport": "^3.13.1",
"unimport": "^3.13.2",
"untyped": "^1.5.1"
},
"devDependencies": {
"@rspack/core": "1.0.14",
"@rspack/core": "1.1.1",
"@types/hash-sum": "1.0.2",
"@types/semver": "7.5.8",
"nitro": "npm:[email protected]",
"unbuild": "3.0.0-rc.11",
"vite": "5.4.10",
"vitest": "2.1.4",
"vite": "5.4.11",
"vitest": "2.1.5",
"webpack": "5.96.1"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/module/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
try {
const resolved = resolveAlias(path, nuxt.options.alias)
const src = isAbsolute(resolved)
? await resolvePath(resolved, { cwd: parentURL, fallbackToOriginal: false, extensions: nuxt.options.extensions })
? pathToFileURL(await resolvePath(resolved, { cwd: parentURL, fallbackToOriginal: false, extensions: nuxt.options.extensions })).href
: await resolveModule(resolved, { url: pathToFileURL(parentURL.replace(/\/node_modules\/?$/, '')), extensions: nuxt.options.extensions })

nuxtModule = await jiti.import(src, { default: true }) as NuxtModule

// nuxt-module-builder generates a module.json with metadata including the version
const moduleMetadataPath = join(dirname(src), 'module.json')
const moduleMetadataPath = new URL('module.json', src)
if (existsSync(moduleMetadataPath)) {
buildTimeModuleMeta = JSON.parse(await fsp.readFile(moduleMetadataPath, 'utf-8'))
}
Expand Down
16 changes: 8 additions & 8 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt",
"version": "3.12.2",
"version": "4.0.0-0",
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/nuxt.git",
Expand Down Expand Up @@ -92,7 +92,7 @@
"klona": "^2.0.6",
"knitwork": "^1.1.0",
"magic-string": "^0.30.12",
"mlly": "^1.7.2",
"mlly": "^1.7.3",
"nanotar": "^0.1.1",
"nitro": "npm:[email protected]",
"nuxi": "^3.15.0",
Expand All @@ -105,7 +105,7 @@
"radix3": "^1.1.2",
"scule": "^1.3.0",
"semver": "^7.6.3",
"std-env": "^3.7.0",
"std-env": "^3.8.0",
"strip-literal": "^2.1.0",
"tinyglobby": "0.2.10",
"ufo": "^1.5.4",
Expand All @@ -114,8 +114,8 @@
"unctx": "^2.3.1",
"unenv": "^1.10.0",
"unhead": "^1.11.11",
"unimport": "^3.13.1",
"unplugin": "^1.15.0",
"unimport": "^3.13.2",
"unplugin": "^1.16.0",
"unplugin-vue-router": "^0.10.8",
"unstorage": "^1.13.1",
"untyped": "^1.5.1",
Expand All @@ -129,11 +129,11 @@
"@nuxt/ui-templates": "1.3.4",
"@parcel/watcher": "2.5.0",
"@types/estree": "1.0.6",
"@vitejs/plugin-vue": "5.1.4",
"@vitejs/plugin-vue": "5.2.0",
"@vue/compiler-sfc": "3.5.12",
"unbuild": "3.0.0-rc.11",
"vite": "5.4.10",
"vitest": "2.1.4"
"vite": "5.4.11",
"vitest": "2.1.5"
},
"peerDependencies": {
"@parcel/watcher": "^2.1.0",
Expand Down
11 changes: 11 additions & 0 deletions packages/nuxt/src/components/plugins/component-names.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createUnplugin } from 'unplugin'
import MagicString from 'magic-string'
import type { Component } from 'nuxt/schema'
import type { Program } from 'acorn'
import { SX_RE, isVue } from '../../core/utils'

interface NameDevPluginOptions {
Expand Down Expand Up @@ -34,6 +35,16 @@ export const ComponentNamePlugin = (options: NameDevPluginOptions) => createUnpl
const s = new MagicString(code)
s.replace(NAME_RE, `__name: ${JSON.stringify(component.pascalName)}`)

// Without setup function, vue compiler does not generate __name
if (!s.hasChanged()) {
const ast = this.parse(code) as Program
const exportDefault = ast.body.find(node => node.type === 'ExportDefaultDeclaration')
if (exportDefault) {
const { start, end } = exportDefault.declaration
s.overwrite(start, end, `Object.assign(${code.slice(start, end)}, { __name: ${JSON.stringify(component.pascalName)} })`)
}
}

if (s.hasChanged()) {
return {
code: s.toString(),
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isIgnored } from '@nuxt/kit'
import type { Nuxt, NuxtConfig, NuxtConfigLayer } from '@nuxt/schema'
import { hash, murmurHash, objectHash } from 'ohash'
import { glob } from 'tinyglobby'
import _consola, { consola } from 'consola'
import { consola } from 'consola'
import { dirname, join, relative } from 'pathe'
import { createTar, parseTar } from 'nanotar'
import type { TarFileInput } from 'nanotar'
Expand Down
1 change: 0 additions & 1 deletion packages/nuxt/src/core/external-config-files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { findPath, logger } from '@nuxt/kit'
import { basename } from 'pathe'
import { generateApp as _generateApp } from './app'

/**
* Check for those external configuration files that are not compatible with Nuxt,
Expand Down
1 change: 0 additions & 1 deletion packages/nuxt/src/core/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { createDebugger, createHooks } from 'hookable'
import ignore from 'ignore'
import type { LoadNuxtOptions } from '@nuxt/kit'
import { addBuildPlugin, addComponent, addPlugin, addPluginTemplate, addRouteMiddleware, addServerPlugin, addVitePlugin, addWebpackPlugin, installModule, loadNuxtConfig, logger, nuxtCtx, resolveAlias, resolveFiles, resolveIgnorePatterns, resolvePath, tryResolveModule, useNitro } from '@nuxt/kit'
import { resolvePath as _resolvePath } from 'mlly'
import type { Nuxt, NuxtHooks, NuxtModule, NuxtOptions } from 'nuxt/schema'
import type { PackageJson } from 'pkg-types'
import { readPackageJSON } from 'pkg-types'
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/plugins/virtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Nuxt } from '@nuxt/schema'
import { dirname, isAbsolute, resolve } from 'pathe'
import { createUnplugin } from 'unplugin'

const PREFIX = '\0virtual:nuxt:'
const PREFIX = 'virtual:nuxt:'

interface VirtualFSPluginOptions {
mode: 'client' | 'server'
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/pages/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { addBuildPlugin, addComponent, addPlugin, addTemplate, addTypeTemplate,
import { dirname, join, relative, resolve } from 'pathe'
import { genImport, genObjectFromRawEntries, genString } from 'knitwork'
import { joinURL } from 'ufo'
import type { Nuxt, NuxtApp, NuxtPage } from 'nuxt/schema'
import type { NuxtPage } from 'nuxt/schema'
import { createRoutesContext } from 'unplugin-vue-router'
import { resolveOptions } from 'unplugin-vue-router/options'
import type { EditableTreeNode, Options as TypedRouterOptions } from 'unplugin-vue-router'
Expand Down Expand Up @@ -569,7 +569,7 @@ export default defineNuxtModule({

addTypeTemplate({
filename: 'types/layouts.d.ts',
getContents: ({ nuxt, app }: { nuxt: Nuxt, app: NuxtApp }) => {
getContents: ({ nuxt, app }) => {
const composablesFile = relative(join(nuxt.options.buildDir, 'types'), resolve(runtimeDir, 'composables'))
return [
'import type { ComputedRef, MaybeRef } from \'vue\'',
Expand Down
2 changes: 2 additions & 0 deletions packages/rspack/builder.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import webpack from '@rspack/core'

export { default as WebpackBarPlugin } from 'webpackbar/rspack'

export const builder = 'rspack'
export { webpack }
export const MiniCssExtractPlugin = webpack.CssExtractRspackPlugin
Loading

0 comments on commit 2e755ec

Please sign in to comment.