create-tsdown 0.0.3 → 0.15.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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2025-present VoidZero Inc. & Contributors
4
- Copyright (c) 2024 三咲智子 Kevin Deng (https://github.com/sxzz)
4
+ Copyright (c) 2024 Kevin Deng (https://github.com/sxzz)
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,18 @@
1
+ //#region src/index.d.ts
2
+ interface Options {
3
+ template?: "default" | "minimal" | "vue" | "react" | "solid";
4
+ path?: string;
5
+ }
6
+ type ResolvedOptions = Required<Options>;
7
+ /**
8
+ * Create a tsdown project.
9
+ */
10
+ declare function create(path: string | undefined, options: Options): Promise<void>;
11
+ /**
12
+ * Resolve the user options and configs
13
+ * @param options The user options
14
+ * @returns The resolved options
15
+ */
16
+ declare function resolveOptions(options: Options): Promise<ResolvedOptions>;
17
+ //#endregion
18
+ export { Options, ResolvedOptions, create, resolveOptions };
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { create, resolveOptions } from "./src-B4P8WTtN.mjs";
2
+
3
+ export { create, resolveOptions };
package/dist/run.mjs ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { create } from "./src-B4P8WTtN.mjs";
3
+ import process from "node:process";
4
+ import { log } from "@clack/prompts";
5
+ import { cac } from "cac";
6
+
7
+ //#region package.json
8
+ var version = "0.15.7";
9
+
10
+ //#endregion
11
+ //#region src/cli.ts
12
+ const cli = cac("create-tsdown");
13
+ cli.help().version(version);
14
+ cli.command("[path]", "Create a tsdown project", {
15
+ ignoreOptionDefaultValue: true,
16
+ allowUnknownOptions: true
17
+ }).option("-t, --template <template>", "Available templates: default, minimal, vue, react, solid", { default: "default" }).action((path, options) => create(path, options));
18
+ async function runCLI() {
19
+ cli.parse(process.argv, { run: false });
20
+ try {
21
+ await cli.runMatchedCommand();
22
+ } catch (error) {
23
+ log.error(String(error));
24
+ process.exit(1);
25
+ }
26
+ }
27
+
28
+ //#endregion
29
+ //#region src/run.ts
30
+ runCLI();
31
+
32
+ //#endregion
33
+ export { };
@@ -0,0 +1,90 @@
1
+ import process from "node:process";
2
+ import { styleText } from "node:util";
3
+ import { cancel, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
4
+ import { downloadTemplate } from "giget";
5
+ import { getUserAgent } from "package-manager-detector";
6
+
7
+ //#region src/index.ts
8
+ /**
9
+ * Create a tsdown project.
10
+ */
11
+ async function create(path, options) {
12
+ intro(`Creating a tsdown project...`);
13
+ const resolved = await resolveOptions({
14
+ ...options,
15
+ path
16
+ });
17
+ const s = spinner();
18
+ s.start("Cloning the template...");
19
+ await downloadTemplate(`gh:sxzz/tsdown-templates/${resolved.template}`, { dir: resolved.path });
20
+ s.stop("Template cloned");
21
+ const pm = getUserAgent() || "npm";
22
+ outro(`Done! Now run:\n ${styleText("green", `cd ${resolved.path}`)}\n ${styleText("green", `${pm} install`)}\n ${styleText("green", `${pm} run build`)}\n\nFor more information, visit: ${styleText("underline", `https://tsdown.dev/`)}`);
23
+ }
24
+ /**
25
+ * Resolve the user options and configs
26
+ * @param options The user options
27
+ * @returns The resolved options
28
+ */
29
+ async function resolveOptions(options) {
30
+ let path = options.path;
31
+ if (!path) {
32
+ const defaultPath = "./my-tsdown-package";
33
+ path = await text({
34
+ message: "What is the name of your package?",
35
+ placeholder: defaultPath
36
+ }) || defaultPath;
37
+ if (isCancel(path)) {
38
+ cancel("Operation cancelled.");
39
+ process.exit(1);
40
+ }
41
+ }
42
+ let template = options.template;
43
+ if (template) {
44
+ if (![
45
+ "default",
46
+ "minimal",
47
+ "vue",
48
+ "react",
49
+ "solid"
50
+ ].includes(template)) throw new Error(`Invalid template "${template}". Available templates: default, vue, react, solid`);
51
+ } else {
52
+ template = await select({
53
+ message: "Which template do you want to use?",
54
+ options: [
55
+ {
56
+ value: "default",
57
+ label: "Default"
58
+ },
59
+ {
60
+ value: "minimal",
61
+ label: "Minimal"
62
+ },
63
+ {
64
+ value: "vue",
65
+ label: "Vue"
66
+ },
67
+ {
68
+ value: "react",
69
+ label: "React"
70
+ },
71
+ {
72
+ value: "solid",
73
+ label: "Solid"
74
+ }
75
+ ],
76
+ initialValue: "default"
77
+ });
78
+ if (isCancel(template)) {
79
+ cancel("Operation cancelled.");
80
+ process.exit(1);
81
+ }
82
+ }
83
+ return {
84
+ path,
85
+ template
86
+ };
87
+ }
88
+
89
+ //#endregion
90
+ export { create, resolveOptions };
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "create-tsdown",
3
- "version": "0.0.3",
4
- "description": "The Elegant Bundler for Libraries",
3
+ "version": "0.15.7",
4
+ "description": "Create a new tsdown project",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "homepage": "https://github.com/Gugustinette/create-tsdown#readme",
7
+ "homepage": "https://github.com/rolldown/tsdown/tree/main/packages/create#readme",
8
8
  "bugs": {
9
- "url": "https://github.com/Gugustinette/create-tsdown/issues"
9
+ "url": "https://github.com/rolldown/tsdown/issues"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/Gugustinette/create-tsdown.git"
13
+ "url": "git+https://github.com/rolldown/tsdown.git",
14
+ "directory": "packages/create-tsdown"
14
15
  },
15
- "author": "三咲智子 Kevin Deng <sxzz@sxzz.moe>",
16
+ "author": "Kevin Deng <sxzz@sxzz.moe>",
16
17
  "funding": "https://github.com/sponsors/sxzz",
17
18
  "files": [
18
- "dist",
19
- "esm-shims.js"
19
+ "dist"
20
20
  ],
21
- "main": "./dist/index.js",
22
- "module": "./dist/index.js",
23
- "types": "./dist/index.d.ts",
21
+ "main": "./dist/index.mjs",
22
+ "module": "./dist/index.mjs",
23
+ "types": "./dist/index.d.mts",
24
24
  "exports": {
25
- ".": "./dist/index.js",
26
- "./run": "./dist/run.js",
25
+ ".": "./dist/index.mjs",
26
+ "./run": "./dist/run.mjs",
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "typesVersions": {
@@ -35,56 +35,19 @@
35
35
  }
36
36
  },
37
37
  "bin": {
38
- "create-tsdown": "./dist/run.js"
38
+ "create-tsdown": "./dist/run.mjs"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "peerDependencies": {
44
- "typescript": "^5.0.0"
45
- },
46
- "peerDependenciesMeta": {
47
- "typescript": {
48
- "optional": true
49
- }
50
- },
51
43
  "dependencies": {
52
44
  "@clack/prompts": "^0.11.0",
53
- "ansis": "^4.0.0",
54
45
  "cac": "^6.7.14",
55
- "debug": "^4.4.1",
56
- "diff": "^8.0.1",
57
46
  "giget": "^2.0.0",
58
- "rolldown": "1.0.0-beta.9-commit.51df2b7"
59
- },
60
- "devDependencies": {
61
- "@oxc-node/core": "^0.0.27",
62
- "@sxzz/eslint-config": "^7.0.1",
63
- "@sxzz/prettier-config": "^2.2.1",
64
- "@sxzz/test-utils": "^0.5.6",
65
- "@types/debug": "^4.1.12",
66
- "@types/node": "^22.15.21",
67
- "bumpp": "^10.1.1",
68
- "eslint": "^9.27.0",
69
- "prettier": "^3.5.3",
70
- "tsdown": "^0.12.2",
71
- "typescript": "~5.8.3",
72
- "unplugin-unused": "^0.5.0",
73
- "vitest": "^3.1.4"
47
+ "package-manager-detector": "^1.4.0"
74
48
  },
75
49
  "engines": {
76
- "node": ">=18.0.0"
50
+ "node": ">=20.19.0"
77
51
  },
78
- "prettier": "@sxzz/prettier-config",
79
- "scripts": {
80
- "lint": "eslint --cache --max-warnings 0 .",
81
- "lint:fix": "pnpm run lint --fix",
82
- "build": "tsdown",
83
- "dev": "node --import @oxc-node/core/register ./src/run.ts",
84
- "dev:migrate": "node --import @oxc-node/core/register ./src/run.ts migrate --dry-run",
85
- "test": "vitest",
86
- "typecheck": "tsc --noEmit",
87
- "format": "prettier --cache --write .",
88
- "release": "bumpp && pnpm publish"
89
- }
52
+ "scripts": {}
90
53
  }
package/README.md DELETED
@@ -1,29 +0,0 @@
1
- # create-tsdown [![npm](https://img.shields.io/npm/v/create-tsdown.svg)](https://npmjs.com/package/create-tsdown) [![downloads](https://img.shields.io/npm/dm/create-tsdown.svg)](https://npmjs.com/package/create-tsdown) [![Unit Test](https://github.com/gugustinette/create-tsdown/actions/workflows/unit-test.yml/badge.svg)](https://github.com/gugustinette/create-tsdown/actions/workflows/unit-test.yml) [![tsdown-starter-stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/github/rolldown/tsdown-starter-stackblitz)
2
-
3
- **create-tsdown** is the cli tool to create a new project using [tsdown](https://tsdown.dev). It provides a simple and efficient way to set up a TypeScript project with all the necessary configurations and dependencies.
4
-
5
- ## Usage
6
-
7
- ```bash
8
- npm create tsdown@latest
9
- ```
10
-
11
- ## Migrate from tsup
12
-
13
- ```bash
14
- npx create-tsdown@latest migrate
15
- ```
16
-
17
- Please make sure to commit your changes before migrating. For more details, see the [Migration Guide](https://tsdown.dev/guide/migrate-from-tsup).
18
-
19
- ## Sponsors
20
-
21
- <p align="center">
22
- <a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg">
23
- <img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>
24
- </a>
25
- </p>
26
-
27
- ## Licenses
28
-
29
- This project is licensed under the [MIT License](LICENSE).
package/dist/index.d.ts DELETED
@@ -1,47 +0,0 @@
1
- //#region src/utils/types.d.ts
2
- type Overwrite<T, U> = Omit<T, keyof U> & U;
3
- //#endregion
4
- //#region src/options/types.d.ts
5
- /**
6
- * Options for tsdown.
7
- */
8
- interface Options {
9
- /**
10
- * The name of the package.
11
- * @default 'my-package'
12
- */
13
- name?: string;
14
- /**
15
- * The template to use.
16
- * @default 'default'
17
- */
18
- template?: "default" | "minimal" | "vue" | "react" | "solid";
19
- /** @default false */
20
- silent?: boolean;
21
- /** @default false */
22
- debug?: boolean;
23
- }
24
- type ResolvedOptions = Overwrite<Options, {
25
- /**
26
- * The name of the package.
27
- * @default 'my-package'
28
- */
29
- name: string;
30
- /**
31
- * The template to use.
32
- * @default 'default'
33
- */
34
- template: "default" | "minimal" | "vue" | "react" | "solid";
35
- /** @default false */
36
- silent: boolean;
37
- /** @default false */
38
- debug: boolean;
39
- }>;
40
- //#endregion
41
- //#region src/index.d.ts
42
- /**
43
- * Create a tsdown project.
44
- */
45
- declare function create(options: ResolvedOptions): Promise<void>;
46
- //#endregion
47
- export { create };
package/dist/index.js DELETED
@@ -1,14 +0,0 @@
1
- import { logger } from "./logger-0-2qD2tL.js";
2
- import { downloadTemplate } from "giget";
3
-
4
- //#region src/index.ts
5
- /**
6
- * Create a tsdown project.
7
- */
8
- async function create(options) {
9
- if (typeof options.silent === "boolean") logger.setSilent(options.silent);
10
- await downloadTemplate(`gh:gugustinette/create-tsdown/templates/${options.template}`, { dir: options.name });
11
- }
12
-
13
- //#endregion
14
- export { create };
@@ -1,41 +0,0 @@
1
- import { bgRed, bgYellow, blue, green } from "ansis";
2
-
3
- //#region src/utils/general.ts
4
- function toArray(val, defaultValue) {
5
- if (Array.isArray(val)) return val;
6
- else if (val == null) {
7
- if (defaultValue) return [defaultValue];
8
- return [];
9
- } else return [val];
10
- }
11
- function resolveComma(arr) {
12
- return arr.flatMap((format) => format.split(","));
13
- }
14
-
15
- //#endregion
16
- //#region src/utils/logger.ts
17
- var Logger = class {
18
- silent = false;
19
- setSilent(value) {
20
- this.silent = value;
21
- }
22
- filter(...args) {
23
- return args.filter((arg) => arg !== void 0 && arg !== false);
24
- }
25
- info(...args) {
26
- if (!this.silent) console.info(blue`ℹ`, ...this.filter(...args));
27
- }
28
- warn(...args) {
29
- if (!this.silent) console.warn("\n", bgYellow` WARN `, ...this.filter(...args), "\n");
30
- }
31
- error(...args) {
32
- if (!this.silent) console.error("\n", bgRed` ERROR `, ...this.filter(...args), "\n");
33
- }
34
- success(...args) {
35
- if (!this.silent) console.info(green`✔`, ...this.filter(...args));
36
- }
37
- };
38
- const logger = new Logger();
39
-
40
- //#endregion
41
- export { logger, resolveComma, toArray };
@@ -1,104 +0,0 @@
1
- import { logger } from "./logger-0-2qD2tL.js";
2
- import { version } from "./package-2m3xQSHC.js";
3
- import process from "node:process";
4
- import { existsSync } from "node:fs";
5
- import { readFile, unlink, writeFile } from "node:fs/promises";
6
-
7
- //#region src/migrate.ts
8
- async function migrate({ cwd, dryRun }) {
9
- if (dryRun) logger.info("Dry run enabled. No changes were made.");
10
- if (cwd) process.chdir(cwd);
11
- await migratePackageJson(dryRun);
12
- await migrateTsupConfig(dryRun);
13
- }
14
- async function migratePackageJson(dryRun) {
15
- if (!existsSync("package.json")) {
16
- logger.error("No package.json found");
17
- return false;
18
- }
19
- const pkgRaw = await readFile("package.json", "utf-8");
20
- let pkg = JSON.parse(pkgRaw);
21
- const semver = `^${version}`;
22
- let found = false;
23
- if (pkg.dependencies?.tsup) {
24
- logger.info("Migrating `dependencies` to tsdown.");
25
- found = true;
26
- pkg.dependencies = renameKey(pkg.dependencies, "tsup", "tsdown", semver);
27
- }
28
- if (pkg.devDependencies?.tsup) {
29
- logger.info("Migrating `devDependencies` to tsdown.");
30
- found = true;
31
- pkg.devDependencies = renameKey(pkg.devDependencies, "tsup", "tsdown", semver);
32
- }
33
- if (pkg.peerDependencies?.tsup) {
34
- logger.info("Migrating `peerDependencies` to tsdown.");
35
- found = true;
36
- pkg.peerDependencies = renameKey(pkg.peerDependencies, "tsup", "tsdown", "*");
37
- }
38
- if (pkg.scripts) {
39
- for (const key of Object.keys(pkg.scripts)) if (pkg.scripts[key].includes("tsup")) {
40
- logger.info(`Migrating \`${key}\` script to tsdown`);
41
- found = true;
42
- pkg.scripts[key] = pkg.scripts[key].replaceAll(/tsup(?:-node)?/g, "tsdown");
43
- }
44
- }
45
- if (pkg.tsup) {
46
- logger.info("Migrating `tsup` field in package.json to `tsdown`.");
47
- found = true;
48
- pkg = renameKey(pkg, "tsup", "tsdown");
49
- }
50
- if (!found) {
51
- logger.warn("No tsup-related fields found in package.json");
52
- return false;
53
- }
54
- const pkgStr = `${JSON.stringify(pkg, null, 2)}\n`;
55
- if (dryRun) {
56
- const { createPatch } = await import("diff");
57
- logger.info("[dry-run] package.json:");
58
- console.info(createPatch("package.json", pkgRaw, pkgStr));
59
- } else {
60
- await writeFile("package.json", pkgStr);
61
- logger.success("Migrated `package.json`");
62
- }
63
- return true;
64
- }
65
- const TSUP_FILES = [
66
- "tsup.config.ts",
67
- "tsup.config.cts",
68
- "tsup.config.mts",
69
- "tsup.config.js",
70
- "tsup.config.cjs",
71
- "tsup.config.mjs",
72
- "tsup.config.json"
73
- ];
74
- async function migrateTsupConfig(dryRun) {
75
- let found = false;
76
- for (const file of TSUP_FILES) {
77
- if (!existsSync(file)) continue;
78
- logger.info(`Found \`${file}\``);
79
- found = true;
80
- const tsupConfigRaw = await readFile(file, "utf-8");
81
- const tsupConfig = tsupConfigRaw.replaceAll(/\btsup\b/g, "tsdown").replaceAll(/\bTSUP\b/g, "TSDOWN");
82
- const renamed = file.replaceAll("tsup", "tsdown");
83
- if (dryRun) {
84
- const { createTwoFilesPatch } = await import("diff");
85
- logger.info(`[dry-run] ${file} -> ${renamed}:`);
86
- console.info(createTwoFilesPatch(file, renamed, tsupConfigRaw, tsupConfig));
87
- } else {
88
- await writeFile(renamed, tsupConfig, "utf8");
89
- await unlink(file);
90
- logger.success(`Migrated \`${file}\` to \`${renamed}\``);
91
- }
92
- }
93
- if (!found) logger.warn("No tsup config found");
94
- return found;
95
- }
96
- function renameKey(obj, oldKey, newKey, newValue) {
97
- const newObj = {};
98
- for (const key of Object.keys(obj)) if (key === oldKey) newObj[newKey] = newValue || obj[oldKey];
99
- else newObj[key] = obj[key];
100
- return newObj;
101
- }
102
-
103
- //#endregion
104
- export { migrate };
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.0.3";
3
-
4
- //#endregion
5
- export { version };
package/dist/run.js DELETED
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env node
2
- import { logger, resolveComma, toArray } from "./logger-0-2qD2tL.js";
3
- import { version } from "./package-2m3xQSHC.js";
4
- import module from "node:module";
5
- import { green, underline } from "ansis";
6
- import process$1 from "node:process";
7
- import { cancel, confirm, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
8
- import { cac } from "cac";
9
- import debug from "debug";
10
-
11
- //#region src/options/index.ts
12
- const debug$1 = debug("create-tsdown:options");
13
- /**
14
- * Resolve the user options and configs
15
- * @param options The user options
16
- * @returns The resolved options
17
- */
18
- async function resolveOptions(options) {
19
- debug$1("options %O", options);
20
- let resolvedName;
21
- if (options.name !== void 0) resolvedName = options.name;
22
- else resolvedName = await text({
23
- message: "What is the name of your package?",
24
- placeholder: "./my-package",
25
- initialValue: "./my-package"
26
- });
27
- if (isCancel(resolvedName)) {
28
- cancel("Operation cancelled.");
29
- process.exit(0);
30
- }
31
- let resolvedTemplate;
32
- if (options.template !== void 0) {
33
- resolvedTemplate = options.template;
34
- if (![
35
- "default",
36
- "minimal",
37
- "vue",
38
- "react",
39
- "solid"
40
- ].includes(resolvedTemplate)) throw new Error(`Invalid template "${resolvedTemplate}". Available templates: default, vue, react, solid`);
41
- } else resolvedTemplate = await select({
42
- message: "Which template do you want to use?",
43
- options: [
44
- {
45
- value: "default",
46
- label: "Default"
47
- },
48
- {
49
- value: "minimal",
50
- label: "Minimal"
51
- },
52
- {
53
- value: "vue",
54
- label: "Vue"
55
- },
56
- {
57
- value: "react",
58
- label: "React"
59
- },
60
- {
61
- value: "solid",
62
- label: "Solid"
63
- }
64
- ],
65
- initialValue: "default"
66
- });
67
- if (isCancel(resolvedTemplate)) {
68
- cancel("Operation cancelled.");
69
- process.exit(0);
70
- }
71
- const resolvedOptions = {
72
- name: resolvedName,
73
- template: resolvedTemplate,
74
- silent: !!options.silent,
75
- debug: !!options.debug
76
- };
77
- debug$1("resolved configs %O", resolvedOptions);
78
- return resolvedOptions;
79
- }
80
-
81
- //#endregion
82
- //#region src/cli.ts
83
- const cli = cac("create-tsdown");
84
- cli.help().version(version);
85
- cli.command("[...files]", "Create a tsdown project", {
86
- ignoreOptionDefaultValue: true,
87
- allowUnknownOptions: true
88
- }).option("-n, --name <name>", "Name of the package to create", { default: "./my-package" }).option("-t, --template <template>", "Available templates: default, vue, react, solid", { default: "default" }).option("--debug", "Show debug logs").option("--silent", "Suppress non-error logs").action(async (input, options) => {
89
- intro(`tsdown - The Elegant Library Bundler`);
90
- logger.setSilent(!!options.silent);
91
- const resolvedOptions = await resolveOptions(options);
92
- const s = spinner();
93
- s.start("Cloning the template...");
94
- const { create } = await import("./index.js");
95
- if (input.length > 0) options.name = input[0];
96
- await create(resolvedOptions);
97
- s.stop("Template cloned");
98
- outro(`Done! Now run:\n ${green`cd ${resolvedOptions.name}`}\n ${green`npm install`}\n ${green`npm run build`}\n\nFor more information, visit: ${underline`https://tsdown.dev/`}`);
99
- });
100
- cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
101
- intro(`Starting migration from tsup to tsdown`);
102
- const shouldContinue = await confirm({ message: `Before proceeding, review the migration guide at ${underline`https://tsdown.dev/guide/migrate-from-tsup`}, as this process will modify your files.\nUncommitted changes will be lost. Use the ${green`--dry-run`} flag to preview changes without applying them.` });
103
- if (isCancel(shouldContinue)) {
104
- cancel("Migration cancelled.");
105
- process$1.exit(0);
106
- }
107
- if (!shouldContinue) {
108
- outro("Migration cancelled.");
109
- process$1.exit(0);
110
- }
111
- const s = spinner();
112
- s.start("Migrating from tsup to tsdown...");
113
- const { migrate } = await import("./migrate-PAss8O89.js");
114
- await migrate({
115
- cwd: args.cwd,
116
- dryRun: !!args.dryRun
117
- });
118
- s.stop();
119
- outro(`Migration completed!`);
120
- });
121
- async function runCLI() {
122
- cli.parse(process$1.argv, { run: false });
123
- if (cli.options.debug) {
124
- let namespace;
125
- if (cli.options.debug === true) namespace = "tsdown:*";
126
- else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
127
- const enabled = debug.disable();
128
- if (enabled) namespace += `,${enabled}`;
129
- debug.enable(namespace);
130
- debug("tsdown:debug")("Debugging enabled", namespace);
131
- }
132
- try {
133
- await cli.runMatchedCommand();
134
- } catch (error) {
135
- logger.error(error);
136
- process$1.exit(1);
137
- }
138
- }
139
-
140
- //#endregion
141
- //#region src/run.ts
142
- try {
143
- module.enableCompileCache?.();
144
- } catch {}
145
- runCLI();
146
-
147
- //#endregion
package/esm-shims.js DELETED
@@ -1,9 +0,0 @@
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()
File without changes