fis-parser-imweb-tplv2
Advanced tools
Comparing version 0.0.3 to 0.0.4
16
index.js
@@ -7,3 +7,3 @@ 'use strict'; | ||
var EOL = '\n'; | ||
function compileTmpl(tmpl) { | ||
function compileTmpl(tmpl, filePath) { | ||
var res = [], | ||
@@ -13,3 +13,2 @@ strict = (/\bit\b/).test(tmpl); | ||
tmpl.replace(/<\/script>/ig, '</s<%=""%>cript>'); | ||
res.push([ | ||
@@ -26,5 +25,9 @@ " function (it, opt) {", | ||
.replace(/[\v]/g, EOL) | ||
.replace(/<%=\s*include\(['"]([^'"]+)['"]\)(\([^\)]*\))\s*%>/g, function (all, filename, args) { | ||
var fullname = path.resolve(file.dirname, filename), | ||
// .replace(/<%=\s*include\(['"]([^'"]+)['"]\)(\([^\)]*\))\s*%>/g, function (all, filename, args) { | ||
.replace(/<%\s*include\s+([^\s]+)\s*%>/g, function (all, filename) { | ||
// console.log('************************************** include ' + filename); | ||
// console.log('************************************** include args ' + args); | ||
var fullname = path.resolve(filePath, filename), | ||
data = ''; | ||
// console.log(fullname); | ||
// 添加links | ||
@@ -39,3 +42,3 @@ file.links = file.links || []; | ||
data = fs.readFileSync(fullname, {'encoding': 'utf8'}); | ||
return "', " + compileTmpl(data) + args + ", '"; | ||
return "', " + compileTmpl(data, path.dirname(fullname)) + "(it, opt), '"; | ||
} else { | ||
@@ -48,2 +51,3 @@ console.log('tpl:' + fullname + ' not found!'); | ||
.replace(/<%=(.*?)%>/g, "', $1, '") | ||
.replace(/<%-(.*?)%>/g, "', $1, '") | ||
.replace(/<%(<-)?/g, "');" + EOL + " ") | ||
@@ -60,3 +64,3 @@ .replace(/->(\w+)%>/g, EOL + " $1.push('") | ||
return 'return ' + compileTmpl(content); | ||
return 'return ' + compileTmpl(content, file.dirname); | ||
}; |
{ | ||
"name": "fis-parser-imweb-tplv2", | ||
"description": "test", | ||
"version": "0.0.3", | ||
"_args": [ | ||
[ | ||
"fis-parser-imweb-tplv2", | ||
"" | ||
] | ||
], | ||
"_cnpm_publish_time": 1449648272153, | ||
"_from": "fis-parser-imweb-tplv2@latest", | ||
"_id": "fis-parser-imweb-tplv2@0.0.3", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/fis-parser-imweb-tplv2", | ||
"_nodeVersion": "0.12.7", | ||
"_npmUser": { | ||
"email": "yisbug@qq.com", | ||
"name": "imweb" | ||
}, | ||
"_npmVersion": "1.4.28", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"name": "fis-parser-imweb-tplv2", | ||
"raw": "fis-parser-imweb-tplv2", | ||
"rawSpec": "", | ||
"scope": null, | ||
"spec": "latest", | ||
"type": "tag" | ||
}, | ||
"_requiredBy": [ | ||
"#USER" | ||
], | ||
"_resolved": "http://r.tnpm.oa.com/fis-parser-imweb-tplv2/download/fis-parser-imweb-tplv2-0.0.3.tgz", | ||
"_shasum": "a6ce9b8579cd6222d585e7182fe8fd593298c9ff", | ||
"_shrinkwrap": null, | ||
"_spec": "fis-parser-imweb-tplv2", | ||
"_where": "", | ||
"author": { | ||
"name": "dongdongli" | ||
}, | ||
"dependencies": {}, | ||
"description": "test", | ||
"devDependencies": {}, | ||
"directories": {}, | ||
"dist": { | ||
"key": "/fis-parser-imweb-tplv2/-/fis-parser-imweb-tplv2-0.0.3.tgz", | ||
"noattachment": false, | ||
"shasum": "a6ce9b8579cd6222d585e7182fe8fd593298c9ff", | ||
"size": 1430, | ||
"tarball": "http://r.tnpm.oa.com/fis-parser-imweb-tplv2/download/fis-parser-imweb-tplv2-0.0.3.tgz" | ||
}, | ||
"keywords": [ | ||
@@ -13,25 +56,22 @@ "fis", | ||
"main": "index.js", | ||
"_id": "fis-parser-imweb-tplv2@0.0.2", | ||
"scripts": {}, | ||
"_shasum": "bfb637d637e0391192794a2d3adce9c07d168e0a", | ||
"_from": "fis-parser-imweb-tplv2@", | ||
"_npmVersion": "2.11.3", | ||
"_nodeVersion": "0.12.7", | ||
"_npmUser": { | ||
"name": "dongdongli", | ||
"email": "dl08375085@126.com" | ||
}, | ||
"dist": { | ||
"shasum": "bfb637d637e0391192794a2d3adce9c07d168e0a", | ||
"tarball": "http://registry.npmjs.org/fis-parser-imweb-tplv2/-/fis-parser-imweb-tplv2-0.0.2.tgz" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "dongdongli", | ||
"email": "dl08375085@126.com" | ||
"email": "dl08375085@126.com", | ||
"name": "dongdongli" | ||
}, | ||
{ | ||
"email": "txw3tech@gmail.com", | ||
"name": "imweb" | ||
}, | ||
{ | ||
"email": "yisbug@qq.com", | ||
"name": "yisbug" | ||
} | ||
], | ||
"directories": {}, | ||
"_resolved": "https://registry.npmjs.org/fis-parser-imweb-tplv2/-/fis-parser-imweb-tplv2-0.0.2.tgz", | ||
"readme": "ERROR: No README data found!" | ||
"name": "fis-parser-imweb-tplv2", | ||
"optionalDependencies": {}, | ||
"publish_time": 1449648272153, | ||
"readme": "ERROR: No README data found!", | ||
"scripts": {}, | ||
"version": "0.0.4" | ||
} |
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
4558
55
0