Skip to content

feat(js): @moq/ui is a private workspace package bundled into watch and publish - #8934

Merged
kixelated merged 5 commits into
mainfrom
quest/m2/ui-private
Nov 17, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m2/ui-private

Conversation

@kixelated

@kixelated kixelated commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Claims and finishes quest/m2/ui-private.md, deleted here.

Problem

@moq/ui existed only to share overlay code between @moq/watch and @moq/publish, yet it was a published package: both kept it external and depended on ^ of its version, so the helpers they took from it (controlButton, graph, statCard, the formatters, ...) were a real cross-package contract hidden behind @internal and outside every API report. @moq/video did the same with rotateVideoDimensions. The name was never published (404), so nothing outside the repo uses it.

Approach

  • js/ui is private: true with no release or build script, version 0.0.0. Watch and publish list it under devDependencies, and their Vite external rules no longer match it, so its code and stats.css are bundled into each.
  • js/common/package.ts bundles the declarations of any private workspace package listed in devDependencies: if a built .d.ts imports one, it emits that package's declarations into dist/bundled/<dir>/ and points each import at the copy. The built @moq/watch and @moq/publish import nothing from @moq/ui, in code or types.
  • Two guards: package.ts fails a build whose dist/*.js or *.d.ts imports an @moq/* package it does not depend on (for example, @moq/ui put back in external). common/deps.ts (just js check) rejects a published package that lists a private one in dependencies, peerDependencies, or optionalDependencies. Shipped source may import a private package only when it is bundled from devDependencies.
  • ./support/element in both packages now exports the Support base, Report, Status, and Show that its declarations name. Each ./support entrypoint's Level re-exports the shared declaration, replacing its own copy of the same union.
  • @moq/ui's helpers lose their @internal tags, since none of them is published. @moq/video exports rotateDimensions as public API.
  • Docs: removed @moq/ui from doc/lib/js/index.md, doc/setup/upgrade.md, and the API reference's package list. Deleted js/ui/api/ and js/ui/MIGRATE.md. The README now says what the package is for inside the workspace. doc/setup/repository.md still lists js/ui because the code still lives there.

Impact

  • @moq/ui: never published, so no consumer changes.
  • @moq/watch/support/element, @moq/publish/support/element: add exports Support (abstract HTMLElement banner base), Report, and Status. Show is unchanged. Not breaking.
  • @moq/watch/support, @moq/publish/support: Level has the same shape and is now one shared declaration. Not breaking.
  • @moq/video: adds rotateDimensions(dimensions, rotation?). The old rotateVideoDimensions was @internal, so it was never public API. Not breaking.
  • Wire: none.

Decisions

The maintainer confirmed these decisions on 2026-11-16 (/quest-run):

  • The support base is public. The declarations of export default class extends Support must name Support. The API check rejects a reference to an unexported declaration, so Support/Report/Status are exported from ./support/element. A side effect is that subclassing Support for a custom banner, which @moq/ui's README advertised, is now available from watch or publish. Alternative: make each element extend HTMLElement and own a private banner instead of inheriting one. That keeps the base off the API but repeats the show/details accessors and callbacks in both packages.
  • The helper is named rotateDimensions, not rotateVideoDimensions. The quest recommended exporting the existing name. Since the docs import the package as Video, Video.rotateVideoDimensions repeats the namespace, which the API rules forbid. Its parameter and return types are written out as { width; height }, matching how RendererInput.display keeps Dimensions off the API, so the package gains exactly one export.
  • Bundling is generic. It lives in package.ts, keyed on private: true plus a devDependencies entry, rather than special-casing @moq/ui. The copy goes to dist/bundled/<dir>/ because dist/ui/ is already taken by each package's own ./ui entrypoint.
  • Proving the declarations work without @moq/ui installed. A test-dts cannot hide a workspace package: TypeScript falls back to node_modules when a paths mapping misses, which I tried. The new test-dts/support.ts in watch and publish proves that the shipped types can be used: subclassing Support and assigning Show. Independence from @moq/ui is proven by js/common/api.ts, which type-checks the declarations in a copy that links only declared dependencies, and by the package.ts scan.

Validation

  • just ci passes. That covers every JS package's build with the new dist scan, the API reports, deps.ts, and the doc site with its TypeDoc reference, which now documents Support under each support/element page.
  • Negative checks: putting @moq/ui back in watch's external fails the build with dist/support/element.js: imports @moq/ui, which @moq/watch does not depend on. Moving it back to dependencies fails deps.ts with js/watch/package.json: depends on the private @moq/ui, which only devDependencies may bundle.
  • Real surface: I used esbuild to bundle @moq/watch/support/element, @moq/publish/support/element, @moq/watch/ui, and @moq/publish/ui from their built dist/, with @moq/ui unresolvable, plus a custom Support subclass. In headless Chromium all four elements registered, all three banners rendered their reports and detail tables, and the page logged no errors.
  • Size, first load, with sh/size/bundles.ts before and after (bytes). Rows other than the script's own watch, watch-ui, and publish came from a scratch copy with extra entries:
bundle raw before raw after brotli before brotli after
@moq/watch/element 694378 694378 185426 185426
@moq/watch/element + /ui 743897 743899 196256 196262
@moq/publish/element 658487 658487 177656 177699
@moq/publish/element + /ui 691643 691642 185370 185366
both elements + both /ui 844028 849461 220109 220261
  • Windows: the rewritten declaration imports are joined with /, since path.relative() returns backslashes there. Checked with path.win32: dist\support\element.d.ts now points at ../bundled/ui/index.js.

A single overlay is unchanged: stats.css was already inlined at build time. A page loading both overlays now carries the shared code twice, +5.4 KB raw or +152 B brotli, as the quest expected.

Follow-ups

None.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5 (iterate, S, arm A)
Implementer: Claude Code, claude-sonnet-5-5 (iterate, M)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with medium)

Review

Rewritten by quest review after each round.

  • Head: 63fd018

  • Base: origin/main at 72c57ce

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, high effort

  • Session: 01a1e8ad-21d5-7130-904c-844651ab815a, round 1

  • Score: 9/10, No actionable defects were found; packaging, bundled declarations, and callers appear consistent, but builds and tests were not run as instructed.

  • Rounds: 3; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 16, 2026 05:52
Quest-Claim: 038f614df7245980
…nd publish

@moq/ui is private and never published. @moq/watch and @moq/publish list it
under devDependencies; Vite bundles its code and stylesheet, and
common/package.ts emits its declarations into dist/bundled/ui and points
every import at that copy. A built package that still imports an @moq
package it does not depend on fails its build, and deps.ts rejects a
published package depending on a private one.

The support elements now export the Support base, Report, Status, and Show
they are typed with, and each ./support entrypoint's Level is that same
declaration. @moq/video exports rotateDimensions (was the @internal
rotateVideoDimensions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title @moq/ui is a workspace package, bundled into watch and publish feat(js): @moq/ui is a private workspace package bundled into watch and publish Nov 16, 2026
@kixelated
kixelated marked this pull request as ready for review November 16, 2026 14:27
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e608a85-8d5c-4551-b370-6dd84dcd0d54
Commits

Reviewing files that changed from the base of the PR and between b063faa and 63fd018.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 38

  • doc/.vitepress/api/package.json
  • doc/lib/js/index.md
  • doc/setup/upgrade.md
  • js/common/deps.test.ts
  • js/common/deps.ts
  • js/common/package.ts
  • js/publish/api/support-element.api.md
  • js/publish/package.json
  • js/publish/src/broadcast.ts
  • js/publish/src/preview.ts
  • js/publish/src/support/element.ts
  • js/publish/src/support/index.ts
  • js/publish/test-dts/support.ts
  • js/publish/vite.config.ts
  • js/ui/MIGRATE.md
  • js/ui/README.md
  • js/ui/api/index.api.md
  • js/ui/package.json
  • js/ui/src/graph.ts
  • js/ui/src/index.ts
  • js/ui/src/stats.ts
  • js/ui/vite.config.ts
  • js/video/api/index.api.md
  • js/video/src/index.ts
  • js/video/src/presentation.test.ts
  • js/video/src/presentation.ts
  • js/watch/api/support-element.api.md
  • js/watch/package.json
  • js/watch/src/support/element.ts
  • js/watch/src/support/index.ts
  • js/watch/src/video/decoder.ts
  • js/watch/test-dts/support.ts
  • js/watch/test-dts/tsconfig.json
  • js/watch/vite.config.ts
  • quest/m2/README.md
  • quest/m2/browser-packages.md
  • quest/m2/ui-private.md
  • quest/m3/release/npm-first-publish.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 16, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

I reviewed all 3 commits that make @moq/ui a private workspace package that @moq/watch and @moq/publish bundle in both code and declarations.

  • @moq/ui is private. js/ui is now private: true at 0.0.0, has no build or release script, and sits under devDependencies in watch and publish. Each package's Vite external excludes exactly @moq/ui. The @import "@moq/ui/stats.css" lines go through Vite's CSS pipeline, not Rollup's external, so the stylesheet is still inlined.
  • Declarations are bundled generically. js/common/package.ts runs tsc for any private workspace devDependency that a built .d.ts imports, writes the output to dist/bundled/<dir>/, and rewrites each import to a relative path through the bundled package's exports.
  • Two new guards. package.ts fails the build if a shipped .js or .d.ts imports an @moq/* package that isn't declared. It also fails if a published package lists a private one in dependencies or peerDependencies. deps.ts applies the same rule to dependencies, peerDependencies, and optionalDependencies, and lets shipped source import a private package only when it is a devDependency.
  • Support types now ship with each package. ./support/element in both packages exports Support, Report, Status, and Show. Level in ./support re-exports the shared declaration. Watch gets a test-dts check that runs during its build.
  • rotateDimensions is public in @moq/video. It replaces rotateVideoDimensions, which was @internal. Its parameter and return shapes are written out inline.
  • Docs and quests cleaned up. @moq/ui is gone from the JS index, the upgrade list, the TypeDoc package list, js/ui/api/, and js/ui/MIGRATE.md. The finished quest file is deleted.

Things I checked:

  • js/ui/src never calls customElements.define, so bundling it into both packages can't define the same element twice on one page.
  • Every workspace: devDependency across js/* resolves under the name-to-directory rule in workspaceDir().
  • The bundled .d.ts files import only @moq/signals, which watch and publish both depend on.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed c42ee5c6210aa85ff2f8cc06a309dc697d7fe656. Keeping UI private and bundling from devDependencies is the right boundary. The existing watch/publish package layout and shared Signals import look sound on POSIX.

[P2] Emit platform-independent declaration import paths. js/common/package.ts:136–137 writes the result of native path.relative() directly into a quoted module specifier. On Windows it produces backslashes (for example, ..\\bundled\\ui\\index.js); the generated source then treats \\u as an invalid Unicode escape instead of a path separator. I reproduced the path and parse failure with Node’s path.win32, not a full Windows build. Normalize separators to / before emitting the specifier and test the rewritten declaration from a Windows-style path. If release packaging is POSIX-only by policy, declare and enforce that instead of emitting invalid artifacts.

I did not independently build the packages or inspect published tarballs.

path.relative() returns backslashes on Windows, which broke the quoted
module specifier package.ts writes into each rewritten .d.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Fixed in f28fcae the review (OpenAI) finding: js/common/package.ts now joins the relative path with / (.split(sep).join("/")) before writing it into the declaration's module specifier, so Windows emits ../bundled/ui/index.js instead of backslashes.

(Written by Claude Opus 5.5)

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)
Head: f28fcaeb30ffa4dc32f4aa60849d0b2bb61f177c

The previous Windows declaration-path issue is fixed. Normalizing the native separator before adding the relative prefix emits ../bundled/ui/index.js on Windows and leaves POSIX output unchanged. No new blocker in this update. A Windows package build or a small specifier regression test would still be useful; I did not run a package build.

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 16, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

I reviewed the delta since the prior Pullfrog review (c42ee5c), which is one fix commit plus a style commit.

  • Windows-safe declaration specifiers. In js/common/package.ts, the relative path written into rewritten @moq/ui imports is split on sep and rejoined with /. Windows now emits ../bundled/ui/index.js rather than backslashes, and POSIX output is unchanged.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The only commit since the last Pullfrog review (f28fcae) merges origin/main into the branch. Compared with the earlier diff, the only new text is in quest/m2/README.md. No code changed.

  • Resolved the merge in quest/m2/README.md. The str0m link now goes to PR #8963, the JS bullet no longer lists the finished @moq/ui quest, and the Bindings bullet matches main.

@moq/ui is still listed only in the devDependencies of @moq/watch and @moq/publish. Nothing merged from main adds a new dependency on it.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 8231b31 Nov 17, 2026
6 checks passed
@kixelated
kixelated deleted the quest/m2/ui-private branch November 17, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant