docs(builder): annotate key decisions with upstream references
Add succinct comments at non-obvious decision points across the custom
Parcel-based Storybook 10 builder, referencing the official Builder API
docs (https://storybook.js.org/docs/builders/builder-api) and the upstream
@storybook/builder-vite and @storybook/builder-webpack5 reference
implementations. Highlights:
- parcel-resolver-storybook: top-of-file block explaining the
externalize-the-runtime pattern, the globalsNameReferenceMap source,
the .cache layout, and the CJS-cycle issue it sidesteps; per-branch
comments for externals / react-dom/client shim / story: pipeline.
- storybook-builder-parcel/preset.mjs: Builder API contract summary,
rationale for the 9003->3000 reverse proxy, list of the five generated
files, and the bail() / module-scope watcher rationale.
- gen-preview-modern.mjs: explicit ordering rationale for runtime ->
setup-addons -> PreviewWeb, why processPreviewAnnotation needs
toPackageExportSpecifier under Parcel, and why toImportFn uses static
imports + Object.assign instead of Promise.all + spread.
- gen-iframe-modern.mjs / templates/iframe.html: provenance from
upstream Vite's input/iframe.html and the OTHER_GLOBALS placeholder
workaround.
- StoryTransformer.ts / StorybookMDXTransformer.mjs: brief headers
describing what each transformer does and the IPC-based docgen
optimization.
No code logic changes; comments only.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>