0.4.0
Minor Changes
#1101 Breaking: a test bed's
dispose()is renameddisposeAsync(), matching@codefast/di'sContainer#disposeAsync()— it returns aPromise, so it carries theAsyncsuffix.await using bed = …compile()is unchanged; replaceawait bed.dispose()withawait bed.disposeAsync().#1068 Lower the Node.js floor from 24 to the lowest release the package, its dependencies and its full test suite run on: 22.12 for
@codefast/cliand@codefast/tailwind-variants, 22.18 for@codefast/diand@codefast/di-testing, and 22.22.2 for@codefast/theme,@codefast/trackingand@codefast/ui. Each floor is type-checked against what Node 22 ships and proven by running the package's tests on that release in CI.
Patch Changes
- #1120 The README and the test bed's internals follow
@codefast/di's rename ofoptional()toinjectOptional(). - Updated dependencies:
- @codefast/di@0.14.0
0.3.0
Minor Changes
- #999 Requires
@codefast/di0.12, whose chains declare a binding's slot before its strategy; the test beds bind their mocks and real collaborators in that order.
Patch Changes
#1005 Breaking for deep subpath imports only — the root entry
@codefast/diis unchanged.src/now follows three rules, and the published subpaths followsrc/with no exception: a directory names a family of two or more modules and a lone module sits flat at its layer; a directory carries the topic and a file its role, so no file repeats its directory's name; and the exports map is the source tree, so thestripthat kept the introspection modules at flat specifiers is gone.Moves: the
MetadataReaderverification leavesresolution/cache/class-introspectorformetadata/verify— it was the one value import pointing up frommetadata/intoresolution/; theRESOLUTION_DIAGNOSTICSchannel leaveserrors/forintrospection/diagnostics; the fluent chain's contract leavescore/bindingforcore/binding-builders, and the class implementing it iscontainer/binding-chain;effectiveBindingScopefolds intocore/binding.Renamed specifiers:
./errors/errors→./errors;./errors/diagnostics→./introspection/diagnostics;./ambient/active-container→./ambient-container;./container/binding-builders→./container/binding-chain;./core/binding-scope→ gone (effectiveBindingScopeis in./core/binding);./injection/resolve-options→./injection/dependency-slot;./metadata/{metadata-keys,metadata-types,metadata-reader-token,symbol-metadata-reader,verifying-metadata-reader}→./metadata/{keys,types,reader-token,symbol-reader,verifying-reader};./lifecycle/{lifecycle-manager,scope-manager}→./lifecycle/{hooks,scopes};./decorators/{lifecycle-decorators,decorator-metadata}→./decorators/{lifecycle,metadata-record};./resolution/path/resolution-path→./resolution/path;./resolution/plan/{instantiation-plan,plan-codegen}→./resolution/plan/{compiler,codegen};./resolution/select/binding-select→./resolution/select/candidates;./resolution/cache/binding-lookup-cache→./resolution/cache/lookup;./{inspector,explanation,dependency-graph,graph-adapters/*}→./introspection/{inspector,explanation,dependency-graph,graph-adapters/*}. New:./core/binding-builders,./metadata/verify.@codefast/di-testingfollows the one specifier it imports,metadata/verifying-reader.Updated dependencies:
- @codefast/di@0.12.0
0.2.0
Minor Changes
#952 A suite now states its mock backend once, and a test bed can no longer be typed against one backend and built from another.
createTestBed({ mockFactory, metadataReader? })returns the entry point every bed begins from, itsBackendinferred from the factory;TestBed.solitary(target)andTestBed.sociable(target)take the target only. TheTestBedexport iscreateTestBed({ mockFactory: defaultMockFactory }), the built-in spy with no framework needed.Before, the backend was chosen per call —
TestBed.solitary(Unit, { mockFactory: () => vi.fn() })— andTestBed.solitary<Unit, SinonStub>(Unit)with no factory type-checked, typed every mock asSinonStub, and built the default spy. Migrate by creating the suite's entry point once:import { createTestBed } from "@codefast/di-testing"; import { vi } from "vitest"; export const TestBed = createTestBed({ mockFactory: () => vi.fn() });TestBedOptions<Backend>configurescreateTestBedand requiresmockFactory;TestBedStatic<Backend>names the entry point's backend and has no default.createTestBedthrows the newMissingMockFactoryError(MISSING_MOCK_FACTORY) for a caller past the types who passes no factory, instead of standing the built-in spy in for a backend nobody chose.#976
engines.nodeis now>=24.0.0, up from>=22.12.0, and Node 22 is no longer supported. Node 24.0.0 is the first release with explicit resource management built in (using,await using,DisposableStack,AsyncDisposableStack,SuppressedError) and all of ES2025, so the packages use both as the platform ships them instead of shimming them for an older line, and the CI matrix runs the unit suite on 24.0.0 itself. Move to Node 24, or stay on the current minor while a deployment still runs Node 22.
Patch Changes
#976 The README states what a program needs for the declarations' disposal members: the explicit resource management types, which no numbered
libdeclares before ES2027.@types/node24 or later loads them, and so doesESNext.Disposableinlib. Without either, TypeScript 7 fails insidecontainer.d.tswith TS2550 underskipLibCheck: false, and atawait usingwith TS2318.@codefast/di-testingdrops a/// <reference lib="esnext.disposable" />that TypeScript 7 stripped from its emitted declarations anyway, and takes the lib from itstsconfig.jsoninstead.#956
README.mdno longer quotes the@codefast/dipeer range, which had fallen behindpackage.json— the release tooling moves that range, so the manifest is the one place it is stated.#965
README.mdnow states TypeScript 7 or later as the floor for the package's types — the one compiler every@codefast/*package is built and checked with. No code or declaration changed.Updated dependencies:
- @codefast/di@0.11.0
0.1.4
Patch Changes
#892
4c97c5bThanks @thevuong! - Lower the monorepo's Node floor from 24 to 22.12, so the packages install and run on the active Node 22 LTS line.engines.nodebecomes>=22.12.0across every package — the floor the shared toolchain (oxlint, Vite, Vitest, TanStack Start) already requires. Development stays on the latest Node (.node-version) for speed, and a CI matrix exercises the floor and the active LTS directly, so the floor is a contract CI proves rather than one everyone has to run.@types/nodeis pinned to the floor's major (^22), with a workspace override holding the whole tree there so a dev tool's@types/node: "*"peer can no longer pull a newer major and mask an API the floor lacks. The floor stays mechanical, not advisory:@codefast/dikeeps its ownMapupsert helpers rather than the ES2025Map.prototype.getOrInsert(which would raise the floor to 26) and itslibstaysES2024.@codefast/cli's mirror step now calls thenode:pathfunctions directly instead of aliasing them, which the floor's types correctly flag as unbound methods.The shared
@codefast/typescript-configpresets pinlibandtargettoES2024(wasESNext) so the compiler's ECMAScript surface matches the Node floor: an ES2025 builtin such asMap.prototype.getOrInsertnow fails to type-check rather than compiling and crashing on Node 22.12.@codefast/diand@codefast/di-testingalready pinnedliband are unchanged.Internal subpath imports move from a
#/prefix to a bare#(#core/token, not#/core/token), and thepackage.json#importskeys become#*/#tests/*/#examples/*to match. Node's native ESM resolver rejects a#/-prefixed specifier withERR_INVALID_MODULE_SPECIFIERon the whole Node 22 line (and on Node 24 before 24.14), and each package ships those specifiers verbatim inside its publisheddist/*.jsfor a consumer's Node to resolve — so this rename is what actually lets the packages import on the new floor. Purely internal: a consumer's own import paths are unchanged.Updated dependencies [
4c97c5b]:- @codefast/di@0.10.1
0.1.3
Patch Changes
#827
0984174Thanks @thevuong! -package.jsonnow carrieshomepageandbugs, so npm links the package README and the issue tracker the way the other@codefast/*packages already do.#848
ffb61a0Thanks @thevuong! - README samples declare tokens with a<namespace>:<Name>display name, matching the convention@codefast/didocuments.Updated dependencies [
0984174,d0b794c]:- @codefast/di@0.9.0
0.1.2
Patch Changes
#791
37a212bThanks @thevuong! - Point the README's license badge and "License" section at the package's ownLICENSEfile instead of the monorepo root.#796
ba04d27Thanks @thevuong! - Rewrite the README around one structure — what the package is, installation and requirements, a complete quick start, the concepts in learning order, then the documents and the license — with every API claim checked against the current code and no figures that go stale.#784
ad2f93aThanks @thevuong! - Ship the MITLICENSEfile in the published package.filesalready listed it, but the file was missing from the package directory, so the tarball had none.Updated dependencies [
37a212b,ba04d27,ad2f93a]:- @codefast/di@0.8.1
0.1.1
Patch Changes
- #774
176e95aThanks @thevuong! - Fold di's reservedslotNamecriterion into slot addressing, so{ name: "x" }and{ tag: slotName.of("x") }— one slot to the container — are one slot to TestBed too: a mock registered with either spelling now matches a dependency declared with the other, andmocks.get(token, options)accepts both. - Updated dependencies [
96af502]:- @codefast/di@0.8.0
0.1.0
Minor Changes
- #771
33c19b7Thanks @thevuong! - Add@codefast/di-testing: solitary and sociable auto-mocking test beds for@codefast/di.TestBed.solitary(Class)reads a class's declared dependencies through di'sMetadataReader, builds a mock for each, and constructs the real unit through a container so@postConstruct, accessor injection, and@preDestroyrun as in production. The default mock is a zero-dependency spy; passmockFactory: () => vi.fn()to build the mocks from Vitest, Jest, or Sinon — the factory's return type flows through the bed, so each backend's own mock API type-checks onmocks.get(...)and inside.stubcallbacks with no adapter packages. Overrides cover fixed sealed values (.using), partial stubs (.stub), absent optionals (.absent),injectAllelement lists (.usingAll), and slot-targeted mocks (.mock(token, { name })); beds exposeresetMocks()andawait usingdisposal.TestBed.sociable(Class).expose(Collaborator)keeps chosen class-keyed collaborators real (recursively, lifecycle included) while token-keyed dependencies stay mocked as the declared boundary;bed.exposed(Class)retrieves the real instances.