Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 10 additions & 12 deletions .claude/testament/2026-04-14.md
Original file line number Diff line number Diff line change
@@ -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<string | symbol, ServiceIdentifier<T>>`. 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.
11 changes: 11 additions & 0 deletions packages/core-di/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/core-di/changes.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
2 changes: 1 addition & 1 deletion packages/core-di/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading