NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1552 most downloaded on npm
Super fast, memoized `req.url` parser
Last release 1 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.9 years
Nearly every release is documented
notes for 1 of 1 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
20 releases · first in 2018
Nothing published for this version
Removes node: prefix from all CommonJS modules ( #215 ). You will get these files via a require statement.
Removes node: prefix from all CommonJS modules (#215).
You will get these files via a require statement.
The ESM version of each package still has the node: prefix. You will only get this version if you are using import syntax.
The node: prefix was added in 16.x and back-ported to 14.18 (docs), so ensure you're on at least one of those versions. While native ESM was technically added in 12.x, it's been end-of-life (including security) for ~3 years and its version of "ESM" is significantly broken/different than today's ESM... 12.x was the first (experimental) ESM release.
node: prefix removed: 5ee202f, 228253cbuild step in CI for size logging: 05dae70Full Changelog: v1.0.0-next.27...v1.0.0-next.28
One column per quarter.
Support Deno runtime by adding node: import prefixes ( #212 ): e34ad69 Thank you @benmccann ~!
node: import prefixes (#212): e34ad69Full Changelog: v1.0.0-next.26...v1.0.0-next.27
Add @polka/compression package! ( #148 ): a2105e0 , 7745eb4 A lightweight compression replacement, with opt-in Brotli support. Thank you @developit !
@polka/compression package! (#148): a2105e0, 7745eb4compression replacement, with opt-in Brotli support.polka@next and a larger astro example.Full Changelog: v1.0.0-next.24...v1.0.0-next.25
Support TypeScript node16 / nodenext / bundler module resolutions support ( #192 , #200 ): Thank you @didinele and @benmccann ~!
node16/nodenext/bundler module resolutions support (#192, #200):(polka) Upgrade to trouter@4.x which improved optional wildcard pattern support: 862b08e
See regexparam@3.0.0 release notes for more information.
(@polka/send) Apply custom response headers for piped stream (#198): 1568db3
Thank you @aral
Full Changelog: v1.0.0-next.22...v1.0.0-next.24
Nothing published for this version
( polka ) Remove code property support for next() errors: f95a5b4 Previously any errors or custom error-objects could use the code property to set the
polka) Remove code property support for next() errors: f95a5b4code property to set the response status code. However, this could pose a problem with native Error types that set an error code (eg, "ENOENT") which is an invalid status code.status property, which was always supported, but took a backseat to code's existence. Express also supports the status property.
next({
-- code: 422,
++ status: 422,
message: 'Invalid content',
});@polka/url) Accomodate an updated error message in test expectant: d30d448( @polka/url ): Remove toDecode parameter ( #175 ): e45fe88 Apparently no one was using it except for me 😆 so I removed it as it was causing cache/mut
Nothing published for this version
Nothing published for this version
(@polka/url): Ensure toDecode value is considered during req._parsedUrl cache match: f64b4bb _For example, if you parse a URL without decoding it, tha
@polka/url): Ensure toDecode value is considered during req._parsedUrl cache match: f64b4bb
For example, if you parse a URL without decoding it, that previous result should not be reused if you call parse again w/ toDecode set to true this time. Should be true for the reverse situation too.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Remove Promise around app.listen (#19): dc56b9d, e34a2a4
Remove Promise around app.listen (#19): dc56b9d, e34a2a4
The previous polka.listen was a Promise & had structured input, both of which made it unique from existing frameworks. However, it was also a gotcha for projects migrating from existing frameworks.
Instead, polka.listen now passes all arguments directly to the underling server.listen, which is arguably more "in tune" with the rest of Polka's ideology around native http integration.
The new method will now rerun the current Polka instance directly, allowing you to continue chaining from it, or allowing you to grab the server or handler values immediately. Previously, .listen() always had to be last in your chain & resolved to nothing.
// Could not do this before 0.5.0
const { server, handler } = polka().listen();
// Or this!
const app = polka().listen(PORT, onAppStart);
app.use('users', require('./users'))
.get('/', (req, res) => {
res.end('Pretty cool!');
});
Removed built-in .METHOD() prototype methods for all 34 http.METHODS: 6d5d094
The large majority of these are never used; eg: ACL, MKCOL, MKCALENDAR, etc.
These HTTP/1.1 verbs are supported / available to your Polka applications:
.get().post().options().delete().patch().put().head().connect().trace()Polka now supports multiple route-specific handlers! (#18): 42574ac, aac1859, a82f571
This was the most anticipated & most request feature for Polka 🎉
Put simply, variadic route handlers allows you to chain middleware for specific paths. This was only feasible before through req.path filters on sub-application or global middleware. Routes can now be modular, allowing you to compose/reuse your server route-by-route instead of group-by-group.
Supporting this dramatically improves compatibility between Express and Polka applications. Most importantly, though, this did not come at the expense of performance~!
Here's a very basic example using passport, which was often a driver for this feature request:
const app = polka();
app.post('/login',
// This "guards" this route, executing first
passport.authenticate('local', { failureRedirect: '/login' }),
// This is the "main" function of this route
function (req, res) {
res.redirect('/');
});
NEW @polka/url package: 44a5757, da00320, 87bac82, 17c54a7
Super lightweight URL parser built specifically for Node.js servers.
send-type) Lowercase all custom headers keys before parsing (#57): 83731c5examples/with-apollo (#48): a7a38c4examples/with-nextjs (#48): a7a38c4
Thanks @jerolan!examples/with-socketio: a9f0f58req.path instead of req.pathname (#62): a4d96b9
Thanks @antoineneff!Your coding agent can read these notes before it upgrades. Set up the MCP server →