@maverick-js/compiler
Advanced tools
Comparing version 0.36.6 to 0.36.7
@@ -307,13 +307,2 @@ import { TS_NODE, resolvePath, resolveConfigPaths, escapeQuotes, camelToKebabCase } from './chunks/chunk-FDW5IKT6.js'; | ||
} | ||
function getProperties(checker, node) { | ||
var _a; | ||
const props = /* @__PURE__ */ new Map(); | ||
for (const symbol of checker.getPropertiesOfType(checker.getTypeAtLocation(node))) { | ||
const declaration = (_a = symbol.declarations) == null ? void 0 : _a[0]; | ||
if (declaration && ts7.isPropertyAssignment(declaration)) { | ||
props.set(escapeQuotes(declaration.name.getText()), declaration); | ||
} | ||
} | ||
return { props }; | ||
} | ||
function getHeritage(checker, node) { | ||
@@ -350,12 +339,4 @@ var _a; | ||
function getPropertyAssignmentValue(checker, obj, key) { | ||
const prop = findPropertyAssignment(obj, key); | ||
if (!prop) { | ||
return void 0; | ||
} else if (ts7.isPropertyAssignment(prop)) { | ||
return prop.initializer; | ||
} else if (ts7.isMethodDeclaration(prop)) { | ||
return prop; | ||
} else { | ||
return getShorthandAssignmentDeclaration(checker, prop); | ||
} | ||
var _a; | ||
return (_a = checker.getPropertyOfType(checker.getTypeAtLocation(obj), key)) == null ? void 0 : _a.valueDeclaration; | ||
} | ||
@@ -416,3 +397,6 @@ function getValueNode(checker, node) { | ||
if (propTypes.length > 0) { | ||
const props = getPropertyAssignmentValue(checker, definition, "props"), values = props ? getProperties(checker, props) : null; | ||
let props = getValueNode(checker, getPropertyAssignmentValue(checker, definition, "props")); | ||
if (props && !ts7.isObjectLiteralExpression(props)) { | ||
props = void 0; | ||
} | ||
for (const symbol of propTypes) { | ||
@@ -422,3 +406,3 @@ const signature = (_a = symbol.declarations) == null ? void 0 : _a[0]; | ||
continue; | ||
const name = escapeQuotes$1(signature.name.getText()), type = checker.getTypeOfSymbol(symbol), valueNode = values == null ? void 0 : values.props.get(name), value = valueNode ? getValueNode(checker, valueNode.initializer) ?? valueNode : null; | ||
const name = escapeQuotes$1(signature.name.getText()), type = checker.getTypeOfSymbol(symbol), valueNode = props ? getPropertyAssignmentValue(checker, props, name) : null, value = valueNode && (ts7.isVariableDeclaration(valueNode) || ts7.isPropertyDeclaration(valueNode) || ts7.isPropertyAssignment(valueNode)) ? getValueNode(checker, valueNode.initializer) ?? valueNode : null; | ||
let info = { | ||
@@ -431,3 +415,4 @@ type | ||
if (declaration && ts7.isObjectLiteralExpression(declaration)) { | ||
info.value = ((_b = getPropertyAssignmentValue(checker, declaration, "value")) == null ? void 0 : _b.getText()) ?? "undefined"; | ||
const val = getPropertyAssignmentValue(checker, declaration, "value"); | ||
info.value = ((_b = val == null ? void 0 : val.initializer) == null ? void 0 : _b.getText()) ?? (val == null ? void 0 : val.getText()) ?? "undefined"; | ||
const attr = getValueNode( | ||
@@ -434,0 +419,0 @@ checker, |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.36.6", | ||
"version": "0.36.7", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "dist/types/index.d.ts", |
Sorry, the diff of this file is not supported yet
266324
7127