New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stencil/angular-output-target

Package Overview
Dependencies
Maintainers
11
Versions
108
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.0.2 to 0.0.3

2

dist/generate-proxies.d.ts
import { OutputTargetAngular } from './types';
import { CompilerCtx, ComponentCompilerMeta } from '@stencil/core/internal';
export default function generateProxies(compilerCtx: CompilerCtx, components: ComponentCompilerMeta[], outputTarget: OutputTargetAngular, rootDir: string): Promise<import("@stencil/core/dist/declarations").FsWriteResults>;
export default function generateProxies(compilerCtx: CompilerCtx, components: ComponentCompilerMeta[], outputTarget: OutputTargetAngular, rootDir: string): Promise<import("@stencil/core/internal").FsWriteResults>;
import path from 'path';
import { GENERATED_DTS, dashToPascalCase, readPackageJson, relativeImport, normalizePath } from './utils';
export default async function generateProxies(compilerCtx, components, outputTarget, rootDir) {
const proxies = getProxies(components);
const pkgData = await readPackageJson(rootDir);
const distTypesDir = path.dirname(pkgData.types);
const proxies = getProxies(components, outputTarget.componentCorePackage, distTypesDir);
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);

@@ -24,5 +24,5 @@ const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');

}
function getProxies(components) {
function getProxies(components, componentCorePackage, distTypesDir) {
return components
.map(getProxy)
.map((cmpMeta) => getProxy(cmpMeta, componentCorePackage, distTypesDir))
.join('\n');

@@ -43,3 +43,3 @@ }

}
function getProxy(cmpMeta) {
function getProxy(cmpMeta, componentCorePackage, distTypesDir) {
// Collect component meta

@@ -60,4 +60,11 @@ const inputs = getInputs(cmpMeta);

}
if (outputs.length > 0) {
directiveOpts.push(`outputs: ['${outputs.map(output => output.name).join(`', '`)}']`);
}
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const lines = [`
const typePath = path.relative(componentCorePackage, cmpMeta.sourceFilePath).replace('../src', path.join(componentCorePackage, distTypesDir)).replace('.tsx', '');
const outputsInterface = outputs.length > 0
? `import { ${cmpMeta.componentClassName} as I${cmpMeta.componentClassName} } from '${typePath}';`
: '';
const lines = [`${outputsInterface}
export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {}

@@ -67,5 +74,6 @@ ${getProxyCmp(inputs, methods)}

export class ${tagNameAsPascal} {`];
// Generate outputs
// Generate outputs
outputs.forEach(output => {
lines.push(` ${output}!: EventEmitter<CustomEvent>;`);
lines.push(` /** ${output.docs.text} ${output.docs.tags.map(tag => `@${tag.name} ${tag.text}`)}*/`);
lines.push(` ${output.name}!: I${cmpMeta.componentClassName}['${output.method}'];`);
});

@@ -77,3 +85,3 @@ lines.push(' protected el: HTMLElement;');

if (hasOutputs) {
lines.push(` proxyOutputs(this, this.el, ['${outputs.join(`', '`)}']);`);
lines.push(` proxyOutputs(this, this.el, ['${outputs.map(output => output.name).join(`', '`)}']);`);
}

@@ -91,3 +99,3 @@ lines.push(` }`);

function getOutputs(cmpMeta) {
return cmpMeta.events.filter(ev => !ev.internal).map(prop => prop.name);
return cmpMeta.events.filter(ev => !ev.internal).map(prop => prop);
}

@@ -94,0 +102,0 @@ function getMethods(cmpMeta) {

@@ -86,5 +86,5 @@ 'use strict';

async function generateProxies(compilerCtx, components, outputTarget, rootDir) {
const proxies = getProxies(components);
const pkgData = await readPackageJson(rootDir);
const distTypesDir = path.dirname(pkgData.types);
const proxies = getProxies(components, outputTarget.componentCorePackage, distTypesDir);
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);

@@ -107,5 +107,5 @@ const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');

}
function getProxies(components) {
function getProxies(components, componentCorePackage, distTypesDir) {
return components
.map(getProxy)
.map((cmpMeta) => getProxy(cmpMeta, componentCorePackage, distTypesDir))
.join('\n');

@@ -126,3 +126,3 @@ }

}
function getProxy(cmpMeta) {
function getProxy(cmpMeta, componentCorePackage, distTypesDir) {
// Collect component meta

@@ -143,4 +143,11 @@ const inputs = getInputs(cmpMeta);

}
if (outputs.length > 0) {
directiveOpts.push(`outputs: ['${outputs.map(output => output.name).join(`', '`)}']`);
}
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const lines = [`
const typePath = path.relative(componentCorePackage, cmpMeta.sourceFilePath).replace('../src', path.join(componentCorePackage, distTypesDir)).replace('.tsx', '');
const outputsInterface = outputs.length > 0
? `import { ${cmpMeta.componentClassName} as I${cmpMeta.componentClassName} } from '${typePath}';`
: '';
const lines = [`${outputsInterface}
export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {}

@@ -150,5 +157,6 @@ ${getProxyCmp(inputs, methods)}

export class ${tagNameAsPascal} {`];
// Generate outputs
// Generate outputs
outputs.forEach(output => {
lines.push(` ${output}!: EventEmitter<CustomEvent>;`);
lines.push(` /** ${output.docs.text} ${output.docs.tags.map(tag => `@${tag.name} ${tag.text}`)}*/`);
lines.push(` ${output.name}!: I${cmpMeta.componentClassName}['${output.method}'];`);
});

@@ -160,3 +168,3 @@ lines.push(' protected el: HTMLElement;');

if (hasOutputs) {
lines.push(` proxyOutputs(this, this.el, ['${outputs.join(`', '`)}']);`);
lines.push(` proxyOutputs(this, this.el, ['${outputs.map(output => output.name).join(`', '`)}']);`);
}

@@ -174,3 +182,3 @@ lines.push(` }`);

function getOutputs(cmpMeta) {
return cmpMeta.events.filter(ev => !ev.internal).map(prop => prop.name);
return cmpMeta.events.filter(ev => !ev.internal).map(prop => prop);
}

@@ -177,0 +185,0 @@ function getMethods(cmpMeta) {

@@ -80,5 +80,5 @@ import path from 'path';

async function generateProxies(compilerCtx, components, outputTarget, rootDir) {
const proxies = getProxies(components);
const pkgData = await readPackageJson(rootDir);
const distTypesDir = path.dirname(pkgData.types);
const proxies = getProxies(components, outputTarget.componentCorePackage, distTypesDir);
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);

@@ -101,5 +101,5 @@ const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');

}
function getProxies(components) {
function getProxies(components, componentCorePackage, distTypesDir) {
return components
.map(getProxy)
.map((cmpMeta) => getProxy(cmpMeta, componentCorePackage, distTypesDir))
.join('\n');

@@ -120,3 +120,3 @@ }

}
function getProxy(cmpMeta) {
function getProxy(cmpMeta, componentCorePackage, distTypesDir) {
// Collect component meta

@@ -137,4 +137,11 @@ const inputs = getInputs(cmpMeta);

}
if (outputs.length > 0) {
directiveOpts.push(`outputs: ['${outputs.map(output => output.name).join(`', '`)}']`);
}
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const lines = [`
const typePath = path.relative(componentCorePackage, cmpMeta.sourceFilePath).replace('../src', path.join(componentCorePackage, distTypesDir)).replace('.tsx', '');
const outputsInterface = outputs.length > 0
? `import { ${cmpMeta.componentClassName} as I${cmpMeta.componentClassName} } from '${typePath}';`
: '';
const lines = [`${outputsInterface}
export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {}

@@ -144,5 +151,6 @@ ${getProxyCmp(inputs, methods)}

export class ${tagNameAsPascal} {`];
// Generate outputs
// Generate outputs
outputs.forEach(output => {
lines.push(` ${output}!: EventEmitter<CustomEvent>;`);
lines.push(` /** ${output.docs.text} ${output.docs.tags.map(tag => `@${tag.name} ${tag.text}`)}*/`);
lines.push(` ${output.name}!: I${cmpMeta.componentClassName}['${output.method}'];`);
});

@@ -154,3 +162,3 @@ lines.push(' protected el: HTMLElement;');

if (hasOutputs) {
lines.push(` proxyOutputs(this, this.el, ['${outputs.join(`', '`)}']);`);
lines.push(` proxyOutputs(this, this.el, ['${outputs.map(output => output.name).join(`', '`)}']);`);
}

@@ -168,3 +176,3 @@ lines.push(` }`);

function getOutputs(cmpMeta) {
return cmpMeta.events.filter(ev => !ev.internal).map(prop => prop.name);
return cmpMeta.events.filter(ev => !ev.internal).map(prop => prop);
}

@@ -171,0 +179,0 @@ function getMethods(cmpMeta) {

import { OutputTargetAngular } from './types';
import { CompilerCtx, ComponentCompilerMeta, Config } from '@stencil/core/internal';
export declare function angularDirectiveProxyOutput(compilerCtx: CompilerCtx, outputTarget: OutputTargetAngular, components: ComponentCompilerMeta[], config: Config): Promise<[any, any, any, any]>;
export declare function angularDirectiveProxyOutput(compilerCtx: CompilerCtx, outputTarget: OutputTargetAngular, components: ComponentCompilerMeta[], config: Config): Promise<[import("@stencil/core/internal").FsWriteResults, any, void, void[] | undefined]>;
{
"name": "@stencil/angular-output-target",
"version": "0.0.2",
"version": "0.0.3",
"description": "This is an output plugin for stencil.",

@@ -16,3 +16,3 @@ "main": "dist/index.cjs.js",

"scripts": {
"prebuild": "rimraf ./dist && npm run test && npm run lint",
"prebuild": "rimraf ./dist && npm run test",
"build": "tsc && npm run rollup",

@@ -23,4 +23,3 @@ "watch": "tsc --watch",

"release": "np",
"lint": "tslint --project tsconfig.json",
"test": "jest",
"test": "../../node_modules/.bin/jest --passWithNoTests",
"test.watch": "jest --watch"

@@ -30,3 +29,3 @@ },

"type": "git",
"url": "git+https://github.com/ionic-team/stencil-ds-plugins.git"
"url": "git+https://github.com/ionic-team/stencil-ds-output-targets.git"
},

@@ -37,3 +36,3 @@ "author": "Ionic Team",

"bugs": {
"url": "https://github.com/ionic-team/stencil-ds-plugins/issues"
"url": "https://github.com/ionic-team/stencil-ds-output-targets/issues"
},

@@ -43,10 +42,6 @@ "devDependencies": {

"@angular/forms": "8.2.14",
"@types/jest": "^24.0.11",
"jest": "^24.5.0",
"np": "^4.0.2",
"rimraf": "^2.6.3",
"rollup": "^1.6.0",
"tslint": "^5.14.0",
"tslint-ionic-rules": "0.0.21",
"typescript": "^3.3.3333"
"typescript": "^3.9.3"
},

@@ -67,3 +62,3 @@ "jest": {

},
"gitHead": "a3588e905186a0e86e7f88418fd5b2f9531b55e0"
"gitHead": "1a9082929749288da703753a03a4f87d70a106e5"
}
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