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

scrat

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrat - npm Package Compare versions

Comparing version 0.2.0-3 to 0.2.0-4

2

configs/olpm.js

@@ -19,3 +19,2 @@ module.exports = [

layoutName : '$1',
useMap : true,
useCache : false,

@@ -28,3 +27,2 @@ release : '/layouts/$1.html'

layoutName : '$1',
useMap : true,
useCache : false,

@@ -31,0 +29,0 @@ release : '/layouts/$1.html'

2

package.json
{
"name": "scrat",
"version": "0.2.0-3",
"version": "0.2.0-4",
"description": "uc front-end integrated solution",

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

@@ -19,33 +19,2 @@ var UNIT_REG = /\{\{\{unit(?=\s)([^}]+)\}\}\}/g;

var getOlpmInfo = function(file, projCode, opt, ret){
var name = file.filename;
var prefix = file.isLayout ? 'layout' : 'unit';
var description = '';
var olpmJson = file.dirname + '/olpm.json';
if(fis.util.exists(olpmJson)){
var olpmInfo = fis.util.readJSON(olpmJson);
name = olpmInfo.name || name;
description = olpmInfo.description;
} else {
fis.log.warning('missing olpm.json file of file [' + file.subpath + ']');
}
var info = {
file : file.release,
name : name,
description : description || '',
code : projCode + '_' + prefix + '_' + file.filename
};
if(file.isUnit){
var data = ret.src[file.subdirname + '/data.js'];
if(data){
info.data = data.release;
}
}
var thumb = ret.src[file.subdirname + '/thumb.png'];
if(thumb){
info.thumb = opt.md5 ? thumb.getHashRelease() : thumb.release;
}
return info;
};
module.exports = function(ret, conf, settings, opt){

@@ -65,3 +34,41 @@ var olpm = fis.config.get('olpm');

var isInline = olpm.pack === fis.olpm.PACK_TYPE_INLINE;
var codes = {};
var getOlpmInfo = function(file, projCode, opt, ret){
var prefix = file.isLayout ? 'layout' : 'unit';
var code = projCode + '_' + prefix + '_' + file.filename;
if(codes.hasOwnProperty(code)){
fis.log.error('redeclare code in file [' + codes[code] + '] and [' + file.subpath + '] ');
} else {
codes[code] = file.subpath;
}
var name = file.filename;
var description = '';
var olpmJson = file.dirname + '/olpm.json';
if(fis.util.exists(olpmJson)){
var olpmInfo = fis.util.readJSON(olpmJson);
name = olpmInfo.name || name;
description = olpmInfo.description;
} else {
fis.log.warning('missing olpm.json file of file [' + file.subpath + ']');
}
var info = {
file : file.release,
name : name,
description : description || '',
code : code
};
if(file.isUnit){
var data = ret.src[file.subdirname + '/data.js'];
if(data){
info.data = data.release;
}
}
var thumb = ret.src[file.subdirname + '/thumb.png'];
if(thumb){
info.thumb = opt.md5 ? thumb.getHashRelease() : thumb.release;
}
return info;
};
fis.util.map(ret.src, function(subpath, file){

@@ -208,11 +215,11 @@ if(file.isLayout){

file.setContent(content);
map.files.layouts.push(getOlpmInfo(file, olpm.code, opt, ret));
} else if(file.isUnit){
//todo
if(opt.pack) {
map.files.layouts.push(getOlpmInfo(file, olpm.code, opt, ret));
}
} else if(file.isUnit && opt.pack){
map.files.units.push(getOlpmInfo(file, olpm.code, opt, ret));
} else if(file.isMod && opt.pack) {
//todo
delete ret.src[file.subpath];
file.release = false;
} else if(file.isAssets){
} else if(file.isAssets && opt.pack){
map.files.assets.push({

@@ -224,6 +231,8 @@ file : opt.md5 ? file.getHashRelease() : file.release,

});
var file = fis.file(fis.project.getProjectPath('release.json'));
file.setContent(JSON.stringify(map, null, 4));
file.compiled = true;
ret.pkg[file.subpath] = file;
if(opt.pack){
var file = fis.file(fis.project.getProjectPath('release.json'));
file.setContent(JSON.stringify(map, null, 4));
file.compiled = true;
ret.pkg[file.subpath] = file;
}
} else if(!olpm.code) {

@@ -230,0 +239,0 @@ fis.log.error('missing project code, use `fis.config.set("olpm.code", value);` in fis-conf.js');

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