diff --git a/.changeset/mosaic-floating-ui-external.md b/.changeset/mosaic-floating-ui-external.md new file mode 100644 index 00000000000..2de34daa1f3 --- /dev/null +++ b/.changeset/mosaic-floating-ui-external.md @@ -0,0 +1,5 @@ +--- +'@clerk/mosaic': patch +--- + +`@floating-ui/react` is now installed as a dependency of `@clerk/mosaic` instead of being bundled into its output, so apps that already use it can share a single copy. diff --git a/packages/mosaic/bundlewatch.config.json b/packages/mosaic/bundlewatch.config.json index 2325ac6ed4a..bf7a2450e74 100644 --- a/packages/mosaic/bundlewatch.config.json +++ b/packages/mosaic/bundlewatch.config.json @@ -1,6 +1,6 @@ { "files": [ - { "path": "./dist/index.js", "maxSize": "110KB" }, + { "path": "./dist/index.js", "maxSize": "75KB" }, { "path": "./dist/styles.css", "maxSize": "12KB" } ] } diff --git a/packages/mosaic/scripts/check-bundle.mjs b/packages/mosaic/scripts/check-bundle.mjs index 0ce65fde9f4..b1527050c58 100644 --- a/packages/mosaic/scripts/check-bundle.mjs +++ b/packages/mosaic/scripts/check-bundle.mjs @@ -26,6 +26,10 @@ if (!/(?:from|import)\s*['"]@clerk\/shared(?:\/[^'"]*)?['"]/.test(source)) { ); } +if (!/(?:from|import)\s*['"]@floating-ui\/react(?:\/[^'"]*)?['"]/.test(source)) { + throw new Error('Published Mosaic JS does not import @floating-ui/react; it should be an external dependency.'); +} + console.log( - '✅ Mosaic bundle is client-boundaried, imports @clerk/shared, and is free of UI, Emotion, and StyleX runtime imports', + '✅ Mosaic bundle is client-boundaried, imports @clerk/shared and @floating-ui/react, and is free of UI, Emotion, and StyleX runtime imports', ); diff --git a/packages/mosaic/tsdown.config.mts b/packages/mosaic/tsdown.config.mts index 700229ba6a7..8d25f3fd9f1 100644 --- a/packages/mosaic/tsdown.config.mts +++ b/packages/mosaic/tsdown.config.mts @@ -16,7 +16,7 @@ export default defineConfig({ tsconfig: './tsconfig.json', deps: { neverBundle: ['react', 'react-dom', /^@clerk\/shared(\/.*)?$/], - alwaysBundle: [/^@stylexjs\//, /^@floating-ui\//], + alwaysBundle: [/^@stylexjs\//], onlyBundle: false, }, plugins: [