Commit Graph

8 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran f9d4fba39d Added a taghelpers and imports overload to Process and ProcessDesignTime
We want to have a way to specify the taghelper descriptors and imports to use while
processing a specific document.
- Added an overload to Process and ProcessDesignTime to take in a list
TagHelperDescriptors and a list of imports
- Added the corresponding CreateCodeDocumentCore overload
- Added GetTagHelpers and SetTagHelpers extension methods for
CodeDocument
- Added the necessary plumbing to use the taghelpers from the
CodeDocument when available and fallback logic.
- Added DocumentImportsTracker and updated background code generation
logic to use the new overload
- Added/updated tests
2018-05-22 11:40:21 -07:00
N. Taylor Mullen b538ceba93 Change final code documents to not contain non-existent imports.
- Existent imports are imports that have content that contribute to the processing of a Razor document. Prior to this we had a legacy expectation that code documents had empty markers in them for all of their import locations. This proved troublesome when cross-referencing files that had file paths and were supposed to be existent but weren't in metadata. Now that we have a project engine with a de-coupled import feature we can rely on the import feature for finding all locations of important files and then strip out any non-existent items.
2018-02-23 16:30:22 -08:00
N. Taylor Mullen e200b69511 Change IImportProjectFeature to consume RazorProjectItems.
- Updated all implementations of `IImportProjectFeature`; for MVC I went ahead and made a single project item that's always returned for MVC scenarios. That project item is smart about returning its content in a light-weight stream fashion.
- Had to add a `RazorProjectItem` => `RazorSourceDocument` conversion mechanic into `DefaultRazorProjectEngine`.
- Added tests for `DefaultRazorProjectItem.ConvertToSourceDocument`.
- Removed the `ProjectEngine` API from `VisualStudioRazorParser`. This was unrelated but was missed feedback.

#2068
2018-02-15 11:31:18 -08:00
Ryan Nowak 82579b6333 Get rid of RazorConfiguration.DesignTime
This change makes it so that we no longer create 'design time' engines.
The choice of design time or runtime is made when we initiate a code
generation operation.

Options instances are now created as part of the CodeDocument
initialization. Our existing code can still be created using a
RazorEngine so our passes that initialize the options still support the
old code path.
2018-02-13 16:21:18 -08:00
N. Taylor Mullen 3375fc8b99 Change RazorProjectEngine to operate on RazorProjectItems.
- Removed the `Process(string)` overload to make it extra clear that you must operate on project items. This way we also don't need to worry about the various formats of paths that can flow through the system.
- Updated tests to use the new project item format.
- Did a few formatting fixes on unrealted files.

#2049
2018-02-09 17:24:27 -08:00
N. Taylor Mullen aa3fb32220 Revert "Revert "Add contracts for RazorProjectEngine.""
This reverts commit f301d92332.
2018-01-24 11:20:18 -08:00
N. Taylor Mullen f301d92332 Revert "Add contracts for RazorProjectEngine."
This reverts commit 59f2cf8e66.
2018-01-23 11:42:38 -08:00
N. Taylor Mullen 59f2cf8e66 Add contracts for RazorProjectEngine.
- These contracts introduce a new `RazorProjectEngine` concept which allows for users to configure 1 entity that's responsible for the RazorEngine and project.
- The `RazorProjectEngineBuilder` has a collection of features that are dispersed on the created `RazorEngine` and the `RazorProjectEngine`.
- Included a complete implementation of `RazorProjectEngine` it introduces the extension points for the project engine. The primary one includes the `IRazorImportFeature`, the default behavior is to return 0 imports.
- Included a complete project engine builder implementation.

#1828
2018-01-22 17:05:43 -08:00