videowright 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/dist/cli/argv.d.ts +28 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +115 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/bin.d.ts +7 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +10 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/dev.d.ts +19 -0
- package/dist/cli/dev.d.ts.map +1 -0
- package/dist/cli/dev.js +104 -0
- package/dist/cli/dev.js.map +1 -0
- package/dist/cli/discover.d.ts +29 -0
- package/dist/cli/discover.d.ts.map +1 -0
- package/dist/cli/discover.js +104 -0
- package/dist/cli/discover.js.map +1 -0
- package/dist/cli/discover_project.d.ts +29 -0
- package/dist/cli/discover_project.d.ts.map +1 -0
- package/dist/cli/discover_project.js +108 -0
- package/dist/cli/discover_project.js.map +1 -0
- package/dist/cli/errors.d.ts +10 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +13 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/ffmpeg.d.ts +57 -0
- package/dist/cli/ffmpeg.d.ts.map +1 -0
- package/dist/cli/ffmpeg.js +122 -0
- package/dist/cli/ffmpeg.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +152 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/playwright_check.d.ts +44 -0
- package/dist/cli/playwright_check.d.ts.map +1 -0
- package/dist/cli/playwright_check.js +20 -0
- package/dist/cli/playwright_check.js.map +1 -0
- package/dist/cli/prompt.d.ts +13 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +47 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/render.d.ts +60 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +471 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/script_cmd.d.ts +26 -0
- package/dist/cli/script_cmd.d.ts.map +1 -0
- package/dist/cli/script_cmd.js +88 -0
- package/dist/cli/script_cmd.js.map +1 -0
- package/dist/cli/time_shim.d.ts +44 -0
- package/dist/cli/time_shim.d.ts.map +1 -0
- package/dist/cli/time_shim.js +390 -0
- package/dist/cli/time_shim.js.map +1 -0
- package/dist/cli/ts_loader.d.ts +28 -0
- package/dist/cli/ts_loader.d.ts.map +1 -0
- package/dist/cli/ts_loader.js +95 -0
- package/dist/cli/ts_loader.js.map +1 -0
- package/dist/cli/vite_helpers.d.ts +62 -0
- package/dist/cli/vite_helpers.d.ts.map +1 -0
- package/dist/cli/vite_helpers.js +273 -0
- package/dist/cli/vite_helpers.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/player/hash_router.d.ts +23 -0
- package/dist/player/hash_router.d.ts.map +1 -0
- package/dist/player/hash_router.js +49 -0
- package/dist/player/hash_router.js.map +1 -0
- package/dist/player/hud.d.ts +33 -0
- package/dist/player/hud.d.ts.map +1 -0
- package/dist/player/hud.js +357 -0
- package/dist/player/hud.js.map +1 -0
- package/dist/player/index.d.ts +123 -0
- package/dist/player/index.d.ts.map +1 -0
- package/dist/player/index.js +848 -0
- package/dist/player/index.js.map +1 -0
- package/dist/player/input.d.ts +14 -0
- package/dist/player/input.d.ts.map +1 -0
- package/dist/player/input.js +90 -0
- package/dist/player/input.js.map +1 -0
- package/dist/player/slot.d.ts +22 -0
- package/dist/player/slot.d.ts.map +1 -0
- package/dist/player/slot.js +43 -0
- package/dist/player/slot.js.map +1 -0
- package/dist/player/transitions/cut.d.ts +7 -0
- package/dist/player/transitions/cut.d.ts.map +1 -0
- package/dist/player/transitions/cut.js +9 -0
- package/dist/player/transitions/cut.js.map +1 -0
- package/dist/player/transitions/fade.d.ts +7 -0
- package/dist/player/transitions/fade.d.ts.map +1 -0
- package/dist/player/transitions/fade.js +18 -0
- package/dist/player/transitions/fade.js.map +1 -0
- package/dist/player/transitions/index.d.ts +4 -0
- package/dist/player/transitions/index.d.ts.map +1 -0
- package/dist/player/transitions/index.js +4 -0
- package/dist/player/transitions/index.js.map +1 -0
- package/dist/player/transitions/slide.d.ts +6 -0
- package/dist/player/transitions/slide.d.ts.map +1 -0
- package/dist/player/transitions/slide.js +35 -0
- package/dist/player/transitions/slide.js.map +1 -0
- package/dist/script/index.d.ts +2 -0
- package/dist/script/index.d.ts.map +1 -0
- package/dist/script/index.js +2 -0
- package/dist/script/index.js.map +1 -0
- package/dist/script/script.d.ts +10 -0
- package/dist/script/script.d.ts.map +1 -0
- package/dist/script/script.js +41 -0
- package/dist/script/script.js.map +1 -0
- package/dist/segment/SegmentRunner.d.ts +52 -0
- package/dist/segment/SegmentRunner.d.ts.map +1 -0
- package/dist/segment/SegmentRunner.js +187 -0
- package/dist/segment/SegmentRunner.js.map +1 -0
- package/dist/segment/defineConfig.d.ts +6 -0
- package/dist/segment/defineConfig.d.ts.map +1 -0
- package/dist/segment/defineConfig.js +7 -0
- package/dist/segment/defineConfig.js.map +1 -0
- package/dist/segment/defineSegment.d.ts +7 -0
- package/dist/segment/defineSegment.d.ts.map +1 -0
- package/dist/segment/defineSegment.js +25 -0
- package/dist/segment/defineSegment.js.map +1 -0
- package/dist/segment/index.d.ts +5 -0
- package/dist/segment/index.d.ts.map +1 -0
- package/dist/segment/index.js +4 -0
- package/dist/segment/index.js.map +1 -0
- package/dist/timeline/index.d.ts +73 -0
- package/dist/timeline/index.d.ts.map +1 -0
- package/dist/timeline/index.js +142 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/loadAudioTrack.d.ts +18 -0
- package/dist/timeline/loadAudioTrack.d.ts.map +1 -0
- package/dist/timeline/loadAudioTrack.js +44 -0
- package/dist/timeline/loadAudioTrack.js.map +1 -0
- package/dist/timeline/loadVoiceover.d.ts +18 -0
- package/dist/timeline/loadVoiceover.d.ts.map +1 -0
- package/dist/timeline/loadVoiceover.js +38 -0
- package/dist/timeline/loadVoiceover.js.map +1 -0
- package/dist/timeline/resolveTiming.d.ts +28 -0
- package/dist/timeline/resolveTiming.d.ts.map +1 -0
- package/dist/timeline/resolveTiming.js +63 -0
- package/dist/timeline/resolveTiming.js.map +1 -0
- package/dist/timeline/validateTiming.d.ts +29 -0
- package/dist/timeline/validateTiming.d.ts.map +1 -0
- package/dist/timeline/validateTiming.js +62 -0
- package/dist/timeline/validateTiming.js.map +1 -0
- package/dist/types.d.ts +216 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
- package/skill/SKILL.md +64 -0
- package/skill/assets/hello_world/PLAN.md +31 -0
- package/skill/assets/hello_world/README.md +27 -0
- package/skill/assets/hello_world/audio/audio_plan.md +14 -0
- package/skill/assets/hello_world/segments/hello_intro.ts +69 -0
- package/skill/assets/hello_world/segments/hello_outro.ts +71 -0
- package/skill/assets/hello_world/timeline.ts +15 -0
- package/skill/assets/hello_world/voiceover_script/script.md +10 -0
- package/skill/assets/install/package.json +10 -0
- package/skill/assets/install/tsconfig.json +23 -0
- package/skill/assets/styles/editorial-mono/STYLE.md +124 -0
- package/skill/assets/styles/editorial-mono/brand.md +85 -0
- package/skill/assets/styles/editorial-mono/reference/animations.jsx +752 -0
- package/skill/assets/styles/editorial-mono/reference/scenes.html +563 -0
- package/skill/assets/styles/editorial-mono/sample/bullet.ts +101 -0
- package/skill/assets/styles/editorial-mono/sample/content.ts +104 -0
- package/skill/assets/styles/editorial-mono/sample/cta.ts +113 -0
- package/skill/assets/styles/editorial-mono/sample/feature.ts +111 -0
- package/skill/assets/styles/editorial-mono/sample/grid.ts +97 -0
- package/skill/assets/styles/editorial-mono/sample/kinetic.ts +96 -0
- package/skill/assets/styles/editorial-mono/sample/section.ts +101 -0
- package/skill/assets/styles/editorial-mono/sample/stat.ts +128 -0
- package/skill/assets/styles/editorial-mono/sample/title.ts +97 -0
- package/skill/assets/styles/editorial-mono/sample/ui-showcase.ts +159 -0
- package/skill/assets/styles/editorial-mono/tokens.css +44 -0
- package/skill/assets/styles/iso-diagram/STYLE.md +109 -0
- package/skill/assets/styles/iso-diagram/brand.md +32 -0
- package/skill/assets/styles/iso-diagram/reference/animations.jsx +673 -0
- package/skill/assets/styles/iso-diagram/reference/scenes.html +427 -0
- package/skill/assets/styles/iso-diagram/sample/bullet.ts +144 -0
- package/skill/assets/styles/iso-diagram/sample/content.ts +192 -0
- package/skill/assets/styles/iso-diagram/sample/cta.ts +162 -0
- package/skill/assets/styles/iso-diagram/sample/feature.ts +205 -0
- package/skill/assets/styles/iso-diagram/sample/grid.ts +181 -0
- package/skill/assets/styles/iso-diagram/sample/kinetic.ts +102 -0
- package/skill/assets/styles/iso-diagram/sample/section.ts +149 -0
- package/skill/assets/styles/iso-diagram/sample/stat.ts +164 -0
- package/skill/assets/styles/iso-diagram/sample/title.ts +173 -0
- package/skill/assets/styles/iso-diagram/sample/ui-showcase.ts +162 -0
- package/skill/assets/styles/iso-diagram/tokens.css +40 -0
- package/skill/assets/styles/motion-engineering/STYLE.md +106 -0
- package/skill/assets/styles/motion-engineering/brand.md +29 -0
- package/skill/assets/styles/motion-engineering/reference/animations.jsx +673 -0
- package/skill/assets/styles/motion-engineering/reference/scenes.html +513 -0
- package/skill/assets/styles/motion-engineering/sample/bullet.ts +176 -0
- package/skill/assets/styles/motion-engineering/sample/content.ts +228 -0
- package/skill/assets/styles/motion-engineering/sample/cta.ts +209 -0
- package/skill/assets/styles/motion-engineering/sample/feature.ts +299 -0
- package/skill/assets/styles/motion-engineering/sample/grid.ts +190 -0
- package/skill/assets/styles/motion-engineering/sample/kinetic.ts +159 -0
- package/skill/assets/styles/motion-engineering/sample/section.ts +196 -0
- package/skill/assets/styles/motion-engineering/sample/stat.ts +230 -0
- package/skill/assets/styles/motion-engineering/sample/title.ts +219 -0
- package/skill/assets/styles/motion-engineering/sample/ui-showcase.ts +267 -0
- package/skill/assets/styles/motion-engineering/tokens.css +40 -0
- package/skill/assets/styles/neon-terminal/STYLE.md +105 -0
- package/skill/assets/styles/neon-terminal/brand.md +27 -0
- package/skill/assets/styles/neon-terminal/reference/animations.jsx +673 -0
- package/skill/assets/styles/neon-terminal/reference/scenes.html +387 -0
- package/skill/assets/styles/neon-terminal/sample/bullet.ts +113 -0
- package/skill/assets/styles/neon-terminal/sample/content.ts +117 -0
- package/skill/assets/styles/neon-terminal/sample/cta.ts +131 -0
- package/skill/assets/styles/neon-terminal/sample/feature.ts +112 -0
- package/skill/assets/styles/neon-terminal/sample/grid.ts +128 -0
- package/skill/assets/styles/neon-terminal/sample/kinetic.ts +105 -0
- package/skill/assets/styles/neon-terminal/sample/section.ts +96 -0
- package/skill/assets/styles/neon-terminal/sample/stat.ts +123 -0
- package/skill/assets/styles/neon-terminal/sample/title.ts +122 -0
- package/skill/assets/styles/neon-terminal/sample/ui-showcase.ts +127 -0
- package/skill/assets/styles/neon-terminal/tokens.css +39 -0
- package/skill/assets/styles/risograph/STYLE.md +110 -0
- package/skill/assets/styles/risograph/brand.md +26 -0
- package/skill/assets/styles/risograph/reference/animations.jsx +673 -0
- package/skill/assets/styles/risograph/reference/scenes.html +403 -0
- package/skill/assets/styles/risograph/sample/bullet.ts +124 -0
- package/skill/assets/styles/risograph/sample/content.ts +135 -0
- package/skill/assets/styles/risograph/sample/cta.ts +149 -0
- package/skill/assets/styles/risograph/sample/feature.ts +152 -0
- package/skill/assets/styles/risograph/sample/grid.ts +123 -0
- package/skill/assets/styles/risograph/sample/kinetic.ts +125 -0
- package/skill/assets/styles/risograph/sample/section.ts +130 -0
- package/skill/assets/styles/risograph/sample/stat.ts +145 -0
- package/skill/assets/styles/risograph/sample/title.ts +132 -0
- package/skill/assets/styles/risograph/sample/ui-showcase.ts +147 -0
- package/skill/assets/styles/risograph/tokens.css +39 -0
- package/skill/assets/styles/swiss-console/STYLE.md +107 -0
- package/skill/assets/styles/swiss-console/brand.md +37 -0
- package/skill/assets/styles/swiss-console/reference/animations.jsx +673 -0
- package/skill/assets/styles/swiss-console/reference/scenes.html +420 -0
- package/skill/assets/styles/swiss-console/sample/bullet.ts +122 -0
- package/skill/assets/styles/swiss-console/sample/content.ts +137 -0
- package/skill/assets/styles/swiss-console/sample/cta.ts +109 -0
- package/skill/assets/styles/swiss-console/sample/feature.ts +163 -0
- package/skill/assets/styles/swiss-console/sample/grid.ts +145 -0
- package/skill/assets/styles/swiss-console/sample/kinetic.ts +117 -0
- package/skill/assets/styles/swiss-console/sample/section.ts +127 -0
- package/skill/assets/styles/swiss-console/sample/stat.ts +148 -0
- package/skill/assets/styles/swiss-console/sample/title.ts +148 -0
- package/skill/assets/styles/swiss-console/sample/ui-showcase.ts +198 -0
- package/skill/assets/styles/swiss-console/tokens.css +39 -0
- package/skill/install/INSTALL.md +400 -0
- package/skill/references/audio/audio_plan.md +199 -0
- package/skill/references/audio/build.md +208 -0
- package/skill/references/audio/cue_template.md +219 -0
- package/skill/references/audio/ffmpeg_cookbook.md +267 -0
- package/skill/references/audio/music/music.md +171 -0
- package/skill/references/audio/music/providers/elevenlabs.md +170 -0
- package/skill/references/audio/music/providers/manual.md +140 -0
- package/skill/references/audio/music/providers/openverse.md +265 -0
- package/skill/references/audio/sfx/providers/elevenlabs.md +152 -0
- package/skill/references/audio/sfx/providers/manual.md +117 -0
- package/skill/references/audio/sfx/providers/openverse.md +243 -0
- package/skill/references/audio/sfx/sfx.md +149 -0
- package/skill/references/audio/styles.md +102 -0
- package/skill/references/audio/sync.md +237 -0
- package/skill/references/audio/voiceover/animation_sync.md +142 -0
- package/skill/references/audio/voiceover/provider_script.md +153 -0
- package/skill/references/audio/voiceover/providers/elevenlabs.md +288 -0
- package/skill/references/audio/voiceover/providers/manual.md +100 -0
- package/skill/references/audio/voiceover/script_writing.md +100 -0
- package/skill/references/audio/voiceover/style_intake.md +56 -0
- package/skill/references/audio/voiceover/sync_algorithm.md +167 -0
- package/skill/references/audio/voiceover.md +296 -0
- package/skill/references/audio.md +135 -0
- package/skill/references/authoring_segment.md +446 -0
- package/skill/references/create_or_edit_video.md +232 -0
- package/skill/references/dev_server.md +157 -0
- package/skill/references/export.md +145 -0
- package/skill/references/new_video.md +117 -0
- package/skill/references/project_structure.md +144 -0
- package/skill/references/setup.md +109 -0
- package/skill/references/setup_new_style.md +158 -0
- package/skill/references/styles.md +154 -0
- package/skill/references/testing.md +115 -0
- package/skill/references/types.md +240 -0
- package/src/cli/entry/components/copy_button.ts +42 -0
- package/src/cli/entry/components/download_modal.ts +204 -0
- package/src/cli/entry/components/empty_state.ts +55 -0
- package/src/cli/entry/components/hide_hud_tab.ts +37 -0
- package/src/cli/entry/components/icons.ts +31 -0
- package/src/cli/entry/components/top_bar.ts +69 -0
- package/src/cli/entry/components/video_card.ts +57 -0
- package/src/cli/entry/dev_frame.ts +189 -0
- package/src/cli/entry/entry_index.ts +16 -0
- package/src/cli/entry/entry_video.ts +24 -0
- package/src/cli/entry/index.html +12 -0
- package/src/cli/entry/parse_slug.ts +14 -0
- package/src/cli/entry/render.html +17 -0
- package/src/cli/entry/render_entry.ts +121 -0
- package/src/cli/entry/styles/base.css +45 -0
- package/src/cli/entry/styles/components.css +605 -0
- package/src/cli/entry/styles/tokens.css +44 -0
- package/src/cli/entry/video.html +22 -0
- package/src/cli/entry/views/homepage.ts +66 -0
- package/src/cli/entry/views/video_view.ts +286 -0
- package/src/cli/entry/virtual.d.ts +8 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime TS module loader for Node using tsx.
|
|
3
|
+
* Used by the CLI to import .ts config and timeline files without a build step.
|
|
4
|
+
*/
|
|
5
|
+
import { register } from "node:module";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
7
|
+
/**
|
|
8
|
+
* Inline ESM loader hooks that treat browser-only asset imports (.css, .svg,
|
|
9
|
+
* .png, font files, etc.) as empty modules.
|
|
10
|
+
*
|
|
11
|
+
* Consumer timeline.ts files typically import their style's tokens.css at the
|
|
12
|
+
* top level (e.g. `import '../../styles/modern/tokens.css'`). Vite handles
|
|
13
|
+
* this in the browser, but when the CLI loads timeline.ts via tsx for parsing,
|
|
14
|
+
* Node's ESM loader rejects the unknown extension. These hooks intercept such
|
|
15
|
+
* imports and return an empty module so the CLI can parse the timeline without
|
|
16
|
+
* needing the CSS content.
|
|
17
|
+
*
|
|
18
|
+
* The hooks are registered via `module.register()` with a data: URL to avoid
|
|
19
|
+
* filesystem path issues between source (TypeScript) and compiled (JavaScript)
|
|
20
|
+
* contexts.
|
|
21
|
+
*/
|
|
22
|
+
const ASSET_HOOKS_SOURCE = `
|
|
23
|
+
const ASSET_EXTS = new Set([
|
|
24
|
+
'.css', '.scss', '.sass', '.less', '.styl', '.stylus',
|
|
25
|
+
'.svg', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.avif', '.ico',
|
|
26
|
+
'.woff', '.woff2', '.eot', '.ttf', '.otf',
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
function isAsset(s) {
|
|
30
|
+
const q = s.indexOf('?');
|
|
31
|
+
const clean = q >= 0 ? s.slice(0, q) : s;
|
|
32
|
+
const dot = clean.lastIndexOf('.');
|
|
33
|
+
return dot >= 0 && ASSET_EXTS.has(clean.slice(dot).toLowerCase());
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
37
|
+
if (isAsset(specifier)) {
|
|
38
|
+
return { url: 'asset-noop:' + specifier, shortCircuit: true };
|
|
39
|
+
}
|
|
40
|
+
return nextResolve(specifier, context);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function load(url, context, nextLoad) {
|
|
44
|
+
if (url.startsWith('asset-noop:')) {
|
|
45
|
+
return { format: 'module', source: 'export default {};', shortCircuit: true };
|
|
46
|
+
}
|
|
47
|
+
return nextLoad(url, context);
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
let assetHooksRegistered = false;
|
|
51
|
+
function ensureAssetHooks() {
|
|
52
|
+
if (assetHooksRegistered)
|
|
53
|
+
return;
|
|
54
|
+
register(`data:text/javascript,${encodeURIComponent(ASSET_HOOKS_SOURCE)}`, import.meta.url);
|
|
55
|
+
assetHooksRegistered = true;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Dynamically import a TypeScript module from Node at runtime.
|
|
59
|
+
* Returns the module's namespace (use .default for default exports).
|
|
60
|
+
*
|
|
61
|
+
* ## tsx double-wrap heuristic
|
|
62
|
+
*
|
|
63
|
+
* When tsx loads a CommonJS-style module (or a module with `export default`),
|
|
64
|
+
* it may produce a namespace like:
|
|
65
|
+
*
|
|
66
|
+
* { default: { __esModule: true, default: <actual-value> } }
|
|
67
|
+
*
|
|
68
|
+
* This happens because tsx transpiles `export default X` to
|
|
69
|
+
* `module.exports.default = X` + `module.exports.__esModule = true`, then
|
|
70
|
+
* the ESM interop layer wraps the whole `module.exports` as the default export.
|
|
71
|
+
*
|
|
72
|
+
* We detect this pattern (an object default with both __esModule and default keys)
|
|
73
|
+
* and unwrap it so callers always see `{ default: <actual-value>, ... }`.
|
|
74
|
+
*
|
|
75
|
+
* If tsx changes this behavior in future versions, the detection is conservative:
|
|
76
|
+
* we only unwrap when both sentinel keys are present, so a legitimate object
|
|
77
|
+
* with those keys would be the only false positive (extremely unlikely in practice).
|
|
78
|
+
*/
|
|
79
|
+
export async function loadModule(modulePath) {
|
|
80
|
+
ensureAssetHooks();
|
|
81
|
+
const { tsImport } = await import("tsx/esm/api");
|
|
82
|
+
const fileUrl = pathToFileURL(modulePath).href;
|
|
83
|
+
const mod = (await tsImport(fileUrl, import.meta.url));
|
|
84
|
+
// Unwrap tsx double-wrapping of default exports (see doc comment above)
|
|
85
|
+
const defaultExport = mod.default;
|
|
86
|
+
if (defaultExport &&
|
|
87
|
+
typeof defaultExport === "object" &&
|
|
88
|
+
"__esModule" in defaultExport &&
|
|
89
|
+
"default" in defaultExport) {
|
|
90
|
+
const inner = defaultExport;
|
|
91
|
+
return { ...mod, default: inner.default };
|
|
92
|
+
}
|
|
93
|
+
return mod;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=ts_loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts_loader.js","sourceRoot":"","sources":["../../src/cli/ts_loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B1B,CAAC;AAEF,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAEjC,SAAS,gBAAgB;IACxB,IAAI,oBAAoB;QAAE,OAAO;IACjC,QAAQ,CAAC,wBAAwB,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5F,oBAAoB,GAAG,IAAI,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAkB;IAClD,gBAAgB,EAAE,CAAC;IACnB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IAC/C,MAAM,GAAG,GAAG,CAAC,MAAM,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAA4B,CAAC;IAElF,wEAAwE;IACxE,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC;IAClC,IACC,aAAa;QACb,OAAO,aAAa,KAAK,QAAQ;QACjC,YAAY,IAAI,aAAa;QAC7B,SAAS,IAAI,aAAa,EACzB,CAAC;QACF,MAAM,KAAK,GAAG,aAAwC,CAAC;QACvD,OAAO,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Vite helpers used by dev.ts and render.ts.
|
|
3
|
+
* Extracted to avoid coupling dev.ts internals to render.ts.
|
|
4
|
+
*/
|
|
5
|
+
import type { Plugin } from "vite";
|
|
6
|
+
import type { ProjectInfo } from "../types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Find the videowright package root by walking up from __dirname.
|
|
9
|
+
* Needed to locate the entry HTML which ships in src/cli/entry/.
|
|
10
|
+
*/
|
|
11
|
+
export declare function findPackageRoot(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Vite plugin that forces a full page reload on every file change,
|
|
14
|
+
* bypassing HMR module replacement. The player + hash routing handles
|
|
15
|
+
* restoring position after reload.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fullReloadPlugin(): Plugin;
|
|
18
|
+
/**
|
|
19
|
+
* Shape of globals injected into entry files via the virtual module.
|
|
20
|
+
*/
|
|
21
|
+
export interface VwGlobals {
|
|
22
|
+
timelinePath: string;
|
|
23
|
+
consumerRoot: string;
|
|
24
|
+
audioFile?: string;
|
|
25
|
+
resolvedTiming?: Record<string, number[]>;
|
|
26
|
+
audioTrackNone?: boolean;
|
|
27
|
+
renderFps?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Vite plugin that provides a virtual module `virtual:vw-globals`.
|
|
31
|
+
* The module exports concrete values that were previously injected via
|
|
32
|
+
* Vite's `define:` config. Using a virtual module avoids text-substitution
|
|
33
|
+
* issues where `define` would rewrite `declare const` lines.
|
|
34
|
+
*/
|
|
35
|
+
export declare function globalsVirtualModulePlugin(globals: VwGlobals): Plugin;
|
|
36
|
+
/**
|
|
37
|
+
* Vite plugin that provides a virtual module `virtual:vw-segments`.
|
|
38
|
+
* The module exports a glob-style Record<string, () => Promise<Module>>
|
|
39
|
+
* with explicit dynamic imports for each discovered segment, avoiding
|
|
40
|
+
* the alias-in-glob issue with import.meta.glob.
|
|
41
|
+
*/
|
|
42
|
+
export declare function segmentDiscoveryPlugin(consumerRoot: string): Plugin;
|
|
43
|
+
/**
|
|
44
|
+
* Vite plugin that provides a virtual module `virtual:videowright/project`.
|
|
45
|
+
* The module exports the `ProjectInfo` object as a default export so the
|
|
46
|
+
* browser can import it synchronously with no fetch waterfall.
|
|
47
|
+
*
|
|
48
|
+
* When `onReload` is provided, timeline.ts changes trigger a re-discovery
|
|
49
|
+
* and full page reload so the homepage reflects updated metadata.
|
|
50
|
+
*/
|
|
51
|
+
export declare function projectVirtualModulePlugin(initialProjectInfo: ProjectInfo, opts?: {
|
|
52
|
+
consumerRoot: string;
|
|
53
|
+
onReload: () => Promise<ProjectInfo>;
|
|
54
|
+
}): Plugin;
|
|
55
|
+
/**
|
|
56
|
+
* Vite plugin that routes `/video/<slug>` requests to `video.html`.
|
|
57
|
+
* Replaces the old SPA fallback plugin. Serves a 404 for unknown routes.
|
|
58
|
+
*
|
|
59
|
+
* @param getKnownSlugs - getter returning the current list of valid video slugs
|
|
60
|
+
*/
|
|
61
|
+
export declare function videoRouteMiddlewarePlugin(getKnownSlugs: () => string[]): Plugin;
|
|
62
|
+
//# sourceMappingURL=vite_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite_helpers.d.ts","sourceRoot":"","sources":["../../src/cli/vite_helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAgBxC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAQzC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CA2BrE;AAoCD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA2CnE;AAOD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACzC,kBAAkB,EAAE,WAAW,EAC/B,IAAI,CAAC,EAAE;IACN,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;CACrC,GACC,MAAM,CAqCR;AAYD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,MAAM,EAAE,GAAG,MAAM,CAkEhF"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Vite helpers used by dev.ts and render.ts.
|
|
3
|
+
* Extracted to avoid coupling dev.ts internals to render.ts.
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
6
|
+
import { dirname, extname, join, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
/**
|
|
10
|
+
* Find the videowright package root by walking up from __dirname.
|
|
11
|
+
* Needed to locate the entry HTML which ships in src/cli/entry/.
|
|
12
|
+
*/
|
|
13
|
+
export function findPackageRoot() {
|
|
14
|
+
let dir = __dirname;
|
|
15
|
+
for (let i = 0; i < 10; i++) {
|
|
16
|
+
const pkgPath = resolve(dir, "package.json");
|
|
17
|
+
if (existsSync(pkgPath)) {
|
|
18
|
+
try {
|
|
19
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
20
|
+
if (pkg.name === "videowright")
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// keep going
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
dir = dirname(dir);
|
|
28
|
+
}
|
|
29
|
+
// Fallback: assume __dirname is inside dist/cli/ or src/cli/
|
|
30
|
+
return resolve(__dirname, "../..");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Vite plugin that forces a full page reload on every file change,
|
|
34
|
+
* bypassing HMR module replacement. The player + hash routing handles
|
|
35
|
+
* restoring position after reload.
|
|
36
|
+
*/
|
|
37
|
+
export function fullReloadPlugin() {
|
|
38
|
+
return {
|
|
39
|
+
name: "videowright-full-reload",
|
|
40
|
+
handleHotUpdate({ server }) {
|
|
41
|
+
server.ws.send({ type: "full-reload" });
|
|
42
|
+
return [];
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const VIRTUAL_GLOBALS_ID = "virtual:vw-globals";
|
|
47
|
+
const RESOLVED_VIRTUAL_GLOBALS_ID = `\0${VIRTUAL_GLOBALS_ID}`;
|
|
48
|
+
/**
|
|
49
|
+
* Vite plugin that provides a virtual module `virtual:vw-globals`.
|
|
50
|
+
* The module exports concrete values that were previously injected via
|
|
51
|
+
* Vite's `define:` config. Using a virtual module avoids text-substitution
|
|
52
|
+
* issues where `define` would rewrite `declare const` lines.
|
|
53
|
+
*/
|
|
54
|
+
export function globalsVirtualModulePlugin(globals) {
|
|
55
|
+
return {
|
|
56
|
+
name: "videowright-globals",
|
|
57
|
+
resolveId(id) {
|
|
58
|
+
if (id === VIRTUAL_GLOBALS_ID)
|
|
59
|
+
return RESOLVED_VIRTUAL_GLOBALS_ID;
|
|
60
|
+
},
|
|
61
|
+
load(id) {
|
|
62
|
+
if (id !== RESOLVED_VIRTUAL_GLOBALS_ID)
|
|
63
|
+
return;
|
|
64
|
+
const lines = [];
|
|
65
|
+
lines.push(`export const timelinePath = ${JSON.stringify(globals.timelinePath)};`);
|
|
66
|
+
lines.push(`export const consumerRoot = ${JSON.stringify(globals.consumerRoot)};`);
|
|
67
|
+
lines.push(`export const audioFile = ${globals.audioFile !== undefined ? JSON.stringify(globals.audioFile) : "undefined"};`);
|
|
68
|
+
lines.push(`export const resolvedTiming = ${globals.resolvedTiming !== undefined ? JSON.stringify(globals.resolvedTiming) : "undefined"};`);
|
|
69
|
+
lines.push(`export const audioTrackNone = ${globals.audioTrackNone !== undefined ? JSON.stringify(globals.audioTrackNone) : "undefined"};`);
|
|
70
|
+
lines.push(`export const renderFps = ${globals.renderFps !== undefined ? JSON.stringify(globals.renderFps) : "undefined"};`);
|
|
71
|
+
return `${lines.join("\n")}\n`;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const VIRTUAL_SEGMENTS_ID = "virtual:vw-segments";
|
|
76
|
+
const RESOLVED_VIRTUAL_SEGMENTS_ID = `\0${VIRTUAL_SEGMENTS_ID}`;
|
|
77
|
+
/**
|
|
78
|
+
* Scan the consumer's segments/ directory and return segment ids.
|
|
79
|
+
* Each segments/<id>/index.ts becomes a discovered segment.
|
|
80
|
+
*/
|
|
81
|
+
function discoverSegmentIds(consumerRoot) {
|
|
82
|
+
const segmentsDir = join(consumerRoot, "segments");
|
|
83
|
+
if (!existsSync(segmentsDir))
|
|
84
|
+
return [];
|
|
85
|
+
const ids = [];
|
|
86
|
+
let entries;
|
|
87
|
+
try {
|
|
88
|
+
entries = readdirSync(segmentsDir);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
const entryPath = join(segmentsDir, entry);
|
|
95
|
+
try {
|
|
96
|
+
if (!statSync(entryPath).isDirectory())
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (existsSync(join(entryPath, "index.ts"))) {
|
|
103
|
+
ids.push(entry);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return ids.sort();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Vite plugin that provides a virtual module `virtual:vw-segments`.
|
|
110
|
+
* The module exports a glob-style Record<string, () => Promise<Module>>
|
|
111
|
+
* with explicit dynamic imports for each discovered segment, avoiding
|
|
112
|
+
* the alias-in-glob issue with import.meta.glob.
|
|
113
|
+
*/
|
|
114
|
+
export function segmentDiscoveryPlugin(consumerRoot) {
|
|
115
|
+
return {
|
|
116
|
+
name: "videowright-segment-discovery",
|
|
117
|
+
resolveId(id) {
|
|
118
|
+
if (id === VIRTUAL_SEGMENTS_ID)
|
|
119
|
+
return RESOLVED_VIRTUAL_SEGMENTS_ID;
|
|
120
|
+
},
|
|
121
|
+
load(id) {
|
|
122
|
+
if (id !== RESOLVED_VIRTUAL_SEGMENTS_ID)
|
|
123
|
+
return;
|
|
124
|
+
const segmentIds = discoverSegmentIds(consumerRoot);
|
|
125
|
+
const imports = segmentIds
|
|
126
|
+
.map((segId) => ` "/segments/${segId}/index.ts": () => import("@consumer/segments/${segId}/index.ts")`)
|
|
127
|
+
.join(",\n");
|
|
128
|
+
return `export default {\n${imports}\n};\n`;
|
|
129
|
+
},
|
|
130
|
+
configureServer(server) {
|
|
131
|
+
const segmentsDir = join(consumerRoot, "segments");
|
|
132
|
+
const invalidate = () => {
|
|
133
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_SEGMENTS_ID);
|
|
134
|
+
if (mod) {
|
|
135
|
+
server.moduleGraph.invalidateModule(mod);
|
|
136
|
+
server.ws.send({ type: "full-reload" });
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
server.watcher.add(segmentsDir);
|
|
140
|
+
server.watcher.on("add", (path) => {
|
|
141
|
+
if (path.endsWith("/index.ts") && path.includes(`${segmentsDir}/`)) {
|
|
142
|
+
invalidate();
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
server.watcher.on("unlink", (path) => {
|
|
146
|
+
if (path.endsWith("/index.ts") && path.includes(`${segmentsDir}/`)) {
|
|
147
|
+
invalidate();
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// ---- Project virtual module plugin ----
|
|
154
|
+
const VIRTUAL_PROJECT_ID = "virtual:videowright/project";
|
|
155
|
+
const RESOLVED_VIRTUAL_PROJECT_ID = `\0${VIRTUAL_PROJECT_ID}`;
|
|
156
|
+
/**
|
|
157
|
+
* Vite plugin that provides a virtual module `virtual:videowright/project`.
|
|
158
|
+
* The module exports the `ProjectInfo` object as a default export so the
|
|
159
|
+
* browser can import it synchronously with no fetch waterfall.
|
|
160
|
+
*
|
|
161
|
+
* When `onReload` is provided, timeline.ts changes trigger a re-discovery
|
|
162
|
+
* and full page reload so the homepage reflects updated metadata.
|
|
163
|
+
*/
|
|
164
|
+
export function projectVirtualModulePlugin(initialProjectInfo, opts) {
|
|
165
|
+
let projectInfo = initialProjectInfo;
|
|
166
|
+
return {
|
|
167
|
+
name: "videowright-project-info",
|
|
168
|
+
resolveId(id) {
|
|
169
|
+
if (id === VIRTUAL_PROJECT_ID)
|
|
170
|
+
return RESOLVED_VIRTUAL_PROJECT_ID;
|
|
171
|
+
},
|
|
172
|
+
load(id) {
|
|
173
|
+
if (id !== RESOLVED_VIRTUAL_PROJECT_ID)
|
|
174
|
+
return;
|
|
175
|
+
return `export default ${JSON.stringify(projectInfo)};`;
|
|
176
|
+
},
|
|
177
|
+
configureServer(server) {
|
|
178
|
+
if (!opts)
|
|
179
|
+
return;
|
|
180
|
+
const videosDir = join(opts.consumerRoot, "videos");
|
|
181
|
+
const reload = async () => {
|
|
182
|
+
projectInfo = await opts.onReload();
|
|
183
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_PROJECT_ID);
|
|
184
|
+
if (mod) {
|
|
185
|
+
server.moduleGraph.invalidateModule(mod);
|
|
186
|
+
}
|
|
187
|
+
server.ws.send({ type: "full-reload" });
|
|
188
|
+
};
|
|
189
|
+
const onTimelineChange = (path) => {
|
|
190
|
+
if (path.endsWith("timeline.ts") && path.includes(`${videosDir}/`)) {
|
|
191
|
+
reload();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
server.watcher.add(videosDir);
|
|
195
|
+
server.watcher.on("change", onTimelineChange);
|
|
196
|
+
server.watcher.on("add", onTimelineChange);
|
|
197
|
+
server.watcher.on("unlink", onTimelineChange);
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
// ---- Video route middleware plugin ----
|
|
202
|
+
/** Paths that should never be intercepted by the routing middleware. */
|
|
203
|
+
const VITE_INTERNAL_PREFIXES = ["/@vite/", "/@fs/", "/@id/", "/node_modules/", "/__vite"];
|
|
204
|
+
/** Minimal 404 HTML served for unknown routes. */
|
|
205
|
+
const NOT_FOUND_HTML = "<!doctype html><html><head><title>Not found</title></head>" +
|
|
206
|
+
'<body><h1>Not found</h1><p><a href="/">Back to videos</a></p></body></html>';
|
|
207
|
+
/**
|
|
208
|
+
* Vite plugin that routes `/video/<slug>` requests to `video.html`.
|
|
209
|
+
* Replaces the old SPA fallback plugin. Serves a 404 for unknown routes.
|
|
210
|
+
*
|
|
211
|
+
* @param getKnownSlugs - getter returning the current list of valid video slugs
|
|
212
|
+
*/
|
|
213
|
+
export function videoRouteMiddlewarePlugin(getKnownSlugs) {
|
|
214
|
+
return {
|
|
215
|
+
name: "videowright-video-route",
|
|
216
|
+
configureServer(server) {
|
|
217
|
+
// Registered early (before Vite's static-serve middleware) so we can
|
|
218
|
+
// intercept `/video/<slug>` requests and rewrite them to video.html
|
|
219
|
+
// before Vite tries to resolve them as filesystem paths. Asset and
|
|
220
|
+
// internal paths are passed through via explicit checks below.
|
|
221
|
+
server.middlewares.use((req, res, next) => {
|
|
222
|
+
if (!req.url || req.method !== "GET") {
|
|
223
|
+
next();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const url = req.url.split("?")[0];
|
|
227
|
+
// Exact root — let Vite serve index.html
|
|
228
|
+
if (url === "/" || url === "/index.html") {
|
|
229
|
+
next();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// Known HTML entries — pass through
|
|
233
|
+
if (url === "/video.html" || url === "/render.html") {
|
|
234
|
+
next();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// Vite internal paths — pass through
|
|
238
|
+
for (const prefix of VITE_INTERNAL_PREFIXES) {
|
|
239
|
+
if (url.startsWith(prefix)) {
|
|
240
|
+
next();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Paths with file extensions (assets) — pass through
|
|
245
|
+
if (extname(url)) {
|
|
246
|
+
next();
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
// Video route: /video/<slug> or /video/<slug>/
|
|
250
|
+
const videoMatch = url.match(/^\/video\/([^/]+)\/?$/);
|
|
251
|
+
if (videoMatch) {
|
|
252
|
+
const slug = decodeURIComponent(videoMatch[1]);
|
|
253
|
+
if (getKnownSlugs().includes(slug)) {
|
|
254
|
+
// Rewrite to video.html so Vite serves it; browser URL stays the same
|
|
255
|
+
req.url = "/video.html";
|
|
256
|
+
next();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// Unknown slug — 404
|
|
260
|
+
res.statusCode = 404;
|
|
261
|
+
res.setHeader("Content-Type", "text/html");
|
|
262
|
+
res.end(NOT_FOUND_HTML);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
// Anything else — 404
|
|
266
|
+
res.statusCode = 404;
|
|
267
|
+
res.setHeader("Content-Type", "text/html");
|
|
268
|
+
res.end(NOT_FOUND_HTML);
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=vite_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite_helpers.js","sourceRoot":"","sources":["../../src/cli/vite_helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC9B,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC7C,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;gBACvD,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa;oBAAE,OAAO,GAAG,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACR,aAAa;YACd,CAAC;QACF,CAAC;QACD,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,6D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E,CAAC;wBACP,OAAO;oBACR,CAAC;oBACD,qBAAqB;oBACrB,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;oBACrB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;oBAC3C,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;oBACxB,OAAO;gBACR,CAAC;gBAED,sBAAsB;gBACtB,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;gBAC3C,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { PlayerContext, SegmentSpec, Segment, TimelineEntry, TimelineMeta, ResolvedTimelineMeta, Timeline, Timing, Voiceover, AudioTrack, Transition, TransitionContext, Config, VideoSummary, ProjectInfo, } from "./types.js";
|
|
2
|
+
export { SEGMENT_BRAND } from "./types.js";
|
|
3
|
+
export { defineSegment } from "./segment/index.js";
|
|
4
|
+
export { defineConfig } from "./segment/index.js";
|
|
5
|
+
export { buildSegmentLoaderMap, buildTransitionLoaderMap, validateTimeline, applyMetaDefaults, } from "./timeline/index.js";
|
|
6
|
+
export type { SegmentLoaderMap, TransitionLoaderMap, TimelineError, TimelineValidationResult, } from "./timeline/index.js";
|
|
7
|
+
export { cut, fade, slideLeft, slideRight, slideUp, slideDown, } from "./player/transitions/index.js";
|
|
8
|
+
export { script } from "./script/index.js";
|
|
9
|
+
export { Player } from "./player/index.js";
|
|
10
|
+
export type { PlayerOptions } from "./player/index.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACX,aAAa,EACb,WAAW,EACX,OAAO,EACP,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,YAAY,EACZ,WAAW,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACX,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,wBAAwB,GACxB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACN,GAAG,EACH,IAAI,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,SAAS,GACT,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Public API barrel -- exports added as modules are implemented.
|
|
2
|
+
export { SEGMENT_BRAND } from "./types.js";
|
|
3
|
+
// Segment authoring
|
|
4
|
+
export { defineSegment } from "./segment/index.js";
|
|
5
|
+
export { defineConfig } from "./segment/index.js";
|
|
6
|
+
// Timeline loader
|
|
7
|
+
export { buildSegmentLoaderMap, buildTransitionLoaderMap, validateTimeline, applyMetaDefaults, } from "./timeline/index.js";
|
|
8
|
+
// Built-in transitions
|
|
9
|
+
export { cut, fade, slideLeft, slideRight, slideUp, slideDown, } from "./player/transitions/index.js";
|
|
10
|
+
// Script helper
|
|
11
|
+
export { script } from "./script/index.js";
|
|
12
|
+
// Player
|
|
13
|
+
export { Player } from "./player/index.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAoBjE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,kBAAkB;AAClB,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAQ7B,uBAAuB;AACvB,OAAO,EACN,GAAG,EACH,IAAI,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,SAAS,GACT,MAAM,+BAA+B,CAAC;AAEvC,gBAAgB;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,SAAS;AACT,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL hash routing for the player.
|
|
3
|
+
* Format: #/<segmentId>/<beat>
|
|
4
|
+
*/
|
|
5
|
+
export interface HashState {
|
|
6
|
+
segmentId: string;
|
|
7
|
+
beat: number;
|
|
8
|
+
}
|
|
9
|
+
/** Parse location.hash into a HashState, or null if absent/malformed. */
|
|
10
|
+
export declare function read(): HashState | null;
|
|
11
|
+
/** Write a HashState to the URL via replaceState (no history entry). */
|
|
12
|
+
export declare function write(state: HashState): void;
|
|
13
|
+
/**
|
|
14
|
+
* Read ?to=<id> query parameter. If present, returns the id,
|
|
15
|
+
* removes the query, and replaces history. Returns null if absent.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readQueryFallback(): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Listen for hashchange events. Calls handler with the parsed HashState
|
|
20
|
+
* when the hash changes to a valid state. Returns an unsubscribe function.
|
|
21
|
+
*/
|
|
22
|
+
export declare function onChange(handler: (s: HashState) => void): () => void;
|
|
23
|
+
//# sourceMappingURL=hash_router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash_router.d.ts","sourceRoot":"","sources":["../../src/player/hash_router.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AAID,yEAAyE;AACzE,wBAAgB,IAAI,IAAI,SAAS,GAAG,IAAI,CAMvC;AAED,wEAAwE;AACxE,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAUjD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CASpE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL hash routing for the player.
|
|
3
|
+
* Format: #/<segmentId>/<beat>
|
|
4
|
+
*/
|
|
5
|
+
const HASH_RE = /^#\/([^/]+)\/(\d+)$/;
|
|
6
|
+
/** Parse location.hash into a HashState, or null if absent/malformed. */
|
|
7
|
+
export function read() {
|
|
8
|
+
const hash = location.hash;
|
|
9
|
+
if (!hash)
|
|
10
|
+
return null;
|
|
11
|
+
const m = hash.match(HASH_RE);
|
|
12
|
+
if (!m)
|
|
13
|
+
return null;
|
|
14
|
+
return { segmentId: m[1], beat: Number(m[2]) };
|
|
15
|
+
}
|
|
16
|
+
/** Write a HashState to the URL via replaceState (no history entry). */
|
|
17
|
+
export function write(state) {
|
|
18
|
+
history.replaceState(null, "", `#/${state.segmentId}/${state.beat}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read ?to=<id> query parameter. If present, returns the id,
|
|
22
|
+
* removes the query, and replaces history. Returns null if absent.
|
|
23
|
+
*/
|
|
24
|
+
export function readQueryFallback() {
|
|
25
|
+
const params = new URLSearchParams(location.search);
|
|
26
|
+
const toId = params.get("to");
|
|
27
|
+
if (!toId)
|
|
28
|
+
return null;
|
|
29
|
+
params.delete("to");
|
|
30
|
+
const remaining = params.toString();
|
|
31
|
+
const newUrl = location.pathname + (remaining ? `?${remaining}` : "") + location.hash;
|
|
32
|
+
history.replaceState(null, "", newUrl);
|
|
33
|
+
return toId;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Listen for hashchange events. Calls handler with the parsed HashState
|
|
37
|
+
* when the hash changes to a valid state. Returns an unsubscribe function.
|
|
38
|
+
*/
|
|
39
|
+
export function onChange(handler) {
|
|
40
|
+
const listener = () => {
|
|
41
|
+
const state = read();
|
|
42
|
+
if (state) {
|
|
43
|
+
handler(state);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
window.addEventListener("hashchange", listener);
|
|
47
|
+
return () => window.removeEventListener("hashchange", listener);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=hash_router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash_router.js","sourceRoot":"","sources":["../../src/player/hash_router.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC,yEAAyE;AACzE,MAAM,UAAU,IAAI;IACnB,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC,C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EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-mode HUD overlay.
|
|
3
|
+
* Shows segment info, timing, voiceover, mode, keyboard reference, errors.
|
|
4
|
+
*/
|
|
5
|
+
export interface HudState {
|
|
6
|
+
segmentId: string;
|
|
7
|
+
beat: number;
|
|
8
|
+
segmentTime: number;
|
|
9
|
+
totalTime: number;
|
|
10
|
+
voiceover?: string;
|
|
11
|
+
mode: "interactive" | "render";
|
|
12
|
+
ended: boolean;
|
|
13
|
+
error?: {
|
|
14
|
+
segmentId: string;
|
|
15
|
+
message: string;
|
|
16
|
+
stack?: string;
|
|
17
|
+
};
|
|
18
|
+
playbackMode?: "idle" | "playing";
|
|
19
|
+
}
|
|
20
|
+
export interface HudOptions {
|
|
21
|
+
onPlayToggle?: () => void;
|
|
22
|
+
}
|
|
23
|
+
export interface Hud {
|
|
24
|
+
el: HTMLDivElement;
|
|
25
|
+
update(state: HudState): void;
|
|
26
|
+
show(): void;
|
|
27
|
+
hide(): void;
|
|
28
|
+
toggle(): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
readonly visible: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function createHud(options?: HudOptions): Hud;
|
|
33
|
+
//# sourceMappingURL=hud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hud.d.ts","sourceRoot":"","sources":["../../src/player/hud.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,QAAQ;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,aAAa,GAAG,QAAQ,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,MAAM,WAAW,UAAU;IAC1B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,GAAG;IACnB,EAAE,EAAE,cAAc,CAAC;IACnB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAoMD,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,GAAG,CA6InD"}
|