Developers

Lite extensions

A Lite extension is a zip of page scripts and styles with a pulsar.json. No background page, nothing to sign. Pulsar injects it safely and draws its drawer and settings from the same specs as full extensions.

When to make one

  • Your extension only changes pages: hides things, restyles, adds a button, reads a price.
  • You want people to install it from your site or a file without signing anything.
  • You don’t need browser.* APIs, a background page, the Pulsar API methods or engines. For those, build a full extension.

pulsar.json

pulsar.json (at the top of the zip)
{
  "pulsar_lite": 1,                              // the format (required)
  "id": "highlighter@mytools.example",           // required: 3–80 of A–Z a–z 0–9 . _ - @ +
  "name": "Highlighter", "version": "1.2.0",
  "description": "Marks prices", "author": "MyTools",
  "icon": "star",                                // a Pulsar icon name, or a .png / .webp in the zip (≤ 256 KB)
  "tint": "#BE185D",
  "matches": ["*://*.shop.example/*"],           // required: 1–20 patterns (http/https) or "<all_urls>"
  "exclude_matches": ["*://shop.example/login*"],
  "js": ["highlight.js"], "css": ["highlight.css"],   // at least one file; ≤ 20 of each; ≤ 1 MB together
  "run_at": "document_idle",                     // document_start | document_end | document_idle
  "all_frames": false,
  "popup": { "title": "Highlighter", "sections": [ … ] },   // optional drawer (ActionSpec)
  "settings": { "sections": [ … ] },                       // optional settings page (SettingSpec)
  "update_url": "https://mytools.example/lite/updates.json" // optional
}

Pulsar keeps only the files pulsar.json names. Ids ending in @pulsarbrowser.com are kept for Pulsar. The popup and settings specs use the same items as Native UI.

Talking to Pulsar: __pulsarLite

Each script runs in its own sandbox with one global, __pulsarLite:

highlight.js
const lite = __pulsarLite;
lite.id;                         // "highlighter@mytools.example"
let s = lite.settings();         // {size: 3, …}: the settings values now
let p = lite.popup();            // {on: true, color: "pink"}: the drawer's values, as the user left them

function paint() { document.documentElement.classList.toggle("hl-on", p.on !== false); }
paint();

lite.on("action", (e) => { p = e.values; paint(); });      // e = {item, value, values}: the drawer, on this tab
lite.on("settings", (e) => { s = e.values; paint(); });    // a setting changed
  • Drawer choices (switches, chips, sliders, text) are remembered and shown the next time.
  • Live events reach the tab’s top frame; frames get the values the page loaded with.
  • Lite extensions can’t call the Pulsar API methods (there is no background page).

Install and share

  • From a file: Settings › Extensions › Install from file (.xpi or .zip), or Developer mode’s Load an extension.
  • From your site: link a file named *.pulsar.zip, or serve it as application/vnd.pulsar.lite+zip. A plain .zip stays a normal download.
  • People see the “from outside the store” sheet with where it runs, governed by their Extensions from outside the store setting (Ask, Allow or Block).
  • Where it runs = your matches and the user’s choices (All sites, Ask me, Selected), minus disabled sites, and private tabs only when allowed.
  • Send it to the store like any extension; once sealed, it is a store extension wherever it is downloaded from.
Package
cd highlighter
zip -r ../highlighter-1.2.0.pulsar.zip pulsar.json highlight.js highlight.css

Updates

Add update_url and serve the same update file as full extensions outside the store. People turn on “Allow updates from your site” at install.