Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 54 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,75 @@
# Ember Resolver [![Build Status](https://travis-ci.org/ember-cli/ember-resolver.svg?branch=master)](https://travis-ci.org/ember-cli/ember-resolver)


This project is tracking a new resolver based on ES6 semantics that has been extracted from (and used by) the following projects:
This project provides the Ember resolver used by the following projects:

* [ember-cli](https://github.com/ember-cli/ember-cli)
* [ember-app-kit](https://github.com/stefanpenner/ember-app-kit)
* [ember-appkit-rails](https://github.com/DavyJonesLocker/ember-appkit-rails)

## Installation

Ember-resolver was previously a bower package, but since v1.0.1, it has become an ember-cli addon, and should be installed with `ember install`:
`ember-resolver` is an ember-cli addon, and should be installed with `ember install`:

```
ember install ember-resolver
```

If you're currently using ember-resolver v0.1.x in your project, you should uninstall it:
## Feature flags

This resolver package supports feature flags for experimental changes. Feature
flag settings change how `ember-resolver` compiles into an ember-cli's
`vendor.js`, so you should think of them as an application build-time option.

Feature flags are set in an application's `config/environment.js`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we change this to use ember-cli-build.js instead (no need to leak these to the browser), but we should do that in a follow up I think...


```js
/* eslint-env node */

module.exports = function(environment) {
var ENV = {
'ember-resolver': {
features: {
EMBER_RESOLVER_MODULE_UNIFICATION: true
}
},
/* ... */
```

Note that you must restart your ember-cli server for changes to the `flags` to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we move to ember-cli-build.js this becomes more obvious, since no changes to ember-cli-build.js are detected and updated without a restart today.

register.

In the `ember-resolver` codebase, you can import these flags:

```js
import { EMBER_RESOLVER_MODULE_UNIFICATION } from 'ember-resolver/features';
```

#### Current feature flags

* None at this time.

## Upgrading

`ember-resolver` is normally bumped with ember-cli releases. To install a newer
version use `yarn` or `npm`. For example:

```
yarn upgrade ember-resolver
```

#### Migrating from bower

Before v1.0.1 `ember-resolver` was primarially consumed bia bower. To migrate
install the addon version via `yarn` or `npm`. If you're currently using
`ember-resolver` v0.1.x in your project, you should uninstall it:

```
bower uninstall ember-resolver --save
```

_You can continue to use ember-resolver v0.1.x as a bower package, but be careful not to update it to versions greater than v1.0._
_You can continue to use ember-resolver v0.1.x as a bower package, but be
careful not to update it to versions greater than v1.0._

## Addon Development

Expand Down
5 changes: 5 additions & 0 deletions addon/features.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* This is a stub file, it must be on disk b/c babel-plugin-debug-macros
* does not strip the module require when the transpiled variable usage is
* stripped.
*/
32 changes: 32 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,38 @@ var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'ember-resolver',

init: function() {
this._super.init.apply(this, arguments);
this.options = this.options || {};

var config = this.project.config();
var resolverConfig = config['ember-resolver'] || {};

var resolverFeatureFlags = Object.assign({
/* Add default feature flags here */
}, resolverConfig.features);

this.options.babel = {
loose: true,
plugins: [
[require('babel-plugin-debug-macros').default, {
debugTools: {
source: '@ember/debug'
},
envFlags: {
source: 'ember-resolver-env-flags',
flags: { DEBUG: process.env.EMBER_ENV != 'production' }
},
features: {
name: 'ember-resolver',
source: 'ember-resolver/features',
flags: resolverFeatureFlags
}
}]
]
};
},

included: function() {
this._super.included.apply(this, arguments);

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"ember-addon"
],
"dependencies": {
"babel-plugin-debug-macros": "^0.1.1",
"ember-cli-babel": "^6.0.0-beta.7",
"ember-cli-version-checker": "^1.1.6"
},
Expand Down
Loading