Skip to content

[pull] master from AdguardTeam:master #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@
},
"problemMatcher": "$esbuild-watch",
},
{
"label": "Integrated ECSSTree dev build (watch)",
"type": "npm",
"script": "watch:ecss-tree",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never",
"close": true
},
"problemMatcher": "$esbuild-watch",
},
{
"label": "Integrated AGLint dev build (watch)",
"type": "npm",
Expand Down Expand Up @@ -111,6 +127,7 @@
"Grammar dev build (watch)",
"Server dev build (watch)",
"Integrated AGTree dev build (watch)",
"Integrated ECSSTree dev build (watch)",
"Integrated AGLint dev build (watch)",
"Client dev build (watch)"
],
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog], and this project adheres to [Semantic Versioning][semver].

## 1.1.14 - 2024-09-21

### Added

- Highlighting for `ext_chromium_mv3` platform name: [#138]

### Changed

- Updated integrated [AGLint] to v2.1.1

## 1.1.13 - 2024-09-20

### Changed

- Updated integrated [AGLint] to v2.1.0

## 1.1.12 - 2024-09-04

### Changed
Expand Down Expand Up @@ -401,6 +417,7 @@ The format is based on [Keep a Changelog][keepachangelog], and this project adhe
[#119]: https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/119
[#122]: https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/122
[#123]: https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/123
[#138]: https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/138
[AGLint]: https://github.com/AdguardTeam/AGLint/blob/master/CHANGELOG.md
[keepachangelog]: https://keepachangelog.com/en/1.0.0/
[semver]: https://semver.org/spec/v2.0.0.html
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "adblock",
"displayName": "Adblock/AdGuard/uBlock filters grammar",
"description": "VS code extension that adds support for ad blocking rules syntax.",
"version": "1.1.12",
"version": "1.1.14",
"publisher": "adguard",
"icon": "icons/aglint_128x128.png",
"main": "./client/out/extension",
Expand Down Expand Up @@ -93,14 +93,15 @@
},
"scripts": {
"build:grammar": "tsx tools/grammar-builder.ts",
"build:prod": "yarn clean && yarn build:grammar && yarn test:compile && yarn esbuild:client --minify && yarn esbuild:agtree --minify && yarn esbuild:aglint --minify && yarn esbuild:server --minify && yarn build:vsix",
"build:prod": "yarn clean && yarn build:grammar && yarn test:compile && yarn esbuild:client --minify && yarn esbuild:agtree --minify && yarn esbuild:ecss-tree --minify && yarn esbuild:aglint --minify && yarn esbuild:server --minify && yarn build:vsix",
"build:txt": "tsx tools/build-txt.ts",
"build:vsix": "mkdirp out && vsce package --yarn --out out/vscode-adblock.vsix",
"clean": "rimraf ./client/out && rimraf ./server/out && rimraf ./syntaxes/out && rimraf ./out",
"esbuild:aglint": "esbuild ./server/src/aglint.ts --bundle --outfile=server/out/aglint.js --format=cjs --platform=node --alias:@adguard/agtree=./agtree --external:./agtree",
"esbuild:aglint": "esbuild ./server/src/aglint.ts --bundle --outfile=server/out/aglint.js --format=cjs --platform=node --alias:@adguard/agtree=./agtree --external:./agtree --alias:@adguard/ecss-tree=./ecss-tree --external:./ecss-tree",
"esbuild:agtree": "esbuild ./server/src/agtree.ts --bundle --outfile=server/out/agtree.js --format=cjs --platform=node",
"esbuild:ecss-tree": "esbuild ./server/src/ecss-tree.ts --bundle --outfile=server/out/ecss-tree.js --format=cjs --platform=browser",
"esbuild:client": "esbuild ./client/src/extension.ts --bundle --outfile=client/out/extension.js --format=cjs --platform=node --external:vscode",
"esbuild:server": "esbuild ./server/src/server.ts --bundle --outfile=server/out/server.js --format=cjs --platform=node --external:vscode --external:./agtree",
"esbuild:server": "esbuild ./server/src/server.ts --bundle --outfile=server/out/server.js --format=cjs --platform=node --external:vscode --external:./agtree --external:./ecss-tree",
"extract-changelog": "node -r esbuild-register tools/changelog-extractor.ts",
"increment": "yarn version --patch --no-git-tag-version",
"lint": "yarn lint:ts && yarn lint:md",
Expand All @@ -113,6 +114,7 @@
"test:compile": "tsc -p ./client --noEmit && tsc -p ./server --noEmit",
"watch:aglint": "yarn esbuild:aglint --sourcemap --watch",
"watch:agtree": "yarn esbuild:agtree --sourcemap --watch",
"watch:ecss-tree": "yarn esbuild:ecss-tree --sourcemap --watch",
"watch:client": "yarn esbuild:client --sourcemap --watch",
"watch:grammar": "sane \"tsx tools/grammar-builder.ts\" --glob=syntaxes/adblock.yaml-tmlanguage",
"watch:server": "yarn esbuild:server --sourcemap --watch"
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vscode-languageserver-textdocument": "^1.0.8"
},
"devDependencies": {
"@adguard/aglint": "2.0.10",
"@adguard/aglint": "2.1.1",
"@types/clone-deep": "^4.0.1",
"@types/semver": "^7.5.0",
"clone-deep": "^4.0.1",
Expand Down
5 changes: 5 additions & 0 deletions server/src/ecss-tree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @file Export ECSSTree API
*/

export * from '@adguard/ecss-tree';
2 changes: 1 addition & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ connection.onExecuteCommand(async (params) => {
&& commentNode.params.type === 'ParameterList'
) {
commentNode.params.children.push({
type: 'Parameter',
type: 'Value',
value: ruleName,
});
replace(
Expand Down
103 changes: 44 additions & 59 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# yarn lockfile v1


"@adguard/aglint@2.0.10":
version "2.0.10"
resolved "https://registry.yarnpkg.com/@adguard/aglint/-/aglint-2.0.10.tgz#5d1ef8c3934eed896ef32dcbb385d27f5fd292ce"
integrity sha512-gv04PUw0M9sPYbdiN5HIc4paBNvPbKpOEKmXJplcU0F5/k2vYREVwrtKS8YvezbSOGR4cUL/AjVsqiY4O8SjfQ==
"@adguard/aglint@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@adguard/aglint/-/aglint-2.1.1.tgz#f5b582e0f0048ebeff864cf3a01d23eb4ea97087"
integrity sha512-Q7c7A9obUcIhmxG7b1iWHahAZ/rhdg/G+1AWDy3wzKrWfWLdnMSLj1Zd26cOAjmNMwsblldWw2HuDc+Kbvt66Q==
dependencies:
"@adguard/agtree" "^1.1.8"
"@adguard/agtree" "^2.0.2"
"@adguard/ecss-tree" "^1.1.0"
"@inquirer/checkbox" "^1.3.7"
"@inquirer/select" "^1.2.7"
chalk "4.1.2"
Expand All @@ -24,33 +25,32 @@
terminal-link "2.1.1"
text-table "^0.2.0"

"@adguard/agtree@^1.1.8":
version "1.1.8"
resolved "https://registry.yarnpkg.com/@adguard/agtree/-/agtree-1.1.8.tgz#e001389bdb08476eb3c55e56922179a14e9b5fbf"
integrity sha512-5k9bYA+JSfZgYTvwahkM8ihIf1fvP+RxA1dKLgkRIGa6ixOSWNKv/pN0Rpiy0DwZJbC9X/OeZrtdW66jASH/JA==
"@adguard/agtree@^2.0.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@adguard/agtree/-/agtree-2.1.2.tgz#b9017566fb1b6a46882f6d5c68b899a1824a299f"
integrity sha512-4X7LsKMfQUo90TXVoZedHVjUS0zEDxAvMx0+JtYp2RwarmxVZYOIGygZPOoa6ihwUxUd3fmrsX0c6SQMldA+8Q==
dependencies:
"@adguard/ecss-tree" "^1.0.8"
"@adguard/scriptlets" "^1.9.61"
"@adguard/css-tokenizer" "^1.1.1"
clone-deep "^4.0.1"
is-ip "3.1.0"
json5 "^2.2.3"
semver "^7.5.3"
sprintf-js "^1.1.3"
tldts "^5.7.112"
xregexp "^5.1.1"
zod "3.21.4"

"@adguard/ecss-tree@^1.0.8":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@adguard/ecss-tree/-/ecss-tree-1.0.8.tgz#9209c2118c88821fc822851153cc042d58abef67"
integrity sha512-Y5dfzWH5nnzEH9URuzOQ1RXl0bzmLiGO7Nt9Wc/na7uD5UHqoz4PlzVllFpO1bLA+Cqq5ebNrz+uWRKN3BxSTg==
dependencies:
css-tree "^2.3.1"
"@adguard/css-tokenizer@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@adguard/css-tokenizer/-/css-tokenizer-1.1.1.tgz#9f5cc45c5a2bd16de9a8924524621270d8caedfd"
integrity sha512-oDNlMegMJIRZ9v6JuAXFOQzTmkKz3ERILV9rTvbWYLDApOZ8jqwil1fEeJbjGFR37OHN6MVU55ef9NcxZCZrig==

"@adguard/scriptlets@^1.9.61":
version "1.9.62"
resolved "https://registry.yarnpkg.com/@adguard/scriptlets/-/scriptlets-1.9.62.tgz#f60b83bb928c160f59153989c9491504e510498b"
integrity sha512-uWSlfMnAJUmIVsChl7KrECBXDJotSfq/N94iNLtfwnJI7br9Q5Gl65iuH89rh0Fs62OwexKlj3cnrzHL4TEFyw==
"@adguard/ecss-tree@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@adguard/ecss-tree/-/ecss-tree-1.1.0.tgz#27d8650ae7fb7fb08b780a41f765564e7251f59b"
integrity sha512-Qs7cpUH5AexO9JAXxMPmh6CwdNEnP1qUBSpvHnGxPmHQDjBzpAn4qz8zsJILmX4Rc5Up0iqeYcYC7Pq5HBvoyQ==
dependencies:
"@babel/runtime" "^7.20.13"
js-yaml "^3.13.1"
css-tree "^2.3.1"

"@babel/runtime-corejs3@^7.16.5":
version "7.21.0"
Expand All @@ -60,13 +60,6 @@
core-js-pure "^3.25.1"
regenerator-runtime "^0.13.11"

"@babel/runtime@^7.20.13":
version "7.22.10"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.10.tgz#ae3e9631fd947cb7e3610d3e9d8fef5f76696682"
integrity sha512-21t/fkKLMZI4pqP2wlmsQAWnYW1PDyKyyUV4vCi+B25ydmdaYTKXPwCj0BzSUnZf4seIiYvSA3jcZ3gdsMFkLQ==
dependencies:
regenerator-runtime "^0.14.0"

"@inquirer/checkbox@^1.3.7":
version "1.3.9"
resolved "https://registry.yarnpkg.com/@inquirer/checkbox/-/checkbox-1.3.9.tgz#7bce7835ba9a407e79a71841bfdbdf2db5b9a8ef"
Expand Down Expand Up @@ -159,13 +152,6 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"

argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
dependencies:
sprintf-js "~1.0.2"

argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
Expand Down Expand Up @@ -243,11 +229,6 @@ escape-string-regexp@^1.0.5:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==

esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==

fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
Expand Down Expand Up @@ -289,11 +270,23 @@ inflection@^2.0.1:
resolved "https://registry.yarnpkg.com/inflection/-/inflection-2.0.1.tgz#bdf3a4c05d4275f41234910cbbe9a102ac72c99b"
integrity sha512-wzkZHqpb4eGrOKBl34xy3umnYHx8Si5R1U4fwmdxLo5gdH6mEK8gclckTj/qWqy4Je0bsDYe/qazZYuO7xe3XQ==

ip-regex@^4.0.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5"
integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==

is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==

[email protected]:
version "3.1.0"
resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-3.1.0.tgz#2ae5ddfafaf05cb8008a62093cf29734f657c5d8"
integrity sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==
dependencies:
ip-regex "^4.0.0"

is-plain-object@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
Expand All @@ -306,14 +299,6 @@ isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==

js-yaml@^3.13.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
Expand Down Expand Up @@ -362,11 +347,6 @@ regenerator-runtime@^0.13.11:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==

regenerator-runtime@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==

run-async@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-3.0.0.tgz#42a432f6d76c689522058984384df28be379daad"
Expand All @@ -391,10 +371,10 @@ source-map-js@^1.0.1:
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==

sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==
sprintf-js@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a"
integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==

string-width@^4.1.0:
version "4.2.3"
Expand Down Expand Up @@ -517,3 +497,8 @@ yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

[email protected]:
version "3.21.4"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db"
integrity sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==
3 changes: 2 additions & 1 deletion syntaxes/adblock.yaml-tmlanguage
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ repository:
- name: keyword.control.hint.name
match: "(NOT_OPTIMIZED|OPTIMIZED|PLATFORM|NOT_PLATFORM)"
- name: constant.language.platform.name
match: "(windows|mac|android|ios|ext_chromium|ext_ff|ext_edge|ext_opera|ext_ublock|ext_safari|ext_android_cb)"
# The basic regexp is greedy and stops once it finds a match, so 'ext_chromium_mv3' should be before 'ext_chromium'
match: "(windows|mac|android|ios|ext_chromium_mv3|ext_chromium|ext_ff|ext_edge|ext_opera|ext_ublock|ext_safari|ext_android_cb)"
- name: keyword.control.characters
match: "(\\(|\\)|,)"
- match: "^!#(?!#).+$"
Expand Down
3 changes: 3 additions & 0 deletions test/static/aglint/list3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ example.com##...

! excluded rule
example.com/bad/query/

! Invalid declaration
#$#div { display: foo; color: bar; }
3 changes: 3 additions & 0 deletions test/static/rules/test_rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
!#endif
!+ NOT_OPTIMIZED PLATFORM(android)
||example.org^
! https://github.com/AdguardTeam/VscodeAdblockSyntax/issues/138
!+ PLATFORM(ext_chromium_mv3)
||example.com^
!#invalidpreprocessor
!#if (invalid_platform)
!#safari_cb_affinity(general,privacy)
Expand Down