Web browser APIs along with avoid this naming summit and this plus avoids conflicts which have internet browser APIs

Only mangling qualities one to end in an underscore is a reasonable heuristic as the normal JS code will not generally incorporate identifiers in that way. Should you want to avoid mangling labels for example __defineGetter__ you can consider using a complex typical term particularly [^_]_$ (i.elizabeth. need to end in a low-emphasize accompanied by a keen underscore).

This is an alternate setting instead of being an element of the minify form since it is an unsafe sales that doesn’t really works towards random JavaScript password. It only really works if your offered normal phrase fits each of the fresh features that you want mangled and will not match one of functions that you don’t need mangled. Additionally only really works if you do not lower than any facts resource a beneficial mangled assets indirectly. Instance, this means you can’t have fun with obj[prop] in order to resource property where prop try a string that has the newest property title. Especially the next syntax constructs are the simply of those entitled to possessions mangling:

While using this particular feature, remember that assets names are merely continuously mangled within this a single esbuild API call yet not all over esbuild API phone calls. For each and every esbuild API phone call do a different possessions mangling process thus output data created by one or two additional API phone calls es, that could result in the ensuing password to act improperly.

#Cited 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 prefer for esbuild to help you also mangle the newest material from sequence literals, you might clearly enable you to definitely choices in this way:

#Stopping renaming

If you need in order to ban particular characteristics out-of mangling, you might put aside these with an additional setting. Such, it spends the regular phrase ^__.*__$ so you can set-aside all the attributes one to initiate and avoid having two underscores, particularly __foo__ :

#Persisting renaming behavior

Cutting-edge entry to the home mangling ability relates to space the fresh new mapping of brand-new name so you can mangled label from inside the a long-term cache. Whenever permitted, most of the mangled possessions renamings was registered about cache for the very first http://datingmentor.org/nl/wildbuddies-overzicht make. Subsequent produces recycle the fresh renamings kept in the fresh new cache and you may create additional renamings for your recently-added features. It offers a number of effects:

This new cache serves as a list of every qualities which were mangled. You can easily search it to see if discover one unforeseen possessions renamings.

You might disable mangling having personal characteristics from the form the new rebranded well worth in order to false rather than in order to a set. This can be similar to the set aside props function however, to the a per-property base.

You can be certain that uniform renaming between stimulates (elizabeth.grams. a central-bond file and you will a web staff, otherwise a collection and a plug-in). Versus this particular aspect, for every make should do another renaming operation plus the mangled assets names almost certainly wouldn’t be uniform.

When we want customRenaming_ are rebranded in order to cR_ and we also don’t want disabledRenaming_ as renamed at all, we can solution the following mangle cache JSON in order to esbuild:

#Metafile

That one tells esbuild to manufacture particular metadata concerning the make in JSON structure. Next analogy sets this new metadata inside the a file titled meta.json :

This info may then feel reviewed by other devices. Like, bundle friend is also consume esbuild’s metadata structure and you will builds a good treemap visualization of your segments on your own plan and how far space each one of these occupies.