-
Notifications
You must be signed in to change notification settings - Fork 535
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
Deprecate types in tree and re-export from fluid-framework #23183
base: main
Are you sure you want to change the base?
Deprecate types in tree and re-export from fluid-framework #23183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⯅ @fluid-example/bundle-size-tests: +245 Bytes
Baseline commit: 5d813e5 |
915b140
to
850f4e3
Compare
f9c2f36
to
11028d8
Compare
11028d8
to
96cfea4
Compare
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
b526839
to
8ec49fb
Compare
8ec49fb
to
3fd8263
Compare
Off, | ||
} from "@fluidframework/core-interfaces"; | ||
// eslint-disable-next-line no-restricted-syntax | ||
export * from "./indexCommonApi.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change does not seem to be described by the PR description. If it needs to be part of this API deprecating event APIs, it would be good to document why this change is being done as part of this in the PR description.
Also it should be documented in the code (here and/or in indexCommonApi) why indexCommonApi exists so people reading the code know what its for and how to maintain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that without knowing why this change is being made, I can't comment on if it's a good idea or done correctly.
Generally, I don't like submodule exports like this since they can very easily break our API reporting / rollup generation tools (since they don't look inside modules like this) and can easily generate errors when packages reexport types from nested modules.
Most of these exports seem to be internal APIs, which I don't see why you would want to modify this way, but if any of them are more public than internal, I think we will leak the internal ones into the rollup with them due to tooling limitations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also #23256 removes many of these exports (they are only use by the dev tool): would be nice to do this change after that one if practical.
Edit: This change has landed, removing many of these APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the goal here is to avoid Multiple exports of name 'x'.eslintimport/export
, be aware that that is not a JavaScript or a TypeScript error. That is an eslint error used to detect when people have conflicting exports on accident, letting them know that some of the exports that would otherwise been included in the * export were skipped. Given that this is exactly what you want to happen, I suggest simply suppressing the lint error, and adding a comment about the suppression along the lines of "This reexports all non-conflicting APIs from tree. The event APIs are known to conflict, and this is intended as the exports via core-interfaces are preferred over the deprecated ones from tree".
This should avoid the need to mess with trees's exports (which when undone, fixes the fact that you haven't documented why you had to change them)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactor was indeed in response to the multiple same export issue. The original thread is #23183 (comment) and none of us knew offhand what the specified or most importantly actual behavior was for multiple of the same export. Seemed better to avoid the situation altogether. This current pattern appears compatible with our export verifications, and I don't see holes in coverage. Though yes, the pattern should be clearly documented in the code.
Alternatively, we can simplify with lint disables and added comments explaining exactly what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a new PR for this change: #23313
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to unresolve this issue because we need to pick one or the other.
Add a changeset to deprecate types from @fluidframework/tree. Modify fluid-framework to re-export the non-deprecated APIs from core-interfaces. Added basic test cases which covers importing a type from the three packages: tree, core-interfaces, and fluid-framework. These tests are added under examples. Prior PR: #23183 [ADO#25440](https://dev.azure.com/fluidframework/internal/_workitems/edit/25440)
Add a changeset to deprecate types from
@fluidframework/tree
. Modifyfluid-framework
to export the non-deprecated APIs from@fluidframework/core-interfaces
.The exports have been reorganized: APIs intended for export from
fluid-framework
are now inindexCommonApi.ts
, while the remaining are placed inindex.ts
.This change addresses the issue of duplicate exports in
fluid-framework
for theListenable
,Listener
,Off
, andIsListener
types, which are now moved to@fluidframework/core-interfaces
and deprecated in@fluidframework/tree
.Customers can still import these types from
@fluidframework/tree
, but they are marked as deprecated there. It is recommended to import them directly from@fluidframework/core-interfaces
instead.indexCommonApi.ts
excludes legacy alpha and deprecated APIs.ADO#25440