ts2ocaml icon indicating copy to clipboard operation
ts2ocaml copied to clipboard

Generate separate, smaller source files

Open zbaylin opened this issue 1 year ago • 0 comments

I am currently using ts2ocaml to generate bindings to a fairly large TypeScript library. ts2ocaml produces an mli file approximately 8.2MB in size, which causes both ocamlopt and ocamlc to stack overflow at the default system stack limit on my Macbook Pro.

I am fairly certain this could be solved by generating separate interface files, since modules can't be recursively dependent anyway.

i.e. transform src.mli:

module X : sig
  ...
end
module Y : sig
  ...
end

into x.mli, y.mli withsrc.mli:

module X = X
module Y = Y

I recognize that this is a "nice-to-have" and probably doesn't represent a widespread need, but would be very helpful in making builds of my library easier!

zbaylin avatar Nov 01 '22 20:11 zbaylin