invariants library
Commit-time AST linting for Dart files that embed literal JavaScript.
This library is deliberately separate from the runtime canary library:
it depends on package:analyzer (a tooling dependency) and is meant
to run on the developer machine / CI, not on device. Import it from
your own test suite to pin the rules, or run the bundled executables:
dart run inappwebview_script_guard:check_js_invariants --root lib/webview_scripts
dart run inappwebview_script_guard:extract_js lib/webview_scripts/foo.dart out/
See checkSource for the four rejected constructs and the per-file skip directive.
Classes
- CheckResult
- Result of running the invariant checker on a single file's source.
Functions
-
checkSource(
String filePath, String source) → CheckResult - Run the full check pipeline (skip-directive scan + AST visitor) against a source string.