Architecture
HLS Downloader follows the structure of browser-extension-template and is organized as a pnpm workspace. Each package under src/
encapsulates a portion of the extension:
Packages
assets β extension manifest, icons and other static files
core β domain logic and the Redux store shared across apps
background β background scripts that sniff network requests and orchestrate downloads
popup β the React UI shown when the toolbar button is clicked
design-system β reusable React components and styles
Core domain
The core
package implements the business layer in a domain-driven style:
Entities β classes representing HLS concepts such as
Fragment
andKey
Use cases β single business actions composed from entities and services
Services β interfaces for side effects like fetching or storage; concrete implementations live in other packages
Controllers β RxJS epics that react to Redux actions and chain use cases
Store β Redux Toolkit slices wired together and exposed through WebExt Redux so background and UI share state
Apps
Background
The background app wires browser APIs to the core store. Listeners watch for tab changes and network requests, dispatch actions, and fulfill services such as fetching segment data or writing files to disk.
Popup
The popup app is a React single-page application built on the design system. It connects to the shared store to show detected playlists, manage downloads, and update settings.
Build and testing
Build scripts compile each package with Vite, copy assets
, and output to dist/
. After a successful build, archives extension-chrome.zip
and extension-firefox.xpi
are generated. Unit tests run across packages with pnpm test
; coverage is produced with pnpm test:coverage
. pnpm storybook
launches an isolated component explorer for the design system.
Last updated