Skip to content

Remove the SDK version from SDK hits and index. #8771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/lib/frontend/templates/views/pkg/package_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ d.Node listOfPackagesNode({

d.Node _sdkLibraryItem(SdkLibraryHit hit) {
final sdkDict = getSdkDict(hit.sdk!);
final metadataText = [
if (hit.version != null) 'v ${hit.version}',
sdkDict.libraryTypeLabel,
].join(' • ');

return _item(
url: hit.url!,
Expand All @@ -60,7 +56,8 @@ d.Node _sdkLibraryItem(SdkLibraryHit hit) {
labeledScoresNode: null,
description: hit.description ?? '',
metadataNode: d.fragment([
d.span(classes: ['packages-metadata-block'], text: metadataText),
d.span(
classes: ['packages-metadata-block'], text: sdkDict.libraryTypeLabel),
coreLibraryBadgeNode,
nullSafeBadgeNode(),
]),
Expand Down
7 changes: 0 additions & 7 deletions app/lib/search/sdk_mem_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:pana/src/dartdoc/dartdoc_index.dart';
import 'package:path/path.dart' as p;
import 'package:pub_dev/search/flutter_sdk_mem_index.dart';

import '../shared/versions.dart';
import 'search_service.dart';
import 'token_index.dart';

Expand All @@ -34,7 +33,6 @@ const _defaultApiPageDirWeights = {
/// In-memory index for SDK library search queries.
class SdkMemIndex {
final String _sdk;
final String? _version;
final Uri _baseUri;
final _tokensPerLibrary = <String, TokenIndex<String>>{};
final _baseUriPerLibrary = <String, String>{};
Expand All @@ -43,13 +41,11 @@ class SdkMemIndex {

SdkMemIndex({
required String sdk,
required String? version,
required Uri baseUri,
required DartdocIndex index,
Set<String>? allowedLibraries,
Map<String, double>? apiPageDirWeights,
}) : _sdk = sdk,
_version = version,
_baseUri = baseUri,
_apiPageDirWeights = apiPageDirWeights ?? _defaultApiPageDirWeights {
_addDartdocIndex(index, allowedLibraries);
Expand All @@ -58,7 +54,6 @@ class SdkMemIndex {
static SdkMemIndex dart({required DartdocIndex index}) {
return SdkMemIndex(
sdk: 'dart',
version: runtimeSdkVersion,
baseUri: Uri.parse('https://api.dart.dev/stable/latest/'),
index: index,
);
Expand All @@ -67,7 +62,6 @@ class SdkMemIndex {
factory SdkMemIndex.flutter({required DartdocIndex index}) {
return SdkMemIndex(
sdk: 'flutter',
version: null,
baseUri: Uri.parse('https://api.flutter.dev/flutter/'),
index: index,
allowedLibraries: flutterSdkAllowedLibraries,
Expand Down Expand Up @@ -159,7 +153,6 @@ class SdkMemIndex {
.where((h) => h.score >= minScore)
.map((hit) => SdkLibraryHit(
sdk: _sdk,
version: _version,
library: hit.library,
description: _descriptionPerLibrary[hit.library],
url: _baseUriPerLibrary[hit.library] ?? _baseUri.toString(),
Expand Down
2 changes: 0 additions & 2 deletions app/lib/search/search_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ class PackageSearchResult {
@JsonSerializable(includeIfNull: false, explicitToJson: true)
class SdkLibraryHit {
final String? sdk;
final String? version;
final String? library;
final String? description;
final String? url;
Expand All @@ -436,7 +435,6 @@ class SdkLibraryHit {

SdkLibraryHit({
required this.sdk,
required this.version,
required this.library,
required this.description,
required this.url,
Expand Down
2 changes: 0 additions & 2 deletions app/lib/search/search_service.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/test/frontend/golden/pkg_index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h3 class="packages-title pub-monochrome-icon-hoverable">
<span>core description</span>
</div>
<p class="packages-metadata">
<span class="packages-metadata-block">v 2.14.0 • Dart SDK library</span>
<span class="packages-metadata-block">Dart SDK library</span>
<span class="package-badge">Core library</span>
<span class="package-badge" title="Supports the null safety language feature.">Null safety</span>
</p>
Expand Down
1 change: 0 additions & 1 deletion app/test/frontend/templates_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ void main() {
sdkLibraryHits: [
SdkLibraryHit(
sdk: 'dart',
version: '2.14.0',
library: 'dart:core',
description: 'core description',
url: 'https://api.dart.dev/library-page.html',
Expand Down
2 changes: 0 additions & 2 deletions app/test/search/result_combiner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ void main() {
primaryIndex: primaryIndex,
dartSdkMemIndex: SdkMemIndex(
sdk: 'dart',
version: runtimeSdkVersion,
baseUri: Uri.parse('https://api.dart.dev/stable/$runtimeSdkVersion/'),
index: DartdocIndex.fromJsonList([
{
Expand Down Expand Up @@ -111,7 +110,6 @@ void main() {
'sdkLibraryHits': [
{
'sdk': 'dart',
'version': isNotEmpty,
'library': 'dart:core',
'url': contains('dart-core-library.html'),
'score': closeTo(0.98, 0.01),
Expand Down
4 changes: 0 additions & 4 deletions app/test/search/sdk_mem_index_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ void main() {
setUpAll(() async {
index = SdkMemIndex(
sdk: 'dart',
version: '',
baseUri: Uri.parse('https://api.dart.dev/x/'),
index: DartdocIndex.fromJsonList([
{
Expand Down Expand Up @@ -91,7 +90,6 @@ void main() {
[
{
'sdk': 'dart',
'version': '',
'library': 'dart:async',
'description': 'async description',
'url': 'https://api.dart.dev/x/dart-async/dart-async-library.html',
Expand Down Expand Up @@ -124,7 +122,6 @@ void main() {
[
{
'sdk': 'dart',
'version': '',
'library': 'dart:async',
'description': 'async description',
'url': 'https://api.dart.dev/x/dart-async/dart-async-library.html',
Expand All @@ -148,7 +145,6 @@ void main() {
[
{
'sdk': 'dart',
'version': '',
'library': 'dart:async',
'description': 'async description',
'url': 'https://api.dart.dev/x/dart-async/dart-async-library.html',
Expand Down