Repository: dotnet/aspnetcore
File: src/Mvc/Mvc.TagHelpers/src/ScriptTagHelper.cs (C#)

Code before:

    /// <summary>
    /// Gets the <see cref="GlobbingUrlBuilder"/> used to populate included and excluded urls.
    /// </summary>
    // Internal for ease of use when testing.
    protected internal GlobbingUrlBuilder GlobbingUrlBuilder { get; set; }

    // Shared writer for determining the string content of a TagHelperAttribute's Value.
    private StringWriter StringWriter
    {
        get
        {
            if (_stringWriter == null)
            {
                _stringWriter = new StringWriter();
            }

            return _stringWriter;
        }
    }

    /// <inheritdoc />
    public override void Process(TagHelperContext context, TagHelperOutput output)
    {
        ProcessAsync(context, output).GetAwaiter().GetResult();
    }

    /// <inheritdoc />
    public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
    {
        ArgumentNullException.ThrowIfNull(context);
        ArgumentNullException.ThrowIfNull(output);

        if (string.Equals(Type, "importmap", StringComparison.OrdinalIgnoreCase))
        {
            // This is an importmap script, check if there's existing content first
            var childContent = await output.GetChildContentAsync();
            if (!childContent.IsEmptyOrWhiteSpace)
            {
                // User provided explicit content, preserve it
                return;
            }

            // No existing content, so we can apply import map logic
            var importMap = ImportMap ?? ViewContext.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ImportMapDefinition>();
            if (importMap == null)
            {
                // No importmap found, nothing to do.
                output.SuppressOutput();
                return;
            }

Review comment (refactor):
Remove this override and add

```
*REMOVED*~override Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.Process(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output) -> void
```
to `src/Mvc/Mvc.TagHelpers/src/PublicAPI.Unshipped.txt` instead

Code after:

    /// <summary>
    /// Gets the <see cref="GlobbingUrlBuilder"/> used to populate included and excluded urls.
    /// </summary>
    // Internal for ease of use when testing.
    protected internal GlobbingUrlBuilder GlobbingUrlBuilder { get; set; }

    // Shared writer for determining the string content of a TagHelperAttribute's Value.
    private StringWriter StringWriter
    {
        get
        {
            if (_stringWriter == null)
            {
                _stringWriter = new StringWriter();
            }

            return _stringWriter;
        }
    }

    /// <inheritdoc />
    public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
    {
        ArgumentNullException.ThrowIfNull(context);
        ArgumentNullException.ThrowIfNull(output);

        if (string.Equals(Type, "importmap", StringComparison.OrdinalIgnoreCase))
        {
            // Do not update the content if another tag helper targeting this element has already done so.
            if (output.IsContentModified)
            {
                return;
            }

            // This is an importmap script, check if there's existing content first.
            var childContent = await output.GetChildContentAsync();
            if (!childContent.IsEmptyOrWhiteSpace)
            {
                // User provided existing content; preserve it.
                output.Content.SetHtmlContent(childContent);
                return;
            }

            // No existing content, so we can apply import map logic.
            var importMap = ImportMap ?? ViewContext.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ImportMapDefinition>();
            if (importMap == null)
            {
                // No importmap found, nothing to do.
                output.SuppressOutput();
                return;