definition-generator-framework 1.13.1 → 2.0.0-rc1
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 +204 -0
- package/dist/index.d.ts +204 -17
- package/dist/index.js +43 -50
- package/dist/index.mjs +43 -0
- package/package.json +28 -14
- 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,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Const = void 0;
|
|
4
|
-
const vitest_1 = require("vitest");
|
|
5
|
-
const mocks_1 = require("../../_mocks/mocks");
|
|
6
|
-
const context_1 = require("../context");
|
|
7
|
-
const file_content_generator_1 = require("./file-content-generator");
|
|
8
|
-
let complexObject = {
|
|
9
|
-
type: 'bow',
|
|
10
|
-
material: 'WoodenItemMaterial',
|
|
11
|
-
maxQuantity: 10,
|
|
12
|
-
mainHand: undefined,
|
|
13
|
-
offHand: undefined,
|
|
14
|
-
bothHands: {
|
|
15
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
16
|
-
parryDice: undefined,
|
|
17
|
-
attacks: [
|
|
18
|
-
{
|
|
19
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
20
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
21
|
-
range: 'WeaponRange.ranged',
|
|
22
|
-
requiresSetup: false,
|
|
23
|
-
unparryable: true,
|
|
24
|
-
lowersQuantity: true,
|
|
25
|
-
projectileType: 'ProjectileType.arrow',
|
|
26
|
-
sounds: {
|
|
27
|
-
hit: 'AssetGroups.battleSoundArrowHit',
|
|
28
|
-
pre: 'AssetGroups.battleSoundArrowShot'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.Const = {
|
|
35
|
-
type: 'bow',
|
|
36
|
-
material: 'WoodenItemMaterial',
|
|
37
|
-
maxQuantity: 10,
|
|
38
|
-
mainHand: undefined,
|
|
39
|
-
offHand: undefined,
|
|
40
|
-
bothHands: {
|
|
41
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
42
|
-
parryDice: undefined,
|
|
43
|
-
attacks: [
|
|
44
|
-
{
|
|
45
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
46
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
47
|
-
range: 'WeaponRange.ranged',
|
|
48
|
-
requiresSetup: false,
|
|
49
|
-
unparryable: true,
|
|
50
|
-
lowersQuantity: true,
|
|
51
|
-
projectileType: 'ProjectileType.arrow',
|
|
52
|
-
sounds: {
|
|
53
|
-
hit: 'AssetGroups.battleSoundArrowHit',
|
|
54
|
-
pre: 'AssetGroups.battleSoundArrowShot'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
61
|
-
`;
|
|
62
|
-
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
63
|
-
`;
|
|
64
|
-
let complexConstExpected = `export const ConstSample: any = {
|
|
65
|
-
type: 'bow',
|
|
66
|
-
material: 'WoodenItemMaterial',
|
|
67
|
-
maxQuantity: 10,
|
|
68
|
-
mainHand: undefined,
|
|
69
|
-
offHand: undefined,
|
|
70
|
-
bothHands: {
|
|
71
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
72
|
-
parryDice: undefined,
|
|
73
|
-
attacks: [
|
|
74
|
-
{
|
|
75
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
76
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
77
|
-
range: 'WeaponRange.ranged',
|
|
78
|
-
requiresSetup: false,
|
|
79
|
-
unparryable: true,
|
|
80
|
-
lowersQuantity: true,
|
|
81
|
-
projectileType: 'ProjectileType.arrow',
|
|
82
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
`;
|
|
88
|
-
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
89
|
-
type: 'bow',
|
|
90
|
-
material: 'WoodenItemMaterial',
|
|
91
|
-
maxQuantity: 10,
|
|
92
|
-
mainHand: undefined,
|
|
93
|
-
offHand: undefined,
|
|
94
|
-
bothHands: {
|
|
95
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
96
|
-
parryDice: undefined,
|
|
97
|
-
attacks: [
|
|
98
|
-
{
|
|
99
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
100
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
101
|
-
range: WeaponRange,
|
|
102
|
-
requiresSetup: false,
|
|
103
|
-
unparryable: true,
|
|
104
|
-
lowersQuantity: true,
|
|
105
|
-
projectileType: 'ProjectileType.arrow',
|
|
106
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
`;
|
|
112
|
-
(0, vitest_1.describe)('File Content Generator: Const Output', () => {
|
|
113
|
-
(0, vitest_1.test)('should handle no type', async () => {
|
|
114
|
-
let output = await file_content_generator_1.FileContentGenerator.generate({ variableName: 'ConstSample', variable: { type: 'item' } });
|
|
115
|
-
(0, vitest_1.expect)(output).toStrictEqual(noTypeExpected);
|
|
116
|
-
});
|
|
117
|
-
(0, vitest_1.test)('should handle basic value', async () => {
|
|
118
|
-
let output = await file_content_generator_1.FileContentGenerator.generate({ variableName: 'ConstSample', variableType: 'string', variable: 'basic' });
|
|
119
|
-
(0, vitest_1.expect)(output).toStrictEqual(basicConstExpected);
|
|
120
|
-
});
|
|
121
|
-
(0, vitest_1.test)('should handle complex object', async () => {
|
|
122
|
-
let output = await file_content_generator_1.FileContentGenerator.generate({
|
|
123
|
-
variableName: 'ConstSample',
|
|
124
|
-
variableType: 'any',
|
|
125
|
-
variable: complexObject
|
|
126
|
-
});
|
|
127
|
-
(0, vitest_1.expect)(output).toStrictEqual(complexConstExpected);
|
|
128
|
-
});
|
|
129
|
-
(0, vitest_1.test)('should handle replacing complex object', async () => {
|
|
130
|
-
let output = await file_content_generator_1.FileContentGenerator.generate({
|
|
131
|
-
variableName: 'ConstSample',
|
|
132
|
-
variableType: 'any',
|
|
133
|
-
variable: complexObject,
|
|
134
|
-
replaceMap: [{ target: `"WeaponRange.ranged"`, replace: 'WeaponRange' }]
|
|
135
|
-
});
|
|
136
|
-
(0, vitest_1.expect)(output).toStrictEqual(complexConstReplaceExpected);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
(0, vitest_1.describe)('File Content Generator: stringify', () => {
|
|
140
|
-
(0, vitest_1.test)('should not lose properties with undefined or null value', async () => {
|
|
141
|
-
let output = await file_content_generator_1.FileContentGenerator['stringify']({
|
|
142
|
-
a: undefined,
|
|
143
|
-
// biome-ignore lint:all
|
|
144
|
-
b: null
|
|
145
|
-
});
|
|
146
|
-
(0, vitest_1.expect)(output).toStrictEqual('{"a":undefined,"b":undefined}');
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
(0, vitest_1.describe)('File Content Generator: convertToRelativePath', () => {
|
|
150
|
-
(0, vitest_1.test)('should convert to relative path', async () => {
|
|
151
|
-
(0, mocks_1.resetContext)();
|
|
152
|
-
context_1.Context.outputPath = 'D:/Projects/Game-Dev/Starfighter/Starfighter-Definitions-Generator/src/.asset-build';
|
|
153
|
-
context_1.Context.config.projectRoot = 'D:/Projects/Game-Dev/Starfighter/Starfighter-Definitions-Generator/';
|
|
154
|
-
let original = '.src/definitions-sample/images/nested/test2.png';
|
|
155
|
-
let desired = '../../../definitions-sample/images/nested/test2.png';
|
|
156
|
-
let filePath = '/0-global-definitions/assets/images.ts';
|
|
157
|
-
let output = file_content_generator_1.FileContentGenerator['convertToRelativePath'](filePath, original);
|
|
158
|
-
(0, vitest_1.expect)(output).toStrictEqual(desired);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
//# sourceMappingURL=file-content-generator.test.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class IndexFileGenerator {
|
|
2
|
-
private static premadeInterfaces;
|
|
3
|
-
private static idTypes;
|
|
4
|
-
static addPremadeInterface(value: string): void;
|
|
5
|
-
static addIdType(constantName: string, keys: string[]): void;
|
|
6
|
-
static generateFile(pretext: string, outputIndexFile: string): Promise<void>;
|
|
7
|
-
private static createIndexFile;
|
|
8
|
-
private static generateFileDevMode;
|
|
9
|
-
private static generateExportsContent;
|
|
10
|
-
private static generateInterfacesContent;
|
|
11
|
-
private static getInterfacesFromFile;
|
|
12
|
-
static generateTypes(): string;
|
|
13
|
-
}
|
|
@@ -1,139 +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 file_content_generator_1 = require("../file-content-generator/file-content-generator");
|
|
32
|
-
const START_COMMAND = '// ---- INDEX OUTPUT ----';
|
|
33
|
-
const END_COMMAND = '// ---- END ----';
|
|
34
|
-
class IndexFileGenerator {
|
|
35
|
-
static { this.premadeInterfaces = []; }
|
|
36
|
-
static { this.idTypes = []; }
|
|
37
|
-
static addPremadeInterface(value) {
|
|
38
|
-
this.premadeInterfaces.push(value);
|
|
39
|
-
}
|
|
40
|
-
static addIdType(constantName, keys) {
|
|
41
|
-
let value = `export type ${constantName}ID = ${keys.map(key => `'${key}'`).join(' | ')};`;
|
|
42
|
-
this.idTypes.push(value);
|
|
43
|
-
}
|
|
44
|
-
static async generateFile(pretext, outputIndexFile) {
|
|
45
|
-
if (context_1.Context.config.compilerModulesPath) {
|
|
46
|
-
let content = await this.generateFileDevMode(pretext);
|
|
47
|
-
if (content) {
|
|
48
|
-
await this.createIndexFile(content);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
await this.createIndexFile(outputIndexFile);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
static async createIndexFile(outputIndexFile) {
|
|
56
|
-
let outputContent = outputIndexFile;
|
|
57
|
-
let typesContent = this.generateTypes();
|
|
58
|
-
if (typesContent) {
|
|
59
|
-
outputContent += '\n\n' + typesContent;
|
|
60
|
-
}
|
|
61
|
-
context_1.Context.output.push({
|
|
62
|
-
path: '/index.ts',
|
|
63
|
-
content: await file_content_generator_1.FileContentGenerator.format(outputContent)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
static async generateFileDevMode(pretext) {
|
|
67
|
-
let fileUrls = glob.sync(`${context_1.Context.config.compilerModulesPath}/**/*.ts`).map(filePath => filePath.replace(/\\/g, '/'));
|
|
68
|
-
if (fileUrls.length === 0) {
|
|
69
|
-
helpers_lib_1.ConsoleHelper.log(`No typescript file found to generate index.ts file.`, 'red');
|
|
70
|
-
}
|
|
71
|
-
let exportsContent = this.generateExportsContent();
|
|
72
|
-
let interfacesContent = await this.generateInterfacesContent(fileUrls);
|
|
73
|
-
if (interfacesContent !== undefined) {
|
|
74
|
-
let output = `${pretext}\n${exportsContent}\n\n${interfacesContent}`;
|
|
75
|
-
output = await file_content_generator_1.FileContentGenerator.format(output);
|
|
76
|
-
fs.writeFileSync(`${context_1.Context.compilerExecutionPath}/output-index-file.ts`, `// AUTO GENERATED - CHANGES WILL BE REPLACED\nexport const OutputIndexFile = \`${output}\`;\n`);
|
|
77
|
-
helpers_lib_1.ConsoleHelper.log(`Index content 'output-index-file.ts' is generated.`, 'green');
|
|
78
|
-
return output;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
static generateExportsContent() {
|
|
82
|
-
return context_1.Context.exports
|
|
83
|
-
.map(exportItem => `export { ${exportItem.variableName} } from '.${exportItem.path.substring(0, exportItem.path.lastIndexOf('.'))}';`)
|
|
84
|
-
.join('\n');
|
|
85
|
-
}
|
|
86
|
-
static async generateInterfacesContent(fileUrls) {
|
|
87
|
-
let errorCount = 0;
|
|
88
|
-
let outputs = [];
|
|
89
|
-
fileUrls.forEach(fileUrl => {
|
|
90
|
-
let fileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1, fileUrl.lastIndexOf('.'));
|
|
91
|
-
let fileContent = fs.readFileSync(fileUrl, 'utf-8');
|
|
92
|
-
try {
|
|
93
|
-
let output = this.getInterfacesFromFile(fileName, fileContent);
|
|
94
|
-
if (output) {
|
|
95
|
-
outputs.push(output);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
errorCount++;
|
|
100
|
-
helpers_lib_1.ConsoleHelper.log(`Error parsing file: ${fileUrl}, error: '${error.message}'`, 'red');
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
let output = `//-------------------------- DEFINITIONS --------------------------\n`;
|
|
104
|
-
if (this.premadeInterfaces.length > 0) {
|
|
105
|
-
output += '// ---- premade ----';
|
|
106
|
-
output += this.premadeInterfaces.join('\n');
|
|
107
|
-
output += '\n\n';
|
|
108
|
-
}
|
|
109
|
-
output += outputs.join('\n');
|
|
110
|
-
return errorCount === 0 ? output : undefined;
|
|
111
|
-
}
|
|
112
|
-
static getInterfacesFromFile(fileName, fileContent) {
|
|
113
|
-
let index = fileContent.indexOf(START_COMMAND);
|
|
114
|
-
let definitionsFound = index !== -1;
|
|
115
|
-
let contents = [];
|
|
116
|
-
while (index !== -1) {
|
|
117
|
-
let endIndex = fileContent.indexOf(END_COMMAND, index);
|
|
118
|
-
if (endIndex === -1) {
|
|
119
|
-
throw new Error(`No end command found.`);
|
|
120
|
-
}
|
|
121
|
-
contents.push(fileContent.substring(fileContent.indexOf('\n', index + START_COMMAND.length) + 1, endIndex));
|
|
122
|
-
index = fileContent.indexOf(START_COMMAND, endIndex);
|
|
123
|
-
}
|
|
124
|
-
if (definitionsFound) {
|
|
125
|
-
return `// ---- ${fileName} ----\n${contents.join('\n')}`;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
static generateTypes() {
|
|
129
|
-
let output = '';
|
|
130
|
-
if (this.idTypes.length > 0) {
|
|
131
|
-
output += `//-------------------------- ID TYPES --------------------------\n`;
|
|
132
|
-
output += this.idTypes.join('\n');
|
|
133
|
-
output += '\n';
|
|
134
|
-
}
|
|
135
|
-
return output;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.IndexFileGenerator = IndexFileGenerator;
|
|
139
|
-
//# sourceMappingURL=index-file-generator.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypesFileGenerator = void 0;
|
|
4
|
-
const glob_1 = require("glob");
|
|
5
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
6
|
-
const context_1 = require("../context");
|
|
7
|
-
const file_content_generator_1 = require("../file-content-generator/file-content-generator");
|
|
8
|
-
class TypesFileGenerator {
|
|
9
|
-
static { this.idTypes = []; }
|
|
10
|
-
static addIdType(constantName, keys) {
|
|
11
|
-
let value = `export type ${constantName}ID = ${keys.map(key => `'${key}'`).join(' | ')};`;
|
|
12
|
-
this.idTypes.push(value);
|
|
13
|
-
}
|
|
14
|
-
static async generateFile(pretext) {
|
|
15
|
-
let fileUrls = glob_1.glob.sync(`${context_1.Context.config.compilerModulesPath}/**/*.ts`).map(filePath => filePath.replace(/\\/g, '/'));
|
|
16
|
-
if (fileUrls.length === 0) {
|
|
17
|
-
helpers_lib_1.ConsoleHelper.log(`No typescript file found to generate index.ts file.`, 'red');
|
|
18
|
-
}
|
|
19
|
-
let output = this.generateContent();
|
|
20
|
-
context_1.Context.output.push({
|
|
21
|
-
path: '/types.ts',
|
|
22
|
-
content: await file_content_generator_1.FileContentGenerator.format(output)
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
static generateContent() {
|
|
26
|
-
let output = '';
|
|
27
|
-
if (this.idTypes.length > 0) {
|
|
28
|
-
output += `//-------------------------- ID TYPES --------------------------\n`;
|
|
29
|
-
output += this.idTypes.join('\n');
|
|
30
|
-
}
|
|
31
|
-
return output;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.TypesFileGenerator = TypesFileGenerator;
|
|
35
|
-
//# sourceMappingURL=types-file-generator.js.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import Joi from 'joi';
|
|
2
|
-
import { Output } from './framework.model';
|
|
3
|
-
export type DefinitionComponentClassType<T> = new (...args: any[]) => DefinitionComponent<T> | SingleDefinitionComponent<T>;
|
|
4
|
-
export interface DefinitionComponentMeta {
|
|
5
|
-
definitionName: string;
|
|
6
|
-
keyName?: string;
|
|
7
|
-
singleton?: boolean;
|
|
8
|
-
validationSchema: Joi.Schema;
|
|
9
|
-
}
|
|
10
|
-
export declare function DefinitionComponentDecorator(
|
|
11
|
-
meta: DefinitionComponentMeta
|
|
12
|
-
): (ComponentClass: DefinitionComponentClassType<any>) => any;
|
|
13
|
-
export declare abstract class DefinitionComponent<T> {
|
|
14
|
-
static getSchema(): Joi.Schema;
|
|
15
|
-
abstract process(definitions: T[], context: Output): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export declare abstract class SingleDefinitionComponent<T> {
|
|
18
|
-
static getSchema(): Joi.Schema;
|
|
19
|
-
abstract process(definitions: T, context: Output): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
interface DefinitionModuleMeta {
|
|
22
|
-
modules: DefinitionComponentClassType<any>[];
|
|
23
|
-
interfaces: string;
|
|
24
|
-
}
|
|
25
|
-
export declare function DefinitionModuleDecorator(meta: DefinitionModuleMeta): (ModuleClass: DefinitionModuleClassType) => any;
|
|
26
|
-
export type DefinitionModuleClassType = new (...args: any[]) => DefinitionModule;
|
|
27
|
-
export declare abstract class DefinitionModule {}
|
|
28
|
-
export {};
|
|
@@ -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
|
-
}
|