diff --git a/package.json b/package.json index ea458e7..f18c245 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sim-phi/extends", - "version": "0.3.3", + "version": "0.3.4", "description": "Third-party chart format conversion functions for sim-phi.", "type": "module", "main": "dist/index.js", @@ -30,13 +30,13 @@ "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-terser": "^0.4.4", - "@stylistic/eslint-plugin": "^1.5.4", - "@typescript-eslint/eslint-plugin": "^6.19.0", - "eslint": "^8.56.0", + "@stylistic/eslint-plugin": "^1.7.0", + "@typescript-eslint/eslint-plugin": "^7.2.0", + "eslint": "^8.57.0", "eslint-plugin-rulesdir": "^0.2.2", - "typescript": "^5.3.3", - "vite": "^5.0.12", - "vite-plugin-dts": "^3.7.1" + "typescript": "^5.4.2", + "vite": "^5.1.6", + "vite-plugin-dts": "^3.7.3" }, "files": [ "dist" diff --git a/src/pec/index.ts b/src/pec/index.ts index 61db5b1..5ddc277 100644 --- a/src/pec/index.ts +++ b/src/pec/index.ts @@ -13,8 +13,8 @@ namespace PEC { } return result; } - export function parseRPE(pec: string, filename: string): ReturnType { - const result = parseRPE$(pec, filename); + export function parseRPE(pec: string, pathname: string, filename: string): ReturnType { + const result = parseRPE$(pec, pathname, filename); for (const line of result.data.judgeLineList) { normalizeSpeedEvents(line.speedEvents); normalizeLineEvents(line.judgeLineDisappearEvents); diff --git a/src/pec/pec2json.ts b/src/pec/pec2json.ts index ea42427..73fc097 100644 --- a/src/pec/pec2json.ts +++ b/src/pec/pec2json.ts @@ -112,8 +112,8 @@ export function parse(pec: string, filename: string): PecParseResult { linesPec[i.lineId] ??= new LinePec(bpmList.baseBpm); linesPec[i.lineId].pushNote(type, time, i.offsetX / 115.2, holdTime, speed, i.isAbove === 1, i.isFake !== 0); // 102.4 // if (i.isAbove !== 1 && i.isAbove !== 2) warnings.push(`检测到非法方向:${i.isAbove}(将被视为2)\n位于:"${i.text}"\n来自${filename}`); - if (i.isFake !== 0) warnings.push(`检测到FakeNote(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`); - if (i.size !== 1) warnings.push(`检测到异常Note(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`); + if (i.isFake !== 0) warnings.push(`检测到Fake音符(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`); + if (i.size !== 1) warnings.push(`检测到异常音符(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`); } const isMotion = (i: number) => !isLinear(i) || i === 1; for (const i of data2.lines) { diff --git a/src/pec/rpe2json.ts b/src/pec/rpe2json.ts index c4495ac..afb5091 100644 --- a/src/pec/rpe2json.ts +++ b/src/pec/rpe2json.ts @@ -517,7 +517,7 @@ interface JudgeLineRPEExtends extends JudgeLineRPE { LineId: number; judgeLineRPE: LineRPE1; } -export function parse(pec: string, filename: string): { +export function parse(pec: string, pathname: string, filename: string): { data: ChartPGS; messages: BetterMessage[]; info: Record; @@ -529,7 +529,7 @@ export function parse(pec: string, filename: string): { if (!meta?.RPEVersion) throw new Error('Invalid rpe file'); const result = { formatVersion: 3, offset: 0, numOfNotes: 0, judgeLineList: [] } as ChartPGS; const warnings = [] as BetterMessage[]; - const warn = (code: number, name: string, message: string) => warnings.push({ host: 'RPE2JSON', code, name, message, target: filename }); + const warn = (code: number, name: string, message: string) => warnings.push({ host: 'RPE2JSON', code, name, message, target: pathname }); warn(0, 'RPEVersionNotice', `RPE谱面兼容建设中...\n检测到RPE版本:${meta.RPEVersion}`); const format = `RPE(${meta.RPEVersion})`; // 谱面信息 @@ -582,7 +582,7 @@ export function parse(pec: string, filename: string): { for (const note of i.notes) { if (note.alpha === undefined) note.alpha = 255; if (note.above !== 1 && note.above !== 2) warn(1, 'NoteSideWarning', `检测到非法方向:${note.above}(将被视为2)\n位于:"${JSON.stringify(note)}"`); - if (note.isFake !== 0) warn(1, 'NoteFakeWarning', `检测到FakeNote(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`); + if (note.isFake !== 0) warn(1, 'NoteFakeWarning', `检测到Fake音符(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`); if (note.size !== 1) warn(1, 'ImplementionWarning', `未兼容size=${note.size}(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`); if (note.yOffset !== 0) warn(1, 'ImplementionWarning', `未兼容yOffset=${note.yOffset}(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`); if (note.visibleTime !== 999999) warn(1, 'ImplementionWarning', `未兼容visibleTime=${note.visibleTime}(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`); @@ -643,7 +643,7 @@ export function parse(pec: string, filename: string): { } for (const i of data.judgeLineList) { const lineRPE = i.judgeLineRPE; // TODO: 待优化 - const judgeLine = lineRPE.format({ onwarning: (msg: string) => warn(1, 'OtherWarning', `${msg}`) }); + const judgeLine = lineRPE.format({ onwarning: (msg: string) => warn(1, 'OtherWarning', msg) }); result.judgeLineList.push(judgeLine); result.numOfNotes! += judgeLine.numOfNotes; }