Skip to content

Commit

Permalink
0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Feb 22, 2022
1 parent 5e6c44a commit 15329ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,33 @@ test/samples/*.js (3123 KiB)

### Building

To build download the WASI SDK 12.0 from https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-12.
This project uses [Chomp](https://chompbuild.com) for building.

With Chomp installed, download the WASI SDK 12.0 from https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-12.

- [Linux](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz)
- [Windows (MinGW)](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-mingw.tar.gz)
- [macOS](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz)

The Makefile assumes the existence of "wasi-sdk-12.0" and "wabt" (optional) as sibling folders to this project.
Locate the WASI-SDK as a sibling folder, or customize the path via the `WASI_PATH` environment variable.

Emscripten emsdk is also assumed to be a sibling folder or via the `EMSDK_PATH` environment variable.

Example setup:

The build through the Makefile is then run via `make lib/lexer.wasm`, which can also be triggered via `npm run build:wasm` to create `dist/lexer.js`.
```
git clone https://github.com:guybedford/es-module-lexer
git clone https://github.com/emscripten-core/emsdk
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
gunzip wasi-sdk-12.0-linux.tar.gz
tar -xf wasi-sdk-12.0-linux.tar
mv wasi-sdk-12.0-linux.tar wasi-sdk-12.0
cargo install chompbuild
cd es-module-lexer
chomp test
```

After the Web Assembly build, the CJS build can be triggered via `npm run build`.
For the `asm.js` build, git clone `emsdk` from is assumed to be a sibling folder as well.

### License

Expand Down
3 changes: 1 addition & 2 deletions chompfile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ OPT = 'z'
[env-default]
WASI_PATH = '../wasi-sdk-12.0'
EMSDK_PATH = '../emsdk'
EMSCRIPTEN_BIN = '../emsdk/fastcomp/emscripten/emcc'

[[task]]
name = 'build'
Expand Down Expand Up @@ -117,7 +116,7 @@ run = """
${{ EMSDK_PATH }}/emsdk install 1.40.1-fastcomp
${{ EMSDK_PATH }}/emsdk activate 1.40.1-fastcomp
${{ EMSCRIPTEN_BIN }} ./src/lexer.c -o lib/lexer.emcc.js -s WASM=0 -O${{OPT}} --closure 1 \
${{ EMSDK_PATH }}/fastcomp/emscripten/emcc ./src/lexer.c -o lib/lexer.emcc.js -s WASM=0 -O${{OPT}} --closure 1 \
-s EXPORTED_FUNCTIONS="['_parse','_sa','_e','_ri','_re','_is','_ie','_ss','_ip','_se','_ai','_id','_es','_ee','_f','_setSource']" \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 -s SINGLE_FILE=1 -s TOTAL_STACK=4997968 -s --separate-asm -Wno-logical-op-parentheses -Wno-parentheses
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "es-module-lexer",
"version": "0.9.3",
"version": "0.10.0",
"description": "Lexes ES modules returning their import/export metadata",
"main": "dist/lexer.cjs",
"module": "dist/lexer.js",
Expand Down

0 comments on commit 15329ab

Please sign in to comment.