Skip to content

Split rescript npm package into multiple subpackages #6183

Open
@cknitt

Description

@cknitt

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions