tsdown 0.6.6 → 0.6.7
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/config.d.ts +1 -1
- package/dist/{dts-DuyYOCuS.js → dts-Df2nwp_8.js} +15 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{migrate-Y0DZZqeT.js → migrate-DKlBgcvw.js} +1 -1
- package/dist/{options.d-D2X9ak47.d.ts → options.d-CLfwY926.d.ts} +2 -1
- package/dist/package-DFHU_6-V.js +6 -0
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +1 -1
- package/dist/run.js +2 -2
- package/package.json +1 -1
- package/dist/package-Dga7uLAE.js +0 -6
package/dist/config.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ function getTempDtsDir(format) {
|
|
|
101
101
|
return `${TEMP_DTS_DIR}-${format}`;
|
|
102
102
|
}
|
|
103
103
|
async function bundleDts(options, jsExtension, format, pkg) {
|
|
104
|
+
const { dts, bundleDts: bundleDts$1 } = options;
|
|
104
105
|
const ext = jsExtension.replace("j", "t");
|
|
105
106
|
const dtsOutDir = path.resolve(options.outDir, getTempDtsDir(format));
|
|
106
107
|
const dtsEntry = Object.fromEntries(Object.keys(options.entry).map((key) => [key, path.resolve(dtsOutDir, `${key}.d.${ext}`)]));
|
|
@@ -112,9 +113,9 @@ async function bundleDts(options, jsExtension, format, pkg) {
|
|
|
112
113
|
},
|
|
113
114
|
plugins: [
|
|
114
115
|
ExternalPlugin(options, pkg),
|
|
115
|
-
|
|
116
|
+
bundleDts$1.resolve && ResolveDtsPlugin(bundleDts$1.resolve !== true ? bundleDts$1.resolve : void 0),
|
|
116
117
|
DtsPlugin({ compilerOptions: {
|
|
117
|
-
...
|
|
118
|
+
...bundleDts$1.compilerOptions,
|
|
118
119
|
declaration: true,
|
|
119
120
|
noEmit: false,
|
|
120
121
|
emitDeclarationOnly: true,
|
|
@@ -128,7 +129,7 @@ async function bundleDts(options, jsExtension, format, pkg) {
|
|
|
128
129
|
]
|
|
129
130
|
});
|
|
130
131
|
let outDir = options.outDir;
|
|
131
|
-
const extraOutdir =
|
|
132
|
+
const extraOutdir = dts.extraOutdir;
|
|
132
133
|
if (extraOutdir) outDir = path.resolve(outDir, extraOutdir);
|
|
133
134
|
await build.write({
|
|
134
135
|
dir: outDir,
|
|
@@ -138,7 +139,7 @@ async function bundleDts(options, jsExtension, format, pkg) {
|
|
|
138
139
|
await fsRemove(dtsOutDir);
|
|
139
140
|
}
|
|
140
141
|
let resolver;
|
|
141
|
-
function ResolveDtsPlugin() {
|
|
142
|
+
function ResolveDtsPlugin(resolveOnly) {
|
|
142
143
|
return {
|
|
143
144
|
name: "resolve-dts",
|
|
144
145
|
buildStart() {
|
|
@@ -157,6 +158,16 @@ function ResolveDtsPlugin() {
|
|
|
157
158
|
async resolveId(id, importer) {
|
|
158
159
|
if (id[0] === "." || path.isAbsolute(id)) return;
|
|
159
160
|
if (/\0/.test(id)) return;
|
|
161
|
+
if (resolveOnly) {
|
|
162
|
+
const shouldResolve = resolveOnly.some((value) => {
|
|
163
|
+
if (typeof value === "string") return value === id;
|
|
164
|
+
return value.test(id);
|
|
165
|
+
});
|
|
166
|
+
if (!shouldResolve) {
|
|
167
|
+
debug("skipped by matching resolveOnly: %s", id);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
160
171
|
const directory = importer ? path.dirname(importer) : process.cwd();
|
|
161
172
|
debug("Resolving:", id, "from:", directory);
|
|
162
173
|
const { path: resolved } = await resolver.async(directory, id);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options, R as ResolvedOptions } from './options.d-
|
|
2
|
-
export { U as UserConfig } from './options.d-
|
|
1
|
+
import { O as Options, R as ResolvedOptions } from './options.d-CLfwY926.js';
|
|
2
|
+
export { U as UserConfig } from './options.d-CLfwY926.js';
|
|
3
3
|
import { ConsolaInstance } from 'consola';
|
|
4
4
|
export { defineConfig } from './config.js';
|
|
5
5
|
import 'publint';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineConfig } from "./config-0LDjKwZ7.js";
|
|
2
|
-
import { ExternalPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray } from "./dts-
|
|
2
|
+
import { ExternalPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray } from "./dts-Df2nwp_8.js";
|
|
3
3
|
import { debug, logger, setSilent } from "./logger-9p9U7Sx7.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
@@ -17,7 +17,8 @@ type Arrayable<T> = T | T[];
|
|
|
17
17
|
|
|
18
18
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
19
19
|
interface BundleDtsOptions {
|
|
20
|
-
|
|
20
|
+
/** Resolve external types used in dts files from node_modules */
|
|
21
|
+
resolve?: boolean | (string | RegExp)[];
|
|
21
22
|
compilerOptions?: CompilerOptions;
|
|
22
23
|
}
|
|
23
24
|
/**
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedOptions } from './options.d-
|
|
1
|
+
import { R as ResolvedOptions } from './options.d-CLfwY926.js';
|
|
2
2
|
import { PackageJson } from 'pkg-types';
|
|
3
3
|
import { Plugin } from 'rolldown';
|
|
4
4
|
import { Plugin as Plugin$1 } from 'rollup';
|
|
@@ -9,6 +9,6 @@ import 'unplugin-unused';
|
|
|
9
9
|
|
|
10
10
|
declare function ExternalPlugin(options: ResolvedOptions, pkg?: PackageJson): Plugin;
|
|
11
11
|
|
|
12
|
-
declare function ResolveDtsPlugin(): Plugin$1;
|
|
12
|
+
declare function ResolveDtsPlugin(resolveOnly?: Array<string | RegExp>): Plugin$1;
|
|
13
13
|
|
|
14
14
|
export { ExternalPlugin, ResolveDtsPlugin };
|
package/dist/plugins.js
CHANGED
package/dist/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger, setSilent } from "./logger-9p9U7Sx7.js";
|
|
2
|
-
import { version } from "./package-
|
|
2
|
+
import { version } from "./package-DFHU_6-V.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { VERSION } from "rolldown";
|
|
5
5
|
import { dim } from "ansis";
|
|
@@ -16,7 +16,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
|
|
|
16
16
|
await build$1(flags);
|
|
17
17
|
});
|
|
18
18
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
19
|
-
const { migrate } = await import("./migrate-
|
|
19
|
+
const { migrate } = await import("./migrate-DKlBgcvw.js");
|
|
20
20
|
await migrate(args);
|
|
21
21
|
});
|
|
22
22
|
async function runCLI() {
|
package/package.json
CHANGED