Skip to content

Commit 34a3244

Browse files
authored
Merge pull request #9834 from NuGet/dev
[ReleasePrep][2024.02.27] RI of dev into main
2 parents acb9dab + c6a67b6 commit 34a3244

14 files changed

Lines changed: 313 additions & 193 deletions

File tree

Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project>
22
<PropertyGroup>
3-
<NuGetClientPackageVersion>6.6.1</NuGetClientPackageVersion>
4-
<ServerCommonPackageVersion>2.115.0</ServerCommonPackageVersion>
5-
<NuGetJobsPackageVersion>4.3.0-dev-8972385</NuGetJobsPackageVersion>
3+
<NuGetClientPackageVersion>6.9.1</NuGetClientPackageVersion>
4+
<ServerCommonPackageVersion>2.117.0</ServerCommonPackageVersion>
5+
<NuGetJobsPackageVersion>4.3.0-dev-9116469</NuGetJobsPackageVersion>
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">

src/NuGetGallery.Core/Services/CorePackageService.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,23 +300,23 @@ protected IQueryable<Package> GetPackagesByIdQueryable(
300300
string id,
301301
PackageDeprecationFieldsToInclude deprecationFields = PackageDeprecationFieldsToInclude.None)
302302
{
303-
bool includeDeprecation;
303+
bool includeDeprecations;
304304
bool includeDeprecationRelationships;
305305

306306
switch (deprecationFields)
307307
{
308308
case PackageDeprecationFieldsToInclude.None:
309-
includeDeprecation = false;
309+
includeDeprecations = false;
310310
includeDeprecationRelationships = false;
311311
break;
312312

313313
case PackageDeprecationFieldsToInclude.Deprecation:
314-
includeDeprecation = true;
314+
includeDeprecations = true;
315315
includeDeprecationRelationships = false;
316316
break;
317317

318318
case PackageDeprecationFieldsToInclude.DeprecationAndRelationships:
319-
includeDeprecation = true;
319+
includeDeprecations = true;
320320
includeDeprecationRelationships = true;
321321
break;
322322

@@ -330,8 +330,9 @@ protected IQueryable<Package> GetPackagesByIdQueryable(
330330
includePackageRegistration: true,
331331
includeUser: true,
332332
includeSymbolPackages: true,
333-
includeDeprecation: includeDeprecation,
334-
includeDeprecationRelationships: includeDeprecationRelationships);
333+
includeDeprecations: includeDeprecations,
334+
includeDeprecationRelationships: includeDeprecationRelationships,
335+
includeSupportedFrameworks: false);
335336
}
336337

337338
protected IQueryable<Package> GetPackagesByIdQueryable(
@@ -340,8 +341,9 @@ protected IQueryable<Package> GetPackagesByIdQueryable(
340341
bool includePackageRegistration,
341342
bool includeUser,
342343
bool includeSymbolPackages,
343-
bool includeDeprecation,
344-
bool includeDeprecationRelationships)
344+
bool includeDeprecations,
345+
bool includeDeprecationRelationships,
346+
bool includeSupportedFrameworks)
345347
{
346348
var packages = _packageRepository
347349
.GetAll()
@@ -373,11 +375,16 @@ protected IQueryable<Package> GetPackagesByIdQueryable(
373375
.Include(p => p.Deprecations.Select(d => d.AlternatePackage.PackageRegistration))
374376
.Include(p => p.Deprecations.Select(d => d.AlternatePackageRegistration));
375377
}
376-
else if (includeDeprecation)
378+
else if (includeDeprecations)
377379
{
378380
packages = packages.Include(p => p.Deprecations);
379381
}
380382

383+
if (includeSupportedFrameworks)
384+
{
385+
packages = packages.Include(p => p.SupportedFrameworks);
386+
}
387+
381388
return packages;
382389
}
383390

src/NuGetGallery.Services/PackageManagement/IPackageService.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,28 @@ public interface IPackageService : ICorePackageService
3232
/// Includes deprecation fields based on <paramref name="deprecationFields"/>.
3333
/// </summary>
3434
IReadOnlyCollection<Package> FindPackagesById(
35-
string id,
35+
string id,
3636
PackageDeprecationFieldsToInclude deprecationFields = PackageDeprecationFieldsToInclude.None);
3737

3838
/// <summary>
3939
/// Returns all packages with an <see cref="Package.Id"/> of <paramref name="id"/>.
4040
/// Includes the <see cref="Package.PackageRegistration"/> fields based on <paramref name="includePackageRegistration"/>.
4141
/// </summary>
42-
IReadOnlyCollection<Package> FindPackagesById(string id, bool includePackageRegistration);
42+
IReadOnlyCollection<Package> FindPackagesById(
43+
string id,
44+
bool includePackageRegistration);
45+
46+
/// <summary>
47+
/// Returns all packages with an <see cref="Package.Id"/> of <paramref name="id"/>.
48+
/// Includes the <see cref="Package.PackageRegistration"/> fields based on <paramref name="includePackageRegistration"/>.
49+
/// Includes the <see cref="Package.Deprecations"/> fields based on <paramref name="includeDeprecations"/>.
50+
/// Includes the <see cref="Package.SupportedFrameworks"/> fields based on <paramref name="includeSupportedFrameworks);"/>.
51+
/// </summary>
52+
IReadOnlyCollection<Package> FindPackagesById(
53+
string id,
54+
bool includePackageRegistration,
55+
bool includeDeprecations,
56+
bool includeSupportedFrameworks);
4357

4458
/// <summary>
4559
/// Gets the package with the given ID and version when exists;

src/NuGetGallery.Services/PackageManagement/PackageService.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,33 @@ public virtual IReadOnlyCollection<Package> FindPackagesById(
239239
includePackageRegistration: includePackageRegistration,
240240
includeUser: false,
241241
includeSymbolPackages: false,
242-
includeDeprecation: false,
243-
includeDeprecationRelationships: false);
242+
includeDeprecations: false,
243+
includeDeprecationRelationships: false,
244+
includeSupportedFrameworks: false);
245+
246+
return packages.ToList();
247+
}
248+
249+
public IReadOnlyCollection<Package> FindPackagesById(
250+
string id,
251+
bool includePackageRegistration,
252+
bool includeDeprecations,
253+
bool includeSupportedFrameworks)
254+
{
255+
if (id == null)
256+
{
257+
throw new ArgumentNullException(nameof(id));
258+
}
259+
260+
var packages = GetPackagesByIdQueryable(
261+
id,
262+
includeLicenseReports: false,
263+
includePackageRegistration: includePackageRegistration,
264+
includeUser: false,
265+
includeSymbolPackages: false,
266+
includeDeprecations: includeDeprecations,
267+
includeDeprecationRelationships: false,
268+
includeSupportedFrameworks: includeSupportedFrameworks);
244269

245270
return packages.ToList();
246271
}

src/NuGetGallery/Controllers/PackagesController.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,11 @@ public virtual async Task<ActionResult> DisplayPackage(string id, string version
925925
}
926926

927927
// Load all packages with the ID.
928-
var allVersions = _packageService.FindPackagesById(id, includePackageRegistration: true);
928+
var allVersions = _packageService.FindPackagesById(id,
929+
includePackageRegistration: true,
930+
includeDeprecations: true,
931+
includeSupportedFrameworks: true);
932+
929933
var filterContext = new PackageFilterContext(RouteData?.Route, version);
930934
var package = _packageFilter.GetFiltered(allVersions, filterContext);
931935

src/NuGetGallery/Scripts/gallery/page-downloads.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
var chevronIcon;
99
var olderVersionsElement;
10-
10+
1111
function makeOlderVersionsCollapsible() {
12-
const listContainer = document.getElementById('nuget-exe').children[1]; //children[0] is the headline, children[1] is the list of versions
13-
const listContainerParent = document.getElementById('nuget-exe');
12+
const listContainer = document.getElementById('win-x86-versions').children[1]; //children[0] is the headline, children[1] is the list of versions
13+
const listContainerParent = document.getElementById('win-x86-versions');
1414
olderVersionsElement = document.createElement('div');
1515

1616
// We want to display 2 versions to the users. Others should be collapsed.
1717
const allVersions = listContainer.querySelectorAll('li');
1818
var collapsedVersions = Array.from(allVersions).slice(2);
19-
19+
2020
// If the first two versions in json file are the same, we only want to show the first.
2121
// The following code checks if they're the same, and if so, removes the second.
2222
// It checks if they're the same based on the last word, which is a version identifier.
@@ -33,7 +33,7 @@
3333
if (firstVersionLastWord === secondVersionLastWord) {
3434
listContainer.removeChild(secondElement);
3535
}
36-
36+
3737
olderVersionsElement.setAttribute('class', 'older-versions-dropdown');
3838
olderVersionsElement.innerHTML = 'Older versions ' +
3939
'<button class="toggle-older-versions-button"' +
@@ -45,7 +45,8 @@
4545
'type="button">' +
4646
'<i class="ms-Icon ms-Icon--ChevronDown"' +
4747
'id="olderVersionsToggleChevron"></i>' +
48-
'</button>';
48+
'</button>' +
49+
'<p> These versions are no longer supported and might have vulnerabilities. </p>';
4950

5051
const versionsList = document.createElement('ul');
5152

src/NuGetGallery/Scripts/gallery/page-list-packages.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
$(function() {
22
'use strict';
33

4-
$(".reserved-indicator").each(window.nuget.setPopovers);
5-
$(".package-warning--vulnerable").each(window.nuget.setPopovers);
6-
$(".package-warning--deprecated").each(window.nuget.setPopovers);
7-
$(".frameworkfiltermode-info").each(window.nuget.setPopovers);
8-
94
const storage = window['localStorage'];
105
const focusResultsColumnKey = 'focus_results_column';
116

@@ -206,6 +201,10 @@ $(function() {
206201
initializeFrameworkAndTfmCheckboxes();
207202
}
208203

204+
$(".reserved-indicator").each(window.nuget.setPopovers);
205+
$(".package-warning--vulnerable").each(window.nuget.setPopovers);
206+
$(".package-warning--deprecated").each(window.nuget.setPopovers);
207+
$(".frameworkfiltermode-info").each(window.nuget.setPopovers);
209208
$(".framework-badge-asset").each(window.nuget.setPopovers);
210209
$(".framework-badge-computed").each(window.nuget.setPopovers);
211210
});

src/NuGetGallery/Services/MarkdownService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class MarkdownService : IMarkdownService
2020
private static readonly TimeSpan RegexTimeout = TimeSpan.FromMinutes(1);
2121
private static readonly Regex EncodedBlockQuotePattern = new Regex("^ {0,3}&gt;", RegexOptions.Multiline, RegexTimeout);
2222
private static readonly Regex LinkPattern = new Regex("<a href=([\"\']).*?\\1", RegexOptions.None, RegexTimeout);
23+
private static readonly Regex JavaScriptPattern = new Regex("<a href=([\"\'])javascript:.*?\\1 rel=([\"'])noopener noreferrer nofollow\\1>", RegexOptions.None, RegexTimeout);
2324
private static readonly Regex HtmlCommentPattern = new Regex("<!--.*?-->", RegexOptions.Singleline, RegexTimeout);
2425
private static readonly Regex ImageTextPattern = new Regex("!\\[\\]\\(", RegexOptions.Singleline, RegexTimeout);
2526
private static readonly string altTextForImage = "alternate text is missing from this package README image";
@@ -285,6 +286,7 @@ private RenderedMarkdownResult GetHtmlFromMarkdownMarkdig(string markdownString,
285286
renderer.Render(document);
286287
output.Content = htmlWriter.ToString().Trim();
287288
output.IsMarkdigMdSyntaxHighlightEnabled = _features.IsMarkdigMdSyntaxHighlightEnabled();
289+
output.Content = JavaScriptPattern.Replace(htmlWriter.ToString(), "").Trim();
288290

289291
return output;
290292
}

src/NuGetGallery/Views/Packages/_SupportedFrameworksTable.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
</table>
4242
<div>
4343
<div>
44-
<i class="frameworktableinfo-asset-icon"></i>
44+
<i class="frameworktableinfo-computed-icon framework-badge-computed"></i>
4545
<span class="frameworktableinfo-text">Compatible target framework(s)</span>
4646
</div>
4747
<div>
48-
<i class="frameworktableinfo-computed-icon framework-badge-computed"></i>
49-
<span class="frameworktableinfo-text">Additional computed target framework(s)</span>
48+
<i class="frameworktableinfo-asset-icon"></i>
49+
<span class="frameworktableinfo-text">Included target framework(s) (in package)</span>
5050
</div>
5151
<span class="frameworktableinfo-text"><i>Learn more about <a href='https://docs.microsoft.com/dotnet/standard/frameworks' aria-label="Learn more about Target Frameworks">Target Frameworks</a> and <a href='https://docs.microsoft.com/dotnet/standard/net-standard' aria-label="Learn more about .NET Standard">.NET Standard</a>.</i></span>
52-
</div>
52+
</div>

src/NuGetGallery/Views/Pages/Downloads.cshtml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,22 @@
1111
</div>
1212
<div class="row">
1313
<div class="col-md-4">
14-
<h2 class="ms-fontSize-xxl">NuGet.exe</h2>
14+
<h2 class="ms-fontSize-xxl">Windows x86 Commandline</h2>
1515
<ul class="list-unstyled list-tools">
1616
<li><a href="https://dist.nuget.org/win-x86-commandline/latest/nuget.exe">nuget.exe - recommended latest</a></li>
1717
</ul>
1818
</div>
1919
<div class="col-md-4">
20-
<h2 class="ms-fontSize-xxl">Visual Studio</h2>
21-
<p>
22-
NuGet Package Manager (PM UI and PM Console) is included with Visual Studio. Latest NuGet releases are delivered as part of Visual Studio updates. Note: nuget.exe itself is not included with any version of Visual Studio.
23-
</p>
20+
<h2 class="ms-fontSize-xxl">Visual Studio 2015</h2>
2421
<ul class="list-unstyled list-tools">
25-
<li><a href="https://visualstudio.microsoft.com/downloads/">Download Visual Studio</a></li>
22+
<li><a href="https://dist.nuget.org/visualstudio-2015-vsix/latest/NuGet.Tools.vsix">VS 2015 VSIX - latest</a></li>
2623
</ul>
2724
</div>
2825
<div class="col-md-4">
29-
<h2 class="ms-fontSize-xxl">.NET SDK</h2>
26+
<h2 class="ms-fontSize-xxl">Visual Studio 2017</h2>
3027
<p>
31-
The CLI tool for .NET Core and .NET Standard libraries, and for any SDK-style project such as one that targets the .NET Framework. This CLI tool is included with the .NET Core SDK and provides core NuGet features on all platforms.
28+
NuGet 4.x is included in the Visual Studio 2017 installation. Latest NuGet releases are delivered as part of Visual Studio updates.
3229
</p>
33-
<ul class="list-unstyled list-tools">
34-
<li><a href="https://dotnet.microsoft.com/en-us/download">Download .NET SDK</a></li>
35-
</ul>
3630
</div>
3731
</div>
3832
</section>
@@ -46,21 +40,21 @@
4640
<div class="row">
4741
<div class="col-md-4">
4842
<!-- ko foreach: artifacts -->
49-
<!-- ko if: name == "nuget-exe" -->
50-
<div id="nuget-exe" data-bind="template: { name: 'tool-list-template', data: $data }"></div>
43+
<!-- ko if: name == "win-x86-commandline" -->
44+
<div id="win-x86-versions" data-bind="template: { name: 'tool-list-template', data: $data }"></div>
5145
<!-- /ko -->
5246
<!-- /ko -->
5347
</div>
5448
<div class="col-md-4">
5549
<!-- ko foreach: artifacts -->
56-
<!-- ko if: name == "visualstudio-vsix" -->
50+
<!-- ko if: name == "visualstudio-2017-vsix" -->
5751
<div data-bind="template: { name: 'tool-list-template', data: $data }"></div>
5852
<!-- /ko -->
5953
<!-- /ko -->
6054
</div>
6155
<div class="col-md-4">
6256
<!-- ko foreach: artifacts -->
63-
<!-- ko if: name != "nuget-exe" && name != "visualstudio-vsix" -->
57+
<!-- ko if: name != "win-x86-commandline" && name != "visualstudio-2017-vsix" -->
6458
<div data-bind="template: { name: 'tool-list-template', data: $data }"></div>
6559
<!-- /ko -->
6660
<!-- /ko -->

0 commit comments

Comments
 (0)