Comparing version 0.9.1 to 1.0.0
@@ -0,1 +1,6 @@ | ||
1.0.0 / 2022-09-06 | ||
================== | ||
* jsdoctypeparser finally updated to latest version | ||
0.9.1 / 2022-04-26 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -409,16 +409,46 @@ /*! | ||
} | ||
var Parser = require('jsdoctypeparser').Parser; | ||
var Builder = require('jsdoctypeparser').Builder; | ||
var result = new Parser().parse(str.substr(1, str.length - 2)); | ||
var {parse, publish, createDefaultPublisher, NodeType, SyntaxType} = require('jsdoctypeparser'); | ||
var result = parse(str.substring(1, str.length - 1)); | ||
var customPublisher = Object.assign({}, createDefaultPublisher(), { | ||
NAME(nameNode) { | ||
var output = '<code>' + nameNode.name + '</code>'; | ||
if (result.type === NodeType.OPTIONAL) { | ||
output += '|<code>undefined</code>'; | ||
} else if (result.type === NodeType.NULLABLE) { | ||
output += '|<code>null</code>'; | ||
} | ||
return output; | ||
} | ||
}); | ||
var types = (function transform(type) { | ||
if(type instanceof Builder.TypeUnion) { | ||
return type.types.map(transform); | ||
} else if(type instanceof Builder.TypeName) { | ||
return type.name; | ||
} else if(type instanceof Builder.RecordType) { | ||
return type.entries.reduce(function(obj, entry) { | ||
obj[entry.name] = transform(entry.typeUnion); | ||
if (type && type.type === NodeType.UNION) { | ||
return [transform(type.left), transform(type.right)].flat(); | ||
} else if (type && type.type === NodeType.NAME) { | ||
return [type.name]; | ||
} else if (type && type.type === NodeType.RECORD) { | ||
return [type.entries.reduce(function (obj, entry) { | ||
obj[entry.key] = transform(entry.value); | ||
return obj; | ||
}, {}); | ||
}, {})]; | ||
} else if (type && type.type === NodeType.GENERIC) { | ||
if (type.meta.syntax === SyntaxType.GenericTypeSyntax.ANGLE_BRACKET) { | ||
return [type.subject.name + '<' + transform(type.objects[0]).join('|') + '>']; | ||
} else if (type.meta.syntax === SyntaxType.GenericTypeSyntax.ANGLE_BRACKET_WITH_DOT) { | ||
return [type.subject.name + '.<' + transform(type.objects[0]).join('|') + '>']; | ||
} else if (type.meta.syntax === SyntaxType.GenericTypeSyntax.SQUARE_BRACKET) { | ||
return [type.subject.name + '[' + transform(type.objects[0]).join('|') + ']']; | ||
} else if (type.meta.syntax === SyntaxType.VariadicTypeSyntax.PREFIX_DOTS) { | ||
return [`...${type.subject.name}`]; | ||
} else if (type.meta.syntax === SyntaxType.VariadicTypeSyntax.SUFFIX_DOTS) { | ||
return [`${type.subject.name}...`]; | ||
} else if (type.meta.syntax === SyntaxType.VariadicTypeSyntax.ONLY_DOTS) { | ||
return ['...']; | ||
} | ||
return [type.subject.name] | ||
} else if (type && type.value) { | ||
return transform(type.value); | ||
} else { | ||
@@ -431,7 +461,7 @@ return type.toString(); | ||
tag.types = types; | ||
tag.typesDescription = result.toHtml(); | ||
tag.optional = (tag.name && tag.name.slice(0,1) === '[') || result.optional; | ||
tag.nullable = result.nullable; | ||
tag.nonNullable = result.nonNullable; | ||
tag.variable = result.variable; | ||
tag.typesDescription = publish(result, customPublisher).replace(/^\?|=$/, ''); | ||
tag.optional = (tag.name && tag.name.slice(0,1) === '[') || result.type === NodeType.OPTIONAL; | ||
tag.nullable = result.type === NodeType.NULLABLE; | ||
tag.nonNullable = result.meta ? result.meta.syntax === 'SUFFIX_QUESTION_MARK' || result.meta.syntax === 'PREFIX_BANG': false; | ||
tag.variable = result.type === NodeType.VARIADIC; | ||
} | ||
@@ -438,0 +468,0 @@ |
{ | ||
"name": "dox", | ||
"description": "Markdown / JSdoc documentation generator", | ||
"version": "0.9.1", | ||
"version": "1.0.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -31,8 +31,8 @@ "contributors": [ | ||
"dependencies": { | ||
"commander": "9.1.0", | ||
"jsdoctypeparser": "^1.2.0", | ||
"markdown-it": "12.3.2" | ||
"commander": "9.4.0", | ||
"jsdoctypeparser": "^9.0.0", | ||
"markdown-it": "13.0.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "9.2.2", | ||
"mocha": "10.0.0", | ||
"should": "13.2.3" | ||
@@ -39,0 +39,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
0
46047
11
743
+ Addedcommander@9.4.0(transitive)
+ Addedentities@3.0.1(transitive)
+ Addedjsdoctypeparser@9.0.0(transitive)
+ Addedlinkify-it@4.0.1(transitive)
+ Addedmarkdown-it@13.0.1(transitive)
- Removedcommander@9.1.0(transitive)
- Removedentities@2.1.0(transitive)
- Removedjsdoctypeparser@1.2.0(transitive)
- Removedlinkify-it@3.0.3(transitive)
- Removedlodash@3.10.1(transitive)
- Removedmarkdown-it@12.3.2(transitive)
Updatedcommander@9.4.0
Updatedjsdoctypeparser@^9.0.0
Updatedmarkdown-it@13.0.1