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
Use the latest punycode(1.3.2) #1865
base: master
Are you sure you want to change the base?
Conversation
define('punycode', function() { return punycode; }); which is portable when using requireJS.
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.
Node.js uses punycode 2.0.0 and it'd be best if we're in sync with them.
However punycode 2+ use ES6 features which are only supported in recent browsers, ideally browserify's node core shims work way back in old browsers too…
punycode 2.0.0 is actually identical to 1.3.2 except for the ES6 syntax. The best thing to do here might be to have a new punycode-browserify package that is punycode 2.0.0 compiled to ES5.
I don't think so. define('punycode', function() {
return punycode;
}); // punycode, 2.0.0 /** Define the public API */
const punycode = {
/**
* A string representing the current Punycode.js version number.
* @memberOf punycode
* @type String
*/
'version': '2.0.0',
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
* @see <https://mathiasbynens.be/notes/javascript-encoding>
* @memberOf punycode
* @type Object
*/
'ucs2': {
'decode': ucs2decode,
'encode': ucs2encode
},
'decode': decode,
'encode': encode,
'toASCII': toASCII,
'toUnicode': toUnicode
};
module.exports = punycode; Yes, browserify is mainly target convert ES6 to ES5, if browserify itself contain ES6 code. Since you can't change it here. Let me try talk to punycode(1.3.2) to remove the uncomfortable amd id('punycode'). |
Besides, Could you help to do it? |
Yes I think I worked on one a few months ago. I'll see if I can dig it up on the weekend. |
I'm confused what the problem is with the AMD detection; couldn't that be trivially wrapped for CJS? |
Use the latest punycode, since punycode(1.3.2) export with:
define('punycode', function() { return punycode; });
which isn't portable when using requireJS.