feat(core): Integrate Rolldown as optional bundler, migrate filesystem to smartfs, and update bundler/tooling
This commit is contained in:
@@ -15,7 +15,10 @@
|
||||
|
||||
<!--Lets make sure we support older browsers-->
|
||||
<script src=" https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<!--Lets avoid a rescaling flicker due to default body margins-->
|
||||
<style>
|
||||
@@ -62,13 +65,11 @@
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
We need JavaScript to run properly!
|
||||
</div>
|
||||
<div class="header">We need JavaScript to run properly!</div>
|
||||
<div class="content">
|
||||
This site is being built using lit-element (made by Google). This technology works with
|
||||
JavaScript. Subsequently this website does not work as intended by Lossless GmbH without
|
||||
JavaScript.
|
||||
This site is being built using lit-element (made by Google). This
|
||||
technology works with JavaScript. Subsequently this website does not
|
||||
work as intended by Lossless GmbH without JavaScript.
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
|
||||
@@ -7,7 +7,7 @@ function sealed(constructor: Function) {
|
||||
@sealed
|
||||
class TestClass {
|
||||
name = 'test';
|
||||
|
||||
|
||||
modify() {
|
||||
this.name = 'modified';
|
||||
}
|
||||
@@ -31,11 +31,14 @@ try {
|
||||
|
||||
// Test that we can't add to prototype
|
||||
try {
|
||||
(TestClass.prototype as any).newMethod = function() {};
|
||||
(TestClass.prototype as any).newMethod = function () {};
|
||||
console.log('Prototype is NOT sealed (unexpected)');
|
||||
} catch (e) {
|
||||
console.log('Prototype is sealed (expected)');
|
||||
}
|
||||
|
||||
console.log('Is TestClass sealed?', Object.isSealed(TestClass));
|
||||
console.log('Is TestClass.prototype sealed?', Object.isSealed(TestClass.prototype));
|
||||
console.log(
|
||||
'Is TestClass.prototype sealed?',
|
||||
Object.isSealed(TestClass.prototype),
|
||||
);
|
||||
|
||||
32
test/test.ts
32
test/test.ts
@@ -3,16 +3,19 @@ import * as tsbundle from '../dist_ts/index.js';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const testBundler = async (bundlerName: 'esbuild' | 'rolldown' | 'rspack', mode: 'test' | 'production') => {
|
||||
const testBundler = async (
|
||||
bundlerName: 'esbuild' | 'rolldown' | 'rspack',
|
||||
mode: 'test' | 'production',
|
||||
) => {
|
||||
const outputFile = `./dist_manual/${bundlerName}-${mode}.js`;
|
||||
const testDir = path.join(process.cwd(), 'test');
|
||||
|
||||
|
||||
// Clean up output directory
|
||||
const outputDir = path.join(testDir, 'dist_manual');
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
|
||||
|
||||
// Clean up output file if exists
|
||||
const outputPath = path.join(testDir, outputFile);
|
||||
if (fs.existsSync(outputPath)) {
|
||||
@@ -20,19 +23,14 @@ const testBundler = async (bundlerName: 'esbuild' | 'rolldown' | 'rspack', mode:
|
||||
}
|
||||
|
||||
const tsbundleInstance = new tsbundle.TsBundle();
|
||||
await tsbundleInstance.build(
|
||||
testDir,
|
||||
'./ts_web/index.ts',
|
||||
outputFile,
|
||||
{
|
||||
bundler: bundlerName,
|
||||
production: mode === 'production'
|
||||
}
|
||||
);
|
||||
await tsbundleInstance.build(testDir, './ts_web/index.ts', outputFile, {
|
||||
bundler: bundlerName,
|
||||
production: mode === 'production',
|
||||
});
|
||||
|
||||
// Verify output file was created
|
||||
expect(fs.existsSync(outputPath)).toBeTrue();
|
||||
|
||||
|
||||
console.log(`✅ ${bundlerName} ${mode} mode: success`);
|
||||
};
|
||||
|
||||
@@ -69,7 +67,7 @@ tap.test('should show bundle size comparison', async () => {
|
||||
const sizes: Record<string, { test: number; production: number }> = {
|
||||
esbuild: { test: 0, production: 0 },
|
||||
rolldown: { test: 0, production: 0 },
|
||||
rspack: { test: 0, production: 0 }
|
||||
rspack: { test: 0, production: 0 },
|
||||
};
|
||||
|
||||
for (const bundler of ['esbuild', 'rolldown', 'rspack'] as const) {
|
||||
@@ -89,10 +87,12 @@ tap.test('should show bundle size comparison', async () => {
|
||||
for (const bundler of ['esbuild', 'rolldown', 'rspack'] as const) {
|
||||
const testSize = (sizes[bundler].test / 1024).toFixed(1) + ' KB';
|
||||
const prodSize = (sizes[bundler].production / 1024).toFixed(1) + ' KB';
|
||||
console.log(`│ ${bundler.padEnd(11)} │ ${testSize.padEnd(10)} │ ${prodSize.padEnd(12)} │`);
|
||||
console.log(
|
||||
`│ ${bundler.padEnd(11)} │ ${testSize.padEnd(10)} │ ${prodSize.padEnd(12)} │`,
|
||||
);
|
||||
}
|
||||
console.log('└─────────────┴────────────┴──────────────┘');
|
||||
|
||||
|
||||
// Verify all sizes are reasonable
|
||||
for (const bundler of ['esbuild', 'rolldown', 'rspack'] as const) {
|
||||
expect(sizes[bundler].test).toBeGreaterThan(0);
|
||||
|
||||
@@ -19,6 +19,4 @@ class BugReport {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(myConst);
|
||||
|
||||
@@ -19,9 +19,7 @@ export class MyElement extends LitElement {
|
||||
render() {
|
||||
return html`
|
||||
<h1>Hello, ${this.name}!</h1>
|
||||
<button @click=${this._onClick}>
|
||||
Click Count: ${this.count}
|
||||
</button>
|
||||
<button @click=${this._onClick}>Click Count: ${this.count}</button>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -34,4 +32,4 @@ export class MyElement extends LitElement {
|
||||
const element = new MyElement();
|
||||
console.log('Element created:', element);
|
||||
console.log('Element name:', element.name);
|
||||
console.log('Element count:', element.count);
|
||||
console.log('Element count:', element.count);
|
||||
|
||||
Reference in New Issue
Block a user