dtsroll 1.1.0 → 1.2.0

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/README.md CHANGED
@@ -101,11 +101,28 @@ Provide resolution conditions to target specific entry points in dependencies, s
101
101
  ```ts
102
102
  import { dtsroll } from 'dtsroll'
103
103
 
104
- await dtsroll({
105
- // inputs?: string[];
106
- // external?: string[];
107
- // conditions?: string[];
108
- // dryRun?: boolean;
104
+ await dtsroll(options as {
105
+
106
+ /**
107
+ * CWD to find the package.json in
108
+ * @default process.cwd()
109
+ */
110
+ cwd?: string
111
+
112
+ /**
113
+ * Defaults to auto-detecting d.ts files from package.json
114
+ */
115
+ inputs?: string[]
116
+
117
+ /**
118
+ * Only used if there's no package.json
119
+ * Defaults to auto-detecting dependencies from package.json
120
+ */
121
+ external?: string[]
122
+
123
+ conditions?: string[]
124
+
125
+ dryRun?: boolean
109
126
  })
110
127
  ```
111
128
 
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { cli } from 'cleye';
3
- import { b as bgYellow, a as black, d as dtsroll } from './index-D3bowY1b.mjs';
4
- import { l as logOutput } from './log-output-D6QoPA8O.mjs';
3
+ import { b as bgYellow, a as black, d as dtsroll } from './index--BBQtOEp.mjs';
4
+ import { l as logOutput } from './log-output-CwMUFOmQ.mjs';
5
5
  import 'node:path';
6
6
  import 'node:fs/promises';
7
7
  import 'rollup';
@@ -10,7 +10,7 @@ import '@rollup/plugin-node-resolve';
10
10
  import 'byte-size';
11
11
 
12
12
  var name = "dtsroll";
13
- var version = "1.1.0";
13
+ var version = "1.2.0";
14
14
  var description = "Bundle dts files";
15
15
 
16
16
  const argv = cli({
@@ -238,8 +238,8 @@ const getExternals = (packageJson) => {
238
238
  }
239
239
  return external;
240
240
  };
241
- const getPackageJson = async () => {
242
- const packageJsonPath = path.resolve("package.json");
241
+ const getPackageJson = async (cwd) => {
242
+ const packageJsonPath = path.resolve(cwd, "package.json");
243
243
  const exists = await pathExists(packageJsonPath);
244
244
  if (!exists) {
245
245
  return;
@@ -442,12 +442,13 @@ const build = async (input, outputDirectory, externals, mode, conditions) => {
442
442
  };
443
443
 
444
444
  const dtsroll = async ({
445
+ cwd = process.cwd(),
445
446
  inputs,
446
447
  external,
447
448
  conditions,
448
449
  dryRun
449
450
  } = {}) => {
450
- const pkgJson = await getPackageJson();
451
+ const pkgJson = await getPackageJson(cwd);
451
452
  const externals = pkgJson ? pkgJson.getExternals() : /* @__PURE__ */ new Map();
452
453
  if (external && external.length > 0) {
453
454
  if (pkgJson) {
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ type Externals = [
11
11
  ][];
12
12
  type ValidatedInput = [
13
13
  inputPath: string,
14
- inputSource: string,
14
+ inputSource: string | undefined,
15
15
  error?: string
16
16
  ];
17
17
  type DtsrollOutput = {
@@ -32,11 +32,12 @@ type DtsrollOutput = {
32
32
  };
33
33
 
34
34
  type Options = {
35
+ cwd?: string;
35
36
  inputs?: string[];
36
37
  external?: string[];
37
38
  conditions?: string[];
38
39
  dryRun?: boolean;
39
40
  };
40
- declare const dtsroll: ({ inputs, external, conditions, dryRun, }?: Options) => Promise<DtsrollOutput>;
41
+ declare const dtsroll: ({ cwd, inputs, external, conditions, dryRun, }?: Options) => Promise<DtsrollOutput>;
41
42
 
42
43
  export { type DtsrollOutput, type Options, dtsroll };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'node:path';
2
- export { d as dtsroll } from './index-D3bowY1b.mjs';
2
+ export { d as dtsroll } from './index--BBQtOEp.mjs';
3
3
  import 'node:fs/promises';
4
4
  import 'rollup';
5
5
  import 'rollup-plugin-dts';
@@ -1,13 +1,13 @@
1
1
  import path from 'node:path';
2
2
  import byteSize from 'byte-size';
3
- import { u as underline, c as bold, l as lightYellow, w as warningSignUnicode, e as dim, g as green, r as red, m as magenta, y as yellow } from './index-D3bowY1b.mjs';
3
+ import { u as underline, c as bold, l as lightYellow, w as warningSignUnicode, e as dim, g as green, r as red, m as magenta, y as yellow } from './index--BBQtOEp.mjs';
4
4
 
5
5
  const cwd = process.cwd();
6
6
 
7
7
  const logOutput = (dtsOutput) => {
8
8
  console.log(underline("dtsroll"));
9
9
  const { inputs } = dtsOutput;
10
- const isCliInput = inputs[0][1] === void 0;
10
+ const isCliInput = inputs[0]?.[1] === void 0;
11
11
  console.log(bold(`
12
12
  \u{1F4E5} Entry points${isCliInput ? "" : " in package.json"}`));
13
13
  console.log(
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { l as logOutput } from './log-output-D6QoPA8O.mjs';
2
- import { d as dtsroll } from './index-D3bowY1b.mjs';
1
+ import { l as logOutput } from './log-output-CwMUFOmQ.mjs';
2
+ import { d as dtsroll } from './index--BBQtOEp.mjs';
3
3
  import 'node:path';
4
4
  import 'byte-size';
5
5
  import 'node:fs/promises';
@@ -9,10 +9,14 @@ import '@rollup/plugin-node-resolve';
9
9
 
10
10
  const dtsrollPlugin = (options) => {
11
11
  let built = false;
12
+ let cwd;
12
13
  return {
13
14
  name: "dtsroll",
14
15
  apply: "build",
15
16
  enforce: "post",
17
+ config: ({ root }) => {
18
+ cwd = root;
19
+ },
16
20
  writeBundle: {
17
21
  sequential: true,
18
22
  order: "post",
@@ -20,7 +24,10 @@ const dtsrollPlugin = (options) => {
20
24
  if (built) {
21
25
  return;
22
26
  }
23
- logOutput(await dtsroll(options));
27
+ logOutput(await dtsroll({
28
+ cwd,
29
+ ...options
30
+ }));
24
31
  console.log();
25
32
  built = true;
26
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtsroll",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Bundle dts files",
5
5
  "keywords": [
6
6
  "bundle",