-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce typescript to scriptlets, migrate helpers
Merge in ADGUARD-FILTERS/scriptlets from feature/typescript to master Squashed commit of the following: commit f931a21 Merge: 0acaf28 7f8dd98 Author: Stanislav A <s.atroschenko@adguard.com> Date: Mon Jun 19 15:58:57 2023 +0300 Merge branch 'master' into feature/typescript commit 0acaf28 Merge: 1339ca3 0512bd1 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 17 01:15:09 2023 +0300 Merge branch 'master' into feature/typescript commit 1339ca3 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Thu Jun 15 01:12:57 2023 +0300 fix jsdocplugin and lint commit e39c4ed Author: stanislav-atr <s.atroschenko@adguard.com> Date: Tue Jun 13 22:52:47 2023 +0300 improve observer naming in observeDocumentWithTimeout commit 7ea0547 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sun Jun 11 00:30:13 2023 +0300 add missing typings commit d646852 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 10 23:52:59 2023 +0300 resolve linting and misc typings commit 48fd2b1 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 10 23:22:39 2023 +0300 fix abort-on-stack-trace testcase commit 95beeb9 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 10 21:38:53 2023 +0300 update yarn.lock commit 363eab9 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 10 21:22:25 2023 +0300 convert response-utils commit 754e817 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 10 21:09:57 2023 +0300 resolve fixmes commit d192e9c Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sat Jun 10 20:54:45 2023 +0300 fix prune-utils commit 9c36493 Merge: ac2782b a55b61f Author: stanislav-atr <s.atroschenko@adguard.com> Date: Thu Jun 8 02:30:26 2023 +0300 merge master commit ac2782b Author: stanislav-atr <s.atroschenko@adguard.com> Date: Wed Jun 7 23:08:07 2023 +0300 tweak getAbpSnippetArguments commit 23dd9f6 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sun May 14 20:46:57 2023 +0300 improve convertScriptletToAdg, fix createOnErrorHandler calls linting commit 5ac964d Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sun May 14 19:20:54 2023 +0300 rename RedirectCompatibilityObject, fix createOnErrorHandler calls commit 6cc6597 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Wed May 10 23:04:13 2023 +0300 improve createOnErrorHandler typings commit 198448c Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sun May 7 23:01:08 2023 +0300 return index in imports paths commit 27765da Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sun May 7 22:42:10 2023 +0300 fix LegalRequestProp, improve :any typings, tweak hit() and remove 'hit' prop from Source commit 7ef8e59 Merge: 16c3d3e e60fdd1 Author: stanislav-atr <s.atroschenko@adguard.com> Date: Sun May 7 21:40:06 2023 +0300 merge master commit 16c3d3e Author: stanislav-atr <s.atroschenko@adguard.com> Date: Fri Apr 28 01:22:50 2023 +0300 improve number-utils typings, fix validator comments ... and 31 more commits
- Loading branch information
1 parent
7f8dd98
commit 6c3693f
Showing
84 changed files
with
4,249 additions
and
3,588 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 |
---|---|---|
@@ -0,0 +1,166 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import babel from '@rollup/plugin-babel'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import copy from 'rollup-plugin-copy'; | ||
import cleanup from 'rollup-plugin-cleanup'; | ||
import generateHtml from 'rollup-plugin-generate-html'; | ||
import path from 'path'; | ||
import project from './package.json'; | ||
|
||
const BUILD_DIST = 'dist'; | ||
const DIST_REDIRECT_FILES = 'dist/redirect-files'; | ||
const BANNER = ` | ||
/** | ||
* AdGuard Scriptlets | ||
* Version ${project.version} | ||
*/ | ||
`; | ||
const FOOTER = ` | ||
/** | ||
* ------------------------------------------- | ||
* | | | ||
* | If you want to add your own scriptlet | | ||
* | please put your code below | | ||
* | | | ||
* ------------------------------------------- | ||
*/ | ||
`; | ||
|
||
const commonPlugins = [ | ||
resolve({ extensions: ['.js', '.ts'] }), | ||
commonjs({ | ||
include: path.resolve(__dirname, './node_modules/**'), | ||
}), | ||
babel({ | ||
extensions: ['.js', '.ts'], | ||
babelHelpers: 'runtime', | ||
}), | ||
]; | ||
|
||
const scriptletsIIFEConfig = { | ||
input: { | ||
scriptlets: 'src/scriptlets/scriptlets-wrapper.js', | ||
}, | ||
output: { | ||
dir: BUILD_DIST, | ||
entryFileNames: '[name].js', | ||
format: 'iife', | ||
strict: false, | ||
banner: BANNER, | ||
footer: FOOTER, | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
], | ||
}; | ||
|
||
const scriptletsUMDConfig = { | ||
input: { | ||
'scriptlets.umd': 'src/scriptlets/scriptlets-umd-wrapper.js', | ||
}, | ||
output: { | ||
dir: 'dist/umd', | ||
entryFileNames: '[name].js', | ||
// umd is preferred over cjs to avoid variables renaming in tsurlfilter | ||
format: 'umd', | ||
exports: 'named', | ||
strict: false, | ||
banner: BANNER, | ||
footer: FOOTER, | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
copy({ | ||
targets: [ | ||
{ src: 'types/scriptlets.d.ts', dest: 'dist/umd/' }, | ||
], | ||
}), | ||
], | ||
}; | ||
|
||
const scriptletsListConfig = { | ||
input: { | ||
'scriptlets-list': 'src/scriptlets/scriptlets-list.js', | ||
}, | ||
output: { | ||
dir: 'tmp', | ||
entryFileNames: '[name].js', | ||
format: 'es', | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
], | ||
}; | ||
|
||
const redirectsListConfig = { | ||
input: { | ||
'redirects-list': 'src/redirects/redirects-list.js', | ||
}, | ||
output: { | ||
dir: 'tmp', | ||
entryFileNames: '[name].js', | ||
format: 'es', | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
], | ||
}; | ||
|
||
const redirectsPrebuildConfig = { | ||
input: { | ||
redirects: 'src/redirects/index.js', | ||
}, | ||
output: { | ||
dir: 'tmp', | ||
entryFileNames: '[name].js', | ||
format: 'es', | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
], | ||
}; | ||
|
||
const click2LoadConfig = { | ||
script: { | ||
input: { | ||
click2load: 'src/redirects/blocking-redirects/click2load.js', | ||
}, | ||
output: { | ||
dir: 'tmp', | ||
entryFileNames: '[name].js', | ||
name: 'click2load', | ||
format: 'iife', | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
cleanup(), | ||
], | ||
}, | ||
html: { | ||
input: 'src/redirects/blocking-redirects/click2load.js', | ||
output: { | ||
dir: DIST_REDIRECT_FILES, | ||
name: 'click2load', | ||
format: 'iife', | ||
}, | ||
plugins: [ | ||
...commonPlugins, | ||
cleanup(), | ||
generateHtml({ | ||
filename: `${DIST_REDIRECT_FILES}/click2load.html`, | ||
template: 'src/redirects/blocking-redirects/click2load.html', | ||
selector: 'body', | ||
inline: true, | ||
}), | ||
], | ||
}, | ||
}; | ||
|
||
export { | ||
scriptletsIIFEConfig, | ||
scriptletsUMDConfig, | ||
scriptletsListConfig, | ||
redirectsListConfig, | ||
click2LoadConfig, | ||
redirectsPrebuildConfig, | ||
}; |
Oops, something went wrong.