-
Notifications
You must be signed in to change notification settings - Fork 282
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
Add the feature to update json2.js regulary from the upstream. #49
base: master
Are you sure you want to change the base?
Add the feature to update json2.js regulary from the upstream. #49
Conversation
(@rails-bot has picked a reviewer for you, use r? to override) |
Could you explain why this patch is necessary in execjs? |
Oh, got it. I'll review carefully. |
Hi, @rafaelfranca
Thanks for your reviewing. If I could understand it, I could send the json2.js upstream [2] a patch as a pull-request by myself. |
If you want to modify my pull-request, you can send me a pull-request to my repo's branch. [1] [1] https://github.com/junaruga/execjs/tree/feature/update-json2-from-upstream-regulary |
I checked why its patch was necessary at past time. ConclusionFirst of all, my conclusion is that we do not need the patch if all the versions of JScript does not include JSON object in the engine. However it is much better to update json2.js to latest version because that the patch's issue is fixed on latest json2.js. Why? (Process)I checked the past source code for the patch
I could find that json2.js was used in external_runtime.rb#compile at that time. [1] Spidermonkey had JSON object in the engine at that time, such as curent Node.js [3] And that means that json2.js's JSON object did override Spidermonky's JSON object before the patch was run, because of
However the issue looks fixed on the JSON-js upstream [4]. So, I think we can update json2.js to latest version easily. And latest execjs That is my thoughts. [1] execjs/lib/execjs/external_runtime.rb Line 43 in f47c02c
[2] Line 22 in f47c02c
[3] https://github.com/artyyouth/SpiderMonkey_JSON Back porting native JSON support from SpiderMonkey 1.85 to SpiderMonkey 1.70. => That means SpiderMonkey had JSON object at past time. [4] douglascrockford/JSON-js@43d7836 |
@rafaelfranca How was that? |
Hi,
I created a mechanism to update json2.js from the upstream easily.
because I am inspired from uglifier's one.
https://github.com/lautis/uglifier/blob/master/CONTRIBUTING.md
To deploy the upstream's json2.js to your package, you can run below commands.
If you want to update json2.js, you can update submodule's commit hash.
I found you have updated the bundled json2.js by yourself.
And I used the patch command to cover it.
The patch file is created by below command.
It is this modification.
https://github.com/rails/execjs/commit/f47c02c.patch
And its patch mechanism is inspired from nokogiri package.
https://github.com/sparklemotion/nokogiri/tree/v1.6.8.rc3/patches/libxslt
I suppose that ideally you do not need to manage the patch by yourself.
You can report the patch to the json2 upstream,
https://github.com/douglascrockford/JSON-js
and can use the fixed new json2.js.
How do you think?
I think that to use upstream's json2.js is better to use your bundled json2.js.
The reason why I created this feature is that I wanted to use system's json2.js file.
I am managing your gem's RPM package in Fedora Project.
By the way, the json2.js is only used from JScript right now.
And I could not run it by myself, because I do not have Windows environment.
Thanks.