Skip to content

Feat: Add embedded static asset support and example project#117

Merged
AnnaSasDev merged 23 commits into
corefrom
EmbeddedWwwroot
Apr 2, 2026
Merged

Feat: Add embedded static asset support and example project#117
AnnaSasDev merged 23 commits into
corefrom
EmbeddedWwwroot

Conversation

@AnnaSasDev
Copy link
Copy Markdown
Member

@AnnaSasDev AnnaSasDev commented Apr 1, 2026

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

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to break)
  • / Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • / Other (please describe):

Changes Made

  • Added src/InfiniFrame.Tools.Pack with CLI entrypoint and service-based packaging pipeline (CommandLine, PublishService, RuntimeResolver, NativeRuntimeBuilder, RepoLayout, etc.).
  • Replaced script-centric packaging flow with the new tool and removed publish-singlefile.ps1.
  • Added static asset infrastructure in src/InfiniFrame/StaticAssets and integrated static asset URI resolution into window loading and custom scheme handling.
  • Extended shared/runtime APIs (IInfiniFrameWindow, window builder/window implementation) to support static asset URI resolution.
  • Added examples/InfiniFrameExample.EmbeddedAssets sample app with embedded wwwroot content and native bootstrap.
  • Added dedicated test project tests/InfiniFrameTests.Tools.Pack with coverage for the new packaging services.
  • Added packaging documentation: docs/articles/guides/pack-tool.md, updated docs TOC/index, and added src/InfiniFrame.Tools.Pack/README.md.

Related Issues

Closes #102

Checklist

  • My code follows the project's coding standards
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • All tests pass locally
  • I have added tests that prove my fix/feature works

- 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.
@AnnaSasDev AnnaSasDev marked this pull request as ready for review April 2, 2026 10:32
…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.
@AnnaSasDev AnnaSasDev self-assigned this Apr 2, 2026
…-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.
@AnnaSasDev AnnaSasDev merged commit 55d3615 into core Apr 2, 2026
19 checks passed
@AnnaSasDev AnnaSasDev deleted the EmbeddedWwwroot branch April 2, 2026 15:01
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