feat(bundle): add configurable bundle output modes and bundler options (support base64ts, production builds, includeFiles, maxLineLength) and route non-default outputs to a CustomBundleHandler

This commit is contained in:
2026-02-24 19:02:39 +00:00
parent c330420eea
commit a893e7a771
6 changed files with 41 additions and 10 deletions
+15 -2
View File
@@ -18,6 +18,7 @@ export class TsWatch {
public typedserver: plugins.typedserver.TypedServer | null = null;
private tsbundle = new plugins.tsbundle.TsBundle();
private customBundleHandler = new plugins.tsbundle.CustomBundleHandler();
private htmlHandler = new plugins.tsbundle.HtmlHandler();
private assetsHandler = new plugins.tsbundle.AssetsHandler();
@@ -128,10 +129,22 @@ export class TsWatch {
} else if (fromPath.endsWith('/') || !fromPath.includes('.')) {
// Assets directory copy
await this.assetsHandler.processAssets();
} else if (bundleConfig.outputMode && bundleConfig.outputMode !== 'bundle') {
// Non-default outputMode (e.g. base64ts) — use CustomBundleHandler
await this.customBundleHandler.processSingleBundle({
from: bundleConfig.from,
to: bundleConfig.to,
outputMode: bundleConfig.outputMode,
bundler: bundleConfig.bundler || 'esbuild',
production: bundleConfig.production || false,
includeFiles: bundleConfig.includeFiles,
maxLineLength: bundleConfig.maxLineLength,
});
} else {
// TypeScript bundling
// Standard TypeScript bundling (default)
await this.tsbundle.build(paths.cwd, fromPath, toPath, {
bundler: 'esbuild',
bundler: bundleConfig.bundler || 'esbuild',
production: bundleConfig.production || false,
});
}