Rome, a new JavaScript Toolchain

sounds like something we can try in the future to replace Google Closure Compiler…?

Rome’s architecture is relatively unique: all compilation happens on a per-module basis, which allows each module to be processed in a pool of worker threads. This works well for per-module transforms, but presents a challenge for bundling: in order to avoid having to re-parse every module produced by the workers, the modules need to be pre-namespaced such that they can all share a single scope.

a demo of generated js code:

(function(global) {
  'use strict';
  // rome/react.tsx

  function ___R$$priv$rome$react_tsx$createElement(
    type, props, ...children
  ) {
    return {type: type, props: props, children: children};
  const ___R$rome$react_tsx$default = {
    createElement: ___R$$priv$rome$react_tsx$createElement

  // rome/other.tsx

  const ___R$rome$other_tsx$default = () =>
      'h1', null, 'Hello World'

  // rome/test.tsx

  const ___R$rome$test_tsx = {};
  async function ___R$$priv$rome$test_tsx$App(props) {
    return ___R$rome$react_tsx$default.createElement(
      'div', { id: 'app'},
      (await ___R$rome$other_tsx$default())


  return ___R$rome$test_tsx;
})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);

I have poor understanding here but my initial reading is that so far it’s not as powerful as the Google closure compiler, if/when it does become the case we may have compatibility issues since Google’s functions are a kind of standard library for some cljs apps

yep. but it at least opens another possibility other than Google Closure Compiler.

1 Like