@mahameru/diatrema 0.0.4 → 0.0.5

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.
@@ -18,7 +18,6 @@ declare abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOp
18
18
  get initialized(): boolean;
19
19
  get options(): O;
20
20
  get generator(): Generator<BaseGeneratorOptions> | undefined;
21
- set outputTypesDirPath(outputTypesDirPath: string);
22
21
  setDiatrema(diatrema: Diatrema): void;
23
22
  initialize(): Promise<void>;
24
23
  destroy(): Promise<void>;
@@ -18,7 +18,6 @@ declare abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOp
18
18
  get initialized(): boolean;
19
19
  get options(): O;
20
20
  get generator(): Generator<BaseGeneratorOptions> | undefined;
21
- set outputTypesDirPath(outputTypesDirPath: string);
22
21
  setDiatrema(diatrema: Diatrema): void;
23
22
  initialize(): Promise<void>;
24
23
  destroy(): Promise<void>;
package/diatrema.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import _default from './diatrema-Fd7aehcd.cjs';
1
+ import _default from './diatrema-Cqq3LX4H.cjs';
2
2
  import './event-emitter.cjs';
3
3
  import './types.cjs';
4
4
  // @ts-ignore
5
5
  export = _default;
6
- export { b as DiatremaEvents, c as DiatremaOptions, d as diatremaDefaultConfig } from './diatrema-Fd7aehcd.cjs';
6
+ export { b as DiatremaEvents, c as DiatremaOptions, d as diatremaDefaultConfig } from './diatrema-Cqq3LX4H.cjs';
7
7
  import './logger.cjs';
package/diatrema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import './event-emitter.js';
2
2
  import './types.js';
3
- export { b as DiatremaEvents, c as DiatremaOptions, D as default, d as diatremaDefaultConfig } from './diatrema-DBO4yaCD.js';
3
+ export { b as DiatremaEvents, c as DiatremaOptions, D as default, d as diatremaDefaultConfig } from './diatrema-ChH40C-x.js';
4
4
  import './logger.js';
package/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as Diatrema } from './diatrema-Fd7aehcd.cjs';
2
- export { B as BaseGeneratorOptions, a as BasePluginOptions, b as DiatremaEvents, c as DiatremaOptions, G as Generator, M as MahameruPlugin, d as diatremaDefaultConfig } from './diatrema-Fd7aehcd.cjs';
1
+ import { D as Diatrema } from './diatrema-Cqq3LX4H.cjs';
2
+ export { B as BaseGeneratorOptions, a as BasePluginOptions, b as DiatremaEvents, c as DiatremaOptions, G as Generator, M as MahameruPlugin, d as diatremaDefaultConfig } from './diatrema-Cqq3LX4H.cjs';
3
3
  export { EventEmitter } from './event-emitter.cjs';
4
4
  export { Logger, createLogger } from './logger.cjs';
5
5
  export { MahameruError } from './mahameru-error.cjs';
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as Diatrema } from './diatrema-DBO4yaCD.js';
2
- export { B as BaseGeneratorOptions, a as BasePluginOptions, b as DiatremaEvents, c as DiatremaOptions, G as Generator, M as MahameruPlugin, d as diatremaDefaultConfig } from './diatrema-DBO4yaCD.js';
1
+ import { D as Diatrema } from './diatrema-ChH40C-x.js';
2
+ export { B as BaseGeneratorOptions, a as BasePluginOptions, b as DiatremaEvents, c as DiatremaOptions, G as Generator, M as MahameruPlugin, d as diatremaDefaultConfig } from './diatrema-ChH40C-x.js';
3
3
  export { EventEmitter } from './event-emitter.js';
4
4
  export { Logger, createLogger } from './logger.js';
5
5
  export { MahameruError } from './mahameru-error.js';
@@ -46,10 +46,6 @@ class MahameruPlugin {
46
46
  get generator() {
47
47
  return this._generator;
48
48
  }
49
- set outputTypesDirPath(outputTypesDirPath) {
50
- if (this._generator)
51
- this._generator.outputTypesDirPath = outputTypesDirPath;
52
- }
53
49
  setDiatrema(diatrema) {
54
50
  this.diatrema = diatrema;
55
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/mahameru-plugin.ts"],"sourcesContent":["import type Diatrema from \"./diatrema\";\r\nimport { type Logger } from \"./logger\";\r\n\r\nexport interface BasePluginOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOptions> {\r\n public abstract readonly name: string;\r\n public abstract readonly slugName: string;\r\n protected logger!: Logger;\r\n protected diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _initialized = false;\r\n protected _isShuttingDown = false;\r\n protected _generator?: Generator;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n get initialized() {\r\n return this._initialized;\r\n }\r\n\r\n get options(): O {\r\n return this._options;\r\n }\r\n\r\n get generator() {\r\n return this._generator;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n if (this._generator)\r\n this._generator.outputTypesDirPath = outputTypesDirPath;\r\n }\r\n\r\n public setDiatrema(diatrema: Diatrema) {\r\n this.diatrema = diatrema;\r\n }\r\n\r\n public async initialize(): Promise<void> {\r\n if (!this.diatrema) {\r\n this.logger.debug('Failed to initialize. No Diatrema instance found');\r\n\r\n return;\r\n }\r\n\r\n this.logger.debug('Initializing...');\r\n\r\n if (this._initialized) {\r\n this.logger.debug('Already initialized');\r\n\r\n return;\r\n }\r\n\r\n await this.boot();\r\n\r\n this.logger.debug('Initializing... Done');\r\n\r\n this._initialized = true;\r\n }\r\n\r\n public async destroy(): Promise<void> {\r\n if (!this._initialized || this._isShuttingDown)\r\n return;\r\n\r\n this.logger.debug('Destroying...');\r\n\r\n this._isShuttingDown = true;\r\n\r\n await this.terminate();\r\n\r\n this._initialized = false;\r\n this._isShuttingDown = false;\r\n\r\n this.logger.debug('Destroying... Done');\r\n }\r\n\r\n protected abstract boot(options?: Partial<O>): Promise<void> | void;\r\n protected abstract terminate(): Promise<void> | void;\r\n}\r\n\r\nexport interface BaseGeneratorOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class Generator<O extends BaseGeneratorOptions = BaseGeneratorOptions> {\r\n protected logger!: Logger;\r\n protected _diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _sourceDirPath!: string;\r\n protected _outputTypesDirPath!: string;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n set diatrema(diatrema: Diatrema) {\r\n this._diatrema = diatrema;\r\n }\r\n\r\n set sourceDirPath(sourceDirPath: string) {\r\n this._sourceDirPath = sourceDirPath;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n this._outputTypesDirPath = outputTypesDirPath;\r\n }\r\n\r\n public async generate() {\r\n this.logger.debug('Generating types...');\r\n const types = await this._generate();\r\n this.logger.debug('Types generated', types);\r\n }\r\n\r\n protected abstract _generate(): Promise<Record<string, any>>;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA4B;AAMrB,MAAe,eAAgE;AAAA,EAPtF,OAOsF;AAAA;AAAA;AAAA,EAGxE;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB;AAAA,EAEV,YAAY,SAAqB;AAC7B,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,IAAI,cAAc;AACd,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,UAAa;AACb,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,YAAY;AACZ,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,mBAAmB,oBAA4B;AAC/C,QAAI,KAAK;AACL,WAAK,WAAW,qBAAqB;AAAA,EAC7C;AAAA,EAEO,YAAY,UAAoB;AACnC,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,MAAa,aAA4B;AACrC,QAAI,CAAC,KAAK,UAAU;AAChB,WAAK,OAAO,MAAM,kDAAkD;AAEpE;AAAA,IACJ;AAEA,SAAK,OAAO,MAAM,iBAAiB;AAEnC,QAAI,KAAK,cAAc;AACnB,WAAK,OAAO,MAAM,qBAAqB;AAEvC;AAAA,IACJ;AAEA,UAAM,KAAK,KAAK;AAEhB,SAAK,OAAO,MAAM,sBAAsB;AAExC,SAAK,eAAe;AAAA,EACxB;AAAA,EAEA,MAAa,UAAyB;AAClC,QAAI,CAAC,KAAK,gBAAgB,KAAK;AAC3B;AAEJ,SAAK,OAAO,MAAM,eAAe;AAEjC,SAAK,kBAAkB;AAEvB,UAAM,KAAK,UAAU;AAErB,SAAK,eAAe;AACpB,SAAK,kBAAkB;AAEvB,SAAK,OAAO,MAAM,oBAAoB;AAAA,EAC1C;AAIJ;AAMO,MAAe,UAAiE;AAAA,EAxFvF,OAwFuF;AAAA;AAAA;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEV,YAAY,SAAqB;AAC7B,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,IAAI,SAAS,UAAoB;AAC7B,SAAK,YAAY;AAAA,EACrB;AAAA,EAEA,IAAI,cAAc,eAAuB;AACrC,SAAK,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,mBAAmB,oBAA4B;AAC/C,SAAK,sBAAsB;AAAA,EAC/B;AAAA,EAEA,MAAa,WAAW;AACpB,SAAK,OAAO,MAAM,qBAAqB;AACvC,UAAM,QAAQ,MAAM,KAAK,UAAU;AACnC,SAAK,OAAO,MAAM,mBAAmB,KAAK;AAAA,EAC9C;AAGJ;","names":[]}
1
+ {"version":3,"sources":["../src/mahameru-plugin.ts"],"sourcesContent":["import type Diatrema from \"./diatrema\";\r\nimport { type Logger } from \"./logger\";\r\n\r\nexport interface BasePluginOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOptions> {\r\n public abstract readonly name: string;\r\n public abstract readonly slugName: string;\r\n protected logger!: Logger;\r\n protected diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _initialized = false;\r\n protected _isShuttingDown = false;\r\n protected _generator?: Generator;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n get initialized() {\r\n return this._initialized;\r\n }\r\n\r\n get options(): O {\r\n return this._options;\r\n }\r\n\r\n get generator() {\r\n return this._generator;\r\n }\r\n\r\n public setDiatrema(diatrema: Diatrema) {\r\n this.diatrema = diatrema;\r\n }\r\n\r\n public async initialize(): Promise<void> {\r\n if (!this.diatrema) {\r\n this.logger.debug('Failed to initialize. No Diatrema instance found');\r\n\r\n return;\r\n }\r\n\r\n this.logger.debug('Initializing...');\r\n\r\n if (this._initialized) {\r\n this.logger.debug('Already initialized');\r\n\r\n return;\r\n }\r\n\r\n await this.boot();\r\n\r\n this.logger.debug('Initializing... Done');\r\n\r\n this._initialized = true;\r\n }\r\n\r\n public async destroy(): Promise<void> {\r\n if (!this._initialized || this._isShuttingDown)\r\n return;\r\n\r\n this.logger.debug('Destroying...');\r\n\r\n this._isShuttingDown = true;\r\n\r\n await this.terminate();\r\n\r\n this._initialized = false;\r\n this._isShuttingDown = false;\r\n\r\n this.logger.debug('Destroying... Done');\r\n }\r\n\r\n protected abstract boot(options?: Partial<O>): Promise<void> | void;\r\n protected abstract terminate(): Promise<void> | void;\r\n}\r\n\r\nexport interface BaseGeneratorOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class Generator<O extends BaseGeneratorOptions = BaseGeneratorOptions> {\r\n protected logger!: Logger;\r\n protected _diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _sourceDirPath!: string;\r\n protected _outputTypesDirPath!: string;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n set diatrema(diatrema: Diatrema) {\r\n this._diatrema = diatrema;\r\n }\r\n\r\n set sourceDirPath(sourceDirPath: string) {\r\n this._sourceDirPath = sourceDirPath;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n this._outputTypesDirPath = outputTypesDirPath;\r\n }\r\n\r\n public async generate() {\r\n this.logger.debug('Generating types...');\r\n const types = await this._generate();\r\n this.logger.debug('Types generated', types);\r\n }\r\n\r\n protected abstract _generate(): Promise<Record<string, any>>;\r\n}\r\n"],"m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B,SAAK,YAAY;AAAA,EACrB;AAAA,EAEA,IAAI,cAAc,eAAuB;AACrC,SAAK,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,mBAAmB,oBAA4B;AAC/C,SAAK,sBAAsB;AAAA,EAC/B;AAAA,EAEA,MAAa,WAAW;AACpB,SAAK,OAAO,MAAM,qBAAqB;AACvC,UAAM,QAAQ,MAAM,KAAK,UAAU;AACnC,SAAK,OAAO,MAAM,mBAAmB,KAAK;AAAA,EAC9C;AAGJ;","names":[]}
@@ -1,4 +1,4 @@
1
- export { B as BaseGeneratorOptions, a as BasePluginOptions, G as Generator, M as MahameruPlugin } from './diatrema-Fd7aehcd.cjs';
1
+ export { B as BaseGeneratorOptions, a as BasePluginOptions, G as Generator, M as MahameruPlugin } from './diatrema-Cqq3LX4H.cjs';
2
2
  import './logger.cjs';
3
3
  import './event-emitter.cjs';
4
4
  import './types.cjs';
@@ -1,4 +1,4 @@
1
- export { B as BaseGeneratorOptions, a as BasePluginOptions, G as Generator, M as MahameruPlugin } from './diatrema-DBO4yaCD.js';
1
+ export { B as BaseGeneratorOptions, a as BasePluginOptions, G as Generator, M as MahameruPlugin } from './diatrema-ChH40C-x.js';
2
2
  import './logger.js';
3
3
  import './event-emitter.js';
4
4
  import './types.js';
@@ -23,10 +23,6 @@ class MahameruPlugin {
23
23
  get generator() {
24
24
  return this._generator;
25
25
  }
26
- set outputTypesDirPath(outputTypesDirPath) {
27
- if (this._generator)
28
- this._generator.outputTypesDirPath = outputTypesDirPath;
29
- }
30
26
  setDiatrema(diatrema) {
31
27
  this.diatrema = diatrema;
32
28
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/mahameru-plugin.ts"],"sourcesContent":["import type Diatrema from \"./diatrema\";\r\nimport { type Logger } from \"./logger\";\r\n\r\nexport interface BasePluginOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOptions> {\r\n public abstract readonly name: string;\r\n public abstract readonly slugName: string;\r\n protected logger!: Logger;\r\n protected diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _initialized = false;\r\n protected _isShuttingDown = false;\r\n protected _generator?: Generator;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n get initialized() {\r\n return this._initialized;\r\n }\r\n\r\n get options(): O {\r\n return this._options;\r\n }\r\n\r\n get generator() {\r\n return this._generator;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n if (this._generator)\r\n this._generator.outputTypesDirPath = outputTypesDirPath;\r\n }\r\n\r\n public setDiatrema(diatrema: Diatrema) {\r\n this.diatrema = diatrema;\r\n }\r\n\r\n public async initialize(): Promise<void> {\r\n if (!this.diatrema) {\r\n this.logger.debug('Failed to initialize. No Diatrema instance found');\r\n\r\n return;\r\n }\r\n\r\n this.logger.debug('Initializing...');\r\n\r\n if (this._initialized) {\r\n this.logger.debug('Already initialized');\r\n\r\n return;\r\n }\r\n\r\n await this.boot();\r\n\r\n this.logger.debug('Initializing... Done');\r\n\r\n this._initialized = true;\r\n }\r\n\r\n public async destroy(): Promise<void> {\r\n if (!this._initialized || this._isShuttingDown)\r\n return;\r\n\r\n this.logger.debug('Destroying...');\r\n\r\n this._isShuttingDown = true;\r\n\r\n await this.terminate();\r\n\r\n this._initialized = false;\r\n this._isShuttingDown = false;\r\n\r\n this.logger.debug('Destroying... Done');\r\n }\r\n\r\n protected abstract boot(options?: Partial<O>): Promise<void> | void;\r\n protected abstract terminate(): Promise<void> | void;\r\n}\r\n\r\nexport interface BaseGeneratorOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class Generator<O extends BaseGeneratorOptions = BaseGeneratorOptions> {\r\n protected logger!: Logger;\r\n protected _diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _sourceDirPath!: string;\r\n protected _outputTypesDirPath!: string;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n set diatrema(diatrema: Diatrema) {\r\n this._diatrema = diatrema;\r\n }\r\n\r\n set sourceDirPath(sourceDirPath: string) {\r\n this._sourceDirPath = sourceDirPath;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n this._outputTypesDirPath = outputTypesDirPath;\r\n }\r\n\r\n public async generate() {\r\n this.logger.debug('Generating types...');\r\n const types = await this._generate();\r\n this.logger.debug('Types generated', types);\r\n }\r\n\r\n protected abstract _generate(): Promise<Record<string, any>>;\r\n}\r\n"],"mappings":";;AACA,eAA4B;AAMrB,MAAe,eAAgE;AAAA,EAPtF,OAOsF;AAAA;AAAA;AAAA,EAGxE;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB;AAAA,EAEV,YAAY,SAAqB;AAC7B,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,IAAI,cAAc;AACd,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,UAAa;AACb,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,YAAY;AACZ,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,mBAAmB,oBAA4B;AAC/C,QAAI,KAAK;AACL,WAAK,WAAW,qBAAqB;AAAA,EAC7C;AAAA,EAEO,YAAY,UAAoB;AACnC,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,MAAa,aAA4B;AACrC,QAAI,CAAC,KAAK,UAAU;AAChB,WAAK,OAAO,MAAM,kDAAkD;AAEpE;AAAA,IACJ;AAEA,SAAK,OAAO,MAAM,iBAAiB;AAEnC,QAAI,KAAK,cAAc;AACnB,WAAK,OAAO,MAAM,qBAAqB;AAEvC;AAAA,IACJ;AAEA,UAAM,KAAK,KAAK;AAEhB,SAAK,OAAO,MAAM,sBAAsB;AAExC,SAAK,eAAe;AAAA,EACxB;AAAA,EAEA,MAAa,UAAyB;AAClC,QAAI,CAAC,KAAK,gBAAgB,KAAK;AAC3B;AAEJ,SAAK,OAAO,MAAM,eAAe;AAEjC,SAAK,kBAAkB;AAEvB,UAAM,KAAK,UAAU;AAErB,SAAK,eAAe;AACpB,SAAK,kBAAkB;AAEvB,SAAK,OAAO,MAAM,oBAAoB;AAAA,EAC1C;AAIJ;AAMO,MAAe,UAAiE;AAAA,EAxFvF,OAwFuF;AAAA;AAAA;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEV,YAAY,SAAqB;AAC7B,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,IAAI,SAAS,UAAoB;AAC7B,SAAK,YAAY;AAAA,EACrB;AAAA,EAEA,IAAI,cAAc,eAAuB;AACrC,SAAK,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,mBAAmB,oBAA4B;AAC/C,SAAK,sBAAsB;AAAA,EAC/B;AAAA,EAEA,MAAa,WAAW;AACpB,SAAK,OAAO,MAAM,qBAAqB;AACvC,UAAM,QAAQ,MAAM,KAAK,UAAU;AACnC,SAAK,OAAO,MAAM,mBAAmB,KAAK;AAAA,EAC9C;AAGJ;","names":[]}
1
+ {"version":3,"sources":["../src/mahameru-plugin.ts"],"sourcesContent":["import type Diatrema from \"./diatrema\";\r\nimport { type Logger } from \"./logger\";\r\n\r\nexport interface BasePluginOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOptions> {\r\n public abstract readonly name: string;\r\n public abstract readonly slugName: string;\r\n protected logger!: Logger;\r\n protected diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _initialized = false;\r\n protected _isShuttingDown = false;\r\n protected _generator?: Generator;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n get initialized() {\r\n return this._initialized;\r\n }\r\n\r\n get options(): O {\r\n return this._options;\r\n }\r\n\r\n get generator() {\r\n return this._generator;\r\n }\r\n\r\n public setDiatrema(diatrema: Diatrema) {\r\n this.diatrema = diatrema;\r\n }\r\n\r\n public async initialize(): Promise<void> {\r\n if (!this.diatrema) {\r\n this.logger.debug('Failed to initialize. No Diatrema instance found');\r\n\r\n return;\r\n }\r\n\r\n this.logger.debug('Initializing...');\r\n\r\n if (this._initialized) {\r\n this.logger.debug('Already initialized');\r\n\r\n return;\r\n }\r\n\r\n await this.boot();\r\n\r\n this.logger.debug('Initializing... Done');\r\n\r\n this._initialized = true;\r\n }\r\n\r\n public async destroy(): Promise<void> {\r\n if (!this._initialized || this._isShuttingDown)\r\n return;\r\n\r\n this.logger.debug('Destroying...');\r\n\r\n this._isShuttingDown = true;\r\n\r\n await this.terminate();\r\n\r\n this._initialized = false;\r\n this._isShuttingDown = false;\r\n\r\n this.logger.debug('Destroying... Done');\r\n }\r\n\r\n protected abstract boot(options?: Partial<O>): Promise<void> | void;\r\n protected abstract terminate(): Promise<void> | void;\r\n}\r\n\r\nexport interface BaseGeneratorOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class Generator<O extends BaseGeneratorOptions = BaseGeneratorOptions> {\r\n protected logger!: Logger;\r\n protected _diatrema!: Diatrema;\r\n protected _options: O;\r\n protected _sourceDirPath!: string;\r\n protected _outputTypesDirPath!: string;\r\n\r\n constructor(options: Partial<O>) {\r\n this._options = options as O;\r\n }\r\n\r\n set diatrema(diatrema: Diatrema) {\r\n this._diatrema = diatrema;\r\n }\r\n\r\n set sourceDirPath(sourceDirPath: string) {\r\n this._sourceDirPath = sourceDirPath;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n this._outputTypesDirPath = outputTypesDirPath;\r\n }\r\n\r\n public async generate() {\r\n this.logger.debug('Generating types...');\r\n const types = await this._generate();\r\n this.logger.debug('Types generated', types);\r\n }\r\n\r\n protected abstract _generate(): Promise<Record<string, any>>;\r\n}\r\n"],"mappings":";;AACA,eAA4B;AAMrB,MAAe,eAAgE;AAAA,EAPtF,OAOsF;AAAA;AAAA;AAAA,EAGxE;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,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SAAK,OAAO,MAAM,qBAAqB;AACvC,UAAM,QAAQ,MAAM,KAAK,UAAU;AACnC,SAAK,OAAO,MAAM,mBAAmB,KAAK;AAAA,EAC9C;AAGJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mahameru/diatrema",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "The core engine of MahameruJS. Just like a volcanic diatreme, it serves as the essential conduit that powers and drives the entire framework ecosystem.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",