Better browserify for English wordlist.

This commit is contained in:
Richard Moore 2018-07-22 21:07:50 -04:00
parent bfff3ea4cc
commit bceefc7197
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
3 changed files with 14 additions and 8 deletions

@ -31,14 +31,13 @@ var empty = "module.exports = {};";
// We already have a random Uint8Array browser/node safe source
// @TODO: Use path construction instead of ../..
var brorand = "var randomBytes = require('../../src.ts/utils').randomBytes; module.exports = function(length) { return randomBytes(length); };";
var brorand = "var randomBytes = require('../../utils').randomBytes; module.exports = function(length) { return randomBytes(length); };";
// setImmediate is installed globally by our src.browser/shims.ts, loaded from src.ts/index.ts
var process = "module.exports = { };";
var process = "module.exports = { browser: true };";
var timers = "module.exports = { setImmediate: global.setImmediate }; ";
var transforms = {
// 'ethers.js/package.json': JSON.stringify({ version: version }),
// Remove the precomputed secp256k1 points
"elliptic/lib/elliptic/precomputed/secp256k1.js": undef,
@ -64,8 +63,6 @@ var transforms = {
"process/browser.js": process,
"timers-browserify/main.js": timers,
// Browser doesn't automatically get wordlists (individual files avaialble)
"src.ts/wordlists/index.ts": "module.exports = { en: require('./lang-en').langEn }",
};
function transformFile(path) {
@ -178,13 +175,13 @@ function taskBundle(name, options) {
var result = browserify({
basedir: '.',
debug: false,
entries: [ './src.ts/' ],
cache: {},
entries: [ './index.js' ],
cache: { },
packageCache: {},
standalone: "ethers",
transform: [ [ transform, { global: true } ] ],
})
.plugin(tsify)
// .plugin(tsify)
.bundle()
.pipe(source(options.filename))

@ -9,4 +9,5 @@ import { } from './hmac';
import { } from './pbkdf2';
import { } from './random-bytes';
import { } from './shims';
import { } from './wordlists';
import { } from './xmlhttprequest';

@ -0,0 +1,8 @@
import { Wordlist } from '../wordlists/wordlist';
import { langEn as _en } from '../wordlists/lang-en';
const en: Wordlist = _en;
export { en }