| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2026-06-10 | 2.1 kB | |
| Release v1.3.0 source code.tar.gz | 2026-06-10 | 157.6 kB | |
| Release v1.3.0 source code.zip | 2026-06-10 | 206.4 kB | |
| Totals: 3 Items | 366.1 kB | 0 | |
New Features
- Mock State 联动能力:
- Added shared Mock State support for dynamic response functions through
ctx.state. - Dynamic mock functions can now read and write shared state across different API rules.
- Supports realistic CRUD flows such as creating a user with
POST /api/usersand reading it later withGET /api/users. -
Exported
MockContextandMockStateStoretypes for TypeScript users. -
State Panel:
- Added a new
Statetab to the PocketMocker dashboard. - Users can view, edit, save, clear, copy, and import shared Mock State as JSON.
-
Added a persistence toggle for controlling whether Mock State survives refreshes.
-
Mock State Persistence:
- Local mode stores Mock State in
localStorage. - Vite plugin mode stores Mock State in
pocket-mock-state.json. -
Added Vite plugin endpoints for reading, saving, and resetting Mock State.
-
Demo Experience:
- Added a linked API state demo to
src/main.ts. - Demo users can create records through
POST /api/usersand refreshGET /api/usersto verify stateful API behavior.
Bug Fixes
- Fixed absolute path matching so parent paths no longer implicitly match child paths.
- For example,
/appplyno longer matches/appply/invite. -
Use explicit wildcard rules such as
/appply/*when child path matching is intended. -
Added CodeMirror dependency dedupe configuration in Vite to avoid duplicate
@codemirror/stateinstances causing editor initialization failures.
Tests
- Added unit tests for Mock State store operations.
- Added handler tests covering shared state between dynamic response functions.
- Added Vite plugin tests for Mock State file read, save, validation, and reset behavior.
- Added matcher regression tests for absolute path matching boundaries.
Documentation
- Added
docs/MOCK_STATE_DESIGN.zh-CN.mdwith the Mock State design, API shape, UI plan, persistence behavior, and rollout strategy.
📦 NPM Package: pocket-mocker@1.3.0