* Pass `dirname` as extra metadata to preset constructor.
Sometimes a preset would like to know where it should resolve relative paths from (e.g. https://github.com/tleunen/babel-plugin-module-resolver) and this extra information makes that possible.
* Test for `dirname` passed into preset constructor
This adds a check for `dirname`’s existence and correctness to the
`resolve-addons-relative-to-file` test, and serves as a minimal example
of a path-aware preset.
Remove imports to lodash/assign and replace assign with Object.assign.
The lodash/assign is unnecessary for babel 7 as node >4 has the same
functionality built-in with Object.assign as used here.
This resolve the [issue 5353](https://github.com/babel/babel/issues/5353)
This encapsulates the logic for turning an acceptable preset name into
the absolute path for that preset. It can be used to preprocess a
presets list to map each preset to its absolute path, which is necessary
if `babel.transform` is going to be executed on a file outside the
directory subtree where the presets are installed.
This adds a getPossiblePresetNames helper encapsulating the logic for
what preset names we should try to resolve, and the resolvePreset method
just calls this helper and actually resolves them.
This encapsulates the logic for turning an acceptable plugin name into
the absolute path for that plugin. It can be used to preprocess a
plugins list to map each plugin to its absolute path, which is necessary
if `babel.transform` is going to be executed on a file outside the
directory subtree where the plugins are installed.
This adds a getPossiblePluginNames helper encapsulating the logic for
what plugin names we should try to resolve, and the resolvePlugin method
just calls this helper and actually resolves them.
* fix(shouldIgnore): filename normalization should be platform sensitive
shouldIgnore normalizes the path of the filename prior to running any "only" regexes or functions. The normalization uses "slash", which has some undesirable special cases for non-ASCII characters and longer paths. Changing the normalization behavior to always replace path separators.
There is no real need to add additional tests, because the tests are not run in an environment where path.sep !== '/'.
* Minor style fix to use double quotes.
* Remove conditional for regex replace to keep consistent behavior.
* whitespace [skip ci]
This change ensures that when hoisting an identifier we do not hoist it up to
the first no shadowed function, but rather up to the bound shadowed function
* babel-core: add options for different parser/generator
* test for experiemental plugins, other babylon options
* fix passing options into parser
* Fix when no code is provided
* fixup tests
* fix tests again
* use filename and fallback to cwd
The filename options used by babylon is called `sourceFilename` and not `filename`. Therefore the option should be adjusted to be called `sourceFilename`.
This reverts commit 033681af8941d9678961f985c13e500c3c70f337, reversing
changes made to a2d66c0fc8ee58e82be3efd59173803e66dee3e0.
I brought you into this world, and I can take you out.
`build-config-chain.js` creates an array of options which will be passed to `OptionsManager#mergeOptions`. The advantage of separating it out is that `build-config-chain` has a very minimal dependency list. The eventual intent is to allow the require hook to lazy load only when required. In other words, if no required files ever match the patterns `ignore` / `only` patterns, the bulk of babel-core, and the associated plugins, will never be loaded.