Skip to content

Commit d36c3e0

Browse files
committed
wasm: Reorganize into src and test subdirs
1 parent 6866fbf commit d36c3e0

File tree

14 files changed

+15
-15
lines changed

14 files changed

+15
-15
lines changed

src/wasm_package/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
"name": "wallycore",
33
"version": "0.8.7",
44
"description": "JavaScript bindings for libwally",
5-
"main": "index.js",
5+
"main": "src/index.js",
66
"type": "module",
77
"scripts": {
8-
"test": "node test.js",
8+
"test": "node test/test.js",
99
"prepare": "./build.sh"
1010
},
1111
"files": [
12-
"*.js",
13-
"*.d.ts",
14-
"libwally_wasm"
12+
"src",
13+
"libwally_wasm",
14+
"webpack.config.js"
1515
],
1616
"author": "Blockstream",
1717
"license": "(MIT or BSD)",
@@ -22,7 +22,7 @@
2222
},
2323
"browser": {
2424
"module": false,
25-
"assert": "./browser/assert.js",
26-
"crypto": "./browser/crypto.js"
25+
"assert": "./src/browser/assert.js",
26+
"crypto": "./src/browser/crypto.js"
2727
}
2828
}
File renamed without changes.

src/wasm_package/core.js renamed to src/wasm_package/src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'assert'
2-
import InitWallyModule from './libwally_wasm/wallycore.js'
2+
import InitWallyModule from '../libwally_wasm/wallycore.js'
33
import { WALLY_OK, WALLY_ERROR, WALLY_EINVAL, WALLY_ENOMEM } from './const.js'
44

55
// Initialize the underlying WASM module and expose it publicly
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/wasm_package/test.js renamed to src/wasm_package/test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import assert from 'assert'
22

3-
import * as wally from './index.js'
3+
import wally from '../src/index.js'
44
import {
55
WALLY_NETWORK_BITCOIN_MAINNET, WALLY_ADDRESS_VERSION_WIF_MAINNET, WALLY_WIF_FLAG_COMPRESSED,
66
BIP32_FLAG_KEY_PUBLIC, BIP32_INITIAL_HARDENED_CHILD,
7-
} from './index.js'
8-
import { toWallyMap, fromWallyMap } from './util.js'
7+
} from '../src/index.js'
8+
import { toWallyMap, fromWallyMap } from '../src/util.js'
99

1010
// Test simple invocation, with a return code only and no destination pointer
1111
wally.hex_verify('00') // should not throw

src/wasm_package/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import webpack from 'webpack'
22
import path from 'path'
33

44
export default {
5-
entry: './index.js',
5+
entry: './src/index.js',
66
experiments: {
77
topLevelAwait: true,
88
},

tools/build_wrappers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ def map_args(func):
520520
tscode.append(f"export function {fn_name}({', '.join(ts_args)}): {ts_return_code};")
521521

522522
# Inject generated functions into functions.js
523-
replace_text(u'src/wasm_package/functions.js', jscode,
523+
replace_text(u'src/wasm_package/src/functions.js', jscode,
524524
[u'// BEGIN AUTOGENERATED', u'// END AUTOGENERATED'])
525525

526526
# Inject generated TypeScript definitions into index.d.ts
527-
replace_text(u'src/wasm_package/index.d.ts', tscode,
527+
replace_text(u'src/wasm_package/src/index.d.ts', tscode,
528528
[u'// BEGIN AUTOGENERATED', u'// END AUTOGENERATED'])
529529

530530

tools/update_wasm_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| grep -v '#define OP_' \
77
| sed -r 's~.*#define ([^ ]*) *~export const \1 = ~; s~( /\*)| *$~;\1~' \
88
| sort \
9-
) > src/wasm_package/const.js
9+
) > src/wasm_package/src/const.js
1010

1111

1212
# Update version number to match libwally's

0 commit comments

Comments
 (0)