You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Alex Harui <ah...@adobe.com.INVALID> on 2020/02/19 20:44:48 UTC

Beware short id's in modules!

To those of you using modules in Royale, we have just noticed that the minifier is starting to create more collisions than it used to.  It could be that some compiler change or new APIs are adding more renamed properties to the apps, but it is something to avoid by using longer id names in your modules.

The minifier takes some property and gives it a short name, so that "getRowCount" gets some name like "za".  As your app contains more and more properties, the short names go from single characters like "a" to two characters "aa", and then to three characters and so on.  This list of short names is passed to the compiler for a module so that the compiler will not re-use those names when minifying the module, otherwise module properties could overwrite the apps property of the same minified name.

However, if your module already contains a short name for an id, the compiler will produce an error. So if your module contains a TextInput with id="ti" and the minification of the main app results in a minified name of "ti", you will get a compiler error.  So best to use longer id names (id="myTI") which will take a lot of properties in the app to generate a minified name that collides with "myTI".

HTH,
-Alex


Re: Beware short id's in modules!

Posted by Carlos Rovira <ca...@apache.org>.
Hi Andrew,

this could be on the Module docs page with a ">" so is like a note or tip
to take into account (It shows as a yellow zone)

El jue., 20 feb. 2020 a las 12:02, Andrew Wetmore (<co...@gmail.com>)
escribió:

> Where should this information go in the documentation? Should we have a
> "tips and tricks" page to capture stuff like this, maybe in the "get
> started" category?
>
> On Wed, Feb 19, 2020 at 4:45 PM Alex Harui <ah...@adobe.com.invalid>
> wrote:
>
> > To those of you using modules in Royale, we have just noticed that the
> > minifier is starting to create more collisions than it used to.  It could
> > be that some compiler change or new APIs are adding more renamed
> properties
> > to the apps, but it is something to avoid by using longer id names in
> your
> > modules.
> >
> > The minifier takes some property and gives it a short name, so that
> > "getRowCount" gets some name like "za".  As your app contains more and
> more
> > properties, the short names go from single characters like "a" to two
> > characters "aa", and then to three characters and so on.  This list of
> > short names is passed to the compiler for a module so that the compiler
> > will not re-use those names when minifying the module, otherwise module
> > properties could overwrite the apps property of the same minified name.
> >
> > However, if your module already contains a short name for an id, the
> > compiler will produce an error. So if your module contains a TextInput
> with
> > id="ti" and the minification of the main app results in a minified name
> of
> > "ti", you will get a compiler error.  So best to use longer id names
> > (id="myTI") which will take a lot of properties in the app to generate a
> > minified name that collides with "myTI".
> >
> > HTH,
> > -Alex
> >
> >
>
> --
> Andrew Wetmore
>
> http://cottage14.blogspot.com/
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: Beware short id's in modules!

Posted by Andrew Wetmore <co...@gmail.com>.
Where should this information go in the documentation? Should we have a
"tips and tricks" page to capture stuff like this, maybe in the "get
started" category?

On Wed, Feb 19, 2020 at 4:45 PM Alex Harui <ah...@adobe.com.invalid> wrote:

> To those of you using modules in Royale, we have just noticed that the
> minifier is starting to create more collisions than it used to.  It could
> be that some compiler change or new APIs are adding more renamed properties
> to the apps, but it is something to avoid by using longer id names in your
> modules.
>
> The minifier takes some property and gives it a short name, so that
> "getRowCount" gets some name like "za".  As your app contains more and more
> properties, the short names go from single characters like "a" to two
> characters "aa", and then to three characters and so on.  This list of
> short names is passed to the compiler for a module so that the compiler
> will not re-use those names when minifying the module, otherwise module
> properties could overwrite the apps property of the same minified name.
>
> However, if your module already contains a short name for an id, the
> compiler will produce an error. So if your module contains a TextInput with
> id="ti" and the minification of the main app results in a minified name of
> "ti", you will get a compiler error.  So best to use longer id names
> (id="myTI") which will take a lot of properties in the app to generate a
> minified name that collides with "myTI".
>
> HTH,
> -Alex
>
>

-- 
Andrew Wetmore

http://cottage14.blogspot.com/

Re: Beware short id's in modules!

Posted by Carlos Rovira <ca...@apache.org>.
Hi Alex,
thanks for pointing that out.
Will take into account
Carlos

El mié., 19 feb. 2020 a las 21:45, Alex Harui (<ah...@adobe.com.invalid>)
escribió:

> To those of you using modules in Royale, we have just noticed that the
> minifier is starting to create more collisions than it used to.  It could
> be that some compiler change or new APIs are adding more renamed properties
> to the apps, but it is something to avoid by using longer id names in your
> modules.
>
> The minifier takes some property and gives it a short name, so that
> "getRowCount" gets some name like "za".  As your app contains more and more
> properties, the short names go from single characters like "a" to two
> characters "aa", and then to three characters and so on.  This list of
> short names is passed to the compiler for a module so that the compiler
> will not re-use those names when minifying the module, otherwise module
> properties could overwrite the apps property of the same minified name.
>
> However, if your module already contains a short name for an id, the
> compiler will produce an error. So if your module contains a TextInput with
> id="ti" and the minification of the main app results in a minified name of
> "ti", you will get a compiler error.  So best to use longer id names
> (id="myTI") which will take a lot of properties in the app to generate a
> minified name that collides with "myTI".
>
> HTH,
> -Alex
>
>

-- 
Carlos Rovira
http://about.me/carlosrovira