@cenk1cenk2/oclif-common 6.0.1 → 6.0.2
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 +1 -0
- package/dist/index.js +4 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -188,6 +188,7 @@ declare class ParserService {
|
|
|
188
188
|
parsers: ClassType<GenericParser>[];
|
|
189
189
|
constructor(moduleRef: ModuleRef, fs: FileSystemService, logger: LoggerService);
|
|
190
190
|
getParser(file: string): Promise<GenericParser>;
|
|
191
|
+
injectParser(Parser: ClassType<GenericParser>): Promise<GenericParser>;
|
|
191
192
|
setParsers(...parsers: ClassType<GenericParser>[]): void;
|
|
192
193
|
addParsers(...parsers: ClassType<GenericParser>[]): void;
|
|
193
194
|
read<T = unknown>(file: string): Promise<T>;
|
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((
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cenk1cenk2/oclif-common",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
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": {
|