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

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/nuxt-ssr-runtime…
Browse files Browse the repository at this point in the history
…-template-compiler
  • Loading branch information
danielroe committed Apr 6, 2023
2 parents 3ccd6d5 + 7b5c755 commit 7caacf1
Show file tree
Hide file tree
Showing 32 changed files with 404 additions and 170 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/autofix-docs.yml
@@ -0,0 +1,30 @@
name: autofix.ci # needed to securely identify the workflow

on:
pull_request:
paths:
- "docs/**"
- ".github/workflows/docs.yml"

permissions:
contents: read

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Lint (docs)
run: pnpm lint:docs:fix

- uses: autofix-ci/action@8bc06253bec489732e5f9c52884c7cace15c0160
42 changes: 42 additions & 0 deletions .github/workflows/autofix.yml
@@ -0,0 +1,42 @@
name: autofix.ci # needed to securely identify the workflow

on:
pull_request:
paths-ignore:
- "docs/**"

permissions:
contents: read

jobs:
code:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Dedupe dependencies
if: ${{ contains(github.ref_name, 'renovate') }}
run: pnpm dedupe

- name: Build (stub)
run: pnpm build:stub

- name: Lint (code)
run: pnpm lint:fix

- name: Test (unit)
run: pnpm test:unit -u

- name: Update bundle size
run: pnpm vitest run bundle -u

- uses: autofix-ci/action@8bc06253bec489732e5f9c52884c7cace15c0160
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -88,6 +88,8 @@ jobs:
run: pnpm test:types

lint:
# autofix workflow will be triggered instead for PRs
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 10

Expand Down Expand Up @@ -169,9 +171,6 @@ jobs:

- name: Test (unit)
run: pnpm test:unit
env:
TEST_ENV: ${{ matrix.env }}
TEST_BUILDER: ${{ matrix.builder }}

- name: Test (fixtures)
run: pnpm test:fixtures
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/docs.yml
Expand Up @@ -5,14 +5,13 @@ on:
paths:
- "docs/**"
- ".github/workflows/docs.yml"
# autofix workflow will be triggered instead for PRs
branches:
- main
pull_request:
paths:
- "docs/**"
- ".github/workflows/docs.yml"
branches:
- main

# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}

jobs:
lint-docs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/introspect.yml
@@ -1,4 +1,4 @@
name: Docs
name: CI

on:
push:
Expand Down
2 changes: 2 additions & 0 deletions .markdownlint.yml
Expand Up @@ -12,3 +12,5 @@ MD025: false
MD033: false
# Allow non blank lines around list
MD032: false
MD046:
style: fenced
6 changes: 3 additions & 3 deletions .markdownlintignore
@@ -1,5 +1,5 @@
**/node_modules

docs/content/index.md
docs/content/**/*.nuxt.config.md
docs/content/changelog.md
docs/0.index.md
docs/1.getting-started/1.introduction.md
docs/**/*.nuxt.config.md
2 changes: 1 addition & 1 deletion docs/1.getting-started/10.deployment.md
Expand Up @@ -141,7 +141,7 @@ Nuxt 3 can be deployed to several cloud providers with a minimal amount of confi
- :icon{name="logos:microsoft-azure" class="h-5 w-4 inline mb-2"} [Azure](https://nitro.unjs.io/deploy/providers/azure)
- :icon{name="ph:cloud-duotone" class="h-5 w-4 inline mb-2"} [Cleavr](https://nitro.unjs.io/deploy/providers/cleavr)
- :icon{name="logos:cloudflare" class="h-5 w-4 inline mb-2"} [CloudFlare](https://nitro.unjs.io/deploy/providers/cloudflare)
- :icon{name="logos:digital-ocean" class="h-5 w-4 inline mb-2"} [Digital Ocean](https://nitro.unjs.io/deploy/providers/digitalocean)
- :icon{name="logos:digital-ocean" class="h-5 w-4 inline mb-2"} [DigitalOcean](https://nitro.unjs.io/deploy/providers/digitalocean)
- :icon{name="logos:firebase" class="h-5 w-4 inline mb-2"} [Firebase](https://nitro.unjs.io/deploy/providers/firebase)
- :icon{name="logos:heroku-icon" class="h-5 w-4 inline mb-2"} [heroku](https://nitro.unjs.io/deploy/providers/heroku)
- :icon{name="ph:cloud-duotone" class="h-5 w-4 inline mb-2"} [Edgio](https://nitro.unjs.io/deploy/providers/edgio)
Expand Down
40 changes: 22 additions & 18 deletions docs/1.getting-started/2.installation.md
Expand Up @@ -19,28 +19,32 @@ Start with one of our starters and themes directly by opening [nuxt.new](https:/

## New Project

<!-- TODO: need to fix upstream in nuxt/nuxt.com -->
<!-- markdownlint-disable-next-line MD001 -->
#### Prerequisites

- **Node.js** - [`v16.10.0`](https://nodejs.org/en/) or newer
- **Text editor** - We recommend [Visual Studio Code]() with the [Volar Extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
- **Text editor** - We recommend [Visual Studio Code](https://code.visualstudio.com/) with the [Volar Extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
- **Terminal** - In order to run Nuxt commands

::alert
::details
:summary[Additional notes for an optimal setup:]
- **Node.js**: Make sure to use an even numbered version (16, 18, etc)

- **Volar**: Either enable [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) (recommended) or add the [TypeScript Vue Plugin](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)

If you have enabled **Take Over Mode** or installed the **TypeScript Vue Plugin (Volar)**, you can disable generating the shim for `*.vue` files in your `nuxt.config.ts` file:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
typescript: {
shim: false
}
})
```
::
::details
:summary[Additional notes for an optimal setup:]
- **Node.js**: Make sure to use an even numbered version (16, 18, etc)

- **Volar**: Either enable [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) (recommended) or add the [TypeScript Vue Plugin](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)

If you have enabled **Take Over Mode** or installed the **TypeScript Vue Plugin (Volar)**, you can disable generating the shim for `*.vue` files in your `nuxt.config.ts` file:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
typescript: {
shim: false
}
})
```

::
::

Open a terminal (if you're using [Visual Studio Code](https://code.visualstudio.com/), you can open an [integrated terminal](https://code.visualstudio.com/docs/editor/integrated-terminal)) and use the following command to create a new starter project:
Expand Down Expand Up @@ -110,4 +114,4 @@ Well done! A browser window should automatically open for <http://localhost:3000

Now that you've created your Nuxt 3 project, you are ready to start building your application.

* Learn about the framework [concepts](/docs/guide/concepts/auto-imports)
- Learn about the framework [concepts](/docs/guide/concepts/auto-imports)
1 change: 0 additions & 1 deletion docs/1.getting-started/8.error-handling.md
Expand Up @@ -48,7 +48,6 @@ This includes:

You cannot currently define a server-side handler for these errors, but can render an error page (see the next section).


### Errors downloading JS chunks

You might encounter chunk loading errors due to a network connectivity failure or a new deployment (which invalidates your old, hashed JS chunk URLs). Nuxt provides built-in support for handling chunk loading errors by performing a hard reload when a chunk fails to load during route navigation.
Expand Down
6 changes: 5 additions & 1 deletion docs/2.guide/1.concepts/1.auto-imports.md
Expand Up @@ -17,6 +17,10 @@ You can find a reference for auto-imported [composables](/docs/api/composables/u
In the [server directory](/docs/guide/directory-structure/server), we auto import exported functions and variables from `server/utils/`.
::

::alert
You can also auto-import functions exported from custom folders or third-party packages by configuring the [`imports` section](/docs/api/configuration/nuxt-config#imports) of your `nuxt.config` file.
::

## Built-in Auto-imports

### Nuxt Auto-imports
Expand Down Expand Up @@ -46,7 +50,7 @@ Vue 3 exposes Reactivity APIs like `ref` or `computed`, as well as lifecycle hoo

<!-- TODO: move to separate page with https://github.com/nuxt/nuxt/issues/14723 and add more information -->

When you are using the built-in composition API composables provided by Vue and Nuxt, be aware that many of them rely on being called in the right _context_.
When you are using the built-in Composition API composables provided by Vue and Nuxt, be aware that many of them rely on being called in the right _context_.

During a component lifecycle, Vue tracks the temporary instance of the current component (and similarly, Nuxt tracks a temporary instance of `nuxtApp`) via a global variable, and then unsets it in same tick. This is essential when server rendering, both to avoid cross-request state pollution (leaking a shared reference between two users) and to avoid leakage between different components.

Expand Down
3 changes: 3 additions & 0 deletions docs/2.guide/2.directory-structure/1.modules.md
Expand Up @@ -16,6 +16,7 @@ The auto-registered files patterns are:
You don't need to add those local modules to your [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt.config) separately.

::code-group

```ts [modules/hello/index.ts]
// `nuxt/kit` is a helper subpath import you can use when defining local modules
// that means you do not need to add `@nuxt/kit` to your project's dependencies
Expand All @@ -36,11 +37,13 @@ export default defineNuxtModule({
}
})
```

```ts [modules/hello/runtime/api-route.ts]
export default defineEventHandler(() => {
return { hello: 'world' }
}
```
::
When starting Nuxt, the `hello` module will be registered and the `/api/hello` route will be available.
Expand Down
2 changes: 1 addition & 1 deletion docs/2.guide/2.directory-structure/1.plugins.md
Expand Up @@ -134,7 +134,7 @@ export { }
```

::alert{type=warning}
If you are using WebStorm, you may need to augment `@vue/runtime-core` until [this issue](https://youtrack.jetbrains.com/issue/WEB-59818/VUE-Typescript-WS-PS-does-not-correctly-display-type-of-globally-injected-properties) is resolved.
If you are using WebStorm, you may need to augment `@vue/runtime-core` until [this issue](https://youtrack.jetbrains.com/issue/WEB-59818/VUE-TypeScript-WS-PS-does-not-correctly-display-type-of-globally-injected-properties) is resolved.
::

## Vue Plugins
Expand Down
1 change: 0 additions & 1 deletion docs/2.guide/2.directory-structure/3.app-config.md
Expand Up @@ -91,4 +91,3 @@ declare module 'nuxt/schema' {
// It is always important to ensure you import/export something when augmenting a type
export {}
```

7 changes: 5 additions & 2 deletions docs/2.guide/3.going-further/3.modules.md
Expand Up @@ -424,6 +424,7 @@ export default defineNuxtModule({
:ReadMore{link="/docs/api/advanced/hooks" title="API > Advanced > Hooks"}
::alert{type=info}
**Module cleanup**
If your module opens, handles, or starts a watcher, you should close it when the Nuxt lifecycle is done. The `close` hook is available for this.
Expand All @@ -440,6 +441,8 @@ export default defineNuxtModule({
})
```
::
#### Augmenting Types
If your module should augment types handled by Nuxt, you can use the `prepare:types` hook to perform this operation.
Expand Down Expand Up @@ -589,9 +592,9 @@ Consider documenting module usage in the readme file:
Linking to the integration website and documentation is always a good idea.
#### Provide a Stackblitz Demo or Boilerplate
#### Provide a StackBlitz Demo or Boilerplate
It's a good practice to make a minimal reproduction with your module and [StackBlitz](https://nuxt.new/s/v3) that you add to your module readme.
It's a good practice to make a minimal reproduction with your module and [StackBlitz](https://nuxt.new/s/v3) that you add to your module readme.
This not only provides potential users of your module a quick and easy way to experiment with the module but also an easy way for them to build minimal reproductions they can send you when they encounter issues.
Expand Down
1 change: 1 addition & 0 deletions docs/3.api/1.composables/use-head-safe.md
Expand Up @@ -9,6 +9,7 @@ The `useHeadSafe` composable is a wrapper around the [`useHead`](/docs/api/compo
## Usage

You can pass all the same values as `useHead`

```ts
useHeadSafe({
script: [
Expand Down
2 changes: 1 addition & 1 deletion docs/3.api/4.advanced/1.hooks.md
Expand Up @@ -46,7 +46,7 @@ Hook | Arguments | Description
`app:templatesGenerated` | `app` | Called after templates are compiled into the [virtual file system](https://nuxt.com/docs/guide/directory-structure/nuxt#virtual-file-system) (vfs).
`build:before` | - | Called before Nuxt bundle builder.
`build:done` | - | Called after Nuxt bundle builder is complete.
`build:manifest` | `manifest` | Called during the manifest build by Vite and Webpack. This allows customizing the manifest that Nitro will use to render `<script>` and `<link>` tags in the final HTML.
`build:manifest` | `manifest` | Called during the manifest build by Vite and webpack. This allows customizing the manifest that Nitro will use to render `<script>` and `<link>` tags in the final HTML.
`builder:generateApp` | `options` | Called before generating the app.
`builder:watch` | `event, path` | Called at build time in development when the watcher spots a change to a file or directory in the project.
`pages:extend` | `pages` | Called after pages routes are resolved.
Expand Down
2 changes: 1 addition & 1 deletion docs/3.api/5.commands/devtools.md
@@ -1,6 +1,6 @@
---
title: "nuxi devtools"
description: The devtools command allows you to enable or disable Nuxt Devtools on a per-project basis.
description: The devtools command allows you to enable or disable Nuxt DevTools on a per-project basis.
---

# `nuxi devtools`
Expand Down
15 changes: 11 additions & 4 deletions docs/5.community/5.framework-contribution.md
Expand Up @@ -134,11 +134,18 @@ git checkout -b my-new-branch

### Set Up Documentation Website in Local Environment

We are using [Docus](https://docus.dev) for documentation.
The Nuxt documentation is currently deployed within [nuxt/nuxt.com](https://github.com/nuxt/nuxt.com) as a layer.

- Run `pnpm build:stub` once in the root directory
- Go into the docs directory: `cd docs`
- Install docs dependencies using `yarn install`
- Run `yarn dev` to start docs in development mode
<!-- - Go into the docs directory: `cd docs` -->
<!-- - Install docs dependencies using `yarn install` -->
<!-- - Run `yarn dev` to start docs in development mode -->
- Before opening a PR, run `pnpm docs:lint:fix` to highlight and resolve any lint issues

::alert
🚧 This repository will be open-sourced shortly. Until then, you will need to open a pull request to see a preview of your changes.
::

::alert
We recommend that you install the [MDC extension](https://marketplace.visualstudio.com/items?itemName=Nuxt.mdc) for VS Code.
::
1 change: 0 additions & 1 deletion docs/7.migration/2.configuration.md
Expand Up @@ -88,7 +88,6 @@ Nuxt and Nuxt Modules are now build-time-only.
})
```


::alert
If you are a module author, you can check out [more information about module compatibility](/docs/migration/module-authors) and [our module author guide](/docs/guide/going-further/modules).
::
Expand Down
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -12,8 +12,9 @@
"example": "./scripts/example.sh dev",
"example:build": "./scripts/example.sh build",
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
"lint:docs": "markdownlint ./docs/content/1.docs && case-police 'docs/content/1.docs/**/*.md'",
"lint:docs:fix": "markdownlint ./docs/content/1.docs --fix && case-police 'docs/content/1.docs/**/*.md' --fix",
"lint:fix": "eslint --ext .vue,.ts,.js,.mjs . --fix",
"lint:docs": "markdownlint ./docs && case-police 'docs/**/*.md'",
"lint:docs:fix": "markdownlint ./docs --fix && case-police 'docs/**/*.md' --fix",
"nuxi": "JITI_ESM_RESOLVE=1 nuxi",
"nuxt": "JITI_ESM_RESOLVE=1 nuxi",
"play": "pnpm nuxi dev playground",
Expand Down Expand Up @@ -77,7 +78,7 @@
"vitest": "^0.29.8",
"vue-tsc": "^1.2.0"
},
"packageManager": "pnpm@8.1.0",
"packageManager": "pnpm@8.1.1",
"engines": {
"node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Expand Up @@ -36,7 +36,7 @@
"scule": "^1.0.0",
"semver": "^7.3.8",
"unctx": "^2.1.2",
"unimport": "^3.0.4",
"unimport": "^3.0.6",
"untyped": "^1.3.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/package.json
Expand Up @@ -96,7 +96,7 @@
"ufo": "^1.1.1",
"unctx": "^2.1.2",
"unenv": "^1.2.2",
"unimport": "^3.0.4",
"unimport": "^3.0.6",
"unplugin": "^1.3.1",
"untyped": "^1.3.2",
"vue": "^3.2.47",
Expand Down

0 comments on commit 7caacf1

Please sign in to comment.