Skip to content
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

Split rescript npm package into multiple subpackages #6183

Open
cknitt opened this issue Apr 20, 2023 · 1 comment
Open

Split rescript npm package into multiple subpackages #6183

cknitt opened this issue Apr 20, 2023 · 1 comment
Assignees
Milestone

Comments

@cknitt
Copy link
Member

cknitt commented Apr 20, 2023

This one is probably for v12 and beyond.

1.) In #6133, the suggestion was made to provide separate npm packages for compiler binaries for each platform, add them as optional dependencies to the rescript package and leverage built-in functionality of the package manager to automatically install only the matching binaries for the current platform similar to how esbuild does it. This would yield the following packages for the compiler binaries:

  • @rescript/darwin-arm64
  • @rescript/darwin-x64
  • @rescript/linux-arm64
  • @rescript/linux-x64
  • @rescript/win32-x64

This change would reduce the amount of disk space used by npm install rescript.

2.) In addition, the runtime / standard libraries could also be extracted from the main rescript package into separate packages:

  • @rescript/runtime (Pervasives, Jsx, Caml_*, etc.)
  • @rescript/core (already a separate package now)
  • @rescript/belt
  • @rescript/js-compat (for the existing Js namespace)
  • @rescript/ocaml-compat (for the existing OCaml standard library modules)

Some of these could be installed by default as dependencies of the rescript packages and others could be made optional.

The cmi/cmj caches could then be built only for the relevant installed packages on the first project build, instead of during CI build.

Advantages:

  • Being able to maintain some of these in separate repos and at a separate release cycle from the compiler repo.
  • Dependencies would always built with the projects compiler settings (uncurried true/false).
  • Further reducing the size of a ReScript installation when more compat packages are made optional.
  • Speeding up CI build by having to build and package less stuff.
@cometkim
Copy link
Member

Note that this technique only works for optionalDependencies

And probably wouldn't work for bin with some package managers as they don't allow installation from transitive dependency
See https://gist.github.com/cometkim/eb2842d67b40e583e4886e9b897a6af0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants