Skip to content

Commit

Permalink
merge release/v1.7 into fix/AG-8269, resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Apr 15, 2022
2 parents 7237656 + 7ef099a commit 4b9d9f6
Show file tree
Hide file tree
Showing 21 changed files with 290 additions and 54 deletions.
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,37 @@ Build for CoreLibs
yarn corelibs
```

Build for Extension
Build dev (rebuild js files on every change)
```
yarn watch
```

### Build for Extension
In scriptlets directory install dependencies, build scriptlets bundle, and create scriptlets link.
```
yarn
yarn build
yarn link
```

Build dev (rebuild js files on every change)
In tsurlfilter directory install and link dependencies, link scriptlets, move into package and build, and create tsurlfilter link.
```
yarn watch
lerna bootstrap
yarn link "@adguard/scriptlets"
cd ./packages/tsurlfilter
yarn build
yarn link
```
In extension directory install dependincies, link packages and build
```
yarn
yarn link @adguard/scriptlets
yarn link @adguard/tsurlfilter
yarn dev
```

### Build output
Expand Down
6 changes: 2 additions & 4 deletions bamboo-specs/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ Build:
ls -alt
yarn install ${bamboo.varsYarn}
yarn browserstack
yarn prepare-builds
rm -rf node_modules
environment: BROWSERSTACK_USER="${bamboo.browserstackUser}" \
BROWSERSTACK_KEY="${bamboo.browserstackPassword}"
- any-task:
plugin-key: com.atlassian.bamboo.plugins.vcs:task.vcs.commit
configuration:
commitMessage: 'Update dist'
# do not change commitMessage as it does not trigger increment after deploy
commitMessage: 'deploy: update dist'
selectedRepository: defaultRepository
- inject-variables:
file: dist/build.txt
Expand Down
22 changes: 16 additions & 6 deletions bamboo-specs/increment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ variables:

stages:
- Increment:
manual: 'false'
final: 'false'
manual: false
final: false
jobs:
- Increment

Expand All @@ -20,18 +20,28 @@ Increment:
image: "${bamboo.dockerContainer}"
volumes:
${system.YARN_DIR}: "${bamboo.cacheYarn}"
other:
clean-working-dir: true
tasks:
- checkout:
force-clean-build: 'true'
- script:
interpreter: SHELL
scripts:
- |-
set -e
set -x
ls -alt
#!/bin/sh
set -e -f -u -x
yarn increment
# Explicitly checkout the revision that we need.
git checkout "${bamboo.repository.revision.number}"
# do not increment for dist deploy after release build
if [[ `git log -1 --pretty=%s` != "deploy: update dist" ]];then
set -e
set -x
ls -alt
yarn increment
fi
- any-task:
plugin-key: com.atlassian.bamboo.plugins.vcs:task.vcs.commit
configuration:
Expand Down
4 changes: 1 addition & 3 deletions bamboo-specs/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ Build:
ls -alt
yarn install
yarn browserstack
yarn test
yarn prepare-builds
rm -rf node_modules
environment: BROWSERSTACK_USER="${bamboo.browserstackUser}" \
BROWSERSTACK_KEY="${bamboo.browserstackPassword}"
artifacts:
- name: scriptlets.corelibs.json
location: dist
Expand Down
2 changes: 1 addition & 1 deletion dist/build.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.6.3
version=1.6.8
2 changes: 1 addition & 1 deletion dist/redirects.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/**
* AdGuard Scriptlets
* Version 1.6.3
* Version 1.6.8
*/

var Redirects = (function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/redirects.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# AdGuard Scriptlets (Redirects Source)
# Version 1.6.3
# Version 1.6.8
#
- title: 1x1-transparent.gif
description: |-
Expand Down
8 changes: 4 additions & 4 deletions dist/scriptlets.corelibs.json

Large diffs are not rendered by default.

49 changes: 44 additions & 5 deletions dist/scriptlets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/**
* AdGuard Scriptlets
* Version 1.6.3
* Version 1.6.8
*/

(function () {
Expand Down Expand Up @@ -2520,6 +2520,8 @@
* - `noopPromiseReject` - function returning Promise.reject()
* - `''` - empty string
* - `-1` - number value `-1`
* - `yes`
* - `no`
* - `stack` - optional, string or regular expression that must match the current function call stack trace;
* if regular expression is invalid it will be skipped
*
Expand Down Expand Up @@ -2552,8 +2554,10 @@
function setConstant(source, property, value, stack) {
if (!property || !matchStackTrace(stack, new Error().stack)) {
return;
}
} // eslint-disable-next-line no-console


var log = console.log.bind(console);
var emptyArr = noopArray();
var emptyObj = noopObject();
var constantValue;
Expand Down Expand Up @@ -2594,6 +2598,10 @@
constantValue = -1;
} else if (value === '') {
constantValue = '';
} else if (value === 'yes') {
constantValue = 'yes';
} else if (value === 'no') {
constantValue = 'no';
} else {
return;
}
Expand Down Expand Up @@ -2621,14 +2629,23 @@

var trapProp = function trapProp(base, prop, configurable, handler) {
if (!handler.init(base[prop])) {
return;
return false;
}

var origDescriptor = Object.getOwnPropertyDescriptor(base, prop);
var prevGetter;
var prevSetter; // This is required to prevent scriptlets overwrite each over

if (origDescriptor instanceof Object) {
// This check is required to avoid defining non-configurable props
if (!origDescriptor.configurable) {
if (source.verbose) {
log("set-constant: property '".concat(prop, "' is not configurable"));
}

return false;
}

base[prop] = constantValue;

if (origDescriptor.get instanceof Function) {
Expand Down Expand Up @@ -2657,6 +2674,7 @@
handler.set(a);
}
});
return true;
};

var setChainPropAccess = function setChainPropAccess(owner, property) {
Expand All @@ -2676,6 +2694,11 @@
return this.factValue;
},
set: function set(a) {
// Prevent breakage due to loop assignments like win.obj = win.obj
if (this.factValue === a) {
return;
}

this.factValue = a;

if (a instanceof Object) {
Expand Down Expand Up @@ -2708,8 +2731,12 @@
}; // End prop case

if (!chain) {
trapProp(base, prop, false, endPropHandler);
hit(source);
var isTrapped = trapProp(base, prop, false, endPropHandler);

if (isTrapped) {
hit(source);
}

return;
} // Defined prop in chain

Expand Down Expand Up @@ -5089,6 +5116,8 @@
* - `emptyObj` - empty object
* - `emptyArr` - empty array
* - `''` - empty string
* - `yes`
* - `no`
*
* **Examples**
* ```
Expand Down Expand Up @@ -5131,6 +5160,10 @@
if (Math.abs(keyValue) > 0x7FFF) {
return;
}
} else if (value === 'yes') {
keyValue = 'yes';
} else if (value === 'no') {
keyValue = 'no';
} else {
return;
}
Expand Down Expand Up @@ -5179,6 +5212,8 @@
* - `emptyObj` - empty object
* - `emptyArr` - empty array
* - `''` - empty string
* - `yes`
* - `no`
*
* **Examples**
* ```
Expand Down Expand Up @@ -5221,6 +5256,10 @@
if (Math.abs(keyValue) > 0x7FFF) {
return;
}
} else if (value === 'yes') {
keyValue = 'yes';
} else if (value === 'no') {
keyValue = 'no';
} else {
return;
}
Expand Down
Loading

0 comments on commit 4b9d9f6

Please sign in to comment.