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

palo

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

palo - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

3

lib/Package.js

@@ -328,3 +328,2 @@ var OO = require( 'oojs' ),

res = this.resources,
lang = this.constructor.static.resourceLanguages[type],
format = this.constructor.static.resourceFormats[type];

@@ -336,4 +335,2 @@

options = ( options && options[lang] ) || {};
if ( format === 'object' ) {

@@ -340,0 +337,0 @@ out = {};

38

lib/resources/StylesheetResource.js

@@ -33,2 +33,6 @@ var OO = require( 'oojs' ),

* @inheritdoc
*
* @param {string} file File name
* @param {Object} [options] Generation options
* @param {boolean} [staticRoot] Base URL for static file access
*/

@@ -43,2 +47,6 @@ StylesheetResource.prototype.mapFileToContent = function *( file, options ) {

if ( options && options.staticRoot ) {
css = this.remap( css, file, options.staticRoot );
}
return css;

@@ -74,4 +82,34 @@ };

StylesheetResource.prototype.remap = function ( data, fileName, staticRoot ) {
if ( data && staticRoot ) {
return data.replace( /url\s*\(\s*(['"]?)([^"'\)]*)\1\s*\)/gi, function ( match ) {
var url, urlPath,
dirName = path.resolve( path.dirname( fileName ) );
match = match.replace( /\s/g, '' );
url = match.slice( 4, -1 )
.replace( /"|'/g, '' )
.replace( /\\/g, '/' );
if (
/^\/|https:|http:|data:/i.test( url ) === false &&
dirName.indexOf( staticRoot ) > -1
) {
urlPath = path.resolve( dirName + '/' + url );
if ( urlPath.indexOf( staticRoot ) > -1 ) {
url = staticRoot + urlPath
.substr( urlPath.indexOf( staticRoot ) + staticRoot.length )
.replace( /\\/g, '/' );
}
}
return 'url("' + url + '")';
} );
}
return data;
};
/* Exports */
module.exports = StylesheetResource;
{
"name": "palo",
"version": "0.1.2",
"version": "0.1.3",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

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