From ef17ba9ebc5d5810b1b1ff065eb845b419dc704f Mon Sep 17 00:00:00 2001 From: ayangweb <75017711+ayangweb@users.noreply.github.com> Date: Sat, 10 Jan 2026 17:51:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20JSON=20=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98=20(#790)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 10 ++++++++++ src/utils/live2d.ts | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8274218..3b38180 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "dayjs": "^1.11.13", "es-toolkit": "^1.38.0", "is-url": "^1.2.4", + "json5": "^2.2.3", "nanoid": "^5.1.5", "pinia": "^3.0.3", "pixi-live2d-display": "^0.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 770c91f..687d92f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,6 +62,9 @@ importers: is-url: specifier: ^1.2.4 version: 1.2.4 + json5: + specifier: ^2.2.3 + version: 2.2.3 nanoid: specifier: ^5.1.5 version: 5.1.5 @@ -3227,6 +3230,11 @@ packages: json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + jsonc-eslint-parser@2.4.0: resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -8031,6 +8039,8 @@ snapshots: json-stable-stringify-without-jsonify@1.0.1: {} + json5@2.2.3: {} + jsonc-eslint-parser@2.4.0: dependencies: acorn: 8.14.1 diff --git a/src/utils/live2d.ts b/src/utils/live2d.ts index 4a0ffef..54e37aa 100644 --- a/src/utils/live2d.ts +++ b/src/utils/live2d.ts @@ -3,6 +3,7 @@ import type { Cubism4InternalModel } from 'pixi-live2d-display' import { convertFileSrc } from '@tauri-apps/api/core' import { readDir, readTextFile } from '@tauri-apps/plugin-fs' +import JSON5 from 'json5' import { Cubism4ModelSettings, Live2DModel } from 'pixi-live2d-display' import { Application, Ticker } from 'pixi.js' @@ -46,7 +47,7 @@ class Live2d { const modelPath = join(path, modelFile.name) - const modelJSON = JSON.parse(await readTextFile(modelPath)) + const modelJSON = JSON5.parse(await readTextFile(modelPath)) const modelSettings = new Cubism4ModelSettings({ ...modelJSON,