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

zpin-templates

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zpin-templates - npm Package Compare versions

Comparing version 0.0.25 to 0.0.26

86

dist/reactTemplates.js

@@ -30,5 +30,6 @@ 'use strict';

//2016.11.22 rt-class别名转换bug
// const classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(this.styles[key]);} }.bind(this), []).join(" ")');
var classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(key);} }.bind(this), []).join(" ")');
var classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(this.styles[key]);} }.bind(this), []).join(" ")');
// const classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(key);} }.bind(this), []).join(" ")');
function getTagTemplateString(simpleTagTemplate, shouldCreateElement) {

@@ -212,17 +213,17 @@ if (simpleTagTemplate) {

val = val.trim();
// if(val.indexOf("{this.styles.")<0){
// var arr=val.split(" ");
// var result="";
// arr.forEach(function (v,i) {
// result+=`this.styles["${v.trim()}"],`;
// if(classExclude.indexOf(v.trim())>0){
// result+=`"${v.trim()}",`;
// }
// })
// if(result.endsWith(",")){
// result=result.substr(0,result.length-1);
// }
// result=`{[${result}].join(' ')}`;
// }
props[propKey] = existing + utils.convertText(node, context, val);
if (val.indexOf("{this.styles.") < 0) {
var arr = val.split(" ");
var result = "";
arr.forEach(function (v, i) {
result += 'this.styles["' + v.trim() + '"],';
if (classExclude.indexOf(v.trim()) > 0) {
result += '"' + v.trim() + '",';
}
});
if (result.endsWith(",")) {
result = result.substr(0, result.length - 1);
}
result = '{[' + result + '].join(\' \')}';
}
props[propKey] = existing + utils.convertText(node, context, result);
}

@@ -349,5 +350,5 @@ } else if (!_.startsWith(key, 'rt-')) {

//bug id选择器名称转化
// if(node.type==='tag'&&node.attribs["id"]){
// node.attribs["id"]=`{this.styles["${node.attribs["id"].trim()}"]}`;
// }
if (node.type === 'tag' && node.attribs["id"]) {
node.attribs["id"] = '{this.styles["' + node.attribs["id"].trim() + '"]}';
}
if (node.name == "Container" && fs.existsSync(path.join(process.cwd(), "dist/config.json"))) {

@@ -373,3 +374,3 @@ var start = resourcePath.indexOf("src\\pages\\");

}
config.pages[pageName].containers.push({ src: src, appId: appId, module: module, page: page });
config.pages[pageName].containers.push(node.attribs);
fs.writeFileSync(path.join(process.cwd(), "dist/config.json"), JSON.stringify(config));

@@ -665,24 +666,25 @@ }

tag.attribs.from = "../../../compile/modules.js";
if (fs.existsSync(path.join(process.cwd(), "dist/config.json"))) {
var start = resourcePath.indexOf("src\\pages\\");
var arr = resourcePath.substr(start).split("\\");
var moduleName = tag.attribs.name;
var pageName = arr[2];
var config = fs.readFileSync(path.join(process.cwd(), "dist/config.json"), "utf-8");
// if(fs.existsSync(path.join(process.cwd(),"dist/config.json"))){
// var start=resourcePath.indexOf("src\\pages\\");
// var arr=resourcePath.substr(start).split("\\");
// var moduleName=tag.attribs.name;
// var pageName=arr[2];
// var config=fs.readFileSync(path.join(process.cwd(),"dist/config.json"),"utf-8");
//
// config=JSON.parse(config);
// if(!config.pages){
// config.pages={};
// }
// if(!config.pages[pageName]){
// config.pages[pageName]={}
// }
// if(!config.pages[pageName].modules){
// config.pages[pageName].modules=[]
// }
// if(config.pages[pageName].modules.indexOf(moduleName)<0){
// config.pages[pageName].modules.push(moduleName);
// }
// fs.writeFileSync(path.join(process.cwd(),"dist/config.json"), JSON.stringify(config))
// }
config = JSON.parse(config);
if (!config.pages) {
config.pages = {};
}
if (!config.pages[pageName]) {
config.pages[pageName] = {};
}
if (!config.pages[pageName].modules) {
config.pages[pageName].modules = [];
}
if (config.pages[pageName].modules.indexOf(moduleName) < 0) {
config.pages[pageName].modules.push(moduleName);
}
fs.writeFileSync(path.join(process.cwd(), "dist/config.json"), JSON.stringify(config));
}
}

@@ -689,0 +691,0 @@ handleImport(tag, context);

{
"name": "zpin-templates",
"version": "0.0.25",
"version": "0.0.26",
"description": "Light weight templates for react -> write html get valid react code",

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

@@ -37,4 +37,4 @@ 'use strict';

//2016.11.22 rt-class别名转换bug
// const classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(this.styles[key]);} }.bind(this), []).join(" ")');
const classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(key);} }.bind(this), []).join(" ")');
const classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(this.styles[key]);} }.bind(this), []).join(" ")');
// const classSetTemplate = _.template('_(<%= classSet %>).transform(function(res, value, key){ if(value){ res.push(key);} }.bind(this), []).join(" ")');

@@ -228,17 +228,17 @@

val=val.trim();
// if(val.indexOf("{this.styles.")<0){
// var arr=val.split(" ");
// var result="";
// arr.forEach(function (v,i) {
// result+=`this.styles["${v.trim()}"],`;
// if(classExclude.indexOf(v.trim())>0){
// result+=`"${v.trim()}",`;
// }
// })
// if(result.endsWith(",")){
// result=result.substr(0,result.length-1);
// }
// result=`{[${result}].join(' ')}`;
// }
props[propKey] = existing + utils.convertText(node, context,val);
if(val.indexOf("{this.styles.")<0){
var arr=val.split(" ");
var result="";
arr.forEach(function (v,i) {
result+=`this.styles["${v.trim()}"],`;
if(classExclude.indexOf(v.trim())>0){
result+=`"${v.trim()}",`;
}
})
if(result.endsWith(",")){
result=result.substr(0,result.length-1);
}
result=`{[${result}].join(' ')}`;
}
props[propKey] = existing + utils.convertText(node, context,result);
}

@@ -367,5 +367,5 @@ } else if (!_.startsWith(key, 'rt-')) {

//bug id选择器名称转化
// if(node.type==='tag'&&node.attribs["id"]){
// node.attribs["id"]=`{this.styles["${node.attribs["id"].trim()}"]}`;
// }
if(node.type==='tag'&&node.attribs["id"]){
node.attribs["id"]=`{this.styles["${node.attribs["id"].trim()}"]}`;
}
if(node.name=="Container"&&fs.existsSync(path.join(process.cwd(),"dist/config.json"))){

@@ -391,3 +391,3 @@ var start=resourcePath.indexOf("src\\pages\\");

}
config.pages[pageName].containers.push({src,appId,module,page});
config.pages[pageName].containers.push(node.attribs);
fs.writeFileSync(path.join(process.cwd(),"dist/config.json"), JSON.stringify(config))

@@ -672,26 +672,26 @@ }

tag.attribs.from="../../../compile/modules.js";
if(fs.existsSync(path.join(process.cwd(),"dist/config.json"))){
var start=resourcePath.indexOf("src\\pages\\");
var arr=resourcePath.substr(start).split("\\");
var moduleName=tag.attribs.name;
var pageName=arr[2];
var config=fs.readFileSync(path.join(process.cwd(),"dist/config.json"),"utf-8");
// if(fs.existsSync(path.join(process.cwd(),"dist/config.json"))){
// var start=resourcePath.indexOf("src\\pages\\");
// var arr=resourcePath.substr(start).split("\\");
// var moduleName=tag.attribs.name;
// var pageName=arr[2];
// var config=fs.readFileSync(path.join(process.cwd(),"dist/config.json"),"utf-8");
//
// config=JSON.parse(config);
// if(!config.pages){
// config.pages={};
// }
// if(!config.pages[pageName]){
// config.pages[pageName]={}
// }
// if(!config.pages[pageName].modules){
// config.pages[pageName].modules=[]
// }
// if(config.pages[pageName].modules.indexOf(moduleName)<0){
// config.pages[pageName].modules.push(moduleName);
// }
// fs.writeFileSync(path.join(process.cwd(),"dist/config.json"), JSON.stringify(config))
// }
config=JSON.parse(config);
if(!config.pages){
config.pages={};
}
if(!config.pages[pageName]){
config.pages[pageName]={}
}
if(!config.pages[pageName].modules){
config.pages[pageName].modules=[]
}
if(config.pages[pageName].modules.indexOf(moduleName)<0){
config.pages[pageName].modules.push(moduleName);
}
fs.writeFileSync(path.join(process.cwd(),"dist/config.json"), JSON.stringify(config))
}
}

@@ -698,0 +698,0 @@ handleImport(tag, context);

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