- BY Luke Johnson
- POSTED IN zoosk-vs-okcupid sites
- WITH 0 COMMENTS
- PERMALINK
- STANDARD POST TYPE
Simply mangling attributes one end in an enthusiastic emphasize try a fair heuristic since normal JS code will not typically consist of identifiers that way. If you would like stop mangling labels particularly __defineGetter__ you could potentially consider utilizing a complex regular expression such as for example [^_]_$ (i.elizabeth. need lead to a non-underscore followed closely by a keen emphasize).
This really is a separate form instead of are a portion of the minify setting because it is a hazardous conversion process that does not functions into the arbitrary JavaScript code. It merely works should your given typical phrase matches all of this new qualities that you like mangled and won’t match people of your own qualities you never wanted mangled. Additionally, it simply functions if you do not below any things reference a mangled possessions indirectly. For example, it indicates you simply can’t play with obj[prop] so you can source a home in which prop was a string which includes this new property identity. Specifically the second sentence structure constructs may be the just of those entitled to assets mangling:
While using the this particular aspect, remember that property labels are merely consistently mangled in this one esbuild API name although not around the esbuild API calls. For each esbuild API phone call really does a separate possessions mangling process so output records made by a couple additional API phone calls es, which will result in the ensuing password to behave improperly.
#Quoted services
By default, esbuild doesn’t modify the contents of string literals. This means you can avoid property mangling for an individual property by quoting it as a string. However, you must consistently use quotes or no quotes for a given property everywhere for this to work. For example, print(< foo_:>.foo_) will be mangled into print(< a:>.a) while print(< 'foo_':>[‘foo_’]) will not be mangled.
If you like getting esbuild to help you also mangle the fresh material out-of string literals, you might explicitly allow you to definitely decisions similar to this:
#Stopping renaming
If you prefer to ban specific attributes away from mangling, you can set-aside all of them with an extra function. Eg, that it uses the standard expression ^__.*__$ so you can set aside most of the services you to definitely start and end which have a few underscores, like __foo__ :
#Persisting renaming behavior
Complex the means to access the home mangling feature comes to storage new mapping out of brand spanking new identity to help you mangled title in a chronic cache. When enabled, every mangled possessions renamings was registered on cache when you look at the 1st create. Subsequent produces recycle the brand new renamings stored in the cache and add most renamings for any newly-additional qualities. It has a few outcomes:
The brand new cache serves as a listing of all of the qualities that have been mangled. You can easily see it to see if you can find any unforeseen possessions renamings.
You could eliminate mangling to own individual properties of the form this new rebranded well worth so you can not the case in the place of so you can a string. It is just like the set-aside props mode but into the good per-assets base.
You can make certain uniform renaming anywhere between yields (e.g. a central-bond document and you will an internet employee, or a library and a plugin). In place of this feature, for each make would do an independent renaming cost of Okcupid vs Zoosk procedure while the mangled possessions names almost certainly would not be consistent.
Whenever we want customRenaming_ is rebranded so you’re able to cR_ so we do not want disabledRenaming_ is rebranded after all, we can violation the second mangle cache JSON so you’re able to esbuild:
#Metafile
This option tells esbuild to help make specific metadata regarding the create for the JSON style. Another analogy leaves brand new metadata in a document entitled meta.json :
This info are able to feel assessed by other tools. Such as for example, bundle buddy normally eat esbuild’s metadata style and you may makes an effective treemap visualization of the segments on the plan and how far area each one occupies.