Won’t the minification remove the code if it’s not needed?

> On Dec 28, 2021, at 2:10 AM, Alex Harui <aha...@adobe.com.INVALID> wrote:
> 
> I think with this change we'll see HelloWorld grow by the size of the 
> goog.html and related code, which could be a noticeable chunk.  Ideally, 
> there'd be some way to kick out the sanitization code if rare situations it 
> isn't needed, or just to show our HelloWorld is still small.  And then it 
> would nice to not have to remember to update the compiler if we add some 
> other goog dependency later.  The compiler did list a bunch of goog files for 
> the debug build's addDependency list, so maybe we just need to start from 
> that list.  However, I'm hoping to not spend more time on this, so maybe some 
> other volunteer can do that.
> 
> -Alex
> 
> On 12/27/21, 1:03 AM, "Harbs" <harbs.li...@gmail.com> wrote:
> 
>    OK. I’ll give it a go. I see what you did. It’s probably reasonable to 
> just add dependencies if/when we need them.
> 
>> On Dec 27, 2021, at 9:53 AM, Alex Harui <aha...@adobe.com.INVALID> wrote:
>> 
>> It looks like the compiler has some expectations that 
>> goog.events.EventTarget is the only goog dependency in a Royale app.
>> I added HtmlSanitizer and a test case I was using that had the same problem 
>> started working.  Maybe we need a smarter way to dictate what goog 
>> dependencies really are.
>> 
>> -Alex
>> 
>> On 12/26/21, 11:51 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>> 
>>   This is when running the CoreJS tests.
>> 
>>> On Dec 26, 2021, at 8:54 PM, Harbs <harbs.li...@gmail.com> wrote:
>>> 
>>> Uncaught TypeError: Cannot read properties of undefined (reading 'ua’)
>>> 
>>> in gf(Ci, We.H.ua);
>>> 
>>> “We.H" is undefined.
>>> 
>>> Here’s the surrounding code:
>>> 
>>> function Ci(a, b) {
>>>  We.H.ua.call(this, a, b)
>>> }
>>> gf(Ci, We.H.ua);
>>> C(je, Ci);
>>> Ci.unwrap = function(a) {
>>>  return We.H.ua.unwrap(a)
>>> }
>>> ;
>>> C('org.apache.royale.utils.string.InternalSafeUrl.unwrap', Ci.unwrap);
>>> Ci.sanitize = function(a) {
>>>  return We.H.ua.sanitize(a)
>>> }
>>> ;
>>> C('org.apache.royale.utils.string.InternalSafeUrl.sanitize', Ci.sanitize);
>>> Ci.prototype.g = {
>>>  names: [{
>>>      name: 'InternalSafeUrl',
>>>      h: je,
>>>      kind: p
>>>  }]
>>> };
>>> Ci.prototype.i = function() {
>>>  return {
>>>      methods: function() {
>>>          return {
>>>              InternalSafeUrl: {
>>>                  type: '',
>>>                  declaredBy: je,
>>>                  parameters: function() {
>>>                      return [l, !1, k, !1]
>>>                  }
>>>              },
>>>              '|unwrap': {
>>>                  type: l,
>>>                  declaredBy: je,
>>>                  parameters: function() {
>>>                      return [kc, !1]
>>>                  }
>>>              },
>>>              '|sanitize': {
>>>                  type: kc,
>>>                  declaredBy: je,
>>>                  parameters: function() {
>>>                      return [l, !1]
>>>                  }
>>>              }
>>>          }
>>>      }
>>>  }
>>> }
>>> ;
>>> 
>>>> On Dec 26, 2021, at 7:27 PM, Alex Harui <aha...@adobe.com.INVALID> wrote:
>>>> 
>>>> What error do you get in release mode?  The goog classes "should" be 
>>>> renamed in release mode if it is all static methods.
>>>> 
>>>> -Alex
>>>> 
>>>> On 12/26/21, 2:11 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>>>> 
>>>> I subclassed the goog classes. That seems to help in debug mode, but for 
>>>> some reason I’m not clear on, the goog classes disappear in release mode.
>>>> 
>>>> You can see what I did on the sanitize branch...
>>>> 
>>>>> On Dec 26, 2021, at 9:35 AM, Harbs <harbs.li...@gmail.com> wrote:
>>>>> 
>>>>> I’ll try to create placeholder classes to subclass them.
>>>>> 
>>>>>> Might be simpler to just special case these two.
>>>>> 
>>>>> How would we go about that?
>>>>> 
>>>>>> On Dec 25, 2021, at 6:08 PM, Alex Harui <aha...@adobe.com.INVALID> wrote:
>>>>>> 
>>>>>> Hmm.  That may not work since you can't extend a static function.  Might 
>>>>>> be simpler to just special case these two.
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>>> On 12/25/21, 12:08 AM, "Alex Harui" <aha...@adobe.com.INVALID> wrote:
>>>>>> 
>>>>>> I took a look.  It does require an "extends" relationship to force the 
>>>>>> goog.require for something in GCL.swc.  I don't think we want to change 
>>>>>> that, so try a workaround.
>>>>>> 
>>>>>> On 12/20/21, 9:02 AM, "Alex Harui" <aha...@adobe.com.INVALID> wrote:
>>>>>> 
>>>>>>   I will try to look at it this coming weekend.  One thing to try for 
>>>>>> now is to create a class that extends goog.html.SafeHtml and redirect 
>>>>>> sanitization through the subclass.  Maybe the only way to get the 
>>>>>> dependency is to have an 'extends' relationship on the dependency, since 
>>>>>> that's what EventDispatcher does.
>>>>>> 
>>>>>>   -Alex
>>>>>> 
>>>>>>   On 12/20/21, 7:16 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Dec 20, 2021, at 10:20 AM, Alex Harui <aha...@adobe.com.INVALID> 
>>>>>>> wrote:
>>>>>>> 
>>>>>>> I might have time this weekend to spend more time getting it to work, 
>>>>>>> but the idea is that you add to GCL.swc the .as version of whatever JS 
>>>>>>> file you need from Google Closure Library
>>>>>> 
>>>>>>       Check.
>>>>>> 
>>>>>>> , make sure the subset code in downloads.xml doesn't delete it,
>>>>>> 
>>>>>>       Check.
>>>>>> 
>>>>>>> and then if the transpiled output of, say, Label references 
>>>>>>> goog.html.SafeHtml, it should show up in the addDependency line for 
>>>>>>> Label.
>>>>>> 
>>>>>> 
>>>>>>       Here’s where I’m stuck.
>>>>>> 
>>>>>>       That’s what I was expecting, but it doesn’t. I don’t know if it’s 
>>>>>> because it’s a utility function rather than a class or some other 
>>>>>> reason, but goog.html.SafeHtml and friends do not appear as dependencies.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>> 
>> 
> 
> 

Reply via email to