Repository navigation
Description
Related discussions: aklinker1/publish-browser-extension#65, aklinker1/publish-browser-extension#89
Reference implementation:rxliuli/extport(running in production across 20+ macOS & iOS Safari extensions)
Summary
Following up on the Safari support discussion in aklinker1/publish-browser-extension#89, this RFC proposes official, end-to-end Safari Web Extension support spanning both build (wxt-dev/wxt) and publish (publish-browser-extension).
Core design principles for v1:
- Convention over configuration: One canonical, minimal-config path from
wxt build -b safaritowxt submit. - Single path, no redundant entry points in v1: Instead of supporting multiple competing artifact formats (
.xcodeprojvs.pkg/.ipa,altoolvsxcodebuild), v1 implements one clean, Apple-recommended pipeline modeled directly onrxliuli/extport. - Clear ownership: I'm happy to take up @aklinker1's offer from feat: implement Safari extension publishing via App Store Connect aklinker1/publish-browser-extension#89 and continuously maintain the Safari build and publish pipeline going forward.
Background & Motivation
Unlike Chrome, Firefox, and Edge — where a single .zip is uploaded to a store API — shipping a Safari Web Extension involves 4 distinct stages:
- Convert & Normalize (macOS): Convert the built web extension into an Xcode project (
.xcodeproj) with normalized bundle IDs, versions, metadata, and a host-app setup UI. - Archive & Sign (macOS): Build and sign the macOS and/or iOS targets from the
.xcodeproj. - Upload Binary (macOS): Upload the signed build to App Store Connect (cannot be done via the ASC REST API).
- Submit for Review (REST API): Wait for Apple to finish processing the uploaded build, create/adopt an App Store version, attach the build, and submit it for App Review.
Because Stage 1 belongs to the build phase and Stages 2–4 belong to the publishing phase, this requires coordinated design across wxt-dev/wxt and publish-browser-extension.
Architecture & Ownership Split
| Stage | Command | Runs on | Owner |
|---|---|---|---|
| 1. Convert & Normalize | wxt build -b safari |
macOS | @wxt-dev/module-safari (private package bundled into wxt) |
| 2. Archive & Sign | wxt submit |
macOS | publish-browser-extension (SafariAddonStore) |
| 3. Upload Binary | wxt submit |
macOS | publish-browser-extension (SafariAddonStore) |
| 4. Submit for Review | wxt submit (skipped with --skip-submit-review) |
Any OS (ASC REST API) | publish-browser-extension (SafariAddonStore) |
flowchart LR
A["wxt build -b safari"] -->|"Stage 1: @wxt-dev/module-safari"| B[".output/<ProjectName>/<ProjectName>.xcodeproj"]
B -->|"Stages 2 & 3: xcodebuild archive + exportArchive (upload)"| C["App Store Connect Build"]
C -->|"Stage 4: ASC REST API (unless --skip-submit-review)"| D["Submitted for App Review"]
Stage 1: @wxt-dev/module-safari (wxt build -b safari)
Implemented as a private workspace package (@wxt-dev/module-safari) inside wxt-dev/wxt and bundled directly into wxt at release time, so wxt build -b safari works out of the box with zero extra package installation.
Runs on WXT's build:done hook when browser === 'safari' (macOS only), wrapping xcrun safari-web-extension-converter and handling the real-world edge cases encountered in production:
1. Xcode Project Normalization
- Both Xcode project formats: Handles both legacy OpenStep
project.pbxproj(read viaplutil -convert json, avoiding brittle regex parsing) and Xcode 27.2+'s JSONproject.xcproj. - Reliable Bundle ID resolution:
safari-web-extension-converterdoes not consistently honor--bundle-identifieracross Xcode versions and--macos-only/--ios-onlyflags. Bundle IDs are resolved by targetproductType(application→<bundleId>,app-extension→<bundleId>.Extension). - Version & metadata stamping: Syncs
MARKETING_VERSIONandCURRENT_PROJECT_VERSIONfrompackage.json/ manifest, setsLSApplicationCategoryType,ITSAppUsesNonExemptEncryption = NO,DEVELOPMENT_TEAM, andCFBundleVersioninInfo.plist.
2. Zero-Config Host App Setup Page
In aklinker1/publish-browser-extension#89, @aklinker1 raised the question of whether the generated host app UI needs customization.
Apple's default converter template is too bare — especially on iOS (Settings → Apps → Safari → Extensions). Since the enabling flow is the same for every Safari extension, @wxt-dev/module-safari replaces the generated Main.html/Style.css/Script.js with a clean, universal setup guide:
- macOS: Extension enabled status badge (via the converter's existing
SFSafariExtensionManagerhook), 4-step guide, and the "Open Safari Settings…" button, with a widened window so nothing clips. - iOS: 4-step guide through Settings and the Safari address bar extension button.
- Zero config: Uses the extension name from the manifest, leaves generated Swift untouched, and handles both single-platform (flat) and universal (
Shared (App)) layouts.
Configuration (wxt.config.ts)
Platform selection (macos, ios, or both) lives in wxt.config.ts, which directly determines what Xcode targets/schemes Stage 1 generates:
export default defineConfig({
safari: {
bundleIdentifier: 'com.example.my-extension',
appCategory: 'public.app-category.productivity',
developmentTeam: 'ABC1234567',
projectType: 'both', // 'macos' | 'ios' | 'both' (default: 'both')
},
})Stages 2–4: publish-browser-extension (wxt submit)
Adds a SafariAddonStore that takes the Xcode project directory generated by Stage 1 and runs Stages 2–4 end-to-end.
Stages 2 & 3: Archive, Sign & Upload (xcodebuild only)
- Auto-detects platforms (
macos,ios, or both) directly from the generated Xcode project's schemes viaxcodebuild -list -json— controlled bysafari.projectTypeinwxt.config.ts, with no extra platform flags needed at submit time. - Single-pass archive + export/upload per detected platform:
xcodebuild archivewithCODE_SIGN_STYLE=Automatic,-allowProvisioningUpdates, and App Store Connect API key flags (-authenticationKeyID,-authenticationKeyIssuerID,-authenticationKeyPath).xcodebuild -exportArchivewithmethod: app-store-connect,signingStyle: automatic, anddestination: upload.
- Why
xcodebuild -exportArchive(destination: upload) instead ofaltool?- It is Apple's current recommended replacement for deprecated
altool. - Automatic signing handles both the host
.appand nested Safari.appexin one pass — no manualcodesign,productbuild, or provisioning profile files required. - One unified path: no
.pkg/.ipaspecial-casing or duplicate upload code to maintain.
- It is Apple's current recommended replacement for deprecated
- API Key discovery: Supports explicit key path as well as Apple's conventional lookup directories (
./private_keys,~/private_keys,~/.private_keys,~/.appstoreconnect/private_keys). - CI Signing Caveat (documented & solved): Ephemeral CI runners (e.g. GitHub Actions
macos-latest) start with an empty keychain. Calling-allowProvisioningUpdateswith an empty keychain causes Apple to mint a brand new distribution certificate on every run until the account hits Apple's certificate cap. Our CI docs will cover importing a single reusable.p12certificate into a temporary keychain before runningwxt submit.
Stage 4: Wait for Processing & Submit for Review (ASC REST API)
Uploading a binary only places it in App Store Connect's build list — it does not create a release or submit for App Review.
Matching publish-browser-extension's existing behavior for Chrome, Firefox, and Edge:
- Default (full submit):
- Authenticates to
https://api.appstoreconnect.apple.comwith an ES256 JWT signed by the same.p8API key (no extra credentials needed). - Polls
/v1/buildsuntil the uploaded build for(version, platform)reachesprocessingState: VALID. - Creates or adopts the platform's editable
appStoreVersion(idempotently handlingPREPARE_FOR_SUBMISSION,REJECTED, or superseded drafts). - Attaches the build and populates a default "What's New" note if empty (required by Apple).
- Submits for review via the
reviewSubmissionsAPI.
- Authenticates to
--skip-submit-review: Stops after Stage 3 (binary uploaded to ASC, no version created or submitted for review).
Explicit Non-Goals for v1 (and Future Work)
To keep v1 focused, minimal, and maintainable:
- No prebuilt
.pkg/.ipaupload mode or custom entry points in v1: One canonical flow (.xcodeproj→xcodebuild→ ASC). - No host-app localization in v1: Automatically generating
<lang>.lproj/InfoPlist.stringsand localized setup pages frompublic/_locales/*is planned as a post-v1 enhancement once the core pipeline is stable. - No custom native host-app builder: Projects that need a custom Swift/SwiftUI host app should manage their own Xcode/Fastlane setup rather than turning WXT into a native app build system.
- First-time App Store Connect app creation remains manual: The ASC API does not support creating a brand-new App record; this is a one-time manual step documented in the setup guide.
- macOS required for Safari builds & uploads: Stages 1–3 rely on Apple's Xcode CLI tools (
safari-web-extension-converter,xcodebuild).
Implementation Plan & Maintenance
All core pieces are already proven in rxliuli/extport (packages/wxt, packages/cli/src/safari-build.ts, packages/store-adapters/src/safari.ts):
- Stage 1 (
wxt-dev/wxt): Implement@wxt-dev/module-safari(private package bundled intowxt) with Xcode project normalization (.pbxproj+.xcproj) and the zero-config setup page. - Stages 2–4 (
publish-browser-extension): ImplementSafariAddonStore(archive/sign/upload viaxcodebuild, plus ASC REST API submission with--skip-submit-review). - Verification & Docs: End-to-end test against a real App Store Connect app (macOS + iOS) and publish a CI guide (including reusable
.p12certificate setup for GitHub Actions).
I'm committed to driving this implementation and continuing to maintain Safari build and publishing support in WXT and publish-browser-extension long-term (including keeping up with annual Xcode changes).
Feedback Requested
@aklinker1 — before I open PRs across wxt-dev/wxt and publish-browser-extension, I'd love your confirmation on:
- Bundling
@wxt-dev/module-safarias an internal/private package directly inwxt(and exposing thesafariconfig key inwxt.config.ts). - The single-path v1 scope (
wxt build -b safari→wxt submit, with--skip-submit-reviewto stop after upload). - Any naming, CLI flag, or docs conventions you'd like us to follow across both repos.
Activity
rxliuli commentedon Nov 23, 2026
Update: I've built a working end-to-end prototype of both halves (Stage 1 in
wxtand Stages 2–4 inpublish-browser-extension) and verified the full flow against a real App Store Connect app (macOS + iOS submitted and confirmedWAITING_FOR_REVIEW).Here is a runnable demo branch using packed tarballs of both branches:
I'll follow up with PRs for both repos shortly.
rxliuli commentedon Nov 23, 2026
Verified on a clean GitHub Actions
macos-26runner as well (building with@wxt-dev/module-safarifrom #2779, importing a reusable.p12cert into a temporary keychain, and uploading macOS + iOS v0.0.24 viawxt submit --safari-skip-submit-reviewfrom aklinker1/publish-browser-extension#99):