Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit 399f944

Browse files
authored
Merge branch 'main' into feat/client-server-components
2 parents 3e78d4f + 93da797 commit 399f944

File tree

160 files changed

+4087
-2519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+4087
-2519
lines changed

.github/ISSUE_TEMPLATE/bug-report-nuxt3.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ body:
88
Please carefully read the contribution docs before creating a bug report
99
👉 https://v3.nuxtjs.org/community/reporting-bugs
1010
11-
Please use the code sandbox template below to create a minimal reproduction
11+
Please use a template below to create a minimal reproduction
12+
👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
1213
👉 https://codesandbox.io/s/github/nuxt/starter/tree/v3-codesandbox
1314
- type: textarea
1415
id: bug-env
@@ -46,4 +47,3 @@ body:
4647
description: |
4748
Optional if provided reproduction. Please try not to insert an image but copy paste the log text.
4849
render: shell
49-

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ name: CI
22

33
on:
44
push:
5+
paths-ignore:
6+
- 'docs/**'
57
branches:
68
- main
79
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
812
branches:
913
- main
1014

@@ -57,9 +61,6 @@ jobs:
5761
- name: Lint
5862
run: yarn lint
5963

60-
- name: Lint (docs)
61-
run: yarn lint:docs
62-
6364
test-fixtures:
6465
runs-on: ${{ matrix.os }}
6566

@@ -141,6 +142,11 @@ jobs:
141142
run: yarn test:types
142143

143144
build-release:
145+
if: |
146+
github.event_name == 'push' &&
147+
!contains(github.event.head_commit.message, '[skip-release]') &&
148+
!contains(github.event.head_commit.message, 'chore') &&
149+
!contains(github.event.head_commit.message, 'docs')
144150
needs:
145151
- lint
146152
- build
@@ -171,11 +177,6 @@ jobs:
171177
key: ${{ matrix.os }}-node-v${{ matrix.node }}-${{ github.sha }}
172178

173179
- name: Release Edge
174-
if: |
175-
github.event_name == 'push' &&
176-
!contains(github.event.head_commit.message, '[skip-release]') &&
177-
!contains(github.event.head_commit.message, 'chore') &&
178-
!contains(github.event.head_commit.message, 'docs')
179180
run: ./scripts/release-edge.sh
180181
env:
181182
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}

.github/workflows/docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
paths:
6+
- 'docs/**'
7+
- '.github/workflows/docs.yml'
8+
branches:
9+
- main
10+
pull_request:
11+
paths:
12+
- 'docs/**'
13+
- '.github/workflows/docs.yml'
14+
branches:
15+
- main
16+
17+
jobs:
18+
lint-docs:
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest]
24+
node: [14]
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-node@v3
29+
with:
30+
node-version: ${{ matrix.node }}
31+
cache: 'yarn'
32+
33+
- name: Install dependencies
34+
run: yarn --immutable
35+
36+
- name: Lint (docs)
37+
run: yarn lint:docs

docs/content/1.getting-started/3.bridge.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ In case you need to extend options provided by `./.nuxt/tsconfig.json` further,
143143

144144
## Migrate Composition API
145145

146-
If you were previously using `@vue/composition-api` or `@nuxtjs/composition-api`, please read the [composition api migration guide](/getting-started/bridge-composition-api).
146+
If you were using `@vue/composition-api` or `@nuxtjs/composition-api`, please read the [composition api migration guide](/getting-started/bridge-composition-api).
147147

148148
### Migrate from CommonJS to ESM
149149

150150
Nuxt 3 natively supports TypeScript and ECMAScript Modules. Please check [Native ES Modules](/concepts/esm) for more info and upgrading.
151151

152152
## Remove incompatible and obsolete modules
153153

154-
- Remove `@nuxt/content` (1.x). A rewrite for nuxt 3 is planned (2.x)
154+
- Remove `@nuxt/content` (1.x). A rewrite for Nuxt 3 is planned (2.x)
155155
- Remove `nuxt-vite`: Bridge enables same functionality
156156
- Remove `@nuxt/typescript-build`: Bridge enables same functionality
157157
- Remove `@nuxt/typescript-runtime` and `nuxt-ts`: Nuxt 2 has built-in runtime support
@@ -219,7 +219,7 @@ export default defineNuxtConfig({
219219
```
220220

221221
This `useMeta` composable uses `@vueuse/head` under the hood (rather than `vue-meta`) to manipulate your `<head>`.
222-
Accordingly, it is recommended not to use both the native Nuxt 2 `head()` properties as well as `useMeta`, as they may conflict.
222+
Accordingly, we recommend not to use both the native Nuxt 2 `head()` properties as well as `useMeta`, as they may conflict.
223223

224224
For more information on how to use this composable, see [the docs](/docs/usage/meta-tags#usemeta-composable).
225225

docs/content/1.getting-started/4.bridge-composition-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ This function has been removed, but its use cases can be met by using `useNuxtAp
114114

115115
These two functions have been replaced with a new composable that works very similarly under the hood: `useState`.
116116

117-
The key differences are that you must provide a _key_ for this state (which previously will have been generated automatically for `ssrRef` and `shallowSsrRef`), and that it can only be called within a Nuxt 3 plugin (which is defined by `defineNuxtPlugin`) or a component instance. (In other words, you cannot use `useState` with a global/ambient context, because of the danger of shared state across requests.)
117+
The key differences are that you must provide a _key_ for this state (which Nuxt generated automatically for `ssrRef` and `shallowSsrRef`), and that it can only be called within a Nuxt 3 plugin (which is defined by `defineNuxtPlugin`) or a component instance. (In other words, you cannot use `useState` with a global/ambient context, because of the danger of shared state across requests.)
118118

119119
```diff
120120
- import { ssrRef } from '@nuxtjs/composition-api'

docs/content/1.getting-started/6.migration.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,26 +107,24 @@ export default () => { }
107107

108108
With Nuxt 3, Nuxt is now a build-time-only dependency, which means that modules shouldn't attempt to hook into the Nuxt runtime.
109109

110-
Your module needs should work even if it's only added to [`buildModules`](/docs/directory-structure/nuxt.config#buildmodules) (instead of `modules`). For example:
110+
Your module should work even if it's only added to [`buildModules`](/docs/directory-structure/nuxt.config#buildmodules) (instead of `modules`). For example:
111111

112112
- Avoid updating `process.env` within a Nuxt module and reading by a nuxt plugin; use [`runtimeConfig`](/docs/directory-structure/nuxt.config#publicruntimeconfig) instead.
113113
- (*) Avoid depending on runtime hooks like `vue-renderer:*` for production
114114
- (*) Avoid adding `serverMiddleware` by importing them inside the module. Instead, add them by referencing a file path so that they are independent of the module's context
115115

116116
(*) Unless it is for `nuxt dev` purpose only and guarded with `if (nuxt.options.dev) { }`.
117117

118-
### Add module meta
119-
120-
Ensure your module is exporting meta object.
121-
122-
\[TODO\]
118+
::alert{type=info icon=🔎}
119+
Continue reading about Nuxt 3 modules in the [Modules guide](/docs/advanced/modules).
120+
::
123121

124122
### Use TypeScript (optional)
125123

126124
While it is not essential, most of the Nuxt ecosystem is shifting to use TypeScript, so it is highly recommended to consider migration.
127125

128126
::alert{icon=💡}
129-
You can start migration by simply renaming `.js` files, to `.ts`. TypeScript is designed to be progressive!
127+
You can start migration by renaming `.js` files, to `.ts`. TypeScript is designed to be progressive!
130128
::
131129

132130
::alert{icon=💡}

docs/content/2.concepts/1.introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To understand what is Nuxt, we need to understand what we need to create a moder
1616

1717
This is only the tip of the iceberg, imagine having to set up all of this for your project, make it work, and then, maintain it over time. We have been doing this since October 2016, tuning all the configurations to provide the best optimization and performance for any Vue application.
1818

19-
Nuxt takes care of all of this so you can focus on what matters: **creating your web application**.
19+
Nuxt takes care of this so you can focus on what matters: **creating your web application**.
2020

2121
On top of this setup, Nuxt provides a [directory structure](/docs/directory-structure/app) to follow, focused on specific features to keep your focus on creating, not configuring.
2222

docs/content/2.concepts/2.vuejs-development.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Nuxt has always used Vue as a frontend framework. We chose to build Nuxt in top
2121

2222
### Components auto-imports
2323

24-
Every Vue components created in the [`components/` directory](/docs/directory-structure/components) of a Nuxt project will be available in your project without having to import them. If a component is not used anywhere, it will not be included in your production’s code.
24+
Every Vue components created in the [`components/` directory](/docs/directory-structure/components) of a Nuxt project will be available in your project without having to import them. If a component is not used anywhere, your production’s code will not include it.
2525

2626
### Vue Router
2727

@@ -39,7 +39,7 @@ Inside the `<template>` of the component, we use the `<Welcome>` component creat
3939
Try to replace the `<template>`’s content with a custom welcome message. The browser window on the right will automatically render the changes without reloading.
4040

4141
::alert{type="info"}
42-
💡 If you are familiar with Vue, you might wonder where is the `main.js` file that creates a Vue app. This part is done by Nuxt behind the scene.
42+
💡 If you are familiar with Vue, you might wonder where is the `main.js` file that creates a Vue app. Nuxt does this part behind the scene.
4343
::
4444

4545
**If you were a previous user of Nuxt 2 or Vue 2, keep reading to get a feel of the differences between Vue 2 and Vue 3, and how Nuxt integrates those evolutions.**
@@ -62,7 +62,7 @@ This results in faster first rendering (component creation) and updates, and les
6262

6363
### Smaller bundle
6464

65-
With Vue 3 and Nuxt 3, a focus has been put on bundle size reduction. With version 3, most of Vue’s functionality, including template directives and built-in components are tree-shakeable. They will not be included in your production bundle if you don’t use them.
65+
With Vue 3 and Nuxt 3, a focus has been put on bundle size reduction. With version 3, most of Vue’s functionality, including template directives and built-in components are tree-shakeable. Your production bundle will not include them if you don’t use them.
6666

6767
This way, a minimal Vue 3 application can be reduced to 12 kb gzipped.
6868

@@ -105,7 +105,7 @@ The goal of Nuxt 3 is to provide a great developer experience around the composi
105105

106106
### Typescript support
107107

108-
Both Vue 3 and Nuxt 3 have been written in Typescript. A fully typed codebase prevents mistakes and documents APIs usage. This doesn’t mean that you have to write your application in Typescript to take advantage of it. With Nuxt 3, you can opt-in by just renaming your file from `.js` to `.ts` , or add `<script lang="ts">` in a component.
108+
Both Vue 3 and Nuxt 3 are written in Typescript. A fully typed codebase prevents mistakes and documents APIs usage. This doesn’t mean that you have to write your application in Typescript to take advantage of it. With Nuxt 3, you can opt-in by renaming your file from `.js` to `.ts` , or add `<script lang="ts">` in a component.
109109

110110
::alert{type="info"}
111111
🔎 [Read the details about Typescript in Nuxt 3](/concepts/typescript)

docs/content/2.concepts/3.rendering.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ While this technique allows building complex and dynamic UIs with smooth page tr
1414
### Pros
1515

1616
- **Development speed**: When working entirely on the client-side, we don't have to worry about the server compatibility of the code, for example, by using browser-only APIs like the `window` object.
17-
- **Cheaper:** Running a server adds a cost of infrastructure as you would need to run on a platform that supports Javascript. We can host Client-only applications on any static server, just with HTML, CSS, and Javascript files.
17+
- **Cheaper:** Running a server adds a cost of infrastructure as you would need to run on a platform that supports Javascript. We can host Client-only applications on any static server with HTML, CSS, and Javascript files.
1818
- **Offline:** Because code entirely runs in the browser, it can nicely keep working while the internet is unavailable.
1919

2020
### Cons
2121

2222
- **Performance**: The user has to wait for the browser to download, parse and run javascript files. Depending on the network for the download part and the user's device for the parsing and execution, this can take some time and impact your user's experience.
23-
- **Search Engine Optimization**: Indexing and updating the content delivered via client-side rendering takes more time than an HTML document already built. This is related to the performance drawback we discussed, as search engine crawlers won't wait for the interface to be fully rendered in their first try to index the page. Therefore, your content will take more time to show and update in search results pages with pure client-side rendering.
23+
- **Search Engine Optimization**: Indexing and updating the content delivered via client-side rendering takes more time than an HTML document already built. This is related to the performance drawback we discussed, as search engine crawlers won't wait for the interface to be fully rendered in their first try to index the page. Your content will take more time to show and update in search results pages with pure client-side rendering.
2424

2525
### Examples
2626

2727
Client-side rendering is a good choice for heavily interactive **web applications** that don't need indexing or frequently use the same users. It can leverage browser caching to skip the download phase on subsequent visits, such as **SaaS, back-office applications, or Online Games**.
2828

2929
## Universal Rendering
3030

31-
When the browser requests a URL with universal (client-side + server-side) rendering enabled, a fully rendered HTML page is returned to the browser. Whether the page has been generated in advance and cached or is rendered on the fly, at some point, Nuxt has run the Javascript (Vue.js) code in a server environment, producing an HTML document. Users immediately get the content of our application, contrary to client-side rendering. This step is similar to traditional **server-side rendering** performed by PHP or Ruby applications.
31+
When the browser requests a URL with universal (client-side + server-side) rendering enabled, the server returns a fully rendered HTML page to the browser. Whether the page has been generated in advance and cached or is rendered on the fly, at some point, Nuxt has run the Javascript (Vue.js) code in a server environment, producing an HTML document. Users immediately get the content of our application, contrary to client-side rendering. This step is similar to traditional **server-side rendering** performed by PHP or Ruby applications.
3232

33-
To not lose the benefits of the client-side rendering method, such as dynamic interfaces and pages transitions, the javascript code that runs on the Server is loaded by the client in the background once the HTML document has been downloaded. Once it is interpreted again by the browser (hence **Universal rendering**), Vue.js takes control of the document and enables interactivity.
33+
To not lose the benefits of the client-side rendering method, such as dynamic interfaces and pages transitions, the Client loads the javascript code that runs on the Server in the background once the HTML document has been downloaded. It is interpreted again by the browser (hence **Universal rendering**) and Vue.js takes control of the document and enables interactivity.
3434

3535
Making a static page interactive in the browser is called "Hydration."
3636

docs/content/2.concepts/4.auto-imports.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Auto imports
22

3-
Nuxt auto-imports helper functions, composables and Vue APIs to use across your application without explicitly importing them. Based on the directory structure, every Nuxt application can also use auto-imports for its own components, composables and plugins. These functions can be used in components, composables or plugins. However, auto imports don't currently work within the server scope. They just work within the Vue portion of your app.
3+
Nuxt auto-imports helper functions, composables and Vue APIs to use across your application without explicitly importing them. Based on the directory structure, every Nuxt application can also use auto-imports for its own components, composables and plugins. Components, composables or plugins can use these functions.
44

55
Contrary to a classic global declaration, Nuxt preserves typings and IDEs completions and hints, and only includes what is actually used in your production code.
66

7-
::alert{type=info}
8-
💡 In the documentation, every function that is not explicitly imported is auto-imported by Nuxt and can be used as-is in your code.
7+
::alert{type=info icon=💡}
8+
In the documentation, every function that is not explicitly imported is auto-imported by Nuxt and can be used as-is in your code.
99
::
1010

11-
::alert{type=info}
12-
🚧 We are working on a proper API reference that will include every Nuxt auto-imports. For now, you can find a reference on the framework repository: [github.com/nuxt/framework/blob/main/packages/nuxt3/src/auto-imports/imports.ts](https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/auto-imports/imports.ts)
11+
::alert{type=info icon=🚧}
12+
We are working on a proper API reference that will include every Nuxt auto-imports. For now, you can find a reference on the framework repository: [github.com/nuxt/framework/blob/main/packages/nuxt3/src/auto-imports/imports.ts](https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/auto-imports/imports.ts)
13+
::
14+
15+
::alert{type=warning}
16+
Auto imports don't currently work within the [server directory](/docs/directory-structure/server).
1317
::
1418

1519
## Nuxt auto-imports

0 commit comments

Comments
 (0)