@stacksjs/browser-extension 0.70.380 → 0.71.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from './firefox-addons';
16
16
  export * from './firefox-previews';
17
17
  export * from './manifest';
18
18
  export * from './package';
19
+ export * from './publish-plan';
19
20
  export * from './safari';
20
21
  export * from './scaffold';
21
22
  export * from './sanitize';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./build";export*from"./app-store-connect";export*from"./app-store-submission";export*from"./chrome-web-store";export*from"./config";export*from"./firefox-addons";export*from"./firefox-previews";export*from"./manifest";export*from"./package";export*from"./safari";export*from"./scaffold";export*from"./sanitize";export*from"./types";
1
+ export*from"./build";export*from"./app-store-connect";export*from"./app-store-submission";export*from"./chrome-web-store";export*from"./config";export*from"./firefox-addons";export*from"./firefox-previews";export*from"./manifest";export*from"./package";export*from"./publish-plan";export*from"./safari";export*from"./scaffold";export*from"./sanitize";export*from"./types";
@@ -0,0 +1,23 @@
1
+ import type { ExtensionConfig, ExtensionTarget } from './types';
2
+ /** Whether the project declares this store at all. */
3
+ export declare function isTargetConfigured(config: ExtensionConfig, target: ExtensionTarget): boolean;
4
+ /** The credential variables a configured target still needs, if any. */
5
+ export declare function missingCredentials(target: ExtensionTarget, env: PublishEnv): string[];
6
+ /**
7
+ * Decide what a release publishes. Targets are always returned in a stable
8
+ * order, including the skipped ones, so the release log shows the whole
9
+ * picture rather than only what happened to run.
10
+ */
11
+ export declare function planExtensionPublish(config: ExtensionConfig, env?: PublishEnv, targets?: readonly ExtensionTarget[]): PublishDecision[];
12
+ /** One line per target, for the release log. */
13
+ export declare function formatPublishPlan(decisions: readonly PublishDecision[]): string;
14
+ export declare interface PublishDecision {
15
+ target: ExtensionTarget
16
+ publish: boolean
17
+ reason?: PublishSkipReason
18
+ detail?: string
19
+ }
20
+ /** Why a target is not being published. */
21
+ export type PublishSkipReason = 'not-configured' | 'missing-credentials';
22
+ /** The environment a plan is resolved against; `process.env` in practice. */
23
+ export type PublishEnv = Record<string, string | undefined>;
@@ -0,0 +1,2 @@
1
+ const credentialRequirements={chrome:[["CHROME_WEB_STORE_SERVICE_ACCOUNT_PATH","CHROME_WEB_STORE_ACCESS_TOKEN","GOOGLE_APPLICATION_CREDENTIALS"]],firefox:[["AMO_JWT_ISSUER","WEB_EXT_API_KEY"],["AMO_JWT_SECRET","WEB_EXT_API_SECRET"]],safari:[["APP_STORE_CONNECT_API_KEY_ID"],["APP_STORE_CONNECT_API_ISSUER_ID"],["APP_STORE_CONNECT_API_KEY_PATH"]]};export function isTargetConfigured(config,target){if(target==="chrome")return Boolean(config.chromeWebStore?.itemId);if(target==="firefox")return Boolean(config.firefoxAddons&&config.geckoId);return Boolean(config.safariBundleId&&config.safariTeamId)}export function missingCredentials(target,env){return credentialRequirements[target].filter((alternatives)=>!alternatives.some((name)=>(env[name]??"").trim()!=="")).map((alternatives)=>alternatives[0])}export function planExtensionPublish(config,env=process.env,targets=["chrome","firefox","safari"]){return targets.map((target)=>{if(!isTargetConfigured(config,target))return{target,publish:!1,reason:"not-configured",detail:`no ${configKeyFor(target)} in config/extension.ts`};const missing=missingCredentials(target,env);if(missing.length)return{target,publish:!1,reason:"missing-credentials",detail:`set ${missing.join(", ")}`};return{target,publish:!0}})}function configKeyFor(target){if(target==="chrome")return"chromeWebStore.itemId";if(target==="firefox")return"firefoxAddons + geckoId";return"safariBundleId + safariTeamId"}export function formatPublishPlan(decisions){return decisions.map((decision)=>{if(decision.publish)return` ${decision.target}: publishing`;return` ${decision.target}: skipped (${decision.detail??decision.reason})`}).join(`
2
+ `)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/browser-extension",
3
3
  "type": "module",
4
- "version": "0.70.380",
4
+ "version": "0.71.2",
5
5
  "description": "Build MV3 browser extensions (Chrome, Firefox, Safari) the Stacks way — manifest, content/background scripts, DNR rules, packaging, Safari container app, all config-driven.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -58,7 +58,7 @@
58
58
  "safari-template"
59
59
  ],
60
60
  "dependencies": {
61
- "ts-pantry": "^0.11.0"
61
+ "ts-pantry": "^0.11.27"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "bun build.ts",
@@ -74,6 +74,6 @@
74
74
  }
75
75
  },
76
76
  "devDependencies": {
77
- "better-dx": "^0.2.17"
77
+ "better-dx": "^0.2.23"
78
78
  }
79
79
  }