@migration-planner-ui/ioc 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biome.json +10 -0
- package/package.json +9 -13
- package/src/Container.ts +1 -1
- package/src/Context.tsx +2 -2
- package/src/Provider.tsx +7 -7
- package/src/hooks/UseInjection.ts +1 -1
- package/src/index.ts +4 -4
- package/tsconfig.json +8 -11
- package/dist/Container.d.ts +0 -7
- package/dist/Container.js +0 -28
- package/dist/Context.d.ts +0 -2
- package/dist/Context.js +0 -2
- package/dist/Provider.d.ts +0 -6
- package/dist/Provider.js +0 -6
- package/dist/hooks/UseInjection.d.ts +0 -1
- package/dist/hooks/UseInjection.js +0 -9
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
package/biome.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@migration-planner-ui/ioc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "A basic IoC solution for React apps (inspired by InversifyJs)",
|
|
5
5
|
"author": "Jonathan Kilzi <jkilzi@redhat.com>",
|
|
6
6
|
"repository": {
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
"url": "https://github.com/kubev2v/migration-planner-ui.git",
|
|
9
9
|
"directory": "packages/ioc"
|
|
10
10
|
},
|
|
11
|
+
"type": "module",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
13
14
|
"import": "./dist/index.js",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./src/index.ts"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
"typesVersions": {
|
|
19
20
|
"*": {
|
|
20
21
|
".": [
|
|
21
|
-
"./src/index.ts",
|
|
22
22
|
"./dist/index.d.ts"
|
|
23
23
|
]
|
|
24
24
|
}
|
|
@@ -29,22 +29,18 @@
|
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "yarn run -T tsc -b",
|
|
32
|
-
"bundle": "yarn build && yarn pack --out
|
|
33
|
-
"clean": "rm -rf node_modules dist",
|
|
34
|
-
"
|
|
32
|
+
"bundle": "yarn build && yarn pack --out ../../out/%s-%v.tgz",
|
|
33
|
+
"clean": "rm -rf node_modules dist .tmp",
|
|
34
|
+
"check": "yarn run -T biome check .",
|
|
35
|
+
"check:fix": "yarn run -T biome check --write .",
|
|
36
|
+
"format": "yarn run -T biome format --write ."
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@patternfly/react-core": "*",
|
|
38
|
-
"@patternfly/react-icons": "*",
|
|
39
|
-
"@patternfly/react-tokens": "*",
|
|
40
39
|
"react": "*",
|
|
41
40
|
"react-dom": "*",
|
|
42
41
|
"react-router-dom": "*"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
|
-
"@patternfly/react-core": "^5.4.0",
|
|
46
|
-
"@patternfly/react-icons": "^5.4.0",
|
|
47
|
-
"@patternfly/react-tokens": "^5.4.0",
|
|
48
44
|
"react": "^18.3.1",
|
|
49
45
|
"react-dom": "^18.3.1",
|
|
50
46
|
"react-router-dom": "^6.26.0"
|
package/src/Container.ts
CHANGED
package/src/Context.tsx
CHANGED
package/src/Provider.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
import type { Container } from "./Container.js";
|
|
4
|
+
import { Context } from "./Context.js";
|
|
5
5
|
|
|
6
|
-
export const Provider: React.FC<
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export const Provider: React.FC<PropsWithChildren<{ container: Container }>> = (
|
|
7
|
+
props,
|
|
8
|
+
) => {
|
|
9
9
|
const { container, children } = props;
|
|
10
10
|
return <Context.Provider value={container}>{children}</Context.Provider>;
|
|
11
11
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./Container";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
1
|
+
export * from "./Container.js";
|
|
2
|
+
export * from "./Context.js";
|
|
3
|
+
export * from "./hooks/UseInjection.js";
|
|
4
|
+
export * from "./Provider.js";
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "
|
|
3
|
+
"tsBuildInfoFile": ".tmp/tsconfig.tsbuildinfo",
|
|
4
4
|
"composite": true,
|
|
5
5
|
"declaration": true,
|
|
6
|
-
"
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"target": "es6",
|
|
9
|
-
"module": "ESNext",
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"rootDir": "src",
|
|
6
|
+
"declarationMap": true,
|
|
12
7
|
"outDir": "dist",
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
"rootDir": "src",
|
|
9
|
+
"target": "es6",
|
|
10
|
+
"module": "nodenext",
|
|
11
|
+
"moduleResolution": "nodenext",
|
|
12
|
+
"jsx": "react-jsx"
|
|
13
|
+
}
|
|
17
14
|
}
|
package/dist/Container.d.ts
DELETED
package/dist/Container.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _Container_registry;
|
|
13
|
-
/** A naive, singleton-scoped dependency injection container */
|
|
14
|
-
export class Container {
|
|
15
|
-
constructor() {
|
|
16
|
-
_Container_registry.set(this, void 0);
|
|
17
|
-
__classPrivateFieldSet(this, _Container_registry, {}, "f");
|
|
18
|
-
}
|
|
19
|
-
get(registeredInterfaceSymbol) {
|
|
20
|
-
const value = __classPrivateFieldGet(this, _Container_registry, "f")[registeredInterfaceSymbol];
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
register(registeredInterfaceSymbol, value) {
|
|
24
|
-
__classPrivateFieldGet(this, _Container_registry, "f")[registeredInterfaceSymbol] = value;
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
_Container_registry = new WeakMap();
|
package/dist/Context.d.ts
DELETED
package/dist/Context.js
DELETED
package/dist/Provider.d.ts
DELETED
package/dist/Provider.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useInjection<T>(registeredInterfaceSymbol: symbol): T;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { Context } from "../Context";
|
|
3
|
-
export function useInjection(registeredInterfaceSymbol) {
|
|
4
|
-
const container = useContext(Context);
|
|
5
|
-
if (!container) {
|
|
6
|
-
throw new ReferenceError("useInjection must be used inside its Provider");
|
|
7
|
-
}
|
|
8
|
-
return container.get(registeredInterfaceSymbol);
|
|
9
|
-
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED