Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"node-sql-parser": "^4.5.0",
"octokit": "^1.7.1",
"p-queue": "^7.3.0",
"pinyin": "3.0.0-alpha.5",
"pinyin": "4.0.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Upgrading pinyin from v3 to v4 introduces breaking changes that will cause runtime errors. The Snyk PR only updated the version in package.json but did not adapt the code to these changes.

Specifically, in api/app/locator/Locator.ts:

  1. The import statement for pinyin needs to be changed from a default import to a named import.
  2. The style constants like pinyin.STYLE_NORMAL have been removed. You should use the Style enum or string literals.

Here are the required changes in api/app/locator/Locator.ts:

// api/app/locator/Locator.ts

// Change this line:
import pinyin from 'pinyin';

// To this:
import { pinyin, Style } from 'pinyin';

// ...

// And change this block:
return pinyin(part, {
    style: pinyin.STYLE_NORMAL,
}).join('');

// To this:
return pinyin(part, {
    style: Style.NORMAL,
}).join('');

Without these changes, the application will crash when trying to use the pinyin function. Please apply these changes before merging.

Also, as noted in the PR description, pnpm-lock.yaml needs to be updated by running pnpm install.

"prom-client": "^14.0.1",
"reflect-metadata": "^0.1.13",
"socket.io": "^4.5.2",
Expand Down
Loading