forked from lib-ruby-parser/wasm-bindings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update codegen templates, build nodejs
now uses codegen bin to generate rust and js files wasm bindgen now imports node classes instead of relying on globals breaks web / no-modules building, but that's because we're optimizing for nodejs (commonjs) importing room for improvement might be having wasm-bindgen export the rust node structs themselves isntead of templating the JS for those (generated types would be nice as well)
- Loading branch information
Showing
29 changed files
with
6,170 additions
and
817 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
include codegen/build.mk | ||
include build/build.mk | ||
include tests/build.mk | ||
include gh-pages/build.mk | ||
include benchmark/build.mk | ||
|
||
build/nodejs: $(CODEGEN_FILES) | ||
wasm-pack build --release --target nodejs --no-typescript --out-dir ../build/nodejs bindings | ||
cp js/* build/nodejs | ||
|
||
CLEAN += build/nodejs | ||
|
||
clean: | ||
rm -rf $(CLEAN) | ||
touch codegen/build.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
CODEGEN_DEPS = $(wildcard codegen/codegen/*.rs) | ||
CODEGEN_DEPS += codegen/Cargo.toml | ||
CODEGEN_DEPS += codegen/build.rs | ||
DO_CODEGEN = cd codegen && cargo build | ||
define download_file | ||
curl "$(1)" --fail-with-body -LSso "$(2).tmp" && mv "$(2).tmp" "$(2)" | ||
endef | ||
|
||
js/nodes.js: $(CODEGEN_DEPS) | ||
$(DO_CODEGEN) | ||
CODEGEN_EXE = codegen/codegen$(EXE) | ||
$(CODEGEN_EXE): | ||
$(call download_file,https://github.com/lib-ruby-parser/lib-ruby-parser/releases/download/codegen-v1.0.1/codegen-x86_64-apple-darwin,$@) | ||
chmod +x $(CODEGEN_EXE) | ||
CLEAN += $(CODEGEN_EXE) | ||
|
||
js/index.d.ts: codegen/types.d.ts.liquid $(CODEGEN_EXE) | ||
$(CODEGEN_EXE) --template $< --write-to $@ | ||
CLEAN += js/index.d.ts | ||
CODEGEN_FILES += js/index.d.ts | ||
|
||
js/nodes.js: codegen/nodes.js.liquid $(CODEGEN_EXE) | ||
$(CODEGEN_EXE) --template $< --write-to $@ | ||
CLEAN += js/nodes.js | ||
CODEGEN_FILES += js/nodes.js | ||
|
||
js/messages.js: $(CODEGEN_DEPS) | ||
$(DO_CODEGEN) | ||
js/messages.js: codegen/messages.js.liquid $(CODEGEN_EXE) | ||
$(CODEGEN_EXE) --template $< --write-to $@ | ||
CLEAN += js/messages.js | ||
CODEGEN_FILES += js/messages.js | ||
|
||
bindings/src/nodes.rs: $(CODEGEN_DEPS) | ||
$(DO_CODEGEN) | ||
bindings/src/nodes.rs: codegen/nodes.rs.liquid $(CODEGEN_EXE) | ||
$(CODEGEN_EXE) --template $< --write-to $@ | ||
CLEAN += bindings/src/nodes.rs | ||
CODEGEN_FILES += bindings/src/nodes.rs | ||
|
||
bindings/src/messages.rs: $(CODEGEN_DEPS) | ||
$(DO_CODEGEN) | ||
bindings/src/messages.rs: codegen/messages.rs.liquid $(CODEGEN_EXE) | ||
$(CODEGEN_EXE) --template $< --write-to $@ | ||
CLEAN += bindings/src/messages.rs | ||
CODEGEN_FILES += bindings/src/messages.rs |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.