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

ejs-html

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ejs-html - npm Package Versions

23

5.1.5

Diff

clubedaentrega
published 5.1.4 •

Changelog

Source

5.1.4

  • Fixed: missing \n
clubedaentrega
published 5.1.3 •

Changelog

Source

5.1.3

  • Fixed: fix weird source map when an EJS tag spans multiple lines
clubedaentrega
published 5.1.2 •

Changelog

Source

5.1.2

  • Fixed: stricMode not working for compile.standAlone
clubedaentrega
published 5.1.1 •

Changelog

Source

5.1.1

  • Fixed: bug with empty EJS eval tags (<% %>)
  • Fixed: bug with text after EJS tag inside custom tag (<my-tag><%= a %> text</my-tag>)
clubedaentrega
published 5.1.0 •

Changelog

Source

5.1.0

  • Added: sourceMap option to create source maps
clubedaentrega
published 5.0.0 •

Changelog

Source

5.0.0

Breaking changes

  • Removed: support for node 4
  • Changed: from reduce(tokens[, compileDebug]) to reduce(tokens[, options])
  • Changed: use strict mode and do not wrap code in with(locals) by default.

The old version (v4) compiled templates to sloppy JS mode and used the long-deprecated with() structure. The new (v5) version changes that, but allows one to opt-out.

We used with(locals) to allow one to write <%= x %> instead of <%= locals.x %>, but employing with() forced the lib to compile to sloppy mode since this construct isn't allowed in strict mode.

In this new version, we revisited that decision and prefered to drop with in favor of strict mode. To ease transition, you can opt-out and keep using the old behavior with the option strictMode: false. On the other hand, if don't want to keep writing locals. all the time, you can list which variables should be made available with the option vars: ['someVar', 'anotherOne']. See the examples below

/**
 * Old (v4)
 */

// Variables could be accessed directly, unless there were absent in the locals parameter
ejs.render('<%= a %>', {a: 2}) // '2'
ejs.render('<%= b %>', {a: 2}) // ReferenceError: b is not defined

// In sloppy mode, weird things happen, like leaking to global context
ejs.render('<% x = 17 %>') // ''
x // 17

/**
 * New (v5)
 */

// Direct access does not work out of the box
ejs.render('<%= a %>', {a: 2}) // ReferenceError: a is not defined

// You have to be explicit. Either use the locals object or list variables to be made available
ejs.render('<%= locals.a %>', {a: 2}) // '2'
ejs.render('<%= a %>', {a: 2}, {vars: ['a']}) // '2'
ejs.render('<%= b %>', {a: 2}, {vars: ['b']}) // ''

// Code is executed in strict mode
ejs.render('<% x = 17 %>') // ReferenceError: x is not defined

// If you REALLY want to use old behavior
ejs.render('<%= a %>', {a: 2}, {strictMode: false}) // '2'

Other changes

  • Added: option strictMode (defaults to true)
  • Added: option vars (defaults to [])
clubedaentrega
published 4.0.3 •

Changelog

Source

4.0.3

  • Fixed: bug in minifier with spaces around some EJS tags
clubedaentrega
published 4.0.2 •

Changelog

Source

4.0.2

  • Fixed: compiling custom elements inside custom elements with compileDebug set to false would crash on runtime. The fix on 4.0.1 did not covered the recursive case.
clubedaentrega
published 4.0.1 •

Changelog

Source

4.0.1

  • Fixed: compiling custom elements with compileDebug set to false would crash on runtime
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