Skip to content

Commit

Permalink
Merge branch 'master' into 7.0
Browse files Browse the repository at this point in the history
* master:
  6.4.0
  Update CHANGELOG.md for 6.4.0
  Optimize code after merge of #398
  Update yarn.lock
  Sort package.json

# Conflicts:
#	package.json
#	src/index.js
#	yarn.lock
  • Loading branch information
danez committed Mar 6, 2017
2 parents 70c8c4a + 36db87b commit 906ab55
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog

## v6.4.0

### 🚀 New Feature

- added metadata passing from babel to webpack, which is currently used by react-intl (#398) @Ognian

## v6.3.2

### 😢 Regression
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -24,6 +24,7 @@
"babel-core": "^6.0.0",
"babel-eslint": "^7.1.0",
"babel-plugin-istanbul": "^4.0.0",
"babel-plugin-react-intl": "^2.1.3",
"babel-preset-env": "^1.2.0",
"babel-register": "^6.18.0",
"codecov": "^1.0.1",
Expand All @@ -32,10 +33,8 @@
"eslint-config-babel": "^6.0.0",
"eslint-plugin-flowtype": "^2.25.0",
"nyc": "^10.0.0",
"rimraf": "^2.4.3",
"react": "^15.1.0",
"react-intl":"^2.1.2",
"babel-plugin-react-intl": "^2.1.3",
"react-intl-webpack-plugin":"^0.0.3",
"webpack": "^2.2.0"
},
Expand Down
24 changes: 11 additions & 13 deletions src/index.js
Expand Up @@ -130,8 +130,6 @@ module.exports = function(source, inputSourceMap) {
delete options.cacheIdentifier;
delete options.metadataSubscribers;

const context = this;

if (cacheDirectory) {
const callback = this.async();
return cache({
Expand All @@ -140,18 +138,18 @@ module.exports = function(source, inputSourceMap) {
source: source,
options: options,
transform: transpile,
}, function(err, result) {
if (err) { return callback(err); }
metadataSubscribers.forEach(function (s) {
passMetadata(s, context, result.metadata);
});
return callback(null, result.code, result.map);
}, (err, { code, map, metadata } = {}) => {
if (err) return callback(err);

metadataSubscribers.forEach((s) => passMetadata(s, this, metadata));

return callback(null, code, map);
});
}

const result = transpile(source, options);
metadataSubscribers.forEach(function (s) {
passMetadata(s, context, result.metadata);
});
this.callback(null, result.code, result.map);
const { code, map, metadata } = transpile(source, options);

metadataSubscribers.forEach((s) => passMetadata(s, this, metadata));

this.callback(null, code, map);
};

0 comments on commit 906ab55

Please sign in to comment.