@stencil/angular-output-target 0.8.3 → 0.9.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.
- package/dist/generate-angular-component.d.ts +1 -1
- package/dist/generate-angular-component.js +16 -1
- package/dist/generate-value-accessors.d.ts +2 -2
- package/dist/generate-value-accessors.js +7 -4
- package/dist/index.cjs.js +43 -26
- package/dist/index.js +26 -9
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -0
- package/package.json +15 -12
- package/resources/control-value-accessors/boolean-value-accessor.ts +1 -1
- package/resources/control-value-accessors/number-value-accessor.ts +1 -1
- package/resources/control-value-accessors/radio-value-accessor.ts +1 -1
- package/resources/control-value-accessors/select-value-accessor.ts +1 -1
- package/resources/control-value-accessors/text-value-accessor.ts +1 -1
|
@@ -21,4 +21,4 @@ export declare const createAngularComponentDefinition: (tagName: string, inputs:
|
|
|
21
21
|
* @param customElementsDir The custom elements directory.
|
|
22
22
|
* @returns The component interface type definition as a string.
|
|
23
23
|
*/
|
|
24
|
-
export declare const createComponentTypeDefinition: (outputType: OutputType, tagNameAsPascal: string, events: readonly ComponentCompilerEvent[], componentCorePackage: string, customElementsDir?: string
|
|
24
|
+
export declare const createComponentTypeDefinition: (outputType: OutputType, tagNameAsPascal: string, events: readonly ComponentCompilerEvent[], componentCorePackage: string, customElementsDir?: string) => string;
|
|
@@ -81,7 +81,22 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
81
81
|
.reduce((type, [src, dst]) => {
|
|
82
82
|
let renamedType = type;
|
|
83
83
|
if (!type.startsWith(prefix)) {
|
|
84
|
-
|
|
84
|
+
if (type.startsWith('{') && type.endsWith('}')) {
|
|
85
|
+
/**
|
|
86
|
+
* If the type starts with { and ends with }, it is an inline type.
|
|
87
|
+
* For example, `{ a: string }`.
|
|
88
|
+
* We don't need to rename these types, so we return the original type.
|
|
89
|
+
*/
|
|
90
|
+
renamedType = type;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
/**
|
|
94
|
+
* If the type does not start with { and end with }, it is a reference type.
|
|
95
|
+
* For example, `MyType`.
|
|
96
|
+
* We need to rename these types, so we prepend the prefix.
|
|
97
|
+
*/
|
|
98
|
+
renamedType = `I${componentClassName}${type}`;
|
|
99
|
+
}
|
|
85
100
|
}
|
|
86
101
|
return (renamedType
|
|
87
102
|
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { OutputTargetAngular, OutputType } from './types';
|
|
2
2
|
import type { CompilerCtx, ComponentCompilerMeta, Config } from '@stencil/core/internal';
|
|
3
3
|
export interface ValueAccessor {
|
|
4
4
|
elementSelectors: string[];
|
|
5
5
|
eventTargets: [string, string][];
|
|
6
6
|
}
|
|
7
7
|
export default function generateValueAccessors(compilerCtx: CompilerCtx, components: ComponentCompilerMeta[], outputTarget: OutputTargetAngular, config: Config): Promise<void>;
|
|
8
|
-
export declare function createValueAccessor(srcFileContents: string, valueAccessor: ValueAccessor): string;
|
|
8
|
+
export declare function createValueAccessor(srcFileContents: string, valueAccessor: ValueAccessor, outputType?: OutputType): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EOL } from 'os';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { OutputTypes } from './utils';
|
|
3
4
|
export default async function generateValueAccessors(compilerCtx, components, outputTarget, config) {
|
|
4
5
|
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
|
5
6
|
return;
|
|
@@ -25,20 +26,21 @@ export default async function generateValueAccessors(compilerCtx, components, ou
|
|
|
25
26
|
const targetFilePath = path.join(targetDir, targetFileName);
|
|
26
27
|
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
27
28
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
28
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
29
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
29
30
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
30
31
|
}));
|
|
31
32
|
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
32
33
|
}
|
|
33
|
-
export function createValueAccessor(srcFileContents, valueAccessor) {
|
|
34
|
+
export function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
34
35
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
35
36
|
return srcFileContents
|
|
36
37
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
37
|
-
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
38
|
+
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
39
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
|
|
38
40
|
}
|
|
39
41
|
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
40
42
|
if (!config.sys || !config.sys.copy) {
|
|
41
|
-
throw new Error('stencil is not properly
|
|
43
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
42
44
|
}
|
|
43
45
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
44
46
|
return {
|
|
@@ -53,4 +55,5 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
53
55
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
54
56
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
55
57
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
58
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
56
59
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
package/dist/index.cjs.js
CHANGED
|
@@ -58,18 +58,18 @@ function normalizePath(str) {
|
|
|
58
58
|
return str;
|
|
59
59
|
}
|
|
60
60
|
function relativeImport(pathFrom, pathTo, ext) {
|
|
61
|
-
let relativePath = path__default[
|
|
61
|
+
let relativePath = path__default["default"].relative(path__default["default"].dirname(pathFrom), path__default["default"].dirname(pathTo));
|
|
62
62
|
if (relativePath === '') {
|
|
63
63
|
relativePath = '.';
|
|
64
64
|
}
|
|
65
65
|
else if (relativePath[0] !== '.') {
|
|
66
66
|
relativePath = './' + relativePath;
|
|
67
67
|
}
|
|
68
|
-
return normalizePath(`${relativePath}/${path__default[
|
|
68
|
+
return normalizePath(`${relativePath}/${path__default["default"].basename(pathTo, ext)}`);
|
|
69
69
|
}
|
|
70
70
|
async function readPackageJson(config, rootDir) {
|
|
71
71
|
var _a;
|
|
72
|
-
const pkgJsonPath = path__default[
|
|
72
|
+
const pkgJsonPath = path__default["default"].join(rootDir, 'package.json');
|
|
73
73
|
let pkgJson;
|
|
74
74
|
try {
|
|
75
75
|
pkgJson = (await ((_a = config.sys) === null || _a === void 0 ? void 0 : _a.readFile(pkgJsonPath, 'utf8')));
|
|
@@ -226,7 +226,22 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
226
226
|
.reduce((type, [src, dst]) => {
|
|
227
227
|
let renamedType = type;
|
|
228
228
|
if (!type.startsWith(prefix)) {
|
|
229
|
-
|
|
229
|
+
if (type.startsWith('{') && type.endsWith('}')) {
|
|
230
|
+
/**
|
|
231
|
+
* If the type starts with { and ends with }, it is an inline type.
|
|
232
|
+
* For example, `{ a: string }`.
|
|
233
|
+
* We don't need to rename these types, so we return the original type.
|
|
234
|
+
*/
|
|
235
|
+
renamedType = type;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
/**
|
|
239
|
+
* If the type does not start with { and end with }, it is a reference type.
|
|
240
|
+
* For example, `MyType`.
|
|
241
|
+
* We need to rename these types, so we prepend the prefix.
|
|
242
|
+
*/
|
|
243
|
+
renamedType = `I${componentClassName}${type}`;
|
|
244
|
+
}
|
|
230
245
|
}
|
|
231
246
|
return (renamedType
|
|
232
247
|
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
|
|
@@ -321,7 +336,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
321
336
|
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
|
322
337
|
return;
|
|
323
338
|
}
|
|
324
|
-
const targetDir = path__default[
|
|
339
|
+
const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile);
|
|
325
340
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
|
326
341
|
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
|
327
342
|
const type = va.type;
|
|
@@ -339,37 +354,39 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
339
354
|
await Promise.all(Object.keys(normalizedValueAccessors).map(async (type) => {
|
|
340
355
|
const valueAccessorType = type; // Object.keys converts to string
|
|
341
356
|
const targetFileName = `${type}-value-accessor.ts`;
|
|
342
|
-
const targetFilePath = path__default[
|
|
343
|
-
const srcFilePath = path__default[
|
|
357
|
+
const targetFilePath = path__default["default"].join(targetDir, targetFileName);
|
|
358
|
+
const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
344
359
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
345
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
360
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
346
361
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
347
362
|
}));
|
|
348
|
-
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
363
|
+
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
|
349
364
|
}
|
|
350
|
-
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
365
|
+
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
351
366
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
352
367
|
return srcFileContents
|
|
353
368
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
354
|
-
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`))
|
|
369
|
+
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`))
|
|
370
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
|
|
355
371
|
}
|
|
356
|
-
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
372
|
+
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
357
373
|
if (!config.sys || !config.sys.copy) {
|
|
358
|
-
throw new Error('stencil is not properly
|
|
374
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
359
375
|
}
|
|
360
376
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
361
377
|
return {
|
|
362
|
-
src: path__default[
|
|
363
|
-
dest: path__default[
|
|
378
|
+
src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf),
|
|
379
|
+
dest: path__default["default"].join(directory, rf),
|
|
364
380
|
keepDirStructure: false,
|
|
365
381
|
warn: false,
|
|
366
382
|
};
|
|
367
383
|
});
|
|
368
|
-
return config.sys.copy(copyTasks, path__default[
|
|
384
|
+
return config.sys.copy(copyTasks, path__default["default"].join(directory));
|
|
369
385
|
}
|
|
370
386
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
371
387
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
372
388
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
389
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
373
390
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
|
374
391
|
|
|
375
392
|
/**
|
|
@@ -396,7 +413,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
396
413
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
397
414
|
await Promise.all([
|
|
398
415
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
399
|
-
copyResources
|
|
416
|
+
copyResources(config, outputTarget),
|
|
400
417
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
401
418
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
402
419
|
]);
|
|
@@ -404,12 +421,12 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
404
421
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
405
422
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
406
423
|
}
|
|
407
|
-
async function copyResources
|
|
424
|
+
async function copyResources(config, outputTarget) {
|
|
408
425
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
409
426
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
410
427
|
}
|
|
411
|
-
const srcDirectory = path__default[
|
|
412
|
-
const destDirectory = path__default[
|
|
428
|
+
const srcDirectory = path__default["default"].join(__dirname, '..', 'angular-component-lib');
|
|
429
|
+
const destDirectory = path__default["default"].join(path__default["default"].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
|
|
413
430
|
return config.sys.copy([
|
|
414
431
|
{
|
|
415
432
|
src: srcDirectory,
|
|
@@ -420,8 +437,8 @@ async function copyResources$1(config, outputTarget) {
|
|
|
420
437
|
], srcDirectory);
|
|
421
438
|
}
|
|
422
439
|
function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
423
|
-
const distTypesDir = path__default[
|
|
424
|
-
const dtsFilePath = path__default[
|
|
440
|
+
const distTypesDir = path__default["default"].dirname(pkgData.types);
|
|
441
|
+
const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS);
|
|
425
442
|
const { outputType } = outputTarget;
|
|
426
443
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
427
444
|
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
@@ -545,11 +562,11 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
545
562
|
if (outputTarget.directivesProxyFile == null) {
|
|
546
563
|
throw new Error('directivesProxyFile is required. Please set it in the Stencil config.');
|
|
547
564
|
}
|
|
548
|
-
if (outputTarget.directivesProxyFile && !path__default[
|
|
549
|
-
results.directivesProxyFile = normalizePath(path__default[
|
|
565
|
+
if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) {
|
|
566
|
+
results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile));
|
|
550
567
|
}
|
|
551
|
-
if (outputTarget.directivesArrayFile && !path__default[
|
|
552
|
-
results.directivesArrayFile = normalizePath(path__default[
|
|
568
|
+
if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) {
|
|
569
|
+
results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile));
|
|
553
570
|
}
|
|
554
571
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
555
572
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
package/dist/index.js
CHANGED
|
@@ -218,7 +218,22 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
218
218
|
.reduce((type, [src, dst]) => {
|
|
219
219
|
let renamedType = type;
|
|
220
220
|
if (!type.startsWith(prefix)) {
|
|
221
|
-
|
|
221
|
+
if (type.startsWith('{') && type.endsWith('}')) {
|
|
222
|
+
/**
|
|
223
|
+
* If the type starts with { and ends with }, it is an inline type.
|
|
224
|
+
* For example, `{ a: string }`.
|
|
225
|
+
* We don't need to rename these types, so we return the original type.
|
|
226
|
+
*/
|
|
227
|
+
renamedType = type;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
/**
|
|
231
|
+
* If the type does not start with { and end with }, it is a reference type.
|
|
232
|
+
* For example, `MyType`.
|
|
233
|
+
* We need to rename these types, so we prepend the prefix.
|
|
234
|
+
*/
|
|
235
|
+
renamedType = `I${componentClassName}${type}`;
|
|
236
|
+
}
|
|
222
237
|
}
|
|
223
238
|
return (renamedType
|
|
224
239
|
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
|
|
@@ -334,20 +349,21 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
334
349
|
const targetFilePath = path.join(targetDir, targetFileName);
|
|
335
350
|
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
336
351
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
337
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
352
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
338
353
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
339
354
|
}));
|
|
340
|
-
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
355
|
+
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
|
341
356
|
}
|
|
342
|
-
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
357
|
+
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
343
358
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
344
359
|
return srcFileContents
|
|
345
360
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
346
|
-
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
361
|
+
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
362
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
|
|
347
363
|
}
|
|
348
|
-
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
364
|
+
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
349
365
|
if (!config.sys || !config.sys.copy) {
|
|
350
|
-
throw new Error('stencil is not properly
|
|
366
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
351
367
|
}
|
|
352
368
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
353
369
|
return {
|
|
@@ -362,6 +378,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
362
378
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
363
379
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
364
380
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
381
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
365
382
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
|
366
383
|
|
|
367
384
|
/**
|
|
@@ -388,7 +405,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
388
405
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
389
406
|
await Promise.all([
|
|
390
407
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
391
|
-
copyResources
|
|
408
|
+
copyResources(config, outputTarget),
|
|
392
409
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
393
410
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
394
411
|
]);
|
|
@@ -396,7 +413,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
396
413
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
397
414
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
398
415
|
}
|
|
399
|
-
async function copyResources
|
|
416
|
+
async function copyResources(config, outputTarget) {
|
|
400
417
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
401
418
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
402
419
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* - `scam` - Generate a Single Component Angular Module for each component.
|
|
5
5
|
* - `standalone` - Generate a component with the `standalone` flag set to `true`.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type OutputType = 'component' | 'scam' | 'standalone';
|
|
8
8
|
export interface OutputTargetAngular {
|
|
9
9
|
/**
|
|
10
10
|
* The package name of the component library.
|
|
@@ -28,7 +28,7 @@ export interface OutputTargetAngular {
|
|
|
28
28
|
*/
|
|
29
29
|
outputType?: OutputType;
|
|
30
30
|
}
|
|
31
|
-
export
|
|
31
|
+
export type ValueAccessorTypes = 'text' | 'radio' | 'select' | 'number' | 'boolean';
|
|
32
32
|
export interface ValueAccessorConfig {
|
|
33
33
|
elementSelectors: string | string[];
|
|
34
34
|
event: string;
|
package/dist/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"prepublishOnly": "
|
|
18
|
-
"prebuild": "rimraf ./dist &&
|
|
19
|
-
"build": "tsc &&
|
|
17
|
+
"prepublishOnly": "pnpm run build",
|
|
18
|
+
"prebuild": "rimraf ./dist && pnpm run test",
|
|
19
|
+
"build": "tsc && pnpm run rollup",
|
|
20
20
|
"watch": "tsc --watch",
|
|
21
21
|
"rollup": "rollup -c",
|
|
22
|
-
"version": "
|
|
23
|
-
"prettier": "
|
|
22
|
+
"version": "pnpm run build",
|
|
23
|
+
"prettier": "pnpm run prettier.base --write",
|
|
24
24
|
"prettier.base": "prettier \"./({angular-component-lib,src,test,__tests__}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\"",
|
|
25
|
-
"prettier.dry-run": "
|
|
25
|
+
"prettier.dry-run": "pnpm run prettier.base --list-different",
|
|
26
26
|
"release": "np",
|
|
27
27
|
"test": "jest --passWithNoTests",
|
|
28
28
|
"test.watch": "jest --watch"
|
|
@@ -39,7 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@angular/core": "8.2.14",
|
|
42
|
-
"@angular/forms": "8.2.14"
|
|
42
|
+
"@angular/forms": "8.2.14",
|
|
43
|
+
"@types/node": "^18.0.0",
|
|
44
|
+
"jest": "^27.0.0",
|
|
45
|
+
"jest-environment-jsdom": "^27.0.0",
|
|
46
|
+
"rimraf": "^5.0.0",
|
|
47
|
+
"rollup": "^2.23.1",
|
|
48
|
+
"typescript": "~5.0.4"
|
|
43
49
|
},
|
|
44
50
|
"peerDependencies": {
|
|
45
51
|
"@stencil/core": ">=2.0.0 || >=3 || >= 4.0.0-beta.0 || >= 4.0.0"
|
|
@@ -58,8 +64,5 @@
|
|
|
58
64
|
],
|
|
59
65
|
"testURL": "http://localhost"
|
|
60
66
|
},
|
|
61
|
-
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0"
|
|
62
|
-
"volta": {
|
|
63
|
-
"extends": "../../package.json"
|
|
64
|
-
}
|
|
67
|
+
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0"
|
|
65
68
|
}
|