diff --git a/.claude/testament/2026-04-14.md b/.claude/testament/2026-04-14.md index fce5874..1003a36 100644 --- a/.claude/testament/2026-04-14.md +++ b/.claude/testament/2026-04-14.md @@ -1,21 +1,19 @@ -# 05:30 +# core-di @abraham/reflection removal -## Remove @abraham/reflection from core-di +## inject.ts is not just a side effect -### Not just metadata.ts - -The prompt says to update `metadata.ts`. Three files actually needed touching: +The prompt targets `metadata.ts`. Three files actually need touching: 1. `src/private/metadata.ts` - the WeakMap replacement -2. `inject.ts` at the package root - this was the tsup inject target (prepended to every bundle). It imported `@abraham/reflection` to ensure the polyfill loaded before any bundle code. After the dependency was removed, this file needed its import cleared. The file still exists and `tsconfig.json` still references it as the inject entry; leaving it empty is correct and harmless. -3. `package.json` / `pnpm-lock.yaml` - via `pnpm remove` +2. `inject.ts` at the package root - this is the tsup inject entry, prepended to every bundle. It imported `@abraham/reflection` to bootstrap the polyfill before any bundle code ran. After the dependency is removed, the import must be cleared. The file should remain (tsconfig still references it); leaving it empty is correct. +3. `package.json` / `pnpm-lock.yaml` via `pnpm remove` -Missing the `inject.ts` change would have left a dead import and a broken build. +Missing the `inject.ts` change leaves a dead import and a broken build with no obvious connection to `metadata.ts`. -### WeakMap semantics are equivalent here +## Why the WeakMap replacement is safe -`@abraham/reflection` `getMetadata` walked the prototype chain (`ordinaryGetMetadata`). The WeakMap replacement does not. This is fine: both callers (`dependsOn.ts` and `ServiceProvider.ts`) always call with the class constructor directly, never with an instance or subclass. The prototype walk was never exercised by this codebase. +`@abraham/reflection` `getMetadata` walked the prototype chain. The WeakMap replacement does not. This is safe because both callers (`dependsOn.ts` and `ServiceProvider.ts`) always pass the class constructor directly, never an instance or subclass. The prototype walk was never exercised. -### Where metadata flows +## Older CHANGELOG entries have bare version tags -`dependsOn.ts` writes when a `@dependsOn` decorator fires. `ServiceProvider.ts` reads when resolving dependencies. The key is always `'design:dependencies'`, the value is `Record>`. Nothing else in the package touches the metadata API. +The changelog generator uses whatever `tag` field is in each release entry. Releases before the `core-di@X.Y.Z` tag format was adopted used bare `3.1.6`-style values. Those links will not resolve to real tags. This is pre-existing; do not touch it. diff --git a/packages/core-di/CHANGELOG.md b/packages/core-di/CHANGELOG.md index 7a24683..098573a 100644 --- a/packages/core-di/CHANGELOG.md +++ b/packages/core-di/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.1.7] - 2026-04-14 + +### Changed + +- Replace @abraham/reflection with a global WeakMap for metadata storage + +### Removed + +- Remove @abraham/reflection dependency + ## [3.1.6] - 2026-02-28 ### Changed @@ -183,6 +193,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release. +[3.1.7]: https://github.com/shellicar/ecosystem/releases/tag/core-di@3.1.7 [3.1.6]: https://github.com/shellicar/ecosystem/releases/tag/3.1.6 [3.1.5]: https://github.com/shellicar/ecosystem/releases/tag/3.1.5 [3.1.4]: https://github.com/shellicar/ecosystem/releases/tag/3.1.4 diff --git a/packages/core-di/changes.jsonl b/packages/core-di/changes.jsonl index 0edbc77..282dd12 100644 --- a/packages/core-di/changes.jsonl +++ b/packages/core-di/changes.jsonl @@ -64,3 +64,4 @@ {"type":"release","version":"3.1.6","date":"2026-02-28","tag":"3.1.6"} {"description":"Replace @abraham/reflection with a global WeakMap for metadata storage","category":"changed"} {"description":"Remove @abraham/reflection dependency","category":"removed"} +{"type":"release","version":"3.1.7","date":"2026-04-14","tag":"core-di@3.1.7"} diff --git a/packages/core-di/package.json b/packages/core-di/package.json index 1d59ce7..1bc7f81 100644 --- a/packages/core-di/package.json +++ b/packages/core-di/package.json @@ -1,7 +1,7 @@ { "name": "@shellicar/core-di", "private": false, - "version": "3.1.6", + "version": "3.1.7", "type": "module", "license": "MIT", "author": "Stephen Hellicar",