unplugin-dts-bundle-generator 3.1.1 → 3.3.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 +88 -19
- package/dist/dts-bundle-generator.d.ts +11 -2
- package/dist/esbuild.cjs.js +1 -0
- package/dist/esbuild.d.ts +17 -0
- package/dist/esbuild.es.js +6 -0
- package/dist/factory.cjs.js +2 -2
- package/dist/factory.es.js +84 -39
- package/dist/rolldown.cjs.js +1 -0
- package/dist/rolldown.d.ts +17 -0
- package/dist/rolldown.es.js +6 -0
- package/dist/rollup.d.ts +5 -3
- package/dist/vite.d.ts +5 -3
- package/package.json +24 -8
package/README.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
[](./LICENCE)
|
|
6
6
|
[](https://github.com/f-lawe/unplugin-dts-bundle-generator/actions/workflows/pr-checks.yml)
|
|
7
7
|
|
|
8
|
-
Ever wanted to easily package your typescript library with a bundled declaration file? Integrate [DTS Bundle Generator](https://github.com/timocov/dts-bundle-generator) within
|
|
9
|
-
|
|
8
|
+
Ever wanted to easily package your typescript library with a bundled declaration file? Integrate [DTS Bundle Generator](https://github.com/timocov/dts-bundle-generator) within your favourite bundler thanks to [Unplugin](https://github.com/unjs/unplugin)!
|
|
9
|
+
|
|
10
|
+
_(see available bundlers below)_
|
|
10
11
|
|
|
11
12
|
## Installation
|
|
12
13
|
```sh
|
|
@@ -18,22 +19,21 @@ yarn add --dev unplugin-dts-bundle-generator
|
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
## Usage
|
|
21
|
-
|
|
22
|
+
Only those bundlers are supported at the moment:
|
|
22
23
|
|
|
23
24
|
<details>
|
|
24
|
-
<summary>
|
|
25
|
+
<summary>ESBuild</summary><br>
|
|
25
26
|
|
|
26
|
-
With
|
|
27
|
+
With ESBuild, add this block when calling `esbuild.build()`:
|
|
27
28
|
|
|
28
29
|
```ts
|
|
29
|
-
import
|
|
30
|
-
import dtsBundleGenerator from 'unplugin-dts-bundle-generator/
|
|
31
|
-
import { defineConfig, normalizePath } from 'vite';
|
|
30
|
+
import * as esbuild from 'esbuild';
|
|
31
|
+
import dtsBundleGenerator from 'unplugin-dts-bundle-generator/rollup';
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
await esbuild.build({
|
|
34
34
|
plugins: [
|
|
35
35
|
dtsBundleGenerator({
|
|
36
|
-
|
|
36
|
+
outfile: 'my-lib.d.ts',
|
|
37
37
|
output: {
|
|
38
38
|
// output config
|
|
39
39
|
},
|
|
@@ -43,19 +43,48 @@ export default defineConfig({
|
|
|
43
43
|
compilation: {
|
|
44
44
|
// compilation options
|
|
45
45
|
}
|
|
46
|
-
})
|
|
46
|
+
}),
|
|
47
47
|
],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fileName: 'my-lib.js'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
48
|
+
entryPoints: 'src/index.ts',
|
|
49
|
+
outfile: 'my-lib.js',
|
|
50
|
+
format: 'esm',
|
|
51
|
+
bundle: true,
|
|
55
52
|
});
|
|
56
53
|
```
|
|
57
54
|
<br></details>
|
|
58
55
|
|
|
56
|
+
<details>
|
|
57
|
+
<summary>Rolldown</summary><br>
|
|
58
|
+
|
|
59
|
+
With Rolldown, add this block to your `rolldown.config.ts`:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import dtsBundleGenerator from 'unplugin-dts-bundle-generator/rolldown';
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
plugins: [
|
|
66
|
+
dtsBundleGenerator({
|
|
67
|
+
file: 'my-lib.d.ts',
|
|
68
|
+
output: {
|
|
69
|
+
// output config
|
|
70
|
+
},
|
|
71
|
+
libraries: {
|
|
72
|
+
// libraries config
|
|
73
|
+
},
|
|
74
|
+
compilation: {
|
|
75
|
+
// compilation options
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
input: 'src/index.ts',
|
|
80
|
+
output: {
|
|
81
|
+
dir: 'dist',
|
|
82
|
+
format: 'es',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
<br></details>
|
|
87
|
+
|
|
59
88
|
<details>
|
|
60
89
|
<summary>Rollup</summary><br>
|
|
61
90
|
|
|
@@ -67,7 +96,7 @@ import dtsBundleGenerator from 'unplugin-dts-bundle-generator/rollup';
|
|
|
67
96
|
export default {
|
|
68
97
|
plugins: [
|
|
69
98
|
dtsBundleGenerator({
|
|
70
|
-
|
|
99
|
+
file: 'my-lib.d.ts',
|
|
71
100
|
output: {
|
|
72
101
|
// output config
|
|
73
102
|
},
|
|
@@ -88,6 +117,46 @@ export default {
|
|
|
88
117
|
```
|
|
89
118
|
<br></details>
|
|
90
119
|
|
|
120
|
+
<details>
|
|
121
|
+
<summary>Vite</summary><br>
|
|
122
|
+
|
|
123
|
+
With Vite, add this block to your `vite.config.ts`:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import path from 'node:path';
|
|
127
|
+
import dtsBundleGenerator from 'unplugin-dts-bundle-generator/vite';
|
|
128
|
+
import { defineConfig, normalizePath } from 'vite';
|
|
129
|
+
|
|
130
|
+
export default defineConfig({
|
|
131
|
+
plugins: [
|
|
132
|
+
dtsBundleGenerator({
|
|
133
|
+
fileName: 'my-lib.d.ts',
|
|
134
|
+
output: {
|
|
135
|
+
// output config
|
|
136
|
+
},
|
|
137
|
+
libraries: {
|
|
138
|
+
// libraries config
|
|
139
|
+
},
|
|
140
|
+
compilation: {
|
|
141
|
+
// compilation options
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
],
|
|
145
|
+
build: {
|
|
146
|
+
lib: {
|
|
147
|
+
entry: normalizePath('src/index.ts'),
|
|
148
|
+
formats: ['es'],
|
|
149
|
+
fileName: 'my-lib.js'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
<br></details>
|
|
155
|
+
|
|
156
|
+
⚠️ Be careful! Plugin options may vary depending on the bundler you are using.
|
|
157
|
+
|
|
158
|
+
Feel free to open a PR or an issue if you need another export and want to speed up the process, so we can work it out.
|
|
159
|
+
|
|
91
160
|
## Configuration
|
|
92
161
|
|
|
93
162
|
This library handle both single and multiple entrypoints. You can use any of the output, libraries and compilation options available in the [config file](https://github.com/timocov/dts-bundle-generator/blob/master/src/config-file/README.md) of DTS Bundle Generator.
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { CompilationOptions, EntryPointConfig } from 'dts-bundle-generator';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
fileName: string | ((entryName: string) => string);
|
|
3
|
+
export interface DtsBundleGeneratorOptions {
|
|
5
4
|
output?: EntryPointConfig["output"];
|
|
6
5
|
libraries?: EntryPointConfig["libraries"];
|
|
7
6
|
compilation?: CompilationOptions;
|
|
8
7
|
}
|
|
8
|
+
export interface OptionsForESBuild extends DtsBundleGeneratorOptions {
|
|
9
|
+
outfile?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface OptionsForRollup extends DtsBundleGeneratorOptions {
|
|
12
|
+
file?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface OptionsForVite extends DtsBundleGeneratorOptions {
|
|
15
|
+
fileName: string | ((entryName: string) => string);
|
|
16
|
+
}
|
|
17
|
+
export type Options = OptionsForESBuild | OptionsForRollup | OptionsForVite;
|
|
9
18
|
declare const _default: import("unplugin").UnpluginInstance<Options, false>;
|
|
10
19
|
|
|
11
20
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("unplugin"),e=require("./factory.cjs.js"),r=u.createEsbuildPlugin(e.unpluginFactory);module.exports=r;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CompilationOptions, EntryPointConfig } from 'dts-bundle-generator';
|
|
2
|
+
|
|
3
|
+
export interface DtsBundleGeneratorOptions {
|
|
4
|
+
output?: EntryPointConfig["output"];
|
|
5
|
+
libraries?: EntryPointConfig["libraries"];
|
|
6
|
+
compilation?: CompilationOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface OptionsForESBuild extends DtsBundleGeneratorOptions {
|
|
9
|
+
outfile?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: (options: OptionsForESBuild) => import("esbuild").Plugin;
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
_default as default,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {};
|
package/dist/factory.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const f=require("node:buffer"),
|
|
2
|
-
${
|
|
1
|
+
"use strict";const f=require("node:buffer"),h=require("node:fs"),c=require("node:path"),g=require("node:zlib"),y=require("dts-bundle-generator"),a=require("picocolors"),d=s=>{const o={},n=[],l=[];return{name:"unplugin-dts-bundle-generator",buildEnd(){l.forEach(e=>n.push({entryPointConfig:{filePath:e.in,libraries:s.libraries,output:s.output},outFile:e.out,size:-1,compressedSize:-1}))},writeBundle(){n.forEach((e,r)=>{if(e.size===-1){const t=y.generateDtsBundle([e.entryPointConfig],s.compilation)[0];h.writeFileSync(e.outFile,t),n[r].size=f.Buffer.byteLength(t),n[r].compressedSize=g.gzipSync(t).length}})},esbuild:{config(e){if(!e.entryPoints)return;const r=s,t=typeof e.entryPoints=="string"?[e.entryPoints]:Array.isArray(e.entryPoints)?e.entryPoints:Object.values(e.entryPoints);t.length===1&&(r.outfile||e.outfile)?l[0]={in:typeof t[0]=="string"?t[0]:t[0].in,out:r.outfile||e.outfile}:t.map(i=>typeof i!="string"?i:{in:i,out:c.basename(i).split(".")[0]}).forEach(i=>{l.push({in:i.in,out:`${e.outdir}/${i.out}.d.ts`})})}},rollup:{buildStart(e){Array.isArray(e.input)?e.input.length===1?e.input.forEach((r,t)=>l.push({in:r,out:o.outFile??`${t}`})):e.input.forEach((r,t)=>l.push({in:r,out:o.outDir?`${o.outDir}/${c.basename(r).split(".")[0]}.d.ts`:`${t}`})):Object.entries(e.input).forEach(([r,t])=>l.push({in:t,out:o.outDir?`${o.outDir}/${c.basename(t).split(".")[0]}.d.ts`:r}))},outputOptions(e){if(n.length===0){o.outFile=e.file,o.outDir=e.dir;return}const r=s;n.length===1&&(r.file||e.file)?n[0].outFile=r.file??e.file.replace(/\.js$/,".d.ts"):n.forEach((t,i)=>{const u=`${c.basename(t.entryPointConfig.filePath).split(".")[0]}.d.ts`;n[i].outFile=`${e.dir}/${u}`})}},vite:{configResolved(e){const r=s;if(e.build.lib){const t=(i="default")=>typeof r.fileName=="string"?`${e.build.outDir}/${r.fileName}`:`${e.build.outDir}/${r.fileName(i)}`;typeof e.build.lib.entry=="string"?l.push({in:e.build.lib.entry,out:t()}):Array.isArray(e.build.lib.entry)?e.build.lib.entry.forEach((i,u)=>l.push({in:i,out:t(`${u}`)})):Object.entries(e.build.lib.entry).forEach(([i,u])=>l.push({in:u,out:t(i)}))}o.outDir=e.build.outDir},closeBundle(){const e=n.length.toString();this.environment.logger.info(`
|
|
2
|
+
${a.green("✓")} ${e} declaration bundles generated.`);const r=Math.max(...n.map(i=>i.outFile.length)),t={maximumFractionDigits:2,minimumFractionDigits:2};n.forEach(i=>this.environment.logger.info(a.dim(`${o.outDir}`)+a.cyan(i.outFile.replace(o.outDir??"",""))+" ".repeat(r-i.outFile.length+2)+a.gray(`${(i.size/1e3).toLocaleString("en",t)} kB`)+a.dim(` │ gzip: ${(i.compressedSize/1e3).toLocaleString("en",t)} kB`)))}}}};exports.unpluginFactory=d;
|
package/dist/factory.es.js
CHANGED
|
@@ -1,67 +1,112 @@
|
|
|
1
1
|
import { Buffer as c } from "node:buffer";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { generateDtsBundle as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
default: t
|
|
10
|
-
}) : Array.isArray(t) ? t.forEach((r) => {
|
|
11
|
-
Object.assign(i, {
|
|
12
|
-
[m.basename(r, m.extname(r))]: r
|
|
13
|
-
});
|
|
14
|
-
}) : Object.assign(i, t);
|
|
15
|
-
}, z = (i) => {
|
|
16
|
-
const t = [], r = {}, s = {}, g = typeof i.fileName == "string" ? () => i.fileName : i.fileName;
|
|
2
|
+
import m from "node:fs";
|
|
3
|
+
import f from "node:path";
|
|
4
|
+
import h from "node:zlib";
|
|
5
|
+
import { generateDtsBundle as g } from "dts-bundle-generator";
|
|
6
|
+
import a from "picocolors";
|
|
7
|
+
const F = (s) => {
|
|
8
|
+
const n = {}, o = [], l = [];
|
|
17
9
|
return {
|
|
18
10
|
name: "unplugin-dts-bundle-generator",
|
|
19
11
|
buildEnd() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
size: c.byteLength(o)
|
|
12
|
+
l.forEach((e) => o.push({
|
|
13
|
+
entryPointConfig: {
|
|
14
|
+
filePath: e.in,
|
|
15
|
+
libraries: s.libraries,
|
|
16
|
+
output: s.output
|
|
17
|
+
},
|
|
18
|
+
outFile: e.out,
|
|
19
|
+
size: -1,
|
|
20
|
+
compressedSize: -1
|
|
30
21
|
}));
|
|
31
22
|
},
|
|
32
23
|
writeBundle() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
o.forEach((e, r) => {
|
|
25
|
+
if (e.size === -1) {
|
|
26
|
+
const t = g([e.entryPointConfig], s.compilation)[0];
|
|
27
|
+
m.writeFileSync(e.outFile, t), o[r].size = c.byteLength(t), o[r].compressedSize = h.gzipSync(t).length;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
esbuild: {
|
|
32
|
+
config(e) {
|
|
33
|
+
if (!e.entryPoints)
|
|
34
|
+
return;
|
|
35
|
+
const r = s, t = typeof e.entryPoints == "string" ? [e.entryPoints] : Array.isArray(e.entryPoints) ? e.entryPoints : Object.values(e.entryPoints);
|
|
36
|
+
t.length === 1 && (r.outfile || e.outfile) ? l[0] = {
|
|
37
|
+
in: typeof t[0] == "string" ? t[0] : t[0].in,
|
|
38
|
+
out: r.outfile || e.outfile
|
|
39
|
+
} : t.map(
|
|
40
|
+
(i) => typeof i != "string" ? i : {
|
|
41
|
+
in: i,
|
|
42
|
+
out: f.basename(i).split(".")[0]
|
|
43
|
+
}
|
|
44
|
+
).forEach((i) => {
|
|
45
|
+
l.push({
|
|
46
|
+
in: i.in,
|
|
47
|
+
out: `${e.outdir}/${i.out}.d.ts`
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
},
|
|
38
52
|
rollup: {
|
|
39
53
|
buildStart(e) {
|
|
40
|
-
|
|
54
|
+
Array.isArray(e.input) ? e.input.length === 1 ? e.input.forEach((r, t) => l.push({
|
|
55
|
+
in: r,
|
|
56
|
+
out: n.outFile ?? `${t}`
|
|
57
|
+
})) : e.input.forEach((r, t) => l.push({
|
|
58
|
+
in: r,
|
|
59
|
+
out: n.outDir ? `${n.outDir}/${f.basename(r).split(".")[0]}.d.ts` : `${t}`
|
|
60
|
+
})) : Object.entries(e.input).forEach(([r, t]) => l.push({
|
|
61
|
+
in: t,
|
|
62
|
+
out: n.outDir ? `${n.outDir}/${f.basename(t).split(".")[0]}.d.ts` : r
|
|
63
|
+
}));
|
|
41
64
|
},
|
|
42
65
|
outputOptions(e) {
|
|
43
|
-
|
|
66
|
+
if (o.length === 0) {
|
|
67
|
+
n.outFile = e.file, n.outDir = e.dir;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const r = s;
|
|
71
|
+
o.length === 1 && (r.file || e.file) ? o[0].outFile = r.file ?? e.file.replace(/\.js$/, ".d.ts") : o.forEach((t, i) => {
|
|
72
|
+
const u = `${f.basename(t.entryPointConfig.filePath).split(".")[0]}.d.ts`;
|
|
73
|
+
o[i].outFile = `${e.dir}/${u}`;
|
|
74
|
+
});
|
|
44
75
|
}
|
|
45
76
|
},
|
|
46
77
|
vite: {
|
|
47
78
|
configResolved(e) {
|
|
48
|
-
|
|
79
|
+
const r = s;
|
|
80
|
+
if (e.build.lib) {
|
|
81
|
+
const t = (i = "default") => typeof r.fileName == "string" ? `${e.build.outDir}/${r.fileName}` : `${e.build.outDir}/${r.fileName(i)}`;
|
|
82
|
+
typeof e.build.lib.entry == "string" ? l.push({
|
|
83
|
+
in: e.build.lib.entry,
|
|
84
|
+
out: t()
|
|
85
|
+
}) : Array.isArray(e.build.lib.entry) ? e.build.lib.entry.forEach((i, u) => l.push({
|
|
86
|
+
in: i,
|
|
87
|
+
out: t(`${u}`)
|
|
88
|
+
})) : Object.entries(e.build.lib.entry).forEach(([i, u]) => l.push({
|
|
89
|
+
in: u,
|
|
90
|
+
out: t(i)
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
n.outDir = e.build.outDir;
|
|
49
94
|
},
|
|
50
95
|
closeBundle() {
|
|
51
|
-
const e =
|
|
96
|
+
const e = o.length.toString();
|
|
52
97
|
this.environment.logger.info(`
|
|
53
|
-
${
|
|
54
|
-
const o = {
|
|
98
|
+
${a.green("✓")} ${e} declaration bundles generated.`);
|
|
99
|
+
const r = Math.max(...o.map((i) => i.outFile.length)), t = {
|
|
55
100
|
maximumFractionDigits: 2,
|
|
56
101
|
minimumFractionDigits: 2
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
102
|
+
};
|
|
103
|
+
o.forEach((i) => this.environment.logger.info(
|
|
104
|
+
a.dim(`${n.outDir}`) + a.cyan(i.outFile.replace(n.outDir ?? "", "")) + " ".repeat(r - i.outFile.length + 2) + a.gray(`${(i.size / 1e3).toLocaleString("en", t)} kB`) + a.dim(` │ gzip: ${(i.compressedSize / 1e3).toLocaleString("en", t)} kB`)
|
|
60
105
|
));
|
|
61
106
|
}
|
|
62
107
|
}
|
|
63
108
|
};
|
|
64
109
|
};
|
|
65
110
|
export {
|
|
66
|
-
|
|
111
|
+
F as u
|
|
67
112
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("unplugin"),o=require("./factory.cjs.js"),r=n.createRolldownPlugin(o.unpluginFactory);module.exports=r;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CompilationOptions, EntryPointConfig } from 'dts-bundle-generator';
|
|
2
|
+
|
|
3
|
+
export interface DtsBundleGeneratorOptions {
|
|
4
|
+
output?: EntryPointConfig["output"];
|
|
5
|
+
libraries?: EntryPointConfig["libraries"];
|
|
6
|
+
compilation?: CompilationOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface OptionsForRolldown extends DtsBundleGeneratorOptions {
|
|
9
|
+
file?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: (options: OptionsForRolldown) => any;
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
_default as default,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {};
|
package/dist/rollup.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CompilationOptions, EntryPointConfig } from 'dts-bundle-generator';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
fileName: string | ((entryName: string) => string);
|
|
3
|
+
export interface DtsBundleGeneratorOptions {
|
|
5
4
|
output?: EntryPointConfig["output"];
|
|
6
5
|
libraries?: EntryPointConfig["libraries"];
|
|
7
6
|
compilation?: CompilationOptions;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
export interface OptionsForRollup extends DtsBundleGeneratorOptions {
|
|
9
|
+
file?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: (options: OptionsForRollup) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
10
12
|
|
|
11
13
|
export {
|
|
12
14
|
_default as default,
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CompilationOptions, EntryPointConfig } from 'dts-bundle-generator';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
fileName: string | ((entryName: string) => string);
|
|
3
|
+
export interface DtsBundleGeneratorOptions {
|
|
5
4
|
output?: EntryPointConfig["output"];
|
|
6
5
|
libraries?: EntryPointConfig["libraries"];
|
|
7
6
|
compilation?: CompilationOptions;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
export interface OptionsForVite extends DtsBundleGeneratorOptions {
|
|
9
|
+
fileName: string | ((entryName: string) => string);
|
|
10
|
+
}
|
|
11
|
+
declare const _default: (options: OptionsForVite) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
|
10
12
|
|
|
11
13
|
export {
|
|
12
14
|
_default as default,
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-dts-bundle-generator",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "DTS bundle generator for Unplugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unplugin",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"esbuild",
|
|
8
|
+
"rolldown",
|
|
9
9
|
"rollup",
|
|
10
|
+
"vite",
|
|
10
11
|
"dts",
|
|
11
12
|
"bundle",
|
|
12
13
|
"typescript"
|
|
13
14
|
],
|
|
14
|
-
"repository":
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/f-lawe/unplugin-dts-bundle-generator.git"
|
|
18
|
+
},
|
|
15
19
|
"license": "MIT",
|
|
16
20
|
"author": "François Lavaud-Wernert <francois@lavaud.family>",
|
|
17
21
|
"type": "module",
|
|
@@ -21,6 +25,16 @@
|
|
|
21
25
|
"import": "./dist/dts-bundle-generator.es.js",
|
|
22
26
|
"require": "./dist/dts-bundle-generator.cjs.js"
|
|
23
27
|
},
|
|
28
|
+
"./esbuild": {
|
|
29
|
+
"types": "./dist/esbuild.d.ts",
|
|
30
|
+
"import": "./dist/esbuild.es.js",
|
|
31
|
+
"require": "./dist/esbuild.cjs.js"
|
|
32
|
+
},
|
|
33
|
+
"./rolldown": {
|
|
34
|
+
"types": "./dist/rolldown.d.ts",
|
|
35
|
+
"import": "./dist/rolldown.es.js",
|
|
36
|
+
"require": "./dist/rolldown.cjs.js"
|
|
37
|
+
},
|
|
24
38
|
"./rollup": {
|
|
25
39
|
"types": "./dist/rollup.d.ts",
|
|
26
40
|
"import": "./dist/rollup.es.js",
|
|
@@ -37,13 +51,14 @@
|
|
|
37
51
|
"source": "src/index.ts",
|
|
38
52
|
"types": "dist/dts-bundle-generator.d.ts",
|
|
39
53
|
"scripts": {
|
|
40
|
-
"build": "
|
|
41
|
-
"build:rollup": "npm run build:vite & rollup --config rollup.config.ts",
|
|
42
|
-
"build:vite": "vite build",
|
|
54
|
+
"build": "vite build",
|
|
43
55
|
"clean": "rimraf dist",
|
|
44
56
|
"lint": "eslint . --fix && sort-package-json",
|
|
45
57
|
"lint:ci": "eslint . && sort-package-json --check",
|
|
46
58
|
"prepack": "npm run clean && npm run build",
|
|
59
|
+
"test:esbuild": "npm run build & rimraf dist-esbuild & node ./test/esbuild.config.ts",
|
|
60
|
+
"test:rolldown": "npm run build & rimraf dist-rollup & rolldown --config ./test/rollup.config.ts",
|
|
61
|
+
"test:rollup": "npm run build & rimraf dist-rollup & rollup --config ./test/rollup.config.ts",
|
|
47
62
|
"typecheck": "tsc --noEmit",
|
|
48
63
|
"typecheck:ci": "tsc --noEmit",
|
|
49
64
|
"watch": "vite build --watch"
|
|
@@ -58,11 +73,12 @@
|
|
|
58
73
|
"@nuxt/schema": "^3.17.4",
|
|
59
74
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
60
75
|
"@types/node": "^24.0.4",
|
|
76
|
+
"esbuild": "^0.25.8",
|
|
61
77
|
"eslint": "^9.12.0",
|
|
62
78
|
"jiti": "^2.4.2",
|
|
63
79
|
"rimraf": "^6.0.1",
|
|
80
|
+
"rolldown": "^1.0.0-beta.32",
|
|
64
81
|
"rollup": "^4.41.0",
|
|
65
|
-
"rollup-plugin-node-externals": "^8.0.0",
|
|
66
82
|
"sort-package-json": "^3.3.1",
|
|
67
83
|
"tslib": "^2.8.1",
|
|
68
84
|
"typescript": "^5.0.2",
|