refactor: update imports and add starting items to desert sample

- Convert single quotes to double quotes for local imports
- Reformat barrel exports in `src/index.ts` for better readability
- Add `startingItems` to the desert sample data in `slay-the-spire-like`
This commit is contained in:
hypercross 2026-04-19 13:51:03 +08:00
parent 3aa92b2d2a
commit 63733bc62d
2 changed files with 70 additions and 29 deletions

View File

@ -4,34 +4,71 @@
*/ */
// Core types // Core types
export type { IGameContext } from './core/game'; export type { IGameContext } from "./core/game";
export { createGameCommandRegistry, createPromptDef } from './core/game'; export { createGameCommandRegistry, createPromptDef } from "./core/game";
export type { GameHost, GameHostStatus, GameModule } from './core/game-host'; export type { GameHost, GameHostStatus, GameModule } from "./core/game-host";
export { createGameHost } from './core/game-host'; export { createGameHost } from "./core/game-host";
export type { Part } from './core/part'; export type { Part } from "./core/part";
export { flip, flipTo, roll } from './core/part'; export { flip, flipTo, roll } from "./core/part";
export { createParts, createPartsFromTable } from './core/part-factory'; export { createParts, createPartsFromTable } from "./core/part-factory";
export type { Region, RegionAxis } from './core/region'; export type { Region, RegionAxis } from "./core/region";
export { createRegion, createRegionAxis, applyAlign, shuffle, moveToRegion } from './core/region'; export {
createRegion,
createRegionAxis,
applyAlign,
shuffle,
moveToRegion,
} from "./core/region";
// Utils // Utils
export type { Command, CommandDef, CommandResult, CommandSchema, CommandParamSchema, CommandOptionSchema, CommandFlagSchema } from './utils/command'; export type {
export { parseCommand, parseCommandSchema, validateCommand, parseCommandWithSchema, applyCommandSchema } from './utils/command'; Command,
CommandDef,
CommandResult,
CommandSchema,
CommandParamSchema,
CommandOptionSchema,
CommandFlagSchema,
} from "./utils/command";
export {
parseCommand,
parseCommandSchema,
validateCommand,
parseCommandWithSchema,
applyCommandSchema,
} from "./utils/command";
export type { CommandRunner, CommandRunnerHandler, CommandRunnerContext, PromptEvent, CommandRunnerEvents } from './utils/command'; export type {
export { createCommandRegistry, registerCommand, unregisterCommand, hasCommand, getCommand, runCommand, runCommandParsed, createCommandRunnerContext, type CommandRegistry, type CommandRunnerContextExport } from './utils/command'; CommandRunner,
CommandRunnerHandler,
CommandRunnerContext,
PromptEvent,
CommandRunnerEvents,
} from "./utils/command";
export {
createCommandRegistry,
registerCommand,
unregisterCommand,
hasCommand,
getCommand,
runCommand,
runCommandParsed,
createCommandRunnerContext,
type CommandRegistry,
type CommandRunnerContextExport,
} from "./utils/command";
export type { MutableSignal } from './utils/mutable-signal'; export type { MutableSignal } from "./utils/mutable-signal";
export { mutableSignal } from './utils/mutable-signal'; export { mutableSignal } from "./utils/mutable-signal";
export type { RNG } from './utils/rng'; export type { RNG, ReadonlyRNG } from "./utils/rng";
export { createRNG, Mulberry32RNG } from './utils/rng'; export { createRNG, Mulberry32RNG } from "./utils/rng";
export type {MiddlewareChain} from './utils/middleware' export type { MiddlewareChain } from "./utils/middleware";
export { createMiddlewareChain } from './utils/middleware'; export { createMiddlewareChain } from "./utils/middleware";
export * from '@preact/signals-core'; export * from "@preact/signals-core";

View File

@ -1,15 +1,19 @@
import getCards from './card.csv'; import getCards from "./card.csv";
import getEffects from './effect.csv'; import getEffects from "./effect.csv";
import getEncounters from './encounter.csv'; import getEncounters from "./encounter.csv";
import getEnemies from './enemy.csv'; import getEnemies from "./enemy.csv";
import getIntents from './intent.csv'; import getIntents from "./intent.csv";
import getItems from './item.csv'; import getItems from "./item.csv";
export { default as dialogues } from './dialogues/dialogues.yarnproject'; export { default as dialogues } from "./dialogues/dialogues.yarnproject";
export { addTriggers } from './triggers'; export { addTriggers } from "./triggers";
export const cards = getCards(); export const cards = getCards();
export const effects = getEffects(); export const effects = getEffects();
export const encounters = getEncounters(); export const encounters = getEncounters();
export const enemies = getEnemies(); export const enemies = getEnemies();
export const intents = getIntents(); export const intents = getIntents();
export const items = getItems(); export const items = getItems();
export const startingItems = ["剑", "盾", "水袋", "绷带"].map((key) =>
items.find((item) => item.name === key),
);