-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AG-36016 Fix build size for CSS Tokenizer and AGTree
Merge in ADGUARD-FILTERS/tsurlfilter from fix/AG-36016-1 to master Squashed commit of the following: commit ad53c10 Merge: 6e2bb9e ff117a6 Author: scripthunter7 <[email protected]> Date: Thu Sep 19 13:32:55 2024 +0200 Merge branch 'master' into fix/AG-36016-1 commit 6e2bb9e Author: scripthunter7 <[email protected]> Date: Thu Sep 19 13:20:00 2024 +0200 change operator commit 8cc6f29 Author: scripthunter7 <[email protected]> Date: Thu Sep 19 10:11:53 2024 +0200 bump version and changelog for css tokenizer commit da3ddaf Author: scripthunter7 <[email protected]> Date: Thu Sep 19 10:11:43 2024 +0200 bump version and changelog for agtree commit 026a507 Author: scripthunter7 <[email protected]> Date: Thu Sep 19 10:10:00 2024 +0200 smoke tests for css tokenizer commit 715e1b3 Author: scripthunter7 <[email protected]> Date: Thu Sep 19 10:00:10 2024 +0200 small fix for css tokenizer build commit b3a2a14 Author: scripthunter7 <[email protected]> Date: Thu Sep 19 09:59:06 2024 +0200 optimize compatibility tables build for agtree
- Loading branch information
1 parent
ff117a6
commit cf96c17
Showing
23 changed files
with
273 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
const { RuleParser } = require('@adguard/agtree'); | ||
const { RuleParser, modifiersCompatibilityTable, SpecificPlatform } = require('@adguard/agtree'); | ||
const { ok } = require('assert'); | ||
|
||
const ruleNode = RuleParser.parse('||example.com^'); | ||
|
||
ok(ruleNode); | ||
|
||
const modifierData = modifiersCompatibilityTable.getSingle('third-party', SpecificPlatform.AdgExtChrome); | ||
|
||
ok(modifierData); | ||
|
||
console.log('Smoke test passed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { RuleParser } from '@adguard/agtree'; | ||
import { RuleParser, modifiersCompatibilityTable, SpecificPlatform } from '@adguard/agtree'; | ||
import { ok } from 'assert'; | ||
|
||
const ruleNode = RuleParser.parse('||example.com^'); | ||
|
||
ok(ruleNode); | ||
|
||
const modifierData = modifiersCompatibilityTable.getSingle('third-party', SpecificPlatform.AdgExtChrome); | ||
|
||
ok(modifierData); | ||
|
||
console.log('Smoke test passed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { RuleParser } from '@adguard/agtree'; | ||
import { RuleParser, modifiersCompatibilityTable, SpecificPlatform } from '@adguard/agtree'; | ||
import { ok } from 'assert'; | ||
|
||
const ruleNode = RuleParser.parse('||example.com^'); | ||
|
||
ok(ruleNode); | ||
|
||
const modifierData = modifiersCompatibilityTable.getSingle('third-party', SpecificPlatform.AdgExtChrome); | ||
|
||
ok(modifierData); | ||
|
||
console.log('Smoke test passed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
node_modules | ||
dist | ||
coverage | ||
test/smoke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { tokenize } = require('@adguard/css-tokenizer'); | ||
const { ok } = require('assert'); | ||
|
||
let tokensCount = 0; | ||
|
||
tokenize('div { color: red; }', () => { | ||
tokensCount += 1; | ||
}); | ||
|
||
ok(tokensCount > 0); | ||
|
||
console.log('Smoke test passed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "cjs", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"author": "Adguard Software Ltd.", | ||
"scripts": { | ||
"start": "node index.js", | ||
"test": "./test.sh" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit on error | ||
|
||
# pack @adguard/css-tokenizer | ||
curr_path="test/smoke/cjs" | ||
csstokenizer="css-tokenizer.tgz" | ||
nm_path="node_modules" | ||
|
||
# Define cleanup function | ||
cleanup() { | ||
echo "Cleaning up..." | ||
rm -f $csstokenizer && rm -rf $nm_path | ||
echo "Cleanup complete" | ||
} | ||
|
||
# Set trap to execute the cleanup function on script exit | ||
trap cleanup EXIT | ||
|
||
(cd ../../.. && pnpm pack && mv adguard-css-tokenizer-*.tgz "$curr_path/$csstokenizer") | ||
|
||
# unzip to @adguard/tsurlfilter to node_modules | ||
csstokenizer_node_modules=$nm_path"/@adguard/css-tokenizer" | ||
mkdir -p $csstokenizer_node_modules | ||
tar -xzf $csstokenizer --strip-components=1 -C $csstokenizer_node_modules | ||
|
||
pnpm start | ||
echo "Test successfully built." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { tokenize } from '@adguard/css-tokenizer'; | ||
import { ok } from 'assert'; | ||
|
||
let tokensCount = 0; | ||
|
||
tokenize('div { color: red; }', () => { | ||
tokensCount += 1; | ||
}); | ||
|
||
ok(tokensCount > 0); | ||
|
||
console.log('Smoke test passed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "esm", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"author": "Adguard Software Ltd.", | ||
"type": "module", | ||
"scripts": { | ||
"start": "node index.js", | ||
"test": "./test.sh" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit on error | ||
|
||
# pack @adguard/css-tokenizer | ||
curr_path="test/smoke/esm" | ||
csstokenizer="css-tokenizer.tgz" | ||
nm_path="node_modules" | ||
|
||
# Define cleanup function | ||
cleanup() { | ||
echo "Cleaning up..." | ||
rm -f $csstokenizer && rm -rf $nm_path | ||
echo "Cleanup complete" | ||
} | ||
|
||
# Set trap to execute the cleanup function on script exit | ||
trap cleanup EXIT | ||
|
||
(cd ../../.. && pnpm pack && mv adguard-css-tokenizer-*.tgz "$curr_path/$csstokenizer") | ||
|
||
# unzip to @adguard/tsurlfilter to node_modules | ||
csstokenizer_node_modules=$nm_path"/@adguard/css-tokenizer" | ||
mkdir -p $csstokenizer_node_modules | ||
tar -xzf $csstokenizer --strip-components=1 -C $csstokenizer_node_modules | ||
|
||
pnpm start | ||
echo "Test successfully built." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { tokenize } from '@adguard/css-tokenizer'; | ||
import { ok } from 'assert'; | ||
|
||
let tokensCount = 0; | ||
|
||
tokenize('div { color: red; }', () => { | ||
tokensCount += 1; | ||
}); | ||
|
||
ok(tokensCount > 0); | ||
|
||
console.log('Smoke test passed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "typescript", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"author": "Adguard Software Ltd.", | ||
"scripts": { | ||
"start": "tsc --noEmit", | ||
"test": "./test.sh" | ||
} | ||
} |
Oops, something went wrong.