This package contains generator scripts specific to package:web.
To generate Dart interfaces for a given .idl file, run the following at the root of this package:
dart bin/update_idl_bindings.dart
If multiple files are passed, the output option is regarded as an output directory instead.
To regenerate web bindings from the current IDL versions, run the entrypoint without any arguments:
dart bin/update_idl_bindings.dart
To re-generate the package from newer IDL versions, you can either run:
dart bin/update_idl_bindings.dart --update
which installs the latest @webref/* and @mdn/browser-compat-data releases (including new major versions) into this package's package.json.
Alternatively, manually edit package.json to use specific versions, and re-run update_idl_bindings.dart.
web/tool/api.txt is a package:api_summary summary of package:web's public API, including member signatures, so API changes are visible in diffs. update_idl_bindings.dart regenerates it after generating the bindings, and web/test/api_test.dart verifies that it is up to date. To regenerate it manually, run the following in web/:
dart run api_summary --output tool/api.txt
The summary depends on the Dart SDK version, so regenerate it with a current dev or beta SDK (CI checks it on dev), not the minimum supported SDK.
package:web's dartdoc comments come from the MDN Web Docs project. In order to update to the latest version of the documentation, run:
dart bin/scrape_mdn.dart
That will collect the MDN documentation into third_party/mdn/mdn.json; changes to that file should be committed to git. You'll need to run update_idl_bindings.dart to produce Dart code using the updated documentation.
The generator scripts use a number of conventions to consistently handle Web IDL definitions:
JSObject.implements between extension types.JSArray and JSPromise.String.JSFunction.String instead of JSString.JSAny?.JSObject.To ignore the compatibility data and emit all members, run:
dart bin/update_idl_bindings.dart --generate-all
This is useful if you want to avoid having to write bindings manually for some experimental and non-standard APIs.
Based on:
| Item | Version |
|---|---|
@mdn/browser-compat-data | 5.6.42 |
@webref/css | 6.20.3 |
@webref/elements | 2.4.0 |
@webref/idl | 3.60.1 |