mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 08:52:25 +00:00
Refactor popover engine to use Floating UI
This commit is contained in:
1 parent
3b53cfd683
commit
43a75e86c8
8 files changed
+194
-232
No files matched your search
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { build } from "esbuild";
|
||||
import { mkdir } from "node:fs/promises";
|
||||
import { copyFile, mkdir } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -11,8 +12,23 @@ const repoRoot = path.resolve(__dirname, "..");
|
||||
const entryPoint = path.join(repoRoot, "torrent/src/beacon-vendor.js");
|
||||
const outDir = path.join(repoRoot, "torrent/dist");
|
||||
const outFile = path.join(outDir, "beacon.js");
|
||||
const vendorDir = path.join(repoRoot, "vendor");
|
||||
const vendorOutFile = path.join(vendorDir, "floating-ui.dom.bundle.min.js");
|
||||
const vendorLicenseFile = path.join(vendorDir, "floating-ui.LICENSE");
|
||||
const floatingUiEntry = path.join(
|
||||
repoRoot,
|
||||
"scripts/vendor/floating-ui-dom-entry.mjs",
|
||||
);
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const floatingUiPackageJson = require.resolve("@floating-ui/dom/package.json");
|
||||
const floatingUiLicense = path.join(
|
||||
path.dirname(floatingUiPackageJson),
|
||||
"LICENSE",
|
||||
);
|
||||
|
||||
await mkdir(outDir, { recursive: true });
|
||||
await mkdir(vendorDir, { recursive: true });
|
||||
|
||||
await build({
|
||||
bundle: true,
|
||||
@@ -34,3 +50,18 @@ await build({
|
||||
},
|
||||
logLevel: "info",
|
||||
});
|
||||
|
||||
await build({
|
||||
bundle: true,
|
||||
entryPoints: [floatingUiEntry],
|
||||
outfile: vendorOutFile,
|
||||
format: "esm",
|
||||
splitting: false,
|
||||
platform: "browser",
|
||||
target: ["es2020"],
|
||||
minify: true,
|
||||
sourcemap: false,
|
||||
logLevel: "info",
|
||||
});
|
||||
|
||||
await copyFile(floatingUiLicense, vendorLicenseFile);
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export {
|
||||
arrow,
|
||||
autoUpdate,
|
||||
computePosition,
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
} from "@floating-ui/dom";
|
||||
Reference in new issue
Block a user