Feat: Add embedded static asset support and example project#117
Merged
Conversation
- Introduced `FileProviderFactory` for managing embedded wwwroot assets with optional physical fallback. - Added `StaticAssetSchemeHandler` and `StaticAssetSettings` for serving embedded assets. - Extended `InfiniFrameWindowBuilder` with `UseEmbeddedWwwrootAssets` method. - Created `InfiniFrameExample.EmbeddedAssets` project to demonstrate usage. - Updated solution and package references to support the new feature.
…ntime handling: - Replaced hardcoded parameters with dynamic profile resolution. - Added support for publish profiles and platform-specific RIDs. - Introduced logic to build and copy native runtime dependencies during publish. - Updated project file for streamlined native runtime build integration.
…ssets: - Introduced `NativeSingleFileBootstrap` for runtime extraction of native libraries during single-file deployment. - Refactored project file to embed native runtime files and improve platform-specific resource handling. - Enhanced publish script to clean previous outputs and remove redundant native files. - Updated examples to initialize native libraries via bootstrapper.
…ing: - Added custom scheme registration for WebView2 to support top-level navigations like `app://`. - Enabled tracing for static asset handling with logging for missed, rejected, and successful asset resolutions. - Enhanced error handling for missing default documents in embedded assets. - Refined `FileProviderFactory` to support legacy and preferred embedded naming conventions. - Updated example asset styles for improved appearance.
…ize new .NET tool: - Introduced `InfiniFrame.Tools.Pack` as a single-command .NET tool for publishing InfiniFrame apps as single-file binaries. - Refactored `publish-singlefile.ps1` to replace legacy profile-based configuration with simplified tool arguments. - Updated solution files to include the tool project and ensure seamless integration. - Enhanced documentation with usage instructions for installing and running the tool.
…ices for improved modularity, added support for reusable MSBuild target in publish scripts, and enhanced CLI usage handling.
…ty, handle edge cases, and enhance CLI resolution logic.
… framework: - Introduced comprehensive unit tests for core services, including `CommandLine`, `RuntimeResolver`, `NativeRuntimeBuilder`, and others. - Added project `InfiniFrameTests.Tools.Pack` with necessary dependencies and project references. - Updated `InfiniFrame.Tools.Pack.csproj` to expose internal members to test project using `InternalsVisibleTo`.
…Tests.Tools.Pack` to simplify test declarations.
…Frame.Tools.Pack`: - Introduced a new guide, `pack-tool.md`, detailing the usage, features, and best practices for `InfiniFrame.Tools.Pack`. - Enhanced XML documentation across services for better maintainability and developer guidance. - Updated table of contents to include the new guide in documentation navigation.
…rap` for consistency and improved native runtime handling: - Migrated `NativeSingleFileBootstrap` to `InfiniFrameSingleFileBootstrap` with enhanced code clarity and modularity. - Updated examples and documentation to use the new bootstrap class. - Streamlined native runtime extraction logic and runtime resolver initialization for single-file packaging.
…eExample.SingleFileExe`: - Updated project files, namespaces, and solution references to reflect the new example name. - Retained functionality and configuration with improved project alignment.
…to use preflight native artifact resolution with enhanced error handling.
…rget execution: - Updated `PublishService` to include `-p:InfiniFramePackInvoked=true` in publish arguments for single-file and non-single-file builds. - Modified MSBuild target condition in `InfiniFrameExample.SingleFileExe.csproj` to skip execution when `InfiniFramePackInvoked` is set.
…orrect solution directory resolution.
…-specific implementations: - On Linux, register "app" as a secure scheme using WebKitSecurityManager to align with Windows behavior. - On Windows, restrict secure and authority components to the "app" scheme for embedded assets.
…rvice`: - Replace inline argument construction with `BuildPublishArguments` utility for streamlined handling. - Add `SafeDeleteDirectory` for secure output directory management. - Enhance native artifact resolution with `ResolvedNativeArtifacts` record. - Update bootstrap logic with support for unique native directory paths and improved missing resource handling. - Extend `README.md` to clarify tool usage as both local and global. - Adjust project file to reflect build output visibility changes for examples.
… enhance output folder handling logic: - Added `MsBuildPropertyResolver` to retrieve evaluated properties from MSBuild. - Introduced `OutputPathSafety` for secure output directory validation and deletion. - Updated `PublishService` to use safe deletion logic and provide clearer failure feedback for missing outputs. - Added support for `--force-clean-output` option to enable cleaning of custom output paths. - Extended `CommandLine` and `PublishOptions` to include `--force-clean-output`. - Updated documentation to reflect changes in output handling and new option usage.
…Window: - Removed inconsistent quotation marks from log messages. - Clarified context in custom scheme debug and warning logs. - Ensured uniform message structure for improved readability and maintainability.
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.
Description
This PR introduces a new packaging workflow for InfiniFrame applications by adding the
InfiniFrame.Tools.Pack.NET tool and integrating embedded static asset support into the runtime.The new tool builds required native artifacts, runs single-file publish with InfiniFrame-specific MSBuild hooks, and cleans output artifacts for distribution.
It also adds a runnable embedded-assets example, comprehensive unit tests for the packaging services, and documentation for installation, usage, and troubleshooting.
Type of Change
Changes Made
src/InfiniFrame.Tools.Packwith CLI entrypoint and service-based packaging pipeline (CommandLine,PublishService,RuntimeResolver,NativeRuntimeBuilder,RepoLayout, etc.).publish-singlefile.ps1.src/InfiniFrame/StaticAssetsand integrated static asset URI resolution into window loading and custom scheme handling.IInfiniFrameWindow, window builder/window implementation) to support static asset URI resolution.examples/InfiniFrameExample.EmbeddedAssetssample app with embeddedwwwrootcontent and native bootstrap.tests/InfiniFrameTests.Tools.Packwith coverage for the new packaging services.docs/articles/guides/pack-tool.md, updated docs TOC/index, and addedsrc/InfiniFrame.Tools.Pack/README.md.Related Issues
Closes #102
Checklist