ZenReader v2.0.0 Release Notes
Complete TypeScript Rebuild
ZenReader v2.0.0 is a ground-up rewrite of the entire extension from vanilla JavaScript to TypeScript, with a modern build toolchain powered by Vite. All core functionality — element selection, focus mode, and style preservation — remains identical. The user experience is unchanged.
What's New
TypeScript + Strict Mode
- Every source file rewritten in TypeScript with
strict: true - Interfaces for all state objects, message payloads, and function signatures
- Type-safe Chrome API usage via
@types/chrome
Vite Build System
- Vite with
vite-plugin-web-extensionreplaces direct file loading - ES Modules bundled into optimized IIFE for content script injection
- Tree-shaking eliminates dead code from the final bundle
npm run buildruns type checking (tsc --noEmit) then Vite buildnpm run devstarts a Vite dev server for faster iteration
ES Module Architecture
- Global variables and script loading order replaced with explicit
import/export - Singleton state module (
getState()) replaces sharedzenReaderStateglobal - Clean dependency graph with no circular references
On-Demand Content Script Injection
- Content scripts are no longer declared in
manifest.jsoncontent_scripts - Background service worker injects scripts via
chrome.scriptingAPI only when the user activates the extension - Re-injection guard (
window.__zenReaderInjected) prevents double initialization - Zero performance impact on pages where ZenReader is not used
Unit Test Suite
- 63 tests across 4 test files using Vitest with
happy-domenvironment - Coverage for color analysis, DOM utilities, layout fixer, and Shadow DOM styles
- Test structure mirrors source tree (
test/content/styles/,test/content/utils/) npm run testandnpm run test:watchcommands
Project Structure Reorganization
- Source code consolidated under
src/(background, content, about, manifest) - Static assets moved to
public/(_locales, icons) - Documentation and GitHub assets moved to
docs/ - Build output isolated to
dist/(not checked into git)
Breaking Changes
- Requires Node.js v18+ —
npm installis now needed before building - Build step required — load
dist/directory in Chrome instead of project root build.shupdated — now runs TypeScript type check + Vite build pipeline before packaging
By the Numbers
| Metric | v1.2.0 | v2.0.0 |
|---|---|---|
| Language | JavaScript (ES5/ES6) | TypeScript (strict) |
| Build system | None | Vite |
| Module system | Global scope | ES Modules |
| Test framework | None (manual only) | Vitest (63 tests) |
| Type safety | None | Full (tsc --noEmit) |
| Content script loading | Every page (manifest) | On-demand (chrome.scripting) |
Migration
For developers who previously loaded ZenReader by pointing Chrome at the project root:
- Install Node.js v18+ if not already installed
- Run
npm installto install dependencies - Run
npm run buildto generate thedist/directory - In
chrome://extensions/, update the unpacked extension path to thedist/directory
Full Changelog
- Add v2 build toolchain: Vite, TypeScript, vitest configuration
- Add TypeScript content scripts: state, styles, utils, selection, and focus mode
- Add TypeScript background service worker with on-demand injection
- Add content script CSS with overlay, selection, and focus mode styles
- Add TypeScript about page with corrected icon paths
- Add unit tests for color utils, layout fixer, shadow DOM styles, and DOM utils
- Update build.sh for Vite-based build pipeline
- Remove legacy v1 source files superseded by TypeScript rebuild
- Reorganize project structure: consolidate CSS, mirror test layout, tidy docs
- Update README and AGENTS.md for v2 TypeScript architecture