@cenk1cenk2/oclif-common 6.0.1 → 6.0.3

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.d.ts CHANGED
@@ -34,8 +34,6 @@ interface ConfigModuleOptions {
34
34
  config: GlobalConfig;
35
35
  }
36
36
 
37
- declare const INSTANCE_LOCKER_SERVICE: InjectionToken;
38
-
39
37
  declare class GenericParser {
40
38
  static extensions: string[];
41
39
  parse<T = unknown>(data: string | Buffer): T | Promise<T>;
@@ -188,6 +186,7 @@ declare class ParserService {
188
186
  parsers: ClassType<GenericParser>[];
189
187
  constructor(moduleRef: ModuleRef, fs: FileSystemService, logger: LoggerService);
190
188
  getParser(file: string): Promise<GenericParser>;
189
+ injectParser(Parser: ClassType<GenericParser>): Promise<GenericParser>;
191
190
  setParsers(...parsers: ClassType<GenericParser>[]): void;
192
191
  addParsers(...parsers: ClassType<GenericParser>[]): void;
193
192
  read<T = unknown>(file: string): Promise<T>;
@@ -348,7 +347,7 @@ declare class ShouldRunAfterHook<Ctx> {
348
347
  shouldRunAfter(ctx: Ctx): void | Promise<void>;
349
348
  }
350
349
  declare class RegisterHook {
351
- register(cli: DynamicModule, options: CliModuleOptions): DynamicModule;
350
+ register(cli: DynamicModule, options: CliModuleOptions): DynamicModule | Promise<DynamicModule>;
352
351
  }
353
352
 
354
353
  type InferFlags<T extends typeof Command$1> = Interfaces.InferredFlags<(typeof Command$1)['baseFlags'] & T['flags']>;
@@ -402,4 +401,4 @@ declare const notFoundHook: Hook<'command_not_found'>;
402
401
 
403
402
  declare const updateNotifierHook: Hook<'init'>;
404
403
 
405
- export { ClassType, CliModule, CliModuleOptions, Command, CommonLockerData, ConfigIterator, ConfigModule, ConfigModuleOptions, ConfigService, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, FilesystemModule, GenericParser, GlobalConfig, HelpGroups, INSTANCE_LOCKER_SERVICE, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerModule, LockerService, LockerServiceOptions, LogFieldStatus, LogLevels, LoggerFormat, LoggerModule, LoggerService, LogoGeneratorFn, LogoModule, LogoService, MergeStrategy, ParserModule, ParserService, PipeProcessToLoggerOptions, RegisterHook, SetCtxAssignOptions, SetCtxDefaultsOptions, ShouldRunAfterHook, ShouldRunBeforeHook, TOKEN_LOGO_GENERATOR, TOKEN_VALIDATOR_SERVICE_OPTIONS, UnlockData, ValidatorModule, ValidatorService, ValidatorServiceOptions, Winston, WinstonService, YamlParser, isDebug, isHookedWithRegister, isHookedWithShouldRunAfter, isHookedWithShouldRunBefore, isSilent, isVerbose, merge, notFoundHook, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, uniqueArrayFilter, updateNotifierHook };
404
+ export { ClassType, CliModule, CliModuleOptions, Command, CommonLockerData, ConfigIterator, ConfigModule, ConfigModuleOptions, ConfigService, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, FilesystemModule, GenericParser, GlobalConfig, HelpGroups, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerModule, LockerService, LockerServiceOptions, LogFieldStatus, LogLevels, LoggerFormat, LoggerModule, LoggerService, LogoGeneratorFn, LogoModule, LogoService, MergeStrategy, ParserModule, ParserService, PipeProcessToLoggerOptions, RegisterHook, SetCtxAssignOptions, SetCtxDefaultsOptions, ShouldRunAfterHook, ShouldRunBeforeHook, TOKEN_LOGO_GENERATOR, TOKEN_VALIDATOR_SERVICE_OPTIONS, UnlockData, ValidatorModule, ValidatorService, ValidatorServiceOptions, Winston, WinstonService, YamlParser, isDebug, isHookedWithRegister, isHookedWithShouldRunAfter, isHookedWithShouldRunBefore, isSilent, isVerbose, merge, notFoundHook, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, uniqueArrayFilter, updateNotifierHook };
package/dist/index.js CHANGED
@@ -787,10 +787,13 @@ var ParserService = (_a9 = class {
787
787
  }
788
788
  async getParser(file) {
789
789
  const ext = (file.includes(".") ? this.fs.extname(file) : file).replace(/^\./, "");
790
- const Parser = this.parsers.find((parser2) => parser2.extensions.includes(ext));
790
+ const Parser = this.parsers.find((parser) => parser.extensions.includes(ext));
791
791
  if (!Parser) {
792
792
  throw new Error(`Parser for the extension is not configured: ${ext}`);
793
793
  }
794
+ return this.injectParser(Parser);
795
+ }
796
+ async injectParser(Parser) {
794
797
  const parser = await this.moduleRef.create(Parser);
795
798
  return parser;
796
799
  }
@@ -1154,9 +1157,6 @@ ConfigModule = _ts_decorate12([
1154
1157
  })
1155
1158
  ], ConfigModule);
1156
1159
 
1157
- // src/lib/locker/locker.constants.ts
1158
- var INSTANCE_LOCKER_SERVICE = Symbol("INSTANCE_LOCKER_SERVICE");
1159
-
1160
1160
  // src/lib/locker/locker.service.ts
1161
1161
  import { Injectable as Injectable9 } from "@nestjs/common";
1162
1162
  import op2 from "object-path-immutable";
@@ -1345,7 +1345,7 @@ __name(_ts_decorate14, "_ts_decorate");
1345
1345
  var _a14;
1346
1346
  var LockerModule = (_a14 = class {
1347
1347
  static forFeature(options) {
1348
- const token = options.token ?? INSTANCE_LOCKER_SERVICE;
1348
+ const token = options.token ?? LockerService;
1349
1349
  return {
1350
1350
  module: _a14,
1351
1351
  providers: [
@@ -1743,7 +1743,7 @@ var _Command = class _Command extends BaseCommand {
1743
1743
  }
1744
1744
  };
1745
1745
  const cli = CliModule.forRoot(options);
1746
- this.app = await CliModule.create(isHookedWithRegister(this) ? this.register(cli, options) : cli);
1746
+ this.app = await CliModule.create(isHookedWithRegister(this) ? await this.register(cli, options) : cli);
1747
1747
  const cs = this.app.get(ConfigService);
1748
1748
  this.logger = await this.app.resolve(LoggerService);
1749
1749
  this.app.useLogger(this.logger);
@@ -1881,7 +1881,6 @@ export {
1881
1881
  FilesystemModule,
1882
1882
  Flags2 as Flags,
1883
1883
  HelpGroups,
1884
- INSTANCE_LOCKER_SERVICE,
1885
1884
  Inject3 as Inject,
1886
1885
  JsonParser,
1887
1886
  LockerModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "type": "module",
@@ -55,6 +55,9 @@
55
55
  },
56
56
  "update-notifier": {
57
57
  "optional": true
58
+ },
59
+ "yaml": {
60
+ "optional": true
58
61
  }
59
62
  },
60
63
  "dependencies": {