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

@maverick-js/cli

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maverick-js/cli - npm Package Compare versions

Comparing version 0.38.5 to 0.39.0

127

analyze.d.ts
import ts from 'typescript';
declare const TS_NODE: unique symbol;
type TypeMeta = string;
interface TypeMeta {
primitive: string;
concise: string;
full: string;
}
interface PropMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;

@@ -25,3 +30,3 @@ type: TypeMeta;

interface MethodMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;

@@ -43,6 +48,6 @@ parameters: ParameterMeta[];

interface EventMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;
type: TypeMeta;
detail: string;
detail: TypeMeta;
docs?: string;

@@ -57,3 +62,3 @@ doctags?: DocTagMeta[];

interface CSSVarMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;

@@ -71,3 +76,3 @@ default?: string;

interface PartMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;

@@ -77,3 +82,3 @@ docs?: string;

interface StateMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;

@@ -88,3 +93,3 @@ type: TypeMeta;

interface DocTagMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;

@@ -94,3 +99,3 @@ text?: string;

interface FileMeta {
[TS_NODE]: ts.SourceFile;
[TS_NODE]?: ts.SourceFile;
path: string;

@@ -104,3 +109,4 @@ }

interface ComponentMeta extends Record<string, unknown> {
[TS_NODE]: ts.ClassDeclaration;
[TS_NODE]?: ts.ClassDeclaration;
type: 'component';
file: FileMeta;

@@ -119,7 +125,7 @@ name: string;

interface TagMeta {
[TS_NODE]: ts.PropertyDeclaration;
[TS_NODE]?: ts.PropertyDeclaration;
name: string;
}
interface AttrMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
attr: string | false;

@@ -131,3 +137,3 @@ }

interface SlotMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name?: string;

@@ -137,8 +143,9 @@ docs?: string;

interface CSSPartMeta {
[TS_NODE]: ts.Node;
[TS_NODE]?: ts.Node;
name: string;
docs?: string;
}
interface ElementMeta {
[TS_NODE]: ts.ClassDeclaration;
interface CustomElementMeta {
[TS_NODE]?: ts.ClassDeclaration;
type: 'element';
name: string;

@@ -148,3 +155,3 @@ file: FileMeta;

component?: {
[TS_NODE]: ts.ClassDeclaration;
[TS_NODE]?: ts.ClassDeclaration;
name: string;

@@ -159,2 +166,41 @@ };

interface ReactRefMeta {
type: TypeMeta;
}
interface ReactPropMeta extends PropMeta {
}
interface ReactCallbackMeta {
[TS_NODE]?: ts.Node;
name: string;
type: TypeMeta;
docs?: string;
doctags?: DocTagMeta[];
parameters?: ParameterMeta[];
internal?: boolean;
deprecated?: boolean;
}
interface ModuleExport {
file: string;
/** If this is undefined, everything is re-exported. */
alias?: Record<string, string>;
}
interface ReactComponentMeta extends Record<string, unknown> {
[TS_NODE]?: ts.Node;
type: 'react';
file: FileMeta;
namespace?: string;
exports?: ModuleExport[];
name: string;
displayName?: string;
docs?: string;
doctags?: DocTagMeta[];
attributes?: string;
instance?: string;
props?: ReactPropMeta[];
propsType?: string;
callbacks?: ReactCallbackMeta[];
ref?: ReactRefMeta;
}
type AnalyzeFramework = 'default' | 'react';
interface ComponentNode {

@@ -173,3 +219,3 @@ name: string;

}
interface ElementNode {
interface CustomElementNode {
name: string;

@@ -187,2 +233,20 @@ root: ts.ClassDeclaration;

}
interface ReactComponentNode {
file: string;
namespace?: string;
exports?: ModuleExport[];
name: string;
root: ts.VariableDeclaration | ts.FunctionDeclaration;
component: ts.FunctionDeclaration | ts.ArrowFunction;
identifier: ts.Identifier;
props?: ts.Declaration;
displayName?: string;
attributes?: string;
instance?: string;
types: {
root: ts.Type;
ref?: ts.Type;
props?: ts.Type;
};
}
interface AnalyzePlugin {

@@ -192,17 +256,22 @@ name: string;

discoverComponents?(sourceFile: ts.SourceFile): Promise<ComponentNode[] | null | undefined>;
buildComponent?(definition: ComponentNode): Promise<ComponentMeta | null | undefined | void>;
discoverElements?(sourceFile: ts.SourceFile): Promise<ElementNode[] | null | undefined>;
buildElement?(definition: ElementNode): Promise<ElementMeta | null | undefined | void>;
transform?(meta: TransformMeta, sourceFiles: Map<ElementMeta | ComponentMeta, ts.SourceFile>): Promise<void>;
buildComponentMeta?(definition: ComponentNode): Promise<ComponentMeta | null | undefined | void>;
discoverCustomElements?(sourceFile: ts.SourceFile): Promise<CustomElementNode[] | null | undefined>;
buildCustomElementMeta?(definition: CustomElementNode): Promise<CustomElementMeta | null | undefined | void>;
discoverReactComponents?(sourceFile: ts.SourceFile): Promise<ReactComponentNode[] | null | undefined>;
buildReactComponentMeta?(definition: ReactComponentNode): Promise<ReactComponentMeta | null | undefined | void>;
transform?(data: TransformData, sourceFiles: TransformSourceFiles): Promise<void>;
destroy?(): Promise<void>;
}
interface TransformMeta {
interface TransformData {
components: ComponentMeta[];
elements: ElementMeta[];
customElements: CustomElementMeta[];
reactComponents: ReactComponentMeta[];
}
type TransformSourceFiles = Map<CustomElementMeta | ComponentMeta | ReactComponentMeta, ts.SourceFile>;
type AnalyzePluginBuilder<ConfigType = any> = (config?: ConfigType) => AnalyzePlugin;
type JSONPluginOutput = Record<string, any> & {
elements: ElementMeta[];
elements: CustomElementMeta[];
components: ComponentMeta[];
react: ReactComponentMeta[];
};

@@ -225,3 +294,3 @@ interface JSONPluginConfig extends Record<string, unknown> {

transformTagData?: (meta: {
element: ElementMeta;
element: CustomElementMeta;
component?: ComponentMeta;

@@ -273,4 +342,4 @@ }, data: ITagData) => ITagData;

declare function walkComponentDocs(component: ComponentMeta, callback: (docs: string) => void | string | undefined): void;
declare function walkComponentDocs(component: ComponentMeta | CustomElementMeta | ReactComponentMeta, callback: (docs: string) => void | string | undefined): void;
export { AnalyzePlugin, AnalyzePluginBuilder, AttrMeta, AttrsMeta, CSSPartMeta, CSSVarMeta, ComponentMeta, ComponentNode, DocTagMeta, ElementMeta, ElementNode, EventMeta, FileMeta, HTMLDataV1, IAttributeData, IReference, ITagData, IValueData, IValueSet, JSONPluginConfig, JSONPluginOutput, MembersMeta, MethodMeta, ParameterMeta, PartMeta, PropMeta, SlotMeta, StateMeta, TS_NODE, TagMeta, TransformMeta, TypeMeta, VSCodePluginConfig, createJSONPlugin, createVSCodePlugin, walkComponentDocs };
export { AnalyzeFramework, AnalyzePlugin, AnalyzePluginBuilder, AttrMeta, AttrsMeta, CSSPartMeta, CSSVarMeta, ComponentMeta, ComponentNode, CustomElementMeta, CustomElementNode, DocTagMeta, EventMeta, FileMeta, HTMLDataV1, IAttributeData, IReference, ITagData, IValueData, IValueSet, JSONPluginConfig, JSONPluginOutput, MembersMeta, MethodMeta, ModuleExport, ParameterMeta, PartMeta, PropMeta, ReactCallbackMeta, ReactComponentMeta, ReactComponentNode, ReactPropMeta, ReactRefMeta, SlotMeta, StateMeta, TagMeta, TransformData, TransformSourceFiles, TypeMeta, VSCodePluginConfig, createJSONPlugin, createVSCodePlugin, walkComponentDocs };

@@ -12,7 +12,8 @@ import { d as dirname, r as resolveConfigPaths, T as TS_NODE, i as isUndefined, c as camelToKebabCase, e as escapeQuotes } from './str.js';

name: "maverick/json",
async transform({ components, elements }) {
async transform({ components, customElements, reactComponents }) {
const normalizedConfig = await normalizeJSONPluginConfig(config);
const output = {
elements,
components
components,
elements: customElements,
react: reactComponents
};

@@ -45,3 +46,3 @@ const stringify = config.stringifyJson ?? JSON.stringify;

name: "maverick/vscode-html-data",
async transform({ components, elements }) {
async transform({ components, customElements }) {
const normalizedConfig = await normalizeVSCodePluginConfig(config);

@@ -53,3 +54,3 @@ const output = {

const map = /* @__PURE__ */ new Map();
for (const el of elements) {
for (const el of customElements) {
if (!el.component)

@@ -60,3 +61,3 @@ continue;

}
elements.filter((el) => !isUndefined(el.tag) && map.has(el)).forEach((element) => {
customElements.filter((el) => !isUndefined(el.tag) && map.has(el)).forEach((element) => {
const component = map.get(element);

@@ -74,3 +75,3 @@ const tagData = {

description: prop.docs,
values: prop.type.includes("|") ? prop.type.split(/\s+\|\s+/)?.filter((value) => !primitiveTypeRE.test(value)).map((type) => ({ name: escapeQuotes(type) })) : void 0
values: prop.type.full.includes("|") ? prop.type.full.split(/\s+\|\s+/)?.filter((value) => !primitiveTypeRE.test(value)).map((type) => ({ name: escapeQuotes(type) })) : void 0
};

@@ -99,10 +100,3 @@ return config.transformAttributeData?.(prop, data) ?? data;

const propKeys = /* @__PURE__ */ new Set([
"props",
"state",
"events",
"cssvars",
"cssparts",
"slots"
]);
const propKeys = /* @__PURE__ */ new Set(["props", "callbacks", "state", "events", "cssvars", "cssparts", "slots"]);
function walkComponentDocs(component, callback) {

@@ -116,3 +110,3 @@ if (component.docs) {

for (const key of keys) {
if (key === "members") {
if (key === "members" && component.type === "component") {
if (component.members?.props) {

@@ -126,9 +120,9 @@ for (const prop of component.members.props) {

}
}
if (component.members?.methods) {
for (const method of component.members.methods) {
if (method.docs) {
const newDocs = callback(method.docs);
if (newDocs)
method.docs = newDocs;
if (component.members?.methods) {
for (const method of component.members.methods) {
if (method.docs) {
const newDocs = callback(method.docs);
if (newDocs)
method.docs = newDocs;
}
}

@@ -149,2 +143,2 @@ }

export { TS_NODE, createJSONPlugin, createVSCodePlugin, walkComponentDocs };
export { createJSONPlugin, createVSCodePlugin, walkComponentDocs };

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

const TS_NODE = Symbol("NODE");
function normalizeWindowsPath(input = "") {

@@ -128,2 +126,7 @@ if (!input || !input.includes("\\")) {

};
const _EXTNAME_RE = /.(\.[^./]+)$/;
const extname = function(p) {
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
return match && match[1] || "";
};
const dirname = function(p) {

@@ -136,3 +139,9 @@ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);

};
const basename = function(p, extension) {
const lastSegment = normalizeWindowsPath(p).split("/").pop();
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
};
const TS_NODE = Symbol("NODE");
function isNull(value) {

@@ -176,2 +185,11 @@ return value === null;

}
function kebabToCamelCase(str) {
return str.replace(/-./g, (x) => x[1].toUpperCase());
}
function kebabToPascalCase(str) {
return kebabToCamelCase(uppercaseFirstChar(str));
}
function uppercaseFirstChar(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
function escapeQuotes(str) {

@@ -189,2 +207,2 @@ return str.replace(/^"+|"+$/g, "").replace(/^'+|'+$/g, "");

export { TS_NODE as T, isFunction as a, isObject as b, camelToKebabCase as c, dirname as d, escapeQuotes as e, isNull as f, resolve as g, normalizeLineBreaks as h, isUndefined as i, resolvePath as j, isArray as k, normalize as n, resolveConfigPaths as r, splitLineBreaks as s };
export { TS_NODE as T, isFunction as a, isObject as b, camelToKebabCase as c, dirname as d, escapeQuotes as e, isNull as f, resolve as g, normalizeLineBreaks as h, isUndefined as i, basename as j, kebabToPascalCase as k, extname as l, resolvePath as m, normalize as n, isArray as o, resolveConfigPaths as r, splitLineBreaks as s };

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.38.5",
"version": "0.39.0",
"type": "module",

@@ -46,2 +46,3 @@ "files": [

"@types/node": "^18.0.3",
"@types/react": "^18.0.24",
"@types/yargs": "^17.0.13",

@@ -53,2 +54,3 @@ "esbuild": "^0.17.19",

"pathe": "^1.1.0",
"react": "^18.2.0",
"rimraf": "^3.0.2",

@@ -55,0 +57,0 @@ "rollup": "^3.25.1",

Sorry, the diff of this file is too big to display

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