Skip to content

feat(kida,preact,query,react,router,store,svelte,svelte-kit): support of injectable classes was added#133

Merged
dangreen merged 3 commits into
mainfrom
di-renaming
Jun 3, 2026
Merged

feat(kida,preact,query,react,router,store,svelte,svelte-kit): support of injectable classes was added#133
dangreen merged 3 commits into
mainfrom
di-renaming

Conversation

@dangreen
Copy link
Copy Markdown
Member

@dangreen dangreen commented Jun 3, 2026

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.85%. Comparing base (9115a66) to head (8bc504c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #133   +/-   ##
=======================================
  Coverage   83.85%   83.85%           
=======================================
  Files         135      135           
  Lines        2949     2949           
  Branches      550      550           
=======================================
  Hits         2473     2473           
  Misses        338      338           
  Partials      138      138           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands Nano Kit’s dependency injection model to support class-based injectables (in addition to function tokens), and updates framework integrations, types, tests, and documentation to use the new Injectable token concept.

Changes:

  • Introduces class-based injectable support in kida via Injectable + Injectable$.
  • Replaces InjectionFactory usages with Injectable across React/Preact/Svelte integrations and related fixtures.
  • Updates SSR dehydration-related APIs/types and documentation to reflect “injectable tokens” terminology.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/src/content/docs/tutorial/prepare-for-ssr.mdx Updates SSR tutorial wording from “factories” to “injectable tokens”.
website/src/content/docs/store/core-concepts.mdx Updates DI docs and adds “Class Tokens” section; example code updated.
website/src/content/docs/examples/weather.mdx Minor wording update around DI description.
packages/svelte/test/ProviderFixture.svelte Updates test fixture types from InjectionFactory to Injectable.
packages/svelte/test/IsolateFixture.svelte Updates test fixture types from InjectionFactory to Injectable.
packages/svelte/src/core.ts Updates getInject signature/docs to accept Injectable.
packages/svelte-kit/src/dehydration.ts Updates dehydration API to accept a plain store-list factory.
packages/store/src/tasks.ts Updates DI-related docstrings to “injectable factory”.
packages/router/src/router.types.ts Replaces InjectionFactory-based aliases with plain factory types and updates comments.
packages/react/src/dehydration.tsx Updates dehydration API types and related comments.
packages/react/src/core.tsx Updates useInject / injectHook to accept Injectable.
packages/query/src/settings/hydratable.ts Doc comment tweak (“inject” → “resolve”).
packages/query/src/ClientContext.ts Doc comment wording update around DI context.
packages/preact/src/core.tsx Updates useInject / injectHook to accept Injectable.
packages/kida/src/di.ts Implements Injectable token type, class instantiation support, and Injectable$ base class.
packages/kida/src/di.spec.ts Adds tests verifying class-based injection behavior.
packages/kida/README.md Updates DI documentation and adds a class-based injectable example.
packages/kida/eslint.config.js Disables no-extraneous-class (review suggests scoping instead of global disable).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/src/content/docs/store/core-concepts.mdx Outdated
Comment thread website/src/content/docs/store/core-concepts.mdx Outdated
Comment thread packages/kida/eslint.config.js
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Comment thread packages/kida/README.md Outdated
Comment thread packages/kida/eslint.config.js
Comment thread packages/query/src/ClientContext.ts Outdated
dangreen and others added 2 commits June 3, 2026 14:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Comment on lines +61 to 66
export function useInject<T>(injectable: Injectable<T>): T {
const currentContext = useInjectionContext()
const dependency = useMemo(
() => inject(factory, currentContext),
[currentContext, factory]
() => inject(injectable, currentContext),
[currentContext, injectable]
)
Comment on lines +62 to 67
export function useInject<T>(injectable: Injectable<T>): T {
const currentContext = useInjectionContext()
const dependency = useMemo(
() => inject(factory, currentContext),
[currentContext, factory]
() => inject(injectable, currentContext),
[currentContext, injectable]
)
Comment on lines +95 to 97
export function getInject<T>(injectable: Injectable<T>): T {
return inject(injectable, getInjectionContext())
}
@dangreen dangreen merged commit c7021a5 into main Jun 3, 2026
11 checks passed
@dangreen dangreen deleted the di-renaming branch June 3, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants