Adds bundle options to the package manifest

to more control over how bundling works for static file processing for app_plugins
This commit is contained in:
Shannon
2021-07-15 13:26:32 -06:00
parent 91d5820982
commit df9c4a0160
17 changed files with 373 additions and 90 deletions

View File

@@ -0,0 +1,26 @@
namespace Umbraco.Cms.Core.Manifest
{
public enum BundleOptions
{
/// <summary>
/// The default bundling behavior for assets in the package folder.
/// </summary>
/// <remarks>
/// The assets will be bundled with the typical packages bundle.
/// </remarks>
Default = 0,
/// <summary>
/// The assets in the package will not be processed at all and will all be requested as individual assets.
/// </summary>
/// <remarks>
/// This will essentially be a bundle that has composite processing turned off for both debug and production.
/// </remarks>
None = 1,
/// <summary>
/// The packages assets will be processed as it's own separate bundle. (in debug, files will not be processed)
/// </summary>
Independent = 2
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.PropertyEditors;
namespace Umbraco.Cms.Core.Manifest
{
/// <summary>
/// A package manifest made up of all combined manifests
/// </summary>
public class CompositePackageManifest
{
public CompositePackageManifest(
IReadOnlyList<IDataEditor> propertyEditors,
IReadOnlyList<IDataEditor> parameterEditors,
IReadOnlyList<GridEditor> gridEditors,
IReadOnlyList<ManifestContentAppDefinition> contentApps,
IReadOnlyList<ManifestDashboard> dashboards,
IReadOnlyList<ManifestSection> sections,
IReadOnlyDictionary<BundleOptions, IReadOnlyList<ManifestAssets>> scripts,
IReadOnlyDictionary<BundleOptions, IReadOnlyList<ManifestAssets>> stylesheets)
{
PropertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
ParameterEditors = parameterEditors ?? throw new ArgumentNullException(nameof(parameterEditors));
GridEditors = gridEditors ?? throw new ArgumentNullException(nameof(gridEditors));
ContentApps = contentApps ?? throw new ArgumentNullException(nameof(contentApps));
Dashboards = dashboards ?? throw new ArgumentNullException(nameof(dashboards));
Sections = sections ?? throw new ArgumentNullException(nameof(sections));
Scripts = scripts ?? throw new ArgumentNullException(nameof(scripts));
Stylesheets = stylesheets ?? throw new ArgumentNullException(nameof(stylesheets));
}
/// <summary>
/// Gets or sets the property editors listed in the manifest.
/// </summary>
public IReadOnlyList<IDataEditor> PropertyEditors { get; }
/// <summary>
/// Gets or sets the parameter editors listed in the manifest.
/// </summary>
public IReadOnlyList<IDataEditor> ParameterEditors { get; }
/// <summary>
/// Gets or sets the grid editors listed in the manifest.
/// </summary>
public IReadOnlyList<GridEditor> GridEditors { get; }
/// <summary>
/// Gets or sets the content apps listed in the manifest.
/// </summary>
public IReadOnlyList<ManifestContentAppDefinition> ContentApps { get; }
/// <summary>
/// Gets or sets the dashboards listed in the manifest.
/// </summary>
public IReadOnlyList<ManifestDashboard> Dashboards { get; }
/// <summary>
/// Gets or sets the sections listed in the manifest.
/// </summary>
public IReadOnlyCollection<ManifestSection> Sections { get; }
public IReadOnlyDictionary<BundleOptions, IReadOnlyList<ManifestAssets>> Scripts { get; }
public IReadOnlyDictionary<BundleOptions, IReadOnlyList<ManifestAssets>> Stylesheets { get; }
}
}

View File

@@ -4,13 +4,13 @@ namespace Umbraco.Cms.Core.Manifest
{
public interface IManifestParser
{
string Path { get; set; }
//string Path { get; set; }
/// <summary>
/// Gets all manifests, merged into a single manifest object.
/// </summary>
/// <returns></returns>
PackageManifest Manifest { get; }
CompositePackageManifest CombinedManifest { get; }
/// <summary>
/// Parses a manifest.

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Cms.Core.Manifest
{
public class ManifestAssets
{
public ManifestAssets(string packageName, IReadOnlyList<string> assets)
{
PackageName = packageName ?? throw new ArgumentNullException(nameof(packageName));
Assets = assets ?? throw new ArgumentNullException(nameof(assets));
}
public string PackageName { get; }
public IReadOnlyList<string> Assets { get; }
}
}

View File

@@ -6,6 +6,7 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Core.Manifest
{
/// <summary>
/// Represents the content of a package manifest.
/// </summary>
@@ -47,6 +48,8 @@ namespace Umbraco.Cms.Core.Manifest
/// </remarks>
[IgnoreDataMember]
public string Source { get; set; }
[DataMember(Name = "bundleOptions")]
public BundleOptions BundleOptions { get; set; }
/// <summary>
/// Gets or sets the scripts listed in the manifest.