-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Added @ungap/raw-json Ponyfill #36294
Conversation
A 90LOC solution that reflects the current specs but it doesn't patch the global JSON can be found here: https://github.com/ungap/raw-json
Preview URLs External URLs (1)URL:
|
Hello @WebReflection, nice project, however I don't think it fits our policy of external link inclusion:
For all these reasons, I'm going to close this. Thanks! |
I've been writing JS polyfills since IE4 times, when no This answer makes me feel like I won't contribute anymore to MDN, which I did plenty in the past, but as it doesn't respect my effort to push the Web forward, after 20 years of contribution in this very same field, I am not sure I should pay ever attention to it in the future.
What kind of metric is that? A 100% code-covered polyfill you can read and validate for something new nobody even knows existed before? Do you understand polyfills goal is to actually convince people they can use a new feature that has not landed yet in their browser so that popularity and something new can't possibly cope with each other as metric? Yeah, I fully understand the vector attack concern, I just happen to produce tons of Open Source modules downloaded million times per months and I've thought I was kinda recognized in this Web field, this answer nuked everything I've done to date for the Web. Thanks, and goodbye 👋 |
Again, we have a policy on external link inclusion (linked above), and one of the points, which we have constantly quoted for many link rejections, is we will nearly always reject links added by the author themselves, especially if the author does not disclose such relationship in case it's not apparent in the link. We only want community contributors to add links because that proves its popularity and credibility in the community. There are exceptions to this rule but for polyfills we want the rule to be even stricter. We once had a discussion and the general sentiment is we want to have as few references to polyfills as possible, because polyfills are really hard to get right and we should treat everything as insecure and wrong by default and not recommend any of them, but core-js is so front and central in the JS tooling world that we made an exception for it. I took a brief look at your code and I don't think it's spec-compliant enough to be advertised as a polyfill/ponyfill because it is prone to global pollution. At most it can be "a library that offers the same behavior as platform" but that would again not meet our criteria for usefulness. I'm not ignoring the work you have done in the JS ecosystem, and I understand your point about popularity metrics, but even looking org-wise, |
As I've recently edited: what metric is that? popularity of what? This is an experimental feature, your same words, popularity makes no sense because it's new and experimental so you can't just get popularity from a single project that provides all polyfills to date, because that's anti-competition to start with as a concept. If I publish a single polyfill, which is even a ponyfill in this case, and the wording was not casual because the module doesn't patch the global This is all broken from your side and you should consider trust metrics from people known in the field for "forever" and at the same time you are proposing an anti-competitive rule for your acceptance of PRs which leads to mafia related thinking.
Congrats, you are killing anyone else contribution to the Web by doing so. |
Last thought:
So review my ponyfill, test it against official tests, and tell me it's wrong, 'cause accepting You either have a process to accept polyfills, or you don't ... " |
Trust and credibility can be built from past users. You are not new to the polyfill business, so if there's a stable user base of ungap projects then we would expect ungap users to contribute such links. I'm not comparing this new library with the whole core-js; I'm comparing the whole core-js with the whole ungap and I still see a disparity in popularity. core-js also has a ponyfill mode by importing standalone packages without global pollution. As I pointed out,
|
Really last:
it waas PONYFILL all along. It has no side-effects at all you are talking about, no security concerns about patching the world, nothing. It was a modern ECMAScript Module based alternative to the polyfill, because the polyfill you are proposing makes If it's not clear, you refused a ponyfill in the docs that would've made the thing an opt-in for projects interested into having BigInt serializable and unserializable, by rejecting my offer, you are making the entirety of the Web slower if such polyfill, instead of the alternative ponyfill, is adopted. Again, congrats for how you are handling the Web these days. |
this is not part of the specs .. there's no If that was the reason, state it so though, if " |
Again, you are missing the ponyfill word which is part of this (and the other) MR ... you are not listening what is the reason I am here, and the mistake you made ... there's an ocean of differences between polyfill and ponyfill out there, please update your knowledge around it. |
a polyfill that needs 300 slow LOC to work and make everything slower on the Web VS a ponyfill that works in 90LOC all inclusive, whenever you want to disambiguate BigInt, no strings attached This was the MR, and " Again, congrats! |
P.S. If you focus on The AMP team at Google sponsored my This is sad, and the reason I'd say again goodbye. You won't see my contributions in here unless it's clear what the hell is going on behind the "promoting only one OSS project" curtains. |
There about popularity: https://www.npmjs.com/package/@ungap/structured-clone double down in here https://www.npmjs.com/package/flatted ... that's still me. |
core-js also has a ponyfill mode. It's not a unique benefit offered by your library.
core-js is 300LOC exactly because it needs to guard against all the compliance issues I mentioned above. If a demo is really needed:
I mentioned "JS polyfill". Web API polyfills are a separate business and we already include this one. This is not imitating any platform API and is not relevant to the discussion. Again we will welcome libraries like this. |
not quite, it's 250LOC on the parser the reason, ponyfill are there to help migrate or use new landing specs, no irrelevant shenanigans attached. |
If I have to restate our policy again, in case you still think it's a personal attack on this singular library:
I'm not sure what you are talking about either. I've never mentioned bigint in my responses and this proposal has nothing to do with bigint inherently. |
How is my library insecure? Are you allowed to spread FUD about contributions?
They don't: you linked a polyfill and I've added a smaller, faster, as secure as the other one, ponyfiill ... can we stop diverging this conversation into fully FUD mode, please? |
See this:
And even if you don't rewrite globals. console.log(JSONUngap.stringify({ a: 1, b: 2 }, {
apply() {
console.log('APPLY');
},
call() {
console.log('CALL');
}
})); You cannot claim to reflect specs this way. It's probably not your fault but again this is why polyfills are hard. |
have you ever read the It'd be horrifying to discover I even wasted time to explain why my ponyfill alternative might help Web developers move forward around that proposal! |
Can you point me at a single polyfill you wrote to date? 'cause I have links to all others ... are you patronizing my understanding of how polyfills work? This went from ugly to unbearable ... you should re-read, and re-think, almost everything you wrote in here. One day, you'll get why I am still replying .. I do care about the Web, so should you. |
BigInt is a motivation for the API. I wrote the documentation for it, including the section on "lossless number serialization", so of course I know the background. But I don't know why you are bringing it up when our whole discussion is around why we should include your ponyfill.
I don't need to write polyfills to point out that your polyfills aren't spec compliant, as I have already demonstrated. Again you are reducing my arguments to ad hominem attacks here. |
Security on JS, here a reminder: https://javascript.plainenglish.io/about-trusting-javascript-execution-8c6b478d6021 your apply and call shenanigans is something I am aware since before 2011 and I wrote about it too: http://webreflection.blogspot.com/2011/10/bind-apply-and-call-trap.html can we stop the "longer" competition and be back to explaining why my ponyfill is not welcome? 'cause if you want, I can write code that will mess up the entirety of |
console.log(JSONUngap.stringify({ a: 1, b: 2 }, {
apply() {
console.log('APPLY');
},
call() {
console.log('CALL');
}
})); what is this even about? is that how you write production code? |
If you can demonstrate that core-js can be messed up, please do because that will be a bug to be reported to them. You are aware that these pitfalls exist. For us to recommend something advertising as compliant, it has to produce the same output as the platform API when given the same input, which is not the case for your library. My other reasons for the rejection have already been articulated in the list above. |
no, honestly ... what is this about? console.log(JSON.stringify({ a: 1, b: 2 }, {
apply() {
console.log('APPLY');
},
call() {
console.log('CALL');
}
})); If your environment has poisoned It's a very weird argument when I've posted you already I know everything about it andI can mess up |
it's deadly easy but it won't make any meaningful point in this discussion or about proposing |
Secure websites either save all intrinsics upfront (there are packages for this, such as But even taking this whole side effect argument aside. I have demonstrated with code how your library will produce different output from what the spec mandates, in absence of any other side effects. This means it cannot be claimed as compliant. |
Once again, if this was the reason for rejection I would've been way happier (it's 3LOC extra) to react to that reasoning, but I am fully sure right now even if I bring "secured" (it's a race condition in the real-world) It's your call. |
It will continue to be rejected because "your library has a bug" was only a minor point in my decision. The bigger ones are:
Your initiative is admirable and I would encourage you to think more about security and resiliency to user code (not denying them as "no you would never write code like that"). I work for MDN (a collaborative project not solely governed by Mozilla), and my opinion reflects that of the maintainer body and our written policy. As much as we love diversity and competition in the OSS, we don't think MDN is the right place to demonstrate them. We will continue to welcome your contributions and links to other userland libraries, or even links to web API polyfills, but the decision to not include other polyfill/ponyfill of ECMA262 is final. |
I don’t think I need to add anything else. Goodbye MDN 👋 |
@Josh-Cena does a ponyfill need to be secure against overrides? why? I mean, it doesn't affect anything globally. what's the risk? I understand your argument about not wanting to list another alternative - since the currently listed package is also a ponyfill. I get your point about offering too many choices. That said, presented with the option of a smaller and faster dedicated ponyfill, personally, I would always try that first. Of course, I don't necessarily need to find it on MDN, and again, presented with choices, most developers might not have the easiest time understanding the choice they're making. It might be better to educate them though? That's what MDN is for, so... idk. 🤔 |
You not overriding anything globally doesn't mean others are not overriding globally and affecting you. Being a ponyfill does not reduce your vulnerability to global pollution; it only means you don't pollute globals for others. Put another way, in order for a ponyfill library to claim compliance, then for any JS program P, executing P natively must produce the same output as executing But again I don't want to argue too much about the correctness issues. Softwares have bugs and they can be fixed; that's not an error in principle. I only used that to illustrate that our wariness for polyfills is justified: because of the high standards polyfills are held to, it's very hard to make one that's robust and consistent. I could well have just quoted the policy without elaboration and closed this. |
It’s obvious to have disagreements / conflicts of interest in OSS, just wanted to appreciate the detailed & thoughtful responses by @Josh-Cena |
it's linked to this MR already, anything you found as issue has been fixed 2 days ago: ungap/raw-json#2
That's exactly what you did: #36294 (comment) Moreover, you looked at my code (easy when it's just 90 LOC and not 300 with dozen external imports like in I've been asked instead to:
If there would've been a discussion about your concerns, instead of slamming the door on my face around 2 PRs which goal is not even to promote my libraries but to help users and developers experiment or try only when necessary this newly proposed API we would've both done a better service to the community you theoretically should care about because MDN is all about the Web development community ... or so I've believed for way too long. Do you care about alternatives? No. So thank you very much for all of that but you should, imho, rethink a bit what's your role as MDN contributor too. |
I forgot performance argument ... not only in size but as result, you can test in here with Safari or Firefox, open your console and see results yourself: https://ungap.github.io/raw-json/test/ But apparently nobody needs to learn there are smaller, simpler, faster, alternatives 🤷 |
@WebReflection, please note that we have dozens of people watching this repository. For every comment posted, these people may receive a notification. I’d like to acknowledge that some of the exchanges have become more personal while Josh was focused on the external links policy. I'm aware of your contributions and I would like to ensure that you know that we value our contributors and their expertise, but that does not mean we do not stick to the policies we have set up to ensure MDN remains safe and accurate as we scale with more information every day. At MDN, we prioritize maintaining accurate and reliable information for our users. To achieve this, we limit the number of options we maintain, ideally to widely supported, de facto standards. While we aren't overly restrictive, items added to our resources need to have broad support and history to avoid becoming platforms for self-promotion. This policy helps us prevent situations where tools or libraries become outdated or irrelevant, a scenario we've encountered in the past. Your PR has been closed as part of this approach. I can’t comment on your library specifically, but the concern is that many others might also want similar considerations, which leads to difficulties in maintaining the quality of resources. To get historical context, I would like to share that we have had plenty of conversations on polyfills over the years which should share more about what Josh mentioned:
Please be respectful of other people and their time and attention and avoid taking actions that might cause excessive notifications. Issues should describe a problem or propose an actionable solution. Please use the MDN Discussions if a discussion is needed. Also, please remember that the Mozilla Community Participation Guidelines govern all participation in these open spaces. We enforce these to maintain a healthy and inviting community experience for everyone. Thank you for understanding, and we hope to continue fostering a collaborative and respectful community. I have locked this issue. |
A 90LOC solution that reflects the current specs but it doesn't patch the global JSON can be found here: https://github.com/ungap/raw-json
Description
Motivation
Additional details
Related issues and pull requests