tsdown 0.4.3 → 0.4.4
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 +1 -1
- package/dist/index.js +3 -3
- package/dist/run.js +1 -1
- package/esm-shims.js +9 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { logger } from "./utils/logger.js";
|
|
|
4
4
|
* Build with tsdown.
|
|
5
5
|
*/
|
|
6
6
|
export declare function build(userOptions?: Omit<Options, "silent">): Promise<void>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const pkgRoot: string;
|
|
8
8
|
/**
|
|
9
9
|
* Build a single configuration, without watch and shortcuts features.
|
|
10
10
|
*
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,7 @@ function resolveOutputExtension(pkg, format) {
|
|
|
88
88
|
//#region src/features/shims.ts
|
|
89
89
|
function getShimsInject(format, platform) {
|
|
90
90
|
if (format === "es" && platform === "node") {
|
|
91
|
-
const shimFile = path$3.resolve(
|
|
91
|
+
const shimFile = path$3.resolve(pkgRoot, "esm-shims.js");
|
|
92
92
|
return {
|
|
93
93
|
__dirname: [shimFile, "__dirname"],
|
|
94
94
|
__filename: [shimFile, "__filename"]
|
|
@@ -322,7 +322,7 @@ else debug("No config file found");
|
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
325
|
-
const
|
|
325
|
+
const pkgRoot = path.resolve(dirname, "..");
|
|
326
326
|
async function buildSingle(resolved) {
|
|
327
327
|
const { entry, external, plugins: userPlugins, outDir, format, clean, platform, alias, treeshake, sourcemap, dts, minify, watch, unused, target, define, shims, onSuccess } = resolved;
|
|
328
328
|
if (clean) await cleanOutDir(outDir, clean);
|
|
@@ -382,4 +382,4 @@ function defineConfig(options) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
//#endregion
|
|
385
|
-
export {
|
|
385
|
+
export { build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/run.js
CHANGED
package/esm-shims.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Shim globals in esm bundle
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
const getFilename = () => fileURLToPath(import.meta.url)
|
|
6
|
+
const getDirname = () => path.dirname(getFilename())
|
|
7
|
+
|
|
8
|
+
export const __dirname = /* @__PURE__ */ getDirname()
|
|
9
|
+
export const __filename = /* @__PURE__ */ getFilename()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "An even faster bundler powered by Rolldown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"author": "三咲智子 Kevin Deng <sxzz@sxzz.moe>",
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"esm-shims.js"
|
|
18
19
|
],
|
|
19
20
|
"main": "./dist/index.js",
|
|
20
21
|
"module": "./dist/index.js",
|