feat(core): Integrate Rolldown as optional bundler, migrate filesystem to smartfs, and update bundler/tooling
This commit is contained in:
93
readme.md
93
readme.md
@@ -2,6 +2,10 @@
|
||||
|
||||
A powerful multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects.
|
||||
|
||||
## Issue Reporting and Security
|
||||
|
||||
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
@@ -41,22 +45,17 @@ const bundler = new TsBundle();
|
||||
|
||||
// Basic usage
|
||||
await bundler.build(
|
||||
process.cwd(), // working directory
|
||||
'./src/index.ts', // entry point
|
||||
'./dist/bundle.js', // output file
|
||||
{ bundler: 'esbuild' } // options
|
||||
process.cwd(), // working directory
|
||||
'./src/index.ts', // entry point
|
||||
'./dist/bundle.js', // output file
|
||||
{ bundler: 'esbuild' }, // options
|
||||
);
|
||||
|
||||
// Production build with rolldown
|
||||
await bundler.build(
|
||||
process.cwd(),
|
||||
'./src/index.ts',
|
||||
'./dist/bundle.min.js',
|
||||
{
|
||||
bundler: 'rolldown',
|
||||
production: true
|
||||
}
|
||||
);
|
||||
await bundler.build(process.cwd(), './src/index.ts', './dist/bundle.min.js', {
|
||||
bundler: 'rolldown',
|
||||
production: true,
|
||||
});
|
||||
```
|
||||
|
||||
## Available Bundlers
|
||||
@@ -141,9 +140,9 @@ await bundler.build(
|
||||
```typescript
|
||||
interface ICliOptions {
|
||||
bundler: 'esbuild' | 'rolldown' | 'rspack'; // Bundler to use
|
||||
production?: boolean; // Enable production optimizations
|
||||
commonjs?: boolean; // Output CommonJS format
|
||||
skiplibcheck?: boolean; // Skip TypeScript lib checking
|
||||
production?: boolean; // Enable production optimizations
|
||||
commonjs?: boolean; // Output CommonJS format
|
||||
skiplibcheck?: boolean; // Skip TypeScript lib checking
|
||||
}
|
||||
```
|
||||
|
||||
@@ -161,9 +160,9 @@ const exists = await htmlHandler.checkIfExists();
|
||||
|
||||
// Process HTML with options
|
||||
await htmlHandler.processHtml({
|
||||
from: './src/index.html', // Source HTML (default: './html/index.html')
|
||||
to: './dist/index.html', // Output HTML (default: './dist_serve/index.html')
|
||||
minify: true // Enable minification
|
||||
from: './src/index.html', // Source HTML (default: './html/index.html')
|
||||
to: './dist/index.html', // Output HTML (default: './dist_serve/index.html')
|
||||
minify: true, // Enable minification
|
||||
});
|
||||
```
|
||||
|
||||
@@ -181,8 +180,8 @@ await assetsHandler.ensureAssetsDir();
|
||||
|
||||
// Copy and process assets
|
||||
await assetsHandler.processAssets({
|
||||
from: './src/assets', // Source directory (default: './assets')
|
||||
to: './dist/assets' // Output directory (default: './dist_serve/assets')
|
||||
from: './src/assets', // Source directory (default: './assets')
|
||||
to: './dist/assets', // Output directory (default: './dist_serve/assets')
|
||||
});
|
||||
```
|
||||
|
||||
@@ -197,31 +196,26 @@ async function buildWebApp() {
|
||||
const bundler = new TsBundle();
|
||||
const htmlHandler = new HtmlHandler();
|
||||
const assetsHandler = new AssetsHandler();
|
||||
|
||||
|
||||
// Bundle the JavaScript
|
||||
await bundler.build(
|
||||
process.cwd(),
|
||||
'./src/app.ts',
|
||||
'./dist/app.js',
|
||||
{
|
||||
bundler: 'rolldown',
|
||||
production: true
|
||||
}
|
||||
);
|
||||
|
||||
await bundler.build(process.cwd(), './src/app.ts', './dist/app.js', {
|
||||
bundler: 'rolldown',
|
||||
production: true,
|
||||
});
|
||||
|
||||
// Process HTML
|
||||
await htmlHandler.processHtml({
|
||||
from: './src/index.html',
|
||||
to: './dist/index.html',
|
||||
minify: true
|
||||
minify: true,
|
||||
});
|
||||
|
||||
|
||||
// Copy assets
|
||||
await assetsHandler.processAssets({
|
||||
from: './src/assets',
|
||||
to: './dist/assets'
|
||||
to: './dist/assets',
|
||||
});
|
||||
|
||||
|
||||
console.log('Build complete!');
|
||||
}
|
||||
|
||||
@@ -238,16 +232,13 @@ async function buildMultipleEntries() {
|
||||
const entries = [
|
||||
{ from: './src/main.ts', to: './dist/main.js' },
|
||||
{ from: './src/admin.ts', to: './dist/admin.js' },
|
||||
{ from: './src/worker.ts', to: './dist/worker.js' }
|
||||
{ from: './src/worker.ts', to: './dist/worker.js' },
|
||||
];
|
||||
|
||||
|
||||
for (const entry of entries) {
|
||||
await bundler.build(
|
||||
process.cwd(),
|
||||
entry.from,
|
||||
entry.to,
|
||||
{ bundler: 'esbuild' }
|
||||
);
|
||||
await bundler.build(process.cwd(), entry.from, entry.to, {
|
||||
bundler: 'esbuild',
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -264,11 +255,11 @@ await bundler.build(
|
||||
process.cwd(),
|
||||
'./src/index.ts',
|
||||
isDev ? './dist/dev/bundle.js' : './dist/prod/bundle.min.js',
|
||||
{
|
||||
bundler: isDev ? 'esbuild' : 'rolldown', // esbuild for speed in dev
|
||||
production: !isDev, // minify in production
|
||||
commonjs: false // use ES modules
|
||||
}
|
||||
{
|
||||
bundler: isDev ? 'esbuild' : 'rolldown', // esbuild for speed in dev
|
||||
production: !isDev, // minify in production
|
||||
commonjs: false, // use ES modules
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
@@ -293,7 +284,7 @@ tsbundle works best with the following TypeScript configuration:
|
||||
|
||||
1. **Entry Points**: Keep your entry points in `ts_web/` for web bundles or `ts/` for library bundles
|
||||
2. **Output Structure**: Use `dist_bundle/` for bundled files and `dist_serve/` for web-ready files
|
||||
3. **Bundler Selection**:
|
||||
3. **Bundler Selection**:
|
||||
- Use `esbuild` for development (fastest)
|
||||
- Use `rolldown` or `rspack` for production (better optimization)
|
||||
4. **Assets**: Place static assets in the `assets/` directory
|
||||
@@ -316,4 +307,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
||||
Reference in New Issue
Block a user