mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 15:19:40 -05:00
fix(cli): make output of deno info --json deterministic (#8483)
Fixes #8458
This commit is contained in:
parent
b8d3caa5d5
commit
57f163510a
5 changed files with 49 additions and 3 deletions
|
@ -41,8 +41,8 @@ use regex::Regex;
|
|||
use serde::Deserialize;
|
||||
use serde::Deserializer;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::{BTreeSet, HashMap};
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::path::PathBuf;
|
||||
|
@ -1098,7 +1098,7 @@ impl Graph {
|
|||
.modules
|
||||
.iter()
|
||||
.map(|(specifier, module)| {
|
||||
let mut deps = HashSet::new();
|
||||
let mut deps = BTreeSet::new();
|
||||
for (_, dep) in module.dependencies.iter() {
|
||||
if let Some(code_dep) = &dep.maybe_code {
|
||||
deps.insert(code_dep.clone());
|
||||
|
|
38
cli/tests/076_info_json_deps_order.out
Normal file
38
cli/tests/076_info_json_deps_order.out
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"compiled": null,
|
||||
"depCount": 4,
|
||||
"fileType": "TypeScript",
|
||||
"files": {
|
||||
"[WILDCARD]cli/tests/076_info_json_deps_order.ts": {
|
||||
"deps": [
|
||||
"[WILDCARD]cli/tests/recursive_imports/A.ts"
|
||||
],
|
||||
"size": [WILDCARD]
|
||||
},
|
||||
"[WILDCARD]cli/tests/recursive_imports/A.ts": {
|
||||
"deps": [
|
||||
"[WILDCARD]cli/tests/recursive_imports/B.ts",
|
||||
"[WILDCARD]cli/tests/recursive_imports/common.ts"
|
||||
],
|
||||
"size": [WILDCARD]
|
||||
},
|
||||
"[WILDCARD]cli/tests/recursive_imports/B.ts": {
|
||||
"deps": [
|
||||
"[WILDCARD]cli/tests/recursive_imports/C.ts",
|
||||
"[WILDCARD]cli/tests/recursive_imports/common.ts"
|
||||
],
|
||||
"size": [WILDCARD]
|
||||
},
|
||||
"[WILDCARD]cli/tests/recursive_imports/C.ts": {
|
||||
"deps": [
|
||||
"[WILDCARD]cli/tests/recursive_imports/A.ts",
|
||||
"[WILDCARD]cli/tests/recursive_imports/common.ts"
|
||||
],
|
||||
"size": [WILDCARD]
|
||||
},
|
||||
"[WILDCARD]cli/tests/recursive_imports/common.ts": {
|
||||
"deps": [],
|
||||
"size": [WILDCARD]
|
||||
}
|
||||
},
|
||||
[WILDCARD]
|
1
cli/tests/076_info_json_deps_order.ts
Normal file
1
cli/tests/076_info_json_deps_order.ts
Normal file
|
@ -0,0 +1 @@
|
|||
import { A } from "./recursive_imports/A.ts";
|
|
@ -2434,6 +2434,11 @@ itest!(_075_import_local_query_hash {
|
|||
output: "075_import_local_query_hash.ts.out",
|
||||
});
|
||||
|
||||
itest!(_076_info_json_deps_order {
|
||||
args: "info --unstable --json 076_info_json_deps_order.ts",
|
||||
output: "076_info_json_deps_order.out",
|
||||
});
|
||||
|
||||
itest!(js_import_detect {
|
||||
args: "run --quiet --reload js_import_detect.ts",
|
||||
output: "js_import_detect.ts.out",
|
||||
|
|
|
@ -48,7 +48,9 @@ impl fmt::Display for ModuleResolutionError {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, Hash, PartialEq, serde::Serialize)]
|
||||
#[derive(
|
||||
Debug, Clone, Eq, Hash, PartialEq, serde::Serialize, Ord, PartialOrd,
|
||||
)]
|
||||
/// Resolved module specifier
|
||||
pub struct ModuleSpecifier(Url);
|
||||
|
||||
|
|
Loading…
Reference in a new issue