Default build to type: module (#180)

* Defaul build to type: module

* Add packageInfo

* 4.0

* pre

* Adjust tests

* jest js, rest cjs

* Bump dev
This commit is contained in:
Jaco Greeff
2021-03-02 17:27:41 +01:00
committed by GitHub
parent 854d209be8
commit 0f6e143a6f
22 changed files with 56 additions and 79 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ RUST_VER=nightly-2020-10-25
WSM=bytes/wasm_bg.wasm
OPT=bytes/wasm_opt.wasm
ASM=wasm-crypto-asmjs/build/data.js
ASM=wasm-crypto-asmjs/build/data.cjs
# build new via wasm-pack
echo "*** Building Rust sources"
-11
View File
@@ -26,11 +26,6 @@ unamestr=`uname`
rustup toolchain install $RUST_VER -c rust-src -t wasm32-unknown-unknown
cargo install xargo
# if ! [ -x "$(command -v wasm-pack)" ]; then
# echo "*** Installing wasm-pack"
# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# fi
if [[ "$unamestr" == 'Linux' ]]; then
echo "*** Detected Linux"
BINARYEN_ZIP=binaryen-$BINARYEN_VER-x86_64-linux
@@ -59,9 +54,3 @@ if [ ! -d "bindgen" ]; then
mv $BINDGEN_ZIP bindgen
ls -alR bindgen
fi
# if [ ! -d "wabt" ]; then
# echo "*** Downloading wabt"
# curl -L $WABT_REPO/releases/download/$WABT_VER/$WABT_ZIP.tar.gz | tar xz
# mv wabt-$WABT_VER wabt
# fi
+5 -5
View File
@@ -29,17 +29,17 @@ function getWasmBuffer (lib = 'fflate') {
return { compressed, sizeUncompressed: data.length };
}
fs.writeFileSync(`./${A_NAME}/build/data.mjs`, `${hdr(A_NAME)}
export { asmJsInit } from './data.js';
fs.writeFileSync(`./${A_NAME}/build/data.js`, `${hdr(A_NAME)}
export { asmJsInit } from './data.cjs';
`);
fs.writeFileSync(`./${W_NAME}/build/bytes.mjs`, `${hdr(W_NAME)}
export { bytes, sizeCompressed, sizeUncompressed } from './bytes.js';
fs.writeFileSync(`./${W_NAME}/build/bytes.js`, `${hdr(W_NAME)}
export { bytes, sizeCompressed, sizeUncompressed } from './bytes.cjs';
`);
const { compressed, sizeUncompressed } = getWasmBuffer();
fs.writeFileSync(`./${W_NAME}/build/bytes.js`, `${hdr(W_NAME)}
fs.writeFileSync(`./${W_NAME}/build/bytes.cjs`, `${hdr(W_NAME)}
const sizeCompressed = ${compressed.length};
const sizeUncompressed = ${sizeUncompressed};
const bytes = '${compressed.toString('base64')}';