mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:39:43 +08:00
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> |
||
|---|---|---|
| .. | ||
| rollup-plugins | ||
| add-theme-globals.js | ||
| add-theme-globals.test.mjs | ||
| asset-processor-rollup.js | ||
| babel-resolve-core-imports.js | ||
| babel-resolve-core-imports.test.mjs | ||
| babel-resolve-plugin-imports.js | ||
| babel-resolve-plugin-imports.test.mjs | ||
| build.mjs | ||
| content-tag.js | ||
| discourse-import-attribute.js | ||
| discourse-source-imports.test.mjs | ||
| noop.js | ||
| os-shim.js | ||
| package.json | ||
| postcss-variable-prefixer.js | ||
| postcss.js | ||
| rollup-virtual-imports.js | ||
| shims.js | ||
| theme-hbs-ast-transforms.js | ||
| transform-action-syntax.js | ||
| transpiler.js | ||
| url-polyfill.js | ||
| virtual-fs.js | ||
| workerpool-shim.js | ||