media-chrome
media-chrome copied to clipboard
Add custom elements manifest analyzer + plugin
This change is the start for adding a custom elements manifest. Related to https://github.com/muxinc/media-chrome/discussions/158
A little downside of Media Chrome using constant variables is that the analyzer can't pick the attributes and events up automatically. An alternative is to use special JSDoc syntax to get these picked up. https://custom-elements-manifest.open-wc.org/analyzer/getting-started/#supported-jsdoc
I added one example for the Airplay button.
The custom function defineCustomElement()
in Media Chrome was causing issues too, luckily this could be automated with a plugin. The analyzer expects customElements.define('my-el')
.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/mux/media-chrome/6RLsix52QwF6g4nNnCYkMkjpZZtK
✅ Preview: https://media-chrome-git-fork-luwes-custom-elements-manifest-mux.vercel.app
Since this is all built on tsc plugins using its AST model, we should be able to build something that works with our constants. Do you think this would be a value add at this stage without also updating the jsdoc comments?
@cjpillsbury yes, I think it was possible with Babel, https://github.com/wooorm/babel-plugin-inline-constants. maybe TS too, might be worth trying out
closing until we get to this