Yett 开源项目使用教程

Yett 开源项目使用教程

yett🔐A small webpage library to control the execution of (third party) scripts项目地址:https://gitcode.com/gh_mirrors/ye/yett

1. 项目的目录结构及介绍

Yett 项目的目录结构如下:

yett/
├── dist/
│   ├── yett.js
│   └── yett.min.js
├── src/
│   ├── index.ts
│   ├── blacklist.ts
│   ├── whitelist.ts
│   ├── utils.ts
│   └── types.ts
├── test/
│   ├── index.test.ts
│   └── utils.test.ts
├── package.json
├── tsconfig.json
├── README.md
└── LICENSE

目录介绍

  • dist/: 包含编译后的 JavaScript 文件,包括 yett.js 和压缩版的 yett.min.js
  • src/: 源代码目录,包含 TypeScript 文件。
    • index.ts: 主入口文件。
    • blacklist.ts: 黑名单处理逻辑。
    • whitelist.ts: 白名单处理逻辑。
    • utils.ts: 工具函数。
    • types.ts: 类型定义。
  • test/: 测试文件目录,包含单元测试。
  • package.json: 项目依赖和脚本配置。
  • tsconfig.json: TypeScript 编译配置。
  • README.md: 项目说明文档。
  • LICENSE: 项目许可证。

2. 项目的启动文件介绍

项目的启动文件是 src/index.ts。这个文件是 Yett 库的主入口,负责初始化和配置黑名单和白名单,以阻止特定的脚本执行。

主要功能

  • 初始化黑名单和白名单。
  • 拦截和阻止匹配的脚本加载。

3. 项目的配置文件介绍

项目的配置文件主要是 package.jsontsconfig.json

package.json

package.json 文件包含了项目的依赖、脚本和其他元数据。

{
  "name": "yett",
  "version": "0.1.10",
  "description": "A small webpage library to control the execution of (third party) scripts",
  "main": "dist/yett.min.js",
  "types": "dist/yett.d.ts",
  "scripts": {
    "build": "tsc && rollup -c",
    "test": "jest",
    "prepublishOnly": "npm run build"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/elbywan/yett.git"
  },
  "keywords": [
    "block",
    "third-party",
    "script",
    "blocker",
    "ads"
  ],
  "author": "Julien Elbaz",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/elbywan/yett/issues"
  },
  "homepage": "https://github.com/elbywan/yett#readme",
  "devDependencies": {
    "@types/jest": "^26.0.20",
    "jest": "^26.6.3",
    "rollup": "^2.38.0",
    "rollup-plugin-terser": "^7.0.2",
    "ts-jest": "^26.5.1",
    "typescript": "^4.1.3"
  }
}

tsconfig.json

tsconfig.json 文件包含了 TypeScript 编译器的配置。

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "declaration": true,
    "outDir": "./dist",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": [
    "src/**/*"
  ]
}

以上是 Yett 开源项目的目录结构、启动文件和配置文件的详细介绍。希望这份文档能帮助你更好地理解和使用 Yett 项目。<|end▁of▁sentence|>

yett🔐A small webpage library to control the execution of (third party) scripts项目地址:https://gitcode.com/gh_mirrors/ye/yett

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

薛美婵

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值