@kanjijs/platform-hono 0.2.0-beta.1 → 0.2.0-beta.10
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/dist/index.js +64 -57
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -2843,69 +2843,73 @@ var methodMetadataStore = new WeakMap;
|
|
|
2843
2843
|
var controllerMetadataStore = new WeakMap;
|
|
2844
2844
|
var moduleMetadataStore = new WeakMap;
|
|
2845
2845
|
var injectionMetadataStore = new WeakMap;
|
|
2846
|
-
var
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
methods = new Map;
|
|
2851
|
-
methodMetadataStore.set(target, methods);
|
|
2852
|
-
}
|
|
2853
|
-
const existing = methods.get(methodName) || {};
|
|
2854
|
-
methods.set(methodName, { ...existing, ...meta });
|
|
2855
|
-
},
|
|
2856
|
-
addContract(target, methodName, contract) {
|
|
2857
|
-
let methods = methodMetadataStore.get(target);
|
|
2858
|
-
if (!methods) {
|
|
2859
|
-
methods = new Map;
|
|
2860
|
-
methodMetadataStore.set(target, methods);
|
|
2861
|
-
}
|
|
2862
|
-
const existing = methods.get(methodName) || {};
|
|
2863
|
-
existing.contract = contract;
|
|
2864
|
-
methods.set(methodName, existing);
|
|
2865
|
-
},
|
|
2866
|
-
addMiddleware(target, middleware, methodName) {
|
|
2867
|
-
if (methodName) {
|
|
2846
|
+
var globalStore = globalThis;
|
|
2847
|
+
if (!globalStore.KANJI_METADATA_STORAGE) {
|
|
2848
|
+
globalStore.KANJI_METADATA_STORAGE = {
|
|
2849
|
+
addRoute(target, methodName, meta) {
|
|
2868
2850
|
let methods = methodMetadataStore.get(target);
|
|
2869
2851
|
if (!methods) {
|
|
2870
2852
|
methods = new Map;
|
|
2871
2853
|
methodMetadataStore.set(target, methods);
|
|
2872
2854
|
}
|
|
2873
2855
|
const existing = methods.get(methodName) || {};
|
|
2874
|
-
|
|
2856
|
+
methods.set(methodName, { ...existing, ...meta });
|
|
2857
|
+
},
|
|
2858
|
+
addContract(target, methodName, contract) {
|
|
2859
|
+
let methods = methodMetadataStore.get(target);
|
|
2860
|
+
if (!methods) {
|
|
2861
|
+
methods = new Map;
|
|
2862
|
+
methodMetadataStore.set(target, methods);
|
|
2863
|
+
}
|
|
2864
|
+
const existing = methods.get(methodName) || {};
|
|
2865
|
+
existing.contract = contract;
|
|
2875
2866
|
methods.set(methodName, existing);
|
|
2876
|
-
}
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2867
|
+
},
|
|
2868
|
+
addMiddleware(target, middleware, methodName) {
|
|
2869
|
+
if (methodName) {
|
|
2870
|
+
let methods = methodMetadataStore.get(target);
|
|
2871
|
+
if (!methods) {
|
|
2872
|
+
methods = new Map;
|
|
2873
|
+
methodMetadataStore.set(target, methods);
|
|
2874
|
+
}
|
|
2875
|
+
const existing = methods.get(methodName) || {};
|
|
2876
|
+
existing.middlewares = [...existing.middlewares || [], middleware];
|
|
2877
|
+
methods.set(methodName, existing);
|
|
2878
|
+
} else {
|
|
2879
|
+
const existing = controllerMetadataStore.get(target) || { prefix: "/" };
|
|
2880
|
+
existing.middlewares = [...existing.middlewares || [], middleware];
|
|
2881
|
+
controllerMetadataStore.set(target, existing);
|
|
2882
|
+
}
|
|
2883
|
+
},
|
|
2884
|
+
getRoutes(target) {
|
|
2885
|
+
return methodMetadataStore.get(target);
|
|
2886
|
+
},
|
|
2887
|
+
setController(target, meta) {
|
|
2888
|
+
controllerMetadataStore.set(target, meta);
|
|
2889
|
+
},
|
|
2890
|
+
getController(target) {
|
|
2891
|
+
return controllerMetadataStore.get(target);
|
|
2892
|
+
},
|
|
2893
|
+
defineModule(target, meta) {
|
|
2894
|
+
moduleMetadataStore.set(target, meta);
|
|
2895
|
+
},
|
|
2896
|
+
getModule(target) {
|
|
2897
|
+
return moduleMetadataStore.get(target);
|
|
2898
|
+
},
|
|
2899
|
+
addInjection(target, index, token) {
|
|
2900
|
+
let injections = injectionMetadataStore.get(target);
|
|
2901
|
+
if (!injections) {
|
|
2902
|
+
injections = new Map;
|
|
2903
|
+
injectionMetadataStore.set(target, injections);
|
|
2904
|
+
}
|
|
2905
|
+
injections.set(index, token);
|
|
2906
|
+
},
|
|
2907
|
+
getInjections(target) {
|
|
2908
|
+
return injectionMetadataStore.get(target);
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
}
|
|
2912
|
+
var MetadataStorage = globalStore.KANJI_METADATA_STORAGE;
|
|
2909
2913
|
function createMethodDecorator(method) {
|
|
2910
2914
|
return (path = "/") => {
|
|
2911
2915
|
return (target, propertyKey) => {
|
|
@@ -3290,8 +3294,11 @@ class KanjijsAdapter {
|
|
|
3290
3294
|
return [];
|
|
3291
3295
|
visited.add(moduleClass);
|
|
3292
3296
|
const meta = MetadataStorage.getModule(moduleClass);
|
|
3293
|
-
if (!meta)
|
|
3297
|
+
if (!meta) {
|
|
3298
|
+
console.error(`[Kanjijs] No metadata found for module: ${moduleClass.name}. Did you forget @Module()?`);
|
|
3294
3299
|
return [];
|
|
3300
|
+
}
|
|
3301
|
+
console.log(`[Kanjijs] Found module metadata for: ${moduleClass.name}. Controllers: ${meta.controllers?.length}`);
|
|
3295
3302
|
const controllers = [...meta.controllers || []];
|
|
3296
3303
|
const imports = [...meta.imports || [], ...target.imports || []];
|
|
3297
3304
|
for (const imp of imports) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanjijs/platform-hono",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
"build": "bun build src/index.ts --outdir dist --target bun"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@kanjijs/common": "
|
|
17
|
-
"@kanjijs/
|
|
18
|
-
"@kanjijs/contracts": "workspace:*",
|
|
16
|
+
"@kanjijs/common": "^0.2.0-beta.10",
|
|
17
|
+
"@kanjijs/contracts": "^0.2.0-beta.10",
|
|
19
18
|
"hono": "^4.0.0",
|
|
20
19
|
"reflect-metadata": "^0.2.0"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@kanjijs/core": "^0.2.0-beta.10"
|
|
21
23
|
}
|
|
22
24
|
}
|