Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WASM2WAT := ../wabt/bin/wasm2wat
WASM_OPT := ../binaryen/bin/wasm-opt
WASM2WAT ?= ../wabt/bin/wasm2wat
WASM_OPT ?= ../binaryen/bin/wasm-opt

.PHONY: optimize clean

Expand All @@ -12,5 +12,8 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/
lib/:
@mkdir -p $@

optimize: lib/lexer.wasm
$(WASM_OPT) -Oz --low-memory-unused --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm

clean:
$(RM) lib/*
2 changes: 1 addition & 1 deletion build/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const WASM_BUILDER_CONTAINER = 'ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970' // v0.0.9

const WASM_OPT = './wasm-opt'
const WASM_OPT = process.env.WASM_OPT || './wasm-opt'

const { execSync } = require('node:child_process')
const { writeFileSync, readFileSync, existsSync, mkdirSync } = require('node:fs')
Expand Down
4 changes: 3 additions & 1 deletion lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ function parseSource (cjsSource) {
pos += 4;
if (source.charCodeAt(pos) === 40/*(*/) {
openTokenPosStack[openTokenDepth++] = lastTokenPos;
if (source.charCodeAt(++pos) === 114/*r*/)
if (source.charCodeAt(pos + 1) === 114/*r*/) {
pos++;
tryParseRequire(ExportStar);
}
}
}
lastTokenPos = pos;
Expand Down
Binary file modified lib/lexer.wasm
Binary file not shown.
Loading
Loading