collectShaderBundleDependencies function

List<Uri> collectShaderBundleDependencies(
  1. Uri manifestUri,
  2. Object decodedManifest
)

Collects the build-system dependencies declared by a shader bundle manifest.

Returns the manifest URI itself plus the resolved URI of every shader source file referenced by a top-level entry's file key. Paths in the manifest are interpreted relative to the manifest's containing directory.

Exposed so users authoring custom build hooks (and tests) can inspect the same dependency set buildShaderBundleJson declares.

Implementation

List<Uri> collectShaderBundleDependencies(
  Uri manifestUri,
  Object decodedManifest,
) {
  final manifestDir = manifestUri.resolve('./');
  final result = <Uri>[manifestUri];
  if (decodedManifest is! Map) {
    return result;
  }
  for (final value in decodedManifest.values) {
    if (value is! Map) continue;
    final file = value['file'];
    if (file is! String) continue;
    result.add(manifestDir.resolve(file));
  }
  return result;
}