├── .csharpierrc.json ├── examples ├── .gitignore ├── net │ ├── ViteNET.MVC │ │ ├── Assets │ │ │ ├── vite-env.d.ts │ │ │ ├── app.ts │ │ │ ├── main.ts │ │ │ ├── counter.ts │ │ │ ├── counter.scss │ │ │ ├── public │ │ │ │ ├── dotnet.svg │ │ │ │ ├── typescript.svg │ │ │ │ └── vite.svg │ │ │ └── style.scss │ │ ├── Views │ │ │ ├── _ViewStart.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ ├── Shared │ │ │ │ ├── _ValidationScriptsPartial.cshtml │ │ │ │ ├── _Layout.cshtml │ │ │ │ ├── Error.cshtml │ │ │ │ └── _Layout.cshtml.css │ │ │ └── Home │ │ │ │ └── Index.cshtml │ │ ├── appsettings.Development.json │ │ ├── README.md │ │ ├── appsettings.json │ │ ├── tsconfig.node.json │ │ ├── Models │ │ │ └── ErrorViewModel.cs │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Controllers │ │ │ └── HomeController.cs │ │ ├── Program.cs │ │ ├── ViteNET.MVC.csproj │ │ ├── vite.config.ts │ │ └── .gitignore │ ├── ViteNET.BlazorServer │ │ ├── Assets │ │ │ ├── vite-env.d.ts │ │ │ ├── app.ts │ │ │ ├── main.ts │ │ │ ├── counter.ts │ │ │ ├── blazor.scss │ │ │ ├── counter.scss │ │ │ ├── public │ │ │ │ ├── dotnet.svg │ │ │ │ ├── typescript.svg │ │ │ │ └── vite.svg │ │ │ └── main.scss │ │ ├── Shared │ │ │ ├── MainLayout.razor │ │ │ └── MainLayout.razor.css │ │ ├── appsettings.json │ │ ├── appsettings.Development.json │ │ ├── tsconfig.node.json │ │ ├── Data │ │ │ ├── WeatherForecast.cs │ │ │ └── WeatherForecastService.cs │ │ ├── package.json │ │ ├── _Imports.razor │ │ ├── App.razor │ │ ├── tsconfig.json │ │ ├── Pages │ │ │ ├── Error.cshtml.cs │ │ │ ├── Index.razor │ │ │ ├── _Host.cshtml │ │ │ └── Error.cshtml │ │ ├── README.md │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Program.cs │ │ ├── ViteNET.BlazorServer.csproj │ │ ├── vite.config.ts │ │ └── .gitignore │ └── ViteNET.RazorPages │ │ ├── Assets │ │ ├── vite-env.d.ts │ │ ├── main.ts │ │ ├── counter.ts │ │ ├── public │ │ │ ├── dotnet.svg │ │ │ ├── typescript.svg │ │ │ └── vite.svg │ │ └── style.scss │ │ ├── Pages │ │ ├── _ViewStart.cshtml │ │ ├── _ViewImports.cshtml │ │ ├── Index.cshtml.cs │ │ ├── Shared │ │ │ └── _Layout.cshtml │ │ ├── Index.cshtml │ │ ├── Error.cshtml.cs │ │ └── Error.cshtml │ │ ├── appsettings.Development.json │ │ ├── README.md │ │ ├── appsettings.json │ │ ├── tsconfig.node.json │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── Program.cs │ │ ├── ViteNET.RazorPages.csproj │ │ ├── .gitignore │ │ └── vite.config.ts ├── libraries │ ├── ViteNET.React │ │ ├── Assets │ │ │ ├── vite-env.d.ts │ │ │ ├── main.tsx │ │ │ ├── App.css │ │ │ ├── App.tsx │ │ │ ├── public │ │ │ │ ├── dotnet.svg │ │ │ │ ├── typescript.svg │ │ │ │ └── vite.svg │ │ │ ├── index.css │ │ │ └── assets │ │ │ │ └── react.svg │ │ ├── Pages │ │ │ ├── _ViewStart.cshtml │ │ │ ├── Index.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── Shared │ │ │ │ └── _Layout.cshtml │ │ │ ├── Error.cshtml.cs │ │ │ └── Error.cshtml │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ ├── README.md │ │ ├── tsconfig.node.json │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Program.cs │ │ ├── ViteNET.React.csproj │ │ ├── .gitignore │ │ └── vite.config.ts │ ├── ViteNET.Solid │ │ ├── Assets │ │ │ ├── vite-env.d.ts │ │ │ ├── main.tsx │ │ │ ├── App.css │ │ │ ├── App.tsx │ │ │ ├── public │ │ │ │ ├── dotnet.svg │ │ │ │ ├── typescript.svg │ │ │ │ └── vite.svg │ │ │ ├── index.css │ │ │ └── assets │ │ │ │ └── solid.svg │ │ ├── Pages │ │ │ ├── _ViewStart.cshtml │ │ │ ├── Index.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── Shared │ │ │ │ └── _Layout.cshtml │ │ │ ├── Error.cshtml.cs │ │ │ └── Error.cshtml │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ ├── README.md │ │ ├── tsconfig.node.json │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Program.cs │ │ ├── ViteNET.Solid.csproj │ │ ├── .gitignore │ │ └── vite.config.ts │ └── ViteNET.Tailwind │ │ ├── Pages │ │ ├── _ViewStart.cshtml │ │ ├── _ViewImports.cshtml │ │ ├── Shared │ │ │ ├── _ValidationScriptsPartial.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Privacy.cshtml │ │ ├── Index.cshtml │ │ ├── Index.cshtml.cs │ │ ├── Privacy.cshtml.cs │ │ ├── Error.cshtml.cs │ │ └── Error.cshtml │ │ ├── wwwroot │ │ └── favicon.ico │ │ ├── Assets │ │ ├── ts │ │ │ └── site.ts │ │ └── app.ts │ │ ├── appsettings.json │ │ ├── appsettings.Development.json │ │ ├── README.md │ │ ├── tailwind.config.css │ │ ├── tsconfig.node.json │ │ ├── .gitignore │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── vite.config.ts │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ └── ViteNET.Tailwind.csproj ├── package.json ├── README.md └── ViteNET.sln ├── src ├── tests │ ├── ViteNetProject │ │ ├── .gitignore │ │ ├── appsettings.Development.json │ │ ├── Assets │ │ │ ├── src │ │ │ │ └── main.ts │ │ │ ├── package.json │ │ │ ├── tsconfig.json │ │ │ └── vite.config.ts │ │ ├── appsettings.json │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ └── ViteNetProject.csproj │ └── ViteNetProject.Tests │ │ ├── Usings.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── ViteNetProject.Tests.csproj │ │ └── ManifestTest.cs ├── Directory.Build.props ├── library │ └── Vite.AspNetCore │ │ ├── Vite.AspNetCore.csproj.DotSettings │ │ ├── Services │ │ ├── ViteTagHelperMonitor.cs │ │ └── ViteDevServerStatus.cs │ │ ├── HotReloadService.cs │ │ ├── ViteOptions.cs │ │ ├── Abstractions │ │ ├── IViteDevServerStatus.cs │ │ ├── IViteManifest.cs │ │ └── IViteChunk.cs │ │ ├── Extensions │ │ ├── ViteManifestExtensions.cs │ │ ├── ViteOptionsExtensions.cs │ │ └── ApplicationBuilderExtensions.cs │ │ ├── ViteChunk.cs │ │ ├── Vite.AspNetCore.csproj │ │ └── ViteDevServerOptions.cs ├── Directory.Packages.props └── Vite.AspNetCore.sln ├── .gitattributes ├── docs ├── vite.png └── vitenet.png ├── .github ├── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── build.yaml │ └── publish.yaml └── LICENSE /.csharpierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | /**/package-lock.json 2 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/.gitignore: -------------------------------------------------------------------------------- 1 | # root folder 2 | wwwroot/ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /docs/vite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eptagone/Vite.AspNetCore/HEAD/docs/vite.png -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /docs/vitenet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eptagone/Vite.AspNetCore/HEAD/docs/vitenet.png -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitenet/workspace", 3 | "workspaces": [ 4 | "libraries/*", 5 | "net/*" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eptagone/Vite.AspNetCore/HEAD/examples/libraries/ViteNET.Tailwind/wwwroot/favicon.ico -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | @{ 4 | ViewData["Title"] = "Vite + ASP.NET + TS"; 5 | } 6 | 7 | @* Nothing Here *@ 8 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | @{ 4 | ViewData["Title"] = "Vite + ASP.NET + TS"; 5 | } 6 | 7 | @* Nothing Here *@ 8 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Assets/ts/site.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: site.ts 3 | * Description: Main script for the application 4 | */ 5 | 6 | console.log('Hello from site.ts'); -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/app.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | console.log("Hello world"); 7 | 8 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/app.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | console.log("Hello world"); 7 | 8 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | Vite + ASP.NET + TS 4 | 5 |
6 | @Body 7 |
8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask for additional information about the project 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Assets/app.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: Main entry point for the application 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | import './ts/site'; -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ViteNET.MVC 2 | @using ViteNET.MVC.Models 3 | @using Vite.AspNetCore 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | @addTagHelper *, Vite.AspNetCore -------------------------------------------------------------------------------- /src/tests/ViteNetProject/Assets/src/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | 8 | console.log('Hello world!'); -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ViteNET.RazorPages 2 | @using Vite.AspNetCore 3 | @namespace ViteNET.RazorPages.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | @addTagHelper *, Vite.AspNetCore 6 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ViteNET.RazorPages 2 | @using Vite.AspNetCore 3 | @namespace ViteNET.RazorPages.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | @addTagHelper *, Vite.AspNetCore 6 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ViteNET.RazorPages 2 | @using Vite.AspNetCore 3 | @namespace ViteNET.RazorPages.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | @addTagHelper *, Vite.AspNetCore 6 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ViteNET.Tailwind 2 | @using Vite.AspNetCore; 3 | @namespace ViteNET.Tailwind.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | @addTagHelper *, Vite.AspNetCore 6 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject.Tests/Usings.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | global using Microsoft.AspNetCore.Mvc.Testing; 5 | global using Xunit; 6 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model PrivacyModel 3 | @{ 4 | ViewData["Title"] = "Privacy Policy"; 5 | } 6 |

@ViewData["Title"]

7 |

Use this page to detail your site's privacy policy.

8 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Vite": { 3 | "UseReactRefresh": true 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Information", 8 | "Microsoft.AspNetCore": "Warning" 9 | } 10 | }, 11 | "AllowedHosts": "*" 12 | } 13 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/README.md: -------------------------------------------------------------------------------- 1 | # ViteNET 2 | 3 | This is an example project with React. 4 | 5 | ## How to run 6 | 7 | The project is already configured to install the npm dependencies and run vite. So, simply run the ASP.NET application by running `dotnet run` or pressing `F5` in Visual Studio. 8 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/README.md: -------------------------------------------------------------------------------- 1 | # ViteNET 2 | 3 | This is an example project with SolidJS. 4 | 5 | ## How to run 6 | 7 | The project is already configured to install the npm dependencies and run vite. So, simply run the ASP.NET application by running `dotnet run` or pressing `F5` in Visual Studio. 8 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/README.md: -------------------------------------------------------------------------------- 1 | # ViteNET 2 | 3 | This is an example project with Tailwind. 4 | 5 | ## How to run 6 | 7 | The project is already configured to install the npm dependencies and run vite. So, simply run the ASP.NET application by running `dotnet run` or pressing `F5` in Visual Studio. 8 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/tailwind.config.css: -------------------------------------------------------------------------------- 1 | /* TailwindCSS configuration file. */ 2 | @import "tailwindcss"; 3 | @source "Assets/**/*.{ts,tsx}"; 4 | @source "Pages/**/*.{cshtml,razor}"; 5 | 6 | html { 7 | position: relative; 8 | height: 100%; 9 | } 10 | 11 | body { 12 | height: 100%; 13 | } 14 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | import { setupCounter } from './counter'; 8 | 9 | setupCounter(document.querySelector('#counter')!); 10 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/README.md: -------------------------------------------------------------------------------- 1 | # ViteNET 2 | 3 | This is an example project to show how to use Vite with ASP.NET MVC. 4 | 5 | ## How to run 6 | 7 | The project is already configured to install the npm dependencies and run vite. So, simply run the ASP.NET application by running `dotnet run` or pressing `F5` in Visual Studio. 8 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning", 6 | "System.Net.Http.HttpClient.Vite.AspNetCore.DevHttpClient": "Warning" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | latest 7 | 8.0-recommended 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | import { setupCounter } from './counter'; 8 | import './style.scss'; 9 | 10 | setupCounter(document.querySelector('#counter')!); 11 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/README.md: -------------------------------------------------------------------------------- 1 | # ViteNET 2 | 3 | This is an example project to show how to use Vite with ASP.NET Razor Pages. 4 | 5 | ## How to run 6 | 7 | The project is already configured to install the npm dependencies and run vite. So, simply run the ASP.NET application by running `dotnet run` or pressing `F5` in Visual Studio. 8 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning", 6 | "System.Net.Http.HttpClient.Vite.AspNetCore.DevHttpClient": "Warning" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | import { setupCounter } from './counter'; 8 | import './style.scss'; 9 | 10 | setupCounter(document.querySelector('#counter')!); 11 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | @{ 4 | ViewData["Title"] = "Home page"; 5 | } 6 | 7 |
8 |

Welcome

9 |

Learn about building Web apps with ASP.NET Core.

10 |
11 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace ViteNET.BlazorServer.Data; 2 | 3 | public class WeatherForecast 4 | { 5 | public DateOnly Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace ViteNET.MVC.Models; 5 | 6 | public class ErrorViewModel 7 | { 8 | public string? RequestId { get; set; } 9 | 10 | public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); 11 | } -------------------------------------------------------------------------------- /src/tests/ViteNetProject.Tests/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "ViteNetProject.Tests": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "https://localhost:64630;http://localhost:64631" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/main.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | /* @refresh reload */ 8 | import { render } from 'solid-js/web' 9 | 10 | import './index.css' 11 | import App from './App' 12 | 13 | const root = document.getElementById('app') 14 | 15 | render(() => , root!) 16 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace ViteNET.Tailwind.Pages; 4 | 5 | public class IndexModel : PageModel 6 | { 7 | private readonly ILogger _logger; 8 | 9 | public IndexModel(ILogger logger) 10 | { 11 | this._logger = logger; 12 | } 13 | 14 | public void OnGet() { } 15 | } 16 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace ViteNET.Tailwind.Pages; 4 | 5 | public class PrivacyModel : PageModel 6 | { 7 | private readonly ILogger _logger; 8 | 9 | public PrivacyModel(ILogger logger) 10 | { 11 | this._logger = logger; 12 | } 13 | 14 | public void OnGet() { } 15 | } 16 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/Assets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vitenet/net-test-project", 3 | "private": true, 4 | "type": "module", 5 | "packageManager": "pnpm@9.15.4", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build" 9 | }, 10 | "devDependencies": { 11 | "@types/node": "^22.15.17", 12 | "sass": "^1.83.4", 13 | "typescript": "^5.8.3", 14 | "vite": "^6.0.11" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/.gitignore: -------------------------------------------------------------------------------- 1 | # dist folder 2 | wwwroot/dist 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | pnpm-debug.log* 10 | lerna-debug.log* 11 | 12 | node_modules 13 | dist 14 | dist-ssr 15 | *.local 16 | 17 | # Editor directories and files 18 | .vscode/* 19 | !.vscode/extensions.json 20 | .idea 21 | .DS_Store 22 | *.suo 23 | *.ntvs* 24 | *.njsproj 25 | *.sln 26 | *.sw? -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitenet-net-mvc", 3 | "private": true, 4 | "version": "1.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "@types/node": "^22.15.17", 13 | "sass": "^1.83.4", 14 | "typescript": "^5.8.3", 15 | "vite": "^6.3.5" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitenet-net-blazor", 3 | "private": true, 4 | "version": "1.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "@types/node": "^22.15.17", 13 | "sass": "^1.83.4", 14 | "typescript": "^5.8.3", 15 | "vite": "^6.3.5" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitenet-net-razor-pages", 3 | "private": true, 4 | "version": "1.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "@types/node": "^22.15.17", 13 | "sass": "^1.83.4", 14 | "typescript": "^5.8.3", 15 | "vite": "^6.3.5" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/main.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: main.ts 3 | * Description: This is the main entry point for the app. 4 | */ 5 | 6 | import 'vite/modulepreload-polyfill'; 7 | import { createRoot } from "react-dom/client"; 8 | import './index.css'; 9 | import App from "./App"; 10 | 11 | const appElement = document.querySelector('#app')!; 12 | 13 | 14 | const root = createRoot(appElement); 15 | root.render(); 16 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitenet-lib-solid", 3 | "private": true, 4 | "version": "1.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build" 9 | }, 10 | "devDependencies": { 11 | "@types/node": "^22.15.17", 12 | "solid-js": "^1.9.4", 13 | "typescript": "^5.8.3", 14 | "vite": "^6.3.5", 15 | "vite-plugin-solid": "^2.11.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitenet-lib-tailwind", 3 | "private": true, 4 | "version": "1.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build" 9 | }, 10 | "devDependencies": { 11 | "@tailwindcss/vite": "^4.0.3", 12 | "@types/node": "^22.15.17", 13 | "tailwindcss": "^4.0.3", 14 | "typescript": "^5.8.3", 15 | "vite": "^6.3.5" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/counter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: counter.ts 3 | * Description: This is the counter script for the app. 4 | */ 5 | 6 | export function setupCounter(element: HTMLButtonElement) { 7 | let counter = 0; 8 | const setCounter = (count: number) => { 9 | counter = count; 10 | element.innerHTML = `count is ${counter}`; 11 | } 12 | element.addEventListener('click', () => setCounter(counter + 1)); 13 | setCounter(0); 14 | } 15 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/counter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: counter.ts 3 | * Description: This is the counter script for the app. 4 | */ 5 | 6 | export function setupCounter(element: HTMLButtonElement) { 7 | let counter = 0; 8 | const setCounter = (count: number) => { 9 | counter = count; 10 | element.innerHTML = `count is ${counter}`; 11 | } 12 | element.addEventListener('click', () => setCounter(counter + 1)); 13 | setCounter(0); 14 | } 15 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Vite.AspNetCore.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/counter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: counter.ts 3 | * Description: This is the counter script for the app. 4 | */ 5 | 6 | export function setupCounter(element: HTMLButtonElement) { 7 | let counter = 0; 8 | const setCounter = (count: number) => { 9 | counter = count; 10 | element.innerHTML = `count is ${counter}`; 11 | } 12 | element.addEventListener('click', () => setCounter(counter + 1)); 13 | setCounter(0); 14 | } 15 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using ViteNET.BlazorServer 10 | @using ViteNET.BlazorServer.Shared 11 | @using Vite.AspNetCore 12 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/App.css: -------------------------------------------------------------------------------- 1 | #app { 2 | max-width: 1280px; 3 | margin: 0 auto; 4 | padding: 2rem; 5 | text-align: center; 6 | } 7 | 8 | .logo { 9 | height: 6em; 10 | padding: 1.5em; 11 | will-change: filter; 12 | transition: filter 300ms; 13 | } 14 | .logo:hover { 15 | filter: drop-shadow(0 0 2em #646cffaa); 16 | } 17 | .logo.solid:hover { 18 | filter: drop-shadow(0 0 2em #61dafbaa); 19 | } 20 | 21 | .card { 22 | padding: 2em; 23 | } 24 | 25 | .read-the-docs { 26 | color: #888; 27 | } 28 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | 6 | namespace ViteNET.RazorPages.Pages; 7 | 8 | public class IndexModel : PageModel 9 | { 10 | private readonly ILogger _logger; 11 | 12 | public IndexModel(ILogger logger) 13 | { 14 | this._logger = logger; 15 | } 16 | 17 | public void OnGet() { } 18 | } 19 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | 6 | namespace ViteNET.RazorPages.Pages; 7 | 8 | public class IndexModel : PageModel 9 | { 10 | private readonly ILogger _logger; 11 | 12 | public IndexModel(ILogger logger) 13 | { 14 | this._logger = logger; 15 | } 16 | 17 | public void OnGet() { } 18 | } 19 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | 6 | namespace ViteNET.RazorPages.Pages; 7 | 8 | public class IndexModel : PageModel 9 | { 10 | private readonly ILogger _logger; 11 | 12 | public IndexModel(ILogger logger) 13 | { 14 | this._logger = logger; 15 | } 16 | 17 | public void OnGet() { } 18 | } 19 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vitenet-lib-react", 3 | "private": true, 4 | "version": "1.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build" 9 | }, 10 | "devDependencies": { 11 | "@types/node": "^22.15.17", 12 | "@types/react": "^18.3.21", 13 | "@types/react-dom": "^18.3.7", 14 | "@vitejs/plugin-react-swc": "^3.9.0", 15 | "react": "^19.1.0", 16 | "react-dom": "^19.1.0", 17 | "typescript": "^5.8.3", 18 | "vite": "^6.3.5" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Services/ViteTagHelperMonitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Service used by the ViteTagHelper to track the injection of the vite script and similar. 8 | /// 9 | public class ViteTagHelperMonitor 10 | { 11 | /// 12 | /// True if the vite script has been injected. 13 | /// 14 | public bool IsDevScriptInjected { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/blazor.scss: -------------------------------------------------------------------------------- 1 | /** 2 | Name: blazor.scss 3 | Description: This is the stylesheet for the Blazor error ui. 4 | */ 5 | 6 | #blazor-error { 7 | /*@at-root &-container { 8 | position: fixed; 9 | }*/ 10 | 11 | @at-root &-ui { 12 | background: lightyellow; 13 | bottom: 0; 14 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 15 | display: none; 16 | left: 0; 17 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 18 | position: fixed; 19 | width: 100%; 20 | z-index: 1000; 21 | 22 | .dismiss { 23 | cursor: pointer; 24 | position: absolute; 25 | right: 0.75rem; 26 | top: 0.5rem; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Vite.AspNetCore; 5 | 6 | var builder = WebApplication.CreateBuilder(args); 7 | 8 | // Add services to the container. 9 | builder.Services.AddRazorPages(); 10 | 11 | // Add the Vite services. 12 | builder.Services.AddViteServices(options => 13 | { 14 | options.Server.PackageManager = "pnpm"; 15 | }); 16 | 17 | var app = builder.Build(); 18 | 19 | app.UseStaticFiles(); 20 | app.UseRouting(); 21 | app.MapRazorPages(); 22 | 23 | app.Run(); 24 | 25 | public partial class Program { } 26 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/counter.scss: -------------------------------------------------------------------------------- 1 | /** 2 | Name: style.scss 3 | Description: This is the main stylesheet for the example project. 4 | */ 5 | 6 | .card { 7 | padding: 2em; 8 | } 9 | 10 | button { 11 | border-radius: 8px; 12 | border: 1px solid transparent; 13 | padding: 0.6em 1.2em; 14 | font-size: 1em; 15 | font-weight: 500; 16 | font-family: inherit; 17 | background-color: #1a1a1a; 18 | cursor: pointer; 19 | transition: border-color 0.25s; 20 | 21 | &:hover { 22 | border-color: #646cff; 23 | } 24 | 25 | &:focus, 26 | &:focus-visible { 27 | outline: 4px auto -webkit-focus-ring-color; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/counter.scss: -------------------------------------------------------------------------------- 1 | /** 2 | Name: style.scss 3 | Description: This is the main stylesheet for the example project. 4 | */ 5 | 6 | .card { 7 | padding: 2em; 8 | } 9 | 10 | button { 11 | border-radius: 8px; 12 | border: 1px solid transparent; 13 | padding: 0.6em 1.2em; 14 | font-size: 1em; 15 | font-weight: 500; 16 | font-family: inherit; 17 | background-color: #1a1a1a; 18 | cursor: pointer; 19 | transition: border-color 0.25s; 20 | 21 | &:hover { 22 | border-color: #646cff; 23 | } 24 | 25 | &:focus, 26 | &:focus-visible { 27 | outline: 4px auto -webkit-focus-ring-color; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "react-jsx", 16 | 17 | /* Linting */ 18 | "strict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noFallthroughCasesInSwitch": true 22 | }, 23 | "include": ["src"], 24 | "references": [{ "path": "./tsconfig.node.json" }] 25 | } 26 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | namespace ViteNET.BlazorServer.Data; 2 | 3 | public class WeatherForecastService 4 | { 5 | private static readonly string[] Summaries = new[] 6 | { 7 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 8 | }; 9 | 10 | public Task GetForecastAsync(DateOnly startDate) 11 | { 12 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 13 | { 14 | Date = startDate.AddDays(index), 15 | TemperatureC = Random.Shared.Next(-20, 55), 16 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 17 | }).ToArray()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @ViewData["Title"] 8 | 9 | @* This line includes the style from the "main.ts" entrypoint *@ 10 | 11 | 12 | 13 |
14 | @RenderBody() 15 |
16 | 17 | 18 | 19 | 20 | @await RenderSectionAsync("Scripts", required: false) 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Vite + ASP.NET + TypeScript

16 |
17 | 18 |
19 |

20 | Click on the Vite, ASP.NET and TypeScript logos to learn more 21 |

22 |
-------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "include": ["src"], 25 | "references": [{ "path": "./tsconfig.node.json" }] 26 | } 27 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | @ViewData["Title"] 9 | 10 | @* This line includes the style from the "main.ts" entrypoint *@ 11 | 12 | 13 | 14 | 15 |
16 | @RenderBody() 17 |
18 | 19 | 20 | 21 | 22 | @await RenderSectionAsync("Scripts", required: false) 23 | 24 | 25 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: Build & Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - dev 8 | pull_request: 9 | branches: 10 | - main 11 | - dev 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-latest 16 | defaults: 17 | run: 18 | working-directory: ./src 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Setup .NET 24 | uses: actions/setup-dotnet@v4 25 | with: 26 | dotnet-version: | 27 | 8.0.x 28 | 29 | - name: Restore dependencies 30 | run: dotnet restore 31 | - name: Build 32 | run: dotnet build --no-restore -c Release 33 | - name: Test 34 | run: dotnet test -c Release --no-build --verbosity normal 35 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "include": ["src"], 25 | "references": [{ "path": "./tsconfig.node.json" }] 26 | } 27 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "include": ["src"], 25 | "references": [{ "path": "./tsconfig.node.json" }] 26 | } 27 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "include": ["src"], 25 | "references": [{ "path": "./tsconfig.node.json" }] 26 | } 27 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "noEmit": true, 15 | "jsx": "preserve", 16 | "jsxImportSource": "solid-js", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "include": ["src"], 25 | "references": [{ "path": "./tsconfig.node.json" }] 26 | } 27 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/Assets/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "useDefineForClassFields": true, 6 | "lib": [ 7 | "ESNext", 8 | "DOM" 9 | ], 10 | "moduleResolution": "bundler", 11 | "strict": true, 12 | "sourceMap": true, 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "esModuleInterop": true, 16 | "noEmit": true, 17 | "noUnusedLocals": true, 18 | "noUnusedParameters": true, 19 | "noImplicitReturns": true, 20 | "noImplicitAny": true, 21 | "noImplicitThis": true, 22 | "skipLibCheck": true, 23 | "types": [ 24 | "vite/client" 25 | ] 26 | }, 27 | "include": [ 28 | "Assets", 29 | "vite.config.ts" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | * 5 | * @see https://vitejs.dev/guide/backend-integration.html 6 | * @see https://tailwindcss.com/docs/guides/vite 7 | */ 8 | 9 | import { defineConfig } from "vite"; 10 | import tailwindcss from "@tailwindcss/vite"; 11 | 12 | export default defineConfig({ 13 | appType: 'custom', 14 | base: '/dist/', 15 | publicDir: false, 16 | build: { 17 | manifest: true, 18 | emptyOutDir: true, 19 | outDir: 'wwwroot/dist', 20 | rollupOptions: { 21 | input: [ 22 | "Assets/app.ts", 23 | "tailwind.config.css", 24 | ], 25 | } 26 | }, 27 | plugins: [tailwindcss()] 28 | }); 29 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace ViteNET.BlazorServer.Pages; 6 | 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @ViewData["Title"] 8 | 9 | @* This line includes the style from the "main.ts" entrypoint *@ 10 | 11 | 12 | 13 |
14 | @RenderBody() 15 |
16 | 17 | 18 | 19 | 20 | @await RenderSectionAsync("Scripts", required: false) 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Device (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - IDE/Editor [e.g. VS 202X vXX, VS Code vX.X] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace ViteNET.Tailwind.Pages; 6 | 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | this._logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | this.RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/App.css: -------------------------------------------------------------------------------- 1 | #app { 2 | max-width: 1280px; 3 | margin: 0 auto; 4 | padding: 2rem; 5 | text-align: center; 6 | } 7 | 8 | .logo { 9 | height: 6em; 10 | padding: 1.5em; 11 | will-change: filter; 12 | transition: filter 300ms; 13 | } 14 | .logo:hover { 15 | filter: drop-shadow(0 0 2em #646cffaa); 16 | } 17 | .logo.react:hover { 18 | filter: drop-shadow(0 0 2em #61dafbaa); 19 | } 20 | 21 | @keyframes logo-spin { 22 | from { 23 | transform: rotate(0deg); 24 | } 25 | to { 26 | transform: rotate(360deg); 27 | } 28 | } 29 | 30 | @media (prefers-reduced-motion: no-preference) { 31 | a:nth-of-type(3) .logo { 32 | animation: logo-spin infinite 20s linear; 33 | } 34 | } 35 | 36 | .card { 37 | padding: 2em; 38 | } 39 | 40 | .read-the-docs { 41 | color: #888; 42 | } 43 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:29363", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "ViteNET": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:7157;http://localhost:5157", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:52710", 8 | "sslPort": 44303 9 | } 10 | }, 11 | "profiles": { 12 | "ViteNET.MVC": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "https://localhost:7281;http://localhost:5217", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:6337", 7 | "sslPort": 44363 8 | } 9 | }, 10 | "profiles": { 11 | "ViteNetProject": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:7132;http://localhost:5068", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/HotReloadService.cs: -------------------------------------------------------------------------------- 1 | #if DEBUG 2 | [assembly: System.Reflection.Metadata.MetadataUpdateHandlerAttribute( 3 | typeof(Vite.AspNetCore.HotReloadService) 4 | )] 5 | 6 | namespace Vite.AspNetCore; 7 | 8 | public static class HotReloadService 9 | { 10 | #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. 11 | public static event Action? UpdateApplicationEvent; 12 | #pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. 13 | 14 | internal static void ClearCache(Type[]? types) { } 15 | 16 | internal static void UpdateApplication(Type[]? types) 17 | { 18 | UpdateApplicationEvent?.Invoke(types); 19 | } 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | @{ 4 | ViewData["Title"] = "Vite + ASP.NET + TS"; 5 | } 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

Vite + ASP.NET + TypeScript

18 |
19 | 20 |
21 |

22 | Click on the Vite, ASP.NET and TypeScript logos to learn more 23 |

24 |
25 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViteDevServerStatus ViteDevServerStatus 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | @ViewData["Title"] 11 | 12 | @* This line includes the style from the "main.ts" entrypoint *@ 13 | 14 | 15 | 16 | 17 |
18 | @RenderBody() 19 |
20 | 21 | 22 | 23 | 24 | @await RenderSectionAsync("Scripts", required: false) 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/README.md: -------------------------------------------------------------------------------- 1 | # ViteNET 2 | 3 | This is an example project to show how to use Vite with Blazor Server. 4 | 5 | ## How to run 6 | 7 | The project is already configured to install the npm dependencies and run vite. So, simply run the ASP.NET application by running `dotnet run` or pressing `F5` in Visual Studio. 8 | 9 | ## Considerations when using Blazor 10 | 11 | Avoid running scripts directly from script tags. Blazor performs a pre-rendering process and if your scripts are executed before this process finishes, all events and references will be removed once rendering is complete. 12 | 13 | If you need to run a script after the page loads. It's recommended to import the script into from. See [index.razor](Pages/Index.razor). 14 | 15 | The Tag Helpers will be in the [_Host.cshtml](Pages/_Host.cshtml) file. 16 | 17 | Include the namespaces in the [_Imports.razor](_Imports.razor) file. 18 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.RazorPages; 6 | using System.Diagnostics; 7 | 8 | namespace ViteNET.RazorPages.Pages; 9 | 10 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 11 | [IgnoreAntiforgeryToken] 12 | public class ErrorModel : PageModel 13 | { 14 | public string? RequestId { get; set; } 15 | 16 | public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); 17 | 18 | private readonly ILogger _logger; 19 | 20 | public ErrorModel(ILogger logger) 21 | { 22 | this._logger = logger; 23 | } 24 | 25 | public void OnGet() 26 | { 27 | this.RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier; 28 | } 29 | } -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.RazorPages; 6 | using System.Diagnostics; 7 | 8 | namespace ViteNET.RazorPages.Pages; 9 | 10 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 11 | [IgnoreAntiforgeryToken] 12 | public class ErrorModel : PageModel 13 | { 14 | public string? RequestId { get; set; } 15 | 16 | public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); 17 | 18 | private readonly ILogger _logger; 19 | 20 | public ErrorModel(ILogger logger) 21 | { 22 | this._logger = logger; 23 | } 24 | 25 | public void OnGet() 26 | { 27 | this.RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier; 28 | } 29 | } -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using System.Diagnostics; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.AspNetCore.Mvc.RazorPages; 7 | 8 | namespace ViteNET.RazorPages.Pages; 9 | 10 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 11 | [IgnoreAntiforgeryToken] 12 | public class ErrorModel : PageModel 13 | { 14 | public string? RequestId { get; set; } 15 | 16 | public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); 17 | 18 | private readonly ILogger _logger; 19 | 20 | public ErrorModel(ILogger logger) 21 | { 22 | this._logger = logger; 23 | } 24 | 25 | public void OnGet() 26 | { 27 | this.RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/ViteOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Options for Vite. 8 | /// 9 | public record ViteOptions 10 | { 11 | public const string Vite = "Vite"; 12 | 13 | /// 14 | /// The manifest file name. Default is "manifest.json". 15 | /// 16 | public string Manifest { get; set; } = Path.Combine(".vite", "manifest.json"); 17 | 18 | /// 19 | /// The subfolder where your assets will be located, including the manifest file. 20 | /// This value is relative to the web root path. 21 | /// 22 | public string? Base { get; set; } 23 | 24 | /// 25 | /// Options for the Vite Development Server. 26 | /// 27 | public ViteDevServerOptions Server { get; set; } = new(); 28 | } 29 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |

26 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ErrorModel 3 | @{ 4 | ViewData["Title"] = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | @if (Model.ShowRequestId) 11 | { 12 |

13 | Request ID: @Model.RequestId 14 |

15 | } 16 | 17 |

Development Mode

18 |

19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |

21 |

22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |

27 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ErrorModel 3 | @{ 4 | ViewData["Title"] = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | @if (Model.ShowRequestId) 11 | { 12 |

13 | Request ID: @Model.RequestId 14 |

15 | } 16 | 17 |

Development Mode

18 |

19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |

21 |

22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |

27 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ErrorModel 3 | @{ 4 | ViewData["Title"] = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | @if (Model.ShowRequestId) 11 | { 12 |

13 | Request ID: @Model.RequestId 14 |

15 | } 16 | 17 |

Development Mode

18 |

19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |

21 |

22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |

27 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ErrorModel 3 | @{ 4 | ViewData["Title"] = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | @if (Model.ShowRequestId) 11 | { 12 |

13 | Request ID: @Model.RequestId 14 |

15 | } 16 | 17 |

Development Mode

18 |

19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |

21 |

22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |

27 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Program.cs: -------------------------------------------------------------------------------- 1 | using Vite.AspNetCore; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | 5 | // Add services to the container. 6 | builder.Services.AddRazorPages(); 7 | 8 | // Add Vite services to the container. 9 | builder.Services.AddViteServices(config => 10 | { 11 | config.Base = "/dist/"; 12 | config.Server.AutoRun = true; 13 | }); 14 | 15 | var app = builder.Build(); 16 | 17 | // Configure the HTTP request pipeline. 18 | if (!app.Environment.IsDevelopment()) 19 | { 20 | app.UseExceptionHandler("/Error"); 21 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 22 | app.UseHsts(); 23 | } 24 | 25 | app.UseHttpsRedirection(); 26 | app.UseStaticFiles(); 27 | 28 | app.UseRouting(); 29 | 30 | app.UseAuthorization(); 31 | 32 | app.MapRazorPages(); 33 | 34 | if (app.Environment.IsDevelopment()) 35 | { 36 | app.UseWebSockets(); 37 | app.UseViteDevelopmentServer(); 38 | } 39 | 40 | app.Run(); 41 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:26307", 8 | "sslPort": 44337 9 | } 10 | }, 11 | "profiles": { 12 | "HTTPS": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "https://localhost:7032;http://localhost:5274", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:44465", 8 | "sslPort": 44342 9 | } 10 | }, 11 | "profiles": { 12 | "ViteNET.React": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "https://localhost:7053;http://localhost:5044", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:44465", 8 | "sslPort": 44342 9 | } 10 | }, 11 | "profiles": { 12 | "ViteNET.Solid": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "https://localhost:7053;http://localhost:5044", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Program.cs: -------------------------------------------------------------------------------- 1 | using Vite.AspNetCore; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | 5 | // Add services to the container. 6 | builder.Services.AddRazorPages(); 7 | 8 | // Add the Vite services. 9 | builder.Services.AddViteServices(options => 10 | { 11 | options.Server.AutoRun = true; 12 | options.Server.Https = true; 13 | }); 14 | 15 | var app = builder.Build(); 16 | 17 | // Configure the HTTP request pipeline. 18 | if (!app.Environment.IsDevelopment()) 19 | { 20 | app.UseExceptionHandler("/Error"); 21 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 22 | app.UseHsts(); 23 | } 24 | 25 | app.UseHttpsRedirection(); 26 | 27 | app.UseStaticFiles(); 28 | 29 | app.UseRouting(); 30 | 31 | app.UseAuthorization(); 32 | 33 | app.MapRazorPages(); 34 | 35 | if (app.Environment.IsDevelopment()) 36 | { 37 | app.UseWebSockets(); 38 | // Use Vite Dev Server as middleware. 39 | app.UseViteDevelopmentServer(true); 40 | } 41 | 42 | app.Run(); 43 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | release: 5 | types: [published] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | publish: 10 | name: build, pack & publish 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./src 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Setup .NET 20 | uses: actions/setup-dotnet@v4 21 | with: 22 | dotnet-version: | 23 | 8.0.x 24 | 25 | - name: Restore dependencies 26 | run: dotnet restore 27 | - name: Build 28 | run: dotnet build -c Release 29 | - name: Test 30 | run: dotnet test -c Release --no-build --verbosity normal 31 | - name: Pack 32 | run: dotnet pack library/Vite.AspNetCore -c Release -o ./nupkgs --no-build 33 | - name: Publish 34 | env: 35 | NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }} 36 | run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ env.NUGET_AUTH_TOKEN }} --skip-duplicate -s https://api.nuget.org/v3/index.json 37 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | This directory contains examples of using the `Vite.AspNetCore` package. 4 | 5 | ## Available Examples 6 | 7 | ### Examples with the .NET frameworks 8 | 9 | All of these projects implement the same website using different .NET frameworks. The site is based on the Vite templates and looks like this: 10 | 11 | ![ViteNET](../docs/vitenet.png) 12 | 13 | - [ViteNET.RazorPages](net/ViteNET.RazorPages/README.md) - An example of using `Vite.AspNetCore` with Razor Pages. 14 | - [ViteNET.MVC](net/ViteNET.MVC/README.md) - An example of using `Vite.AspNetCore` with MVC. 15 | - [ViteNET.BlazorServer](net/ViteNET.BlazorServer/README.md) - An example of using `Vite.AspNetCore` with Blazor Server. 16 | 17 | ### Examples with JS libraries 18 | 19 | - [ViteNET.React](libraries/ViteNET.React/README.md) - An example of using `Vite.AspNetCore` with React. 20 | - [ViteNET.Solid](libraries/ViteNET.Solid/README.md) - An example of using `Vite.AspNetCore` with SolidJS. 21 | - [ViteNET.TailwindCSS](libraries/ViteNET.Tailwind/README.md) - An example of using `Vite.AspNetCore` with Tailwind CSS. 22 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject.Tests/ViteNetProject.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | all 16 | 17 | 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | all 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Program.cs: -------------------------------------------------------------------------------- 1 | using Vite.AspNetCore; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | 5 | // Add services to the container. 6 | builder.Services.AddRazorPages(); 7 | 8 | // Add the Vite services. 9 | builder.Services.AddViteServices(options => 10 | { 11 | options.Server.AutoRun = true; 12 | options.Server.Https = true; 13 | options.Server.UseReactRefresh = true; 14 | }); 15 | 16 | var app = builder.Build(); 17 | 18 | // Configure the HTTP request pipeline. 19 | if (!app.Environment.IsDevelopment()) 20 | { 21 | app.UseExceptionHandler("/Error"); 22 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 23 | app.UseHsts(); 24 | } 25 | 26 | app.UseHttpsRedirection(); 27 | 28 | app.UseStaticFiles(); 29 | 30 | app.UseRouting(); 31 | 32 | app.UseAuthorization(); 33 | 34 | app.MapRazorPages(); 35 | 36 | if (app.Environment.IsDevelopment()) 37 | { 38 | app.UseWebSockets(); 39 | // Use Vite Dev Server as middleware. 40 | app.UseViteDevelopmentServer(true); 41 | } 42 | 43 | app.Run(); 44 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Views/Shared/_Layout.cshtml.css: -------------------------------------------------------------------------------- 1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | for details on configuring this project to bundle and minify static web assets. */ 3 | 4 | a.navbar-brand { 5 | white-space: normal; 6 | text-align: center; 7 | word-break: break-all; 8 | } 9 | 10 | a { 11 | color: #0077cc; 12 | } 13 | 14 | .btn-primary { 15 | color: #fff; 16 | background-color: #1b6ec2; 17 | border-color: #1861ac; 18 | } 19 | 20 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 21 | color: #fff; 22 | background-color: #1b6ec2; 23 | border-color: #1861ac; 24 | } 25 | 26 | .border-top { 27 | border-top: 1px solid #e5e5e5; 28 | } 29 | .border-bottom { 30 | border-bottom: 1px solid #e5e5e5; 31 | } 32 | 33 | .box-shadow { 34 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 35 | } 36 | 37 | button.accept-policy { 38 | font-size: 1rem; 39 | line-height: inherit; 40 | } 41 | 42 | .footer { 43 | position: absolute; 44 | bottom: 0; 45 | width: 100%; 46 | white-space: nowrap; 47 | line-height: 60px; 48 | } 49 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:59426", 7 | "sslPort": 44361 8 | } 9 | }, 10 | "profiles": { 11 | "http": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "http://localhost:5244", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "https": { 21 | "commandName": "Project", 22 | "dotnetRunMessages": true, 23 | "launchBrowser": true, 24 | "applicationUrl": "https://localhost:7174;http://localhost:5244", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | }, 29 | "IIS Express": { 30 | "commandName": "IISExpress", 31 | "launchBrowser": true, 32 | "environmentVariables": { 33 | "ASPNETCORE_ENVIRONMENT": "Development" 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Quetzal Rivera 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Abstractions/IViteDevServerStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Provides information about the Vite development server. 8 | /// 9 | public interface IViteDevServerStatus 10 | { 11 | /// 12 | /// True if the development server is enabled, otherwise false. 13 | /// 14 | public bool IsEnabled { get; } 15 | 16 | /// 17 | /// True if the middleware is enabled, otherwise false. 18 | /// 19 | public bool IsMiddlewareEnable { get; } 20 | 21 | /// 22 | /// The URL of the Vite development server. 23 | /// 24 | public string ServerUrl { get; } 25 | 26 | /// 27 | /// The URL of the Vite development server with base path. 28 | /// 29 | public string ServerUrlWithBasePath { get; } 30 | 31 | /// 32 | /// The base path of the Vite development server. 33 | /// 34 | public string BasePath { get; } 35 | } 36 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Program.cs: -------------------------------------------------------------------------------- 1 | using ViteNET.BlazorServer.Data; 2 | using Vite.AspNetCore; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | // Add services to the container. 7 | builder.Services.AddRazorPages(); 8 | builder.Services.AddServerSideBlazor(); 9 | builder.Services.AddSingleton(); 10 | 11 | // Add Vite services 12 | builder.Services.AddViteServices(options => 13 | { 14 | options.Server.Https = true; 15 | options.Server.AutoRun = true; 16 | }); 17 | 18 | var app = builder.Build(); 19 | 20 | // Configure the HTTP request pipeline. 21 | if (!app.Environment.IsDevelopment()) 22 | { 23 | app.UseExceptionHandler("/Error"); 24 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 25 | app.UseHsts(); 26 | } 27 | 28 | app.UseHttpsRedirection(); 29 | 30 | app.UseStaticFiles(); 31 | 32 | app.UseRouting(); 33 | 34 | app.MapBlazorHub(); 35 | app.MapFallbackToPage("/_Host"); 36 | 37 | if (app.Environment.IsDevelopment()) 38 | { 39 | app.UseWebSockets(); 40 | // Use Vite Dev Server as middleware. 41 | app.UseViteDevelopmentServer(true); 42 | } 43 | 44 | app.Run(); 45 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Vite.AspNetCore; 5 | 6 | var builder = WebApplication.CreateBuilder(args); 7 | 8 | // Add services to the container. 9 | builder.Services.AddRazorPages(); 10 | 11 | // Add the Vite services. 12 | builder.Services.AddViteServices(options => 13 | { 14 | options.Server.AutoRun = true; 15 | options.Server.Https = true; 16 | }); 17 | 18 | var app = builder.Build(); 19 | 20 | // Configure the HTTP request pipeline. 21 | 22 | if (!app.Environment.IsDevelopment()) 23 | { 24 | app.UseExceptionHandler("/Error"); 25 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 26 | app.UseHsts(); 27 | } 28 | 29 | app.UseHttpsRedirection(); 30 | app.UseStaticFiles(); 31 | app.UseRouting(); 32 | app.UseAuthorization(); 33 | 34 | app.MapRazorPages(); 35 | 36 | if (app.Environment.IsDevelopment()) 37 | { 38 | app.UseWebSockets(); 39 | // Use Vite Dev Server as middleware. 40 | app.UseViteDevelopmentServer(true); 41 | } 42 | 43 | app.Run(); 44 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using System.Diagnostics; 5 | using Microsoft.AspNetCore.Mvc; 6 | using ViteNET.MVC.Models; 7 | 8 | namespace ViteNET.MVC.Controllers; 9 | 10 | public class HomeController : Controller 11 | { 12 | private readonly ILogger _logger; 13 | 14 | public HomeController(ILogger logger) 15 | { 16 | this._logger = logger; 17 | } 18 | 19 | public IActionResult Index() 20 | { 21 | return this.View(); 22 | } 23 | 24 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 25 | public IActionResult Error() 26 | { 27 | return this.View( 28 | new ErrorViewModel 29 | { 30 | RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier 31 | } 32 | ); 33 | } 34 | 35 | [HttpGet("/hello")] 36 | [HttpPost("/hello")] 37 | public IActionResult Hello() 38 | { 39 | string randomString = Guid.NewGuid().ToString(); 40 | return this.Ok($"Hello World! GUID: {randomString}"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Vite.AspNetCore; 5 | 6 | var builder = WebApplication.CreateBuilder(args); 7 | 8 | // Add services to the container. 9 | builder.Services.AddControllersWithViews(); 10 | // Add the Vite services. 11 | builder.Services.AddViteServices(options => 12 | { 13 | options.Server.AutoRun = true; 14 | options.Server.Https = true; 15 | }); 16 | 17 | var app = builder.Build(); 18 | 19 | // Configure the HTTP request pipeline. 20 | 21 | if (!app.Environment.IsDevelopment()) 22 | { 23 | app.UseExceptionHandler("/Home/Error"); 24 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 25 | app.UseHsts(); 26 | } 27 | 28 | app.UseHttpsRedirection(); 29 | app.UseStaticFiles(); 30 | 31 | app.UseRouting(); 32 | app.UseAuthorization(); 33 | 34 | app.MapControllerRoute( 35 | name: "default", 36 | pattern: "{controller=Home}/{action=Index}/{id?}"); 37 | 38 | if (app.Environment.IsDevelopment()) 39 | { 40 | app.UseWebSockets(); 41 | // Use Vite Dev Server as middleware. 42 | app.UseViteDevelopmentServer(true); 43 | } 44 | 45 | app.Run(); 46 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/public/dotnet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 14 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/App.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'react' 2 | import reactLogo from './assets/react.svg' 3 | import viteLogo from '/vite.svg' 4 | import dotnetLogo from '/dotnet.svg' 5 | import './App.css' 6 | 7 | function App() { 8 | const [count, setCount] = useState(0) 9 | 10 | return ( 11 | <> 12 | 23 |

Vite + ASP.NET + React

24 |
25 | 28 |

29 | Edit src/App.tsx and save to test HMR 30 |

31 |
32 |

33 | Click on the Vite, ASP.NET and React logos to learn more 34 |

35 | 36 | ) 37 | } 38 | 39 | export default App 40 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/public/dotnet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 14 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/App.tsx: -------------------------------------------------------------------------------- 1 | import { createSignal } from 'solid-js' 2 | import solidLogo from './assets/solid.svg' 3 | import viteLogo from '/vite.svg' 4 | import dotnetLogo from '/dotnet.svg' 5 | import './App.css' 6 | 7 | function App() { 8 | const [count, setCount] = createSignal(0) 9 | 10 | return ( 11 | <> 12 | 23 |

Vite + ASP.NET + Solid

24 |
25 | 28 |

29 | Edit src/App.tsx and save to test HMR 30 |

31 |
32 |

33 | Click on the Vite, ASP.NET and Solid logos to learn more 34 |

35 | 36 | ) 37 | } 38 | 39 | export default App 40 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/public/dotnet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 14 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/public/dotnet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 14 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/public/dotnet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 14 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Extensions/ViteManifestExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | internal static class ViteManifestExtensions 7 | { 8 | internal static IEnumerable GetRecursiveCssFiles( 9 | this IViteManifest manifest, 10 | string chunkName 11 | ) => GetRecursiveCssFiles(manifest, chunkName, new HashSet()); 12 | 13 | private static IEnumerable GetRecursiveCssFiles( 14 | IViteManifest manifest, 15 | string chunkName, 16 | ICollection processedChunks 17 | ) 18 | { 19 | if (processedChunks.Contains(chunkName)) 20 | { 21 | return []; 22 | } 23 | 24 | var chunk = manifest[chunkName]; 25 | var cssFiles = new HashSet(chunk?.Css ?? []); 26 | if (chunk?.Imports?.Any() == true) 27 | { 28 | processedChunks.Add(chunkName); 29 | foreach (var import in chunk.Imports) 30 | { 31 | var otherCssFiles = GetRecursiveCssFiles(manifest, import, processedChunks); 32 | cssFiles.UnionWith(otherCssFiles); 33 | } 34 | } 35 | 36 | return cssFiles.Distinct(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @inject IJSRuntime JS 3 | @inject IViteManifest Manifest 4 | @inject IViteDevServerStatus ViteStatusService 5 | @inject IHostEnvironment Environment 6 | 7 | Index 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

Vite + ASP.NET + TypeScript

20 |
21 | 22 |
23 |

24 | Click on the Vite, ASP.NET and TypeScript logos to learn more 25 |

26 |
27 | 28 | 29 | @code { 30 | private ElementReference counterButton; 31 | 32 | protected override async Task OnAfterRenderAsync(bool firstRender) 33 | { 34 | if (firstRender) 35 | { 36 | var mainModule = ViteStatusService.IsEnabled 37 | ? $"{ViteStatusService.ServerUrlWithBasePath}/main.ts" 38 | : $"/{Manifest["main.ts"]!.File}"; 39 | await JS.InvokeAsync("import", mainModule); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Abstractions/IViteManifest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Represents a Vite manifest file. 8 | /// 9 | public interface IViteManifest : IEnumerable 10 | { 11 | /// 12 | /// Gets the Vite chunk for the specified entry point if it exists. 13 | /// If Dev Server is enabled, this will always return . 14 | /// 15 | /// 16 | /// The chunk if it exists, otherwise . 17 | IViteChunk? this[string key] { get; } 18 | 19 | /// 20 | /// Gets an enumerable collection that contains the chunk keys in the manifest. 21 | /// 22 | /// An enumerable collection that contains the chunk keys in the manifest. 23 | IEnumerable Keys { get; } 24 | 25 | /// 26 | /// Determines whether the manifest contains a chunk with the specified key entry. 27 | /// 28 | /// The eky entry to locate. 29 | /// true if the manifest contains a chunk with the specified key entry; otherwise, false. 30 | bool ContainsKey(string key); 31 | } 32 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using Microsoft.AspNetCore.Components.Web 3 | @namespace ViteNET.BlazorServer.Pages 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | @addTagHelper *, Vite.AspNetCore 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | @* This line includes the style from the "main.scss" entrypoint *@ 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | An error has occurred. This application may no longer respond until reloaded. 25 | 26 | 27 | An unhandled exception has occurred. See browser dev tools for details. 28 | 29 | Reload 30 | 🗙 31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/public/typescript.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/public/typescript.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/public/typescript.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/public/typescript.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/public/typescript.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/index.css: -------------------------------------------------------------------------------- 1 | :root { 2 | font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; 3 | line-height: 1.5; 4 | font-weight: 400; 5 | 6 | color-scheme: light dark; 7 | color: rgba(255, 255, 255, 0.87); 8 | background-color: #242424; 9 | 10 | font-synthesis: none; 11 | text-rendering: optimizeLegibility; 12 | -webkit-font-smoothing: antialiased; 13 | -moz-osx-font-smoothing: grayscale; 14 | } 15 | 16 | a { 17 | font-weight: 500; 18 | color: #646cff; 19 | text-decoration: inherit; 20 | } 21 | a:hover { 22 | color: #535bf2; 23 | } 24 | 25 | body { 26 | margin: 0; 27 | display: flex; 28 | place-items: center; 29 | min-width: 320px; 30 | min-height: 100vh; 31 | } 32 | 33 | h1 { 34 | font-size: 3.2em; 35 | line-height: 1.1; 36 | } 37 | 38 | button { 39 | border-radius: 8px; 40 | border: 1px solid transparent; 41 | padding: 0.6em 1.2em; 42 | font-size: 1em; 43 | font-weight: 500; 44 | font-family: inherit; 45 | background-color: #1a1a1a; 46 | cursor: pointer; 47 | transition: border-color 0.25s; 48 | } 49 | button:hover { 50 | border-color: #646cff; 51 | } 52 | button:focus, 53 | button:focus-visible { 54 | outline: 4px auto -webkit-focus-ring-color; 55 | } 56 | 57 | @media (prefers-color-scheme: light) { 58 | :root { 59 | color: #213547; 60 | background-color: #ffffff; 61 | } 62 | a:hover { 63 | color: #747bff; 64 | } 65 | button { 66 | background-color: #f9f9f9; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Extensions/ViteOptionsExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Define extension methods for 8 | /// 9 | internal static class ViteOptionsExtensions 10 | { 11 | internal static string GetViteDevServerUrl(this ViteOptions options) 12 | { 13 | // Get the port and host from the configuration. 14 | var host = options.Server.Host; 15 | var port = options.Server.Port; 16 | // Check if https is enabled. 17 | var https = options.Server.Https; 18 | 19 | var serverUrl = $"{(https ? "https" : "http")}://{host}"; 20 | if (port is not null) 21 | { 22 | serverUrl += $":{port}"; 23 | } 24 | 25 | // Return the url. 26 | return serverUrl; 27 | } 28 | 29 | internal static string GetViteDevServerUrlWithBasePath(this ViteOptions options) 30 | { 31 | var serverUrl = options.GetViteDevServerUrl(); 32 | var basePath = options.GetViteBasePath(); 33 | return $"{serverUrl}{basePath}"; 34 | } 35 | 36 | internal static string GetViteBasePath(this ViteOptions options) { 37 | var basePath = options.Base?.Trim('/'); 38 | return string.IsNullOrEmpty(basePath) 39 | ? string.Empty 40 | : $"/{basePath}"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Extensions/ApplicationBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Builder; 5 | 6 | namespace Vite.AspNetCore; 7 | 8 | /// 9 | /// Vite extension methods for . 10 | /// 11 | public static class ApplicationBuilderExtensions 12 | { 13 | /// 14 | /// Instructs the Tag Helpers to render urls to the Vite Development Server and adds the to the pipeline if it is enabled. 15 | /// 16 | /// The instance this method extends. 17 | /// If true, a middleware will be registered to proxy all requests to the Vite Development Server. 18 | /// The instance this method extends. 19 | /// 20 | public static IApplicationBuilder UseViteDevelopmentServer( 21 | this IApplicationBuilder app, 22 | bool useMiddleware = false 23 | ) 24 | { 25 | ArgumentNullException.ThrowIfNull(app); 26 | ViteDevServerStatus.IsEnabled = true; 27 | ViteDevServerStatus.IsMiddlewareEnable = useMiddleware; 28 | 29 | return useMiddleware ? app.UseMiddleware() : app; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/index.css: -------------------------------------------------------------------------------- 1 | :root { 2 | font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; 3 | line-height: 1.5; 4 | font-weight: 400; 5 | 6 | color-scheme: light dark; 7 | color: rgba(255, 255, 255, 0.87); 8 | background-color: #242424; 9 | 10 | font-synthesis: none; 11 | text-rendering: optimizeLegibility; 12 | -webkit-font-smoothing: antialiased; 13 | -moz-osx-font-smoothing: grayscale; 14 | } 15 | 16 | a { 17 | font-weight: 500; 18 | color: #646cff; 19 | text-decoration: inherit; 20 | } 21 | 22 | a:hover { 23 | color: #535bf2; 24 | } 25 | 26 | body { 27 | margin: 0; 28 | display: flex; 29 | place-items: center; 30 | min-width: 320px; 31 | min-height: 100vh; 32 | } 33 | 34 | h1 { 35 | font-size: 3.2em; 36 | line-height: 1.1; 37 | } 38 | 39 | button { 40 | border-radius: 8px; 41 | border: 1px solid transparent; 42 | padding: 0.6em 1.2em; 43 | font-size: 1em; 44 | font-weight: 500; 45 | font-family: inherit; 46 | background-color: #1a1a1a; 47 | cursor: pointer; 48 | transition: border-color 0.25s; 49 | } 50 | 51 | button:hover { 52 | border-color: #646cff; 53 | } 54 | 55 | button:focus, 56 | button:focus-visible { 57 | outline: 4px auto -webkit-focus-ring-color; 58 | } 59 | 60 | @media (prefers-color-scheme: light) { 61 | :root { 62 | color: #213547; 63 | background-color: #ffffff; 64 | } 65 | 66 | a:hover { 67 | color: #747bff; 68 | } 69 | 70 | button { 71 | background-color: #f9f9f9; 72 | } 73 | } -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .top-row, article { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/assets/solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/ViteNetProject.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/ViteChunk.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Represents a chunk of JavaScript or CSS code generated by Vite. 8 | /// 9 | public record ViteChunk : IViteChunk 10 | { 11 | /// 12 | /// Gets the file name of the chunk. 13 | /// 14 | public string File { get; init; } = null!; 15 | 16 | /// 17 | /// The relative src path from project root. 18 | /// 19 | public string? Src { get; init; } 20 | 21 | /// 22 | /// True, if the current chunk file is an entrypoint. 23 | /// 24 | public bool? IsEntry { get; init; } 25 | 26 | /// 27 | /// List of chunk paths that are imported by the current chunk. 28 | /// 29 | public IEnumerable? DynamicImports { get; init; } 30 | 31 | /// 32 | /// List of all CSS files imported by the current chunk. 33 | /// 34 | public IEnumerable? Css { get; init; } 35 | 36 | /// 37 | /// List of all assets imported by the current chunk. 38 | /// 39 | public IEnumerable? Assets { get; init; } 40 | 41 | /// 42 | /// True, if the current chunk if a dynamic import entrypoint. 43 | /// 44 | public bool? IsDynamicEntry { get; init; } 45 | 46 | /// 47 | /// List of all imports. 48 | /// 49 | public IEnumerable? Imports { get; init; } 50 | } 51 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Abstractions/IViteChunk.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using System.Diagnostics.CodeAnalysis; 5 | 6 | namespace Vite.AspNetCore; 7 | 8 | /// 9 | /// Represents a chunk of JavaScript or CSS code generated by Vite. 10 | /// 11 | public interface IViteChunk 12 | { 13 | /// 14 | /// Gets the file name of the chunk. 15 | /// 16 | string File { get; } 17 | 18 | /// 19 | /// The relative src path from project root. 20 | /// 21 | string? Src { get; } 22 | 23 | /// 24 | /// True, if the current chunk file is an entrypoint. 25 | /// 26 | bool? IsEntry { get; } 27 | 28 | /// 29 | /// List of chunk paths that are imported by the current chunk. 30 | /// 31 | IEnumerable? DynamicImports { get; } 32 | 33 | /// 34 | /// List of all CSS files imported by the current chunk. 35 | /// 36 | IEnumerable? Css { get; } 37 | 38 | /// 39 | /// List of all assets imported by the current chunk. 40 | /// 41 | IEnumerable? Assets { get; } 42 | 43 | /// 44 | /// True, if the current chunk if a dynamic import entrypoint. 45 | /// 46 | bool? IsDynamicEntry { get; } 47 | 48 | /// 49 | /// List of all imports. 50 | /// 51 | [SuppressMessage("Naming", "CA1716:Identifiers should not match keywords")] 52 | IEnumerable? Imports { get; } 53 | } 54 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ViteNET.BlazorServer.Pages.ErrorModel 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Error 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Error.

19 |

An error occurred while processing your request.

20 | 21 | @if (Model.ShowRequestId) 22 | { 23 |

24 | Request ID: @Model.RequestId 25 |

26 | } 27 | 28 |

Development Mode

29 |

30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |

32 |

33 | The Development environment shouldn't be enabled for deployed applications. 34 | It can result in displaying sensitive information from exceptions to end users. 35 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 36 | and restarting the app. 37 |

38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/Assets/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Vite.AspNetCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Vite for ASPNET 5 | Quetzal Rivera 6 | Quetzal Rivera 2024 © 7 | A lightweight library for integrating ViteJs into ASP.NET MPA projects. 8 | False 9 | README.md 10 | vite.png 11 | https://github.com/Eptagone/Vite.AspNetCore 12 | Vite;ViteJS;AspNet;MPA;Middleware;Server;Assets;Mvc;WebPages 13 | LICENSE 14 | True 15 | 2.4.1 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | all 27 | runtime; build; native; contentfiles; analyzers; buildtransitive 28 | 29 | 30 | 31 | 32 | 33 | True 34 | \ 35 | 36 | 37 | True 38 | \ 39 | 40 | 41 | 42 | 43 | 44 | True 45 | \ 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/ViteNET.React.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/ViteNET.Solid.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/ViteNET.RazorPages.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/Services/ViteDevServerStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Microsoft.Extensions.Options; 5 | 6 | namespace Vite.AspNetCore; 7 | 8 | /// 9 | /// Provides information about the Vite development server. 10 | /// 11 | sealed class ViteDevServerStatus : IViteDevServerStatus 12 | { 13 | internal static bool IsEnabled { get; set; } 14 | internal static bool IsMiddlewareEnable { get; set; } 15 | private readonly ViteOptions options; 16 | 17 | /// 18 | /// Initializes a new instance of the . 19 | /// 20 | /// Options to configure the Vite development server. 21 | /// The Vite Development Server launcher. 22 | public ViteDevServerStatus( 23 | IOptions options, 24 | ViteDevServerLauncher devServerLauncher 25 | ) 26 | { 27 | this.options = options.Value; 28 | 29 | // Make sure the Vite Development Server is running if AutoRun is true. 30 | if (IsEnabled && this.options.Server.AutoRun) 31 | { 32 | devServerLauncher.LaunchIfNotRunning(); 33 | } 34 | } 35 | 36 | /// 37 | bool IViteDevServerStatus.IsEnabled => IsEnabled; 38 | 39 | /// 40 | bool IViteDevServerStatus.IsMiddlewareEnable => IsMiddlewareEnable; 41 | 42 | /// 43 | string IViteDevServerStatus.ServerUrl => this.options.GetViteDevServerUrl(); 44 | 45 | /// 46 | string IViteDevServerStatus.ServerUrlWithBasePath => 47 | this.options.GetViteDevServerUrlWithBasePath(); 48 | 49 | /// 50 | string IViteDevServerStatus.BasePath => this.options.GetViteBasePath(); 51 | } 52 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/Pages/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewData["Title"] - ViteNET.Tailwind 7 | 8 | @* *@ 9 | 10 | 11 |
12 |
13 | 26 |
27 |
28 | @RenderBody() 29 |
30 | 31 |
32 |
33 | © 2024 - ViteNET.Tailwind - Privacy 34 |
35 |
36 |
37 | 38 | 39 | @await RenderSectionAsync("Scripts", required: false) 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/ViteNET.MVC.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Tailwind/ViteNET.Tailwind.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/ViteNET.BlazorServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject/Assets/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | */ 5 | 6 | import { defineConfig } from 'vite'; 7 | 8 | // Pattern for CSS files 9 | const cssPattern = /\.css$/; 10 | // Pattern for image files 11 | const imagePattern = /\.(png|jpe?g|gif|svg|webp|avif)$/; 12 | 13 | // Define Vite configuration 14 | export default defineConfig({ 15 | appType: 'custom', 16 | publicDir: false, 17 | build: { 18 | manifest: true, 19 | emptyOutDir: true, 20 | outDir: '../wwwroot', 21 | assetsDir: '', 22 | rollupOptions: { 23 | input: 'src/main.ts', 24 | output: { 25 | // Save entry files to the appropriate folder 26 | entryFileNames: 'js/[name].[hash].js', 27 | // Save chunk files to the js folder 28 | chunkFileNames: 'js/[name]-chunk.js', 29 | // Save asset files to the appropriate folder 30 | assetFileNames: (info) => { 31 | if (info.name) { 32 | // If the file is a CSS file, save it to the css folder 33 | if (cssPattern.test(info.name)) { 34 | return 'css/[name][extname]'; 35 | } 36 | // If the file is an image file, save it to the images folder 37 | if (imagePattern.test(info.name)) { 38 | return 'images/[name][extname]'; 39 | } 40 | 41 | // If the file is any other type of file, save it to the assets folder 42 | return 'assets/[name][extname]'; 43 | } else { 44 | // If the file name is not specified, save it to the output directory 45 | return '[name][extname]'; 46 | } 47 | }, 48 | } 49 | }, 50 | }, 51 | server: { 52 | strictPort: true, 53 | }, 54 | css: { 55 | preprocessorOptions: { 56 | scss: { 57 | api: "modern-compiler", 58 | }, 59 | }, 60 | }, 61 | }); 62 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/Assets/style.scss: -------------------------------------------------------------------------------- 1 | /** 2 | Name: style.scss 3 | Description: This is the main stylesheet for the example project. 4 | */ 5 | 6 | :root { 7 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif; 8 | font-size: 16px; 9 | line-height: 24px; 10 | font-weight: 400; 11 | 12 | color-scheme: light dark; 13 | color: rgba(255, 255, 255, 0.87); 14 | background-color: #242424; 15 | 16 | font-synthesis: none; 17 | text-rendering: optimizeLegibility; 18 | -webkit-font-smoothing: antialiased; 19 | -moz-osx-font-smoothing: grayscale; 20 | -webkit-text-size-adjust: 100%; 21 | } 22 | 23 | a { 24 | font-weight: 500; 25 | color: #646cff; 26 | text-decoration: inherit; 27 | 28 | &:hover { 29 | color: #535bf2; 30 | } 31 | } 32 | 33 | 34 | body { 35 | margin: 0; 36 | display: flex; 37 | place-items: center; 38 | min-width: 320px; 39 | min-height: 100vh; 40 | } 41 | 42 | h1 { 43 | font-size: 3.2em; 44 | line-height: 1.1; 45 | } 46 | 47 | #app { 48 | max-width: 1280px; 49 | margin: 0 auto; 50 | padding: 2rem; 51 | text-align: center; 52 | } 53 | 54 | .logo { 55 | height: 6em; 56 | padding: 1.5em; 57 | will-change: filter; 58 | 59 | &:hover { 60 | filter: drop-shadow(0 0 2em #646cffaa); 61 | } 62 | 63 | &.vanilla:hover { 64 | filter: drop-shadow(0 0 2em #3178c6aa); 65 | } 66 | } 67 | 68 | .card { 69 | padding: 2em; 70 | } 71 | 72 | .read-the-docs { 73 | color: #888; 74 | } 75 | 76 | button { 77 | border-radius: 8px; 78 | border: 1px solid transparent; 79 | padding: 0.6em 1.2em; 80 | font-size: 1em; 81 | font-weight: 500; 82 | font-family: inherit; 83 | background-color: #1a1a1a; 84 | cursor: pointer; 85 | transition: border-color 0.25s; 86 | 87 | &:hover { 88 | border-color: #646cff; 89 | } 90 | 91 | &:focus, 92 | &:focus-visible { 93 | outline: 4px auto -webkit-focus-ring-color; 94 | } 95 | } 96 | 97 | 98 | @media (prefers-color-scheme: light) { 99 | :root { 100 | color: #213547; 101 | background-color: #ffffff; 102 | } 103 | 104 | a:hover { 105 | color: #747bff; 106 | } 107 | 108 | button { 109 | background-color: #f9f9f9; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/Assets/style.scss: -------------------------------------------------------------------------------- 1 | /** 2 | Name: style.scss 3 | Description: This is the main stylesheet for the example project. 4 | */ 5 | 6 | :root { 7 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif; 8 | font-size: 16px; 9 | line-height: 24px; 10 | font-weight: 400; 11 | 12 | color-scheme: light dark; 13 | color: rgba(255, 255, 255, 0.87); 14 | background-color: #242424; 15 | 16 | font-synthesis: none; 17 | text-rendering: optimizeLegibility; 18 | -webkit-font-smoothing: antialiased; 19 | -moz-osx-font-smoothing: grayscale; 20 | -webkit-text-size-adjust: 100%; 21 | } 22 | 23 | a { 24 | font-weight: 500; 25 | color: #646cff; 26 | text-decoration: inherit; 27 | 28 | &:hover { 29 | color: #535bf2; 30 | } 31 | } 32 | 33 | 34 | body { 35 | margin: 0; 36 | display: flex; 37 | place-items: center; 38 | min-width: 320px; 39 | min-height: 100vh; 40 | } 41 | 42 | h1 { 43 | font-size: 3.2em; 44 | line-height: 1.1; 45 | } 46 | 47 | #app { 48 | max-width: 1280px; 49 | margin: 0 auto; 50 | padding: 2rem; 51 | text-align: center; 52 | } 53 | 54 | .logo { 55 | height: 6em; 56 | padding: 1.5em; 57 | will-change: filter; 58 | 59 | &:hover { 60 | filter: drop-shadow(0 0 2em #646cffaa); 61 | } 62 | 63 | &.vanilla:hover { 64 | filter: drop-shadow(0 0 2em #3178c6aa); 65 | } 66 | } 67 | 68 | .card { 69 | padding: 2em; 70 | } 71 | 72 | .read-the-docs { 73 | color: #888; 74 | } 75 | 76 | button { 77 | border-radius: 8px; 78 | border: 1px solid transparent; 79 | padding: 0.6em 1.2em; 80 | font-size: 1em; 81 | font-weight: 500; 82 | font-family: inherit; 83 | background-color: #1a1a1a; 84 | cursor: pointer; 85 | transition: border-color 0.25s; 86 | 87 | &:hover { 88 | border-color: #646cff; 89 | } 90 | 91 | &:focus, 92 | &:focus-visible { 93 | outline: 4px auto -webkit-focus-ring-color; 94 | } 95 | } 96 | 97 | 98 | @media (prefers-color-scheme: light) { 99 | :root { 100 | color: #213547; 101 | background-color: #ffffff; 102 | } 103 | 104 | a:hover { 105 | color: #747bff; 106 | } 107 | 108 | button { 109 | background-color: #f9f9f9; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/Assets/main.scss: -------------------------------------------------------------------------------- 1 | /** 2 | Name: style.scss 3 | Description: This is the main stylesheet for the example project. 4 | */ 5 | 6 | @use "./blazor"; 7 | 8 | :root { 9 | font-family: Inter, Avenir, Helvetica, Arial, sans-serif; 10 | font-size: 16px; 11 | line-height: 24px; 12 | font-weight: 400; 13 | 14 | color-scheme: light dark; 15 | color: rgba(255, 255, 255, 0.87); 16 | background-color: #242424; 17 | 18 | font-synthesis: none; 19 | text-rendering: optimizeLegibility; 20 | -webkit-font-smoothing: antialiased; 21 | -moz-osx-font-smoothing: grayscale; 22 | -webkit-text-size-adjust: 100%; 23 | } 24 | 25 | a { 26 | font-weight: 500; 27 | color: #646cff; 28 | text-decoration: inherit; 29 | 30 | &:hover { 31 | color: #535bf2; 32 | } 33 | } 34 | 35 | 36 | body { 37 | margin: 0; 38 | display: flex; 39 | place-items: center; 40 | min-width: 320px; 41 | min-height: 100vh; 42 | } 43 | 44 | h1 { 45 | font-size: 3.2em; 46 | line-height: 1.1; 47 | } 48 | 49 | #app { 50 | max-width: 1280px; 51 | margin: 0 auto; 52 | padding: 2rem; 53 | text-align: center; 54 | } 55 | 56 | .logo { 57 | height: 6em; 58 | padding: 1.5em; 59 | will-change: filter; 60 | 61 | &:hover { 62 | filter: drop-shadow(0 0 2em #646cffaa); 63 | } 64 | 65 | &.vanilla:hover { 66 | filter: drop-shadow(0 0 2em #3178c6aa); 67 | } 68 | } 69 | 70 | .card { 71 | padding: 2em; 72 | } 73 | 74 | .read-the-docs { 75 | color: #888; 76 | } 77 | 78 | button { 79 | border-radius: 8px; 80 | border: 1px solid transparent; 81 | padding: 0.6em 1.2em; 82 | font-size: 1em; 83 | font-weight: 500; 84 | font-family: inherit; 85 | background-color: #1a1a1a; 86 | cursor: pointer; 87 | transition: border-color 0.25s; 88 | 89 | &:hover { 90 | border-color: #646cff; 91 | } 92 | 93 | &:focus, 94 | &:focus-visible { 95 | outline: 4px auto -webkit-focus-ring-color; 96 | } 97 | } 98 | 99 | 100 | @media (prefers-color-scheme: light) { 101 | :root { 102 | color: #213547; 103 | background-color: #ffffff; 104 | } 105 | 106 | a:hover { 107 | color: #747bff; 108 | } 109 | 110 | button { 111 | background-color: #f9f9f9; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | */ 5 | 6 | import { UserConfig, defineConfig } from 'vite'; 7 | import { spawn } from 'child_process'; 8 | import fs from 'fs'; 9 | import path from 'path'; 10 | 11 | // Get base folder for certificates. 12 | const baseFolder = 13 | process.env.APPDATA !== undefined && process.env.APPDATA !== '' 14 | ? `${process.env.APPDATA}/ASP.NET/https` 15 | : `${process.env.HOME}/.aspnet/https`; 16 | 17 | // Generate the certificate name using the NPM package name 18 | const certificateName = process.env.npm_package_name; 19 | 20 | // Define certificate filepath 21 | const certFilePath = path.join(baseFolder, `${certificateName}.pem`); 22 | // Define key filepath 23 | const keyFilePath = path.join(baseFolder, `${certificateName}.key`); 24 | 25 | // Export Vite configuration 26 | export default defineConfig(async () => { 27 | // Ensure the certificate and key exist 28 | if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { 29 | // Wait for the certificate to be generated 30 | await new Promise((resolve) => { 31 | spawn('dotnet', [ 32 | 'dev-certs', 33 | 'https', 34 | '--export-path', 35 | certFilePath, 36 | '--format', 37 | 'Pem', 38 | '--no-password', 39 | ], { stdio: 'inherit', }) 40 | .on('exit', (code) => { 41 | resolve(); 42 | if (code) { 43 | process.exit(code); 44 | } 45 | }); 46 | }); 47 | }; 48 | 49 | // Define Vite configuration 50 | const config: UserConfig = { 51 | appType: 'custom', 52 | root: 'Assets', 53 | publicDir: 'public', 54 | build: { 55 | emptyOutDir: true, 56 | manifest: true, 57 | outDir: '../wwwroot', 58 | assetsDir: '', 59 | rollupOptions: { 60 | input: 'Assets/main.ts' 61 | }, 62 | }, 63 | server: { 64 | strictPort: true, 65 | https: { 66 | cert: certFilePath, 67 | key: keyFilePath 68 | } 69 | }, 70 | optimizeDeps: { 71 | include: [] 72 | }, 73 | css: { 74 | preprocessorOptions: { 75 | scss: { 76 | api: "modern-compiler", 77 | }, 78 | }, 79 | }, 80 | } 81 | 82 | return config; 83 | }); 84 | -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | */ 5 | 6 | import { UserConfig, defineConfig } from 'vite'; 7 | import { spawn } from 'child_process'; 8 | import fs from 'fs'; 9 | import path from 'path'; 10 | 11 | // Get base folder for certificates. 12 | const baseFolder = 13 | process.env.APPDATA !== undefined && process.env.APPDATA !== '' 14 | ? `${process.env.APPDATA}/ASP.NET/https` 15 | : `${process.env.HOME}/.aspnet/https`; 16 | 17 | // Generate the certificate name using the NPM package name 18 | const certificateName = process.env.npm_package_name; 19 | 20 | // Define certificate filepath 21 | const certFilePath = path.join(baseFolder, `${certificateName}.pem`); 22 | // Define key filepath 23 | const keyFilePath = path.join(baseFolder, `${certificateName}.key`); 24 | 25 | // Export Vite configuration 26 | export default defineConfig(async () => { 27 | // Ensure the certificate and key exist 28 | if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { 29 | // Wait for the certificate to be generated 30 | await new Promise((resolve) => { 31 | spawn('dotnet', [ 32 | 'dev-certs', 33 | 'https', 34 | '--export-path', 35 | certFilePath, 36 | '--format', 37 | 'Pem', 38 | '--no-password', 39 | ], { stdio: 'inherit', }) 40 | .on('exit', (code) => { 41 | resolve(); 42 | if (code) { 43 | process.exit(code); 44 | } 45 | }); 46 | }); 47 | }; 48 | 49 | // Define Vite configuration 50 | const config: UserConfig = { 51 | appType: 'custom', 52 | root: 'Assets', 53 | publicDir: 'public', 54 | build: { 55 | emptyOutDir: true, 56 | manifest: true, 57 | outDir: '../wwwroot', 58 | assetsDir: '', 59 | rollupOptions: { 60 | input: [ 61 | 'Assets/main.scss', 62 | 'Assets/main.ts' 63 | ] 64 | }, 65 | }, 66 | server: { 67 | strictPort: true, 68 | https: { 69 | cert: certFilePath, 70 | key: keyFilePath 71 | } 72 | }, 73 | optimizeDeps: { 74 | include: [] 75 | }, 76 | css: { 77 | preprocessorOptions: { 78 | scss: { 79 | api: "modern-compiler", 80 | }, 81 | }, 82 | }, 83 | } 84 | 85 | return config; 86 | }); 87 | -------------------------------------------------------------------------------- /examples/net/ViteNET.MVC/.gitignore: -------------------------------------------------------------------------------- 1 | # root folder 2 | wwwroot/ 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | lerna-debug.log* 10 | .pnpm-debug.log* 11 | 12 | # Diagnostic reports (https://nodejs.org/api/report.html) 13 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 14 | 15 | # Runtime data 16 | pids 17 | *.pid 18 | *.seed 19 | *.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | lib-cov 23 | 24 | # Coverage directory used by tools like istanbul 25 | coverage 26 | *.lcov 27 | 28 | # nyc test coverage 29 | .nyc_output 30 | 31 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 32 | .grunt 33 | 34 | # Bower dependency directory (https://bower.io/) 35 | bower_components 36 | 37 | # node-waf configuration 38 | .lock-wscript 39 | 40 | # Compiled binary addons (https://nodejs.org/api/addons.html) 41 | build/Release 42 | 43 | # Dependency directories 44 | node_modules/ 45 | jspm_packages/ 46 | 47 | # Snowpack dependency directory (https://snowpack.dev/) 48 | web_modules/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional stylelint cache 60 | .stylelintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variable files 78 | .env 79 | .env.development.local 80 | .env.test.local 81 | .env.production.local 82 | .env.local 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | .parcel-cache 87 | 88 | # Next.js build output 89 | .next 90 | out 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # vuepress v2.x temp and cache directory 106 | .temp 107 | .cache 108 | 109 | # Docusaurus cache and generated files 110 | .docusaurus 111 | 112 | # Serverless directories 113 | .serverless/ 114 | 115 | # FuseBox cache 116 | .fusebox/ 117 | 118 | # DynamoDB Local files 119 | .dynamodb/ 120 | 121 | # TernJS port file 122 | .tern-port 123 | 124 | # Stores VSCode versions used for testing VSCode extensions 125 | .vscode-test 126 | 127 | # yarn v2 128 | .yarn/cache 129 | .yarn/unplugged 130 | .yarn/build-state.yml 131 | .yarn/install-state.gz 132 | .pnp.* -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/.gitignore: -------------------------------------------------------------------------------- 1 | # root folder 2 | wwwroot/ 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | lerna-debug.log* 10 | .pnpm-debug.log* 11 | 12 | # Diagnostic reports (https://nodejs.org/api/report.html) 13 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 14 | 15 | # Runtime data 16 | pids 17 | *.pid 18 | *.seed 19 | *.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | lib-cov 23 | 24 | # Coverage directory used by tools like istanbul 25 | coverage 26 | *.lcov 27 | 28 | # nyc test coverage 29 | .nyc_output 30 | 31 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 32 | .grunt 33 | 34 | # Bower dependency directory (https://bower.io/) 35 | bower_components 36 | 37 | # node-waf configuration 38 | .lock-wscript 39 | 40 | # Compiled binary addons (https://nodejs.org/api/addons.html) 41 | build/Release 42 | 43 | # Dependency directories 44 | node_modules/ 45 | jspm_packages/ 46 | 47 | # Snowpack dependency directory (https://snowpack.dev/) 48 | web_modules/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional stylelint cache 60 | .stylelintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variable files 78 | .env 79 | .env.development.local 80 | .env.test.local 81 | .env.production.local 82 | .env.local 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | .parcel-cache 87 | 88 | # Next.js build output 89 | .next 90 | out 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # vuepress v2.x temp and cache directory 106 | .temp 107 | .cache 108 | 109 | # Docusaurus cache and generated files 110 | .docusaurus 111 | 112 | # Serverless directories 113 | .serverless/ 114 | 115 | # FuseBox cache 116 | .fusebox/ 117 | 118 | # DynamoDB Local files 119 | .dynamodb/ 120 | 121 | # TernJS port file 122 | .tern-port 123 | 124 | # Stores VSCode versions used for testing VSCode extensions 125 | .vscode-test 126 | 127 | # yarn v2 128 | .yarn/cache 129 | .yarn/unplugged 130 | .yarn/build-state.yml 131 | .yarn/install-state.gz 132 | .pnp.* -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/.gitignore: -------------------------------------------------------------------------------- 1 | # root folder 2 | wwwroot/ 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | lerna-debug.log* 10 | .pnpm-debug.log* 11 | 12 | # Diagnostic reports (https://nodejs.org/api/report.html) 13 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 14 | 15 | # Runtime data 16 | pids 17 | *.pid 18 | *.seed 19 | *.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | lib-cov 23 | 24 | # Coverage directory used by tools like istanbul 25 | coverage 26 | *.lcov 27 | 28 | # nyc test coverage 29 | .nyc_output 30 | 31 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 32 | .grunt 33 | 34 | # Bower dependency directory (https://bower.io/) 35 | bower_components 36 | 37 | # node-waf configuration 38 | .lock-wscript 39 | 40 | # Compiled binary addons (https://nodejs.org/api/addons.html) 41 | build/Release 42 | 43 | # Dependency directories 44 | node_modules/ 45 | jspm_packages/ 46 | 47 | # Snowpack dependency directory (https://snowpack.dev/) 48 | web_modules/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional stylelint cache 60 | .stylelintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variable files 78 | .env 79 | .env.development.local 80 | .env.test.local 81 | .env.production.local 82 | .env.local 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | .parcel-cache 87 | 88 | # Next.js build output 89 | .next 90 | out 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # vuepress v2.x temp and cache directory 106 | .temp 107 | .cache 108 | 109 | # Docusaurus cache and generated files 110 | .docusaurus 111 | 112 | # Serverless directories 113 | .serverless/ 114 | 115 | # FuseBox cache 116 | .fusebox/ 117 | 118 | # DynamoDB Local files 119 | .dynamodb/ 120 | 121 | # TernJS port file 122 | .tern-port 123 | 124 | # Stores VSCode versions used for testing VSCode extensions 125 | .vscode-test 126 | 127 | # yarn v2 128 | .yarn/cache 129 | .yarn/unplugged 130 | .yarn/build-state.yml 131 | .yarn/install-state.gz 132 | .pnp.* -------------------------------------------------------------------------------- /examples/net/ViteNET.BlazorServer/.gitignore: -------------------------------------------------------------------------------- 1 | # root folder 2 | wwwroot/ 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | lerna-debug.log* 10 | .pnpm-debug.log* 11 | 12 | # Diagnostic reports (https://nodejs.org/api/report.html) 13 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 14 | 15 | # Runtime data 16 | pids 17 | *.pid 18 | *.seed 19 | *.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | lib-cov 23 | 24 | # Coverage directory used by tools like istanbul 25 | coverage 26 | *.lcov 27 | 28 | # nyc test coverage 29 | .nyc_output 30 | 31 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 32 | .grunt 33 | 34 | # Bower dependency directory (https://bower.io/) 35 | bower_components 36 | 37 | # node-waf configuration 38 | .lock-wscript 39 | 40 | # Compiled binary addons (https://nodejs.org/api/addons.html) 41 | build/Release 42 | 43 | # Dependency directories 44 | node_modules/ 45 | jspm_packages/ 46 | 47 | # Snowpack dependency directory (https://snowpack.dev/) 48 | web_modules/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional stylelint cache 60 | .stylelintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variable files 78 | .env 79 | .env.development.local 80 | .env.test.local 81 | .env.production.local 82 | .env.local 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | .parcel-cache 87 | 88 | # Next.js build output 89 | .next 90 | out 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # vuepress v2.x temp and cache directory 106 | .temp 107 | .cache 108 | 109 | # Docusaurus cache and generated files 110 | .docusaurus 111 | 112 | # Serverless directories 113 | .serverless/ 114 | 115 | # FuseBox cache 116 | .fusebox/ 117 | 118 | # DynamoDB Local files 119 | .dynamodb/ 120 | 121 | # TernJS port file 122 | .tern-port 123 | 124 | # Stores VSCode versions used for testing VSCode extensions 125 | .vscode-test 126 | 127 | # yarn v2 128 | .yarn/cache 129 | .yarn/unplugged 130 | .yarn/build-state.yml 131 | .yarn/install-state.gz 132 | .pnp.* -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/.gitignore: -------------------------------------------------------------------------------- 1 | # root folder 2 | wwwroot/ 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | lerna-debug.log* 10 | .pnpm-debug.log* 11 | 12 | # Diagnostic reports (https://nodejs.org/api/report.html) 13 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 14 | 15 | # Runtime data 16 | pids 17 | *.pid 18 | *.seed 19 | *.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | lib-cov 23 | 24 | # Coverage directory used by tools like istanbul 25 | coverage 26 | *.lcov 27 | 28 | # nyc test coverage 29 | .nyc_output 30 | 31 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 32 | .grunt 33 | 34 | # Bower dependency directory (https://bower.io/) 35 | bower_components 36 | 37 | # node-waf configuration 38 | .lock-wscript 39 | 40 | # Compiled binary addons (https://nodejs.org/api/addons.html) 41 | build/Release 42 | 43 | # Dependency directories 44 | node_modules/ 45 | jspm_packages/ 46 | 47 | # Snowpack dependency directory (https://snowpack.dev/) 48 | web_modules/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional stylelint cache 60 | .stylelintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variable files 78 | .env 79 | .env.development.local 80 | .env.test.local 81 | .env.production.local 82 | .env.local 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | .parcel-cache 87 | 88 | # Next.js build output 89 | .next 90 | out 91 | 92 | # Nuxt.js build / generate output 93 | .nuxt 94 | dist 95 | 96 | # Gatsby files 97 | .cache/ 98 | # Comment in the public line in if your project uses Gatsby and not Next.js 99 | # https://nextjs.org/blog/next-9-1#public-directory-support 100 | # public 101 | 102 | # vuepress build output 103 | .vuepress/dist 104 | 105 | # vuepress v2.x temp and cache directory 106 | .temp 107 | .cache 108 | 109 | # Docusaurus cache and generated files 110 | .docusaurus 111 | 112 | # Serverless directories 113 | .serverless/ 114 | 115 | # FuseBox cache 116 | .fusebox/ 117 | 118 | # DynamoDB Local files 119 | .dynamodb/ 120 | 121 | # TernJS port file 122 | .tern-port 123 | 124 | # Stores VSCode versions used for testing VSCode extensions 125 | .vscode-test 126 | 127 | # yarn v2 128 | .yarn/cache 129 | .yarn/unplugged 130 | .yarn/build-state.yml 131 | .yarn/install-state.gz 132 | .pnp.* -------------------------------------------------------------------------------- /src/library/Vite.AspNetCore/ViteDevServerOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | namespace Vite.AspNetCore; 5 | 6 | /// 7 | /// Options for the Vite Dev Server. 8 | /// 9 | public record ViteDevServerOptions 10 | { 11 | public const string Server = "Server"; 12 | 13 | /// 14 | /// The port where the Vite Dev Server will be running. Default value is "5173". 15 | /// 16 | /// 17 | /// If the port is null, server URL will be generated without port. 18 | /// Example: http://localhost 19 | /// 20 | public ushort? Port { get; set; } = 5173; 21 | 22 | /// 23 | /// The host where the Vite Dev Server will be running. Default value is "localhost". 24 | /// 25 | public string Host { get; set; } = "localhost"; 26 | 27 | /// 28 | /// Wait for Vite Server to load in seconds. 29 | /// Default value is "5". 30 | /// 31 | public int TimeOut { get; set; } = 5; 32 | 33 | /// 34 | /// If true, the middleware will use HTTPS to connect to the Vite Dev Server. 35 | /// Default value is "false". 36 | /// 37 | public bool Https { get; set; } 38 | 39 | /// 40 | /// Inject the react-refresh preamble and enable HMR for React components, see: https://vitejs.dev/guide/backend-integration.html. 41 | /// Default value is false. 42 | /// 43 | public bool? UseReactRefresh { get; set; } 44 | 45 | #region AutoRun 46 | 47 | /// 48 | /// Enable or disable the automatic start of the Vite development server. Default value is "false". 49 | /// 50 | public bool AutoRun { get; set; } 51 | 52 | /// 53 | /// The name of the package manager to use to run the Vite development server. 54 | /// Default value is "npm". 55 | /// 56 | public string PackageManager { get; set; } = "npm"; 57 | 58 | /// 59 | /// The directory where the package.json file is located. 60 | /// Default value is the .NET project working directory. 61 | /// 62 | public string? PackageDirectory { get; set; } 63 | 64 | /// 65 | /// The script name to run the Vite development server when is enabled. 66 | /// Default value is "dev". 67 | /// 68 | public string ScriptName { get; set; } = "dev"; 69 | 70 | /// 71 | /// If specified, the script will be run with the specified arguments. 72 | /// 73 | /// Example: "npm run dev -- " 74 | public string? ScriptArgs { get; set; } 75 | 76 | #endregion 77 | } 78 | -------------------------------------------------------------------------------- /src/tests/ViteNetProject.Tests/ManifestTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Quetzal Rivera. 2 | // Licensed under the MIT License, See LICENCE in the project root for license information. 3 | 4 | using Vite.AspNetCore; 5 | 6 | namespace ViteNetProject.Tests; 7 | 8 | /// 9 | /// Integration tests for TagHelpers. 10 | /// 11 | public class ManifestTest : IClassFixture> 12 | { 13 | private readonly WebApplicationFactory factory; 14 | 15 | /// 16 | /// Initializes a new instance of . 17 | /// 18 | /// 19 | public ManifestTest(WebApplicationFactory factory) 20 | { 21 | this.factory = factory; 22 | } 23 | 24 | [Fact] 25 | public void ReadManifest() 26 | { 27 | var manifest = this.factory.Services.GetRequiredService(); 28 | // Verify tha the chunk with name "Assets/main.ts" exists. 29 | Assert.NotNull(manifest["src/main.ts"]); 30 | } 31 | 32 | [Fact] 33 | public async Task ManifestIsRefreshedWhenUpdated() 34 | { 35 | IWebHostEnvironment hostEnv = 36 | this.factory.Services.GetRequiredService(); 37 | string manifestPath = Path.Combine(hostEnv.WebRootPath, ".vite", "manifest.json"); 38 | string backup = await File.ReadAllTextAsync(manifestPath); 39 | 40 | // Setup manifest to consistent starting state 41 | string testManifest = """ 42 | { 43 | "src/main.ts": { 44 | "file": "js/main.111111.js", 45 | "isEntry": true, 46 | "src": "src/main.ts" 47 | } 48 | } 49 | """; 50 | await File.WriteAllTextAsync(manifestPath, testManifest); 51 | var manifest = this.factory.Services.GetRequiredService(); 52 | IViteChunk chunk = manifest["src/main.ts"]!; 53 | string initFile = chunk.File; 54 | 55 | // Try updating the manifest 56 | testManifest = """ 57 | { 58 | "src/main.ts": { 59 | "file": "js/main.222222.js", 60 | "isEntry": true, 61 | "src": "src/main.ts" 62 | } 63 | } 64 | """; 65 | await File.WriteAllTextAsync(manifestPath, testManifest); 66 | 67 | // The refresh is asynchronous, so give it a second to refresh 68 | await Task.Delay(50); 69 | 70 | chunk = manifest["src/main.ts"]!; 71 | string fileAfterChange = chunk.File; 72 | 73 | // Restore the file 74 | await File.WriteAllTextAsync(manifestPath, backup); 75 | 76 | // Check that we got back what we expect 77 | Assert.Equal("js/main.111111.js", initFile); 78 | Assert.Equal("js/main.222222.js", fileAfterChange); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Vite.AspNetCore.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FCA0D074-A864-45F5-AC89-DD640CAD6670}" 7 | ProjectSection(SolutionItems) = preProject 8 | .editorconfig = .editorconfig 9 | EndProjectSection 10 | EndProject 11 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "library", "library", "{6EDF4FDC-3A5A-4DE0-B29E-B936FE3EA419}" 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vite.AspNetCore", "library\Vite.AspNetCore\Vite.AspNetCore.csproj", "{FC0CAF82-AA77-47AB-BB61-0F17AE11C7F3}" 14 | EndProject 15 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8971FA7F-E120-4008-8DB7-A7A8AA73553C}" 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViteNetProject", "tests\ViteNetProject\ViteNetProject.csproj", "{C265F098-8CFC-4CC0-8478-184A022E6DF3}" 18 | EndProject 19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViteNetProject.Tests", "tests\ViteNetProject.Tests\ViteNetProject.Tests.csproj", "{4AA5BE32-3CF3-4EF9-B415-509B09B59268}" 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Any CPU = Debug|Any CPU 24 | Release|Any CPU = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {FC0CAF82-AA77-47AB-BB61-0F17AE11C7F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {FC0CAF82-AA77-47AB-BB61-0F17AE11C7F3}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {FC0CAF82-AA77-47AB-BB61-0F17AE11C7F3}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {FC0CAF82-AA77-47AB-BB61-0F17AE11C7F3}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {C265F098-8CFC-4CC0-8478-184A022E6DF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {C265F098-8CFC-4CC0-8478-184A022E6DF3}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {C265F098-8CFC-4CC0-8478-184A022E6DF3}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {C265F098-8CFC-4CC0-8478-184A022E6DF3}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {4AA5BE32-3CF3-4EF9-B415-509B09B59268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {4AA5BE32-3CF3-4EF9-B415-509B09B59268}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {4AA5BE32-3CF3-4EF9-B415-509B09B59268}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {4AA5BE32-3CF3-4EF9-B415-509B09B59268}.Release|Any CPU.Build.0 = Release|Any CPU 39 | EndGlobalSection 40 | GlobalSection(SolutionProperties) = preSolution 41 | HideSolutionNode = FALSE 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityGlobals) = postSolution 44 | SolutionGuid = {9898E7A5-84C0-4564-8DF9-8122742A1100} 45 | EndGlobalSection 46 | GlobalSection(NestedProjects) = preSolution 47 | {FC0CAF82-AA77-47AB-BB61-0F17AE11C7F3} = {6EDF4FDC-3A5A-4DE0-B29E-B936FE3EA419} 48 | {C265F098-8CFC-4CC0-8478-184A022E6DF3} = {8971FA7F-E120-4008-8DB7-A7A8AA73553C} 49 | {4AA5BE32-3CF3-4EF9-B415-509B09B59268} = {8971FA7F-E120-4008-8DB7-A7A8AA73553C} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/Assets/assets/react.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/net/ViteNET.RazorPages/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | */ 5 | 6 | import { UserConfig, defineConfig } from 'vite'; 7 | import { spawn } from 'child_process'; 8 | import fs from 'fs'; 9 | import path from 'path'; 10 | 11 | // Get base folder for certificates. 12 | const baseFolder = 13 | process.env.APPDATA !== undefined && process.env.APPDATA !== '' 14 | ? `${process.env.APPDATA}/ASP.NET/https` 15 | : `${process.env.HOME}/.aspnet/https`; 16 | 17 | // Generate the certificate name using the NPM package name 18 | const certificateName = process.env.npm_package_name; 19 | 20 | // Define certificate filepath 21 | const certFilePath = path.join(baseFolder, `${certificateName}.pem`); 22 | // Define key filepath 23 | const keyFilePath = path.join(baseFolder, `${certificateName}.key`); 24 | 25 | // Pattern for CSS files 26 | const cssPattern = /\.css$/; 27 | // Pattern for image files 28 | const imagePattern = /\.(png|jpe?g|gif|svg|webp|avif)$/; 29 | 30 | // Export Vite configuration 31 | export default defineConfig(async () => { 32 | // Ensure the certificate and key exist 33 | if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { 34 | // Wait for the certificate to be generated 35 | await new Promise((resolve) => { 36 | spawn('dotnet', [ 37 | 'dev-certs', 38 | 'https', 39 | '--export-path', 40 | certFilePath, 41 | '--format', 42 | 'Pem', 43 | '--no-password', 44 | ], { stdio: 'inherit', }) 45 | .on('exit', (code) => { 46 | resolve(); 47 | if (code) { 48 | process.exit(code); 49 | } 50 | }); 51 | }); 52 | }; 53 | 54 | // Define Vite configuration 55 | const config: UserConfig = { 56 | appType: 'custom', 57 | root: 'Assets', 58 | publicDir: 'public', 59 | build: { 60 | manifest: true, 61 | emptyOutDir: true, 62 | outDir: '../wwwroot', 63 | assetsDir: '', 64 | rollupOptions: { 65 | input: 'Assets/main.ts', 66 | output: { 67 | // Save entry files to the appropriate folder 68 | entryFileNames: 'js/[name].[hash].js', 69 | // Save chunk files to the js folder 70 | chunkFileNames: 'js/[name]-chunk.js', 71 | // Save asset files to the appropriate folder 72 | assetFileNames: (info) => { 73 | if (info.name) { 74 | // If the file is a CSS file, save it to the css folder 75 | if (cssPattern.test(info.name)) { 76 | return 'css/[name][extname]'; 77 | } 78 | // If the file is an image file, save it to the images folder 79 | if (imagePattern.test(info.name)) { 80 | return 'images/[name][extname]'; 81 | } 82 | 83 | // If the file is any other type of file, save it to the assets folder 84 | return 'assets/[name][extname]'; 85 | } else { 86 | // If the file name is not specified, save it to the output directory 87 | return '[name][extname]'; 88 | } 89 | }, 90 | } 91 | }, 92 | }, 93 | server: { 94 | strictPort: true, 95 | https: { 96 | cert: certFilePath, 97 | key: keyFilePath 98 | } 99 | }, 100 | optimizeDeps: { 101 | include: [] 102 | }, 103 | css: { 104 | preprocessorOptions: { 105 | scss: { 106 | api: "modern-compiler", 107 | }, 108 | }, 109 | }, 110 | } 111 | 112 | return config; 113 | }); 114 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.Solid/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | */ 5 | 6 | import { UserConfig, defineConfig } from 'vite'; 7 | import solid from 'vite-plugin-solid'; 8 | import { spawn } from 'child_process'; 9 | import fs from 'fs'; 10 | import path from 'path'; 11 | 12 | // Get base folder for certificates. 13 | const baseFolder = 14 | process.env.APPDATA !== undefined && process.env.APPDATA !== '' 15 | ? `${process.env.APPDATA}/ASP.NET/https` 16 | : `${process.env.HOME}/.aspnet/https`; 17 | 18 | // Generate the certificate name using the NPM package name 19 | const certificateName = process.env.npm_package_name; 20 | 21 | // Define certificate filepath 22 | const certFilePath = path.join(baseFolder, `${certificateName}.pem`); 23 | // Define key filepath 24 | const keyFilePath = path.join(baseFolder, `${certificateName}.key`); 25 | 26 | // Pattern for CSS files 27 | const cssPattern = /\.css$/; 28 | // Pattern for image files 29 | const imagePattern = /\.(png|jpe?g|gif|svg|webp|avif)$/; 30 | 31 | // Export Vite configuration 32 | export default defineConfig(async () => { 33 | // Ensure the certificate and key exist 34 | if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { 35 | // Wait for the certificate to be generated 36 | await new Promise((resolve) => { 37 | spawn('dotnet', [ 38 | 'dev-certs', 39 | 'https', 40 | '--export-path', 41 | certFilePath, 42 | '--format', 43 | 'Pem', 44 | '--no-password', 45 | ], { stdio: 'inherit', }) 46 | .on('exit', (code) => { 47 | resolve(); 48 | if (code) { 49 | process.exit(code); 50 | } 51 | }); 52 | }); 53 | }; 54 | 55 | // Define Vite configuration 56 | const config: UserConfig = { 57 | appType: 'custom', 58 | root: 'Assets', 59 | publicDir: 'public', 60 | build: { 61 | manifest: true, 62 | emptyOutDir: true, 63 | outDir: '../wwwroot', 64 | assetsDir: '', 65 | rollupOptions: { 66 | input: 'Assets/main.tsx', 67 | output: { 68 | // Save entry files to the appropriate folder 69 | entryFileNames: 'js/[name].[hash].js', 70 | // Save chunk files to the js folder 71 | chunkFileNames: 'js/[name]-chunk.js', 72 | // Save asset files to the appropriate folder 73 | assetFileNames: (info) => { 74 | if (info.name) { 75 | // If the file is a CSS file, save it to the css folder 76 | if (cssPattern.test(info.name)) { 77 | return 'css/[name][extname]'; 78 | } 79 | // If the file is an image file, save it to the images folder 80 | if (imagePattern.test(info.name)) { 81 | return 'images/[name][extname]'; 82 | } 83 | 84 | // If the file is any other type of file, save it to the assets folder 85 | return 'assets/[name][extname]'; 86 | } else { 87 | // If the file name is not specified, save it to the output directory 88 | return '[name][extname]'; 89 | } 90 | }, 91 | } 92 | }, 93 | }, 94 | server: { 95 | strictPort: true, 96 | https: { 97 | cert: certFilePath, 98 | key: keyFilePath 99 | } 100 | }, 101 | plugins: [ 102 | solid() 103 | ], 104 | optimizeDeps: { 105 | include: [] 106 | }, 107 | css: { 108 | preprocessorOptions: { 109 | scss: { 110 | api: "modern-compiler", 111 | }, 112 | }, 113 | }, 114 | } 115 | 116 | return config; 117 | }); 118 | -------------------------------------------------------------------------------- /examples/libraries/ViteNET.React/vite.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Name: vite.config.ts 3 | * Description: Vite configuration file 4 | */ 5 | 6 | import { UserConfig, defineConfig } from 'vite'; 7 | import react from "@vitejs/plugin-react-swc"; 8 | import { spawn } from 'child_process'; 9 | import fs from 'fs'; 10 | import path from 'path'; 11 | 12 | // Get base folder for certificates. 13 | const baseFolder = 14 | process.env.APPDATA !== undefined && process.env.APPDATA !== '' 15 | ? `${process.env.APPDATA}/ASP.NET/https` 16 | : `${process.env.HOME}/.aspnet/https`; 17 | 18 | // Generate the certificate name using the NPM package name 19 | const certificateName = process.env.npm_package_name; 20 | 21 | // Define certificate filepath 22 | const certFilePath = path.join(baseFolder, `${certificateName}.pem`); 23 | // Define key filepath 24 | const keyFilePath = path.join(baseFolder, `${certificateName}.key`); 25 | 26 | // Pattern for CSS files 27 | const cssPattern = /\.css$/; 28 | // Pattern for image files 29 | const imagePattern = /\.(png|jpe?g|gif|svg|webp|avif)$/; 30 | 31 | // Export Vite configuration 32 | export default defineConfig(async () => { 33 | // Ensure the certificate and key exist 34 | if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { 35 | // Wait for the certificate to be generated 36 | await new Promise((resolve) => { 37 | spawn('dotnet', [ 38 | 'dev-certs', 39 | 'https', 40 | '--export-path', 41 | certFilePath, 42 | '--format', 43 | 'Pem', 44 | '--no-password', 45 | ], { stdio: 'inherit', }) 46 | .on('exit', (code) => { 47 | resolve(); 48 | if (code) { 49 | process.exit(code); 50 | } 51 | }); 52 | }); 53 | }; 54 | 55 | // Define Vite configuration 56 | const config: UserConfig = { 57 | appType: 'custom', 58 | root: 'Assets', 59 | publicDir: 'public', 60 | build: { 61 | manifest: true, 62 | emptyOutDir: true, 63 | outDir: '../wwwroot', 64 | assetsDir: '', 65 | rollupOptions: { 66 | input: 'Assets/main.tsx', 67 | output: { 68 | // Save entry files to the appropriate folder 69 | entryFileNames: 'js/[name].[hash].js', 70 | // Save chunk files to the js folder 71 | chunkFileNames: 'js/[name]-chunk.js', 72 | // Save asset files to the appropriate folder 73 | assetFileNames: (info) => { 74 | if (info.name) { 75 | // If the file is a CSS file, save it to the css folder 76 | if (cssPattern.test(info.name)) { 77 | return 'css/[name][extname]'; 78 | } 79 | // If the file is an image file, save it to the images folder 80 | if (imagePattern.test(info.name)) { 81 | return 'images/[name][extname]'; 82 | } 83 | 84 | // If the file is any other type of file, save it to the assets folder 85 | return 'assets/[name][extname]'; 86 | } else { 87 | // If the file name is not specified, save it to the output directory 88 | return '[name][extname]'; 89 | } 90 | }, 91 | } 92 | }, 93 | }, 94 | server: { 95 | strictPort: true, 96 | https: { 97 | cert: certFilePath, 98 | key: keyFilePath 99 | } 100 | }, 101 | plugins: [ 102 | react() 103 | ], 104 | optimizeDeps: { 105 | include: [] 106 | }, 107 | css: { 108 | preprocessorOptions: { 109 | scss: { 110 | api: "modern-compiler", 111 | }, 112 | }, 113 | }, 114 | } 115 | 116 | return config; 117 | }); 118 | -------------------------------------------------------------------------------- /examples/ViteNET.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33205.214 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{7CF82174-53AE-45C3-B550-E1C7738CA5AB}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vite.AspNetCore", "..\src\library\Vite.AspNetCore\Vite.AspNetCore.csproj", "{1EC9A678-7933-4A8C-BA88-BE1321D4DEEC}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViteNET.React", "libraries\ViteNET.React\ViteNET.React.csproj", "{8140CF6C-05D6-445C-A459-5BBDB3FD32C5}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".NET Frameworks", ".NET Frameworks", "{A7ED3E33-5652-458C-951F-382F84D5C05E}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViteNET.MVC", "net\ViteNET.MVC\ViteNET.MVC.csproj", "{CFEBB578-3E57-489B-9149-13EFF7EEDB87}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViteNET.RazorPages", "net\ViteNET.RazorPages\ViteNET.RazorPages.csproj", "{8FABD675-EE64-48F5-AD75-CFF548B89052}" 17 | EndProject 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViteNET.Solid", "libraries\ViteNET.Solid\ViteNET.Solid.csproj", "{ECBE79A2-F287-4616-B475-02464D4CD9BC}" 19 | EndProject 20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JS Libraries", "JS Libraries", "{FDC67C94-7931-4077-90DC-E65257CFBC60}" 21 | EndProject 22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViteNET.Tailwind", "libraries\ViteNET.Tailwind\ViteNET.Tailwind.csproj", "{E6126602-DD2E-45C8-93C4-E29A9D710499}" 23 | EndProject 24 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViteNET.BlazorServer", "net\ViteNET.BlazorServer\ViteNET.BlazorServer.csproj", "{53437CA6-A84F-4680-B930-E231CDDE9281}" 25 | EndProject 26 | Global 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 28 | Debug|Any CPU = Debug|Any CPU 29 | Release|Any CPU = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {1EC9A678-7933-4A8C-BA88-BE1321D4DEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {1EC9A678-7933-4A8C-BA88-BE1321D4DEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {1EC9A678-7933-4A8C-BA88-BE1321D4DEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {1EC9A678-7933-4A8C-BA88-BE1321D4DEEC}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {8140CF6C-05D6-445C-A459-5BBDB3FD32C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {8140CF6C-05D6-445C-A459-5BBDB3FD32C5}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {8140CF6C-05D6-445C-A459-5BBDB3FD32C5}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {8140CF6C-05D6-445C-A459-5BBDB3FD32C5}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {CFEBB578-3E57-489B-9149-13EFF7EEDB87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {CFEBB578-3E57-489B-9149-13EFF7EEDB87}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {CFEBB578-3E57-489B-9149-13EFF7EEDB87}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {CFEBB578-3E57-489B-9149-13EFF7EEDB87}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {8FABD675-EE64-48F5-AD75-CFF548B89052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {8FABD675-EE64-48F5-AD75-CFF548B89052}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {8FABD675-EE64-48F5-AD75-CFF548B89052}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {8FABD675-EE64-48F5-AD75-CFF548B89052}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {ECBE79A2-F287-4616-B475-02464D4CD9BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {ECBE79A2-F287-4616-B475-02464D4CD9BC}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {ECBE79A2-F287-4616-B475-02464D4CD9BC}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {ECBE79A2-F287-4616-B475-02464D4CD9BC}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {E6126602-DD2E-45C8-93C4-E29A9D710499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {E6126602-DD2E-45C8-93C4-E29A9D710499}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {E6126602-DD2E-45C8-93C4-E29A9D710499}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {E6126602-DD2E-45C8-93C4-E29A9D710499}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {53437CA6-A84F-4680-B930-E231CDDE9281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {53437CA6-A84F-4680-B930-E231CDDE9281}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {53437CA6-A84F-4680-B930-E231CDDE9281}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {53437CA6-A84F-4680-B930-E231CDDE9281}.Release|Any CPU.Build.0 = Release|Any CPU 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | GlobalSection(NestedProjects) = preSolution 65 | {1EC9A678-7933-4A8C-BA88-BE1321D4DEEC} = {7CF82174-53AE-45C3-B550-E1C7738CA5AB} 66 | {8140CF6C-05D6-445C-A459-5BBDB3FD32C5} = {FDC67C94-7931-4077-90DC-E65257CFBC60} 67 | {CFEBB578-3E57-489B-9149-13EFF7EEDB87} = {A7ED3E33-5652-458C-951F-382F84D5C05E} 68 | {8FABD675-EE64-48F5-AD75-CFF548B89052} = {A7ED3E33-5652-458C-951F-382F84D5C05E} 69 | {ECBE79A2-F287-4616-B475-02464D4CD9BC} = {FDC67C94-7931-4077-90DC-E65257CFBC60} 70 | {E6126602-DD2E-45C8-93C4-E29A9D710499} = {FDC67C94-7931-4077-90DC-E65257CFBC60} 71 | {53437CA6-A84F-4680-B930-E231CDDE9281} = {A7ED3E33-5652-458C-951F-382F84D5C05E} 72 | EndGlobalSection 73 | GlobalSection(ExtensibilityGlobals) = postSolution 74 | SolutionGuid = {E639557B-5E53-4EC9-AB71-C64E275BE060} 75 | EndGlobalSection 76 | EndGlobal 77 | --------------------------------------------------------------------------------