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 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 assetsDir: string;
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(assetsDir, "esm-shims.js");
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 assetsDir = path.resolve(dirname, "../assets");
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 { assetsDir, build, buildSingle, defineConfig, logger };
385
+ export { build, buildSingle, defineConfig, logger, pkgRoot };
package/dist/run.js CHANGED
@@ -5,7 +5,7 @@ import pc from "picocolors";
5
5
  import { cac } from "cac";
6
6
 
7
7
  //#region package.json
8
- var version = "0.4.3";
8
+ var version = "0.4.4";
9
9
 
10
10
  //#endregion
11
11
  //#region src/cli.ts
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",
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",