discourse/app
Godfrey Chan eb4971cb06
DEV: move xss dependency into core (#23094)
This resolves the issue in #23064.

This issue arises because we need to produce the trees for the
auxilary bundles in `ember-cli-build.js` to pass these trees as
argument to `app.toTree()`. In order to produce these trees, the
code internally need to set up babel, which deep-clones the addons'
babel configs.

When using `@embroider/macros`, the addon's babel config includes a
`MacrosConfig` object which is not supposed to be touched until the
configs are "finalized". In a classic build, the finalization step
happens when `app.toTree()` is called. In Embroider, this happens
somewhere deeper inside `CompatApp`.

We need to produce these auxilary bundle trees before we call
`app.toTree()` or before constructing `CompatApp` because they
need to be passed as arguments to these functions. So this poses a
tricky chicken-and-egg timing issue. It was difficult to find a
workaround for this that works for both the classic and Embroider
build pipeline.

Of all the internal addons that uses the auxilary bundle pattern,
this only affets `pretty-text` as it is (for now, at least) the
only addon that uses `@embroider/macros`.

Taking a step back, the only reason (for now, at least) it was
introduced was for the loader shim for the `xss` package. This
package is actually used inside the lazily loaded markdown-it
bundle. However, we didn't have a better way to include the dep
into the lazy bundle directly, so it ends up going into the main
addon tree, and, inturns, the discourse core bundle.

In core's main loader shim manifest, we already have an entry for
`xss`. This was perhaps a mistake at the time, but it doesn't make
a difference – as mentioned above, `xss` needs to be included into
the main bundle anyway.

So, for now, the simpliest solution is to avoid `@embroider/macros`
in these internal addons for the time being. Ideally we would soon
absorb these back into core as lazily loaded (`import()`-ed) code
managed by Webpack when we fully switch over to Embroider.
2023-08-15 16:13:26 +01:00
..
assets DEV: move xss dependency into core (#23094) 2023-08-15 16:13:26 +01:00
controllers FEATURE: Stream topic summaries. (#23065) 2023-08-11 15:08:49 -03:00
helpers DEV: Correctly strip sourcemap URL from splash-screen js (#22879) 2023-07-31 16:49:27 +01:00
jobs FEATURE: Stream topic summaries. (#23065) 2023-08-11 15:08:49 -03:00
mailers FIX: Order tags shown in email subject by topics count and name (#22586) 2023-07-13 15:39:58 +08:00
models FEATURE: add topic voting webhook event type (#23072) 2023-08-11 13:42:28 -03:00
serializers FEATURE: Stream topic summaries. (#23065) 2023-08-11 15:08:49 -03:00
services FEATURE: Stream topic summaries. (#23065) 2023-08-11 15:08:49 -03:00
views PERF: Avoid calling the same translation twice when rendering lists view (#22976) 2023-08-04 13:38:41 +08:00