@extension.dev/urls

中文文档
0.8.4发布于 2026/11/05Apache-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 2339

One source of truth for cross-app origins and route paths across the extension.dev fleet (www, console, docs, templates, themes, code, inspect, preview, userland) and the public MCP. Pure path builders plus an env-driven origin resolver with local-dev der

原始使用文档
文档目录5 节
  1. Why one package for links
  2. Usage
  3. The extension.dev stack
  4. Community
  5. License

@extension.dev/urls Version Downloads CI Discord

One source of truth for the origins and route paths that link the extension.dev fleet together.

Logo
npm install @extension.dev/urls

Powers cross-app links for www, console, docs, templates, themes, code, inspect, preview, userland, and the public MCP.

extension.dev · Extension.js · Discord

A cross-app link is two halves: the host (which app) and the path (which route inside it). Hardcode either and the day an app moves or a route is renamed, every caller drifts. This package keeps both halves in one place so a link a tool hands back can never point at a route the app router no longer serves.

  • @extension.dev/urls/paths - pure, environment-free route builders. Safe to call from any runtime (Next.js, Vite SPAs, Node, the bundled MCP) because they read no environment and only encode path shapes.
  • @extension.dev/urls/origins - the host resolver. Each runtime names its env vars differently, so this module never reads the environment itself: the caller passes in whatever overrides it has and gets back a full origin set, with local-dev hosts derived from the Caddy proxy map when the environment looks local, and production hosts otherwise.
  • @extension.dev/urls/userland - whole-URL builders for the public build viewer. userland is the one app whose production host is per-workspace (<workspace>.extension.dev), so its two halves cannot be chosen independently and it gets its own module rather than a paths entry.
  • @extension.dev/urls/reserved-slugs - the names a workspace or project slug may never take: isReservedWorkspaceSlug, isReservedProjectSlug and the sets behind them. The list lives here because this is the only package both the www server that refuses a name and the console form that greys it out already depend on, so the two can never drift apart again.

Usage

import { resolveOrigins } from "@extension.dev/urls/origins";
import { consoleProjectPath, ConsoleProjectPage } from "@extension.dev/urls/paths";

const origins = resolveOrigins({
  // Pass only the vars this runtime actually has; the rest derive.
  www: process.env.EXTENSION_DEV_API_URL,
});

// A full link is `origins.<app> + <pathBuilder>(...)`.
const buildsUrl =
  origins.console +
  consoleProjectPath({ workspace: "acme", project: "toolbar" }, ConsoleProjectPage.builds);

Store submissions sit under one root on the console project. The older stores keys remain as aliases and return the same paths:

const ref = { workspace: "acme", project: "toolbar" };

consoleProjectPath(ref, ConsoleProjectPage.submissions);
// -> "/acme/toolbar/submissions"

consoleProjectPath(ref, ConsoleProjectPage.submissionNew("chrome"));
// -> "/acme/toolbar/submissions/chrome/new"

consoleProjectPath(ref, ConsoleProjectPage.submission("chrome", "sub_1"));
// -> "/acme/toolbar/submissions/chrome/sub_1"

Set a single local override and every unset origin follows it to the dev proxy:

resolveOrigins({ www: "http://localhost:3100" }).console;
// -> "http://console.extension.localhost"

The public build viewer takes whole URLs, because the workspace lives in the host in production and in the path locally:

import { userlandBuildUrl } from "@extension.dev/urls/userland";

userlandBuildUrl({ workspace: "acme", project: "toolbar" }, "abc1234");
// -> "https://acme.extension.dev/toolbar/builds/abc1234"

userlandBuildUrl({ workspace: "acme", project: "toolbar" }, "abc1234", {
  base: resolveOrigins({ www: "http://localhost:3100" }).userland,
});
// -> "http://userland.extension.localhost/acme/toolbar/builds/abc1234"

The extension.dev stack

PackageUse it to
@extension.dev/mcpGive an AI agent hands: scaffold, run, inspect, and publish extensions
@extension.dev/skillTeach agents the judgment half: cross-browser rules, gotchas, playbooks
@extension.dev/artifact-integrityCheck an artifact against a declared SHA-256 and gate CI on the result

All of it rides on Extension.js, the open-source cross-browser extension framework.

Community

  • Join the extension.dev Discord for help and feedback
  • Browse production-ready templates at templates.extension.dev
  • Follow the platform's public packages on GitHub
  • Report Extension.js framework issues on GitHub

License

Apache-2.0 (c) 2026 Cezar Augusto and the extension.dev collaborators. See LICENSE.

版本与发布记录

@extension.dev/urls 共发布 10 个版本,首次发布于 2026/07/25;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.4latest2026/11/059 天前
0.8.32026/10/2025 天前
0.8.22026/10/051 个月前
0.8.12026/10/041 个月前
0.8.02026/08/083 个月前
0.7.02026/08/073 个月前

关于 @extension.dev/urls 的常见问题

@extension.dev/urls 是什么?

One source of truth for cross-app origins and route paths across the extension.dev fleet (www, console, docs, templates, themes, code, inspect, preview, userland) and the public MCP. Pure path builders plus an env-driven origin resolver with local-dev der

如何安装 @extension.dev/urls?

在项目目录运行 npm install @extension.dev/urls,或使用 pnpm add / yarn add / bun add。

@extension.dev/urls 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@extension.dev/urls 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@extension.dev/urls 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@extension.dev/urls 可以商用吗?

@extension.dev/urls 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@extension.dev/urls 的下载量有多少?

根据 npm 官方下载统计,@extension.dev/urls 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,339 次,日均约 78 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@extension.dev/urls 还在维护吗?

最新版本 0.8.4 发布于 2026/11/05(9 天前);至今共发布 10 个版本,其中过去 12 个月发布了 10 个;首次发布于 2026/07/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。