Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1630f55
Add vocabulary property preprocessors to vocab-tools
dahlia Jun 5, 2026
82ec5ea
Normalize Link icon and image values to Image objects
dahlia Jun 5, 2026
469803e
Document property preprocessor changes
dahlia Jun 5, 2026
e479455
Expand JSON-LD before preprocessors in property path
dahlia Jun 5, 2026
1db7fb7
Update Node.js and Bun snapshots for preprocessor changes
dahlia Jun 5, 2026
bbfe8d0
Use static imports and fix review issues
dahlia Jun 5, 2026
3152298
Guard blank-node IDs in remaining URL construction sites
dahlia Jun 5, 2026
cc35832
Resolve relative @id URLs against baseUrl in decoder
dahlia Jun 5, 2026
57eb851
Throw on missing preprocessor module and extract baseUrl
dahlia Jun 5, 2026
6a5265a
Compute resolved URL once for both options.baseUrl and _baseUrl
dahlia Jun 5, 2026
2185439
Add JSDoc to new exported APIs
dahlia Jun 5, 2026
456127f
Note normalizeLinkToImage is exported in CHANGES.md
dahlia Jun 5, 2026
14d24ad
Update Node.js and Bun snapshots for codegen changes
dahlia Jun 5, 2026
0749718
Update Deno snapshot for codegen changes
dahlia Jun 5, 2026
2548564
Re-export normalizeLinkToImage and fix root @id resolution
dahlia Jun 6, 2026
9fed078
Guard root @id URL construction and update snapshots
dahlia Jun 6, 2026
a29690b
Revert URL resolution changes and scope baseUrl spread
dahlia Jun 6, 2026
688a54c
Silence baseUrl deprecation in Twoslash compiler options
dahlia Jun 6, 2026
fe1a813
Throw on missing preprocessor module in property.ts
dahlia Jun 6, 2026
b34f17a
Fix relative @id resolution and preserve Link id
dahlia Jun 6, 2026
92b66cb
Update snapshots for @id resolution changes
dahlia Jun 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,30 @@ To be released.

[#489]: https://github.com/fedify-dev/fedify/issues/489

### @fedify/vocab-runtime

- Added `PropertyPreprocessor`, `PropertyPreprocessorContext`, and `Json`
types for normalizing wire-level JSON-LD property values before the
generated range decoder runs. [[#792]]

[#792]: https://github.com/fedify-dev/fedify/issues/792

### @fedify/vocab

- Explicit ActivityStreams `Link` objects in `icon` and `image` properties
are now normalized to `Image` during decoding via the new exported
`normalizeLinkToImage()` preprocessor. The public `Image`-oriented
TypeScript API is unchanged. [[#790], [#792]]

[#790]: https://github.com/fedify-dev/fedify/issues/790

### @fedify/vocab-tools

- Property schemas now support a `preprocessors` field that lists
module/function pairs. Generated decoders dynamically import and run
these preprocessors for each expanded JSON-LD property value before
falling back to the normal range decoder. [[#792]]


Version 2.2.5
-------------
Expand Down
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.jsr-cache.json
.jsr-*-cache.json
.jsr-cache-*.json
.vitepress/cache/
.vitepress/dist/
node_modules/
69 changes: 18 additions & 51 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import taskLists from "@hackmd/markdown-it-task-lists";
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
import abbr from "markdown-it-abbr";
import deflist from "markdown-it-deflist";
Expand All @@ -15,24 +14,15 @@ import {
import llmstxt from "vitepress-plugin-llms";
import { withMermaid } from "vitepress-plugin-mermaid";

const jsrRefVersion = process.env.JSR_REF_VERSION ?? "unstable";
const jsrRefPackages = [
["@fedify/fedify", ".jsr-cache.json"],
["@fedify/vocab", ".jsr-vocab-cache.json"],
["@fedify/vocab-runtime", ".jsr-vocab-runtime-cache.json"],
["@fedify/webfinger", ".jsr-webfinger-cache.json"],
["@fedify/debugger", ".jsr-debugger-cache.json"],
["@fedify/testing", ".jsr-testing-cache.json"],
] as const;
const jsrRefPlugins = await Promise.all(
jsrRefPackages.map(([packageName, cachePath]) =>
jsrRef({
package: packageName,
version: jsrRefVersion,
cachePath,
})
),
);
const jsrRefPlugins: (Awaited<ReturnType<typeof jsrRef>>)[] = [];
for (const pkg of ["fedify", "vocab", "vocab-runtime", "webfinger"]) {
const jsrRefPlugin = await jsrRef({
package: `@fedify/${pkg}`,
version: process.env.JSR_REF_VERSION ?? "unstable",
cachePath: `.jsr-cache-${pkg}.json`,
});
jsrRefPlugins.push(jsrRefPlugin);
}

let extraNav: { text: string; link: string }[] = [];
if (process.env.EXTRA_NAV_TEXT && process.env.EXTRA_NAV_LINK) {
Expand Down Expand Up @@ -112,15 +102,6 @@ const TUTORIAL = {
},
{ text: "Learning the basics", link: "/tutorial/basics.md" },
{ text: "Creating a microblog", link: "/tutorial/microblog.md" },
{
text: "Creating an image sharing service",
link: "/tutorial/content-sharing.md",
},
{ text: "Building a federated blog", link: "/tutorial/astro-blog.md" },
{
text: "Building a threadiverse community",
link: "/tutorial/threadiverse.md",
},
],
activeMatch: "/tutorial",
};
Expand All @@ -134,7 +115,6 @@ const MANUAL = {
{ text: "Vocabulary", link: "/manual/vocab.md" },
{ text: "Actor dispatcher", link: "/manual/actor.md" },
{ text: "Inbox listeners", link: "/manual/inbox.md" },
{ text: "Outbox listeners", link: "/manual/outbox.md" },
{ text: "Sending activities", link: "/manual/send.md" },
{ text: "Collections", link: "/manual/collections.md" },
{ text: "Object dispatcher", link: "/manual/object.md" },
Expand All @@ -145,16 +125,13 @@ const MANUAL = {
{ text: "Pragmatics", link: "/manual/pragmatics.md" },
{ text: "Key–value store", link: "/manual/kv.md" },
{ text: "Message queue", link: "/manual/mq.md" },
{ text: "Circuit breaker", link: "/manual/circuit-breaker.md" },
{ text: "Integration", link: "/manual/integration.md" },
{ text: "Migration", link: "/manual/migrate.md" },
{ text: "Relay", link: "/manual/relay.md" },
{ text: "Testing", link: "/manual/test.md" },
{ text: "Debugging", link: "/manual/debug.md" },
{ text: "Linting", link: "/manual/lint.md" },
{ text: "Logging", link: "/manual/log.md" },
{ text: "OpenTelemetry", link: "/manual/opentelemetry.md" },
{ text: "Benchmarking", link: "/manual/benchmarking.md" },
{ text: "Deployment", link: "/manual/deploy.md" },
],
activeMatch: "/manual",
Expand Down Expand Up @@ -292,15 +269,12 @@ export default withMermaid(defineConfig({
transformerTwoslash({
twoslashOptions: {
compilerOptions: {
ignoreDeprecations: "6.0",
moduleResolution: ModuleResolutionKind.Bundler,
module: ModuleKind.ESNext,
target: ScriptTarget.ESNext,
experimentalDecorators: true, // For @fedify/nestjs
emitDecoratorMetadata: true, // For @fedify/nestjs
// Silences TS5101 about the `baseUrl` injected by @typescript/vfs
// when Twoslash spins up its virtual TS environment; the option
// is deprecated in TypeScript 6.0 and removed in 7.0.
ignoreDeprecations: "6.0",
lib: ["dom", "dom.iterable", "esnext"],
types: [
"dom",
Expand All @@ -321,7 +295,6 @@ export default withMermaid(defineConfig({
md.use(abbr);
md.use(deflist);
md.use(footnote);
md.use(taskLists);
md.use(groupIconMdPlugin);
Comment on lines 295 to 298
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore task-list markdown rendering

With the task-list plugin no longer registered, the deployment checklist in docs/manual/deploy.md (the - [ ] items around lines 1499-1564) will render as plain list text instead of checkboxes in the published docs. This affects the generated documentation whenever that page is built, so keep @hackmd/markdown-it-task-lists wired into the Markdown config or replace it with equivalent task-list support.

Useful? React with 👍 / 👎.

for (const jsrRefPlugin of jsrRefPlugins) {
md.use(jsrRefPlugin);
Expand All @@ -336,20 +309,14 @@ export default withMermaid(defineConfig({
plugins: [
groupIconVitePlugin(),
llmstxt({
ignoreFilesPerOutput: {
llmsTxt: [
"changelog.md",
"contribute.md",
"README.md",
"sponsors.md",
],
llmsFullTxt: [
"changelog.md",
"contribute.md",
"README.md",
"sponsors.md",
],
},
ignoreFiles: [
"changelog.md",
"contribute.md",
"README.md",
"security.md",
"sponsors.md",
"tutorial.md",
],
}),
],
},
Expand Down
5 changes: 5 additions & 0 deletions packages/vocab-runtime/src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export {
type GetUserAgentOptions,
logRequest,
} from "./request.ts";
export {
type Json,
type PropertyPreprocessor,
type PropertyPreprocessorContext,
} from "./preprocessor.ts";
export {
expandIPv6Address,
isValidPublicIPv4Address,
Expand Down
43 changes: 43 additions & 0 deletions packages/vocab-runtime/src/preprocessor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import type { DocumentLoader } from "./docloader.ts";
import type { TracerProvider } from "@opentelemetry/api";

/**
* JSON value shape passed to property preprocessors.
* @since 2.3.0
*/
export type Json =
| string
| number
| boolean
| null
| readonly Json[]
| { readonly [key: string]: Json };

/**
* Runtime context provided to property preprocessors.
* @since 2.3.0
*/
export interface PropertyPreprocessorContext {
/** Loader for remote JSON-LD documents. */
documentLoader?: DocumentLoader;
/** Loader for remote JSON-LD contexts. */
contextLoader?: DocumentLoader;
/** OpenTelemetry tracer provider for instrumentation. */
tracerProvider?: TracerProvider;
/** Base URL for resolving relative references. */
baseUrl?: URL;
}

/**
* Function signature for schema-configured property preprocessors.
*
* Receives an expanded JSON-LD property value and returns a vocabulary
* object when the value is handled, `undefined` when the value should
* fall through to the normal range decoder, or an `Error` when the value
* is recognized but cannot be converted.
* @since 2.3.0
*/
export type PropertyPreprocessor<T = unknown> = (
value: Json,
context: PropertyPreprocessorContext,
) => T | undefined | Error | Promise<T | undefined | Error>;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Loading