Repository navigation
v4.0.0
Major Changes
-
28beb95: # Remove axios Dependency - Native Fetch API
Replaced axios with native Fetch API, eliminating an external dependency and reducing bundle size.
Breaking Changes
- API Response Type:
dymoRequestBuildernow returnsDymoResponseinstead ofAxiosResponse- Changed properties:
response.dataremains the same - Added:
status,statusText,urlproperties
- Changed properties:
- Cancellation: Replace
axios.CancelTokenwithAbortController(standard Web API)- Use
signalparameter instead ofcancelToken - Use
isRequestCancelled()instead ofaxios.isCancel()
- Use
- Error Handling: New
RequestCancelledErrorclass for cancelled requests
New Features
- ✨ Zero external HTTP dependencies - uses native browser Fetch API
- 📦 ~40KB smaller bundle - removed axios dependency
- 🌐 Standards-based AbortController for request cancellation
- 🎯 New exports:
isRequestCancelled(),RequestCancelledError,DymoResponsetype - 🔧 Simplified request configuration with native
RequestInit
Migration Guide
For TypeScript Users
// Before (v2.x with axios) import {CancelToken} from "axios"; const source = axios.CancelToken.source(); dymoRequestBuilder({ method: "GET", wsAction: "status", cancelToken: source.token, }); // After (v3.x with fetch) const controller = new AbortController(); dymoRequestBuilder({ method: "GET", wsAction: "status", signal: controller.signal, }); // Cancel request controller.abort();
Checking for Cancellation
// Before import axios from "axios"; if (axios.isCancel(error)) { ... } // After import { isRequestCancelled } from "react-dymo-hooks"; if (isRequestCancelled(error)) { ... }
Custom Request Options
// Before (axios) dymoRequestBuilder({ method: "POST", wsAction: "printLabel", axiosOtherParams: { data: formData, }, }); // After (fetch) dymoRequestBuilder({ method: "POST", wsAction: "printLabel", fetchOptions: { body: formData, headers: {"Content-Type": "application/x-www-form-urlencoded"}, }, });
Technical Changes
- Replaced
axios.get()andaxios.request()with nativefetch() - Implemented custom retry logic using
fetch() - AbortController for request cancellation (standard Web API)
- Custom
RequestCancelledErrorfor handling abort signals - Updated all React hooks to use AbortController instead of CancelToken
Non-Breaking Changes
- All React hooks maintain the same API
- Request discovery and retry logic unchanged
- Test coverage maintained (43 passing tests)
- All utility functions work identically
Benefits
- Smaller bundle: ~40KB reduction by removing axios
- Modern standards: Uses native Fetch API and AbortController
- Better tree-shaking: No external HTTP library
- Faster load times: Less code to download and parse
- Future-proof: Built on web standards
Compatibility
- Requires browsers with Fetch API support (all modern browsers)
- Node.js 18+ (native fetch support)
- Older browsers can use fetch polyfill if needed
- API Response Type:
-
182d18f: # TypeScript Migration v3.0.0
Complete rewrite to TypeScript with comprehensive test suite and API improvements.
Breaking Changes
- DymoPrinter interface: Boolean properties (
isLocal,isTwinTurbo,isConnected) are now actual booleans instead of string"True"/"False"values
New Features
- ✨ Full TypeScript support with exported types and interfaces
- 🧪 Comprehensive test suite with 90%+ coverage (43 passing tests)
- 📝 Better IDE autocomplete and type checking
- 🐛 Improved error handling with proper error types
- 🎯 All utility functions and hooks are fully typed
- 📦 Generated .d.ts files for full TypeScript integration
Migration Guide
For TypeScript users or anyone accessing
DymoPrinterproperties:// Before (v2.x) if (printer.isLocal === "True") { ... } // After (v3.x) if (printer.isLocal === true) { ... }
For JavaScript users: The library remains fully backward compatible. Boolean comparisons will work naturally.
Technical Changes
- Converted all source files to TypeScript (.ts/.tsx)
- Added Vitest test suite with @testing-library/react-hooks
- Replaced moment.js with native Date API in storage utilities
- Created type declarations for react-xml-parser
- Fixed type safety issues in dymo_utils request builder
- All exports now include proper TypeScript types
Test Coverage
- ✅ storage.test.ts: 18 tests for storage with Date API
- ✅ dymo_utils.test.ts: 13 tests for utilities and XML parsing
- ✅ hooks.test.ts: 8 tests for the useData hook
- ✅ index.test.tsx: 9 tests for React hooks
- DymoPrinter interface: Boolean properties (
Patch Changes
-
4a7b86c: # Vite and Vitest Migration
Migrated build tooling from microbundle-crl to Vite and testing from Jest to Vitest for improved performance and modern development experience.
Build System Changes
- Replaced microbundle-crl with Vite for library bundling
- Significantly faster build times using esbuild
- Modern ESM-first approach
- Better development experience with HMR support
- Build outputs: ESM (
index.modern.js) and CJS (index.cjs.js) formats - TypeScript declarations: Generated via
vite-plugin-dts - Source maps: Enabled for better debugging
Testing Changes
- Replaced Jest with Vitest for testing
- Jest-compatible API with better performance
- Native ESM and TypeScript support
- Faster test execution
- All 43 tests passing with identical coverage as Jest
- Test utilities: Using
@testing-library/react-hooksfor React 16 compatibility
Developer Benefits
- ⚡ ~3x faster builds: Vite uses esbuild for transpilation
- 🔄 ~2x faster tests: Vitest's parallel execution and smart caching
- 📦 Smaller bundle: Modern build optimizations
- 🛠️ Better DX: Improved error messages and debugging
Non-Breaking Changes
- All test suites migrated successfully
- Build output format remains compatible
- No API changes for library consumers
- Package exports unchanged
Technical Details
Removed Dependencies
microbundle-crl(replaced by Vite)@types/jest(replaced by Vitest types)cross-env(not needed with Vitest)
Added Dependencies
vitev7.3.1vitestv4.0.17vite-plugin-dtsv4.5.4 (TypeScript declarations)jsdom(test environment)@vitest/coverage-v8(coverage reporting)
Configuration Files
vite.config.ts: Library build configurationvitest.config.ts: Test configuration with jsdom environmentsrc/setupTests.ts: Test setup file
- Replaced microbundle-crl with Vite for library bundling