@stencil/angular-output-target 0.0.1-dev.11722462330.188a8aeb → 0.0.1-dev.11722540458.1506f4d7
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/index.cjs.js +21 -21
- package/dist/index.js +4 -4
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -1
- package/package.json +12 -15
|
@@ -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) => string;
|
|
24
|
+
export declare const createComponentTypeDefinition: (outputType: OutputType, tagNameAsPascal: string, events: readonly ComponentCompilerEvent[], componentCorePackage: string, customElementsDir?: string | undefined) => string;
|
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')));
|
|
@@ -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,13 +354,13 @@ 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
360
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
361
361
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
362
362
|
}));
|
|
363
|
-
await copyResources
|
|
363
|
+
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
364
364
|
}
|
|
365
365
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
366
366
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
@@ -368,19 +368,19 @@ function createValueAccessor(srcFileContents, valueAccessor) {
|
|
|
368
368
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
369
369
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`));
|
|
370
370
|
}
|
|
371
|
-
function copyResources
|
|
371
|
+
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
372
372
|
if (!config.sys || !config.sys.copy) {
|
|
373
373
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
|
374
374
|
}
|
|
375
375
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
376
376
|
return {
|
|
377
|
-
src: path__default[
|
|
378
|
-
dest: path__default[
|
|
377
|
+
src: path__default['default'].join(__dirname, '../resources/control-value-accessors/', rf),
|
|
378
|
+
dest: path__default['default'].join(directory, rf),
|
|
379
379
|
keepDirStructure: false,
|
|
380
380
|
warn: false,
|
|
381
381
|
};
|
|
382
382
|
});
|
|
383
|
-
return config.sys.copy(copyTasks, path__default[
|
|
383
|
+
return config.sys.copy(copyTasks, path__default['default'].join(directory));
|
|
384
384
|
}
|
|
385
385
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
386
386
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
@@ -411,7 +411,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
411
411
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
412
412
|
await Promise.all([
|
|
413
413
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
414
|
-
copyResources(config, outputTarget),
|
|
414
|
+
copyResources$1(config, outputTarget),
|
|
415
415
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
416
416
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
417
417
|
]);
|
|
@@ -419,12 +419,12 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
419
419
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
420
420
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
421
421
|
}
|
|
422
|
-
async function copyResources(config, outputTarget) {
|
|
422
|
+
async function copyResources$1(config, outputTarget) {
|
|
423
423
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
424
424
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
425
425
|
}
|
|
426
|
-
const srcDirectory = path__default[
|
|
427
|
-
const destDirectory = path__default[
|
|
426
|
+
const srcDirectory = path__default['default'].join(__dirname, '..', 'angular-component-lib');
|
|
427
|
+
const destDirectory = path__default['default'].join(path__default['default'].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
|
|
428
428
|
return config.sys.copy([
|
|
429
429
|
{
|
|
430
430
|
src: srcDirectory,
|
|
@@ -435,8 +435,8 @@ async function copyResources(config, outputTarget) {
|
|
|
435
435
|
], srcDirectory);
|
|
436
436
|
}
|
|
437
437
|
function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
438
|
-
const distTypesDir = path__default[
|
|
439
|
-
const dtsFilePath = path__default[
|
|
438
|
+
const distTypesDir = path__default['default'].dirname(pkgData.types);
|
|
439
|
+
const dtsFilePath = path__default['default'].join(rootDir, distTypesDir, GENERATED_DTS);
|
|
440
440
|
const { outputType } = outputTarget;
|
|
441
441
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
442
442
|
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
@@ -560,11 +560,11 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
560
560
|
if (outputTarget.directivesProxyFile == null) {
|
|
561
561
|
throw new Error('directivesProxyFile is required. Please set it in the Stencil config.');
|
|
562
562
|
}
|
|
563
|
-
if (outputTarget.directivesProxyFile && !path__default[
|
|
564
|
-
results.directivesProxyFile = normalizePath(path__default[
|
|
563
|
+
if (outputTarget.directivesProxyFile && !path__default['default'].isAbsolute(outputTarget.directivesProxyFile)) {
|
|
564
|
+
results.directivesProxyFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesProxyFile));
|
|
565
565
|
}
|
|
566
|
-
if (outputTarget.directivesArrayFile && !path__default[
|
|
567
|
-
results.directivesArrayFile = normalizePath(path__default[
|
|
566
|
+
if (outputTarget.directivesArrayFile && !path__default['default'].isAbsolute(outputTarget.directivesArrayFile)) {
|
|
567
|
+
results.directivesArrayFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesArrayFile));
|
|
568
568
|
}
|
|
569
569
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
570
570
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
package/dist/index.js
CHANGED
|
@@ -352,7 +352,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
352
352
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
353
353
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
354
354
|
}));
|
|
355
|
-
await copyResources
|
|
355
|
+
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
356
356
|
}
|
|
357
357
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
358
358
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
@@ -360,7 +360,7 @@ function createValueAccessor(srcFileContents, valueAccessor) {
|
|
|
360
360
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
361
361
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`));
|
|
362
362
|
}
|
|
363
|
-
function copyResources
|
|
363
|
+
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
364
364
|
if (!config.sys || !config.sys.copy) {
|
|
365
365
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
|
366
366
|
}
|
|
@@ -403,7 +403,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
403
403
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
404
404
|
await Promise.all([
|
|
405
405
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
406
|
-
copyResources(config, outputTarget),
|
|
406
|
+
copyResources$1(config, outputTarget),
|
|
407
407
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
408
408
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
409
409
|
]);
|
|
@@ -411,7 +411,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
411
411
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
412
412
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
413
413
|
}
|
|
414
|
-
async function copyResources(config, outputTarget) {
|
|
414
|
+
async function copyResources$1(config, outputTarget) {
|
|
415
415
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
416
416
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
417
417
|
}
|
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 type OutputType = 'component' | 'scam' | 'standalone';
|
|
7
|
+
export declare 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 type ValueAccessorTypes = 'text' | 'radio' | 'select' | 'number' | 'boolean';
|
|
31
|
+
export declare 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.11722540458.1506f4d7",
|
|
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": "npm run build",
|
|
18
|
+
"prebuild": "rimraf ./dist && npm run test",
|
|
19
|
+
"build": "tsc && npm run rollup",
|
|
20
20
|
"watch": "tsc --watch",
|
|
21
21
|
"rollup": "rollup -c",
|
|
22
|
-
"version": "
|
|
23
|
-
"prettier": "
|
|
22
|
+
"version": "npm run build",
|
|
23
|
+
"prettier": "npm 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": "npm run prettier.base -- --list-different",
|
|
26
26
|
"release": "np",
|
|
27
27
|
"test": "jest --passWithNoTests",
|
|
28
28
|
"test.watch": "jest --watch"
|
|
@@ -39,13 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@angular/core": "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"
|
|
42
|
+
"@angular/forms": "8.2.14"
|
|
49
43
|
},
|
|
50
44
|
"peerDependencies": {
|
|
51
45
|
"@stencil/core": ">=2.0.0 || >=3 || >= 4.0.0-beta.0 || >= 4.0.0"
|
|
@@ -64,5 +58,8 @@
|
|
|
64
58
|
],
|
|
65
59
|
"testURL": "http://localhost"
|
|
66
60
|
},
|
|
67
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "506f4d72ba87a07be32c5e4d7724db362d7f9da6",
|
|
62
|
+
"volta": {
|
|
63
|
+
"extends": "../../package.json"
|
|
64
|
+
}
|
|
68
65
|
}
|