Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
564 changes: 491 additions & 73 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"mkdirp": "3.0.1",
"nyc": "17.1.0",
"semver": "^7.6.3",
"traverse": "^0.6.10"
"traverse": "^0.6.10",
"typescript": "^5.9.3"
},
"engines": {
"node": ">=18",
Expand Down
11 changes: 8 additions & 3 deletions packages/markdown-cicero/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"access": "public"
},
"files": [
"lib"
"lib",
"types"
],
"main": "index.js",
"scripts": {
Expand All @@ -21,8 +22,11 @@
"test": "jest --timeOut=10000 --silent",
"test:updateSnapshot": "jest --updateSnapshot --silent",
"test:cov": "npm run lint && jest --timeOut=10000 --coverage --silent",
"jsdoc": "jsdoc -c jsdoc.json package.json"
"jsdoc": "jsdoc -c jsdoc.json package.json",
"build": "npm run build:types",
"build:types": "tsc"
},
"typings": "types/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/accordproject/markdown-transform.git",
Expand All @@ -45,7 +49,8 @@
"jest": "^29.7.0",
"jest-diff": "^29.7.0",
"jsdoc": "4.0.4",
"license-check-and-add": "2.3.6"
"license-check-and-add": "2.3.6",
"typescript": "^5.9.3"
},
"dependencies": {
"@accordproject/concerto-core": "3.25.7",
Expand Down
10 changes: 10 additions & 0 deletions packages/markdown-cicero/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "types",
"strict": false
},
"include": ["index.js", "lib/**/*.js"]
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tsconfig.json includes lib/**/*.js, and this package has test files under lib/ (e.g., *.test.js). As a result, running tsc will emit test declaration stubs into types/, which is usually not intended for published typings. Add an exclude (or narrow the include) to omit test files and regenerate the types/ output.

Suggested change
"include": ["index.js", "lib/**/*.js"]
"include": ["index.js", "lib/**/*.js"],
"exclude": ["lib/**/*.test.js", "lib/**/__tests__/**/*"]

Copilot uses AI. Check for mistakes.
}
4 changes: 4 additions & 0 deletions packages/markdown-cicero/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const CiceroMarkTransformer: typeof import("./lib/CiceroMarkTransformer");
export const FromCiceroEditVisitor: typeof import("./lib/FromCiceroEditVisitor");
export const ToCommonMarkVisitor: typeof import("./lib/ToCommonMarkVisitor");
export const Decorators: typeof import("./lib/Decorators");
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
107 changes: 107 additions & 0 deletions packages/markdown-cicero/types/lib/CiceroMarkTransformer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
export = CiceroMarkTransformer;
/**
* Converts a CiceroMark DOM to/from a
* CommonMark DOM.
*
* Converts a CiceroMark DOM to/from a markdown string.
*/
declare class CiceroMarkTransformer {
commonMark: import("@accordproject/markdown-common/types/lib/CommonMarkTransformer");
modelManager: ModelManager;
serializer: Serializer;
/**
* Obtain the Clause text for a Clause node
* @param {*} input CiceroMark DOM
* @returns {*} markdown_cicero string
*/
getClauseText(input: any): any;
/**
* Retrieve the serializer used by the parser
*
* @returns {*} a serializer capable of dealing with the Concerto
* object returns by parse
*/
getSerializer(): any;
/**
* Converts a CiceroEdit string to a CiceroMark DOM
* @param {*} input - ciceroedit string
* @returns {*} CiceroMark DOM
*/
fromCiceroEdit(input: any): any;
/**
* Converts a CiceroMark DOM to a CiceroMark Unwrapped DOM
* @param {object} input - CiceroMark DOM (JSON)
* @param {object} [options] configuration options
* @param {boolean} [options.unquoteVariables] if true variable quotations are removed
* @returns {*} CiceroMark DOM
*/
toCiceroMarkUnwrapped(input: object, options?: {
unquoteVariables?: boolean;
}): any;
/**
* Converts a CommonMark DOM to a CiceroMark DOM
* @param {*} input - CommonMark DOM (in JSON)
* @returns {*} CiceroMark DOM
*/
fromCommonMark(input: any): any;
/**
* Converts a markdown string to a CiceroMark DOM
* @param {string} markdown a markdown string
* @returns {object} ciceromark object (JSON)
*/
fromMarkdown(markdown: string): object;
/**
* Converts a CiceroMark DOM to a markdown string
* @param {*} input CiceroMark DOM
* @param {object} [options] configuration options
* @returns {*} markdown string
*/
toMarkdown(input: any, options?: object): any;
/**
* Converts a cicero markdown string to a CiceroMark DOM
* @param {string} markdown a cicero markdown string
* @param {object} [options] configuration options
* @returns {object} ciceromark object (JSON)
*/
fromMarkdownCicero(markdown: string, options?: object): object;
/**
* Converts a CiceroMark DOM to a cicero markdown string
* @param {object} input CiceroMark DOM
* @returns {string} json commonmark object
*/
toMarkdownCicero(input: object): string;
/**
* Converts a CiceroMark DOM to a CommonMark DOM
* @param {*} input CiceroMark DOM
* @param {object} [options] configuration options
* @param {boolean} [options.removeFormatting] if true the formatting nodes are removed
* @param {boolean} [options.unquoteVariables] if true variable quotations are removed
* @returns {*} json commonmark object
*/
toCommonMark(input: any, options?: {
removeFormatting?: boolean;
unquoteVariables?: boolean;
}): any;
/**
* Unquotes a CiceroMark DOM
* @param {object} input CiceroMark DOM
* @returns {object} unquoted CiceroMark DOM
*/
unquote(input: object): object;
/**
* Converts a ciceromark string into a token stream
*
* @param {string} input the string to parse
* @returns {*} a markdown-it token stream
*/
toTokens(input: string): any;
/**
* Converts a token stream into a CiceroMark DOM object.
*
* @param {object} tokenStream the token stream
* @returns {*} the CiceroMark DOM (JSON)
*/
fromTokens(tokenStream: object): any;
}
import { ModelManager } from "@accordproject/concerto-core";
import { Serializer } from "@accordproject/concerto-core";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
35 changes: 35 additions & 0 deletions packages/markdown-cicero/types/lib/Decorators.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export = Decorators;
/**
* A class to retrieve decorators on CiceroMark nodes
*/
declare class Decorators {
/**
* Construct an instance, based on a CiceroMark node
* Note that decorator arguments must be specified as an
* array of [name (string),value] pairs, even though this is
* not enforced by the Concerto grammar.
* @param {object} node the CiceroMark node
*/
constructor(node: object);
data: {};
/**
* Returns true is the decorator is present
* @param {string} decoratorName the name of the decorator
* @returns {boolean} true is the decorator is present
*/
hasDecorator(decoratorName: string): boolean;
/**
* Get the arguments for a named decorator
* @param {string} decoratorName the name of the decorator
* @returns {array} an array of arguments, or null
*/
getArguments(decoratorName: string): any[];
/**
* Get the arguments for a named decorator
* @param {string} decoratorName the name of the decorator
* @param {string} argumentName the name of the decorator argument
* @returns {object} the value of the argument or null if the decorator
* is missing or undefined if the argument is missing
*/
getDecoratorValue(decoratorName: string, argumentName: string): object;
}
1 change: 1 addition & 0 deletions packages/markdown-cicero/types/lib/Decorators.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
33 changes: 33 additions & 0 deletions packages/markdown-cicero/types/lib/FromCiceroEditVisitor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export = FromCiceroEditVisitor;
/**
* Converts a CommonMark DOM to a CiceroMark DOM
*/
declare class FromCiceroEditVisitor {
/**
* Visits a sub-tree and return CiceroMark DOM
* @param {*} visitor the visitor to use
* @param {*} thing the node to visit
* @param {*} [parameters] optional parameters
*/
static visitChildren(visitor: any, thing: any, parameters?: any): void;
/**
* Visits a list of nodes and return the CiceroMark DOM
* @param {*} visitor the visitor to use
* @param {*} things the list node to visit
* @param {*} [parameters] optional parameters
*/
static visitNodes(visitor: any, things: any, parameters?: any): void;
/**
* Find an attribute from its name
* @param {*} attributes - the array of attributes
* @param {string} name - the name of the attributes
* @return {*} the attribute or undefined
*/
static getAttribute(attributes: any, name: string): any;
/**
* Visit a node
* @param {*} thing the object being visited
* @param {*} parameters the parameters
*/
visit(thing: any, parameters: any): void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export = ToCiceroMarkUnwrappedVisitor;
/**
* Converts a CiceroMark DOM to a CiceroMark unwrapped DOM
*/
declare class ToCiceroMarkUnwrappedVisitor {
/**
* Visits a sub-tree and return the CommonMark DOM
* @param {*} visitor the visitor to use
* @param {*} thing the node to visit
* @param {*} [parameters] optional parameters
*/
static visitChildren(visitor: any, thing: any, parameters?: any): void;
/**
* Visit a node
* @param {*} thing the object being visited
* @param {*} parameters the parameters
* @return {*[]} result nodes
*/
visit(thing: any, parameters: any): any[];
}
20 changes: 20 additions & 0 deletions packages/markdown-cicero/types/lib/ToCommonMarkVisitor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export = ToCommonMarkVisitor;
/**
* Converts a CiceroMark DOM to a CommonMark DOM
*/
declare class ToCommonMarkVisitor {
/**
* Visits a sub-tree and return the CommonMark DOM
* @param {*} visitor the visitor to use
* @param {*} thing the node to visit
* @param {*} [parameters] optional parameters
*/
static visitChildren(visitor: any, thing: any, parameters?: any): void;
/**
* Visit a node
* @param {*} thing the object being visited
* @param {*} parameters the parameters
* @return {*[]} result nodes
*/
visit(thing: any, parameters: any): any[];
}
20 changes: 20 additions & 0 deletions packages/markdown-cicero/types/lib/ToMarkdownCiceroVisitor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export = ToMarkdownCiceroVisitor;
declare const ToMarkdownCiceroVisitor_base: typeof import("@accordproject/markdown-common/types/lib/FromCommonMarkVisitor");
/**
* Converts a CiceroMark DOM to a cicero markdown string.
*/
declare class ToMarkdownCiceroVisitor extends ToMarkdownCiceroVisitor_base {
/**
* Construct the visitor.
* @param {object} [options] configuration options
* @param {*} resultSeq how to sequentially combine results
* @param {object} rules how to process each node type
*/
constructor(options?: object);
/**
* Converts a CiceroMark DOM to a cicero markdown string.
* @param {*} input - CiceroMark DOM (JSON)
* @returns {string} the cicero markdown string
*/
toMarkdownCicero(input: any): string;
}
8 changes: 8 additions & 0 deletions packages/markdown-cicero/types/lib/UnquoteVariables.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export = unquoteVariables;
/**
* Replaces variable and formulas with text nodes
* @param {*} input input object
* @param {*} options options object
* @returns {*} the modified object
*/
declare function unquoteVariables(input: any): any;
38 changes: 38 additions & 0 deletions packages/markdown-cicero/types/lib/cicerorules.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
declare namespace formulaRule {
let tag: string;
let leaf: boolean;
let open: boolean;
let close: boolean;
function enter(node: any, token: any, callback: any): void;
let skipEmpty: boolean;
}
declare namespace clauseOpenRule {
let tag_1: string;
export { tag_1 as tag };
let leaf_1: boolean;
export { leaf_1 as leaf };
let open_1: boolean;
export { open_1 as open };
let close_1: boolean;
export { close_1 as close };
export function enter_1(node: any, token: any, callback: any): void;
export { enter_1 as enter };
}
declare namespace clauseCloseRule {
let tag_2: string;
export { tag_2 as tag };
let leaf_2: boolean;
export { leaf_2 as leaf };
let open_2: boolean;
export { open_2 as open };
let close_2: boolean;
export { close_2 as close };
}
export namespace inlines {
export { formulaRule as formula };
}
export namespace blocks {
export { clauseOpenRule as block_clause_open };
export { clauseCloseRule as block_clause_close };
}
export {};
2 changes: 2 additions & 0 deletions packages/markdown-cicero/types/lib/fromciceromarkrules.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export function Formula(visitor: any, thing: any, children: any, parameters: any, resultString: any, resultSeq: any): void;
export function Clause(visitor: any, thing: any, children: any, parameters: any, resultString: any, resultSeq: any): void;
9 changes: 7 additions & 2 deletions packages/markdown-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"files": [
"bin",
"lib",
"types",
"umd"
],
"main": "index.js",
Expand All @@ -24,8 +25,11 @@
"postlint": "npm run licchk",
"licchk": "license-check-and-add",
"test": "mocha --exclude test/extension --timeout 30000",
"test:cov": "npm run lint && nyc mocha --timeout 30000"
"test:cov": "npm run lint && nyc mocha --timeout 30000",
"build": "npm run build:types",
"build:types": "tsc"
},
"typings": "types/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/accordproject/markdown-transform.git",
Expand All @@ -49,7 +53,8 @@
"eslint": "8.57.1",
"license-check-and-add": "2.3.6",
"mocha": "10.8.2",
"nyc": "17.1.0"
"nyc": "17.1.0",
"typescript": "^5.9.3"
},
"dependencies": {
"@accordproject/concerto-util": "3.25.7",
Expand Down
Loading
Loading