ocrmnav
Version:
DevStack - The Complete Developer Toolkit - Virtual file system, workflow automation, and more than 65+ other development tools / features in one seamless extension. Cutting down dev times never before seen.
372 lines (282 loc) • 10.8 kB
JavaScript
exports.id = 103;
exports.ids = [103];
exports.modules = {
/***/ 1525:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasLessInterpolation)
/* harmony export */ });
const HAS_LESS_INTERPOLATION = /@\{.+?\}/;
/**
* Check whether a string has less interpolation
*
* @param {string} string
* @returns {boolean} If `true`, a string has less interpolation
*/
function hasLessInterpolation(string) {
return HAS_LESS_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1526:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasPsvInterpolation)
/* harmony export */ });
const HAS_PSV_INTERPOLATION = /\$\(.+?\)/;
/**
* Check whether a string has postcss-simple-vars interpolation
*
* @param {string} string
* @returns {boolean}
*/
function hasPsvInterpolation(string) {
return HAS_PSV_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1527:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasScssInterpolation)
/* harmony export */ });
const HAS_SCSS_INTERPOLATION = /#\{.+?\}/s;
/**
* Check whether a string has scss interpolation
*
* @param {string} string
* @returns {boolean}
*/
function hasScssInterpolation(string) {
return HAS_SCSS_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1528:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasTplInterpolation)
/* harmony export */ });
const HAS_TPL_INTERPOLATION = /\{.+?\}/s;
/**
* Check whether a string has JS template literal interpolation or HTML-like template
*
* @param {string} string
* @returns {boolean} If `true`, a string has template literal interpolation
*/
function hasTplInterpolation(string) {
return HAS_TPL_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1650:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ functionArgumentsSearch)
/* harmony export */ });
/* harmony import */ var balanced_match__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1651);
/* harmony import */ var postcss_value_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1514);
/* harmony import */ var _validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(579);
/** @typedef {(expression: string, expressionIndex: number, funcNode: valueParser.FunctionNode, parsedValue: valueParser.ParsedValue) => void} Callback */
/**
* Search a CSS string for functions by name.
* For every match, invoke the callback, passing the function's
* "argument(s) string" (whatever is inside the parentheses)
* as an argument.
*
* Callback will be called once for every matching function found,
* with the function's "argument(s) string" and its starting index
* as the arguments.
*
* @param {string} source
* @param {string | RegExp} functionName
* @param {Callback} callback
* @returns {valueParser.ParsedValue}
*/
function functionArgumentsSearch(source, functionName, callback) {
const parsedValue = postcss_value_parser__WEBPACK_IMPORTED_MODULE_1__(source);
return parsedValue.walk((node) => {
if (node.type !== 'function') return;
const { value } = node;
if ((0,_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__.isString)(functionName) && value !== functionName) return;
if ((0,_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__.isRegExp)(functionName) && !functionName.test(node.value)) return;
const parensMatch = balanced_match__WEBPACK_IMPORTED_MODULE_0__('(', ')', source.slice(node.sourceIndex));
(0,_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_2__.assert)(parensMatch);
const expression = parensMatch.body;
const parenLength = 1; // == '('
const expressionIndex = node.sourceIndex + value.length + parenLength;
callback(expression, expressionIndex, node, parsedValue);
});
}
/***/ }),
/***/ 1651:
/***/ ((module) => {
module.exports = balanced
function balanced (a, b, str) {
if (a instanceof RegExp) a = maybeMatch(a, str)
if (b instanceof RegExp) b = maybeMatch(b, str)
const r = range(a, b, str)
return (
r && {
start: r[0],
end: r[1],
pre: str.slice(0, r[0]),
body: str.slice(r[0] + a.length, r[1]),
post: str.slice(r[1] + b.length)
}
)
}
function maybeMatch (reg, str) {
const m = str.match(reg)
return m ? m[0] : null
}
balanced.range = range
function range (a, b, str) {
let begs, beg, left, right, result
let ai = str.indexOf(a)
let bi = str.indexOf(b, ai + 1)
let i = ai
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi]
}
begs = []
left = str.length
while (i >= 0 && !result) {
if (i === ai) {
begs.push(i)
ai = str.indexOf(a, i + 1)
} else if (begs.length === 1) {
result = [begs.pop(), bi]
} else {
beg = begs.pop()
if (beg < left) {
left = beg
right = bi
}
bi = str.indexOf(b, i + 1)
}
i = ai < bi && ai >= 0 ? ai : bi
}
if (begs.length) {
result = [left, right]
}
}
return result
}
/***/ }),
/***/ 1655:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _utils_functionArgumentsSearch_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1650);
/* harmony import */ var _utils_isStandardSyntaxUrl_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1656);
/* harmony import */ var _utils_report_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(945);
/* harmony import */ var _utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(950);
/* harmony import */ var _utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(873);
const ruleName = 'function-url-no-scheme-relative';
const messages = (0,_utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(ruleName, {
rejected: 'Unexpected scheme-relative url',
});
const meta = {
url: 'https://stylelint.io/user-guide/rules/function-url-no-scheme-relative',
};
/**
* Reports scheme-relative URLs.
*
* @param {import('postcss').Node} node - The PostCSS node containing the URL.
* @param {string} rawInput - The raw string to search (e.g., decl or params).
* @param {import('stylelint').PostcssResult} result - The Stylelint result object.
*/
const reportSchemeRelativeUrl = (node, rawInput, result) => {
(0,_utils_functionArgumentsSearch_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(rawInput.toLowerCase(), 'url', (args, index) => {
const url = args.trim().replace(/^['"]+|['"]+$/g, '');
if (!(0,_utils_isStandardSyntaxUrl_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(url) || !url.startsWith('//')) {
return;
}
(0,_utils_report_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])({
message: messages.rejected,
messageArgs: [],
node,
index,
endIndex: index + args.length,
result,
ruleName,
});
});
};
/** @type {import('stylelint').CoreRules[ruleName]} */
const rule = (primary) => {
return (root, result) => {
const validOptions = (0,_utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_4__["default"])(result, ruleName, { actual: primary });
if (!validOptions) {
return;
}
root.walkDecls((decl) => {
reportSchemeRelativeUrl(decl, decl.toString(), result);
});
root.walkAtRules('import', (atRule) => {
reportSchemeRelativeUrl(atRule, atRule.toString(), result);
});
};
};
rule.ruleName = ruleName;
rule.messages = messages;
rule.meta = meta;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rule);
/***/ }),
/***/ 1656:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ isStandardSyntaxUrl)
/* harmony export */ });
/* harmony import */ var _hasLessInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1525);
/* harmony import */ var _hasPsvInterpolation_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1526);
/* harmony import */ var _hasScssInterpolation_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1527);
/* harmony import */ var _hasTplInterpolation_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1528);
const IS_LESS_VARIABLE_IN_URL = /^@@?[\w-]+$/;
const IS_SCSS_VARIABLE_IN_URL = /^[$\s\w+\-,./*'"@#?]+$/;
/**
* Check whether a URL is standard
*
* @param {string} url
* @returns {boolean}
*/
function isStandardSyntaxUrl(url) {
if (url.length === 0) {
return true;
}
// Sass interpolation works anywhere
if ((0,_hasScssInterpolation_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(url) || (0,_hasTplInterpolation_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(url) || (0,_hasPsvInterpolation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(url)) {
return false;
}
// Inside `'` and `"` work only LESS interpolation
if ((url.startsWith(`'`) && url.endsWith(`'`)) || (url.startsWith(`"`) && url.endsWith(`"`))) {
if ((0,_hasLessInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(url)) {
return false;
}
return true;
}
// Less variable works only at the beginning
// Check is less variable, allow use '@url/some/path'
// https://github.com/less/less.js/blob/3.x/lib/less/parser/parser.js#L547
if (url.startsWith('@') && IS_LESS_VARIABLE_IN_URL.test(url)) {
return false;
}
// In url without quotes scss variable can be everywhere
// But in this case it is allowed to use only specific characters
// Also forbidden "/" at the end of url
if (url.includes('$') && IS_SCSS_VARIABLE_IN_URL.test(url) && !url.endsWith('/')) {
return false;
}
return true;
}
/***/ })
};
;
//# sourceMappingURL=103.extension.js.map
;