Better browserify for English wordlist.
This commit is contained in:
parent
bfff3ea4cc
commit
bceefc7197
13
gulpfile.js
13
gulpfile.js
@ -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';
|
||||
|
8
src.ts/shims/wordlists.ts
Normal file
8
src.ts/shims/wordlists.ts
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
import { Wordlist } from '../wordlists/wordlist';
|
||||
|
||||
import { langEn as _en } from '../wordlists/lang-en';
|
||||
|
||||
const en: Wordlist = _en;
|
||||
|
||||
export { en }
|
Loading…
Reference in New Issue
Block a user