#!/usr/bin/env bun import { promises as fs } from "node:fs"; import { build, defineConfig } from "tsup"; import pkg from "../package.json" with { type: "json" }; const tsupConfig = defineConfig({ outDir: "dist", splitting: false, sourcemap: false, dts: true, treeshake: true, platform: "node", format: "esm", banner: { js: "/* eslint-disable */", }, define: { __PKG_NAME__: JSON.stringify(pkg.name), }, }); await build({ ...tsupConfig, entry: ["src/classed.tsx", "src/css-to-js.ts"], outDir: "dist", external: ["react", "react/jsx-runtime", "clsx"], clean: true, }); await Promise.all([ build({ ...tsupConfig, entry: ["src/classed.tsx", "src/css-to-js.ts"], outDir: "dist", external: ["react", "react/jsx-runtime", "clsx"], }), build({ ...tsupConfig, entry: ["src/index.ts"], external: ["postcss-selector-parser", "postcss", "stylis"], }), ...[ "animate", "aspect-ratio", "container-queries", "forms", "react-aria-components", "typography", ].map(name => build({ ...tsupConfig, entry: [`./src/vendor/${name}.ts`], outDir: "dist/vendor", external: ["tailwindcss/plugin", "tailwindcss/colors", "tailwindcss/defaultTheme"], }) ), ]); await Promise.all([ fs.copyFile("README.md", "dist/README.md"), fs.copyFile("LICENSE.md", "dist/LICENSE.md"), fs.copyFile("src/macro.d.ts", "dist/macro.d.ts"), fs.copyFile("src/react-env.d.ts", "dist/react-env.d.ts"), Bun.write(`dist/base.d.ts`, `/**\n * \`@tailwind base\` component.\n */\nexport {};`), ]); process.exit(0);