feat(importmap): implement package-scoped vendor structure for staticDeps - #14
Merged
Conversation
added 2 commits
April 28, 2026 08:45
…cDeps
Completely rewrite import map pinning to use package-scoped directory
structure with full JSPM staticDeps support for proper dependency isolation.
Changes:
- Pin now downloads ALL files from JSPM staticDeps (main + deps + internal)
- Package-scoped structure: vendor/{pkg}@{ver}/ with scopes/ subdirectory
- Internal files (_/, jsx-runtime/) downloaded but not added to importmap
- Rollback mechanism on download errors for clean failure handling
- Pristine command updated to extract packages from new URL format
- Unpin deletes entire package directory including all scopes
Structure:
vendor/
├── @org/package@1.0.0/
│ ├── dist/index.js (main)
│ ├── _/abc123.js (internal - not in importmap)
│ └── scopes/
│ └── dependency@2.0.0/ (isolated deps)
Breaking changes:
- Vendor directory structure changed from flat to package-scoped
- Old: vendor/pkg@1.0.0.js
- New: vendor/pkg@1.0.0/dist/index.js
Benefits:
- Version coexistence (different packages can use different dep versions)
- Clean unpin (single directory deletion removes all files)
- JSPM structure preservation (exact paths from JSPM CDN)
- Better isolation (no shared dependency conflicts)
Tests:
- Added comprehensive test suite (pin_test.go) for new structure
- Updated existing tests to use generic package names
- All tests passing with new architecture
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
This PR changes the way vendor packages are downloaded and organized in the importmap tool.
Currently the importmap tool downloads packages into a flattened structure. This approach is not including the download of packages that require internal dependencies (scopes).
The new approach downloads all package scopes and places them within their vendored path, creating an isolated directory structure per package:
Breaking Change
After upgrading, you must run:
This reorganizes the vendor directory to the new structure.
Some internal dependencies are placed in
_/folders (e.g.,_/index.js). The Go embed directive with standard * pattern excludes directories starting with_or.Update required in
template/internal/system/assets/assets.go:Without this change,
_/directories won't be embedded and the application will fail at runtime.See Go embed docs for details.