@mahameru/diatrema 0.0.3 → 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.
@@ -13,28 +13,29 @@ declare abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOp
13
13
  protected _options: O;
14
14
  protected _initialized: boolean;
15
15
  protected _isShuttingDown: boolean;
16
- protected _typesGenerator?: TypesGenerator;
16
+ protected _generator?: Generator;
17
17
  constructor(options: Partial<O>);
18
18
  get initialized(): boolean;
19
19
  get options(): O;
20
- get typesGenerator(): TypesGenerator<BaseTypesGeneratorOptions> | undefined;
21
- set outputTypesDirPath(outputTypesDirPath: string);
20
+ get generator(): Generator<BaseGeneratorOptions> | undefined;
22
21
  setDiatrema(diatrema: Diatrema): void;
23
22
  initialize(): Promise<void>;
24
23
  destroy(): Promise<void>;
25
24
  protected abstract boot(options?: Partial<O>): Promise<void> | void;
26
25
  protected abstract terminate(): Promise<void> | void;
27
26
  }
28
- interface BaseTypesGeneratorOptions {
27
+ interface BaseGeneratorOptions {
29
28
  debug?: boolean;
30
29
  }
31
- declare abstract class TypesGenerator<O extends BaseTypesGeneratorOptions = BaseTypesGeneratorOptions> {
30
+ declare abstract class Generator<O extends BaseGeneratorOptions = BaseGeneratorOptions> {
32
31
  protected logger: Logger;
33
32
  protected _diatrema: Diatrema;
34
33
  protected _options: O;
34
+ protected _sourceDirPath: string;
35
35
  protected _outputTypesDirPath: string;
36
36
  constructor(options: Partial<O>);
37
37
  set diatrema(diatrema: Diatrema);
38
+ set sourceDirPath(sourceDirPath: string);
38
39
  set outputTypesDirPath(outputTypesDirPath: string);
39
40
  generate(): Promise<void>;
40
41
  protected abstract _generate(): Promise<Record<string, any>>;
@@ -90,4 +91,4 @@ declare class Diatrema extends EventEmitter<DiatremaEvents> {
90
91
  protected getDefaultExport<T>(module: Record<string, T>, filePath: string): T;
91
92
  }
92
93
 
93
- export { type BasePluginOptions as B, Diatrema as D, MahameruPlugin as M, TypesGenerator as T, type BaseTypesGeneratorOptions as a, type DiatremaEvents as b, type DiatremaOptions as c, diatremaDefaultConfig as d };
94
+ export { type BaseGeneratorOptions as B, Diatrema as D, Generator as G, MahameruPlugin as M, type BasePluginOptions as a, type DiatremaEvents as b, type DiatremaOptions as c, diatremaDefaultConfig as d };
@@ -13,28 +13,29 @@ declare abstract class MahameruPlugin<O extends BasePluginOptions = BasePluginOp
13
13
  protected _options: O;
14
14
  protected _initialized: boolean;
15
15
  protected _isShuttingDown: boolean;
16
- protected _typesGenerator?: TypesGenerator;
16
+ protected _generator?: Generator;
17
17
  constructor(options: Partial<O>);
18
18
  get initialized(): boolean;
19
19
  get options(): O;
20
- get typesGenerator(): TypesGenerator<BaseTypesGeneratorOptions> | undefined;
21
- set outputTypesDirPath(outputTypesDirPath: string);
20
+ get generator(): Generator<BaseGeneratorOptions> | undefined;
22
21
  setDiatrema(diatrema: Diatrema): void;
23
22
  initialize(): Promise<void>;
24
23
  destroy(): Promise<void>;
25
24
  protected abstract boot(options?: Partial<O>): Promise<void> | void;
26
25
  protected abstract terminate(): Promise<void> | void;
27
26
  }
28
- interface BaseTypesGeneratorOptions {
27
+ interface BaseGeneratorOptions {
29
28
  debug?: boolean;
30
29
  }
31
- declare abstract class TypesGenerator<O extends BaseTypesGeneratorOptions = BaseTypesGeneratorOptions> {
30
+ declare abstract class Generator<O extends BaseGeneratorOptions = BaseGeneratorOptions> {
32
31
  protected logger: Logger;
33
32
  protected _diatrema: Diatrema;
34
33
  protected _options: O;
34
+ protected _sourceDirPath: string;
35
35
  protected _outputTypesDirPath: string;
36
36
  constructor(options: Partial<O>);
37
37
  set diatrema(diatrema: Diatrema);
38
+ set sourceDirPath(sourceDirPath: string);
38
39
  set outputTypesDirPath(outputTypesDirPath: string);
39
40
  generate(): Promise<void>;
40
41
  protected abstract _generate(): Promise<Record<string, any>>;
@@ -90,4 +91,4 @@ declare class Diatrema extends EventEmitter<DiatremaEvents> {
90
91
  protected getDefaultExport<T>(module: Record<string, T>, filePath: string): T;
91
92
  }
92
93
 
93
- export { type BasePluginOptions as B, Diatrema as D, MahameruPlugin as M, TypesGenerator as T, type BaseTypesGeneratorOptions as a, type DiatremaEvents as b, type DiatremaOptions as c, diatremaDefaultConfig as d };
94
+ export { type BaseGeneratorOptions as B, Diatrema as D, Generator as G, MahameruPlugin as M, type BasePluginOptions as a, type DiatremaEvents as b, type DiatremaOptions as c, diatremaDefaultConfig as d };
package/diatrema.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import _default from './diatrema-CyKJKZv_.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-CyKJKZv_.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-Bk12jngx.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-CyKJKZv_.cjs';
2
- export { B as BasePluginOptions, a as BaseTypesGeneratorOptions, b as DiatremaEvents, c as DiatremaOptions, M as MahameruPlugin, T as TypesGenerator, d as diatremaDefaultConfig } from './diatrema-CyKJKZv_.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-Bk12jngx.js';
2
- export { B as BasePluginOptions, a as BaseTypesGeneratorOptions, b as DiatremaEvents, c as DiatremaOptions, M as MahameruPlugin, T as TypesGenerator, d as diatremaDefaultConfig } from './diatrema-Bk12jngx.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';
@@ -19,8 +19,8 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var mahameru_plugin_exports = {};
21
21
  __export(mahameru_plugin_exports, {
22
- MahameruPlugin: () => MahameruPlugin,
23
- TypesGenerator: () => TypesGenerator
22
+ Generator: () => Generator,
23
+ MahameruPlugin: () => MahameruPlugin
24
24
  });
25
25
  module.exports = __toCommonJS(mahameru_plugin_exports);
26
26
  var import_logger = require('./logger.cjs');
@@ -33,7 +33,7 @@ class MahameruPlugin {
33
33
  _options;
34
34
  _initialized = false;
35
35
  _isShuttingDown = false;
36
- _typesGenerator;
36
+ _generator;
37
37
  constructor(options) {
38
38
  this._options = options;
39
39
  }
@@ -43,12 +43,8 @@ class MahameruPlugin {
43
43
  get options() {
44
44
  return this._options;
45
45
  }
46
- get typesGenerator() {
47
- return this._typesGenerator;
48
- }
49
- set outputTypesDirPath(outputTypesDirPath) {
50
- if (this.typesGenerator)
51
- this.typesGenerator.outputTypesDirPath = outputTypesDirPath;
46
+ get generator() {
47
+ return this._generator;
52
48
  }
53
49
  setDiatrema(diatrema) {
54
50
  this.diatrema = diatrema;
@@ -78,13 +74,14 @@ class MahameruPlugin {
78
74
  this.logger.debug("Destroying... Done");
79
75
  }
80
76
  }
81
- class TypesGenerator {
77
+ class Generator {
82
78
  static {
83
- __name(this, "TypesGenerator");
79
+ __name(this, "Generator");
84
80
  }
85
81
  logger;
86
82
  _diatrema;
87
83
  _options;
84
+ _sourceDirPath;
88
85
  _outputTypesDirPath;
89
86
  constructor(options) {
90
87
  this._options = options;
@@ -92,6 +89,9 @@ class TypesGenerator {
92
89
  set diatrema(diatrema) {
93
90
  this._diatrema = diatrema;
94
91
  }
92
+ set sourceDirPath(sourceDirPath) {
93
+ this._sourceDirPath = sourceDirPath;
94
+ }
95
95
  set outputTypesDirPath(outputTypesDirPath) {
96
96
  this._outputTypesDirPath = outputTypesDirPath;
97
97
  }
@@ -103,7 +103,7 @@ class TypesGenerator {
103
103
  }
104
104
  // Annotate the CommonJS export names for ESM import in node:
105
105
  0 && (module.exports = {
106
- MahameruPlugin,
107
- TypesGenerator
106
+ Generator,
107
+ MahameruPlugin
108
108
  });
109
109
  //# sourceMappingURL=mahameru-plugin.cjs.map
@@ -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 _typesGenerator?: TypesGenerator;\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 typesGenerator() {\r\n return this._typesGenerator;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n if (this.typesGenerator)\r\n this.typesGenerator.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 BaseTypesGeneratorOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class TypesGenerator<O extends BaseTypesGeneratorOptions = BaseTypesGeneratorOptions> {\r\n protected logger!: Logger;\r\n protected _diatrema!: Diatrema;\r\n protected _options: O;\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 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>>;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,EACA;AAAA,EAEV,YAAY,SAAqB;AAC7B,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,IAAI,SAAS,UAAoB;AAC7B,SAAK,YAAY;AAAA,EACrB;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":";;;;;;;;;;;;;;;;;;;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,EAEO,Y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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 BasePluginOptions, a as BaseTypesGeneratorOptions, M as MahameruPlugin, T as TypesGenerator } from './diatrema-Bk12jngx.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';
@@ -10,7 +10,7 @@ class MahameruPlugin {
10
10
  _options;
11
11
  _initialized = false;
12
12
  _isShuttingDown = false;
13
- _typesGenerator;
13
+ _generator;
14
14
  constructor(options) {
15
15
  this._options = options;
16
16
  }
@@ -20,12 +20,8 @@ class MahameruPlugin {
20
20
  get options() {
21
21
  return this._options;
22
22
  }
23
- get typesGenerator() {
24
- return this._typesGenerator;
25
- }
26
- set outputTypesDirPath(outputTypesDirPath) {
27
- if (this.typesGenerator)
28
- this.typesGenerator.outputTypesDirPath = outputTypesDirPath;
23
+ get generator() {
24
+ return this._generator;
29
25
  }
30
26
  setDiatrema(diatrema) {
31
27
  this.diatrema = diatrema;
@@ -55,13 +51,14 @@ class MahameruPlugin {
55
51
  this.logger.debug("Destroying... Done");
56
52
  }
57
53
  }
58
- class TypesGenerator {
54
+ class Generator {
59
55
  static {
60
- __name(this, "TypesGenerator");
56
+ __name(this, "Generator");
61
57
  }
62
58
  logger;
63
59
  _diatrema;
64
60
  _options;
61
+ _sourceDirPath;
65
62
  _outputTypesDirPath;
66
63
  constructor(options) {
67
64
  this._options = options;
@@ -69,6 +66,9 @@ class TypesGenerator {
69
66
  set diatrema(diatrema) {
70
67
  this._diatrema = diatrema;
71
68
  }
69
+ set sourceDirPath(sourceDirPath) {
70
+ this._sourceDirPath = sourceDirPath;
71
+ }
72
72
  set outputTypesDirPath(outputTypesDirPath) {
73
73
  this._outputTypesDirPath = outputTypesDirPath;
74
74
  }
@@ -79,7 +79,7 @@ class TypesGenerator {
79
79
  }
80
80
  }
81
81
  export {
82
- MahameruPlugin,
83
- TypesGenerator
82
+ Generator,
83
+ MahameruPlugin
84
84
  };
85
85
  //# sourceMappingURL=mahameru-plugin.js.map
@@ -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 _typesGenerator?: TypesGenerator;\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 typesGenerator() {\r\n return this._typesGenerator;\r\n }\r\n\r\n set outputTypesDirPath(outputTypesDirPath: string) {\r\n if (this.typesGenerator)\r\n this.typesGenerator.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 BaseTypesGeneratorOptions {\r\n debug?: boolean;\r\n}\r\n\r\nexport abstract class TypesGenerator<O extends BaseTypesGeneratorOptions = BaseTypesGeneratorOptions> {\r\n protected logger!: Logger;\r\n protected _diatrema!: Diatrema;\r\n protected _options: O;\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 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,iBAAiB;AACjB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,mBAAmB,oBAA4B;AAC/C,QAAI,KAAK;AACL,WAAK,eAAe,qBAAqB;AAAA,EACjD;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,eAAgF;AAAA,EAxFtG,OAwFsG;AAAA;AAAA;AAAA,EACxF;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,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,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,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,EAnFvF,OAmFuF;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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mahameru/diatrema",
3
- "version": "0.0.3",
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",