@theholocron/tsdown-config 8.6.0 → 8.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { t as resolveEntry } from "../resolve-entry-DDrvshfq.js";
1
+ import { n as resolveOutDir, t as resolveEntry } from "../resolve-entry-Bh8yS2Sn.js";
2
2
  import { defineConfig } from "tsdown";
3
3
  //#region presets/cli.ts
4
4
  /**
@@ -9,6 +9,7 @@ import { defineConfig } from "tsdown";
9
9
  function cli(options = {}) {
10
10
  const merged = {
11
11
  entry: ["src/cli.ts"],
12
+ outDir: "dist",
12
13
  format: "esm",
13
14
  dts: false,
14
15
  clean: true,
@@ -18,7 +19,8 @@ function cli(options = {}) {
18
19
  };
19
20
  return defineConfig({
20
21
  ...merged,
21
- entry: resolveEntry(merged.entry)
22
+ entry: resolveEntry(merged.entry),
23
+ outDir: resolveOutDir(merged.outDir ?? "dist")
22
24
  });
23
25
  }
24
26
  var cli_default = cli();
@@ -1,4 +1,4 @@
1
- import { t as resolveEntry } from "../resolve-entry-DDrvshfq.js";
1
+ import { n as resolveOutDir, t as resolveEntry } from "../resolve-entry-Bh8yS2Sn.js";
2
2
  import { defineConfig } from "tsdown";
3
3
  //#region presets/library.ts
4
4
  /**
@@ -18,6 +18,7 @@ import { defineConfig } from "tsdown";
18
18
  function library(options = {}) {
19
19
  const merged = {
20
20
  entry: ["src/index.ts"],
21
+ outDir: "dist",
21
22
  format: "esm",
22
23
  dts: true,
23
24
  clean: true,
@@ -26,7 +27,8 @@ function library(options = {}) {
26
27
  };
27
28
  return defineConfig({
28
29
  ...merged,
29
- entry: resolveEntry(merged.entry)
30
+ entry: resolveEntry(merged.entry),
31
+ outDir: resolveOutDir(merged.outDir ?? "dist")
30
32
  });
31
33
  }
32
34
  /** Ready-to-use config for packages that need no customisation. */
@@ -0,0 +1,39 @@
1
+ import { resolve } from "node:path";
2
+ //#region presets/resolve-entry.ts
3
+ /**
4
+ * tsdown resolves a config's relative paths — `entry` and, confirmed the
5
+ * same way (clients#376's release: every package but `http-client`, the
6
+ * one that still kept its own local `tsdown.config.ts`, published with an
7
+ * empty `dist/` — the real build output landed in
8
+ * `node_modules/@theholocron/tsdown-config/dist/presets/dist/` instead),
9
+ * `outDir` too — against the config file's own directory, not the invoking
10
+ * `cwd`. Fine for a package's own local `tsdown.config.ts` (same directory
11
+ * as `src/`), but wrong the moment `--config` points at this shared
12
+ * preset's own location deep in `node_modules` (astromech's
13
+ * config-resolution mechanism, holocron#749/#750/#680 — that's exactly how
14
+ * `entry`'s own version of this first surfaced, migrating a real repo off
15
+ * its local file; `outDir` was never given the same treatment, and the
16
+ * build silently "succeeded" — real file sizes, real log output — while
17
+ * writing everything to a phantom location no `npm publish` would ever
18
+ * pack). An absolute path sidesteps the ambiguity entirely, in both cases:
19
+ * `process.cwd()` is always the actual package directory tsdown was
20
+ * invoked from, regardless of where the config *module* lives on disk.
21
+ *
22
+ * Only `string` and `string[]` are resolved — the only shapes any preset
23
+ * here (or any known consumer's override) actually passes. tsdown's own
24
+ * `entry` type also allows a `Record<string, string | string[]>` (named
25
+ * multi-entry builds) and glob negation patterns (`!foo`); neither is used
26
+ * anywhere in this org today, so both pass through unresolved rather than
27
+ * guessing at a generalization nothing yet exercises.
28
+ */
29
+ function resolveEntry(entry) {
30
+ if (typeof entry === "string") return resolve(process.cwd(), entry);
31
+ if (Array.isArray(entry) && entry.every((e) => typeof e === "string")) return entry.map((e) => resolve(process.cwd(), e));
32
+ return entry;
33
+ }
34
+ /** Same fix as {@link resolveEntry}, for the single-string `outDir` option. */
35
+ function resolveOutDir(outDir) {
36
+ return resolve(process.cwd(), outDir);
37
+ }
38
+ //#endregion
39
+ export { resolveOutDir as n, resolveEntry as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/tsdown-config",
3
- "version": "8.6.0",
3
+ "version": "8.6.1",
4
4
  "description": "Shared tsdown configurations for @theholocron packages.",
5
5
  "homepage": "https://github.com/theholocron/configs/tree/main/packages/tsdown-config#readme",
6
6
  "bugs": "https://github.com/theholocron/configs/issues",
@@ -25,8 +25,8 @@
25
25
  "tsdown": "^0.22.14",
26
26
  "typescript": "^5.9.3",
27
27
  "vitest": "^4.1.10",
28
- "@theholocron/tsconfig": "8.6.0",
29
- "@theholocron/vitest-config": "8.6.0"
28
+ "@theholocron/vitest-config": "8.6.1",
29
+ "@theholocron/tsconfig": "8.6.1"
30
30
  },
31
31
  "exports": {
32
32
  ".": {
@@ -1,27 +0,0 @@
1
- import { resolve } from "node:path";
2
- //#region presets/resolve-entry.ts
3
- /**
4
- * tsdown resolves a config's relative `entry` paths against the config
5
- * file's own directory, not the invoking `cwd` — fine for a package's own
6
- * local `tsdown.config.ts` (same directory as `src/`), but wrong the moment
7
- * `--config` points at this shared preset's own location deep in
8
- * `node_modules` (astromech's config-resolution mechanism, holocron#749/
9
- * #750/#680 — that's exactly how this surfaced, migrating a real repo off
10
- * its local file). An absolute path sidesteps the ambiguity entirely, in
11
- * both cases: `process.cwd()` is always the actual package directory tsdown
12
- * was invoked from, regardless of where the config *module* lives on disk.
13
- *
14
- * Only `string` and `string[]` are resolved — the only shapes any preset
15
- * here (or any known consumer's override) actually passes. tsdown's own
16
- * `entry` type also allows a `Record<string, string | string[]>` (named
17
- * multi-entry builds) and glob negation patterns (`!foo`); neither is used
18
- * anywhere in this org today, so both pass through unresolved rather than
19
- * guessing at a generalization nothing yet exercises.
20
- */
21
- function resolveEntry(entry) {
22
- if (typeof entry === "string") return resolve(process.cwd(), entry);
23
- if (Array.isArray(entry) && entry.every((e) => typeof e === "string")) return entry.map((e) => resolve(process.cwd(), e));
24
- return entry;
25
- }
26
- //#endregion
27
- export { resolveEntry as t };