Is your feature request related to a problem? Please describe.
stanc.js often runs in environments like v8 where the file system is not available, and so it currently cannot handle #include statements. This limits its ability to be used for tasks like formatting, and compiling requires preprocessing outside of the compiler which leads to bugs and worse error messages.
Describe the solution you'd like
The stanc() function could accept a final argument which is a mapping from file paths to a string of their contents, e.g if i had a stan model foo.stan,
Describe alternatives you've considered
In contexts where the file system is actually available, like Node, we could just use it directly.
Additional context
Properly preparing a call to the above would require some work based on the include-paths argument the user supplied. Of course, you could over specify the final argument and include the text of all .stan files in the directory - perhaps a bit slower, but would work.
@andrjohns @hsbadr - does this sound like something RStan would use if it was supported
Is your feature request related to a problem? Please describe.
stanc.js often runs in environments like v8 where the file system is not available, and so it currently cannot handle #include statements. This limits its ability to be used for tasks like formatting, and compiling requires preprocessing outside of the compiler which leads to bugs and worse error messages.
Describe the solution you'd like
The stanc() function could accept a final argument which is a mapping from file paths to a string of their contents, e.g if i had a stan model foo.stan,
I could invoke
stanc()
likestanc("foo", fooCode, arguments, {"helpers/bar.stan": barcode});
Describe alternatives you've considered In contexts where the file system is actually available, like Node, we could just use it directly.
Additional context
Properly preparing a call to the above would require some work based on the include-paths argument the user supplied. Of course, you could over specify the final argument and include the text of all .stan files in the directory - perhaps a bit slower, but would work.
@andrjohns @hsbadr - does this sound like something RStan would use if it was supported