Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[heft] Add tryLoadProjectConfigurationFileAsync API and use in plugins #5147

Merged
merged 9 commits into from
Apr 8, 2025

Conversation

dmichon-msft
Copy link
Contributor

@dmichon-msft dmichon-msft commented Mar 5, 2025

Summary

Adds a new API to HeftConfiguration, tryLoadProjectConfigurationFileAsync, so that plugins can load riggable config files without taking a direct dependency (and risking version duplication) on @rushstack/heft-config-file.

Starts addressing #5092. The motivation is to get us to a world where Heft plugins don't need any runtime dependencies other than on any external tools they bring with them, because all the core functionality of a Heft plugin is available on arguments passed to apply, similar to prior art in webpack plugins, that have the compiler.webpack field that provides access to all functionality that would otherwise be obtained via import ... from 'webpack'.

This API change removes any need for Heft plugins to take their own dependency on the @rushstack/heft-config-file package for normal scenarios.

Details

Fixes an issue with PathResolutionMethod.resolveRelativeToProjectRoot when extending from a file that lives in a different package. It was previously resolving relative to the package that contained the file being extended from, rather than the file that contains the original loaded configuration file.

Adds a new customValidationFunction option to the configuration file APIs that can be used to perform additional validation after loading a file.

Uses this API in heft-api-extractor-plugin, heft-sass-plugin, and heft-typescript-plugin.
Currently doesn't expose the version that throws if the file cannot be found.

All needed types are re-exported under the ConfigurationFile namespace on @rushstack/heft.

How it was tested

Existing build tests for these plugins.

Impacted documentation

API Documentation for @rushstack/heft.

@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage Mar 10, 2025
@dmichon-msft dmichon-msft merged commit c27f564 into microsoft:main Apr 8, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Closed in Bug Triage Apr 8, 2025
@dmichon-msft dmichon-msft deleted the heft-config-api branch April 8, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants