Skip to content

Commit 8e9c1d1

Browse files
committed
feat: add support for dynamicImport, targets and modules
BREAKING CHANGE: change preset options - option ie10 is removed, - option decorator is disabled by default
1 parent 2815983 commit 8e9c1d1

File tree

64 files changed

+7162
-4494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+7162
-4494
lines changed

.babelrc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
{
2-
presets: ['es2015', 'stage-0', 'flow'],
2+
presets: [
3+
['babel-preset-env', {
4+
target: {
5+
node: 6,
6+
}
7+
}],
8+
'babel-preset-flow',
9+
],
10+
plugins: [
11+
['babel-plugin-transform-object-rest-spread', { useBuiltIns: true }],
12+
['babel-plugin-flow-runtime', { assert: true, annotate: true }],
13+
["transform-runtime", {
14+
"helpers": true,
15+
"polyfill": true,
16+
"regenerator": false,
17+
"moduleName": "babel-runtime"
18+
}]
19+
]
320
}

.eslintrc.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
/* @flow */
22
module.exports = {
3+
plugins: ['playlyfe'],
34
extends: [
4-
'eslint-config-airbnb-base/rules/best-practices',
5-
'eslint-config-airbnb-base/rules/errors',
6-
'eslint-config-airbnb-base/rules/node',
7-
'eslint-config-airbnb-base/rules/style',
8-
'eslint-config-airbnb-base/rules/variables',
9-
'eslint-config-airbnb-base/rules/es6',
10-
].map(require.resolve),
11-
12-
parser: require.resolve('babel-eslint'),
13-
14-
globals: {
15-
describe: false,
16-
it: false,
17-
expect: false,
18-
19-
// flow
20-
$Exact: false,
5+
'plugin:playlyfe/js',
6+
'plugin:playlyfe/flow',
7+
'plugin:playlyfe/testing:jest',
8+
],
9+
env: {
10+
node: true,
2111
},
22-
2312
rules: {
24-
'no-param-reassign': ['error', { 'props': false }],
25-
'no-underscore-dangle': 'off',
26-
'global-require': 'off',
13+
'arrow-parens': 'off',
2714
},
2815
};

.flowconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PROJECT_ROOT>/\(lib|coverage\)/.*
33
.*/node_modules/\(findup\|config-chain\|npmconf\)/test/.*
44
<PROJECT_ROOT>/node_modules/fbjs/.*
5+
<PROJECT_ROOT>/node_modules/babel-plugin-flow-runtime/.*
56

67
[include]
78

@@ -17,4 +18,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
1718
suppress_comment=\\(.\\|\n\\)*\\$FlowDisable
1819

1920
[version]
20-
^0.38.0
21+
^0.49.1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ coverage
22
node_modules
33
lib
44
npm-debug.log
5+
yarn.log

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"flow.useNPMPackagedFlow": true
4+
}

README.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,30 @@
1111

1212
```sh
1313
$ npm install --save-dev babel-preset-playlyfe
14+
$ yarn add --dev babel-preset-playlyfe
1415
```
15-
>
16-
Note if 'babelRuntime'(see options below) is enabled then install 'babel-runtime' also.
17-
```sh
18-
$ npm install --save babel-runtime
19-
>
2016

2117
## Usage
2218

23-
## .babelrc
24-
25-
```json
19+
```javascript
20+
// .babelrc
2621
{
27-
"presets": ["playlyfe"]
22+
"presets": ["playlyfe", options]
2823
}
2924
```
3025

3126
## Options
3227

33-
* `ie10` - bool (default false) Add support for ie10.
34-
* `react` - bool (default true) Enable react support.
35-
* `reactIntl` - bool (default true) Enable react-intl support.
36-
* `babelRuntime` - bool (default true) Enable [babel-plugin-transform-runtime plugin](https://babeljs.io/docs/plugins/transform-runtime).
3728
* `flow` - bool (default true) Enable flow support.
29+
* `dynamicImport` - boolean (default false) Allow dynamic imports.
30+
* `modules` - 'amd' | 'umd' | 'systemjs' | 'commonjs' | false (default 'commonjs').
31+
* `decorators` - boolean (default false) Enable decorators support.
3832
* `asyncAwait` - bool (default false) Enable async-await support (Note: need [regeneratorRuntime](https://babeljs.io/docs/plugins/transform-regenerator)).
33+
* `targets` - same as babel-preset-env [targets option](https://github.com/babel/babel-preset-env#options)
34+
* `useBuiltIns` - (default: true) same as babel-preset-env [useBuiltIns option](https://github.com/babel/babel-preset-env#options)
3935

40-
```
41-
// enable ie10 support (default: disabled)
42-
{
43-
presets: [
44-
["playlyfe", {"ie10": false}]
45-
]
46-
}
47-
48-
// disable react (default: enabled)
49-
{
50-
presets: [
51-
["playlyfe", {"react": false}]
52-
]
53-
}
54-
55-
// disable babelRuntime (default: enabled)
56-
{
57-
presets: [
58-
["playlyfe", {"babelRuntime": false}]
59-
]
60-
}
6136

62-
// disable flow support (default: enabled)
63-
{
64-
presets: [
65-
["playlyfe", {"flow": false}]
66-
]
67-
}
37+
* `react` - bool (default true) Enable react support.
38+
* `reactIntl` - bool (default true) Enable react-intl support.
6839

69-
// enable async-await support (default: disabled)
70-
{
71-
presets: [
72-
["playlyfe", {"asynAwait": true}]
73-
]
74-
}
75-
```
40+
* `babelRuntime` - bool (default true) Enable [babel-plugin-transform-runtime plugin](https://babeljs.io/docs/plugins/transform-runtime).

flow-typed/npm/babel-cli_vx.x.x.js

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// flow-typed signature: 56aadab86d5f94299218becc5c3f0e5e
2-
// flow-typed version: <<STUB>>/babel-cli_v6.16.0/flow_v0.33.0
1+
// flow-typed signature: 5e907b35a81c5c99a2af9596d870b7bc
2+
// flow-typed version: <<STUB>>/babel-cli_v6.24.1/flow_v0.49.1
33

44
/**
55
* This is an autogenerated libdef stub for:
@@ -8,8 +8,8 @@
88
*
99
* Fill this stub out by replacing all the `any` types.
1010
*
11-
* Once filled out, we encourage you to share your work with the
12-
* community by sending a pull request to:
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
1313
* https://github.com/flowtype/flow-typed
1414
*/
1515

@@ -42,30 +42,6 @@ declare module 'babel-cli/lib/_babel-node' {
4242
declare module.exports: any;
4343
}
4444

45-
declare module 'babel-cli/lib/babel-doctor/index' {
46-
declare module.exports: any;
47-
}
48-
49-
declare module 'babel-cli/lib/babel-doctor/rules/deduped' {
50-
declare module.exports: any;
51-
}
52-
53-
declare module 'babel-cli/lib/babel-doctor/rules/has-config' {
54-
declare module.exports: any;
55-
}
56-
57-
declare module 'babel-cli/lib/babel-doctor/rules/index' {
58-
declare module.exports: any;
59-
}
60-
61-
declare module 'babel-cli/lib/babel-doctor/rules/latest-packages' {
62-
declare module.exports: any;
63-
}
64-
65-
declare module 'babel-cli/lib/babel-doctor/rules/npm-3' {
66-
declare module.exports: any;
67-
}
68-
6945
declare module 'babel-cli/lib/babel-external-helpers' {
7046
declare module.exports: any;
7147
}
@@ -112,24 +88,6 @@ declare module 'babel-cli/index.js' {
11288
declare module 'babel-cli/lib/_babel-node.js' {
11389
declare module.exports: $Exports<'babel-cli/lib/_babel-node'>;
11490
}
115-
declare module 'babel-cli/lib/babel-doctor/index.js' {
116-
declare module.exports: $Exports<'babel-cli/lib/babel-doctor/index'>;
117-
}
118-
declare module 'babel-cli/lib/babel-doctor/rules/deduped.js' {
119-
declare module.exports: $Exports<'babel-cli/lib/babel-doctor/rules/deduped'>;
120-
}
121-
declare module 'babel-cli/lib/babel-doctor/rules/has-config.js' {
122-
declare module.exports: $Exports<'babel-cli/lib/babel-doctor/rules/has-config'>;
123-
}
124-
declare module 'babel-cli/lib/babel-doctor/rules/index.js' {
125-
declare module.exports: $Exports<'babel-cli/lib/babel-doctor/rules/index'>;
126-
}
127-
declare module 'babel-cli/lib/babel-doctor/rules/latest-packages.js' {
128-
declare module.exports: $Exports<'babel-cli/lib/babel-doctor/rules/latest-packages'>;
129-
}
130-
declare module 'babel-cli/lib/babel-doctor/rules/npm-3.js' {
131-
declare module.exports: $Exports<'babel-cli/lib/babel-doctor/rules/npm-3'>;
132-
}
13391
declare module 'babel-cli/lib/babel-external-helpers.js' {
13492
declare module.exports: $Exports<'babel-cli/lib/babel-external-helpers'>;
13593
}

flow-typed/npm/babel-eslint_vx.x.x.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// flow-typed signature: 369def5d3208fc7f3ceb3ded1cff29ef
2-
// flow-typed version: <<STUB>>/babel-eslint_v7.0.0/flow_v0.33.0
1+
// flow-typed signature: fd70b794c71ab9403b0706a24288439f
2+
// flow-typed version: <<STUB>>/babel-eslint_v7.2.3/flow_v0.49.1
33

44
/**
55
* This is an autogenerated libdef stub for:
@@ -8,8 +8,8 @@
88
*
99
* Fill this stub out by replacing all the `any` types.
1010
*
11-
* Once filled out, we encourage you to share your work with the
12-
* community by sending a pull request to:
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
1313
* https://github.com/flowtype/flow-typed
1414
*/
1515

@@ -26,6 +26,10 @@ declare module 'babel-eslint/babylon-to-espree/attachComments' {
2626
declare module.exports: any;
2727
}
2828

29+
declare module 'babel-eslint/babylon-to-espree/convertComments' {
30+
declare module.exports: any;
31+
}
32+
2933
declare module 'babel-eslint/babylon-to-espree/convertTemplateType' {
3034
declare module.exports: any;
3135
}
@@ -50,6 +54,9 @@ declare module 'babel-eslint/babylon-to-espree/toTokens' {
5054
declare module 'babel-eslint/babylon-to-espree/attachComments.js' {
5155
declare module.exports: $Exports<'babel-eslint/babylon-to-espree/attachComments'>;
5256
}
57+
declare module 'babel-eslint/babylon-to-espree/convertComments.js' {
58+
declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertComments'>;
59+
}
5360
declare module 'babel-eslint/babylon-to-espree/convertTemplateType.js' {
5461
declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertTemplateType'>;
5562
}

flow-typed/npm/babel-jest_vx.x.x.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// flow-typed signature: e9d9dd1f52ed6e6fcbdd07ff45369903
2-
// flow-typed version: <<STUB>>/babel-jest_v16.0.0/flow_v0.33.0
1+
// flow-typed signature: 1c459f573b3356c2c9ddf6d70296f848
2+
// flow-typed version: <<STUB>>/babel-jest_v20.0.3/flow_v0.49.1
33

44
/**
55
* This is an autogenerated libdef stub for:
@@ -8,8 +8,8 @@
88
*
99
* Fill this stub out by replacing all the `any` types.
1010
*
11-
* Once filled out, we encourage you to share your work with the
12-
* community by sending a pull request to:
11+
* Once filled out, we encourage you to share your work with the
12+
* community by sending a pull request to:
1313
* https://github.com/flowtype/flow-typed
1414
*/
1515

0 commit comments

Comments
 (0)