Skip to content

Commit

Permalink
Merge pull request #79 from Daddoon/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Daddoon authored Dec 4, 2021
2 parents 7c46289 + 789f81a commit 3f13f69
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/Blazor.Polyfill.Server/Blazor.Polyfill.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>6.0.100.2</Version>
<Version>6.0.100.3</Version>
<Authors>Guillaume ZAHRA</Authors>
<Company>Daddoon</Company>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
Expand All @@ -14,6 +14,9 @@
<RepositoryUrl>https://github.com/Daddoon/Blazor.Polyfill</RepositoryUrl>
<PackageTags>blazor blazor-server ie11 edgeHTML edge-legacy polyfill</PackageTags>
<PackageReleaseNotes>
6.0.100.3:
- Fix invalid 'require' keyword in blazor.server.js added by Babel in transpilation that cannot be used on a pure javascript environment

6.0.100.2:
- Blazor.Polyfill now respect the autostart attribute value at start
- Added the ES5ConversionScope option in Blazor.Polyfill configuration. This option is meant to transpile None, Razor Class Libraries, or All Javascript files to ES5 automatically and store it in a es5cache store for your application. Files will be used automatically at runtime when needed. Keeping them under source control is advised.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ private static FileContentReference GetPatchedBlazorServerFile()
//We still need to fix 'state' regex evaluation code, as it was expecting a named capture group.
js = Regex.Replace(js, "([_a-zA-Z0-9]+)(.groups[ ]*&&[ ]*[_a-zA-Z0-9]+.groups.state)", "$1[1]");

//Here we fix invalids interopRequireWildcard(require(''.concat(n))) to _interopRequireWildcard(''.concat(n)) (works for '' or "")
//Warning: " is written "" here but must be read as " from the regex logic: We are in a verbatim string
js = Regex.Replace(js, @"(require\((['""]['""].concat\([a-zA-Z]+\))\))", "$2");

#endregion Regex named groups fix

//Minify with AjaxMin (we don't want an additional external tool with NPM or else for managing this
Expand Down
2 changes: 1 addition & 1 deletion src/Blazor.Polyfill.Server/dist/blazor.server.packaged.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/MyApp/MyApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

<ItemGroup>
<PackageReference Include="BlazorPolyfill.Build" Version="6.0.100.2" />
<PackageReference Include="BlazorPolyfill.Server" Version="6.0.100.2" />
<PackageReference Include="Radzen.Blazor" Version="3.12.2" />
</ItemGroup>

<ItemGroup>
<Folder Include="wwwroot\es5cache\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Blazor.Polyfill.Server\Blazor.Polyfill.Server.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/MyApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseBlazorPolyfill((options) =>
{
options.ES5ConversionScope = ES5ConversionScope.All;
options.UsePackagedBlazorServerLibrary = false;
options.ForceES5Fallback = true;
options.UsePackagedBlazorServerLibrary = true;
options.ForceES5Fallback = false;
options.JavascriptModuleImportEmulation = true;
options.JavascriptModuleImportEmulationLibraryPath = "/es5module.min.js";
});
Expand Down

0 comments on commit 3f13f69

Please sign in to comment.