com.kylin.di 1.1.0 → 1.1.2
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/.github/workflows/publish.yml +34 -6
- package/README.md +1 -1
- package/package.json +5 -1
- package/.omc/project-memory.json +0 -229
- package/.omc/state/hud-state.json +0 -6
- package/CLAUDE.md +0 -58
|
@@ -2,21 +2,49 @@ name: Publish to npmjs
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
|
|
6
|
-
- 'v*'
|
|
5
|
+
branches: [master]
|
|
7
6
|
|
|
8
7
|
jobs:
|
|
9
8
|
publish:
|
|
10
9
|
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
id-token: write
|
|
11
13
|
steps:
|
|
12
14
|
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
13
17
|
|
|
14
18
|
- uses: actions/setup-node@v4
|
|
15
19
|
with:
|
|
16
20
|
node-version: '20'
|
|
17
21
|
registry-url: 'https://registry.npmjs.org'
|
|
18
22
|
|
|
19
|
-
- name:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
- name: Check version against existing tag
|
|
24
|
+
id: check
|
|
25
|
+
run: |
|
|
26
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
27
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
28
|
+
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
29
|
+
echo "should_publish=false" >> $GITHUB_OUTPUT
|
|
30
|
+
echo "Tag v$VERSION already exists. Skipping publish."
|
|
31
|
+
else
|
|
32
|
+
echo "should_publish=true" >> $GITHUB_OUTPUT
|
|
33
|
+
echo "Will publish v$VERSION"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
- name: Upgrade npm for OIDC support
|
|
37
|
+
if: steps.check.outputs.should_publish == 'true'
|
|
38
|
+
run: npm install -g npm@latest
|
|
39
|
+
|
|
40
|
+
- name: Create and push tag
|
|
41
|
+
if: steps.check.outputs.should_publish == 'true'
|
|
42
|
+
run: |
|
|
43
|
+
git config user.name "github-actions[bot]"
|
|
44
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
45
|
+
git tag "v${{ steps.check.outputs.version }}"
|
|
46
|
+
git push origin "v${{ steps.check.outputs.version }}"
|
|
47
|
+
|
|
48
|
+
- name: Publish with trusted publishing
|
|
49
|
+
if: steps.check.outputs.should_publish == 'true'
|
|
50
|
+
run: npm publish --access public
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.kylin.di",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"displayName": "KDI (Kylin Dependency Injection)",
|
|
5
5
|
"description": "Scope-based dependency injection framework for Unity 6. Field injection only, hierarchical scopes.",
|
|
6
6
|
"unity": "6000.0",
|
|
7
7
|
"documentationUrl": "",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/ToolStorage/KDI"
|
|
12
|
+
},
|
|
9
13
|
"keywords": [
|
|
10
14
|
"dependency-injection",
|
|
11
15
|
"di",
|
package/.omc/project-memory.json
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "1.0.0",
|
|
3
|
-
"lastScanned": 1773710696675,
|
|
4
|
-
"projectRoot": "C:\\ProjectControl\\KDIPackage",
|
|
5
|
-
"techStack": {
|
|
6
|
-
"languages": [
|
|
7
|
-
{
|
|
8
|
-
"name": "JavaScript/TypeScript",
|
|
9
|
-
"version": null,
|
|
10
|
-
"confidence": "high",
|
|
11
|
-
"markers": [
|
|
12
|
-
"package.json"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"frameworks": [],
|
|
17
|
-
"packageManager": "npm",
|
|
18
|
-
"runtime": null
|
|
19
|
-
},
|
|
20
|
-
"build": {
|
|
21
|
-
"buildCommand": null,
|
|
22
|
-
"testCommand": null,
|
|
23
|
-
"lintCommand": null,
|
|
24
|
-
"devCommand": null,
|
|
25
|
-
"scripts": {}
|
|
26
|
-
},
|
|
27
|
-
"conventions": {
|
|
28
|
-
"namingStyle": null,
|
|
29
|
-
"importStyle": null,
|
|
30
|
-
"testPattern": null,
|
|
31
|
-
"fileOrganization": null
|
|
32
|
-
},
|
|
33
|
-
"structure": {
|
|
34
|
-
"isMonorepo": false,
|
|
35
|
-
"workspaces": [],
|
|
36
|
-
"mainDirectories": [],
|
|
37
|
-
"gitBranches": {
|
|
38
|
-
"defaultBranch": "master",
|
|
39
|
-
"branchingStrategy": null
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"customNotes": [],
|
|
43
|
-
"directoryMap": {
|
|
44
|
-
"Runtime": {
|
|
45
|
-
"path": "Runtime",
|
|
46
|
-
"purpose": null,
|
|
47
|
-
"fileCount": 8,
|
|
48
|
-
"lastAccessed": 1773710696650,
|
|
49
|
-
"keyFiles": [
|
|
50
|
-
"Attributes.meta",
|
|
51
|
-
"Core.meta",
|
|
52
|
-
"Debug.meta",
|
|
53
|
-
"DI.meta",
|
|
54
|
-
"Kylin.DI.asmdef"
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"hotPaths": [
|
|
59
|
-
{
|
|
60
|
-
"path": "",
|
|
61
|
-
"accessCount": 5,
|
|
62
|
-
"lastAccessed": 1773710728288,
|
|
63
|
-
"type": "directory"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"path": "README.md",
|
|
67
|
-
"accessCount": 2,
|
|
68
|
-
"lastAccessed": 1773711146365,
|
|
69
|
-
"type": "file"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"path": "package.json",
|
|
73
|
-
"accessCount": 1,
|
|
74
|
-
"lastAccessed": 1773710732915,
|
|
75
|
-
"type": "file"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"path": "Runtime\\Kylin.DI.asmdef",
|
|
79
|
-
"accessCount": 1,
|
|
80
|
-
"lastAccessed": 1773710733554,
|
|
81
|
-
"type": "file"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"path": "Runtime\\DI\\KDI.cs",
|
|
85
|
-
"accessCount": 1,
|
|
86
|
-
"lastAccessed": 1773710733804,
|
|
87
|
-
"type": "file"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"path": "Runtime\\DI\\Scope.cs",
|
|
91
|
-
"accessCount": 1,
|
|
92
|
-
"lastAccessed": 1773710734108,
|
|
93
|
-
"type": "file"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"path": "Runtime\\DI\\Registration.cs",
|
|
97
|
-
"accessCount": 1,
|
|
98
|
-
"lastAccessed": 1773710734544,
|
|
99
|
-
"type": "file"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"path": "Runtime\\Core\\LifetimeScope.cs",
|
|
103
|
-
"accessCount": 1,
|
|
104
|
-
"lastAccessed": 1773710734976,
|
|
105
|
-
"type": "file"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"path": "Runtime\\Core\\DIBehaviour.cs",
|
|
109
|
-
"accessCount": 1,
|
|
110
|
-
"lastAccessed": 1773710735204,
|
|
111
|
-
"type": "file"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"path": "Runtime\\DI\\DependencyBuilder.cs",
|
|
115
|
-
"accessCount": 1,
|
|
116
|
-
"lastAccessed": 1773710739245,
|
|
117
|
-
"type": "file"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"path": "Runtime\\DI\\DependencyInjector.cs",
|
|
121
|
-
"accessCount": 1,
|
|
122
|
-
"lastAccessed": 1773710739574,
|
|
123
|
-
"type": "file"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"path": "Runtime\\DI\\InstanceFactory.cs",
|
|
127
|
-
"accessCount": 1,
|
|
128
|
-
"lastAccessed": 1773710740017,
|
|
129
|
-
"type": "file"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"path": "Runtime\\DI\\ScopeBuilder.cs",
|
|
133
|
-
"accessCount": 1,
|
|
134
|
-
"lastAccessed": 1773710740465,
|
|
135
|
-
"type": "file"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"path": "Runtime\\DI\\ScopeExtensions.cs",
|
|
139
|
-
"accessCount": 1,
|
|
140
|
-
"lastAccessed": 1773710740905,
|
|
141
|
-
"type": "file"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"path": "Runtime\\Attributes\\InjectAttribute.cs",
|
|
145
|
-
"accessCount": 1,
|
|
146
|
-
"lastAccessed": 1773710741924,
|
|
147
|
-
"type": "file"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"path": "Runtime\\Attributes\\ViewModelAttribute.cs",
|
|
151
|
-
"accessCount": 1,
|
|
152
|
-
"lastAccessed": 1773710742234,
|
|
153
|
-
"type": "file"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"path": "Runtime\\Update\\UpdateLoopManager.cs",
|
|
157
|
-
"accessCount": 1,
|
|
158
|
-
"lastAccessed": 1773710742681,
|
|
159
|
-
"type": "file"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"path": "Runtime\\SubscribableProperty\\SubscribableProperty.cs",
|
|
163
|
-
"accessCount": 1,
|
|
164
|
-
"lastAccessed": 1773710742957,
|
|
165
|
-
"type": "file"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"path": "CLAUDE.md",
|
|
169
|
-
"accessCount": 1,
|
|
170
|
-
"lastAccessed": 1773710790027,
|
|
171
|
-
"type": "file"
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"path": "Runtime\\SubscribableProperty\\SubscribableCollection.cs",
|
|
175
|
-
"accessCount": 1,
|
|
176
|
-
"lastAccessed": 1773710989419,
|
|
177
|
-
"type": "file"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"path": "Runtime\\SubscribableProperty\\SubscribablePropertyExtensions.cs",
|
|
181
|
-
"accessCount": 1,
|
|
182
|
-
"lastAccessed": 1773710989888,
|
|
183
|
-
"type": "file"
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"path": "Runtime\\SubscribableProperty\\SubscribablePropertyLinq.cs",
|
|
187
|
-
"accessCount": 1,
|
|
188
|
-
"lastAccessed": 1773710990457,
|
|
189
|
-
"type": "file"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"path": "Runtime\\SubscribableProperty\\SubscribableCommand.cs",
|
|
193
|
-
"accessCount": 1,
|
|
194
|
-
"lastAccessed": 1773710990803,
|
|
195
|
-
"type": "file"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"path": "Runtime\\SubscribableProperty\\SubscribableDictionary.cs",
|
|
199
|
-
"accessCount": 1,
|
|
200
|
-
"lastAccessed": 1773710991251,
|
|
201
|
-
"type": "file"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"path": "Runtime\\SubscribableProperty\\SubscribableCollectionExtensions.cs",
|
|
205
|
-
"accessCount": 1,
|
|
206
|
-
"lastAccessed": 1773710991698,
|
|
207
|
-
"type": "file"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
"path": "Runtime\\Update\\IUpdatable.cs",
|
|
211
|
-
"accessCount": 1,
|
|
212
|
-
"lastAccessed": 1773710992139,
|
|
213
|
-
"type": "file"
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
"path": "Runtime\\Update\\IUpdatePriority.cs",
|
|
217
|
-
"accessCount": 1,
|
|
218
|
-
"lastAccessed": 1773710992657,
|
|
219
|
-
"type": "file"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"path": "Runtime\\Debug\\ClosureAnalyzer.cs",
|
|
223
|
-
"accessCount": 1,
|
|
224
|
-
"lastAccessed": 1773710993007,
|
|
225
|
-
"type": "file"
|
|
226
|
-
}
|
|
227
|
-
],
|
|
228
|
-
"userDirectives": []
|
|
229
|
-
}
|
package/CLAUDE.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
KDI (Kylin Dependency Injection) is a Unity 6 package (`com.kylin.di`) — a minimal scope-based DI framework with field-only injection and built-in reactive properties. Core DI logic is ~500 lines. Assembly name: `Kylin.DI`, root namespace: `Kylin`.
|
|
8
|
-
|
|
9
|
-
This is a Unity Package Manager (UPM) package, not a standalone project. There are no build/test/lint commands to run directly — it compiles within a Unity project that references it.
|
|
10
|
-
|
|
11
|
-
## Architecture
|
|
12
|
-
|
|
13
|
-
### DI Pipeline (Runtime/DI/)
|
|
14
|
-
|
|
15
|
-
The injection flow is: `LifetimeScope.Configure()` → `ScopeBuilder.Build()` → `Scope` created → `LifetimeScope.InjectChildren()` pushes `[Inject]` fields into child transforms.
|
|
16
|
-
|
|
17
|
-
- **KDI** — Static facade. Holds the `RootScope` reference. Auto-resets via `[RuntimeInitializeOnLoadMethod]`.
|
|
18
|
-
- **ScopeBuilder** — Collects `Registration` entries via fluent `Bind<T>().To<TImpl>().AsScoped()` API. Freezes after `Build()`. Enforces Singleton-only-in-RootScope rule at build time.
|
|
19
|
-
- **DependencyBuilder<T>** — Fluent builder returned by `ScopeBuilder.Bind<T>()`. Lifetime chain terminates with `AsSingleton()`/`AsScoped()`/`AsTransient()`/`FromInstance()`.
|
|
20
|
-
- **Scope** — Implements `IScope`. Holds `Dictionary<Type, Registration>` (frozen) and `Dictionary<Type, object>` (cached instances). Resolution walks parent chain. Circular reference detection uses `[ThreadStatic] HashSet<Type>`. Dispose cascades children → instances (IDisposable + UpdateLoopManager unregister).
|
|
21
|
-
- **Registration** — Data class: ServiceType, ImplementationType, Instance, Lifetime, Factory.
|
|
22
|
-
- **DependencyInjector** — Static. Two-phase inject: resolve all fields first, then set all at once (atomic). `ConcurrentDictionary<Type, FieldInfo[]>` cache walks inheritance up to MonoBehaviour/object. Warns on `[Inject]` fields without `IInjectable`.
|
|
23
|
-
- **InstanceFactory** — `Expression.Lambda.Compile()` cached factory for parameterless constructors.
|
|
24
|
-
- **ScopeExtensions** — `IScope.Instantiate()` and `IScope.InjectGameObject()` for runtime prefab spawning with DI.
|
|
25
|
-
|
|
26
|
-
### Unity Integration (Runtime/Core/)
|
|
27
|
-
|
|
28
|
-
- **LifetimeScope** — Abstract MonoBehaviour. Subclass and override `Configure(ScopeBuilder)`. Parent set via Inspector `_parent` field. Auto-initializes in `Awake` (configurable). Static registry uses `Transform.IsChildOf` (native) instead of `GetComponentInParent` (managed) for scope lookup. Push injection stops at child LifetimeScope boundaries.
|
|
29
|
-
- **DIBehaviour** — Abstract MonoBehaviour implementing `IInjectable`. Provides `_cd` (CompositeDisposable) for subscription cleanup on `OnDisable`, and `Scope` property for runtime access.
|
|
30
|
-
|
|
31
|
-
### Key Marker Interfaces
|
|
32
|
-
|
|
33
|
-
- `IDependencyObject` — Required on types registered via `To<T>()` or `FromInstance()`.
|
|
34
|
-
- `IInjectable` — Required for `[Inject]` field injection to work. Without it, fields are silently skipped (with a warning).
|
|
35
|
-
- `IPostInjectable` — Optional. `PostInject()` called after all `[Inject]` fields are set.
|
|
36
|
-
|
|
37
|
-
### Reactive System (Runtime/SubscribableProperty/)
|
|
38
|
-
|
|
39
|
-
`SubscribableProperty<T>` — Observable value with `Subscribe(callback, invokeInitial)` → `IDisposable`. Uses `EqualityComparer<T>.Default` for change detection. Supports Unity serialization (`ISerializationCallbackReceiver`). External serialization (MessagePack, JSON etc.) is supported via separate adapter packages (`com.kylin.di.messagepack`). Namespace: `Kylin.SubscribableProperty`.
|
|
40
|
-
|
|
41
|
-
Also includes: `SubscribableCollection<T>`, `SubscribableDictionary<TKey,TValue>`, `SubscribableCommand`, and LINQ extensions (`Select`, etc.).
|
|
42
|
-
|
|
43
|
-
### Update Loop (Runtime/Update/)
|
|
44
|
-
|
|
45
|
-
`UpdateLoopManager` — Singleton MonoBehaviour (`DontDestroyOnLoad`). Non-MonoBehaviour classes implementing `IUpdatable`/`IFixedUpdatable`/`ILateUpdatable` are auto-registered when resolved through a Scope. Supports `IUpdatePriority` (lower value = earlier execution). Registration/unregistration is deferred via a pending queue processed each frame.
|
|
46
|
-
|
|
47
|
-
Interface method names are prefixed: `KDIUpdate`, `KDIFixedUpdate`, `KDILateUpdate`.
|
|
48
|
-
|
|
49
|
-
## Design Constraints
|
|
50
|
-
|
|
51
|
-
- **Field injection only** — No constructor injection. All DI-managed types must have a public parameterless constructor.
|
|
52
|
-
- **Singleton only in RootScope** — `AsSingleton()` in a child scope throws at build time.
|
|
53
|
-
- **Push injection model** — LifetimeScope walks child transforms; components don't pull their own dependencies.
|
|
54
|
-
- **Scope freeze** — `ScopeBuilder` cannot accept registrations after `Build()`.
|
|
55
|
-
|
|
56
|
-
## Language
|
|
57
|
-
|
|
58
|
-
Source code comments and log messages are in Korean. Follow this convention when modifying existing code.
|