Skip to content

Comments

add a way to prefer cached files over remote files#5

Merged
donseba merged 1 commit intomainfrom
cache-or-fetch
Jun 16, 2025
Merged

add a way to prefer cached files over remote files#5
donseba merged 1 commit intomainfrom
cache-or-fetch

Conversation

@donseba
Copy link
Owner

@donseba donseba commented Jun 12, 2025

This pull request introduces a new method to handle caching and asset management for packages in the ImportMap structure. It also adds a supporting method in the Package structure to retrieve asset files. These changes aim to improve the handling of package assets and their integration into the application's import structure.

New functionality for caching and asset management:

  • CacheOrFetch method in importmap.go:
    Added a new method to the ImportMap structure to check for cached and asset files for packages. If files are missing, it fetches or builds them as needed, ensuring the Structure.Imports map is updated with the correct asset paths. This method also includes logging for better traceability.

  • Error handling improvements in importmap.go:
    Introduced the errors package to provide more descriptive error messages when cache or asset directories are not set.

Supporting method for asset retrieval:

  • Assets method in library/package.go:
    Added a new method to the Package structure to list all asset files in a package's directory or retrieve a specific file. This method ensures proper error handling and returns detailed file information, including paths and types.

@donseba donseba merged commit 2892cea into main Jun 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant