Skip to content

Commit 601450c

Browse files
Mariotakuclaude
andcommitted
webdetect: drop service dependency reporting
webOS JS services bundle everything (no on-device npm); package.json only carries main/name. Stop parsing and reporting `dependencies`, which was misleading. Native services are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4a706ae commit 601450c

4 files changed

Lines changed: 7 additions & 26 deletions

File tree

common/webdetect/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ impl FrameworkKind {
9797
/// reliably, so it is not trusted as a runtime requirement.
9898
#[derive(Debug, Clone, Default)]
9999
pub struct ServiceRuntimeDetection {
100-
/// `dependencies` as (name, version-spec) pairs, sorted by name.
101-
pub dependencies: Vec<(String, String)>,
102100
/// The `main` entry point, if declared.
103101
pub main: Option<String>,
104102
/// Minimum ES level the service's own code requires — a code-derived,

common/webdetect/src/service.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Node.js service runtime detection from a bundled `package.json`.
22
3-
use std::collections::BTreeMap;
43
use std::fs;
54
use std::path::Path;
65

@@ -13,12 +12,10 @@ use crate::ServiceRuntimeDetection;
1312
struct PackageJson {
1413
#[serde(default)]
1514
main: Option<String>,
16-
#[serde(default)]
17-
dependencies: BTreeMap<String, String>,
1815
}
1916

20-
/// Inspect a service directory: read `package.json` for dependencies/entry
21-
/// point, and analyze the service's own `.js` code for its ES language level
17+
/// Inspect a service directory: read `package.json` for the entry point, and
18+
/// analyze the service's own `.js` code for its ES language level
2219
/// (checked against the firmware's Node.js) and runtime-API usage.
2320
///
2421
/// Note: `engines.node` is deliberately NOT read — webOS services don't set it
@@ -33,7 +30,6 @@ pub fn detect_service_runtime(dir: &Path) -> ServiceRuntimeDetection {
3330
let analysis = js::analyze_js(&sources, false);
3431

3532
ServiceRuntimeDetection {
36-
dependencies: pkg.dependencies.into_iter().collect(),
3733
main: pkg.main,
3834
es_level: analysis.es_level,
3935
es_features: analysis.es_features,
@@ -55,22 +51,18 @@ mod tests {
5551
}
5652

5753
#[test]
58-
fn parses_main_and_deps() {
54+
fn parses_main() {
5955
let dir = write_pkg(
60-
r#"{ "main": "service.js", "engines": { "node": ">=12.0.0" },
61-
"dependencies": { "express": "^4.18.0", "lodash": "4.17.21" } }"#,
56+
r#"{ "main": "service.js", "name": "com.example.app.service" }"#,
6257
);
6358
let d = detect_service_runtime(dir.path());
6459
assert_eq!(d.main.as_deref(), Some("service.js"));
65-
assert_eq!(d.dependencies.len(), 2);
66-
assert_eq!(d.dependencies[0].0, "express");
6760
}
6861

6962
#[test]
7063
fn missing_package_json_is_empty() {
7164
let dir = tempfile::TempDir::new().unwrap();
7265
let d = detect_service_runtime(dir.path());
73-
assert!(d.dependencies.is_empty());
7466
assert!(d.main.is_none());
7567
}
7668
}

packages/ipk-verify/src/main.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ fn es_support_title(level: Option<webdetect_lib::EsLevel>) -> String {
366366
}
367367
}
368368

369-
/// Render `--details` for a non-native component: syntax-feature / dependency
370-
/// evidence, then any firmware on which it is incompatible and why.
369+
/// Render `--details` for a non-native component: syntax-feature evidence,
370+
/// then any firmware on which it is incompatible and why.
371371
fn print_detection_details(
372372
results: &Vec<(&Firmware, &ComponentVerifyResult)>,
373373
out: &mut Box<dyn ReportOutput>,
@@ -399,9 +399,6 @@ fn print_detection_details(
399399
out.write_fmt(format_args!("* Language features used: {}\n", feats.join(", ")))?;
400400
}
401401
print_api_details(&svc.es_apis, &svc.polyfills, out)?;
402-
for (name, ver) in &svc.dependencies {
403-
out.write_fmt(format_args!("* Dependency: {name} {ver}\n"))?;
404-
}
405402
}
406403
}
407404
// Report incompatible firmwares with their reason (gating verdicts only).
@@ -490,7 +487,7 @@ fn describe_web(web: &WebAppDetection) -> String {
490487
}
491488

492489
/// One-line description of the detected JS service: its ES language level
493-
/// (checked against Node.js) and dependency count.
490+
/// (checked against Node.js).
494491
fn describe_service(svc: &ServiceRuntimeDetection) -> String {
495492
let mut parts: Vec<String> = vec!["Node.js service".to_string()];
496493
if let Some(level) = svc.es_level {
@@ -499,11 +496,6 @@ fn describe_service(svc: &ServiceRuntimeDetection) -> String {
499496
if !svc.polyfills.is_empty() {
500497
parts.push(format!("bundles polyfills ({})", svc.polyfills.join(", ")));
501498
}
502-
match svc.dependencies.len() {
503-
0 => {}
504-
1 => parts.push("1 dependency".to_string()),
505-
n => parts.push(format!("{n} dependencies")),
506-
}
507499
parts.join("; ")
508500
}
509501

packages/ipk-verify/tests/detection.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ fn node_service(id: &str, es: EsLevel) -> Component<ServiceInfo> {
5151
engine: Some("node".to_string()),
5252
executable: None,
5353
runtime: Some(ServiceRuntimeDetection {
54-
dependencies: vec![("express".to_string(), "^4.18.0".to_string())],
5554
main: None,
5655
es_level: Some(es),
5756
es_features: vec![],

0 commit comments

Comments
 (0)