|
1 | 1 |
|
2 | 2 | /** |
3 | 3 | * AdGuard Scriptlets |
4 | | - * Version 1.3.3 |
| 4 | + * Version 1.3.4 |
5 | 5 | */ |
6 | 6 |
|
7 | 7 | /** |
@@ -5194,58 +5194,6 @@ var redirectsList = /*#__PURE__*/Object.freeze({ |
5194 | 5194 | AmazonApstag: AmazonApstag |
5195 | 5195 | }); |
5196 | 5196 |
|
5197 | | -/** |
5198 | | - * Finds redirect resource by it's name |
5199 | | - * @param {string} name - redirect name |
5200 | | - */ |
5201 | | - |
5202 | | -var getRedirectByName = function getRedirectByName(name) { |
5203 | | - var redirects = Object.keys(redirectsList).map(function (key) { |
5204 | | - return redirectsList[key]; |
5205 | | - }); |
5206 | | - return redirects.find(function (r) { |
5207 | | - return r.names && r.names.indexOf(name) > -1; |
5208 | | - }); |
5209 | | -}; |
5210 | | -/** |
5211 | | - * @typedef {Object} Source - redirect properties |
5212 | | - * @property {string} name redirect name |
5213 | | - * @property {Array<string>} args Arguments for redirect function |
5214 | | - * @property {'extension'|'test'} [engine] - |
5215 | | - * Defines the final form of redirect string presentation |
5216 | | - * @property {boolean} [verbose] flag to enable printing to console debug information |
5217 | | - */ |
5218 | | - |
5219 | | -/** |
5220 | | - * Returns redirect code by param |
5221 | | - * @param {Source} source |
5222 | | - * @returns {string} redirect code |
5223 | | - */ |
5224 | | - |
5225 | | - |
5226 | | -var getRedirectCode = function getRedirectCode(source) { |
5227 | | - var redirect = getRedirectByName(source.name); |
5228 | | - var result = attachDependencies(redirect); |
5229 | | - result = addCall(redirect, result); // redirect code for different sources is checked in tests |
5230 | | - // so it should be just a code without any source and props passed |
5231 | | - |
5232 | | - result = source.engine === 'test' ? wrapInNonameFunc(result) : passSourceAndProps(source, result); |
5233 | | - return result; |
5234 | | -}; |
5235 | | - |
5236 | | -var redirectsCjs = { |
5237 | | - getCode: getRedirectCode, |
5238 | | - isAdgRedirectRule: validator.isAdgRedirectRule, |
5239 | | - isValidAdgRedirectRule: validator.isValidAdgRedirectRule, |
5240 | | - isAdgRedirectCompatibleWithUbo: validator.isAdgRedirectCompatibleWithUbo, |
5241 | | - isUboRedirectCompatibleWithAdg: validator.isUboRedirectCompatibleWithAdg, |
5242 | | - isAbpRedirectCompatibleWithAdg: validator.isAbpRedirectCompatibleWithAdg, |
5243 | | - convertUboRedirectToAdg: convertUboRedirectToAdg, |
5244 | | - convertAbpRedirectToAdg: convertAbpRedirectToAdg, |
5245 | | - convertRedirectToAdg: convertRedirectToAdg, |
5246 | | - convertAdgRedirectToUbo: convertAdgRedirectToUbo |
5247 | | -}; |
5248 | | - |
5249 | 5197 | function _classCallCheck(instance, Constructor) { |
5250 | 5198 | if (!(instance instanceof Constructor)) { |
5251 | 5199 | throw new TypeError("Cannot call a class as a function"); |
@@ -9225,6 +9173,59 @@ var Redirects = /*#__PURE__*/function () { |
9225 | 9173 | return Redirects; |
9226 | 9174 | }(); |
9227 | 9175 |
|
| 9176 | +/** |
| 9177 | + * Finds redirect resource by it's name |
| 9178 | + * @param {string} name - redirect name |
| 9179 | + */ |
| 9180 | + |
| 9181 | +var getRedirectByName = function getRedirectByName(name) { |
| 9182 | + var redirects = Object.keys(redirectsList).map(function (key) { |
| 9183 | + return redirectsList[key]; |
| 9184 | + }); |
| 9185 | + return redirects.find(function (r) { |
| 9186 | + return r.names && r.names.indexOf(name) > -1; |
| 9187 | + }); |
| 9188 | +}; |
| 9189 | +/** |
| 9190 | + * @typedef {Object} Source - redirect properties |
| 9191 | + * @property {string} name redirect name |
| 9192 | + * @property {Array<string>} args Arguments for redirect function |
| 9193 | + * @property {'extension'|'test'} [engine] - |
| 9194 | + * Defines the final form of redirect string presentation |
| 9195 | + * @property {boolean} [verbose] flag to enable printing to console debug information |
| 9196 | + */ |
| 9197 | + |
| 9198 | +/** |
| 9199 | + * Returns redirect code by param |
| 9200 | + * @param {Source} source |
| 9201 | + * @returns {string} redirect code |
| 9202 | + */ |
| 9203 | + |
| 9204 | + |
| 9205 | +var getRedirectCode = function getRedirectCode(source) { |
| 9206 | + var redirect = getRedirectByName(source.name); |
| 9207 | + var result = attachDependencies(redirect); |
| 9208 | + result = addCall(redirect, result); // redirect code for different sources is checked in tests |
| 9209 | + // so it should be just a code without any source and props passed |
| 9210 | + |
| 9211 | + result = source.engine === 'test' ? wrapInNonameFunc(result) : passSourceAndProps(source, result); |
| 9212 | + return result; |
| 9213 | +}; |
| 9214 | + |
| 9215 | +var redirectsCjs = { |
| 9216 | + Redirects: Redirects, |
| 9217 | + getCode: getRedirectCode, |
| 9218 | + isAdgRedirectRule: validator.isAdgRedirectRule, |
| 9219 | + isValidAdgRedirectRule: validator.isValidAdgRedirectRule, |
| 9220 | + isAdgRedirectCompatibleWithUbo: validator.isAdgRedirectCompatibleWithUbo, |
| 9221 | + isUboRedirectCompatibleWithAdg: validator.isUboRedirectCompatibleWithAdg, |
| 9222 | + isAbpRedirectCompatibleWithAdg: validator.isAbpRedirectCompatibleWithAdg, |
| 9223 | + convertUboRedirectToAdg: convertUboRedirectToAdg, |
| 9224 | + convertAbpRedirectToAdg: convertAbpRedirectToAdg, |
| 9225 | + convertRedirectToAdg: convertRedirectToAdg, |
| 9226 | + convertAdgRedirectToUbo: convertAdgRedirectToUbo |
| 9227 | +}; |
| 9228 | + |
9228 | 9229 | /** |
9229 | 9230 | * @typedef {Object} Source - scriptlet properties |
9230 | 9231 | * @property {string} name Scriptlet name |
@@ -9275,8 +9276,7 @@ var scriptletsObject = function () { |
9275 | 9276 | convertAbpToAdg: convertAbpSnippetToAdg, |
9276 | 9277 | convertScriptletToAdg: convertScriptletToAdg, |
9277 | 9278 | convertAdgToUbo: convertAdgScriptletToUbo, |
9278 | | - redirects: redirectsCjs, |
9279 | | - Redirects: Redirects |
| 9279 | + redirects: redirectsCjs |
9280 | 9280 | }; |
9281 | 9281 | }(); |
9282 | 9282 |
|
|
0 commit comments