feat(cli): add --v8-flags plumbing to configure V8 at startup (#130) (#131)

* feat(cli): add --v8-flags plumbing to configure V8 at startup (#130)

Obscura had no way to pass flags to V8, so users hitting OOM on pages
larger than ~5MB had no escape hatch. Adds a generic passthrough rather
than a one-off heap knob, so future V8 tuning needs no new code.

- New `obscura_js::set_v8_flags` (Once-guarded, empty-string no-op).
- Global `--v8-flags <FLAGS>` arg with `allow_hyphen_values = true`,
  applied once in `main` before any isolate is created.
- Usage: `obscura --v8-flags "--max-old-space-size=4096" fetch <url>`.

Closes #130.

* test(cli): expand --v8-flags coverage with normalize helper

Extract normalize_v8_flags() from main() so the trim/empty-check logic
is unit-testable without needing to invoke V8. Adds parse-coverage tests
for --v8-flags with serve/scrape subcommands and empty-string values,
plus pure-function tests for the normalizer.
This commit is contained in:
Adam Ma authored and GitHub committed 2026-05-15 19:46:03 +00:00
1 parent 7b209dc655
commit cb701fc2d8
3 files changed
+154 -1

No files matched your search

+2
View File
@@ -4,7 +4,9 @@ extern crate html5ever;
pub mod module_loader;
pub mod runtime;
pub mod ops;
pub mod v8_flags;
pub mod v8_lock;
pub mod markdown;
pub use markdown::HTML_TO_MARKDOWN_JS;
pub use v8_flags::set_v8_flags;