@samitouri / QOS-React-2 / commits / 5b5e48a0d2

Ignore third_party JS in internal transform step

Paul O’Shannessy committed May 18, 2015 at 09:50 UTC 5b5e48a0d225d64333e79738a4af4a0a28d31691
2 files changed +13 -7
bin/jsx-internal
+12 -6
@@ -7,6 +7,8 @@ var babel = require('babel');
7
8 var constants = require('../vendor/constants')(babel);
9
10 +var TRANSFORM_IGNORE_RE = /^WebComponents$/;
11 +
12 require("commoner").version(
13 require("../package.json").version
14 ).resolve(function(id) {
@@ -30,12 +32,16 @@ require("commoner").version(
32 }).process(function(id, source) {
33 var context = this;
34
33 - // This is where JSX, ES6, etc. desugaring happens.
34 - source = babel.transform(source, {
35 - blacklist: ['spec.functionName', 'validation.react'],
36 - plugins: [constants],
37 - filename: id
38 - }).code;
35 + // This is hacky but that's ok… It really only matters for tests since it
36 + // won't otherwise be in the dependency tree.
37 + if (!TRANSFORM_IGNORE_RE.test(id)) {
38 + // This is where JSX, ES6, etc. desugaring happens.
39 + source = babel.transform(source, {
40 + blacklist: ['spec.functionName', 'validation.react'],
41 + plugins: [constants],
42 + filename: id
43 + }).code;
44 + }
45
46 if (context.config.mocking) {
47 // Make sure there is exactly one newline at the end of the module.
jest/preprocessor.js
+1 -1
@@ -20,7 +20,7 @@ module.exports = {
20 if (path.match(/\.ts$/) && !path.match(/\.d\.ts$/)) {
21 return ts.compile(src, path);
22 }
23 - if (!path.match(/\/node_modules\//)) {
23 + if (!path.match(/\/node_modules\//) && !path.match(/\/third_party\//)) {
24 return babel.transform(src, {
25 blacklist: ['spec.functionName', 'validation.react'],
26 filename: path