definition-generator-framework 1.13.0 → 2.0.0-rc0
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.mts +198 -0
- package/dist/index.d.ts +198 -17
- package/dist/index.js +43 -50
- package/dist/index.mjs +43 -0
- package/package.json +33 -22
- package/dist/_mocks/mocks.d.ts +0 -7
- package/dist/_mocks/mocks.js +0 -44
- package/dist/decorators/definition-component.d.ts +0 -18
- package/dist/decorators/definition-component.js +0 -52
- package/dist/decorators/definition-generator.d.ts +0 -11
- package/dist/decorators/definition-generator.js +0 -30
- package/dist/framework/context.d.ts +0 -24
- package/dist/framework/context.js +0 -64
- package/dist/framework/definition-component.d.ts +0 -20
- package/dist/framework/definition-component.js +0 -29
- package/dist/framework/definition-generator.d.ts +0 -11
- package/dist/framework/definition-generator.js +0 -22
- package/dist/framework/definition-store.d.ts +0 -25
- package/dist/framework/definition-store.js +0 -121
- package/dist/framework/file-content-generator/file-content-generator.d.ts +0 -19
- package/dist/framework/file-content-generator/file-content-generator.js +0 -117
- package/dist/framework/file-content-generator/file-content-generator.test.d.ts +0 -24
- package/dist/framework/file-content-generator/file-content-generator.test.js +0 -161
- package/dist/framework/file-generators/index-file-generator.d.ts +0 -13
- package/dist/framework/file-generators/index-file-generator.js +0 -139
- package/dist/framework/file-generators/types-file-generator.d.ts +0 -6
- package/dist/framework/file-generators/types-file-generator.js +0 -35
- package/dist/framework/framework.d.ts +0 -28
- package/dist/framework/framework.data.d.ts +0 -6
- package/dist/framework/framework.data.js +0 -17
- package/dist/framework/framework.js +0 -51
- package/dist/framework/framework.model.d.ts +0 -32
- package/dist/framework/framework.model.js +0 -3
- package/dist/framework/index-file-generator/index-file-generator.d.ts +0 -10
- package/dist/framework/index-file-generator/index-file-generator.js +0 -118
- package/dist/framework/interfaces.d.ts +0 -46
- package/dist/framework/interfaces.js +0 -3
- package/dist/framework/kernel.d.ts +0 -12
- package/dist/framework/kernel.js +0 -308
- package/dist/helpers/common-functions/common-functions.d.ts +0 -10
- package/dist/helpers/common-functions/common-functions.js +0 -29
- package/dist/helpers/common-functions/common-functions.spec.d.ts +0 -1
- package/dist/helpers/common-functions/common-functions.spec.js +0 -50
- package/dist/helpers/common-functions/common-functions.test.d.ts +0 -1
- package/dist/helpers/common-functions/common-functions.test.js +0 -51
- package/dist/helpers/duplicate-helper/duplicate-helper.d.ts +0 -11
- package/dist/helpers/duplicate-helper/duplicate-helper.js +0 -40
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.d.ts +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +0 -54
- package/dist/helpers/duplicate-helper/duplicate-helper.test.d.ts +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.test.js +0 -55
- package/dist/helpers/output-helper/output-helper.d.ts +0 -30
- package/dist/helpers/output-helper/output-helper.js +0 -143
- package/dist/helpers/output-helper/output-helper.spec.d.ts +0 -24
- package/dist/helpers/output-helper/output-helper.spec.js +0 -261
- package/dist/helpers/output-helper/output-helper.test.d.ts +0 -24
- package/dist/helpers/output-helper/output-helper.test.js +0 -262
- package/dist/helpers/raw-definition-helper/raw-definition.helper.d.ts +0 -7
- package/dist/helpers/raw-definition-helper/raw-definition.helper.js +0 -66
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.d.ts +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +0 -143
- package/dist/helpers/raw-definition-helper/raw-definition.helper.test.d.ts +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.test.js +0 -136
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.d.ts +0 -16
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.js +0 -48
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +0 -191
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.d.ts +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.js +0 -213
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.d.ts +0 -13
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.js +0 -53
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.d.ts +0 -1
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.js +0 -96
- package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +0 -14
- package/dist/helpers/validator/custom-validators/image.custom-validator.js +0 -44
- package/dist/helpers/validator/custom-validators/path.custom-validator.d.ts +0 -9
- package/dist/helpers/validator/custom-validators/path.custom-validator.js +0 -30
- package/dist/helpers/validator/custom-validators/position-on-sprite.d.ts +0 -14
- package/dist/helpers/validator/custom-validators/position-on-sprite.js +0 -44
- package/dist/helpers/validator/custom-validators/reference.custom-validator.d.ts +0 -22
- package/dist/helpers/validator/custom-validators/reference.custom-validator.js +0 -123
- package/dist/helpers/validator/custom-validators/sprite.custom-validator.d.ts +0 -14
- package/dist/helpers/validator/custom-validators/sprite.custom-validator.js +0 -43
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +0 -9
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +0 -33
- package/dist/helpers/validator/custom-validators/unique.custom-validator.d.ts +0 -8
- package/dist/helpers/validator/custom-validators/unique.custom-validator.js +0 -20
- package/dist/helpers/validator/joi-custom-validators.d.ts +0 -33
- package/dist/helpers/validator/joi-custom-validators.js +0 -54
- package/dist/helpers/validator/joi-custom-validators.spec.d.ts +0 -1
- package/dist/helpers/validator/joi-custom-validators.spec.js +0 -304
- package/dist/helpers/validator/validator.d.ts +0 -21
- package/dist/helpers/validator/validator.js +0 -74
- package/dist/helpers/validator/validator.spec.d.ts +0 -1
- package/dist/helpers/validator/validator.spec.js +0 -332
- package/dist/helpers/validator/validator.test.d.ts +0 -1
- package/dist/helpers/validator/validator.test.js +0 -329
- package/dist/pipeline/1-select-definitions-helper.d.ts +0 -20
- package/dist/pipeline/1-select-definitions-helper.js +0 -76
- package/dist/pipeline/1-select-definitions.helper.d.ts +0 -20
- package/dist/pipeline/1-select-definitions.helper.js +0 -80
- package/dist/pipeline/1-select-definitions.helper.test.d.ts +0 -1
- package/dist/pipeline/1-select-definitions.helper.test.js +0 -141
- package/dist/pipeline/1-select-definitions.spec.d.ts +0 -1
- package/dist/pipeline/1-select-definitions.spec.js +0 -140
- package/dist/pipeline/2-structure-parser.helper.d.ts +0 -11
- package/dist/pipeline/2-structure-parser.helper.js +0 -70
- package/dist/pipeline/2-structure-parser.helper.spec.d.ts +0 -1
- package/dist/pipeline/2-structure-parser.helper.spec.js +0 -280
- package/dist/pipeline/2-structure-parser.helper.test.d.ts +0 -1
- package/dist/pipeline/2-structure-parser.helper.test.js +0 -281
- package/dist/pipeline/3-config.d.ts +0 -9
- package/dist/pipeline/3-config.js +0 -36
- package/dist/pipeline/_mocks/index.d.ts +0 -13
- package/dist/pipeline/_mocks/index.js +0 -52
- package/dist/pipeline/parsers/array-parser.d.ts +0 -4
- package/dist/pipeline/parsers/array-parser.js +0 -69
- package/dist/pipeline/parsers/array-parser.spec.d.ts +0 -1
- package/dist/pipeline/parsers/array-parser.spec.js +0 -128
- package/dist/pipeline/parsers/array-parser.test.d.ts +0 -1
- package/dist/pipeline/parsers/array-parser.test.js +0 -126
- package/dist/pipeline/parsers/object-parser.d.ts +0 -4
- package/dist/pipeline/parsers/object-parser.js +0 -135
- package/dist/pipeline/parsers/object-parser.spec.d.ts +0 -1
- package/dist/pipeline/parsers/object-parser.spec.js +0 -179
- package/dist/pipeline/parsers/object-parser.test.d.ts +0 -1
- package/dist/pipeline/parsers/object-parser.test.js +0 -186
- package/dist/pipeline/parsers/primitive-parser.d.ts +0 -7
- package/dist/pipeline/parsers/primitive-parser.js +0 -111
- package/dist/pipeline/parsers/primitive-parser.spec.d.ts +0 -1
- package/dist/pipeline/parsers/primitive-parser.spec.js +0 -79
- package/dist/pipeline/parsers/primitive-parser.test.d.ts +0 -1
- package/dist/pipeline/parsers/primitive-parser.test.js +0 -85
- package/dist/pipeline/raw-data-parser.d.ts +0 -5
- package/dist/pipeline/raw-data-parser.js +0 -25
- package/dist/pre-made-components/_validators/shape-validators.d.ts +0 -7
- package/dist/pre-made-components/_validators/shape-validators.js +0 -37
- package/dist/pre-made-components/_validators/sprite-validators.d.ts +0 -7
- package/dist/pre-made-components/_validators/sprite-validators.js +0 -43
- package/dist/pre-made-components/assets/1-sprite.d.ts +0 -15
- package/dist/pre-made-components/assets/1-sprite.js +0 -74
- package/dist/pre-made-components/assets/2-sprite-group.d.ts +0 -11
- package/dist/pre-made-components/assets/2-sprite-group.js +0 -41
- package/dist/pre-made-components/assets/3-font.d.ts +0 -17
- package/dist/pre-made-components/assets/3-font.js +0 -71
- package/dist/pre-made-components/events/1-event.d.ts +0 -6
- package/dist/pre-made-components/events/1-event.js +0 -206
- package/dist/pre-made-components/events/1-script.d.ts +0 -8
- package/dist/pre-made-components/events/1-script.js +0 -102
- package/dist/pre-made-components/events/2-event-test.d.ts +0 -18
- package/dist/pre-made-components/events/2-event-test.js +0 -172
- package/dist/pre-made-components/events/2-script-test.d.ts +0 -7
- package/dist/pre-made-components/events/2-script-test.js +0 -102
- package/dist/pre-made-components/events/3-event.d.ts +0 -7
- package/dist/pre-made-components/events/3-event.js +0 -100
- package/dist/pre-made-components/events/4-event-test.d.ts +0 -7
- package/dist/pre-made-components/events/4-event-test.js +0 -89
- package/dist/pre-made-components/events/event-setup.d.ts +0 -13
- package/dist/pre-made-components/events/event-setup.js +0 -20
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.d.ts +0 -3
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.js +0 -24
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.d.ts +0 -1
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.js +0 -39
- package/dist/pre-made-components/events/helpers/script-testing.helper.d.ts +0 -33
- package/dist/pre-made-components/events/helpers/script-testing.helper.js +0 -79
- package/dist/pre-made-components/events/script-setup.d.ts +0 -8
- package/dist/pre-made-components/events/script-setup.js +0 -16
- package/dist/pre-made-components/events/scripting-setup.d.ts +0 -33
- package/dist/pre-made-components/events/scripting-setup.js +0 -97
- package/dist/pre-made-components/events/validators.d.ts +0 -6
- package/dist/pre-made-components/events/validators.js +0 -96
- package/dist/setup.d.ts +0 -1
- package/dist/setup.js +0 -10
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.FrameworkData = void 0;
|
|
4
|
-
const _3_config_1 = require('../pipeline/3-config');
|
|
5
|
-
class FrameworkData {
|
|
6
|
-
static {
|
|
7
|
-
this.definitionNames = new Set([_3_config_1.ConfigDefinitionName]);
|
|
8
|
-
}
|
|
9
|
-
static {
|
|
10
|
-
this.modules = [];
|
|
11
|
-
}
|
|
12
|
-
static {
|
|
13
|
-
this.interfaces = '';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.FrameworkData = FrameworkData;
|
|
17
|
-
//# sourceMappingURL=framework.data.js.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.DefinitionModule =
|
|
4
|
-
exports.DefinitionModuleDecorator =
|
|
5
|
-
exports.SingleDefinitionComponent =
|
|
6
|
-
exports.DefinitionComponent =
|
|
7
|
-
exports.DefinitionComponentDecorator =
|
|
8
|
-
void 0;
|
|
9
|
-
const kernel_1 = require('./kernel');
|
|
10
|
-
const definition_store_1 = require('./definition-store');
|
|
11
|
-
function DefinitionComponentDecorator(meta) {
|
|
12
|
-
return function (ComponentClass) {
|
|
13
|
-
definition_store_1.FrameworkData.definitionNames.add(meta.definitionName);
|
|
14
|
-
ComponentClass.$meta = {
|
|
15
|
-
definitionName: meta.definitionName,
|
|
16
|
-
keyName: meta.keyName,
|
|
17
|
-
singleton: meta.singleton,
|
|
18
|
-
validationSchema: meta.validationSchema
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
exports.DefinitionComponentDecorator = DefinitionComponentDecorator;
|
|
23
|
-
class DefinitionComponent {
|
|
24
|
-
static getSchema() {
|
|
25
|
-
return this.$meta.validationSchema;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.DefinitionComponent = DefinitionComponent;
|
|
29
|
-
class SingleDefinitionComponent {
|
|
30
|
-
static getSchema() {
|
|
31
|
-
return this.$meta.validationSchema;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.SingleDefinitionComponent = SingleDefinitionComponent;
|
|
35
|
-
let ModuleIsRegistered = false;
|
|
36
|
-
function DefinitionModuleDecorator(meta) {
|
|
37
|
-
return function (ModuleClass) {
|
|
38
|
-
if (ModuleIsRegistered) {
|
|
39
|
-
console.error('There can be only one definition module!');
|
|
40
|
-
} else {
|
|
41
|
-
ModuleIsRegistered = true;
|
|
42
|
-
definition_store_1.FrameworkData.modules.push(...meta.modules);
|
|
43
|
-
definition_store_1.FrameworkData.interfaces = meta.interfaces;
|
|
44
|
-
kernel_1.Kernel.process();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
exports.DefinitionModuleDecorator = DefinitionModuleDecorator;
|
|
49
|
-
class DefinitionModule {}
|
|
50
|
-
exports.DefinitionModule = DefinitionModule;
|
|
51
|
-
//# sourceMappingURL=framework.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface FileSystem {
|
|
2
|
-
existsSync: (path: string) => boolean;
|
|
3
|
-
}
|
|
4
|
-
export interface FileInfo {
|
|
5
|
-
path: string;
|
|
6
|
-
content: string;
|
|
7
|
-
}
|
|
8
|
-
export interface LocationInFile {
|
|
9
|
-
readonly path: string;
|
|
10
|
-
readonly line: number;
|
|
11
|
-
}
|
|
12
|
-
export interface ErrorLog {
|
|
13
|
-
readonly description: string;
|
|
14
|
-
readonly location: LocationInFile;
|
|
15
|
-
}
|
|
16
|
-
export interface Config {
|
|
17
|
-
projectRoot: string;
|
|
18
|
-
}
|
|
19
|
-
export type RawData = undefined | string | ParsedStructure[] | Record<string, ParsedStructure>;
|
|
20
|
-
export interface ParsedStructure {
|
|
21
|
-
readonly rawData: RawData;
|
|
22
|
-
readonly line: number;
|
|
23
|
-
}
|
|
24
|
-
export interface RawDefinition {
|
|
25
|
-
readonly componentName: string;
|
|
26
|
-
readonly parsedStructure: ParsedStructure;
|
|
27
|
-
readonly location: LocationInFile;
|
|
28
|
-
}
|
|
29
|
-
export interface Output {
|
|
30
|
-
addFile: (fileInfo: FileInfo) => void;
|
|
31
|
-
addError: (errorLog: ErrorLog) => void;
|
|
32
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class IndexFileGenerator {
|
|
2
|
-
private static premadeInterfaces;
|
|
3
|
-
static addPremadeInterface(value: string): void;
|
|
4
|
-
static generateIndexFile(pretext: string, outputIndexFile: string): void;
|
|
5
|
-
private static generateIndexFileBuildMode;
|
|
6
|
-
private static generateIndexFileDevMode;
|
|
7
|
-
private static generateExportsContent;
|
|
8
|
-
private static generateInterfacesContent;
|
|
9
|
-
private static getInterfacesFromFile;
|
|
10
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.IndexFileGenerator = void 0;
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const glob = __importStar(require("glob"));
|
|
29
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
30
|
-
const context_1 = require("../context");
|
|
31
|
-
const START_COMMAND = '// ---- INDEX OUTPUT ----';
|
|
32
|
-
const END_COMMAND = '// ---- END ----';
|
|
33
|
-
class IndexFileGenerator {
|
|
34
|
-
static { this.premadeInterfaces = []; }
|
|
35
|
-
static addPremadeInterface(value) {
|
|
36
|
-
this.premadeInterfaces.push(value);
|
|
37
|
-
}
|
|
38
|
-
static generateIndexFile(pretext, outputIndexFile) {
|
|
39
|
-
if (context_1.Context.config.compilerModulesPath) {
|
|
40
|
-
this.generateIndexFileDevMode(pretext);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.generateIndexFileBuildMode(outputIndexFile);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
static generateIndexFileBuildMode(outputIndexFile) {
|
|
47
|
-
context_1.Context.output.push({
|
|
48
|
-
path: '/index.ts',
|
|
49
|
-
content: outputIndexFile
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
static async generateIndexFileDevMode(pretext) {
|
|
53
|
-
let fileUrls = glob.sync(`${context_1.Context.config.compilerModulesPath}/**/*.ts`).map(filePath => filePath.replace(/\\/g, '/'));
|
|
54
|
-
if (fileUrls.length === 0) {
|
|
55
|
-
helpers_lib_1.ConsoleHelper.log(`No typescript file found to generate index.ts file.`, 'red');
|
|
56
|
-
}
|
|
57
|
-
let exportsContent = this.generateExportsContent();
|
|
58
|
-
let interfacesContent = this.generateInterfacesContent(fileUrls);
|
|
59
|
-
if (interfacesContent !== undefined) {
|
|
60
|
-
let output = `${pretext}\n${exportsContent}\n\n${interfacesContent}`;
|
|
61
|
-
context_1.Context.output.push({
|
|
62
|
-
path: '/index.ts',
|
|
63
|
-
content: output
|
|
64
|
-
});
|
|
65
|
-
fs.writeFileSync(`${context_1.Context.compilerExecutionPath}/output-index-file.ts`, `// AUTO GENERATED - CHANGES WILL BE REPLACED\nexport const OutputIndexFile = \`${output}\`;\n`);
|
|
66
|
-
helpers_lib_1.ConsoleHelper.log(`Index content 'output-index-file.ts' is generated.`, 'green');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
static generateExportsContent() {
|
|
70
|
-
return context_1.Context.exports
|
|
71
|
-
.map(exportItem => `export { ${exportItem.variableName} } from '.${exportItem.path.substring(0, exportItem.path.lastIndexOf('.'))}';`)
|
|
72
|
-
.join('\n');
|
|
73
|
-
}
|
|
74
|
-
static generateInterfacesContent(fileUrls) {
|
|
75
|
-
let errorCount = 0;
|
|
76
|
-
let outputs = [];
|
|
77
|
-
fileUrls.forEach(fileUrl => {
|
|
78
|
-
let fileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1, fileUrl.lastIndexOf('.'));
|
|
79
|
-
let fileContent = fs.readFileSync(fileUrl, 'utf-8');
|
|
80
|
-
try {
|
|
81
|
-
let output = this.getInterfacesFromFile(fileName, fileContent);
|
|
82
|
-
if (output) {
|
|
83
|
-
outputs.push(output);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
errorCount++;
|
|
88
|
-
helpers_lib_1.ConsoleHelper.log(`Error parsing file: ${fileUrl}, error: '${error.message}'`, 'red');
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
let output = `//-------------------------- DEFINITIONS --------------------------\n`;
|
|
92
|
-
if (this.premadeInterfaces.length > 0) {
|
|
93
|
-
output += '// ---- premade ----';
|
|
94
|
-
output += this.premadeInterfaces.join('\n');
|
|
95
|
-
output += '\n\n';
|
|
96
|
-
}
|
|
97
|
-
output += outputs.join('\n');
|
|
98
|
-
return errorCount === 0 ? output : undefined;
|
|
99
|
-
}
|
|
100
|
-
static getInterfacesFromFile(fileName, fileContent) {
|
|
101
|
-
let index = fileContent.indexOf(START_COMMAND);
|
|
102
|
-
let definitionsFound = index !== -1;
|
|
103
|
-
let contents = [];
|
|
104
|
-
while (index !== -1) {
|
|
105
|
-
let endIndex = fileContent.indexOf(END_COMMAND, index);
|
|
106
|
-
if (endIndex === -1) {
|
|
107
|
-
throw new Error(`No end command found.`);
|
|
108
|
-
}
|
|
109
|
-
contents.push(fileContent.substring(fileContent.indexOf('\n', index + START_COMMAND.length) + 1, endIndex));
|
|
110
|
-
index = fileContent.indexOf(START_COMMAND, endIndex);
|
|
111
|
-
}
|
|
112
|
-
if (definitionsFound) {
|
|
113
|
-
return `// ---- ${fileName} ----\n${contents.join('\n')}`;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.IndexFileGenerator = IndexFileGenerator;
|
|
118
|
-
//# sourceMappingURL=index-file-generator.js.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export interface FileSystem {
|
|
2
|
-
existsSync: (path: string) => boolean;
|
|
3
|
-
}
|
|
4
|
-
export interface FileInfo {
|
|
5
|
-
path: string;
|
|
6
|
-
content: string;
|
|
7
|
-
}
|
|
8
|
-
export interface AddFileOptions {
|
|
9
|
-
path: string;
|
|
10
|
-
variableName: string;
|
|
11
|
-
variable: any;
|
|
12
|
-
preText?: string | string[];
|
|
13
|
-
variableType?: string;
|
|
14
|
-
replaceMap?: {
|
|
15
|
-
target: string;
|
|
16
|
-
replace: string;
|
|
17
|
-
}[];
|
|
18
|
-
assetUrl?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface LocationInFile {
|
|
21
|
-
readonly path: string;
|
|
22
|
-
readonly line: number;
|
|
23
|
-
}
|
|
24
|
-
export interface ErrorLog {
|
|
25
|
-
readonly description: string;
|
|
26
|
-
readonly location: LocationInFile;
|
|
27
|
-
}
|
|
28
|
-
export interface Config {
|
|
29
|
-
projectRoot: string;
|
|
30
|
-
compilerModulesPath: string;
|
|
31
|
-
}
|
|
32
|
-
export type RawData = undefined | string | ParsedStructure[] | Record<string, ParsedStructure>;
|
|
33
|
-
export interface ParsedStructure {
|
|
34
|
-
readonly rawData: RawData;
|
|
35
|
-
readonly line: number;
|
|
36
|
-
}
|
|
37
|
-
export interface RawDefinition {
|
|
38
|
-
readonly componentName: string;
|
|
39
|
-
readonly parsedStructure: ParsedStructure;
|
|
40
|
-
readonly location: LocationInFile;
|
|
41
|
-
}
|
|
42
|
-
export interface Output {
|
|
43
|
-
addFile: (request: AddFileOptions) => Promise<void>;
|
|
44
|
-
addError: (errorLog: ErrorLog) => void;
|
|
45
|
-
convertLocationInFileToLink: (location: LocationInFile) => string;
|
|
46
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DefinitionComponentClassType } from '../decorators/definition-component';
|
|
2
|
-
export declare class Kernel {
|
|
3
|
-
static process(components: DefinitionComponentClassType<any>[], indexFilePretext: string, outputIndexFile: string): Promise<void>;
|
|
4
|
-
private static readFiles;
|
|
5
|
-
private static writeFiles;
|
|
6
|
-
private static cleanPath;
|
|
7
|
-
private static removeEmptyFolders;
|
|
8
|
-
private static generateOutputFiles;
|
|
9
|
-
private static iterateOnKeyNames;
|
|
10
|
-
private static registerDefinitions;
|
|
11
|
-
private static getOutputFiles;
|
|
12
|
-
}
|
package/dist/framework/kernel.js
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Kernel = void 0;
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const glob = __importStar(require("glob"));
|
|
29
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
const custom_validator_helper_1 = require("../helpers/validator/custom-validator-helper/custom-validator.helper");
|
|
32
|
-
const validator_1 = require("../helpers/validator/validator");
|
|
33
|
-
const _3_config_1 = require("../pipeline/3-config");
|
|
34
|
-
const raw_data_parser_1 = require("../pipeline/raw-data-parser");
|
|
35
|
-
const context_1 = require("./context");
|
|
36
|
-
const definition_store_1 = require("./definition-store");
|
|
37
|
-
const index_file_generator_1 = require("./file-generators/index-file-generator");
|
|
38
|
-
const KeyValueRegex = /^[a-z]+([a-zA-Z0-9]+)*$/;
|
|
39
|
-
const HeavySeperator = '======================================================';
|
|
40
|
-
const LightSeperator = '------------------------------------------------------';
|
|
41
|
-
const LocationFileToLink = (location) => location.path.replace(context_1.Context.compilerExecutionPath + '/', '') + ':' + location.line;
|
|
42
|
-
class Kernel {
|
|
43
|
-
static async process(components, indexFilePretext, outputIndexFile) {
|
|
44
|
-
let componentNameToComponentMap = new Map();
|
|
45
|
-
componentNameToComponentMap.set(_3_config_1.ConfigDefinitionComponentName, _3_config_1.Config);
|
|
46
|
-
components.forEach(component => {
|
|
47
|
-
let componentName = component.$meta.componentName;
|
|
48
|
-
if (componentNameToComponentMap.has(componentName)) {
|
|
49
|
-
throw new Error(`Component name "${componentName}" is used more than once.`);
|
|
50
|
-
}
|
|
51
|
-
componentNameToComponentMap.set(componentName, component);
|
|
52
|
-
});
|
|
53
|
-
definition_store_1.DefinitionStore['setComponents'](componentNameToComponentMap);
|
|
54
|
-
helpers_lib_1.ConsoleHelper.log('Compilation is in progress.', 'white');
|
|
55
|
-
this.readFiles();
|
|
56
|
-
let outputFiles = await this.generateOutputFiles(components, indexFilePretext, outputIndexFile);
|
|
57
|
-
this.writeFiles(outputFiles, context_1.Context.outputPath);
|
|
58
|
-
}
|
|
59
|
-
static readFiles() {
|
|
60
|
-
context_1.Context.compilerExecutionPath = path.resolve('./').replace(/\\/g, '/');
|
|
61
|
-
context_1.Context.outputPath = `${context_1.Context.compilerExecutionPath}/.asset-build`;
|
|
62
|
-
context_1.Context.files = glob
|
|
63
|
-
.sync(`${context_1.Context.compilerExecutionPath}/**/*.md`)
|
|
64
|
-
.map(filePath => filePath.replace(/\\/g, '/'))
|
|
65
|
-
.map(filePath => {
|
|
66
|
-
let content = fs.readFileSync(filePath).toString();
|
|
67
|
-
let fileInfo = { path: filePath, content };
|
|
68
|
-
return fileInfo;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
static writeFiles(outputFiles, outputPath) {
|
|
72
|
-
let filesInOutputFolder = new Set();
|
|
73
|
-
glob
|
|
74
|
-
.sync(`${context_1.Context.outputPath}/**/*`, { nodir: true })
|
|
75
|
-
.map(filePath => filePath.replace(/\\/g, '/'))
|
|
76
|
-
.forEach(filePath => {
|
|
77
|
-
filesInOutputFolder.add(filePath);
|
|
78
|
-
});
|
|
79
|
-
outputFiles.forEach(outputFile => {
|
|
80
|
-
outputFile.path = outputPath + outputFile.path;
|
|
81
|
-
filesInOutputFolder.delete(outputFile.path);
|
|
82
|
-
});
|
|
83
|
-
if (context_1.Context.successful) {
|
|
84
|
-
helpers_lib_1.ConsoleHelper.log(HeavySeperator, 'gray');
|
|
85
|
-
helpers_lib_1.ConsoleHelper.log(`Changes:`, 'gray');
|
|
86
|
-
helpers_lib_1.ConsoleHelper.newLine();
|
|
87
|
-
}
|
|
88
|
-
let erasedFileCount = 0;
|
|
89
|
-
if (context_1.Context.successful) {
|
|
90
|
-
filesInOutputFolder.forEach(filePath => {
|
|
91
|
-
erasedFileCount++;
|
|
92
|
-
console.info(`${helpers_lib_1.ConsoleHelper.red}Erasing file:${helpers_lib_1.ConsoleHelper.gray} "${this.cleanPath(filePath)}"${helpers_lib_1.ConsoleHelper.default}`);
|
|
93
|
-
fs.unlinkSync(filePath);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
let modifiedFileCount = 0;
|
|
97
|
-
let createdFileCount = 0;
|
|
98
|
-
outputFiles.forEach(outputFile => {
|
|
99
|
-
let folderPath = outputFile.path.substring(0, outputFile.path.lastIndexOf('/'));
|
|
100
|
-
fs.mkdirSync(folderPath, { recursive: true });
|
|
101
|
-
let exists = fs.existsSync(outputFile.path);
|
|
102
|
-
let content = exists ? fs.readFileSync(outputFile.path).toString() : '';
|
|
103
|
-
if (content !== outputFile.content) {
|
|
104
|
-
if (exists) {
|
|
105
|
-
modifiedFileCount++;
|
|
106
|
-
console.info(`${helpers_lib_1.ConsoleHelper.blue}Modifying file:${helpers_lib_1.ConsoleHelper.gray} "${this.cleanPath(outputFile.path)}"${helpers_lib_1.ConsoleHelper.default}`);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
createdFileCount++;
|
|
110
|
-
console.info(`${helpers_lib_1.ConsoleHelper.cyan}Creating file:${helpers_lib_1.ConsoleHelper.gray} "${this.cleanPath(outputFile.path)}"${helpers_lib_1.ConsoleHelper.default}`);
|
|
111
|
-
}
|
|
112
|
-
fs.writeFileSync(outputFile.path, outputFile.content);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
this.removeEmptyFolders(outputPath);
|
|
116
|
-
if (createdFileCount + modifiedFileCount + erasedFileCount > 0) {
|
|
117
|
-
helpers_lib_1.ConsoleHelper.newLine();
|
|
118
|
-
}
|
|
119
|
-
helpers_lib_1.ConsoleHelper.log(`Created file count: ${createdFileCount}`, 'gray');
|
|
120
|
-
helpers_lib_1.ConsoleHelper.log(`Modified file count: ${modifiedFileCount}`, 'gray');
|
|
121
|
-
helpers_lib_1.ConsoleHelper.log(`Erased file count: ${erasedFileCount}`, 'gray');
|
|
122
|
-
helpers_lib_1.ConsoleHelper.log(HeavySeperator, 'gray');
|
|
123
|
-
if (context_1.Context.successful) {
|
|
124
|
-
helpers_lib_1.ConsoleHelper.log(`Compilation is completed successfuly!`, 'green');
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
helpers_lib_1.ConsoleHelper.log(`Compilation encountered errors!`, 'red');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
static cleanPath(path) {
|
|
131
|
-
let startPathsFrom = context_1.Context.compilerExecutionPath.length;
|
|
132
|
-
return path.substring(startPathsFrom); // .replace(/\//g, '\\');
|
|
133
|
-
}
|
|
134
|
-
static removeEmptyFolders(dir) {
|
|
135
|
-
let files = fs.readdirSync(dir);
|
|
136
|
-
let isEmpty = true;
|
|
137
|
-
for (let file of files) {
|
|
138
|
-
let fullPath = path.join(dir, file);
|
|
139
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
140
|
-
let isSubDirEmpty = this.removeEmptyFolders(fullPath);
|
|
141
|
-
if (isSubDirEmpty) {
|
|
142
|
-
fs.rmdirSync(fullPath);
|
|
143
|
-
console.info(`${helpers_lib_1.ConsoleHelper.red}Erasing folder:${helpers_lib_1.ConsoleHelper.gray} "${fullPath.substring(dir.length).replace(/\\/g, '/')}"${helpers_lib_1.ConsoleHelper.default}`);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
isEmpty = false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
isEmpty = false;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return isEmpty;
|
|
154
|
-
}
|
|
155
|
-
static async generateOutputFiles(modules, indexFilePretext, outputIndexFile) {
|
|
156
|
-
raw_data_parser_1.RawDataParser.process();
|
|
157
|
-
context_1.Context.flushErrorLogs();
|
|
158
|
-
let preparedItems = modules.map(ModuleClass => {
|
|
159
|
-
let meta = ModuleClass.$meta;
|
|
160
|
-
context_1.Context.componentInProgressData = {
|
|
161
|
-
meta,
|
|
162
|
-
idToReferencesMap: new Map()
|
|
163
|
-
};
|
|
164
|
-
let output = {
|
|
165
|
-
addFile: (request) => context_1.Context.addFile(request),
|
|
166
|
-
addError: (errorLog) => context_1.Context.addErrorLog(errorLog),
|
|
167
|
-
convertLocationInFileToLink: (location) => LocationFileToLink(location)
|
|
168
|
-
};
|
|
169
|
-
this.iterateOnKeyNames(meta.keyName, meta.componentName, ModuleClass);
|
|
170
|
-
let definitionToProcess;
|
|
171
|
-
if (meta.singleton) {
|
|
172
|
-
let validatedItem = validator_1.Validator.validateAndConvertSingular(meta.componentName, meta.validationSchema);
|
|
173
|
-
if (validatedItem) {
|
|
174
|
-
definitionToProcess = validatedItem.definition;
|
|
175
|
-
definition_store_1.DefinitionStore['setRawDefinition'](ModuleClass, validatedItem.definition, validatedItem.rawDefinition);
|
|
176
|
-
definition_store_1.DefinitionStore['setSingletonDefinition'](ModuleClass, definitionToProcess);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
let validatedItems = validator_1.Validator.validateAndConvert(meta.componentName, meta.validationSchema);
|
|
181
|
-
// Remove the definitions if there are lazy references that has been invalid
|
|
182
|
-
if (context_1.Context.componentInProgressData.idToReferencesMap.size > 0) {
|
|
183
|
-
let keyName = meta.keyName;
|
|
184
|
-
if (!keyName) {
|
|
185
|
-
throw new Error('Unexpected Error: KeyName should be defined for lazy references.');
|
|
186
|
-
}
|
|
187
|
-
let idToReferencesMap = context_1.Context.componentInProgressData.idToReferencesMap;
|
|
188
|
-
let runTheLoop = true;
|
|
189
|
-
while (runTheLoop) {
|
|
190
|
-
let validatedItemCount = validatedItems.length;
|
|
191
|
-
let validatedItemIds = new Set(validatedItems.map(validatedItem => validatedItem.definition[keyName]));
|
|
192
|
-
validatedItems = validatedItems.filter(validatedItem => {
|
|
193
|
-
let id = validatedItem.definition[keyName];
|
|
194
|
-
if (idToReferencesMap.has(id)) {
|
|
195
|
-
let references = idToReferencesMap.get(id);
|
|
196
|
-
let isValid = true;
|
|
197
|
-
references.forEach(reference => validatedItemIds.has(reference) || (isValid = false));
|
|
198
|
-
return isValid;
|
|
199
|
-
}
|
|
200
|
-
return true;
|
|
201
|
-
});
|
|
202
|
-
runTheLoop = validatedItemCount !== validatedItems.length;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
validatedItems.forEach(item => {
|
|
206
|
-
definition_store_1.DefinitionStore['setRawDefinition'](ModuleClass, item.definition, item.rawDefinition);
|
|
207
|
-
});
|
|
208
|
-
definitionToProcess = validatedItems.map(validatedItem => validatedItem.definition);
|
|
209
|
-
this.registerDefinitions(definitionToProcess, meta.keyName, ModuleClass);
|
|
210
|
-
}
|
|
211
|
-
context_1.Context.flushErrorLogs();
|
|
212
|
-
context_1.Context.componentInProgressData = undefined;
|
|
213
|
-
return {
|
|
214
|
-
definitionToProcess,
|
|
215
|
-
output,
|
|
216
|
-
ModuleClass
|
|
217
|
-
};
|
|
218
|
-
});
|
|
219
|
-
for (let preparedItem of preparedItems) {
|
|
220
|
-
if (preparedItem.definitionToProcess) {
|
|
221
|
-
let module = new preparedItem.ModuleClass();
|
|
222
|
-
let keyName = preparedItem.ModuleClass.$meta.keyName;
|
|
223
|
-
if (keyName) {
|
|
224
|
-
index_file_generator_1.IndexFileGenerator.addIdType(preparedItem.ModuleClass.$meta.pascalCaseComponentName, preparedItem.definitionToProcess.map((definition) => definition[keyName]));
|
|
225
|
-
}
|
|
226
|
-
await module.process(preparedItem.definitionToProcess, preparedItem.output);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
context_1.Context.flushErrorLogs(); // Still there might be some errors that customly added
|
|
230
|
-
custom_validator_helper_1.CustomValidatorHelper.logDuplicates();
|
|
231
|
-
if (context_1.Context.successful) {
|
|
232
|
-
await index_file_generator_1.IndexFileGenerator.generateFile(indexFilePretext, outputIndexFile);
|
|
233
|
-
}
|
|
234
|
-
return this.getOutputFiles();
|
|
235
|
-
}
|
|
236
|
-
static iterateOnKeyNames(keyName, componentName, ModuleClass) {
|
|
237
|
-
let rawDefinitions = validator_1.Validator.getRawDefinitions(componentName);
|
|
238
|
-
if (keyName) {
|
|
239
|
-
rawDefinitions.forEach(rawDefinition => {
|
|
240
|
-
let rootRawData = rawDefinition.parsedStructure.rawData;
|
|
241
|
-
if (!helpers_lib_1.Comparator.isObject(rootRawData) || helpers_lib_1.Comparator.isArray(rootRawData)) {
|
|
242
|
-
context_1.Context.addErrorLog({
|
|
243
|
-
description: `KeyName shold not be used with a content which is not an object, keyName: "${keyName}" in "${componentName}"`,
|
|
244
|
-
location: { line: rawDefinition.parsedStructure.line, path: rawDefinition.location.path }
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
let keyValue = rootRawData[keyName]?.rawData;
|
|
249
|
-
if (!helpers_lib_1.Comparator.isString(keyValue)) {
|
|
250
|
-
// Do nothing, joi validation will log the errors
|
|
251
|
-
}
|
|
252
|
-
else if (KeyValueRegex.test(keyValue) === false) {
|
|
253
|
-
context_1.Context.addErrorLog({
|
|
254
|
-
description: `KeyValue should be a valid key, keyValue: "${keyValue}"`,
|
|
255
|
-
location: { line: rootRawData[keyName].line, path: rawDefinition.location.path }
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
else if (definition_store_1.DefinitionStore['isRawDefinitionExists'](ModuleClass, keyValue)) {
|
|
259
|
-
context_1.Context.addErrorLog({
|
|
260
|
-
description: `Definition with key "${keyValue}" already exists`,
|
|
261
|
-
location: { line: rootRawData[keyName].line, path: rawDefinition.location.path }
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
definition_store_1.DefinitionStore['setRawDefinitionByKey'](ModuleClass, keyValue, rawDefinition);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
static registerDefinitions(definitions, keyName, ModuleClass) {
|
|
272
|
-
if (keyName) {
|
|
273
|
-
definitions.forEach((definition) => {
|
|
274
|
-
let definitionName = definition[keyName];
|
|
275
|
-
definition_store_1.DefinitionStore['setDefinition'](ModuleClass, definitionName, definition);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
static getOutputFiles() {
|
|
280
|
-
if (context_1.Context.successful) {
|
|
281
|
-
return context_1.Context.output;
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
helpers_lib_1.ConsoleHelper.newLine();
|
|
285
|
-
helpers_lib_1.ConsoleHelper.log(`ERROR LOGS:`, 'red');
|
|
286
|
-
helpers_lib_1.ConsoleHelper.log(HeavySeperator, 'gray');
|
|
287
|
-
context_1.Context.errorLogs.forEach((log, index) => {
|
|
288
|
-
if (index > 0) {
|
|
289
|
-
helpers_lib_1.ConsoleHelper.log(LightSeperator, 'gray');
|
|
290
|
-
}
|
|
291
|
-
helpers_lib_1.ConsoleHelper.log(`Error:`, 'red');
|
|
292
|
-
console.info(`${helpers_lib_1.ConsoleHelper.white}Details:${helpers_lib_1.ConsoleHelper.green} ${log.description}`);
|
|
293
|
-
console.info(`${helpers_lib_1.ConsoleHelper.white}Location:${helpers_lib_1.ConsoleHelper.green} ${LocationFileToLink(log.location)}`);
|
|
294
|
-
});
|
|
295
|
-
helpers_lib_1.ConsoleHelper.log(HeavySeperator, 'gray');
|
|
296
|
-
return [
|
|
297
|
-
{
|
|
298
|
-
path: '/error-logs.md',
|
|
299
|
-
content: context_1.Context.errorLogs
|
|
300
|
-
.map(errorLog => `${errorLog.description}\r\nPath: '${errorLog.location.path}', Line: '${errorLog.location.line}'\r\n`)
|
|
301
|
-
.join('\r\n')
|
|
302
|
-
}
|
|
303
|
-
];
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
exports.Kernel = Kernel;
|
|
308
|
-
//# sourceMappingURL=kernel.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare class CommonFunctionsClass {
|
|
2
|
-
decorateDefinitionName(name: string, componentName: string): string;
|
|
3
|
-
kebabCaseToCamelCase(string: string): string;
|
|
4
|
-
lowerCaseFirstLetter(string: string): string;
|
|
5
|
-
upperCaseFirstLetter(string: string): string;
|
|
6
|
-
removeWhiteSpace(row: string): string;
|
|
7
|
-
removeComments(row: string): string;
|
|
8
|
-
}
|
|
9
|
-
export declare const CommonFunctions: CommonFunctionsClass;
|
|
10
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommonFunctions = void 0;
|
|
4
|
-
class CommonFunctionsClass {
|
|
5
|
-
decorateDefinitionName(name, componentName) {
|
|
6
|
-
return `${this.kebabCaseToCamelCase(componentName)}${this.upperCaseFirstLetter(name)}`;
|
|
7
|
-
}
|
|
8
|
-
kebabCaseToCamelCase(string) {
|
|
9
|
-
return string.toLowerCase().replace(/-./g, x => x[1].toUpperCase());
|
|
10
|
-
}
|
|
11
|
-
lowerCaseFirstLetter(string) {
|
|
12
|
-
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
13
|
-
}
|
|
14
|
-
upperCaseFirstLetter(string) {
|
|
15
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
16
|
-
}
|
|
17
|
-
removeWhiteSpace(row) {
|
|
18
|
-
return row
|
|
19
|
-
.replace(/\r?\n|\r/g, '')
|
|
20
|
-
.replace(/\/\/.*$/gm, '')
|
|
21
|
-
.trim()
|
|
22
|
-
.replace(/ {2,}/g, ' ');
|
|
23
|
-
}
|
|
24
|
-
removeComments(row) {
|
|
25
|
-
return row.replace(/\/\/.*$/gm, '').trimEnd();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.CommonFunctions = new CommonFunctionsClass();
|
|
29
|
-
//# sourceMappingURL=common-functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|