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

@cldcvr/custom-elements-manifest-to-types

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cldcvr/custom-elements-manifest-to-types - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

6

CHANGELOG.md
# @cldcvr/custom-elements-manifest-to-types
## 2.0.2
## [2.0.3] - 2023-10-18
### Patch Changes
### Bug fixes
- a2de106: Fix platform types
- Duplicate type import fixed.

@@ -9,0 +9,0 @@ ## 2.0.1-beta.0

@@ -248,2 +248,5 @@ "use strict";

}
function isSuperClassDeclaration(declaration) {
return declaration.superclass && (declaration.superclass.name === "FRoot" || declaration.superclass.name === "LitElement");
}
function getComponentPropTypeImports(schema, modulePath) {

@@ -264,11 +267,11 @@ const builtInTypes = [

const moduleTypeImports = [];
const extractedTypes = /* @__PURE__ */ new Set();
const moduleName = modulePath || "./src";
schema.modules.forEach((module2) => {
const moduleName = modulePath || "./src";
module2.declarations?.forEach((declaration) => {
declaration = declaration;
if (!(declaration.superclass && (declaration.superclass.name === "FRoot" || declaration.superclass.name === "LitElement"))) {
if (!isSuperClassDeclaration(declaration)) {
return;
}
if (declaration.attributes) {
const extractedTypes = /* @__PURE__ */ new Set();
declaration.attributes.forEach((attribute) => {

@@ -284,13 +287,13 @@ if (attribute.type?.text) {

});
if (extractedTypes.size > 0) {
let importStatement = `import type { `;
Array.from(extractedTypes).forEach((et, idx) => {
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`;
});
importStatement += `} from '${moduleName}';`;
moduleTypeImports.push(importStatement);
}
}
});
});
if (extractedTypes.size > 0) {
let importStatement = `import type { `;
Array.from(extractedTypes).forEach((et, idx) => {
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`;
});
importStatement += `} from '${moduleName}';`;
moduleTypeImports.push(importStatement);
}
return moduleTypeImports;

@@ -297,0 +300,0 @@ }

@@ -247,2 +247,8 @@ import {

}
function isSuperClassDeclaration(declaration: MixinDeclaration) {
return (
declaration.superclass &&
(declaration.superclass.name === "FRoot" || declaration.superclass.name === "LitElement")
);
}

@@ -264,14 +270,9 @@ function getComponentPropTypeImports(schema: Package, modulePath?: string): string[] {

const moduleTypeImports: string[] = [];
const extractedTypes: Set<string> = new Set();
const moduleName = modulePath || "./src";
schema.modules.forEach(module => {
const moduleName = modulePath || "./src";
module.declarations?.forEach(declaration => {
declaration = declaration as MixinDeclaration;
if (
!(
declaration.superclass &&
(declaration.superclass.name === "FRoot" || declaration.superclass.name === "LitElement")
)
) {
if (!isSuperClassDeclaration(declaration)) {
return;

@@ -281,3 +282,2 @@ }

if (declaration.attributes) {
const extractedTypes: Set<string> = new Set();
declaration.attributes.forEach(attribute => {

@@ -293,11 +293,2 @@ if (attribute.type?.text) {

});
if (extractedTypes.size > 0) {
let importStatement = `import type { `;
Array.from(extractedTypes).forEach((et, idx) => {
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`;
});
importStatement += `} from '${moduleName}';`;
moduleTypeImports.push(importStatement);
}
}

@@ -307,3 +298,11 @@ });

if (extractedTypes.size > 0) {
let importStatement = `import type { `;
Array.from(extractedTypes).forEach((et, idx) => {
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`;
});
importStatement += `} from '${moduleName}';`;
moduleTypeImports.push(importStatement);
}
return moduleTypeImports;
}
{
"name": "@cldcvr/custom-elements-manifest-to-types",
"version": "2.0.2",
"version": "2.0.3",
"main": "dist/index.js",

@@ -23,3 +23,3 @@ "types": "dist/index.d.ts",

"type": "git",
"url": "git+ssh://github.com/cldcvr/flow-core.git",
"url": "https://github.com/cldcvr/flow-core.git",
"directory": "packages/custom-elements-manifest-to-types"

@@ -26,0 +26,0 @@ },

Sorry, the diff of this file is not supported yet

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