Skip to content

Experiment: Modularize nicegui.js with Rollup bundler - #115

Draft
evnchn wants to merge 1 commit into
mainfrom
temp/rollup-refactor
Draft

Experiment: Modularize nicegui.js with Rollup bundler#115
evnchn wants to merge 1 commit into
mainfrom
temp/rollup-refactor

Conversation

@evnchn

@evnchn evnchn commented Mar 29, 2026

Copy link
Copy Markdown
Owner

What this branch does

Splits the monolithic nicegui.js into the same organized ES modules as the esbuild branch (app.js, colors.js, constants.js, elements.js, events.js, render.js, utils.js, quasar-hack.js) but uses Rollup as the bundler. Outputs IIFE format with beautified output for debugging, external Vue/Quasar/Socket.IO dependencies, and adds a pre-commit hook to auto-rebuild on JS changes.

Status

Experimental — one of two paired JS bundler experiments (see also: temp/esbuild-refactor). This branch uses Rollup. Together they allow comparing bundler ergonomics and output for the same modularization.

Files changed

17 files, key additions: nicegui/static/src/*.js (8 modules), nicegui/static/rollup.config.mjs, nicegui/static/package.json

Upstream PR

None yet

- Split monolithic nicegui.js into organized modules in src/
  - colors.js: Color utilities
  - constants.js: Python-style constants (True/False/None)
  - elements.js: Element access helpers
  - events.js: Event handling and throttling
  - render.js: Vue rendering logic
  - utils.js: General utilities
  - app.js: Vue app creation and socket handlers
  - quasar-hack.js: Quasar CSS fixes
  - index.js: Entry point with public API exports

- Add Rollup build system with package.json and rollup.config.mjs
  - IIFE format with beautified output for debugging
  - External dependencies: Vue, Quasar, Socket.IO
  - Watch mode for development workflow

- Restore public API compatibility:
  - All functions exposed on window object
  - Added window.app and window.mounted_app getters

- Add pre-commit hook to auto-rebuild on JS changes
- Document new workflow in CONTRIBUTING.md
- Save original file as nicegui.old.js for reference

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@evnchn evnchn added experimental Experiment/POC - preserve for reference javascript Pull requests that update javascript code labels Mar 29, 2026
@evnchn evnchn added the nicegui-js-refactor Reference material for any future nicegui.js modularization label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental Experiment/POC - preserve for reference javascript Pull requests that update javascript code nicegui-js-refactor Reference material for any future nicegui.js modularization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant