@@ -11,10 +11,13 @@ import 'package:shelf/shelf.dart';
1111
1212abstract class LoadStrategy {
1313 final AssetReader _assetReader;
14+ final String ? _packageConfigPath;
1415 final _providers = < String , MetadataProvider > {};
15- String ? _packageConfigPath;
1616
17- LoadStrategy (this ._assetReader);
17+ LoadStrategy (
18+ this ._assetReader, {
19+ String ? packageConfigPath,
20+ }) : _packageConfigPath = packageConfigPath;
1821
1922 /// The ID for this strategy.
2023 ///
@@ -100,28 +103,17 @@ abstract class LoadStrategy {
100103 /// an app URI.
101104 String ? serverPathForAppUri (String appUri);
102105
103- /// Returns the absolute path to the app's package config, determined by the
104- /// app's [entrypoint] path.
105- ///
106- /// Example:
107- ///
108- /// main_module.bootstrap.js
109- /// -> /Users/john_doe/my_dart_app/.dart_tool/package_config.json
110- ///
111- String ? packageConfigLocator (String entrypoint);
112-
113106 /// Returns the relative path in google3, determined by the [absolutePath] .
114107 ///
115108 /// Returns `null` if not a google3 app.
116109 String ? g3RelativePath (String absolutePath);
117110
118- /// The absolute path to the app's package config, or null if not provided by
119- /// [packageConfigLocator] .
111+ /// The absolute path to the app's package configuration.
120112 String get packageConfigPath {
121113 return _packageConfigPath ?? _defaultPackageConfigPath;
122114 }
123115
124- /// The default package config path, if none is provided by the load strategy .
116+ /// The default package config path if none is provided.
125117 String get _defaultPackageConfigPath => p.join (
126118 DartUri .currentDirectory,
127119 '.dart_tool' ,
@@ -142,7 +134,6 @@ abstract class LoadStrategy {
142134 /// provided [entrypoint] .
143135 void trackEntrypoint (String entrypoint) {
144136 final metadataProvider = MetadataProvider (entrypoint, _assetReader);
145- _packageConfigPath = packageConfigLocator (entrypoint);
146137 _providers[metadataProvider.entrypoint] = metadataProvider;
147138 }
148139}
0 commit comments