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,