@@ -809,17 +809,13 @@ def serve_dist(self):
809
809
libraries = flask .request .get_json ()
810
810
dists = []
811
811
for dist_type in ("_js_dist" , "_css_dist" ):
812
- resources = [
813
- resource
814
- for resource in ComponentRegistry .get_resources (dist_type , libraries )
815
- if not resource .get ("async" ) and not resource .get ("dynamic" )
816
- ]
817
- srcs = self ._collect_and_register_resources (resources )
812
+ resources = ComponentRegistry .get_resources (dist_type , libraries )
813
+ srcs = self ._collect_and_register_resources (resources , False )
818
814
for src in srcs :
819
815
dists .append (dict (type = dist_type , url = src ))
820
816
return flask .jsonify (dists )
821
817
822
- def _collect_and_register_resources (self , resources ):
818
+ def _collect_and_register_resources (self , resources , include_async = True ):
823
819
# now needs the app context.
824
820
# template in the necessary component suite JS bundles
825
821
# add the version number of the package as a query parameter
@@ -848,6 +844,8 @@ def _relative_url_path(relative_package_path="", namespace=""):
848
844
srcs = []
849
845
for resource in resources :
850
846
is_dynamic_resource = resource .get ("dynamic" , False )
847
+ is_async = resource .get ("async" ) is not None
848
+ excluded = not include_async and is_async
851
849
852
850
if "relative_package_path" in resource :
853
851
paths = resource ["relative_package_path" ]
@@ -859,15 +857,15 @@ def _relative_url_path(relative_package_path="", namespace=""):
859
857
860
858
self .registered_paths [resource ["namespace" ]].add (rel_path )
861
859
862
- if not is_dynamic_resource :
860
+ if not is_dynamic_resource and not excluded :
863
861
srcs .append (
864
862
_relative_url_path (
865
863
relative_package_path = rel_path ,
866
864
namespace = resource ["namespace" ],
867
865
)
868
866
)
869
867
elif "external_url" in resource :
870
- if not is_dynamic_resource :
868
+ if not is_dynamic_resource and not excluded :
871
869
if isinstance (resource ["external_url" ], str ):
872
870
srcs .append (resource ["external_url" ])
873
871
else :
0 commit comments