@stencil/angular-output-target 0.8.4 → 0.9.1
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 +2 -2
- package/dist/generate-value-accessors.d.ts +2 -2
- package/dist/generate-value-accessors.js +8 -4
- package/dist/index.cjs.js +31 -27
- package/dist/index.js +14 -10
- package/dist/output-angular.js +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -0
- package/package.json +19 -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;
|
|
@@ -149,8 +149,8 @@ export const createComponentTypeDefinition = (outputType, tagNameAsPascal, event
|
|
|
149
149
|
const eventTypes = publicEvents.map((event) => {
|
|
150
150
|
const comment = createDocComment(event.docs);
|
|
151
151
|
let eventName = event.name;
|
|
152
|
-
if (event.name
|
|
153
|
-
// If an event name includes a dash, we need to wrap it in quotes.
|
|
152
|
+
if (/[-/]/.test(event.name)) {
|
|
153
|
+
// If an event name includes a dash or a forward slash, we need to wrap it in quotes.
|
|
154
154
|
// https://github.com/ionic-team/stencil-ds-output-targets/issues/212
|
|
155
155
|
eventName = `'${event.name}'`;
|
|
156
156
|
}
|
|
@@ -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 {
|
|
@@ -46,6 +48,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
46
48
|
dest: path.join(directory, rf),
|
|
47
49
|
keepDirStructure: false,
|
|
48
50
|
warn: false,
|
|
51
|
+
ignore: [],
|
|
49
52
|
};
|
|
50
53
|
});
|
|
51
54
|
return config.sys.copy(copyTasks, path.join(directory));
|
|
@@ -53,4 +56,5 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
53
56
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
54
57
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
55
58
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
59
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
56
60
|
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')));
|
|
@@ -294,8 +294,8 @@ const createComponentTypeDefinition = (outputType, tagNameAsPascal, events, comp
|
|
|
294
294
|
const eventTypes = publicEvents.map((event) => {
|
|
295
295
|
const comment = createDocComment(event.docs);
|
|
296
296
|
let eventName = event.name;
|
|
297
|
-
if (event.name
|
|
298
|
-
// If an event name includes a dash, we need to wrap it in quotes.
|
|
297
|
+
if (/[-/]/.test(event.name)) {
|
|
298
|
+
// If an event name includes a dash or a forward slash, we need to wrap it in quotes.
|
|
299
299
|
// https://github.com/ionic-team/stencil-ds-output-targets/issues/212
|
|
300
300
|
eventName = `'${event.name}'`;
|
|
301
301
|
}
|
|
@@ -336,7 +336,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
336
336
|
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
|
-
const targetDir = path__default[
|
|
339
|
+
const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile);
|
|
340
340
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
|
341
341
|
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
|
342
342
|
const type = va.type;
|
|
@@ -354,37 +354,40 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
354
354
|
await Promise.all(Object.keys(normalizedValueAccessors).map(async (type) => {
|
|
355
355
|
const valueAccessorType = type; // Object.keys converts to string
|
|
356
356
|
const targetFileName = `${type}-value-accessor.ts`;
|
|
357
|
-
const targetFilePath = path__default[
|
|
358
|
-
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);
|
|
359
359
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
360
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
360
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
361
361
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
362
362
|
}));
|
|
363
|
-
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
363
|
+
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
|
364
364
|
}
|
|
365
|
-
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
365
|
+
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
366
366
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
367
367
|
return srcFileContents
|
|
368
368
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
369
|
-
.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' : '');
|
|
370
371
|
}
|
|
371
|
-
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
372
|
+
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
372
373
|
if (!config.sys || !config.sys.copy) {
|
|
373
|
-
throw new Error('stencil is not properly
|
|
374
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
374
375
|
}
|
|
375
376
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
376
377
|
return {
|
|
377
|
-
src: path__default[
|
|
378
|
-
dest: path__default[
|
|
378
|
+
src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf),
|
|
379
|
+
dest: path__default["default"].join(directory, rf),
|
|
379
380
|
keepDirStructure: false,
|
|
380
381
|
warn: false,
|
|
382
|
+
ignore: [],
|
|
381
383
|
};
|
|
382
384
|
});
|
|
383
|
-
return config.sys.copy(copyTasks, path__default[
|
|
385
|
+
return config.sys.copy(copyTasks, path__default["default"].join(directory));
|
|
384
386
|
}
|
|
385
387
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
386
388
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
387
389
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
390
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
388
391
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
|
389
392
|
|
|
390
393
|
/**
|
|
@@ -411,7 +414,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
411
414
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
412
415
|
await Promise.all([
|
|
413
416
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
414
|
-
copyResources
|
|
417
|
+
copyResources(config, outputTarget),
|
|
415
418
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
416
419
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
417
420
|
]);
|
|
@@ -419,24 +422,25 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
419
422
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
420
423
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
421
424
|
}
|
|
422
|
-
async function copyResources
|
|
425
|
+
async function copyResources(config, outputTarget) {
|
|
423
426
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
424
427
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
425
428
|
}
|
|
426
|
-
const srcDirectory = path__default[
|
|
427
|
-
const destDirectory = path__default[
|
|
429
|
+
const srcDirectory = path__default["default"].join(__dirname, '..', 'angular-component-lib');
|
|
430
|
+
const destDirectory = path__default["default"].join(path__default["default"].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
|
|
428
431
|
return config.sys.copy([
|
|
429
432
|
{
|
|
430
433
|
src: srcDirectory,
|
|
431
434
|
dest: destDirectory,
|
|
432
435
|
keepDirStructure: false,
|
|
433
436
|
warn: false,
|
|
437
|
+
ignore: [],
|
|
434
438
|
},
|
|
435
439
|
], srcDirectory);
|
|
436
440
|
}
|
|
437
441
|
function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
438
|
-
const distTypesDir = path__default[
|
|
439
|
-
const dtsFilePath = path__default[
|
|
442
|
+
const distTypesDir = path__default["default"].dirname(pkgData.types);
|
|
443
|
+
const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS);
|
|
440
444
|
const { outputType } = outputTarget;
|
|
441
445
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
442
446
|
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
@@ -560,11 +564,11 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
560
564
|
if (outputTarget.directivesProxyFile == null) {
|
|
561
565
|
throw new Error('directivesProxyFile is required. Please set it in the Stencil config.');
|
|
562
566
|
}
|
|
563
|
-
if (outputTarget.directivesProxyFile && !path__default[
|
|
564
|
-
results.directivesProxyFile = normalizePath(path__default[
|
|
567
|
+
if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) {
|
|
568
|
+
results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile));
|
|
565
569
|
}
|
|
566
|
-
if (outputTarget.directivesArrayFile && !path__default[
|
|
567
|
-
results.directivesArrayFile = normalizePath(path__default[
|
|
570
|
+
if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) {
|
|
571
|
+
results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile));
|
|
568
572
|
}
|
|
569
573
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
570
574
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
package/dist/index.js
CHANGED
|
@@ -286,8 +286,8 @@ const createComponentTypeDefinition = (outputType, tagNameAsPascal, events, comp
|
|
|
286
286
|
const eventTypes = publicEvents.map((event) => {
|
|
287
287
|
const comment = createDocComment(event.docs);
|
|
288
288
|
let eventName = event.name;
|
|
289
|
-
if (event.name
|
|
290
|
-
// If an event name includes a dash, we need to wrap it in quotes.
|
|
289
|
+
if (/[-/]/.test(event.name)) {
|
|
290
|
+
// If an event name includes a dash or a forward slash, we need to wrap it in quotes.
|
|
291
291
|
// https://github.com/ionic-team/stencil-ds-output-targets/issues/212
|
|
292
292
|
eventName = `'${event.name}'`;
|
|
293
293
|
}
|
|
@@ -349,20 +349,21 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
349
349
|
const targetFilePath = path.join(targetDir, targetFileName);
|
|
350
350
|
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
351
351
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
352
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
352
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
353
353
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
354
354
|
}));
|
|
355
|
-
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
355
|
+
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
|
356
356
|
}
|
|
357
|
-
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
357
|
+
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
358
358
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
359
359
|
return srcFileContents
|
|
360
360
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
361
|
-
.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' : '');
|
|
362
363
|
}
|
|
363
|
-
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
364
|
+
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
364
365
|
if (!config.sys || !config.sys.copy) {
|
|
365
|
-
throw new Error('stencil is not properly
|
|
366
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
366
367
|
}
|
|
367
368
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
368
369
|
return {
|
|
@@ -370,6 +371,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
370
371
|
dest: path.join(directory, rf),
|
|
371
372
|
keepDirStructure: false,
|
|
372
373
|
warn: false,
|
|
374
|
+
ignore: [],
|
|
373
375
|
};
|
|
374
376
|
});
|
|
375
377
|
return config.sys.copy(copyTasks, path.join(directory));
|
|
@@ -377,6 +379,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
377
379
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
378
380
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
379
381
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
382
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
380
383
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
|
381
384
|
|
|
382
385
|
/**
|
|
@@ -403,7 +406,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
403
406
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
404
407
|
await Promise.all([
|
|
405
408
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
406
|
-
copyResources
|
|
409
|
+
copyResources(config, outputTarget),
|
|
407
410
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
408
411
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
409
412
|
]);
|
|
@@ -411,7 +414,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
411
414
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
412
415
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
413
416
|
}
|
|
414
|
-
async function copyResources
|
|
417
|
+
async function copyResources(config, outputTarget) {
|
|
415
418
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
416
419
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
417
420
|
}
|
|
@@ -423,6 +426,7 @@ async function copyResources$1(config, outputTarget) {
|
|
|
423
426
|
dest: destDirectory,
|
|
424
427
|
keepDirStructure: false,
|
|
425
428
|
warn: false,
|
|
429
|
+
ignore: [],
|
|
426
430
|
},
|
|
427
431
|
], srcDirectory);
|
|
428
432
|
}
|
package/dist/output-angular.js
CHANGED
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.1",
|
|
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,18 @@
|
|
|
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
|
+
"dev": "run-p dev:*",
|
|
21
|
+
"dev:build": "tsc --watch --preserveWatchOutput",
|
|
22
|
+
"dev:rollup": "rollup -c --watch --preserveWatchOutput",
|
|
20
23
|
"watch": "tsc --watch",
|
|
21
24
|
"rollup": "rollup -c",
|
|
22
|
-
"version": "
|
|
23
|
-
"prettier": "
|
|
25
|
+
"version": "pnpm run build",
|
|
26
|
+
"prettier": "pnpm run prettier.base --write",
|
|
24
27
|
"prettier.base": "prettier \"./({angular-component-lib,src,test,__tests__}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\"",
|
|
25
|
-
"prettier.dry-run": "
|
|
28
|
+
"prettier.dry-run": "pnpm run prettier.base --list-different",
|
|
26
29
|
"release": "np",
|
|
27
30
|
"test": "jest --passWithNoTests",
|
|
28
31
|
"test.watch": "jest --watch"
|
|
@@ -39,7 +42,14 @@
|
|
|
39
42
|
},
|
|
40
43
|
"devDependencies": {
|
|
41
44
|
"@angular/core": "8.2.14",
|
|
42
|
-
"@angular/forms": "8.2.14"
|
|
45
|
+
"@angular/forms": "8.2.14",
|
|
46
|
+
"@types/node": "^18.0.0",
|
|
47
|
+
"jest": "^27.0.0",
|
|
48
|
+
"jest-environment-jsdom": "^27.0.0",
|
|
49
|
+
"npm-run-all2": "^6.2.4",
|
|
50
|
+
"rimraf": "^5.0.0",
|
|
51
|
+
"rollup": "^2.23.1",
|
|
52
|
+
"typescript": "~5.0.4"
|
|
43
53
|
},
|
|
44
54
|
"peerDependencies": {
|
|
45
55
|
"@stencil/core": ">=2.0.0 || >=3 || >= 4.0.0-beta.0 || >= 4.0.0"
|
|
@@ -58,8 +68,5 @@
|
|
|
58
68
|
],
|
|
59
69
|
"testURL": "http://localhost"
|
|
60
70
|
},
|
|
61
|
-
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0"
|
|
62
|
-
"volta": {
|
|
63
|
-
"extends": "../../package.json"
|
|
64
|
-
}
|
|
71
|
+
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0"
|
|
65
72
|
}
|