@vercel/board 0.42.1 → 0.43.0

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.
@@ -0,0 +1,2 @@
1
+ import { t as inspect } from "./inspect-ByIt7CxV.mjs";
2
+ export { inspect };
@@ -1,7 +1,7 @@
1
1
  import { h as ATTACHMENT_BYTES_MAX } from "./errors-DUzpDSrJ.mjs";
2
2
  import "./schemas-DAzSsgWk.mjs";
3
- import { t as Failed, u as who } from "./main-C4HVA8cc.mjs";
4
- import { t as page } from "./page-CnjVt5w2.mjs";
3
+ import { t as Failed, u as who } from "./main-CM0_uZ7w.mjs";
4
+ import { t as page } from "./page-D-OzDOAX.mjs";
5
5
  import { randomBytes, timingSafeEqual } from "node:crypto";
6
6
  import { createServer } from "node:http";
7
7
  //#region src/inspect/style.ts
@@ -420,7 +420,7 @@ button.file:hover { background: var(--shade-hover); color: var(--bright); }
420
420
  .toast { max-width: 420px; padding: 8px 12px; border: 1px solid var(--dim); background: var(--bg); color: var(--bright); }
421
421
  `;
422
422
  /** The prebuilt UI where board is installed, read only when an inspector starts without one. */
423
- const bundle = async () => (await import("./page-BPTzCBeW.mjs")).page();
423
+ const bundle = async () => (await import("./page-Dr9Aqlej.mjs")).page();
424
424
  const shell = (token) => `<!doctype html>
425
425
  <html lang="en">
426
426
  <head>
@@ -605,17 +605,8 @@ const stopped = () => new Promise((resolve) => {
605
605
  process.once("SIGINT", done);
606
606
  process.once("SIGTERM", done);
607
607
  });
608
- /** The page to serve, before anything starts: a run that can't have one says so, and serves nothing. */
609
- async function pageOf(provided) {
610
- if (provided) try {
611
- return await provided();
612
- } catch (error) {
613
- throw new Failed({
614
- class: "unknown",
615
- reason: "inspector_page_unavailable",
616
- message: `Couldn't get the inspector's page: ${error.message}`
617
- });
618
- }
608
+ /** The page to serve, before anything starts: an install without one says so, and serves nothing. */
609
+ async function pageOf() {
619
610
  const found = await page();
620
611
  if (found === null) throw new Failed({
621
612
  class: "unknown",
@@ -625,9 +616,9 @@ async function pageOf(provided) {
625
616
  });
626
617
  return found;
627
618
  }
628
- async function inspect({ flags, out, portFlag, client, openBrowser, inspectorPage }) {
619
+ async function inspect({ flags, out, portFlag, client, openBrowser }) {
629
620
  const port = portFlag();
630
- const page = await pageOf(inspectorPage);
621
+ const page = await pageOf();
631
622
  const inspector = await startInspector({
632
623
  client: client(),
633
624
  page,
@@ -2,7 +2,7 @@ import { _ as IMPORT_BYTES_MAX, a as forbidden$1, b as mediaType, c as toErrorRe
2
2
  import { _ as actorKind, a as CAN_MAX, b as storable, c as Handle, d as Labels, g as SeenActorKind, h as RemoteWatcherId, i as Author, l as LabelKey, m as MessageText, n as Attachment, o as ChannelPath, p as MessageId, s as Emoji, t as ActorId, v as authorView, y as platformAvatar } from "./schemas-DAzSsgWk.mjs";
3
3
  import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-DymyhUzl.mjs";
4
4
  import { a as SCHEMA_DESCRIPTION_MAX, c as canonical, d as parseSchemaId, f as schemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, n as blocksIn, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX, u as isBuiltInName } from "./blocks-CVoBC7ur.mjs";
5
- import { a as compileWatcher, c as METHODS, h as VERSION, i as runMatch, m as SYNC, n as syncTarget, o as hasCriteria, r as canonicalWatchers, t as SYNC_ACTOR } from "./origin-Cuu8lW8n.mjs";
5
+ import { a as compileWatcher, c as METHODS, h as VERSION, i as runMatch, m as SYNC, n as syncTarget, o as hasCriteria, r as canonicalWatchers, t as SYNC_ACTOR } from "./origin-DoRR9yql.mjs";
6
6
  import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-0DUFrav-.mjs";
7
7
  import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
8
8
  import { S as wroteAs, _ as removes, a as authenticates, c as checkPrincipal, d as grantIssuers, m as joined, n as GITHUB_ISSUER, o as checkCan, p as issuerName, s as checkGrant, x as workflowPath } from "./auth-Ft4AJptx.mjs";
@@ -1,13 +1,13 @@
1
1
  import { g as DIRECT_UPLOAD_BYTES_MAX, u as BoardError, y as fileSize } from "./errors-DUzpDSrJ.mjs";
2
2
  import { f as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-DAzSsgWk.mjs";
3
3
  import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
4
- import { h as VERSION, s as withMentions } from "./origin-Cuu8lW8n.mjs";
4
+ import { h as VERSION, s as withMentions } from "./origin-DoRR9yql.mjs";
5
5
  import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
6
6
  import { l as shownName } from "./middleware-0DUFrav-.mjs";
7
7
  import { r as PERMISSIONS } from "./access-BgBiaCyx.mjs";
8
- import { a as isApiMessageId, n as isBoardName } from "./exports-kDMIgZVu.mjs";
9
- import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-DeEJJw3i.mjs";
10
- import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-CKbE7eMT.mjs";
8
+ import { a as isApiMessageId, n as isBoardName } from "./exports-S2AJNE_O.mjs";
9
+ import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-C4fR0md0.mjs";
10
+ import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-CD7qe_Pl.mjs";
11
11
  import { t as conformance } from "./conformance-BORt5nky.mjs";
12
12
  import { t as displayText } from "./bots-CGkO76qH.mjs";
13
13
  import { spawn } from "node:child_process";
@@ -2565,7 +2565,6 @@ async function run(command, args) {
2565
2565
  }
2566
2566
  return 0;
2567
2567
  }
2568
- case "inspect": return (await import("./inspect-CNW1rLWB.mjs")).inspect(context());
2569
2568
  default: {
2570
2569
  const own = app.commands[command];
2571
2570
  if (own) return own.run(args, context());
@@ -2861,8 +2860,7 @@ const context = () => ({
2861
2860
  portFlag,
2862
2861
  connection,
2863
2862
  client,
2864
- openBrowser,
2865
- ...app.inspectorPage ? { inspectorPage: app.inspectorPage } : {}
2863
+ openBrowser
2866
2864
  });
2867
2865
  /**
2868
2866
  * Runs board's CLI on `argv` (what follows the command name) as `app`, and answers its exit
@@ -2897,6 +2895,8 @@ async function runOnce(argv, options) {
2897
2895
  else out(VERSION);
2898
2896
  return 0;
2899
2897
  }
2898
+ const elsewhere = standalone(canonical(positionals[0]));
2899
+ if (elsewhere) throw elsewhere;
2900
2900
  if (flags.help) {
2901
2901
  out(help(positionals));
2902
2902
  return 0;
@@ -2954,6 +2954,34 @@ function stopped(reason) {
2954
2954
  ...writes ? { next: [{ instruction: "It may have happened anyway: read before you run it again." }] } : {}
2955
2955
  });
2956
2956
  }
2957
+ /** The commands only board's own CLI has (`local.ts`), by name: an app that embeds board's points to it. */
2958
+ const STANDALONE = /* @__PURE__ */ new Set(["inspect", "serve"]);
2959
+ /**
2960
+ * A command only board's own CLI has, typed in an app that embeds board's: the same run there, as
2961
+ * typed. The app's team never reaches these arguments (`vercel board` takes `--scope` itself), so
2962
+ * `inspect`'s says where one goes, unless a URL names the board, and with it its team. `serve` runs
2963
+ * a board of its own, and reads none.
2964
+ */
2965
+ function standalone(command) {
2966
+ if (io.board || command === void 0 || !STANDALONE.has(command) || Object.hasOwn(app.commands, command)) return void 0;
2967
+ const at = typed.indexOf("--");
2968
+ const before = at === -1 ? typed : typed.slice(0, at);
2969
+ const given = flags.url !== void 0 || Boolean(process.env.BOARD_URL?.trim()) || (flags.scope ?? flags.team) !== void 0;
2970
+ const team = command === "inspect" && !given ? ["--scope", "<TEAM>"] : [];
2971
+ return usage(`${named()} has no ${command}: board's own CLI runs it.`, {
2972
+ reason: "unknown_command",
2973
+ next: [{
2974
+ instruction: "Run board's own CLI",
2975
+ argv: [
2976
+ "npx",
2977
+ "@vercel/board@latest",
2978
+ ...before,
2979
+ ...team,
2980
+ ...at === -1 ? [] : typed.slice(at)
2981
+ ]
2982
+ }]
2983
+ });
2984
+ }
2957
2985
  /** The commands about the machine the CLI runs on, not the board: none of them run in-process. */
2958
2986
  const MACHINE = /* @__PURE__ */ new Set([
2959
2987
  "whoami",
@@ -3,7 +3,7 @@ import { b as storable, d as Labels, f as MESSAGE_TEXT_MAX, l as LabelKey, m as
3
3
  import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DymyhUzl.mjs";
4
4
  import { a as SCHEMA_DESCRIPTION_MAX, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX } from "./blocks-CVoBC7ur.mjs";
5
5
  import { i as afterRetry } from "./middleware-0DUFrav-.mjs";
6
- import { o as options } from "./commands-DeEJJw3i.mjs";
6
+ import { o as options } from "./commands-C4fR0md0.mjs";
7
7
  import { z } from "zod";
8
8
  //#region src/api/routes.ts
9
9
  /**
@@ -757,7 +757,7 @@ const routes = {
757
757
  };
758
758
  //#endregion
759
759
  //#region src/version.ts
760
- const VERSION = "0.42.1";
760
+ const VERSION = "0.43.0";
761
761
  //#endregion
762
762
  //#region src/server/backend.ts
763
763
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -0,0 +1,14 @@
1
+ import { readFile } from "node:fs/promises";
2
+ //#region src/inspect/page.ts
3
+ /** Next to the CLI in `dist`, or in `dist` when running from source. */
4
+ const FILES = [new URL("./inspect/app.js", import.meta.url), new URL("../../dist/inspect/app.js", import.meta.url)];
5
+ /** The page's script where board is installed, or null when there's none beside it. */
6
+ async function page() {
7
+ for (const file of FILES) {
8
+ const script = await readFile(file, "utf8").catch(() => null);
9
+ if (script !== null) return script;
10
+ }
11
+ return null;
12
+ }
13
+ //#endregion
14
+ export { page as t };
@@ -0,0 +1,2 @@
1
+ import { t as page } from "./page-D-OzDOAX.mjs";
2
+ export { page };
@@ -1,7 +1,7 @@
1
1
  import { u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
- import { d as localTokenFile, t as board } from "./server-CKbE7eMT.mjs";
2
+ import { d as localTokenFile, t as board } from "./server-CD7qe_Pl.mjs";
3
3
  import { t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
4
- import { t as local } from "./local-DsJ14yqg.mjs";
4
+ import { t as local } from "./local-0TVbQkzW.mjs";
5
5
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
6
6
  import { userInfo } from "node:os";
7
7
  import { dirname, join, resolve } from "node:path";
@@ -1,8 +1,8 @@
1
1
  import { d as createBoardClient, p as formatProfileHeader, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
2
  import "./schemas-DAzSsgWk.mjs";
3
- import { Y as routes, a as compileWatcher, c as METHODS } from "./origin-Cuu8lW8n.mjs";
3
+ import { Y as routes, a as compileWatcher, c as METHODS } from "./origin-DoRR9yql.mjs";
4
4
  import { g as keyId, p as DERIVED_ID } from "./middleware-0DUFrav-.mjs";
5
- import { c as tailWatchers, i as createVercel, l as deployedOnVercel, o as PROTOCOL_ROUTES, s as withoutToken, t as createBoard } from "./exports-kDMIgZVu.mjs";
5
+ import { c as tailWatchers, i as createVercel, l as deployedOnVercel, o as PROTOCOL_ROUTES, s as withoutToken, t as createBoard } from "./exports-S2AJNE_O.mjs";
6
6
  import { execFile } from "node:child_process";
7
7
  import { createHash } from "node:crypto";
8
8
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -8,6 +8,9 @@ description: '`vb inspect` opens any board in your browser, reading and writing
8
8
  ```bash
9
9
  # in a terminal, wherever the CLI already finds your board:
10
10
  vb inspect
11
+
12
+ # or, without board installed:
13
+ npx @vercel/board@latest inspect
11
14
  ```
12
15
 
13
16
  ```text
@@ -25,8 +25,9 @@ The CLI makes no HTTP calls of its own: every command goes through
25
25
 
26
26
  `@vercel/board/cli` runs the same CLI inside another one, as `vercel board`
27
27
  does. Help, usage, and errors use the name it's given. It has every command but
28
- [`serve`](#serve), so an app that bundles it brings no local board. [`inspect`](#inspect)
29
- is in a chunk of its own, which loads only when `inspect` runs.
28
+ [`inspect`](#inspect) and [`serve`](#serve), which run something on this
29
+ machine, so an app that bundles it brings neither the inspector nor a local
30
+ board. Either one, typed there, points to board's own CLI.
30
31
 
31
32
  ```ts
32
33
  import { createApp } from '@vercel/board/cli'
@@ -35,29 +36,6 @@ import { createApp } from '@vercel/board/cli'
35
36
  const code = await createApp({ appName: 'vercel board' }).run(process.argv.slice(3))
36
37
  ```
37
38
 
38
- The inspector's page isn't in that chunk. It's one file in board's npm
39
- package, `dist/inspect/app.js`, which `inspect` reads beside board's files. An
40
- app that bundles board's CLI has none beside it, so it fetches this version's
41
- page and hands it over. `INSPECTOR_PAGE` names the file and its SHA-256, so
42
- the app checks it before the page runs as you:
43
-
44
- ```ts
45
- import { createApp, INSPECTOR_PAGE } from '@vercel/board/cli'
46
-
47
- // { name: '@vercel/board', version: '0.37.0', path: 'dist/inspect/app.js', sha256: '…' }
48
- const { name, version, path, sha256 } = INSPECTOR_PAGE
49
-
50
- const code = await createApp({
51
- appName: 'vercel board',
52
- // Asked for only when `inspect` runs. What it throws fails the run, and nothing is served.
53
- // inspectorPage: () => yourCachedPage({ name, version, path, sha256 }), // from npm, checked
54
- }).run(process.argv.slice(3))
55
- ```
56
-
57
- Without `inspectorPage`, an app with no file of board's beside it fails
58
- `inspect` with `no_inspector_page`, and one whose `inspectorPage` throws fails
59
- with `inspector_page_unavailable`.
60
-
61
39
  `run` answers the exit code, and never exits the process itself. A failure is
62
40
  data too, for the CLI that runs board to show as it shows its own:
63
41
 
@@ -1051,7 +1029,8 @@ vb inspect [--port N] [--no-open]
1051
1029
  ```
1052
1030
 
1053
1031
  Serves the board's web UI on 127.0.0.1, as you, and opens it. The port is 4747,
1054
- or any free port when that's taken. See
1032
+ or any free port when that's taken. Only board's own CLI has it, so without
1033
+ `vb` installed, `npx @vercel/board@latest inspect` runs it. See
1055
1034
  [Inspector](../03-guides/02-inspector.md).
1056
1035
 
1057
1036
  ## Filters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.42.1",
3
+ "version": "0.43.0",
4
4
  "description": "A message board you mount in one route: one durable log, verified authors, live tail, and two-way sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -94,7 +94,6 @@
94
94
  "@vercel/connect": "^2.3.4",
95
95
  "ai": "^7.0.130",
96
96
  "chat": "^4.41.1",
97
- "esbuild": "0.28.1",
98
97
  "experimental-a2": "0.24.0",
99
98
  "github-slugger": "^2.0.0",
100
99
  "lucide-react": "^1.49.0",
@@ -1,4 +0,0 @@
1
- //#region src/inspect/digest.ts
2
- const PAGE_SHA256 = "c19aa15fdf63e3d1220b585c1594163ecca1702039ea5be31a8fe092fd9d5a0b";
3
- //#endregion
4
- export { PAGE_SHA256 as t };
@@ -1,2 +0,0 @@
1
- import { t as inspect } from "./inspect-CqCXjtPI.mjs";
2
- export { inspect };
@@ -1,2 +0,0 @@
1
- import { t as page } from "./page-CnjVt5w2.mjs";
2
- export { page };
@@ -1,30 +0,0 @@
1
- import "./digest-dm54M2k8.mjs";
2
- import { createHash } from "node:crypto";
3
- import { readFile } from "node:fs/promises";
4
- //#region src/inspect/page.ts
5
- /**
6
- * Next to the CLI in `dist`, or in `dist` when running from source. Resolved only when asked
7
- * for: an app that bundles board's CLI as CommonJS may have no `import.meta.url`, and then has
8
- * none of board's files either.
9
- */
10
- function files() {
11
- try {
12
- return [new URL("./inspect/app.js", import.meta.url), new URL("../../dist/inspect/app.js", import.meta.url)];
13
- } catch {
14
- return [];
15
- }
16
- }
17
- /**
18
- * The page's script where board is installed, or null when there's none beside it. A build takes
19
- * only the page it made: in an app that bundles board's CLI, these paths are the app's, and a file
20
- * that happens to be there isn't board's.
21
- */
22
- async function page() {
23
- for (const file of files()) {
24
- const script = await readFile(file, "utf8").catch(() => null);
25
- if (script !== null && createHash("sha256").update(script).digest("hex") === "c19aa15fdf63e3d1220b585c1594163ecca1702039ea5be31a8fe092fd9d5a0b") return script;
26
- }
27
- return null;
28
- }
29
- //#endregion
30
- export { page as t };