-
-
Notifications
You must be signed in to change notification settings - Fork 103
Add property preprocessors to @fedify/vocab-tools and normalize Link icon/image
#793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dahlia
wants to merge
32
commits into
fedify-dev:main
Choose a base branch
from
dahlia:issue-792-property-preprocessors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
1630f55
Add vocabulary property preprocessors to vocab-tools
dahlia 82ec5ea
Normalize Link icon and image values to Image objects
dahlia 469803e
Document property preprocessor changes
dahlia e479455
Expand JSON-LD before preprocessors in property path
dahlia 1db7fb7
Update Node.js and Bun snapshots for preprocessor changes
dahlia bbfe8d0
Use static imports and fix review issues
dahlia 3152298
Guard blank-node IDs in remaining URL construction sites
dahlia cc35832
Resolve relative @id URLs against baseUrl in decoder
dahlia 57eb851
Throw on missing preprocessor module and extract baseUrl
dahlia 6a5265a
Compute resolved URL once for both options.baseUrl and _baseUrl
dahlia 2185439
Add JSDoc to new exported APIs
dahlia 456127f
Note normalizeLinkToImage is exported in CHANGES.md
dahlia 14d24ad
Update Node.js and Bun snapshots for codegen changes
dahlia 0749718
Update Deno snapshot for codegen changes
dahlia 2548564
Re-export normalizeLinkToImage and fix root @id resolution
dahlia 9fed078
Guard root @id URL construction and update snapshots
dahlia a29690b
Revert URL resolution changes and scope baseUrl spread
dahlia 688a54c
Silence baseUrl deprecation in Twoslash compiler options
dahlia fe1a813
Throw on missing preprocessor module in property.ts
dahlia b34f17a
Fix relative @id resolution and preserve Link id
dahlia 92b66cb
Update snapshots for @id resolution changes
dahlia 996c3b7
Restore taskLists plugin accidentally dropped during merge
dahlia c8872aa
Guard URL construction and jsonld.expand calls
dahlia 78f293d
Keep only safe URL.canParse guards, revert decoder guard
dahlia a4b1a72
Restore docs nav entries damaged by stash conflict
dahlia f1a9bde
Handle relative IDs in nested decoders
dahlia 5d2708b
Preserve baseUrl for cached re-parse of preprocessed properties
dahlia 62100f2
Guard blank node @id from baseUrl resolution in constructor
dahlia 7eed2c6
Complete blank-node and non-preprocessor baseUrl coverage
dahlia 540de76
Add URL.canParse guard and deduplicate accessor baseUrl logic
dahlia 61cc233
Drop redundant as string casts and fix preprocessor docs
dahlia d262252
Reject malformed decoded IDs
dahlia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| .jsr-cache.json | ||
| .jsr-cache-*.json | ||
| .jsr-*-cache.json | ||
| .vitepress/cache/ | ||
| .vitepress/dist/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.