extension 4.1.11 → 4.1.12

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/cli.cjs CHANGED
@@ -7317,7 +7317,7 @@ var __webpack_modules__ = {
7317
7317
  required: false
7318
7318
  }
7319
7319
  ],
7320
- description: 'Publish to extension.dev and print a shareable URL (requires EXTENSION_DEV_TOKEN)',
7320
+ description: 'Publish a build to the configured platform and print a shareable URL (requires EXTENSION_DEV_TOKEN and EXTENSION_DEV_API_URL)',
7321
7321
  supportsSourceInspection: false
7322
7322
  },
7323
7323
  {
@@ -9791,9 +9791,15 @@ Cross-browser compatibility
9791
9791
  }));
9792
9792
  });
9793
9793
  }
9794
- const DEFAULT_API = 'https://www.extension.dev';
9795
- const PUBLISH_DOCS_URL = 'https://docs.extension.dev/tools/publish';
9796
- const NO_TOKEN_REMEDY = 'Pass --token, set EXTENSION_DEV_TOKEN, or run npx @extension.dev/mcp login.';
9794
+ const NO_TOKEN_REMEDY = 'Pass --token, set EXTENSION_DEV_TOKEN, or sign in with the platform MCP.';
9795
+ const NO_API_REMEDY = 'Publishing needs a platform URL. Pass --api or set EXTENSION_DEV_API_URL.';
9796
+ function platformDocsUrl() {
9797
+ return String(process.env.EXTENSION_DEV_DOCS_URL || '').trim().replace(/\/+$/, '');
9798
+ }
9799
+ function publishDocsHint() {
9800
+ const docs = platformDocsUrl();
9801
+ return docs ? `Get a token: ${docs}/tools/publish` : '';
9802
+ }
9797
9803
  function storedLoginPath() {
9798
9804
  if ('win32' === process.platform) {
9799
9805
  const base = process.env.APPDATA || process.env.LOCALAPPDATA || external_node_path_default().join(external_node_os_default().homedir(), 'AppData', 'Roaming');
@@ -9842,14 +9848,18 @@ Cross-browser compatibility
9842
9848
  const envToken = String(process.env.EXTENSION_DEV_TOKEN || '').trim();
9843
9849
  const token = flagToken || envToken || stored?.token || '';
9844
9850
  const source = flagToken ? 'flag' : envToken ? 'env' : 'stored-login';
9845
- if (!token) throw new Error(`No token. Publishing needs an extension.dev access token.\nGet one: ${PUBLISH_DOCS_URL}\n` + NO_TOKEN_REMEDY);
9851
+ if (!token) {
9852
+ const docsHint = publishDocsHint();
9853
+ throw new Error('No token. Publishing needs a platform access token.\n' + (docsHint ? `${docsHint}\n` : '') + NO_TOKEN_REMEDY);
9854
+ }
9846
9855
  const projectPath = external_node_path_default().resolve(opts.projectPath || process.cwd());
9847
9856
  const localName = readLocalProjectName(projectPath);
9848
9857
  const confirmed = String(opts.project || '').trim();
9849
9858
  const scopedSlug = 'stored-login' === source ? stored?.projectSlug || '' : '';
9850
- if (confirmed && scopedSlug && slugish(confirmed) !== slugish(scopedSlug)) throw new Error(`You asked to publish "${confirmed}" but your stored login is scoped to "${scopedSlug}".\nPass --token for ${confirmed}, or run npx @extension.dev/mcp login for it.`);
9859
+ if (confirmed && scopedSlug && slugish(confirmed) !== slugish(scopedSlug)) throw new Error(`You asked to publish "${confirmed}" but your stored login is scoped to "${scopedSlug}".\nPass --token for ${confirmed}, or sign in with the platform MCP for it.`);
9851
9860
  if (scopedSlug && slugish(scopedSlug) !== slugish(localName) && slugish(confirmed) !== slugish(scopedSlug)) throw new Error(`Your stored login is scoped to the "${scopedSlug}" project${stored?.workspaceSlug ? ` in workspace "${stored.workspaceSlug}"` : ''}, but ${projectPath} is "${localName}".\nPublishing here would share ${scopedSlug}, not ${localName}.\nRun extension publish inside ${scopedSlug}, pass --project ${scopedSlug} to publish that project on purpose, or pass --token / EXTENSION_DEV_TOKEN for this one.`);
9852
- const base = String(opts.api || process.env.EXTENSION_DEV_API_URL || DEFAULT_API).replace(/\/+$/, '');
9861
+ const base = String(opts.api || process.env.EXTENSION_DEV_API_URL || '').trim().replace(/\/+$/, '');
9862
+ if (!base) throw new Error(NO_API_REMEDY);
9853
9863
  const body = {};
9854
9864
  if (null != opts.ttl && '' !== opts.ttl) body.ttlHours = Number(opts.ttl);
9855
9865
  if (opts.buildSha) body.buildSha = opts.buildSha;
@@ -9871,7 +9881,7 @@ Cross-browser compatibility
9871
9881
  };
9872
9882
  }
9873
9883
  function registerPublishCommand(program) {
9874
- program.command('publish').arguments('[project-path]').usage('[project-path] [options]').description(commandDescriptions.publish).option('--token <token>', 'extension.dev access token (or EXTENSION_DEV_TOKEN, or the stored login)').option('--api <url>', 'platform base URL (or EXTENSION_DEV_API_URL)').option('--ttl <hours>', 'share-link lifetime in hours (1–168, default 24)').option('--build-sha <sha>', 'pin the share URL to a specific build').option('--project <slug>', 'name the project this publish is for, when it is not the directory you are in').option('--output <pretty|json>', 'output format (default pretty)').action(async (projectPathArg, opts)=>{
9884
+ program.command('publish').arguments('[project-path]').usage('[project-path] [options]').description(commandDescriptions.publish).option('--token <token>', 'platform access token (or EXTENSION_DEV_TOKEN, or the stored login)').option('--api <url>', 'platform base URL (or EXTENSION_DEV_API_URL)').option('--ttl <hours>', 'share-link lifetime in hours (1–168, default 24)').option('--build-sha <sha>', 'pin the share URL to a specific build').option('--project <slug>', 'name the project this publish is for, when it is not the directory you are in').option('--output <pretty|json>', 'output format (default pretty)').action(async (projectPathArg, opts)=>{
9875
9885
  const asJson = 'json' === opts.output;
9876
9886
  const failWith = async (status, error, prose, hint)=>{
9877
9887
  if (asJson) console.log(JSON.stringify(messaging.Pr.fail('publish', status, error, hint ? {
@@ -9891,10 +9901,11 @@ Cross-browser compatibility
9891
9901
  scope = plan.scope;
9892
9902
  } catch (err) {
9893
9903
  const message = err?.message || 'publish failed: no token';
9904
+ const docsHint = publishDocsHint();
9894
9905
  await failWith('denied', {
9895
9906
  code: messaging.Lp.E_AUTH_REQUIRED,
9896
9907
  message
9897
- }, message, `Get a token at ${PUBLISH_DOCS_URL}. ${NO_TOKEN_REMEDY}`);
9908
+ }, message, `${docsHint ? `${docsHint}. ` : ''}${NO_TOKEN_REMEDY} ${NO_API_REMEDY}`);
9898
9909
  return;
9899
9910
  }
9900
9911
  let res;
@@ -1,4 +1,5 @@
1
1
  import type { Command } from 'commander';
2
+ export declare function publishDocsHint(): string;
2
3
  export interface StoredLogin {
3
4
  token: string;
4
5
  projectSlug: string;
@@ -127,7 +127,7 @@ declare const COMMAND_TABLE: readonly [{
127
127
  readonly name: 'project-path';
128
128
  readonly required: false;
129
129
  }];
130
- readonly description: 'Publish to extension.dev and print a shareable URL (requires EXTENSION_DEV_TOKEN)';
130
+ readonly description: 'Publish a build to the configured platform and print a shareable URL (requires EXTENSION_DEV_TOKEN and EXTENSION_DEV_API_URL)';
131
131
  readonly supportsSourceInspection: false;
132
132
  }, {
133
133
  readonly name: 'install';
package/package.json CHANGED
@@ -38,7 +38,7 @@
38
38
  "extension": "./bin/extension.cjs"
39
39
  },
40
40
  "name": "extension",
41
- "version": "4.1.11",
41
+ "version": "4.1.12",
42
42
  "description": "The cross-browser extension framework. Build Chrome, Edge, Firefox, and Safari extensions with no build configuration.",
43
43
  "homepage": "https://extension.js.org/",
44
44
  "bugs": {
@@ -106,9 +106,9 @@
106
106
  "vivaldi-location2": "2.1.1",
107
107
  "waterfox-location": "2.1.1",
108
108
  "yandex-location": "2.1.1",
109
- "extension-create": "4.1.11",
110
- "extension-develop": "4.1.11",
111
- "extension-install": "4.1.11",
109
+ "extension-create": "4.1.12",
110
+ "extension-develop": "4.1.12",
111
+ "extension-install": "4.1.12",
112
112
  "commander": "^15.0.0",
113
113
  "pintor": "0.3.0",
114
114
  "semver": "^7.7.3",