diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03c90e0..6ad4a1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,28 +57,6 @@ jobs: - name: Create the package run: dotnet pack ${{ env.PROJECT }} --no-build --no-restore --configuration Release -o ${{ env.OUTPUT_PATH }} - - name: Publish to NuGet - if: github.event_name == 'release' - working-directory: ${{ env.OUTPUT_PATH }} - run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} - - - uses: avakar/tag-and-release@v1 - if: github.event_name == 'release' - name: Create Release Tag v${{ steps.package_version.outputs.version }} - id: release - with: - tag_name: v${{ steps.package_version.outputs.version }} - prerelease: ${{ steps.check_prerelease.outputs.prerelease }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Release information for v${{ steps.package_version.outputs.version }} - if: github.event_name == 'release' - run: | - echo Release Id: ${{ steps.release.outputs.id }} - echo Upload URL: ${{ steps.release.outputs.upload_url }} - echo Release URL: ${{ steps.release.outputs.html_url }} - - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 566d283..791c8af 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'csharp', 'javascript' ] + language: [ 'csharp' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://git.io/codeql-language-support diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47ab129..105a4fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,6 @@ jobs: - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} uses: actions/setup-dotnet@v4 - with: dotnet-version: ${{ matrix.dotnet-version }} @@ -58,12 +57,12 @@ jobs: - name: Create the package run: dotnet pack ${{ env.PROJECT }} --no-build --no-restore --configuration Release -o ${{ env.OUTPUT_PATH }} - # Get a short-lived NuGet API key + # Get a short-lived NuGet API key - name: NuGet login (OIDC → temp API key) uses: NuGet/login@v1 id: login with: - user: ${{ secrets.NUGET_USER }} # Recommended: use a secret like ${{ secrets.NUGET_USER }} for your nuget.org username (profile name), NOT your email address + user: ${{ secrets.NUGET_USER }} # Push the package - name: NuGet push diff --git a/.gitignore b/.gitignore index 7282dbf..660bb80 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ CodeCoverage/ *.VisualState.xml TestResult.xml nunit-*.xml +*.csproj.lscache diff --git a/README.md b/README.md index 238e536..074e963 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ A production Vite build emits a manifest that maps each logical entry (e.g. `ind `ViteManifestService` loads this manifest from `{WebRootPath}/.vite/manifest.json`, resolves an entry, prefixes the files with a configurable base path, and renders the tags. The `` tag helper is a thin wrapper over the service. +Resolution follows the entry's `imports` graph transitively: CSS contributed by shared/split chunks (which Vite records against those chunks, not the entry) is collected and rendered, and each imported chunk is emitted as a `` hint alongside the entry `", html); + Assert.True( + html.IndexOf("modulepreload", StringComparison.Ordinal) < html.IndexOf(" tag + // (the module loader fetches them via the entry's import statements). + using var ctx = ManifestTestContext.Create(SharedChunkManifest); + var entry = ctx.Service.GetEntry("index.html")!; + + var html = RenderToString(ctx.Service.RenderJs(entry, "/")); + + var scriptCount = html.Split("", html); + Assert.Contains("", html); + } + + [Fact] + public void RenderCss_WithPreloadEmitsPreloadAndNoscriptFallback() + { + using var ctx = ManifestTestContext.Create(SharedChunkManifest); + var entry = ctx.Service.GetEntry("index.html")!; + + var html = RenderToString(ctx.Service.RenderCss(entry, "/", preload: true)); + + Assert.Contains("rel=\"preload\"", html); + Assert.Contains("