You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can see it is exported in app.js so I believe this one can be ☑ export function run(opts, projectFileName, outDir) {
extend the function to accept a raw fs code (string), write that content as a dedicated file, add it at the end of *.fsproj, so it will become some sort of Main.fs,
execute fable against the *.fsproj and return transpiled js content so it can be further used in JS eval()
As a context, I would like to play with F# in a place where currently squint (a light-weight version of ClojureScript) is used:
import { compileString } from 'squint-cljs';
const f = eval(compileString("(fn [] 1)"
, {"context": "expr",
"elide-imports": true}
));
console.log(f()); // prints 1
Having this example, let's say I'm talking about this compileString Fable equivalent.
I'm asking if you see any obstacles or burdens to achieve it.
I can proceed then on my own with PR
The text was updated successfully, but these errors were encountered:
PawelStadnicki
changed the title
fable-compiler-js that consumes (fs) and produces (js) the raw string content
fable-compiler-js that consumes and produces raw content
Dec 2, 2024
I think what you want is to use @fable-org/fable-standalone which is the actual project which host and expose the compiler API.
This is what fable-compiler-js and Fable REPL use, for compiling F# code in different environnement. It will allows you to decide how you want the project file to be resolved, should there be additional API available, etc.
Today I noticed that fable-compile-js was refreshed several months ago.
That is amazing, thank you!
I wonder if something as below could be possible (without too much work):
run
directly from proprietary js codeFable/src/fable-compiler-js/src/app.fs
Line 390 in 6498a3d
I can see it is exported in app.js so I believe this one can be ☑
export function run(opts, projectFileName, outDir) {
As a context, I would like to play with F# in a place where currently squint (a light-weight version of ClojureScript) is used:
Having this example, let's say I'm talking about this
compileString
Fable equivalent.I'm asking if you see any obstacles or burdens to achieve it.
I can proceed then on my own with PR
The text was updated successfully, but these errors were encountered: