Skip to content
Draft
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
29 changes: 29 additions & 0 deletions builder/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@filteringdev/tinyshield-builder",
"private": true,
"type": "module",
"scripts": {
"lint": "tsc --noEmit && eslint **/*.ts",
"build": "tsx source/build.ts",
"debug": "tsx source/debug.ts"
},
"dependencies": {
"@types/node": "^24.10.8",
"simple-git": "^3.30.0",
"tldts": "^7.0.19"
},
"devDependencies": {
"@npmcli/package-json": "^7.0.4",
"@types/npmcli__package-json": "^4.0.4",
"@types/semver": "^7.7.1",
"@typescriptprime/securereq": "^1.0.1",
"chokidar": "^5.0.0",
"esbuild": "^0.27.2",
"eslint": "^9.39.2",
"semver": "^7.7.3",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.53.0",
"zod": "^4.3.5"
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion builder.ts → builder/source/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ let AttachHeaderPath = `/tmp/${crypto.randomUUID()}`
Fs.writeFileSync(AttachHeaderPath, ConvertedHeader, { encoding: 'utf-8', mode: 0o700 })
console.log('Written temporary header file to:', AttachHeaderPath)
await ESBuild.build({
entryPoints: ['./sources/src/index.ts'],
entryPoints: ['./sources/index.ts'],
bundle: true,
minify: BuildType === 'production',
define: {
Expand Down
38 changes: 38 additions & 0 deletions builder/source/references/iabsellers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as Zod from 'zod'
import { HTTPSRequest } from '@typescriptprime/securereq'


const IABSellersJsonURL = 'https://info.ad-shield.io/sellers.json'

export async function FetchIABSellersJsonData(): Promise<string[]> {
const IABSellersJsonResponse: { StatusCode: number, Headers: Record<string, string | string[]>, Body: unknown } = await HTTPSRequest(new URL(IABSellersJsonURL), { ExpectedAs: 'JSON' })
let IABSellersJsonData =IABSellersJsonResponse.Body as {
// eslint-disable-next-line @typescript-eslint/naming-convention
sellers: Array<{
// eslint-disable-next-line @typescript-eslint/naming-convention
seller_id: number,
// eslint-disable-next-line @typescript-eslint/naming-convention
seller_type: string,
// eslint-disable-next-line @typescript-eslint/naming-convention
name: string,
// eslint-disable-next-line @typescript-eslint/naming-convention
domain: string
}>
}
IABSellersJsonData = await Zod.object({
sellers: Zod.array(Zod.object({
seller_id: Zod.number(),
seller_type: Zod.string(),
name: Zod.string(),
domain: Zod.string().refine(D => {
try {
new URL(`https://${D}`)
} catch {
return false
}
return true
})
}))
}).parseAsync(IABSellersJsonData)
return [...new Set(IABSellersJsonData.sellers.map(S => S.domain))]
}
7 changes: 7 additions & 0 deletions builder/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"include": [
"source/**/*.ts",
"test/**/*.ts"
]
}
22 changes: 5 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build:userscript": "tsx builder.ts -- production",
"build": "npm run build:interface && npm run build:userscript",
"debug": "tsx builder.ts -- development",
"lint": "tsc --noEmit && eslint sources/**/*.ts"
"lint": "npm run lint -w builder && npm run lint -w userscript"
},
"keywords": [
"Ad-Shield"
Expand All @@ -28,20 +28,8 @@
"url": "git+https://github.com/FilteringDev/tinyShield.git"
},
"license": "MPL-2.0",
"dependencies": {
"@types/node": "^24.9.2"
},
"devDependencies": {
"@npmcli/package-json": "^7.0.4",
"@types/npmcli__package-json": "^4.0.4",
"@types/semver": "^7.7.1",
"esbuild": "^0.27.0",
"eslint": "^9.38.0",
"semver": "^7.7.3",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.2",
"zod": "^4.3.5"
},
"packageManager": "[email protected]+"
"packageManager": "[email protected]+",
"workspaces": [
"userscript", "builder"
]
}
9 changes: 0 additions & 9 deletions sources/esbuild.inject.ts

This file was deleted.

8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"moduleResolution": "NodeNext",
"removeComments": false,
"alwaysStrict": false,
"skipLibCheck": true
"skipLibCheck": true,
"paths": {
"@builder/*": ["./builder/source/*"],
"@userscript/*": ["./userscript/source/*"],
"@root/*": ["./source/*"],
"@reporoot/*": ["./*"]
}
}
}
11 changes: 11 additions & 0 deletions userscript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@filteringdev/tinyshield-userscript",
"private": true,
"type": "module",
"scripts": {
"lint": "tsc --noEmit && eslint **/*.ts"
},
"devDependencies": {
"@types/web": "^0.0.317"
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion sources/interface.ts → userscript/source/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* - See Git history at https://github.com/FilteringDev/tinyShield for detailed authorship information.
*/

export { RunTinyShieldUserscript } from './src/index.js'
export { RunTinyShieldUserscript } from './index.js'
File renamed without changes.
6 changes: 6 additions & 0 deletions userscript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../tsconfig.json",
"include": [
"source/**/*.ts"
]
}