benbria / browserify-transform-tools

Utilities for writing browserify transforms.
MIT License
65 stars 15 forks source link

Ensure file configuration (appliesTo) is overridden correctly #17

Closed matthewdunsdon closed 8 years ago

matthewdunsdon commented 8 years ago

Previously, the file configuration appliesTo was only being read from the config parameter (the programatic config) if there was no configuration in package.json.

In the PR, I look to address this issue. Now, if appliesTo is set programatically it will override any existing value (such as package.json file configuration).

Also, this PR aligns the behaviour of appliesTo with the current documentation (https://github.com/benbria/browserify-transform-tools/wiki/Transform-Configuration):

Configuration is taken first from data passed via options from browserify (either from b.transform(tr, opts) or from the command line. Configuration is then loaded from package.json. If configuration is found in both package.json and in data passed programatically, then keys from the programatic configuartion are copied over top of the configuration from package.json.

The appliesTo key will be stripped from the configuration before being passed to your transform (although it is available in the configData if you need it for some reason.) Note that appliesTo will override the includeExtensions and excludeExtensions provided to any of the make*Transform() functions.

jwalton commented 8 years ago

Wow. Thanks for being so thorough with this. I should read my own documentation. :P

jwalton commented 8 years ago

Published as v1.5.3.