@adguard/agtree 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v1.1.0 (build date: Thu, 10 Aug 2023 15:16:26 GMT)
2
+ * AGTree v1.1.2 (build date: Mon, 14 Aug 2023 13:52:06 GMT)
3
3
  * (c) 2023 AdGuard Software Ltd.
4
4
  * Released under the MIT license
5
5
  * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
@@ -4308,21 +4308,15 @@ class ScriptletInjectionBodyParser {
4308
4308
  }
4309
4309
  // Save the offset of the opening parentheses
4310
4310
  const openingParenthesesIndex = offset;
4311
- // Find closing parentheses
4312
- // eslint-disable-next-line max-len
4313
- const closingParenthesesIndex = StringUtils.findUnescapedNonStringNonRegexChar(raw, CLOSE_PARENTHESIS, openingParenthesesIndex + 1);
4311
+ // Skip whitespace from the end
4312
+ const closingParenthesesIndex = StringUtils.skipWSBack(raw, raw.length - 1);
4314
4313
  // Closing parentheses should be present
4315
- if (closingParenthesesIndex === -1) {
4314
+ if (raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS
4315
+ || raw[closingParenthesesIndex - 1] === ESCAPE_CHARACTER) {
4316
4316
  throw new AdblockSyntaxError(
4317
4317
  // eslint-disable-next-line max-len
4318
4318
  `Invalid AdGuard/uBlock scriptlet call, no closing parentheses '${CLOSE_PARENTHESIS}' found`, locRange(loc, offset, raw.length));
4319
4319
  }
4320
- // Shouldn't have any characters after the closing parentheses
4321
- if (StringUtils.skipWSBack(raw) !== closingParenthesesIndex) {
4322
- throw new AdblockSyntaxError(
4323
- // eslint-disable-next-line max-len
4324
- `Invalid AdGuard/uBlock scriptlet call, unexpected characters after the closing parentheses '${CLOSE_PARENTHESIS}'`, locRange(loc, closingParenthesesIndex + 1, raw.length));
4325
- }
4326
4320
  // Parse parameter list
4327
4321
  const params = ParameterListParser.parse(raw.substring(openingParenthesesIndex + 1, closingParenthesesIndex), COMMA, shiftLoc(loc, openingParenthesesIndex + 1));
4328
4322
  // Allow empty scritptlet call: js() or //scriptlet(), but not allow parameters
@@ -5818,12 +5812,14 @@ var data$O = { adg_os_any:{ name:"cookie",
5818
5812
  docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#cookie-modifier",
5819
5813
  assignable:true,
5820
5814
  negatable:false,
5815
+ value_optional:true,
5821
5816
  value_format:"^([^;=\\s]*?)((?:;(maxAge=\\d+;?)?|(sameSite=(lax|none|strict);?)?){1,3})(?<!;)$" },
5822
5817
  adg_ext_any:{ name:"cookie",
5823
5818
  description:"The `$cookie` modifier completely changes rule behavior.\nInstead of blocking a request, this modifier makes us suppress or modify the Cookie and Set-Cookie headers.",
5824
5819
  docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#cookie-modifier",
5825
5820
  assignable:true,
5826
5821
  negatable:false,
5822
+ value_optional:true,
5827
5823
  value_format:"^([^;=\\s]*?)((?:;(maxAge=\\d+;?)?|(sameSite=(lax|none|strict);?)?){1,3})(?<!;)$" } };
5828
5824
 
5829
5825
  var data$N = { adg_os_any:{ name:"csp",
@@ -5836,6 +5832,7 @@ var data$N = { adg_os_any:{ name:"csp",
5836
5832
  inverse_conflicts:true,
5837
5833
  assignable:true,
5838
5834
  negatable:false,
5835
+ value_optional:true,
5839
5836
  value_format:"/[^,$]+/" },
5840
5837
  adg_ext_any:{ name:"csp",
5841
5838
  description:"This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
@@ -5847,6 +5844,7 @@ var data$N = { adg_os_any:{ name:"csp",
5847
5844
  inverse_conflicts:true,
5848
5845
  assignable:true,
5849
5846
  negatable:false,
5847
+ value_optional:true,
5850
5848
  value_format:"/[^,$]+/" },
5851
5849
  abp_ext_any:{ name:"csp",
5852
5850
  description:"This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
@@ -5856,6 +5854,7 @@ var data$N = { adg_os_any:{ name:"csp",
5856
5854
  inverse_conflicts:true,
5857
5855
  assignable:true,
5858
5856
  negatable:false,
5857
+ value_optional:true,
5859
5858
  value_format:"/[^,$]+/" },
5860
5859
  ubo_ext_any:{ name:"csp",
5861
5860
  description:"This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
@@ -5867,6 +5866,7 @@ var data$N = { adg_os_any:{ name:"csp",
5867
5866
  inverse_conflicts:true,
5868
5867
  assignable:true,
5869
5868
  negatable:false,
5869
+ value_optional:true,
5870
5870
  value_format:"/[^,$]+/" } };
5871
5871
 
5872
5872
  var data$M = { adg_os_any:{ name:"denyallow",
@@ -6432,6 +6432,7 @@ var data$h = { adg_os_any:{ name:"redirect-rule",
6432
6432
  inverse_conflicts:true,
6433
6433
  assignable:true,
6434
6434
  negatable:false,
6435
+ value_optional:true,
6435
6436
  value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html|\n )?$" },
6436
6437
  adg_ext_any:{ name:"redirect-rule",
6437
6438
  description:"This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
@@ -6461,6 +6462,7 @@ var data$h = { adg_os_any:{ name:"redirect-rule",
6461
6462
  inverse_conflicts:true,
6462
6463
  assignable:true,
6463
6464
  negatable:false,
6465
+ value_optional:true,
6464
6466
  value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html|\n )?$" },
6465
6467
  ubo_ext_any:{ name:"redirect-rule",
6466
6468
  description:"This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
@@ -6497,19 +6499,28 @@ var data$g = { adg_os_any:{ name:"redirect",
6497
6499
  docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
6498
6500
  assignable:true,
6499
6501
  negatable:false,
6502
+ value_optional:true,
6500
6503
  value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html\n )?$" },
6501
6504
  adg_ext_any:{ name:"redirect",
6502
6505
  description:"Used to redirect web requests to a local \"resource\".",
6503
6506
  docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
6504
6507
  assignable:true,
6505
6508
  negatable:false,
6509
+ value_optional:true,
6506
6510
  value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html\n )?$" },
6507
6511
  ubo_ext_any:{ name:"redirect",
6508
6512
  description:"Used to redirect web requests to a local \"resource\".",
6509
6513
  docs:"https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#redirect",
6510
6514
  assignable:true,
6511
6515
  negatable:false,
6512
- value_format:"(?x)\n ^(\n 1x1\\.gif|\n 2x2\\.png|\n 3x2\\.png|\n 32x32\\.png|\n noop\\.css|\n noop\\.html|\n noopframe|\n noop\\.js|\n noop\\.txt|\n noop-0\\.1s\\.mp3|\n noop-0\\.5s\\.mp3|\n noop-1s\\.mp4|\n none|\n click2load\\.html|\n addthis_widget\\.js|\n amazon_ads\\.js|\n amazon_apstag\\.js|\n monkeybroker\\.js|\n doubleclick_instream_ad_status|\n google-analytics_ga\\.js|\n google-analytics_analytics\\.js|\n google-analytics_inpage_linkid\\.js|\n google-analytics_cx_api\\.js|\n google-ima\\.js|\n googletagservices_gpt\\.js|\n googletagmanager_gtm\\.js|\n googlesyndication_adsbygoogle\\.js|\n scorecardresearch_beacon\\.js|\n outbrain-widget\\.js|\n hd-main\\.js\n )\n (:[0-9]+)?$" } };
6516
+ value_optional:true,
6517
+ value_format:"(?x)\n ^(\n 1x1\\.gif|\n 2x2\\.png|\n 3x2\\.png|\n 32x32\\.png|\n noop\\.css|\n noop\\.html|\n noopframe|\n noop\\.js|\n noop\\.txt|\n noop-0\\.1s\\.mp3|\n noop-0\\.5s\\.mp3|\n noop-1s\\.mp4|\n none|\n click2load\\.html|\n addthis_widget\\.js|\n amazon_ads\\.js|\n amazon_apstag\\.js|\n monkeybroker\\.js|\n doubleclick_instream_ad_status|\n google-analytics_ga\\.js|\n google-analytics_analytics\\.js|\n google-analytics_inpage_linkid\\.js|\n google-analytics_cx_api\\.js|\n google-ima\\.js|\n googletagservices_gpt\\.js|\n googletagmanager_gtm\\.js|\n googlesyndication_adsbygoogle\\.js|\n scorecardresearch_beacon\\.js|\n outbrain-widget\\.js|\n hd-main\\.js\n )\n (:[0-9]+)?$" },
6518
+ abp_ext_any:{ name:"rewrite",
6519
+ description:"The `rewrite=` option allows the rewriting of URLs (or redirecting requests) to an internal\nresource in order to deactivate it without causing an error. Indicate the internal resource\nby name and prefix `abp-resource:` in order to be recognized. For example\n`$rewrite=abp-resource:blank-js` sends an empty JavaScript.",
6520
+ docs:"https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
6521
+ assignable:true,
6522
+ negatable:false,
6523
+ value_format:"(?x)\n # ABP resources always starts with the `abp-resource:` prefix\n ^abp-resource:\n # Possible resource names\n (\n blank-text|\n blank-css|\n blank-js|\n blank-html|\n blank-mp3|\n 1x1-transparent-gif|\n 2x2-transparent-png|\n 3x2-transparent-png|\n 32x32-transparent-png\n )$" } };
6513
6524
 
6514
6525
  var data$f = { adg_os_any:{ name:"removeheader",
6515
6526
  description:"Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
@@ -6536,6 +6547,7 @@ var data$f = { adg_os_any:{ name:"removeheader",
6536
6547
  inverse_conflicts:true,
6537
6548
  assignable:true,
6538
6549
  negatable:false,
6550
+ value_optional:true,
6539
6551
  value_format:"(?xi)\n ^\n # Value may start with \"request:\"\n (request:)?\n\n # Forbidden header names\n (?!\n (\n access-control-allow-origin|\n access-control-allow-credentials|\n access-control-allow-headers|\n access-control-allow-methods|\n access-control-expose-headers|\n access-control-max-age|\n access-control-request-headers|\n access-control-request-method|\n origin|\n timing-allow-origin|\n allow|\n cross-origin-embedder-policy|\n cross-origin-opener-policy|\n cross-origin-resource-policy|\n content-security-policy|\n content-security-policy-report-only|\n expect-ct|\n feature-policy|\n origin-isolation|\n strict-transport-security|\n upgrade-insecure-requests|\n x-content-type-options|\n x-download-options|\n x-frame-options|\n x-permitted-cross-domain-policies|\n x-powered-by|\n x-xss-protection|\n public-key-pins|\n public-key-pins-report-only|\n sec-websocket-key|\n sec-websocket-extensions|\n sec-websocket-accept|\n sec-websocket-protocol|\n sec-websocket-version|\n p3p|\n sec-fetch-mode|\n sec-fetch-dest|\n sec-fetch-site|\n sec-fetch-user|\n referrer-policy|\n content-type|\n content-length|\n accept|\n accept-encoding|\n host|\n connection|\n transfer-encoding|\n upgrade\n )\n $)\n\n # Any other header name is allowed, if it matches the following regex\n [A-z0-9-]+\n $" },
6540
6552
  adg_ext_any:{ name:"removeheader",
6541
6553
  description:"Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
@@ -6562,6 +6574,7 @@ var data$f = { adg_os_any:{ name:"removeheader",
6562
6574
  inverse_conflicts:true,
6563
6575
  assignable:true,
6564
6576
  negatable:false,
6577
+ value_optional:true,
6565
6578
  value_format:"(?xi)\n ^\n # Value may start with \"request:\"\n (request:)?\n\n # Forbidden header names\n (?!\n (\n access-control-allow-origin|\n access-control-allow-credentials|\n access-control-allow-headers|\n access-control-allow-methods|\n access-control-expose-headers|\n access-control-max-age|\n access-control-request-headers|\n access-control-request-method|\n origin|\n timing-allow-origin|\n allow|\n cross-origin-embedder-policy|\n cross-origin-opener-policy|\n cross-origin-resource-policy|\n content-security-policy|\n content-security-policy-report-only|\n expect-ct|\n feature-policy|\n origin-isolation|\n strict-transport-security|\n upgrade-insecure-requests|\n x-content-type-options|\n x-download-options|\n x-frame-options|\n x-permitted-cross-domain-policies|\n x-powered-by|\n x-xss-protection|\n public-key-pins|\n public-key-pins-report-only|\n sec-websocket-key|\n sec-websocket-extensions|\n sec-websocket-accept|\n sec-websocket-protocol|\n sec-websocket-version|\n p3p|\n sec-fetch-mode|\n sec-fetch-dest|\n sec-fetch-site|\n sec-fetch-user|\n referrer-policy|\n content-type|\n content-length|\n accept|\n accept-encoding|\n host|\n connection|\n transfer-encoding|\n upgrade\n )\n $)\n\n # Any other header name is allowed, if it matches the following regex\n [A-z0-9-]+\n $" } };
6566
6579
 
6567
6580
  var data$e = { adg_os_any:{ name:"removeparam",
@@ -6569,12 +6582,14 @@ var data$e = { adg_os_any:{ name:"removeparam",
6569
6582
  docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
6570
6583
  assignable:true,
6571
6584
  negatable:false,
6585
+ value_optional:true,
6572
6586
  value_format:"/^(?!.*([^\\\\](,|\\$|\\/))).*$/" },
6573
6587
  adg_ext_any:{ name:"removeparam",
6574
6588
  description:"Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
6575
6589
  docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
6576
6590
  assignable:true,
6577
6591
  negatable:false,
6592
+ value_optional:true,
6578
6593
  value_format:"/^(?!.*([^\\\\](,|\\$|\\/))).*$/" },
6579
6594
  ubo_ext_any:{ name:"removeparam",
6580
6595
  description:"Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
@@ -6662,6 +6677,7 @@ var data$a = { adg_os_any:{ name:"stealth",
6662
6677
  assignable:true,
6663
6678
  negatable:false,
6664
6679
  exception_only:true,
6680
+ value_optional:true,
6665
6681
  value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n 3p-cache|\n 3p-auth|\n webrtc|\n push|\n location|\n flash|\n java|\n referrer|\n useragent|\n ip|\n xclientdata|\n dpi|\n \\|?\n )\\b)+(?<!\\|)$" },
6666
6682
  adg_ext_chrome:{ name:"stealth",
6667
6683
  description:"Disables the Stealth Mode module for all corresponding pages and requests.",
@@ -6669,6 +6685,7 @@ var data$a = { adg_os_any:{ name:"stealth",
6669
6685
  assignable:true,
6670
6686
  negatable:false,
6671
6687
  exception_only:true,
6688
+ value_optional:true,
6672
6689
  value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n xclientdata\n |\\|?\n )\\b)+(?<!\\|)$" },
6673
6690
  adg_ext_firefox:{ name:"stealth",
6674
6691
  description:"Disables the Stealth Mode module for all corresponding pages and requests.",
@@ -6676,6 +6693,7 @@ var data$a = { adg_os_any:{ name:"stealth",
6676
6693
  assignable:true,
6677
6694
  negatable:false,
6678
6695
  exception_only:true,
6696
+ value_optional:true,
6679
6697
  value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n |\\|?\n )\\b)+(?<!\\|)$" },
6680
6698
  adg_ext_opera:{ name:"stealth",
6681
6699
  description:"Disables the Stealth Mode module for all corresponding pages and requests.",
@@ -6683,6 +6701,7 @@ var data$a = { adg_os_any:{ name:"stealth",
6683
6701
  assignable:true,
6684
6702
  negatable:false,
6685
6703
  exception_only:true,
6704
+ value_optional:true,
6686
6705
  value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n |\\|?\n )\\b)+(?<!\\|)$" },
6687
6706
  adg_ext_edge:{ name:"stealth",
6688
6707
  description:"Disables the Stealth Mode module for all corresponding pages and requests.",
@@ -6690,6 +6709,7 @@ var data$a = { adg_os_any:{ name:"stealth",
6690
6709
  assignable:true,
6691
6710
  negatable:false,
6692
6711
  exception_only:true,
6712
+ value_optional:true,
6693
6713
  value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n |\\|?\n )\\b)+(?<!\\|)$" } };
6694
6714
 
6695
6715
  var data$9 = { ubo_any:{ name:"strict1p",
@@ -6893,6 +6913,9 @@ var SpecificKey;
6893
6913
  SpecificKey["Negatable"] = "negatable";
6894
6914
  SpecificKey["BlockOnly"] = "block_only";
6895
6915
  SpecificKey["ExceptionOnly"] = "exception_only";
6916
+ // TODO: consider removing this field
6917
+ // and handle whether the value is optional by `value_format`. AG-24028
6918
+ SpecificKey["ValueOptional"] = "value_optional";
6896
6919
  SpecificKey["ValueFormat"] = "value_format";
6897
6920
  // TODO: following fields should be handled later
6898
6921
  // VersionAdded = 'version_added',
@@ -6931,6 +6954,7 @@ const prepareBlockerData = (blockerId, rawModifierData) => {
6931
6954
  : rawData[SpecificKey.Negatable],
6932
6955
  [SpecificKey.BlockOnly]: rawData[SpecificKey.BlockOnly] || false,
6933
6956
  [SpecificKey.ExceptionOnly]: rawData[SpecificKey.ExceptionOnly] || false,
6957
+ [SpecificKey.ValueOptional]: rawData[SpecificKey.ValueOptional] || false,
6934
6958
  [SpecificKey.ValueFormat]: rawData[SpecificKey.ValueFormat] || null,
6935
6959
  };
6936
6960
  return blockerData;
@@ -7091,18 +7115,20 @@ const validateForSpecificSyntax = (modifiersData, syntax, modifier, isException)
7091
7115
  // e.g. 'domain'
7092
7116
  if (specificBlockerData.assignable) {
7093
7117
  /**
7094
- * exception_only modifier 'stealth' is assignable
7095
- * but it also may be used without value as well -- `$stealth` or `$stealth=dpi`
7118
+ * Some assignable modifiers can be used without a value,
7119
+ * e.g. '@@||example.com^$cookie'.
7096
7120
  */
7097
7121
  if (!modifier.value
7098
- /**
7099
- * TODO: consider to return `{ ok: true, warn: 'Modifier value may be specified' }` (???)
7100
- * after the extension will support stealth mode with value
7101
- * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2107
7102
- */
7103
- && !specificBlockerData.exception_only) {
7122
+ // value should be specified if it is not optional
7123
+ && !specificBlockerData.value_optional) {
7104
7124
  return getInvalidValidationResult(`${INVALID_ERROR_PREFIX.VALUE_REQUIRED}: '${modifierName}'`);
7105
7125
  }
7126
+ /**
7127
+ * TODO: consider to return `{ ok: true, warn: 'Modifier value may be specified' }` (???)
7128
+ * for $stealth modifier without a value
7129
+ * but only after the extension will support value for $stealth:
7130
+ * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2107
7131
+ */
7106
7132
  }
7107
7133
  else if (modifier?.value) {
7108
7134
  return getInvalidValidationResult(`${INVALID_ERROR_PREFIX.VALUE_FORBIDDEN}: '${modifierName}'`);
@@ -8849,7 +8875,7 @@ class LogicalExpressionUtils {
8849
8875
  }
8850
8876
  }
8851
8877
 
8852
- const version$1 = "1.1.0";
8878
+ const version$1 = "1.1.2";
8853
8879
 
8854
8880
  /**
8855
8881
  * @file AGTree version