Skip to content

♻️ refactor(http-import): make HTTP fetcher pluggable via HttpFetcher trait - #1886

Merged
harehare merged 8 commits into
mainfrom
feat/wasm-http-import
Jun 17, 2026
Merged

harehare merged 8 commits into
mainfrom
feat/wasm-http-import

Conversation

@harehare

Copy link
Copy Markdown
Owner

harehare added 4 commits June 16, 2026 21:23
Support fetching mq modules from HTTP/GitHub URLs in the WASM
runtime using the browser Fetch API. Versioned (tagged) imports
are cached persistently in OPFS; mutable (HEAD/branch) imports
use a refreshable cache. Adds clearHttpCache and clearAllHttpCache
WASM exports for cache management from the host.
… trait

Split `http-import` feature into `http-import` (URL utils + trait + generic
resolver) and `http-import-ureq` (adds UreqFetcher with disk cache + ureq).

- Add `HttpFetcher` trait covering both fetch and cache responsibility
- Introduce generic `HttpModuleResolver<F: HttpFetcher>` replacing the
  ureq-coupled implementation
- Add `UreqFetcher` behind `http-import-ureq` feature (disk cache with
  versioned/mutable subdirs and SHA-256 sidecar, ureq HTTPS fetch)
- Add `WasmFetcher` in mq-wasm: reads from a pre-populated in-memory
  HashMap, bridging async OPFS preload with sync module resolution
- mq-run enables `mq-lang/http-import-ureq`; mq-wasm enables
  `mq-lang/http-import` (no ureq dependency in WASM)
`extract_http_import_urls` previously only scanned `import` nodes;
`include "https://..."` and `include "github.com/..."` were silently
skipped, so OPFS caching never ran for them.

✅ test(http-import): add rstest parametrized and proptest property tests

Add comprehensive rstest cases and proptest property-based tests for all
URL utility functions in `http_import.rs` (is_remote_url, is_github_url,
github_to_raw_url, extract_module_name, normalize_allowed_domain,
is_allowed_url, is_versioned_url, prefix_matches).

Add wasm_bindgen_test cases for extract_http_import_urls covering import
and include with HTTPS/GitHub URLs, local exclusions, mixed code, invalid
syntax, and empty input.
Add parametrized rstest cases and proptest property-based tests for
is_remote_url, is_github_url, github_to_raw_url, extract_module_name,
normalize_allowed_domain, is_allowed_url, is_versioned_url, and
prefix_matches covering edge cases, prefix-attack prevention, scheme
stripping, and mutable/versioned ref classification.
@codspeed

codspeed Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing feat/wasm-http-import (bf23af0) with main (e42d6e1)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (eb53e80) during the generation of this report, so e42d6e1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@harehare
harehare force-pushed the feat/wasm-http-import branch from b0ff5a5 to bf23af0 Compare June 17, 2026 12:50
@harehare
harehare merged commit 149a697 into main Jun 17, 2026
11 checks passed
@harehare
harehare deleted the feat/wasm-http-import branch June 17, 2026 13:10
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
mq 0.6.2

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed

###  ✨ New Features

- Allow pipeline expressions as function arguments by @VrtxOmega in harehare/mq#1865
- ✨ feat(playground): add drag-and-drop file import to editors by @harehare in harehare/mq#1885
- ✨ feat(mq-web): expose clearHttpCache and clearAllHttpCache APIs by @harehare in harehare/mq#1890
- ✨ feat(mq-ffi): expose engine module/config APIs and mq_version by @harehare in harehare/mq#1893
- ✨ feat(mq-repl): add /save command test and fix missing match arm by @harehare in harehare/mq#1896
- ✨ feat(mq-lsp): add code actions and rename support by @harehare in harehare/mq#1900
- ✨ feat(mq-run): add shell completion subcommand  by @harehare in harehare/mq#1902
- ✨ feat(mq-lang): add set_children builtin function by @harehare in harehare/mq#1907
- ✨ feat(mq-lang): add md module for building markdown from scratch by @harehare in harehare/mq#1906
- ✨ feat(mq-lang): make md::doc accept variadic arguments by @harehare in harehare/mq#1909
- feat: add --exit-status / -e flag (exit code 1 for false/null/empty output) by @sridhar-3009 in harehare/mq#1823
- ✨ feat(mq-nodejs): add hover and HTTP cache control APIs by @harehare in harehare/mq#1910

###  🐛  Bug Fixes

- 🐛 fix(cst): support pipeline expressions as function arguments by @harehare in harehare/mq#1866
- 💄 fix(playground): replace alert() with showToast() for error messages by @harehare in harehare/mq#1877
- fix(mq-lang): handle "v"/"V" prefix in semver_parse by @aodihis in harehare/mq#1887
- 🐛 fix(mq-lang): escape embedded double-quotes in csv_stringify by @harehare in harehare/mq#1892
- 🐛 fix(mq-lang): block SSRF/DNS-rebinding in http-import resolver by @harehare in harehare/mq#1901
- 🐛 fix(mq-check): preserve generic arm type when union with concrete None arm by @harehare in harehare/mq#1904
- 🐛 fix(mq-formatter): fix indentation of wrapped def/fn params when inline by @harehare in harehare/mq#1908
- 🐛 fix(mq-wasm): gate OPFS-only helpers behind opfs feature by @harehare in harehare/mq#1911

### ♻ Refactor

- ♻ refactor(http-import): make HTTP fetcher pluggable via HttpFetcher trait by @harehare in harehare/mq#1886

###  📦 Build / Dependencies

- build(deps): bump the dependencies group with 2 updates by @dependabot[bot] in harehare/mq#1882
- build(deps): bump which from 8.0.2 to 8.0.3 in the dependencies group by @dependabot[bot] in harehare/mq#1881
- build(deps-dev): bump the dependencies group in /editors/vscode with 4 updates by @dependabot[bot] in harehare/mq#1878
- build(deps-dev): bump oxlint from 1.68.0 to 1.69.0 in /packages/mq-web in the dependencies group by @dependabot[bot] in harehare/mq#1879
- build(deps-dev): bump the dependencies group in /packages/mq-playground with 2 updates by @dependabot[bot] in harehare/mq#1880
- build(deps-dev): bump js-yaml from 4.1.1 to 4.2.0 in /editors/vscode by @dependabot[bot] in harehare/mq#1883
- build(deps): bump cbindgen from 0.29.3 to 0.29.4 in the dependencies group by @dependabot[bot] in harehare/mq#1888
- 📦 build(nix): update flake.lock to latest nixpkgs and rust-overlay by @harehare in harehare/mq#1889
- build(deps): bump taiki-e/install-action from 2.81.8 to 2.81.9 in the dependencies group by @dependabot[bot] in harehare/mq#1894
- build(deps-dev): bump @types/node from 25.9.2 to 25.9.3 in /editors/vscode in the dependencies group by @dependabot[bot] in harehare/mq#1898
- build(deps): bump the dependencies group with 2 updates by @dependabot[bot] in harehare/mq#1899
- build(deps): bump smallvec from 1.15.1 to 1.15.2 in the dependencies group by @dependabot[bot] in harehare/mq#1903

## New Contributors

* @VrtxOmega made their first contribution in harehare/mq#1865
* @aodihis made their first contribution in harehare/mq#1887
* @sridhar-3009 made their first contribution in harehare/mq#1823

**Full Changelog**: harehare/mq@v0.6.1...v0.6.2
</pre>
  <p>View the full release notes at <a href="https://github.com/harehare/mq/releases/tag/v0.6.2">https://github.com/harehare/mq/releases/tag/v0.6.2</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!12066
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.

1 participant