Extract site REST proxy, media MIME, and installed-app detection to @studio/common#3955
Merged
Conversation
…studio/common Three small, independent shared libs, each rewiring one desktop spot to delegate: the WordPress REST proxy (wordpress-rest-api.ts), local-media MIME lookup (ipc-handlers.ts), and installed editor/terminal detection (is-installed.ts, now a re-export; its test moves to @studio/common). Behavior is unchanged except one hardening that comes with the shared REST proxy: its request.path branch now validates the resolved URL stays within the site's own REST root, closing a latent SSRF. Part of splitting the studio ui PoC (#3953). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Completes the media-mime extraction: ipc-handlers imports getLocalMediaMimeType from @studio/common/lib/media-mime and drops its inline copy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
📊 Performance Test ResultsComparing 657e993 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
These explained the extraction ("now lives in @studio/common", "shared between desktop and the local server") rather than the code; the shared-module headers keep a one-line description.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Proposed Changes
Three small, independent shared-lib extractions, each rewiring exactly one desktop spot to delegate to
@studio/common:lib/wordpress-rest.ts(desktopwordpress-rest-api.tsbecomes a thinSiteServerresolver).lib/media-mime.ts(used inipc-handlers.ts).lib/user-settings/installed-apps.ts(desktopis-installed.tsis now a re-export; its test moves to@studio/common).Behavior is unchanged except one hardening that ships with the shared REST proxy: the
request.pathbranch now validates the resolved URL stays within the site’s own REST root, closing a latent SSRF (an absolute URL inpathcould previously redirect the request to an arbitrary host with the site’s auth headers).Independent of the other split PRs; based directly on
trunk. Part of splitting thestudio uiproof-of-concept (#3953).Testing Instructions
npm run typecheckclean fortools/commonandapps/studio.installed-apps(20), desktopwordpress-rest-api(3),installed-apps-api+open-file-in-ide(23) — all pass.Pre-merge Checklist