Skip to content

🚀 Feature: Dynamically computed TSDown entry value #1931

Open
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

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.

💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: in discussionNot yet ready for implementation or a pull requesttype: featureNew enhancement or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions