docx-templates
Advanced tools
Comparing version 4.5.3 to 4.5.4
@@ -0,1 +1,6 @@ | ||
## 4.5.4 (2021-03-05) | ||
* Improve error messages. | ||
* Export error types at the library level. | ||
* Update dependencies. | ||
## 4.5.3 (2020-12-18) | ||
@@ -2,0 +7,0 @@ * Correctly export `getMetadata` function from library index module / entrypoint. |
@@ -21,5 +21,5 @@ export declare class NullishCommandResultError extends Error { | ||
export declare class InternalError extends Error { | ||
message: string; | ||
constructor(msg: string); | ||
} | ||
export declare class TemplateParseError extends Error { | ||
} |
@@ -10,2 +10,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -73,6 +75,4 @@ function __() { this.constructor = d; } | ||
__extends(InternalError, _super); | ||
function InternalError() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.message = 'INTERNAL ERROR'; | ||
return _this; | ||
function InternalError(msg) { | ||
return _super.call(this, "INTERNAL ERROR: " + msg) || this; | ||
} | ||
@@ -79,0 +79,0 @@ return InternalError; |
@@ -1,3 +0,5 @@ | ||
import createReport, { listCommands, getMetadata } from './main'; | ||
export { createReport, listCommands, getMetadata }; | ||
import createReport from './main'; | ||
export { listCommands, getMetadata } from './main'; | ||
export { NullishCommandResultError, CommandSyntaxError, InvalidCommandError, CommandExecutionError, ImageError, InternalError, TemplateParseError, } from './errors'; | ||
export { createReport }; | ||
export default createReport; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMetadata = exports.listCommands = exports.createReport = void 0; | ||
var main_1 = __importStar(require("./main")); | ||
exports.createReport = exports.TemplateParseError = exports.InternalError = exports.ImageError = exports.CommandExecutionError = exports.InvalidCommandError = exports.CommandSyntaxError = exports.NullishCommandResultError = exports.getMetadata = exports.listCommands = void 0; | ||
var main_1 = __importDefault(require("./main")); | ||
exports.createReport = main_1.default; | ||
Object.defineProperty(exports, "listCommands", { enumerable: true, get: function () { return main_1.listCommands; } }); | ||
Object.defineProperty(exports, "getMetadata", { enumerable: true, get: function () { return main_1.getMetadata; } }); | ||
var main_2 = require("./main"); | ||
Object.defineProperty(exports, "listCommands", { enumerable: true, get: function () { return main_2.listCommands; } }); | ||
Object.defineProperty(exports, "getMetadata", { enumerable: true, get: function () { return main_2.getMetadata; } }); | ||
var errors_1 = require("./errors"); | ||
Object.defineProperty(exports, "NullishCommandResultError", { enumerable: true, get: function () { return errors_1.NullishCommandResultError; } }); | ||
Object.defineProperty(exports, "CommandSyntaxError", { enumerable: true, get: function () { return errors_1.CommandSyntaxError; } }); | ||
Object.defineProperty(exports, "InvalidCommandError", { enumerable: true, get: function () { return errors_1.InvalidCommandError; } }); | ||
Object.defineProperty(exports, "CommandExecutionError", { enumerable: true, get: function () { return errors_1.CommandExecutionError; } }); | ||
Object.defineProperty(exports, "ImageError", { enumerable: true, get: function () { return errors_1.ImageError; } }); | ||
Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return errors_1.InternalError; } }); | ||
Object.defineProperty(exports, "TemplateParseError", { enumerable: true, get: function () { return errors_1.TemplateParseError; } }); | ||
exports.default = main_1.default; |
@@ -152,3 +152,3 @@ "use strict"; | ||
if (!curLoop) | ||
throw new errors_1.InternalError(); | ||
throw new errors_1.InternalError('jumping while curLoop is null'); | ||
refNode = curLoop.refNode, refNodeLevel = curLoop.refNodeLevel; | ||
@@ -232,3 +232,3 @@ // | ||
if (nodeOutParent == null) | ||
throw new errors_1.InternalError(); | ||
throw new errors_1.InternalError('node parent is null'); | ||
// Execute the move in the output tree | ||
@@ -312,3 +312,3 @@ nodeOut = nodeOutParent; | ||
if (nodeOut._parent == null) | ||
throw new errors_1.InternalError(); | ||
throw new errors_1.InternalError('node parent is null'); | ||
nodeOut = nodeOut._parent; | ||
@@ -349,3 +349,3 @@ } | ||
if (nodeOut._parent == null) | ||
throw new errors_1.InternalError(); | ||
throw new errors_1.InternalError('node parent is null'); | ||
nodeOut = nodeOut._parent; | ||
@@ -352,0 +352,0 @@ deltaJump -= 1; |
{ | ||
"name": "docx-templates", | ||
"version": "4.5.3", | ||
"version": "4.5.4", | ||
"description": "Template-based docx report creation", | ||
@@ -67,3 +67,3 @@ "main": "lib/index.js", | ||
"ts-jest": "^26.1.0", | ||
"typescript": "^4.0.2" | ||
"typescript": "^4.2.3" | ||
}, | ||
@@ -70,0 +70,0 @@ "jest": { |
@@ -96,3 +96,11 @@ # Docx-templates [![Build Status](https://travis-ci.org/guigrpa/docx-templates.svg)](https://travis-ci.org/guigrpa/docx-templates) [![Coverage Status](https://coveralls.io/repos/github/guigrpa/docx-templates/badge.svg?branch=master)](https://coveralls.io/github/guigrpa/docx-templates?branch=master) [![npm version](https://img.shields.io/npm/v/docx-templates.svg)](https://www.npmjs.com/package/docx-templates) | ||
*/ | ||
rejectNullish: false | ||
rejectNullish: false, | ||
/** | ||
* MS Word usually autocorrects JS string literal quotes with unicode 'smart' quotes ('curly' quotes). E.g. 'aubergine' -> ‘aubergine’. | ||
* This causes an error when evaluating commands containing these smart quotes, as they are not valid JavaScript. | ||
* If you set fixSmartQuotes to 'true', these smart quotes will automatically get replaced with straight quotes (') before command evaluation. | ||
* Defaults to false. | ||
*/ | ||
fixSmartQuotes: false; | ||
}); | ||
@@ -99,0 +107,0 @@ ``` |
148836
576
2492