Skip to content
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

Split out directDependencies and devDependencies in pub deps #4383

Merged
merged 8 commits into from
Sep 25, 2024
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
12 changes: 11 additions & 1 deletion lib/src/command/deps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,17 @@ class DepsCommand extends PubCommand {
'version': currentPackage.version.toString(),
'kind': kind,
'source': source,
'dependencies': next,
// This field is kept for backwards compatibility with dart 3.5 and
// before. Clients should opt to consume directDependencies and
// devDependencies separately instead.
'dependencies': (isRoot
? currentPackage.dependencies
: currentPackage.immediateDependencies)
.keys
.toList(),
'directDependencies': currentPackage.dependencies.keys.toList(),
if (isRoot)
'devDependencies': currentPackage.devDependencies.keys.toList(),
});
toVisit.addAll(next);
}
Expand Down
14 changes: 7 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: f6dbf021f4b214d85c79822912c5fcd142a2c4869f01222ad371bc51f9f1c356
sha256: "45cfa8471b89fb6643fe9bf51bd7931a76b8f5ec2d65de4fb176dba8d4f22c77"
url: "https://pub.dev"
source: hosted
version: "74.0.0"
version: "73.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.3"
version: "0.3.2"
analyzer:
dependency: "direct main"
description:
name: analyzer
sha256: f7e8caf82f2d3190881d81012606effdf8a38e6c1ab9e30947149733065f817c
sha256: "4959fec185fe70cce007c57e9ab6983101dbe593d2bf8bbfb4453aaec0cf470a"
url: "https://pub.dev"
source: hosted
version: "6.9.0"
version: "6.8.0"
args:
dependency: "direct main"
description:
Expand Down Expand Up @@ -194,10 +194,10 @@ packages:
dependency: transitive
description:
name: macros
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
url: "https://pub.dev"
source: hosted
version: "0.1.3-main.0"
version: "0.1.2-main.4"
matcher:
dependency: transitive
description:
Expand Down
47 changes: 40 additions & 7 deletions test/deps_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,24 @@ void main() {
"dependencies": [
"normal",
"overridden",
"from_path",
"unittest",
"override_only"
"from_path"
],
"directDependencies": [
"normal",
"overridden",
"from_path"
],
"devDependencies": [
"unittest"
]
},
{
"name": "override_only",
"version": "1.2.3",
"kind": "transitive",
"source": "hosted",
"dependencies": []
"dependencies": [],
"directDependencies": []
},
{
"name": "unittest",
Expand All @@ -178,14 +185,19 @@ void main() {
"dependencies": [
"shared",
"dev_only"
],
"directDependencies": [
"shared",
"dev_only"
]
},
{
"name": "dev_only",
"version": "1.2.3",
"kind": "transitive",
"source": "hosted",
"dependencies": []
"dependencies": [],
"directDependencies": []
},
{
"name": "shared",
Expand All @@ -194,6 +206,9 @@ void main() {
"source": "hosted",
"dependencies": [
"other"
],
"directDependencies": [
"other"
]
},
{
Expand All @@ -203,21 +218,26 @@ void main() {
"source": "hosted",
"dependencies": [
"myapp"
],
"directDependencies": [
"myapp"
]
},
{
"name": "from_path",
"version": "1.2.3",
"kind": "direct",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
},
{
"name": "overridden",
"version": "2.0.0",
"kind": "direct",
"source": "hosted",
"dependencies": []
"dependencies": [],
"directDependencies": []
},
{
"name": "normal",
Expand All @@ -227,6 +247,10 @@ void main() {
"dependencies": [
"transitive",
"circular_a"
],
"directDependencies": [
"transitive",
"circular_a"
]
},
{
Expand All @@ -236,6 +260,9 @@ void main() {
"source": "hosted",
"dependencies": [
"circular_b"
],
"directDependencies": [
"circular_b"
]
},
{
Expand All @@ -245,6 +272,9 @@ void main() {
"source": "hosted",
"dependencies": [
"circular_a"
],
"directDependencies": [
"circular_a"
]
},
{
Expand All @@ -254,6 +284,9 @@ void main() {
"source": "hosted",
"dependencies": [
"shared"
],
"directDependencies": [
"shared"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,28 @@ $ pub deps --json
"dependencies": [
"foo",
"bar"
]
],
"directDependencies": [
"foo",
"bar"
],
"devDependencies": []
},
{
"name": "bar",
"version": "1.0.0",
"kind": "direct",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
},
{
"name": "foo",
"version": "1.0.0",
"kind": "direct",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ $ pub deps --json
"version": "0.0.0",
"kind": "root",
"source": "root",
"dependencies": [
"dependencies": [],
"directDependencies": [],
"devDependencies": [
"foo"
]
},
Expand All @@ -43,7 +45,8 @@ $ pub deps --json
"version": "1.0.0",
"kind": "dev",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ $ pub deps --json
"version": "0.0.0",
"kind": "root",
"source": "root",
"dependencies": []
"dependencies": [],
"directDependencies": [],
"devDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ $ pub deps --json
"source": "root",
"dependencies": [
"foo"
]
],
"directDependencies": [
"foo"
],
"devDependencies": []
},
{
"name": "foo",
"version": "1.0.0",
"kind": "direct",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ $ pub deps --json
"source": "root",
"dependencies": [
"foo"
]
],
"directDependencies": [
"foo"
],
"devDependencies": []
},
{
"name": "foo",
Expand All @@ -49,14 +53,18 @@ $ pub deps --json
"source": "path",
"dependencies": [
"baz"
],
"directDependencies": [
"baz"
]
},
{
"name": "baz",
"version": "1.0.0",
"kind": "transitive",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ $ pub deps --json
"source": "root",
"dependencies": [
"foo"
]
],
"directDependencies": [
"foo"
],
"devDependencies": []
},
{
"name": "foo",
"version": "2.0.0",
"kind": "direct",
"source": "path",
"dependencies": []
"dependencies": [],
"directDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ $ pub deps --json
"version": "0.0.0",
"kind": "root",
"source": "root",
"dependencies": []
"dependencies": [],
"directDependencies": [],
"devDependencies": []
}
],
"sdks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ $ pub deps --json
"version": "0.0.0",
"kind": "root",
"source": "root",
"dependencies": []
"dependencies": [],
"directDependencies": [],
"devDependencies": []
}
],
"sdks": [
Expand Down
Loading