Skip to content

Releases: aqzhyi/chinese-conv

v4.0.0

30 Oct 14:32

Choose a tag to compare

[4.0.0] - 2025-10-30

🐛 Bug Fixes

  • Build Configuration: Fixed preinstall script hang issue on Deno environments by removing the preinstall script that enforced pnpm usage (#2)
  • Package Configuration: Improved package.json structure with proper CommonJS and ESM dual module support
  • Build Output: Added proper type declarations for both ESM (index.d.ts) and CJS (index.d.cts) formats

⚡ Performance Improvements

  • Pre-compiled Regex Patterns: Moved regex compilation outside the replacement function to eliminate repeated compilation overhead
  • Optimized Character Lookup: Replaced char in map checks with direct property access using nullish coalescing (map[char] ?? char)
  • Streamlined Logic: Removed unnecessary variable assignments and simplified control flow
  • Consistent Performance: Achieved stable performance across all text sizes:
    • Small text (< 50 chars): ~3.18M calls/second
    • Medium text (100-500 chars): ~1.05M calls/second
    • Large text (1000+ chars): ~43K calls/second
    • Peak throughput: ~3.2M conversions/second

📦 BREAKING CHANGES

  • Dependencies: Updated all devDependencies to latest versions
  • Node.js Engines: Added engine requirements (^20.19.0 || >=22.12.0)

🔗 Related Issues


thank you @lst97 for your help on #2, #3

v3.2.2

26 Nov 01:17

Choose a tag to compare

  • docs: add example link to README c89d8f8
  • build: bump pnpm-lock 3c28c15
  • chore: update turbo 41beeff
  • chore: add preinstall script to enforce pnpm usage ff2a865
  • chore: upgrade nodejs and pnpm 18ed71b
  • docs: add dictionary source to README 3c1ec3e
  • chore: update LICENSE 995a636
  • build: add "publint" for package linting and update package.json exports 06f2b86
  • chore: add @types/node 20.17.6 bf0f8b0
  • build: add Lefthook configuration for pre-commit hooks 86a92ce
  • build: add dist/index.umd.js. use Vite as package bundler. remove Bun b0a7b16
  • chore: change the package manager to pnpm, lock the development dependency versions in "devDeps" 1442ba6

v3.2.1...v3.2.2

v3.2.1

14 Oct 08:46

Choose a tag to compare

v3.2.0

14 Oct 07:33

Choose a tag to compare

3.2.0 (2024-10-14)

Features

  • the function "tifyJson" can accept either a js#array or a js#object as a parameter, and it will return the original type after converting the text (9e27c04)
it('Handling js#array.', () => {
  const chsAsArray = [
    '所谓知己知彼百战不殆',
    '作为星际2职业选手',
    '他们在平时练习中不仅要练好自己的本族',
    '还会经常选择其他两个族进行练习',
  ]
  const chtAsArray = [
    '所謂知己知彼百戰不殆',
    '作為星際2職業選手',
    '他們在平時練習中不僅要練好自己的本族',
    '還會經常選擇其他兩個族進行練習',
  ]

  expect(tifyJson(chsAsArray)).toEqual(chtAsArray)
})
it('Handling js#object.', () => {
  const chsAsObject = {
    text1: '所谓知己知彼百战不殆',
    text2: '作为星际2职业选手',
    text3: '他们在平时练习中不仅要练好自己的本族',
    text4: '还会经常选择其他两个族进行练习',
  }
  const chtAsObject = {
    text1: '所謂知己知彼百戰不殆',
    text2: '作為星際2職業選手',
    text3: '他們在平時練習中不僅要練好自己的本族',
    text4: '還會經常選擇其他兩個族進行練習',
  }

  expect(tifyJson(chsAsObject)).toEqual(chtAsObject)
})

v3.0.0

02 Oct 05:27

Choose a tag to compare

  • build!: use the more modern field packagejson#export to replace the main field, enhancing the exported files and typings.

    BREAKING CHANGE:
    
    all components are now exported as named exports, and the default export method is no longer supported
    

Usage

import { tify } from 'chinese-conv'

or

import { tify } from 'chinese-conv/dist'

Preview

CleanShot 2024-10-02 at 13 22 20

v2.1.1

25 Aug 19:33

Choose a tag to compare

  • error handling, if a non-string parameter is unexpectedly passed in, an error message will be logged to the console (43891b5)

2.0.0

25 Aug 17:32

Choose a tag to compare

Breaking Changes

  • build!: retire the old-fashioned build plan from 9 years ago and switch to TypeScript, Bun, and Vitest (b0548c4)

Full Changelog: v1.1.0...v2.0.0

1.1.0

28 Nov 03:14

Choose a tag to compare