2015-09-16 17:30:53 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2015-09-19 22:20:25 +00:00
|
|
|
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
|
|
|
const path = require('path');
|
|
|
|
const transformer = require('../packager/transformer.js');
|
2015-09-16 17:30:53 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
process(src, file) {
|
2015-09-22 19:11:13 +00:00
|
|
|
// Don't transform node_modules, except react-tools which includes the
|
|
|
|
// untransformed copy of React
|
2015-10-22 00:38:19 +00:00
|
|
|
if (file.match(/node_modules\/(?!react-tools\/)/)) {
|
2015-09-22 19:11:13 +00:00
|
|
|
return src;
|
|
|
|
}
|
|
|
|
|
2015-10-21 23:25:24 +00:00
|
|
|
return transformer.transform(src, file, {inlineRequires: true}).code;
|
2015-09-19 22:20:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getCacheKey: createCacheKeyFunction([
|
|
|
|
__filename,
|
|
|
|
path.join(__dirname, '../packager/transformer.js'),
|
2016-01-18 14:02:16 +00:00
|
|
|
require.resolve('babel-core/package.json'),
|
2015-09-19 22:20:25 +00:00
|
|
|
]),
|
2015-09-16 17:30:53 +00:00
|
|
|
};
|