Repository navigation
Compile C Hooks locally with hooks-compiler and drop JS Hooks support - #61
Merged
Merged
Conversation
- Remove compile-js, js2qjsc-cli, init js, and the js2qjsc/2bytes modules - Replace the remote compile server with hooks-compiler@0.2.0 (in-process); HOOKS_COMPILE_HOST and the --xrpl flag are gone - Vendor the C header files into the init template; they also serve as the default when --headers is omitted - Move tests from jest to node:test via tsx (jest cannot load the ESM-only compiler); tsconfig uses node16 module resolution - Require Node >= 20.12
- scripts/update-headers.mjs syncs src/init/c/contracts/include with hook/*.h on Xahau/xahaud@release; --check reports drift and exits 1 - yarn headers:update / yarn headers:check; CI runs the check - Bundled headers now match the release branch (adds ls_flags.h, tx_flags.h)
tequdev
enabled auto-merge (squash)
October 19, 2026 11:52
tequdev
disabled auto-merge
October 19, 2026 12:05
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compile-js,js2qjsc-cli,init js, thejs2qjscand2bytesmodules, and theesbuild/pako/base64-jsdependencies. Theinitcommand keeps itstypeargument (onlycis valid) so another hook type can be added later.hooks-compiler@0.2.0instead of the remote compile server.HOOKS_COMPILE_HOSTand the--xrplflag are gone; no network access is needed to build.hook/*.hfrom the xahaudreleasebranch into theinit ctemplate atcontracts/include(8 files, includingls_flags.handtx_flags.h). They also serve as the default when--headersis omitted. Headers are keyed by basename as before, so#include "foo.h"findsheaders/sub/foo.h.scripts/update-headers.mjsre-syncs those headers (yarn headers:update);yarn headers:checkexits 1 on drift and runs in CI as theheaders-up-to-datejob.initnow rejects an invalid type before creating the project directory.node:testrun viatsx --test:hooks-compileris ESM-only and ts-jest rewritesimport()torequire(), so jest cannot load it. tsconfig usesmodule/moduleResolutionnode16so tsc keeps the dynamic import.debugandHOOKS_DEBUG_HOSTare unchanged.Behaviour changes
-O3; hooks-compiler uses-O2followed bywasm-opt -Oz. Output forcontracts-c/base.cis 197 bytes (server: 231 bytes) with identical imports and exports._gimport) are still rejected by hook-cleaner, the same as with the compile server.Release note
src/init/c/package.jsonstill pins@xahau/hooks-cli: ^2.1.0and the package version is still 2.1.0. Because the published 2.x CLI requiresHOOKS_COMPILE_HOSTand the new template.envno longer sets it, this should ship as 3.0.0 with the template devDependency bumped to^3.0.0in the release commit.Verification
yarn build,yarn lint,yarn test:integration(14 tests, including realnpm/yarn/pnpminstalls of a generated project built against this branch's CLI).contracts-c/base.c, chooks-templateindex.c, and iou-reward-hookreward.cwith both the previous buildbox header set and the release-branch set (byte-identical output): all passguard_checker, export onlyhook, import onlyenv.*, and have import/export sets identical to the compile server's output for the same sources.base.wasmandindex.wasmto a standalone xahaud via the generated project's deploy script:base: Finished.andaccept(return code 14 =__LINE__) with the expectedHookStateentry written.<name>.logcontaining the clang diagnostics.