-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/inversify/InversifyJS int…
…o next/6.1.4-beta
- Loading branch information
Showing
10 changed files
with
1,200 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { | ||
Container, | ||
inject, | ||
injectable, | ||
multiInject, | ||
} from '../../src/inversify'; | ||
|
||
describe('Issue 1515', () => { | ||
it('should properly throw on circular dependency', () => { | ||
@injectable() | ||
class Circle1 { | ||
constructor(@inject('circle-2') public readonly circle2: unknown) {} | ||
} | ||
|
||
@injectable() | ||
class Circle2 { | ||
constructor(@inject('circle-1') public circle1: unknown) {} | ||
} | ||
|
||
@injectable() | ||
class Multi1 {} | ||
@injectable() | ||
class Multi2 {} | ||
@injectable() | ||
class Multi3 {} | ||
|
||
@injectable() | ||
class Top { | ||
constructor( | ||
@multiInject('multi-inject') public readonly multis: unknown[], | ||
@inject('circle-1') public readonly circle1: unknown, | ||
) {} | ||
} | ||
|
||
const container: Container = new Container(); | ||
|
||
container.bind('multi-inject').to(Multi1); | ||
container.bind('multi-inject').to(Multi2); | ||
container.bind('multi-inject').to(Multi3); | ||
container.bind('circle-1').to(Circle1); | ||
container.bind('circle-2').to(Circle2); | ||
container.bind(Top).toSelf(); | ||
|
||
expect(() => { | ||
container.get(Top); | ||
}).to.throw( | ||
'Circular dependency found: Top --> circle-1 --> circle-2 --> circle-1', | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { Container } from '../../src/inversify'; | ||
|
||
describe('Issue 1515', () => { | ||
it('should not throw on deactivating undefined singleton values', () => { | ||
const container: Container = new Container(); | ||
const symbol: symbol = Symbol.for('foo'); | ||
container.bind(symbol).toConstantValue(undefined); | ||
|
||
console.log(container.get(symbol)); | ||
|
||
container.unbindAll(); | ||
|
||
expect(() => {}).not.to.throw(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ts-check | ||
|
||
import path from 'node:path'; | ||
|
||
const outputPath = path.resolve(import.meta.dirname, 'es'); | ||
|
||
/** @type {!import("webpack").Configuration} */ | ||
export default { | ||
devtool: 'inline-source-map', | ||
entry: './src/inversify.ts', | ||
experiments: { | ||
outputModule: true, | ||
}, | ||
externals: [/@inversifyjs\/.+/], | ||
mode: 'production', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.tsx?$/, | ||
use: [ | ||
{ | ||
loader: 'ts-loader', | ||
options: { | ||
configFile: 'src/tsconfig-es.json', | ||
}, | ||
}, | ||
], | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
}, | ||
output: { | ||
filename: 'inversify.js', | ||
library: { | ||
type: 'module', | ||
}, | ||
path: outputPath, | ||
}, | ||
performance: { | ||
maxEntrypointSize: 512000, | ||
maxAssetSize: 512000, | ||
}, | ||
stats: 'verbose', | ||
}; |