Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: documentationjs/documentation
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.0.0-beta.19
Choose a base ref
...
head repository: documentationjs/documentation
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.0.0-rc.0
Choose a head ref
  • 12 commits
  • 29 files changed
  • 4 contributors

Commits on Apr 10, 2017

  1. Copy the full SHA
    e4e7866 View commit details

Commits on Apr 12, 2017

  1. test(description-tag): Confirm behavior of description tag with tests (

    …#720)
    
    The `@description` tag allows people to specify a description of a node in any place in the JSDoc
    comment, instead of only at the beginning.
    
    Fixes #341
    tmcw authored Apr 12, 2017
    Copy the full SHA
    5b48290 View commit details
  2. Copy the full SHA
    191056e View commit details

Commits on Apr 13, 2017

  1. fix(params): added code path for type RestElement

    * FIX: added code path for type RestElement
    
    * TEST: integration test for documenting RestElement node
    hey-leon authored and tmcw committed Apr 13, 2017
    Copy the full SHA
    6961ee8 View commit details
  2. Copy the full SHA
    fc1cd13 View commit details

Commits on Apr 14, 2017

  1. refactor(exported-extractor): Use Map object instead of Object.create…

    …(null) (#730)
    
    The map object provides a cleaner and more predictable way to deal with indexed data in JavaScript.
    I wrote something about that here http://www.macwright.org/2017/03/13/maps-not-strictly-better.html
    tmcw authored Apr 14, 2017
    Copy the full SHA
    d8ec5da View commit details

Commits on Apr 15, 2017

  1. Copy the full SHA
    9eca36c View commit details

Commits on Apr 21, 2017

  1. refactor(nest): Better nesting implementation (#732)

    * refactor(nest): Better nesting implementation
    
    This nesting implementation uses a proper recursive tree algorithm
    
    Fixes #554
    
    BREAKING CHANGE: referencing inferred destructure params without
    renaming them, like $0.x, from JSDoc comments will no longer
    work. To reference them, instead add a param tag to name the
    destructuring param, and then refer to members of that name.
    
    Before:
    
    ```js
    /**
     * @param {number} $0.x a member of x
     */
    function a({ x }) {}
    ```
    
    After:
    
    ```js
    /**
     * @param {Object} options
     * @param {number} options.x a member of x
     */
    function a({ x }) {}
    ```
    
    * Address review comments
    
    * Reduce testing node requirement back down to 4
    
    * Don't output empty properties, reduce diff noise
    
    * Rearrange and document params
    
    * Simplify param inference, update test fixtures. This is focused around Array destructuring: documenting destructured array elements with indices instead of names, because the names are purely internal details
    
    * Use temporary fork to get through blocker
    tmcw authored Apr 21, 2017
    Copy the full SHA
    7374730 View commit details
  2. refactor: Move index.js to lib (#744)

    Fixes #736
    tmcw authored Apr 21, 2017
    Copy the full SHA
    a15b071 View commit details
  3. Copy the full SHA
    9554b2f View commit details
  4. Copy the full SHA
    e5ea56d View commit details
  5. chore(release): 4.0.0-rc.0

    tmcw committed Apr 21, 2017

    Verified

    This commit was signed with the committer’s verified signature.
    tmcw Tom MacWright
    Copy the full SHA
    b595c8f View commit details
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,61 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="4.0.0-rc.0"></a>
# [4.0.0-rc.0](https://github.com/documentationjs/documentation/compare/v4.0.0-beta.19...v4.0.0-rc.0) (2017-04-21)


### Bug Fixes

* **html output:** Fix github links in HTML output ([#745](https://github.com/documentationjs/documentation/issues/745)) ([9554b2f](https://github.com/documentationjs/documentation/commit/9554b2f)), closes [#738](https://github.com/documentationjs/documentation/issues/738)
* **params:** added code path for type RestElement ([6961ee8](https://github.com/documentationjs/documentation/commit/6961ee8))


### Code Refactoring

* **nest:** Better nesting implementation ([#732](https://github.com/documentationjs/documentation/issues/732)) ([7374730](https://github.com/documentationjs/documentation/commit/7374730))


### BREAKING CHANGES

* **nest:** referencing inferred destructure params without
renaming them, like $0.x, from JSDoc comments will no longer
work. To reference them, instead add a param tag to name the
destructuring param, and then refer to members of that name.

Before:

```js
/**
* @param {number} $0.x a member of x
*/
function a({ x }) {}
```

After:

```js
/**
* @param {Object} options
* @param {number} options.x a member of x
*/
function a({ x }) {}
```

* Address review comments

* Reduce testing node requirement back down to 4

* Don't output empty properties, reduce diff noise

* Rearrange and document params

* Simplify param inference, update test fixtures. This is focused around Array destructuring: documenting destructured array elements with indices instead of names, because the names are purely internal details

* Use temporary fork to get through blocker



<a name="4.0.0-beta.19"></a>
# [4.0.0-beta.19](https://github.com/documentationjs/documentation/compare/v4.0.0-beta.18...v4.0.0-beta.19) (2017-04-10)

78 changes: 47 additions & 31 deletions declarations/comment.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
declare type DocumentationConfig = {
type DocumentationConfig = {
polyglot?: boolean,
inferPrivate?: boolean,
inferPrivate?: string,
noPackage?: boolean,
toc?: Array<Object>,
paths?: { [key: string]: number },
access?: Array<string>,
defaultGlobals?: boolean,
defaultGlobalsEnvs?: Array<string>,
external?: Array<string>,
@@ -12,25 +13,25 @@ declare type DocumentationConfig = {
parseExtension: Array<string>
};

declare type InputsConfig = {
type InputsConfig = {
inputs: Array<SourceFile>,
config: DocumentationConfig
};

declare type CommentError = {
type CommentError = {
message: string,
commentLineNumber?: number
};

declare type DoctrineType = {
type DoctrineType = {
elements?: Array<DoctrineType>,
expression?: DoctrineType,
applications?: Array<DoctrineType>,
type: string,
name?: string
};

declare type CommentLoc = {
type CommentLoc = {
start: {
line: number
},
@@ -39,12 +40,12 @@ declare type CommentLoc = {
}
};

declare type SourceFile = {
type SourceFile = {
source?: string,
file: string
};

declare type CommentContext = {
type CommentContext = {
sortKey: string,
file: string,
ast: Object,
@@ -53,12 +54,26 @@ declare type CommentContext = {
github?: CommentContextGitHub
};

declare type CommentContextGitHub = {
type CommentContextGitHub = {
path: string,
url: string
};

declare type CommentTag = {
type CommentTagBase = {
title: string
};

type CommentTag = CommentTagBase & {
name?: string,
title: string,
description?: Object,
default?: any,
lineNumber?: number,
type?: DoctrineType,
properties?: Array<CommentTag>
};

type CommentTagNamed = CommentTag & {
name?: string,
title: string,
description?: Object,
@@ -68,40 +83,41 @@ declare type CommentTag = {
properties?: Array<CommentTag>
};

declare type CommentMembers = {
type CommentMembers = {
static: Array<Comment>,
instance: Array<Comment>,
events: Array<Comment>,
global: Array<Comment>,
inner: Array<Comment>
};

declare type CommentExample = {
type CommentExample = {
caption?: string,
description?: Object
};

declare type Remark = {
type Remark = {
type: string,
children: Array<Object>
};

declare type Access = 'private' | 'public' | 'protected';
declare type Scope = 'instance' | 'static' | 'inner' | 'global';
declare type Kind = 'class' |
'constant' |
'event' |
'external' |
'file' |
'function' |
'member' |
'mixin' |
'module' |
'namespace' |
'typedef' |
'interface';

declare type Comment = {
type Access = 'private' | 'public' | 'protected';
type Scope = 'instance' | 'static' | 'inner' | 'global';
type Kind =
| 'class'
| 'constant'
| 'event'
| 'external'
| 'file'
| 'function'
| 'member'
| 'mixin'
| 'module'
| 'namespace'
| 'typedef'
| 'interface';

type Comment = {
errors: Array<CommentError>,
tags: Array<CommentTag>,

@@ -148,8 +164,8 @@ declare type Comment = {
}>
};

declare type ReducedComment = {
type ReducedComment = {
name: string,
kind: ?Kind,
scope?: ?Scope
}
};
8 changes: 4 additions & 4 deletions default_theme/section._
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
</h3>
<% } %>
<% if (section.context && section.context.github) { %>
<a class='fr fill-darken0 round round pad1x quiet h5' href='<%= section.context.github %>'>
<span><%= section.context.path %></span>
<a class='fr fill-darken0 round round pad1x quiet h5' href='<%= section.context.github.url %>'>
<span><%= section.context.github.path %></span>
</a>
<% } %>
</div>
@@ -52,7 +52,7 @@
= <code><%- param.default %></code><% } %>)</code>
<%= md(param.description, true) %>
</div>
<% if (param.properties) { %>
<% if (param.properties && param.properties.length) { %>
<table class='mt1 mb2 fixed-table h5 col-12'>
<colgroup>
<col width='30%' />
@@ -93,7 +93,7 @@
<% } %><% if (property.description) {
%>: <%= md(property.description, true) %><%
} %>
<% if (property.properties) { %>
<% if (property.properties && property.properties.length) { %>
<ul>
<% property.properties.forEach(function(property) { %>
<li><code><%- property.name %></code> <%= formatType(property.type) %>
6 changes: 3 additions & 3 deletions lib/extractors/exported.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ function walkExported(
) {
var newResults = [];
var filename = data.file;
var dataCache = Object.create(null);
var dataCache = new Map();

function addBlankComment(data, path, node) {
return addComment(data, '', node.loc, path, node.loc, true);
@@ -178,7 +178,7 @@ function getCachedData(dataCache, filePath) {
path = require.resolve(path);
}

var value = dataCache[path];
var value = dataCache.get(path);
if (!value) {
var input = fs.readFileSync(path, 'utf-8');
var ast = parseToAst(input, path);
@@ -189,7 +189,7 @@ function getCachedData(dataCache, filePath) {
},
ast
};
dataCache[path] = value;
dataCache.set(path, value);
}
return value;
}
Loading