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

Merge release/v1.1.0 to develop #4971

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions app/packages/plugins/src/externalize.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import * as foa from "@fiftyone/aggregations";
import * as focore from "@fiftyone/core";
import * as foe from "@fiftyone/embeddings";
import * as fol from "@fiftyone/looker";
import * as fom from "@fiftyone/map";
import * as fopb from "@fiftyone/playback";
import * as fosl from "@fiftyone/spotlight";
import * as fof from "@fiftyone/flashlight";
import * as fol3d from "@fiftyone/looker-3d";
import * as foc from "@fiftyone/components";
import * as foo from "@fiftyone/operators";
import * as fos from "@fiftyone/state";
Expand All @@ -21,6 +30,15 @@ declare global {
__foo__: typeof foo;
__fosp__: typeof fosp;
__fop__: typeof fop;
__foa__: typeof foa;
__focore__: typeof focore;
__foe__: typeof foe;
__fol__: typeof fol;
__fom__: typeof fom;
__fopb__: typeof fopb;
__fosl__: typeof fosl;
__fof__: typeof fof;
__fol3d__: typeof fol3d;
__mui__: typeof mui;
__styled__: typeof styled;
}
Expand All @@ -39,5 +57,14 @@ if (typeof window !== "undefined") {
window.__fosp__ = fosp;
window.__mui__ = mui;
window.__fop__ = fop;
window.__foa__ = foa;
window.__focore__ = focore;
window.__foe__ = foe;
window.__fol__ = fol;
window.__fom__ = fom;
window.__fopb__ = fopb;
window.__fosl__ = fosl;
window.__fof__ = fof;
window.__fol3d__ = fol3d;
Comment on lines +60 to +68
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider refactoring global assignments for better maintainability

While the implementation is correct, maintaining parallel lists of imports, interface declarations, and assignments can be error-prone. Consider creating a mapping object to reduce duplication:

const moduleMap = {
  __foa__: foa,
  __focore__: focore,
  // ... other modules
} as const;

declare global {
  interface Window {
    // Use the moduleMap to generate types
    [K in keyof typeof moduleMap]: typeof moduleMap[K]
  }
}

if (typeof window !== "undefined") {
  Object.assign(window, moduleMap);
}

This approach would:

  1. Reduce maintenance overhead
  2. Ensure consistency between types and runtime
  3. Make it easier to add/remove exposed modules

window.__styled__ = styled;
}
Loading