@o3r/components 11.6.0-prerelease.2 → 11.6.0-prerelease.20

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 (142) hide show
  1. package/builders/component-extractor/helpers/component/component-class.extractor.d.ts +3 -9
  2. package/builders/component-extractor/helpers/component/component-class.extractor.d.ts.map +1 -1
  3. package/builders/component-extractor/helpers/component/component-class.extractor.js +34 -37
  4. package/builders/component-extractor/helpers/component/component-config.extractor.d.ts +2 -15
  5. package/builders/component-extractor/helpers/component/component-config.extractor.d.ts.map +1 -1
  6. package/builders/component-extractor/helpers/component/component-config.extractor.js +24 -45
  7. package/builders/component-extractor/helpers/component/component.extractor.d.ts +2 -10
  8. package/builders/component-extractor/helpers/component/component.extractor.d.ts.map +1 -1
  9. package/builders/component-extractor/helpers/component/component.extractor.js +20 -25
  10. package/builders/component-extractor/helpers/component/component.parser.d.ts +2 -3
  11. package/builders/component-extractor/helpers/component/component.parser.d.ts.map +1 -1
  12. package/builders/component-extractor/helpers/component/component.parser.js +11 -14
  13. package/builders/component-extractor/index.d.ts.map +1 -1
  14. package/builders/component-extractor/index.js +25 -27
  15. package/builders/component-extractor/schema.d.ts.map +1 -1
  16. package/builders/metadata-check/helpers/config-metadata-comparison.helper.d.ts +2 -2
  17. package/builders/metadata-check/helpers/config-metadata-comparison.helper.d.ts.map +1 -1
  18. package/builders/metadata-check/helpers/config-metadata-comparison.helper.js +1 -1
  19. package/builders/metadata-check/index.d.ts.map +1 -1
  20. package/builders/metadata-check/schema.d.ts.map +1 -1
  21. package/core/component.output.d.ts.map +1 -1
  22. package/core/rendering/helpers.d.ts +0 -1
  23. package/core/rendering/helpers.d.ts.map +1 -1
  24. package/devkit/components-devkit.interface.d.ts.map +1 -1
  25. package/devkit/components-devtools.message.service.d.ts +2 -3
  26. package/devkit/components-devtools.message.service.d.ts.map +1 -1
  27. package/devkit/components-devtools.module.d.ts.map +1 -1
  28. package/devkit/components-devtools.token.d.ts +1 -1
  29. package/devkit/components-devtools.token.d.ts.map +1 -1
  30. package/devkit/inspector/ng/ng.d.ts +3 -1
  31. package/devkit/inspector/ng/ng.d.ts.map +1 -1
  32. package/devkit/inspector/otter-inspector.helpers.d.ts.map +1 -1
  33. package/devkit/inspector/otter-inspector.service.d.ts.map +1 -1
  34. package/esm2022/core/component.output.mjs +1 -1
  35. package/esm2022/core/rendering/helpers.mjs +3 -4
  36. package/esm2022/devkit/components-devkit.interface.mjs +7 -7
  37. package/esm2022/devkit/components-devtools.message.service.mjs +15 -16
  38. package/esm2022/devkit/components-devtools.module.mjs +10 -10
  39. package/esm2022/devkit/components-devtools.token.mjs +2 -2
  40. package/esm2022/devkit/index.mjs +1 -1
  41. package/esm2022/devkit/inspector/index.mjs +1 -1
  42. package/esm2022/devkit/inspector/ng/ng.mjs +1 -1
  43. package/esm2022/devkit/inspector/otter-inspector.helpers.mjs +8 -8
  44. package/esm2022/devkit/inspector/otter-inspector.service.mjs +8 -8
  45. package/esm2022/rules-engine/placeholder.action-handler.mjs +23 -21
  46. package/esm2022/rules-engine/placeholder.interfaces.mjs +1 -1
  47. package/esm2022/rules-engine/placeholder.rules-engine.effect.mjs +28 -25
  48. package/esm2022/rules-engine/placeholder.rules-engine.module.mjs +10 -10
  49. package/esm2022/rules-engine/public_api.mjs +2 -2
  50. package/esm2022/stores/index.mjs +2 -2
  51. package/esm2022/stores/placeholder-request/index.mjs +1 -1
  52. package/esm2022/stores/placeholder-request/placeholder-request.actions.mjs +3 -3
  53. package/esm2022/stores/placeholder-request/placeholder-request.module.mjs +9 -9
  54. package/esm2022/stores/placeholder-request/placeholder-request.reducer.mjs +4 -4
  55. package/esm2022/stores/placeholder-request/placeholder-request.selectors.mjs +4 -4
  56. package/esm2022/stores/placeholder-request/placeholder-request.state.mjs +1 -1
  57. package/esm2022/stores/placeholder-request/placeholder-request.sync.mjs +3 -3
  58. package/esm2022/stores/placeholder-template/index.mjs +1 -1
  59. package/esm2022/stores/placeholder-template/placeholder-template.actions.mjs +2 -2
  60. package/esm2022/stores/placeholder-template/placeholder-template.module.mjs +9 -9
  61. package/esm2022/stores/placeholder-template/placeholder-template.reducer.mjs +3 -3
  62. package/esm2022/stores/placeholder-template/placeholder-template.selectors.mjs +8 -8
  63. package/esm2022/stores/placeholder-template/placeholder-template.state.mjs +1 -1
  64. package/esm2022/stores/placeholder-template/placeholder-template.sync.mjs +2 -2
  65. package/esm2022/tools/component-replacement/c11n.directive.mjs +9 -8
  66. package/esm2022/tools/component-replacement/c11n.helpers.mjs +1 -1
  67. package/esm2022/tools/component-replacement/c11n.mock.module.mjs +15 -15
  68. package/esm2022/tools/component-replacement/c11n.module.mjs +10 -9
  69. package/esm2022/tools/component-replacement/c11n.service.mjs +7 -7
  70. package/esm2022/tools/component-replacement/c11n.token.mjs +2 -2
  71. package/esm2022/tools/component-replacement/index.mjs +3 -3
  72. package/esm2022/tools/pipes/capitalize/capitalize.module.mjs +7 -7
  73. package/esm2022/tools/pipes/capitalize/capitalize.pipe.mjs +8 -8
  74. package/esm2022/tools/pipes/duration/duration.module.mjs +7 -7
  75. package/esm2022/tools/pipes/duration/duration.pipe.mjs +10 -9
  76. package/esm2022/tools/pipes/keep-white-space/keep-white-space.module.mjs +7 -7
  77. package/esm2022/tools/pipes/keep-white-space/keep-white-space.pipe.mjs +8 -8
  78. package/esm2022/tools/pipes/replace-with-bold/replace-with-bold.module.mjs +7 -7
  79. package/esm2022/tools/pipes/replace-with-bold/replace-with-bold.pipe.mjs +9 -9
  80. package/esm2022/tools/placeholder/placeholder.component.mjs +18 -22
  81. package/esm2022/tools/placeholder/placeholder.interface.mjs +1 -1
  82. package/esm2022/tools/placeholder/placeholder.module.mjs +11 -11
  83. package/fesm2022/o3r-components-rules-engine.mjs +41 -36
  84. package/fesm2022/o3r-components-rules-engine.mjs.map +1 -1
  85. package/fesm2022/o3r-components.mjs +241 -244
  86. package/fesm2022/o3r-components.mjs.map +1 -1
  87. package/package.json +11 -11
  88. package/rules-engine/placeholder.action-handler.d.ts +1 -1
  89. package/rules-engine/placeholder.action-handler.d.ts.map +1 -1
  90. package/rules-engine/placeholder.interfaces.d.ts.map +1 -1
  91. package/rules-engine/placeholder.rules-engine.effect.d.ts +2 -2
  92. package/rules-engine/placeholder.rules-engine.effect.d.ts.map +1 -1
  93. package/rules-engine/placeholder.rules-engine.module.d.ts.map +1 -1
  94. package/rules-engine/public_api.d.ts +1 -1
  95. package/rules-engine/public_api.d.ts.map +1 -1
  96. package/schematics/cms-adapter/index.d.ts.map +1 -1
  97. package/schematics/cms-adapter/index.js +1 -1
  98. package/schematics/ng-add/helpers/devtools-registration.d.ts +0 -2
  99. package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -1
  100. package/schematics/ng-add/helpers/devtools-registration.js +1 -3
  101. package/schematics/ng-add/index.d.ts.map +1 -1
  102. package/schematics/ng-add/index.js +3 -4
  103. package/schematics/ng-add/schema.d.ts.map +1 -1
  104. package/schematics/ng-update/v10-0/index.d.ts.map +1 -1
  105. package/schematics/ng-update/v10-0/index.js +2 -1
  106. package/stores/index.d.ts +1 -1
  107. package/stores/index.d.ts.map +1 -1
  108. package/stores/placeholder-request/placeholder-request.actions.d.ts.map +1 -1
  109. package/stores/placeholder-request/placeholder-request.module.d.ts.map +1 -1
  110. package/stores/placeholder-request/placeholder-request.reducer.d.ts.map +1 -1
  111. package/stores/placeholder-request/placeholder-request.selectors.d.ts.map +1 -1
  112. package/stores/placeholder-request/placeholder-request.state.d.ts.map +1 -1
  113. package/stores/placeholder-request/placeholder-request.sync.d.ts +1 -1
  114. package/stores/placeholder-request/placeholder-request.sync.d.ts.map +1 -1
  115. package/stores/placeholder-template/placeholder-template.actions.d.ts.map +1 -1
  116. package/stores/placeholder-template/placeholder-template.module.d.ts.map +1 -1
  117. package/stores/placeholder-template/placeholder-template.reducer.d.ts.map +1 -1
  118. package/stores/placeholder-template/placeholder-template.selectors.d.ts.map +1 -1
  119. package/stores/placeholder-template/placeholder-template.state.d.ts.map +1 -1
  120. package/stores/placeholder-template/placeholder-template.sync.d.ts +2 -2
  121. package/stores/placeholder-template/placeholder-template.sync.d.ts.map +1 -1
  122. package/tools/component-replacement/c11n.directive.d.ts.map +1 -1
  123. package/tools/component-replacement/c11n.helpers.d.ts.map +1 -1
  124. package/tools/component-replacement/c11n.mock.module.d.ts.map +1 -1
  125. package/tools/component-replacement/c11n.module.d.ts +1 -0
  126. package/tools/component-replacement/c11n.module.d.ts.map +1 -1
  127. package/tools/component-replacement/c11n.service.d.ts.map +1 -1
  128. package/tools/component-replacement/c11n.token.d.ts.map +1 -1
  129. package/tools/component-replacement/index.d.ts +2 -2
  130. package/tools/component-replacement/index.d.ts.map +1 -1
  131. package/tools/pipes/capitalize/capitalize.module.d.ts.map +1 -1
  132. package/tools/pipes/capitalize/capitalize.pipe.d.ts.map +1 -1
  133. package/tools/pipes/duration/duration.module.d.ts.map +1 -1
  134. package/tools/pipes/duration/duration.pipe.d.ts +1 -0
  135. package/tools/pipes/duration/duration.pipe.d.ts.map +1 -1
  136. package/tools/pipes/keep-white-space/keep-white-space.module.d.ts.map +1 -1
  137. package/tools/pipes/keep-white-space/keep-white-space.pipe.d.ts.map +1 -1
  138. package/tools/pipes/replace-with-bold/replace-with-bold.module.d.ts.map +1 -1
  139. package/tools/pipes/replace-with-bold/replace-with-bold.pipe.d.ts.map +1 -1
  140. package/tools/placeholder/placeholder.component.d.ts.map +1 -1
  141. package/tools/placeholder/placeholder.interface.d.ts.map +1 -1
  142. package/tools/placeholder/placeholder.module.d.ts.map +1 -1
@@ -1,6 +1,6 @@
1
1
  import { logging } from '@angular-devkit/core';
2
- import type { ComponentStructure } from '@o3r/components';
3
2
  import * as ts from 'typescript';
3
+ import type { ComponentStructure } from '@o3r/components';
4
4
  /** Information extracted from a component file */
5
5
  export interface ComponentInformation {
6
6
  /** Name of the component */
@@ -34,6 +34,7 @@ export declare class ComponentClassExtractor {
34
34
  /** List of interfaces that a configurable component can implement */
35
35
  readonly CONFIGURABLE_INTERFACES: string[];
36
36
  /**
37
+ * Component class extractor constructor
37
38
  * @param source Typescript SourceFile node of the file
38
39
  * @param logger Logger
39
40
  * @param filePath Path to the file to extract the data from
@@ -41,26 +42,22 @@ export declare class ComponentClassExtractor {
41
42
  constructor(source: ts.SourceFile, logger: logging.LoggerApi, filePath: string);
42
43
  /**
43
44
  * Indicates if the given decorator is a component decorator.
44
- *
45
45
  * @param decoratorNode The decorator node to test
46
46
  */
47
47
  private isComponentDecorator;
48
48
  /**
49
49
  * Get the component type from the given decorator node.
50
- *
51
50
  * @param decoratorNode The decorator node to get the component type from
52
51
  */
53
52
  private getComponentType;
54
53
  /**
55
54
  * Get the component selector from the given decorator node.
56
- *
57
55
  * @param decoratorNode The decorator node to get the component selector from
58
56
  */
59
57
  private getComponentSelector;
60
58
  /**
61
59
  * Sanitize component type by removing extra quotes
62
60
  * Example: "'Page'" becomes 'Page'
63
- *
64
61
  * @param type
65
62
  * @private
66
63
  */
@@ -68,15 +65,12 @@ export declare class ComponentClassExtractor {
68
65
  private getComponentStructure;
69
66
  /**
70
67
  * Extract component information of a given class node
71
- *
72
68
  * @param classNode Typescript node of a class
73
69
  */
74
70
  private getComponentInformation;
75
71
  /**
76
72
  * Get the file path of the given class from the import
77
- *
78
- * @param contextName Name of the class to find in the imports
79
- * @param className
73
+ * @param className Name of the class to find in the imports
80
74
  */
81
75
  private getFilePath;
82
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"component-class.extractor.d.ts","sourceRoot":"","sources":["../../../../../builders/component-extractor/helpers/component/component-class.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1D,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,eAAe,EAAE,OAAO,CAAC;IACzB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,IAAI,EAAE,kBAAkB,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAUf,MAAM,EAAE,EAAE,CAAC,UAAU;IAAE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA4B,QAAQ,EAAE,MAAM;IAR7G,qEAAqE;IACrE,SAAgB,uBAAuB,EAAE,MAAM,EAAE,CAA4E;IAE7H;;;;OAIG;gBACgB,MAAM,EAAE,EAAE,CAAC,UAAU,EAAmB,MAAM,EAAE,OAAO,CAAC,SAAS,EAAS,QAAQ,EAAE,MAAM;IAG7G;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAexB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,qBAAqB;IAc7B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAwD/B;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAsBnB;;OAEG;IACI,OAAO;CAkBf"}
1
+ {"version":3,"file":"component-class.extractor.d.ts","sourceRoot":"","sources":["../../../../../builders/component-extractor/helpers/component/component-class.extractor.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EACR,MAAM,sBAAsB,C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AAC,WAAW;IAoBnB;;OAEG;IACI,OAAO;CAiBf"}
@@ -2,16 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentClassExtractor = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const extractors_1 = require("@o3r/extractors");
6
- const schematics_1 = require("@o3r/schematics");
7
5
  const fs = tslib_1.__importStar(require("node:fs"));
8
6
  const path = tslib_1.__importStar(require("node:path"));
7
+ const extractors_1 = require("@o3r/extractors");
8
+ const schematics_1 = require("@o3r/schematics");
9
9
  const ts = tslib_1.__importStar(require("typescript"));
10
10
  /**
11
11
  * Component class extractor.
12
12
  */
13
13
  class ComponentClassExtractor {
14
14
  /**
15
+ * Component class extractor constructor
15
16
  * @param source Typescript SourceFile node of the file
16
17
  * @param logger Logger
17
18
  * @param filePath Path to the file to extract the data from
@@ -25,7 +26,6 @@ class ComponentClassExtractor {
25
26
  }
26
27
  /**
27
28
  * Indicates if the given decorator is a component decorator.
28
- *
29
29
  * @param decoratorNode The decorator node to test
30
30
  */
31
31
  isComponentDecorator(decoratorNode) {
@@ -33,29 +33,25 @@ class ComponentClassExtractor {
33
33
  }
34
34
  /**
35
35
  * Get the component type from the given decorator node.
36
- *
37
36
  * @param decoratorNode The decorator node to get the component type from
38
37
  */
39
38
  getComponentType(decoratorNode) {
40
- if (ts.isCallExpression(decoratorNode.expression)) {
41
- if (decoratorNode.expression.expression.getText(this.source) === 'O3rComponent') {
42
- const arg1 = decoratorNode.expression.arguments[0];
43
- if (ts.isObjectLiteralExpression(arg1)) {
44
- return this.getComponentStructure(arg1.properties
45
- .find((prop) => prop.name?.getText(this.source) === 'componentType')
46
- ?.initializer.getText(this.source));
47
- }
39
+ if (ts.isCallExpression(decoratorNode.expression) && decoratorNode.expression.expression.getText(this.source) === 'O3rComponent') {
40
+ const arg1 = decoratorNode.expression.arguments[0];
41
+ if (ts.isObjectLiteralExpression(arg1)) {
42
+ return this.getComponentStructure(arg1.properties
43
+ .find((prop) => prop.name?.getText(this.source) === 'componentType')
44
+ ?.initializer.getText(this.source));
48
45
  }
49
46
  }
50
47
  }
51
48
  /**
52
49
  * Get the component selector from the given decorator node.
53
- *
54
50
  * @param decoratorNode The decorator node to get the component selector from
55
51
  */
56
52
  getComponentSelector(decoratorNode) {
57
53
  if (this.isComponentDecorator(decoratorNode)) {
58
- const matches = /selector:\s*['"](.*)['"]/.exec(decoratorNode.getText(this.source));
54
+ const matches = /selector:\s*["'](.*)["']/.exec(decoratorNode.getText(this.source));
59
55
  if (matches) {
60
56
  return matches[1];
61
57
  }
@@ -64,7 +60,6 @@ class ComponentClassExtractor {
64
60
  /**
65
61
  * Sanitize component type by removing extra quotes
66
62
  * Example: "'Page'" becomes 'Page'
67
- *
68
63
  * @param type
69
64
  * @private
70
65
  */
@@ -72,24 +67,27 @@ class ComponentClassExtractor {
72
67
  if (!type) {
73
68
  return;
74
69
  }
75
- return type.replaceAll(/['"]/g, '');
70
+ return type.replaceAll(/["']/g, '');
76
71
  }
77
72
  getComponentStructure(type) {
78
73
  const sanitizedType = this.sanitizeComponentType(type);
79
74
  switch (sanitizedType) {
80
- case 'Block':
75
+ case 'Block': {
81
76
  return 'BLOCK';
82
- case 'Page':
77
+ }
78
+ case 'Page': {
83
79
  return 'PAGE';
84
- case 'ExposedComponent':
80
+ }
81
+ case 'ExposedComponent': {
85
82
  return 'EXPOSED_COMPONENT';
86
- default:
83
+ }
84
+ default: {
87
85
  return 'COMPONENT';
86
+ }
88
87
  }
89
88
  }
90
89
  /**
91
90
  * Extract component information of a given class node
92
- *
93
91
  * @param classNode Typescript node of a class
94
92
  */
95
93
  getComponentInformation(classNode) {
@@ -107,16 +105,17 @@ class ComponentClassExtractor {
107
105
  const interfaceValue = implNode.getText(this.source);
108
106
  if (!configName && regExp.test(interfaceValue)) {
109
107
  configName = interfaceValue.replace(/.*<(.*?)\s*(,\s*('\w*')\s*)?>.*/, '$1');
110
- isDynamic = /^Dynamic/.test(interfaceValue);
108
+ isDynamic = interfaceValue.startsWith('Dynamic');
111
109
  }
112
110
  else if (!contextName && interfaceValue.endsWith('Context')) {
113
111
  contextName = interfaceValue;
114
112
  }
115
113
  else {
116
114
  switch (interfaceValue) {
117
- case 'LinkableToRuleset':
115
+ case 'LinkableToRuleset': {
118
116
  linkableToRuleset = true;
119
117
  break;
118
+ }
120
119
  }
121
120
  }
122
121
  });
@@ -138,19 +137,19 @@ class ComponentClassExtractor {
138
137
  const localizationFiles = (0, extractors_1.getLocalizationFileFromAngularElement)(classNode);
139
138
  const localizationKeys = (localizationFiles || []).reduce((acc, file) => {
140
139
  const resolvedFilePath = path.resolve(path.dirname(this.filePath), file);
141
- const data = JSON.parse(fs.readFileSync(resolvedFilePath, 'utf-8'));
140
+ const data = JSON.parse(fs.readFileSync(resolvedFilePath, 'utf8'));
142
141
  return acc.concat(Object.keys(data));
143
142
  }, []);
144
- return name && type ? {
145
- name, configName, contextName, isDynamicConfig: isDynamic, type, selector, linkableToRuleset,
146
- ...(localizationKeys.length ? { localizationKeys } : {})
147
- } : undefined;
143
+ return name && type
144
+ ? {
145
+ name, configName, contextName, isDynamicConfig: isDynamic, type, selector, linkableToRuleset,
146
+ ...(localizationKeys.length > 0 ? { localizationKeys } : {})
147
+ }
148
+ : undefined;
148
149
  }
149
150
  /**
150
151
  * Get the file path of the given class from the import
151
- *
152
- * @param contextName Name of the class to find in the imports
153
- * @param className
152
+ * @param className Name of the class to find in the imports
154
153
  */
155
154
  getFilePath(className) {
156
155
  if (!className) {
@@ -158,15 +157,13 @@ class ComponentClassExtractor {
158
157
  }
159
158
  let res;
160
159
  this.source.forEachChild((node) => {
161
- if (!res && ts.isImportDeclaration(node)) {
162
- if (new RegExp(className).test(node.getText(this.source))) {
163
- const children = node.getChildren(this.source);
164
- res = children[children.length - 2].getText(this.source).replace(/^['"](.*)['"]/, '$1');
165
- }
160
+ if (!res && ts.isImportDeclaration(node) && new RegExp(className).test(node.getText(this.source))) {
161
+ const children = node.getChildren(this.source);
162
+ res = children.at(-2)?.getText(this.source).replace(/^["'](.*)["']/, '$1');
166
163
  }
167
164
  });
168
165
  if (res && /^\./.test(res)) {
169
- res = path.resolve(path.dirname(this.filePath), `${res}.ts`).replace(/[\\/]/g, '/');
166
+ res = path.resolve(path.dirname(this.filePath), `${res}.ts`).replace(/[/\\]/g, '/');
170
167
  }
171
168
  return res;
172
169
  }
@@ -1,7 +1,7 @@
1
1
  import { logging } from '@angular-devkit/core';
2
- import type { ConfigProperty } from '@o3r/components';
3
2
  import type { CategoryDescription } from '@o3r/core';
4
3
  import * as ts from 'typescript';
4
+ import type { ConfigProperty } from '@o3r/components';
5
5
  /** Information extracted from a configuration file */
6
6
  export interface ConfigurationInformation {
7
7
  /** Name of the configuration */
@@ -16,7 +16,6 @@ export interface ConfigurationInformation {
16
16
  categories?: CategoryDescription[];
17
17
  /**
18
18
  * Determine if the configuration is runtime
19
- *
20
19
  * @note the current implementation set this value as `undefined` for all the components (only AppBuildConfiguration is set to `false` and AppRuntimeConfiguration is set to `true`)
21
20
  */
22
21
  runtime?: boolean;
@@ -56,6 +55,7 @@ export declare class ComponentConfigExtractor {
56
55
  /** Parser of configuration doc */
57
56
  private readonly configDocParser;
58
57
  /**
58
+ * Configuration file extractor constructor
59
59
  * @param libraryName
60
60
  * @param strictMode
61
61
  * @param source Typescript SourceFile node of the file
@@ -67,20 +67,17 @@ export declare class ComponentConfigExtractor {
67
67
  constructor(libraryName: string, strictMode: boolean, source: ts.SourceFile, logger: logging.LoggerApi, filePath: string, checker: ts.TypeChecker, libraries?: string[]);
68
68
  /**
69
69
  * Handle error cases depending on the mode: throwing errors or logging warnings
70
- *
71
70
  * @param message the warning message to be logged
72
71
  * @param errorMessage the error message to be thrown. If not provided, the warning one will be used
73
72
  */
74
73
  private handleErrorCases;
75
74
  /**
76
75
  * Verifies if an UnionType has strings elements.
77
- *
78
76
  * @param node Typescript node to be checked
79
77
  */
80
78
  private hasStringElements;
81
79
  /**
82
80
  * Returns the name of the symbol
83
- *
84
81
  * @param symbol
85
82
  */
86
83
  private getSymbolName;
@@ -88,7 +85,6 @@ export declare class ComponentConfigExtractor {
88
85
  * Get the type from a property
89
86
  * If the type refers to a NestedConfiguration type, then it will be replaced with element
90
87
  * and a reference to the object will be returned
91
- *
92
88
  * @param node Typescript node to extract the data from
93
89
  * @param configurationWrapper the configuration wrapper containing nestedConfig and union type strings
94
90
  * @param source
@@ -96,7 +92,6 @@ export declare class ComponentConfigExtractor {
96
92
  private getTypeFromNode;
97
93
  /**
98
94
  * Extract the property data from an interface property signature
99
- *
100
95
  * @param propertyNode Node to extract the data from
101
96
  * @param configurationWrapper the configuration wrapper containing nestedConfig and union type strings
102
97
  * @param source
@@ -104,14 +99,12 @@ export declare class ComponentConfigExtractor {
104
99
  private extractPropertySignatureData;
105
100
  /**
106
101
  * Extract the possible options in case of an enum node
107
- *
108
102
  * @param node Node to extract the data from
109
103
  * @param source
110
104
  */
111
105
  private extractOptionsForEnum;
112
106
  /**
113
107
  * Get the configuration properties from a given interface node
114
- *
115
108
  * @param interfaceNode Node of a typescript interface
116
109
  * @param configurationWrapper
117
110
  * @param source
@@ -119,20 +112,17 @@ export declare class ComponentConfigExtractor {
119
112
  private getPropertiesFromConfigurationInterface;
120
113
  /**
121
114
  * Extract the default value of a configuration interface
122
- *
123
115
  * @param variableNode Typescript node of the default constant implementing the interface
124
116
  * @param configurationInformationWrapper Configuration object extracted from the interface
125
117
  */
126
118
  private getDefaultValueFromConfigurationInterface;
127
119
  /**
128
120
  * Remove all quotation marks from the input string to prevent any ""my_string"" and "'my_string'" in the metadata file
129
- *
130
121
  * @param inputString that needs to be format
131
122
  */
132
123
  private removeQuotationMarks;
133
124
  /**
134
125
  * Check is name is typed as a known nested configuration
135
- *
136
126
  * @param propertyName
137
127
  * @param nestedConfiguration List of nested configuration
138
128
  * @param libraries
@@ -140,7 +130,6 @@ export declare class ComponentConfigExtractor {
140
130
  private isTypedNestedConfiguration;
141
131
  /**
142
132
  * This function checks if the interface name given as parameter is extended by the interface node
143
- *
144
133
  * @param interfaceDeclaration
145
134
  * @param extendedInterfaceNames
146
135
  * @param source
@@ -148,13 +137,11 @@ export declare class ComponentConfigExtractor {
148
137
  private isExtending;
149
138
  /**
150
139
  * Fill the nested configuration with default values
151
- *
152
140
  * @param nestedConfigurationInformation
153
141
  */
154
142
  private fillNestedConfigurationDefaultValues;
155
143
  /**
156
144
  * Collect nested configuration information
157
- *
158
145
  * @param source
159
146
  */
160
147
  private collectNestedConfiguration;
@@ -1 +1 @@
1
- {"version":3,"file":"component-config.extractor.d.ts","sourceRoot":"","sources":["../../../../../builders/component-extractor/helpers/component/component-config.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAwD,MAAM,iBAAiB,CAAC;AAC5G,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,WAAW,CAAC;AAIrE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,sDAAsD;AACtD,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,8CAA8C;IAC9C,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,OAAO,EAAE,MAAM,EAAE,CAAC;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C;;;;;OAKG;IACH,OAAO,CAAC,yCAAyC;IAwEjD;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAyBlC;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAWnB;;;;OAIG;IACH,OAAO,CAAC,oCAAoC;IA2B5C;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IA0BlC;;OAEG;IACI,OAAO;CA0Bf"}
1
+ {"version":3,"file":"component-config.extractor.d.ts","sourceRoot":"","sources":["../../../../../builders/component-extractor/helpers/component/component-config.extractor.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AAOnB,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,iBAAiB,CAAC;AAEzB,sDAAsD;AACtD,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,8CAA8C;IAC9C,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,iEAAiE;AACjE,MAAM,WA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jD;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IAyBlC;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAWnB;;;OAGG;IACH,OAAO,CAAC,oCAAoC;IA2B5C;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAwBlC;;OAEG;IACI,OAAO;CA0Bf"}
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentConfigExtractor = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const node_fs_1 = require("node:fs");
5
6
  const extractors_1 = require("@o3r/extractors");
6
7
  const schematics_1 = require("@o3r/schematics");
7
- const node_fs_1 = require("node:fs");
8
8
  const ts = tslib_1.__importStar(require("typescript"));
9
9
  /** Configuration file extractor */
10
10
  class ComponentConfigExtractor {
11
11
  /**
12
+ * Configuration file extractor constructor
12
13
  * @param libraryName
13
14
  * @param strictMode
14
15
  * @param source Typescript SourceFile node of the file
@@ -35,21 +36,19 @@ class ComponentConfigExtractor {
35
36
  }
36
37
  /**
37
38
  * Handle error cases depending on the mode: throwing errors or logging warnings
38
- *
39
39
  * @param message the warning message to be logged
40
40
  * @param errorMessage the error message to be thrown. If not provided, the warning one will be used
41
41
  */
42
42
  handleErrorCases(message, errorMessage) {
43
- if (!this.strictMode) {
44
- this.logger.warn(`${message.replace(/([^.])$/, '$1.')} Will throw in strict mode.`);
43
+ if (this.strictMode) {
44
+ throw new schematics_1.O3rCliError(errorMessage || message);
45
45
  }
46
46
  else {
47
- throw new schematics_1.O3rCliError(errorMessage || message);
47
+ this.logger.warn(`${message.replace(/([^.])$/, '$1.')} Will throw in strict mode.`);
48
48
  }
49
49
  }
50
50
  /**
51
51
  * Verifies if an UnionType has strings elements.
52
- *
53
52
  * @param node Typescript node to be checked
54
53
  */
55
54
  hasStringElements(node) {
@@ -57,7 +56,6 @@ class ComponentConfigExtractor {
57
56
  }
58
57
  /**
59
58
  * Returns the name of the symbol
60
- *
61
59
  * @param symbol
62
60
  */
63
61
  getSymbolName(symbol) {
@@ -67,7 +65,6 @@ class ComponentConfigExtractor {
67
65
  * Get the type from a property
68
66
  * If the type refers to a NestedConfiguration type, then it will be replaced with element
69
67
  * and a reference to the object will be returned
70
- *
71
68
  * @param node Typescript node to extract the data from
72
69
  * @param configurationWrapper the configuration wrapper containing nestedConfig and union type strings
73
70
  * @param source
@@ -89,9 +86,9 @@ class ComponentConfigExtractor {
89
86
  && this.libraries.includes(statement.moduleSpecifier.text)
90
87
  && !!statement.importClause?.namedBindings
91
88
  && ts.isNamedImports(statement.importClause.namedBindings)
92
- && !!statement.importClause.namedBindings.elements.find((nameBinding) => ts.isImportSpecifier(nameBinding)
89
+ && !!statement.importClause.namedBindings.elements.some((nameBinding) => ts.isImportSpecifier(nameBinding)
93
90
  && ts.isIdentifier(nameBinding.name)
94
- && nameBinding.name.escapedText === typeNode.typeName.getText()));
91
+ && nameBinding.name.escapedText.toString() === typeNode.typeName.getText()));
95
92
  if (importFromLibraries) {
96
93
  return {
97
94
  type: 'element[]',
@@ -105,7 +102,7 @@ class ComponentConfigExtractor {
105
102
  const type = this.checker.getTypeFromTypeNode(typeNode);
106
103
  const baseTypes = type.getBaseTypes();
107
104
  const symbolName = this.getSymbolName(type.symbol || type.aliasSymbol);
108
- const alreadyExtracted = !!configurationWrapper.nestedConfiguration.find((c) => c.name === symbolName);
105
+ const alreadyExtracted = configurationWrapper.nestedConfiguration.some((c) => c.name === symbolName);
109
106
  const extendsNested = !!baseTypes?.some((baseType) => this.getSymbolName(baseType.symbol).match(/^NestedConfiguration$/));
110
107
  if (extendsNested && !alreadyExtracted) {
111
108
  const nestedFilePath = type.symbol.parent.declarations[0].fileName;
@@ -139,7 +136,7 @@ class ComponentConfigExtractor {
139
136
  if (nodeType.isUnion()) {
140
137
  return {
141
138
  type: 'enum',
142
- choices: nodeType.types.map((type) => type.isLiteral() && type.isStringLiteral() && type.value || '')
139
+ choices: nodeType.types.map((type) => (type.isLiteral() && type.isStringLiteral() && type.value) || '')
143
140
  };
144
141
  }
145
142
  return { type: this.DEFAULT_UNKNOWN_TYPE };
@@ -168,7 +165,6 @@ class ComponentConfigExtractor {
168
165
  }
169
166
  /**
170
167
  * Extract the property data from an interface property signature
171
- *
172
168
  * @param propertyNode Node to extract the data from
173
169
  * @param configurationWrapper the configuration wrapper containing nestedConfig and union type strings
174
170
  * @param source
@@ -179,7 +175,7 @@ class ComponentConfigExtractor {
179
175
  const res = {
180
176
  description: configDocInfo?.description || '',
181
177
  category: configDocInfo?.category,
182
- label: configDocInfo?.label ? configDocInfo.label : name.replace(/([A-Z])/g, ' $1'),
178
+ label: configDocInfo?.label || name.replace(/([A-Z])/g, ' $1'),
183
179
  name,
184
180
  type: 'unknown',
185
181
  widget: configDocInfo?.widget,
@@ -200,7 +196,6 @@ class ComponentConfigExtractor {
200
196
  }
201
197
  /**
202
198
  * Extract the possible options in case of an enum node
203
- *
204
199
  * @param node Node to extract the data from
205
200
  * @param source
206
201
  */
@@ -218,7 +213,6 @@ class ComponentConfigExtractor {
218
213
  }
219
214
  /**
220
215
  * Get the configuration properties from a given interface node
221
- *
222
216
  * @param interfaceNode Node of a typescript interface
223
217
  * @param configurationWrapper
224
218
  * @param source
@@ -238,19 +232,14 @@ class ComponentConfigExtractor {
238
232
  const content = extendedInterfaceNode.getText(source);
239
233
  isConfiguration = isConfiguration || this.CONFIGURATION_INTERFACES.some((r) => r.test(content));
240
234
  if (typeof runtime === 'undefined') {
241
- if (new RegExp('AppBuildConfiguration').test(content)) {
242
- runtime = false;
243
- }
244
- else {
245
- runtime = new RegExp('AppRuntimeConfiguration').test(content) || undefined;
246
- }
235
+ runtime = new RegExp('AppBuildConfiguration').test(content) ? false : new RegExp('AppRuntimeConfiguration').test(content) || undefined;
247
236
  }
248
237
  });
249
238
  }
250
239
  else if (isConfiguration && ts.isPropertySignature(node)) {
251
240
  const property = this.extractPropertySignatureData(node, configurationWrapper, source);
252
241
  properties.push(property);
253
- if (property.category && categoriesOnProps.indexOf(property.category) === -1) {
242
+ if (property.category && !categoriesOnProps.includes(property.category)) {
254
243
  categoriesOnProps.push(property.category);
255
244
  }
256
245
  }
@@ -265,7 +254,7 @@ class ComponentConfigExtractor {
265
254
  const configDocInfo = this.configDocParser.parseConfigDocFromNode(source, interfaceNode);
266
255
  if (configDocInfo && configDocInfo.categories) {
267
256
  for (const describedCategory of configDocInfo.categories) {
268
- if (categoriesOnProps.indexOf(describedCategory.name) === -1) {
257
+ if (!categoriesOnProps.includes(describedCategory.name)) {
269
258
  this.handleErrorCases(`Description found for category "${describedCategory.name}" but no property has this category.`);
270
259
  }
271
260
  }
@@ -274,7 +263,6 @@ class ComponentConfigExtractor {
274
263
  }
275
264
  /**
276
265
  * Extract the default value of a configuration interface
277
- *
278
266
  * @param variableNode Typescript node of the default constant implementing the interface
279
267
  * @param configurationInformationWrapper Configuration object extracted from the interface
280
268
  */
@@ -312,10 +300,8 @@ class ComponentConfigExtractor {
312
300
  && this.isTypedNestedConfiguration(property.reference.name, configurationInformationWrapper, this.libraries)) {
313
301
  let defaultValuesMapArrayItem = {};
314
302
  arrayItem.forEachChild((arrayItemProperty) => {
315
- if (ts.isPropertyAssignment(arrayItemProperty)) {
316
- if (ts.isStringLiteral(arrayItemProperty.name)) {
317
- arrayItemProperty.name.getText(this.source);
318
- }
303
+ if (ts.isPropertyAssignment(arrayItemProperty) && ts.isStringLiteral(arrayItemProperty.name)) {
304
+ arrayItemProperty.name.getText(this.source);
319
305
  }
320
306
  // Build the property map pushing all the key/value from the default config
321
307
  // getChildAt(0, this.source) is the key, getChildAt(1, this.source) the ":" and getChildAt(2, this.source) the value
@@ -327,7 +313,7 @@ class ComponentConfigExtractor {
327
313
  property.values.push(defaultValuesMapArrayItem);
328
314
  }
329
315
  else {
330
- console.warn(`Unsupported type found will be ignored with kind = ${arrayItem.kind} and value = ${arrayItem.getText(this.source)}`);
316
+ this.logger.warn(`Unsupported type found will be ignored with kind = ${arrayItem.kind} and value = ${arrayItem.getText(this.source)}`);
331
317
  }
332
318
  });
333
319
  if (typeReplacement) {
@@ -352,15 +338,13 @@ class ComponentConfigExtractor {
352
338
  }
353
339
  /**
354
340
  * Remove all quotation marks from the input string to prevent any ""my_string"" and "'my_string'" in the metadata file
355
- *
356
341
  * @param inputString that needs to be format
357
342
  */
358
343
  removeQuotationMarks(inputString) {
359
- return inputString.replace(/^['"](.*)['"]$/, '$1');
344
+ return inputString.replace(/^["'](.*)["']$/, '$1');
360
345
  }
361
346
  /**
362
347
  * Check is name is typed as a known nested configuration
363
- *
364
348
  * @param propertyName
365
349
  * @param nestedConfiguration List of nested configuration
366
350
  * @param libraries
@@ -388,7 +372,6 @@ class ComponentConfigExtractor {
388
372
  }
389
373
  /**
390
374
  * This function checks if the interface name given as parameter is extended by the interface node
391
- *
392
375
  * @param interfaceDeclaration
393
376
  * @param extendedInterfaceNames
394
377
  * @param source
@@ -405,7 +388,6 @@ class ComponentConfigExtractor {
405
388
  }
406
389
  /**
407
390
  * Fill the nested configuration with default values
408
- *
409
391
  * @param nestedConfigurationInformation
410
392
  */
411
393
  fillNestedConfigurationDefaultValues(nestedConfigurationInformation) {
@@ -436,7 +418,6 @@ class ComponentConfigExtractor {
436
418
  }
437
419
  /**
438
420
  * Collect nested configuration information
439
- *
440
421
  * @param source
441
422
  */
442
423
  collectNestedConfiguration(source) {
@@ -448,15 +429,13 @@ class ComponentConfigExtractor {
448
429
  choices: this.extractOptionsForEnum(node.type, source)
449
430
  });
450
431
  }
451
- if (ts.isInterfaceDeclaration(node)) {
452
- // If it extends NestedConfiguration, we consider it as an independent NestedConfig
453
- if (this.isExtending(node, [/NestedConfiguration/], source)) {
454
- let nestedConfigurationInformation = this.getPropertiesFromConfigurationInterface(node, configurationInformationWrapper, source);
455
- nestedConfigurationInformation = this.fillNestedConfigurationDefaultValues(nestedConfigurationInformation);
456
- if (nestedConfigurationInformation) {
457
- // We add it to the list of Nested config if the result is not undefined
458
- configurationInformationWrapper.nestedConfiguration.push(nestedConfigurationInformation);
459
- }
432
+ if (ts.isInterfaceDeclaration(node) // If it extends NestedConfiguration, we consider it as an independent NestedConfig
433
+ && this.isExtending(node, [/NestedConfiguration/], source)) {
434
+ let nestedConfigurationInformation = this.getPropertiesFromConfigurationInterface(node, configurationInformationWrapper, source);
435
+ nestedConfigurationInformation = this.fillNestedConfigurationDefaultValues(nestedConfigurationInformation);
436
+ if (nestedConfigurationInformation) {
437
+ // We add it to the list of Nested config if the result is not undefined
438
+ configurationInformationWrapper.nestedConfiguration.push(nestedConfigurationInformation);
460
439
  }
461
440
  }
462
441
  });