Socket
Socket
Sign inDemoInstall

@buxlabs/html-engine

Package Overview
Dependencies
19
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.5 to 0.9.7

2

package.json
{
"name": "@buxlabs/html-engine",
"version": "0.9.5",
"version": "0.9.7",
"description": "Compile HTML templates into JS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -343,2 +343,3 @@ const AbstractSyntaxTree = require('abstract-syntax-tree')

const component = components.find(component => component.name === tag)
const { languages, translationsPaths } = options
if (component && !fragment.plain) {

@@ -577,3 +578,3 @@ const { localVariables } = resolveComponent(component, fragment, variables, modifiers, components, statistics, options)

collectComponentsFromPartialAttribute(fragment, statistics, options)
const nodes = convertTag(fragment, variables, modifiers)
const nodes = convertTag(fragment, variables, modifiers, translations, languages, translationsPaths)
nodes.forEach(node => {

@@ -601,3 +602,2 @@ if (node.type === 'IfStatement') {

} else if (fragment.type === 'text') {
const { languages, translationsPaths } = options
const nodes = convertText(fragment.content, variables, modifiers, translations, languages, translationsPaths)

@@ -665,3 +665,3 @@ return nodes.forEach(node => tree.append(getTemplateAssignmentExpression(node)))

let parent = operator.value || `{${right.key}}`
const name = convertAttribute('html', parent, variables)
const name = convertAttribute('html', parent, variables, translations, languages, translationsPaths)

@@ -691,3 +691,3 @@ variables.push(variable)

let parent = operator.value || `{${right.key}}`
const name = convertAttribute('html', parent, variables)
const name = convertAttribute('html', parent, variables, translations, languages, translationsPaths)
ast.append(getForInLoopVariable(keyIdentifier, valueIdentifier, name))

@@ -694,0 +694,0 @@

@@ -53,3 +53,3 @@ const { OBJECT_VARIABLE, ESCAPE_VARIABLE, BOOLEAN_ATTRIBUTES, UNESCAPED_NAMES, GLOBAL_VARIABLES } = require('./enum')

function convertAttribute (name, value, variables, currentModifiers) {
function convertAttribute (name, value, variables, currentModifiers, translations, languages, translationsPaths) {
if (value && value.includes('{') && value.includes('}')) {

@@ -70,3 +70,3 @@ let values = extract(value)

}
return modify(getTemplateNode(expression, variables, unescape), modifiers)
return modify(getTemplateNode(expression, variables, unescape), modifiers, translations, languages, translationsPaths)
} else {

@@ -86,5 +86,5 @@ const nodes = values.map(({ value, modifiers = [] }, index) => {

}
return modify(getTemplateNode(expression, variables, unescape), modifiers)
return modify(getTemplateNode(expression, variables, unescape), modifiers, translations, languages, translationsPaths)
}
return modify(getLiteral(value), modifiers)
return modify(getLiteral(value), modifiers, translations, languages, translationsPaths)
})

@@ -102,10 +102,10 @@ const expression = convertToBinaryExpression(nodes)

function convertHtmlOrTextAttribute (fragment, variables, currentModifiers) {
function convertHtmlOrTextAttribute (fragment, variables, currentModifiers, translations, languages, translationsPaths) {
let html = fragment.attributes.find(attr => attr.key === 'html' || attr.key === 'html.bind')
if (html) {
return convertAttribute(html.key, html.value, variables, currentModifiers)
return convertAttribute(html.key, html.value, variables, currentModifiers, translations, languages, translationsPaths)
} else {
let text = fragment.attributes.find(attr => attr.key === 'text' || attr.key === 'text.bind')
if (text) {
let argument = convertAttribute(text.key, text.value, variables, currentModifiers)
let argument = convertAttribute(text.key, text.value, variables, currentModifiers, translations, languages, translationsPaths)
return {

@@ -348,3 +348,3 @@ type: 'CallExpression',

function convertTag (fragment, variables, currentModifiers) {
function convertTag (fragment, variables, currentModifiers, translations, languages, translationsPaths) {
let node = fragment.tagName

@@ -370,3 +370,3 @@ let parts = []

type: 'IfStatement',
test: convertAttribute(attr.key, attr.value, variables, currentModifiers),
test: convertAttribute(attr.key, attr.value, variables, currentModifiers, translations, languages, translationsPaths),
consequent: {

@@ -381,3 +381,3 @@ type: 'BlockStatement',

let { value } = attr
parts.push(convertAttribute(attr.key, value, variables, currentModifiers))
parts.push(convertAttribute(attr.key, value, variables, currentModifiers, translations, languages, translationsPaths))
parts.push(getLiteral('"'))

@@ -388,3 +388,3 @@ }

parts.push(getLiteral('>'))
const leaf = convertHtmlOrTextAttribute(fragment, variables, currentModifiers)
const leaf = convertHtmlOrTextAttribute(fragment, variables, currentModifiers, translations, languages, translationsPaths)
if (leaf) {

@@ -391,0 +391,0 @@ parts.push(leaf)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc