Skip to content

Commit

Permalink
Merge branch 'main' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Apr 7, 2023
2 parents 5274c61 + c2e1e7c commit 854068e
Show file tree
Hide file tree
Showing 37 changed files with 3,607 additions and 3,512 deletions.
5 changes: 5 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
threshold: 5%
145 changes: 145 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,151 @@

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.3.2

[compare changes](https://github.com/unjs/nitro/compare/v2.3.1...v2.3.2)


### 🩹 Fixes

- Sanitize `statusMessage` of disallowed chars ([#1057](https://github.com/unjs/nitro/pull/1057))
- **types:** Sync vercel build config types ([#1056](https://github.com/unjs/nitro/pull/1056))
- **azure:** Support custom baseURL ([#1062](https://github.com/unjs/nitro/pull/1062))
- **vercel-edge:** Fix route generation ([#1071](https://github.com/unjs/nitro/pull/1071))
- Mark `options.renderer` as optional ([#1069](https://github.com/unjs/nitro/pull/1069))
- **types:** Make $Fetch types less complex ([#1059](https://github.com/unjs/nitro/pull/1059))

### 💅 Refactors

- Add type safety to auto-detected providers ([#1072](https://github.com/unjs/nitro/pull/1072))

### 📖 Documentation

- Fixed link path ([#1053](https://github.com/unjs/nitro/pull/1053))
- Fix typo ([#1068](https://github.com/unjs/nitro/pull/1068))
- **routing:** Add `$fetch` usage note ([#1070](https://github.com/unjs/nitro/pull/1070))

### ❤️ Contributors

- Mahdi Boomeri <mahdi@boomeri.dev>
- Daniel Roe <daniel@roe.dev>
- Shohei Maeda
- Lucas ([@Draichi](http://github.com/Draichi))
- Nobkd
- Honza Pobořil <honza@poboril.cz>

## v2.3.1

[compare changes](https://github.com/unjs/nitro/compare/v2.3.0...v2.3.1)


### 🩹 Fixes

- **types:** Don't simplify type of serialized return ([#1050](https://github.com/unjs/nitro/pull/1050))

### 🏡 Chore

- Add `codecov.yml` ([6fe7f64](https://github.com/unjs/nitro/commit/6fe7f64))

### ❤️ Contributors

- Pooya Parsa ([@pi0](http://github.com/pi0))
- Daniel Roe <daniel@roe.dev>

## v2.3.0

[compare changes](https://github.com/unjs/nitro/compare/v2.2.3...v2.3.0)


### 🚀 Enhancements

- **vercel:** Add functions config ([#976](https://github.com/unjs/nitro/pull/976))
- Add support for `sourceMap` values `hidden` and `inline` ([#998](https://github.com/unjs/nitro/pull/998))
- **lagon:** Write `.lagon/config.json` on build ([#996](https://github.com/unjs/nitro/pull/996))
- **types:** Type $fetch to match json serialization output ([#1002](https://github.com/unjs/nitro/pull/1002))
- Support base in `useStorage(base?: string)` and improve docs ([#1012](https://github.com/unjs/nitro/pull/1012))
- **cloudflare-pages:** Rewrite with module syntax ([#1004](https://github.com/unjs/nitro/pull/1004))
- Allow customising generated tsconfig path ([#1021](https://github.com/unjs/nitro/pull/1021))
- Support app config ([#1022](https://github.com/unjs/nitro/pull/1022))

### 🩹 Fixes

- **cloudflare-pages:** Only allow 100 rules combined ([#973](https://github.com/unjs/nitro/pull/973))
- Only mock `debug` in production ([#990](https://github.com/unjs/nitro/pull/990))
- Scan middleware and print tree list in ascending alphabetical order ([#981](https://github.com/unjs/nitro/pull/981))
- **externals:** Correctly specify multiple external dependencies in package.json ([#1013](https://github.com/unjs/nitro/pull/1013))
- **static:** Use correct format for last modified ([#1017](https://github.com/unjs/nitro/pull/1017))
- **cache:** Remove rejected cache promise from pending list. ([#995](https://github.com/unjs/nitro/pull/995))
- Expose `useStorage` with types ([#1026](https://github.com/unjs/nitro/pull/1026))
- **prerender:** Allow spaces in `href` value regex ([#1030](https://github.com/unjs/nitro/pull/1030))
- **cache:** Use stale value by default when `swr` is enabled ([#1038](https://github.com/unjs/nitro/pull/1038))
- Resolve types relative to custom tsconfig path ([#1041](https://github.com/unjs/nitro/pull/1041))
- Remove duplicate import in generated code ([#1043](https://github.com/unjs/nitro/pull/1043))
- **types:** Exclude non serializable options from route rules ([#1047](https://github.com/unjs/nitro/pull/1047))

### 💅 Refactors

- Use unimport built-in type gen for dirs ([#994](https://github.com/unjs/nitro/pull/994))
- Split out api types ([#1027](https://github.com/unjs/nitro/pull/1027))

### 📖 Documentation

- Update to latest docus and various improvements ([#975](https://github.com/unjs/nitro/pull/975))
- Up docus and add back ellipsis ([38b1f34](https://github.com/unjs/nitro/commit/38b1f34))
- Remove tailwind module ([b3b7e87](https://github.com/unjs/nitro/commit/b3b7e87))
- **lock:** Update ([7efa31f](https://github.com/unjs/nitro/commit/7efa31f))
- More improvements ([#985](https://github.com/unjs/nitro/pull/985))
- Remove fluid layout ([d83f2b6](https://github.com/unjs/nitro/commit/d83f2b6))
- Update color ([18674c5](https://github.com/unjs/nitro/commit/18674c5))
- Add unjs icon in footer ([6d36ceb](https://github.com/unjs/nitro/commit/6d36ceb))
- Update docus ([5fcc127](https://github.com/unjs/nitro/commit/5fcc127))
- Add button to open on CodeSandBox ([ad120ac](https://github.com/unjs/nitro/commit/ad120ac))
- Update deployment example for configuration ([#972](https://github.com/unjs/nitro/pull/972))
- Update dependencies ([c923fed](https://github.com/unjs/nitro/commit/c923fed))
- **cache:** Improve documentation and `cachedFunction` default options ([#1011](https://github.com/unjs/nitro/pull/1011))
- Improve readme and getting started ([94d95fa](https://github.com/unjs/nitro/commit/94d95fa))
- Fix on mobile long path ([1d2f57e](https://github.com/unjs/nitro/commit/1d2f57e))
- Improvements ([f78619f](https://github.com/unjs/nitro/commit/f78619f))
- Add `prerender.ignore` description ([#1032](https://github.com/unjs/nitro/pull/1032))
- Improve configuration page ([554b358](https://github.com/unjs/nitro/commit/554b358))
- Improve plugins section ([f36a6e0](https://github.com/unjs/nitro/commit/f36a6e0))
- Update readme ([c58a764](https://github.com/unjs/nitro/commit/c58a764))
- Update homepage hero ([b848e5a](https://github.com/unjs/nitro/commit/b848e5a))
- Update meta tags ([70f00e5](https://github.com/unjs/nitro/commit/70f00e5))
- More improvements ([#1039](https://github.com/unjs/nitro/pull/1039))
- Update docus version ([f31240b](https://github.com/unjs/nitro/commit/f31240b))
- Upgrade docus ([a6ce587](https://github.com/unjs/nitro/commit/a6ce587))
- **deploy/workers:** Fix typo of bundle ([#1046](https://github.com/unjs/nitro/pull/1046))

### 🏡 Chore

- **readme:** Various improvements ([#1009](https://github.com/unjs/nitro/pull/1009))
- Fix tests ([#1014](https://github.com/unjs/nitro/pull/1014))
- **docs:** Use pnpm ([39f117a](https://github.com/unjs/nitro/commit/39f117a))
- Add autofix-ci action ([8f9c3e2](https://github.com/unjs/nitro/commit/8f9c3e2))
- Remove old docs commands ([#1042](https://github.com/unjs/nitro/pull/1042))
- Update dependencies ([02c48f2](https://github.com/unjs/nitro/commit/02c48f2))
- Maintain lockfile ([ac81602](https://github.com/unjs/nitro/commit/ac81602))
- Use single undici version for testing ([00743bc](https://github.com/unjs/nitro/commit/00743bc))

### ❤️ Contributors

- Pooya Parsa ([@pi0](http://github.com/pi0))
- Daniel Roe <daniel@roe.dev>
- Felix De Montis <hi@felix.dm>
- Sébastien Chopin ([@Atinux](http://github.com/Atinux))
- Hannes Küttner <kuettner.hannes@gmail.com>
- Julie Saia
- Ted De Koning
- Jan Johansen <nizopezo@gmail.com>
- Tobias Diez <code@tobiasdiez.com>
- Elian ☕️ <hello@elian.codes>
- Mahdi Boomeri <mahdi@boomeri.dev>
- Anthony Fu <anthonyfu117@hotmail.com>
- Tom Lienard ([@QuiiBz](http://github.com/QuiiBz))
- Alex Korytskyi ([@alex-key](http://github.com/alex-key))
- Shohei Maeda

## v2.2.3

[compare changes](https://github.com/unjs/nitro/compare/v2.2.2...v2.2.3)
Expand Down
2 changes: 1 addition & 1 deletion docs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineAppConfig({
iconLinks: [
{
href: "https://unjs.io",
icon: "vscode-icons:file-type-js-official",
icon: "IconUnJS",
label: "UnJS",
},
],
Expand Down
32 changes: 32 additions & 0 deletions docs/components/global/IconUnJS.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<svg
width="70"
height="70"
viewBox="0 0 70 70"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M69.8123 70.0485C46.5425 70.0485 23.2983 70.0485 0.0540217 70.0485C0.0521683 70.0422 0.0486903 70.036 0.0486903 70.0298C0.0484606 46.7047 0.0484619 23.3797 0.0484619 0.0515747C23.3795 0.0515747 46.7106 0.0515747 70.0451 0.0515747C70.0451 23.3793 70.0451 46.7101 70.0451 70.0485C69.9783 70.0485 69.9081 70.0485 69.8123 70.0485ZM57.7765 45.794C57.6648 45.6665 57.5592 45.5332 57.4406 45.4125C56.1262 44.0761 54.4711 43.7975 52.709 43.9566C51.1807 44.0947 49.8716 44.7674 48.74 45.7939C48.6789 45.8493 48.6121 45.8986 48.524 45.9702C48.524 45.8272 48.5298 45.7228 48.5231 45.6192C48.4902 45.1114 48.2516 44.7265 47.7999 44.4951C47.3572 44.2684 46.9046 44.29 46.487 44.5568C46.0227 44.8534 45.8642 45.3094 45.8647 45.8453C45.868 49.8601 45.8665 53.8748 45.8665 57.8896C45.8665 58.14 45.8615 58.3906 45.8676 58.6409C45.8831 59.2854 46.2248 59.7959 46.7437 59.9593C47.6541 60.2459 48.5225 59.6147 48.5238 58.6545C48.5274 55.8999 48.5267 53.1453 48.524 50.3907C48.5233 49.6149 48.7195 48.9035 49.2143 48.2979C50.3673 46.8867 51.8603 46.2907 53.6664 46.4964C54.546 46.5967 55.2568 47.0049 55.7444 47.7588C56.2019 48.4663 56.3586 49.2649 56.3649 50.0872C56.3821 52.3569 56.3755 54.6268 56.3779 56.8966C56.3786 57.5186 56.3683 58.1408 56.3804 58.7626C56.3994 59.7352 57.4448 60.3372 58.3009 59.8751C58.8453 59.5813 59.0387 59.1008 59.038 58.5074C59.0347 55.9305 59.0422 53.3536 59.0324 50.7767C59.0301 50.1648 59.0095 49.549 58.9384 48.9419C58.8066 47.8161 58.494 46.746 57.7765 45.794ZM41.0198 44.3552C40.8599 44.3666 40.6934 44.3533 40.5412 44.3937C39.9072 44.5624 39.5577 45.0664 39.5573 45.7984C39.5557 48.4239 39.5611 51.0495 39.5523 53.675C39.5508 54.1091 39.5281 54.5498 39.4515 54.9759C39.2493 56.1006 38.6462 56.943 37.5641 57.3698C36.5098 57.7856 35.4244 57.8 34.3328 57.5037C33.5048 57.279 32.87 56.8039 32.4554 56.0491C32.1582 55.508 32.0135 54.918 32.0027 54.3079C31.981 53.0723 31.9884 51.8361 31.987 50.6001C31.9852 49.0006 31.9891 47.401 31.9854 45.8015C31.9836 45.0138 31.4604 44.3951 30.7759 44.3551C29.928 44.3055 29.3302 44.8829 29.3292 45.7669C29.3263 48.4651 29.3228 51.1633 29.3311 53.8615C29.3341 54.8261 29.4377 55.7775 29.805 56.6855C30.5016 58.4082 31.8017 59.4481 33.546 59.9542C34.6439 60.2727 35.7748 60.292 36.9079 60.1587C37.7833 60.0557 38.6202 59.8168 39.3826 59.3737C41.1831 58.3274 42.0991 56.7004 42.1572 54.6688C42.2424 51.6903 42.2076 48.7081 42.2108 45.7275C42.2117 44.9795 41.7718 44.4833 41.0198 44.3552Z"
fill="currentColor"
></path>
<path
d="M57.786 45.8084C58.494 46.746 58.8067 47.8161 58.9384 48.9419C59.0095 49.5491 59.0301 50.1648 59.0325 50.7768C59.0423 53.3536 59.0348 55.9305 59.038 58.5074C59.0388 59.1008 58.8454 59.5813 58.3009 59.8752C57.4449 60.3372 56.3994 59.7352 56.3805 58.7626C56.3683 58.1408 56.3786 57.5186 56.378 56.8966C56.3755 54.6268 56.3821 52.3569 56.3649 50.0872C56.3587 49.2649 56.202 48.4663 55.7444 47.7588C55.2569 47.0049 54.5461 46.5967 53.6664 46.4965C51.8604 46.2907 50.3673 46.8867 49.2143 48.2979C48.7196 48.9036 48.5233 49.6149 48.5241 50.3907C48.5267 53.1453 48.5274 55.8999 48.5238 58.6545C48.5226 59.6147 47.6542 60.2459 46.7438 59.9593C46.2248 59.7959 45.8832 59.2854 45.8676 58.6409C45.8616 58.3906 45.8666 58.1401 45.8666 57.8896C45.8666 53.8749 45.8681 49.8601 45.8647 45.8453C45.8643 45.3094 46.0228 44.8534 46.487 44.5568C46.9047 44.29 47.3573 44.2684 47.7999 44.4951C48.2516 44.7265 48.4902 45.1114 48.5231 45.6192C48.5298 45.7228 48.5241 45.8272 48.5241 45.9702C48.6122 45.8986 48.6789 45.8493 48.74 45.7939C49.8716 44.7674 51.1808 44.0947 52.709 43.9567C54.4711 43.7975 56.1263 44.0761 57.4406 45.4126C57.5592 45.5332 57.6648 45.6666 57.786 45.8084Z"
class="logo-text"
></path>
<path
d="M41.0414 44.3563C41.7718 44.4833 42.2117 44.9795 42.2108 45.7275C42.2076 48.7082 42.2424 51.6903 42.1572 54.6688C42.0991 56.7005 41.1831 58.3274 39.3826 59.3737C38.6202 59.8168 37.7833 60.0557 36.9079 60.1587C35.7748 60.292 34.6439 60.2727 33.546 59.9542C31.8017 59.4481 30.5016 58.4082 29.805 56.6856C29.4377 55.7775 29.3341 54.8262 29.3311 53.8615C29.3228 51.1633 29.3263 48.4651 29.3292 45.7669C29.3302 44.8829 29.928 44.3055 30.7759 44.3551C31.4604 44.3952 31.9836 45.0138 31.9854 45.8015C31.9891 47.401 31.9852 49.0006 31.987 50.6001C31.9884 51.8361 31.981 53.0723 32.0027 54.3079C32.0135 54.918 32.1582 55.5081 32.4554 56.0491C32.87 56.804 33.5048 57.279 34.3328 57.5038C35.4243 57.8001 36.5098 57.7857 37.5641 57.3698C38.6462 56.9431 39.2493 56.1006 39.4515 54.976C39.5281 54.5498 39.5508 54.1092 39.5523 53.675C39.5611 51.0495 39.5557 48.424 39.5573 45.7985C39.5577 45.0665 39.9072 44.5624 40.5412 44.3938C40.6934 44.3533 40.8599 44.3667 41.0414 44.3563Z"
class="logo-text"
></path>
</svg>
</template>

<style scoped>
.logo-text {
fill: white;
}
.dark .logo-text {
fill: black;
}
</style>
2 changes: 2 additions & 0 deletions docs/content/1.guide/3.routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export default eventHandler(() => {
})
```

You can now universally call this API using `await $fetch('/api/hello')`.

### Route with params

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1.guide/4.storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Nitro provides a built-in storage layer that can abstract filesystem or database
await useStorage().setItem('test:foo', { hello: 'world' })
await useStorage().getItem('test:foo')

// Could can also specific the base in useStorage(base)
// You can also specify the base in useStorage(base)
await useStorage('test').setItem('foo', { hello: 'world' })
await useStorage('test').getItem('foo')
```
Expand Down
10 changes: 5 additions & 5 deletions docs/content/1.guide/5.cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ The stars will be cached in development inside **.nitro/cache/functions/ghStars/

## Route Rules

This feature enable to add caching routes based on a glob pattern directly in the main configuration file.
This feature enables you to add caching routes based on a glob pattern directly in the main configuration file.


::alert{type="primary"}
This features is still experimental and may evolve in the future.
This feature is still experimental and may evolve in the future.
::

Cache all the blog routes for 1 hour with `stale-while-revalidate` behavior:
Expand Down Expand Up @@ -203,7 +203,7 @@ export default defineNuxtConfig({
The `cachedEventHandler` and `cachedFunction` functions accept the following options:
- `name`: Handler name.
- Type: `String`
- Default: guessed from function name if not provided and fallback to `_` otherwise.
- Default: Guessed from function name if not provided and fallback to `_` otherwise.
- `group`: Part of cache name. Useful to organize cache storage.
- Type: `String`
- Default: `'nitro/handlers'` for handlers and `'nitro/functions'` for functions.
Expand All @@ -212,7 +212,7 @@ The `cachedEventHandler` and `cachedFunction` functions accept the following opt
- Default: If not provided, a built-in hash function will be used.
- `integrity`: A value that invalidates the cache when changed.
- Type: `String`
- Default: computed from **function code**, used in development to invalidate the cache when the function code changes.
- Default: Computed from **function code**, used in development to invalidate the cache when the function code changes.
- `maxAge`: Maximum age that cache is valid in seconds.
- Type: `Number`
- Default: `1` (second).
Expand All @@ -221,7 +221,7 @@ The `cachedEventHandler` and `cachedFunction` functions accept the following opt
- Default: `0` (disabled).
- `swr`: Enable `stale-while-revalidate` behavior.
- Default: `true`
- `base`: Name of the storage mointpoint to use for caching.
- `base`: Name of the storage mountpoint to use for caching.
- Default: `cache`.
- `shouldInvalidateCache`: A function that returns a `Boolean` to invalidate the current cache and create a new one.
- Type: `Function`
Expand Down
4 changes: 2 additions & 2 deletions docs/content/1.guide/7.plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Plugins are auto-registered (filename ordering) and run synchronously on the fir

Scanning pattern: `plugins/**/*.{ts,mjs,js,cjs}`

You can order the plugis by prefixing them with a number:
You can order the plugins by prefixing them with a number:

```md
plugins/
1.first.ts
2.second.td
2.second.ts
```

**Example:** Simple plugin
Expand Down
2 changes: 1 addition & 1 deletion docs/content/2.deploy/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Using built-in presets, you can easily configure Nitro to adjust it's output for

## Default output

Default production output preset is [Node.js server](./node).
Default production output preset is [Node.js server](/deploy/node).

When running Nitro in development mode, Nitro will always use a special preset called `nitro-dev` using Node.js with ESM in an isolated Worker environment with behavior as close as possible to the production environment.

Expand Down
2 changes: 1 addition & 1 deletion docs/content/2.deploy/2.workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Deploying to edge workers has some limitations. See [limitations](/deploy/worker
- No support for raw TCP/IP traffic
- Execution time is limited compared to classic serverless offerings (normally 15-30 seconds)
- No access to the filesystem (use the [nitro storage](/guide/storage) layer)
- Budnle size is very limited (normally a few MBs)
- Bundle size is very limited (normally a few MBs)
- Limited access Node.js APIs (nitro provides compatibility layer via [unjs/unenv](https://github.com/unjs/unenv))

### Incompatible libraries
Expand Down
2 changes: 1 addition & 1 deletion docs/content/3.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ routeRules: {
'/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
'/old-page': { redirect: '/new-page' },
'/proxy/example': { proxy: 'https://example.com' },
"/proxy/**": { proxy: '/api/**' },
'/proxy/**': { proxy: '/api/**' },
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"preview": "nuxi preview"
},
"devDependencies": {
"@nuxt-themes/docus": "^1.9.1",
"@nuxthq/studio": "^0.8.2",
"@nuxt-themes/docus": "^1.10.1",
"@nuxthq/studio": "^0.10.0",
"@nuxtjs/plausible": "^0.2.0",
"nuxt": "3.2.3"
"nuxt": "3.3.3"
}
}
Loading

0 comments on commit 854068e

Please sign in to comment.