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

improvement(build-common): Allow APIs to {@link} to APIs of lower release levels. #23533

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Josmithr
Copy link
Contributor

@Josmithr Josmithr commented Jan 13, 2025

Since we generate API reports for different release levels, it is possible (and valid) for @link tags to reference an API item that won't be visible at that level. Currently, our configurations forbid such links as a side-effect of running link validation during report generation (where APIs will be omitted from report consideration based on their release tags.

However, it is often useful for APIs to link to more experimental APIs for discoverability.

To make this possible, link validation is now disabled in report generation configurations. It is maintained in model generation configs, which is where we really need it.

Also adds a couple of such links in the tree package as a test (and because we wanted them there).

@github-actions github-actions bot added area: build Build related issues area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels Jan 13, 2025
@Josmithr Josmithr requested review from jason-ha, CraigMacomber and a team January 13, 2025 19:51
@Josmithr Josmithr marked this pull request as ready for review January 13, 2025 19:51
@Copilot Copilot bot review requested due to automatic review settings January 13, 2025 19:51
@Josmithr Josmithr requested a review from a team as a code owner January 13, 2025 19:51

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.

Files not reviewed (3)
  • common/build/build-common/api-extractor-lint.entrypoint.json: Language not supported
  • common/build/build-common/api-extractor-report.esm.current.json: Language not supported
  • common/build/build-common/api-extractor-report.esm.legacy.json: Language not supported
@@ -13,5 +13,17 @@
// second time via "legacy" report.
"tsdocMetadata": {
"enabled": false
},
"messages": {
"extractorMessageReporting": {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be practical to have this config extend api-extractor-report.esm.current.json so that it didn't need to duplicate things we want for report generation, and only do legacy specific stuff?

Copy link
Contributor Author

@Josmithr Josmithr Jan 13, 2025

Choose a reason for hiding this comment

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

Hopefully that or something similar. Was hoping to get @jason-ha's eyes on this to advise.

Copy link
Contributor

Choose a reason for hiding this comment

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

api-extractor has trouble with merging array properties. And unfortunately, doesn't allow multiple inheritance. Ideally there would be a base model config and several other shareable config pieces.
The best we can do is reduce to two configs with manipulation of this message.

Option A (one more duplication of "tsdocMetadata" overall; my preference):

  • Place this in -base (and turn-off model by default).
  • Add -base.model (or -base_with_model) that turns on model and that message.
  • Change -base.cjs.no-legacy and -model.esm to extend -base.model.
  • Update -base.esm.no-legacy to:
    • Extend -base.model.
    • Specify "mainEntryPointFilePath": "/lib/index.d.ts" (can be deleted from -base.esm).
    • Specify "tsdocMetadata" as found in -base.esm.
  • Optional (recommended):
    • Delete -base.esm.
      • Add "tsdocMetadata" as was found in -base.esm into -report.esm.current.
    • For good measure add "apiReport.enabled": true to both -report.esm.current and -report.esm.legacy.
    • Remove "explicit docModel" disable from -lint, -lint.entrypoint, -report.esm.current, and -report.esm.legacy.

Option B (three copies of docModel disable with message change):

  • Add -report.base.ems (alternatively -base.esm.no-model) that inherits -base.esm
    • Disable "docModel" and turn off message
  • -report.esm.current and -report.esm.legacy would inherit new -report.base.ems and stop disabling "docModel".
  • optional (recommended): move -base.esm's mainEntryPointFilePath setting to .esm.no-legacy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the note of array merge: microsoft/rushstack#5071

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went with A above. Named the new config -mode-base, but I can change that if you feel strongly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Longer term: this hierarchy of configs is very confusing. I wonder if we would be better suited by adding a simple generator that spits out complete configs based on input parameters.

Copy link
Contributor

@CraigMacomber CraigMacomber left a comment

Choose a reason for hiding this comment

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

Tree changes look good.

Copy link
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

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

Code Coverage Summary

No packages impacted by the change.


Baseline commit: cf15304
Baseline build: 316399
Happy Coding!!

Code coverage comparison check passed!!

@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +245 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 470.26 KB 470.3 KB +35 Bytes
azureClient.js 566.99 KB 567.04 KB +49 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 266.13 KB 266.14 KB +14 Bytes
fluidFramework.js 358.4 KB 358.41 KB +14 Bytes
loader.js 134.2 KB 134.21 KB +14 Bytes
map.js 42.68 KB 42.69 KB +7 Bytes
matrix.js 150.36 KB 150.36 KB +7 Bytes
odspClient.js 534.46 KB 534.51 KB +49 Bytes
odspDriver.js 99.49 KB 99.51 KB +21 Bytes
odspPrefetchSnapshot.js 43.04 KB 43.06 KB +14 Bytes
sharedString.js 166.51 KB 166.52 KB +7 Bytes
sharedTree.js 348.89 KB 348.89 KB +7 Bytes
Total Size 3.26 MB 3.26 MB +245 Bytes

Baseline commit: cf15304

Generated by 🚫 dangerJS against 34bf17d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants