private static void AddComponentFeatures(RazorProjectEngineBuilder builder)
        {
            // Project Engine Features
            builder.Features.Add(new ComponentImportProjectFeature());

            // Directives (conditional on file kind)
            ComponentCodeDirective.Register(builder);
            ComponentInjectDirective.Register(builder);
            ComponentLayoutDirective.Register(builder);
            ComponentPageDirective.Register(builder);
            ComponentTypeParamDirective.Register(builder);

            // Document Classifier
            builder.Features.Add(new ComponentDocumentClassifierPass());

            // Directive Classifier
            builder.Features.Add(new ComponentWhitespacePass());

            // Optimization
            builder.Features.Add(new ComponentComplexAttributeContentPass());
            builder.Features.Add(new ComponentLoweringPass());
            builder.Features.Add(new ComponentScriptTagPass());
            builder.Features.Add(new ComponentEventHandlerLoweringPass());
            builder.Features.Add(new ComponentKeyLoweringPass());
            builder.Features.Add(new ComponentReferenceCaptureLoweringPass());
            builder.Features.Add(new ComponentSplatLoweringPass());
            builder.Features.Add(new ComponentBindLoweringPass());
            builder.Features.Add(new ComponentTemplateDiagnosticPass());
            builder.Features.Add(new ComponentGenericTypePass());
            builder.Features.Add(new ComponentChildContentDiagnosticPass());
            builder.Features.Add(new ComponentMarkupDiagnosticPass());
            builder.Features.Add(new ComponentMarkupBlockPass());
            builder.Features.Add(new ComponentMarkupEncodingPass());
        }
Пример #2
0
        private static void AddComponentFeatures(RazorProjectEngineBuilder builder, RazorLanguageVersion razorLanguageVersion)
        {
            // Project Engine Features
            builder.Features.Add(new ComponentImportProjectFeature());

            // Directives (conditional on file kind)
            ComponentCodeDirective.Register(builder);
            ComponentInjectDirective.Register(builder);
            ComponentLayoutDirective.Register(builder);
            ComponentPageDirective.Register(builder);

            // Unconditionally enable the feature for the time being until we flow the SDK with the flow version
            // into the repository.
            ComponentTypeParamDirective.Register(
                builder,
                supportConstraints: true);
            //supportConstraints: razorLanguageVersion.CompareTo(RazorLanguageVersion.Version_6_0) >= 0);

            if (razorLanguageVersion.CompareTo(RazorLanguageVersion.Version_5_0) >= 0)
            {
                ComponentPreserveWhitespaceDirective.Register(builder);
            }

            // Document Classifier
            builder.Features.Add(new ComponentDocumentClassifierPass());

            // Directive Classifier
            builder.Features.Add(new ComponentWhitespacePass());

            // Optimization
            builder.Features.Add(new ComponentComplexAttributeContentPass());
            builder.Features.Add(new ComponentLoweringPass());
            builder.Features.Add(new ComponentScriptTagPass());
            builder.Features.Add(new ComponentEventHandlerLoweringPass());
            builder.Features.Add(new ComponentKeyLoweringPass());
            builder.Features.Add(new ComponentReferenceCaptureLoweringPass());
            builder.Features.Add(new ComponentSplatLoweringPass());
            builder.Features.Add(new ComponentBindLoweringPass());
            builder.Features.Add(new ComponentCssScopePass());
            builder.Features.Add(new ComponentTemplateDiagnosticPass());
            builder.Features.Add(new ComponentGenericTypePass());
            builder.Features.Add(new ComponentChildContentDiagnosticPass());
            builder.Features.Add(new ComponentMarkupDiagnosticPass());
            builder.Features.Add(new ComponentMarkupBlockPass());
            builder.Features.Add(new ComponentMarkupEncodingPass());
        }