This commit is contained in:
2025-11-14 11:39:33 +08:00
parent 6e5d892992
commit 1ba633ba45
7143 changed files with 922330 additions and 0 deletions

10
node_modules/postcss-urlrewrite/.editorconfig generated vendored Normal file
View 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-urlrewrite/.jshintrc generated vendored Normal file
View 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-urlrewrite/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,3 @@
language: node_js
node_js:
- '8.4.0'

View File

@@ -0,0 +1,8 @@
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

26
node_modules/postcss-urlrewrite/CHANGELOG generated vendored Normal file
View File

@@ -0,0 +1,26 @@
0.1.0:
date: 2014-08-12
changes:
- Initial release.
0.1.1:
date: 2014-08-13
changes:
- Bumped post-helpers version to 0.2.0.
0.2.0:
date: 2015-12-20
changes:
- Bumped post-helpers version to 0.3.1.
- Updated dependencies.
- Updated deprecated postcss syntax.
0.2.1:
date: 2017-01-05
changes:
- Fixed issue #3 (properties not accepted 'true').
0.2.2
date: 2017-08-31
changes:
- Fixed issue #4 (blank url() throws error).
0.3.0
date: 2024-08-12
changes:
- Replace deprecated node.js methods and update dependencies.

22
node_modules/postcss-urlrewrite/LICENSE-MIT generated vendored Normal file
View 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.

3
node_modules/postcss-urlrewrite/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
module.exports = require("./lib/urlrewrite.js");

142
node_modules/postcss-urlrewrite/lib/urlrewrite.js generated vendored Normal file
View File

@@ -0,0 +1,142 @@
"use strict";
var helpers = require("postcss-helpers");
var util = require("util");
/**
* Checks validity of config object.
* @private
* @param {Object} config Configuration object
*/
var validateConfig = function (config) {
if (!config || !config.rules) {
throw new Error("You must configure at least one replace rule.");
}
if (!Array.isArray(config.rules) && typeof config.rules !== "function") {
throw new Error("Rules must be an Array or Function.");
}
if (Array.isArray(config.rules)) {
config.rules.forEach(function (rule) {
if (!rule.from && !rule.to) {
throw new Error(
'Rules must be in { from: "from", to: "to" } format.'
);
} else if (
typeof rule.from !== "string" &&
!util.types.isRegExp(rule.from)
) {
throw new Error("Rule.from must be a String or RegExp.");
} else if (["string", "function"].indexOf(typeof rule.to) === -1) {
throw new Error("Rule.to must be a String or Function.");
}
});
}
if (
config.properties &&
!Array.isArray(config.properties) &&
!(typeof config.properties === "boolean")
) {
throw new Error("Properties must be an Array of Strings or Boolean.");
}
if (Array.isArray(config.properties)) {
config.properties.forEach(function (prop) {
if (typeof prop !== "string") {
throw new Error('Items in "properties" array must be Strings.');
}
});
}
};
/**
* Returns callback function for URI replacement based on config params.
* @private
* @param {Array} rules Array of objects with "from" and "to" keys to use
* as arguments to String.replace.
* @returns {Function} Callback function.
*/
var useRulesCallback = function (rules) {
rules = rules;
return function (uri) {
var modified = false;
var original = uri.href();
rules.forEach(function (rule) {
if (modified) {
return;
}
var tmp = original.replace(rule.from, rule.to);
if (tmp !== original) {
modified = true;
uri.href(tmp);
}
});
};
};
/**
* Plugin body.
* @param {Boolean} config.imports If set to true, will also replace @import values.
* @param {Array|Boolean} config.properties List of css properties to update or false.
* @param {Array|Function} config.rules Array of replace params or
* callback function.
* @returns {Function} PostCSS plugin.
*/
var urlrewrite = function (config) {
validateConfig(config);
// Choosing which callback to use: One received from user or autogenerated
// from params.
var callback = Array.isArray(config.rules)
? useRulesCallback(config.rules)
: config.rules;
// Function to update @import URIs
var updateImport = function (atRule) {
if (atRule.name !== "import") {
return;
}
var helper = helpers.createImportHelper(atRule.params);
callback(helper.URI);
atRule.params = helper.getModifiedRule();
};
// Function to update declarations URIs
var updateDecl = function (decl) {
if (config.properties === false) {
return;
}
if (
Array.isArray(config.properties) &&
config.properties.indexOf(decl.prop) === -1
) {
return;
}
if (!decl.value.match(helpers.regexp.URLS)) {
return;
}
var helper = helpers.createUrlsHelper(decl.value);
helper.URIS.forEach(callback);
decl.value = helper.getModifiedRule();
};
return function (style) {
if (config.imports) {
style.walkAtRules(updateImport);
}
if (config.properties !== false) {
style.walkDecls(updateDecl);
}
};
};
module.exports = urlrewrite;

31
node_modules/postcss-urlrewrite/package.json generated vendored Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "postcss-urlrewrite",
"description": "PostCSS plugin for easy url() rewriting.",
"version": "0.3.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/iAdramelk/postcss-urlrewrite.git"
},
"authors": [
"Alexey Ivanov <mail@alexeyivanov.info>"
],
"license": "MIT",
"engines": {
"node": ">=16"
},
"scripts": {
"test": "mocha --reporter list"
},
"keywords": [
"postcss",
"css"
],
"dependencies": {
"postcss-helpers": "^0.3.3"
},
"devDependencies": {
"mocha": "^10.7.3",
"postcss": "^8.4.41"
}
}