Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
webidl-tools
Advanced tools
Readme
Note: This project is a work-in-progress and exists primarily to enable some pet projects. As such, it is tuned to those use cases. If you need additional functionality, bug fixes, etc., please open a pull request.
webidl-tools provides a suite of commands for extracting and transforming WebIDL.
npm install -g webidl-tools
Set your .flowconfig
to
[include]
validators.js
[libs]
decls
Then run
webidl-tools extract \
https://w3c.github.io/webrtc-pc/archives/20160215/webrtc.html \
--rename 'AlgorithmIdentifier|MediaStream|WorkerGlobalScope/Object'
webidl-tools flow
webidl-tools js
flow check
The file validators.js
will contain typechecked validators for enums and
dictionaries defined in the WebIDL. For example,
$ node
> var validators = require('./validators');
undefined
> validators.validateRTCIceRole('controlling')
"controlling"
> validators.validateRTCIceRole('foo')
TypeError: Invalid RTCIceRole "foo"
$ webidl-tools --help
Usage: webidl-tools <sub-command> [options]
webidl-tools provides a suite of commands for extracting and transforming
WebIDL.
Commands:
extract Extract WebIDL definitions from HTML documents (for
example, W3C specifications). This command also
accepts URLs.
flow Generate Flow type declarations from WebIDL
definitions. If multiple WebIDL definitions with the
same name are provided, they will be merged. This
command also accepts URLs.
js Generate JavaScript code from WebIDL definitions.
The generated code can be used to validate WebIDL
enums and dictionaries. If multiple WebIDL
definitions with the same name are provided, they
will be merged. This command also accepts URLs.
help <sub-command> Show the --help for a specific command
$ webidl-tools extract --help
Usage: webidl-tools-extract [options] <html ...>
Extract WebIDL definitions from HTML documents (for example, W3C
specifications). This command also accepts URLs.
Options:
-h, --help output usage information
-V, --version output the version number
--rename <s/foo/bar/> Rename WebIDL interface, argument, etc., names
(can be specified multiple times; applied after
--skip)
--only </foo/> Only process WebIDL definitions with the given
name (can be specified multiple times)
--skip </foo/> Skip WebIDL definitions with the given name (can
be specified multiple times; applied after --only)
-b, --bail Exit on WebIDL parse failure
--merge Merge WebIDL definitions by unioning interface and
dictionary members
--no-merge Don't merge WebIDL definitions; if a merge is
required and this option is specified, the process
exits
-o, --out <dir> Directory to write the WebIDL to (defaults to ./idl)
$ webidl-tools flow --help
Usage: webidl-tools-flow [options] <idl ...>
Generate Flow type declarations from WebIDL definitions. If multiple WebIDL
definitions with the same name are provided, they will be merged. This
command also accepts URLs.
Options:
-h, --help output usage information
-V, --version output the version number
--rename <s/foo/bar/> Rename WebIDL interface, argument, etc., names
(can be specified multiple times; applied after
--skip)
--only </foo/> Only process WebIDL definitions with the given
name (can be specified multiple times)
--skip </foo/> Skip WebIDL definitions with the given name (can
be specified multiple times; applied after --only)
-b, --bail Exit on WebIDL parse failure
--merge Merge WebIDL definitions by unioning interface and
dictionary members (default)
--no-merge Don't merge WebIDL definitions; if a merge is
required and this option is specified, the process
exits
-o, --out <dir> Directory to write Flow type declarations to
(defualts to ./decls)
$ webidl-tools js --help
Usage: webidl-tools-js [options] <idl ...>
Generate JavaScript code from WebIDL definitions. The generated code can be
used to validate WebIDL enums and dictionaries. If multiple WebIDL
definitions with the same name are provided, they will be merged. This
command also accepts URLs.
Options:
-h, --help output usage information
-V, --version output the version number
--rename <s/foo/bar/> Rename WebIDL interface, argument, etc.,
names (can be specified multiple times;
applied after --skip)
--only </foo/> Only process WebIDL definitions with the
given name (can be specified multiple times)
--skip </foo/> Skip WebIDL definitions with the given name
(can be specified multiple times; applied
after --only)
-b, --bail Exit on WebIDL parse failure
--merge Merge WebIDL definitions by unioning
interface and dictionary members (default)
--no-merge Don't merge WebIDL definitions; if a merge
is required and this option is specified,
the process exits
--flow-types-in-comments Include Flow types in comments (default)
--no-flow-types-in-comments Do not include Flow types in comments
--jsdoc Include JSDoc comments (default)
--no-jsdoc Do not include JSDoc comments
-o, --out <file> File to write JavaScript code to (defaults
to ./validators.js)
FAQs
WebIDL Tools
The npm package webidl-tools receives a total of 3 weekly downloads. As such, webidl-tools popularity was classified as not popular.
We found that webidl-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.