unjs/nitro changelog
!NOTE Release of Nitro 2.10 might little bit take longer (after Nitro 3.0 release) in order to make sure all major refactors are nonbreaking and tested enough. In the meantime, 2.9.7 adds important fixes.
Full changelog: https://github.com/unjs/nitro/compare/v2.9.6...v2.9.7
🩹 Fixes
- github-pages: Prerender
/by default (#2334) (8b5cbc590e3948b7abc5569dd06ab43b955a4ae8) - Deduplicate plugins (#2391) (4293b8b1db5e1d1a12778efeba852c5f07da8a3f)
- Add
.tsxand.jsxto node-resolve extensions (#2398) (d2c0d74140b7b8f166d5937d736830b55177dd07) - typescript: Set
compilerOptions.noEmitto avoidtsconfig.jsonwarning (#2402) (6b6777eb73fde6337c87242ddf62406e06f0fcd3) - prerender: Only try to add
/after prerender:routes hook (#2348) (fb88efdc614e3b3b1e9dd76dfb342f9f0aff229c) - Pass custom entry filename when resolving prerenderer (#2461) (9bd662258a3d727805248f69ea8280ccf8e31675)
- public-assets: Do not shadow paths that share prefix (#2516) (72db8482e837c9fc50b5c928ff5636ba2cbb51cf)
- openapi: Update swagger-ui version to v5 for OpenAPI v3.1 support (#2343) (9e2cd8af32b2ea803b52ca0df282c588356161a2)
- Convert
CapturedErrorContextto interface to allow type augmentation (#2393) (45ff175ec9ce962ddc8cbe67925bb2136279c80b) - renderer: Check full path for
/favicon.icoplaceholder (#2553) (b86bb4580c2f6df855c9c7f184613877ebd7b58e) - Use relative paths in
nitro-config.d.ts(#2471) (4d70b759e1d8c50bb6a43a471c77eaf205bcb760) - prerender: Extract links from explicit html routes (#2517) (e1f87c590d6ca8ebb338ecd0d0b4d4b85eb75042)
- cloudflare-pages: Remove
.htmlextension from generated_routes.json(#2498) (79b85feec37c6c796df4ac453fcd4dd012d9be7b) - core: Resolve modules with esm compatibility (#2514) (4657ada0e372cf36a78fec29de0b96b582923832)
- Update cli preset with esm module format (#2539) (f6f23270c841514fa3f9d7162ece83f13ab4108c)
- types: Infer types correctly when method is omitted (#2551) (f76d21be811766009757dd0eebf05ff8aa7e795f)
- deno-server: Explicitly remove cert/key from options if either is not set (#2373) (d887f4a62a300be5c24dea7bfd1ede324a1dfe7a)
- azure: Correctly handle maxAge cookie option (#2403) (aabdc9c5c78c011a212c754058160ed23391361d)
- netlify: Ensure preview command is correct (#2561) (d16a47bd4dac8674db8538ff8b6235131c75230f)
- iis: Deep merge configs (#2358) (f03addd248a85d0093b71e8ac8e2523c590a35d2)
- iis: Parse without explicitArray to allow merging
web.config(#2457) (6c3e0805d38c80fcad9430d1e5beeeee65bbbaa5) - vercel: Support custom baseURL (#2464) (61f2079a605fca81b578894edfdbb0c328db12a3)
- Lower-case accepted handler method (#2382) (e60e114f33ce02866d931c70518268a5e94509ee)
- defineCachedEventHandler: Add
event.context.cache(#2519) (fc3968ba9993321cbe090c8818d22f3efa10e9d1)
❤️ Contributors
- Pooya Parsa (@pi0)
- Sébastien Chopin (@Atinux)
- Leex (@jsonleex)
- Daniel Roe (@danielroe)
- Ariesly Ariesly.Mao@hotmail.com
- Julien Blatecky (@julien1619)
- Juho Rutila (@nice-game-hints)
- Maik Kowol (@94726)
- Julien Huang julien.huang@outlook.fr
- Yuurin (@byyuurin)
- Brandon Roberts (@brandonroberts)
- Ígor Jacaúna (@igorjacauna)
- Sby1ce (@sby1ce)
🩹 Fixes
- Generate root/src directory aliases (#2318)
- externals: Skip resolving virtual ids start with
\0(#2321) - types: Account for
undefinedvalue for$fetchreturn type (#2327) - cloudflare-pages: Use predefined wildcards in
routes.exclude(#2319)
📖 Documentation
- Remove outdated nightly warning (#2317)
❤️ Contributors
- Peter Graugaard git@graugaard.me
- Damian Głowala (@DamianGlowala)
- Pooya Parsa (@pi0)
- Daniel Roe (@danielroe)
- Stefan
✅ Fixes and Improvements
- openapi: Add experimental
/_nitro/scalarendpoint (#2252) - openapi: Use dynamic host + port (#2216)
- openapi: Add
schemato generated parameters (#2235) - openapi: Avoid double slash for base (fdf7e70a)
- options: Set
scheduledTasksto an empty object by default (#2285) - prerender: Call
nitroAppclose hook when done prerendering (#2287) - types: Return
TfromSerializewhen it extendsundefined(#2286) - raw: Exclude yaml from raw plugin (#2275)
- externals: Check explicit inline rules on resolved id (#2288)
- raw: Allow importing relative paths (#2289)
- types: Make c12 env types available for
NitroConfig(#2292) - netlify-edge: Write
_headersand_redirects(#2291) - cloudflare-pages: Write
_headersand_redirectsfor non static builds (#2290) - netlify: Allow writing
config.json(#2264) - Allow importing utils from
nitropack/runtime(#2314) - openapi: Upgrade to openapi 3.1 (#2297)
- Use
.d.tsfor runtime generated types (#2313)
📖 Documentation
- routing: Add note about middleware execution order (#2282)
- routing: Fx link to h3 object syntax handler (#2281)
- Update tasks return value (8a62e7db)
- cache: Add a note for serverless environment (dc83a2e2)
- Fix typo (#2298)
❤️ Contributors
- Pooya Parsa (@pi0)
- Matt Kane matt.kane@netlify.com
- Hans Pagel
- Jamaluddin Rumi 16121031@student.mercubuana-yogya.ac.id
- Julien Huang julien.huang@outlook.fr
- Bobbie Goede bobbiegoede@gmail.com
- Damian Głowala (@DamianGlowala)
- Daniel Roe (@danielroe)
- Sébastien Chopin (@Atinux)
- Neil Richter (@noook)
- Samuel Burkhard sxburk@gmail.com
- Shoshana Connack (@moshetanzer)
- Yuurin (@byyuurin)
- Markthree (@markthree)
🩹 Fixes
- Handle path negations when scanning public assets (#2250)
- pkg: Add
ioredisas unstorage peer dependency (#2266)
📖 Documentation
- Fix server assets example path (#2248)
- Remove duplicate
integritykey (#2246) - Fix wording (#2261)
- Remove nightly notice (39bc3f2e)
- tasks: Update dev server usage (#2240)
- cache: Add example usage for
cache.varies(#2241)
❤️ Contributors
- Adam DeHaven (@adamdehaven)
- Neil Richter (@noook)
- Pooya Parsa (@pi0)
- Alexander Lichter (@manniL)
- KobZ (@devseckobz)
- Klein Petr petr@kleinpetr.com
- Daniel Roe (@danielroe)
🩹 Fixes
- raw: Use mime to chck binary types and exclude
.json(#2239)
📖 Documentation
- Fix typo (a445fae6)
❤️ Contributors
- Pooya Parsa pyapar@gmail.com
- Keigo Nakao (@kspace-trk)
🩹 Fixes
- database: CamelCase the connector name (#2228)
- Respect
imports.autoImport: false(#2226) - server-assets: Mark
yaml,json,json5andcsvas text (#2229) - import-meta: Import
processfromnode:processfor node compatible builds (deno) (#2225)
📖 Documentation
- deploy: Add link to zero config providers (#2206)
- fetch: Fix typo (#2209)
- Fix typo (#2211)
- Fix typo (#2205)
- Remove lagon (#2204)
- Update url for experimental database feature (#2210)
- providers: Improve formatting & use new
undocscomponents (#2202) - Improve cache page (674089b3)
❤️ Contributors
- Pooya Parsa (@pi0)
- Divy Srivastava (@littledivy)
- Alexander Lichter github@lichter.io
- Daniel Roe (@danielroe)
- Sébastien Chopin (@Atinux)
- Christian Preston (@cpreston321)
- Phan Khắc Đạo daopk.dev@gmail.com
- Maxime Pauvert (@maximepvrt)
- Jeff Galbraith (@hawkeye64)
- Rajeev R Sharma i.rarsh@gmail.com
- Julien Vanelian (@JulienVanelian)
- Gangan (@shinGangan)
🩹 Fixes
- Dev:
remoteAddressmight be undefined forx-forwarded-for(#2198) - Disable scheduled tasks in testing environment (#2200)
📖 Documentation
🤖 CI
- Skip
cloudflare-pagestest for windows (#2199)
❤️ Contributors
- Pooya Parsa pyapar@gmail.com
- Roman Nuritdinov (@Ky6uk)
- Stefan stefan.heim@hotmail.com
- Shoshana Connack
- manniL
🎉 Released live from Vue.js Amsterdam
⭐ What is new?
🏃♂️ Nitro Tasks
All changes
🚀 Enhancements
- prerender: Support function/RegExp for
prerender.ignore(#1966) - CLI: Show meta framework name on server build success (#1955)
- Presets: Add zeabur preset (#1942)
- Experimental nitro tasks (#1929)
- Add types:extend hook (#1715)
- Allow oveeridng nested runtime config with env (#1831)
- wasm: Universal support with esm import syntax (#2017)
- wasm: Migrate to unjs/unwasm (#2037)
- zeabur: Support zeaburStatic and auto detect preset (#2014)
- runtime-config: Experimental env expansion support (#2043)
- Support binary server assets (#2107)
- Experimental websocket support (#2170)
- dev: Expose upgrade handler (5374429f)
- Experimental database layer (#1351)
- Experimental scheduled tasks (#2179)
- cache: Support async shouldBypassCache and shouldInvalidateCache (#2181)
- prerender: Add total prerender time (#2130)
- Presets: Add koyeb preset (#1248)
- providers: Support alwaysdata hosting provider (#1790)
- routeRules: Allow wildcard redirects (#1976)
🩹 Fixes
- rollup: Avoid preserving relative externals (#1972)
- wasm: Directly generate chunk exports (#2003)
- iis-node: Correctly escape backslashes for port fix (#2020)
- deno-deploy: Shim
x-forwarded-forandx-forwarded-protoheaders (#2026) - Add
baseURLto openapi generated url (#2049) - dev: Correctly set
x-forwarded-*headers (29ddd948) - azure: Add
18and20to supported node versions (#2077) - azure: Pass body to the context as-is (#2079)
- dev: Only mock consola in production (#2110)
- Default to bundler module resolution (#2120)
- Handle optional
routeHandler.routein rollup chunk (#2152) - File extension stripping in
writeTypesfunction (#2139) - cache: Detect malformed data read from storage (#2161)
- cacheEventHandler: Provide event.fetch and event.$fetch (#2066)
- module: Resolve modules with jiti directly (#2030)
💅 Refactors
- Include framework name in more build packages (#1973)
- cloudflare: Remove
--localfrom perview commands (#1979) - cloudflare: Remove unused import (#1980)
- rollup: Improve generated chunk names (#2004)
- Use name exports in presets entry (1abfc3e5)
- Reimplement WASM plugin (#2031)
- Various improvements around tasks api (#2175)
- tasks: Stablize api (#2178)
- github-pages: Add
--dotfilesto deploy command hint (#2158)
📖 Documentation
- routing: Update request filtering to match the type of getRequestURL (#1977)
- config: Fix
setResponseHeaderexample params (#2027) - netlify: Add note to make sure publish dist is set to dist (#2035)
- cloudflare: Various updates, cleanups and fixes (#1981)
- presets: Deprecate
lagon(17f922aa) - Update the routing page (#2085)
- Update the cache page (#2087)
- Close code-group in cache section (#2093)
- routing: Escape filename paths and prepend routes folder (#2097)
- storage: Fix unstorage links (#2101)
- routing: Fix typo for getRouterParam (#2098)
- Update the storage page (#2086)
- Add object syntax for event handler (#2091)
- Update the configuration page (#2083)
- Update the assets page (#2088)
- Create a page on built-in fetch (#2089)
- Add warning about azure functions stability (#2092)
- cloudflare: Update deployment guide (#2074)
- Fix icon of fetch page (#2115)
- Update getting started page (#2082)
- Fix links to /guide/auto-imports (#2131)
- Fix typo in defineCachedFunction example (#2133)
- Clarify difference between dir and baseURL (#2144)
- Migrate to undocs (#2163)
- index: Fix utils link (#2172)
- websocket: Fix typo (#2173)
- Fix typo (3017e6e2)
- vercel: Add monorepo info (#2183)
- Fix typo (#2182)
- cloudflare: Add local bindings usage (#2135)
- Fix link to h3 utils (#2184)
- deploy: Add platform.sh (#1630)
📦 Build
- Better dist chunk names (#2005)
✅ Tests
- cloudflare: Migrate to
miniflarev3 (#2018) - Enable azure tests behind a flag (#2076)
- Enable binary response test for all presets (#2078)
- Avoid prerendering
icon.png(cb220f7e)
🤖 CI
- Fix nightly release job condition (#1975)
❤️ Contributors
- Julien Huang julien.huang@outlook.fr
- Jasper Zonneveld
- M4dz (@m4dz)
- Dominik Opyd dominik.opyd@gmail.com
- Justin Ellingwood justin.ellingwood@gmail.com
- Connor Pearson cjp822@gmail.com
- Alexander Lichter (@manniL)
- David De Sloovere
- Dario Piotrowicz (@dario-piotrowicz)
- Balázs Németh
- Mehmet hi@productdevbook.com
- Markthree (@markthree)
- Arkadiusz Sygulski aareksio@gmail.com
- Jamaluddin Rumi jamal.rumi@icloud.com
- Pooya Parsa (@pi0)
- McPizza gh@l1.io
- Shoshana Connack
- Anthony Fu anthonyfu117@hotmail.com
- Jackson Tenclay
- Rihan (@RihanArfan)
- Remonke
- Daniel Roe (@danielroe)
- Estéban (@Barbapapazes)
- Gerard Wilkinson gerard.wilkinson@me.com
- Tobias Lebeitsuk
- Alexander (@cany748)
- Kasper Kronborg kasper@kronborg.info
- Gustavo Alfredo Marín Sáez aterbonus@gmail.com
- Alexandr
- Yuanlin Lin im.yuanlinlin@gmail.com
- Mcremer-able marc.cremer@able-group.de
- Jasonleong jasonliangbiz@gmail.com
- METO (@metowolf)
- Michael Brevard yonshi29@gmail.com
- Bobbie Goede bobbiegoede@gmail.com
- Becem (@becem-gharbi)
- Mukund Shah
- Ayo Ayco (@ayoayco)
🩹 Fixes
- dev: Conditionally access worker address for build info (#1947)
- Force use wasm import strategy for windows (e73b849f)
- netlify-lambda: Handle base64 encoded body (#1940)
- cloudflare: Wasm support with dynamic chunks (#1957)
- prerenderer: Write responses with json signature to original path (#1963)
📖 Documentation
- cache: Make default value
swr: truemore clear (#1949)
🏡 Chore
✅ Tests
❤️ Contributors
- Pooya Parsa (@pi0)
- Becem becem.gharbi@live.com
- Mick Lawitzke (@MickL)
🌟 What is new?
🚀 Zero config deployment to AWS Amplify Hosting
We have been closely working with the AWS Amplify team to bring you a zero-config experience AWS deployment and it is ready today! Read more in the deployment guide.
🔥 Code splitting enabled for Cloudflare Pages and Modules
Code-splitting support is now enabled for Cloudflare Pages and Modules presets making startup-time even faster by leveraging lazy chunks. (read more: (#1905))
🍣 Rollup v4 with native SWC-based parser
We've upgraded Nitro to the latest Rollup v4, powered native SWC-based parser for even faster builds (https://github.com/rollup/rollup/pull/5073) 🔥
Normally, you won't need any specific changes in your project. You can also ignore warnings about compatibility with rollup-plugin-visualizer. If you're adding a custom Rollup plugin or using Vite v4, you might encounter type issues due to duplicate dependencies. You can either use the resolutions field in your package.json or simply ignore this warning until Nuxt upgrades to Vite v5 (soon!).
🧩 Modules support to extend Nitro core
With this release, we have introduced a new advanced feature to extend the Nitro builder core. (more documentation will be available soon)
Example: modules/test.ts (server/modules/test.ts for Nuxt projects)
import type { NitroModule } from "nitropack";
export default <NitroModule>{
name: "my-nitro-module",
async setup(nitro) {
console.log("Running custom nitro module...");
await nitro.updateConfig({
routeRules: {
"/**": { swr: true },
},
});
},
};
⚡️ H3 v1.9
h3 v1.9.0 comes with new getValidatedRouterParamsand getRequestFingerprint utilities, decode options for getRouterParam and auto-completion for headers in your IDE!
🔥 More coming soon
There are more exciting features including tasks, db layer, and WebSocket API planned for the next minor releases. Stay tuned!
Changelog
🚀 Enhancements
- Support modules to extend nitro builder (#1789)
- Support
inlinemode forserveStatic(#1864) - Add experimental
winterjspreset (#1863) - Allow setting preset using
SERVER_PRESETenvironment variable (#1870) - cloudflare-pages, Cloudflare-module: Enable code splitting by default (#1905)
- Support
frameworkconfig (#1843) - Add AWS Amplify Hosting preset (#1912)
- Upgrade to Rollup v4 (#1927)
- Improve
nitro.jsonbuild info (#1930) - aws-amplify: Support static builds (#1933)
- Add
defineNitroErrorHandlertype helper (#1923)
🩹 Fixes
- cloudflare-pages: Filter out overlapping public assets dirs (#1859)
- scanner: Allow having HTTP method as part of the route name (#1895)
- Generate route types with resolve path and stripped extension (#1897)
- Scan dirs for unimport on initialization (#1908)
- aws-amplify: Register and auto detect (0f38eb6f)
- prerender: Decode generated routes (#1914)
- Disabled public asset handler name is
null(b7a6a1a6) - prerender: Decode URIs in headers (#1932)
- error: Respect accept:
text/htmlrequest header (#1921) - prerender: Filter encoded links starting with
#(#1936)
💅 Refactors
📖 Documentation
- deploy: Split runtimes from providers (#1865)
- routing: Add note about middleware returns (#1884)
- Update edge links to nightly (#1902)
- deploy: Add deno to runtime list (#1899)
- cloudflare: Update wrangler link (#1913)
- aws-amplify: Add custom
amplify.yml(f412af16) - amplify: Remove cache from config (7bbb723e)
- Hide winterjs due to instability (048c8ff0)
- Add jsdoc for
cache.maxAge(#1878)
🌊 Types
- Export
SerializeTupleandSerializeObjecttypes (#1907)
❤️ Contributors
- Pooya Parsa (@pi0)
- Siegerts stephen.siegert@gmail.com
- Passionate-bram
- Daniel Roe daniel@roe.dev
- Neil Richter (@noook)
- Xin Du (Clark) clark.duxin@gmail.com
- Anthony Fu anthonyfu117@hotmail.com
- Dario Piotrowicz (@dario-piotrowicz)
- Kalwabed Rizki
- Thunfisch987
- Oof2win2 honza.koco44@gmail.com
- Markthree (@markthree)
- Estéban (@Barbapapazes)
🩹 Fixes
- cloudflare-pages: Filter out overlapping public assets dirs (#1859)
❤️ Contributors
- Daniel Roe daniel@roe.dev
🩹 Fixes
- Recursively simplify returned objects (#1847)
- cache: Fix
etagandlast-modifiedvalues (#1855) - cache: Invalidate wrongly cached handler entities (#1857)
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe daniel@roe.dev
🚀 Enhancements
- vercel: Support
bypassTokenfor on-demand static reganaration (#1723) - prerender: Support
retryandretryDelay(#1534) - Allow disabling compressed size calculation (#1756)
🔥 Performance
- Use native fetch for node >= 18 to reduce %40 of bundle size! (#1724)
🩹 Fixes
- Sort dependencies in
.output/package.json(#1708) - Add
application/javascriptmime type in lambda utils (#1737) - renderer: Allow all h3 handled body types (#1755)
- dev: Safe error message override (#1712)
- azure: Fix cookie format normalization (#1753)
- Exclude undefined from hook types (#1769)
- iis-node: Pass
PORTasNITRO_UNIX_SOCKET(#1783) - aws-lambda: Handle
event.isBase64Encoded(#1779) - cache: Allow overriding integrity (#1791)
- cache: Write SWR and update errors to the console (#1794)
- cache: Only return validated stale value (#1795)
- cache: Only invalidate if validate returns false (#1796)
- Watch plugins directory (#1800)
- cache: Allow setting multiple set-cookie headers (bad practice!) (#1838)
- prerender: Decode HTML entities in rendered links (#1824)
- storage: Validate and skip invalid mounts (#1805)
- cache: Validate
entry.valueto have value for cached handlers (84559382) - cache: Fix event handler integrity hash generation (#1820)
- cache: Set cache item before returning response on first request (#1813)
💅 Refactors
- iis: Improve preset and docs (#1784)
📖 Documentation
- Update prerender options (11a24124)
- Fix typo (#1722)
- Register error handler using
hookinstead ofhookOnce(#1743) - Update lock file (#1750)
- Fix typo (#1759)
- Fix configuration file name of the custom preset (#1760)
- Typo in word "legacy" in Configuration docs (#1780)
- cloudflare: Add local dev section (#1772)
🏡 Chore
- Add
.devcontainer(#1633) - Update
vitestto1.0.0-beta(#1776) - Use pnpm
shell-emulatorfor Windows local development (#1828) - Use
nitropack-nightlyfor the nightly release channel (#1841)
🤖 CI
- Run tests against Node.js 18 (#1713)
❤️ Contributors
- Pooya Parsa (@pi0)
- Yasser Lahbibi (@yassilah)
- Horu
- Michael Brevard yonshi29@gmail.com
- Daniel Roe daniel@roe.dev
- MiniDigger < Martin>
- Estéban (@Barbapapazes)
- Heb (@Hebilicious)
- Henrique Lopes
- McPizza gh@l1.io
- Michael BOUVY michael.bouvy@gmail.com
- Jeremy Graziani
- Tobias Diez code@tobiasdiez.com
- VALERIY SINEVICH
- Roman Zipp ich@ich.wtf
- Benjamin GAYMAY (@BenjaminGaymay)
- Alexander Lichter (@manniL)
- Farnabaz (@farnabaz)
- Nils K
- Jonas Thelemann (@dargmuesli)
- Jenjen75 jean-michel.khou@vivlab.com
- Sébastien Chopin (@Atinux)
🩹 Fixes
- firebase: Apply region for gen2 deployments (#1657)
- cloudflare-pages: Autodetect static preset (#1659)
- Resolve output dirs relative to
rootDir(#1666) - prerender: Allow disabling html sub-folders (#1676)
- firebase: Use correct key when importing firebase
httpsOptions(#1663) - Await on
send()calls (#1701) - Bun dev compatibility (#1702)
- aws-lambda,netlify-lambda: Binary body v2 and cookies v1 (#1683)
- iis: Merge
web.config(#1658)
📖 Documentation
- render-com: Add note about node version (#1693)
- Add instructions for using Nuxt edge release channel (#1688)
- Add instructions for bun (#1672)
✅ Tests
- Update test for bun headers (#1684)
❤️ Contributors
- Gavin Hardaker (@Hardaker587)
- Heb (@Hebilicious)
- Colin McDonnell (@colinhacks)
- Pooya Parsa (@pi0)
- Luke Nelson luke@nelson.zone
- Rajeev R Sharma i.rarsh@gmail.com
- Markthree (@markthree)
- Daniel Roe daniel@roe.dev
- Yuichi Takebe
🩹 Fixes
- Use new h3 generics for
defineCachedEventHandler(#1640) - aws-lambda, netlify: Add
isBase64Encodedresponse field (#1645) - Exclude typed body from
cachedEventHandler(#1647) - static: Send immediate empty responses for 304 handling (#1639)
🏡 Chore
- Update
listhento latest (62ac3065)
✅ Tests
- Add test for prerender ignored
data:URLs (#1431)
❤️ Contributors
- Pooya Parsa (@pi0)
- Markthree (@markthree)
- Daniel Roe daniel@roe.dev
- Azcray
🩹 Fixes
- Correctly mark
middleware: falsefor scanned routes (#1631) - Pass relative ignore paths when scanning public assets (#1632)
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe daniel@roe.dev
note 📰 Release article coming soon!
🚀 Enhancements
- storage: Default data storage for
nodeand dev presets (#1352) - Support regexps in external options (#1388)
- Support
exportConditionsand add worker default conditions (#1401) event.waitUntilwith Cloudflare integration (#1421)experimental.typescriptBundlerResolutionflag (#1384)- Support
ignoreto ignore scanned files (#1430) - Allow ignoring public assets with
ignoreoptions (#945) - Add
iisserver preset (#1436) - Auto capture errors with
nitroApp.captureError(#1463) - vercel: Enable streaming support out of the box (#1514)
- Fully resolve type paths for auto-import declarations (#1528)
- Add
prerender:config,prerender:initandprerender:donehooks (#1519) - cache: Support cached event handlers with varies (#1184)
- app: Support
request,beforeResponseandafterResponsehooks (#1545) - Experimental composition api via
useEvent()ans async context support (#1546) - prerenderer: Support for query links exploration (#1474)
- cloudflare-pages: Add config to customize generated
_routes.json(#1312) - firebase: Add support for 2nd generation functions (#1500)
- externals: Resolve actual subpaths before guessing (#527)
- externals: Support aliasing traced packages (#1553)
- wasm: Support output esm imports (#1565)
- Enable
timingin debug mode (#1577) - prerender: Preserve prerendered asset
content-typeheader (#1587) - externals: Improved output
package.json(#1607) - firebase: Support renaming exported server function (#1377)
- azure: Support custom configuration (#1344)
- node-server: Support listening to unix sockets using
NITRO_UNIX_SOCKET(#1201) - cloudflare-module, cloudflare-pages: Experimental dynamic imports (#1172)
- cli: Support
--presetand--minify/--no-minifyargs forbuild(#1621) - cli: Add listhen options for
devcommand (#1622) - Handle stream and
Uint8Arrayfor lambda presets (#1624)
🔥 Performance
- Use
fsLitedriver for productiondata:storage (dd290763) - Use inline
http-graceful-shoutdownto reduce externals (8053cca0) - Remove
source-map-supportas node supports--enable-source-maps(9ba8fe98) - Bundle runtime dependencies (#1554)
- Use local fetch for proxy route rules (#1609)
🩹 Fixes
- rollup: Replace
globalThis.process.withprocess.(#1360) - types: Enable
allowSyntheticDefaultImportsoption by default (#1383) - cache: Try to call
event.waitUntil(#1422) - defineCachedFunction: Properly infer function type (#1423)
- static: Safe decode path (#1459)
- Split cookie headers (#1452)
- deno-deploy: Treat all
https://modules as external (#1438) - cache: Call
event.waitUntilon main resolver when expired (421d6255) - prerender: Skip redirects (#1448)
- aws-lambda,netlify: Base64 encode binary responses (#1274)
- app: Enable router preemptive mode (#1504)
- vercel: Allow arbitrary function configuration (#1508)
- Use relative paths in
tsconfig.json(#1518) - prerender: Free up memory after each route is written to the disk (#1536)
- prerender: Call
prerender:routebefore freeing up memory (#1537) - prerender: Only match
hrefattribute after whitespace (#1530) - externals: Absolute paths are inlined (#1429)
- openapi: Merge handlers with same route and different method (#1497)
- prerender: Exclude encoded
hrefattributes from link extraction (#1485) - externals: Increase score for npm package name patterns to avoid breaking changes (#1548)
- deno-deploy: Decode static asset path before reading from filesystem (#1494)
- Remove non-standard
moduleexport condition (#1559) - externals: Trace externals with their commonjs / esm status (#1562)
- Use relative paths in generated tsconfig (#1572)
- app: Use
event.pathinstead ofevent.url(41a76c0f) - cache: Don't use
_originalPath(#1576) - types: Use relative type path to nitro
#internal/nitro(#1584) - Disable sourcemap minify for dev (e38f3586)
- Use relative source map paths and add test (#1582)
- pkg: Remove node 14 from supported
engines(#1585) - prerender: Use decoded asset id to access prerendered asset header overrides (#1588)
- Add
consola/corealias (#1591) - vercel,netlify: Don't deprecate
swrwhencache: false(#1603) - build: Workaround bun's difference in
function.toString()(#1606) - firebase: Ignore
fseventdependency (#1610) - Directly pass
localFetchto route rules handler (#1611) - stormkit: Properly send buffer responses (#1616)
- Add parent
node_modulesof nitro to modules dir for pnpm compat (#1618) - deno-server: Fix injections and enable back tests (#1625)
💅 Refactors
- cloudflare: Use
wrangler deployinstead ofpublish(#1372) - cloudflare: Use
wrangler deployin more places (#1393) - prerender: Improve console formatting for failed routes (#1471)
- Reduce usage of
event.node.req(#1511) - Reduce usage of
event.node.res(#1513) - timing: Hide debug logs with
0ms(8a44d19c) - firebase: Update generated
package.json(#1608) - Migrate from
http-proxytounjs/httpxy(#1623)
📖 Documentation
- vercel: Add note about top level
api/directory (#1386) - Add nitro plugins examples (#1403)
- Add custom preset instructions (#1409)
- aws: Add note about inlining dynamic chunks (#650)
- Fixed typo of the word
discussions(#1433) - Fix typo (#1446)
- Use
defineEventHandlerinstead ofeventHandler(#1442) - Remove auto-imported
defineNitroConfig(#1441) - Add
utils/directory (#1451) - storage: Add runtime storage configuration examples (#1456)
- Prefer
snake_casefor preset names (#1499) - routing: Add middleware section (#1307)
- plugins: Add runtime hooks section (#1521)
- config: Add runtime config and environment variables section (#1550)
- firebase: Improve docs (#1556)
- cloudflare: Add environment variables instructions (#1547)
✅ Tests
- Improve external modules test (#1428)
- Run tests even if not
serveStatic(#1590) - Add tests for environment variables and runtime config overrides (#1549)
🤖 CI
🏡 Chore
🩹 Fixes
- Add
envPrefixtoruntimeConfig.nitrotypes (#1336) - prerender: Allow to fetch static files (#1340)
- options: Default target to
staticwhenstaticoverride is set (#1342) - Correct default
node-servertarget (7976318) - vercel, netlify: Always check
nativeSWRfuture flag (ccebe4e) - vercel, netlify: Handle boolean values for route rule deprecation (dfd8bbd)
- Dedup
unstoragedependency and use subpath alias (#1164) - dev: Ensure socket path is accessible (#1115)
- Type
event.$fetchandevent.fetch(#1343) - Allow configuring
esbuildtransform plugin (#1347)
📖 Documentation
- Add a reference to install Azure functions core tools to the swa section (#1339)
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe daniel@roe.dev
- Stefan Bittmann stefan@clinic.tools
- Nick Dawson
📖 Documentation
- Fix typo in Flightcontrol deployment option (#1332)
📦 Build
- Avoid doubly-bundling runtime types (#1334)
🌊 Types
- Avoid overriding app runtime config namespace (#1333)
❤️ Contributors
- Daniel Roe daniel@roe.dev
- ModupeD
⭐ What is new?
- Type generics supported for
useStorageanduseRuntimeConfigand lots of more type safety enhancements across ecosystem - UnJS ecosystem packages upgraded to the latest versions with lots of bug fixes and enhancements
- With
h3@1.7.0we are now experimenting response streaming support (Demo).
🚀 Enhancements
- Allow customising generated
tsConfig(#1266) - Type
useRuntimeConfigwithNitroRuntimeConfig(#1311) - Type nitro app runtime hooks (#1316)
- Add
cloudflare-pages-staticpreset (#1310) - Add experimental
deno-serverpreset (#592) - Add
flightcontrolpreset (#970, #1250) - Support
jsxandtsxout of the box (#1303) - Add support for
failOnError(#1294) - Generic type support for
useStorage(#1279) - Provide static
process.*andimport.meta.*build flags (#1331)
🩹 Fixes
- bun: Resolve internal dependencies with
bunexport condition (#1313) - deno: Support environment variables (88b4e11)
- Respect
staticflag when auto-detecting preset (#1321) - prerenderer: Don't inherit
staticconfig (#1324) - vercel: Add check for index route rule (#1290)
- Use
event.handledguard before sending direct responses (#1326) - Import
NitroRuntimeHooksfrom runtime dir (#1328) - Generate types for
#imports(#1329)
📖 Documentation
- Update
docusversion (848c86a) - Update
cloudflare-pagespreset (#1304) - Add an example for
devHandlersconfig (#1295)
❤️ Contributors
- Pooya Parsa (@pi0)
- 魔王少年 (@maou-shonen)
- Daniel Roe daniel@roe.dev
- Andrew mshote@gmail.com
- Estéban (@Barbapapazes)
- Dunqing (@Dunqing)
- Frantz Kati bahdcoder@gmail.com
- Mike Laumann Bellika
- Sébastien Chopin (@Atinux)
- Hebilicious (@Hebilicious)
- Michael J. Roberts (@michealroberts)
⬆️ How to Upgrade?
- Make sure to recreate the lock file as well in order to receive all UnJS ecosystem updates.
- If you are using Nitro via Nuxt, simply use
npx nuxi@latest upgrade --force.
🩹 Fixes
- pkg: Add
http-proxytypes to deps (#1213) - vercel-edge: Use platform provided
processshim (392ce64) - netlify-edge: Update output format (41a4a6a)
- netlify-edge: Support environment variables (5c85c14)
- netlify-edge: Handle static asset urls (116874f)
- netlify-edge: Fix body handling (4c825b6)
- vercel-edge: Fix body handling (c75c2f1)
- deno, lagon, sw: Fix request body handling (1c88e5e)
- netlify-edge: Polyfill missing
x-forwarded-protoheader (4e5f46e)
🏡 Chore
- Update dependencies (c4fcd78)
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe daniel@roe.dev
⬆️ How to Upgrade?
If you are directly using Nitro, make sure to recreate lockfile as well in order to receive all UnJS ecosystem updates.
If you are using Nitro via Nuxt, simply use npx nuxi@latest upgrade --force.
⭐ What is new?
isr route rule
Vercel and Netlify route rules support a dedicated isr flag to enable Incremental Static Regeneration.
For backward compatibility, we keep converting swr and static route rules to isr for these two presets. If you were previously depending on swr and static route rules, we highly recommend to upgrade nitro and switch to isr flag:
routeRules: {
-- '/blog/**': { swr: 3000 },
++ '/blog/**': { isr: 3000 },
}
If you like to leverage Nitro Native SWR cache (stored in storage), you can opt-in using future.nativeSWR: true (nuxt: nitro.future.nativeSWR) config.
Vercel KV Storage
In collaboration with the Vercel team, Nitro now supports seamless integration with Vercel KV Store. See docs for usage information.
Cloudflare Module Worker Preset
You can opt-in to the new Cloudflare Module Worker output format.
The cloudflare pages preset is also upgraded to the worker format with this release
First-class static targets
While Nitro is a server builder, it can be also used to prerender all routes using a renderer and output only static output. New static ,vercel-static, netlify-static and github-pages presets are now available to only output prerender and skip the production server build.
Config HMR support
You can now directly edit route rules and runtime config within nitro.config without the need to restart the nitro server! See #1175 for more information.
Dynamic App Config and Runtime Config
Previously, both useAppConfig() and useRuntimeConfig() were returning a frozen object. Now using useAppConfig(event) and useRuntimeConfig(event) you can have a fully dynamic interface, enabling dynamic, per-request config and support for environments such as Cloudflare where env is only available during the request lifecycle.
If you were previously using useAppConfig() and useRuntimeConfig() in an ambient context (outside of event handlers and composable functions, we highly recommend to migrate to the new API:
-- const appConfig = useAppConfig()
export default eventHandler(event => {
++ const appConfig = useAppConfig(event)
})
See #1154 for more information.
Experimental Swagger and Open API support
Swagger and OpenAPI are de facto standard tools for documenting server API routes. You can now see all auto-generated API docs by enabling experimental.openAPI: true (nuxt: nitro.experimental.openAPI: true) and opening /_nitro/swagger UI.
See #1162 for more information.
We are working to bring route-level meta definition for an even better and more detailed docs generator.
New Documentation and Branding
Nitro docs and logo are live with a new fancier design at nitro.unjs.io
🚀 Enhancements
- Add Cloudflare module worker support (#681)
- vercel, netlify: Introduce
isrroute rule (#1124) - Add
staticpreset (#1127) - Add
vercel-staticandnetlify-staticpresets (#1073) - Add
github-pagespreset (#1133) - Pass resolved config to
rollup:beforehook (#1160) - Config reload support for
nitro dev(#1173) - Config hmr support for
routeRulesandrutimeConfig(#1175) - Support dynamic app config and runtime config (#1154)
- Experimental
/_nitro/openapi.jsonand/_nitro/swaggerfor dev mode (#1162) - vercel: Add support for specifying edge regions (#1192)
future.nativeSWR(#1212)
🔥 Performance
- Export
defineNitroConfigfromnitro/config(#1174)
🩹 Fixes
- Separate
typesDirfromtsConfigDir(#1146) - cloudflare: Expose env from module context (#1147)
- proxy: Append request query params for single proxy route rules (#1163)
- vercel, netlify: Keep default behavior for
staticandswrtoisrmapping (#1155) - Apply
chunkFileNameson windows (#1189) - pkg: Allow installing on node v20 and above (#1204)
💅 Refactors
📖 Documentation
- Fix typo (#1131)
- Update serverAssets example (#1156)
- Add edge releases channel (2793f51)
- get-started: H2 instead of h3 (ff3964e)
- routing: Add route rules (46740e6)
- routing: Add missing import (30675d4)
- Fix syntax issue in guide > storage (#1180)
- Update (1e5bb86)
- Fix typo (#1185)
- Fix typo (#1190)
- vercel: Add vercel kv storage section (#1210)
- Update branding (#1188)
- Update vercel-storage (ffff9db)
✅ Tests
- Enable
vercel-edgetest (7951532)
❤️ Contributors
- Pooya Parsa (@pi0)
- Sébastien Chopin (@Atinux)
- Daniel Roe daniel@roe.dev
- AaronBeaudoin aaronjbeaudoin@gmail.com
- Oumar Barry (@oumarbarry)
- G-Cyrille
- 魔王少年 q267009886.work@gmail.com
- Iho Somnam ihosomnam4741@gmail.com
- Timhanlon tim@timhanlon.com
🚀 Enhancements
- Upgrade to consola v3 (release notes)
🩹 Fixes
- prerender: Show generated routes with error in logs (8e06f2e)
- prerender: Respect output path from main preset (#1114)
📖 Documentation
- Fix typos in storage and cache guides (#1086)
- Use unjs logo (#1104)
- Fix typo in cachedEventHandler options (#1110)
- Use consistent quotes in the routeRules example (#1108)
- Fix typo in server assets mount point (#1119)
- Improve
publicAssetsconfig details (#1102) - Fix small typo in plugin filename (#1081)
❤️ Contributors
- Pooya Parsa (@pi0)
- Gabriel Cipriano (@gabrielcipriano)
- Daniel Roe daniel@roe.dev
- Yassine El Ouazzani (@kwarkjes)
- Inesh Bose
- Andre Hammons
- Michael BOUVY michael.bouvy@gmail.com
🩹 Fixes
- Sanitize
statusMessageof disallowed chars (#1057) - types: Sync vercel build config types (#1056)
- azure: Support custom baseURL (#1062)
- vercel-edge: Fix route generation (#1071)
- Mark
options.rendereras optional (#1069) - types: Make $Fetch types less complex (#1059)
💅 Refactors
- Add type safety to auto-detected providers (#1072)
📖 Documentation
❤️ Contributors
- Mahdi Boomeri mahdi@boomeri.dev
- Daniel Roe daniel@roe.dev
- Shohei Maeda
- Lucas (@Draichi)
- Nobkd
- Honza Pobořil honza@poboril.cz
🩹 Fixes
- types: Don't simplify type of serialized return (#1050)
🏡 Chore
- Add
codecov.yml(6fe7f64)
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe daniel@roe.dev
🚀 Enhancements
- Add lagon preset (#964)
🩹 Fixes
- node-cluster: Default number of workers (#963)
- cloudflare-pages: Exclude assets from function call (#965)
- cloudflare-pages: Handle assets only for get requests (#968)
- Render json errors for cors requests (#969)
- Use json response for errors in
/api/routes (#971)
💅 Refactors
- externals: Sort
bundledDependencieskeys in outputpackage.json(#967)
📖 Documentation
- cloudflare: Add info regarding
runtimeConfigand environment variables (#958) - Prevent ellipsis overflow on small screens (#956)
- deploy: Add workers page for edge limitations (#953)
🏡 Chore
❤️ Contributors
- Pooya Parsa (@pi0)
- Daniel Roe daniel@roe.dev
- Jan-Henrik Damaschke jdamaschke@outlook.de
- Bogdan Kostyuk bogdankostyuk12@gmail.com
- Hminghe (@hminghe)
- Alexander Lichter (@manniL)
⭐ What is new?
- Runtime proxy support using route rules (learn more)
- Nested fetch calls with incoming headers and context in event context (learn more)
- Binary and Raw storage operations support (learn more)
- Cloudflare Exposed
event.context.cf(learn more) - Built-in session support (learn more)
🚀 Enhancements
- Support runtime proxy using route rules (#926)
- cloudflare:
cacheControlsupport for public assets with withmaxAge(#922) - cloudflare: Expose
event.context.cf(#927) - firebase: Use nodejs 18 as default runtime (#925)
- Support
event.fetchandevent.$fetch(#930) - vercel: Auto-detect runtime version (#879)
🩹 Fixes
❤️ Contributors
- Pooya Parsa pooya@pi0.io
- Shohei Maeda
- Luke Nelson luke@nelson.zone
- Oleg Khalin
- Daniel Roe daniel@roe.dev