Skip to content

Commit

Permalink
feat: migrate to TypeScript 5.6. Don't swallow errors thrown during c…
Browse files Browse the repository at this point in the history
…lass instance construction. Refactoring. Use modern EcmaScript
  • Loading branch information
wessberg committed Oct 18, 2024
1 parent d6760fb commit 2830e9d
Show file tree
Hide file tree
Showing 37 changed files with 4,832 additions and 4,890 deletions.
8 changes: 0 additions & 8 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
github: wessberg
patreon: wessberg
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# 2.1.0 (2022-04-07)
# [2.1.0](https://github.com/wessberg/di/compare/5903e8520730951484bddbeac1759e4a297e9e8c...v2.1.0) (2022-04-07)


### Bug Fixes

- don't run tests with np ([0ec8060](https://github.com/wessberg/di/commit/0ec80603e77c161589fe64bbe265db449d401c41))
* don't run tests with np ([0ec8060](https://github.com/wessberg/di/commit/0ec80603e77c161589fe64bbe265db449d401c41))


### Features

- **api:** API overhaul ([5903e85](https://github.com/wessberg/di/commit/5903e8520730951484bddbeac1759e4a297e9e8c))
- update development dependencies. Update documentation. Produce cleaner output. More informative error descriptions ([7b19929](https://github.com/wessberg/di/commit/7b199295e8d87b83387fc1a2c448fc4431622dfe))
* **api:** API overhaul ([5903e85](https://github.com/wessberg/di/commit/5903e8520730951484bddbeac1759e4a297e9e8c))
* update development dependencies. Update documentation. Produce cleaner output. More informative error descriptions ([7b19929](https://github.com/wessberg/di/commit/7b199295e8d87b83387fc1a2c448fc4431622dfe))



2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting any of the code of conduct enforcers: [Frederik Wessberg](mailto:frederikwessberg@hotmail.com) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg)).
reported by contacting any of the code of conduct enforcers: .
All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
You are more than welcome to contribute to `@wessberg/di` in any way you please, including:
You are more than welcome to contribute to `undefined` in any way you please, including:

- Updating documentation.
- Fixing spelling and grammar
- Adding tests
- Fixing issues and suggesting new features
- Blogging, tweeting, and creating tutorials about `@wessberg/di`
- Reaching out to [@FredWessberg](https://twitter.com/FredWessberg) on Twitter
- Blogging, tweeting, and creating tutorials about `undefined`

- Submit an issue or a Pull Request
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2022 [Frederik Wessberg](mailto:frederikwessberg@hotmail.com) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg))
Copyright © 2024

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ This library is a runtime dependency, but you need to transform your code with t

## Backers

| <a href="https://usebubbles.com"><img alt="Bubbles" src="https://uploads-ssl.webflow.com/5d682047c28b217055606673/5e5360be16879c1d0dca6514_icon-thin-128x128%402x.png" height="70" /></a> | <a href="https://github.com/cblanc"><img alt="Christopher Blanchard" src="https://avatars0.githubusercontent.com/u/2160685?s=400&v=4" height="70" /></a> | <a href="https://github.com/ideal-postcodes"><img alt="Ideal Postcodes" src="https://avatars.githubusercontent.com/u/4996310?s=200&v=4" height="70" /></a> | <a href="https://www.xerox.com"><img alt="Xerox" src="https://avatars.githubusercontent.com/u/9158512?s=200&v=4" height="70" /></a> | <a href="https://changelog.me"><img alt="Trent Raymond" src="https://avatars.githubusercontent.com/u/1509616?v=4" height="70" /></a> | <a href="https://scrubtheweb.com"><img alt="scrubtheweb" src="https://avatars.githubusercontent.com/u/41668218?v=4" height="70" /></a> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| [Bubbles](https://usebubbles.com)<br><strong>Twitter</strong>: [@usebubbles](https://twitter.com/usebubbles) | [Christopher Blanchard](https://github.com/cblanc) | [Ideal Postcodes](https://github.com/ideal-postcodes) | [Xerox](https://www.xerox.com) | [Trent Raymond](https://changelog.me) | [scrubtheweb](https://scrubtheweb.com) |

### Patreon

<a href="https://www.patreon.com/bePatron?u=11315442"><img alt="Patrons on Patreon" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dwessberg%26type%3Dpatrons" width="200" /></a>
Expand All @@ -72,7 +68,6 @@ This library is a runtime dependency, but you need to transform your code with t
- [Injecting instances of services into classes](#injecting-instances-of-services-into-classes)
- [Getting instances directly from the `DIContainer`](#getting-instances-directly-from-the-dicontainer)
- [Contributing](#contributing)
- [Maintainers](#maintainers)
- [FAQ](#faq)
- [This is pure magic. How does it work?](#this-is-pure-magic-how-does-it-work)
- [Is it possible to have multiple, scoped containers?](#is-it-possible-to-have-multiple-scoped-containers)
Expand Down Expand Up @@ -182,12 +177,6 @@ Do you want to contribute? Awesome! Please follow [these recommendations](./CONT

<!-- SHADOW_SECTION_MAINTAINERS_START -->

## Maintainers

| <a href="mailto:frederikwessberg@hotmail.com"><img alt="Frederik Wessberg" src="https://avatars2.githubusercontent.com/u/20454213?s=460&v=4" height="70" /></a> |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Frederik Wessberg](mailto:frederikwessberg@hotmail.com)<br><strong>Twitter</strong>: [@FredWessberg](https://twitter.com/FredWessberg)<br><strong>Github</strong>: [@wessberg](https://github.com/wessberg)<br>_Lead Developer_ |

<!-- SHADOW_SECTION_MAINTAINERS_END -->

<!-- SHADOW_SECTION_FAQ_START -->
Expand All @@ -208,6 +197,6 @@ Sure. You can instantiate as many as you want to, as long as you make sure the [

## License

MIT © [Frederik Wessberg](mailto:frederikwessberg@hotmail.com) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg))
MIT ©

<!-- SHADOW_SECTION_LICENSE_END -->
14 changes: 14 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import shared from "@wessberg/ts-config/eslint.config.js";

export default [
...shared,
{
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/class-literal-property-style": "off"
}
}
];
181 changes: 94 additions & 87 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,96 @@
{
"name": "@wessberg/di",
"version": "2.1.0",
"description": "A compile-time powered Dependency-Injection container for Typescript that holds services and can produce instances of them as required.",
"scripts": {
"generate:sandhog": "sandhog all --yes",
"generate:changelog": "standard-changelog --first-release",
"generate:all": "pnpm run generate:sandhog && pnpm run generate:changelog",
"clean": "rimraf dist",
"lint": "tsc --noEmit && eslint \"src/**/*.ts\" --color",
"prettier": "prettier --write \"{src,test,documentation}/**/*.{js,ts,json,html,xml,css,md}\"",
"prebuild": "pnpm run clean",
"build": "pnpm run prebuild && pnpm run rollup",
"prewatch": "pnpm run clean",
"watch": "pnpm run prewatch && pnpm run rollup -- --watch",
"rollup": "rollup -c rollup.config.js",
"preversion": "pnpm run lint && pnpm run build",
"version": "pnpm run preversion && pnpm run generate:all && git add .",
"release": "np --no-cleanup --no-yarn --no-tests",
"update:check": "pnpx npm-check-updates -x typescript-* --dep dev,prod",
"update:commit": "pnpx npm-check-updates -u -x typescript-* --dep dev,prod && pnpm update && pnpm install"
},
"keywords": [
"DI",
"dependency injection",
"ioc",
"inversion",
"service",
"container",
"newable",
"reflection",
"singleton",
"transient"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"@wessberg/ts-config": "^2.0.2",
"rollup-plugin-ts": "^2.0.7",
"typescript": "4.6.4",
"tslib": "^2.4.0",
"npm-check-updates": "^13.0.3",
"sandhog": "^1.0.43",
"standard-changelog": "^2.0.27",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.1",
"husky": "^8.0.1",
"np": "^7.6.1",
"pnpm": "^7.1.5",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"rollup": "^2.74.1"
},
"dependencies": {},
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"browser": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",
"typings": "./dist/esm/index.d.ts",
"es2015": "./dist/esm/index.js",
"repository": {
"type": "git",
"url": "https://github.com/wessberg/di.git"
},
"bugs": {
"url": "https://github.com/wessberg/di/issues"
},
"contributors": [
{
"name": "Frederik Wessberg",
"email": "frederikwessberg@hotmail.com",
"url": "https://github.com/wessberg",
"imageUrl": "https://avatars2.githubusercontent.com/u/20454213?s=460&v=4",
"role": "Lead Developer",
"twitter": "FredWessberg",
"github": "wessberg"
}
],
"engines": {
"node": ">=9.0.0"
},
"license": "MIT",
"files": [
"dist/**/*.*"
]
"name": "@wessberg/di",
"version": "2.1.0",
"description": "A compile-time powered Dependency-Injection container for Typescript that holds services and can produce instances of them as required.",
"scripts": {
"generate:sandhog": "sandhog all --yes",
"generate:changelog": "standard-changelog --first-release",
"generate:all": "pnpm run generate:sandhog && pnpm run generate:changelog",
"clean": "rimraf dist",
"lint": "tsc --noEmit && eslint \"src/**/*.ts\" --color --fix",
"prettier": "prettier --write \"{src,test,documentation}/**/*.{js,ts,json,html,xml,css,md}\"",
"test": "node --import tsx --test \"./test/**/*.test.ts\"",
"prebuild": "pnpm run clean",
"build": "pnpm run clean && tsup \"src/index.ts\" --sourcemap --dts --format esm,cjs",
"preversion": "pnpm run lint && pnpm run build",
"version": "pnpm run preversion && pnpm run generate:all && git add .",
"release": "np --no-cleanup --no-yarn --no-tests",
"update:check": "pnpx npm-check-updates --dep dev,prod",
"update:commit": "pnpx npm-check-updates -u --dep dev,prod && pnpm update && pnpm install"
},
"keywords": [
"DI",
"dependency injection",
"ioc",
"inversion",
"service",
"container",
"newable",
"reflection",
"singleton",
"transient"
],
"devDependencies": {
"@types/node": "22.7.6",
"@wessberg/prettier-config": "^1.0.0",
"@wessberg/ts-config": "^5.0.20",
"@eslint/js": "9.12.0",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^50.4.3",
"eslint-plugin-prettier": "^5.2.1",
"typescript-eslint": "^8.10.0",
"typescript": "5.6.3",
"npm-check-updates": "^17.1.4",
"sandhog": "^3.0.2",
"standard-changelog": "^6.0.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"tsup": "^8.3.0",
"np": "^10.0.7",
"pnpm": "^9.12.2",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"tsx": "^4.19.1"
},
"dependencies": {},
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"type": "module",
"types": "./dist/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"repository": {
"type": "git",
"url": "https://github.com/wessberg/di.git"
},
"bugs": {
"url": "https://github.com/wessberg/di/issues"
},
"contributors": [
{
"name": "Frederik Wessberg",
"email": "frederikwessberg@hotmail.com",
"url": "https://github.com/wessberg",
"imageUrl": "https://avatars2.githubusercontent.com/u/20454213?s=460&v=4",
"role": "Lead Developer",
"twitter": "FredWessberg",
"github": "wessberg"
}
],
"engines": {
"node": ">=12.0.0"
},
"license": "MIT",
"files": [
"dist/**/*.*"
],
"lint-staged": {
"*": "prettier --ignore-unknown --write"
},
"prettier": "@wessberg/prettier-config"
}
Loading

0 comments on commit 2830e9d

Please sign in to comment.