From 73a42ca82a552d35c4860f294340fc9d67a77311 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sat, 31 Jan 2026 16:28:09 +0100 Subject: [PATCH] Add backward compatibility for @fedify/fedify/vocab module The @fedify/vocab package was split out from @fedify/fedify in https://github.com/fedify-dev/fedify/pull/517, but the original @fedify/fedify/vocab module was completely removed, breaking existing code. This change restores the @fedify/fedify/vocab module as a deprecated re-export of @fedify/vocab, allowing existing code to continue working while users gradually migrate to importing from @fedify/vocab directly. The module is marked with @deprecated JSDoc tags to guide users toward the migration. Changes include: - Created packages/fedify/src/vocab/mod.ts that re-exports all exports from @fedify/vocab with deprecation notice - Added ./vocab export to deno.json for Deno environment - Added ./vocab export to package.json for Node.js/Bun - Added ./src/vocab/mod.ts to tsdown build entry points - Updated CHANGES.md to document the deprecation Related to https://github.com/fedify-dev/fedify/issues/437 and https://github.com/fedify-dev/fedify/pull/517. --- CHANGES.md | 14 ++++++++++---- packages/fedify/deno.json | 3 ++- packages/fedify/package.json | 10 ++++++++++ packages/fedify/src/vocab/mod.ts | 13 +++++++++++++ packages/fedify/tsdown.config.ts | 1 + 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 packages/fedify/src/vocab/mod.ts diff --git a/CHANGES.md b/CHANGES.md index b87686b3..a18f6d29 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -90,6 +90,12 @@ To be released. - Removed `@fedify/fedify/x/sveltekit` in favor of `@fedify/sveltekit`. - Removed `@fedify/fedify/x/fresh` (Fresh integration). [[#466]] + - Deprecated the `@fedify/fedify/vocab` module in favor of the new + `@fedify/vocab` package. The `@fedify/fedify/vocab` module now re-exports + all exports from `@fedify/vocab` for backward compatibility, but will be + removed in a future version. Please migrate to `@fedify/vocab` directly. + [[#437], [#517] by ChanHaeng Lee] + - The `KvStore.list()` method is now required instead of optional. This method was added as optional in version 1.10.0 to give existing implementations time to add support. All official `KvStore` implementations @@ -119,6 +125,7 @@ To be released. [#393]: https://github.com/fedify-dev/fedify/pulls/393 [#433]: https://github.com/fedify-dev/fedify/pull/433 [#434]: https://github.com/fedify-dev/fedify/pull/434 +[#437]: https://github.com/fedify-dev/fedify/issues/437 [#441]: https://github.com/fedify-dev/fedify/issues/441 [#444]: https://github.com/fedify-dev/fedify/issues/444 [#445]: https://github.com/fedify-dev/fedify/pull/445 @@ -126,6 +133,7 @@ To be released. [#466]: https://github.com/fedify-dev/fedify/issues/466 [#499]: https://github.com/fedify-dev/fedify/issues/499 [#506]: https://github.com/fedify-dev/fedify/pull/506 +[#517]: https://github.com/fedify-dev/fedify/pull/517 [#536]: https://github.com/fedify-dev/fedify/issues/536 [#538]: https://github.com/fedify-dev/fedify/issues/538 [#540]: https://github.com/fedify-dev/fedify/pull/540 @@ -283,18 +291,16 @@ To be released. including parsing and generating WebFinger documents. [[#517] by ChanHaeng Lee] -[#517]: https://github.com/fedify-dev/fedify/pull/517 - ### @fedify/vocab - Created ActivityPub Vocabulary API package as the *@fedify/vocab* package. This package contains the generated Activity Vocabulary classes and related types, separated from the main *@fedify/fedify* package to improve modularity and enable custom vocabulary extensions. + The previous `@fedify/fedify/vocab` module is now deprecated and + re-exports all exports from this package for backward compatibility. [[#437], [#517] by ChanHaeng Lee] -[#437]: https://github.com/fedify-dev/fedify/issues/437 - ### @fedify/sqlite - Added `SqliteMessageQueue` class implementing `MessageQueue` interface diff --git a/packages/fedify/deno.json b/packages/fedify/deno.json index 6b696a6e..3099074a 100644 --- a/packages/fedify/deno.json +++ b/packages/fedify/deno.json @@ -9,7 +9,8 @@ "./nodeinfo": "./src/nodeinfo/mod.ts", "./otel": "./src/otel/mod.ts", "./sig": "./src/sig/mod.ts", - "./utils": "./src/utils/mod.ts" + "./utils": "./src/utils/mod.ts", + "./vocab": "./src/vocab/mod.ts" }, "imports": { "@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1", diff --git a/packages/fedify/package.json b/packages/fedify/package.json index 96751da2..f0ee3afe 100644 --- a/packages/fedify/package.json +++ b/packages/fedify/package.json @@ -107,6 +107,16 @@ "import": "./dist/utils/mod.js", "require": "./dist/utils/mod.cjs", "default": "./dist/utils/mod.js" + }, + "./vocab": { + "types": { + "import": "./dist/vocab/mod.d.ts", + "require": "./dist/vocab/mod.d.cts", + "default": "./dist/vocab/mod.d.ts" + }, + "import": "./dist/vocab/mod.js", + "require": "./dist/vocab/mod.cjs", + "default": "./dist/vocab/mod.js" } }, "dependencies": { diff --git a/packages/fedify/src/vocab/mod.ts b/packages/fedify/src/vocab/mod.ts new file mode 100644 index 00000000..f4617bbb --- /dev/null +++ b/packages/fedify/src/vocab/mod.ts @@ -0,0 +1,13 @@ +/** + * A set of type-safe object mappings for the [Activity + * Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/). + * + * @deprecated This module has been moved to the `@fedify/vocab` package. + * Please use `@fedify/vocab` instead of `@fedify/fedify/vocab`. + * This module will be removed in a future version. + * See {@link https://github.com/fedify-dev/fedify/issues/437} + * and {@link https://github.com/fedify-dev/fedify/pull/517} + * for more details. + * @module + */ +export * from "@fedify/vocab"; diff --git a/packages/fedify/tsdown.config.ts b/packages/fedify/tsdown.config.ts index 89c6eb41..de361b5f 100644 --- a/packages/fedify/tsdown.config.ts +++ b/packages/fedify/tsdown.config.ts @@ -12,6 +12,7 @@ export default [ "./src/otel/mod.ts", "./src/utils/mod.ts", "./src/sig/mod.ts", + "./src/vocab/mod.ts", ], dts: true, format: ["esm", "cjs"],