-
Notifications
You must be signed in to change notification settings - Fork 55
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
API design considerations for tld.js@3.0 #124
Comments
Hi @oncletom, thanks for initiating the discussion, and sorry for taking so long to give feedback on this! I really like that you identify the different use-cases for tld.js. In fact, it made me realize that people do not use this library for the same purposes! I was naively thinking that my use-case was representative, but it might not be! Do you think it would make sense to start looking at how other libraries use As you suggest, identifying use-cases would allow us to think better about how to structure the API. I do not have clear ideas about what the best solution would be; so far both of your suggestions (dedicated modules or prefix) make sense. I have a few general questions/remarks though:
As usual, I feel giving more power/control to users will have the cost of making the API more complex, and keeping the simplicity of tld.js could prove to be challenging! What are your thoughts on this @oncletom? |
@remusao yes, I think it's worthwile otherwise the work might not be as useful as it could be. I browsed the dependents a few weeks ago and noticed most of them were still depending in the 1.x branch. I was thinking of either contacting owners directly or by opening Pull Requests to bump to tld@2 and collect feedback there. The later feels a bit heavier to implement (and I wouldn't be able to commit to it at the moment). It's slower than rewriting code but I totally feel it's worth asking. |
@oncletom I'm willing to help here. If we put up a list of projects in some meta-issue, we can share the work. I think it's a good idea! Should "collecting feedback" and "updating to tld@2" be done simultaneously? |
Thanks 😊 I find your help on this project to be singular and very helpful.
I have opened #125 to shape out something. Is it something relatable to what you had in mind? Do you think something else should be part of it? Also, I realised there is no API to get package dependants. module-dependants looks like a good one to programmatically fetch them with a few lines of code. |
I'm happy to make myself useful :) I like the project and I also find working with you to be a rewarding experience.
Indeed, for some reason different libraries did not get all the dependencies, so I combined several of them. We got ~52 deps. What's weird is that on npm there are more listed... We can always check manually at some point. Should not take too long! |
The more I think about it and the more I feel the removal of Personnalisation comes around "validity" (strict or lenient, additional hosts or not). My hunch is it's more about strictness ( Maybe there is something about the naming Also, I don't mind publishing alpha versions to flesh this out by doing. What do you think? |
Good points! I agree regarding the removal of
So not sure 100% about how all this would look like, but maybe I can play a bit around that and propose some implementation as a starting point. Some examples: import tldjs from 'tldjs';
tldjs.parse(url);
tldjs.parse(url, { includePslPrivateDomains: true });
tldjs.isValid(url, { strictHostnameValidation: true });
... So in the end, I would really like to have a super simple default experience with the library, with potentially opinionated defaults (which should still be as less surprising as possible for people using the library), but one consistent way to customize the behavior. |
And in the end, it does not look so different from tldjs 2.x, but we could make the API even simpler, more consistent and change some of the defaults to fit better what people expect from the library. |
There are some recurring issues going on. I feel they are more related to naming/design rather than because of technical issues.
The intent of this issue is to open a discussion about the painpoints and what we think could help addressing them.
From what I read, the biggest source of
painconfusion isgetDomain
does not return the expected domain • #78 #117 #73From what I understand, this library can be used:
toto@foo.abcdefg
email address okay?I was thinking of making the context of each function explicit.
Via a prefix
Via a dedicated module
The text was updated successfully, but these errors were encountered: