@stencil/angular-output-target 0.8.1 → 0.8.3
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/angular-component-lib/utils.ts +8 -0
- package/dist/generate-angular-component.js +16 -2
- package/dist/index.cjs.js +16 -5
- package/dist/index.js +16 -5
- package/dist/plugin.js +0 -3
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,14 @@ export const proxyInputs = (Cmp: any, inputs: string[]) => {
|
|
|
12
12
|
set(val: any) {
|
|
13
13
|
this.z.runOutsideAngular(() => (this.el[item] = val));
|
|
14
14
|
},
|
|
15
|
+
/**
|
|
16
|
+
* In the event that proxyInputs is called
|
|
17
|
+
* multiple times re-defining these inputs
|
|
18
|
+
* will cause an error to be thrown. As a result
|
|
19
|
+
* we set configurable: true to indicate these
|
|
20
|
+
* properties can be changed.
|
|
21
|
+
*/
|
|
22
|
+
configurable: true,
|
|
15
23
|
});
|
|
16
24
|
});
|
|
17
25
|
};
|
|
@@ -70,6 +70,7 @@ 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}`;
|
|
73
74
|
/**
|
|
74
75
|
* The original attribute contains the original type defined by the devs.
|
|
75
76
|
* This regexp normalizes the reference, by removing linebreaks,
|
|
@@ -78,11 +79,24 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
78
79
|
return Object.entries(event.complexType.references)
|
|
79
80
|
.filter(([_, refObject]) => refObject.location === 'local' || refObject.location === 'import')
|
|
80
81
|
.reduce((type, [src, dst]) => {
|
|
81
|
-
|
|
82
|
+
let renamedType = type;
|
|
83
|
+
if (!type.startsWith(prefix)) {
|
|
84
|
+
renamedType = `I${componentClassName}${type}`;
|
|
85
|
+
}
|
|
82
86
|
return (renamedType
|
|
83
87
|
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
|
|
84
88
|
// Capture all instances of the `src` field surrounded by non-word characters on each side and join them.
|
|
85
|
-
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) =>
|
|
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
|
+
}));
|
|
86
100
|
}, event.complexType.original
|
|
87
101
|
.replace(/\n/g, ' ')
|
|
88
102
|
.replace(/\s{2,}/g, ' ')
|
package/dist/index.cjs.js
CHANGED
|
@@ -215,6 +215,7 @@ 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}`;
|
|
218
219
|
/**
|
|
219
220
|
* The original attribute contains the original type defined by the devs.
|
|
220
221
|
* This regexp normalizes the reference, by removing linebreaks,
|
|
@@ -223,11 +224,24 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
223
224
|
return Object.entries(event.complexType.references)
|
|
224
225
|
.filter(([_, refObject]) => refObject.location === 'local' || refObject.location === 'import')
|
|
225
226
|
.reduce((type, [src, dst]) => {
|
|
226
|
-
|
|
227
|
+
let renamedType = type;
|
|
228
|
+
if (!type.startsWith(prefix)) {
|
|
229
|
+
renamedType = `I${componentClassName}${type}`;
|
|
230
|
+
}
|
|
227
231
|
return (renamedType
|
|
228
232
|
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
|
|
229
233
|
// Capture all instances of the `src` field surrounded by non-word characters on each side and join them.
|
|
230
|
-
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) =>
|
|
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
|
+
}));
|
|
231
245
|
}, event.complexType.original
|
|
232
246
|
.replace(/\n/g, ' ')
|
|
233
247
|
.replace(/\s{2,}/g, ' ')
|
|
@@ -540,9 +554,6 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
540
554
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
541
555
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
|
542
556
|
}
|
|
543
|
-
if (outputTarget.outputType === OutputTypes.Scam) {
|
|
544
|
-
console.warn(`**Experimental**: outputType: "${OutputTypes.Scam}" is a developer preview feature and may change or be removed in the future.`);
|
|
545
|
-
}
|
|
546
557
|
return results;
|
|
547
558
|
}
|
|
548
559
|
|
package/dist/index.js
CHANGED
|
@@ -207,6 +207,7 @@ 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}`;
|
|
210
211
|
/**
|
|
211
212
|
* The original attribute contains the original type defined by the devs.
|
|
212
213
|
* This regexp normalizes the reference, by removing linebreaks,
|
|
@@ -215,11 +216,24 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
215
216
|
return Object.entries(event.complexType.references)
|
|
216
217
|
.filter(([_, refObject]) => refObject.location === 'local' || refObject.location === 'import')
|
|
217
218
|
.reduce((type, [src, dst]) => {
|
|
218
|
-
|
|
219
|
+
let renamedType = type;
|
|
220
|
+
if (!type.startsWith(prefix)) {
|
|
221
|
+
renamedType = `I${componentClassName}${type}`;
|
|
222
|
+
}
|
|
219
223
|
return (renamedType
|
|
220
224
|
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
|
|
221
225
|
// Capture all instances of the `src` field surrounded by non-word characters on each side and join them.
|
|
222
|
-
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) =>
|
|
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
|
+
}));
|
|
223
237
|
}, event.complexType.original
|
|
224
238
|
.replace(/\n/g, ' ')
|
|
225
239
|
.replace(/\s{2,}/g, ' ')
|
|
@@ -532,9 +546,6 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
532
546
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
533
547
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
|
534
548
|
}
|
|
535
|
-
if (outputTarget.outputType === OutputTypes.Scam) {
|
|
536
|
-
console.warn(`**Experimental**: outputType: "${OutputTypes.Scam}" is a developer preview feature and may change or be removed in the future.`);
|
|
537
|
-
}
|
|
538
549
|
return results;
|
|
539
550
|
}
|
|
540
551
|
|
package/dist/plugin.js
CHANGED
|
@@ -33,8 +33,5 @@ export function normalizeOutputTarget(config, outputTarget) {
|
|
|
33
33
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
34
34
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
|
35
35
|
}
|
|
36
|
-
if (outputTarget.outputType === OutputTypes.Scam) {
|
|
37
|
-
console.warn(`**Experimental**: outputType: "${OutputTypes.Scam}" is a developer preview feature and may change or be removed in the future.`);
|
|
38
|
-
}
|
|
39
36
|
return results;
|
|
40
37
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface OutputTargetAngular {
|
|
|
23
23
|
/**
|
|
24
24
|
* The type of output that should be generated.
|
|
25
25
|
* - `component` - Generate many component wrappers tied to a single Angular module (lazy/hydrated approach).
|
|
26
|
-
* - `scam` -
|
|
26
|
+
* - `scam` - Generate a Single Component Angular Module for each component.
|
|
27
27
|
* - `standalone` - Generate a component with the `standalone` flag set to `true`.
|
|
28
28
|
*/
|
|
29
29
|
outputType?: OutputType;
|