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

dgeni-packages

Package Overview
Dependencies
Maintainers
2
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dgeni-packages - npm Package Compare versions

Comparing version 0.24.0 to 0.24.1

jsdoc/services/code-name-matchers/import-declaration.js

8

CHANGELOG.md
# Changelog
# 0.24.1 7 February 2018
## Fixes
* **jsdoc**: braces in the description are not jsdoc types 35763aafa
* **typescript**: fallback to decorators from set accessor 3a4e56855
* **jsdoc**: handle import statements in code name matching 5db8fc90f
# 0.24.0 26 January 2018

@@ -4,0 +12,0 @@

1

jsdoc/services/code-name-matchers/index.js

@@ -13,2 +13,3 @@ module.exports = [

require('./identifier.js'),
require('./import-declaration'),
require('./literal.js'),

@@ -15,0 +16,0 @@ require('./member-expression.js'),

13

jsdoc/services/transforms/extract-type.js

@@ -5,3 +5,3 @@ // Much of this code was inspired by or simply copied from the JSDOC project.

var catharsis = require('catharsis');
var TYPE_EXPRESSION_START = /\{[^@]/;
var TYPE_EXPRESSION_START = /^\s*\{[^@]/;

@@ -18,7 +18,9 @@ /**

start = value.search(TYPE_EXPRESSION_START);
length = value.length;
if (start !== -1) {
var match = TYPE_EXPRESSION_START.exec(value);
if (match) {
length = value.length;
// the start is the beginning of the `{`
start = match[0].length - 2;
// advance to the first character in the type expression
position = start + 1;
position = match[0].length - 1;
count = 1;

@@ -58,2 +60,3 @@

} catch(x) {
console.log(tag);
throw new Error('Error parsing the jsdoc type expression "{' + tag.typeExpression + '}"', x);

@@ -60,0 +63,0 @@ }

var transformFactory = require('./extract-type');
describe("extract-type transform", function() {
fdescribe("extract-type transform", function() {

@@ -14,3 +14,3 @@ var transform;

it("should extract the type from the description", function() {
debugger;
value = ' {string} paramName - Some description \n Some more description';

@@ -34,2 +34,8 @@ value = transform(doc, tag, value);

});
it('should handle braces in the description', () => {
value = 'paramName - Some description \n Some `{ code: block }` in the description';
value = transform(doc, tag, value);
expect(value).toEqual('paramName - Some description \n Some `{ code: block }` in the description');
});
});
{
"name": "dgeni-packages",
"version": "0.24.0",
"version": "0.24.1",
"description": "A collection of dgeni packages for generating documentation from source code",

@@ -5,0 +5,0 @@ "scripts": {

@@ -18,3 +18,7 @@ "use strict";

function PropertyMemberDoc(containerDoc, symbol, declaration, getAccessorDeclaration, setAccessorDeclaration, isStatic) {
var _this = _super.call(this, containerDoc, symbol, (declaration || getAccessorDeclaration || setAccessorDeclaration), isStatic) || this;
var _this =
// For accessors, the declaration parameter will be null, and therefore the getter declaration
// will be used for most of the things (e.g. determination of the type). If the getter doesn't
// have a type or description, the setter will be checked manually later in this constructor.
_super.call(this, containerDoc, symbol, (declaration || getAccessorDeclaration || setAccessorDeclaration), isStatic) || this;
_this.name = _this.symbol.name;

@@ -27,4 +31,11 @@ _this.anchor = _this.name;

_this.setAccessor = setAccessorDeclaration && new AccessorInfoDoc_1.AccessorInfoDoc('set', _this, setAccessorDeclaration);
_this.type = _this.type || _this.setAccessor && _this.setAccessor.parameterDocs[0].type || '';
_this.content = _this.content || _this.setAccessor && _this.setAccessor.content || '';
// As mentioned before, by default the get accessor declaration will be passed to the superclass,
// to determine information about the property. With that approach, it can happen that a few
// things are not declared on the getter, but on the setter. In that case, if there is a
// setter, we add the missing information by looking at the setter info document.
if (_this.setAccessor) {
_this.type = _this.type || _this.setAccessor.parameterDocs[0].type || '';
_this.content = _this.content || _this.setAccessor.content || '';
_this.decorators = _this.decorators || _this.setAccessor.decorators;
}
return _this;

@@ -31,0 +42,0 @@ }

@@ -20,2 +20,11 @@ export class Test {

set noType(value: string) { /**/ }
/** Description of myProperty. */
@SomeDecorator()
set decoratorProp(value: string) {}
get decoratorProp() { return 'Hello'; }
}
export function SomeDecorator() {
return (target: any, args: any) => {}
}

@@ -333,2 +333,5 @@ "use strict";

var noTypeSetter;
var decoratorProp;
var decoratorPropGetter;
var decoratorPropSetter;
beforeEach(function () {

@@ -343,2 +346,3 @@ processor.sourceFiles = ['gettersAndSetters.ts'];

noType = docs.find(function (doc) { return doc.name === 'noType'; });
decoratorProp = docs.find(function (doc) { return doc.name === 'decoratorProp'; });
foo1Getter = docs.find(function (doc) { return doc.name === 'foo1:get'; });

@@ -354,2 +358,4 @@ foo1Setter = docs.find(function (doc) { return doc.name === 'foo1:set'; });

noTypeSetter = docs.find(function (doc) { return doc.name === 'noType:set'; });
decoratorPropGetter = docs.find(function (doc) { return doc.name === 'decoratorProp:get'; });
decoratorPropSetter = docs.find(function (doc) { return doc.name === 'decoratorProp:set'; });
});

@@ -412,2 +418,13 @@ it('should create a property member doc for property that has accessors', function () {

});
describe('if getter is missing information', function () {
it('should add decorators of the setter to the property doc', function () {
expect(decoratorProp.decorators[0].name).toBe('SomeDecorator');
});
it('should add description of the setter to the property doc', function () {
expect(decoratorProp.content).toBe('Description of myProperty.');
});
it('should add type of the setter to the property doc', function () {
expect(decoratorProp.type).toBe('string');
});
});
});

@@ -414,0 +431,0 @@ describe('method parameters', function () {

@@ -23,2 +23,5 @@ import { Declaration, GetAccessorDeclaration, SetAccessorDeclaration, SignatureDeclaration, Symbol, SyntaxKind } from 'typescript';

) {
// For accessors, the declaration parameter will be null, and therefore the getter declaration
// will be used for most of the things (e.g. determination of the type). If the getter doesn't
// have a type or description, the setter will be checked manually later in this constructor.
super(containerDoc, symbol, (declaration || getAccessorDeclaration || setAccessorDeclaration)!, isStatic);

@@ -29,5 +32,13 @@

this.setAccessor = setAccessorDeclaration && new AccessorInfoDoc('set', this, setAccessorDeclaration);
this.type = this.type || this.setAccessor && this.setAccessor.parameterDocs[0].type || '';
this.content = this.content || this.setAccessor && this.setAccessor.content || '';
// As mentioned before, by default the get accessor declaration will be passed to the superclass,
// to determine information about the property. With that approach, it can happen that a few
// things are not declared on the getter, but on the setter. In that case, if there is a
// setter, we add the missing information by looking at the setter info document.
if (this.setAccessor) {
this.type = this.type || this.setAccessor.parameterDocs[0].type || '';
this.content = this.content || this.setAccessor.content || '';
this.decorators = this.decorators || this.setAccessor.decorators;
}
}
}

@@ -407,2 +407,5 @@ import {Dgeni, DocCollection} from 'dgeni';

let noTypeSetter: AccessorInfoDoc;
let decoratorProp: PropertyMemberDoc;
let decoratorPropGetter: AccessorInfoDoc;
let decoratorPropSetter: AccessorInfoDoc;

@@ -419,2 +422,3 @@ beforeEach(() => {

noType = docs.find(doc => doc.name === 'noType');
decoratorProp = docs.find(doc => doc.name === 'decoratorProp');

@@ -435,2 +439,5 @@ foo1Getter = docs.find(doc => doc.name === 'foo1:get');

noTypeSetter = docs.find(doc => doc.name === 'noType:set');
decoratorPropGetter = docs.find(doc => doc.name === 'decoratorProp:get');
decoratorPropSetter = docs.find(doc => doc.name === 'decoratorProp:set');
});

@@ -498,2 +505,16 @@

});
describe('if getter is missing information', () => {
it('should add decorators of the setter to the property doc', () => {
expect(decoratorProp.decorators![0].name).toBe('SomeDecorator');
});
it('should add description of the setter to the property doc', () => {
expect(decoratorProp.content).toBe('Description of myProperty.');
});
it('should add type of the setter to the property doc', () => {
expect(decoratorProp.type).toBe('string');
});
});
});

@@ -500,0 +521,0 @@

Sorry, the diff of this file is not supported yet

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