Repository navigation
fix(build): restore the supported validation toolchain - #32
Merged
Merged
Conversation
Pin TypeScript to the compiler API supported by vue-tsc and typescript-eslint. Use the existing esbuild dependency for formatter fixtures, permit the existing TS import suffixes, and remove compilation/lint blockers. Run translation generation as ESM with module-relative output and cover invocation from another working directory. The independent PageSupport.reasonCode compile errors remain for the separate page-support fix. Signed-off-by: aliyun1121003339 <jacob.hxx.cn@outlook.com>
评审者指南此 PR 通过将 TypeScript 固定到 5.9 版本、在格式化工具测试中移除对 TypeScript 编译器 API 的依赖、启用现有的导入约定,并修复 ESM/可移植翻译生成,恢复了受支持的验证工具链。此外,它还清理了未使用的绑定并添加了回归测试;独立的类型检查仍依赖 PR 30 中单独修复的 PageSupport.reasonCode。 可移植 ESM 翻译生成时序图sequenceDiagram
participant Test as Translation test
participant Generator as gen_trans.js
participant FS as File system
Test->>Generator: run from another working directory
Generator->>Generator: import fs from node:fs
Generator->>FS: resolve evidence_translations.json via import.meta.url
Generator->>FS: write generated translations
FS-->>Test: output beside generator module
文件级变更
提示与命令与 Sourcery 互动
自定义你的体验访问你的控制面板以便:
获取帮助Original review guide in EnglishReviewer's GuideThis PR restores the supported validation toolchain by pinning TypeScript to 5.9, removing reliance on the TypeScript compiler API in formatter tests, enabling existing import conventions, and fixing ESM/portable translation generation. It also cleans up unused bindings and adds regression coverage; standalone typecheck still depends on the separate PageSupport.reasonCode fix in PR 30. Sequence diagram for portable ESM translation generationsequenceDiagram
participant Test as Translation test
participant Generator as gen_trans.js
participant FS as File system
Test->>Generator: run from another working directory
Generator->>Generator: import fs from node:fs
Generator->>FS: resolve evidence_translations.json via import.meta.url
Generator->>FS: write generated translations
FS-->>Test: output beside generator module
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
7 tasks done
There was a problem hiding this comment.
你好——我发现了 1 个问题
给 AI 代理的提示
请处理这次代码审查中的评论:
## 单条评论
### 评论 1
<location path="src/i18n/gen_trans.js" line_range="1" />
<code_context>
-const fs = require('fs')
-const f = 'D:/压缩/tech-detector-extension/src/i18n/evidence_translations.json'
+import fs from 'node:fs'
+const f = new URL('./evidence_translations.json', import.meta.url)
const d = {}
</code_context>
<issue_to_address>
**重新生成会丢失大部分翻译**
运行翻译生成器时,`fs.writeFileSync` 会在剩余的 `Object.assign` 调用执行之前写入 `d`,因此运行生成器会将翻译文件替换为仅包含初始条目的内容;最终写入虽然发生在所有条目都添加之后,但之前的写入已经截断了文件。
移除提前执行的写入,并且只在所有翻译条目都赋值完成后写入完整的 `d`。
</issue_to_address>Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/i18n/gen_trans.js" line_range="1" />
<code_context>
-const fs = require('fs')
-const f = 'D:/压缩/tech-detector-extension/src/i18n/evidence_translations.json'
+import fs from 'node:fs'
+const f = new URL('./evidence_translations.json', import.meta.url)
const d = {}
</code_context>
<issue_to_address>
**Regeneration drops most translations**
When the translation generator is run, `fs.writeFileSync` writes `d` before the remaining `Object.assign` calls run, so invoking the generator replaces the translation file with only the initial entries; the final write occurs after all entries have been added, but the earlier write has already truncated the file.
Remove the early write and write the completed `d` only after all translation entries have been assigned.
</issue_to_address>Signed-off-by: aliyun1121003339 <jacob.hxx.cn@outlook.com>
setube
added a commit
that referenced
this pull request
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Context & Motivation (Context)
~5.9.3, compatible with the current tooling, instead of migrating compiler consumers in this repair. Formatter tests use the existing esbuild dependency. No new dependency or detection hot-path change.2. Implementation Details (Implementation)
PageSupport.reasonCodedefect remains outside this diff. Merge fix(popup): return localization keys for unsupported pages #30 as well to make the complete typecheck green.3. Testing Strategies (Validation)
bun run test:unit: 27/27 pass on this branch, including existing formatter regressions and the new translation-generator test.bun run lintpasses on this branch.bun run typecheckcompletes vue-tsc and the production extension build; the combined fork has 36 passing unit tests and the SDK candidate passed 13 real-Chrome integration tests.reasonCodeerrors addressed by PR 30. It is not reported as passing independently.