build: implement bundling system with Rollup

Phase 1-3 Complete:
-  Installed Rollup with all required plugins
-  Created rollup.config.js for UMD, ESM, CJS builds
-  Created src/index.js entry point
-  Created src/styles.css for CSS bundling
-  Added ES6 exports to debug-system.js
-  Excluded Node.js-only html-generator.js from bundle

Build outputs:
- dist/testdrive-jsui.js (217KB UMD)
- dist/testdrive-jsui.min.js (107KB minified!)
- dist/testdrive-jsui.esm.js (199KB ES Module)
- dist/testdrive-jsui.cjs.js (199KB CommonJS)
- dist/testdrive-jsui.css (minified, all styles inlined)

All builds include source maps for debugging.
This commit is contained in:
2025-12-16 22:42:37 +01:00
parent fd12bbd34a
commit a7856f4b20
6 changed files with 3021 additions and 23 deletions

59
src/index.js Normal file
View File

@@ -0,0 +1,59 @@
/**
* TestDrive-JSUI - Main Entry Point
*
* This file bundles all components into a single distributable library.
*
* @version 1.0.0
* @license MIT
*/
// Import CSS (will be extracted by postcss plugin)
import './styles.css';
// Core components (must be loaded first)
import '../js/core/debug-system.js';
import '../js/core/section-manager.js';
// UI Components
import '../js/components/dom-renderer.js';
import '../js/components/document-controls.js';
import '../js/components/debug-panel.js';
// Control panels
import '../js/controls/control-base.js';
import '../js/controls/edit-control.js';
import '../js/controls/debug-control.js';
import '../js/controls/status-control.js';
import '../js/controls/contents-control.js';
// Utilities
import '../js/config-loader.js';
// Note: html-generator.js is Node.js only (uses 'fs'), excluded from browser bundle
// Widgets (if needed)
import '../js/widgets/base/Widget.js';
import '../js/widgets/base/UIWidget.js';
import '../js/widgets/navigation/DocumentNavigator.js';
// Plugins
import '../js/plugins/document-navigator-plugin.js';
// Main library class
// Note: testdrive-jsui.js already exports in multiple formats
// We'll import it and re-export
// The main class is defined in testdrive-jsui.js
// Since all dependencies are loaded above, we can now load the main class
import '../js/testdrive-jsui.js';
// Get the TestDriveJSUI from window (set by testdrive-jsui.js)
// In UMD build, this will be available globally
const TestDriveJSUI = (typeof window !== 'undefined' && window.TestDriveJSUI)
|| (typeof global !== 'undefined' && global.TestDriveJSUI);
// Export for ES modules and CommonJS
export default TestDriveJSUI;
export { TestDriveJSUI };
// Export version
export const version = '1.0.0';

38
src/styles.css Normal file
View File

@@ -0,0 +1,38 @@
/**
* TestDrive-JSUI Styles
* Combined stylesheet for the markdown editor
*
* @version 1.0.0
* @license MIT
*/
/* Base editor styles */
@import '../static/css/editor.css';
/* Control panels */
@import '../static/css/controls.css';
/* Default theme (GitHub) */
@import '../static/css/themes/github.css';
/* CSS Variables and Base Styles */
:root {
--testdrive-primary-color: #0366d6;
--testdrive-border-color: #e1e4e8;
--testdrive-background: #ffffff;
--testdrive-text-color: #24292e;
--testdrive-hover-bg: #f6f8fa;
--testdrive-focus-shadow: rgba(3, 102, 214, 0.3);
}
.testdrive-container {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
line-height: 1.6;
color: var(--testdrive-text-color);
background: var(--testdrive-background);
}
/* Ensure smooth transitions */
* {
transition: background-color 0.2s ease, border-color 0.2s ease;
}