documentalist
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
@@ -12,3 +12,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./markdown")); | ||
__export(require("./tags")); | ||
__export(require("./typescript")); | ||
__export(require("./utils")); |
@@ -48,1 +48,3 @@ /** | ||
} | ||
/** Type guard for `IPageNode`, useful for its `children` array. */ | ||
export declare function isPageNode(node: any): node is IPageNode; |
@@ -9,1 +9,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** Type guard for `IPageNode`, useful for its `children` array. */ | ||
function isPageNode(node) { | ||
return node != null && node.children != null; | ||
} | ||
exports.isPageNode = isPageNode; |
@@ -37,1 +37,8 @@ /** | ||
export declare type StringOrTag = string | ITag; | ||
/** | ||
* Type guard to determine if a `contents` node is an `@tag` statement. | ||
* Optionally tests tag name too, if `tagName` arg is provided. | ||
*/ | ||
export declare function isTag(node: any, tagName?: string): node is ITag; | ||
/** Type guard to deterimine if a `contents` node is an `@#+` heading tag. */ | ||
export declare function isHeadingTag(node: any): node is IHeadingTag; |
@@ -9,1 +9,14 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Type guard to determine if a `contents` node is an `@tag` statement. | ||
* Optionally tests tag name too, if `tagName` arg is provided. | ||
*/ | ||
function isTag(node, tagName) { | ||
return node != null && node.tag != null && (tagName == null || node.tag === tagName); | ||
} | ||
exports.isTag = isTag; | ||
/** Type guard to deterimine if a `contents` node is an `@#+` heading tag. */ | ||
function isHeadingTag(node) { | ||
return isTag(node, "heading"); | ||
} | ||
exports.isHeadingTag = isHeadingTag; |
@@ -16,5 +16,5 @@ /** | ||
Method = "method", | ||
Parameter = "parameter", | ||
MethodParameter = "method parameter", | ||
MethodSignature = "method signature", | ||
Property = "property", | ||
Signature = "signature", | ||
TypeAlias = "type alias", | ||
@@ -87,3 +87,3 @@ } | ||
export interface ITsMethodSignature extends ITsDocBase { | ||
kind: Kind.Signature; | ||
kind: Kind.MethodSignature; | ||
/** Method signatures do not have flags of their own. Flags can be found on the method itself and on each parameter. */ | ||
@@ -100,3 +100,3 @@ flags: undefined; | ||
export interface ITsMethodParameter extends ITsDocBase, ITsDefaultValue { | ||
kind: Kind.Parameter; | ||
kind: Kind.MethodParameter; | ||
/** Fully qualified type string describing this parameter. */ | ||
@@ -110,3 +110,3 @@ type: string; | ||
inheritedFrom?: string; | ||
/** Type string describing of this property. */ | ||
/** Type string describing this property. */ | ||
type: string; | ||
@@ -137,2 +137,4 @@ } | ||
kind: Kind.TypeAlias; | ||
/** Type string for which this member is an alias. */ | ||
type: string; | ||
} | ||
@@ -151,5 +153,11 @@ /** | ||
} | ||
export declare function isTsClass(data: any): data is ITsClass; | ||
export declare function isTsEnum(data: any): data is ITsEnum; | ||
export declare function isTsInterface(data: any): data is ITsInterface; | ||
export declare function isTsTypeAlias(data: any): data is ITsTypeAlias; | ||
export declare const isTsClass: (data: any) => data is ITsClass; | ||
export declare const isTsConstructor: (data: any) => data is ITsConstructor; | ||
export declare const isTsEnum: (data: any) => data is ITsEnum; | ||
export declare const isTsEnumMember: (data: any) => data is ITsEnumMember; | ||
export declare const isTsInterface: (data: any) => data is ITsInterface; | ||
export declare const isTsMethod: (data: any) => data is ITsMethod; | ||
export declare const isTsMethodParameter: (data: any) => data is ITsMethodParameter; | ||
export declare const isTsProperty: (data: any) => data is ITsProperty; | ||
export declare const isTsMethodSignature: (data: any) => data is ITsMethodSignature; | ||
export declare const isTsTypeAlias: (data: any) => data is ITsTypeAlias; |
@@ -18,22 +18,20 @@ "use strict"; | ||
Kind["Method"] = "method"; | ||
Kind["Parameter"] = "parameter"; | ||
Kind["MethodParameter"] = "method parameter"; | ||
Kind["MethodSignature"] = "method signature"; | ||
Kind["Property"] = "property"; | ||
Kind["Signature"] = "signature"; | ||
Kind["TypeAlias"] = "type alias"; | ||
})(Kind = exports.Kind || (exports.Kind = {})); | ||
function isTsClass(data) { | ||
return data != null && data.kind === Kind.Class; | ||
function typeguard(kind) { | ||
return (data) => data != null && data.kind === kind; | ||
} | ||
exports.isTsClass = isTsClass; | ||
function isTsEnum(data) { | ||
return data != null && data.kind === Kind.Enum; | ||
} | ||
exports.isTsEnum = isTsEnum; | ||
function isTsInterface(data) { | ||
return data != null && data.kind === Kind.Interface; | ||
} | ||
exports.isTsInterface = isTsInterface; | ||
function isTsTypeAlias(data) { | ||
return data != null && data.kind === Kind.TypeAlias; | ||
} | ||
exports.isTsTypeAlias = isTsTypeAlias; | ||
// wooooo typeguards | ||
exports.isTsClass = typeguard(Kind.Class); | ||
exports.isTsConstructor = typeguard(Kind.Constructor); | ||
exports.isTsEnum = typeguard(Kind.Enum); | ||
exports.isTsEnumMember = typeguard(Kind.EnumMember); | ||
exports.isTsInterface = typeguard(Kind.Interface); | ||
exports.isTsMethod = typeguard(Kind.Method); | ||
exports.isTsMethodParameter = typeguard(Kind.MethodParameter); | ||
exports.isTsProperty = typeguard(Kind.Property); | ||
exports.isTsMethodSignature = typeguard(Kind.MethodSignature); | ||
exports.isTsTypeAlias = typeguard(Kind.TypeAlias); |
@@ -7,13 +7,16 @@ /** | ||
*/ | ||
import { IHeadingTag, IPageNode, ITag } from "./index"; | ||
/** | ||
* Splits the `text` string into words and invokes the `callback` for each word that is | ||
* found in the `data` record. If not found, the word appears unchanged in the output | ||
* array. | ||
* | ||
* Example: | ||
* ```tsx | ||
* linkify("string | ITag", docs.typescript, (name) => <a href={`#api/${name}`}>{name}</a>) | ||
* // => | ||
* ["string", " | ", <a href="#api/ITag">ITag</a>] | ||
* ``` | ||
*/ | ||
export declare function linkify<D, T>(text: string, data: Record<string, D>, callback: (name: string, data: D) => T): Array<string | T>; | ||
/** Slugify a string: "Really Cool Heading!" => "really-cool-heading-" */ | ||
export declare function slugify(str: string): string; | ||
/** | ||
* Type guard to determine if a `contents` node is an `@tag` statement. | ||
* Optionally tests tag name too, if `tagName` arg is provided. | ||
*/ | ||
export declare function isTag(node: any, tagName?: string): node is ITag; | ||
/** Type guard to deterimine if a `contents` node is an `@#+` heading tag. */ | ||
export declare function isHeadingTag(node: any): node is IHeadingTag; | ||
/** Type guard for `IPageNode`, useful for its `children` array. */ | ||
export declare function isPageNode(node: any): node is IPageNode; |
@@ -9,2 +9,19 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Splits the `text` string into words and invokes the `callback` for each word that is | ||
* found in the `data` record. If not found, the word appears unchanged in the output | ||
* array. | ||
* | ||
* Example: | ||
* ```tsx | ||
* linkify("string | ITag", docs.typescript, (name) => <a href={`#api/${name}`}>{name}</a>) | ||
* // => | ||
* ["string", " | ", <a href="#api/ITag">ITag</a>] | ||
* ``` | ||
*/ | ||
function linkify(text, data, callback) { | ||
return text.split(WORD_SEPARATORS).map(word => (data[word] == null ? word : callback(word, data[word]))); | ||
} | ||
exports.linkify = linkify; | ||
const WORD_SEPARATORS = /([\[\]<>()| :.,]+)/g; | ||
/** Slugify a string: "Really Cool Heading!" => "really-cool-heading-" */ | ||
@@ -15,19 +32,1 @@ function slugify(str) { | ||
exports.slugify = slugify; | ||
/** | ||
* Type guard to determine if a `contents` node is an `@tag` statement. | ||
* Optionally tests tag name too, if `tagName` arg is provided. | ||
*/ | ||
function isTag(node, tagName) { | ||
return (node != null && node.tag !== undefined && (tagName === undefined || node.tag === tagName)); | ||
} | ||
exports.isTag = isTag; | ||
/** Type guard to deterimine if a `contents` node is an `@#+` heading tag. */ | ||
function isHeadingTag(node) { | ||
return isTag(node, "heading"); | ||
} | ||
exports.isHeadingTag = isHeadingTag; | ||
/** Type guard for `IPageNode`, useful for its `children` array. */ | ||
function isPageNode(node) { | ||
return node != null && node.children != null; | ||
} | ||
exports.isPageNode = isPageNode; |
@@ -7,4 +7,3 @@ /** | ||
*/ | ||
export * from "./client"; | ||
export * from "./documentalist"; | ||
export * from "./plugins"; |
@@ -12,4 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./client")); | ||
__export(require("./documentalist")); | ||
__export(require("./plugins")); |
@@ -5,9 +5,15 @@ import { ICompiler, IFile, IPlugin, ITypescriptPluginData } from "../../client"; | ||
/** | ||
* Array of glob strings to exclude entire files. Files in `node_modules/` are always excluded. | ||
* Note that when matching directories you'll need to capture the entire path using `**`s on either end. | ||
* Array of patterns (string or RegExp) to exclude members by name. | ||
* Strings will be converted to regular expressions through `string.match(pattern)`. | ||
* | ||
* Note that excluded members will still be parsed by the compiler, so they can be referenced | ||
* by other symbols, but they will not appear in the output data. | ||
*/ | ||
excludePaths?: string[]; | ||
/** Array of patterns (string or RegExp) to exclude named members. */ | ||
excludeNames?: Array<string | RegExp>; | ||
/** | ||
* Array of patterns (string or RegExp) to exclude members based on file path. | ||
* See `excludeNames` above for usage notes. | ||
*/ | ||
excludePaths?: Array<string | RegExp>; | ||
/** | ||
* Enable parsing of `.d.ts` files. | ||
@@ -14,0 +20,0 @@ * @default false |
@@ -23,4 +23,4 @@ "use strict"; | ||
this.visitMethod = (def) => (Object.assign({}, this.makeDocEntry(def, typescript_1.Kind.Method), { inheritedFrom: def.inheritedFrom && typestring_1.resolveTypeString(def.inheritedFrom), signatures: def.signatures.map(sig => this.visitSignature(sig)) })); | ||
this.visitSignature = (sig) => (Object.assign({}, this.makeDocEntry(sig, typescript_1.Kind.Signature), { flags: undefined, parameters: (sig.parameters || []).map(param => this.visitParameter(param)), returnType: typestring_1.resolveTypeString(sig.type), type: typestring_1.resolveSignature(sig) })); | ||
this.visitParameter = (param) => (Object.assign({}, this.makeDocEntry(param, typescript_1.Kind.Parameter), { defaultValue: getDefaultValue(param), type: typestring_1.resolveTypeString(param.type) })); | ||
this.visitSignature = (sig) => (Object.assign({}, this.makeDocEntry(sig, typescript_1.Kind.MethodSignature), { flags: undefined, parameters: (sig.parameters || []).map(param => this.visitParameter(param)), returnType: typestring_1.resolveTypeString(sig.type), type: typestring_1.resolveSignature(sig) })); | ||
this.visitParameter = (param) => (Object.assign({}, this.makeDocEntry(param, typescript_1.Kind.MethodParameter), { defaultValue: getDefaultValue(param), type: typestring_1.resolveTypeString(param.type) })); | ||
} | ||
@@ -48,6 +48,7 @@ visitProject(project) { | ||
visitChildren(children, visitor, comparator) { | ||
const { excludeNames = [], includeNonExportedMembers = false } = this.options; | ||
const { excludeNames = [], excludePaths = [], includeNonExportedMembers = false } = this.options; | ||
return children | ||
.filter(ref => (ref.flags.isExported || includeNonExportedMembers) && isNotExcluded(excludeNames, ref.name)) | ||
.filter(ref => ref.flags.isExported || includeNonExportedMembers) | ||
.map(visitor) | ||
.filter(doc => isNotExcluded(excludeNames, doc.name) && isNotExcluded(excludePaths, doc.fileName)) | ||
.sort(comparator); | ||
@@ -54,0 +55,0 @@ } |
{ | ||
"name": "documentalist", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "documentation for the rest of us", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
77402
1664