@fedify/cli 2.0.8 → 2.0.9

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/cache.js CHANGED
@@ -1,11 +1,8 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
4
- import { join } from "node:path";
5
- import { mkdir } from "node:fs/promises";
1
+ import "@js-temporal/polyfill";
6
2
  import { homedir } from "node:os";
3
+ import { join } from "node:path";
7
4
  import process from "node:process";
8
-
5
+ import { mkdir } from "node:fs/promises";
9
6
  //#region src/cache.ts
10
7
  /**
11
8
  * Returns the default cache directory path.
@@ -13,19 +10,13 @@ import process from "node:process";
13
10
  * - Windows: `%LOCALAPPDATA%\fedify`
14
11
  */
15
12
  function getDefaultCacheDir() {
16
- if (process.platform === "win32") {
17
- const localAppData = process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local");
18
- return join(localAppData, "fedify");
19
- }
20
- const xdgCacheHome = process.env.XDG_CACHE_HOME || join(homedir(), ".cache");
21
- return join(xdgCacheHome, "fedify");
13
+ if (process.platform === "win32") return join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "fedify");
14
+ return join(process.env.XDG_CACHE_HOME || join(homedir(), ".cache"), "fedify");
22
15
  }
23
- const DEFAULT_CACHE_DIR = getDefaultCacheDir();
24
- let currentCacheDir = DEFAULT_CACHE_DIR;
16
+ let currentCacheDir = getDefaultCacheDir();
25
17
  async function getCacheDir() {
26
18
  await mkdir(currentCacheDir, { recursive: true });
27
19
  return currentCacheDir;
28
20
  }
29
-
30
21
  //#endregion
31
- export { getCacheDir };
22
+ export { getCacheDir };
package/dist/config.js CHANGED
@@ -1,13 +1,10 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { message } from "@optique/core";
5
3
  import { printError } from "@optique/run";
6
4
  import { readFileSync } from "node:fs";
7
5
  import { parse } from "smol-toml";
8
6
  import { createConfigContext } from "@optique/config";
9
7
  import { array, boolean, number, object as object$1, optional as optional$1, picklist, string as string$1 } from "valibot";
10
-
11
8
  //#region src/config.ts
12
9
  /**
13
10
  * Schema for the webfinger command configuration.
@@ -66,9 +63,9 @@ const nodeinfoSchema = object$1({
66
63
  showMetadata: optional$1(boolean())
67
64
  });
68
65
  /**
69
- * Schema for the complete configuration file.
66
+ * Config context for use with bindConfig().
70
67
  */
71
- const configSchema = object$1({
68
+ const configContext = createConfigContext({ schema: object$1({
72
69
  debug: optional$1(boolean()),
73
70
  userAgent: optional$1(string$1()),
74
71
  tunnelService: optional$1(picklist([
@@ -81,11 +78,7 @@ const configSchema = object$1({
81
78
  inbox: optional$1(inboxSchema),
82
79
  relay: optional$1(relaySchema),
83
80
  nodeinfo: optional$1(nodeinfoSchema)
84
- });
85
- /**
86
- * Config context for use with bindConfig().
87
- */
88
- const configContext = createConfigContext({ schema: configSchema });
81
+ }) });
89
82
  /**
90
83
  * Try to load and parse a TOML config file.
91
84
  * Returns an empty object if the file doesn't exist.
@@ -100,6 +93,5 @@ function tryLoadToml(filePath) {
100
93
  return {};
101
94
  }
102
95
  }
103
-
104
96
  //#endregion
105
- export { configContext, tryLoadToml };
97
+ export { configContext, tryLoadToml };
package/dist/deno.js CHANGED
@@ -1,81 +1,5 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  //#region deno.json
5
- var name = "@fedify/cli";
6
- var version = "2.0.8";
7
- var license = "MIT";
8
- var exports = "./src/mod.ts";
9
- var imports = {
10
- "@hongminhee/localtunnel": "jsr:@hongminhee/localtunnel@^0.3.0",
11
- "@inquirer/prompts": "npm:@inquirer/prompts@^7.8.4",
12
- "@jimp/core": "npm:@jimp/core@^1.6.0",
13
- "@jimp/wasm-webp": "npm:@jimp/wasm-webp@^1.6.0",
14
- "@poppanator/http-constants": "npm:@poppanator/http-constants@^1.1.1",
15
- "chalk": "npm:chalk@^5.6.2",
16
- "cli-table3": "npm:cli-table3@^0.6.5",
17
- "fetch-mock": "npm:fetch-mock@^12.5.4",
18
- "hono": "jsr:@hono/hono@^4.8.3",
19
- "icojs": "npm:icojs@^0.19.5",
20
- "inquirer-toggle": "npm:inquirer-toggle@^1.0.1",
21
- "ora": "npm:ora@^8.2.0",
22
- "shiki": "npm:shiki@^1.6.4",
23
- "smol-toml": "npm:smol-toml@^1.6.0",
24
- "srvx": "npm:srvx@^0.8.7",
25
- "valibot": "jsr:@valibot/valibot@^1.2.0",
26
- "#kv": "./src/kv.node.ts"
27
- };
28
- var exclude = [
29
- "dist/",
30
- "fedify-cli-*.tar.xz",
31
- "fedify-cli-*.tgz",
32
- "fedify-cli-*.zip"
33
- ];
34
- var publish = { "exclude": [
35
- "**/*.test.ts",
36
- "tsdown.config.ts",
37
- "scripts/"
38
- ] };
39
- var tasks = {
40
- "codegen": "deno task -f @fedify/vocab compile",
41
- "check": {
42
- "command": "deno fmt --check && deno lint && deno check src/**/*.ts",
43
- "dependencies": ["codegen"]
44
- },
45
- "run": {
46
- "command": "deno run --allow-all src/mod.ts",
47
- "dependencies": ["codegen"]
48
- },
49
- "runi": "deno run --allow-all src/mod.ts",
50
- "pack": {
51
- "command": "deno run -A scripts/pack.ts",
52
- "dependencies": ["codegen"]
53
- },
54
- "test": {
55
- "command": "deno test --allow-all",
56
- "dependencies": ["codegen"]
57
- },
58
- "test-init": {
59
- "command": "FEDIFY_TEST_MODE=true deno run --allow-all src/init/test/mod.ts test-init",
60
- "dependencies": ["codegen"]
61
- }
62
- };
63
- var fmt = { "exclude": ["src/init/templates/**"] };
64
- var lint = { "exclude": ["src/init/templates/**"] };
65
- var test = { "exclude": ["src/init/test/**"] };
66
- var deno_default = {
67
- name,
68
- version,
69
- license,
70
- exports,
71
- imports,
72
- exclude,
73
- publish,
74
- tasks,
75
- fmt,
76
- lint,
77
- test
78
- };
79
-
3
+ var version = "2.0.9";
80
4
  //#endregion
81
- export { deno_default as default };
5
+ export { version };
package/dist/docloader.js CHANGED
@@ -1,17 +1,13 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { kvCache } from "@fedify/fedify";
5
3
  import { getDocumentLoader } from "@fedify/vocab-runtime";
6
4
  import { getKvStore } from "#kv";
7
-
8
5
  //#region src/docloader.ts
9
6
  const documentLoaders = {};
10
7
  async function getDocumentLoader$1({ userAgent } = {}) {
11
8
  if (documentLoaders[userAgent ?? ""]) return documentLoaders[userAgent ?? ""];
12
- const kv = await getKvStore();
13
9
  return documentLoaders[userAgent ?? ""] = kvCache({
14
- kv,
10
+ kv: await getKvStore(),
15
11
  rules: [
16
12
  [new URLPattern({
17
13
  protocol: "http{s}?",
@@ -47,6 +43,5 @@ async function getDocumentLoader$1({ userAgent } = {}) {
47
43
  function getContextLoader(options = {}) {
48
44
  return getDocumentLoader$1(options);
49
45
  }
50
-
51
46
  //#endregion
52
- export { getContextLoader, getDocumentLoader$1 as getDocumentLoader };
47
+ export { getContextLoader, getDocumentLoader$1 as getDocumentLoader };
@@ -1,12 +1,9 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
4
- import { stat } from "node:fs/promises";
5
- import process from "node:process";
1
+ import "@js-temporal/polyfill";
6
2
  import { printError } from "@optique/run";
3
+ import process from "node:process";
7
4
  import { generateVocab } from "@fedify/vocab-tools";
8
5
  import { message } from "@optique/core/message";
9
-
6
+ import { stat } from "node:fs/promises";
10
7
  //#region src/generate-vocab/action.ts
11
8
  async function runGenerateVocab({ schemaDir, generatedPath }) {
12
9
  if (!(await stat(schemaDir)).isDirectory()) {
@@ -15,6 +12,5 @@ async function runGenerateVocab({ schemaDir, generatedPath }) {
15
12
  }
16
13
  await generateVocab(schemaDir, generatedPath);
17
14
  }
18
-
19
15
  //#endregion
20
- export { runGenerateVocab };
16
+ export { runGenerateVocab as default };
@@ -1,9 +1,6 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { argument, command, constant, message, object, option, withDefault } from "@optique/core";
5
3
  import { path } from "@optique/run";
6
-
7
4
  //#region src/generate-vocab/command.ts
8
5
  const schemaDir = withDefault(option("-i", "--input", path({
9
6
  metavar: "DIR",
@@ -20,7 +17,5 @@ const generateVocabCommand = command("generate-vocab", object("Generation option
20
17
  schemaDir,
21
18
  generatedPath
22
19
  }), { description: message`Generate vocabulary classes from schema files.` });
23
- var command_default = generateVocabCommand;
24
-
25
20
  //#endregion
26
- export { command_default as default };
21
+ export { generateVocabCommand as default };
@@ -1,5 +1,4 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
4
- import { runGenerateVocab } from "./action.js";
5
- import command_default from "./command.js";
1
+ import "@js-temporal/polyfill";
2
+ import "./action.js";
3
+ import "./command.js";
4
+ export {};
@@ -1,13 +1,10 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { Jimp } from "./nodeinfo.js";
5
- import path from "node:path";
6
- import fs from "node:fs/promises";
7
3
  import os from "node:os";
4
+ import path from "node:path";
8
5
  import process from "node:process";
6
+ import fs from "node:fs/promises";
9
7
  import { encodeBase64 } from "byte-encodings/base64";
10
-
11
8
  //#region src/imagerenderer.ts
12
9
  const KITTY_IDENTIFIERS = [
13
10
  "kitty",
@@ -45,27 +42,22 @@ function serializeGrCommand(cmd, payload) {
45
42
  return result;
46
43
  }
47
44
  async function renderImageKitty(imagePath, cmd) {
48
- const imageData = await fs.readFile(imagePath);
49
- const base64Data = encodeBase64(imageData);
50
- let remaining = base64Data;
45
+ let remaining = encodeBase64(await fs.readFile(imagePath));
51
46
  let isFirst = true;
52
47
  while (remaining.length > 0) {
53
48
  const chunk = remaining.slice(0, 4096);
54
49
  remaining = remaining.slice(4096);
55
- const chunkCmd = {
50
+ const command = serializeGrCommand({
56
51
  ...isFirst ? cmd : {},
57
52
  m: remaining.length > 0 ? 1 : 0
58
- };
59
- const command = serializeGrCommand(chunkCmd, chunk);
53
+ }, chunk);
60
54
  process.stderr.write(command);
61
55
  isFirst = false;
62
56
  }
63
57
  }
64
58
  async function renderImageITerm2(imagePath) {
65
- const imageData = await fs.readFile(imagePath);
66
- const base64Data = encodeBase64(imageData);
67
- const encoder = new TextEncoder();
68
- const command = encoder.encode(`\x1b]1337;File=inline=1preserveAspectRatio=1:${base64Data}\x07\n`);
59
+ const base64Data = encodeBase64(await fs.readFile(imagePath));
60
+ const command = new TextEncoder().encode(`\x1b]1337;File=inline=1preserveAspectRatio=1:${base64Data}\x07\n`);
69
61
  process.stderr.write(command);
70
62
  }
71
63
  async function downloadImage(url) {
@@ -87,8 +79,7 @@ async function renderImages(imageUrls) {
87
79
  const tempPath = await downloadImage(url.href);
88
80
  if (!tempPath) continue;
89
81
  const convertedImagePath = `${tempPath}.converted.png`;
90
- const image = await Jimp.read(tempPath);
91
- await image.write(convertedImagePath);
82
+ await (await Jimp.read(tempPath)).write(convertedImagePath);
92
83
  await fs.rm(tempPath);
93
84
  console.error();
94
85
  if (graphicsProtocol === "kitty") await renderImageKitty(convertedImagePath, {
@@ -100,6 +91,5 @@ async function renderImages(imageUrls) {
100
91
  console.error();
101
92
  }
102
93
  }
103
-
104
94
  //#endregion
105
- export { renderImages };
95
+ export { renderImages };
@@ -1,9 +1,6 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { getContextLoader } from "../docloader.js";
5
3
  import { getStatusText } from "@poppanator/http-constants";
6
-
7
4
  //#region src/inbox/rendercode.ts
8
5
  function renderRequest(request) {
9
6
  request = request.clone();
@@ -12,8 +9,7 @@ function renderRequest(request) {
12
9
  }
13
10
  function renderResponse(response) {
14
11
  response = response.clone();
15
- const code = `${response.status} ${response.statusText === "" ? getStatusText(response.status) : response.statusText}`;
16
- return renderMessage(code, response.headers, response);
12
+ return renderMessage(`${response.status} ${response.statusText === "" ? getStatusText(response.status) : response.statusText}`, response.headers, response);
17
13
  }
18
14
  async function renderMessage(code, headers, body) {
19
15
  code += "\n";
@@ -42,6 +38,5 @@ async function renderActivity(activity, expand = false) {
42
38
  function capitalize(name) {
43
39
  return name.replace(/(^|-)./g, (match) => match.toUpperCase());
44
40
  }
45
-
46
41
  //#endregion
47
- export { renderActivity, renderRawActivity, renderRequest, renderResponse };
42
+ export { renderActivity, renderRawActivity, renderRequest, renderResponse };
@@ -1,13 +1,10 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import { Temporal } from "@js-temporal/polyfill";
4
2
  import { renderActivity, renderRawActivity, renderRequest, renderResponse } from "./rendercode.js";
5
3
  import { getStatusText } from "@poppanator/http-constants";
6
4
  import { Fragment } from "hono/jsx";
7
5
  import { getSingletonHighlighter } from "shiki";
8
6
  import util from "node:util";
9
7
  import { jsx, jsxs } from "hono/jsx/jsx-runtime";
10
-
11
8
  //#region src/inbox/view.tsx
12
9
  const Layout = (props) => {
13
10
  return /* @__PURE__ */ jsxs("html", { children: [/* @__PURE__ */ jsxs("head", { children: [
@@ -291,12 +288,11 @@ await highlighter.loadTheme("github-light");
291
288
  await highlighter.loadLanguage("http");
292
289
  await highlighter.loadLanguage("json");
293
290
  const CodeBlock = ({ language, code }) => {
294
- const result = highlighter.codeToHtml(code, {
295
- lang: language,
296
- theme: "github-light"
297
- });
298
291
  return /* @__PURE__ */ jsx("div", {
299
- dangerouslySetInnerHTML: { __html: result },
292
+ dangerouslySetInnerHTML: { __html: highlighter.codeToHtml(code, {
293
+ lang: language,
294
+ theme: "github-light"
295
+ }) },
300
296
  class: "m-3"
301
297
  });
302
298
  };
@@ -452,8 +448,7 @@ const ActivityList = ({ entries }) => {
452
448
  return /* @__PURE__ */ jsx("div", {
453
449
  class: "list-group",
454
450
  children: entries.map((entry, i) => {
455
- const failed = entry.activity == null || entry.response == null || !entry.response.ok || entry.request.method !== "POST";
456
- const itemClass = failed ? "list-group-item-danger" : "";
451
+ const itemClass = entry.activity == null || entry.response == null || !entry.response.ok || entry.request.method !== "POST" ? "list-group-item-danger" : "";
457
452
  const url = new URL(entry.request.url);
458
453
  return /* @__PURE__ */ jsxs("a", {
459
454
  class: "list-group-item list-group-item-action d-flex w-100 justify-content-between " + itemClass,
@@ -503,6 +498,5 @@ const ActivityListPage = ({ handle, entries }) => {
503
498
  }), /* @__PURE__ */ jsx(ActivityList, { entries })]
504
499
  });
505
500
  };
506
-
507
501
  //#endregion
508
- export { ActivityEntryPage, ActivityListPage };
502
+ export { ActivityEntryPage, ActivityListPage };
package/dist/inbox.js CHANGED
@@ -1,8 +1,6 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import { Temporal } from "@js-temporal/polyfill";
4
2
  import { configContext } from "./config.js";
5
- import deno_default from "./deno.js";
3
+ import { version } from "./deno.js";
6
4
  import { getDocumentLoader } from "./docloader.js";
7
5
  import { ActivityEntryPage, ActivityListPage } from "./inbox/view.js";
8
6
  import { configureLogging, recordingSink } from "./log.js";
@@ -10,8 +8,8 @@ import { createTunnelOption } from "./options.js";
10
8
  import { tableStyle } from "./table.js";
11
9
  import { spawnTemporaryServer } from "./tempserver.js";
12
10
  import { colors, matchesActor } from "./utils.js";
13
- import process from "node:process";
14
11
  import { command, constant, group, merge, message, multiple, object, option, string } from "@optique/core";
12
+ import process from "node:process";
15
13
  import { bindConfig } from "@optique/config";
16
14
  import { MemoryKvStore, createFederation, generateCryptoKeyPair } from "@fedify/fedify";
17
15
  import { Accept, Activity, Application, Delete, Endpoints, Follow, Image, PUBLIC_COLLECTION, isActor, lookupObject } from "@fedify/vocab";
@@ -20,8 +18,9 @@ import Table from "cli-table3";
20
18
  import { Hono } from "hono";
21
19
  import ora from "ora";
22
20
  import { jsx } from "hono/jsx/jsx-runtime";
23
-
24
21
  //#region src/inbox.tsx
22
+ /** @jsx react-jsx */
23
+ /** @jsxImportSource hono/jsx */
25
24
  const logger = getLogger([
26
25
  "fedify",
27
26
  "cli",
@@ -62,14 +61,14 @@ const activities = [];
62
61
  const acceptFollows = [];
63
62
  const peers = {};
64
63
  const followers = {};
65
- async function runInbox(command$1) {
64
+ async function runInbox(command) {
66
65
  activities.length = 0;
67
66
  acceptFollows.length = 0;
68
67
  for (const key of Object.keys(peers)) delete peers[key];
69
68
  for (const key of Object.keys(followers)) delete followers[key];
70
- if (command$1.debug) await configureLogging();
69
+ if (command.debug) await configureLogging();
71
70
  const federationDocumentLoader = await getDocumentLoader();
72
- const authorizedFetchEnabled = command$1.authorizedFetch ?? false;
71
+ const authorizedFetchEnabled = command.authorizedFetch ?? false;
73
72
  const authorize = async (ctx) => {
74
73
  if (!authorizedFetchEnabled) return true;
75
74
  return await ctx.getSignedKey() != null;
@@ -132,8 +131,7 @@ async function runInbox(command$1) {
132
131
  const { identifier } = parsed;
133
132
  const follower = await activity.getActor();
134
133
  if (!isActor(follower)) return;
135
- const accepts = await matchesActor(follower, acceptFollows);
136
- if (!accepts || activity.id == null) {
134
+ if (!await matchesActor(follower, acceptFollows) || activity.id == null) {
137
135
  logger.debug("Does not accept follow from {actor}.", { actor: follower.id?.href });
138
136
  return;
139
137
  }
@@ -164,7 +162,7 @@ async function runInbox(command$1) {
164
162
  return {
165
163
  software: {
166
164
  name: "fedify-cli",
167
- version: deno_default.version,
165
+ version,
168
166
  repository: new URL("https://github.com/fedify-dev/fedify")
169
167
  },
170
168
  protocols: ["activitypub"],
@@ -180,20 +178,20 @@ async function runInbox(command$1) {
180
178
  };
181
179
  });
182
180
  const fetch = createFetchHandler(federation, {
183
- actorName: command$1.actorName,
184
- actorSummary: command$1.actorSummary
181
+ actorName: command.actorName,
182
+ actorSummary: command.actorSummary
185
183
  });
186
184
  const sendDeleteToPeers = createSendDeleteToPeers(federation, {
187
- actorName: command$1.actorName,
188
- actorSummary: command$1.actorSummary
185
+ actorName: command.actorName,
186
+ actorSummary: command.actorSummary
189
187
  });
190
188
  const spinner = ora({
191
189
  text: "Spinning up an ephemeral ActivityPub server...",
192
190
  discardStdin: false
193
191
  }).start();
194
192
  const server = await spawnTemporaryServer(fetch, {
195
- noTunnel: !command$1.tunnel,
196
- ...command$1.tunnel && { service: command$1.tunnelService }
193
+ noTunnel: !command.tunnel,
194
+ ...command.tunnel && { service: command.tunnelService }
197
195
  });
198
196
  spinner.succeed(`The ephemeral ActivityPub server is up and running: ${colors.green(server.url.href)}`);
199
197
  process.on("SIGINT", () => {
@@ -211,14 +209,14 @@ async function runInbox(command$1) {
211
209
  spinner.start();
212
210
  const fedCtx = federation.createContext(server.url, {
213
211
  activityIndex: -1,
214
- actorName: command$1.actorName,
215
- actorSummary: command$1.actorSummary
212
+ actorName: command.actorName,
213
+ actorSummary: command.actorSummary
216
214
  });
217
- if (command$1.acceptFollow != null && command$1.acceptFollow.length > 0) acceptFollows.push(...command$1.acceptFollow ?? []);
218
- if (command$1.follow != null && command$1.follow.length > 0) {
215
+ if (command.acceptFollow != null && command.acceptFollow.length > 0) acceptFollows.push(...command.acceptFollow ?? []);
216
+ if (command.follow != null && command.follow.length > 0) {
219
217
  spinner.text = "Following actors...";
220
218
  const documentLoader = await fedCtx.getDocumentLoader({ identifier: "i" });
221
- for (const uri of command$1.follow) {
219
+ for (const uri of command.follow) {
222
220
  spinner.text = `Following ${colors.green(uri)}...`;
223
221
  const actor = await lookupObject(uri, { documentLoader });
224
222
  if (!isActor(actor)) {
@@ -275,7 +273,7 @@ async function printActivityEntry(idx, entry) {
275
273
  const response = entry.response?.clone();
276
274
  const url = new URL(request.url);
277
275
  const activity = entry.activity;
278
- const object$1 = await activity?.getObject();
276
+ const object = await activity?.getObject();
279
277
  const table = new Table({
280
278
  chars: tableStyle,
281
279
  style: {
@@ -283,12 +281,11 @@ async function printActivityEntry(idx, entry) {
283
281
  border: []
284
282
  }
285
283
  });
286
- table.push({ "Request #:": colors.bold(idx.toString()) }, { "Activity type:": activity == null ? colors.red("failed to parse") : colors.green(`${activity.constructor.name}(${object$1?.constructor.name})`) }, { "HTTP request:": `${request.method === "POST" ? colors.green("POST") : colors.red(request.method)} ${url.pathname + url.search}` }, ...response == null ? [] : [{ "HTTP response:": `${response.ok ? colors.green(response.status.toString()) : colors.red(response.status.toString())} ${response.statusText}` }], { "Details": new URL(`/r/${idx}`, url).href });
284
+ table.push({ "Request #:": colors.bold(idx.toString()) }, { "Activity type:": activity == null ? colors.red("failed to parse") : colors.green(`${activity.constructor.name}(${object?.constructor.name})`) }, { "HTTP request:": `${request.method === "POST" ? colors.green("POST") : colors.red(request.method)} ${url.pathname + url.search}` }, ...response == null ? [] : [{ "HTTP response:": `${response.ok ? colors.green(response.status.toString()) : colors.red(response.status.toString())} ${response.statusText}` }], { "Details": new URL(`/r/${idx}`, url).href });
287
285
  console.log(table.toString());
288
286
  }
289
287
  function getHandle(c) {
290
- const url = new URL(c.req.url);
291
- return `@i@${url.host}`;
288
+ return `@i@${new URL(c.req.url).host}`;
292
289
  }
293
290
  const app = new Hono();
294
291
  app.get("/", (c) => c.redirect("/r"));
@@ -343,6 +340,5 @@ function createFetchHandler(federation, actorOptions) {
343
340
  return response;
344
341
  };
345
342
  }
346
-
347
343
  //#endregion
348
- export { inboxCommand, runInbox };
344
+ export { inboxCommand, runInbox };
package/dist/init/mod.js CHANGED
@@ -1,6 +1,3 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { initCommand, runInit } from "@fedify/init";
5
-
6
- export { initCommand, runInit };
3
+ export { initCommand, runInit };
package/dist/kv.bun.js CHANGED
@@ -1,17 +1,11 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { getCacheDir } from "./cache.js";
3
+ import { join } from "node:path";
5
4
  import { SqliteKvStore } from "@fedify/sqlite";
6
5
  import { Database } from "bun:sqlite";
7
- import { join } from "node:path";
8
-
9
6
  //#region src/kv.bun.ts
10
7
  async function getKvStore() {
11
- const path$1 = join(await getCacheDir(), "sqlite");
12
- const sqlite = new Database(path$1);
13
- return new SqliteKvStore(sqlite);
8
+ return new SqliteKvStore(new Database(join(await getCacheDir(), "sqlite")));
14
9
  }
15
-
16
10
  //#endregion
17
- export { getKvStore };
11
+ export { getKvStore };
package/dist/kv.node.js CHANGED
@@ -1,17 +1,11 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { getCacheDir } from "./cache.js";
5
- import { SqliteKvStore } from "@fedify/sqlite";
6
3
  import { join } from "node:path";
4
+ import { SqliteKvStore } from "@fedify/sqlite";
7
5
  import { DatabaseSync } from "node:sqlite";
8
-
9
6
  //#region src/kv.node.ts
10
7
  async function getKvStore() {
11
- const path$1 = join(await getCacheDir(), "sqlite");
12
- const sqlite = new DatabaseSync(path$1);
13
- return new SqliteKvStore(sqlite);
8
+ return new SqliteKvStore(new DatabaseSync(join(await getCacheDir(), "sqlite")));
14
9
  }
15
-
16
10
  //#endregion
17
- export { getKvStore };
11
+ export { getKvStore };
package/dist/log.js CHANGED
@@ -1,13 +1,10 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
-
1
+ import "@js-temporal/polyfill";
4
2
  import { dirname } from "node:path";
5
- import { mkdir } from "node:fs/promises";
6
3
  import process from "node:process";
4
+ import { mkdir } from "node:fs/promises";
7
5
  import { configure, getConsoleSink } from "@logtape/logtape";
8
6
  import { getFileSink } from "@logtape/file";
9
7
  import { AsyncLocalStorage } from "node:async_hooks";
10
-
11
8
  //#region src/log.ts
12
9
  function getRecordingSink() {
13
10
  let records = [];
@@ -48,12 +45,12 @@ await configure({
48
45
  reset: true
49
46
  });
50
47
  async function configureLogging() {
51
- const logFile$1 = process.env["FEDIFY_LOG_FILE"];
48
+ const logFile = process.env["FEDIFY_LOG_FILE"];
52
49
  await configure({
53
50
  sinks: {
54
51
  console: getConsoleSink(),
55
52
  recording: recordingSink,
56
- file: logFile$1 == null ? () => void 0 : getFileSink(logFile$1)
53
+ file: logFile == null ? () => void 0 : getFileSink(logFile)
57
54
  },
58
55
  filters: {},
59
56
  loggers: [
@@ -81,6 +78,5 @@ async function configureLogging() {
81
78
  contextLocalStorage: new AsyncLocalStorage()
82
79
  });
83
80
  }
84
-
85
81
  //#endregion
86
- export { configureLogging, recordingSink };
82
+ export { configureLogging, recordingSink };