@stencil/angular-output-target
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -73,2 +73,3 @@ import { createComponentEventTypeImports, dashToPascalCase, formatToQuotedList } from './utils'; | ||
const formatOutputType = (componentClassName, event) => { | ||
const prefix = `I${componentClassName}`; | ||
/** | ||
@@ -82,7 +83,20 @@ * The original attribute contains the original type defined by the devs. | ||
.reduce((type, [src, dst]) => { | ||
const renamedType = `I${componentClassName}${type}`; | ||
let renamedType = type; | ||
if (!type.startsWith(prefix)) { | ||
renamedType = `I${componentClassName}${type}`; | ||
} | ||
return (renamedType | ||
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`) | ||
// Capture all instances of the `src` field surrounded by non-word characters on each side and join them. | ||
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join(''))); | ||
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => { | ||
if ((dst === null || dst === void 0 ? void 0 : dst.location) === 'import') { | ||
/** | ||
* Replaces a complex type reference within a generic type. | ||
* For example, remapping a type like `EventEmitter<CustomEvent<MyEvent<T>>>` to | ||
* `EventEmitter<CustomEvent<IMyComponentMyEvent<IMyComponentT>>>`. | ||
*/ | ||
return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join(''); | ||
} | ||
return [p1, dst, p2].join(''); | ||
})); | ||
}, event.complexType.original | ||
@@ -89,0 +103,0 @@ .replace(/\n/g, ' ') |
@@ -218,2 +218,3 @@ 'use strict'; | ||
const formatOutputType = (componentClassName, event) => { | ||
const prefix = `I${componentClassName}`; | ||
/** | ||
@@ -227,7 +228,20 @@ * The original attribute contains the original type defined by the devs. | ||
.reduce((type, [src, dst]) => { | ||
const renamedType = `I${componentClassName}${type}`; | ||
let renamedType = type; | ||
if (!type.startsWith(prefix)) { | ||
renamedType = `I${componentClassName}${type}`; | ||
} | ||
return (renamedType | ||
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`) | ||
// Capture all instances of the `src` field surrounded by non-word characters on each side and join them. | ||
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join(''))); | ||
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => { | ||
if ((dst === null || dst === void 0 ? void 0 : dst.location) === 'import') { | ||
/** | ||
* Replaces a complex type reference within a generic type. | ||
* For example, remapping a type like `EventEmitter<CustomEvent<MyEvent<T>>>` to | ||
* `EventEmitter<CustomEvent<IMyComponentMyEvent<IMyComponentT>>>`. | ||
*/ | ||
return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join(''); | ||
} | ||
return [p1, dst, p2].join(''); | ||
})); | ||
}, event.complexType.original | ||
@@ -234,0 +248,0 @@ .replace(/\n/g, ' ') |
@@ -210,2 +210,3 @@ import path from 'path'; | ||
const formatOutputType = (componentClassName, event) => { | ||
const prefix = `I${componentClassName}`; | ||
/** | ||
@@ -219,7 +220,20 @@ * The original attribute contains the original type defined by the devs. | ||
.reduce((type, [src, dst]) => { | ||
const renamedType = `I${componentClassName}${type}`; | ||
let renamedType = type; | ||
if (!type.startsWith(prefix)) { | ||
renamedType = `I${componentClassName}${type}`; | ||
} | ||
return (renamedType | ||
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`) | ||
// Capture all instances of the `src` field surrounded by non-word characters on each side and join them. | ||
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join(''))); | ||
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => { | ||
if ((dst === null || dst === void 0 ? void 0 : dst.location) === 'import') { | ||
/** | ||
* Replaces a complex type reference within a generic type. | ||
* For example, remapping a type like `EventEmitter<CustomEvent<MyEvent<T>>>` to | ||
* `EventEmitter<CustomEvent<IMyComponentMyEvent<IMyComponentT>>>`. | ||
*/ | ||
return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join(''); | ||
} | ||
return [p1, dst, p2].join(''); | ||
})); | ||
}, event.complexType.original | ||
@@ -226,0 +240,0 @@ .replace(/\n/g, ' ') |
{ | ||
"name": "@stencil/angular-output-target", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "Angular output target for @stencil/core components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102261
1991