@rrlab/tsdown-config 0.2.0 → 0.2.2

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 rcrd <ricardo@variable.land>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # tsdown-config
2
+
3
+ `@rrlab/tsdown-config` holds the [tsdown](https://tsdown.dev) configuration helpers of [run-run](https://github.com/withvariablelab/dx/tree/main/run-run/cli). The `tsdown.config.ts` that [`@rrlab/tsdown-plugin`](https://www.npmjs.com/package/@rrlab/tsdown-plugin) writes calls one of them.
4
+
5
+ ## Install
6
+
7
+ If you use run-run:
8
+
9
+ ```sh
10
+ rr plugins add tsdown
11
+ ```
12
+
13
+ Once you confirm, it asks for the kind of build, installs this package and writes a `tsdown.config.ts` that calls the matching helper.
14
+
15
+ Without run-run, install it by hand:
16
+
17
+ ```sh
18
+ pnpm add -D @rrlab/tsdown-config tsdown
19
+ ```
20
+
21
+ It needs tsdown 0.22 or later and Node 22.18 or later.
22
+
23
+ ## Presets
24
+
25
+ - `defineLibConfig()`: a library. ESM with `.d.ts` declarations, from the entry `src/index.ts`.
26
+ - `defineBinConfig()`: a CLI or Node binary. ESM for the `node` platform, from the entry `src/run.ts`.
27
+
28
+ Each helper wraps tsdown's `defineConfig()` and takes tsdown's `UserConfig`, which this package also exports. Your options are spread over the defaults, so they win.
29
+
30
+ ## Usage
31
+
32
+ ```ts
33
+ // tsdown.config.ts
34
+ import { defineLibConfig } from "@rrlab/tsdown-config";
35
+
36
+ export default defineLibConfig();
37
+ ```
38
+
39
+ Pass tsdown options to override a default, such as `defineLibConfig({ entry: ["src/lib.ts"] })`.
40
+
41
+ ## License
42
+
43
+ [MIT](https://github.com/withvariablelab/dx/blob/main/LICENSE).
44
+
45
+ <p align="center">
46
+ <a href="https://lab.variable.land"><img src="https://cdn.jsdelivr.net/gh/withvariablelab/brand@v0.3.1/.github/readme/logo.svg" width="24" alt="" align="absmiddle">&nbsp;Variable Land</a>
47
+ </p>
package/dist/index.d.mts CHANGED
@@ -1,7 +1,4 @@
1
- import { UserConfig } from "tsdown";
2
-
3
- //#region src/index.d.ts
4
- declare function defineBinConfig(options?: UserConfig): UserConfig;
5
- declare function defineLibConfig(options?: UserConfig): UserConfig;
6
- //#endregion
7
- export { defineBinConfig, defineLibConfig };
1
+ import { UserConfig, UserConfig as UserConfig$1 } from "tsdown";
2
+ export declare function defineBinConfig(options?: UserConfig$1): UserConfig$1;
3
+ export declare function defineLibConfig(options?: UserConfig$1): UserConfig$1;
4
+ export type { UserConfig };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineConfig } from "tsdown";
2
- //#region src/index.ts
2
+ // src/index.ts
3
3
  function defineBinConfig(options = {}) {
4
4
  return defineConfig({
5
5
  entry: ["src/run.ts"],
@@ -16,5 +16,4 @@ function defineLibConfig(options = {}) {
16
16
  ...options
17
17
  });
18
18
  }
19
- //#endregion
20
19
  export { defineBinConfig, defineLibConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rrlab/tsdown-config",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Shared tsdown configuration helpers used by @rrlab/tsdown-plugin.",
5
5
  "homepage": "https://github.com/withvariablelab/dx/tree/main/run-run/tsdown-config#readme",
6
6
  "bugs": {
@@ -39,7 +39,14 @@
39
39
  "peerDependencies": {
40
40
  "tsdown": ">=0.22.0"
41
41
  },
42
+ "devDependencies": {
43
+ "@types/node": "26.6.6",
44
+ "tsdown": "0.23.4",
45
+ "typescript": "7.0.2",
46
+ "vitest": "5.0.5"
47
+ },
42
48
  "scripts": {
43
- "build": "tsdown"
49
+ "build": "tsdown",
50
+ "test": "vitest run"
44
51
  }
45
52
  }
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { defineConfig, type UserConfig } from "tsdown";
2
2
 
3
+ export type { UserConfig } from "tsdown";
4
+
3
5
  export function defineBinConfig(options: UserConfig = {}) {
4
6
  return defineConfig({
5
7
  entry: ["src/run.ts"],