bun-plugin-dtsx 0.21.14 → 0.21.16

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -23
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // @bun
2
2
  // src/index.ts
3
- import fs from "fs";
4
- import path from "path";
3
+ import process from "process";
5
4
  import { generate } from "@stacksjs/dtsx";
6
5
  function dts(options = {
7
6
  root: "./src",
@@ -11,39 +10,24 @@ function dts(options = {
11
10
  name: "bun-plugin-dtsx",
12
11
  async setup(build) {
13
12
  const config = normalizeConfig(options, build);
14
- if (config.clean && config.outdir) {
15
- try {
16
- fs.rmSync(config.outdir, { recursive: true, force: true });
17
- } catch {}
18
- fs.mkdirSync(config.outdir, { recursive: true });
19
- }
20
13
  await generate(config);
21
14
  }
22
15
  };
23
16
  }
24
17
  function normalizeConfig(options, build) {
25
- const root = options.root || build?.config.root;
26
- const outdir = options.outdir || build?.config.outdir;
18
+ const root = options.root || build.config.root;
19
+ const outdir = options.outdir || build.config.outdir;
27
20
  if (!root) {
28
21
  throw new Error("[bun-plugin-dtsx] Root directory is required");
29
22
  }
30
- const normalizedEntrypoints = options.entrypoints ?? build?.config?.entrypoints?.map((ep) => {
31
- if (!ep)
32
- return ep;
33
- if (!path.isAbsolute(ep))
34
- return ep;
35
- return path.relative(root, ep);
36
- });
37
23
  return {
38
- cwd: options.cwd ?? root,
24
+ ...options,
25
+ cwd: options.cwd || process.cwd(),
39
26
  root,
40
- entrypoints: normalizedEntrypoints,
27
+ entrypoints: options.entrypoints || ["**/*.ts"],
41
28
  outdir,
42
- keepComments: options.keepComments,
43
29
  clean: options.clean,
44
- tsconfigPath: options.tsconfigPath,
45
- verbose: options.verbose,
46
- outputStructure: options.outputStructure
30
+ tsconfigPath: options.tsconfigPath
47
31
  };
48
32
  }
49
33
  var src_default = dts;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-dtsx",
3
3
  "type": "module",
4
- "version": "0.21.14",
4
+ "version": "0.21.16",
5
5
  "description": "A Bun Bundler plugin that auto generates your DTS types extremely fast.",
6
6
  "author": "Chris Breuer <chris@ow3.org>",
7
7
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "typecheck": "bun tsc --noEmit"
57
57
  },
58
58
  "dependencies": {
59
- "@stacksjs/dtsx": "^0.9.7"
59
+ "@stacksjs/dtsx": "^0.9.8"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@stacksjs/bumpx": "^0.2.2",