extension 4.1.10 → 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
  {
@@ -7590,7 +7590,7 @@ Available templates
7590
7590
  ${TEMPLATE_GROUPS.map((group)=>`- ${external_pintor_default().green(group.title)} ${messages_arg(`(${group.summary})`)}: ${group.templates.map((template)=>messages_code(template)).join(', ')}`).join('\n')}${TEMPLATE_ALIASES.length > 0 ? `\n- ${external_pintor_default().green('Alias')}: ${TEMPLATE_ALIASES.map((alias)=>`${messages_code(alias.name)} ${messages_arg(alias.note)}`).join(', ')}` : ''}
7591
7591
  - ${messages_code(DEFAULT_TEMPLATE)} is the default when ${messages_code('--template')} is omitted.${BUNDLED_TEMPLATES.includes(DEFAULT_TEMPLATE) ? ' It ships inside the CLI and needs no network.' : ''}
7592
7592
  - Every other name is downloaded from ${messages_code(TEMPLATE_CATALOG_URL)} at create time. A GitHub or ZIP URL works in place of a name.
7593
- - A name that is not on this list fails with ${messages_code('TemplateNotFoundError')}. Run ${messages_code('extension create --help')} for the same list.
7593
+ - A name that is neither on this list nor an ${external_pintor_default().green('Alias')} above fails with ${messages_code('TemplateNotFoundError')}. Run ${messages_code('extension create --help')} for the same list.
7594
7594
 
7595
7595
  Webpack/Rspack configuration
7596
7596
  - Create ${external_pintor_default().underline(messages_code(messages_arg('extension.config.js')))} for custom webpack configuration
@@ -7749,7 +7749,7 @@ Cross-browser compatibility
7749
7749
  `extension create <name> with no --template scaffolds ${DEFAULT_TEMPLATE}`,
7750
7750
  'every name in bundled[] ships inside the CLI package and scaffolds offline. Every other name downloads the examples archive at create time',
7751
7751
  'a GitHub URL or a ZIP URL is accepted in place of a catalog name',
7752
- 'a name outside names[] fails with TemplateNotFoundError and creates nothing',
7752
+ 'a name outside names[] fails with TemplateNotFoundError and creates nothing, except a name listed in aliases[], which scaffolds its resolvesTo entry',
7753
7753
  `names[] is generated from ${TEMPLATE_CORPUS_REPO} at corpus.ref, the exact commit this CLI version downloads, so it is what this version can scaffold and not the current contents of the catalog repository`
7754
7754
  ]
7755
7755
  },
@@ -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.10",
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.10",
110
- "extension-develop": "4.1.10",
111
- "extension-install": "4.1.10",
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",