Ejemplo n.º 1
0
        private IEnumerable <PreCompiledResourceDependencies> GetAllDependencies()
        {
            var allResources = _finder.FindResources(ResourceType.Script)
                               .Union(_finder.FindResources(ResourceType.Stylesheet));

            //we must gather the dependencies for the consolidated url's before we gather them for specific url's
            //because the consolidated url's could actually exist on disk if pre-consolidation was run before.
            //In that case, if we did the specific resources first, it would use the IDependencyProvider against the
            //content of the consolidated resource, which is not what we want.  Then that value is cached and prevents us from finding
            //the dependencies for the group.
            var scriptDependenciesByConsolidatedUrl = GetDependenciesForConsolidatedUrls(_scriptGroups, allResources);
            var styleDependenciesByConsolidatedUrl  = GetDependenciesForConsolidatedUrls(_styleGroups, allResources);

            var specificResourceDependencies = from resource in allResources
                                               let dependencies = _dependencyManager.GetDependencies(resource)
                                                                  where dependencies.Any()
                                                                  select new PreCompiledResourceDependencies
            {
                ResourcePath = resource.VirtualPath,
                Dependencies = dependencies.ToList()
            };

            return
                (scriptDependenciesByConsolidatedUrl.Union(styleDependenciesByConsolidatedUrl).Union(
                     specificResourceDependencies));
        }
Ejemplo n.º 2
0
 public IEnumerable <string> GetDependencyUrls(string resourceUrl)
 {
     return(_dependencyManager.GetDependencies(resourceUrl));
 }
Ejemplo n.º 3
0
        public void GetDependenciesReturnsParsedDependencies()
        {
            var myscript = StubResource.WithPath("~/scripts/myscript.js");

            _resourceFinder.AddResource(myscript);

            SetDependencies(myscript, "~/scripts/jquery.js", "~/scripts/common.js");

            var dependencies = _dependencyManager.GetDependencies(myscript.VirtualPath).ToList();

            dependencies[0].ShouldEqual("~/scripts/jquery.js");
            dependencies[1].ShouldEqual("~/scripts/common.js");
        }
Ejemplo n.º 4
0
 public IEnumerable <string> GetResourceDependencies(string virtualPath)
 {
     return(_dependencyManager.GetDependencies(virtualPath));
 }