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.
Files changed (173) hide show
  1. package/dist/index.d.mts +198 -0
  2. package/dist/index.d.ts +198 -17
  3. package/dist/index.js +43 -50
  4. package/dist/index.mjs +43 -0
  5. package/package.json +33 -22
  6. package/dist/_mocks/mocks.d.ts +0 -7
  7. package/dist/_mocks/mocks.js +0 -44
  8. package/dist/decorators/definition-component.d.ts +0 -18
  9. package/dist/decorators/definition-component.js +0 -52
  10. package/dist/decorators/definition-generator.d.ts +0 -11
  11. package/dist/decorators/definition-generator.js +0 -30
  12. package/dist/framework/context.d.ts +0 -24
  13. package/dist/framework/context.js +0 -64
  14. package/dist/framework/definition-component.d.ts +0 -20
  15. package/dist/framework/definition-component.js +0 -29
  16. package/dist/framework/definition-generator.d.ts +0 -11
  17. package/dist/framework/definition-generator.js +0 -22
  18. package/dist/framework/definition-store.d.ts +0 -25
  19. package/dist/framework/definition-store.js +0 -121
  20. package/dist/framework/file-content-generator/file-content-generator.d.ts +0 -19
  21. package/dist/framework/file-content-generator/file-content-generator.js +0 -117
  22. package/dist/framework/file-content-generator/file-content-generator.test.d.ts +0 -24
  23. package/dist/framework/file-content-generator/file-content-generator.test.js +0 -161
  24. package/dist/framework/file-generators/index-file-generator.d.ts +0 -13
  25. package/dist/framework/file-generators/index-file-generator.js +0 -139
  26. package/dist/framework/file-generators/types-file-generator.d.ts +0 -6
  27. package/dist/framework/file-generators/types-file-generator.js +0 -35
  28. package/dist/framework/framework.d.ts +0 -28
  29. package/dist/framework/framework.data.d.ts +0 -6
  30. package/dist/framework/framework.data.js +0 -17
  31. package/dist/framework/framework.js +0 -51
  32. package/dist/framework/framework.model.d.ts +0 -32
  33. package/dist/framework/framework.model.js +0 -3
  34. package/dist/framework/index-file-generator/index-file-generator.d.ts +0 -10
  35. package/dist/framework/index-file-generator/index-file-generator.js +0 -118
  36. package/dist/framework/interfaces.d.ts +0 -46
  37. package/dist/framework/interfaces.js +0 -3
  38. package/dist/framework/kernel.d.ts +0 -12
  39. package/dist/framework/kernel.js +0 -308
  40. package/dist/helpers/common-functions/common-functions.d.ts +0 -10
  41. package/dist/helpers/common-functions/common-functions.js +0 -29
  42. package/dist/helpers/common-functions/common-functions.spec.d.ts +0 -1
  43. package/dist/helpers/common-functions/common-functions.spec.js +0 -50
  44. package/dist/helpers/common-functions/common-functions.test.d.ts +0 -1
  45. package/dist/helpers/common-functions/common-functions.test.js +0 -51
  46. package/dist/helpers/duplicate-helper/duplicate-helper.d.ts +0 -11
  47. package/dist/helpers/duplicate-helper/duplicate-helper.js +0 -40
  48. package/dist/helpers/duplicate-helper/duplicate-helper.spec.d.ts +0 -1
  49. package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +0 -54
  50. package/dist/helpers/duplicate-helper/duplicate-helper.test.d.ts +0 -1
  51. package/dist/helpers/duplicate-helper/duplicate-helper.test.js +0 -55
  52. package/dist/helpers/output-helper/output-helper.d.ts +0 -30
  53. package/dist/helpers/output-helper/output-helper.js +0 -143
  54. package/dist/helpers/output-helper/output-helper.spec.d.ts +0 -24
  55. package/dist/helpers/output-helper/output-helper.spec.js +0 -261
  56. package/dist/helpers/output-helper/output-helper.test.d.ts +0 -24
  57. package/dist/helpers/output-helper/output-helper.test.js +0 -262
  58. package/dist/helpers/raw-definition-helper/raw-definition.helper.d.ts +0 -7
  59. package/dist/helpers/raw-definition-helper/raw-definition.helper.js +0 -66
  60. package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.d.ts +0 -1
  61. package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +0 -143
  62. package/dist/helpers/raw-definition-helper/raw-definition.helper.test.d.ts +0 -1
  63. package/dist/helpers/raw-definition-helper/raw-definition.helper.test.js +0 -136
  64. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.d.ts +0 -16
  65. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.js +0 -48
  66. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +0 -1
  67. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +0 -191
  68. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.d.ts +0 -1
  69. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.js +0 -213
  70. package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.d.ts +0 -13
  71. package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.js +0 -53
  72. package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.d.ts +0 -1
  73. package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.js +0 -96
  74. package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +0 -14
  75. package/dist/helpers/validator/custom-validators/image.custom-validator.js +0 -44
  76. package/dist/helpers/validator/custom-validators/path.custom-validator.d.ts +0 -9
  77. package/dist/helpers/validator/custom-validators/path.custom-validator.js +0 -30
  78. package/dist/helpers/validator/custom-validators/position-on-sprite.d.ts +0 -14
  79. package/dist/helpers/validator/custom-validators/position-on-sprite.js +0 -44
  80. package/dist/helpers/validator/custom-validators/reference.custom-validator.d.ts +0 -22
  81. package/dist/helpers/validator/custom-validators/reference.custom-validator.js +0 -123
  82. package/dist/helpers/validator/custom-validators/sprite.custom-validator.d.ts +0 -14
  83. package/dist/helpers/validator/custom-validators/sprite.custom-validator.js +0 -43
  84. package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +0 -9
  85. package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +0 -33
  86. package/dist/helpers/validator/custom-validators/unique.custom-validator.d.ts +0 -8
  87. package/dist/helpers/validator/custom-validators/unique.custom-validator.js +0 -20
  88. package/dist/helpers/validator/joi-custom-validators.d.ts +0 -33
  89. package/dist/helpers/validator/joi-custom-validators.js +0 -54
  90. package/dist/helpers/validator/joi-custom-validators.spec.d.ts +0 -1
  91. package/dist/helpers/validator/joi-custom-validators.spec.js +0 -304
  92. package/dist/helpers/validator/validator.d.ts +0 -21
  93. package/dist/helpers/validator/validator.js +0 -74
  94. package/dist/helpers/validator/validator.spec.d.ts +0 -1
  95. package/dist/helpers/validator/validator.spec.js +0 -332
  96. package/dist/helpers/validator/validator.test.d.ts +0 -1
  97. package/dist/helpers/validator/validator.test.js +0 -329
  98. package/dist/pipeline/1-select-definitions-helper.d.ts +0 -20
  99. package/dist/pipeline/1-select-definitions-helper.js +0 -76
  100. package/dist/pipeline/1-select-definitions.helper.d.ts +0 -20
  101. package/dist/pipeline/1-select-definitions.helper.js +0 -80
  102. package/dist/pipeline/1-select-definitions.helper.test.d.ts +0 -1
  103. package/dist/pipeline/1-select-definitions.helper.test.js +0 -141
  104. package/dist/pipeline/1-select-definitions.spec.d.ts +0 -1
  105. package/dist/pipeline/1-select-definitions.spec.js +0 -140
  106. package/dist/pipeline/2-structure-parser.helper.d.ts +0 -11
  107. package/dist/pipeline/2-structure-parser.helper.js +0 -70
  108. package/dist/pipeline/2-structure-parser.helper.spec.d.ts +0 -1
  109. package/dist/pipeline/2-structure-parser.helper.spec.js +0 -280
  110. package/dist/pipeline/2-structure-parser.helper.test.d.ts +0 -1
  111. package/dist/pipeline/2-structure-parser.helper.test.js +0 -281
  112. package/dist/pipeline/3-config.d.ts +0 -9
  113. package/dist/pipeline/3-config.js +0 -36
  114. package/dist/pipeline/_mocks/index.d.ts +0 -13
  115. package/dist/pipeline/_mocks/index.js +0 -52
  116. package/dist/pipeline/parsers/array-parser.d.ts +0 -4
  117. package/dist/pipeline/parsers/array-parser.js +0 -69
  118. package/dist/pipeline/parsers/array-parser.spec.d.ts +0 -1
  119. package/dist/pipeline/parsers/array-parser.spec.js +0 -128
  120. package/dist/pipeline/parsers/array-parser.test.d.ts +0 -1
  121. package/dist/pipeline/parsers/array-parser.test.js +0 -126
  122. package/dist/pipeline/parsers/object-parser.d.ts +0 -4
  123. package/dist/pipeline/parsers/object-parser.js +0 -135
  124. package/dist/pipeline/parsers/object-parser.spec.d.ts +0 -1
  125. package/dist/pipeline/parsers/object-parser.spec.js +0 -179
  126. package/dist/pipeline/parsers/object-parser.test.d.ts +0 -1
  127. package/dist/pipeline/parsers/object-parser.test.js +0 -186
  128. package/dist/pipeline/parsers/primitive-parser.d.ts +0 -7
  129. package/dist/pipeline/parsers/primitive-parser.js +0 -111
  130. package/dist/pipeline/parsers/primitive-parser.spec.d.ts +0 -1
  131. package/dist/pipeline/parsers/primitive-parser.spec.js +0 -79
  132. package/dist/pipeline/parsers/primitive-parser.test.d.ts +0 -1
  133. package/dist/pipeline/parsers/primitive-parser.test.js +0 -85
  134. package/dist/pipeline/raw-data-parser.d.ts +0 -5
  135. package/dist/pipeline/raw-data-parser.js +0 -25
  136. package/dist/pre-made-components/_validators/shape-validators.d.ts +0 -7
  137. package/dist/pre-made-components/_validators/shape-validators.js +0 -37
  138. package/dist/pre-made-components/_validators/sprite-validators.d.ts +0 -7
  139. package/dist/pre-made-components/_validators/sprite-validators.js +0 -43
  140. package/dist/pre-made-components/assets/1-sprite.d.ts +0 -15
  141. package/dist/pre-made-components/assets/1-sprite.js +0 -74
  142. package/dist/pre-made-components/assets/2-sprite-group.d.ts +0 -11
  143. package/dist/pre-made-components/assets/2-sprite-group.js +0 -41
  144. package/dist/pre-made-components/assets/3-font.d.ts +0 -17
  145. package/dist/pre-made-components/assets/3-font.js +0 -71
  146. package/dist/pre-made-components/events/1-event.d.ts +0 -6
  147. package/dist/pre-made-components/events/1-event.js +0 -206
  148. package/dist/pre-made-components/events/1-script.d.ts +0 -8
  149. package/dist/pre-made-components/events/1-script.js +0 -102
  150. package/dist/pre-made-components/events/2-event-test.d.ts +0 -18
  151. package/dist/pre-made-components/events/2-event-test.js +0 -172
  152. package/dist/pre-made-components/events/2-script-test.d.ts +0 -7
  153. package/dist/pre-made-components/events/2-script-test.js +0 -102
  154. package/dist/pre-made-components/events/3-event.d.ts +0 -7
  155. package/dist/pre-made-components/events/3-event.js +0 -100
  156. package/dist/pre-made-components/events/4-event-test.d.ts +0 -7
  157. package/dist/pre-made-components/events/4-event-test.js +0 -89
  158. package/dist/pre-made-components/events/event-setup.d.ts +0 -13
  159. package/dist/pre-made-components/events/event-setup.js +0 -20
  160. package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.d.ts +0 -3
  161. package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.js +0 -24
  162. package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.d.ts +0 -1
  163. package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.js +0 -39
  164. package/dist/pre-made-components/events/helpers/script-testing.helper.d.ts +0 -33
  165. package/dist/pre-made-components/events/helpers/script-testing.helper.js +0 -79
  166. package/dist/pre-made-components/events/script-setup.d.ts +0 -8
  167. package/dist/pre-made-components/events/script-setup.js +0 -16
  168. package/dist/pre-made-components/events/scripting-setup.d.ts +0 -33
  169. package/dist/pre-made-components/events/scripting-setup.js +0 -97
  170. package/dist/pre-made-components/events/validators.d.ts +0 -6
  171. package/dist/pre-made-components/events/validators.js +0 -96
  172. package/dist/setup.d.ts +0 -1
  173. package/dist/setup.js +0 -10
@@ -1,50 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- const common_functions_1 = require('./common-functions');
4
- describe('COMMON FUNCTIONS', () => {
5
- test('kabab case to camel case', () => {
6
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('')).toEqual('');
7
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text')).toEqual('text');
8
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT')).toEqual('text');
9
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text-asdf')).toEqual('textAsdf');
10
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT-ASDF')).toEqual('textAsdf');
11
- });
12
- test('lower case first letter', () => {
13
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('')).toEqual('');
14
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('text')).toEqual('text');
15
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' ')).toEqual(' ');
16
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('Text')).toEqual('text');
17
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' Text')).toEqual(' Text');
18
- });
19
- test('upper case first letter', () => {
20
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('')).toEqual('');
21
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('Text')).toEqual('Text');
22
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter(' ')).toEqual(' ');
23
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('text')).toEqual('Text');
24
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter(' text')).toEqual(' text');
25
- });
26
- test('remove whitespace', () => {
27
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('')).toEqual('');
28
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text')).toEqual('text');
29
- expect(common_functions_1.CommonFunctions.removeWhiteSpace(' text')).toEqual('text');
30
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text ')).toEqual('text');
31
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\n')).toEqual('text');
32
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\r')).toEqual('text');
33
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\r\n')).toEqual('text');
34
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text//')).toEqual('text');
35
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text //')).toEqual('text');
36
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text // asdf')).toEqual('text');
37
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
38
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
39
- });
40
- test('remove comments', () => {
41
- expect(common_functions_1.CommonFunctions.removeComments('')).toEqual('');
42
- expect(common_functions_1.CommonFunctions.removeComments('text')).toEqual('text');
43
- expect(common_functions_1.CommonFunctions.removeComments(' text ')).toEqual(' text');
44
- expect(common_functions_1.CommonFunctions.removeComments(' text//')).toEqual(' text');
45
- expect(common_functions_1.CommonFunctions.removeComments(' text //')).toEqual(' text');
46
- expect(common_functions_1.CommonFunctions.removeComments(' text // asdf')).toEqual(' text');
47
- expect(common_functions_1.CommonFunctions.removeComments('- Symbol: □ // Dirt\n')).toEqual('- Symbol: □');
48
- });
49
- });
50
- //# sourceMappingURL=common-functions.spec.js.map
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const common_functions_1 = require("./common-functions");
5
- (0, vitest_1.describe)('COMMON FUNCTIONS', () => {
6
- (0, vitest_1.test)('kabab case to camel case', () => {
7
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.kebabCaseToCamelCase('')).toEqual('');
8
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text')).toEqual('text');
9
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT')).toEqual('text');
10
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text-asdf')).toEqual('textAsdf');
11
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT-ASDF')).toEqual('textAsdf');
12
- });
13
- (0, vitest_1.test)('lower case first letter', () => {
14
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.lowerCaseFirstLetter('')).toEqual('');
15
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.lowerCaseFirstLetter('text')).toEqual('text');
16
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' ')).toEqual(' ');
17
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.lowerCaseFirstLetter('Text')).toEqual('text');
18
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' Text')).toEqual(' Text');
19
- });
20
- (0, vitest_1.test)('upper case first letter', () => {
21
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.upperCaseFirstLetter('')).toEqual('');
22
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.upperCaseFirstLetter('Text')).toEqual('Text');
23
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.upperCaseFirstLetter(' ')).toEqual(' ');
24
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.upperCaseFirstLetter('text')).toEqual('Text');
25
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.upperCaseFirstLetter(' text')).toEqual(' text');
26
- });
27
- (0, vitest_1.test)('remove whitespace', () => {
28
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('')).toEqual('');
29
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text')).toEqual('text');
30
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace(' text')).toEqual('text');
31
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text ')).toEqual('text');
32
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text\n')).toEqual('text');
33
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text\r')).toEqual('text');
34
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text\r\n')).toEqual('text');
35
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text//')).toEqual('text');
36
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text //')).toEqual('text');
37
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text // asdf')).toEqual('text');
38
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
39
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
40
- });
41
- (0, vitest_1.test)('remove comments', () => {
42
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments('')).toEqual('');
43
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments('text')).toEqual('text');
44
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments(' text ')).toEqual(' text');
45
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments(' text//')).toEqual(' text');
46
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments(' text //')).toEqual(' text');
47
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments(' text // asdf')).toEqual(' text');
48
- (0, vitest_1.expect)(common_functions_1.CommonFunctions.removeComments('- Symbol: □ // Dirt\n')).toEqual('- Symbol: □');
49
- });
50
- });
51
- //# sourceMappingURL=common-functions.test.js.map
@@ -1,11 +0,0 @@
1
- import { LocationInFile } from '../../framework/interfaces';
2
- export declare class DuplicateHelper {
3
- private group;
4
- private identifiers;
5
- private identifierToLocation;
6
- private addedIdentifiers;
7
- private duplicates;
8
- constructor(group: string);
9
- newEntry(identifier: string, location: LocationInFile): boolean;
10
- logDuplicateErrors(): void;
11
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DuplicateHelper = void 0;
4
- const context_1 = require("../../framework/context");
5
- class DuplicateHelper {
6
- constructor(group) {
7
- this.group = group;
8
- this.identifiers = new Set();
9
- this.identifierToLocation = new Map();
10
- this.addedIdentifiers = new Set();
11
- this.duplicates = [];
12
- }
13
- newEntry(identifier, location) {
14
- if (this.identifiers.has(identifier)) {
15
- if (!this.addedIdentifiers.has(identifier)) {
16
- this.addedIdentifiers.add(identifier);
17
- let firstIdentifierLocation = this.identifierToLocation.get(identifier);
18
- firstIdentifierLocation && this.duplicates.push({ identifier, location: firstIdentifierLocation });
19
- }
20
- this.duplicates.push({ identifier, location });
21
- return false;
22
- }
23
- else {
24
- this.identifiers.add(identifier);
25
- this.identifierToLocation.set(identifier, location);
26
- return true;
27
- }
28
- }
29
- logDuplicateErrors() {
30
- this.duplicates.forEach(duplicate => {
31
- let errorLog = {
32
- description: `Value should be singular! Group: "${this.group}", Value: "${duplicate.identifier}"`,
33
- location: duplicate.location
34
- };
35
- context_1.Context.addErrorLog(errorLog);
36
- });
37
- }
38
- }
39
- exports.DuplicateHelper = DuplicateHelper;
40
- //# sourceMappingURL=duplicate-helper.js.map
@@ -1,54 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- const duplicate_helper_1 = require('./duplicate-helper');
4
- const mocks_1 = require('../../_mocks/mocks');
5
- const context_1 = require('../../framework/context');
6
- describe('Duplicate Helper', () => {
7
- test('should handle single entry', () => {
8
- (0, mocks_1.resetContext)();
9
- let helper = new duplicate_helper_1.DuplicateHelper('ASSET: Name');
10
- expect(helper.newEntry('identifier', mocks_1.SampleLocation1)).toBeTruthy();
11
- helper.logDuplicateErrors();
12
- expect(context_1.Context.errorLogs).toStrictEqual([]);
13
- });
14
- test('should detect duplicate', () => {
15
- (0, mocks_1.resetContext)();
16
- let helper = new duplicate_helper_1.DuplicateHelper('ASSET: Name');
17
- expect(helper.newEntry('identifier', mocks_1.SampleLocation1)).toBeTruthy();
18
- expect(helper.newEntry('identifier', mocks_1.SampleLocation2)).toBeFalsy();
19
- helper.logDuplicateErrors();
20
- expect(context_1.Context.errorLogs).toStrictEqual([
21
- {
22
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
23
- location: mocks_1.SampleLocation1
24
- },
25
- {
26
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
27
- location: mocks_1.SampleLocation2
28
- }
29
- ]);
30
- });
31
- test('should detect multiple duplicate', () => {
32
- (0, mocks_1.resetContext)();
33
- let helper = new duplicate_helper_1.DuplicateHelper('ASSET: Name');
34
- expect(helper.newEntry('identifier', mocks_1.SampleLocation1)).toBeTruthy();
35
- expect(helper.newEntry('identifier', mocks_1.SampleLocation2)).toBeFalsy();
36
- expect(helper.newEntry('identifier', mocks_1.SampleLocation3)).toBeFalsy();
37
- helper.logDuplicateErrors();
38
- expect(context_1.Context.errorLogs).toStrictEqual([
39
- {
40
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
41
- location: mocks_1.SampleLocation1
42
- },
43
- {
44
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
45
- location: mocks_1.SampleLocation2
46
- },
47
- {
48
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
49
- location: mocks_1.SampleLocation3
50
- }
51
- ]);
52
- });
53
- });
54
- //# sourceMappingURL=duplicate-helper.spec.js.map
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const mocks_1 = require("../../_mocks/mocks");
5
- const context_1 = require("../../framework/context");
6
- const duplicate_helper_1 = require("./duplicate-helper");
7
- (0, vitest_1.describe)('Duplicate Helper', () => {
8
- (0, vitest_1.test)('should handle single entry', () => {
9
- (0, mocks_1.resetContext)();
10
- let helper = new duplicate_helper_1.DuplicateHelper('ASSET: Name');
11
- (0, vitest_1.expect)(helper.newEntry('identifier', mocks_1.SampleLocation1)).toBeTruthy();
12
- helper.logDuplicateErrors();
13
- (0, vitest_1.expect)(context_1.Context['errorLogBuffer']).toStrictEqual([]);
14
- });
15
- (0, vitest_1.test)('should detect duplicate', () => {
16
- (0, mocks_1.resetContext)();
17
- let helper = new duplicate_helper_1.DuplicateHelper('ASSET: Name');
18
- (0, vitest_1.expect)(helper.newEntry('identifier', mocks_1.SampleLocation1)).toBeTruthy();
19
- (0, vitest_1.expect)(helper.newEntry('identifier', mocks_1.SampleLocation2)).toBeFalsy();
20
- helper.logDuplicateErrors();
21
- (0, vitest_1.expect)(context_1.Context['errorLogBuffer']).toStrictEqual([
22
- {
23
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
24
- location: mocks_1.SampleLocation1
25
- },
26
- {
27
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
28
- location: mocks_1.SampleLocation2
29
- }
30
- ]);
31
- });
32
- (0, vitest_1.test)('should detect multiple duplicate', () => {
33
- (0, mocks_1.resetContext)();
34
- let helper = new duplicate_helper_1.DuplicateHelper('ASSET: Name');
35
- (0, vitest_1.expect)(helper.newEntry('identifier', mocks_1.SampleLocation1)).toBeTruthy();
36
- (0, vitest_1.expect)(helper.newEntry('identifier', mocks_1.SampleLocation2)).toBeFalsy();
37
- (0, vitest_1.expect)(helper.newEntry('identifier', mocks_1.SampleLocation3)).toBeFalsy();
38
- helper.logDuplicateErrors();
39
- (0, vitest_1.expect)(context_1.Context['errorLogBuffer']).toStrictEqual([
40
- {
41
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
42
- location: mocks_1.SampleLocation1
43
- },
44
- {
45
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
46
- location: mocks_1.SampleLocation2
47
- },
48
- {
49
- description: 'Value should be singular! Group: "ASSET: Name", Value: "identifier"',
50
- location: mocks_1.SampleLocation3
51
- }
52
- ]);
53
- });
54
- });
55
- //# sourceMappingURL=duplicate-helper.test.js.map
@@ -1,30 +0,0 @@
1
- declare class OutputHelperClass {
2
- generateArrayOutput(options: {
3
- preText?: string;
4
- variableName: string;
5
- variableType: string;
6
- variable: any[];
7
- filePath?: string;
8
- assetUrl?: string;
9
- replaceMap?: {
10
- target: string;
11
- replace: string;
12
- }[];
13
- }): Promise<string>;
14
- generateOutput(options: {
15
- preText?: string;
16
- variableName: string;
17
- variableType?: string;
18
- variable: any;
19
- replaceMap?: {
20
- target: string;
21
- replace: string;
22
- }[];
23
- }): Promise<string>;
24
- private convertToRelativePath;
25
- private replaceOutput;
26
- private format;
27
- private stringify;
28
- }
29
- export declare const OutputHelper: OutputHelperClass;
30
- export {};
@@ -1,143 +0,0 @@
1
- 'use strict';
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = {
10
- enumerable: true,
11
- get: function () {
12
- return m[k];
13
- }
14
- };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }
18
- : function (o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- });
22
- var __setModuleDefault =
23
- (this && this.__setModuleDefault) ||
24
- (Object.create
25
- ? function (o, v) {
26
- Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
- }
28
- : function (o, v) {
29
- o['default'] = v;
30
- });
31
- var __importStar =
32
- (this && this.__importStar) ||
33
- function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null)
37
- for (var k in mod) if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- var __importDefault =
42
- (this && this.__importDefault) ||
43
- function (mod) {
44
- return mod && mod.__esModule ? mod : { default: mod };
45
- };
46
- Object.defineProperty(exports, '__esModule', { value: true });
47
- exports.OutputHelper = void 0;
48
- const prettier = __importStar(require('prettier'));
49
- const path_1 = __importDefault(require('path'));
50
- const context_1 = require('../../framework/context');
51
- const helpers_lib_1 = require('helpers-lib');
52
- class OutputHelperClass {
53
- async generateArrayOutput(options) {
54
- let output = '';
55
- if (options.preText) {
56
- output += `${options.preText}\n\n`;
57
- }
58
- let assetsReplaceMap;
59
- if (options.assetUrl) {
60
- if (!options.filePath) {
61
- throw new Error('filePath is required when using assetUrl');
62
- }
63
- let urls = options.variable.map(item => {
64
- let url = helpers_lib_1.JsonHelper.deepFind(item, options.assetUrl);
65
- if (!url) {
66
- throw new Error(
67
- `OutputHelperClass: Asset url is not found in the given variable! item: "${JSON.stringify(item)}", assetUrl: "${options.assetUrl}"`
68
- );
69
- }
70
- return url;
71
- });
72
- let assetUrlToNameMap = new Map();
73
- urls.forEach(url => {
74
- if (!assetUrlToNameMap.has(url)) {
75
- let name = `asset${assetUrlToNameMap.size}`;
76
- assetUrlToNameMap.set(url, name);
77
- }
78
- });
79
- let imports = Array.from(assetUrlToNameMap, ([key, value]) => ({ name: value, url: key }))
80
- .map(item => `import ${item.name} from '${this.convertToRelativePath(options.filePath, item.url)}';`)
81
- .join('\n');
82
- output += imports + '\n\n';
83
- assetsReplaceMap = urls.reduce((map, url) => [...map, { target: `"${url}"`, replace: assetUrlToNameMap.get(url) }], []);
84
- }
85
- if (options.variable.reduce) {
86
- let content = options.variable.reduce((acc, item, index) => `${acc}${index !== 0 ? ',' : ''}${this.stringify(item)}`, '');
87
- output += `export const ${options.variableName}: ${options.variableType} = [${content}];`;
88
- } else {
89
- console.error(
90
- `Given variable is not an array, do you mean to use "generateOutput()", for the variable "${options.variableName}"?`
91
- );
92
- }
93
- if (assetsReplaceMap) {
94
- output = this.replaceOutput(output, assetsReplaceMap);
95
- }
96
- if (options.replaceMap) {
97
- output = this.replaceOutput(output, options.replaceMap);
98
- }
99
- return this.format(output);
100
- }
101
- async generateOutput(options) {
102
- let output = '';
103
- if (options.preText) {
104
- output += `${options.preText}\n\n`;
105
- }
106
- if (options.variableType) {
107
- output += `export const ${options.variableName}: ${options.variableType} = ${this.stringify(options.variable)}`;
108
- } else {
109
- output += `export const ${options.variableName} = ${this.stringify(options.variable)}`;
110
- }
111
- if (options.replaceMap) {
112
- output = this.replaceOutput(output, options.replaceMap);
113
- }
114
- return this.format(output);
115
- }
116
- convertToRelativePath(filePath, relativePathFromRoot) {
117
- let fromPath = context_1.Context.outputPath + filePath.substring(0, filePath.lastIndexOf('/'));
118
- let toPath = context_1.Context.config.projectRoot + relativePathFromRoot.substring(1);
119
- return path_1.default.relative(fromPath, toPath).replace(/\\/g, '/');
120
- }
121
- replaceOutput(output, replaceMap) {
122
- replaceMap.forEach(item => {
123
- output = output.replace(new RegExp(item.target, 'g'), item.replace);
124
- });
125
- return output;
126
- }
127
- async format(str) {
128
- return prettier.format(str, {
129
- parser: 'typescript',
130
- trailingComma: 'none',
131
- tabWidth: 2,
132
- printWidth: 130,
133
- singleQuote: true,
134
- arrowParens: 'avoid'
135
- });
136
- }
137
- stringify(obj) {
138
- // eslint-disable-next-line no-null/no-null
139
- return JSON.stringify(obj, (k, v) => (v === undefined ? null : v)).replace(/null/gm, 'undefined');
140
- }
141
- }
142
- exports.OutputHelper = new OutputHelperClass();
143
- //# sourceMappingURL=output-helper.js.map
@@ -1,24 +0,0 @@
1
- export declare const Const: {
2
- type: string;
3
- material: string;
4
- maxQuantity: number;
5
- mainHand: undefined;
6
- offHand: undefined;
7
- bothHands: {
8
- imageOnCharacter: string;
9
- parryDice: undefined;
10
- attacks: {
11
- actionIcon: string;
12
- attackDices: string[];
13
- range: string;
14
- requiresSetup: boolean;
15
- unparryable: boolean;
16
- lowersQuantity: boolean;
17
- projectileType: string;
18
- sounds: {
19
- hit: string;
20
- pre: string;
21
- };
22
- }[];
23
- };
24
- };