Skip to content

Clean up module outputFile calculation and move it to the specifications#6967

Open
alfonso-noriega wants to merge 1 commit intomainfrom
03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications
Open

Clean up module outputFile calculation and move it to the specifications#6967
alfonso-noriega wants to merge 1 commit intomainfrom
03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications

Conversation

@alfonso-noriega
Copy link
Contributor

@alfonso-noriega alfonso-noriega commented Mar 10, 2026

WHY are these changes introduced?

The outputFileName property was previously calculated dynamically using a getter method that relied on the extension's build configuration mode. This approach was inflexible and didn't allow for extension-specific customization of output file names.

WHAT is this pull request doing?

  • Converts outputFileName from a computed getter to a direct property on ExtensionInstance
  • Adds an optional getOutputFileName method to the ExtensionSpecification interface
  • Implements getOutputFileName in all UI extension specifications to return ${extension.handle}.js
  • Implements getOutputFileName in function extensions to return index.wasm
  • Refactors the BuildConfig type to use a discriminated union for better type safety
  • Initializes outputFileName in the constructor using the specification's method or defaults to empty string

How to test your changes?

  1. Create extensions of different types (UI extensions, functions, etc.)
  2. Verify that the output file names are generated correctly for each extension type
  3. Test the build process to ensure extensions are built with the expected output file names
  4. Confirm that existing functionality remains unchanged

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

alfonso-noriega commented Mar 10, 2026

@alfonso-noriega alfonso-noriega marked this pull request as ready for review March 10, 2026 10:30
@alfonso-noriega alfonso-noriega requested a review from a team as a code owner March 10, 2026 10:30
@github-actions
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

@binks-code-reviewer
Copy link

binks-code-reviewer bot commented Mar 10, 2026

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ No issues → ✅ 2 findings → ❌ Failed → ✅ No issues

@alfonso-noriega alfonso-noriega changed the base branch from 03-10-create_abstract_client_steps_infrastracture_to_externalize_the_ap_modules_client_configurations to graphite-base/6967 March 10, 2026 11:05
@alfonso-noriega alfonso-noriega force-pushed the 03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications branch from bbc0817 to 7b68eb7 Compare March 10, 2026 11:05
@alfonso-noriega alfonso-noriega changed the base branch from graphite-base/6967 to main March 10, 2026 11:05
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 79.23% 14596/18423
🟡 Branches 73.47% 7241/9856
🟡 Functions 79.39% 3724/4691
🟡 Lines 79.56% 13792/17336

Test suite run success

3822 tests passing in 1464 suites.

Report generated by 🧪jest coverage report action from 880b269

@alfonso-noriega alfonso-noriega force-pushed the 03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications branch from 7b68eb7 to c3ee349 Compare March 10, 2026 11:24
@alfonso-noriega alfonso-noriega force-pushed the 03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications branch 2 times, most recently from 24fb214 to ecf7d0f Compare March 10, 2026 12:41
} else {
return `${this.handle}.js`
}
return basename(this.specification.getOutputFileName?.(this) ?? '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all extension instances always have a build/output file name? extension-instance feels very overloaded today, and I worry we're overloading it further with things that might be optional properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change in this PR actually cleans this. Move the optional implementation to the specification, so each module can decide if it has an outputFileName or not.

This function already existed in extension-instance, but isntead of hardcoded if/else we move the ownership to each specification

@alfonso-noriega alfonso-noriega force-pushed the 03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications branch 2 times, most recently from 9bebf7c to dd63de8 Compare March 12, 2026 10:30
@alfonso-noriega alfonso-noriega force-pushed the 03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications branch 3 times, most recently from 243fb31 to 7e38d07 Compare March 12, 2026 12:30
@alfonso-noriega alfonso-noriega force-pushed the 03-10-clean_up_module_outputfile_calculation_and_move_it_to_the_specifications branch from 7e38d07 to 880b269 Compare March 12, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants