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

🚀 Feature: Dynamically computed tsup entry value #1931

Open
2 tasks done
JoshuaKGoldberg opened this issue Feb 5, 2025 · 0 comments
Open
2 tasks done

🚀 Feature: Dynamically computed tsup entry value #1931

JoshuaKGoldberg opened this issue Feb 5, 2025 · 0 comments
Labels
status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request

Comments

@JoshuaKGoldberg
Copy link
Owner

Bug Report Checklist

Overview

Splitting out of #1910: right now, the TSup config includes all src/**/*.ts files except test files:

entry: ["src/**/*.ts", "!src/**/*.test.*"],

That presents an edge case for test utility files with names like data.fakes.ts. They're not excluded by the !src/**/*.test.*, and so are included by the src/**/*.ts - even though they shouldn't be in the output package. As a result I've been less willing to write files like that.

The tsup config could in theory be expanded to exclude files with known names like *.fakes.*...

entry: ["src/**/*.ts", "!src/**/*.fakes.*", "!src/**/*.test.*"],

...but then that establishes a convention that not every package already uses. -1 from me.

I think what we really need here is an entry that respects package.json exports/main. I think that could be achieved with some kind of helper library used like:

import { defineConfig } from "tsup";
import { readEntryPoints } from "read-entry-points";

export default defineConfig({
	// ...
	entry: readEntryPoints(),
	// ...
});

Additional Info

I see this as kind of an intermediate step in lieu of / towards #1910. This wouldn't solve the issues around tsup falling out of maintenance. But it would solve the specific issue of out-of-entrypoints modules still being included.

Putting in status: in discussion for a bit to let the idea settle. I'm also asking around about #1910 on social media: https://bsky.app/profile/joshuakgoldberg.com/post/3lhgppvnyjc2e, https://fosstodon.org/@JoshuaKGoldberg/113951603816733558.

💖

@JoshuaKGoldberg JoshuaKGoldberg added status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request labels Feb 5, 2025
@JoshuaKGoldberg JoshuaKGoldberg changed the title 🚀 Feature: Have tsup 🚀 Feature: Dynamically computed tsup entry value Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request
Projects
None yet
Development

No branches or pull requests

1 participant