@filteringdev/tinyshield-domain-collection

中文文档
0.0.71发布于 2026/11/14MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 4463

Deterministic domain collections generated from tinyShield reference sources.

原始使用文档
文档目录6 节
  1. Install
  2. Published files
  3. Updating
  4. Development
  5. First npm release
  6. Sources and licensing

tinyShield domain collection

@filteringdev/tinyshield-domain-collection publishes deterministic snapshots of the domain views returned by @filteringdev/tinyshield-lib/references.

The package is generated once per day. A new patch version is published only when the canonical domain content changes.

Install

npm install @filteringdev/tinyshield-domain-collection

Use the library functions from the package entry point:

import { getDomainsList, isAllowedToRun } from '@filteringdev/tinyshield-domain-collection'

const domains = getDomainsList()
const allowed = isAllowedToRun(new URL('https://sub.example.com/path'))

getDomainsList() returns a fresh copy of the sorted, wildcard-expanded Full domain list. isAllowedToRun() uses binary search to match either the exact URL hostname or a parent domain at a DNS label boundary.

isAllowedToRun(new URL('https://example.com/'))
// true when example.com is listed

isAllowedToRun(new URL('https://deep.a.example.com/'))
// true when example.com is listed

isAllowedToRun(new URL('https://notexample.com/'))
// false when notexample.com is not listed

The same functions are available from the typed @filteringdev/tinyshield-domain-collection/lib subpath. tinyShield should call getDomainsList() only from its builder so this data package is not bundled into the userscript. Runtime consumers such as Extra can use isAllowedToRun() to decide whether tinyShield should run for a URL.

The Full list is used because Normal may contain wildcard suffix patterns such as domain.*. Existing data constants remain available for compatibility:

import {
  Normal,
  Full,
  EachDomain,
  EachDomainFull,
  Manifest
} from '@filteringdev/tinyshield-domain-collection'

Individual JSON files are also exported:

import Normal from '@filteringdev/tinyshield-domain-collection/normal.json' with { type: 'json' }

Published files

ExportJSON shapeDescription
normal.jsonstring[]Deduplicated domain patterns from the tinyShield fetcher.
full.jsonstring[]Patterns after wildcard suffix expansion.
each-domain.jsonstring[][]Normal patterns grouped by registrable domain.
each-domain-full.jsonstring[][]Grouped patterns after wildcard suffix expansion.
manifest.jsonobjectSchema, source package, counts, and canonical content hash.

Every flat list, every group, and the list of groups are sorted by Unicode code point. The generated files do not contain timestamps, so identical source content produces byte-for-byte identical output.

manifest.json has this shape:

type DomainCollectionManifest = {
  readonly SchemaVersion: 1
  readonly ContentHash: string
  readonly SourcePackage: '@filteringdev/tinyshield-lib'
  readonly SourcePackageVersion: string
  readonly Counts: {
    readonly Normal: number
    readonly Full: number
    readonly EachDomain: number
    readonly EachDomainFull: number
  }
}

EachDomain and EachDomainFull counts are group counts. ContentHash is a SHA-256 digest of the four canonical domain payloads and excludes package versions and build time.

Updating

The scheduled workflow runs daily at 00:00 UTC and can also be started manually. It performs these steps:

  1. Lint and test the generator.
  2. Fetch live domain data through the npm release of @filteringdev/tinyshield-lib.
  3. Download the latest npm package with retries and compare its manifest with the generated hash.
  4. Exit without publishing when the hash is unchanged.
  5. Increment only the patch version and publish through npm trusted publishing when content changed or a prerelease is promoted.

When the latest npm package is a prerelease, the workflow promotes it to a stable version even when the domain hash is unchanged. The workflow fails without publishing when an upstream request, repeated npm registry lookup, schema validation, or build fails. A decrease of more than 25 percent in the Normal count is also blocked. A maintainer can review the change and use the manual allow-large-change input to permit it.

Generated files and workflow-only version changes are not committed to Git or tagged.

Development

Node.js 24 and pnpm are required.

pnpm install --no-lockfile
npm run lint
npm test
npm run build
npm run pack:check

Unit tests use fixtures and do not access the network. npm run build is the live integration check and writes the public package to dist/.

First npm release

Trusted publishing can be configured only after the package exists on npm. A maintainer must publish the verified 0.0.1 package once using interactive npm authentication and two-factor authentication.

After the first release, configure the npm package's trusted publisher with:

  • Provider: GitHub Actions
  • Organization: FilteringDev
  • Repository: tinyShield-domain-collection
  • Workflow filename: publish.yml
  • Allowed action: npm publish

Then run the workflow manually to verify OIDC authentication. The workflow requires Node 24, npm 11.5.1 or newer, a GitHub-hosted runner, and id-token: write. It does not use a long-lived npm token. npm automatically creates provenance for eligible public repository publishes.

Sources and licensing

The generator code in this repository is MIT licensed. Generated data is assembled from third-party sources through @filteringdev/tinyshield-lib; those sources retain their own terms. See THIRD_PARTY_NOTICES.md before redistributing the data.

版本与发布记录

@filteringdev/tinyshield-domain-collection 共发布 73 个版本,首次发布于 2026/07/22;过去 12 个月发布了 73 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.71latest2026/11/14今天
0.0.702026/11/131 天前
0.0.692026/11/122 天前
0.0.682026/11/113 天前
0.0.672026/11/095 天前
0.0.662026/11/086 天前

其他发布通道:staged → 0.0.0-staged。

关于 @filteringdev/tinyshield-domain-collection 的常见问题

@filteringdev/tinyshield-domain-collection 是什么?

Deterministic domain collections generated from tinyShield reference sources.

如何安装 @filteringdev/tinyshield-domain-collection?

在项目目录运行 npm install @filteringdev/tinyshield-domain-collection,或使用 pnpm add / yarn add / bun add。

@filteringdev/tinyshield-domain-collection 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@filteringdev/tinyshield-domain-collection 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@filteringdev/tinyshield-domain-collection 可以商用吗?

@filteringdev/tinyshield-domain-collection 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@filteringdev/tinyshield-domain-collection 的下载量有多少?

根据 npm 官方下载统计,@filteringdev/tinyshield-domain-collection 在 2026/10/15 – 2026/11/13 这 30 天内被下载 4,463 次,日均约 149 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@filteringdev/tinyshield-domain-collection 还在维护吗?

最新版本 0.0.71 发布于 2026/11/14(今天);至今共发布 73 个版本,其中过去 12 个月发布了 73 个;首次发布于 2026/07/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。