@stencil/angular-output-target 0.7.2-dev.11691686917.1045ccb9 → 0.8.0

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.
@@ -70,7 +70,6 @@ export class ${tagNameAsPascal} {
70
70
  * @returns The sanitized event type as a string.
71
71
  */
72
72
  const formatOutputType = (componentClassName, event) => {
73
- const prefix = `I${componentClassName}`;
74
73
  /**
75
74
  * The original attribute contains the original type defined by the devs.
76
75
  * This regexp normalizes the reference, by removing linebreaks,
@@ -79,24 +78,11 @@ const formatOutputType = (componentClassName, event) => {
79
78
  return Object.entries(event.complexType.references)
80
79
  .filter(([_, refObject]) => refObject.location === 'local' || refObject.location === 'import')
81
80
  .reduce((type, [src, dst]) => {
82
- let renamedType = type;
83
- if (!type.startsWith(prefix)) {
84
- renamedType = `I${componentClassName}${type}`;
85
- }
81
+ const renamedType = `I${componentClassName}${type}`;
86
82
  return (renamedType
87
83
  .replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
88
84
  // Capture all instances of the `src` field surrounded by non-word characters on each side and join them.
89
- .replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => {
90
- if ((dst === null || dst === void 0 ? void 0 : dst.location) === 'import') {
91
- /**
92
- * Replaces a complex type reference within a generic type.
93
- * For example, remapping a type like `EventEmitter<CustomEvent<MyEvent<T>>>` to
94
- * `EventEmitter<CustomEvent<IMyComponentMyEvent<IMyComponentT>>`.
95
- */
96
- return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
97
- }
98
- return [p1, dst, p2].join('');
99
- }));
85
+ .replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join('')));
100
86
  }, event.complexType.original
101
87
  .replace(/\n/g, ' ')
102
88
  .replace(/\s{2,}/g, ' ')
package/dist/index.cjs.js CHANGED
@@ -215,7 +215,6 @@ export class ${tagNameAsPascal} {
215
215
  * @returns The sanitized event type as a string.
216
216
  */
217
217
  const formatOutputType = (componentClassName, event) => {
218
- const prefix = `I${componentClassName}`;
219
218
  /**
220
219
  * The original attribute contains the original type defined by the devs.
221
220
  * This regexp normalizes the reference, by removing linebreaks,
@@ -224,24 +223,11 @@ const formatOutputType = (componentClassName, event) => {
224
223
  return Object.entries(event.complexType.references)
225
224
  .filter(([_, refObject]) => refObject.location === 'local' || refObject.location === 'import')
226
225
  .reduce((type, [src, dst]) => {
227
- let renamedType = type;
228
- if (!type.startsWith(prefix)) {
229
- renamedType = `I${componentClassName}${type}`;
230
- }
226
+ const renamedType = `I${componentClassName}${type}`;
231
227
  return (renamedType
232
228
  .replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
233
229
  // Capture all instances of the `src` field surrounded by non-word characters on each side and join them.
234
- .replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => {
235
- if ((dst === null || dst === void 0 ? void 0 : dst.location) === 'import') {
236
- /**
237
- * Replaces a complex type reference within a generic type.
238
- * For example, remapping a type like `EventEmitter<CustomEvent<MyEvent<T>>>` to
239
- * `EventEmitter<CustomEvent<IMyComponentMyEvent<IMyComponentT>>`.
240
- */
241
- return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
242
- }
243
- return [p1, dst, p2].join('');
244
- }));
230
+ .replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join('')));
245
231
  }, event.complexType.original
246
232
  .replace(/\n/g, ' ')
247
233
  .replace(/\s{2,}/g, ' ')
package/dist/index.js CHANGED
@@ -207,7 +207,6 @@ export class ${tagNameAsPascal} {
207
207
  * @returns The sanitized event type as a string.
208
208
  */
209
209
  const formatOutputType = (componentClassName, event) => {
210
- const prefix = `I${componentClassName}`;
211
210
  /**
212
211
  * The original attribute contains the original type defined by the devs.
213
212
  * This regexp normalizes the reference, by removing linebreaks,
@@ -216,24 +215,11 @@ const formatOutputType = (componentClassName, event) => {
216
215
  return Object.entries(event.complexType.references)
217
216
  .filter(([_, refObject]) => refObject.location === 'local' || refObject.location === 'import')
218
217
  .reduce((type, [src, dst]) => {
219
- let renamedType = type;
220
- if (!type.startsWith(prefix)) {
221
- renamedType = `I${componentClassName}${type}`;
222
- }
218
+ const renamedType = `I${componentClassName}${type}`;
223
219
  return (renamedType
224
220
  .replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
225
221
  // Capture all instances of the `src` field surrounded by non-word characters on each side and join them.
226
- .replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => {
227
- if ((dst === null || dst === void 0 ? void 0 : dst.location) === 'import') {
228
- /**
229
- * Replaces a complex type reference within a generic type.
230
- * For example, remapping a type like `EventEmitter<CustomEvent<MyEvent<T>>>` to
231
- * `EventEmitter<CustomEvent<IMyComponentMyEvent<IMyComponentT>>`.
232
- */
233
- return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
234
- }
235
- return [p1, dst, p2].join('');
236
- }));
222
+ .replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join('')));
237
223
  }, event.complexType.original
238
224
  .replace(/\n/g, ' ')
239
225
  .replace(/\s{2,}/g, ' ')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/angular-output-target",
3
- "version": "0.7.2-dev.11691686917.1045ccb9",
3
+ "version": "0.8.0",
4
4
  "description": "Angular output target for @stencil/core components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -58,7 +58,7 @@
58
58
  ],
59
59
  "testURL": "http://localhost"
60
60
  },
61
- "gitHead": "045ccb908869f12cc45c6f67fb99d1dcf5e23427",
61
+ "gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0",
62
62
  "volta": {
63
63
  "extends": "../../package.json"
64
64
  }