maint: integrate reviewed contribution #3591

This commit is contained in:
haelyra committed 2026-10-29 11:23:24 -07:00
commit 09e0eb7d7f
2 files changed
+41 -2

No files matched your search

+4 -1
View File
@@ -9,7 +9,6 @@
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
/**
* Language detection rules.
@@ -350,6 +349,10 @@ function hasFlutterSdkDependency(projectDir) {
const pubspecPath = path.join(projectDir, 'pubspec.yaml');
if (!fs.existsSync(pubspecPath)) return false;
const content = fs.readFileSync(pubspecPath, 'utf8');
// Loaded here, not at the top: the SessionStart hook requires this module
// from plugin installs that have no node_modules (#2822). Without js-yaml
// the catch below costs only the Flutter check, not the whole hook.
const yaml = require('js-yaml');
const pubspec = yaml.load(content, { schema: yaml.JSON_SCHEMA });
// Only a declared Flutter SDK dependency identifies the framework.
// Unrelated configuration, comments, and strings must not count.