render.javascript
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -25,3 +25,3 @@ { | ||
"name": "render.javascript", | ||
"version": "0.1.2" | ||
"version": "0.1.3" | ||
} |
@@ -9,4 +9,4 @@ const version = require('../package.json').version; | ||
let head = "let str = '';with(obj){str+=`", | ||
tail = "`; return str;}"; | ||
tail = "`; return str;}"; | ||
const variable = /\{\{([^}]+)\}\}/g; | ||
@@ -28,19 +28,13 @@ const expression = /\{\%([^%]+)\%\}/g; | ||
) : '') + fn(Object.assign(data, { | ||
include: path => { | ||
include: _path => { | ||
let parts = filePath.split('/'); | ||
let $path = parts.join('/') | ||
.split('\\') | ||
.join('//') | ||
.split('//') | ||
.slice(0, -1) | ||
.join('\\'); | ||
return renderFile($path + path?.replace(/\.\//g, '\\')?.replace(/\.\.\//g, '\\'), data, true); | ||
let file = parts.slice(0, parts.length - 1).join('/'); | ||
return renderFile(file + '/' + _path, data, true); | ||
} | ||
})).replace('\r\n', ''); | ||
} catch (parseErr) { | ||
} catch(parseErr) { | ||
parseErr.name = 'Render.js Error'; | ||
const fileContent = fs.readFileSync(filePath).toString(); | ||
console.error(parseErr); | ||
return fs.readFileSync(path.join(__dirname, './error.html')).toString() | ||
@@ -47,0 +41,0 @@ .replace(/{{error}}/g, parseErr.name + ': ' + parseErr.message) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1
5950
65