Ejemplo n.º 1
0
        public BundleManager(
            IOptions <BundlingOptions> options,
            IOptions <BundleContributorOptions> contributorOptions,
            IScriptBundler scriptBundler,
            IStyleBundler styleBundler,
            IWebHostEnvironment hostingEnvironment,
            IServiceProvider serviceProvider,
            IDynamicFileProvider dynamicFileProvider,
            IBundleCache bundleCache,
            IWebContentFileProvider webContentFileProvider,
            IWebRequestResources requestResources)
        {
            Options                = options.Value;
            ContributorOptions     = contributorOptions.Value;
            HostingEnvironment     = hostingEnvironment;
            ScriptBundler          = scriptBundler;
            ServiceProvider        = serviceProvider;
            DynamicFileProvider    = dynamicFileProvider;
            BundleCache            = bundleCache;
            WebContentFileProvider = webContentFileProvider;
            RequestResources       = requestResources;
            StyleBundler           = styleBundler;

            Logger = NullLogger <BundleManager> .Instance;
        }
Ejemplo n.º 2
0
 public StyleBundleTagHelper(
     IBundleCollection bundles,
     IBundleCache bundleCache,
     IOptionsMonitor <BundlingOptions> options,
     IWebHostEnvironment env)
     : base(bundles, bundleCache, options, env)
 {
 }
Ejemplo n.º 3
0
 public BundleTagHelper(
     IBundleCollection bundles,
     IBundleCache bundleCache,
     IOptionsMonitor <BundlingOptions> options,
     IWebHostEnvironment env)
 {
     Bundles         = bundles;
     BundleCache     = bundleCache;
     Options         = options.CurrentValue;
     HostEnvironment = env;
 }
Ejemplo n.º 4
0
 protected BundleBase(IFileWriterFactory fileWriterFactory, IFileReaderFactory fileReaderFactory, IDebugStatusReader debugStatusReader, ICurrentDirectoryWrapper currentDirectoryWrapper, IHasher hasher, IBundleCache bundleCache)
 {
     this.fileWriterFactory       = fileWriterFactory;
     this.fileReaderFactory       = fileReaderFactory;
     this.debugStatusReader       = debugStatusReader;
     this.currentDirectoryWrapper = currentDirectoryWrapper;
     this.hasher = hasher;
     ShouldRenderOnlyIfOutputFileIsMissing = false;
     HashKeyName      = "r";
     this.bundleCache = bundleCache;
 }
Ejemplo n.º 5
0
 protected BundleBase(IFileWriterFactory fileWriterFactory, IFileReaderFactory fileReaderFactory, IDebugStatusReader debugStatusReader, IDirectoryWrapper directoryWrapper, IHasher hasher, IBundleCache bundleCache)
 {
     this.fileWriterFactory = fileWriterFactory;
     this.fileReaderFactory = fileReaderFactory;
     this.debugStatusReader = debugStatusReader;
     this.directoryWrapper  = directoryWrapper;
     this.hasher            = hasher;
     bundleState            = new BundleState
     {
         DebugPredicate = Configuration.Instance.DefaultDebugPredicate(),
         ShouldRenderOnlyIfOutputFileIsMissing = false,
         HashKeyName = "r"
     };
     this.bundleCache = bundleCache;
 }
Ejemplo n.º 6
0
        public BundleManagerFactory(IEnumerable <IBundleModelFactory> modelFactories, IBundleCache cache, IBundleVersionProvider versionProvider, IBundleUrlHelper urlHelper,
                                    ILoggerFactory loggerFactory, ISystemClock clock, IApplicationLifetime applicationLifetime)
        {
            _modelFactories  = modelFactories;
            _cache           = cache;
            _versionProvider = versionProvider;
            _urlHelper       = urlHelper;

            _loggerFactory = loggerFactory;
            _clock         = clock;

            _shutdownToken = applicationLifetime.ApplicationStopping;

            _instances = new List <IBundleManager>();
        }
Ejemplo n.º 7
0
 public BundleMiddleware(
     RequestDelegate next,
     IBundleCollection collection,
     IBundleCache bundleCache,
     IBundleBuilder bundleBuilder,
     IOptionsMonitor <BundlingOptions> optionsMonitor,
     IThemeRegistry themeRegistry,
     ILogger <BundleMiddleware> logger)
 {
     _next           = next;
     _collection     = collection;
     _bundleCache    = bundleCache;
     _bundleBuilder  = bundleBuilder;
     _optionsMonitor = optionsMonitor;
     _themeRegistry  = themeRegistry;
     _logger         = logger;
 }
Ejemplo n.º 8
0
        public BundleManager(int id, BundleCollection bundles, IBundlingContext bundlingContext, CancellationToken shutdownToken,
                             IEnumerable <IBundleModelFactory> modelFactories, IBundleCache cache, IBundleVersionProvider versionProvider, IBundleUrlHelper urlHelper,
                             ILoggerFactory loggerFactory, ISystemClock clock)
        {
            _id = id;
            _bundlingContext = bundlingContext;
            _shutdownToken   = shutdownToken;

            _modelFactories  = modelFactories;
            _cache           = cache;
            _versionProvider = versionProvider;
            _urlHelper       = urlHelper;

            _logger = loggerFactory.CreateLogger <BundleManager>();
            _clock  = clock;

            _bundles = bundles.ToDictionary(b => b.Path, CreateModel);
        }
Ejemplo n.º 9
0
        //
        /// <summary>
        /// Store the response for this bundle instance in the appropriate caches
        /// </summary>
        /// <param name="context"></param>
        /// <param name="response"></param>
        public virtual void UpdateCache(BundleContext context, BundleResponse response)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            IBundleCache cache = context.BundleCollection.Cache;

            if (cache.IsEnabled(context))
            {
                cache.Put(context, this, response);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns the first cache hit from the context.BundleCollection.CacheList by default.
        /// Can override to implement custom caching logic.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public virtual BundleResponse CacheLookup(BundleContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            IBundleCache cache = context.BundleCollection.Cache;

            if (cache.IsEnabled(context))
            {
                BundleResponse response = cache.Get(context, this);
                if (response != null)
                {
                    return(response);
                }
            }
            return(null);
        }
Ejemplo n.º 11
0
 public static void Enable(bool optimize, IBundleCache cache)
 {
     BundleTable.Bundles.Optimize = optimize;
     BundleTable.Bundles.Cache = cache;
 }
Ejemplo n.º 12
0
 public JavaScriptBundle(IDebugStatusReader debugStatusReader, IFileWriterFactory fileWriterFactory, IFileReaderFactory fileReaderFactory, IDirectoryWrapper directoryWrapper, IHasher hasher, IBundleCache bundleCache) :
     base(fileWriterFactory, fileReaderFactory, debugStatusReader, directoryWrapper, hasher, bundleCache)
 {
 }
 public CachedBundleContainerFactory(IBundleCache cache, IDictionary <Type, IBundleFactory <Bundle> > bundleFactories)
     : base(bundleFactories)
 {
     this.cache = cache;
 }
Ejemplo n.º 14
0
 public CSSBundle(IDebugStatusReader debugStatusReader, IFileWriterFactory fileWriterFactory, IFileReaderFactory fileReaderFactory, ICurrentDirectoryWrapper currentDirectoryWrapper, IHasher hasher, IBundleCache bundleCache)
     : base(fileWriterFactory, fileReaderFactory, debugStatusReader, currentDirectoryWrapper, hasher, bundleCache)
 {
 }
 public CachedBundleContainerFactory(IBundleCache cache, IDictionary<Type, IBundleFactory<Bundle>> bundleFactories)
     : base(bundleFactories)
 {
     this.cache = cache;
 }
 public void Setup()
 {
     provider = new Mock<ICacheProvider>();
     cache = new BundleCache<BundleImpl>(provider.Object);
 }