Refactor widget.js into TypeScript modules#976
Open
manzt wants to merge 1 commit intopush-zzsossttrsmtfrom
Open
Refactor widget.js into TypeScript modules#976manzt wants to merge 1 commit intopush-zzsossttrsmtfrom
manzt wants to merge 1 commit intopush-zzsossttrsmtfrom
Conversation
|
Split the monolithic `widget.js` into focused, single-responsibility
TypeScript files, leaving only the Jupyter/AMD factory in widget.ts.
The previous JS monolith was previously useful because the JupyterLab
builds required webpack (which doesn't support TS out-out-of-the-box).
But we switched to rspack, and since these modules _require_ bundling,
it makes sense to change them to TS because the syntax is nicer and
type-stripping is a "free" default with our build tools.
```sh
Before After
──────────────────────────────────────────────────────
src/
└── widget.js (741 lines) src/
├── widget.ts ( 98 lines) ← Jupyter/AMD factory only
├── runtime.ts (113 lines)
├── binding.ts (128 lines)
├── host.ts ( 68 lines)
├── load.ts (114 lines)
├── invoke.ts ( 40 lines)
├── observe.ts ( 16 lines)
├── model-proxy.ts ( 34 lines)
├── widget-ref.ts ( 8 lines)
└── util.ts ( 63 lines)
```
700953e to
fdf8407
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split the monolithic
widget.jsinto focused, single-responsibility TypeScript files, leaving only the Jupyter/AMD factory in widget.ts.The previous JS monolith was previously useful because the JupyterLab builds required webpack (which doesn't support TS out-out-of-the-box). But we switched to rspack, and since these modules require bundling, it makes sense to change them to TS because the syntax is nicer and type-stripping is a "free" default with our build tools.
Before After ────────────────────────────────────────────────────── src/ └── widget.js (741 lines) src/ ├── widget.ts ( 98 lines) ← Jupyter/AMD factory only ├── runtime.ts (113 lines) ├── binding.ts (128 lines) ├── host.ts ( 68 lines) ├── load.ts (114 lines) ├── invoke.ts ( 40 lines) ├── observe.ts ( 16 lines) ├── model-proxy.ts ( 34 lines) ├── widget-ref.ts ( 8 lines) └── util.ts ( 63 lines)