init
This commit is contained in:
10
node_modules/postcss-helpers/.editorconfig
generated
vendored
Normal file
10
node_modules/postcss-helpers/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
; EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
; Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
charset = 'utf-8'
|
||||
trim_trailing_whitespace = true
|
||||
28
node_modules/postcss-helpers/.jshintrc
generated
vendored
Normal file
28
node_modules/postcss-helpers/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"node": true,
|
||||
|
||||
"maxparams": 5,
|
||||
"maxdepth": 5,
|
||||
"maxstatements": 40,
|
||||
"maxcomplexity": 10,
|
||||
|
||||
"bitwise": false,
|
||||
"boss" : false,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"globalstrict": true,
|
||||
"immed": true,
|
||||
"indent": 4,
|
||||
"latedef": "nofunc",
|
||||
"laxcomma": true,
|
||||
"loopfunc": true,
|
||||
"nonew": true,
|
||||
"multistr": true,
|
||||
"newcap": true,
|
||||
"quotmark": true,
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true
|
||||
}
|
||||
3
node_modules/postcss-helpers/.travis.yml
generated
vendored
Normal file
3
node_modules/postcss-helpers/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.12.9'
|
||||
35
node_modules/postcss-helpers/CHANGELOG
generated
vendored
Normal file
35
node_modules/postcss-helpers/CHANGELOG
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
0.1.0:
|
||||
date: 2014-08-08
|
||||
changes:
|
||||
- Initial release.
|
||||
0.1.1:
|
||||
date: 2014-08-11
|
||||
changes:
|
||||
- Make regexps public.
|
||||
- Fixed bug with URIs that contains ?#iefix. Normally urijs normalizes such urls and removes "?" part, but only in this exact syntax it is now preserved as is.
|
||||
|
||||
0.2.0:
|
||||
date: 2014-08-12
|
||||
changes:
|
||||
- Added UrlHelper.getOriginalURI() method.
|
||||
- Added UrlsHelper.getOriginalURIS() method.
|
||||
- Added ImportHelper.getOriginalURI() method.
|
||||
- Added ImportHelper.getOriginalMediaQuery() method.
|
||||
- Added ImportHelper.getMediaQuery() method.
|
||||
- Added ImportHelper.setMediaQuery() method.
|
||||
0.3.0:
|
||||
date: 2015-12-20
|
||||
changes:
|
||||
- Updated dependencies
|
||||
0.3.1:
|
||||
date: 2015-12-20
|
||||
changes:
|
||||
- Updated forgotten urijs references
|
||||
0.3.2
|
||||
date: 2017-08-31
|
||||
changes:
|
||||
- Resolved blank url() case https://github.com/iAdramelk/postcss-urlrewrite/issues/4#issuecomment-325940126
|
||||
0.3.3
|
||||
date: 2023-05-18
|
||||
changes:
|
||||
- Update urljs and minimatch
|
||||
22
node_modules/postcss-helpers/LICENSE-MIT
generated
vendored
Normal file
22
node_modules/postcss-helpers/LICENSE-MIT
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2014 Alexey Ivanov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
7
node_modules/postcss-helpers/index.js
generated
vendored
Normal file
7
node_modules/postcss-helpers/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
createUrlsHelper: require( './lib/urls' ),
|
||||
createImportHelper: require( './lib/import' ),
|
||||
regexp: require( './lib/regexp' )
|
||||
};
|
||||
120
node_modules/postcss-helpers/lib/import.js
generated
vendored
Normal file
120
node_modules/postcss-helpers/lib/import.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
'use strict';
|
||||
|
||||
// using URLjs because I don't want to think about all this:
|
||||
// http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding
|
||||
var regexp = require( './regexp' );
|
||||
var URI = require( 'urijs' );
|
||||
var UrlHelper = require( './url' );
|
||||
|
||||
/**
|
||||
* ImportHelper constructor
|
||||
* @constructor
|
||||
* @param {String} rule @import value.
|
||||
*/
|
||||
var ImportHelper = function ( rule ) {
|
||||
var exports = {};
|
||||
|
||||
if ( ! ( this instanceof ImportHelper ) ) {
|
||||
return new ImportHelper( rule );
|
||||
}
|
||||
|
||||
this._originalURI = this._extractURI( rule );
|
||||
|
||||
if ( !this._originalURI ) { return false; }
|
||||
|
||||
this._originalRule = rule;
|
||||
this._mediaQuery = this.getOriginalMediaQuery();
|
||||
|
||||
this.URI = URI( this._originalURI );
|
||||
|
||||
exports.URI = this.URI;
|
||||
exports.getOriginalURI = this.getOriginalURI.bind( this );
|
||||
exports.getModifiedRule = this.getModifiedRule.bind( this );
|
||||
exports.getOriginalRule = this.getOriginalRule.bind( this );
|
||||
exports.setMediaQuery = this.setMediaQuery.bind( this );
|
||||
exports.getMediaQuery = this.getMediaQuery.bind( this );
|
||||
exports.getOriginalMediaQuery = this.getOriginalMediaQuery.bind( this );
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
ImportHelper.prototype = Object.create( UrlHelper.prototype );
|
||||
|
||||
ImportHelper.prototype.constructor = ImportHelper;
|
||||
|
||||
/**
|
||||
* Extracts URI from rule.
|
||||
* @private
|
||||
* @param {String} rule String to test.
|
||||
* @returns {String|undefined} Returns URI value or undefined.
|
||||
*/
|
||||
ImportHelper.prototype._extractURI = function( rule ) {
|
||||
if ( rule.match( regexp.URLS ) ) {
|
||||
return rule.match( regexp.URLS )[ 0 ]
|
||||
.replace( /^url\s?\(/, '' )
|
||||
.replace( /\)$/, '' )
|
||||
.trim()
|
||||
.replace( /^("|\')/, '' )
|
||||
.replace( /("|\')$/, '' );
|
||||
}
|
||||
|
||||
else if ( rule.match( regexp.STRINGS ) ) {
|
||||
return rule.match( regexp.STRINGS )[ 0 ]
|
||||
.replace( /^("|\')/, '' )
|
||||
.replace( /("|\')$/, '' );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns media query from original string.
|
||||
* @returns {String|boolean} Media query or false.
|
||||
*/
|
||||
ImportHelper.prototype.getOriginalMediaQuery = function() {
|
||||
var query = this.getOriginalRule();
|
||||
if ( query.match( regexp.URLS ) ) {
|
||||
query = query.replace( regexp.URLS, '' ).trim();
|
||||
}
|
||||
else {
|
||||
query = query.replace( regexp.STRINGS, '' ).trim();
|
||||
}
|
||||
|
||||
return query || false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns current media query.
|
||||
* @returns {String|boolean} Media query or false.
|
||||
*/
|
||||
ImportHelper.prototype.getMediaQuery = function() {
|
||||
return this._mediaQuery;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets media query value.
|
||||
* @param {String} query New media query.
|
||||
*/
|
||||
ImportHelper.prototype.setMediaQuery = function( query ) {
|
||||
this._mediaQuery = query;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns modified rule.
|
||||
* @returns {String} Modified rule.
|
||||
*/
|
||||
ImportHelper.prototype.getModifiedRule = function () {
|
||||
var rule = UrlHelper.prototype.getModifiedRule.apply( this );
|
||||
|
||||
if ( this.getMediaQuery() !== this.getOriginalMediaQuery() ) {
|
||||
if ( this.getOriginalMediaQuery() ) {
|
||||
rule = rule.replace( this.getOriginalMediaQuery(), this.getMediaQuery() || '' ).trim();
|
||||
}
|
||||
else if ( this.getMediaQuery() ) {
|
||||
rule = rule + ' ' + this.getMediaQuery();
|
||||
}
|
||||
}
|
||||
|
||||
return rule;
|
||||
};
|
||||
|
||||
module.exports = ImportHelper;
|
||||
20
node_modules/postcss-helpers/lib/regexp.js
generated
vendored
Normal file
20
node_modules/postcss-helpers/lib/regexp.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
/** Making url() RegExp according to css tokenization rules:
|
||||
* http://www.w3.org/TR/CSS21/syndata.html#tokenization
|
||||
*/
|
||||
|
||||
var R_W = '[ \\t\\r\\n\\f]*';
|
||||
var R_NL = '\\n|\\r\\n|\\r|\\f';
|
||||
var R_UNICODE = '\\\\[0-9a-f]{1,6}(\\r\\n|[ \\n\\r\\t\\f])?';
|
||||
var R_NONASCII = '[^\\0-\\237]';
|
||||
var R_ESCAPE = R_UNICODE + '|\\\\[^\\n\\r\\f0-9a-f]';
|
||||
var R_STRING_1 = '\\"([^\\n\\r\\f\\\\"]|\\\\' + R_NL + '|' + R_ESCAPE + ')*\\"';
|
||||
var R_STRING_2 = '\\\'([^\\n\\r\\f\\\\\']|\\\\' + R_NL + '|' + R_ESCAPE + ')*\\\'';
|
||||
var R_STRING = '(' + R_STRING_1 + '|' + R_STRING_2 + ')';
|
||||
var R_URI = 'url\\(' + R_W + R_STRING + R_W + '\\)|url\\(' + R_W + '([!#$%&*-\\[\\]-~]|' + R_NONASCII + '|' + R_ESCAPE + ')*' + R_W + '\\)';
|
||||
|
||||
module.exports = {
|
||||
STRINGS: new RegExp( R_STRING, 'ig' ),
|
||||
URLS: new RegExp( R_URI, 'ig' )
|
||||
};
|
||||
92
node_modules/postcss-helpers/lib/url.js
generated
vendored
Normal file
92
node_modules/postcss-helpers/lib/url.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
|
||||
// using URLjs because I don't want to think about all this:
|
||||
// http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding
|
||||
var URI = require( 'urijs' );
|
||||
var regexp = require( './regexp' );
|
||||
|
||||
/**
|
||||
* UrlHelper constructor
|
||||
* @constructor
|
||||
* @param {String} rule CSS rule with url().
|
||||
*/
|
||||
var UrlHelper = function ( rule ) {
|
||||
var exports = {};
|
||||
|
||||
if ( ! ( this instanceof UrlHelper ) ) {
|
||||
return new UrlHelper( rule );
|
||||
}
|
||||
|
||||
this._originalURI = this._extractURI( rule );
|
||||
|
||||
if ( !this._originalURI && this._originalURI !== '') { return false; }
|
||||
|
||||
this._originalRule = rule;
|
||||
|
||||
this.URI = URI( this._originalURI );
|
||||
|
||||
exports.URI = this.URI;
|
||||
exports.getOriginalURI = this.getOriginalURI.bind( this );
|
||||
exports.getModifiedRule = this.getModifiedRule.bind( this );
|
||||
exports.getOriginalRule = this.getOriginalRule.bind( this );
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extracts URI from rule.
|
||||
* @private
|
||||
* @param {String} rule String to test.
|
||||
* @returns {String|undefined} Returns URI value or undefined.
|
||||
*/
|
||||
UrlHelper.prototype._extractURI = function( rule ) {
|
||||
if ( rule.match( regexp.URLS ) ) {
|
||||
return rule.match( regexp.URLS )[ 0 ]
|
||||
.replace( /^url\s?\(/, '' )
|
||||
.replace( /\)$/, '' )
|
||||
.trim()
|
||||
.replace( /^("|\')/, '' )
|
||||
.replace( /("|\')$/, '' );
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns original URI.
|
||||
* @returns {String} Original URI.
|
||||
*/
|
||||
UrlHelper.prototype.getOriginalURI = function () {
|
||||
return this._originalURI;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns modified rule.
|
||||
* @returns {String} Modified rule.
|
||||
*/
|
||||
UrlHelper.prototype.getModifiedRule = function () {
|
||||
var modifiedURI = this.URI.toString();
|
||||
var originalHasIEFix = this._originalURI.match( /\?#iefix/ );
|
||||
var modifiedShouldHaveIEFix = modifiedURI.match( /[^?]#iefix/ );
|
||||
|
||||
// TODO Remove VERY ugly ?#iefix exeption handling, urijs normalizing it and removing "?"
|
||||
if ( originalHasIEFix && modifiedShouldHaveIEFix ) {
|
||||
modifiedURI = modifiedURI.replace( '#iefix', '?#iefix' );
|
||||
}
|
||||
|
||||
if (this._originalRule.match(/url\(\s*\)/) && modifiedURI) {
|
||||
return "url('" + modifiedURI + "')";
|
||||
}
|
||||
|
||||
return this._originalRule.replace( this._originalURI, modifiedURI );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns original rule.
|
||||
* @returns {String} Original rule.
|
||||
*/
|
||||
UrlHelper.prototype.getOriginalRule = function () {
|
||||
return this._originalRule;
|
||||
};
|
||||
|
||||
module.exports = UrlHelper;
|
||||
73
node_modules/postcss-helpers/lib/urls.js
generated
vendored
Normal file
73
node_modules/postcss-helpers/lib/urls.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
var UrlHelper = require( './url' );
|
||||
var regexp = require( './regexp' );
|
||||
|
||||
/**
|
||||
* UrlsHelper constructor
|
||||
* @constructor
|
||||
* @param {String} rule CSS rule with many url() blocks.
|
||||
*/
|
||||
var UrlsHelper = function( rule ) {
|
||||
var exports = {};
|
||||
|
||||
if ( !rule.match( regexp.URLS ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! ( this instanceof UrlsHelper ) ) {
|
||||
return new UrlsHelper( rule );
|
||||
}
|
||||
|
||||
this._originalRule = rule;
|
||||
this._helpers = [];
|
||||
this.URIS = [];
|
||||
|
||||
rule.match( regexp.URLS ).forEach( function( url ) {
|
||||
var urlHelper = new UrlHelper( url );
|
||||
|
||||
this._helpers.push( urlHelper );
|
||||
this.URIS.push( urlHelper.URI );
|
||||
}, this );
|
||||
|
||||
exports.URIS = this.URIS;
|
||||
exports.getOriginalURIS = this.getOriginalURIS.bind( this );
|
||||
exports.getModifiedRule = this.getModifiedRule.bind( this );
|
||||
exports.getOriginalRule = this.getOriginalRule.bind( this );
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns modified rule.
|
||||
* @returns {String} Modified rule.
|
||||
*/
|
||||
UrlsHelper.prototype.getModifiedRule = function() {
|
||||
var rule = this._originalRule;
|
||||
|
||||
this._helpers.forEach( function ( uri ) {
|
||||
rule = rule.replace( uri.getOriginalRule(), uri.getModifiedRule() );
|
||||
} );
|
||||
|
||||
return rule;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns original rule.
|
||||
* @returns {String} Original rule.
|
||||
*/
|
||||
UrlsHelper.prototype.getOriginalRule = function() {
|
||||
return this._originalRule;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns array of original URIs.
|
||||
* @returns {String} Original URIs array.
|
||||
*/
|
||||
UrlsHelper.prototype.getOriginalURIS = function () {
|
||||
return this._helpers.map( function( helper ) {
|
||||
return helper.getOriginalURI();
|
||||
} );
|
||||
};
|
||||
|
||||
module.exports = UrlsHelper;
|
||||
29
node_modules/postcss-helpers/package.json
generated
vendored
Normal file
29
node_modules/postcss-helpers/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "postcss-helpers",
|
||||
"description": "Some general purpose helpers for PostCSS, created to make working with url() and @import values more easy.",
|
||||
"version": "0.3.3",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/iAdramelk/postcss-helpers.git"
|
||||
},
|
||||
"authors": [
|
||||
"Alexey Ivanov <iadramelk@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.12.9"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter list"
|
||||
},
|
||||
"keywords": [
|
||||
"postcss"
|
||||
],
|
||||
"dependencies": {
|
||||
"urijs": "^1.18.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^3.5.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user