Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

ultimate.mvc

Package Overview
Dependencies
215
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.7 to 1.1.8

77

lib/pjs.js

@@ -13,3 +13,4 @@ import fs from 'fs';

var filename=path.join(this.__dirname,filename);
return {filename,
return {filename,viewdir:path.resolve(this.__viewdir),
details:details?details:{type:'view'},

@@ -19,2 +20,22 @@ data:null,local:next_local,options,parent_local:this};

function readAccessFileData(filename){
return new Promise((resolve,reject)=>{
fs.access(filename, fs.constants.F_OK, function(err){
if (err) {
reject(new Error("File not found:"+filename));
} else {
fs.readFile(filename,function(err, file_data){
if (err) {
reject(new Error("file read error:"+filename));
}
else{
resolve(file_data.toString());
}
});
}
});
});
}
async function createElementFuns(tag,props,...children){

@@ -37,2 +58,8 @@ var child_data='';

var attrs='';
if(props)for(var i in props){
attrs+=` ${i}="${props[i]}"`;
}
if(typeof tag === 'object'){

@@ -42,20 +69,6 @@ if(!('data' in tag))throw new Error("View object must have data property");

tag.data=await new Promise((resolve,reject)=>{
fs.access(tag.filename, fs.constants.F_OK, function(err){
if (err) {
reject(new Error("File not found:"+tag.filename));
} else {
fs.readFile(tag.filename,function(err, file_data){
if (err) {
reject(new Error("file read error:"+tag.filename));
}
else{
resolve(file_data.toString());
}
});
}
});
});
if(tag.details.type=='view'){
tag.data=await readAccessFileData(tag.filename);
if(tag.details.type=='view'){
//updated. new insteant need to create at the time of rendering

@@ -74,5 +87,22 @@ var next_local=tag.local?tag.local:{};

}
//reamek the type
child_data=tag.data+child_data;
tag=tag.details.type;
else if('instant' in tag.details && tag.details.instant===false){
//if remote access for links or scripts
let accesspath=path.relative(tag.viewdir,path.resolve(tag.filename));
//attrs
if(tag.details.type=='script'){
tag=tag.details.type;
attrs+=` src="${accesspath}"`;
}
else if(tag.details.type=='style'){
return `<link rel="stylesheet" type="text/css" href="${accesspath}" ${attrs}/>`;
}
}
else{
tag.data=await readAccessFileData(tag.filename);
//reamek the type
child_data=tag.data+child_data;
tag=tag.details.type;
}
}

@@ -83,7 +113,2 @@ else if(typeof tag === 'function'){

var attrs='';
for(var i in props){
attrs+=` ${i}="${props[i]}"`;
}
return `<${tag} ${attrs}>${child_data}</${tag}>`;

@@ -90,0 +115,0 @@ }

@@ -5,3 +5,3 @@ {

"author": "Pallob Gain",
"version": "1.1.7",
"version": "1.1.8",
"debug":true,

@@ -8,0 +8,0 @@ "orginal_path":false,

{
"name": "ultimate.mvc",
"version": "1.1.7",
"version": "1.1.8",
"description": "It is node js MVC for creating interactive chromium based cross-platform desktop-app and web-app",

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

Sorry, the diff of this file is not supported yet

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