Sroberge/three peerdep - #98
Open
vim-sroberge wants to merge 5 commits into
Open
Conversation
three was a hard dependency inlined into the bundle (~1.8 MB), so any host app that already used three ended up with two three instances in one page — breaking instanceof across the boundary, duplicating module-level state, and double-shipping the payload. Because vim-web re-exports THREE (VIM.THREE), this also meant VIM.THREE !== the host's THREE. - vite.config.js: externalize three (and three/* subpaths); emit ESM only. The IIFE build is dropped — it can't cleanly externalize three (the three/examples/jsm/* passes have no UMD global), nothing documents or uses the script-tag path, and the package's exports map already routes modern consumers to ESM. - package.json: move three + @types/three from dependencies to devDependencies, add three to peerDependencies at the tested range (^0.183.2), point main at the ESM bundle, bump to 1.0.0-beta.3. - README.md: document the peer dependencies and that only the pinned three version is tested (others may work). ESM bundle drops from 3.43 MB to 1.57 MB (-54%). Build verified: three is no longer inlined (no __THREE__ detector, no node_modules/three/build region); it is imported as an external instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Establish one rule: uppercase for tooling-required entry points
(CLAUDE.md, README.md, SKILL.md), lowercase kebab-case for everything in
.claude/docs. Fixes two skills that used lowercase skill.md (the skill
loader looks for SKILL.md and would miss them on case-sensitive systems)
and normalizes the screaming-caps doc names.
- .claude/skills/{auto-refactor,css}/skill.md -> SKILL.md
- .claude/docs/INPUT.md -> input.md, RENDERING_OPTIMIZATIONS.md -> rendering-optimizations.md
- CLAUDE.md: repoint doc links (also fixes two that were missing the docs/ segment)
- rendering-optimizations.md: fix inter-doc link
- input handlers: update "See INPUT.md" comments to the resolvable path
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add RELEASE_NOTES.md section for 1.0.0-beta.3 and a MIGRATION.md section covering the three peer-dependency move and the IIFE build removal, so consumers know to install their own three and switch script-tag usage to ESM. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The bare `docs` ignore pattern (meant for a root build-output dir) also matched `.claude/docs`, silently keeping two useful reference docs out of the repo. Anchor the pattern to root (`/docs`, `/docs2`) so `.claude/docs` is tracked, and add the two evergreen references: - styling.md — style.css token system, layout patterns, override conventions - webgl-vs-ultra.md — WebGL/Ultra API comparison and known discrepancies Also remove colors.md, a historical design plan for the (already-shipped) color-palette system, which nothing references. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@vim-sroberge please bump the version up to 1.0-beta.4 (beta.3 is already on NPM; the vim-hackathon repository references it) |
|
Can you please also update vim-demo and vim-hackathon once beta.4 of vim-web is released? |
beta.3 is already published on NPM (referenced by vim-hackathon), so this change ships as beta.4. Update the version and the release-notes/migration references accordingly; three was bundled through beta.3 and becomes a peer dependency in beta.4. 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.
Ship
threeas a peer dependency, drop the IIFE build, and tidy AI docsBase:
sroberge/1_0← Compare:sroberge/three-peerdepVersion:
1.0.0-beta.2→1.0.0-beta.3Why
threewas a harddependencyinlined into the bundle. Any host app that already used three ended up with two three instances in one page, which:instanceofacross the boundary — a host'sTHREE.Meshis not ourTHREE.Mesh, so any API that accepts or returns three objects silently misbehaves. This is especially bad because vim-web re-exports THREE asVIM.THREE, soVIM.THREE.Mesh !== hostTHREE.Meshtoday;Object3Did counters,Layers, renderer bookkeeping);Because of the re-export, this is a correctness fix for the existing public API, not just a packaging nicety.
What changed
threeis now a peer dependencythree+@types/threefromdependenciestodevDependencies.threetopeerDependenciesat the tested range^0.183.2(i.e. the version the library is built and tested against — not a speculative wide range). Other three.js versions may work; only the pinned one is tested/supported.threeandthree/*in the Vite build (the/^three\//pattern also coversthree/examples/jsm/*addon imports).mainrepointed from the deleted IIFE bundle to the ESM bundle.IIFE build removed → ESM only
vite.config.jsnow emits['es']only;dist/vim-web.iife.jsis no longer produced.three/examples/jsm/*passes have no UMD global), nothing in the repo documents or uses the<script>-tag path, and theexportsmap already routes modern consumers to ESM. Removed the now-deadoutput.globalsmap and UMDname.<script>tag.Docs & housekeeping (rides along with the beta.3 packaging change)
CLAUDE.md,README.md,SKILL.md), lowercase kebab-case for.claude/docs. Fixes two skills that used lowercaseskill.md(the loader looks forSKILL.mdand would miss them on case-sensitive systems) and repoints doc links (also fixing two that were missing thedocs/segment)..gitignorescoped: the baredocspattern (meant for a root build dir) was collaterally hiding.claude/docs. Anchored to/docs//docs2so TypeDoc output stays ignored but.claude/docsis tracked.styling.md(style.css tokens/patterns) andwebgl-vs-ultra.md(WebGL/Ultra API comparison). Removedcolors.md, a historical design plan for the already-shipped palette system that nothing referenced.RELEASE_NOTES.mdbeta.3 section +MIGRATION.mdpeer-dependency and IIFE-removal guidance.Commits
982cfd789cbe6b53e8d80d9a4bcaa844Verification
npm run buildpasses (vite + tsc declarations + both d.ts bundles).__THREE__duplicate-instance detector, nonode_modules/three/buildregion in the output; three is imported as an external instead.input.md/optimization.md/rendering-optimizations.mdlowercase; allSKILL.mduppercase) — correct on Linux/CI, not just Windows.Consumer impact (breaking → beta.3)
Consumers must now install three themselves:
npm install vim-web three react react-dom # TypeScript users also need @types/three matching their three versionthreeto their deps; one shared copy, no duplicate-instance issues.<script>-tag/IIFE consumers: switch to an ESM import (bundler or<script type="module">).^0.183get a peer warning; they can override at their own risk and still keep a single copy.Notes for reviewers
styling.md/webgl-vs-ultra.mdwere never tracked before, so they land with their current local content and haven't had the repo's usual review history — worth a skim in the diff.9cbe6b53and4bcaa844can be split into a separate PR.