Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a550d6e450 | |||
| 201f8aca38 |
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-01-12 - 2.7.3 - fix(mod_output)
|
||||
wrap long base64 file contents and format generated TypeScript output to avoid extremely long lines
|
||||
|
||||
- Introduce MAX_LINE_LENGTH (200) and formatBase64 to split long base64 strings into chunks and join them with string concatenation
|
||||
- Emit the files array as nicely indented object entries instead of a single JSON.stringify output to improve readability and avoid extremely long lines
|
||||
|
||||
## 2026-01-12 - 2.7.2 - fix(readme)
|
||||
update README to add interactive setup (tsbundle init), expand quick start and usage examples, include pnpm install, document embedding/base64ts output with Deno example, add project structure recommendations, and clarify license/trademark wording
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@git.zone/tsbundle",
|
||||
"version": "2.7.2",
|
||||
"version": "2.7.3",
|
||||
"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.7.2',
|
||||
version: '2.7.3',
|
||||
description: 'a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects'
|
||||
}
|
||||
|
||||
@@ -79,9 +79,32 @@ export class Base64TsOutput {
|
||||
* Generate TypeScript file content
|
||||
*/
|
||||
public generateTypeScript(): string {
|
||||
const filesJson = JSON.stringify(this.files, null, 2);
|
||||
const MAX_LINE_LENGTH = 200;
|
||||
|
||||
const formatBase64 = (base64: string): string => {
|
||||
if (base64.length <= MAX_LINE_LENGTH) {
|
||||
return `"${base64}"`;
|
||||
}
|
||||
|
||||
const chunks: string[] = [];
|
||||
for (let i = 0; i < base64.length; i += MAX_LINE_LENGTH) {
|
||||
chunks.push(base64.slice(i, i + MAX_LINE_LENGTH));
|
||||
}
|
||||
|
||||
return `"" +\n "${chunks.join('" +\n "')}"`;
|
||||
};
|
||||
|
||||
const filesFormatted = this.files.map(file => {
|
||||
return ` {
|
||||
"path": "${file.path}",
|
||||
"contentBase64": ${formatBase64(file.contentBase64)}
|
||||
}`;
|
||||
}).join(',\n');
|
||||
|
||||
return `// Auto-generated by tsbundle - do not edit
|
||||
export const files: { path: string; contentBase64: string }[] = ${filesJson};
|
||||
export const files: { path: string; contentBase64: string }[] = [
|
||||
${filesFormatted}
|
||||
];
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user