@djodjonx/neo-syringe 1.1.5
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/.editorconfig +12 -0
- package/.github/workflows/ci.yml +97 -0
- package/.github/workflows/release.yml +45 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.lintstagedrc +8 -0
- package/.oxlintrc.json +148 -0
- package/CHANGELOG.md +43 -0
- package/README.md +824 -0
- package/commitlint.config.cjs +3 -0
- package/dist/GraphValidator-C8ldJtNp.mjs +442 -0
- package/dist/GraphValidator-G0F4QiLk.cjs +487 -0
- package/dist/cli/index.cjs +40 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +40 -0
- package/dist/index.cjs +64 -0
- package/dist/index.d.cts +142 -0
- package/dist/index.d.mts +142 -0
- package/dist/index.mjs +59 -0
- package/dist/lsp/index.cjs +76 -0
- package/dist/lsp/index.d.cts +18 -0
- package/dist/lsp/index.d.mts +19 -0
- package/dist/lsp/index.mjs +76 -0
- package/dist/unplugin/index.cjs +208 -0
- package/dist/unplugin/index.d.cts +21 -0
- package/dist/unplugin/index.d.mts +21 -0
- package/dist/unplugin/index.mjs +207 -0
- package/logo/logo.png +0 -0
- package/package.json +73 -0
- package/src/analyzer/Analyzer.ts +642 -0
- package/src/analyzer/types.ts +87 -0
- package/src/cli/index.ts +49 -0
- package/src/generator/Generator.ts +226 -0
- package/src/generator/GraphValidator.ts +90 -0
- package/src/index.ts +22 -0
- package/src/lsp/index.ts +101 -0
- package/src/types.ts +179 -0
- package/src/unplugin/index.ts +82 -0
- package/tests/analyzer/Analyzer.test.ts +75 -0
- package/tests/analyzer/AnalyzerDeclarative.test.ts +90 -0
- package/tests/analyzer/AnalyzerSafety.test.ts +79 -0
- package/tests/analyzer/ExternalAnalyzer.test.ts +55 -0
- package/tests/analyzer/Factory.test.ts +192 -0
- package/tests/analyzer/InterfaceId.test.ts +52 -0
- package/tests/analyzer/LegacyContainer.test.ts +285 -0
- package/tests/analyzer/NamedContainer.test.ts +59 -0
- package/tests/analyzer/Partials.test.ts +82 -0
- package/tests/analyzer/PropertyToken.test.ts +199 -0
- package/tests/cli/cli.test.ts +229 -0
- package/tests/e2e/__snapshots__/snapshots.test.ts.snap +691 -0
- package/tests/e2e/container-integration.test.ts +358 -0
- package/tests/e2e/generated-code.test.ts +1352 -0
- package/tests/e2e/inversify.test.ts +251 -0
- package/tests/e2e/snapshots.test.ts +227 -0
- package/tests/e2e/standalone.test.ts +239 -0
- package/tests/e2e/tsyringe.test.ts +303 -0
- package/tests/fixtures/simple-container.ts +21 -0
- package/tests/generator/ExternalGenerator.test.ts +77 -0
- package/tests/generator/FactoryGenerator.test.ts +172 -0
- package/tests/generator/Generator.test.ts +101 -0
- package/tests/generator/GeneratorDeclarative.test.ts +70 -0
- package/tests/generator/GraphValidator.test.ts +102 -0
- package/tests/generator/GraphValidatorSafety.test.ts +21 -0
- package/tests/generator/ParentContainerValidation.test.ts +278 -0
- package/tests/index.test.ts +31 -0
- package/tests/lsp/LSPDiagnostics.test.ts +200 -0
- package/tests/lsp/lsp.test.ts +86 -0
- package/tests/unplugin/unplugin.test.ts +78 -0
- package/tsconfig.json +14 -0
- package/tsdown.config.ts +13 -0
- package/typedoc.json +5 -0
- package/vitest.config.ts +8 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [18, 20, 22]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: pnpm/action-setup@v4
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: 'pnpm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: pnpm install --frozen-lockfile
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: pnpm lint
|
|
31
|
+
|
|
32
|
+
- name: Type check
|
|
33
|
+
run: pnpm typecheck
|
|
34
|
+
|
|
35
|
+
- name: Test (Node 18)
|
|
36
|
+
if: matrix.node-version == 18
|
|
37
|
+
run: pnpm test
|
|
38
|
+
|
|
39
|
+
- name: Test with coverage (Node 20+)
|
|
40
|
+
if: matrix.node-version != 18
|
|
41
|
+
run: pnpm test:coverage
|
|
42
|
+
|
|
43
|
+
- name: Upload coverage to Codecov
|
|
44
|
+
if: matrix.node-version == 20
|
|
45
|
+
uses: codecov/codecov-action@v4
|
|
46
|
+
with:
|
|
47
|
+
files: ./coverage/clover.xml
|
|
48
|
+
fail_ci_if_error: false
|
|
49
|
+
|
|
50
|
+
build:
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
needs: test
|
|
53
|
+
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- uses: pnpm/action-setup@v4
|
|
58
|
+
|
|
59
|
+
- uses: actions/setup-node@v4
|
|
60
|
+
with:
|
|
61
|
+
node-version: '20'
|
|
62
|
+
cache: 'pnpm'
|
|
63
|
+
|
|
64
|
+
- name: Install dependencies
|
|
65
|
+
run: pnpm install --frozen-lockfile
|
|
66
|
+
|
|
67
|
+
- name: Build
|
|
68
|
+
run: pnpm build
|
|
69
|
+
|
|
70
|
+
- name: Verify build output
|
|
71
|
+
run: |
|
|
72
|
+
test -f dist/index.js
|
|
73
|
+
test -f dist/index.d.ts
|
|
74
|
+
test -f dist/unplugin/index.js
|
|
75
|
+
test -f dist/lsp/index.js
|
|
76
|
+
test -f dist/cli/index.js
|
|
77
|
+
|
|
78
|
+
security:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
|
|
84
|
+
- uses: pnpm/action-setup@v4
|
|
85
|
+
|
|
86
|
+
- uses: actions/setup-node@v4
|
|
87
|
+
with:
|
|
88
|
+
node-version: '20'
|
|
89
|
+
cache: 'pnpm'
|
|
90
|
+
|
|
91
|
+
- name: Install dependencies
|
|
92
|
+
run: pnpm install --frozen-lockfile
|
|
93
|
+
|
|
94
|
+
- name: Audit dependencies
|
|
95
|
+
run: pnpm audit --audit-level=high
|
|
96
|
+
continue-on-error: true
|
|
97
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
github-release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Extract release notes
|
|
21
|
+
id: extract_release_notes
|
|
22
|
+
run: |
|
|
23
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
24
|
+
echo "Processing version: $VERSION"
|
|
25
|
+
|
|
26
|
+
# Extract the section from CHANGELOG.md for this version
|
|
27
|
+
sed -n "/^#* \[${VERSION}\]/,/^#* \[/p" CHANGELOG.md | sed '$d' > RELEASE_BODY.md
|
|
28
|
+
|
|
29
|
+
# If no content found, create a default message
|
|
30
|
+
if [ ! -s RELEASE_BODY.md ]; then
|
|
31
|
+
echo "## What's Changed" > RELEASE_BODY.md
|
|
32
|
+
echo "" >> RELEASE_BODY.md
|
|
33
|
+
echo "See [CHANGELOG.md](./CHANGELOG.md) for details." >> RELEASE_BODY.md
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
cat RELEASE_BODY.md
|
|
37
|
+
|
|
38
|
+
- name: Create GitHub Release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
body_path: RELEASE_BODY.md
|
|
42
|
+
draft: false
|
|
43
|
+
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
|
|
44
|
+
generate_release_notes: false
|
|
45
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.lintstagedrc
ADDED
package/.oxlintrc.json
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": [
|
|
4
|
+
"unicorn",
|
|
5
|
+
"typescript",
|
|
6
|
+
"oxc"
|
|
7
|
+
],
|
|
8
|
+
"categories": {},
|
|
9
|
+
"rules": {
|
|
10
|
+
"constructor-super": "warn",
|
|
11
|
+
"for-direction": "warn",
|
|
12
|
+
"no-async-promise-executor": "warn",
|
|
13
|
+
"no-caller": "warn",
|
|
14
|
+
"no-class-assign": "warn",
|
|
15
|
+
"no-compare-neg-zero": "warn",
|
|
16
|
+
"no-cond-assign": "warn",
|
|
17
|
+
"no-const-assign": "warn",
|
|
18
|
+
"no-constant-binary-expression": "warn",
|
|
19
|
+
"no-constant-condition": "warn",
|
|
20
|
+
"no-control-regex": "warn",
|
|
21
|
+
"no-debugger": "warn",
|
|
22
|
+
"no-delete-var": "warn",
|
|
23
|
+
"no-dupe-class-members": "warn",
|
|
24
|
+
"no-dupe-else-if": "warn",
|
|
25
|
+
"no-dupe-keys": "warn",
|
|
26
|
+
"no-duplicate-case": "warn",
|
|
27
|
+
"no-empty-character-class": "warn",
|
|
28
|
+
"no-empty-pattern": "warn",
|
|
29
|
+
"no-empty-static-block": "warn",
|
|
30
|
+
"no-eval": "warn",
|
|
31
|
+
"no-ex-assign": "warn",
|
|
32
|
+
"no-extra-boolean-cast": "warn",
|
|
33
|
+
"no-func-assign": "warn",
|
|
34
|
+
"no-global-assign": "warn",
|
|
35
|
+
"no-import-assign": "warn",
|
|
36
|
+
"no-invalid-regexp": "warn",
|
|
37
|
+
"no-irregular-whitespace": "warn",
|
|
38
|
+
"no-loss-of-precision": "warn",
|
|
39
|
+
"no-new-native-nonconstructor": "warn",
|
|
40
|
+
"no-nonoctal-decimal-escape": "warn",
|
|
41
|
+
"no-obj-calls": "warn",
|
|
42
|
+
"no-self-assign": "warn",
|
|
43
|
+
"no-setter-return": "warn",
|
|
44
|
+
"no-shadow-restricted-names": "warn",
|
|
45
|
+
"no-sparse-arrays": "warn",
|
|
46
|
+
"no-this-before-super": "warn",
|
|
47
|
+
"no-unassigned-vars": "warn",
|
|
48
|
+
"no-unsafe-finally": "warn",
|
|
49
|
+
"no-unsafe-negation": "warn",
|
|
50
|
+
"no-unsafe-optional-chaining": "warn",
|
|
51
|
+
"no-unused-expressions": "warn",
|
|
52
|
+
"no-unused-labels": "warn",
|
|
53
|
+
"no-unused-private-class-members": "warn",
|
|
54
|
+
"no-unused-vars": "warn",
|
|
55
|
+
"no-useless-backreference": "warn",
|
|
56
|
+
"no-useless-catch": "warn",
|
|
57
|
+
"no-useless-escape": "warn",
|
|
58
|
+
"no-useless-rename": "warn",
|
|
59
|
+
"no-with": "warn",
|
|
60
|
+
"require-yield": "warn",
|
|
61
|
+
"use-isnan": "warn",
|
|
62
|
+
"valid-typeof": "warn",
|
|
63
|
+
"oxc/bad-array-method-on-arguments": "warn",
|
|
64
|
+
"oxc/bad-char-at-comparison": "warn",
|
|
65
|
+
"oxc/bad-comparison-sequence": "warn",
|
|
66
|
+
"oxc/bad-min-max-func": "warn",
|
|
67
|
+
"oxc/bad-object-literal-comparison": "warn",
|
|
68
|
+
"oxc/bad-replace-all-arg": "warn",
|
|
69
|
+
"oxc/const-comparisons": "warn",
|
|
70
|
+
"oxc/double-comparisons": "warn",
|
|
71
|
+
"oxc/erasing-op": "warn",
|
|
72
|
+
"oxc/missing-throw": "warn",
|
|
73
|
+
"oxc/number-arg-out-of-range": "warn",
|
|
74
|
+
"oxc/only-used-in-recursion": "warn",
|
|
75
|
+
"oxc/uninvoked-array-callback": "warn",
|
|
76
|
+
"typescript/await-thenable": "warn",
|
|
77
|
+
"typescript/no-array-delete": "warn",
|
|
78
|
+
"typescript/no-base-to-string": "warn",
|
|
79
|
+
"typescript/no-duplicate-enum-values": "warn",
|
|
80
|
+
"typescript/no-duplicate-type-constituents": "warn",
|
|
81
|
+
"typescript/no-extra-non-null-assertion": "warn",
|
|
82
|
+
"typescript/no-floating-promises": "warn",
|
|
83
|
+
"typescript/no-for-in-array": "warn",
|
|
84
|
+
"typescript/no-implied-eval": "warn",
|
|
85
|
+
"typescript/no-meaningless-void-operator": "warn",
|
|
86
|
+
"typescript/no-misused-new": "warn",
|
|
87
|
+
"typescript/no-misused-spread": "warn",
|
|
88
|
+
"typescript/no-non-null-asserted-optional-chain": "warn",
|
|
89
|
+
"typescript/no-redundant-type-constituents": "warn",
|
|
90
|
+
"typescript/no-this-alias": "warn",
|
|
91
|
+
"typescript/no-unnecessary-parameter-property-assignment": "warn",
|
|
92
|
+
"typescript/no-unsafe-declaration-merging": "warn",
|
|
93
|
+
"typescript/no-unsafe-unary-minus": "warn",
|
|
94
|
+
"typescript/no-useless-empty-export": "warn",
|
|
95
|
+
"typescript/no-wrapper-object-types": "warn",
|
|
96
|
+
"typescript/prefer-as-const": "warn",
|
|
97
|
+
"typescript/require-array-sort-compare": "warn",
|
|
98
|
+
"typescript/restrict-template-expressions": "warn",
|
|
99
|
+
"typescript/triple-slash-reference": "warn",
|
|
100
|
+
"typescript/unbound-method": "warn",
|
|
101
|
+
"unicorn/no-await-in-promise-methods": "warn",
|
|
102
|
+
"unicorn/no-empty-file": "warn",
|
|
103
|
+
"unicorn/no-invalid-fetch-options": "warn",
|
|
104
|
+
"unicorn/no-invalid-remove-event-listener": "warn",
|
|
105
|
+
"unicorn/no-new-array": "warn",
|
|
106
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
107
|
+
"unicorn/no-thenable": "warn",
|
|
108
|
+
"unicorn/no-unnecessary-await": "warn",
|
|
109
|
+
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
110
|
+
"unicorn/no-useless-length-check": "warn",
|
|
111
|
+
"unicorn/no-useless-spread": "warn",
|
|
112
|
+
"unicorn/prefer-set-size": "warn",
|
|
113
|
+
"unicorn/prefer-string-starts-ends-with": "warn"
|
|
114
|
+
},
|
|
115
|
+
"settings": {
|
|
116
|
+
"jsx-a11y": {
|
|
117
|
+
"polymorphicPropName": null,
|
|
118
|
+
"components": {},
|
|
119
|
+
"attributes": {}
|
|
120
|
+
},
|
|
121
|
+
"next": {
|
|
122
|
+
"rootDir": []
|
|
123
|
+
},
|
|
124
|
+
"react": {
|
|
125
|
+
"formComponents": [],
|
|
126
|
+
"linkComponents": [],
|
|
127
|
+
"version": null
|
|
128
|
+
},
|
|
129
|
+
"jsdoc": {
|
|
130
|
+
"ignorePrivate": false,
|
|
131
|
+
"ignoreInternal": false,
|
|
132
|
+
"ignoreReplacesDocs": true,
|
|
133
|
+
"overrideReplacesDocs": true,
|
|
134
|
+
"augmentsExtendsReplacesDocs": false,
|
|
135
|
+
"implementsReplacesDocs": false,
|
|
136
|
+
"exemptDestructuredRootsFromChecks": false,
|
|
137
|
+
"tagNamePreference": {}
|
|
138
|
+
},
|
|
139
|
+
"vitest": {
|
|
140
|
+
"typecheck": false
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"env": {
|
|
144
|
+
"builtin": true
|
|
145
|
+
},
|
|
146
|
+
"globals": {},
|
|
147
|
+
"ignorePatterns": []
|
|
148
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [1.1.5](https://github.com/djodjonx/neo-syringe/compare/v1.1.4...v1.1.5) (2026-01-18)
|
|
6
|
+
|
|
7
|
+
### [1.1.4](https://github.com/djodjonx/neo-syringe/compare/v1.1.3...v1.1.4) (2026-01-18)
|
|
8
|
+
|
|
9
|
+
### [1.1.3](https://github.com/djodjonx/neo-syringe/compare/v1.1.2...v1.1.3) (2026-01-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **ci:** restore CI workflow configuration ([24aa1ce](https://github.com/djodjonx/neo-syringe/commit/24aa1ced7c993a35a5440840126f95576b613ec8))
|
|
15
|
+
* **ci:** run coverage only on Node 20+ (node:inspector/promises not available in Node 18) ([72d6a22](https://github.com/djodjonx/neo-syringe/commit/72d6a22508365fad3513706fbe1e67cb6dfa6b2d))
|
|
16
|
+
|
|
17
|
+
### [1.1.2](https://github.com/djodjonx/neo-syringe/compare/v1.1.1...v1.1.2) (2026-01-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **ci:** remove pnpm version to use packageManager from package.json ([a8e0686](https://github.com/djodjonx/neo-syringe/commit/a8e06863b98d7c9361654deda1075c94f013e731))
|
|
23
|
+
|
|
24
|
+
### [1.1.1](https://github.com/djodjonx/neo-syringe/compare/v1.1.0...v1.1.1) (2026-01-18)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* correct typos in analyzer types ([8999c37](https://github.com/djodjonx/neo-syringe/commit/8999c373e70ba9b8b5738e5635bd1d4d949fb93b))
|
|
30
|
+
* resolve lint warnings ([faeccba](https://github.com/djodjonx/neo-syringe/commit/faeccba67dfcc3f5e3e7790d15e738900fbf5d8b))
|
|
31
|
+
|
|
32
|
+
## 1.1.0 (2026-01-18)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* **analyzer:** implement dependency graph analyzer ([ec4ea32](https://github.com/djodjonx/neo-syringe/commit/ec4ea32f4779feb955a0415d5ecc4b715b8422c6))
|
|
38
|
+
* **cli:** add CLI validation tool ([5f95973](https://github.com/djodjonx/neo-syringe/commit/5f959730b5795fe036cca51eb4588520805533ba))
|
|
39
|
+
* **core:** add type definitions and API ([b2e04b7](https://github.com/djodjonx/neo-syringe/commit/b2e04b7c228dfe1982eb72b6b6fd1147868071f2))
|
|
40
|
+
* **generator:** implement code generator ([60027dc](https://github.com/djodjonx/neo-syringe/commit/60027dcb6ba282965313936df023b15a4f26d22b))
|
|
41
|
+
* **lsp:** add TypeScript language server plugin ([561266f](https://github.com/djodjonx/neo-syringe/commit/561266fe3a5b0b28c4386e1f279f69ef6145da76))
|
|
42
|
+
* scaffold project with TypeScript, oxlint, Vitest, and Husky ([0e35001](https://github.com/djodjonx/neo-syringe/commit/0e35001535f1830c168efa4b5d748a09e416cfec))
|
|
43
|
+
* **unplugin:** add build plugin for bundlers ([9f4701a](https://github.com/djodjonx/neo-syringe/commit/9f4701a84944e9fb6375e939bd645b4b6052f088))
|