ivandotv / pumpit Goto Github PK
View Code? Open in Web Editor NEWPumpIt is a small (~2KB) dependency injection container without the decorators, suitable for the browser.
License: MIT License
PumpIt is a small (~2KB) dependency injection container without the decorators, suitable for the browser.
License: MIT License
Maybe provide decorators as a separate package if there is enough demand.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/CI.yml
actions/checkout v4
actions/setup-node v4
pnpm/action-setup v3.0.0
actions/cache v3
changesets/action v1
package.json
@biomejs/biome 1.5.3
@changesets/cli ^2.27.1
@vitest/coverage-v8 ^1.3.1
lefthook ^1.6.5
microbundle ^0.15.1
shx ^0.3.4
typedoc ^0.25.10
typedoc-plugin-markdown ^3.17.1
typescript ^5.3.3
vitest ^1.3.1
After constructing a class, if a postConstruct
method is present on the class instance, invoke it.
Implement a method that will validate all the dependencies in the container (confirm that all dependencies can be resolved and instantiated)
This will effectively prevent runtime resolve
errors.
Hi does this library support aliasing like in Nest Js depedency injection
Link to aliasing provider in nest js depedency injection
Find a way to pretty print a circular dependency tree similar to the Linux tree
command.
Hi, I am not very good with english, but i will try to express me. I am using this library with qwik.js because It does not support with decorators (for example, qwik.js with inversify.js). It is a very good library for this use case. the problem is that i use the SOLID principe "Dependency inversion principle" https://en.wikipedia.org/wiki/Dependency_inversion_principle and i need to use the bindClass's generic with interfaces, but it is not working. I am using my solution for this problem:
import type { BindKey, ClassOptions } from "pumpit";
import { PumpIt } from "pumpit";
import { UserRepository } from "./domain"
import { UserMongolRepository } from "./repository"
type Instanciable<T> =
| { new (...arg: any[]): T }
| { new (...arg: any[]): T; inject?: Inject };
type BindOptions<T> = Omit<
Partial<
ClassOptions<
Instanciable<T>,
"SINGLETON" | "TRANSIENT" | "REQUEST" | "CONTAINER_SINGLETON"
>
>,
"type"
>;
class IoC extends PumpIt {
bind = <T>(
key: BindKey,
value: Instanciable<T>,
options?: BindOptions<T>
) => {
return super.bindClass(key, value, options);
};
}
export const container = new IoC();
container.bind<UserRepository>("TOKEN_REPOSITORY", UserMongoRepository);
can you add this features in your library? thanks for reading this
Hi! I'm really liking this library! Thank you for your work.
I use moduleResolution of node16 in my project, and can't import it without errors.
Then I edit package.json
in node_modules
...
"umd:main": "./dist/prod/index.umd.js",
"exports": {
"require": "./dist/prod/index.cjs",
"default": "./dist/prod/index.modern.js",
+ "types": "./src/index.ts"
},
"types": "./dist/types/index.d.ts",
...
But the source files is containing imports without .js extension, so there's other error
And last thing I tried is providing url to .d.ts file in exports
:
...
"umd:main": "./dist/prod/index.umd.js",
"exports": {
"require": "./dist/prod/index.cjs",
"default": "./dist/prod/index.modern.js",
- "types": "./src/index.ts"
+ "types": "./dist/types/index.d.ts"
},
"types": "./dist/types/index.d.ts",
...
Without extensions it just doesn't reexport types in index.d.ts
I think the best solution for this problem is providing extensions for import paths and providing type's path to index.d.ts file in exports
. What do you think?
calling validate
method should check if all dependencies can be resolved.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.