1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 01:08:27 +00:00

Removed custom babel module

This commit is contained in:
Vladimír Volek 2018-07-30 13:52:06 +02:00
parent c6292a1375
commit a99d638a58
4 changed files with 4 additions and 64 deletions

View File

@ -14,6 +14,9 @@
"polyfill": false,
"regenerator": true
}],
"./src/babel/babel-plugin-import.js"
["babel-plugin-root-import", {
"rootPathSuffix": "./src",
"rootPathPrefix": "~"
}]
]
}

View File

@ -23,7 +23,6 @@
"test-unit:watch": "jest -o --watch"
},
"dependencies": {
"bignumber.js": "^7.2.1",
"color-hash": "^1.0.3",
"copy-webpack-plugin": "^4.5.2",
"ethereumjs-tx": "^1.3.3",

View File

@ -1,58 +0,0 @@
// inspired by:
// https://github.com/entwicklerstube/babel-plugin-root-import/
// Simple plugin allows es6 import from '~/' which is src root
const cwd = process.cwd();
const replacePrefix = (path, opts = [], sourceFile) => {
const options = [].concat(opts);
if (typeof path === 'string') {
if (path.indexOf('~/') === 0) {
return path.replace('~/', `${cwd}/src/`);
}
}
return path;
};
export default ({ types: t }) => {
const visitor = {
CallExpression(path, state) {
if (path.node.callee.name !== 'require') {
return;
}
const args = path.node.arguments;
if (!args.length) {
return;
}
const firstArg = traverseExpression(t, args[0]);
if (firstArg) {
firstArg.value = replacePrefix(firstArg.value, state.opts, state.file.opts.filename);
}
},
ImportDeclaration(path, state) {
path.node.source.value = replacePrefix(path.node.source.value, state.opts, state.file.opts.filename);
},
ExportNamedDeclaration(path, state) {
if (path.node.source) {
path.node.source.value = replacePrefix(path.node.source.value, state.opts, state.file.opts.filename);
}
},
ExportAllDeclaration(path, state) {
if (path.node.source) {
path.node.source.value = replacePrefix(path.node.source.value, state.opts, state.file.opts.filename);
}
},
};
return {
visitor: {
Program(path, state) {
path.traverse(visitor, state);
},
},
};
};

View File

@ -1503,10 +1503,6 @@ bignumber.js@^4.0.2:
version "4.1.0"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.1.0.tgz#db6f14067c140bd46624815a7916c92d9b6c24b1"
bignumber.js@^7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f"
binary-extensions@^1.0.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"