Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stencil/angular-output-target

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stencil/angular-output-target - npm Package Compare versions

Comparing version 0.8.4 to 0.9.0

2

dist/generate-angular-component.d.ts

@@ -24,2 +24,2 @@ import type { ComponentCompilerEvent } from '@stencil/core/internal';

*/
export declare const createComponentTypeDefinition: (outputType: OutputType, tagNameAsPascal: string, events: readonly ComponentCompilerEvent[], componentCorePackage: string, customElementsDir?: string | undefined) => string;
export declare const createComponentTypeDefinition: (outputType: OutputType, tagNameAsPascal: string, events: readonly ComponentCompilerEvent[], componentCorePackage: string, customElementsDir?: string) => string;

@@ -1,2 +0,2 @@

import type { OutputTargetAngular } from './types';
import { OutputTargetAngular, OutputType } from './types';
import type { CompilerCtx, ComponentCompilerMeta, Config } from '@stencil/core/internal';

@@ -8,2 +8,2 @@ export interface ValueAccessor {

export default function generateValueAccessors(compilerCtx: CompilerCtx, components: ComponentCompilerMeta[], outputTarget: OutputTargetAngular, config: Config): Promise<void>;
export declare function createValueAccessor(srcFileContents: string, valueAccessor: ValueAccessor): string;
export declare function createValueAccessor(srcFileContents: string, valueAccessor: ValueAccessor, outputType?: OutputType): string;
import { EOL } from 'os';
import path from 'path';
import { OutputTypes } from './utils';
export default async function generateValueAccessors(compilerCtx, components, outputTarget, config) {

@@ -28,3 +29,3 @@ if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {

const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
await compilerCtx.fs.writeFile(targetFilePath, finalText);

@@ -34,11 +35,12 @@ }));

}
export function createValueAccessor(srcFileContents, valueAccessor) {
export function createValueAccessor(srcFileContents, valueAccessor, outputType) {
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
return srcFileContents
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`));
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
}
function copyResources(config, resourcesFilesToCopy, directory) {
if (!config.sys || !config.sys.copy) {
throw new Error('stencil is not properly intialized at this step. Notify the developer');
throw new Error('stencil is not properly initialized at this step. Notify the developer');
}

@@ -58,2 +60,3 @@ const copyTasks = resourcesFilesToCopy.map((rf) => {

const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;

@@ -61,3 +61,3 @@ 'use strict';

function relativeImport(pathFrom, pathTo, ext) {
let relativePath = path__default['default'].relative(path__default['default'].dirname(pathFrom), path__default['default'].dirname(pathTo));
let relativePath = path__default["default"].relative(path__default["default"].dirname(pathFrom), path__default["default"].dirname(pathTo));
if (relativePath === '') {

@@ -69,7 +69,7 @@ relativePath = '.';

}
return normalizePath(`${relativePath}/${path__default['default'].basename(pathTo, ext)}`);
return normalizePath(`${relativePath}/${path__default["default"].basename(pathTo, ext)}`);
}
async function readPackageJson(config, rootDir) {
var _a;
const pkgJsonPath = path__default['default'].join(rootDir, 'package.json');
const pkgJsonPath = path__default["default"].join(rootDir, 'package.json');
let pkgJson;

@@ -341,3 +341,3 @@ try {

}
const targetDir = path__default['default'].dirname(outputTarget.directivesProxyFile);
const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile);
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {

@@ -360,24 +360,25 @@ const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];

const targetFileName = `${type}-value-accessor.ts`;
const targetFilePath = path__default['default'].join(targetDir, targetFileName);
const srcFilePath = path__default['default'].join(__dirname, '../resources/control-value-accessors/', targetFileName);
const targetFilePath = path__default["default"].join(targetDir, targetFileName);
const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName);
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
await compilerCtx.fs.writeFile(targetFilePath, finalText);
}));
await copyResources(config, ['value-accessor.ts'], targetDir);
await copyResources$1(config, ['value-accessor.ts'], targetDir);
}
function createValueAccessor(srcFileContents, valueAccessor) {
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
return srcFileContents
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`));
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`))
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
}
function copyResources(config, resourcesFilesToCopy, directory) {
function copyResources$1(config, resourcesFilesToCopy, directory) {
if (!config.sys || !config.sys.copy) {
throw new Error('stencil is not properly intialized at this step. Notify the developer');
throw new Error('stencil is not properly initialized at this step. Notify the developer');
}
const copyTasks = resourcesFilesToCopy.map((rf) => {
return {
src: path__default['default'].join(__dirname, '../resources/control-value-accessors/', rf),
dest: path__default['default'].join(directory, rf),
src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf),
dest: path__default["default"].join(directory, rf),
keepDirStructure: false,

@@ -387,3 +388,3 @@ warn: false,

});
return config.sys.copy(copyTasks, path__default['default'].join(directory));
return config.sys.copy(copyTasks, path__default["default"].join(directory));
}

@@ -393,2 +394,3 @@ const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;

const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;

@@ -420,3 +422,3 @@

compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
copyResources$1(config, outputTarget),
copyResources(config, outputTarget),
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),

@@ -429,8 +431,8 @@ generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),

}
async function copyResources$1(config, outputTarget) {
async function copyResources(config, outputTarget) {
if (!config.sys || !config.sys.copy || !config.sys.glob) {
throw new Error('stencil is not properly initialized at this step. Notify the developer');
}
const srcDirectory = path__default['default'].join(__dirname, '..', 'angular-component-lib');
const destDirectory = path__default['default'].join(path__default['default'].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
const srcDirectory = path__default["default"].join(__dirname, '..', 'angular-component-lib');
const destDirectory = path__default["default"].join(path__default["default"].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
return config.sys.copy([

@@ -446,4 +448,4 @@ {

function generateProxies(components, pkgData, outputTarget, rootDir) {
const distTypesDir = path__default['default'].dirname(pkgData.types);
const dtsFilePath = path__default['default'].join(rootDir, distTypesDir, GENERATED_DTS);
const distTypesDir = path__default["default"].dirname(pkgData.types);
const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS);
const { outputType } = outputTarget;

@@ -572,7 +574,7 @@ const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');

}
if (outputTarget.directivesProxyFile && !path__default['default'].isAbsolute(outputTarget.directivesProxyFile)) {
results.directivesProxyFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesProxyFile));
if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) {
results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile));
}
if (outputTarget.directivesArrayFile && !path__default['default'].isAbsolute(outputTarget.directivesArrayFile)) {
results.directivesArrayFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesArrayFile));
if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) {
results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile));
}

@@ -579,0 +581,0 @@ if (outputTarget.includeSingleComponentAngularModules !== undefined) {

@@ -352,16 +352,17 @@ import path from 'path';

const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
await compilerCtx.fs.writeFile(targetFilePath, finalText);
}));
await copyResources(config, ['value-accessor.ts'], targetDir);
await copyResources$1(config, ['value-accessor.ts'], targetDir);
}
function createValueAccessor(srcFileContents, valueAccessor) {
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
return srcFileContents
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`));
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
}
function copyResources(config, resourcesFilesToCopy, directory) {
function copyResources$1(config, resourcesFilesToCopy, directory) {
if (!config.sys || !config.sys.copy) {
throw new Error('stencil is not properly intialized at this step. Notify the developer');
throw new Error('stencil is not properly initialized at this step. Notify the developer');
}

@@ -381,2 +382,3 @@ const copyTasks = resourcesFilesToCopy.map((rf) => {

const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;

@@ -408,3 +410,3 @@

compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
copyResources$1(config, outputTarget),
copyResources(config, outputTarget),
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),

@@ -417,3 +419,3 @@ generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),

}
async function copyResources$1(config, outputTarget) {
async function copyResources(config, outputTarget) {
if (!config.sys || !config.sys.copy || !config.sys.glob) {

@@ -420,0 +422,0 @@ throw new Error('stencil is not properly initialized at this step. Notify the developer');

@@ -7,3 +7,3 @@ /**

*/
export declare type OutputType = 'component' | 'scam' | 'standalone';
export type OutputType = 'component' | 'scam' | 'standalone';
export interface OutputTargetAngular {

@@ -32,3 +32,3 @@ /**

}
export declare type ValueAccessorTypes = 'text' | 'radio' | 'select' | 'number' | 'boolean';
export type ValueAccessorTypes = 'text' | 'radio' | 'select' | 'number' | 'boolean';
export interface ValueAccessorConfig {

@@ -35,0 +35,0 @@ elementSelectors: string | string[];

{
"name": "@stencil/angular-output-target",
"version": "0.8.4",
"version": "0.9.0",
"description": "Angular output target for @stencil/core components.",

@@ -17,11 +17,11 @@ "main": "dist/index.cjs.js",

"scripts": {
"prepublishOnly": "npm run build",
"prebuild": "rimraf ./dist && npm run test",
"build": "tsc && npm run rollup",
"prepublishOnly": "pnpm run build",
"prebuild": "rimraf ./dist && pnpm run test",
"build": "tsc && pnpm run rollup",
"watch": "tsc --watch",
"rollup": "rollup -c",
"version": "npm run build",
"prettier": "npm run prettier.base -- --write",
"version": "pnpm run build",
"prettier": "pnpm run prettier.base --write",
"prettier.base": "prettier \"./({angular-component-lib,src,test,__tests__}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\"",
"prettier.dry-run": "npm run prettier.base -- --list-different",
"prettier.dry-run": "pnpm run prettier.base --list-different",
"release": "np",

@@ -43,3 +43,9 @@ "test": "jest --passWithNoTests",

"@angular/core": "8.2.14",
"@angular/forms": "8.2.14"
"@angular/forms": "8.2.14",
"@types/node": "^18.0.0",
"jest": "^27.0.0",
"jest-environment-jsdom": "^27.0.0",
"rimraf": "^5.0.0",
"rollup": "^2.23.1",
"typescript": "~5.0.4"
},

@@ -63,6 +69,3 @@ "peerDependencies": {

},
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0",
"volta": {
"extends": "../../package.json"
}
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0"
}

@@ -18,3 +18,3 @@ import { Directive, ElementRef } from '@angular/core';

}
]
]<VALUE_ACCESSOR_STANDALONE>
})

@@ -21,0 +21,0 @@ export class BooleanValueAccessor extends ValueAccessor {

@@ -18,3 +18,3 @@ import { Directive, ElementRef } from '@angular/core';

}
]
]<VALUE_ACCESSOR_STANDALONE>
})

@@ -21,0 +21,0 @@ export class NumericValueAccessor extends ValueAccessor {

@@ -18,3 +18,3 @@ import { Directive, ElementRef } from '@angular/core';

}
]
]<VALUE_ACCESSOR_STANDALONE>
})

@@ -21,0 +21,0 @@ export class RadioValueAccessor extends ValueAccessor {

@@ -18,3 +18,3 @@ import { Directive, ElementRef } from '@angular/core';

}
]
]<VALUE_ACCESSOR_STANDALONE>
})

@@ -21,0 +21,0 @@ export class SelectValueAccessor extends ValueAccessor {

@@ -18,3 +18,3 @@ import { Directive, ElementRef } from '@angular/core';

}
]
]<VALUE_ACCESSOR_STANDALONE>
})

@@ -21,0 +21,0 @@ export class TextValueAccessor extends ValueAccessor {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc