-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider a better API for feeding in files #160
Comments
In #208, I implemented It also fixes the bug where: const transformer = new WebIDL2JS();
transformer.addSource("path/to/Attr.webidl", "path/to/Attr-impl.js");
// ... add the rest, one file at a time. The client is responsible for directory iteration.
await transformer.generate("outputDir"); Would result in |
I'd like us to consider and decide on the eventual shape of the whole API, and not just add things. In particular, I think Can you describe how |
Testing would be easier if we had a core API that didn't do file I/O at all, plus a wrapper API that did the file I/O. I guess that would be something like const transformer = new WebIDL2JS();
transformer.add(idlString1, implModuleSpecifier1);
transformer.add(idlString2, implModuleSpecifier2);
for (const constructName of transformer.constructs()) {
const result = transformer.generate(constructName);
}
const utils = transformer.utils(); Although this idea of using module specifiers for the impl is a bit fragile; it helps keep the pipeline pure string-to-string, but it makes it the caller's responsibility to get the exact path mapping right on disk. Maybe that's fine with a good wrapper API though... |
#159 ran into an issue where the current API is not flexible enough to do targeted testing, because it operates on a directory level. This has always been a bit of a strange design; it's not very flexible and assumes a lot about the directory structure. I'd love to get opinions on what would be better designs.
Here are some ideas:
Other ideas are welcome as well.
The text was updated successfully, but these errors were encountered: