Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
f072c82
feat: added toJson functionality
Dhruv-Maradiya Jan 30, 2025
5170f1d
test: add unit tests for Pubspec toJson functionality
Dhruv-Maradiya Jan 30, 2025
68a12a6
chore: update changelog and version to 1.5.1
Dhruv-Maradiya Jan 30, 2025
a22391e
update version to 1.6.0-wip in changelog and pubspec.yaml
Dhruv-Maradiya Jan 31, 2025
3ec103e
Merge branch 'main' into tojson-pubspec-parser
mosuem Apr 17, 2025
026fc6e
Support newInstanceNamed with empty name (#1194)
mattrbeck Apr 17, 2025
c1cbc84
allow custom ID generators in Clients, and support String ids (#2077)
jakemac53 Apr 21, 2025
bef28ac
[html] fix TypeError in nth-child query selector (#2015)
sstasi95 Apr 22, 2025
34e421b
[html] Various performance optimizations (#2019)
moffatman Apr 24, 2025
d083ea0
Add --fail-under flag for minimum coverage threshold (#2075)
vvs-personalstash Apr 29, 2025
1935f40
[coverage] Fix resume after shutdown error (#2079)
liamappelbe Apr 29, 2025
010afe0
[coverage] Fix another flaky lifecycle management error (#2082)
liamappelbe May 1, 2025
bf31336
fix(clock): keep micros in monthsAgo, monthsFromNow and yearsAgo (#1202)
Goddchen May 5, 2025
64119a3
broaden the publish tag regex to allow digits (#2085)
jakemac53 May 5, 2025
4668c93
[benchmark_harness] Move Measure into its on lib (#2092)
kevmoo May 20, 2025
9589942
[benchmark_harness]: add a bench command (#2091)
kevmoo May 20, 2025
c6a331c
Add package:process (#2097)
devoncarew May 21, 2025
c79aa93
have package:lints use package:lints/recommended (#2098)
devoncarew May 21, 2025
896db9f
add an issue template for package:process (#2099)
devoncarew May 21, 2025
7fe3e10
[test_reflective_loader] Pass test locations to `pkg:test` to improve…
DanTup May 22, 2025
b837c1e
[coverage] Partial workspace support (#2095)
liamappelbe May 22, 2025
14a9767
[coverage] Switch from package:pubspec_parse to package:yaml (#2103)
liamappelbe May 28, 2025
d3d2ec1
Bump actions/setup-node from 3 to 4 in the github-actions group (#2106)
dependabot[bot] Jun 1, 2025
5d9ed7c
[coverage] Fix remaining ~0.1% flakiness (#2102)
liamappelbe Jun 4, 2025
585b9b1
[source_span] Add a test covering the highlighting of non-contiguous …
stof Jun 4, 2025
5d46a4c
Don't emit two WatchEvents when creating a file in a non-existent dir…
bkonyi Jun 11, 2025
1174eb3
remove flutter_markdown integration test (#2114)
kevmoo Jun 24, 2025
8c8d753
Add events for dart mcp server tool invocations (#2112)
jakemac53 Jun 24, 2025
b81556b
Fix status badge (#2116)
kevmoo Jun 24, 2025
590e8a2
[unified_analytics]Add library cycle info to analysis server data (#2…
keertip Jun 24, 2025
0f8807a
[Markdown] Fix HTML comment parser. (#2121)
lrhn Jul 3, 2025
de96517
Add wasm dry run event to unified analytics. (#2125)
biggs0125 Jul 8, 2025
d48736a
[coverage] Expose `filterIgnored` function (#2123)
liamappelbe Jul 8, 2025
cedd940
Fix wasm dry run event and tests (#2128)
biggs0125 Jul 9, 2025
f10484b
Improve test_reflective_loader/README.md (#2129)
scheglov Jul 10, 2025
2dd2f9e
[cli_util] Add base directories (#2130)
dcharkes Jul 15, 2025
eee7e0d
[code_builder] Set `external` and `static` in correct order (#2120)
nikeokoronkwo Jul 17, 2025
342285d
disable failing test (#2136)
devoncarew Jul 29, 2025
94c2bdc
Fix mixtures of parentheses and spaces in windows command paths (#2138)
jakemac53 Jul 30, 2025
700195a
Configure Gemini code review (#2141)
mosuem Aug 6, 2025
48ddaa4
Consistent blank after => members in class-likes (#2146)
natebosch Aug 16, 2025
ee355b9
Windows DirectoryWatcher buffer exhaustion recovery workaround. (#2149)
davidmorgan Aug 25, 2025
bde668b
List directory failure (#2151)
davidmorgan Aug 25, 2025
4f80530
code_builder: update deps, prepare release (#2160)
kevmoo Sep 10, 2025
58b51b3
Update README.md (#2161)
devoncarew Sep 11, 2025
4b9ab59
Update gemini config.yaml (#2162)
devoncarew Sep 11, 2025
c345401
rev package:pool in prep for publishing (#2166)
devoncarew Sep 17, 2025
0dc77ef
add support for `setUpClass` and `tearDownClass` (#2164)
RohitSaily Sep 18, 2025
82825d3
refactor the media types golden table (#2168)
devoncarew Sep 24, 2025
1ac4d8f
Update CODEOWNERS (#2177)
devoncarew Sep 29, 2025
edadc0d
Update CODEOWNERS for pkgs/watcher. (#2179)
davidmorgan Sep 29, 2025
f697db1
Ignore PathNotFoundException when watching subdirs (#2181)
mraleph Sep 30, 2025
5d2f633
Ignore Path{NotFound,Access}Exception in more places. (#2183)
mraleph Sep 30, 2025
fada903
Add test coverage around startup race and missing file on startup. (#…
davidmorgan Sep 30, 2025
3f5eb7f
Update watcher overflow detection (#2182)
mraleph Sep 30, 2025
f047d27
Prepare to release watcher 1.1.4 (#2184)
mraleph Sep 30, 2025
4691d95
Make subdirectory robustness test less strict (#2185)
mraleph Sep 30, 2025
83481e1
[markdown] Simplify deindentation logic for fenced code block lines (…
parlough Sep 30, 2025
e806d54
Fixing structure issue of nested lists indented by tabs (#2172) (#2173)
alexgarbarev Oct 1, 2025
753467d
Bump the github-actions group with 5 updates (#2188)
dependabot[bot] Oct 1, 2025
78a936d
Fix file watcher startup race on MacOS (#2176)
davidmorgan Oct 1, 2025
0732e6a
Add test coverage for file watcher and symlinks. (#2178)
davidmorgan Oct 1, 2025
a52f390
Run file watcher symlink tests. (#2189)
davidmorgan Oct 1, 2025
bbd2227
Add Event.analysisStatistics() constructor. (#2191)
scheglov Oct 4, 2025
f558715
Fix flaky test on Windows. (#2192)
davidmorgan Oct 6, 2025
3ffdc87
Allow more time for tests on Windows. (#2193)
davidmorgan Oct 6, 2025
9b68074
[bazel_worker] Upgrade `protobuf` + cleanups (#2195)
mosuem Oct 7, 2025
cad7da3
Force merge into better state
natebosch Oct 16, 2025
7868406
Merge branch 'main' into tojson-pubspec-parser
natebosch Oct 16, 2025
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
3 changes: 2 additions & 1 deletion pkgs/pubspec_parse/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 1.5.1-wip
## 1.6.0-wip

- Added `toJson` method to `Pubspec` to serialize the object back to a `Map`.
- Require Dart 3.8

## 1.5.0
Expand Down
33 changes: 32 additions & 1 deletion pkgs/pubspec_parse/lib/src/dependency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ Dependency? _fromJson(Object? data, String name) {
return null;
}

sealed class Dependency {}
sealed class Dependency {
Map<String, dynamic> toJson();
}

@JsonSerializable()
class SdkDependency extends Dependency {
Expand All @@ -114,6 +116,9 @@ class SdkDependency extends Dependency {

@override
String toString() => 'SdkDependency: $sdk';

@override
Map<String, dynamic> toJson() => {'sdk': sdk, 'version': version.toString()};
}

@JsonSerializable()
Expand Down Expand Up @@ -149,6 +154,15 @@ class GitDependency extends Dependency {

@override
String toString() => 'GitDependency: url@$url';

@override
Map<String, dynamic> toJson() => {
'git': {
'url': url.toString(),
if (ref != null) 'ref': ref,
if (path != null) 'path': path,
},
};
}

Uri? parseGitUriOrNull(String? value) =>
Expand Down Expand Up @@ -208,6 +222,9 @@ class PathDependency extends Dependency {

@override
String toString() => 'PathDependency: path@$path';

@override
Map<String, dynamic> toJson() => {'path': path};
}

@JsonSerializable(disallowUnrecognizedKeys: true)
Expand All @@ -232,6 +249,12 @@ class HostedDependency extends Dependency {

@override
String toString() => 'HostedDependency: $version';

@override
Map<String, dynamic> toJson() => {
'version': version.toString(),
if (hosted != null) 'hosted': hosted!.toJson(),
};
}

@JsonSerializable(disallowUnrecognizedKeys: true)
Expand Down Expand Up @@ -275,7 +298,15 @@ class HostedDetails {

@override
int get hashCode => Object.hash(name, url);

Map<String, dynamic> toJson() => {
if (declaredName != null) 'name': declaredName,
'url': url.toString(),
};
}

VersionConstraint _constraintFromString(String? input) =>
input == null ? VersionConstraint.any : VersionConstraint.parse(input);

Map<String, dynamic> serializeDeps(Map<String, Dependency> input) =>
input.map((k, v) => MapEntry(k, v.toJson()));
28 changes: 20 additions & 8 deletions pkgs/pubspec_parse/lib/src/pubspec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import 'screenshot.dart';

part 'pubspec.g.dart';

@JsonSerializable()
@JsonSerializable(createToJson: true)
class Pubspec {
// TODO: executables

final String name;

@JsonKey(fromJson: _versionFromString)
@JsonKey(fromJson: _versionFromString, toJson: _versionToString)
final Version? version;

final String? description;
Expand Down Expand Up @@ -51,7 +51,7 @@ class Pubspec {
final List<String>? ignoredAdvisories;

/// Optional field for specifying included screenshot files.
@JsonKey(fromJson: parseScreenshots)
@JsonKey(fromJson: parseScreenshots, toJson: serializeScreenshots)
final List<Screenshot>? screenshots;

/// If there is exactly 1 value in [authors], returns it.
Expand All @@ -69,16 +69,16 @@ class Pubspec {
final List<String> authors;
final String? documentation;

@JsonKey(fromJson: _environmentMap)
@JsonKey(fromJson: _environmentMap, toJson: _serializeEnvironment)
final Map<String, VersionConstraint?> environment;

@JsonKey(fromJson: parseDeps)
@JsonKey(fromJson: parseDeps, toJson: serializeDeps)
final Map<String, Dependency> dependencies;

@JsonKey(fromJson: parseDeps)
@JsonKey(fromJson: parseDeps, toJson: serializeDeps)
final Map<String, Dependency> devDependencies;

@JsonKey(fromJson: parseDeps)
@JsonKey(fromJson: parseDeps, toJson: serializeDeps)
final Map<String, Dependency> dependencyOverrides;

/// Optional configuration specific to [Flutter](https://flutter.io/)
Expand All @@ -90,7 +90,7 @@ class Pubspec {
final Map<String, dynamic>? flutter;

/// Optional field to specify executables
@JsonKey(fromJson: _executablesMap)
@JsonKey(fromJson: _executablesMap, toJson: _serializeExecutables)
final Map<String, String?> executables;

/// If this package is a Pub Workspace, this field lists the sub-packages.
Expand Down Expand Up @@ -171,6 +171,9 @@ class Pubspec {
return _$PubspecFromJson(json);
}

// Returns a JSON-serializable map for this instance.
Map<String, dynamic> toJson() => _$PubspecToJson(this);

/// Parses source [yaml] into [Pubspec].
///
/// When [lenient] is set, top-level property-parsing or type cast errors are
Expand Down Expand Up @@ -247,3 +250,12 @@ Map<String, String?> _executablesMap(Map? source) =>
}
}) ??
{};

Map<String, String?> _serializeEnvironment(
Map<String, VersionConstraint?> map,
) => map.map((key, value) => MapEntry(key, value?.toString()));

String? _versionToString(Version? version) => version?.toString();

Map<String, String?> _serializeExecutables(Map<String, String?>? map) =>
map?.map(MapEntry.new) ?? {};
25 changes: 25 additions & 0 deletions pkgs/pubspec_parse/lib/src/pubspec.g.dart

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

8 changes: 8 additions & 0 deletions pkgs/pubspec_parse/lib/src/screenshot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,11 @@ List<Screenshot> parseScreenshots(List? input) {
}
return res;
}

List<Map<String, String>> serializeScreenshots(List<Screenshot>? input) =>
input
?.map(
(e) => <String, String>{'description': e.description, 'path': e.path},
)
.toList() ??
[];
2 changes: 1 addition & 1 deletion pkgs/pubspec_parse/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pubspec_parse
version: 1.5.1-wip
version: 1.6.0-wip
description: >-
Simple package for parsing pubspec.yaml files with a type-safe API and rich
error reporting.
Expand Down
Loading