feat(includeFiles): support {from, to} object form for custom serve paths

includeFiles now accepts string | {from, to} entries. The object form
allows specifying a custom serve path (e.g. ./html/index.html -> index.html)
for base64ts bundled content.
This commit is contained in:
2026-02-24 17:02:46 +00:00
parent 801cab9001
commit 12c5655251
4 changed files with 32 additions and 9 deletions

View File

@@ -105,8 +105,12 @@ export class CustomBundleHandler {
// Add included files
if (bundleConfig.includeFiles && bundleConfig.includeFiles.length > 0) {
for (const pattern of bundleConfig.includeFiles) {
await base64Output.addFilesFromGlob(pattern);
for (const entry of bundleConfig.includeFiles) {
if (typeof entry === 'string') {
await base64Output.addFilesFromGlob(entry);
} else {
await base64Output.addFileWithServePath(entry.from, entry.to);
}
}
}
@@ -135,7 +139,8 @@ export class CustomBundleHandler {
const htmlHandler = new HtmlHandler();
const outputDir = plugins.path.dirname(toPath);
for (const pattern of bundleConfig.includeFiles) {
for (const entry of bundleConfig.includeFiles) {
const pattern = typeof entry === 'string' ? entry : entry.from;
await this.copyIncludedFiles(pattern, outputDir);
}
}