Compare commits

...

2 Commits
v2.9.3 ... main

Author SHA1 Message Date
7f5de8797c v2.10.0
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-24 18:15:30 +00:00
aea86bd8f5 feat(config): migrate project configuration to smartconfig.json and update bundler dependencies 2026-03-24 18:15:30 +00:00
14 changed files with 1678 additions and 2343 deletions

View File

@@ -5,7 +5,7 @@
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "gitzone", "gitscope": "gitzone",
"gitrepo": "tsbundle", "gitrepo": "tsbundle",
"description": "a bundler using rollup for painless bundling of web projects", "description": "a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects",
"npmPackagename": "@git.zone/tsbundle", "npmPackagename": "@git.zone/tsbundle",
"license": "MIT", "license": "MIT",
"projectDomain": "git.zone" "projectDomain": "git.zone"

View File

@@ -1,7 +1,7 @@
{ {
"json.schemas": [ "json.schemas": [
{ {
"fileMatch": ["/npmextra.json"], "fileMatch": ["/smartconfig.json"],
"schema": { "schema": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## 2026-03-24 - 2.10.0 - feat(config)
migrate project configuration to smartconfig.json and update bundler dependencies
- replace npmextra.json with .smartconfig.json and update CLI, init, and custom bundle loading references
- rename the smartconfig plugin export and load tsbundle configuration through the new config file
- update rolldown output settings to use codeSplitting: false instead of the deprecated inlineDynamicImports option
- refresh core build and bundler dependencies including rolldown, rspack, esbuild, TypeScript, and smartfs
- revise README documentation to reflect smartconfig.json usage and current bundler capabilities
## 2026-03-24 - 2.9.3 - fix(config) ## 2026-03-24 - 2.9.3 - fix(config)
migrate configuration loading and init output from npmextra.json to smartconfig.json migrate configuration loading and init output from npmextra.json to smartconfig.json

View File

@@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tsbundle", "name": "@git.zone/tsbundle",
"version": "2.9.3", "version": "2.10.0",
"private": false, "private": false,
"description": "a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects", "description": "a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@@ -17,29 +17,29 @@
"tsbundle": "cli.js" "tsbundle": "cli.js"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^3.1.2", "@git.zone/tsbuild": "^4.3.0",
"@git.zone/tsrun": "^2.0.0", "@git.zone/tsrun": "^2.0.1",
"@git.zone/tstest": "^3.1.3", "@git.zone/tstest": "^3.5.1",
"@types/node": "^24.10.1" "@types/node": "^25.5.0"
}, },
"dependencies": { "dependencies": {
"@push.rocks/early": "^4.0.4", "@push.rocks/early": "^4.0.4",
"@push.rocks/smartconfig": "^6.0.0", "@push.rocks/smartconfig": "^6.0.1",
"@push.rocks/smartcli": "^4.0.20", "@push.rocks/smartcli": "^4.0.20",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfs": "^1.1.3", "@push.rocks/smartfs": "^1.5.0",
"@push.rocks/smartinteract": "^2.0.16", "@push.rocks/smartinteract": "^2.0.16",
"@push.rocks/smartlog": "^3.1.8", "@push.rocks/smartlog": "^3.2.1",
"@push.rocks/smartlog-destination-local": "^9.0.2", "@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartpath": "^6.0.0", "@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3", "@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartspawn": "^3.0.3", "@push.rocks/smartspawn": "^3.0.3",
"@rspack/core": "^1.6.5", "@rspack/core": "^1.7.10",
"@types/html-minifier": "^4.0.6", "@types/html-minifier": "^4.0.6",
"esbuild": "^0.27.0", "esbuild": "^0.27.4",
"html-minifier": "^4.0.0", "html-minifier": "^4.0.0",
"rolldown": "1.0.0-beta.52", "rolldown": "1.0.0-rc.11",
"typescript": "5.9.3" "typescript": "6.0.2"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@@ -50,7 +50,7 @@
"dist_ts_web/**/*", "dist_ts_web/**/*",
"assets/**/*", "assets/**/*",
"cli.js", "cli.js",
"npmextra.json", ".smartconfig.json",
"readme.md" "readme.md"
], ],
"browserslist": [ "browserslist": [

3777
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,15 @@
# tsbundle Hints and Findings # tsbundle Hints and Findings
## Recent Updates (2025-11-23) ## Recent Updates (2026-03-24)
- Migrated from @push.rocks/smartfile v11 to @push.rocks/smartfs v1.1.0 - Upgraded all dependencies to latest versions
- All filesystem operations now use async smartfs API - Migrated from npmextra.json to smartconfig.json (renamed file, updated all references)
- Removed @push.rocks/tapbundle (now imported from @git.zone/tstest/tapbundle) - Renamed `npmextra` import to `smartconfig` in plugins.ts
- All bundlers (esbuild, rolldown, rspack) updated to latest versions - Fixed rolldown deprecation: `inlineDynamicImports` replaced with `codeSplitting: false`
- Removed deprecated rolldown experimental.enableComposingJsPlugins option - Major version bumps: tsbuild ^3.1.2 -> ^4.3.0, TypeScript 5.9.3 -> 6.0.2
- Rolldown upgraded from 1.0.0-beta.52 to 1.0.0-rc.11
- @rspack/core upgraded from ^1.6.5 to ^1.7.10
- @types/node upgraded from ^24.10.1 to ^25.5.0
## Bundler Architecture ## Bundler Architecture
@@ -16,41 +19,16 @@
## Bundler Implementations ## Bundler Implementations
- **esbuild** (default): Fully implemented, production ready, 3.9K minified - **esbuild** (default): Fully implemented, production ready
- **rolldown**: Implemented and working (beta v1.0.0-beta.51), produces smallest bundles (1.0K minified) - **rolldown**: Implemented and working (1.0.0-rc.11), produces smallest bundles
- **rspack**: Implemented and working (v1.6.4), webpack-compatible API, 6.3K minified - **rspack**: Implemented and working (v1.7.10), webpack-compatible API
- **rollup**: Removed (was never implemented)
- **parcel**: Removed (was never implemented)
## Adding New Bundlers ## Configuration
To add a new bundler, you need: - Config file: `smartconfig.json` (previously `npmextra.json`)
- Config key: `@git.zone/tsbundle` with `bundles` array
1. Update `ICliOptions` interface to include the bundler name - Supports `bundle` and `base64ts` output modes
2. Add case in `getBundlerPath()` switch statement - Interactive init wizard via `tsbundle init`
3. Create `mod_<bundler>/` directory with:
- `plugins.ts`: Import and re-export the bundler
- `index.child.ts`: Implement TsBundleProcess class with buildTest() and buildProduction()
4. Add bundler to package.json dependencies
## Rolldown Specific Notes
- Rolldown is in beta (v1.0.0-beta.18) but working well
- API: Use `rolldown()` function directly, not `rolldown.rolldown()`
- Output options go in the `write()` method, not the initial config
- Uses `dir` and `entryFileNames` instead of `file` for output (handles dynamic imports)
- Includes `inlineDynamicImports: true` to avoid chunk splitting issues
- Produces smaller minified bundles than esbuild (1.5K vs 2.2K in tests)
- Supports TypeScript via `resolve.tsconfigFilename`
## Rspack Specific Notes
- Rspack v1.3.15 - stable and production ready
- Uses webpack-compatible API (callback-based)
- Built-in SWC loader for TypeScript transpilation
- Produces larger bundles than esbuild/rolldown due to webpack runtime overhead
- Best choice if you need webpack compatibility or advanced features
- Supports ES modules output via `experiments.outputModule: true`
## CLI Usage ## CLI Usage
@@ -61,5 +39,4 @@ To add a new bundler, you need:
## Known Issues ## Known Issues
- esbuild recently had splitting and tree-shaking disabled due to issues - Rolldown emits a warning about `preserveValueImports` in tsconfig - this is informational only
- The README still mentions "a bundler using rollup" but uses esbuild by default

124
readme.md
View File

@@ -1,6 +1,6 @@
# @git.zone/tsbundle # @git.zone/tsbundle
A powerful multi-bundler tool supporting **esbuild**, **rolldown**, and **rspack** for painless bundling of web projects. 🚀 A powerful multi-bundler tool supporting **esbuild**, **rolldown**, and **rspack** for painless bundling of web projects.
## Issue Reporting and Security ## Issue Reporting and Security
@@ -10,16 +10,13 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
```bash ```bash
# Global installation for CLI usage # Global installation for CLI usage
npm install -g @git.zone/tsbundle pnpm add -g @git.zone/tsbundle
# Local installation for project usage # Local installation for project usage
npm install --save-dev @git.zone/tsbundle pnpm add --save-dev @git.zone/tsbundle
# Or with pnpm
pnpm add -g @git.zone/tsbundle
``` ```
## Quick Start ## Quick Start
### Interactive Setup ### Interactive Setup
@@ -29,11 +26,11 @@ The easiest way to get started is with the interactive wizard:
tsbundle init tsbundle init
``` ```
This will guide you through setting up your bundle configuration with preset options: This guides you through setting up your bundle configuration with preset options:
- **element** - Web component / element bundle (`./ts_web/index.ts` `./dist_bundle/bundle.js`) - **element** - Web component / element bundle (`./ts_web/index.ts` -> `./dist_bundle/bundle.js`)
- **website** - Full website with HTML and assets (`./ts_web/index.ts` `./dist_serve/bundle.js`) - **website** - Full website with HTML and assets (`./ts_web/index.ts` -> `./dist_serve/bundle.js`)
- **npm** - NPM package bundle (`./ts/index.ts` `./dist_bundle/bundle.js`) - **npm** - NPM package bundle (`./ts/index.ts` -> `./dist_bundle/bundle.js`)
- **custom** - Configure everything manually - **custom** - Configure everything manually
### Build Your Bundles ### Build Your Bundles
@@ -44,19 +41,19 @@ Once configured, simply run:
tsbundle tsbundle
``` ```
That's it! Your bundles will be built according to your `npmextra.json` configuration. Your bundles will be built according to your `smartconfig.json` configuration.
## CLI Commands ## CLI Commands
| Command | Description | | Command | Description |
|---------|-------------| |---------|-------------|
| `tsbundle` | Build all bundles from `npmextra.json` configuration | | `tsbundle` | Build all bundles from `smartconfig.json` configuration |
| `tsbundle custom` | Same as above (explicit) | | `tsbundle custom` | Same as above (explicit) |
| `tsbundle init` | Interactive wizard to create/update bundle configuration | | `tsbundle init` | Interactive wizard to create/update bundle configuration |
## Configuration 📝 ## Configuration
tsbundle uses `npmextra.json` for configuration. Here's an example: tsbundle uses `smartconfig.json` for configuration. Here's an example:
```json ```json
{ {
@@ -109,22 +106,24 @@ export const files: { path: string; contentBase64: string }[] = [
]; ];
``` ```
**Tip:** If you're working with AI tools that have line length limitations, set `maxLineLength` (e.g., `200`) to split long base64 strings across multiple lines. If you're working with AI tools that have line length limitations, set `maxLineLength` (e.g., `200`) to split long base64 strings across multiple lines.
## Available Bundlers 🔧 ## Available Bundlers
tsbundle supports three modern bundlers: tsbundle supports three modern bundlers, each with different strengths:
| Bundler | Speed | Best For | | Bundler | Speed | Bundle Size | Best For |
|---------|-------|----------| |---------|-------|-------------|----------|
| **esbuild** | ⚡⚡⚡ Blazing fast | Development, quick iterations | | **esbuild** | Fastest | Medium | Development, quick iterations |
| **rolldown** | ⚡⚡ Fast | Production builds, tree-shaking | | **rolldown** | Fast | Smallest | Production builds, tree-shaking |
| **rspack** | ⚡⚡ Fast | Webpack compatibility | | **rspack** | Fast | Largest (webpack runtime) | Webpack compatibility |
## API Usage ## API Usage
### TsBundle Class ### TsBundle Class
The core bundling class, usable programmatically:
```typescript ```typescript
import { TsBundle } from '@git.zone/tsbundle'; import { TsBundle } from '@git.zone/tsbundle';
@@ -135,15 +134,17 @@ await bundler.build(
'./src/index.ts', // Entry point './src/index.ts', // Entry point
'./dist/bundle.js', // Output path './dist/bundle.js', // Output path
{ {
bundler: 'esbuild', bundler: 'esbuild', // 'esbuild' | 'rolldown' | 'rspack'
production: true production: true
} }
); );
``` ```
Each bundler runs in a separate child process via `smartspawn.ThreadSimple`, keeping the main process clean and isolated from bundler-specific dependencies.
### HtmlHandler Class ### HtmlHandler Class
Process and minify HTML files: Process and optionally minify HTML files:
```typescript ```typescript
import { HtmlHandler } from '@git.zone/tsbundle'; import { HtmlHandler } from '@git.zone/tsbundle';
@@ -159,7 +160,7 @@ await htmlHandler.processHtml({
### AssetsHandler Class ### AssetsHandler Class
Handle static assets: Copy static assets between directories:
```typescript ```typescript
import { AssetsHandler } from '@git.zone/tsbundle'; import { AssetsHandler } from '@git.zone/tsbundle';
@@ -172,59 +173,34 @@ await assetsHandler.processAssets({
}); });
``` ```
## Complete Example 🎯 ### Base64TsOutput Class
### 1. Initialize your project Generate TypeScript files with base64-encoded content for embedding:
```bash
tsbundle init
```
Select "website" preset for a full web application setup.
### 2. Your generated config
```json
{
"@git.zone/tsbundle": {
"bundles": [
{
"from": "./ts_web/index.ts",
"to": "./dist_serve/bundle.js",
"outputMode": "bundle",
"bundler": "esbuild",
"includeFiles": ["./html/**/*.html", "./assets/**/*"]
}
]
}
}
```
### 3. Create your entry point
```typescript ```typescript
// ts_web/index.ts import { Base64TsOutput } from '@git.zone/tsbundle';
console.log('Hello from tsbundle! 🚀');
export const app = { const output = new Base64TsOutput(process.cwd());
version: '1.0.0', output.addFile('bundle.js', bundleBuffer);
init() { await output.addFilesFromGlob('./html/**/*.html');
console.log('App initialized'); await output.writeToFile('./ts/embedded-bundle.ts', 200); // optional maxLineLength
```
### CustomBundleHandler Class
Process multiple bundle configurations from `smartconfig.json`:
```typescript
import { CustomBundleHandler } from '@git.zone/tsbundle';
const handler = new CustomBundleHandler(process.cwd());
const hasConfig = await handler.loadConfig();
if (hasConfig) {
await handler.processAllBundles();
} }
};
app.init();
``` ```
### 4. Build ## Embedding for Deno Compile
```bash
tsbundle
```
Your bundle is ready in `./dist_serve/bundle.js` along with any HTML and assets!
## Embedding for Deno Compile 🦕
For single-executable scenarios with Deno: For single-executable scenarios with Deno:
@@ -264,7 +240,7 @@ const bundleContent = atob(bundle.contentBase64);
const htmlContent = atob(html.contentBase64); const htmlContent = atob(html.contentBase64);
``` ```
## Project Structure Recommendations 📁 ## Project Structure Recommendations
``` ```
your-project/ your-project/
@@ -277,7 +253,7 @@ your-project/
├── assets/ # Static assets (images, fonts, etc.) ├── assets/ # Static assets (images, fonts, etc.)
├── dist_bundle/ # Output for element/npm bundles ├── dist_bundle/ # Output for element/npm bundles
├── dist_serve/ # Output for website bundles ├── dist_serve/ # Output for website bundles
└── npmextra.json # tsbundle configuration └── smartconfig.json # tsbundle configuration
``` ```
## License and Legal Information ## License and Legal Information

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tsbundle', name: '@git.zone/tsbundle',
version: '2.9.3', version: '2.10.0',
description: 'a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects' description: 'a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects'
} }

View File

@@ -16,11 +16,11 @@ export class CustomBundleHandler {
} }
/** /**
* Load configuration from npmextra.json * Load configuration from smartconfig.json
*/ */
public async loadConfig(): Promise<boolean> { public async loadConfig(): Promise<boolean> {
const npmextraInstance = new plugins.npmextra.Smartconfig(this.cwd); const smartconfigInstance = new plugins.smartconfig.Smartconfig(this.cwd);
this.config = npmextraInstance.dataFor<interfaces.ITsbundleConfig>('@git.zone/tsbundle', { this.config = smartconfigInstance.dataFor<interfaces.ITsbundleConfig>('@git.zone/tsbundle', {
bundles: [], bundles: [],
}); });

View File

@@ -44,7 +44,7 @@ export class InitHandler {
} }
/** /**
* Load existing npmextra.json or create empty config * Load existing smartconfig.json or create empty config
*/ */
private async loadExistingConfig(): Promise<any> { private async loadExistingConfig(): Promise<any> {
const fileExists = await plugins.fs.file(this.smartconfigPath).exists(); const fileExists = await plugins.fs.file(this.smartconfigPath).exists();
@@ -60,7 +60,7 @@ export class InitHandler {
} }
/** /**
* Save config to npmextra.json * Save config to smartconfig.json
*/ */
private async saveConfig(config: any): Promise<void> { private async saveConfig(config: any): Promise<void> {
const content = JSON.stringify(config, null, 2); const content = JSON.stringify(config, null, 2);

View File

@@ -53,7 +53,7 @@ export class TsBundleProcess {
entryFileNames: outputFilename, entryFileNames: outputFilename,
format: 'es', format: 'es',
sourcemap: true, sourcemap: true,
inlineDynamicImports: true, codeSplitting: false,
}); });
} }
@@ -83,7 +83,7 @@ export class TsBundleProcess {
format: 'es', format: 'es',
sourcemap: true, sourcemap: true,
minify: true, minify: true,
inlineDynamicImports: true, codeSplitting: false,
}); });
} }
} }

View File

@@ -4,7 +4,7 @@ import * as path from 'path';
export { path }; export { path };
// pushrocks scope // pushrocks scope
import * as npmextra from '@push.rocks/smartconfig'; import * as smartconfig from '@push.rocks/smartconfig';
import * as smartcli from '@push.rocks/smartcli'; import * as smartcli from '@push.rocks/smartcli';
import * as smartfs from '@push.rocks/smartfs'; import * as smartfs from '@push.rocks/smartfs';
import * as smartinteract from '@push.rocks/smartinteract'; import * as smartinteract from '@push.rocks/smartinteract';
@@ -15,7 +15,7 @@ import * as smartpromise from '@push.rocks/smartpromise';
import * as smartspawn from '@push.rocks/smartspawn'; import * as smartspawn from '@push.rocks/smartspawn';
export { export {
npmextra, smartconfig,
smartcli, smartcli,
smartfs, smartfs,
smartinteract, smartinteract,

View File

@@ -5,7 +5,7 @@ import { runInit } from './mod_init/index.js';
export const runCli = async () => { export const runCli = async () => {
const tsBundleCli = new plugins.smartcli.Smartcli(); const tsBundleCli = new plugins.smartcli.Smartcli();
// Default command: run custom bundles from npmextra.json // Default command: run custom bundles from smartconfig.json
tsBundleCli.standardCommand().subscribe(async (argvArg) => { tsBundleCli.standardCommand().subscribe(async (argvArg) => {
await runCustomBundles(); await runCustomBundles();
}); });

View File

@@ -4,9 +4,7 @@
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"esModuleInterop": true, "esModuleInterop": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true
"baseUrl": ".",
"paths": {}
}, },
"exclude": ["dist_*/**/*.d.ts"] "exclude": ["dist_*/**/*.d.ts"]
} }