New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

auto-sprites

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-sprites - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

13

auto-sprites.js

@@ -69,3 +69,3 @@ var path = require('path'),

this.path = config.path;
this.fileName = this.getFileName(config.fileName);
this.fileName = config.fileName;
this.root = config.root;

@@ -78,11 +78,4 @@ this.base64 = config.base64 || false;

constructor: AutoSprites,
/**
* Get image save name
* @param fileName
* @returns {*}
*/
getFileName: function (fileName) {
return crypto.createHash('md5').update(fileName).digest("hex");
},
/**
* Parse css then generate css sprites

@@ -115,3 +108,3 @@ * @param callback {Function} After generate css sprites execute callback

}).parse(function () {
next();
next();
});

@@ -118,0 +111,0 @@ }

@@ -1,2 +0,2 @@

var DialonalPacker = function(){
var DialonalPacker = function () {

@@ -10,3 +10,3 @@ };

//[w:10,h:10]
fit:function(blocks){
fit: function (blocks) {
var n, block, len = blocks.length, prevBlock;

@@ -16,26 +16,26 @@

// this.root = { x: 0, y: 0, w: w, h: h };
for (n = 0; n < len ; n++) {
for (n = 0; n < len; n++) {
block = blocks[n];
if(!this.root){
if (!this.root) {
this.root = {
x:0,
y:0,
w:block.w,
h:block.h
x: 0,
y: 0,
w: block.w,
h: block.h
};
block.fit = this.root;
}else{
} else {
this.root = {
x:0,
y:0,
w:block.w+this.root.w,
h:block.h+this.root.h,
rightTop:{
x:this.root.w,
y:0,
w:block.w,
h:block.h
x: 0,
y: 0,
w: block.w + this.root.w,
h: block.h + this.root.h,
rightTop: {
x: this.root.w,
y: 0,
w: block.w,
h: block.h
}

@@ -47,5 +47,5 @@ }

for(var j=0;j<n;j++){
for (var j = 0; j < n; j++) {
prevBlock = blocks[j];
if(prevBlock.fit){
if (prevBlock.fit) {
prevBlock.fit.y += block.h;

@@ -52,0 +52,0 @@ }

@@ -1,6 +0,7 @@

var pegasus = require('pegasus'),
var //pegasus = require('pegasus'),
path = require('path'),
AutoSprites = require('./auto-sprites');
var autoSprites = pegasus.createPipe({
var autoSprites = {}
/*pegasus.createPipe({
_initialize:function(config){

@@ -40,4 +41,8 @@ this.root = config.root;

}
});
});*/
module.exports = autoSprites;
exports.autoSprites = autoSprites;
exports.AutoSprites = AutoSprites;
var path = require('path'),
nodeImages = require('node-images'),
fs = require('fs'),
asyncUtil = require('./util');
asyncUtil = require('./util'),
crypto = require('crypto');
;

@@ -34,3 +36,3 @@ var MergeImage = function (config) {

} else {
try {
try {
console.log('Get css background ---> '+ url );

@@ -50,2 +52,3 @@ var png = nodeImages(url);

} catch (e) {
console.log(e.message);
next();

@@ -94,6 +97,7 @@ }

var imageUrl = path.join(self.path , self.fileName + '-' + self.type + '.png').split(path.sep).join('/'),
var imageUrl = path.join(self.path , crypto.createHash('md5').update(self.fileName + '-' + self.type).digest("hex").substring(0,8) + '.png').split(path.sep).join('/'),
spritesImageName = path.join( self.root , imageUrl);
console.log('Save Image to ---> '+ spritesImageName );
console.log('Save Image to ---> '+ spritesImageName );

@@ -100,0 +104,0 @@ asyncUtil.forEach(position, function (index, style, go) {

{
"name": "auto-sprites",
"version": "0.1.7",
"version": "0.1.8",
"description": "自动合并图片的模块",

@@ -28,3 +28,3 @@ "main": "index.js",

"readme": "ERROR: No README data found!",
"_id": "auto-sprites@0.1.5",
"_id": "auto-sprites@0.1.7",
"dist": {

@@ -34,3 +34,5 @@ "shasum": "c0d4ecc2fefe174c3bbd4730a62b8d76f10a4dde"

"_from": "auto-sprites@",
"_resolved": "https://registry.npmjs.org/auto-sprites/-/auto-sprites-0.1.5.tgz"
"_resolved": "https://registry.npmjs.org/auto-sprites/-/auto-sprites-0.1.7.tgz",
"homepage": "https://github.com/windyGex/auto-sprites",
"_shasum": "44c706c92554021fc4670710f157fa3406eabfdc"
}
var path = require('path'),
// from peaches
// https://github.com/sliuqin/peaches.
backgroundRegExp = [

@@ -127,3 +129,3 @@ {

}
style.setProperty(key, result[key], "");
style.setProperty(key, result[key], '');
}

@@ -142,9 +144,2 @@ }

}
//去除掉http引用的情况
url = url.replace(/(http:\/\/.*)(\/simg\/.*)/, function ($1, $2, $3) {
return $3;
});
url = url.replace(/(http:\/\/.*)(\/wimg\/.*)/, function ($1, $2, $3) {
return $3;
});
//去除掉携带参数的情况,时间戳

@@ -249,3 +244,2 @@ url = url.replace(/\?.*$/, '');

}
};

@@ -252,0 +246,0 @@

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