discourse/spec
David Taylor aa2fb29fa6
DEV: Use rollup for theme JS compilation (#33103)
This commit is a complete reimplementation of our theme JS compilation
system.

Previously, we compiled theme JS into AMD `define` statements on a
per-source-file basis, and then concatenated them together for the
client. These AMD modules would integrate with those in Discourse core,
allowing two way access between core/theme modules. Going forward, we'll
be moving away from AMD, and towards native ES modules in core. Before
we can do that, we need to stop relying on AMD as the 'glue' between
core and themes/plugins.

This change introduces Rollup (running in mini-racer) as a compiler for
theme JS. This is configured to generate a single ES Module which
exports a list of 'compat modules'. Core `import()`s the modules for
each active theme, and adds them all to AMD. In future, this consumption
can be updated to avoid AMD entirely.

All module resolution within a theme is handled by Rollup, and does not
use AMD.

Import of core/plugin modules from themes are automatically transformed
into calls to a new `window.moduleBroker` interface. For now, this is a
direct interface to AMD. In future, this can be updated to point to real
ES Modules in core.

Despite the complete overhaul of the internals, this is not a breaking
change, and should have no impact on existing themes. If any
incompatibilities are found, please report them on
https://meta.discourse.org.

---------

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
Co-authored-by: Chris Manson <chris@manson.ie>
2025-07-25 12:02:29 +01:00
..
db/migrate FEATURE: Themeable site settings (#32233) 2025-07-16 11:00:21 +10:00
fabricators FEATURE: Add support for aws MediaConvert (#33092) 2025-07-23 11:58:33 -06:00
fixtures FIX: correctly unescape title for amazon oneboxes (#33010) 2025-06-02 17:50:13 +05:30
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
import_export DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
initializers DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
integration DEV: Only write session cookie when contents is changed (#33828) 2025-07-25 11:07:07 +01:00
integrity FIX: cross origin opener policy should apply to public error responses (#31559) 2025-03-03 17:04:24 +08:00
jobs FEATURE: Add support for aws MediaConvert (#33092) 2025-07-23 11:58:33 -06:00
lib DEV: Use rollup for theme JS compilation (#33103) 2025-07-25 12:02:29 +01:00
mailers DEV: Remove ability to use users' names in group mention notifications and mentions shown in emails and added :user_notification_email_options plugin modifier to allow plugins reintroduce this or other modifications to emails (#33449) 2025-07-14 15:20:08 -05:00
models DEV: Use rollup for theme JS compilation (#33103) 2025-07-25 12:02:29 +01:00
multisite FEATURE: Themeable site settings (#32233) 2025-07-16 11:00:21 +10:00
queries/reports DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
requests DEV: Use rollup for theme JS compilation (#33103) 2025-07-25 12:02:29 +01:00
script/import_scripts DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
serializers DEV: Use themeable site settings for Horizon (#33645) 2025-07-24 12:20:34 +10:00
services FIX: bug when silence user and do nothing to post (#33819) 2025-07-25 10:31:22 +08:00
support DEV: updates playwright to 1.54 (#33715) 2025-07-24 10:07:31 +02:00
system DEV: skips a spec failing very often (#33854) 2025-07-25 12:10:25 +02:00
tasks DEV: Only load specific plugin bundles during qunit test (#33678) 2025-07-21 21:00:48 +01:00
views FIX: correctly displaying the failure error message 2025-06-25 10:25:41 +08:00
rails_helper.rb DEV: Use themeable site settings for Horizon (#33645) 2025-07-24 12:20:34 +10:00
regenerate_swagger_docs
swagger_helper.rb DEV: Bump rswag-specs from 2.11.0 to 2.13.0 (#24654) 2023-12-07 08:16:47 +08:00