Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit 10a3674

Browse files
authored
Merge pull request #77 from andyearnshaw/feature-preset-react
Bundle babel-preset-react, false by default (closes #76)
2 parents c39d148 + fe6e578 commit 10a3674

4 files changed

Lines changed: 119 additions & 64 deletions

File tree

build-babel/jspm.config.js

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,110 @@
11
SystemJS.config({
22
devConfig: {
33
"map": {
4-
"plugin-babel": "npm:systemjs-plugin-babel@0.0.16"
4+
"plugin-babel": "npm:systemjs-plugin-babel@0.0.16",
5+
"babel-runtime": "npm:babel-runtime@5.8.38",
6+
"babel-preset-react": "npm:babel-preset-react@6.22.0"
7+
},
8+
"packages": {
9+
"npm:babel-preset-react@6.22.0": {
10+
"map": {
11+
"babel-plugin-syntax-flow": "npm:babel-plugin-syntax-flow@6.18.0",
12+
"babel-plugin-syntax-jsx": "npm:babel-plugin-syntax-jsx@6.18.0",
13+
"babel-plugin-transform-flow-strip-types": "npm:babel-plugin-transform-flow-strip-types@6.22.0",
14+
"babel-plugin-transform-react-display-name": "npm:babel-plugin-transform-react-display-name@6.22.0",
15+
"babel-plugin-transform-react-jsx": "npm:babel-plugin-transform-react-jsx@6.22.0",
16+
"babel-plugin-transform-react-jsx-self": "npm:babel-plugin-transform-react-jsx-self@6.22.0",
17+
"babel-plugin-transform-react-jsx-source": "npm:babel-plugin-transform-react-jsx-source@6.22.0"
18+
}
19+
},
20+
"npm:babel-plugin-transform-flow-strip-types@6.22.0": {
21+
"map": {
22+
"babel-plugin-syntax-flow": "npm:babel-plugin-syntax-flow@6.18.0",
23+
"babel-runtime": "npm:babel-runtime@6.22.0"
24+
}
25+
},
26+
"npm:babel-plugin-transform-react-jsx@6.22.0": {
27+
"map": {
28+
"babel-plugin-syntax-jsx": "npm:babel-plugin-syntax-jsx@6.18.0",
29+
"babel-runtime": "npm:babel-runtime@6.22.0",
30+
"babel-helper-builder-react-jsx": "npm:babel-helper-builder-react-jsx@6.22.0"
31+
}
32+
},
33+
"npm:babel-plugin-transform-react-jsx-self@6.22.0": {
34+
"map": {
35+
"babel-plugin-syntax-jsx": "npm:babel-plugin-syntax-jsx@6.18.0",
36+
"babel-runtime": "npm:babel-runtime@6.22.0"
37+
}
38+
},
39+
"npm:babel-plugin-transform-react-jsx-source@6.22.0": {
40+
"map": {
41+
"babel-plugin-syntax-jsx": "npm:babel-plugin-syntax-jsx@6.18.0",
42+
"babel-runtime": "npm:babel-runtime@6.22.0"
43+
}
44+
},
45+
"npm:babel-plugin-transform-react-display-name@6.22.0": {
46+
"map": {
47+
"babel-runtime": "npm:babel-runtime@6.22.0"
48+
}
49+
},
50+
"npm:babel-helper-builder-react-jsx@6.22.0": {
51+
"map": {
52+
"babel-runtime": "npm:babel-runtime@6.22.0",
53+
"lodash": "npm:lodash@4.17.4",
54+
"babel-types": "npm:babel-types@6.22.0",
55+
"esutils": "npm:esutils@2.0.2"
56+
}
57+
},
58+
"npm:babel-runtime@6.22.0": {
59+
"map": {
60+
"regenerator-runtime": "npm:regenerator-runtime@0.10.1",
61+
"core-js": "npm:core-js@2.4.1"
62+
}
63+
},
64+
"npm:babel-types@6.22.0": {
65+
"map": {
66+
"esutils": "npm:esutils@2.0.2",
67+
"lodash": "npm:lodash@4.17.4",
68+
"babel-runtime": "npm:babel-runtime@6.22.0",
69+
"to-fast-properties": "npm:to-fast-properties@1.0.2"
70+
}
71+
}
572
}
673
},
774
transpiler: "plugin-babel",
875
map: {
9-
"regenerator": "github:facebook/regenerator@0.8.46"
76+
"regenerator": "github:facebook/regenerator@0.8.46",
77+
"http": "npm:jspm-nodelibs-http@0.2.0",
78+
"net": "npm:jspm-nodelibs-net@0.2.0",
79+
"tty": "npm:jspm-nodelibs-tty@0.2.0",
80+
"url": "npm:jspm-nodelibs-url@0.2.0"
81+
},
82+
packages: {
83+
"npm:url@0.11.0": {
84+
"map": {
85+
"punycode": "npm:punycode@1.3.2",
86+
"querystring": "npm:querystring@0.2.0"
87+
}
88+
},
89+
"npm:jspm-nodelibs-http@0.2.0": {
90+
"map": {
91+
"http-browserify": "npm:stream-http@2.5.0"
92+
}
93+
},
94+
"npm:jspm-nodelibs-url@0.2.0": {
95+
"map": {
96+
"url-browserify": "npm:url@0.11.0"
97+
}
98+
},
99+
"npm:stream-http@2.5.0": {
100+
"map": {
101+
"builtin-status-codes": "npm:builtin-status-codes@2.0.0",
102+
"readable-stream": "npm:readable-stream@2.2.2",
103+
"to-arraybuffer": "npm:to-arraybuffer@1.0.1",
104+
"xtend": "npm:xtend@4.0.1",
105+
"inherits": "npm:inherits@2.0.3"
106+
}
107+
}
10108
}
11109
});
12110

@@ -55,17 +153,13 @@ SystemJS.config({
55153
"child_process": "npm:jspm-nodelibs-child_process@0.2.0",
56154
"events": "npm:jspm-nodelibs-events@0.2.0",
57155
"fs": "npm:jspm-nodelibs-fs@0.2.0",
58-
"http": "npm:jspm-nodelibs-http@0.2.0",
59156
"module": "npm:jspm-nodelibs-module@0.2.0",
60-
"net": "npm:jspm-nodelibs-net@0.2.0",
61157
"os": "npm:jspm-nodelibs-os@0.2.0",
62158
"path": "npm:jspm-nodelibs-path@0.2.1",
63159
"process": "npm:jspm-nodelibs-process@0.2.0",
64160
"regenerator-runtime": "npm:regenerator-runtime@0.10.1",
65161
"stream": "npm:jspm-nodelibs-stream@0.2.0",
66162
"string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.0",
67-
"tty": "npm:jspm-nodelibs-tty@0.2.0",
68-
"url": "npm:jspm-nodelibs-url@0.2.0",
69163
"util": "npm:jspm-nodelibs-util@0.2.1",
70164
"vm": "npm:jspm-nodelibs-vm@0.2.0"
71165
},
@@ -173,12 +267,6 @@ SystemJS.config({
173267
"readable-stream": "npm:readable-stream@2.2.2"
174268
}
175269
},
176-
"npm:url@0.11.0": {
177-
"map": {
178-
"punycode": "npm:punycode@1.3.2",
179-
"querystring": "npm:querystring@0.2.0"
180-
}
181-
},
182270
"npm:babel-plugin-transform-es2015-function-name@6.9.0": {
183271
"map": {
184272
"babel-types": "npm:babel-types@6.21.0",
@@ -587,16 +675,6 @@ SystemJS.config({
587675
"is-finite": "npm:is-finite@1.0.2"
588676
}
589677
},
590-
"npm:jspm-nodelibs-http@0.2.0": {
591-
"map": {
592-
"http-browserify": "npm:stream-http@2.5.0"
593-
}
594-
},
595-
"npm:jspm-nodelibs-url@0.2.0": {
596-
"map": {
597-
"url-browserify": "npm:url@0.11.0"
598-
}
599-
},
600678
"npm:jspm-nodelibs-os@0.2.0": {
601679
"map": {
602680
"os-browserify": "npm:os-browserify@0.2.1"
@@ -733,15 +811,6 @@ SystemJS.config({
733811
"jsesc": "npm:jsesc@1.3.0"
734812
}
735813
},
736-
"npm:stream-http@2.5.0": {
737-
"map": {
738-
"builtin-status-codes": "npm:builtin-status-codes@2.0.0",
739-
"readable-stream": "npm:readable-stream@2.2.2",
740-
"to-arraybuffer": "npm:to-arraybuffer@1.0.1",
741-
"xtend": "npm:xtend@4.0.1",
742-
"inherits": "npm:inherits@2.0.3"
743-
}
744-
},
745814
"npm:babel-code-frame@6.20.0": {
746815
"map": {
747816
"esutils": "npm:esutils@2.0.2",

build-babel/package.json

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"babel-plugin-transform-es2015-unicode-regex": "npm:babel-plugin-transform-es2015-unicode-regex@^6.3.13",
2828
"babel-plugin-transform-regenerator": "npm:babel-plugin-transform-regenerator@^6.3.18",
2929
"babel-plugin-transform-runtime": "npm:babel-plugin-transform-runtime@^6.3.13",
30+
"babel-preset-react": "npm:babel-preset-react@^6.22.0",
3031
"babel-preset-stage-1": "npm:babel-preset-stage-1@^6.5.0",
3132
"babel-preset-stage-2": "npm:babel-preset-stage-2@^6.5.0",
3233
"babel-preset-stage-3": "npm:babel-preset-stage-3@^6.3.13",
@@ -45,20 +46,23 @@
4546
"crypto": "npm:jspm-nodelibs-crypto@^0.2.0",
4647
"events": "npm:jspm-nodelibs-events@^0.2.0",
4748
"fs": "npm:jspm-nodelibs-fs@^0.2.0",
48-
"http": "npm:jspm-nodelibs-http@^0.2.0",
4949
"module": "npm:jspm-nodelibs-module@^0.2.0",
50-
"net": "npm:jspm-nodelibs-net@^0.2.0",
5150
"os": "npm:jspm-nodelibs-os@^0.2.0",
5251
"path": "npm:jspm-nodelibs-path@^0.2.0",
5352
"process": "npm:jspm-nodelibs-process@^0.2.0",
5453
"stream": "npm:jspm-nodelibs-stream@^0.2.0",
5554
"string_decoder": "npm:jspm-nodelibs-string_decoder@^0.2.0",
56-
"tty": "npm:jspm-nodelibs-tty@^0.2.0",
57-
"url": "npm:jspm-nodelibs-url@^0.2.0",
5855
"util": "npm:jspm-nodelibs-util@^0.2.0",
5956
"vm": "npm:jspm-nodelibs-vm@^0.2.0"
6057
},
6158
"overrides": {
59+
"npm:babel-runtime@5.8.38": {
60+
"main": false,
61+
"dependencies": {},
62+
"optionalDependencies": {
63+
"core-js": "^1.2.0"
64+
}
65+
},
6266
"npm:debug@2.6.0": {
6367
"main": "src/browser.js",
6468
"jspmNodeConversion": false,
@@ -91,47 +95,19 @@
9195
"jspmNodeConversion": false,
9296
"format": "cjs"
9397
},
94-
"npm:punycode@1.3.2": {
95-
"map": {
96-
"./punycode.js": {
97-
"node": "@node/punycode"
98-
}
99-
}
100-
},
10198
"npm:querystring@0.2.0": {
10299
"map": {
103100
"./index.js": {
104101
"node": "@node/querystring"
105102
}
106103
}
107104
},
108-
"npm:stream-browserify@2.0.1": {
109-
"map": {
110-
"./index.js": {
111-
"node": "@node/stream"
112-
}
113-
}
114-
},
115-
"npm:stream-http@2.5.0": {
116-
"map": {
117-
"./index.js": {
118-
"node": "@node/http"
119-
}
120-
}
121-
},
122105
"npm:string_decoder@0.10.31": {
123106
"map": {
124107
"./index.js": {
125108
"node": "@node/string_decoder"
126109
}
127110
}
128-
},
129-
"npm:url@0.11.0": {
130-
"map": {
131-
"./url.js": {
132-
"node": "@node/url"
133-
}
134-
}
135111
}
136112
}
137113
}

build-babel/systemjs-babel.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ export let runtimeTransform = {
2020
import p1 from 'babel-preset-stage-1';
2121
import p2 from 'babel-preset-stage-2';
2222
import p3 from 'babel-preset-stage-3';
23+
import pReact from 'babel-preset-react';
2324

2425
let pluginsStage1 = p1.plugins;
2526
let pluginsStage2 = p2.plugins;
2627
let pluginsStage3 = p3.plugins;
28+
let pluginsReact = pReact.plugins;
2729

28-
export { pluginsStage1, pluginsStage2, pluginsStage3 }
30+
export { pluginsStage1, pluginsStage2, pluginsStage3, pluginsReact }
2931

3032
// ES2015 plugins to keep in sync with https://github.com/babel/babel/blob/master/packages/babel-preset-es2015/index.js
3133
import templateLiterals from 'babel-plugin-transform-es2015-template-literals';

plugin-babel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var modulesRegister = require('systemjs-babel-build').modulesRegister;
77
var stage3 = require('systemjs-babel-build').pluginsStage3;
88
var stage2 = require('systemjs-babel-build').pluginsStage2;
99
var stage1 = require('systemjs-babel-build').pluginsStage1;
10+
var react = require('systemjs-babel-build').pluginsReact;
1011

1112
var externalHelpers = require('systemjs-babel-build').externalHelpers;
1213
var runtimeTransform = require('systemjs-babel-build').runtimeTransform;
@@ -44,6 +45,7 @@ function prepend(a, b) {
4445
* stage3: true / false (defaults to true)
4546
* stage2: true / false (defaults to true)
4647
* stage1: true / false (defaults to false)
48+
* react: true / false (defaults to false)
4749
* plugins: array of custom plugins (objects or module name strings)
4850
* presets: array of custom presets (objects or module name strings)
4951
* compact: as in Babel
@@ -58,6 +60,7 @@ var defaultBabelOptions = {
5860
stage3: true,
5961
stage2: true,
6062
stage1: false,
63+
react: false,
6164
compact: false,
6265
comments: true
6366
};
@@ -148,6 +151,11 @@ exports.translate = function(load, traceOpts) {
148151
plugins: stage1
149152
});
150153

154+
if (babelOptions.react)
155+
presets.push({
156+
plugins: react
157+
});
158+
151159
if (babelOptions.presets)
152160
babelOptions.presets.forEach(function(preset) {
153161
if (typeof preset == 'string')

0 commit comments

Comments
 (0)