-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feature/typings #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great thanks! I think it might be better to just port the project itself across to TS so the typings never get out of date, WDYT?
The code isn't very complex and it's already written using ES6 classes - shouldn't be problematic, thanks to that ;) The biggest challenge would be to properly build so it supports both Import/export syntax and commonJS. I might try helping with that in my free time, but it'd take a bit to standardize and properly test. |
You don't need to worry about that, ES6 modules are only useful for frontend where tree shaking is a thing, for node you just need to transpile to commonjs and it will work everywhere |
Perfect, I'll try to conjure sth in following days then ;) |
…ork on new coverage and enabling Function support.
@mattlewis92 Basic work is done. All the tests are passing and all the code (including tests) is rewritten to Typescript, with a few improvements :) I'll need another day to refine the tests (cover new type guards) and probably address #2 as well. |
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
==========================================
+ Coverage 87.5% 91.66% +4.16%
==========================================
Files 2 1 -1
Lines 16 24 +8
Branches 4 3 -1
==========================================
+ Hits 14 22 +8
+ Misses 2 1 -1
- Partials 0 1 +1
Continue to review full report at Codecov.
|
@mattlewis92 I've just finished coding! :) Tested the library with ES imports - it works fine.
And a lot of smaller changes. Feel free to merge and if you don't mind - I'd be thankful if you can mention me as a contributor / typescript version author ;) |
One remark - I changed |
@mattlewis92 another round of changes - I was able to update code structure to prepare two builds:
I also added some build tools and tests for them. I tested both ES and CJS and typings for TS. Importing is not touched after that last update - main exported module is CJS. I also updated README. Please feel free to adjust it in any desirable way ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is really awesome, thank you!! ❤️
The only comments I have are:
-
Let's keep things simple and just have one index.ts instead of multiple ones, I think this will simplify things a lot. If you add
export default FilterWarningsPlugin
to the index it won't break anything for people already using es modules in their webpack configs, and for commonjs users they can migrate toconst { FilterWarningsPlugin } = require('webpack-filter-warnings-plugin')
-
Is having
@types/webpack
as a dependency a best practice? I'm just worried about when@types/webpack@5
is released and how npm will hoist things and if it could break typings by having duplicate module declarations. Are there any other webpack plugins out there that ship typings that we could copy from?
Hi! I'm sorry for not responding for so long, but I was switching commercial projects and well... Didn't have any time for Open Source :)
|
…types. Updated dependencies.
…d pipeline is successful.
I updated the PR:
Note on default exports - If you're OK with destructuring (that would be a breaking change), then we're set. If not, I can revert to this "double entry files" approach :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking awesome, thank you so much! Just a couple of small things and I think we're g2g
@mattlewis92 done! All the remarks are addressed, if it works for you, we should be good to go! 😀 |
Thanks again for your hard work on this! 😄 Just published a beta to npm, would you mind installing it in your project and double checking everything is ok?
|
As Typescript gets more and more popular, adding typings to the repository would make importing package in Typescript environments much easier.
I tried to keep it simple and concise and affect as little as possible, the only external dependency being Webpack @types/webpack (not Webpack itself).