discourse/app/assets/javascripts/pretty-text/addon
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
..
emoji DEV: Update javascript:update_constants rake task following template colocation (#20365) 2023-02-20 06:20:47 +03:00
engines DEV: Remove enable_experimental_hashtag_autocomplete logic (#22820) 2023-08-08 11:18:55 +10:00
allow-lister.js A11Y: Set role=presentation if alt attr is missing (#18546) 2022-10-12 14:07:37 +03:00
censored-words.js DEV: Ensure censorFn copes with null regexpList (#17754) 2022-08-02 11:09:51 +01:00
emoji.js FIX: Use only first character when looking up emoji (#22977) 2023-08-04 15:28:58 +02:00
guid.js DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
highlightjs-aliases.js DEV: Add support for aliases in HighlightJS languages (#20380) 2023-02-23 15:06:06 -05:00
inline-oneboxer.js DEV: removes jquery usage from onebox (#14683) 2021-10-22 13:15:46 +02:00
mentions.js FEATURE: Enforce mention limits for chat messages (#19034) 2022-12-06 14:54:04 -03:00
oneboxer-cache.js DEV: removes jquery usage from onebox (#14683) 2021-10-22 13:15:46 +02:00
oneboxer.js DEV: Introduce discourseLater (#17532) 2022-07-17 00:50:49 +02:00
pretty-text.js DEV: move xss dependency into core (#23094) 2023-08-15 16:13:26 +01:00
sanitizer.js FIX: skip iframe URLs with relative paths in pretty text sanitizer. (#21714) 2023-05-24 16:14:18 +05:30
upload-short-url.js DEV: Rename secure_media to secure_uploads (#18376) 2022-09-29 09:24:33 +10:00