Source Directory Tree
Thesrc/ directory contains all source code for the extension:
Directory Purpose
/manifest
Contains the manifest file configuration split into three files:
- base.json: Common properties shared across all browsers
- chrome.json: Complete Chrome manifest with MV3 specifications
- firefox.json: Complete Firefox manifest with browser-specific settings
manifest.json for each browser.
/popup
The extension popup that appears when clicking the browser action icon. Contains:
- Toggle switches for debug modes (hsDebug, cacheBuster, developerMode)
- Quick links to HubL documentation
- Website enable/disable controls
- Settings page access
/home/daytona/workspace/source/src/popup/popup.js:1 for the main popup logic.
/options
The settings/options page accessible from the popup. Provides:
- Auto-apply to links toggle
- Badge visibility settings
- Persist across sessions toggle
- Domain allowlist management
/background
Manifest V3 service worker that handles:
- Badge updates based on active parameters
- Context menu management
- Cross-tab messaging
- Persistent parameter application
- Content script injection
/home/daytona/workspace/source/src/background/background.js:1 for implementation details.
/content
Content scripts injected into web pages to:
- Monitor link hover events
- Automatically add debug parameters to same-domain links
- Sync with extension state
/lib
Shared utility modules used across different contexts:
browser-api.js: Cross-browser compatibility layer
/assets
Static resources including extension icons in multiple sizes required by browser stores.
Build Output Structure
When you runnpm run build:chrome or npm run build:firefox, the build process creates:
- Copies all source files to the appropriate browser directory
- Merges manifest files specific to each browser
- Optimizes assets
- Validates the extension package
Key Files and Their Roles
| File | Purpose | Context |
|---|---|---|
background/background.js | Service worker, handles background tasks | Background (MV3) |
content/content-script.js | Modifies links on hover | Content Script |
popup/popup.js | Main UI logic and toggle controls | Popup |
options/options.js | Settings page management | Options Page |
lib/browser-api.js | Cross-browser compatibility | All contexts |
lib/url-params.js | URL parameter definitions | All contexts |
lib/storage.js | Storage utilities | All contexts |
Manifest V3 Architecture
This extension uses Manifest V3 (MV3), the latest extension platform:- Service Worker: Replaces persistent background pages with an event-driven service worker
- Declarative Permissions: Uses
host_permissionsinstead of broadpermissions - Scripting API: Uses
chrome.scripting.executeScript()for dynamic content injection - Action API: Uses
chrome.actioninstead ofbrowserAction
Development Workflow
- Make changes in
src/directory - Build with
npm run build:chromeornpm run build:firefox - Load the extension from
dist/chrome/ordist/firefox/ - Test on target browser
- Validate with
npm run validate