Skip to content

Commit

Permalink
Merge branch 'main' into fix/config-overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Nov 20, 2023
2 parents ddc09f0 + 0a5911e commit e909050
Show file tree
Hide file tree
Showing 96 changed files with 4,860 additions and 2,110 deletions.
2 changes: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ coverage:
status:
project:
default:
threshold: 5%
threshold: 50%
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm stub
- name: Fix lint issues
run: npm run lint:fix
- uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
- uses: autofix-ci/action@bee19d72e71787c12ca0f29de72f2833e437e4c9
with:
commit-message: "chore: apply automated fixes"
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: pnpm
Expand All @@ -35,7 +35,7 @@ jobs:
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: pnpm
Expand All @@ -49,17 +49,18 @@ jobs:
deno-version: v1.x
- run: pnpm install
- run: pnpm test:types
if: ${{ matrix.os != 'windows-latest' }}
- run: pnpm build
- run: pnpm vitest --coverage
- run: pnpm vitest-es --coverage
env:
NODE_OPTIONS: --experimental-vm-modules --enable-source-maps
- uses: codecov/codecov-action@v3
- name: Release Edge
# - uses: codecov/codecov-action@v3
- name: Release Nightly
if: |
github.event_name == 'push' &&
!contains(github.event.head_commit.message, '[skip-release]') &&
!contains(github.event.head_commit.message, 'chore') &&
!contains(github.event.head_commit.message, 'docs')
run: ./scripts/release-edge.sh
run: ./scripts/release-nightly.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Temporary Items
.env
.netlify
.vercel
.amplify-hosting
staticwebapp.config.json
.eslintcache
playground/firebase.json
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ignore-workspace-root-check=true
shell-emulator=true
126 changes: 126 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,132 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## v2.7.1

[compare changes](https://github.com/unjs/nitro/compare/v2.7.0...v2.7.1)

### 🩹 Fixes

- Recursively simplify returned objects ([#1847](https://github.com/unjs/nitro/pull/1847))
- **cache:** Fix `etag` and `last-modified` values ([#1855](https://github.com/unjs/nitro/pull/1855))
- **cache:** Invalidate wrongly cached handler entities ([#1857](https://github.com/unjs/nitro/pull/1857))

### 🏡 Chore

- Update dependencies ([7a6c61db](https://github.com/unjs/nitro/commit/7a6c61db))
- Update lockfile ([9b5ed9a1](https://github.com/unjs/nitro/commit/9b5ed9a1))
- Update lockfile ([b0ec181d](https://github.com/unjs/nitro/commit/b0ec181d))

### ❤️ Contributors

- Pooya Parsa ([@pi0](http://github.com/pi0))
- Daniel Roe <[email protected]>

## v2.7.0

[compare changes](https://github.com/unjs/nitro/compare/v2.6.3...v2.7.0)

### 🚀 Enhancements

- **vercel:** Support `bypassToken` for on-demand static reganaration ([#1723](https://github.com/unjs/nitro/pull/1723))
- **prerender:** Support `retry` and `retryDelay` ([#1534](https://github.com/unjs/nitro/pull/1534))
- Allow disabling compressed size calculation ([#1756](https://github.com/unjs/nitro/pull/1756))

### 🔥 Performance

- Use native fetch for `node >= 18` to reduce `%40` of bundle size ([#1724](https://github.com/unjs/nitro/pull/1724))

### 🩹 Fixes

- Sort dependencies in `.output/package.json` ([#1708](https://github.com/unjs/nitro/pull/1708))
- Add `application/javascript` mime type in lambda utils ([#1737](https://github.com/unjs/nitro/pull/1737))
- **renderer:** Allow all h3 handled body types ([#1755](https://github.com/unjs/nitro/pull/1755))
- **dev:** Safe error message override ([#1712](https://github.com/unjs/nitro/pull/1712))
- **azure:** Fix cookie format normalization ([#1753](https://github.com/unjs/nitro/pull/1753))
- Exclude undefined from hook types ([#1769](https://github.com/unjs/nitro/pull/1769))
- **iis-node:** Pass `PORT` as `NITRO_UNIX_SOCKET` ([#1783](https://github.com/unjs/nitro/pull/1783))
- **aws-lambda:** Handle `event.isBase64Encoded` ([#1779](https://github.com/unjs/nitro/pull/1779))
- **cache:** Allow overriding integrity ([#1791](https://github.com/unjs/nitro/pull/1791))
- **cache:** Write swr and update errors to console ([#1794](https://github.com/unjs/nitro/pull/1794))
- **cache:** Only return validated stale value ([#1795](https://github.com/unjs/nitro/pull/1795))
- **cache:** Only invalidate if `validate` returns `false` ([#1796](https://github.com/unjs/nitro/pull/1796))
- Watch plugins directory ([#1800](https://github.com/unjs/nitro/pull/1800))
- **cache:** Allow setting multiple `set-cookie` headers (bad practice) ([#1838](https://github.com/unjs/nitro/pull/1838))
- **prerender:** Decode html entities in rendered links ([#1824](https://github.com/unjs/nitro/pull/1824))
- **storage:** Validate and skip invalid mounts ([#1805](https://github.com/unjs/nitro/pull/1805))
- **cache:** Validate `entry.value` to have value for cached handlers ([84559382](https://github.com/unjs/nitro/commit/84559382))
- **cache:** Fix event handler integrity hash generation ([#1820](https://github.com/unjs/nitro/pull/1820))
- **cache:** Set cache item before returning response on first request ([#1813](https://github.com/unjs/nitro/pull/1813))

### 💅 Refactors

- **iis:** Improve preset and docs ([#1784](https://github.com/unjs/nitro/pull/1784))

### 📖 Documentation

- Update prerender options ([11a24124](https://github.com/unjs/nitro/commit/11a24124))
- Fix typo ([#1722](https://github.com/unjs/nitro/pull/1722))
- Register error handler using hook instead of `hookOnce` ([#1743](https://github.com/unjs/nitro/pull/1743))
- Update lock file ([#1750](https://github.com/unjs/nitro/pull/1750))
- Fix typo ([#1759](https://github.com/unjs/nitro/pull/1759))
- Fix configuration file name of the custom preset ([#1760](https://github.com/unjs/nitro/pull/1760))
- Typo in word "legacy" in Configuration docs ([#1780](https://github.com/unjs/nitro/pull/1780))
- **cloudflare:** Add local dev section ([#1772](https://github.com/unjs/nitro/pull/1772))

### 🏡 Chore

- **release:** V2.6.3 ([9bb55262](https://github.com/unjs/nitro/commit/9bb55262))
- Add `.devcontainer` ([#1633](https://github.com/unjs/nitro/pull/1633))
- Update dependencies ([d225d3be](https://github.com/unjs/nitro/commit/d225d3be))
- Fix lint issue ([c3565d8c](https://github.com/unjs/nitro/commit/c3565d8c))
- Update non-major dependencies ([9c2cab26](https://github.com/unjs/nitro/commit/9c2cab26))
- Update lockfile ([179846c7](https://github.com/unjs/nitro/commit/179846c7))
- Fix type issues ([0ff72e29](https://github.com/unjs/nitro/commit/0ff72e29))
- Update vitest to `1.0.0-beta` ([#1776](https://github.com/unjs/nitro/pull/1776))
- Update dependencies ([553e4534](https://github.com/unjs/nitro/commit/553e4534))
- **app:** Fix `localFetch` type ([5f3b287c](https://github.com/unjs/nitro/commit/5f3b287c))
- Use pnpm `shell-emulator` for windows local development ([#1828](https://github.com/unjs/nitro/pull/1828))
- Update lockfile ([f4e33332](https://github.com/unjs/nitro/commit/f4e33332))
- Use `nitropack-nightly` for nightly release channel ([#1841](https://github.com/unjs/nitro/pull/1841))
- Increase codecov threshold ([bc464032](https://github.com/unjs/nitro/commit/bc464032))
- Update lockfile ([f53e3575](https://github.com/unjs/nitro/commit/f53e3575))

### ✅ Tests

- Temporaily disable dev test in ci ([53a96adb](https://github.com/unjs/nitro/commit/53a96adb))
- Update deno test with explicit host ([8cce5085](https://github.com/unjs/nitro/commit/8cce5085))
- Update reponse type check ([#1839](https://github.com/unjs/nitro/pull/1839))

### 🤖 CI

- Run tests against node 18 ([#1713](https://github.com/unjs/nitro/pull/1713))
- Run vitest with es and sourcemap support ([c4c00467](https://github.com/unjs/nitro/commit/c4c00467))

### ❤️ Contributors

- Pooya Parsa ([@pi0](http://github.com/pi0))
- Yasser Lahbibi ([@yassilah](http://github.com/yassilah))
- Horu
- Michael Brevard <[email protected]>
- Daniel Roe <[email protected]>
- MiniDigger < Martin>
- Estéban ([@Barbapapazes](http://github.com/Barbapapazes))
- Heb ([@Hebilicious](http://github.com/Hebilicious))
- Henrique Lopes
- McPizza <[email protected]>
- Michael BOUVY <[email protected]>
- Jeremy Graziani
- Tobias Diez <[email protected]>
- VALERIY SINEVICH
- Roman Zipp <[email protected]>
- Benjamin GAYMAY ([@BenjaminGaymay](http://github.com/BenjaminGaymay))
- Alexander Lichter ([@manniL](http://github.com/manniL))
- Farnabaz ([@farnabaz](http://github.com/farnabaz))
- Nils K
- Jonas Thelemann ([@dargmuesli](http://github.com/dargmuesli))
- Jenjen75 <[email protected]>
- Sébastien Chopin ([@Atinux](http://github.com/Atinux))

## v2.6.3

[compare changes](https://github.com/unjs/nitro/compare/v2.6.2...v2.6.3)
Expand Down
10 changes: 5 additions & 5 deletions docs/content/1.guide/0.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ npm run preview
```


## Edge Release Channel
## Nightly Release Channel

Nitro offers an edge release channel that automatically releases for every commit to `main` branch.
Nitro offers a nightly release channel that automatically releases for every commit to `main` branch.

You can opt-in to the edge release channel by updating your `package.json`:
You can opt-in to the nightly release channel by updating your `package.json`:

::code-group
```diff [Nitro]
{
"devDependencies": {
-- "nitropack": "^2.0.0"
++ "nitropack": "npm:nitropack-edge@latest"
++ "nitropack": "npm:nitropack-nightly@latest"
}
}
```
Expand All @@ -120,7 +120,7 @@ You can opt-in to the edge release channel by updating your `package.json`:
::

::alert
If you are using Nuxt, [use the Nuxt edge channel](https://nuxt.com/docs/guide/going-further/edge-channel#opting-into-the-edge-channel) as it already includes `nitropack-edge`.
If you are using Nuxt, [use the Nuxt nightly channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel#opting-in) as it already includes `nitropack-nightly`.
::

Remove the lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`) and reinstall the dependencies.
3 changes: 2 additions & 1 deletion docs/content/1.guide/3.routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ nitro.config.ts
### Simple Middleware

Middleware are defined exactly like route handlers with the only exception that they should not return anything.
Returning from middleware behaves like returning from a request - the value will be returned as a response and further code will not be ran.

```ts [middleware/auth.ts]
export default defineEventHandler((event) => {
Expand All @@ -181,7 +182,7 @@ export default defineEventHandler((event) => {
```

::alert
Returning anything from a middleware will close the request and should be avoided!
Returning anything from a middleware will close the request and should be avoided! Any returned value from middleware will be the response and further code will not be executed however **this is not recommended to do!**
::

### Execution Order
Expand Down
1 change: 1 addition & 0 deletions docs/content/2.deploy/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ When running Nitro in development mode, Nitro will always use a special preset c

When deploying to the production using CI/CD, Nitro tries to automatically detect the provider environment and set the right one without any additional configuration. Currently, providers below can be auto-detected with zero config.

- [aws amplify](/deploy/providers/aws-amplify)
- [azure](/deploy/providers/azure)
- [cloudflare pages](/deploy/providers/cloudflare#cloudflare-pages)
- [netlify](/deploy/providers/netlify)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
icon: ri:global-line
---

# Workers
# Edge Workers

Nitro provides out of the box support for deploying to Edge Workers.

Expand All @@ -11,7 +11,7 @@ Nitro provides out of the box support for deploying to Edge Workers.
Nitro provides out of the box support for deploying any Nitro app to different Edge Worker offerings as well as Service Workers.

- [Cloudflare](/deploy/providers/cloudflare)
- [Deno](/deploy/providers/deno)
- [Deno Deploy](/deploy/providers/deno-deploy)
- [Vercel](/deploy/providers/vercel#vercel-edge-functions)
- [Netlify](/deploy/providers/netlify#netlify-edge-functions)
- [Lagon](/deploy/providers/lagon)
Expand Down
1 change: 1 addition & 0 deletions docs/content/2.deploy/10.runtimes/_dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
icon: codicon:run-all
36 changes: 36 additions & 0 deletions docs/content/2.deploy/10.runtimes/_winterjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
icon: game-icons:cold-heart
---

# WinterJS

**Preset:** `winterjs` ([switch to this preset](/deploy/#changing-the-deployment-preset))

You can easily build Nitro powered applications to run with [wasmerio/winterjs](https://github.com/wasmerio/winterjs) runtime.

[WinterJS](https://github.com/wasmerio/winterjs) is a JavaScript Service Workers server written in Rust, that uses the SpiderMonkey runtime to execute JavaScript (the same runtime that Firefox uses) ([announcement](https://wasmer.io/posts/announcing-winterjs-service-workers)).


::alert{type="warning"}
🌙 WinterJS is currently supported in **nightly release channel**. Read the docs for using [Nightly Release Channel](/guide/getting-started#nightly-release-channel).
::


::alert{type="warning"}
🚧 WinterJS runtime is unstable and under heavy development. Follow [unjs/nitro#1861](https://github.com/unjs/nitro/issues/1861) for status and information.
::


In order to build for this runtime, use `NITRO_PRESET="winterjs"` environment variable:

```sh
NITRO_PRESET="winterjs" npm run build
```

Make sure you have `wasmer` installed locally ([install wasmer](https://docs.wasmer.io/install))

Run locally:

```sh
wasmer run wasmer/winterjs --forward-host-env --net --mapdir app:.output app/server/index.mjs
```
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
---
icon: simple-icons:bun

---

# Bun

Run Nitro apps with [Bun](https://bun.sh/) runtime.

**Preset:** `bun` ([switch to this preset](/deploy/#changing-the-deployment-preset))

::alert{type="warning"}
Bun preset is experimental and available to try via [edge channel](/guide/getting-started#edge-release-channel).
Bun preset is experimental and available to try via [edge channel](/guide/getting-started#nightly-release-channel).
::

## Building for Bun
Expand Down
25 changes: 25 additions & 0 deletions docs/content/2.deploy/10.runtimes/deno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
icon: simple-icons:deno
---

# Deno

Run Nitro apps with [Deno](https://deno.com/) runtime.

## Deno Server

**Preset:** `deno-server` ([switch to this preset](/deploy/#changing-the-deployment-preset))

::alert{type="warning"}
Deno runtime preset is experimental.
::

You can build your Nitro server using Node.js to run within [Deno Runtime](https://deno.com/runtime) in a custom server.

```bash
# Build with the deno NITRO preset
NITRO_PRESET=deno-server npm run build

# Start production server
deno run --unstable --allow-net --allow-read --allow-env .output/server/index.ts
```
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/content/2.deploy/20.providers/_dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
icon: tdesign:cloud
Loading

0 comments on commit e909050

Please sign in to comment.