Skip to content

feat(http): add QuickJS script handler - #871

Open
ithewei wants to merge 6 commits into
masterfrom
js-http-script-handler
Open

feat(http): add QuickJS script handler#871
ithewei wants to merge 6 commits into
masterfrom
js-http-script-handler

Conversation

@ithewei

@ithewei ithewei commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add optional WITH_JS / QuickJS support and install HttpJsHandler.h when enabled.
  • Add HttpJsHandler plus HttpScriptHandler dispatch for .js scripts.
  • Support v1 built-in modules for scripts: hv, hv/http, hv/ws, hv/redis, and hv/mqtt with Promise-based APIs for async / await.
  • Document JS handler usage, module scope, and the v1 boundary that Node.js/npm modules such as require("axios") are not supported.
  • Add JS integration tests covering HTTP async/await, Redis, WebSocket, MQTT failure handling, and JSON stringify errors.
  • Fix AsyncRedisClient pending request callback reentrancy by popping completed/failed requests before invoking callbacks.

Testing

  • git diff --check
  • rm -rf /tmp/libhv-default-nojs-final8 && cmake -S . -B /tmp/libhv-default-nojs-final8 -DBUILD_UNITTEST=ON -DBUILD_EXAMPLES=OFF && cmake --build /tmp/libhv-default-nojs-final8 --target hv unittest --config Release
  • rm -rf /tmp/libhv-js-all-final4 && cmake -S . -B /tmp/libhv-js-all-final4 -DWITH_JS=ON -DWITH_HTTP=ON -DWITH_REDIS=ON -DWITH_MQTT=ON -DBUILD_UNITTEST=ON -DBUILD_EXAMPLES=OFF -DQUICKJS_ROOT=/opt/homebrew/Cellar/quickjs/2026-06-04 && cmake --build /tmp/libhv-js-all-final4 --target unittest --config Release && /tmp/libhv-js-all-final4/bin/http_js_handler_test && /tmp/libhv-js-all-final4/bin/http_js_redis_test && /tmp/libhv-js-all-final4/bin/http_js_ws_test && /tmp/libhv-js-all-final4/bin/http_js_mqtt_test && /tmp/libhv-js-all-final4/bin/redis_async_client_test && /tmp/libhv-js-all-final4/bin/redis_client_test && /tmp/libhv-js-all-final4/bin/redis_batch_test && /tmp/libhv-js-all-final4/bin/redis_subscriber_test
  • git restore --source=HEAD --staged --worktree config.mk && rm -rf bin lib include/hv && ./configure --with-js --with-http --with-redis --with-mqtt >/tmp/libhv-js-configure-final5.log && make run-unittest WITH_JS=yes WITH_HTTP=yes WITH_REDIS=yes WITH_MQTT=yes

Copilot AI lite review requested due to automatic review settings August 19, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 20, 2026 04:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 20, 2026 05:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 20, 2026 05:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 20, 2026 05:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 20, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ithewei
ithewei requested a lite review from Copilot August 20, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants