npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@frontierjs/jetty

v0.0.12

Published

Browser extension framework for FrontierJS. MV3, Mesa runtime.

Readme

@frontierjs/jetty

Browser extension framework for FrontierJS. MV3-first, Mesa-rendered, Junction-connected.

Status: Phases 0–8 complete — every phase file passes (bun run test, which runs plain node over the phases in order). Foundational architecture, port protocol, Junction adapter, channels, Resources, Islands, dev tooling, Firefox parity, and permission audit + CLI are all shipped and tested. See What's not yet done for what is still owed.

What's here

src/
  define/        — defineHarbor, defineDock, defineOptions, definePier, defineIsland
  runtime/       — port protocol, PagePort, harbor registry, channel registry, mount, surfaces
  browser/       — typed cross-browser shim w/ permission errors + audit-miss warnings
  audit/         — permission audit: scans source for chrome.*/browser.* use
  junction/      — adapter contract, junction-adapter (the real one), default
                   WS adapter (placeholder), schema cache, auth flow
  resources/     — harborApp (the handle sierra's createResource takes), the
                   page's port, and Harbor's session as state and Mesa signals
  island/        — content-script runtime: shadow DOM mount, UnoCSS mirror, page-script bridge,
                   chrome.scripting registration
  build/         — Vite plugin pipeline, manifest emitter, auto-gen, discover, config loader
  dev/           — dev WS server + client snippet + classifier, FJS port scheme, orchestrator

bin/
  build-ext.js   — production build CLI
  dev-ext.js     — dev mode CLI w/ file watching + WS broadcast

test/
  phase{0–9}.test.js  — the architectural layers, run in order by
                        `bun run test` (phase2.5 is one of them)
  fixtures/basic-ext/ — minimal smoke fixture (harbor + dock + 1 island)

Build & test

This package supports both Node 24+ and Bun 1.3+. bun run test runs plain node over the phase files in order, except phase 3, which runs under bun because it boots a real Junction app (Junction is Bun-only).

bun install
bun run test                   # all phases, in order (phase 3 under bun)
bun run test:bun               # the same phases under bun's runtime
bun run build:fixture          # Chrome build → dist/chrome/
bun run dev:fixture            # dev mode, Chrome only, WS on 8400

# npm works identically — the scripts are the same
npm install && npm test

Other build/dev targets: build:fixture:firefox, build:fixture:both, dev:fixture:both, and test:phase<n> / test:bun:phase<n> to run one phase on its own.

After build:fixture, load test/fixtures/basic-ext/dist/chrome/ via chrome://extensions → Developer mode → "Load unpacked". After build:fixture:firefox, load dist/firefox/ via about:debugging → This Firefox → Load Temporary Add-on → select manifest.json.

Monorepo layout

This package lives at packages/jetty/ in the FrontierJS monorepo. Siblings it reaches for (when present):

  • packages/mesa/ — reactive runtime + compiler. Optional — jetty falls back to stub mount if missing, which passes a .mesa file through as JavaScript and fails later at Vite with a parse error inside the component. If a build reports Unexpected JSX expression at line 1, the compiler was not found.
  • packages/junction/ — WebSocket service client. Optional — jetty falls back to its built-in default WS adapter if missing.

Both are optional peers. In this repo they are workspace devDependencies, so the siblings are linked; an app that wants one installs it beside jetty.

An app installs neither. A surface has one package.json, at the app root, so @frontierjs/mesa lives at <app>/node_modules and jetty's compiler lookup walks up from extension/ to find it — see Using it in an app.

CLI tools

jetty build    --root=. --browser=chrome|firefox|both [--verbose]
jetty dev      --root=. --browser=chrome|firefox|both [--verbose]
                                                      [--launch] [--start-url=URL]
                                                      [--profile=DIR | --temp-profile]
jetty info     --root=. [--browser=chrome]   # print structure summary
jetty audit    --root=. [--browser=chrome]   # standalone permission audit
jetty manifest --root=. [--browser=chrome|firefox|both]  # print manifest only

jetty dev in a terminal takes keys: o opens the browser(s) with the extension loaded (what --launch does at start), q quits. A launched browser keeps its profile at <root>/.browser-profiles/<browser>/, so a sign-in on the page under test and the extension's own storage survive a restart — gitignore it. --temp-profile is web-ext's fresh profile per launch.

Permission audit

Set permissions.audit in jetty.config.js:

permissions: {
  declared: ['storage', 'tabs'],
  audit:    'warn',  // 'warn' = log; 'strict' = fail build; false = off
}

The audit scans built bundles for chrome.<ns>.* / browser.<ns>.* calls, maps each namespace to its required manifest permission, and reports:

  • missing — APIs used but permission not declared
  • unused — declared but no calls detected (candidate for removal)
  • unknown — namespace not in the catalog (typo or new API)
  • dynamic — chrome[expr] accesses that the audit can't resolve

Limits: the scanner uses string matching, not AST. Comments are stripped, but minification can mangle access patterns. Framework-internal indirection (jetty's own browser shim) is invisible to the audit by design — jetty auto-adds the perms it needs (scripting when islands present).

Browser support

Both Chrome and Firefox use Manifest V3. Differences jetty handles automatically per --browser flag:

| Field | Chrome | Firefox | |--------------------------------|--------------------------|------------------------------------------| | Background script | background.service_worker | background.service_worker (default)or background.scripts[] (opt-in) | | Min browser version | minimum_chrome_version | browser_specific_settings.gecko.strict_min_version | | Stable extension ID (signing) | n/a (Chrome assigns) | browser_specific_settings.gecko.id (required for AMO) | | host_permissions | identical | identical | | web_accessible_resources | identical | identical | | permissions / options_ui | identical | identical | | commands (keyboard shortcuts) | identical | identical |

Firefox-specific settings live under firefox: {...} in jetty.config.js:

firefox: {
  geckoId:          '[email protected]',
  strictMinVersion: 121,
  // background: { useScripts: true }, // optional: classic scripts[] form
}

A keyboard shortcut is a commands entry in jetty.config.js, written as the manifest spells it and received in Harbor through chrome.commands.onCommand:

commands: {
  'pick-element': {
    suggested_key: { default: 'Ctrl+Shift+E', mac: 'Command+Shift+E' },
    description:   'Start the element picker',
  },
}

Using it in an app

An app gets jetty as the extension/ surface — a sub-project at the app root beside api/, web/ and widgets/, with the same six folders every sub-project has. Root README.md § Project Structure is canonical.

fli make:extension          # config/, src/harbor, src/dock, test/, deploy/
fli dev:extension           # watch + reload over the dev port (8400)
fli extension:build         # → extension/dist/chrome/ (--browser both for Firefox too)
fli extension:audit         # permissions declared vs. chrome.* actually called

Those wrap the jetty bin with --root=extension, so an app's build and this package's tests are one program. fli new --extension adds the surface to any template; fli new --template extension-only is a project whose whole product is the extension — no api/, no web/.

The app owns the install, not the surface: one package.json at the app root, so @frontierjs/mesa lives at <app>/node_modules and jetty's compiler lookup walks up from the surface to find it.

Resources

A page's Resource is sierra's own, the same one a web page uses. Only the app it talks to differs:

import { createResource } from '@frontierjs/sierra/resource'
import { harborApp }      from '@frontierjs/jetty/resources'

export const orders = createResource('orders', { app: harborApp() })

A page holds no connection, because MV3 keeps it in the service worker. harborApp() is a Junction client created with relay: each call goes to Harbor as the frame the socket would have carried, Harbor's client makes it, and pushes come back over the port. So the tether, query matching, stale and save()'s patch-what-changed all behave as they do on a web page. A call only HTTP can carry (a file upload, a filtered bulk write, a findFirst) is refused by name. Sign-in is signIn(email, password) / completeSignIn(code) / signOut() from the same import, because Harbor holds the token.

What's not yet done

  • AST-based audit. The current audit uses string matching, which has known false negatives on framework-internal indirection and minified code. A swap to a real JS parser (acorn/swc) would catch both.
  • The default adapter is still a placeholder. createJunctionAdapter over @frontierjs/junction/client is the real connection and closed FJS-279; default-adapter.js beside it is the stand-in it says it is, and nothing points at it. Mesa is not in this bracket either: the compiler is found and used whenever the app that owns the surface has it installed, and the fixture's dock is a real Mesa component.

Architecture references

  • Spec: the original planning document is not in this repo; what shipped is described here and in CLAUDE.md
  • Mesa vision: packages/mesa/docs/VISION.md (informed Phase 3 integration)
  • Resources are sierra's, over a relaying Junction client (FJS-D650); IDEAS/shipped/sierra-scope.md § 2.7 and § 3 item 5.

FJS port scheme

Jetty's dev WS uses the FrontierJS port scheme:

[ENV] [CATEGORY] [PROJECT] [SERVICE]
  8       4         XX        X
  • 8 = dev environment
  • 4 = browser-extensions category
  • XX = project slot (00–99, manually assigned per consumer extension)
  • X = service slot (0 = primary dev WS, 1–9 reserved)

Jetty's own fixture uses 8400. Consumer extensions assign their own project slot in jetty.config.js → dev.port and jetty validates the range at build time.