Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a5f6c6944 | |||
| 54ac7e7188 | |||
| 5f0507b2c7 | |||
| ecfd7600e2 | |||
| 9cf173293d | |||
| 3a53fffe3d | |||
| 8f129527d9 | |||
| 5d9052018e | |||
| 12c5655251 |
24
changelog.md
24
changelog.md
@@ -1,5 +1,29 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-03-11 - 2.9.2 - fix(mod_esbuild)
|
||||
preserve function and class names in esbuild output by enabling keepNames in both dev and prod configs
|
||||
|
||||
- Added keepNames: true to esbuild options in ts/mod_esbuild/index.child.ts for the non-minified/dev build
|
||||
- Added keepNames: true to esbuild options in ts/mod_esbuild/index.child.ts for the minified/production build to improve stack traces, debugging, and runtime reflection
|
||||
|
||||
## 2026-03-05 - 2.9.1 - fix(mod_custom)
|
||||
use absolute smartfs entry.path instead of joining with dirPath when building fullPath
|
||||
|
||||
- entry.path is already absolute (from smartfs); avoid joining it with dirPath which produced incorrect paths
|
||||
- Fixes file copy path construction so plugins.fs.file(fullPath).copy(destPath) uses the correct source path
|
||||
|
||||
## 2026-02-24 - 2.9.0 - feat(exports)
|
||||
expose mod_custom, mod_output and interfaces from entry; make processSingleBundle public
|
||||
|
||||
- Exported ./mod_custom, ./mod_output and ./interfaces from ts/index.ts to expose these modules in the public API.
|
||||
- Changed processSingleBundle in ts/mod_custom/index.ts from private to public to allow programmatic invocation.
|
||||
- Non-breaking API expansion; recommend a minor version bump.
|
||||
|
||||
## 2026-02-24 - 2.8.4 - fix()
|
||||
no changes — empty diff, nothing to commit
|
||||
|
||||
- Diff contained no modifications; no release required
|
||||
|
||||
## 2026-01-23 - 2.8.3 - fix(mod_output)
|
||||
use pattern base dir when computing relative paths for files to serve
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@git.zone/tsbundle",
|
||||
"version": "2.8.3",
|
||||
"version": "2.9.2",
|
||||
"private": false,
|
||||
"description": "a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects",
|
||||
"main": "dist_ts/index.js",
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsbundle',
|
||||
version: '2.8.3',
|
||||
version: '2.9.2',
|
||||
description: 'a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects'
|
||||
}
|
||||
|
||||
@@ -11,4 +11,7 @@ early.stop();
|
||||
export * from './tsbundle.class.tsbundle.js';
|
||||
export * from './mod_assets/index.js';
|
||||
export * from './mod_html/index.js';
|
||||
export * from './mod_custom/index.js';
|
||||
export * from './mod_output/index.js';
|
||||
export * from './interfaces/index.js';
|
||||
export { runCli };
|
||||
|
||||
@@ -17,13 +17,15 @@ export interface IEnvTransportOptions {
|
||||
export type TOutputMode = 'bundle' | 'base64ts';
|
||||
export type TBundler = 'esbuild' | 'rolldown' | 'rspack';
|
||||
|
||||
export type TIncludeFile = string | { from: string; to: string };
|
||||
|
||||
export interface IBundleConfig {
|
||||
from: string;
|
||||
to: string;
|
||||
outputMode?: TOutputMode;
|
||||
bundler?: TBundler;
|
||||
production?: boolean;
|
||||
includeFiles?: string[];
|
||||
includeFiles?: TIncludeFile[];
|
||||
maxLineLength?: number; // For base64ts output: max chars per line. 0 or undefined = unlimited (default)
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ export class CustomBundleHandler {
|
||||
/**
|
||||
* Process a single bundle configuration
|
||||
*/
|
||||
private async processSingleBundle(bundleConfig: interfaces.IBundleConfig): Promise<void> {
|
||||
public async processSingleBundle(bundleConfig: interfaces.IBundleConfig): Promise<void> {
|
||||
const outputMode = bundleConfig.outputMode || 'bundle';
|
||||
const bundler = bundleConfig.bundler || 'esbuild';
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -171,7 +176,8 @@ export class CustomBundleHandler {
|
||||
|
||||
for (const entry of entries) {
|
||||
if (!entry.isDirectory && regex.test(entry.name)) {
|
||||
const fullPath = plugins.path.join(dirPath, entry.path);
|
||||
// entry.path is already absolute from smartfs
|
||||
const fullPath = entry.path;
|
||||
const relativePath = plugins.path.relative(this.cwd, fullPath);
|
||||
const destPath = plugins.path.join(outputDir, plugins.path.basename(entry.path));
|
||||
await plugins.fs.directory(plugins.path.dirname(destPath)).create();
|
||||
|
||||
@@ -43,6 +43,7 @@ export class TsBundleProcess {
|
||||
sourcemap: true,
|
||||
format: 'esm',
|
||||
target: 'es2022',
|
||||
keepNames: true,
|
||||
entryNames: plugins.path.parse(toArg).name,
|
||||
outdir: plugins.path.parse(toArg).dir,
|
||||
splitting: false,
|
||||
@@ -67,6 +68,7 @@ export class TsBundleProcess {
|
||||
format: 'esm',
|
||||
target: 'es2022',
|
||||
minify: true,
|
||||
keepNames: true,
|
||||
entryNames: plugins.path.parse(toArg).name,
|
||||
outdir: plugins.path.parse(toArg).dir,
|
||||
tsconfig: paths.tsconfigPath,
|
||||
|
||||
@@ -123,7 +123,8 @@ export class InitHandler {
|
||||
console.log(` Mode: ${bundle.outputMode || 'bundle'}`);
|
||||
console.log(` Bundler: ${bundle.bundler || 'esbuild'}`);
|
||||
if (bundle.includeFiles && bundle.includeFiles.length > 0) {
|
||||
console.log(` Include: ${bundle.includeFiles.join(', ')}`);
|
||||
const display = bundle.includeFiles.map(f => typeof f === 'string' ? f : `${f.from} -> ${f.to}`);
|
||||
console.log(` Include: ${display.join(', ')}`);
|
||||
}
|
||||
console.log('');
|
||||
});
|
||||
@@ -168,7 +169,8 @@ export class InitHandler {
|
||||
console.log(` Mode: ${preset.config.outputMode}`);
|
||||
console.log(` Bundler: ${preset.config.bundler}`);
|
||||
if (preset.config.includeFiles && preset.config.includeFiles.length > 0) {
|
||||
console.log(` Include: ${preset.config.includeFiles.join(', ')}`);
|
||||
const display = preset.config.includeFiles.map(f => typeof f === 'string' ? f : `${f.from} -> ${f.to}`);
|
||||
console.log(` Include: ${display.join(', ')}`);
|
||||
}
|
||||
|
||||
const confirmInteract = new plugins.smartinteract.SmartInteract();
|
||||
@@ -293,14 +295,14 @@ export class InitHandler {
|
||||
/**
|
||||
* Configure files to include
|
||||
*/
|
||||
private async configureIncludeFiles(prefill?: string[]): Promise<string[]> {
|
||||
const includeFiles: string[] = [];
|
||||
private async configureIncludeFiles(prefill?: interfaces.TIncludeFile[]): Promise<interfaces.TIncludeFile[]> {
|
||||
const includeFiles: interfaces.TIncludeFile[] = [];
|
||||
let addMore = true;
|
||||
|
||||
// If we have prefilled values, show them first
|
||||
if (prefill && prefill.length > 0) {
|
||||
console.log('\nPre-configured include patterns:');
|
||||
prefill.forEach((p) => console.log(` - ${p}`));
|
||||
prefill.forEach((p) => console.log(` - ${typeof p === 'string' ? p : `${p.from} -> ${p.to}`}`));
|
||||
|
||||
const keepInteract = new plugins.smartinteract.SmartInteract();
|
||||
keepInteract.addQuestions([
|
||||
|
||||
@@ -22,6 +22,20 @@ export class Base64TsOutput {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file with a custom serve path
|
||||
*/
|
||||
public async addFileWithServePath(fromPath: string, servePath: string): Promise<void> {
|
||||
const absolutePath = plugins.smartpath.transform.toAbsolute(fromPath, this.cwd) as string;
|
||||
const fileExists = await plugins.fs.file(absolutePath).exists();
|
||||
if (!fileExists) {
|
||||
console.log(`File does not exist: ${absolutePath}`);
|
||||
return;
|
||||
}
|
||||
const content = await plugins.fs.file(absolutePath).read();
|
||||
this.addFile(servePath, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add files matching a glob pattern
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user