bun-plugin-dtsx 0.9.13 → 0.9.14

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/dist/index.d.ts CHANGED
@@ -53,6 +53,7 @@ export declare interface PluginConfig extends DtsGenerationOption {
53
53
  config: {
54
54
  root?: string
55
55
  outdir?: string
56
+ entrypoints?: string[]
56
57
  }
57
58
  }
58
59
  onSuccess?: (stats: GenerationStats) => void | Promise<void>
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __require = import.meta.require;
4
4
  // src/index.ts
5
5
  import { createHash } from "crypto";
6
6
  import { existsSync, readFileSync, writeFileSync } from "fs";
7
- import { join, resolve } from "path";
7
+ import { basename, join, resolve } from "path";
8
8
  import process from "process";
9
9
  import { generate } from "@stacksjs/dtsx";
10
10
  var PluginErrorCodes = {
@@ -241,11 +241,24 @@ function normalizeConfig(options, build) {
241
241
  if (!root) {
242
242
  throw new DtsxPluginError("Root directory is required", "CONFIG_ERROR", { providedRoot: root });
243
243
  }
244
+ let entrypoints = options.entrypoints;
245
+ if (!entrypoints) {
246
+ const bunEntrypoints = build?.config?.entrypoints;
247
+ if (bunEntrypoints?.length) {
248
+ const resolvedRoot = resolve(options.cwd || process.cwd(), root);
249
+ entrypoints = bunEntrypoints.map((ep) => {
250
+ const resolved = resolve(ep);
251
+ return resolved.startsWith(resolvedRoot) ? resolved.slice(resolvedRoot.length + 1) : basename(resolved);
252
+ });
253
+ } else {
254
+ entrypoints = ["index.ts"];
255
+ }
256
+ }
244
257
  return {
245
258
  ...options,
246
259
  cwd: options.cwd || process.cwd(),
247
260
  root,
248
- entrypoints: options.entrypoints || ["**/*.ts"],
261
+ entrypoints,
249
262
  outdir,
250
263
  clean: options.clean,
251
264
  tsconfigPath: options.tsconfigPath
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-dtsx",
3
3
  "type": "module",
4
- "version": "0.9.13",
4
+ "version": "0.9.14",
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",
@@ -49,6 +49,6 @@
49
49
  "typecheck": "bun tsc --noEmit"
50
50
  },
51
51
  "dependencies": {
52
- "@stacksjs/dtsx": "0.9.13"
52
+ "@stacksjs/dtsx": "0.9.14"
53
53
  }
54
54
  }