[READ-ONLY] Mirror of https://github.com/bombshell-dev/tools. Internal CLI to standardize tooling across all Bombshell projects
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: externalized deps

Nate Moore (Mar 31, 2025, 8:04 PM -0500) f51c30bb 20ea4854

+21 -2
+5
.changeset/metal-frogs-kneel.md
··· 1 + --- 2 + "@bomb.sh/tools": patch 3 + --- 4 + 5 + Fixes externalized dependency bundling and properly handles rewriting for local `.ts` modules
+14 -1
src/commands/build.ts
··· 1 1 import { rm } from "node:fs/promises"; 2 - import { build as esbuild } from "esbuild"; 2 + import { type Plugin, build as esbuild } from "esbuild"; 3 3 import type { CommandContext } from "../context.ts"; 4 4 import { getPackageJSON } from "../utils.ts"; 5 5 ··· 8 8 await rm("dist", { recursive: true, force: true }); 9 9 await esbuild({ 10 10 entryPoints: ["src/*", "src/**/*"], 11 + plugins: [ts()], 11 12 outdir: "dist", 12 13 platform: "node", 13 14 format: "esm", ··· 21 22 process.exit(1); 22 23 }); 23 24 } 25 + 26 + function ts(): Plugin { 27 + return { 28 + name: 'ts', 29 + setup(build) { 30 + build.onResolve({ filter: /\.tsx?$/ }, args => { 31 + return { path: args.path.replace(/\.tsx?$/, '.js'), external: true } 32 + }) 33 + }, 34 + } 35 + } 36 +
+2 -1
src/utils.ts
··· 1 + import { cwd } from "node:process"; 1 2 import { fileURLToPath, pathToFileURL } from "node:url"; 2 3 import escalade from "escalade"; 3 4 ··· 8 9 } 9 10 10 11 export async function getPackageJSON() { 11 - const pkg = await escalade(fileURLToPath(import.meta.url), (dir, files) => { 12 + const pkg = await escalade(cwd(), (dir, files) => { 12 13 return files.find((file) => file === "package.json"); 13 14 }); 14 15 if (!pkg) {