@fedify/vocab 2.4.0-dev.1488 → 2.4.0-dev.1504

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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.4.0-dev.1488+a9fe1094",
3
+ "version": "2.4.0-dev.1504+756217cc",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
package/dist/mod.cjs CHANGED
@@ -33,7 +33,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
33
33
  let es_toolkit = require("es-toolkit");
34
34
  //#region deno.json
35
35
  var name = "@fedify/vocab";
36
- var version = "2.4.0-dev.1488+a9fe1094";
36
+ var version = "2.4.0-dev.1504+756217cc";
37
37
  //#endregion
38
38
  //#region src/type.ts
39
39
  function getTypeId(object) {
package/dist/mod.js CHANGED
@@ -9,7 +9,7 @@ import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/tem
9
9
  import { delay } from "es-toolkit";
10
10
  //#region deno.json
11
11
  var name = "@fedify/vocab";
12
- var version = "2.4.0-dev.1488+a9fe1094";
12
+ var version = "2.4.0-dev.1504+756217cc";
13
13
  //#endregion
14
14
  //#region src/type.ts
15
15
  function getTypeId(object) {
@@ -1206,7 +1206,7 @@ var esm_default = new class FetchMock {
1206
1206
  //#endregion
1207
1207
  //#region deno.json
1208
1208
  var name = "@fedify/vocab";
1209
- var version = "2.4.0-dev.1488+a9fe1094";
1209
+ var version = "2.4.0-dev.1504+756217cc";
1210
1210
  //#endregion
1211
1211
  //#region src/actor.ts
1212
1212
  const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
3
  import { B as __exportAll, E as Person, N as Service, T as Organization, a as Application, m as Group } from "./vocab-XnSGFOqq.mjs";
4
- import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-Cw0Y6V0k.mjs";
4
+ import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-B-hIveNP.mjs";
5
5
  import { createTestMeterProvider, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
7
7
  //#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
3
  import { E as Person, S as Object$1, o as Collection, x as Note } from "./vocab-XnSGFOqq.mjs";
4
- import { c as esm_default, i as isActor, o as name, s as version } from "./actor-Cw0Y6V0k.mjs";
4
+ import { c as esm_default, i as isActor, o as name, s as version } from "./actor-B-hIveNP.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
7
7
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.4.0-dev.1488+a9fe1094",
3
+ "version": "2.4.0-dev.1504+756217cc",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,7 +10,10 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/fedify-dev/fedify/issues"
12
12
  },
13
- "funding": "https://opencollective.com/fedify",
13
+ "funding": [
14
+ "https://opencollective.com/fedify",
15
+ "https://github.com/sponsors/dahlia"
16
+ ],
14
17
  "engines": {
15
18
  "deno": ">=2.0.0",
16
19
  "node": ">=22.0.0",
@@ -43,9 +46,9 @@
43
46
  "es-toolkit": "1.46.1",
44
47
  "jsonld": "^9.0.0",
45
48
  "pkijs": "^3.3.3",
46
- "@fedify/webfinger": "2.4.0-dev.1488+a9fe1094",
47
- "@fedify/vocab-runtime": "2.4.0-dev.1488+a9fe1094",
48
- "@fedify/vocab-tools": "2.4.0-dev.1488+a9fe1094"
49
+ "@fedify/vocab-tools": "2.4.0-dev.1504+756217cc",
50
+ "@fedify/webfinger": "2.4.0-dev.1504+756217cc",
51
+ "@fedify/vocab-runtime": "2.4.0-dev.1504+756217cc"
49
52
  },
50
53
  "devDependencies": {
51
54
  "@types/node": "^22.17.0",
@@ -7,49 +7,36 @@ const LOCK_RETRY_MS = 100;
7
7
  const LOCK_TIMEOUT_MS = 60 * 1000; // 1 minute
8
8
 
9
9
  /**
10
- * Get the latest mtime among files under a directory tree (recursively),
11
- * limited to the given file extensions. Returns 0 if the directory is absent.
10
+ * Get the latest mtime from all YAML files in the schema directory.
12
11
  */
13
- async function getLatestMtimeUnder(
14
- dir: Path,
15
- exts: readonly string[],
16
- ): Promise<number> {
17
- if (!(await dir.exists())) return 0;
12
+ async function getLatestSourceMtime(schemaDir: Path): Promise<number> {
18
13
  let latestMtime = 0;
19
- for await (const entry of Deno.readDir(dir.toString())) {
20
- const child = dir.join(entry.name);
21
- if (entry.isDirectory) {
22
- const mtime = await getLatestMtimeUnder(child, exts);
23
- if (mtime > latestMtime) latestMtime = mtime;
24
- } else if (entry.isFile && exts.some((ext) => entry.name.endsWith(ext))) {
25
- const fileStat = await child.stat();
26
- const mtime = fileStat?.mtime?.getTime() ?? 0;
27
- if (mtime > latestMtime) latestMtime = mtime;
14
+ for await (const entry of schemaDir.readDir()) {
15
+ if (!entry.isFile) continue;
16
+ if (!entry.name.match(/\.ya?ml$/i)) continue;
17
+ if (entry.name === "schema.yaml") continue;
18
+ const fileStat = await schemaDir.join(entry.name).stat();
19
+ if (fileStat?.mtime && fileStat.mtime.getTime() > latestMtime) {
20
+ latestMtime = fileStat.mtime.getTime();
28
21
  }
29
22
  }
30
23
  return latestMtime;
31
24
  }
32
25
 
33
26
  /**
34
- * Check if the generated file is up to date compared to its source files,
35
- * including the generator itself (`@fedify/vocab-tools` and this codegen
36
- * script): changing the generator changes the generated output, so the
37
- * generated file must be at least as new as those too.
27
+ * Check if the generated file is up to date compared to source files.
38
28
  */
39
29
  async function isUpToDate(
40
30
  schemaDir: Path,
41
31
  generatedPath: Path,
42
- generatorMtime: number,
43
32
  ): Promise<boolean> {
44
33
  try {
45
34
  const [sourceMtime, generatedStat] = await Promise.all([
46
- // Match loadSchemaFiles()'s /\.ya?ml$/i: a .yml schema is a real input.
47
- getLatestMtimeUnder(schemaDir, [".yaml", ".yml"]),
35
+ getLatestSourceMtime(schemaDir),
48
36
  generatedPath.stat(),
49
37
  ]);
50
38
  if (!generatedStat?.mtime) return false;
51
- return generatedStat.mtime.getTime() >=
52
- Math.max(sourceMtime, generatorMtime);
39
+ return generatedStat.mtime.getTime() >= sourceMtime;
53
40
  } catch {
54
41
  // If generated file doesn't exist, it's not up to date
55
42
  return false;
@@ -130,20 +117,8 @@ async function codegen() {
130
117
  // Acquire lock to prevent concurrent codegen
131
118
  const lock = await acquireLock(lockPath);
132
119
  try {
133
- // The generated vocab.ts depends not only on the YAML schemas but on the
134
- // generator itself: @fedify/vocab-tools and this codegen script. Sample
135
- // its mtime inside the lock so that a generator edit made while we were
136
- // waiting for the lock is not missed by the freshness check below.
137
- const generatorMtime = Math.max(
138
- await getLatestMtimeUnder(
139
- packageDir.parent()!.join("vocab-tools", "src"),
140
- [".ts", ".yaml", ".yml"],
141
- ),
142
- await getLatestMtimeUnder(scriptsDir, [".ts"]),
143
- );
144
-
145
120
  // Check if regeneration is needed (after acquiring lock)
146
- if (await isUpToDate(schemaDir, realPath, generatorMtime)) {
121
+ if (await isUpToDate(schemaDir, realPath)) {
147
122
  $.log("vocab.ts is up to date, skipping codegen");
148
123
  return;
149
124
  }