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

@vue-macros/api

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-macros/api - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

4

dist/index.d.ts
import { MagicString, SFC } from '@vue-macros/common';
export { MagicString, SFC, parseSFC } from '@vue-macros/common';
import { Node, TSModuleBlock, CallExpression, TSType, LVal, VariableDeclaration, ExpressionStatement, TSCallSignatureDeclaration, TSTypeLiteral, TSIntersectionType, TSInterfaceDeclaration, StringLiteral, TSMethodSignature, TSPropertySignature, ObjectMethod, ObjectProperty, Expression } from '@babel/types';
import { Node, TSModuleBlock, CallExpression, TSType, LVal, VariableDeclaration, ExpressionStatement, TSCallSignatureDeclaration, TSTypeLiteral, TSIntersectionType, TSInterfaceDeclaration, StringLiteral, TSMethodSignature, TSPropertySignature, TSUnionType, ObjectMethod, ObjectProperty, Expression } from '@babel/types';
import { TSFile, TSResolvedType } from './ts.js';

@@ -125,3 +125,3 @@ export { ResolveTSFileIdImpl, TSDeclaration, TSExports, TSProperties, TSScope, exportsSymbol, getTSFile, isTSDeclaration, isTSExports, mergeTSProperties, resolveTSEntityName, resolveTSExports, resolveTSFileId, resolveTSFileIdNode, resolveTSProperties, resolveTSReferencedType, resolveTSScope, resolveTypeElements, setResolveTSFileIdImpl, tsFileCache, tsFileExportsCache } from './ts.js';

definitions: Record<string | number, TSPropsMethod | TSPropsProperty>;
definitionsAst: ASTDefinition<TSInterfaceDeclaration | TSTypeLiteral | TSIntersectionType>;
definitionsAst: ASTDefinition<TSInterfaceDeclaration | TSTypeLiteral | TSIntersectionType | TSUnionType>;
/**

@@ -128,0 +128,0 @@ * Default value of props.

@@ -324,3 +324,94 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

const { type: definitionsAst2, scope } = resolved;
if (definitionsAst2.type !== "TSInterfaceDeclaration" && definitionsAst2.type !== "TSTypeLiteral" && definitionsAst2.type !== "TSIntersectionType")
if (definitionsAst2.type === "TSIntersectionType") {
const results = {};
for (const type of definitionsAst2.types) {
const defMap = await resolveDefinitions({ type, scope }).then(
({ definitions: definitions3 }) => definitions3
);
for (const [key, def] of Object.entries(defMap)) {
const result = results[key];
if (!result) {
results[key] = def;
continue;
}
if (result.type === "method" && def.type === "method") {
result.methods.push(...def.methods);
} else {
results[key] = def;
}
}
}
return {
definitions: results,
definitionsAst: buildDefinition({ scope, type: definitionsAst2 })
};
} else if (definitionsAst2.type === "TSUnionType") {
const unionDefs = [];
const keys = /* @__PURE__ */ new Set();
for (const type of definitionsAst2.types) {
const defs = await resolveDefinitions({ type, scope }).then(
({ definitions: definitions3 }) => definitions3
);
Object.keys(defs).map((key) => keys.add(key));
unionDefs.push(defs);
}
const results = {};
for (const key of keys) {
let optional = false;
let result;
for (const defMap of unionDefs) {
const def = defMap[key];
if (!def) {
optional = true;
continue;
}
optional || (optional = def.optional);
if (!result) {
result = def;
continue;
}
if (result.type === "method" && def.type === "method") {
result.methods.push(...def.methods);
} else if (result.type === "property" && def.type === "property") {
if (!def.value) {
continue;
} else if (!result.value) {
result = def;
continue;
}
if (def.value.ast.type === "TSImportType" || def.value.ast.type === "TSDeclareFunction" || def.value.ast.type === "TSEnumDeclaration" || def.value.ast.type === "TSInterfaceDeclaration" || def.value.ast.type === "TSModuleDeclaration" || result.value.ast.type === "TSImportType" || result.value.ast.type === "TSDeclareFunction" || result.value.ast.type === "TSEnumDeclaration" || result.value.ast.type === "TSInterfaceDeclaration" || result.value.ast.type === "TSModuleDeclaration") {
continue;
}
if (result.value.ast.type === "TSUnionType") {
result.value.ast.types.push(def.value.ast);
} else {
result = {
type: "property",
value: buildDefinition({
scope,
type: {
type: "TSUnionType",
types: [result.value.ast, def.value.ast]
}
}),
signature: null,
optional,
addByAPI: false
};
}
} else {
throw new SyntaxError(
`Cannot resolve TS definition. Union type contains different types of results.`
);
}
}
if (result) {
results[key] = { ...result, optional };
}
}
return {
definitions: results,
definitionsAst: buildDefinition({ scope, type: definitionsAst2 })
};
} else if (definitionsAst2.type !== "TSInterfaceDeclaration" && definitionsAst2.type !== "TSTypeLiteral")
throw new SyntaxError(`Cannot resolve TS definition.`);

@@ -327,0 +418,0 @@ const properties = await _chunk32PZ64CNjs.resolveTSProperties.call(void 0, {

{
"name": "@vue-macros/api",
"version": "0.3.0",
"version": "0.4.0",
"packageManager": "pnpm@7.26.0",

@@ -5,0 +5,0 @@ "license": "MIT",

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