@cenk1cenk2/oclif-common 6.0.2 → 6.0.4

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,7 +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>;
191
- injectParser(Parser: ClassType<GenericParser>): Promise<GenericParser>;
189
+ inject<T extends GenericParser>(Parser: ClassType<T>): Promise<T>;
192
190
  setParsers(...parsers: ClassType<GenericParser>[]): void;
193
191
  addParsers(...parsers: ClassType<GenericParser>[]): void;
194
192
  read<T = unknown>(file: string): Promise<T>;
@@ -330,7 +328,7 @@ declare class ValidatorService {
330
328
  private logValidationError;
331
329
  }
332
330
 
333
- declare function setup(): void;
331
+ declare function setup(): Promise<void>;
334
332
 
335
333
  interface CliModuleOptions {
336
334
  config: ConfigModuleOptions;
@@ -345,11 +343,11 @@ declare class CliModule {
345
343
  declare class ShouldRunBeforeHook {
346
344
  shouldRunBefore(): void | Promise<void>;
347
345
  }
348
- declare class ShouldRunAfterHook<Ctx> {
346
+ declare class ShouldRunAfterHook<Ctx extends ListrContext = ListrContext> {
349
347
  shouldRunAfter(ctx: Ctx): void | Promise<void>;
350
348
  }
351
349
  declare class RegisterHook {
352
- register(cli: DynamicModule, options: CliModuleOptions): DynamicModule;
350
+ register(cli: DynamicModule, options: CliModuleOptions): DynamicModule | Promise<DynamicModule>;
353
351
  }
354
352
 
355
353
  type InferFlags<T extends typeof Command$1> = Interfaces.InferredFlags<(typeof Command$1)['baseFlags'] & T['flags']>;
@@ -403,4 +401,4 @@ declare const notFoundHook: Hook<'command_not_found'>;
403
401
 
404
402
  declare const updateNotifierHook: Hook<'init'>;
405
403
 
406
- 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
@@ -1,13 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined")
8
- return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
4
  var __publicField = (obj, key, value) => {
12
5
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
6
  return value;
@@ -791,9 +784,9 @@ var ParserService = (_a9 = class {
791
784
  if (!Parser) {
792
785
  throw new Error(`Parser for the extension is not configured: ${ext}`);
793
786
  }
794
- return this.injectParser(Parser);
787
+ return this.inject(Parser);
795
788
  }
796
- async injectParser(Parser) {
789
+ async inject(Parser) {
797
790
  const parser = await this.moduleRef.create(Parser);
798
791
  return parser;
799
792
  }
@@ -1157,9 +1150,6 @@ ConfigModule = _ts_decorate12([
1157
1150
  })
1158
1151
  ], ConfigModule);
1159
1152
 
1160
- // src/lib/locker/locker.constants.ts
1161
- var INSTANCE_LOCKER_SERVICE = Symbol("INSTANCE_LOCKER_SERVICE");
1162
-
1163
1153
  // src/lib/locker/locker.service.ts
1164
1154
  import { Injectable as Injectable9 } from "@nestjs/common";
1165
1155
  import op2 from "object-path-immutable";
@@ -1348,7 +1338,7 @@ __name(_ts_decorate14, "_ts_decorate");
1348
1338
  var _a14;
1349
1339
  var LockerModule = (_a14 = class {
1350
1340
  static forFeature(options) {
1351
- const token = options.token ?? INSTANCE_LOCKER_SERVICE;
1341
+ const token = options.token ?? LockerService;
1352
1342
  return {
1353
1343
  module: _a14,
1354
1344
  providers: [
@@ -1585,35 +1575,15 @@ ValidatorModule = _ts_decorate18([
1585
1575
  ], ValidatorModule);
1586
1576
 
1587
1577
  // src/lib/setup.ts
1588
- function setup() {
1578
+ async function setup() {
1589
1579
  const inspect = process.argv.indexOf("--inspect");
1590
1580
  if (inspect !== -1) {
1591
- __require("inspector").open();
1581
+ await import("inspector").then((mod) => mod.open());
1592
1582
  process.argv.splice(inspect, 1);
1593
1583
  }
1594
- const verbose = process.argv.indexOf("--verbose");
1595
- if (verbose !== -1) {
1596
- process.env.LOG_LEVEL = "verbose";
1597
- process.argv.splice(verbose, 1);
1598
- }
1599
- const debug = process.argv.indexOf("--debug");
1600
- if (debug !== -1) {
1601
- process.env.LOG_LEVEL = "debug";
1602
- process.argv.splice(debug, 1);
1603
- }
1604
- const trace = process.argv.indexOf("--trace");
1605
- if (trace !== -1) {
1606
- process.env.LOG_LEVEL = "trace";
1607
- process.argv.splice(trace, 1);
1608
- }
1609
- const silent = process.argv.indexOf("--silent");
1610
- if (silent !== -1) {
1611
- process.env.LOG_LEVEL = "silent";
1612
- process.argv.splice(silent, 1);
1613
- }
1614
1584
  const sourceMaps = process.argv.indexOf("--source-map");
1615
1585
  if (sourceMaps !== -1) {
1616
- __require("source-map-support").install();
1586
+ await import("source-map-support").then((mod) => mod.install());
1617
1587
  process.argv.splice(sourceMaps, 1);
1618
1588
  }
1619
1589
  }
@@ -1746,7 +1716,7 @@ var _Command = class _Command extends BaseCommand {
1746
1716
  }
1747
1717
  };
1748
1718
  const cli = CliModule.forRoot(options);
1749
- this.app = await CliModule.create(isHookedWithRegister(this) ? this.register(cli, options) : cli);
1719
+ this.app = await CliModule.create(isHookedWithRegister(this) ? await this.register(cli, options) : cli);
1750
1720
  const cs = this.app.get(ConfigService);
1751
1721
  this.logger = await this.app.resolve(LoggerService);
1752
1722
  this.app.useLogger(this.logger);
@@ -1884,7 +1854,6 @@ export {
1884
1854
  FilesystemModule,
1885
1855
  Flags2 as Flags,
1886
1856
  HelpGroups,
1887
- INSTANCE_LOCKER_SERVICE,
1888
1857
  Inject3 as Inject,
1889
1858
  JsonParser,
1890
1859
  LockerModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "6.0.2",
3
+ "version": "6.0.4",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "type": "module",
@@ -80,6 +80,7 @@
80
80
  "execa": "^8.0.1",
81
81
  "fs-extra": "^11.1.1",
82
82
  "listr2": "^7.0.2",
83
+ "source-map-support": "^0.5.21",
83
84
  "yaml": "^2.3.3"
84
85
  }
85
86
  }