Auto-detect playground dependency subpaths (playground 0.3.13) - #612
Conversation
Bump @studiometa/playground to 0.3.12 and replace the hand-rolled `packageDeps` loop with the preset's `subpaths: true` option. It reads each workspace package's `package.json` `exports` map and builds every subpath as an entry of ONE code-split tsdown build, so modules shared between entries — a component class referenced by the barrel, its own `@studiometa/ui/<Component>` subpath and the `./manifest` lazy imports — are emitted once as a shared chunk and referenced by every entry. That gives a single runtime instance and removes the singleton/identity hazard of bundling each subpath separately. The playground now resolves every ui / ui-mapbox / ui-autoload subpath from local source with same-origin declarations, so any `@studiometa/ui/<Component>` import works in the editor while developing new components. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FQxYGj2RqgcP8BkubpiNu
Code ReviewRisk: Low — The change is safe to merge based on the reviewed diff; no concrete defects were identified. Replaces the manual workspace dependency-entry generation with Review usage: 7,126 in (3,677 cached) / 334 out tokens — $0.0033 (openrouter/openai/gpt-5.6-luna, thinking: low) Reviewed by @weareikko/code-review v0.9.5 for commit 7058587. Previous review runsPrevious run archived 2026-08-06T08:50:17ZCode ReviewRisk: Low — The configuration now relies on Review usage: 6,963 in (3,677 cached) / 246 out tokens — $0.0030 (openrouter/openai/gpt-5.6-luna, thinking: low) Reviewed by @weareikko/code-review v0.9.5 for commit ef914b8. Previous run archived 2026-08-06T08:29:53ZCode ReviewRisk: Low — The playground dependency configuration now relies on The hand-rolled exports parsing and per-subpath dependency generation were replaced with Notes:
Review usage: 22,204 in (18,105 cached) / 370 out tokens — $0.0046 (openrouter/openai/gpt-5.6-luna, thinking: low) Reviewed by @weareikko/code-review v0.9.5 for commit 434c367. |
CDN asset previewThis pull request's build is published as the immutable channel Declarative autoloader Import a <script type="module" src="https://cdn.studiometa.dev/ui-autoload@pr-612-705858782960/ui.js"></script>
<script type="module" src="https://cdn.studiometa.dev/ui-autoload@pr-612-705858782960/ui-mapbox.js"></script>Manual ESM imports Each package surface at its pinned URL: import { Base, createApp } from "https://cdn.studiometa.dev/js-toolkit@3.8.0/index.js";
import { Action } from "https://cdn.studiometa.dev/ui@pr-612-705858782960/index.js";
import { MapboxMap } from "https://cdn.studiometa.dev/ui-mapbox@pr-612-705858782960/index.js";
import { autoload, composeManifests } from "https://cdn.studiometa.dev/ui-autoload@pr-612-705858782960/index.js";Component manifests Each package exposes its own manifest (composed at runtime by the autoloader): import { manifest as ui } from "https://cdn.studiometa.dev/ui@pr-612-705858782960/manifest.js";
import { manifest as uiMapbox } from "https://cdn.studiometa.dev/ui-mapbox@pr-612-705858782960/manifest.js";It is pruned from the index automatically when the PR closes. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #612 +/- ##
=========================================
Coverage 87.50% 87.50%
Complexity 145 145
=========================================
Files 147 147
Lines 5324 5324
Branches 1010 1010
=========================================
Hits 4659 4659
Misses 583 583
Partials 82 82
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Export SizeUnchanged@studiometa/ui
@studiometa/ui-mapbox
@studiometa/ui-autoload
|
0.3.13 rewrites relative `.js` imports to `.d.ts` inside the emitted declaration chunks of self-hosted dependencies. rolldown-plugin-dts wrote cross-chunk type imports with a `.js` extension, but declaration chunks are content-hashed independently from the JS chunks, so `./X-<hash>.js` never existed for types (only `./X-<hash>.d.ts` did) — the editor LSP fetched the dead URL and type resolution broke for every code-split subpath. Verified in the playground build: all 145 cross-chunk `.d.ts` imports now point at existing `.d.ts` files (0 dead `.js` type-imports), while the JS shared-chunk singleton is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FQxYGj2RqgcP8BkubpiNu
|
Bumped to |
Align the playground's `@studiometa/js-toolkit` dev dependency with the latest patch release so the local tsdown builds of the workspace packages resolve the same version consumers get from esm.sh. Playground build verified green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FQxYGj2RqgcP8BkubpiNu
What
Bump
@studiometa/playground0.3.11 → 0.3.12and replace the hand-rolledpackageDeps()loop inpackages/playground/meta.config.jswith the preset's newsubpaths: trueoption.Why
0.3.12adds two related features:entriesmulti-entry builds (playground#74) — all subpaths of a workspace package build together in one code-split tsdown build, so modules shared between entries are emitted once as a shared chunk and referenced by every entry. That means the barrel (@studiometa/ui), a direct subpath (@studiometa/ui/Accordion) and the./manifestlazy imports all resolve to the same chunk URL — a single runtime instance, eliminating the singleton/identity hazard of the previous per-subpath builds.subpaths: trueauto-detection (playground#75) — derives those entries from the package'spackage.jsonexportsmap, so nothing is hardcoded and the config tracks the source automatically.Result — verified against a local build
@studiometa/ui: 95 entries derived (barrel +./manifest+ every component subpath) → 189 import-map keys (extensionless +.jsaliases).@studiometa/ui-mapbox: barrel +./manifest.@studiometa/ui-autoload: barrel +./ui+./ui-mapbox.index.js(barrel),Accordion.js(subpath) andmanifest.js's lazyimport("./Accordion.js")all reference the single shared chunkAccordion-<hash>.js— only one Accordion chunk exists..d.tswired via_headers(x-typescript-types) for the barrel and every subpath.cdn.studiometa.devin the bundled deps.Net effect: any
@studiometa/ui/<Component>import now works in the editor from local source while developing new components, with correct types and no duplicated component classes.🤖 Generated with Claude Code