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

@raycast/generate-docs

Package Overview
Dependencies
Maintainers
8
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@raycast/generate-docs - npm Package Compare versions

Comparing version 0.8.9 to 0.8.10

59

index.js

@@ -263,3 +263,5 @@ #!/usr/bin/env node

console.log(JSON.stringify(namesMap.get(name), null, " "));
throw new Error("Cannot find react component " + name);
throw new Error(
`Cannot find react component ${name}.\nIf you are positive that the react component exists in the codebase and is exported, ping someone (probably Mathieu) to have a look.`
);
}

@@ -291,9 +293,12 @@

)
.map((prop) => [
prop.name,
utils.getPropTypeString(prop, typeParameters),
!prop.flags?.isOptional, // required
utils.getDefaultValue(prop), // default
utils.getDescription(prop),
]);
.map((prop) => {
const context = { parent: name, name: prop.name };
return [
prop.name,
utils.getPropTypeString(prop, typeParameters, context),
!prop.flags?.isOptional, // required
utils.getDefaultValue(prop), // default
utils.getDescription(prop),
];
});

@@ -330,3 +335,5 @@ newContent = newContent.replace(

console.log(JSON.stringify(namesMap.get(name), null, " "));
throw new Error("Cannot find interface " + name);
throw new Error(
`Cannot find interface ${name}.\nIf you are positive that the interface exists in the codebase and is exported, ping someone (probably Mathieu) to have a look.`
);
}

@@ -354,8 +361,11 @@

)
.map((prop) => [
prop.name,
utils.getPropTypeString(prop, typeParameters),
!prop.flags?.isOptional, // required
utils.getDescription(prop),
]);
.map((prop) => {
const context = { parent: name, name: prop.name };
return [
prop.name,
utils.getPropTypeString(prop, typeParameters, context),
!prop.flags?.isOptional, // required
utils.getDescription(prop),
];
});

@@ -391,3 +401,5 @@ newContent = newContent.replace(

console.log(JSON.stringify(namesMap.get(name), null, " "));
throw new Error("Cannot find function " + name);
throw new Error(
`Cannot find function ${name}.\nIf you are positive that the react component exists in the codebase and is exported, ping someone (probably Mathieu) to have a look.`
);
}

@@ -412,8 +424,11 @@

)
.map((prop) => [
prop.name,
utils.getPropTypeString(prop, typeParameters),
!prop.flags?.isOptional, // required
utils.getDescription(prop),
]);
.map((prop) => {
const context = { parent: name, name: prop.name };
return [
prop.name,
utils.getPropTypeString(prop, typeParameters, context),
!prop.flags?.isOptional, // required
utils.getDescription(prop),
];
});

@@ -420,0 +435,0 @@ newContent = newContent.replace(

{
"name": "@raycast/generate-docs",
"version": "0.8.9",
"version": "0.8.10",
"description": "",

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

@@ -13,5 +13,5 @@ // @ts-check

module.exports = (docs, idsMap, namesMap, aliasesMap, anchors) => {
function getPropTypeString(prop, typeParameters = []) {
function getPropTypeString(prop, typeParameters = [], context) {
if (prop.type) {
return getTypeString(prop.type, typeParameters);
return getTypeString(prop.type, typeParameters, context);
}

@@ -26,5 +26,6 @@ if (

.map(
({ name, type }) => `${name}: ${getTypeString(type, typeParameters)}`
({ name, type }) =>
`${name}: ${getTypeString(type, typeParameters, context)}`
)
.join(", ")}) => ${getTypeString(sig.type, typeParameters)}`;
.join(", ")}) => ${getTypeString(sig.type, typeParameters, context)}`;
}

@@ -39,11 +40,18 @@ if (

.map(
({ name, type }) => `${name}: ${getTypeString(type, typeParameters)}`
({ name, type }) =>
`${name}: ${getTypeString(type, typeParameters, context)}`
)
.join(", ")}) => ${getTypeString(sig.type, typeParameters)}`;
.join(", ")}) => ${getTypeString(sig.type, typeParameters, context)}`;
}
if (prop.kindString === "Accessor") {
return getTypeString(prop.getSignature[0].type, typeParameters);
return getTypeString(prop.getSignature[0].type, typeParameters, context);
}
throw new Error(
`TODO: unsupported prop in getPropTypeString: ${JSON.stringify(prop)}`
`Unsupported prop type for ${prop.parent}'s ${
prop.name
} in getPropTypeString\n${JSON.stringify(
prop,
null,
" "
)}.\nThat's unexpected so ping someone (probably Mathieu) to have a look.`
);

@@ -60,3 +68,3 @@ }

function getTypeString(item, typeParameters = []) {
function getTypeString(item, typeParameters = [], context) {
if (item.type === "intrinsic") {

@@ -68,3 +76,3 @@ return item.name;

if (typeParameter) {
return getTypeString(typeParameter, typeParameters);
return getTypeString(typeParameter, typeParameters, context);
}

@@ -84,3 +92,3 @@

if (comp) {
return getNamespacedName(comp);
return getNamespacedName(comp, context);
}

@@ -99,15 +107,15 @@ }

// special case for PathLike because we are documenting it
return getNamespacedName(item);
return getNamespacedName(item, context);
}
return item.qualifiedName;
}
return getNamespacedName(item);
return getNamespacedName(item, context);
}
if (item.type === "union" || item.type === "intersection") {
return item.types
.flatMap((type) => getTypeString(type, typeParameters))
.flatMap((type) => getTypeString(type, typeParameters, context))
.join(" | ");
}
if (item.type === "array") {
return getTypeString(item.elementType, typeParameters) + "[]";
return getTypeString(item.elementType, typeParameters, context) + "[]";
}

@@ -125,5 +133,6 @@ if (item.type === "literal") {

.flatMap(
({ name, type }) => `${name}: ${getTypeString(type, typeParameters)}`
({ name, type }) =>
`${name}: ${getTypeString(type, typeParameters, context)}`
)
.join(", ")}) => ${getTypeString(sig.type, typeParameters)}`;
.join(", ")}) => ${getTypeString(sig.type, typeParameters, context)}`;
}

@@ -133,3 +142,4 @@ if (item.type === "reflection" && item.declaration.children?.length > 0) {

.map(
({ name, type }) => `${name}: ${getTypeString(type, typeParameters)}`
({ name, type }) =>
`${name}: ${getTypeString(type, typeParameters, context)}`
)

@@ -139,15 +149,17 @@ .join("; ")} }`;

if (item.type === "query") {
return getTypeString(item.queryType, typeParameters);
return getTypeString(item.queryType, typeParameters, context);
}
throw new Error(
`TODO: unsupported type in getTypeString: ${JSON.stringify(
`Unsupported type for ${prop.parent}'s ${
prop.name
} in getTypeString\n${JSON.stringify(
item,
null,
" "
)}`
)}.\nThat's unexpected so ping someone (probably Mathieu) to have a look.`
);
}
function getNamespacedName(item) {
function getNamespacedName(item, context) {
const alias = aliasesMap.get(item.name);

@@ -185,3 +197,9 @@

alias || item.name
}" so we could not generate the link`
}" when try to get the type of ${prop.parent}'s ${
prop.name
} so we could not generate the link.\nYou probably need to find the markdown file where ${
prop.parent
} is documented and add a "### ${
alias || item.name
}" section under the "## Types" section.`
);

@@ -195,3 +213,3 @@ }

if (!match) {
throw new Error("cannot find " + name);
return undefined;
}

@@ -232,3 +250,3 @@ return match.find((x) => x.type && is.ReactComponentType(x.type));

if (!match) {
throw new Error("cannot find " + name);
return undefined;
}

@@ -308,3 +326,3 @@ return match.find(

if (!match) {
throw new Error("cannot find " + name);
return undefined;
}

@@ -311,0 +329,0 @@ return match.find((x) => x.kindString === "Function");

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