feat: add Mapbox GL JS support with separate build targets#145
Open
dailyprice wants to merge 2 commits intomasterfrom
Open
feat: add Mapbox GL JS support with separate build targets#145dailyprice wants to merge 2 commits intomasterfrom
dailyprice wants to merge 2 commits intomasterfrom
Conversation
Implement dual-library support for both MapLibre and Mapbox GL JS using build-time path aliasing. The codebase now builds two separate packages (maplibre-geoman and mapbox-geoman) with VITE_BASE_MAP environment variable controlling which adapter is used. Key changes: - Add src/core/map/mapbox/ adapter directory mirroring MapLibre implementation - Mapbox source uses applyDiff() to manually apply GeoJSONSourceDiffHashed since Mapbox lacks incremental updateData() API - Extract module augmentation and CSS into adapter directories for build-time switching - Add control class constants (maplibregl-ctrl vs mapboxgl-ctrl) via @maplib alias - Update vite.config.ts, tsconfig.json to support baseMap parameter and create tsconfig.mapbox.json - Add build:mapbox and build:types:mapbox npm scripts - Create src/dev/index.mapbox.dev.ts with OSM raster tiles and dynamic:true/false toggle to verify fixes - Both builds verified: npm run build (MapLibre) and VITE_BASE_MAP=mapbox npm run build (Mapbox) Closes #7 Co-Authored-By: Claude Opus 4.6 <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.
Summary
Implement dual-library support for both MapLibre and Mapbox GL JS using build-time path aliasing. The codebase now builds two separate npm packages (maplibre-geoman and mapbox-geoman) with VITE_BASE_MAP environment variable controlling which adapter is used at compile time.
Key Changes
src/core/map/mapbox/adapter directory with complete MapLibre API compatibility layer for Mapbox GL JSapplyDiff()logic to handle Mapbox's lack of incrementalupdateData()API@mapLibaliastsconfig.mapbox.jsonfor Mapbox build targetbuild:mapboxandbuild:types:mapboxnpm scriptsTesting
Both build targets verified:
npm run build→ producesdist/maplibre-geoman.*VITE_BASE_MAP=mapbox npm run build→ producesdist/mapbox-geoman.*Closes #7
🤖 Generated with Claude Code