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
13
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.1.0 to 0.2.0

20

dist/generate-angular-component.js

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

import path from 'path';
import { dashToPascalCase, isRelativePath, normalizePath } from './utils';
import { dashToPascalCase } from './utils';
export const createComponentDefinition = (componentCorePackage, distTypesDir, rootDir) => (cmpMeta) => {

@@ -26,4 +25,2 @@ // Collect component meta

const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const typePath = path.parse(path.join(componentCorePackage, path.join(cmpMeta.sourceFilePath, '').replace(path.join(rootDir, 'src'), distTypesDir)));
const importPath = normalizePath(path.join(typePath.dir, typePath.name));
const outputsInterface = new Set();

@@ -33,15 +30,10 @@ const outputReferenceRemap = {};

Object.entries(output.complexType.references).forEach(([reference, refObject]) => {
// Add import line for each local/import reference, and add new mapping name
// outputReferenceRemap should be updated only if the import interface is set in outputsInterface
// This will prevent global types to be remapped
// Add import line for each local/import reference, and add new mapping name.
// `outputReferenceRemap` should be updated only if the import interface is set in outputsInterface,
// this will prevent global types to be remapped.
const remappedReference = `I${cmpMeta.componentClassName}${reference}`;
if (refObject.location === 'local') {
if (refObject.location === 'local' || refObject.location === 'import') {
outputReferenceRemap[reference] = remappedReference;
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${importPath}';`);
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${componentCorePackage}';`);
}
else if (refObject.location === 'import') {
outputReferenceRemap[reference] = remappedReference;
const interfacePath = normalizePath(isRelativePath(refObject.path) ? path.join(typePath.dir, refObject.path) : refObject.path);
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${interfacePath}';`);
}
});

@@ -48,0 +40,0 @@ });

@@ -69,5 +69,2 @@ 'use strict';

}
function isRelativePath(path) {
return path && path.startsWith('.');
}
async function readPackageJson(rootDir) {

@@ -118,4 +115,2 @@ const pkgJsonPath = path__default['default'].join(rootDir, 'package.json');

const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const typePath = path__default['default'].parse(path__default['default'].join(componentCorePackage, path__default['default'].join(cmpMeta.sourceFilePath, '').replace(path__default['default'].join(rootDir, 'src'), distTypesDir)));
const importPath = normalizePath(path__default['default'].join(typePath.dir, typePath.name));
const outputsInterface = new Set();

@@ -125,15 +120,10 @@ const outputReferenceRemap = {};

Object.entries(output.complexType.references).forEach(([reference, refObject]) => {
// Add import line for each local/import reference, and add new mapping name
// outputReferenceRemap should be updated only if the import interface is set in outputsInterface
// This will prevent global types to be remapped
// Add import line for each local/import reference, and add new mapping name.
// `outputReferenceRemap` should be updated only if the import interface is set in outputsInterface,
// this will prevent global types to be remapped.
const remappedReference = `I${cmpMeta.componentClassName}${reference}`;
if (refObject.location === 'local') {
if (refObject.location === 'local' || refObject.location === 'import') {
outputReferenceRemap[reference] = remappedReference;
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${importPath}';`);
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${componentCorePackage}';`);
}
else if (refObject.location === 'import') {
outputReferenceRemap[reference] = remappedReference;
const interfacePath = normalizePath(isRelativePath(refObject.path) ? path__default['default'].join(typePath.dir, refObject.path) : refObject.path);
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${interfacePath}';`);
}
});

@@ -317,3 +307,3 @@ });

components
.map(createComponentDefinition(outputTarget.componentCorePackage, distTypesDir, rootDir))
.map(createComponentDefinition(outputTarget.componentCorePackage))
.join('\n'),

@@ -320,0 +310,0 @@ ];

@@ -60,5 +60,2 @@ import path from 'path';

}
function isRelativePath(path) {
return path && path.startsWith('.');
}
async function readPackageJson(rootDir) {

@@ -109,4 +106,2 @@ const pkgJsonPath = path.join(rootDir, 'package.json');

const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const typePath = path.parse(path.join(componentCorePackage, path.join(cmpMeta.sourceFilePath, '').replace(path.join(rootDir, 'src'), distTypesDir)));
const importPath = normalizePath(path.join(typePath.dir, typePath.name));
const outputsInterface = new Set();

@@ -116,15 +111,10 @@ const outputReferenceRemap = {};

Object.entries(output.complexType.references).forEach(([reference, refObject]) => {
// Add import line for each local/import reference, and add new mapping name
// outputReferenceRemap should be updated only if the import interface is set in outputsInterface
// This will prevent global types to be remapped
// Add import line for each local/import reference, and add new mapping name.
// `outputReferenceRemap` should be updated only if the import interface is set in outputsInterface,
// this will prevent global types to be remapped.
const remappedReference = `I${cmpMeta.componentClassName}${reference}`;
if (refObject.location === 'local') {
if (refObject.location === 'local' || refObject.location === 'import') {
outputReferenceRemap[reference] = remappedReference;
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${importPath}';`);
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${componentCorePackage}';`);
}
else if (refObject.location === 'import') {
outputReferenceRemap[reference] = remappedReference;
const interfacePath = normalizePath(isRelativePath(refObject.path) ? path.join(typePath.dir, refObject.path) : refObject.path);
outputsInterface.add(`import { ${reference} as ${remappedReference} } from '${interfacePath}';`);
}
});

@@ -308,3 +298,3 @@ });

components
.map(createComponentDefinition(outputTarget.componentCorePackage, distTypesDir, rootDir))
.map(createComponentDefinition(outputTarget.componentCorePackage))
.join('\n'),

@@ -311,0 +301,0 @@ ];

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

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

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