-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
koa 3.0 roadmap #1114
Comments
Is it to early to create a v3 branch? I have some spare time coming up and wouldn’t mind doing some work. |
All these pending PRs are not so emergency to me, so if anyone has any thoughts or some feature / refactor required, post in the issue to help us decide when to start create v3 branch. :) |
How about officially dropping support for < node.js 8? |
|
totally rewrite using TypeScript |
I'm personally against introducing TypeScript, adding external typings should be easy enough for those in need. |
@fl0w @iyuq according to community practice, engines support should always follow the Node.js release schedule :) |
like what @fl0w said above, just one more thing: |
if you have any breaking changes you'd like to introduce, please state them now :) |
Let's announce EOL for Koa v1. |
How about support HTTP/2 ? https://nodejs.org/api/http2.html |
@zhangxiang958 koa already support it since const fs = require('fs');
const http2 = require('http2');
const Koa = require('koa');
const app = new Koa();
app.use(ctx => {
ctx.body = 'Hello Koa'; // or any other stream
});
const options = {
key: fs.readFileSync('xxx.key'),
cert: fs.readFileSync('xxx.crt'),
};
const server = http2.createSecureServer(options, app.callback());
server.listen(443); |
How about publish |
Adjust naming to follow WHATWG URL Standard. |
I think |
@tiendq I completely agree! I keep mixing up
|
How to access the http2 stream on ctx object to push assets to client using koa? It this supported right now? |
I second @damianobarbati , would be great to get an implementation snippet that displays the compatibility and its usage. For example, would the stream be accessible through I've been seeing a bit of chatter on HTTP/2 support for Koa - I agree that we don't need to define config just to "enable" out of the box. What we do need however, is an interface to utilize HTTP/2, let's say if the request type is HTTP/2, maybe context could be formed at this stage. I believe that the moment the Koa community takes a stance on HTTP/2, this would promote its usage for the next generation of servers built using Koa. To me, this is a great step forward. What I envision, as a mode of compatibility and usage, is to add |
Why not simply @koa/? |
Here is my little suggestions
[EDIT] In fact everything's working perfectly. |
Note, I am not privileged to make this decision. This is my personal opinion. I'd like to chime in that I agree that namespace:ing npm-releases under npm:@koa is a good idea. One or two caveats thought.
Bug reports for 3rd party packages often end up in @koajs/koa#issues, which is burdensome for both maintainers and the user. This might clear things up a bit. I also haven't considered possible implications of moving the packages (e.g. does npm have tooling for moving origins?). |
+1 on #1044 |
Please do normal error handling. The ability to set content type |
+1 on #998 |
I think superset is bad! But I agree make a TS version to run on Deno in another repository. |
type issue is one of basic and necessary cost to move to TS, but i think benefit is more than cost especially in code quality. |
how about base on uWebSocket.js. it's so fast. |
Definitely #1326 |
How about support HTTP/3 https://nodejs.org/dist/latest-v15.x/docs/api/quic.html |
Downside of this that external type declarations can be easily broken or lagging the koa releases. |
What drew me to koa back then was that it was using generators from the core while others were still using nasty callbacks. Koa was technologically ahead. Now async/await is everywhere, but I stuck with koa because I had already built quite a few frameworks on it... Even though Koa isn't the most economically viable space to invest in right now as far as popularity. Now I see koa kinda lagging behind in a lot of things. And I believe it's partly because TJ and other OGs have moved on to other things. But that's good for them. I will say that if koa 3 does not come inbuilt with typescript, that will be the final nail in the coffin for koa for me. That will keep it in the land of hobby/amateur/not-professional-use... Which does none of us koa "investors" any favors. Types are a thing now and are invaluable when working with huge teams, whether anyone likes it or not. |
Type issues can be solved by simply understanding typescript. You can make typescript as strict or as lax as you want. At the end of the day, there is value in even the most lax typescript implementation when it comes to keeping typings automatically up to date. A TS version can also serve normal JS users as well as TS users, with the TS users getting a better dev experience right out the back. There would be no need to keep 2 versions. Also not a fan of external typings as they go out of sync. |
It doesn't make sense to me! Deno runs native TS (as another language). I keep my opinion. |
If we migrate the project to TS, that single version can be used in both TS and JS. I'd personally recommend that based on the future needs of Koa and the community moving toward strong TS support. I can probably help with migration, but I don't think I'd have time to do all of it on my own. |
@nickmccurdy I'd be willing to help if there is desire to migrate. I took at stab at rewriting koa in TS the middle of last year and opened an issue (#1475), but it did not seem pressing to make the transition at the time and was closed. However, if there is renewed interest, then https://github.com/kubejm/koa-ts might be a reasonable jumping off point. It's likely a little stale, because I have not kept up with changes since the issue was closed in June of 2020. |
I don't think there is a reason to migrate to TS, jsdoc works just as well with typing support. Deno requires explicit path with .ts extension, nodejs don't support TypeScript have never worked in the Browser and it never will. All it is is a uncessary JIT compiler that adds a unnecessary extra step that makes it take longer to load There is many things Typescript gets wrong, it have no understanding of It's just lagging behind in many areas so it will always stand in the shadow of javascript, when something new comes out then typescript will take for ages to adapt to new changes. one such recent change is having signal in addEventListener I have written a vanilla javascript project for both Deno and NodeJS with jsdoc and love and behold you get typing/IDE support from both worlds using npm and http-import using the Deno plugin for vscode and without any d.ts or ts files Typescript just adds complexity to a project, i have worked with it JS in 12 years, two of those years i have activlly used TS back and forth, i don't think it adds any real marginal productivity, you will spend lots of time just making some simple JS function compliant to the TS rules. I don't think the bug density is lower just b/c you use TypeScript, you just spend it just upfront more early Its very much possible to have typing and esm code without using Typescript syntax and having it work for both Deno and Node One day we could have optional static typing, and when that day comes TS will be totally unnecessary and everyone would refactor back to vanilla javascript |
@jimmywarting |
@alanpurple my point is that TypeScript will never be a first class language in browser or nodejs - https://stackoverflow.com/a/8947021/1008999 I just created this page to prove my point that you don't actually need typescript |
@jimmywarting Although there are some valid points in your writing, most of them are just straight bad. |
There is a beautie in a dynamic loosed type system too and there is nothing wrong with it that needs to be fixed, there have been one time where i actually wanted to do js have very many toPrimitive (or rather webidl conversion) hacks in a lot of the builtin web api's that typescript don't understand, one very common such thing is casting anything to string. anywhere where a web api expect a byteString, number or a boolean there is a webidl converter that is suppose to cast whatever argument you gave it into the correct type. i don't think the community needs stronger typescript support, i think it needs optional static typing instead builtin instead. and if you feel so strongly about types (and possible coming from a other typed language) why not just stick to it and compile to WebAssembly instead? |
You do realize Typescript allows for "Optional static typing" right? IF you simply must This is about moving Koa forward for all, not an argument of personal preferences and hacks. BTW: If anyone wants a tool to define Koa endpoints+input validation using Typescript annotations and classes, check out https://www.npmjs.com/package/amala |
optional static typing proposal !== TypeScript |
The decision we make about this will determine how attractive the Koa ecosystem will be to end-users. Typescript will not only allow for what you are proposing, but also open the gates to more serious engagement in this ecosystem by providing end-users with the types they need to enforce their code structure based on their industry compliance needs, etc. Actual Types and Interfaces, not just relying on comment-based intelli-sence that can easily become obsolete and/or wrong. We have to mature Koa past these personal hack/blob preferences. |
For me, Typescript is just a tool for ECMAScript. Well, there is not only one tool for such purpose. Flexibility can be exchanged for team-work efficiency. That is what employers need. But it doesn't mean that koa should be writen with Typescript. If koa switch to Typescirpt, there would also be a voice from people who don't want to include Typescript compiler in their projects. Typescript is not a silver bullet. I don't want to argue much about it. I just share my opinion as a heavy user of koa. And wish we don't spend too much time on this. |
Actually, a Typescript compiler was never necessary to consume Typescript packages. Typescript projects export plain JS along type definition files. Moving the source code to Typescript should mostly be made if it brings value to the maintainers working on the code, and I do believe Typescript lowers the difficulty for beginners to make code contributions. Also to refactor and clean up code. Given the low API surface, I would be surprised if a plain Koa user/consumer could gain any benefit beyond what the @types/koa already gives. Maybe a whole different thing is wanting to send the signal that Typescript is taken seriously. When comparing packages I do favor the ones with clear TS support. Just this month the node-redis package was updated to officially support promises, because you know, callbacks were always enough. |
Middle ground that will probably appease the TypeScript and the anti-bundler crowd... They build their extremely popular library on pure ES Modules... no bundlers needed... Node LTS as of 16, aka the current LTS release as of two years ago has stable support for ES Modules. Personally I just want the official typed examples... seriously what's the type of the response object! ... I'm sure I'll figure it out eventually, I may have to read the DT source code. I'm talking about docs like the one pictured below... absolutely no one in 2022 should ever type the word bonus: here's a koa sandbox with Typescript powered by vite... vavite's server side HSR wasn't a thing when I made this. https://stackblitz.com/edit/vitejs-vite-asva6y?file=src/app.ts Typescript could be one of the ways to really say, we are better than Express. Their upcoming 5.0 version won't be in typescript, but 6.0 is looking positive expressjs/express#4756 (comment) If I don't see a blue TS logo on the repo, I will immediately think less of the package and look for alternatives. |
Is this a dead horse? 'cos it looks like a dead horse. 💀 🐴 |
It looks like this is not well maintained, for new TS based projects users can consider libs like tinyhttp. but it might be slower than koa, users can also consider hyper express if req/sec is very important. |
huge thanks for spreading the word about the project! Agree on the performance side, but the benefit is better compatibility with middleware / smoother transition from express |
There are lots of PRs are blocked due to breaking change, and maybe it's time to make a plan for koa 3.0 now, if anyone has other suggestion, please post in this issue. :)
respond=false
and header sent #1044origin
header if it exists, not the current hostname #1008The text was updated successfully, but these errors were encountered: