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

@documentalist/client

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@documentalist/client - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

changelog/@unreleased/.gitkeep

10

lib/compiler.d.ts

@@ -20,3 +20,3 @@ /**

*/
export interface ICompiler {
export interface Compiler {
/**

@@ -42,3 +42,3 @@ * Converts an array of entries into a map of key to entry, using given

*/
renderBlock(blockContent: string, reservedTagWords?: string[]): IBlock;
renderBlock(blockContent: string, reservedTagWords?: string[]): Block;
/**

@@ -62,3 +62,3 @@ * Render a string of markdown to HTML, using the options from `Documentalist`.

*/
export interface IMetadata {
export interface Metadata {
/**

@@ -80,3 +80,3 @@ * Unique ID for addressing this page.

*/
export interface IBlock {
export interface Block {
/** Parsed nodes of source file. An array of markdown-rendered HTML strings or `@tag` objects. */

@@ -87,3 +87,3 @@ contents: StringOrTag[];

/** Arbitrary YAML metadata parsed from front matter of source file, if any, or `{}`. */
metadata: IMetadata;
metadata: Metadata;
}

@@ -17,3 +17,3 @@ /**

/** A single modifier for an example. */
export interface IKssModifier {
export interface KssModifier {
documentation: string;

@@ -25,3 +25,3 @@ name: string;

*/
export interface IKssExample {
export interface KssExample {
/** Raw documentation string. */

@@ -40,3 +40,3 @@ documentation: string;

/** Array of modifiers supported by HTML markup. */
modifiers: IKssModifier[];
modifiers: KssModifier[];
/** Unique reference for addressing this example. */

@@ -50,6 +50,6 @@ reference: string;

*/
export interface IKssPluginData {
export interface KssPluginData {
css: {
[reference: string]: IKssExample;
[reference: string]: KssExample;
};
}

@@ -16,4 +16,4 @@ /**

*/
import { IBlock } from "./compiler";
import { INavigable } from "./tags";
import { Block } from "./compiler";
import { Navigable } from "./tags";
/**

@@ -23,3 +23,3 @@ * The `MarkdownPlugin` exports a map of markdown `pages` keyed by reference,

*/
export interface IMarkdownPluginData {
export interface MarkdownPluginData {
/**

@@ -30,6 +30,6 @@ * An ordered, nested, multi-rooted tree describing the navigation layout

*/
nav: IPageNode[];
nav: PageNode[];
/** A map of page reference to data. */
pages: {
[reference: string]: IPageData;
[reference: string]: PageData;
};

@@ -40,3 +40,3 @@ }

*/
export interface IPageData extends IBlock {
export interface PageData extends Block {
/** Unique identifier for addressing this page. */

@@ -52,3 +52,3 @@ reference: string;

/** An `@#+` tag belongs to a specific page. */
export interface IHeadingNode extends INavigable {
export interface HeadingNode extends Navigable {
/** Display title of page heading. */

@@ -58,9 +58,9 @@ title: string;

/** A page has ordered children composed of `@#+` and `@page` tags. */
export interface IPageNode extends IHeadingNode {
export interface PageNode extends HeadingNode {
/** Ordered list of pages and headings that appear on this page. */
children: Array<IPageNode | IHeadingNode>;
children: Array<PageNode | HeadingNode>;
/** Unique reference of this page, used for retrieval from store. */
reference: string;
}
/** Type guard for `IPageNode`, useful for its `children` array. */
export declare function isPageNode(node: any): node is IPageNode;
/** Type guard for `PageNode`, useful for its `children` array. */
export declare function isPageNode(node: any): node is PageNode;

@@ -19,3 +19,3 @@ "use strict";

exports.isPageNode = void 0;
/** Type guard for `IPageNode`, useful for its `children` array. */
/** Type guard for `PageNode`, useful for its `children` array. */
function isPageNode(node) {

@@ -22,0 +22,0 @@ return node != null && node.children != null;

@@ -19,3 +19,3 @@ /**

*/
export interface INpmPackage {
export interface NpmPackageInfo {
/** Package name. */

@@ -41,10 +41,10 @@ name: string;

/**
* The `KssPlugin` exports a `css` key that contains a map of styleguide references to markup/modifier examples.
* The `NpmPlugin` exports an `npm` key that contains a map of package names to their associated metadata.
*
* @see KSSPlugin
* @see NpmPlugin
*/
export interface INpmPluginData {
export interface NpmPluginData {
npm: {
[packageName: string]: INpmPackage;
[packageName: string]: NpmPackageInfo;
};
}

@@ -16,3 +16,3 @@ /**

*/
import { ICompiler } from "./compiler";
import { Compiler } from "./compiler";
/**

@@ -26,3 +26,3 @@ * A Documentalist plugin is an object with a `compile(files, compiler)` function

* ```ts
* import { ICompiler, IFile, IPlugin } from "documentalist/client";
* import { Compiler, File, Plugin } from "documentalist/client";
*

@@ -37,6 +37,6 @@ * export interface MyData {

*
* export class MyPlugin implements IPlugin<MyData> {
* export class MyPlugin implements Plugin<MyData> {
* public constructor(options: MyOptions = {}) {}
*
* public compile(files: IFile[], compiler: ICompiler) {
* public compile(files: File[], compiler: Compiler) {
* return files.map(transformToMyData);

@@ -47,4 +47,4 @@ * }

*/
export interface IPlugin<T> {
compile(files: IFile[], compiler: ICompiler): T | Promise<T>;
export interface Plugin<T> {
compile(files: File[], compiler: Compiler): T | Promise<T>;
}

@@ -55,5 +55,5 @@ /**

*/
export interface IFile {
export interface File {
path: string;
read(): string;
}

@@ -17,3 +17,3 @@ /**

/** Represents a single `@tag <value>` line from a file. */
export interface ITag {
export interface Tag {
/** Tag name. */

@@ -28,3 +28,3 @@ tag: string;

*/
export interface INavigable {
export interface Navigable {
/** Fully-qualified route of the heading, which can be used as anchor `href`. */

@@ -43,7 +43,7 @@ route: string;

*/
export interface IHeadingTag extends ITag, INavigable {
export interface HeadingTag extends Tag, Navigable {
tag: "heading";
}
/** An entry in `contents` array: either an HTML string or an `@tag`. */
export declare type StringOrTag = string | ITag;
export type StringOrTag = string | Tag;
/**

@@ -53,4 +53,4 @@ * Type guard to determine if a `contents` node is an `@tag` statement.

*/
export declare function isTag(node: any, tagName?: string): node is ITag;
export declare function isTag(node: any, tagName?: string): node is Tag;
/** Type guard to deterimine if a `contents` node is an `@#+` heading tag. */
export declare function isHeadingTag(node: any): node is IHeadingTag;
export declare function isHeadingTag(node: any): node is HeadingTag;

@@ -16,3 +16,3 @@ /**

*/
import { IBlock } from "./compiler";
import { Block } from "./compiler";
/** Enumeration describing the various kinds of member supported by this plugin. */

@@ -33,3 +33,3 @@ export declare enum Kind {

/** Compiler flags about this member. */
export interface ITsFlags {
export interface TsFlags {
/** This flag supports an optional message, typically used to include a version number. */

@@ -47,10 +47,10 @@ isDeprecated?: boolean | string;

/** Base type for all typescript documentation members. */
export interface ITsDocBase<K extends Kind = Kind> {
export interface TsDocBase<K extends Kind = Kind> {
/** Type brand indicating kind of member; type guards will reveal further information about it. */
kind: K;
/** Compiled documentation: `contents` field contains an array of markdown strings or `@tag value` objects. */
documentation?: IBlock;
documentation?: Block;
/** Original file name in which this member originated, relative to current working directory. */
fileName?: string;
flags?: ITsFlags;
flags?: TsFlags;
/** Name of this member in code, also used as its identifiers in the data store. */

@@ -68,13 +68,13 @@ name: string;

* Common type for a callable member, something that can be invoked.
* @see ITsConstructor
* @see ITsMethod
* @see TsConstructor
* @see TsMethod
*/
export interface ITsCallable {
export interface TsCallable {
/** Type name from which this method was inherited. Typically takes the form `Interface.member`. */
inheritedFrom?: string;
/** A method has at least one signature, which describes the parameters and return type and contains documentation. */
signatures: ITsSignature[];
signatures: TsSignature[];
}
/** Re-usable interface for Typescript members that support a notion of "default value." */
export interface ITsDefaultValue {
export interface TsDefaultValue {
/** The default value of this property, from an initializer or an `@default` tag. */

@@ -84,3 +84,3 @@ defaultValue?: string;

/** Re-usable interface for Typescript members that look like objects. */
export interface ITsObjectDefinition {
export interface TsObjectDefinition {
/** List of type strings that this definition `extends`. */

@@ -91,21 +91,21 @@ extends?: string[];

/** Index signature for this object, if declared. */
indexSignature?: ITsSignature;
indexSignature?: TsSignature;
/** Property members of this definition. */
properties: ITsProperty[];
properties: TsProperty[];
/** Method members of this definiton. */
methods: ITsMethod[];
methods: TsMethod[];
}
/**
* Documentation for a class constructor. See `signatures` array for actual callable signatures and rendered docs.
* @see ITsClass
* @see TsClass
*/
export interface ITsConstructor extends ITsDocBase, ITsCallable {
export interface TsConstructor extends TsDocBase, TsCallable {
kind: Kind.Constructor;
}
export interface ITsAccessor extends ITsDocBase {
export interface TsAccessor extends TsDocBase {
kind: Kind.Accessor;
/** If a set signature is defined and documented for this accessor, this will contain its documentation. */
getDocumentation: IBlock | undefined;
getDocumentation: Block | undefined;
/** If a get signature is defined and documented for this accessor, this will contain its documentation. */
setDocumentation: IBlock | undefined;
setDocumentation: Block | undefined;
/** Type of the accessor. */

@@ -115,3 +115,3 @@ type: string;

/** Documentation for a method. See `signatures` array for actual callable signatures and rendered docs. */
export interface ITsMethod extends ITsDocBase, ITsCallable {
export interface TsMethod extends TsDocBase, TsCallable {
kind: Kind.Method;

@@ -123,3 +123,3 @@ }

*/
export interface ITsSignature extends ITsDocBase {
export interface TsSignature extends TsDocBase {
kind: Kind.Signature;

@@ -129,3 +129,3 @@ /** Signatures do not have flags of their own. Flags can be found on the parent and on each parameter. */

/** Signature parameters, each with their own docs and data. */
parameters: ITsParameter[];
parameters: TsParameter[];
/** Return type of the signature. */

@@ -137,3 +137,3 @@ returnType: string;

/** Documentation for a single parameter to a signature. */
export interface ITsParameter extends ITsDocBase, ITsDefaultValue {
export interface TsParameter extends TsDocBase, TsDefaultValue {
kind: Kind.Parameter;

@@ -146,3 +146,3 @@ /** Fully qualified type string describing this parameter. */

/** Documentation for a property of an object, which may have a default value. */
export interface ITsProperty extends ITsDocBase, ITsDefaultValue {
export interface TsProperty extends TsDocBase, TsDefaultValue {
kind: Kind.Property;

@@ -155,24 +155,24 @@ /** Type name from which this property was inherited. Typically takes the form `Interface.member`. */

/** Documentation for an `interface` definition. */
export interface ITsInterface extends ITsDocBase, ITsObjectDefinition {
export interface TsInterface extends TsDocBase, TsObjectDefinition {
kind: Kind.Interface;
}
/** Documentation for a `class` definition. */
export interface ITsClass extends ITsDocBase, ITsObjectDefinition {
export interface TsClass extends TsDocBase, TsObjectDefinition {
kind: Kind.Class;
/** Constructor signature of this class. Note the special name here, as `constructor` is a JavaScript keyword. */
constructorType: ITsConstructor;
accessors: ITsAccessor[];
constructorType: TsConstructor;
accessors: TsAccessor[];
}
/** A member of an `enum` definition. An enum member will have a `defaultValue` if it was declared with an initializer. */
export interface ITsEnumMember extends ITsDocBase, ITsDefaultValue {
export interface TsEnumMember extends TsDocBase, TsDefaultValue {
kind: Kind.EnumMember;
}
/** Documentation for an `enum` definition. */
export interface ITsEnum extends ITsDocBase {
export interface TsEnum extends TsDocBase {
kind: Kind.Enum;
/** Enumeration members. */
members: ITsEnumMember[];
members: TsEnumMember[];
}
/** A type alias, defined using `export type {name} = {type}.` The `type` property will contain the full type alias as a string. */
export interface ITsTypeAlias extends ITsDocBase {
export interface TsTypeAlias extends TsDocBase {
kind: Kind.TypeAlias;

@@ -182,2 +182,3 @@ /** Type string for which this member is an alias. */

}
export type TsDocEntry = TsClass | TsInterface | TsEnum | TsMethod | TsTypeAlias;
/**

@@ -190,16 +191,16 @@ * The `TypescriptPlugin` exports a `typescript` key that contains a map of member name to

*/
export interface ITypescriptPluginData {
export interface TypescriptPluginData {
typescript: {
[name: string]: ITsClass | ITsInterface | ITsEnum | ITsMethod | ITsTypeAlias;
[name: string]: TsDocEntry;
};
}
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 isTsParameter: (data: any) => data is ITsParameter;
export declare const isTsProperty: (data: any) => data is ITsProperty;
export declare const isTsSignature: (data: any) => data is ITsSignature;
export declare const isTsTypeAlias: (data: any) => data is ITsTypeAlias;
export declare const isTsClass: (data: any) => data is TsClass;
export declare const isTsConstructor: (data: any) => data is TsConstructor;
export declare const isTsEnum: (data: any) => data is TsEnum;
export declare const isTsEnumMember: (data: any) => data is TsEnumMember;
export declare const isTsInterface: (data: any) => data is TsInterface;
export declare const isTsMethod: (data: any) => data is TsMethod;
export declare const isTsParameter: (data: any) => data is TsParameter;
export declare const isTsProperty: (data: any) => data is TsProperty;
export declare const isTsSignature: (data: any) => data is TsSignature;
export declare const isTsTypeAlias: (data: any) => data is TsTypeAlias;

@@ -33,7 +33,6 @@ "use strict";

Kind["Accessor"] = "accessor";
})(Kind = exports.Kind || (exports.Kind = {}));
})(Kind || (exports.Kind = Kind = {}));
function typeguard(kind) {
return function (data) { return data != null && data.kind === kind; };
return (data) => data != null && data.kind === kind;
}
// wooooo typeguards
exports.isTsClass = typeguard(Kind.Class);

@@ -40,0 +39,0 @@ exports.isTsConstructor = typeguard(Kind.Constructor);

@@ -34,6 +34,6 @@ "use strict";

.split(WORD_SEPARATORS)
.map(function (word, idx) { return (data[word] == null ? word : callback(word, data[word], idx)); });
.map((word, idx) => (data[word] == null ? word : callback(word, data[word], idx)));
}
exports.linkify = linkify;
var WORD_SEPARATORS = /([\[\]<>()| :.,]+)/g;
const WORD_SEPARATORS = /([\[\]<>()| :.,]+)/g;
/**

@@ -40,0 +40,0 @@ * Slugify a string: "Really Cool Heading!" => "really-cool-heading-"

{
"name": "@documentalist/client",
"version": "4.0.0",
"description": "Runtime functions and interfaces used in rendering documentalist data",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "run-s compile",
"compile": "tsc --project ./src",
"lint": "tslint --project ./src",
"lint-fix": "yarn lint --fix"
},
"devDependencies": {
"tslint": "^6.1.3",
"typescript": "~4.6.2"
},
"engines": {
"node": ">=12"
},
"repository": {
"type": "git",
"url": "git@github.com:palantir/documentalist.git"
},
"author": "Palantir Technologies",
"license": "Apache-2.0"
"name": "@documentalist/client",
"version": "5.0.0",
"description": "Runtime functions and interfaces used in rendering documentalist data",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "run-s compile",
"compile": "tsc --project ./src",
"lint": "tslint --project ./src",
"lint-fix": "yarn lint --fix"
},
"devDependencies": {
"tslint": "^6.1.3",
"typescript": "~5.2.2"
},
"engines": {
"node": ">=18"
},
"repository": {
"type": "git",
"url": "git@github.com:palantir/documentalist.git"
},
"author": "Palantir Technologies",
"license": "Apache-2.0"
}
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