Categories
zoosk-vs-okcupid sites

Web browser APIs and additionally avoid so it naming discussion so this also avoids disputes which have browser APIs

Web browser APIs and additionally avoid so it naming discussion so this also avoids disputes which have browser APIs

Simply mangling functions one to end in a keen emphasize is actually a fair heuristic just like the regular JS code will not typically have identifiers like that. Should you want to prevent mangling names such __defineGetter__ you can consider using a very state-of-the-art regular term instance [^_]_$ (i.age. need certainly to bring about a non-emphasize with a keen underscore).

This can be a unique setting unlike getting part of the minify mode since it is a hazardous sales that does not functions towards the arbitrary JavaScript code. It merely functions if the considering regular phrase suits each of the latest functions that you want mangled and will not match people of your own properties you do not need mangled. Additionally, it just work unless you not as much as one issues reference a good mangled possessions indirectly. Such, this means you can’t have fun with obj[prop] to help you resource a home in which prop is actually a sequence with the latest property name. Specifically another syntax constructs are the just of them entitled to assets mangling:

When using this particular aspect, keep in mind that possessions brands are merely consistently mangled inside a single esbuild API telephone call although not across the esbuild API calls. Each esbuild API phone call do an independent possessions mangling procedure therefore returns documents made by a couple of different API phone calls es, which will cause the resulting code to do something incorrectly.

#Cited characteristics

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 need getting esbuild in order to in addition to mangle the fresh information of string literals, you can explicitly permit one choices like this:

#Stopping renaming

If you would like to prohibit specific services away from mangling, you can reserve them with a supplementary setting. Such, it spends the standard expression ^__.*__$ to put aside the qualities that start and you will https://datingmentor.org/zoosk-vs-okcupid/ stop with two underscores, eg __foo__ :

#Persisting renaming behavior

State-of-the-art entry to the property mangling feature relates to storing the mapping of new title to help you mangled name inside the a chronic cache. Whenever let, every mangled property renamings is actually submitted regarding the cache in initially create. Next creates reuse the renamings kept in the newest cache and you will add a lot more renamings for recently-additional properties. It offers a number of effects:

The newest cache functions as a summary of the properties that were mangled. You’ll search they to find out if you will find one unexpected property renamings.

You could potentially eliminate mangling to own private properties because of the means the new rebranded worthy of in order to not the case in lieu of so you’re able to a string. This might be just as the put aside props means but for the a beneficial per-assets basis.

You could verify consistent renaming anywhere between generates (age.grams. a central-thread document and a web site staff member, or a collection and you can a plug-in). Instead of this particular aspect, per generate should do another renaming process additionally the mangled possessions names more than likely would not be uniform.

Whenever we require customRenaming_ become renamed in order to cR_ and we wouldn’t like disabledRenaming_ to-be renamed after all, we could citation the following mangle cache JSON so you’re able to esbuild:

#Metafile

This one tells esbuild to make specific metadata regarding build in the JSON style. The second example leaves the latest metadata during the a document called meta.json :

This information are able to feel reviewed from the other devices. For example, plan buddy can also be eat esbuild’s metadata structure and you can creates good treemap visualization of your modules on your own plan as well as how much space each one occupies.

Leave a Reply

Your email address will not be published. Required fields are marked *