Skip to content

Commit

Permalink
fix(babel-preset): support fast/generator/promises or exclude async t…
Browse files Browse the repository at this point in the history
…ransformer

close #8, bump related dependencies
  • Loading branch information
JounQin committed Nov 9, 2019
1 parent 7012807 commit 99a9666
Show file tree
Hide file tree
Showing 11 changed files with 637 additions and 208 deletions.
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@
},
"devDependencies": {
"@angular/core": "^8.2.13",
"@types/jest": "^24.0.21",
"@types/node": "^12.12.5",
"@types/jest": "^24.0.22",
"@types/node": "^12.12.7",
"@types/react": "^16.9.11",
"@types/unist": "^2.0.3",
"lerna": "^3.18.3",
"lerna": "^3.18.4",
"npm-run-all": "^4.1.5",
"react": "^16.11.0",
"ts-jest": "^24.1.0",
"tslint": "^5.20.0",
"typescript": "^3.6.4",
"tslint": "^5.20.1",
"vue": "^2.6.10"
},
"resolutions": {
"typescript": "^3.7.2"
},
"commitlint": {
"extends": [
"@1stg"
Expand Down
4 changes: 2 additions & 2 deletions packages/app-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"@1stg/remark-config": "^0.2.2",
"@1stg/stylelint-config": "^0.8.5",
"@1stg/tsconfig": "^0.7.1",
"@babel/core": "^7.6.4",
"@babel/core": "^7.7.2",
"@pkgr/es-modules": "^0.2.1",
"@pkgr/imagemin": "^0.3.0",
"browserslist": "^4.7.2",
"eslint": "^6.6.0",
"husky": "^3.0.9",
"lint-staged": "^9.4.2",
"postcss": "^7.0.21",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"stylelint": "^11.1.1",
"tslib": "^1.10.0"
},
Expand Down
21 changes: 12 additions & 9 deletions packages/babel-preset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = declare(
(
api,
{
generator,
async = 'fast',

This comment has been minimized.

Copy link
@tunnckoCore

tunnckoCore Nov 9, 2019

asyncAwait is probably a bit better name. And don't bugs with the syntax highlighting (here in github).

import: importOptions,
modules = false,
esmodules,
Expand Down Expand Up @@ -45,12 +45,13 @@ module.exports = declare(
require('@babel/preset-env'),
{
modules,
exclude: generator
? undefined
: [
'@babel/transform-async-to-generator',
'@babel/transform-regenerator',
],
exclude:
async === 'generator'
? undefined
: [
'@babel/transform-async-to-generator',
'@babel/transform-regenerator',
],
corejs: {
version: 3,
proposals: true,
Expand Down Expand Up @@ -102,13 +103,15 @@ module.exports = declare(
])
}

if (!generator) {
if (async === 'fast') {
plugins.push([
require('fast-async'),
{
useRuntimeModule: true,
},
])
} else if (async === 'promises') {
plugins.push(require('babel-plugin-transform-async-to-promises'))
}

if (importOptions) {
Expand Down Expand Up @@ -159,8 +162,8 @@ module.exports = declare(
}

return {
plugins,
presets,
plugins,
overrides: isTSX
? undefined
: [
Expand Down
15 changes: 8 additions & 7 deletions packages/babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-decorators": "^7.6.0",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-decorators": "^7.7.0",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"@babel/preset-typescript": "^7.7.2",
"@pkgr/utils": "^0.3.2",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"@vue/babel-preset-jsx": "^1.1.1",
"@vue/babel-preset-jsx": "^1.1.2",
"babel-plugin-import": "^1.12.2",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-typescript-metadata": "^0.2.2",
"babel-preset-proposal-typescript": "^1.4.5",
"core-js": "^3.3.6",
"core-js": "^3.4.0",
"fast-async": "^7.0.6"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/commitlint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@commitlint/config-lerna-scopes": "^8.2.0",
"@pkgr/utils": "^0.3.0"
"@pkgr/utils": "^0.3.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"eslint-import-resolver-ts": "^0.4.2",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.0.2",
"eslint-plugin-jest": "^23.0.3",
"eslint-plugin-mdx": "^1.6.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.2.0",
"eslint-plugin-sonarjs": "^0.4.0",
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.0.0",
"is-glob": "^4.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"@1stg/prettier-config": "^0.6.1",
"@1stg/remark-config": "^0.2.2",
"@1stg/tsconfig": "^0.7.1",
"@babel/core": "^7.6.4",
"@babel/core": "^7.7.2",
"@pkgr/rollup": "^0.8.2",
"eslint": "^6.6.0",
"husky": "^3.0.9",
"jest": "^24.9.0",
"lint-staged": "^9.4.2",
"prettier": "^1.18.2"
"prettier": "^1.19.1"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/lint-staged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
},
"dependencies": {
"@pkgr/utils": "^0.3.2",
"@prettier/plugin-pug": "^1.0.6",
"@prettier/plugin-pug": "^1.0.8",
"@prettier/plugin-ruby": "^0.15.1",
"cross-env": "^6.0.3",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"prettier-plugin-sh": "^0.2.2",
"prettier-plugin-toml": "^0.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"prettier": ">=1.18.0"
},
"dependencies": {
"@prettier/plugin-pug": "^1.0.6",
"@prettier/plugin-pug": "^1.0.8",
"@prettier/plugin-ruby": "^0.15.1",
"prettier-plugin-pkg": "^0.4.4",
"prettier-plugin-sh": "^0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/tslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"codelyzer": "^5.2.0",
"rxjs-tslint": "^0.1.7",
"tslint-angular": "^3.0.2",
"tslint-config-eslint": "^0.1.1",
"tslint-config-eslint": "^0.2.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"tslint-react": "^4.1.0",
Expand Down
Loading

0 comments on commit 99a9666

Please sign in to comment.