@flesh-and-blood/search

中文文档
7.3.3发布于 2026/11/01MITTypeScriptESM + CJS

TypeScript search engine for Flesh and Blood cards

原始使用文档
文档目录4 节
  1. Installation
  2. Usage
  3. What's included
  4. Working with this project

@flesh-and-blood/search

A fuse.js-based search engine for Flesh and Blood cards.

Installation

npm i @flesh-and-blood/search @flesh-and-blood/types

@flesh-and-blood/types is a peer dependency: install it alongside this package

Usage

import Searcher from "@flesh-and-blood/search";
import { cards, releases } from "@flesh-and-blood/cards";

const searcher = new Searcher(cards, { releases });
const { searchResults } = searcher.search("rhinar go again");
  • new Searcher(cards, { releases }), or { index } to share a catalogue index built with getCatalogueIndex(cards, releases)
  • index.getHero(name) resolves any name a player writes for a hero to its key, the way l: and sp: do; index.getHeroMatches(name) answers every hero the name fits, each with a hero card, for a name several heroes hold; index.getByRole(CardRole.Hero) lists every hero card, and index.getHeroCardsByFormat(format) the hero cards legal in a format; filter either on card.heroPool for one hero pool. getHeroFilterValue(heroCard) writes the l: filter for a hero card
  • A hero name several heroes hold is reported in unresolvedFilters as { reason: "ambiguous", values, candidates }, each candidate a hero card's name
  • .search(text) → SearchResults: { searchResults: SearchCard[], appliedFilters, keywords, attributes }

Data-only modules are available as subpath imports (handy for lazy-loaded UI like a search-bar dropdown):

import { shorthands } from "@flesh-and-blood/search/shorthands";

What's included

  • Default export: Searcher, the search engine
  • Types: SearchResults, SearchCard
  • Data modules (subpath imports): shorthands, memes
  • Filter, exclusion and helper utilities (filters, exclusions, legality, helpers, constants, related)

Working with this project

npm run build   # build:esm (per-file ESM) + build:cjs (bundled) + tsc declarations
npm test        # vitest

Uses @flesh-and-blood/cards (file:../cards) as a dev dependency for tests.

版本与发布记录

@flesh-and-blood/search 共发布 1,002 个版本,首次发布于 2023/09/18;过去 12 个月发布了 345 个版本。

版本发布日期距今
7.3.3latest2026/11/012 天前
7.3.22026/11/012 天前
7.3.12026/10/304 天前
7.3.02026/10/295 天前
7.2.02026/10/285 天前
7.1.102026/10/286 天前

关于 @flesh-and-blood/search 的常见问题

@flesh-and-blood/search 是什么?

血肉卡牌的TypeScript搜索引擎

如何安装 @flesh-and-blood/search?

在项目目录运行 npm install @flesh-and-blood/search,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@flesh-and-blood/types(^7.3.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@flesh-and-blood/search 支持 TypeScript 吗?

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

@flesh-and-blood/search 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@flesh-and-blood/search 可以商用吗?

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

@flesh-and-blood/search 还在维护吗?

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