New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

docx-templates

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docx-templates - npm Package Versions

123567

4.2.0

Diff
guigrpa
published 4.2.0 •

Changelog

Source

4.2.0 (2020-06-15)

  • Feature: added 'rejectNullish' setting. When set to true, this setting ensures createReport throws a NullishCommandResultError when the result of an INS, HTML, IMAGE, or LINK command is null or undefined. This is useful as nullish return values usually indicate a mistake in the template or the invoking code. Defaults to false.
  • Enhancement: typed Errors to facilitate more fine-grained downstream error handling.
guigrpa
published 4.1.1 •

Changelog

Source

4.1.1 (2020-06-06)

  • PR #121 Improved detection of built-in commands in templates to avoid confusion with javascript symbols.
  • #107 Library now correctly recognizes user-defined commands with non-alphanumeric names (like Chinese characters).
  • #131: .docx template files originating from Office365 or SharePoint can now be used (PR #132)
guigrpa
published 4.1.0 •

Changelog

Source

4.1.0 (2020-4-25)

  • #112 Failing on the first error that is encountered while rendering a template is now optional behaviour (but still the default). Use failFast: false to collect all errors in a template before failing. This allows for less cumbersome interactive correction of typos or other mistakes in template commands.
  • #33 SVGs can now be inserted into the templates directly, based on excellent work by @lwallent.
  • #113 fixed a regression caused by relying on incomplete jsZip type definitions.
  • #83 fixed a bug that occurred when links were used in FOR loops.
  • Added docstrings (thanks @mathe42 !)
guigrpa
published 4.0.0 •

Changelog

Source

4.0.0 (2020-04-13)

  • Removed Flow and switched entire codebase over to TypeScript. In the process a few minor soundness issues were fixed.

  • Breaking change Removed dependency on Node filesystem APIs so the library no longer needs a separate node and browser entrypoint, simplifying maintenance and development. This has the following implications for the public API, justifying the version bump to 4.0.0:

    • You can no longer provide image data as a path, and need to provide an ArrayBuffer or base64-encoded string instead.

    • You can no longer provide a template as a filesystem path, and you'll need to read it into a Buffer first.

    • Removed output: 'buffer' argument. The output of createReport is now always a Uint8Array, unless the debug argument _probe is specified.

The README and examples have also been updated to reflect the above changes.

guigrpa
published 3.1.1 •

Changelog

Source

3.1.1 (2019-8-20)

  • Avoid issue when a single paragraph contains END-IF/FOR for a previous loop and IF/FOR for a new one (#72).
  • Fix hyperlink styles (#64).
guigrpa
published 3.1.0 •

Changelog

Source

3.1.0 (2019-8-20)

  • Allow different left/right command delimiters, e.g. cmdDelimiter: ['{', '}'] (#66, #70).
  • Allow omission of the INS (or =) command (#70).
guigrpa
published 3.0.0 •

Changelog

Source

3.0.0 (2019-2-17)

  • Breaking change: removed replaceImages, replaceImagesBase64 options (deprecated since v2.4.0). Please use the IMAGE command instead.
  • Breaking change for users of the vm2 sandbox: replaced vm2Sandbox option (which caused headaches for users in the browser) with runJs, a custom hook for JS snippet execution. If you want to use vm2:
import createReport from 'docx-templates';
import { VM, VMScript } from 'vm2';

createReport({
  template: /* ... */,
  data: /* ... */,
  runJs: ({ sandbox }) => {
    const script = new VMScript(
      `
      __result__ = eval(__code__);
      `
    ).compile();
    const vm2 = new VM({ sandbox });
    vm2.run(script);
    const { VMError, Buffer, ...modifiedSandbox } = vm2._context;
    const result = modifiedSandbox.__result__;
    return { modifiedSandbox, result };
  }
})
guigrpa
published 2.10.0 •

Changelog

Source

2.10.0 (2019-2-16)

  • Let alternate text be specified for images (@emilong, #57).
guigrpa
published 2.9.1 •

Changelog

Source

2.9.1 (2019-1-3)

guigrpa
published 2.9.0 •

Changelog

Source

2.9.0 (2018-11-30)