-
Notifications
You must be signed in to change notification settings - Fork 91
feat(html): generate VJSC skin templates #2546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mihar-22
merged 7 commits into
feat/vjsc-framework-skin-packages
from
feat/vjsc-html-cdn-templates
Sep 3, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
857b7c4
feat(html): generate VJSC skin templates
mihar-22 4019924
feat(skins): emit source-owned html registry skins
mihar-22 3ba3492
test(skins): harden hosted registry consumers
mihar-22 dcef895
test(skin): refresh html template snapshot
mihar-22 44f3a35
fix(html): generate framework skins before build
mihar-22 eb156e6
fix(site): extract generated HTML skin templates
mihar-22 d3b2371
test(skin): refresh html output snapshot
mihar-22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| /** Verify that every generated skin survives the public CDN build as a browser-ready entry. */ | ||
|
|
||
| import { existsSync, readFileSync } from 'node:fs'; | ||
| import { dirname, relative, resolve } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| import { resolveClosure } from './cdn-graph.ts'; | ||
|
|
||
| const PACKAGE_DIR = resolve(dirname(fileURLToPath(import.meta.url)), '..'); | ||
| const CDN_DIR = resolve(PACKAGE_DIR, 'cdn'); | ||
| const PREFIX = '\x1b[35m[check-cdn-skins]\x1b[0m'; | ||
| const forbiddenRuntime = /(?:virtual:vjsc|vjsc\/components|vjsc\/target|@videojs\/core\/vjsc)/; | ||
| const skins = [ | ||
| { | ||
| entry: 'video', | ||
| generated: 'default-video', | ||
| skinTag: 'video-skin', | ||
| playerTag: 'video-player', | ||
| scope: '.media-skin--video', | ||
| }, | ||
| { | ||
| entry: 'video-minimal', | ||
| generated: 'minimal-video', | ||
| skinTag: 'video-minimal-skin', | ||
| playerTag: 'video-player', | ||
| scope: '.media-skin--minimal.media-skin--video', | ||
| }, | ||
| { | ||
| entry: 'audio', | ||
| generated: 'default-audio', | ||
| skinTag: 'audio-skin', | ||
| playerTag: 'audio-player', | ||
| scope: '.media-skin--audio', | ||
| }, | ||
| { | ||
| entry: 'audio-minimal', | ||
| generated: 'minimal-audio', | ||
| skinTag: 'audio-minimal-skin', | ||
| playerTag: 'audio-player', | ||
| scope: '.media-skin--minimal.media-skin--audio', | ||
| }, | ||
| { | ||
| entry: 'live-video', | ||
| generated: 'default-live-video', | ||
| skinTag: 'live-video-skin', | ||
| playerTag: 'live-video-player', | ||
| scope: '.media-skin--live-video', | ||
| }, | ||
| { | ||
| entry: 'live-video-minimal', | ||
| generated: 'minimal-live-video', | ||
| skinTag: 'live-video-minimal-skin', | ||
| playerTag: 'live-video-player', | ||
| scope: '.media-skin--minimal.media-skin--live-video', | ||
| }, | ||
| { | ||
| entry: 'live-audio', | ||
| generated: 'default-live-audio', | ||
| skinTag: 'live-audio-skin', | ||
| playerTag: 'live-audio-player', | ||
| scope: '.media-skin--live-audio', | ||
| }, | ||
| { | ||
| entry: 'live-audio-minimal', | ||
| generated: 'minimal-live-audio', | ||
| skinTag: 'live-audio-minimal-skin', | ||
| playerTag: 'live-audio-player', | ||
| scope: '.media-skin--minimal.media-skin--live-audio', | ||
| }, | ||
| ] as const; | ||
|
|
||
| function main(): void { | ||
| if (!existsSync(CDN_DIR)) fail(`CDN build not found at ${CDN_DIR}. Run \`pnpm build:cdn\` first.`); | ||
|
|
||
| for (const skin of skins) { | ||
| const stylesheet = readCdn(`${skin.entry}.css`); | ||
|
|
||
| assert(stylesheet.length > 10_000, `${skin.entry}.css is unexpectedly incomplete`); | ||
| assert(stylesheet.includes(skin.scope), `${skin.entry}.css is missing its skin scope`); | ||
|
|
||
| const registration = readSource(`src/internal/skins/${skin.generated}/register.ts`); | ||
| const expectedSources = registrationImports(registration); | ||
|
|
||
| for (const mode of ['dev', 'prod'] as const) { | ||
| const entry = `${skin.entry}${mode === 'dev' ? '.dev' : ''}.js`; | ||
| const closure = resolveClosure(CDN_DIR, [entry]); | ||
| const source = [...closure].map(readCdn).join('\n'); | ||
|
|
||
| assert(source.includes(skin.skinTag), `${entry} does not register ${skin.skinTag}`); | ||
| assert(source.includes(skin.playerTag), `${entry} does not register ${skin.playerTag}`); | ||
| assert(source.includes('<media-container'), `${entry} does not contain its static skin template`); | ||
| assert(!forbiddenRuntime.test(source), `${entry} retains a VJSC compiler runtime reference`); | ||
| assert(existsSync(resolve(CDN_DIR, `${entry}.map`)), `${entry} is missing its source map`); | ||
| assert(readCdn(entry).includes(`sourceMappingURL=${entry}.map`), `${entry} does not reference its source map`); | ||
|
|
||
| const sources = mappedSources(closure); | ||
| const generatedRegister = `src/internal/skins/${skin.generated}/register.ts`; | ||
|
|
||
| assert( | ||
| sources.some((value) => value.endsWith(generatedRegister)), | ||
| `${entry} dropped ${generatedRegister}` | ||
| ); | ||
|
|
||
| for (const expected of expectedSources) { | ||
| assert( | ||
| sources.some((value) => value.endsWith(expected)), | ||
| `${entry} dropped ${expected}` | ||
| ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| console.log(PREFIX, `✅ ${skins.length} skins have dev/prod bundles, complete CSS, and source maps`); | ||
| } | ||
|
|
||
| function readCdn(file: string): string { | ||
| const path = resolve(CDN_DIR, file); | ||
|
|
||
| if (!existsSync(path)) fail(`Expected CDN skin artifact is missing: ${file}`); | ||
|
|
||
| return readFileSync(path, 'utf8'); | ||
| } | ||
|
|
||
| function readSource(file: string): string { | ||
| const path = resolve(PACKAGE_DIR, file); | ||
|
|
||
| if (!existsSync(path)) fail(`Expected generated skin source is missing: ${file}`); | ||
|
|
||
| return readFileSync(path, 'utf8'); | ||
| } | ||
|
|
||
| function mappedSources(files: Iterable<string>): string[] { | ||
| const sources = new Set<string>(); | ||
|
|
||
| for (const file of files) { | ||
| const map = resolve(CDN_DIR, `${file}.map`); | ||
| if (!existsSync(map)) continue; | ||
|
|
||
| const parsed: unknown = JSON.parse(readFileSync(map, 'utf8')); | ||
| if (Object.prototype.toString.call(parsed) !== '[object Object]') continue; | ||
|
|
||
| // SAFETY: The parsed source map was checked to be an object before reading its optional sources field. | ||
| const sourceMap = parsed as { sources?: unknown }; | ||
| if (!Array.isArray(sourceMap.sources)) continue; | ||
|
|
||
| for (const source of sourceMap.sources) { | ||
| if (Object.prototype.toString.call(source) !== '[object String]') continue; | ||
|
|
||
| sources.add(String(source)); | ||
| } | ||
| } | ||
|
|
||
| return [...sources]; | ||
| } | ||
|
|
||
| function registrationImports(registration: string): string[] { | ||
| return [...registration.matchAll(/^import ['"]([^'"]+)['"];$/gm)].map((match) => { | ||
| const source = resolve(PACKAGE_DIR, 'src/internal/skins/default-video', match[1]!); | ||
|
|
||
| return ( | ||
| relative(PACKAGE_DIR, source) | ||
| .replaceAll('\\', '/') | ||
| .replace(/\.[cm]?[jt]s$/, '') + '.ts' | ||
| ); | ||
| }); | ||
| } | ||
|
|
||
| function assert(condition: boolean, message: string): asserts condition { | ||
| if (!condition) fail(message); | ||
| } | ||
|
|
||
| function fail(message: string): never { | ||
| console.error(PREFIX, '\x1b[31merror:\x1b[0m', message); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| @import "../global.css"; | ||
| @import "../shared.css"; | ||
| @import "@videojs/skins/minimal/css/audio.css"; | ||
| @import "../../internal/skins/minimal-audio/skin.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { MinimalAudioSkinElement } from '../../presets/audio/minimal-skin'; | ||
| import { safeDefine } from '../../registration/safe-define'; | ||
| import './minimal-ui'; | ||
| import '../../internal/skins/minimal-audio/register'; | ||
|
|
||
| safeDefine(MinimalAudioSkinElement); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| @import "../global.css"; | ||
| @import "../shared.css"; | ||
| @import "@videojs/skins/default/css/audio.css"; | ||
| @import "../../internal/skins/default-audio/skin.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { AudioSkinElement } from '../../presets/audio/skin'; | ||
| import { safeDefine } from '../../registration/safe-define'; | ||
| import './ui'; | ||
| import '../../internal/skins/default-audio/register'; | ||
|
|
||
| safeDefine(AudioSkinElement); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| @import "../global.css"; | ||
| @import "../shared.css"; | ||
| @import "@videojs/skins/minimal/css/audio.css"; | ||
| @import "../../internal/skins/minimal-live-audio/skin.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { MinimalLiveAudioSkinElement } from '../../presets/live-audio/minimal-skin'; | ||
| import { safeDefine } from '../../registration/safe-define'; | ||
| import './minimal-ui'; | ||
| import '../../internal/skins/minimal-live-audio/register'; | ||
|
|
||
| safeDefine(MinimalLiveAudioSkinElement); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| @import "../global.css"; | ||
| @import "../shared.css"; | ||
| @import "@videojs/skins/default/css/audio.css"; | ||
| @import "../../internal/skins/default-live-audio/skin.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { LiveAudioSkinElement } from '../../presets/live-audio/skin'; | ||
| import { safeDefine } from '../../registration/safe-define'; | ||
| import './ui'; | ||
| import '../../internal/skins/default-live-audio/register'; | ||
|
|
||
| safeDefine(LiveAudioSkinElement); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| @import "../global.css"; | ||
| @import "../shared.css"; | ||
| @import "@videojs/skins/minimal/css/video.css"; | ||
| @import "../../internal/skins/minimal-live-video/skin.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { MinimalLiveVideoSkinElement } from '../../presets/live-video/minimal-skin'; | ||
| import { safeDefine } from '../../registration/safe-define'; | ||
| import './minimal-ui'; | ||
| import '../../internal/skins/minimal-live-video/register'; | ||
|
|
||
| safeDefine(MinimalLiveVideoSkinElement); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| @import "../global.css"; | ||
| @import "../shared.css"; | ||
| @import "@videojs/skins/default/css/video.css"; | ||
| @import "../../internal/skins/default-live-video/skin.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { LiveVideoSkinElement } from '../../presets/live-video/skin'; | ||
| import { safeDefine } from '../../registration/safe-define'; | ||
| import './ui'; | ||
| import '../../internal/skins/default-live-video/register'; | ||
|
|
||
| safeDefine(LiveVideoSkinElement); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skin registers omitted from sideEffects
High Severity
Generated skin
registermodules are side-effect-only (baredefine/ui/*imports plusregisterIcons()), butpackage.jsonsideEffectsstill lists onlydefine/**, i18n, and icon element paths. The Vite pack config now treats/internal/skins/*/registeras side-effectful so this package's own build keeps them; consumer bundlers that honorsideEffects(webpack, Vite/Rollup production) do not. Importing a skin or preset can drop the register graph, leave template tags as plainHTMLElement, and throw on methods such assetSyncedText.Additional Locations (1)
packages/html/vite.config.ts#L80-L90Reviewed by Cursor Bugbot for commit d3b2371. Configure here.