mirror of
https://github.com/hyungyunlim/obsidian-korean-grammar-assistant.git
synced 2026-07-22 06:42:55 +00:00
Round 3 of Obsidian plugin review. Eliminates remaining any types,
reverses incorrect activeWindow timer convention, removes Node fs/path
imports entirely, and addresses dozens of unused-import/var warnings.
- Reverse all activeWindow.{setTimeout,clearTimeout,setInterval,clearInterval}
back to window.* (reviewer wants window.* for timer functions)
- Replace bare requestAnimationFrame with window.requestAnimationFrame
- Drop local api-config.json fs/path loader (was dev-only, reviewer
forbids require() and Node builtin imports). DEFAULT_SETTINGS now
inline literal — no I/O at module load
- Replace 'builtin-modules' npm dep with Node's native node:module
builtinModules import in esbuild.config.mjs
- src/ui/settingsTab.ts: type all service accesses (AdvancedSettingsService,
ErrorHandlerService, Logger.getStats/getMemoryUsage/getHistory return
values); add LogStats/ErrorStats/MemoryUsage typed shapes; remove 11
require() callsites in favor of top-level ES imports
- src/popup/, src/services/, src/api/, src/ui/, src/utils/: type all
remaining any (event handlers, error catches via instanceof Error,
Bareun response shapes, optimizedApi reject(new Error()))
- Remove 6 unused action-data interfaces in CorrectionPopupCore plus
~20 unused imports/locals across popup/services/ui/utils
- src/services/inlineModeService.ts: fix unbound 'this' via StateField
arg shape, remove dead ErrorWidget, redundant double negation
- src/ui/correctionPopup.ts, inlineTooltip.ts: convert remaining
document.* to activeDocument.*; remove unnecessary !-assertions;
guard error.stack/message via instanceof Error
- Replace last instanceof HTMLElement (HeaderRenderer) with typed
querySelector<HTMLElement>
Build: tsc clean (0 errors), esbuild production succeeds (main.js 639KB)
Residual review-blocker patterns in shipped code: 0
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
58 lines
No EOL
1.2 KiB
JavaScript
58 lines
No EOL
1.2 KiB
JavaScript
import esbuild from "esbuild";
|
|
import process from "process";
|
|
import { builtinModules } from "node:module";
|
|
|
|
const banner =
|
|
`/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
`;
|
|
|
|
const prod = (process.argv[2] === "production");
|
|
|
|
const jsContext = await esbuild.context({
|
|
banner: {
|
|
js: banner,
|
|
},
|
|
entryPoints: ["main.ts"],
|
|
bundle: true,
|
|
external: [
|
|
"obsidian",
|
|
"electron",
|
|
"@codemirror/autocomplete",
|
|
"@codemirror/collab",
|
|
"@codemirror/commands",
|
|
"@codemirror/language",
|
|
"@codemirror/lint",
|
|
"@codemirror/search",
|
|
"@codemirror/state",
|
|
"@codemirror/view",
|
|
"@lezer/common",
|
|
"@lezer/highlight",
|
|
"@lezer/lr",
|
|
...builtinModules,
|
|
...builtinModules.map((m) => `node:${m}`)],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "inline",
|
|
treeShaking: true,
|
|
outfile: "main.js",
|
|
});
|
|
|
|
const cssContext = await esbuild.context({
|
|
entryPoints: ["styles/main.css"],
|
|
bundle: true,
|
|
outfile: "styles.css",
|
|
logLevel: "info",
|
|
});
|
|
|
|
if (prod) {
|
|
await jsContext.rebuild();
|
|
await cssContext.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await jsContext.watch();
|
|
await cssContext.watch();
|
|
} |