mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-03 02:27:57 +09:00
A `.mjs` file currently fails to upload with HTTP 500, so the CLI retries the same unsupported format and reports a retry-exhausted error. This PR lets people upload ECMAScript modules as JavaScript assets. Files with unsupported extensions now get HTTP 400 and the CLI does not retry them. Closes #6612 The existing asset-type registry now includes `.mjs` with the same MIME type and editor as `.js`. Filename validation uses a typed error so the Assets API can return 400 without inspecting error text. Transient server failures still retain the existing retry. The upload still transfers the file and checks its size and content; this change does not remove those costs. - [x] Reproduce the `.mjs` rejection locally and show new tests fail before the fix. - [x] Accept `.mjs` in upload detection, serving MIME lookup, and the Assets panel Code filter. - [x] Return HTTP 400 for unsupported extensions. - [x] Stop the CLI after a non-retryable upload response. The regression test failed with two requests before the fix and passes with one afterward; HTTP 500 still retries. - [x] Review documentation impact and add `.mjs` to the authoritative Assets guide. The retry behavior needs no further docs change. - [x] Verify fixture impact: no fixture asset has format `mjs`; no generated fixture input or output changes. - [x] Run focused tests (SDK 133, asset uploader 8, Builder Assets API 23), then full SDK (910) and asset-uploader (313) suites. - [x] Run SDK, asset-uploader, Builder, project-build, and HTTP-client typechecks; lint, package-boundary check, formatting, and diff check. - [x] Verify required CI checks after the retry fix: main workflow (including all ten Builder E2E shards), visual regression, staging build, lint, and submodule checks passed. The reporter’s exact package file was not available. The regression uses a small valid `.mjs` file and verifies the same upload-validation path. The full agent evaluation suite was not run, as requested; focused tests were used instead.
Webstudio HTTP Client
Function-call client for Webstudio HTTP and TRPC APIs.
This package owns network details for Builder/project calls so callers do not need route URLs, TRPC procedure paths, auth header names, staged upload details, or response validation details.
- parsing Builder project URLs
- project bundle load/import helpers and sync bundle normalization
- staged uploads, asset uploads, and import-with-assets orchestration
- project API read/write helpers
- API compatibility headers and error messages
CLI command names, help text, manuals, and command-specific output formatting belong in the CLI package, not here.