fix(parser): 修正资源去重和构建配置#972
Conversation
There was a problem hiding this comment.
Code Review
This pull request cleans up the dependencies and configuration of the packages/parser package. It removes unused dependencies like lodash and chevrotain, deletes tsconfig.node.json, and updates tsconfig.json and package.json accordingly. Additionally, it replaces the lodash uniqWith utility in sceneParser.ts with a custom deduplicateAssets helper. A review comment suggests adding defensive checks in this new helper to prevent potential runtime errors when accessing properties of potentially null or undefined assets.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
背景
packages/parser当前同时存在两类问题:lodash/uniqWith,但没有显式比较语义,重复资源去重不稳定。本次改动
deduplicateAssets替代lodash/uniqWith,按type + url对资源去重,并保留首次出现的资源记录。packages/parser/package.json中未使用的构建相关依赖,补充rimraf,保留tsx作为调试用开发依赖。packages/parser/tsconfig.json,移除tsconfig.node.json,同步更新.npmignore。exports: "named",统一不同产物的导出行为。yarn.lock以反映依赖收敛结果。影响范围
packages/parser的资源预加载去重逻辑packages/parser的打包与发布配置yarn.lock验证建议
yarn parser:test --runyarn parser:buildyarn buildassetsList中相同type + url只保留一条风险与注意事项
type + url。如果上层未来需要区分同 URL 但不同name或lineNumber的记录,需要进一步明确接口边界。