A platform for community discussion. Free, open, simple.
DEV: Remove the old non-rollup plugin compiler (#39009)
Jarek Radosz81cac8ba4920
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex d9900f553bf..b333179826f 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -62,7 +62,6 @@ jobs:LOAD_PLUGINS: ${{ (matrix.target == 'core-plugins' || matrix.target == 'official-plugins' || matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}QUNIT_REUSE_BUILD: 1- ROLLUP_PLUGIN_COMPILER: ${{ matrix.plugin_compiler == 'rollup' && '1' || '0' }}strategy:fail-fast: falsediff --git a/app/models/theme.rb b/app/models/theme.rbindex 778a876f1f4..bf26083820f 100644--- a/app/models/theme.rb+++ b/app/models/theme.rb@@ -250,7 +250,6 @@ class Theme < ActiveRecord::BaseGlobalSetting.s3_endpoint,GlobalSetting.s3_bucket,Discourse.current_hostname,- ENV["ROLLUP_PLUGIN_COMPILER"],]Digest::SHA1.hexdigest(dependencies.join)enddiff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erbindex 78559d5d539..d915c5cfba1 100644--- a/app/views/layouts/application.html.erb+++ b/app/views/layouts/application.html.erb@@ -26,7 +26,7 @@include_unofficial: allow_third_party_plugins?,request: request,include_admin_asset: staff?- }) if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"+ })%><%= build_plugin_html 'server:before-script-load' %>@@ -56,14 +56,6 @@<%= preload_script "vendor" %><%= preload_script "discourse" %>- <%= render("layouts/plugin_js", opts: {- include_official: allow_plugins?,- include_unofficial: allow_third_party_plugins?,- request: request,- include_admin_asset: staff?- }) if ENV["ROLLUP_PLUGIN_COMPILER"] == "0"- %>-<%- if staff? %><% EmberCli.script_chunks["chunk.admin"]&.each do |script_name| %><link rel="preload" href="<%= script_asset_path(script_name) %>" as="script" nonce="<%= csp_nonce_placeholder %>" data-discourse-entrypoint="admin">diff --git a/config/pitchfork.conf.rb b/config/pitchfork.conf.rbindex c8a5bc48ab4..012cf1a936d 100644--- a/config/pitchfork.conf.rb+++ b/config/pitchfork.conf.rb@@ -123,9 +123,7 @@ before_service_worker_ready do |server, service_worker|demon_class.start(1, logger: server.logger)end- if Rails.env.development? && ENV["ROLLUP_PLUGIN_COMPILER"] != "0"- Demon::PluginJsWatcher.start(verbose: true)- end+ Demon::PluginJsWatcher.start(verbose: true) if Rails.env.development?Thread.new dowhile truediff --git a/frontend/asset-processor/babel-replace-imports.js b/frontend/asset-processor/babel-replace-imports.jsindex b64ecd52c4a..7536a6fc205 100644--- a/frontend/asset-processor/babel-replace-imports.js+++ b/frontend/asset-processor/babel-replace-imports.js@@ -16,10 +16,7 @@ export default function (babel) {return;}- if (- globalThis.ROLLUP_PLUGIN_COMPILER !== "0" &&- moduleName.startsWith("discourse/plugins/")- ) {+ if (moduleName.startsWith("discourse/plugins/")) {const parts = moduleName.split("/");path.node.source = t.stringLiteral(`discourse/plugins/${parts[2]}`);diff --git a/frontend/asset-processor/package.json b/frontend/asset-processor/package.jsonindex b5fdfa34626..f2a9e258ff5 100644--- a/frontend/asset-processor/package.json+++ b/frontend/asset-processor/package.json@@ -23,7 +23,6 @@"core-js": "^3.49.0","decorator-transforms": "^2.3.1","discourse": "workspace:0.0.0",- "discourse-plugins": "workspace:1.0.0","ember-cli-htmlbars": "^7.0.0","ember-source": "~6.10.0","ember-this-fallback": "^0.4.0",diff --git a/frontend/asset-processor/theme-rollup.js b/frontend/asset-processor/theme-rollup.jsindex 335cdcd00e8..a4720ccb967 100644--- a/frontend/asset-processor/theme-rollup.js+++ b/frontend/asset-processor/theme-rollup.js@@ -7,7 +7,6 @@ import colocatedBabelPlugin from "ember-cli-htmlbars/lib/colocated-babel-plugin"import { precompile } from "ember-source/ember-template-compiler/index.js";import EmberThisFallback from "ember-this-fallback";import { memfs } from "memfs";-import transformActionSyntax from "discourse-plugins/transform-action-syntax";import { browsers } from "../discourse/config/targets";import babelTransformModuleRenames from "../discourse/lib/babel-transform-module-renames";import AddThemeGlobals from "./add-theme-globals";@@ -20,6 +19,7 @@ import discourseHbs from "./rollup-plugins/discourse-hbs";import discourseTerser from "./rollup-plugins/discourse-terser";import discourseVirtualLoader from "./rollup-plugins/discourse-virtual-loader";import buildEmberTemplateManipulatorPlugin from "./theme-hbs-ast-transforms";+import transformActionSyntax from "./transform-action-syntax";let lastRollupResult;let lastRollupError;diff --git a/frontend/discourse-plugins/transform-action-syntax.js b/frontend/asset-processor/transform-action-syntax.jssimilarity index 100%rename from frontend/discourse-plugins/transform-action-syntax.jsrename to frontend/asset-processor/transform-action-syntax.jsdiff --git a/frontend/deprecation-silencer/index.js b/frontend/deprecation-silencer/index.jsindex 9522a7462d0..eccfe2102f1 100644--- a/frontend/deprecation-silencer/index.js+++ b/frontend/deprecation-silencer/index.js@@ -3,7 +3,6 @@ const SILENCED_WARN_PREFIXES = ['unexpectedly found "', // https://github.com/emberjs/ember.js/issues/19392"The setting 'staticAddonTestSupportTrees'","The setting 'staticAddonTrees'",- "\n\n--------\n+ Your app is using the legacy ember-template-compiler.js AMD bundle", // Remove when ROLLUP_PLUGIN_COMPILER is promoted];class DeprecationSilencer {diff --git a/frontend/discourse-plugins/colocated-template-compiler.js b/frontend/discourse-plugins/colocated-template-compiler.jsdeleted file mode 100644index 04611e3697d..00000000000--- a/frontend/discourse-plugins/colocated-template-compiler.js+++ /dev/null@@ -1,14 +0,0 @@-const ColocatedTemplateProcessor = require("ember-cli-htmlbars/lib/colocated-broccoli-plugin");--module.exports = class DiscoursePluginColocatedTemplateProcessor extends (- ColocatedTemplateProcessor-) {- constructor(tree, rootName) {- super(tree);- this.rootName = rootName;- }-- detectRootName() {- return this.rootName;- }-};diff --git a/frontend/discourse-plugins/index.js b/frontend/discourse-plugins/index.jsdeleted file mode 100644index 20ae85d1015..00000000000--- a/frontend/discourse-plugins/index.js+++ /dev/null@@ -1,276 +0,0 @@-"use strict";--const path = require("path");-const WatchedDir = require("broccoli-source").WatchedDir;-const Funnel = require("broccoli-funnel");-const mergeTrees = require("broccoli-merge-trees");-const fs = require("fs");-const concat = require("broccoli-concat");-const DiscoursePluginColocatedTemplateProcessor = require("./colocated-template-compiler");-const EmberApp = require("ember-cli/lib/broccoli/ember-app");-const transformActionSyntax = require("./transform-action-syntax");--function fixLegacyExtensions(tree) {- return new Funnel(tree, {- getDestinationPath: function (relativePath) {- if (relativePath.endsWith(".es6")) {- return relativePath.slice(0, -4);- }-- return relativePath;- },- });-}--const COLOCATED_CONNECTOR_REGEX =- /^(?<prefix>.*)\/connectors\/(?<outlet>[^\/]+)\/(?<name>[^\/\.]+)\.(?<extension>.+)$/;--// Having connector templates and js in the same directory causes a clash-// when outputting es6 modules. This shim separates colocated connectors-// into separate js / template locations.-function unColocateConnectors(tree) {- return new Funnel(tree, {- getDestinationPath: function (relativePath) {- const match = relativePath.match(COLOCATED_CONNECTOR_REGEX);- if (- match &&- match.groups.extension === "hbs" &&- match.groups.prefix.split("/").pop() !== "templates"- ) {- const { prefix, outlet, name } = match.groups;- return `${prefix}/templates/connectors/${outlet}/${name}.hbs`;- }- if (- match &&- match.groups.extension === "js" &&- match.groups.prefix.split("/").pop() === "templates"- ) {- // Some plugins are colocating connector JS under `/templates`- const { prefix, outlet, name } = match.groups;- const newPrefix = prefix.slice(0, -"/templates".length);- return `${newPrefix}/connectors/${outlet}/${name}.js`;- }- return relativePath;- },- });-}--function namespaceModules(tree, pluginName) {- return new Funnel(tree, {- getDestinationPath: function (relativePath) {- return `discourse/plugins/${pluginName}/${relativePath}`;- },- });-}--function parsePluginName(pluginRbPath) {- const pluginRb = fs.readFileSync(pluginRbPath, "utf8");- // Match parsing logic in `lib/plugin/metadata.rb`- for (const line of pluginRb.split("\n")) {- if (line.startsWith("#")) {- const [attribute, value] = line.slice(1).split(":", 2);- if (attribute.trim() === "name") {- return value.trim();- }- }- }- throw new Error(- `Unable to parse plugin name from metadata in ${pluginRbPath}`- );-}--module.exports = {- name: require("./package").name,-- options: {- ...require("../discourse/lib/common-babel-config")(),-- "ember-this-fallback": {- enableLogging: false,- },- },-- setupPreprocessorRegistry(type, registry) {- if (type === "self") {- const plugin = this._buildActionPlugin();- plugin.parallelBabel = {- requireFile: __filename,- buildUsing: "_buildActionPlugin",- params: {},- };-- registry.add("htmlbars-ast-plugin", plugin);- }- },-- _buildActionPlugin() {- return {- name: "transform-action-syntax",- plugin: transformActionSyntax,- baseDir: transformActionSyntax.baseDir,- cacheKey: transformActionSyntax.cacheKey,- };- },-- pluginInfos() {- const root = path.resolve("../../plugins");- const pluginDirectories = fs- .readdirSync(root, { withFileTypes: true })- .filter(- (dirent) =>- (dirent.isDirectory() || dirent.isSymbolicLink()) &&- !dirent.name.startsWith(".") &&- fs.existsSync(path.resolve(root, dirent.name, "plugin.rb"))- );-- return pluginDirectories.map((directory) => {- const directoryName = directory.name;- const pluginName = parsePluginName(- path.resolve(root, directoryName, "plugin.rb")- );- const jsDirectory = path.resolve(- root,- directoryName,- "assets/javascripts"- );- const adminJsDirectory = path.resolve(- root,- directoryName,- "admin/assets/javascripts"- );- const testDirectory = path.resolve(- root,- directoryName,- "test/javascripts"- );- const configDirectory = path.resolve(root, directoryName, "config");- const hasJs = fs.existsSync(jsDirectory);- const hasAdminJs = fs.existsSync(adminJsDirectory);- const hasTests = fs.existsSync(testDirectory);- const hasConfig = fs.existsSync(configDirectory);-- return {- pluginName,- directoryName,- jsDirectory,- adminJsDirectory,- testDirectory,- configDirectory,- hasJs,- hasAdminJs,- hasTests,- hasConfig,- };- });- },-- generatePluginsTree(withTests) {- if (!this.shouldLoadPlugins()) {- return mergeTrees([]);- }- const trees = [- this._generatePluginAppTree(),- this._generatePluginAdminTree(),- ];- if (withTests) {- trees.push(this._generatePluginTestTree());- }- return mergeTrees(trees);- },-- _generatePluginAppTree() {- const trees = this.pluginInfos()- .filter((p) => p.hasJs)- .map(({ pluginName, directoryName, jsDirectory }) =>- this._buildAppTree({- directory: jsDirectory,- pluginName,- outputFile: `assets/plugins/${directoryName}.js`,- })- );- return mergeTrees(trees);- },-- _generatePluginAdminTree() {- const trees = this.pluginInfos()- .filter((p) => p.hasAdminJs)- .map(({ pluginName, directoryName, adminJsDirectory }) =>- this._buildAppTree({- directory: adminJsDirectory,- pluginName,- outputFile: `assets/plugins/${directoryName}_admin.js`,- })- );- return mergeTrees(trees);- },-- _buildAppTree({ directory, pluginName, outputFile }) {- let tree = new WatchedDir(directory);-- tree = fixLegacyExtensions(tree);- tree = unColocateConnectors(tree);- tree = namespaceModules(tree, pluginName);-- const colocateBase = `discourse/plugins/${pluginName}`;- tree = new DiscoursePluginColocatedTemplateProcessor(- tree,- `${colocateBase}/discourse`- );- tree = new DiscoursePluginColocatedTemplateProcessor(- tree,- `${colocateBase}/admin`- );- tree = this.compileTemplates(tree);-- tree = this.processedAddonJsFiles(tree);-- return concat(mergeTrees([tree]), {- inputFiles: ["**/*.js"],- outputFile,- allowNone: true,- });- },-- _generatePluginTestTree() {- const trees = this.pluginInfos()- .filter((p) => p.hasTests)- .map(({ pluginName, directoryName, testDirectory }) => {- let tree = new WatchedDir(testDirectory);-- tree = fixLegacyExtensions(tree);- tree = namespaceModules(tree, pluginName);- tree = this.processedAddonJsFiles(tree);-- return concat(mergeTrees([tree]), {- inputFiles: ["**/*.js"],- outputFile: `assets/plugins/test/${directoryName}_tests.js`,- allowNone: true,- });- });- return mergeTrees(trees);- },-- shouldCompileTemplates() {- // The base Addon implementation checks for template- // files in the addon directories. We need to override that- // check so that the template compiler always runs.- return true;- },-- // Matches logic from GlobalSetting.load_plugins? in the ruby app- shouldLoadPlugins() {- if (process.env.ROLLUP_PLUGIN_COMPILER !== "0") {- return false;- }-- if (process.env.LOAD_PLUGINS === "1") {- return true;- } else if (process.env.LOAD_PLUGINS === "0") {- return false;- } else if (EmberApp.env() === "test") {- return false;- } else {- return true;- }- },-};diff --git a/frontend/discourse-plugins/package.json b/frontend/discourse-plugins/package.jsondeleted file mode 100644index 1ca0887f9fc..00000000000--- a/frontend/discourse-plugins/package.json+++ /dev/null@@ -1,31 +0,0 @@-{- "name": "discourse-plugins",- "version": "1.0.0",- "description": "An addon providing a broccoli tree for each Discourse plugin",- "author": "Discourse",- "license": "GPL-2.0-only",- "keywords": [- "ember-addon"- ],- "dependencies": {- "@babel/core": "^7.28.5",- "deprecation-silencer": "workspace:1.0.0",- "ember-cli-babel": "^8.2.0",- "ember-cli-htmlbars": "^7.0.0",- "ember-template-imports": "^4.4.0",- "ember-this-fallback": "^0.4.0"- },- "devDependencies": {- "ember-cli": "~6.11.0",- "webpack": "5.99.9"- },- "engines": {- "node": ">= 20",- "npm": "please-use-pnpm",- "yarn": "please-use-pnpm",- "pnpm": "^10"- },- "ember": {- "edition": "default"- }-}diff --git a/frontend/discourse/app/lib/source-identifier.js b/frontend/discourse/app/lib/source-identifier.jsindex 3d131454242..5faa1749ea6 100644--- a/frontend/discourse/app/lib/source-identifier.js+++ b/frontend/discourse/app/lib/source-identifier.js@@ -1,4 +1,3 @@-import { DEBUG } from "@glimmer/env";import getURL from "discourse/lib/get-url";import PreloadStore from "discourse/lib/preload-store";@@ -48,36 +47,7 @@ export default function identifySource(error) {}}- let plugin;-- // Build patterns array dynamically to match plugin files in both development and production- // Order matters: check more specific patterns (_admin) before general ones- const patterns = [];-- // legacy- if (DEBUG) {- patterns.push(- /assets\/plugins\/([\w-]+)_admin\.js/, // Admin UI Development (no fingerprinting)- /assets\/plugins\/([\w-]+)\.js/, // Development (no fingerprinting)- /assets\/plugins\/test\/([\w-]+)_tests\.js/ // Test files- );- }-- // legacy- patterns.push(- /assets\/plugins\/_?([\w-]+)-[0-9a-f]+_admin(?:\.(?:br|gz))?\.js/, // Admin UI Production (with fingerprints)- /assets\/plugins\/_?([\w-]+)-[0-9a-f]+(?:\.(?:br|gz))?\.js/ // Production (with fingerprints)- );-- // new paths (ROLLUP_PLUGIN_COMPILER)- patterns.push(/assets\/(?:js|br|gz)\/plugins\/([\w-]+)_/);-- for (const pattern of patterns) {- plugin = stack.match(pattern)?.[1];- if (plugin) {- break;- }- }+ const plugin = stack.match(/assets\/(?:js|br|gz)\/plugins\/([\w-]+)_/)?.[1];if (plugin) {return {diff --git a/frontend/discourse/ember-cli-build.js b/frontend/discourse/ember-cli-build.jsindex fcfc28e2664..d486eb75c5f 100644--- a/frontend/discourse/ember-cli-build.js+++ b/frontend/discourse/ember-cli-build.js@@ -124,25 +124,14 @@ module.exports = function (defaults) {discourseRoot + "/frontend/discourse/public/assets/scripts/module-shims.js");- const discoursePluginsTree = app.project- .findAddonByName("discourse-plugins")- .generatePluginsTree(app.tests);-app.project.liveReloadFilterPatterns = [/.*\.scss/];const terserPlugin = app.project.findAddonByName("ember-cli-terser");const applyTerser = (tree) => terserPlugin.postprocessTree("all", tree);- const pluginTrees = applyTerser(discoursePluginsTree);-- if (process.env.SKIP_CORE_BUILD) {- return pluginTrees;- }-let extraPublicTrees = [funnel(`${discourseRoot}/public/javascripts`, { destDir: "javascripts" }),applyTerser(generateScriptsTree(app)),- pluginTrees,];const assetCachebuster = process.env["DISCOURSE_ASSET_URL_SALT"] || "";diff --git a/frontend/discourse/package.json b/frontend/discourse/package.jsonindex a66cc178dbf..7f2582dbfdc 100644--- a/frontend/discourse/package.json+++ b/frontend/discourse/package.json@@ -116,7 +116,6 @@"deprecation-silencer": "workspace:1.0.0","discourse-i18n": "workspace:1.0.0","discourse-markdown-it": "workspace:1.0.0",- "discourse-plugins": "workspace:1.0.0","ember-async-data": "^2.0.1","ember-auto-import": "^2.13.0","ember-buffered-proxy": "^2.1.1",diff --git a/frontend/discourse/tests/acceptance/client-error-handler-test.js b/frontend/discourse/tests/acceptance/client-error-handler-test.jsindex 256e77bf196..c16cca8302b 100644--- a/frontend/discourse/tests/acceptance/client-error-handler-test.js+++ b/frontend/discourse/tests/acceptance/client-error-handler-test.js@@ -11,7 +11,7 @@ acceptance("client-error-handler service", function (needs) {test("displays route-loading errors caused by themes", async function (assert) {const fakeError = new Error("Something bad happened");- fakeError.stack = "assets/plugins/some-fake-plugin-name.js";+ fakeError.stack = "assets/js/plugins/fake-plugin_main-faw0x1gl.digested.js";const topicRoute = getOwner(this).lookup("route:topic");Sinon.stub(topicRoute, "model").throws(fakeError);@@ -23,8 +23,6 @@ acceptance("client-error-handler service", function (needs) {consoleStub.restore();assert.dom(".broken-theme-alert-banner").exists();- assert- .dom(".broken-theme-alert-banner")- .containsText("some-fake-plugin-name");+ assert.dom(".broken-theme-alert-banner").containsText("fake-plugin");});});diff --git a/frontend/discourse/tests/setup-tests.js b/frontend/discourse/tests/setup-tests.jsindex 7bc2acb0ec2..b848cf86b0b 100644--- a/frontend/discourse/tests/setup-tests.js+++ b/frontend/discourse/tests/setup-tests.js@@ -396,14 +396,8 @@ export default function setupTests(config) {// core tests run without loading plugins or themesconst isCoreTest = !hasPluginJs && !hasThemeJs;- const isPreinstalledPluginTest = !!(- document.querySelector(- // TODO (ROLLUP_PLUGIN_COMPILER): drop this legacy script tag check- `script[data-plugin-name="${CSS.escape(target)}"][data-preinstalled="true"]`- ) ||- document.querySelector(- `link[rel=modulepreload][data-plugin-name="${CSS.escape(target)}"][data-preinstalled="true"]`- )+ const isPreinstalledPluginTest = !!document.querySelector(+ `link[rel=modulepreload][data-plugin-name="${CSS.escape(target)}"][data-preinstalled="true"]`);if (diff --git a/lib/asset_processor.rb b/lib/asset_processor.rbindex c1495be8d8c..ed354fe2e98 100644--- a/lib/asset_processor.rb+++ b/lib/asset_processor.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueclass AssetProcessor- BASE_COMPILER_VERSION = 107+ BASE_COMPILER_VERSION = 108PROCESSOR_DIR = "tmp/asset-processor"LOCK_FILE = "#{PROCESSOR_DIR}/build.lock"@@ -11,7 +11,6 @@ class AssetProcessorfrontend/asset-processor/**/*.jsfrontend/discourse/lib/babel-transform-module-renames.jsfrontend/discourse/config/targets.js- frontend/discourse-plugins/transform-action-syntax.js]@mutex = Mutex.new@@ -153,7 +152,6 @@ class AssetProcessorsource = load_or_build_processor_source- ctx.eval("globalThis.ROLLUP_PLUGIN_COMPILER = #{ENV["ROLLUP_PLUGIN_COMPILER"].to_json}")ctx.eval(source, filename: "asset-processor.js")ctx.low_memory_notification # GC to free up memory used during initdiff --git a/lib/discourse.rb b/lib/discourse.rbindex 7950d36f848..d7deb9b5120 100644--- a/lib/discourse.rb+++ b/lib/discourse.rb@@ -465,19 +465,14 @@ module Discourseplugins.each do |plugin|if plugin.js_asset_exists?- if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"- if logical_path =- Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "main")- assets << {- name: logical_path,- imports: Plugin::JsManager.import_paths_for(plugin.directory_name, "main"),- plugin: plugin,- type_module: true,- importmap_name: "discourse/plugins/#{plugin.name}",- }- end- else- assets << { name: "plugins/#{plugin.directory_name}", plugin: plugin }+ if logical_path = Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "main")+ assets << {+ name: logical_path,+ imports: Plugin::JsManager.import_paths_for(plugin.directory_name, "main"),+ plugin: plugin,+ type_module: true,+ importmap_name: "discourse/plugins/#{plugin.name}",+ }endend@@ -490,35 +485,26 @@ module Discourseendif args[:include_admin_asset] && plugin.admin_js_asset_exists?- if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"- if logical_path =- Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "admin")- assets << {- name: logical_path,- imports: Plugin::JsManager.import_paths_for(plugin.directory_name, "admin"),- plugin: plugin,- type_module: true,- }- end- else- assets << { name: "plugins/#{plugin.directory_name}_admin", plugin: plugin }+ if logical_path =+ Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "admin")+ assets << {+ name: logical_path,+ imports: Plugin::JsManager.import_paths_for(plugin.directory_name, "admin"),+ plugin: plugin,+ type_module: true,+ }endendif args[:include_test_assets_for]&.include?(plugin.directory_name) &&plugin.test_js_asset_exists?- if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"- if logical_path =- Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "test")- assets << {- name: logical_path,- imports: Plugin::JsManager.import_paths_for(plugin.directory_name, "test"),- plugin: plugin,- type_module: true,- }- end- else- assets << { name: "plugins/test/#{plugin.directory_name}_tests", plugin: plugin }+ if logical_path = Plugin::JsManager.digested_logical_path_for(plugin.directory_name, "test")+ assets << {+ name: logical_path,+ imports: Plugin::JsManager.import_paths_for(plugin.directory_name, "test"),+ plugin: plugin,+ type_module: true,+ }endendenddiff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rakeindex e97765b81c2..67bec8c3e5d 100644--- a/lib/tasks/assets.rake+++ b/lib/tasks/assets.rake@@ -24,11 +24,7 @@ task "assets:precompile:build" doendtask "assets:precompile:build_plugins": "environment" do- if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"- Plugin::JsManager.new.compile!- else- puts "Skipping plugin JS compilation, set ROLLUP_PLUGIN_COMPILER=1 to enable"- end+ Plugin::JsManager.new.compile!endtask "assets:precompile:before": %w[environment assets:precompile:build]diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 9fb452cc584..ae1b119e8e9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -160,9 +160,6 @@ importers:discourse:specifier: workspace:0.0.0version: link:../discourse- discourse-plugins:- specifier: workspace:1.0.0- version: link:../discourse-pluginsember-cli-htmlbars:specifier: ^7.0.0version: 7.0.0(@babel/[email protected])([email protected](patch_hash=85ff9a16d08431e3bdc9aea8d55280e14f437f1c2a7d8e461de56c614ad48926)(@glimmer/[email protected])([email protected]))@@ -506,9 +503,6 @@ importers:discourse-markdown-it:specifier: workspace:1.0.0version: link:../discourse-markdown-it- discourse-plugins:- specifier: workspace:1.0.0- version: link:../discourse-pluginsember-async-data:specifier: ^2.0.1version: 2.0.1(@babel/[email protected])(@glint/[email protected])@@ -663,34 +657,6 @@ importers:specifier: ^1.0.15version: 1.0.15- frontend/discourse-plugins:- dependencies:- '@babel/core':- specifier: ^7.28.5- version: 7.29.0([email protected])- deprecation-silencer:- specifier: workspace:1.0.0- version: link:../deprecation-silencer- ember-cli-babel:- specifier: ^8.2.0- version: 8.3.1(@babel/[email protected])- ember-cli-htmlbars:- specifier: ^7.0.0- version: 7.0.0(@babel/[email protected])([email protected](patch_hash=85ff9a16d08431e3bdc9aea8d55280e14f437f1c2a7d8e461de56c614ad48926)(@glimmer/[email protected])([email protected]))- ember-template-imports:- specifier: ^4.4.0- version: 4.4.0- ember-this-fallback:- specifier: ^0.4.0- version: 0.4.0(patch_hash=31c150a292037db2b05d9030a75069bb0a9518a4a7e0969b9b4e14d957134e45)([email protected](@babel/[email protected])([email protected](patch_hash=85ff9a16d08431e3bdc9aea8d55280e14f437f1c2a7d8e461de56c614ad48926)(@glimmer/[email protected])([email protected])))([email protected](patch_hash=85ff9a16d08431e3bdc9aea8d55280e14f437f1c2a7d8e461de56c614ad48926)(@glimmer/[email protected])([email protected]))- devDependencies:- ember-cli:- specifier: ~6.11.0- version: 6.11.0(@types/[email protected])([email protected])([email protected])([email protected])- webpack:- specifier: 5.99.9- version: 5.99.9(@swc/[email protected])([email protected])-frontend/discourse-types:devDependencies:'@types/node':diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 5260eceac94..6073d7bed43 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -6,7 +6,6 @@ packages:- "frontend/discourse"- "frontend/discourse-i18n"- "frontend/discourse-markdown-it"-- "frontend/discourse-plugins"- "frontend/ember-cli-progress-ci"- "frontend/pretty-text"- "frontend/asset-processor"diff --git a/script/assemble_ember_build.rb b/script/assemble_ember_build.rbindex a7c1b4c1dca..d6cc1a3f75c 100755--- a/script/assemble_ember_build.rb+++ b/script/assemble_ember_build.rb@@ -156,41 +156,16 @@ build_cmd << "-prod" if resolved_ember_env == "production"core_build_reusable =existing_core_build_usable? || (download_prebuild_assets! && existing_core_build_usable?)-if ENV["ROLLUP_PLUGIN_COMPILER"] != "0"- if core_build_reusable- log "Reusing existing core ember build. All done."- else- log "Running full core build..."- system(build_env, *build_cmd, exception: true, chdir: EMBER_APP_DIR)- File.write(BUILD_INFO_FILE, JSON.pretty_generate(build_info))- end- system("bin/rake", "assets:precompile:build_plugins", exception: true)+if core_build_reusable+ log "Reusing existing core ember build. All done."else- if core_build_reusable && ENV["LOAD_PLUGINS"] == "0"- log "Reusing existing core ember build. Plugins not loaded. All done."- elsif core_build_reusable- log "Reusing existing core ember build. Only building plugins..."- build_env["SKIP_CORE_BUILD"] = "1"- build_cmd << "-o" << "dist/_plugin_only_build"- begin- system(build_env, *build_cmd, exception: true, chdir: EMBER_APP_DIR)- FileUtils.rm_rf("#{EMBER_APP_DIR}/dist/assets/plugins")- FileUtils.mv(- "#{EMBER_APP_DIR}/dist/_plugin_only_build/assets/plugins",- "#{EMBER_APP_DIR}/dist/assets/plugins",- )- ensure- FileUtils.rm_rf("#{EMBER_APP_DIR}/dist/_plugin_only_build")- end-- log "Plugin build successfully integrated into dist"- else- log "Running full core build..."- system(build_env, *build_cmd, exception: true, chdir: EMBER_APP_DIR)- File.write(BUILD_INFO_FILE, JSON.pretty_generate(build_info))- end+ log "Running full core build..."+ system(build_env, *build_cmd, exception: true, chdir: EMBER_APP_DIR)+ File.write(BUILD_INFO_FILE, JSON.pretty_generate(build_info))end+system("bin/rake", "assets:precompile:build_plugins", exception: true)+if ARGV.include?("--compress")files = [*Dir.glob("#{EMBER_APP_DIR}/dist/**/*.js"), *Dir.glob("app/assets/generated/**/*.js")]Parallel.map(files, in_threads: 4) do |file|diff --git a/script/publish_built_assets.rb b/script/publish_built_assets.rbindex b940a7fb421..e7709311374 100755--- a/script/publish_built_assets.rb+++ b/script/publish_built_assets.rb@@ -24,7 +24,6 @@ endCOMMON_ENV = {"DISCOURSE_DOWNLOAD_PRE_BUILT_ASSETS" => "0","LOAD_PLUGINS" => "1",- "ROLLUP_PLUGIN_COMPILER" => "1","SKIP_DB_AND_REDIS" => "1",}