Merge pull request #17 from embark-framework/async-es

async-es for optimized browser builds
This commit is contained in:
Michael Bradley 2018-09-05 11:19:36 -05:00 committed by GitHub
commit 6f40edd5b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 12 deletions

View File

@ -5,6 +5,7 @@
"browser": {
"ignore": [
"src/embark.js",
"src/node/async.js",
"src/node/index.js",
"src/standalone/index.js"
],
@ -22,7 +23,20 @@
]
},
"node": {
"ignore": ["src/browser.js"],
"ignore": ["src/browser.js", "src/node/async.js"],
"plugins": [
["@babel/plugin-transform-runtime", {
"corejs": 2
}]
],
"presets": [
["@babel/env", {
"targets": {"node": "8.11.3"}
}]
]
},
"node:async": {
"ignore": ["src/node/index.js"],
"plugins": [
["@babel/plugin-transform-runtime", {
"corejs": 2

View File

@ -17,9 +17,10 @@
"src"
],
"scripts": {
"babel": "npm run babel:browser && npm run babel:node",
"babel": "npm run babel:browser && npm run babel:node && npm run babel:node:async",
"babel:browser": "cross-env BABEL_ENV=browser babel --out-dir dist/browser src",
"babel:node": "cross-env BABEL_ENV=node babel --out-dir dist src",
"babel:node:async": "cross-env BABEL_ENV=node:async babel --out-dir dist src/node",
"build": "npm run clean && npm run babel && npm run webpack",
"clean": "rimraf dist embark.min.js embarkjs-*.tgz package",
"http-server": "http-server",
@ -48,7 +49,8 @@
"homepage": "https://github.com/embark-framework/EmbarkJS#readme",
"dependencies": {
"@babel/runtime-corejs2": "7.0.0-rc.1",
"async": "^2.0.1"
"async": "2.6.1",
"async-es": "2.6.1"
},
"devDependencies": {
"@babel/cli": "7.0.0-rc.1",

1
src/async.js Normal file
View File

@ -0,0 +1 @@
export {detectSeries, reduce} from 'async-es';

View File

@ -1,4 +1,4 @@
import {reduce} from 'async'
import {reduce} from './async'
function isNewWeb3_1() {
return (typeof(web3.version) === "string");

View File

@ -1,2 +1 @@
import EmbarkJS from './index';
export default EmbarkJS;
export {default} from './index';

View File

@ -1,8 +1,8 @@
import Storage from './storage.js';
import Names from './names.js';
import Messages from './messages.js';
import Blockchain from './blockchain.js';
import Utils from './utils.js';
import Storage from './storage';
import Names from './names';
import Messages from './messages';
import Blockchain from './blockchain';
import Utils from './utils';
var EmbarkJS = {
onReady: function (cb) {

1
src/node/async.js Normal file
View File

@ -0,0 +1 @@
export {detectSeries, reduce} from 'async';

View File

@ -1,4 +1,4 @@
import {detectSeries} from 'async';
import {detectSeries} from './async';
const Storage = {};