Skip to content

Commit

Permalink
Expose getSupportedExtensions method.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Mar 18, 2021
1 parent f7a1980 commit 37a06da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ allow you to use latest Javascript in your Ember CLI project.
+ [Adding Custom Plugins](#adding-custom-plugins)
+ [Additional Trees](#additional-trees)
+ [`buildBabelOptions` usage](#buildbabeloptions-usage)
+ [`getSupportedExtensions` usage](#getsupportedextensions-usage)
+ [`transpileTree` usage](#transpiletree-usage)
* [Debug Tooling](#debug-tooling)
+ [Debug Macros](#debug-macros)
Expand Down Expand Up @@ -412,6 +413,16 @@ let options = babelAddon.buildBabelOptions(config)
require('babel-core').transform('something', options);
```

#### `getSupportedExtensions` usage

```js
// find your babel addon (can use `this.findAddonByName('ember-cli-babel')` in [email protected] and newer)
let babelAddon = this.addons.find(addon => addon.name === 'ember-cli-babel');

// create the babel options to use elsewhere based on the config above
let extensions = babelAddon.getSupportedExtensions(config)
```

#### `transpileTree` usage

```js
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ module.exports = {
return this._cachedDebugTree.apply(null, arguments);
},

getSupportedExtensions(config) {
return _getExtensions(config, this.parent);
},

_buildBroccoliBabelTranspilerOptions(config = {}) {
let emberCLIBabelConfig = config["ember-cli-babel"];

Expand All @@ -104,7 +108,7 @@ module.exports = {
annotation: providedAnnotation || `Babel: ${_parentName(this.parent)}`,
sourceMaps,
throwUnlessParallelizable,
filterExtensions: _getExtensions(config, this.parent),
filterExtensions: this.getSupportedExtensions(config),
plugins: []
};

Expand Down

0 comments on commit 37a06da

Please sign in to comment.