@fluojs/testing 1.0.6 → 2.0.0
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/README.ko.md +5 -5
- package/README.md +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/mock-types.d.ts +2 -0
- package/dist/mock-types.d.ts.map +1 -0
- package/dist/mock-types.js +1 -0
- package/dist/mock.d.ts +3 -2
- package/dist/mock.d.ts.map +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +71 -53
- package/dist/portability/http-adapter-portability.d.ts +1 -7
- package/dist/portability/http-adapter-portability.d.ts.map +1 -1
- package/dist/portability/http-adapter-portability.js +5 -1
- package/dist/portability/web-runtime-adapter-portability.d.ts +1 -7
- package/dist/portability/web-runtime-adapter-portability.d.ts.map +1 -1
- package/dist/types.d.ts +64 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
package/README.ko.md
CHANGED
|
@@ -60,7 +60,7 @@ try {
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
애플리케이션 route, guard, interceptor, DTO validation, request body, query parameter, header, synthetic principal, serialized response를 검증하는 기본 HTTP/e2e 스타일 경로로는 `createTestApp({ rootModule })`을 사용하세요. 하나의 slice 안에서 module wiring, provider visibility, provider/guard/interceptor override가 계약일 때는 `createTestingModule(...)`을 사용합니다.
|
|
63
|
+
애플리케이션 route, guard, interceptor, DTO validation, request body, query parameter, header, synthetic principal, request-scoped provider isolation, serialized response를 검증하는 기본 HTTP/e2e 스타일 경로로는 `createTestApp({ rootModule })`을 사용하세요. 하나의 slice 안에서 module wiring, provider visibility, provider/guard/interceptor override가 계약일 때는 `createTestingModule(...)`을 사용합니다.
|
|
64
64
|
|
|
65
65
|
## 주요 패턴
|
|
66
66
|
|
|
@@ -118,7 +118,7 @@ try {
|
|
|
118
118
|
}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
`app.request(...).send()`는 수동 `FrameworkRequest`/`FrameworkResponse` stub 없이 HTTP 의미에 가까운 테스트를 작성하게 해
|
|
121
|
+
`app.request(...).send()`는 수동 `FrameworkRequest`/`FrameworkResponse` stub 없이 HTTP 의미에 가까운 테스트를 작성하게 해 주고 runtime dispatch와 같은 isolated request-scoped DI boundary를 생성하므로 애플리케이션 개발자의 기본 경로입니다. Assertion 실패가 runtime resource 누수로 이어지지 않도록 반환된 app은 `finally` 블록에서 닫으세요. `app.dispatch(...)`, `makeRequest(...)`, raw `FluoFactory.create(...)` 테스트는 adapter/runtime contract, framework internal, 또는 low-level dispatch boundary 자체를 증명해야 하는 compatibility case에 남겨 둡니다.
|
|
122
122
|
|
|
123
123
|
`createTestApp(...)`은 runtime HTTP bootstrap과 같은 application bootstrap option을 받습니다. 여기에는 `providers`, `filters`, `converters`, `interceptors`, `middleware`, `observers`, `versioning`, diagnostics option이 포함됩니다. 테스트 헬퍼는 request-context middleware를 앞에 추가하되, 호출자가 넘긴 middleware를 같은 app middleware chain 안에 보존합니다.
|
|
124
124
|
|
|
@@ -132,7 +132,7 @@ const repo = createMock<UserRepository>({ findById: vi.fn() });
|
|
|
132
132
|
const mailer = createDeepMock(MailService);
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
`asMock(value)`는 기존 값을 mock-friendly 타입으로 좁히고, `mockToken(token, value)`는 token 기반
|
|
135
|
+
`asMock(value)`는 기존 값을 mock-friendly 타입으로 좁히고, `mockToken(token, value)`는 token 기반 override를 위해 `{ provide: token, useValue: value }` 형태의 `ValueProvider` descriptor를 만듭니다. `createMock(..., { strict: true })`는 지정하지 않은 member 접근을 거부합니다. `DeepMocked<T>`는 root `@fluojs/testing` 패키지, `@fluojs/testing/types`, `@fluojs/testing/mock`에서 모두 노출됩니다. 세 경로는 Vitest peer declaration을 non-mock runtime helper로 끌어들이지 않으면서 같은 Vitest-compatible mock type boundary를 공유합니다. Vitest를 사용하지 않는 소비자는 `@fluojs/testing/app`, `@fluojs/testing/module`, 또는 harness subpath에서 non-mock helper만 import하세요.
|
|
136
136
|
|
|
137
137
|
배포된 런타임 import가 안정적으로 해석되도록, mock 헬퍼를 사용할 워크스페이스에는 `vitest`를 함께 설치해야 합니다.
|
|
138
138
|
|
|
@@ -169,8 +169,8 @@ fluo는 테스트가 명시적인 `rootModule`을 이름으로 지정해야 한
|
|
|
169
169
|
|
|
170
170
|
## 공개 API
|
|
171
171
|
|
|
172
|
-
- **루트 패키지**: `createTestingModule(...)`, `Test.createTestingModule(...)`, `createTestApp(...)`, 모듈 introspection 헬퍼, 공용 테스트 타입
|
|
173
|
-
- **서브패스**: `@fluojs/testing/app`, `@fluojs/testing/module`, `@fluojs/testing/http`, `@fluojs/testing/mock
|
|
172
|
+
- **루트 패키지**: `createTestingModule(...)`, `Test.createTestingModule(...)`, `createTestApp(...)`, 모듈 introspection 헬퍼, `DeepMocked<T>`를 포함한 공용 app/module 테스트 타입
|
|
173
|
+
- **서브패스**: `@fluojs/testing/app`, `@fluojs/testing/module`, `@fluojs/testing/http`, `@fluojs/testing/mock` (`DeepMocked<T>` 포함), `@fluojs/testing/types` (`DeepMocked<T>` 포함), `@fluojs/testing/vitest`, `@fluojs/testing/vitest/tooling`
|
|
174
174
|
- **하니스 서브패스**: `platform-conformance`, `http-adapter-portability`, `web-runtime-adapter-portability`, `fetch-style-websocket-conformance`
|
|
175
175
|
- **도구 지원**: `@fluojs/testing/vitest`의 `fluoBabelDecoratorsPlugin()` 및 `@fluojs/testing/vitest/tooling`의 Vitest workspace config helper (`vitest`와 `@babel/core`를 함께 요구)
|
|
176
176
|
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ try {
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
Use `createTestApp({ rootModule })` as the default HTTP/e2e-style path for application routes, guards, interceptors, DTO validation, request bodies, query parameters, headers, synthetic principals, and serialized responses. Reach for `createTestingModule(...)` when the contract is module wiring, provider visibility, or provider/guard/interceptor overrides inside one slice.
|
|
61
|
+
Use `createTestApp({ rootModule })` as the default HTTP/e2e-style path for application routes, guards, interceptors, DTO validation, request bodies, query parameters, headers, synthetic principals, request-scoped provider isolation, and serialized responses. Reach for `createTestingModule(...)` when the contract is module wiring, provider visibility, or provider/guard/interceptor overrides inside one slice.
|
|
62
62
|
|
|
63
63
|
## Common Patterns
|
|
64
64
|
|
|
@@ -116,7 +116,7 @@ try {
|
|
|
116
116
|
}
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
`app.request(...).send()` is the preferred app-developer path because it keeps tests close to HTTP semantics without manual `FrameworkRequest`/`FrameworkResponse` stubs. Close the returned app from a `finally` block so assertion failures do not leak runtime resources. Keep `app.dispatch(...)`, `makeRequest(...)`, and raw `FluoFactory.create(...)` tests for adapter/runtime contracts, framework internals, or compatibility cases where the low-level dispatch boundary itself is what the test must prove.
|
|
119
|
+
`app.request(...).send()` is the preferred app-developer path because it keeps tests close to HTTP semantics without manual `FrameworkRequest`/`FrameworkResponse` stubs and creates the same isolated request-scoped DI boundary as runtime dispatch. Close the returned app from a `finally` block so assertion failures do not leak runtime resources. Keep `app.dispatch(...)`, `makeRequest(...)`, and raw `FluoFactory.create(...)` tests for adapter/runtime contracts, framework internals, or compatibility cases where the low-level dispatch boundary itself is what the test must prove.
|
|
120
120
|
|
|
121
121
|
`createTestApp(...)` accepts the same application bootstrap options as the runtime HTTP bootstrap, including `providers`, `filters`, `converters`, `interceptors`, `middleware`, `observers`, `versioning`, and diagnostics options. The testing helper prepends its request-context middleware while preserving caller-provided middleware in the same app middleware chain.
|
|
122
122
|
|
|
@@ -130,7 +130,7 @@ const repo = createMock<UserRepository>({ findById: vi.fn() });
|
|
|
130
130
|
const mailer = createDeepMock(MailService);
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
`asMock(value)` narrows an existing value to a mock-friendly type, and `mockToken(token, value)` creates a
|
|
133
|
+
`asMock(value)` narrows an existing value to a mock-friendly type, and `mockToken(token, value)` creates a `ValueProvider` descriptor shaped as `{ provide: token, useValue: value }` for token-based overrides. `createMock(..., { strict: true })` rejects access to unspecified members. `DeepMocked<T>` is exposed from the root `@fluojs/testing` package, `@fluojs/testing/types`, and `@fluojs/testing/mock`; all three paths intentionally share the same Vitest-compatible mock type boundary without importing Vitest peer declarations through non-mock runtime helpers. Consumers that do not use Vitest should import only non-mock helpers from `@fluojs/testing/app`, `@fluojs/testing/module`, or the harness subpaths.
|
|
134
134
|
|
|
135
135
|
Install `vitest` in the consuming workspace before using the mock helpers so the published runtime import resolves consistently.
|
|
136
136
|
|
|
@@ -167,8 +167,8 @@ fluo differs from NestJS by requiring tests to name an explicit `rootModule`. Th
|
|
|
167
167
|
|
|
168
168
|
## Public API
|
|
169
169
|
|
|
170
|
-
- **Root package**: `createTestingModule(...)`, `Test.createTestingModule(...)`, `createTestApp(...)`, module introspection helpers, shared testing types
|
|
171
|
-
- **Subpaths**: `@fluojs/testing/app`, `@fluojs/testing/module`, `@fluojs/testing/http`, `@fluojs/testing/mock
|
|
170
|
+
- **Root package**: `createTestingModule(...)`, `Test.createTestingModule(...)`, `createTestApp(...)`, module introspection helpers, and shared app/module testing types including `DeepMocked<T>`
|
|
171
|
+
- **Subpaths**: `@fluojs/testing/app`, `@fluojs/testing/module`, `@fluojs/testing/http`, `@fluojs/testing/mock` (including `DeepMocked<T>`), `@fluojs/testing/types` (including `DeepMocked<T>`), `@fluojs/testing/vitest`, `@fluojs/testing/vitest/tooling`
|
|
172
172
|
- **Harness subpaths**: `platform-conformance`, `http-adapter-portability`, `web-runtime-adapter-portability`, `fetch-style-websocket-conformance`
|
|
173
173
|
- **Tooling**: `@fluojs/testing/vitest` with `fluoBabelDecoratorsPlugin()` and `@fluojs/testing/vitest/tooling` with Vitest workspace config helpers (requires `vitest` and `@babel/core` in the consuming workspace)
|
|
174
174
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './app.js';
|
|
2
2
|
export { Test, createTestingModule, extractModuleProviders, extractModuleControllers, extractModuleImports } from './module.js';
|
|
3
|
-
export
|
|
3
|
+
export type { DeepMocked, OverrideProviderBuilder, TestApp, TestingApplicationOptions, TestingModuleBuilder, TestingModuleOptions, TestingModuleRef, TestRequestOptions, } from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChI,YAAY,EACV,UAAU,EACV,uBAAuB,EACvB,OAAO,EACP,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export * from './app.js';
|
|
2
|
-
export { Test, createTestingModule, extractModuleProviders, extractModuleControllers, extractModuleImports } from './module.js';
|
|
3
|
-
export * from './types.js';
|
|
2
|
+
export { Test, createTestingModule, extractModuleProviders, extractModuleControllers, extractModuleImports } from './module.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-types.d.ts","sourceRoot":"","sources":["../src/mock-types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/mock.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Mock } from 'vitest';
|
|
2
1
|
import type { Token } from '@fluojs/core';
|
|
3
2
|
import type { ValueProvider } from '@fluojs/di';
|
|
4
|
-
import type {
|
|
3
|
+
import type { Mock } from 'vitest';
|
|
4
|
+
import type { DeepMocked } from './mock-types.js';
|
|
5
|
+
export type { DeepMocked } from './mock-types.js';
|
|
5
6
|
/**
|
|
6
7
|
* Defines the mocked methods type.
|
|
7
8
|
*/
|
package/dist/mock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC/E,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,OAAO,GAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAM,EACvC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,aAAa,CAAC,CAAC,CAAC,CAsBlB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAkBnG;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,OAAO,CAAC,CAAC,CAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAExF"}
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EAKd,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EAKd,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAGV,UAAU,EACX,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EAA2B,oBAAoB,EAAE,oBAAoB,EAAoB,MAAM,YAAY,CAAC;AAYxH;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,EAAE,CAQzE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,EAAE,CAQ5E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE,CAQzE;AAyuBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CAEvF;AAED;;GAEG;AACH,eAAO,MAAM,IAAI;;CAEhB,CAAC"}
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getModuleMetadata } from '@fluojs/core';
|
|
2
|
-
import { isForwardRef, isOptionalToken, Scope } from '@fluojs/di';
|
|
2
|
+
import { isForwardRef, isOptionalToken, RequestScopeResolutionError, Scope } from '@fluojs/di';
|
|
3
3
|
import { bootstrapModule } from '@fluojs/runtime';
|
|
4
4
|
import { createDispatcher, createHandlerMapping } from '@fluojs/http';
|
|
5
5
|
import { createTestRequestContextMiddleware, makeRequest } from './http.js';
|
|
@@ -45,9 +45,10 @@ export function extractModuleImports(moduleType) {
|
|
|
45
45
|
return metadata.imports;
|
|
46
46
|
}
|
|
47
47
|
function createHandlerSources(bootstrappedModules) {
|
|
48
|
+
const globalModules = bootstrappedModules.filter(compiledModule => compiledModule.definition.global);
|
|
48
49
|
return bootstrappedModules.flatMap(compiledModule => (compiledModule.definition.controllers ?? []).map(controllerToken => ({
|
|
49
50
|
controllerToken,
|
|
50
|
-
moduleMiddleware: compiledModule.definition.middleware ?? [],
|
|
51
|
+
moduleMiddleware: [...globalModules.filter(globalModule => globalModule !== compiledModule).flatMap(globalModule => globalModule.definition.middleware ?? []), ...(compiledModule.definition.middleware ?? [])],
|
|
51
52
|
moduleType: compiledModule.type
|
|
52
53
|
})));
|
|
53
54
|
}
|
|
@@ -133,16 +134,16 @@ async function instantiateLifecycleProvider(provider, bootstrapped, introspectio
|
|
|
133
134
|
return new provider.useClass(...dependencies);
|
|
134
135
|
}
|
|
135
136
|
async function resolveMultiLifecycleProvider(provider, bootstrapped, introspection) {
|
|
136
|
-
const
|
|
137
|
-
const cached =
|
|
137
|
+
const rootIntrospection = rootContainerIntrospection(introspection);
|
|
138
|
+
const cached = rootIntrospection.multiSingletonCache.get(provider);
|
|
138
139
|
if (cached) {
|
|
139
140
|
return cached;
|
|
140
141
|
}
|
|
141
142
|
const instance = instantiateLifecycleProvider(provider, bootstrapped, introspection).catch(error => {
|
|
142
|
-
|
|
143
|
+
rootIntrospection.cacheOwner.deleteMultiSingleton(provider);
|
|
143
144
|
throw error;
|
|
144
145
|
});
|
|
145
|
-
|
|
146
|
+
rootIntrospection.cacheOwner.setMultiSingleton(provider, instance);
|
|
146
147
|
return instance;
|
|
147
148
|
}
|
|
148
149
|
async function resolveTestingLifecycleInstances(bootstrapped, overrides = []) {
|
|
@@ -176,7 +177,7 @@ async function resolveTestingLifecycleInstances(bootstrapped, overrides = []) {
|
|
|
176
177
|
}
|
|
177
178
|
instances.push(await bootstrapped.container.resolve(token));
|
|
178
179
|
} catch (error) {
|
|
179
|
-
if (error instanceof
|
|
180
|
+
if (error instanceof RequestScopeResolutionError) {
|
|
180
181
|
continue;
|
|
181
182
|
}
|
|
182
183
|
throw error;
|
|
@@ -228,30 +229,6 @@ function dependencyToken(entry) {
|
|
|
228
229
|
}
|
|
229
230
|
return entry;
|
|
230
231
|
}
|
|
231
|
-
function trackFactoryResolutionKind(provider, factoryResolutionKinds) {
|
|
232
|
-
if (provider.type !== 'factory' || !provider.useFactory) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
const originalFactory = provider.useFactory;
|
|
236
|
-
provider.useFactory = (...deps) => {
|
|
237
|
-
const value = originalFactory(...deps);
|
|
238
|
-
factoryResolutionKinds.set(provider, isPromiseLike(value) ? 'async' : 'sync');
|
|
239
|
-
return value;
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function installFactoryResolutionTracking(target, factoryResolutionKinds) {
|
|
243
|
-
if (target.parent) {
|
|
244
|
-
installFactoryResolutionTracking(target.parent, factoryResolutionKinds);
|
|
245
|
-
}
|
|
246
|
-
for (const provider of target.registrations.values()) {
|
|
247
|
-
trackFactoryResolutionKind(provider, factoryResolutionKinds);
|
|
248
|
-
}
|
|
249
|
-
for (const providers of target.multiRegistrations.values()) {
|
|
250
|
-
for (const provider of providers) {
|
|
251
|
-
trackFactoryResolutionKind(provider, factoryResolutionKinds);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
232
|
function providerGraphIsSyncResolvable(state, token, visited = new Set()) {
|
|
256
233
|
if (visited.has(token)) {
|
|
257
234
|
return true;
|
|
@@ -332,6 +309,7 @@ function instantiateSyncProvider(provider, state) {
|
|
|
332
309
|
if (isPromiseLike(value)) {
|
|
333
310
|
throw new Error(`Token ${String(provider.provide)} requires async resolution. Use resolve() instead of get() for async providers.`);
|
|
334
311
|
}
|
|
312
|
+
state.cacheOwner.recordFactoryResolution(provider, 'sync');
|
|
335
313
|
return value;
|
|
336
314
|
}
|
|
337
315
|
case 'class':
|
|
@@ -355,15 +333,20 @@ function resolveSyncProvider(provider, state) {
|
|
|
355
333
|
if (provider.scope === 'transient') {
|
|
356
334
|
return instantiateSyncProvider(provider, state);
|
|
357
335
|
}
|
|
358
|
-
|
|
359
|
-
|
|
336
|
+
const memo = state.syncSingletonValues.get(provider.provide);
|
|
337
|
+
if (memo) {
|
|
338
|
+
return memo.value;
|
|
360
339
|
}
|
|
361
340
|
if (state.singletonCache.has(provider.provide)) {
|
|
362
341
|
throw new Error(`Token ${String(provider.provide)} was already resolved asynchronously. Use resolve() instead of get() for this provider.`);
|
|
363
342
|
}
|
|
364
343
|
const instance = instantiateSyncProvider(provider, state);
|
|
365
|
-
|
|
366
|
-
state.
|
|
344
|
+
const cacheEntry = Promise.resolve(instance);
|
|
345
|
+
state.syncSingletonValues.set(provider.provide, {
|
|
346
|
+
cacheEntry,
|
|
347
|
+
value: instance
|
|
348
|
+
});
|
|
349
|
+
state.cacheOwner.setSingleton(provider.provide, cacheEntry);
|
|
367
350
|
return instance;
|
|
368
351
|
}
|
|
369
352
|
function resolveSyncMultiProvider(provider, state) {
|
|
@@ -373,15 +356,20 @@ function resolveSyncMultiProvider(provider, state) {
|
|
|
373
356
|
if (provider.scope === 'transient') {
|
|
374
357
|
return instantiateSyncProvider(provider, state);
|
|
375
358
|
}
|
|
376
|
-
|
|
377
|
-
|
|
359
|
+
const memo = state.syncMultiSingletonValues.get(provider);
|
|
360
|
+
if (memo) {
|
|
361
|
+
return memo.value;
|
|
378
362
|
}
|
|
379
363
|
if (state.multiSingletonCache.has(provider)) {
|
|
380
364
|
throw new Error(`Token ${String(provider.provide)} was already resolved asynchronously. Use resolve() instead of get() for this provider.`);
|
|
381
365
|
}
|
|
382
366
|
const instance = instantiateSyncProvider(provider, state);
|
|
383
|
-
|
|
384
|
-
state.
|
|
367
|
+
const cacheEntry = Promise.resolve(instance);
|
|
368
|
+
state.syncMultiSingletonValues.set(provider, {
|
|
369
|
+
cacheEntry,
|
|
370
|
+
value: instance
|
|
371
|
+
});
|
|
372
|
+
state.cacheOwner.setMultiSingleton(provider, cacheEntry);
|
|
385
373
|
return instance;
|
|
386
374
|
}
|
|
387
375
|
function resolveSyncToken(token, state) {
|
|
@@ -405,31 +393,60 @@ function resolveSyncToken(token, state) {
|
|
|
405
393
|
}
|
|
406
394
|
function createSyncResolver(container) {
|
|
407
395
|
const introspection = toContainerIntrospection(container);
|
|
408
|
-
const
|
|
409
|
-
installFactoryResolutionTracking(introspection, factoryResolutionKinds);
|
|
396
|
+
const rootIntrospection = rootContainerIntrospection(introspection);
|
|
410
397
|
const state = {
|
|
411
|
-
|
|
398
|
+
cacheOwner: rootIntrospection.cacheOwner,
|
|
399
|
+
factoryResolutionKinds: rootIntrospection.factoryResolutionKinds,
|
|
412
400
|
introspection,
|
|
413
|
-
multiSingletonCache:
|
|
401
|
+
multiSingletonCache: rootIntrospection.multiSingletonCache,
|
|
414
402
|
resolutionChain: new Set(),
|
|
415
|
-
singletonCache:
|
|
403
|
+
singletonCache: rootIntrospection.singletonCache,
|
|
416
404
|
syncMultiSingletonValues: new Map(),
|
|
417
405
|
syncSingletonValues: new Map()
|
|
418
406
|
};
|
|
407
|
+
const refreshState = () => {
|
|
408
|
+
const freshIntrospection = toContainerIntrospection(container);
|
|
409
|
+
const freshRootIntrospection = rootContainerIntrospection(freshIntrospection);
|
|
410
|
+
state.cacheOwner = freshRootIntrospection.cacheOwner;
|
|
411
|
+
state.factoryResolutionKinds = freshRootIntrospection.factoryResolutionKinds;
|
|
412
|
+
state.introspection = freshIntrospection;
|
|
413
|
+
state.multiSingletonCache = freshRootIntrospection.multiSingletonCache;
|
|
414
|
+
state.singletonCache = freshRootIntrospection.singletonCache;
|
|
415
|
+
for (const [token, memo] of state.syncSingletonValues) {
|
|
416
|
+
if (state.singletonCache.get(token) !== memo.cacheEntry) {
|
|
417
|
+
state.syncSingletonValues.delete(token);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
for (const [provider, memo] of state.syncMultiSingletonValues) {
|
|
421
|
+
if (state.multiSingletonCache.get(provider) !== memo.cacheEntry) {
|
|
422
|
+
state.syncMultiSingletonValues.delete(provider);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
};
|
|
419
426
|
return {
|
|
420
|
-
get: token =>
|
|
427
|
+
get: token => {
|
|
428
|
+
refreshState();
|
|
429
|
+
return resolveSyncToken(token, state);
|
|
430
|
+
},
|
|
421
431
|
syncFromContainer: async () => {
|
|
432
|
+
refreshState();
|
|
422
433
|
for (const [token, promise] of state.singletonCache) {
|
|
423
434
|
if (!canPromoteCachedSingleton(state, token)) {
|
|
424
435
|
continue;
|
|
425
436
|
}
|
|
426
|
-
state.syncSingletonValues.set(token,
|
|
437
|
+
state.syncSingletonValues.set(token, {
|
|
438
|
+
cacheEntry: promise,
|
|
439
|
+
value: await promise
|
|
440
|
+
});
|
|
427
441
|
}
|
|
428
442
|
for (const [provider, promise] of state.multiSingletonCache) {
|
|
429
443
|
if (!providerGraphForProviderIsSyncResolvable(state, provider)) {
|
|
430
444
|
continue;
|
|
431
445
|
}
|
|
432
|
-
state.syncMultiSingletonValues.set(provider,
|
|
446
|
+
state.syncMultiSingletonValues.set(provider, {
|
|
447
|
+
cacheEntry: promise,
|
|
448
|
+
value: await promise
|
|
449
|
+
});
|
|
433
450
|
}
|
|
434
451
|
}
|
|
435
452
|
};
|
|
@@ -527,6 +544,12 @@ class DefaultTestingModuleBuilder {
|
|
|
527
544
|
const syncResolver = createSyncResolver(bootstrapped.container);
|
|
528
545
|
await runTestingBootstrapLifecycle(bootstrapped, this.overrides);
|
|
529
546
|
await syncResolver.syncFromContainer();
|
|
547
|
+
const resolve = bootstrapped.container.resolve.bind(bootstrapped.container);
|
|
548
|
+
bootstrapped.container.resolve = async token => {
|
|
549
|
+
const value = await resolve(token);
|
|
550
|
+
await syncResolver.syncFromContainer();
|
|
551
|
+
return value;
|
|
552
|
+
};
|
|
530
553
|
return this.createTestingModuleRef(bootstrapped, syncResolver);
|
|
531
554
|
}
|
|
532
555
|
bootstrapTestingModule() {
|
|
@@ -545,11 +568,7 @@ class DefaultTestingModuleBuilder {
|
|
|
545
568
|
...bootstrapped,
|
|
546
569
|
has: token => bootstrapped.container.has(token),
|
|
547
570
|
get: token => syncResolver.get(token),
|
|
548
|
-
resolve:
|
|
549
|
-
const value = await bootstrapped.container.resolve(token);
|
|
550
|
-
await syncResolver.syncFromContainer();
|
|
551
|
-
return value;
|
|
552
|
-
},
|
|
571
|
+
resolve: token => bootstrapped.container.resolve(token),
|
|
553
572
|
resolveAll: async tokens => {
|
|
554
573
|
const results = [];
|
|
555
574
|
const errors = [];
|
|
@@ -570,7 +589,6 @@ class DefaultTestingModuleBuilder {
|
|
|
570
589
|
}) => ` - ${String(token)}: ${error instanceof Error ? error.message : String(error)}`).join('\n');
|
|
571
590
|
throw new Error(`Failed to resolve ${errors.length} of ${tokens.length} tokens:\n${summary}`);
|
|
572
591
|
}
|
|
573
|
-
await syncResolver.syncFromContainer();
|
|
574
592
|
return results;
|
|
575
593
|
},
|
|
576
594
|
dispatch: async request => {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import { type ModuleType
|
|
2
|
-
declare module '@fluojs/http' {
|
|
3
|
-
interface FrameworkRequest {
|
|
4
|
-
files?: UploadedFile[];
|
|
5
|
-
rawBody?: Uint8Array;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
import { type ModuleType } from '@fluojs/runtime';
|
|
8
2
|
type AppLike = {
|
|
9
3
|
close(): Promise<void>;
|
|
10
4
|
listen(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-adapter-portability.d.ts","sourceRoot":"","sources":["../../src/portability/http-adapter-portability.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-adapter-portability.d.ts","sourceRoot":"","sources":["../../src/portability/http-adapter-portability.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExF,KAAK,OAAO,GAAG;IACb,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC;AAcF;;;;;;GAMG;AACH,MAAM,WAAW,oCAAoC,CACnD,iBAAiB,SAAS,MAAM,EAChC,WAAW,SAAS,MAAM,EAC1B,IAAI,SAAS,OAAO,GAAG,OAAO;IAE9B;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjF;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,2BAA2B,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IA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if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
5
5
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
6
|
-
import { request as httpsRequest } from 'node:https';
|
|
7
6
|
import { Controller, Get, Post, SseResponse } from '@fluojs/http';
|
|
8
7
|
import { defineModule } from '@fluojs/runtime';
|
|
9
8
|
|
|
@@ -37,6 +36,11 @@ function resolveListeningUrl(app, adapterName) {
|
|
|
37
36
|
return target.url;
|
|
38
37
|
}
|
|
39
38
|
async function requestHttps(url) {
|
|
39
|
+
const [{
|
|
40
|
+
Buffer
|
|
41
|
+
}, {
|
|
42
|
+
request: httpsRequest
|
|
43
|
+
}] = await Promise.all([import('node:buffer'), import('node:https')]);
|
|
40
44
|
return await new Promise((resolve, reject) => {
|
|
41
45
|
const request = httpsRequest(url, {
|
|
42
46
|
rejectUnauthorized: false
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import { type ModuleType
|
|
2
|
-
declare module '@fluojs/http' {
|
|
3
|
-
interface FrameworkRequest {
|
|
4
|
-
files?: UploadedFile[];
|
|
5
|
-
rawBody?: Uint8Array;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
import { type ModuleType } from '@fluojs/runtime';
|
|
8
2
|
type WebRuntimePortabilityAppLike = {
|
|
9
3
|
close(): Promise<void>;
|
|
10
4
|
dispatch(request: Request): Promise<Response>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-runtime-adapter-portability.d.ts","sourceRoot":"","sources":["../../src/portability/web-runtime-adapter-portability.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"web-runtime-adapter-portability.d.ts","sourceRoot":"","sources":["../../src/portability/web-runtime-adapter-portability.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,4BAA4B,GAAG;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,8CAA8C,CAC7D,iBAAiB,SAAS,MAAM,EAChC,IAAI,SAAS,4BAA4B,GAAG,4BAA4B;IAExE,SAAS,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjF,IAAI,EAAE,MAAM,CAAC;CACd;AA0CD;;GAEG;AACH,qBAAa,uCAAuC,CAClD,iBAAiB,SAAS,MAAM,EAChC,IAAI,SAAS,4BAA4B,GAAG,4BAA4B;IAE5D,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,8CAA8C,CAAC,iBAAiB,EAAE,IAAI,CAAC;IAEvG,qCAAqC,IAAI,OAAO,CAAC,IAAI,CAAC;IAyCtD,oCAAoC,IAAI,OAAO,CAAC,IAAI,CAAC;IAgDrD,oCAAoC,IAAI,OAAO,CAAC,IAAI,CAAC;IAsE3D;;OAEG;IACG,wDAAwD,IAAI,OAAO,CAAC,IAAI,CAAC;IA0CzE,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC;IAqDlD,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC;CA8ClD;AAED;;;;;GAKG;AACH,wBAAgB,6CAA6C,CAC3D,iBAAiB,SAAS,MAAM,EAChC,IAAI,SAAS,4BAA4B,GAAG,4BAA4B,EAExE,OAAO,EAAE,8CAA8C,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAC/E,uCAAuC,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAElE"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Mock } from 'vitest';
|
|
2
1
|
import type { MaybePromise, Token } from '@fluojs/core';
|
|
3
2
|
import type { ClassType, Container, ForwardRefFn, OptionalToken, Provider } from '@fluojs/di';
|
|
4
|
-
import type { BootstrapApplicationOptions, BootstrapResult, BootstrapModuleOptions, ModuleType } from '@fluojs/runtime';
|
|
5
3
|
import type { Guard, Interceptor } from '@fluojs/http';
|
|
4
|
+
import type { BootstrapApplicationOptions, BootstrapModuleOptions, BootstrapResult, ModuleType } from '@fluojs/runtime';
|
|
6
5
|
import type { RequestBuilder, TestPrincipal, TestRequest, TestRequestWithOptions, TestResponse } from './http.js';
|
|
7
6
|
/**
|
|
8
7
|
* Bootstrap options accepted by `createTestingModule(...)`.
|
|
@@ -74,9 +73,70 @@ export interface TestApp {
|
|
|
74
73
|
close(): Promise<void>;
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
|
-
*
|
|
76
|
+
* Result entry recorded by a Vitest-compatible testing mock.
|
|
77
|
+
*/
|
|
78
|
+
export type TestingMockResult<Return> = {
|
|
79
|
+
type: 'return';
|
|
80
|
+
value: Return;
|
|
81
|
+
} | {
|
|
82
|
+
type: 'throw';
|
|
83
|
+
value: unknown;
|
|
84
|
+
} | {
|
|
85
|
+
type: 'incomplete';
|
|
86
|
+
value: undefined;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Settled async result entry recorded by a Vitest-compatible testing mock.
|
|
90
|
+
*/
|
|
91
|
+
export type TestingMockSettledResult<Return> = {
|
|
92
|
+
type: 'fulfilled';
|
|
93
|
+
value: Awaited<Return>;
|
|
94
|
+
} | {
|
|
95
|
+
type: 'rejected';
|
|
96
|
+
value: unknown;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Context snapshot exposed from a Vitest-compatible testing mock.
|
|
100
|
+
*/
|
|
101
|
+
export interface TestingMockContext<Args extends unknown[] = unknown[], Return = unknown> {
|
|
102
|
+
calls: Args[];
|
|
103
|
+
instances: Return[];
|
|
104
|
+
contexts: unknown[];
|
|
105
|
+
invocationCallOrder: number[];
|
|
106
|
+
results: Array<TestingMockResult<Return>>;
|
|
107
|
+
settledResults: Array<TestingMockSettledResult<Return>>;
|
|
108
|
+
lastCall: Args | undefined;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Vitest `Mock<T>`-compatible function shape used to preserve root `DeepMocked<T>` type imports
|
|
112
|
+
* without importing Vitest peer declarations through non-mock entrypoints.
|
|
113
|
+
*/
|
|
114
|
+
export interface TestingMockFunction<Args extends unknown[] = unknown[], Return = unknown> {
|
|
115
|
+
new (...args: Args): Return;
|
|
116
|
+
(...args: Args): Return;
|
|
117
|
+
[Symbol.dispose](): void;
|
|
118
|
+
mock: TestingMockContext<Args, Return>;
|
|
119
|
+
getMockName(): string;
|
|
120
|
+
getMockImplementation(): ((...args: Args) => Return) | undefined;
|
|
121
|
+
mockClear(): this;
|
|
122
|
+
mockName(name: string): this;
|
|
123
|
+
mockReset(): this;
|
|
124
|
+
mockRestore(): void;
|
|
125
|
+
mockImplementation(fn: (...args: Args) => Return): this;
|
|
126
|
+
mockImplementationOnce(fn: (...args: Args) => Return): this;
|
|
127
|
+
withImplementation<T>(fn: (...args: Args) => Return, callback: () => T): T extends Promise<unknown> ? Promise<this> : this;
|
|
128
|
+
mockReturnThis(): this;
|
|
129
|
+
mockReturnValue(value: Return): this;
|
|
130
|
+
mockReturnValueOnce(value: Return): this;
|
|
131
|
+
mockResolvedValue(value: Awaited<Return>): this;
|
|
132
|
+
mockResolvedValueOnce(value: Awaited<Return>): this;
|
|
133
|
+
mockRejectedValue(error: unknown): this;
|
|
134
|
+
mockRejectedValueOnce(error: unknown): this;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Shallow method-mocked version of a type where function properties become mock functions.
|
|
78
138
|
*/
|
|
79
139
|
export type DeepMocked<T> = {
|
|
80
|
-
[K in keyof T]: T[K] extends (...args: infer A) => infer R ?
|
|
140
|
+
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? TestingMockFunction<A, R> & T[K] : T[K];
|
|
81
141
|
};
|
|
82
142
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAElH;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,2BAA2B;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAED;;GAEG;AACH,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,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrG,CAAC"}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"override",
|
|
10
10
|
"module-builder"
|
|
11
11
|
],
|
|
12
|
-
"version": "
|
|
12
|
+
"version": "2.0.0",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
"dist"
|
|
81
81
|
],
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@fluojs/config": "^1.0.
|
|
84
|
-
"@fluojs/core": "^1.0
|
|
85
|
-
"@fluojs/http": "^
|
|
86
|
-
"@fluojs/di": "^
|
|
87
|
-
"@fluojs/runtime": "^
|
|
83
|
+
"@fluojs/config": "^1.0.4",
|
|
84
|
+
"@fluojs/core": "^1.1.0",
|
|
85
|
+
"@fluojs/http": "^2.0.1",
|
|
86
|
+
"@fluojs/di": "^2.0.0",
|
|
87
|
+
"@fluojs/runtime": "^2.0.1"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@babel/core": ">=7.0.0",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"vitest": "^3.2.4",
|
|
95
|
-
"@fluojs/platform-bun": "^
|
|
96
|
-
"@fluojs/platform-cloudflare-workers": "^1.0.
|
|
97
|
-
"@fluojs/platform-deno": "^1.0
|
|
98
|
-
"@fluojs/platform-nodejs": "^1.0.
|
|
99
|
-
"@fluojs/platform-express": "^1.0
|
|
100
|
-
"@fluojs/platform-fastify": "^1.0.
|
|
95
|
+
"@fluojs/platform-bun": "^2.0.0",
|
|
96
|
+
"@fluojs/platform-cloudflare-workers": "^1.0.5",
|
|
97
|
+
"@fluojs/platform-deno": "^1.1.0",
|
|
98
|
+
"@fluojs/platform-nodejs": "^1.0.6",
|
|
99
|
+
"@fluojs/platform-express": "^1.1.0",
|
|
100
|
+
"@fluojs/platform-fastify": "^1.0.9"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"prebuild": "node ../../tooling/scripts/clean-dist.mjs",
|