Currently, the playground takes a single source string (passed to compile()) and produces JS output. This requires tools that support multiple files (like https://github.com/phated/reasonable and codesandbox/codesandbox-client#850) to guess at the dependency list/order before wrapping each source file in module syntax and concatenating them together, which is then passed to the compile() method. Currently, both tools are using a custom compiled version of BuckleScript by @jaredly and then doing their own module resolution.
If the playground had support for registering multiple source strings (maybe by a module name?) before calling compile(), I think all of that previous dance could be avoided.
Hypothetical API:
window.ocaml.registerModule("Foo", "...");
window.ocaml.registerModule("Bar", "...");
window.ocaml.registerModule("Baz", "..."); // Uses Foo and Bar modules
window.ocaml.compileModules();
Thoughts?