Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-05-12 04:43:25 +10:00
parent 655d16ea6b
commit b09a329d62
13 changed files with 3602 additions and 27 deletions

View File

@@ -50,6 +50,11 @@ const FONT_LOADERS = {
'.svg': 'dataurl',
};
const TEXT_LOADERS = {
'.aff': 'text',
'.dic': 'text',
};
async function main() {
fs.mkdirSync(DIST_DIR, { recursive: true });
@@ -77,6 +82,20 @@ async function main() {
fs.writeFileSync(path.join(DIST_DIR, 'milkdown-theme.css'), cssTheme.outputFiles[0].contents);
console.log(`✓ milkdown-theme.css ${(cssTheme.outputFiles[0].contents.byteLength / 1024).toFixed(0)} KB`);
console.log('⏳ Bundling spellcheck JS…');
const spellcheckJs = await esbuild.build({
entryPoints: [path.join(ROOT, 'spellcheck.js')],
bundle: true,
format: 'esm',
platform: 'browser',
target: 'es2022',
minify: true,
write: false,
loader: TEXT_LOADERS,
});
fs.writeFileSync(path.join(DIST_DIR, 'spellcheck.js'), spellcheckJs.outputFiles[0].contents);
console.log(`✓ spellcheck.js ${(spellcheckJs.outputFiles[0].contents.byteLength / 1024).toFixed(0)} KB`);
console.log('\n✓ dist/ ready — run: npx @vscode/vsce package --out blog-editor.vsix --no-dependencies');
}