Enable modern JavaScript for Djblets using Rollup.js and @beanbag/frontend-buildkit.

Review Request #12761 — Created Jan. 4, 2023 and submitted

Information

Djblets
release-4.x

Reviewers

This switches Djblets over to the new @beanbag/frontend-buildkit
dependency, which defines a standard set of dependencies for building
both CSS and JavaScript media.

The new buildkit dependency includes Rollup. This is now enabled,
allowing us to begin introducing JavaScript (TypeScript, specifically)
modules that can import other modules.

To start off, most (though not all) of our Pipeline JavaScript bundles
now include an index.ts, which can be populated with imports as we go
forward. The Pipeline bundles separate these out from the legacy
JavaScript via comments. There's also a rollup.config.js to tell
Rollup how we want to bundle things, which will be shared for each
Pipeline bundle.

It'll be the responsibility of each index.ts to import any modules
needed, and to set them in a Djblets namespace.

Extension building has also been updated to work with this.

Temporarily converted some code to use Rollup. This involved converting
some existing files (both .ts and .es6.js) to be modules that
exported content instead of setting Djblets.*explicitly. Re-exported
in an index.ts and verified the resulting bundled file set those on
Djblets.

Then updated an index.ts in a different bundle, imported content from
the other bundle, and exported new code based on that. Verified it
properly accessed the imported content from Djblets and exported back
to Djblets without overwriting anything.

Compiled Djblets static media for packaging, and manually inspected
the files, making sure this all looked correct.

Built the static media in Review Board by browsing pages, and verified
it used Djblets's rollup.config.js, .babelrc, and tsconfig.json for
the builds, instead of Review Board's (tested with and without Review Board
providing those files). Verified Review Board was able to successfully use
the modified code that exported some functionality, and that some dummy
objects I set up and modified via the exports were accessible in Djblets.

Summary ID
Enable modern JavaScript for Djblets and extensions.
This switches Djblets over to the new `@beanbag/frontend-buildkit` dependency, which defines a standard set of dependencies for building both CSS and JavaScript media. The new buildkit dependency includes Rollup. This is now enabled, allowing us to begin introducing JavaScript (TypeScript, specifically) modules that can import other modules. To start off, most (though not all) of our Pipeline JavaScript bundles now include an `index.ts`, which can be populated with imports as we go forward. The Pipeline bundles separate these out from the legacy JavaScript via comments. There's also a `rollup.config.js` to tell Rollup how we want to bundle things, which will be shared for each Pipeline bundle. It'll be the responsibility of each `index.ts` to import any modules needed, and to set them in a `Djblets` namespace. Extension building has also been updated to work with this.
827643d5a444b2d6e6128e43ff723a4cf6067543
chipx86
david
  1. Ship It!
  2. 
      
chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.x (73827bb)