Closed lohriialo closed 4 years ago
Looking at the big diff, it might or might not have something to do with the component.json
having been deleted. Which, by the way, is not mentioned in the changelog. @lohriialo what package management system does ExtendScript use?
Looking up ExtendScript on wikipedia, I find that it is based on ES3. This hints at another possible cause. In 1.9.2, the underscore IIFE is called straight instead of with a .call(this)
, which, if I understand this page correctly, is equivalent in ES5 but not in ES3 (see section "Function").
Personally, I have no strong opinion on whether underscore 1.9 should support ExtendScript or not.
Yes, @lohriialo — if you don't mind taking a look, and seeing what we need to tweak to regain ExtendScript support ... I'd be happy to put it back in.
(At least until a future version perhaps becomes ES Modules)
If it makes any easier, break started with 1.9.0
@lohriialo Please make a local clone of underscore 1.9.2 and try whether you can make it work again by editing the source code yourself. @jashkenas said he would be happy to put the fix in underscore, but I think he meant he needs you to find the fix.
@jgonggrijp thanks for looking into it, I'll test and update back
Btw, ExtendScript installer is available here https://github.com/Adobe-CEP/CEP-Resources/tree/master/ExtendScript-Toolkit
@jgonggrijp Version A works but not B
@lohriialo Thanks, that is the result I hoped for. How about the one below?
Btw, ExtendScript installer is available here https://github.com/Adobe-CEP/CEP-Resources/tree/master/ExtendScript-Toolkit
- Install and run above test script
Thanks. I don't really mind doing that, but I would be an absolute beginner and I wouldn't fully trust the results I obtained while not knowing exactly what I'm doing. If we can arrive at a working 1.9.2+ version by cooperating in the way we do now, I think I'll know enough for the future in order to be able to support ExtendScript.
@jgonggrijp sure, I'm happy to help test
Version C doesn't work either
That's a shame, I really hoped that would work. But I won't give up yet.
@lohriialo I did some more research and arrived at three more versions, which are mostly experimental means to figure out what is needed. Could you please test these as well?
In addition, could you please tell me what is the output of the following script in JSX (without loading underscore)? If it errors out in any way, please tell me the exact error as well.
(function() {
$.writeln('this ', typeof this);
$.writeln('Function ', typeof Function);
$.writeln('Global ', typeof Global);
$.writeln('global ', typeof global);
$.writeln('self ', typeof self);
$.writeln('$ ', typeof $);
$.writeln('$.global ', typeof $.global);
$.writeln('identity ', ($.global.$ === $ ? 'true' : 'false'));
$.writeln('$.Function ', typeof $.Function);
}());
I was about to test these things myself after all, but I'm on a recent version of macOS and I can't get any installer for the JSX toolkit to work.
@jgonggrijp All version works(D, E, F) and below is the output without underscorejs
this function
Function function
Global undefined
global undefined
self undefined
$ object
$.global object
identity true
$.Function undefined
@lohriialo Great. D is my preferred solution, I submitted a pull request for it (referenced right above this comment).
Interestingly, the only difference between C and D is a semicolon:
// version C
Function('return this;')()
// version D
Function('return this')()
I find the this
and global
outputs from the test script rather surprising, but fortunately we have a solution now.
@jgonggrijp Thanks for all your help looking into this!
Error : _ is undefined
Now try version 1.8.3 it works like a charm