@kanjijs/cli 0.2.0-beta.12 → 0.2.0-beta.14

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.
@@ -0,0 +1,4 @@
1
+ import { Command as CommanderCommand } from "commander";
2
+ export declare abstract class Command {
3
+ abstract load(program: CommanderCommand): void;
4
+ }
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ import { Command as BaseCommand } from "./base";
3
+ export declare class ClientCommand extends BaseCommand {
4
+ load(program: Command): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ import { Command as BaseCommand } from "./base";
3
+ export declare class DevCommand extends BaseCommand {
4
+ load(program: Command): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ import { Command as BaseCommand } from "./base";
3
+ export declare class GenerateCommand extends BaseCommand {
4
+ load(program: Command): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ import { Command as BaseCommand } from "./base";
3
+ export declare class NewCommand extends BaseCommand {
4
+ load(program: Command): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ import { Command as BaseCommand } from "./base";
3
+ export declare class OpenApiCommand extends BaseCommand {
4
+ load(program: Command): void;
5
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
package/dist/index.js CHANGED
@@ -4108,7 +4108,7 @@ class ModuleCompiler {
4108
4108
  const paramTypes = Reflect.getMetadata("design:paramtypes", clazz) || [];
4109
4109
  const injectionTokens = MetadataStorage.getInjections(clazz) || new Map;
4110
4110
  dependencies = paramTypes.map((t, i) => injectionTokens.get(i) || t);
4111
- } else if ("useFactory" in provider && provider.useFactory) {
4111
+ } else if ("useFactory" in provider) {
4112
4112
  targetName = provider.provide?.name || String(provider.provide);
4113
4113
  dependencies = provider.inject || [];
4114
4114
  }
@@ -5595,7 +5595,7 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __t
5595
5595
  enumerable: true
5596
5596
  });
5597
5597
  return to;
5598
- }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), require_Reflect, import_reflect_metadata, methodMetadataStore, controllerMetadataStore, moduleMetadataStore, injectionMetadataStore, MetadataStorage, Get, Post, Put, Delete, Patch, import_reflect_metadata2, KanjijsIoC, kanjijsContext, GLOBAL_MIDDLEWARE_TOKEN, ignoreOverride, defaultOptions, getDefaultOptions = (options) => typeof options === "string" ? {
5598
+ }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), require_Reflect, import_reflect_metadata, methodMetadataStore, controllerMetadataStore, moduleMetadataStore, injectionMetadataStore, globalStore, MetadataStorage, Get, Post, Put, Delete, Patch, import_reflect_metadata2, KanjijsIoC, kanjijsContext, GLOBAL_MIDDLEWARE_TOKEN, ignoreOverride, defaultOptions, getDefaultOptions = (options) => typeof options === "string" ? {
5599
5599
  ...defaultOptions,
5600
5600
  name: options
5601
5601
  } : {
@@ -7064,69 +7064,73 @@ var init_dist = __esm(() => {
7064
7064
  controllerMetadataStore = new WeakMap;
7065
7065
  moduleMetadataStore = new WeakMap;
7066
7066
  injectionMetadataStore = new WeakMap;
7067
- MetadataStorage = {
7068
- addRoute(target, methodName, meta) {
7069
- let methods = methodMetadataStore.get(target);
7070
- if (!methods) {
7071
- methods = new Map;
7072
- methodMetadataStore.set(target, methods);
7073
- }
7074
- const existing = methods.get(methodName) || {};
7075
- methods.set(methodName, { ...existing, ...meta });
7076
- },
7077
- addContract(target, methodName, contract) {
7078
- let methods = methodMetadataStore.get(target);
7079
- if (!methods) {
7080
- methods = new Map;
7081
- methodMetadataStore.set(target, methods);
7082
- }
7083
- const existing = methods.get(methodName) || {};
7084
- existing.contract = contract;
7085
- methods.set(methodName, existing);
7086
- },
7087
- addMiddleware(target, middleware, methodName) {
7088
- if (methodName) {
7067
+ globalStore = globalThis;
7068
+ if (!globalStore.KANJI_METADATA_STORAGE) {
7069
+ globalStore.KANJI_METADATA_STORAGE = {
7070
+ addRoute(target, methodName, meta) {
7071
+ let methods = methodMetadataStore.get(target);
7072
+ if (!methods) {
7073
+ methods = new Map;
7074
+ methodMetadataStore.set(target, methods);
7075
+ }
7076
+ const existing = methods.get(methodName) || {};
7077
+ methods.set(methodName, { ...existing, ...meta });
7078
+ },
7079
+ addContract(target, methodName, contract) {
7089
7080
  let methods = methodMetadataStore.get(target);
7090
7081
  if (!methods) {
7091
7082
  methods = new Map;
7092
7083
  methodMetadataStore.set(target, methods);
7093
7084
  }
7094
7085
  const existing = methods.get(methodName) || {};
7095
- existing.middlewares = [...existing.middlewares || [], middleware];
7086
+ existing.contract = contract;
7096
7087
  methods.set(methodName, existing);
7097
- } else {
7098
- const existing = controllerMetadataStore.get(target) || { prefix: "/" };
7099
- existing.middlewares = [...existing.middlewares || [], middleware];
7100
- controllerMetadataStore.set(target, existing);
7101
- }
7102
- },
7103
- getRoutes(target) {
7104
- return methodMetadataStore.get(target);
7105
- },
7106
- setController(target, meta) {
7107
- controllerMetadataStore.set(target, meta);
7108
- },
7109
- getController(target) {
7110
- return controllerMetadataStore.get(target);
7111
- },
7112
- defineModule(target, meta) {
7113
- moduleMetadataStore.set(target, meta);
7114
- },
7115
- getModule(target) {
7116
- return moduleMetadataStore.get(target);
7117
- },
7118
- addInjection(target, index, token) {
7119
- let injections = injectionMetadataStore.get(target);
7120
- if (!injections) {
7121
- injections = new Map;
7122
- injectionMetadataStore.set(target, injections);
7088
+ },
7089
+ addMiddleware(target, middleware, methodName) {
7090
+ if (methodName) {
7091
+ let methods = methodMetadataStore.get(target);
7092
+ if (!methods) {
7093
+ methods = new Map;
7094
+ methodMetadataStore.set(target, methods);
7095
+ }
7096
+ const existing = methods.get(methodName) || {};
7097
+ existing.middlewares = [...existing.middlewares || [], middleware];
7098
+ methods.set(methodName, existing);
7099
+ } else {
7100
+ const existing = controllerMetadataStore.get(target) || { prefix: "/" };
7101
+ existing.middlewares = [...existing.middlewares || [], middleware];
7102
+ controllerMetadataStore.set(target, existing);
7103
+ }
7104
+ },
7105
+ getRoutes(target) {
7106
+ return methodMetadataStore.get(target);
7107
+ },
7108
+ setController(target, meta) {
7109
+ controllerMetadataStore.set(target, meta);
7110
+ },
7111
+ getController(target) {
7112
+ return controllerMetadataStore.get(target);
7113
+ },
7114
+ defineModule(target, meta) {
7115
+ moduleMetadataStore.set(target, meta);
7116
+ },
7117
+ getModule(target) {
7118
+ return moduleMetadataStore.get(target);
7119
+ },
7120
+ addInjection(target, index, token) {
7121
+ let injections = injectionMetadataStore.get(target);
7122
+ if (!injections) {
7123
+ injections = new Map;
7124
+ injectionMetadataStore.set(target, injections);
7125
+ }
7126
+ injections.set(index, token);
7127
+ },
7128
+ getInjections(target) {
7129
+ return injectionMetadataStore.get(target);
7123
7130
  }
7124
- injections.set(index, token);
7125
- },
7126
- getInjections(target) {
7127
- return injectionMetadataStore.get(target);
7128
- }
7129
- };
7131
+ };
7132
+ }
7133
+ MetadataStorage = globalStore.KANJI_METADATA_STORAGE;
7130
7134
  Get = createMethodDecorator("GET");
7131
7135
  Post = createMethodDecorator("POST");
7132
7136
  Put = createMethodDecorator("PUT");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanjijs/cli",
3
- "version": "0.2.0-beta.12",
3
+ "version": "0.2.0-beta.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "kanji": "./dist/index.js"
@@ -12,8 +12,8 @@
12
12
  "templates"
13
13
  ],
14
14
  "scripts": {
15
- "build": "bun build src/index.ts --outdir dist --target bun",
16
- "watch": "bun build src/index.ts --outdir dist --target bun --watch"
15
+ "build": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
16
+ "watch": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist --watch"
17
17
  },
18
18
  "dependencies": {
19
19
  "@inquirer/prompts": "^8.2.0",
@@ -21,7 +21,7 @@
21
21
  "fs-extra": "^11.3.3",
22
22
  "picocolors": "^1.1.1",
23
23
  "openapi-typescript-codegen": "^0.25.0",
24
- "@kanjijs/openapi": "^0.2.0-beta.12"
24
+ "@kanjijs/openapi": "^0.2.0-beta.14"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/fs-extra": "^11.0.4"
@@ -7,12 +7,12 @@
7
7
  "start": "bun run src/main.ts"
8
8
  },
9
9
  "dependencies": {
10
- "@kanjijs/core": "^0.2.0-beta.12",
11
- "@kanjijs/platform-bun": "^0.2.0-beta.12",
12
- "@kanjijs/platform-hono": "^0.2.0-beta.12",
13
- "@kanjijs/auth": "^0.2.0-beta.12",
14
- "@kanjijs/logger": "^0.2.0-beta.12",
15
- "@kanjijs/throttler": "^0.2.0-beta.12",
10
+ "@kanjijs/core": "^0.2.0-beta.14",
11
+ "@kanjijs/platform-bun": "^0.2.0-beta.14",
12
+ "@kanjijs/platform-hono": "^0.2.0-beta.14",
13
+ "@kanjijs/auth": "^0.2.0-beta.14",
14
+ "@kanjijs/logger": "^0.2.0-beta.14",
15
+ "@kanjijs/throttler": "^0.2.0-beta.14",
16
16
  "hono": "^4.0.0",
17
17
  "reflect-metadata": "^0.2.0",
18
18
  "zod": "^3.0.0"