0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-04 10:39:43 +08:00
discourse/frontend/asset-processor
Sérgio Saquetim a8b1606ff8
DEV: Derive styleguide code samples from the rendered example (#42100)
DEV: Keep styleguide samples synchronized with source

Styleguide code samples were hand-written strings that could silently drift
from the markup they described. This caused the char counter sample to
advertise a nonexistent `CharCounter` module while rendering
`DCharCounter`.

Add a `discourse-source-imports` bundler plugin that imports another module's
untranspiled source as a string. `?source=file` returns the complete file,
while `?source=template` extracts the contents of the module's single
`<template>` block. Imports use normal module resolution and pass the result
to `StyleguideExample` through its `@code` argument.

Move the spinner and char counter examples into `components/examples/` and
source their displayed code through the new plugin.

Register the plugin with both the core Rolldown build and the asset processor.
Each pipeline injects its own `readSource(id)` implementation: the asset
processor reads from its in-memory module map, while core reads from disk and
rejects paths outside the project root.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2026-07-29 13:48:35 -03:00
..
rollup-plugins DEV: add typescript support for core, themes and plugins (#41478) 2026-07-08 12:57:18 +01:00
add-theme-globals.js
add-theme-globals.test.mjs
asset-processor-rollup.js DEV: Derive styleguide code samples from the rendered example (#42100) 2026-07-29 13:48:35 -03:00
babel-resolve-core-imports.js DEV: Improve cross-plugin/theme import handling (#40939) 2026-06-30 16:11:38 +01:00
babel-resolve-core-imports.test.mjs DEV: Improve cross-plugin/theme import handling (#40939) 2026-06-30 16:11:38 +01:00
babel-resolve-plugin-imports.js DEV: Improve cross-plugin/theme import handling (#40939) 2026-06-30 16:11:38 +01:00
babel-resolve-plugin-imports.test.mjs DEV: Improve cross-plugin/theme import handling (#40939) 2026-06-30 16:11:38 +01:00
build.mjs DEV: Derive styleguide code samples from the rendered example (#42100) 2026-07-29 13:48:35 -03:00
content-tag.js
discourse-import-attribute.js DEV: Improve cross-plugin/theme import handling (#40939) 2026-06-30 16:11:38 +01:00
discourse-source-imports.test.mjs DEV: Derive styleguide code samples from the rendered example (#42100) 2026-07-29 13:48:35 -03:00
noop.js
os-shim.js DEV: Bump babel plugin in asset-processor and stub workerpool (#40438) 2026-06-01 10:54:43 +01:00
package.json DEV: add typescript support for core, themes and plugins (#41478) 2026-07-08 12:57:18 +01:00
postcss-variable-prefixer.js
postcss.js Revert "FEATURE: discourse-workflows (#39704)" (#40366) 2026-05-28 13:59:42 +01:00
rollup-virtual-imports.js DEV: add typescript support for core, themes and plugins (#41478) 2026-07-08 12:57:18 +01:00
shims.js
theme-hbs-ast-transforms.js
transform-action-syntax.js
transpiler.js DEV: Rename theme-rollup -> asset-processor-rollup (#41085) 2026-06-22 14:45:56 +01:00
url-polyfill.js
virtual-fs.js
workerpool-shim.js DEV: Bump babel plugin in asset-processor and stub workerpool (#40438) 2026-06-01 10:54:43 +01:00