@rzl-zone/build-tools 0.0.13 → 0.0.14-beta.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/dist/.references/index.d.cts +1 -1
- package/dist/.references/index.d.ts +1 -1
- package/dist/bundler/rolldown.cjs +2 -2
- package/dist/bundler/rolldown.d.cts +2 -2
- package/dist/bundler/rolldown.d.ts +2 -2
- package/dist/bundler/rolldown.js +1 -1
- package/dist/bundler/tsdown.cjs +4 -4
- package/dist/bundler/tsdown.cjs.map +1 -1
- package/dist/bundler/tsdown.d.cts +8 -10
- package/dist/bundler/tsdown.d.ts +8 -10
- package/dist/bundler/tsdown.js +4 -4
- package/dist/bundler/tsdown.js.map +1 -1
- package/dist/bundler/utils.cjs +2 -2
- package/dist/bundler/utils.d.cts +2 -2
- package/dist/bundler/utils.d.ts +2 -2
- package/dist/bundler/utils.js +2 -2
- package/dist/{client-DowGlRm4.cjs → client-CUiclOap.cjs} +3 -3
- package/dist/{client-DowGlRm4.cjs.map → client-CUiclOap.cjs.map} +1 -1
- package/dist/{client-DgQRjdo8.js → client-DXv1TyTC.js} +3 -3
- package/dist/{client-DgQRjdo8.js.map → client-DXv1TyTC.js.map} +1 -1
- package/dist/commander-kit/index.cjs +5 -5
- package/dist/commander-kit/index.cjs.map +1 -1
- package/dist/commander-kit/index.d.cts +3 -3
- package/dist/commander-kit/index.d.ts +3 -3
- package/dist/commander-kit/index.js +5 -5
- package/dist/commander-kit/index.js.map +1 -1
- package/dist/{extra-B0cm-axJ.d.ts → extra-haYf2y7g.d.cts} +2 -2
- package/dist/{extra-B0cm-axJ.d.cts → extra-haYf2y7g.d.ts} +2 -2
- package/dist/{fast-globe-options-CUaH5spu.d.ts → fast-globe-options-DiPYSmWl.d.ts} +96 -4
- package/dist/{fast-globe-options-DXVzXC8B.d.cts → fast-globe-options-Dr-w8Myw.d.cts} +96 -4
- package/dist/{formatter-BFgV1HhV.js → formatter-BK-4zd0G.js} +2 -2
- package/dist/{formatter-BFgV1HhV.js.map → formatter-BK-4zd0G.js.map} +1 -1
- package/dist/{formatter-C-Yt_Gvf.cjs → formatter-DkpMt0A4.cjs} +2 -2
- package/dist/{formatter-C-Yt_Gvf.cjs.map → formatter-DkpMt0A4.cjs.map} +1 -1
- package/dist/{identity-8Wy_JtzU.cjs → identity-BHNQH-bO.cjs} +5 -5
- package/dist/{identity-8Wy_JtzU.cjs.map → identity-BHNQH-bO.cjs.map} +1 -1
- package/dist/{identity-DPB1Qgy4.js → identity-BUYu2Hfa.js} +5 -5
- package/dist/{identity-DPB1Qgy4.js.map → identity-BUYu2Hfa.js.map} +1 -1
- package/dist/{index-8QVWHQzC.d.cts → index-BU6nzu6M.d.cts} +2 -2
- package/dist/{index-8QVWHQzC.d.ts → index-BU6nzu6M.d.ts} +2 -2
- package/dist/{index-CyGIoXau.d.ts → index-D5uQ7OdQ.d.cts} +3 -3
- package/dist/{index-CyGIoXau.d.cts → index-D5uQ7OdQ.d.ts} +3 -3
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -37
- package/dist/index.d.ts +13 -37
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{package-banner-BjakxfTu.js → package-banner-BDtg5TtW.js} +4 -4
- package/dist/{package-banner-BjakxfTu.js.map → package-banner-BDtg5TtW.js.map} +1 -1
- package/dist/{package-banner-Cf5uu-7p.cjs → package-banner-CHj1ji3Y.cjs} +4 -4
- package/dist/{package-banner-Cf5uu-7p.cjs.map → package-banner-CHj1ji3Y.cjs.map} +1 -1
- package/dist/{server-B1jiYLZq.js → server-BM7JNptE.js} +3 -3
- package/dist/{server-B1jiYLZq.js.map → server-BM7JNptE.js.map} +1 -1
- package/dist/{server-BRuKWcjy.cjs → server-BszV1phk.cjs} +3 -3
- package/dist/{server-BRuKWcjy.cjs.map → server-BszV1phk.cjs.map} +1 -1
- package/dist/utils/client.cjs +3 -3
- package/dist/utils/client.d.cts +1 -1
- package/dist/utils/client.d.ts +1 -1
- package/dist/utils/client.js +3 -3
- package/dist/utils/server.cjs +2 -2
- package/dist/utils/server.d.cts +3 -3
- package/dist/utils/server.d.ts +3 -3
- package/dist/utils/server.js +2 -2
- package/package.json +15 -15
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
12
12
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
13
|
-
const require_formatter = require('../formatter-
|
|
13
|
+
const require_formatter = require('../formatter-DkpMt0A4.cjs');
|
|
14
14
|
const require_bundler_utils = require('./utils.cjs');
|
|
15
15
|
require("@rzl-zone/node-only");
|
|
16
16
|
let rolldown = require("rolldown");
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { i as NonUndefined } from "../extra-
|
|
11
|
+
import { i as NonUndefined } from "../extra-haYf2y7g.cjs";
|
|
12
12
|
import * as _rolldown from "rolldown";
|
|
13
13
|
import * as _rolldownPlugin from "rolldown/plugins";
|
|
14
14
|
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { i as NonUndefined } from "../extra-
|
|
11
|
+
import { i as NonUndefined } from "../extra-haYf2y7g.js";
|
|
12
12
|
import * as _rolldown from "rolldown";
|
|
13
13
|
import * as _rolldownPlugin from "rolldown/plugins";
|
|
14
14
|
|
package/dist/bundler/rolldown.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
package/dist/bundler/tsdown.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
12
12
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
13
|
-
const require_formatter = require('../formatter-
|
|
14
|
-
const require_package_banner = require('../package-banner-
|
|
13
|
+
const require_formatter = require('../formatter-DkpMt0A4.cjs');
|
|
14
|
+
const require_package_banner = require('../package-banner-CHj1ji3Y.cjs');
|
|
15
15
|
require("@rzl-zone/node-only");
|
|
16
16
|
let semver = require("semver");
|
|
17
17
|
semver = require_formatter.__toESM(semver, 1);
|
|
@@ -119,7 +119,7 @@ function applyWarningFilter(patterns, options) {
|
|
|
119
119
|
DEFAULT_PATTERNS.push("\x1B[33m[PLUGIN_TIMINGS]");
|
|
120
120
|
}
|
|
121
121
|
const safePatterns = (patterns ?? []).filter((p) => typeof p === "string").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
122
|
-
const finalPatterns = Array.from(new Set([...DEFAULT_PATTERNS, ...safePatterns]));
|
|
122
|
+
const finalPatterns = Array.from(/* @__PURE__ */ new Set([...DEFAULT_PATTERNS, ...safePatterns]));
|
|
123
123
|
const orig = process.stderr.write.bind(process.stderr);
|
|
124
124
|
process.stderr.write = ((...args) => {
|
|
125
125
|
const [chunk] = args;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.cjs","names":["getPackageJson","generatePackageBanner","toArray","isFunction","isArray","tsdown","_tsDown"],"sources":["../../src/bundler/tsdown.ts"],"sourcesContent":["import \"@rzl-zone/node-only\";\n\nimport type {\n InlineConfig as _InlineConfig,\n UserConfig as _UserConfig,\n DepsConfig as _DepsConfig\n} from \"tsdown\";\n\nimport type {\n Arrayable,\n StrictAwaitable,\n OverrideTypes,\n Prettify\n} from \"@/_internal/types/extra\";\n\nimport semver from \"semver\";\nimport * as _tsDown from \"tsdown\";\n// import {resolveUserConfig,mergeConfig ,defineConfig,Rolldown,} from \"tsdown\";\n\nimport { isArray, isFunction, toArray } from \"@/_internal/utils/helper\";\n\nimport { getPackageJson } from \"@/core/get\";\nimport { generatePackageBanner } from \"@/core/generate/package-banner\";\n\nexport type InlineConfig = _InlineConfig;\n\n/** ----------------------------------------------------------------\n * * ***Override the default user config.***\n * ----------------------------------------------------------------\n *\n * Represents the user-facing configuration that can override\n * the library's internal defaults.\n *\n * All fields are optional and will be merged with the base defaults.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * import { type UserConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config: UserConfig = {\n * dts: false,\n * minify: \"esbuild\",\n * format: [\"esm\"]\n * };\n * ```\n */\nexport type UserConfig = Omit<\n _UserConfig,\n | \"dts\"\n | \"clean\"\n | \"minify\"\n | \"sourcemap\"\n | \"format\"\n | \"fixedExtension\"\n | \"banner\"\n | \"deps\"\n> &\n UserConfigDefault;\n\n/** ----------------------------------------------------------------\n * * ***Base user config without overridden defaults.***\n * ----------------------------------------------------------------\n *\n * A strict version of {@link UserConfig | **`UserConfig`**} with internal default-controlled\n * options omitted.\n *\n * - ***These fields are intentionally managed by the default config layer:***\n * - `dts`.\n * - `minify`.\n * - `clean`.\n * - `inlineOnly`.\n * - `sourcemap`.\n * - `format`.\n * - `fixedExtension`.\n * - `banner`.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n */\ntype InternalUserConfigBase = Omit<\n UserConfig,\n | \"dts\"\n | \"minify\"\n | \"clean\"\n | \"deps\"\n | \"sourcemap\"\n | \"format\"\n | \"fixedExtension\"\n | \"banner\"\n>;\n\n/** Deps option from `UserConfig.deps` */\nexport type DepsConfig = Omit<_DepsConfig, \"onlyAllowBundle\" | \"onlyBundle\"> & {\n /** Whitelist of dependencies allowed to be bundled from `node_modules`.\n * Throws an error if any unlisted dependency is bundled.\n *\n * - `undefined`: Show warnings for bundled dependencies.\n * - `false` **(default)**: Suppress all warnings about bundled dependencies.\n *\n * Note: Be sure to include all required sub-dependencies as well.\n *\n * - **⚠️ Warning:**\n * - Only effective in tsdown v0.21.1 or bellow.\n * - Versions v0.21.1+ use {@link DepsConfig.onlyBundle | `onlyBundle`} instead, because these options is deprecated.\n *\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.2}\n */\n onlyAllowBundle?: Arrayable<string | RegExp> | false;\n /** Whitelist of dependencies allowed to be bundled from `node_modules`.\n * Throws an error if any unlisted dependency is bundled.\n *\n * - `undefined`: Show warnings for bundled dependencies.\n * - `false` **(default)**: Suppress all warnings about bundled dependencies.\n *\n * Note: Be sure to include all required sub-dependencies as well.\n *\n * - **⚠️ Warning:**\n * - Only effective in tsdown v0.21.2 or later.\n * - Versions below v0.21.2 use {@link DepsConfig.onlyAllowBundle | `onlyAllowBundle`}, because will ignore these options.\n *\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.2}\n */\n onlyBundle?: Arrayable<string | RegExp> | false;\n};\n\ntype UserConfigDefault = {\n /** Enables generation of TypeScript declaration files (`.d.ts`).\n *\n * By default, this option is true, also auto-detected based on your project's `package.json`:\n * - If the `types` field is present, or if the main `exports` contains a `types` entry, declaration file generation is enabled by default.\n * - Otherwise, declaration file generation is disabled by default.\n *\n * @default true\n */\n dts?: _UserConfig[\"dts\"];\n\n /** Clean directories before build.\n *\n * Default to output directory.\n * @default [\"dist/*\"]\n */\n clean?: _UserConfig[\"clean\"];\n\n /** Minification strategy.\n *\n * @default false\n */\n minify?: _UserConfig[\"minify\"];\n\n /** Bundle only the dependencies listed here; throw an error if any others are missing.\n *\n * - `undefined`: Show warnings for bundled dependencies.\n * - `false` **(default)**: Suppress all warnings about `inlineOnly` option.\n *\n * Note: Be sure to include all required sub-dependencies as well.\n *\n * ----------------------------------------------------------------\n * ⚠️ Version Compatibility\n *\n * - Only effective in **tsdown below v0.21.0**.\n * - Versions **v0.21.0** **`>=`** **v0.21.01**:\n * - Use {@link DepsConfig.onlyAllowBundle | **`deps.onlyAllowBundle`**}.\n * - ***Example:***\n * ```json\n * {\n * deps: {\n * onlyAllowBundle: true\n * }\n * }\n * ```\n * - Versions **v0.21.2** or higher use\n * - Use {@link DepsConfig.onlyBundle | **`deps.onlyBundle`**}\n * as the transitional option.\n * - ***Example:***\n * ```json\n * {\n * deps: {\n * onlyBundle: true\n * }\n * }\n * ```\n *\n * ----------------------------------------------------------------\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.0}\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.2}\n */\n inlineOnly?: _UserConfig[\"inlineOnly\"];\n\n /** Whether to generate source map files.\n *\n * Note that this option will always be `true` if you have\n * [`declarationMap`](https://www.typescriptlang.org/tsconfig/#declarationMap)\n * option enabled in your `tsconfig.json`.\n *\n * @default true\n */\n sourcemap?: _UserConfig[\"sourcemap\"];\n\n /** Output formats to generate.\n *\n * - Available formats are:\n * - `esm`: ESM.\n * - `cjs`: CommonJS.\n * - `iife`: IIFE.\n * - `umd`: UMD.\n * @default [\"cjs\", \"esm\"]\n */\n format?: _UserConfig[\"format\"];\n\n /** Use a fixed extension for output files.\n * - If `true`, the extension will always be `.cjs` or `.mjs`.\n * - Otherwise, it will depend on the package type.\n *\n * @default false\n */\n fixedExtension?: _UserConfig[\"fixedExtension\"];\n\n /** Custom banner string injected into output files.\n *\n * Defaults to the value generated by **`generatePackageBanner`**.\n *\n * Set to `false` if you want to disable automatic banner injection.\n */\n banner?: _UserConfig[\"banner\"] | false;\n\n /** Dependency handling options.\n *\n * - **⚠️ Warning:**\n * - Only effective in tsdown **v0.21.0** or later.\n * - Versions below **v0.21.0** will ignore these options.\n */\n deps?: DepsConfig;\n};\ntype UserConfigInternal = InternalUserConfigBase & UserConfigDefault;\n\ntype UserConfigOptionsResult = Prettify<\n OverrideTypes<UserConfigInternal, { banner?: UserConfig[\"banner\"] }>\n>;\n\n/** ----------------------------------------------------------------\n * * ***Default config input variants.***\n * ----------------------------------------------------------------\n *\n * - ***Supported forms:***\n * - Single config object.\n * - Array of config objects.\n * - Async config resolver function.\n * - Promise resolving to any of the above.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * resolveDefaultConfig({\n * dts: false,\n * format: [\"esm\"]\n * });\n *\n *\n * resolveDefaultConfig([\n * { format: [\"cjs\"] },\n * { format: [\"esm\"] }\n * ]);\n *\n * resolveDefaultConfig(async () => ({\n * sourcemap: false\n * }));\n *\n * resolveDefaultConfig((_, ctx) => [\n * { format: [\"esm\"] },\n * ctx.ci ? { minify: true } : { sourcemap: true }\n * ]);\n * ```\n */\nexport type ConfigOptions = StrictAwaitable<\n UserConfigFn | Arrayable<UserConfig>\n>;\n\n/** ----------------------------------------------------------------\n * * ***User config override function.***\n * ----------------------------------------------------------------\n *\n * Allows dynamic configuration based on build context.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * import { type UserConfigFn } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const overrideConfig: UserConfigFn = (inline, ctx) => {\n * if (ctx.ci) {\n * return {\n * sourcemap: false,\n * minify: true\n * };\n * }\n *\n * return {\n * sourcemap: true\n * };\n * };\n * ```\n */\nexport type UserConfigFn = (\n inlineConfig: InlineConfig,\n context: {\n ci: boolean;\n }\n) => StrictAwaitable<Arrayable<UserConfig>>;\n\n/** ----------------------------------------------------------------\n * * ***Config export variants.***\n * ----------------------------------------------------------------\n *\n * Represents all supported **exported configuration forms**\n * that a user can provide to the config resolver.\n *\n * This type mirrors the typical patterns used in modern\n * build tools and bundlers where configuration can be:\n *\n * - A **static config object**\n * - An **array of config objects**\n * - A **config resolver function**\n * - A **Promise resolving to either of the above**\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * // Static config\n * const config: UserConfigExport = {\n * format: [\"esm\"]\n * };\n *\n * // Multiple configs\n * const config: UserConfigExport = [\n * { format: [\"esm\"] },\n * { format: [\"cjs\"] }\n * ];\n *\n * // Dynamic config\n * const config: UserConfigExport = (_, ctx) => ({\n * sourcemap: !ctx.ci\n * });\n *\n * // Async config\n * const config: UserConfigExport = Promise.resolve({\n * minify: true\n * });\n * ```\n */\nexport type UserConfigExport =\n | UserConfigFn\n | Arrayable<UserConfig>\n | Promise<UserConfigFn | Arrayable<UserConfig>>;\n\ntype TsdownCompat = {\n useOnlyBundle: boolean;\n useOnlyAllowBundle: boolean;\n allowInlineOnly: boolean;\n};\nfunction resolveTsdownCompat(version?: string): TsdownCompat {\n if (typeof version !== \"string\") {\n return {\n useOnlyBundle: true,\n useOnlyAllowBundle: false,\n allowInlineOnly: false\n };\n }\n\n return {\n useOnlyBundle: semver.gte(version, \"0.21.2\"),\n useOnlyAllowBundle: semver.lt(version, \"0.21.2\"),\n allowInlineOnly: semver.lt(version, \"0.21.0\")\n };\n}\n\n/** ----------------------------------------------------------------\n * * ***Base default configuration.***\n * ----------------------------------------------------------------\n *\n * Used as the foundation for all resolved configurations.\n *\n */\nexport const BASE_DEFAULT_CONFIG = {\n dts: true,\n minify: false,\n clean: [\"dist/*\"],\n sourcemap: true,\n format: [\"cjs\", \"esm\"],\n banner: undefined,\n // inlineOnly: false,\n // deps: {\n // onlyBundle: false\n // },\n fixedExtension: false\n} as const satisfies UserConfig;\n\nlet _cachedCompat: TsdownCompat | null = null;\n\nasync function getTsdownCompat(): Promise<TsdownCompat> {\n if (_cachedCompat) return _cachedCompat;\n\n const pkg = await getPackageJson();\n\n const raw =\n pkg.dependencies?.tsdown ||\n pkg.devDependencies?.tsdown ||\n pkg.peerDependencies?.tsdown;\n\n const version = raw ? semver.coerce(raw)?.version : undefined;\n\n _cachedCompat = resolveTsdownCompat(version);\n\n return _cachedCompat;\n}\n\nasync function createInternalDefaultConfig(): Promise<UserConfigOptionsResult> {\n const defaultBanner = await generatePackageBanner();\n const compat = await getTsdownCompat();\n\n return {\n ...BASE_DEFAULT_CONFIG,\n\n // INLINE ONLY\n ...(compat.allowInlineOnly && {\n inlineOnly: false\n }),\n\n // DEPS (dynamic)\n deps: {\n ...(compat.useOnlyBundle && { onlyBundle: false }),\n ...(compat.useOnlyAllowBundle && { onlyAllowBundle: false })\n },\n\n banner: defaultBanner\n };\n}\n\nconst isDisableBanner = (\n banner?: UserConfigInternal[\"banner\"]\n): banner is false => {\n return banner === false;\n};\n\n/** ----------------------------------------------------------------\n * * ***Resolve default configuration.***\n * ----------------------------------------------------------------\n *\n * Normalizes all supported config input shapes into a resolved config.\n *\n * This function is designed to act as a **config composition layer**\n * on top of bundler configuration tools such as\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**}.\n *\n * - *Behavior:*\n * - Merges user configuration with `INTERNAL_DEFAULT_CONFIG`.\n * - Automatically injects a banner generated by `generatePackageBanner`.\n * - Set `options.banner` to `false` to disable automatic banner injection.\n *\n * - *Supported input forms:*\n * - Plain config object.\n * - Array of config objects.\n * - Resolver function returning a config or config array.\n * - Promise resolving to any of the above.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/tsdown | **`tsdown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"tsdown\"`).\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/tsdown | **`tsdown`**} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @param options\n * User-provided configuration or resolver.\n *\n * - **May be:**\n * - A config object.\n * - An array of config objects.\n * - A resolver function returning a config or config array.\n * - A Promise resolving to any of the above.\n *\n * ----------------------------------------------------------------\n *\n * @returns\n * A resolved configuration object or an array of configs,\n * depending on the original input shape.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Basic usage**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await resolveDefaultConfig({\n * entry: \"src/index.ts\",\n * dts: false\n * });\n *\n * // ➔ returns an array of configs\n * // ➔ each item is merged with BASE_DEFAULT_CONFIG\n * ```\n * @see {@link BASE_DEFAULT_CONFIG | **`BASE_DEFAULT_CONFIG`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Direct usage in `tsdown.config.ts`**\n *\n * `resolveDefaultConfig` can be exported directly as the config.\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default resolveDefaultConfig({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * This works because `tsdown` accepts **awaitable config values**\n * (objects, arrays, promises, or resolver functions).\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ❌ **Invalid (nested resolver — will throw in tsdown)**\n *\n * ```ts\n * export default defineConfig(async () =>\n * resolveDefaultConfig(async (_, ctx) => ({\n * entry: [\"src/index.ts\"],\n * sourcemap: !ctx.ci\n * }))\n * );\n * ```\n *\n * ✅ **Valid**\n *\n * ```ts\n * export default defineConfig(\n * resolveDefaultConfig(async (_, ctx) => ({\n * entry: [\"src/index.ts\"],\n * sourcemap: !ctx.ci\n * }))\n * );\n * ```\n *\n * Resolver functions must be passed **directly** to `defineConfig`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Promise-based configuration**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await resolveDefaultConfig(\n * Promise.resolve({\n * entry: [\"src/index.ts\"],\n * sourcemap: false\n * })\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Conditional configuration (CI-aware)**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await resolveDefaultConfig((_, ctx) => {\n * return ctx.ci\n * ? { entry: [\"src/index.ts\"], sourcemap: false, minify: true }\n * : { entry: [\"src/index.ts\"], sourcemap: true };\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Conditional resolver returning multiple configs**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const configs = await resolveDefaultConfig((_, ctx) => [\n * { format: [\"esm\"] },\n * ctx.ci\n * ? { minify: true }\n * : { sourcemap: true }\n * ]);\n *\n * // ➜ returns an array of configs\n * // ➜ each item is merged with BASE_DEFAULT_CONFIG\n * ```\n *\n * @see {@link BASE_DEFAULT_CONFIG | **`BASE_DEFAULT_CONFIG`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Multiple entry configurations**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const configs = await resolveDefaultConfig([\n * {\n * entry: [\"src/index.ts\"]\n * },\n * {\n * entry: [\"src/cli/*\"],\n * outDir: \"dist/cli\",\n * format: [\"cjs\"],\n * dts: false\n * }\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with `defineConfig` from `tsdown`**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default defineConfig(\n * resolveDefaultConfig([\n * { entry: [\"src/index.ts\"] },\n * {\n * entry: [\"src/cli/*\"],\n * outDir: \"dist/cli\",\n * format: [\"cjs\"],\n * dts: false\n * }\n * ])\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with the bundled `tsdown` facade**\n *\n * ```ts\n * import {\n * tsdown,\n * resolveDefaultConfig\n * } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default tsdown.defineConfig(\n * resolveDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @environment `node`\n *\n * @remarks\n *\n * - This function intentionally **preserves the input shape**\n * (single object or array) to allow flexible composition.\n *\n * - The resolver performs a **shallow merge only**, nested objects are not deeply merged.\n */\nexport async function resolveDefaultConfig(\n options: UserConfigFn\n): Promise<UserConfigFn>;\nexport async function resolveDefaultConfig(\n options: UserConfig[]\n): Promise<UserConfig>;\nexport async function resolveDefaultConfig(\n options: UserConfig\n): Promise<UserConfig[]>;\nexport async function resolveDefaultConfig(\n options: UserConfigExport\n): Promise<UserConfigExport>;\nexport async function resolveDefaultConfig(\n options: UserConfig | UserConfig[] | UserConfigFn | UserConfigExport\n): Promise<UserConfigExport> {\n const resolved = await Promise.resolve(options);\n // const defaultBanner = await generatePackageBanner();\n\n // const _BASE_DEFAULT_CONFIG: UserConfigOptionsResult = {\n // ...BASE_DEFAULT_CONFIG,\n // banner: defaultBanner\n // };\n\n const _BASE_DEFAULT_CONFIG = await createInternalDefaultConfig();\n\n async function mergeDefaultConfig(\n input: Arrayable<StrictAwaitable<UserConfigInternal>>\n ) {\n const resolvedList = await Promise.all(toArray(input));\n const data: UserConfigOptionsResult[] = [];\n\n for (const opts of resolvedList) {\n if (!opts || typeof opts !== \"object\") continue;\n\n data.push({\n ..._BASE_DEFAULT_CONFIG,\n ...opts,\n banner: isDisableBanner(opts.banner)\n ? undefined\n : (opts.banner ?? _BASE_DEFAULT_CONFIG.banner)\n });\n }\n\n return data;\n\n // const list = toArray(input);\n\n // const resolvedList: UserConfigInternal[] = [];\n // for (const item of list) {\n // resolvedList.push(await item);\n // }\n\n // const data: UserConfigOptionsResult[] = [];\n\n // for (const opts of resolvedList) {\n // if (!opts || typeof opts !== \"object\") continue;\n\n // data.push({\n // ..._BASE_DEFAULT_CONFIG,\n // ...opts,\n // banner: isDisableBanner(opts.banner) ? undefined : opts.banner\n // });\n // }\n\n // return data;\n }\n\n // Promise\n if (isFunction(resolved)) {\n return async (inline, ctx) => {\n const next = await resolved(inline, ctx);\n\n if (isFunction(next)) {\n throw new Error(\n \"resolveDefaultConfig(): Nested resolver functions are not supported.\"\n );\n }\n\n const merged = await mergeDefaultConfig(next);\n\n return merged;\n };\n }\n\n // Array\n if (isArray(resolved)) {\n if (resolved.length === 0) {\n return [_BASE_DEFAULT_CONFIG];\n }\n\n return mergeDefaultConfig(resolved);\n }\n\n // Object\n if (resolved) {\n return {\n ..._BASE_DEFAULT_CONFIG,\n ...resolved,\n banner: isDisableBanner(resolved.banner)\n ? undefined\n : (resolved.banner ?? _BASE_DEFAULT_CONFIG.banner)\n };\n }\n\n // Empty\n return _BASE_DEFAULT_CONFIG;\n}\n\n/** ----------------------------------------------------------------\n * * ***Create default config.***\n * ----------------------------------------------------------------\n *\n * Shorthand helper for merging user overrides with the internal\n * base default configuration.\n *\n * This helper mirrors the typical **`resolveDefaultConfig()`**\n * pattern commonly used in bundler `defineConfig()` factories.\n *\n * Unlike {@link resolveDefaultConfig | `resolveDefaultConfig`}, this helper is intended for\n * **static configuration objects only**.\n *\n * ----------------------------------------------------------------\n *\n * @description\n * - Designed for **simple configuration factories**.\n * - Accepts a single config object and merges it with\n * `INTERNAL_DEFAULT_CONFIG`.\n * - Does **not support resolver functions** or contextual\n * configuration.\n *\n * If you need dynamic configuration based on environment or CI\n * context, use {@link resolveDefaultConfig | `resolveDefaultConfig`} instead.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/tsdown | **`tsdown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"tsdown\"`).\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/tsdown | **`tsdown`**} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @param options\n * User config overrides.\n *\n * ----------------------------------------------------------------\n *\n * @returns\n * A configuration object merged with `INTERNAL_DEFAULT_CONFIG`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Basic usage**\n *\n * ```ts\n * import { createDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await createDefaultConfig({\n * entry: [\"src/index.ts\"],\n * format: [\"esm\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with `defineConfig` (direct import)**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import { createDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default defineConfig([\n * await createDefaultConfig({\n * entry: [\"src/browser.ts\"],\n * format: \"umd\",\n * sourcemap: false\n * }),\n * await createDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with bundled `tsdown` facade**\n *\n * ```ts\n * import { tsdown, createDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default tsdown.defineConfig([\n * await createDefaultConfig({\n * entry: [\"src/browser.ts\"],\n * format: \"umd\",\n * sourcemap: false\n * }),\n * await createDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Mixed usage with `resolveDefaultConfig`**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import {\n * createDefaultConfig,\n * resolveDefaultConfig\n * } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n *\n * // When wrapped with `resolveDefaultConfig`, configuration entries\n * // may be provided either synchronously or asynchronously,\n * // as the resolver accepts Awaitable values.\n * export default defineConfig(\n * resolveDefaultConfig([\n * await createDefaultConfig({\n * entry: [\"src/browser.ts\"],\n * format: \"umd\",\n * sourcemap: false\n * }),\n * createDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * ])\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @see {@link resolveDefaultConfig | `resolveDefaultConfig`}\n * @environment `node`\n */\nexport const createDefaultConfig = async (\n options: UserConfig\n): Promise<UserConfigOptionsResult> => {\n const base = await createInternalDefaultConfig();\n\n const finalBanner = isDisableBanner(options.banner)\n ? undefined\n : (options.banner ?? base.banner);\n\n return {\n ...base,\n ...options,\n\n deps: {\n ...base.deps,\n ...options.deps\n },\n\n banner: finalBanner\n };\n\n // return {\n // ...BASE_DEFAULT_CONFIG,\n // ...options,\n // banner: finalBanner\n // };\n};\n\ntype TsDown = typeof _tsDown;\n\n/** ----------------------------------------------------------------\n * * ***Package `tsdown` bundler API (Node.js only).***\n * ----------------------------------------------------------------\n * Thin namespace re-export of the {@link https://github.com/rolldown/tsdown | **`tsdown`**} package.\n *\n * - This export is provided as a **convenience facade** only.\n * - The actual implementation is resolved from the consumer's\n * dependency graph.\n * - *Typical use cases:*\n * - `defineConfig()` usage.\n * - Programmatic bundler configuration.\n * - Build pipelines and tooling.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/tsdown | **`tsdown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"tsdown\"`).\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/tsdown | **`tsdown`**} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @see {@link https://tsdown.dev | **`https://tsdown.dev`**.}\n * @environment `node`.\n *\n */\nexport const tsdown: TsDown = _tsDown;\n\n/** ----------------------------------------------------------------\n * * ***Filter process warnings at runtime.***\n * ----------------------------------------------------------------\n *\n * Monkey-patches `process.stderr.write` to suppress specific noisy\n * warnings emitted by tooling such as `tsdown`, `rolldown`,\n * or other build-time utilities that bypass the official logger API.\n *\n * These warnings are written directly to stderr, making them\n * impossible to silence using standard logger hooks.\n *\n * ----------------------------------------------------------------\n *\n * @description\n *\n * - Intercepts all `process.stderr.write` calls.\n * - Extracts string content from the output chunk.\n * - Suppresses messages that match configured patterns.\n * - Forwards all other messages to the original stderr writer.\n *\n * This utility acts as a **last-resort filtering mechanism**\n * when upstream tooling does not expose proper logging hooks.\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * This utility is **not tied to any specific config helper**.\n *\n * - Can be used with:\n * - `resolveDefaultConfig`\n * - `createDefaultConfig`\n * - native `tsdown` config (`defineConfig`)\n * - direct `build()` API\n * - or any custom build script\n *\n * It works by patching the global `process.stderr.write`,\n * so it applies to **any tool emitting warnings to stderr**.\n *\n * ----------------------------------------------------------------\n *\n * @param patterns\n * Additional patterns used to match and suppress warnings.\n *\n * - Each pattern is matched using `String.prototype.includes`.\n * - Invalid values (non-string, empty, or whitespace-only) are **ignored at runtime**.\n * - Patterns are automatically **trimmed and sanitized**.\n *\n * ----------------------------------------------------------------\n *\n * @param options\n * Optional configuration for filter behavior.\n *\n * ----------------------------------------------------------------\n *\n * @returns\n * `void`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Basic usage (default behavior)**\n *\n * ```ts\n * applyWarningFilter();\n * ```\n *\n * Filters:\n * - `[MISSING_EXPORT] Warning`\n * - `[PLUGIN_TIMINGS] Warning`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Extend default filter**\n *\n * ```ts\n * applyWarningFilter([\n * \"[ANOTHER_WARNING]\"\n * ]);\n * ```\n *\n * Filters:\n * - `[MISSING_EXPORT] Warning`\n * - `[PLUGIN_TIMINGS] Warning`\n * - `[ANOTHER_WARNING]`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Override default filters**\n *\n * ```ts\n * applyWarningFilter(\n * [\"[ANOTHER_WARNING]\"],\n * {\n * includeMissingExportWarning: false,\n * includePluginTimingsWarning: false\n * }\n * );\n * ```\n *\n * Filters:\n * - `[ANOTHER_WARNING]`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Partial match (recommended)**\n *\n * ```ts\n * applyWarningFilter([\n * \"MISSING_EXPORT\",\n * \"PLUGIN_TIMINGS\"\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage (top-level, recommended)**\n *\n * Apply the filter once at the top of your config file:\n *\n * ```ts\n * applyWarningFilter();\n *\n * export default resolveDefaultConfig({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage inside config resolver**\n *\n * You can also call the filter inside a resolver function.\n * This is useful when applying dynamic configuration:\n *\n * ```ts\n * export default resolveDefaultConfig(() => {\n * applyWarningFilter(\n * [\"[ANOTHER_WARNING]\"]\n * );\n *\n * return [\n * {\n * entry: {\n * index: \"src/index.ts\"\n * }\n * }\n * ];\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with native tsdown config**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n *\n * applyWarningFilter([\"MISSING_EXPORT\"]);\n *\n * export default defineConfig({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Programmatic usage (build script)**\n *\n * ```ts\n * import { build } from \"tsdown\";\n *\n * applyWarningFilter();\n *\n * await build({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * ⚠️ ***Important Notes***\n *\n * - This modifies global process behavior (**side-effect**).\n * - Must be executed **before** build tools emit logs.\n * - Not recommended for long-running applications.\n *\n * ----------------------------------------------------------------\n *\n * ⚠️ ***Node.js only***\n *\n * **DO NOT use this in browser or client-side environments.**\n *\n * ----------------------------------------------------------------\n *\n * @category Build Utilities\n * @environment `node`\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * This utility is **not tied to any specific configuration helper**.\n *\n * - It can be used with:\n * - `resolveDefaultConfig`\n * - `createDefaultConfig`\n * - native `tsdown` config (`defineConfig`)\n * - direct `build()` API\n * - or any custom Node.js build script\n *\n * ----------------------------------------------------------------\n *\n * Internally, this function patches the global `process.stderr.write`,\n * meaning it will affect **all warnings emitted to stderr** during\n * the current process lifecycle.\n *\n * - As a result:\n * - The filter applies globally across all tools.\n * - It is not limited to `tsdown` or any specific bundler.\n * - It may also suppress warnings from unrelated libraries if\n * they match the provided patterns.\n *\n * ----------------------------------------------------------------\n *\n * For predictable behavior, it is recommended to call this function:\n * - once\n * - as early as possible (before any build or logging starts)\n *\n * ----------------------------------------------------------------\n */\nexport function applyWarningFilter(\n patterns?: readonly string[],\n options?: {\n /** ----------------------------------------------------------------\n * * ***Include `[MISSING_EXPORT]` warning filter.***\n * ----------------------------------------------------------------\n *\n * Controls whether the built-in filter for:\n *\n * ```txt\n * [MISSING_EXPORT] Warning\n * ```\n *\n * is applied.\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * - When `true` **(default)**, this pattern is included and merged\n * with user-provided `patterns`.\n * - When `false`, it is excluded unless explicitly provided.\n *\n * ----------------------------------------------------------------\n *\n * This warning is typically emitted by underlying tooling\n * (e.g. dts bundling or rolldown internals) and may not be\n * configurable through official `tsdown` options.\n *\n * In such cases, filtering the output is the only practical way\n * to suppress this warning.\n *\n * ----------------------------------------------------------------\n *\n * This utility only suppresses warnings at the output level.\n * It does not disable the underlying checks or warning generation.\n *\n * ----------------------------------------------------------------\n *\n * @default true\n */\n includeMissingExportWarning?: boolean;\n\n /** ----------------------------------------------------------------\n * * ***Include `[PLUGIN_TIMINGS]` warning filter.***\n * ----------------------------------------------------------------\n *\n * Controls whether the built-in filter for:\n *\n * ```txt\n * [PLUGIN_TIMINGS] Warning\n * ```\n *\n * is applied.\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * - When `true` **(default)**, this pattern is included and merged\n * with user-provided `patterns`.\n * - When `false`, it is excluded unless explicitly provided.\n *\n * ----------------------------------------------------------------\n *\n * This warning can also be disabled via the official `tsdown`\n * configuration:\n *\n * ```ts\n * checks: {\n * pluginTimings: false\n * }\n * ```\n *\n * In such cases, using the built-in configuration is preferred\n * over filtering the output.\n *\n * ----------------------------------------------------------------\n *\n * This utility only suppresses warnings at the output level.\n * It does not disable the underlying checks or warning generation.\n *\n * ----------------------------------------------------------------\n *\n * @default true\n */\n includePluginTimingsWarning?: boolean;\n }\n): void {\n const DEFAULT_PATTERNS: string[] = [];\n\n if (options?.includeMissingExportWarning ?? true) {\n DEFAULT_PATTERNS.push(\"[MISSING_EXPORT] Warning\");\n DEFAULT_PATTERNS.push(\"\\x1b[33m[MISSING_EXPORT]\");\n }\n\n if (options?.includePluginTimingsWarning ?? true) {\n DEFAULT_PATTERNS.push(\"[PLUGIN_TIMINGS] Warning\");\n DEFAULT_PATTERNS.push(\"\\x1b[33m[PLUGIN_TIMINGS]\");\n }\n\n const safePatterns = (patterns ?? [])\n .filter((p): p is string => typeof p === \"string\")\n .map((p) => p.trim())\n .filter((p) => p.length > 0);\n\n const finalPatterns = Array.from(\n new Set([...DEFAULT_PATTERNS, ...safePatterns])\n );\n\n const orig = process.stderr.write.bind(process.stderr);\n\n process.stderr.write = ((\n ...args: Parameters<typeof process.stderr.write>\n ): ReturnType<typeof process.stderr.write> => {\n const [chunk] = args;\n\n let text = \"\";\n\n if (typeof chunk === \"string\") {\n text = chunk;\n } else if (Buffer.isBuffer(chunk)) {\n text = chunk.toString(\"utf8\");\n }\n\n if (finalPatterns.some((p) => text.includes(p))) {\n return true;\n }\n\n return orig(...args);\n }) as typeof process.stderr.write;\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"tsdown.cjs","names":["getPackageJson","generatePackageBanner","toArray","isFunction","isArray","tsdown","_tsDown"],"sources":["../../src/bundler/tsdown.ts"],"sourcesContent":["import \"@rzl-zone/node-only\";\n\nimport type {\n InlineConfig as _InlineConfig,\n UserConfig as _UserConfig,\n DepsConfig as _DepsConfig\n} from \"tsdown\";\n\nimport type {\n Arrayable,\n StrictAwaitable,\n OverrideTypes,\n Prettify\n} from \"@/_internal/types/extra\";\n\nimport semver from \"semver\";\nimport * as _tsDown from \"tsdown\";\n// import {resolveUserConfig,mergeConfig ,defineConfig,Rolldown,} from \"tsdown\";\n\nimport { isArray, isFunction, toArray } from \"@/_internal/utils/helper\";\n\nimport { getPackageJson } from \"@/core/get\";\nimport { generatePackageBanner } from \"@/core/generate/package-banner\";\n\nexport type InlineConfig = _InlineConfig;\n\n/** ----------------------------------------------------------------\n * * ***Override the default user config.***\n * ----------------------------------------------------------------\n *\n * Represents the user-facing configuration that can override\n * the library's internal defaults.\n *\n * All fields are optional and will be merged with the base defaults.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * import { type UserConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config: UserConfig = {\n * dts: false,\n * minify: \"esbuild\",\n * format: [\"esm\"]\n * };\n * ```\n */\nexport type UserConfig = Omit<\n _UserConfig,\n | \"dts\"\n | \"clean\"\n | \"minify\"\n | \"sourcemap\"\n | \"format\"\n | \"fixedExtension\"\n | \"banner\"\n | \"deps\"\n> &\n UserConfigDefault;\n\n/** ----------------------------------------------------------------\n * * ***Base user config without overridden defaults.***\n * ----------------------------------------------------------------\n *\n * A strict version of {@link UserConfig | **`UserConfig`**} with internal default-controlled\n * options omitted.\n *\n * - ***These fields are intentionally managed by the default config layer:***\n * - `dts`.\n * - `minify`.\n * - `clean`.\n * - `inlineOnly`.\n * - `sourcemap`.\n * - `format`.\n * - `fixedExtension`.\n * - `banner`.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n */\ntype InternalUserConfigBase = Omit<\n UserConfig,\n | \"dts\"\n | \"minify\"\n | \"clean\"\n | \"deps\"\n | \"sourcemap\"\n | \"format\"\n | \"fixedExtension\"\n | \"banner\"\n>;\n\n/** Deps option from `UserConfig.deps` */\nexport type DepsConfig = Omit<_DepsConfig, \"onlyAllowBundle\" | \"onlyBundle\"> & {\n /** Whitelist of dependencies allowed to be bundled from `node_modules`.\n * Throws an error if any unlisted dependency is bundled.\n *\n * - `undefined`: Show warnings for bundled dependencies.\n * - `false` **(default)**: Suppress all warnings about bundled dependencies.\n *\n * Note: Be sure to include all required sub-dependencies as well.\n *\n * - **⚠️ Warning:**\n * - Only effective in tsdown v0.21.1 or bellow.\n * - Versions v0.21.1+ use {@link DepsConfig.onlyBundle | `onlyBundle`} instead, because these options is deprecated.\n *\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.2}\n */\n onlyAllowBundle?: Arrayable<string | RegExp> | false;\n /** Whitelist of dependencies allowed to be bundled from `node_modules`.\n * Throws an error if any unlisted dependency is bundled.\n *\n * - `undefined`: Show warnings for bundled dependencies.\n * - `false` **(default)**: Suppress all warnings about bundled dependencies.\n *\n * Note: Be sure to include all required sub-dependencies as well.\n *\n * - **⚠️ Warning:**\n * - Only effective in tsdown v0.21.2 or later.\n * - Versions below v0.21.2 use {@link DepsConfig.onlyAllowBundle | `onlyAllowBundle`}, because will ignore these options.\n *\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.2}\n */\n onlyBundle?: Arrayable<string | RegExp> | false;\n};\n\ntype UserConfigDefault = {\n /** Enables generation of TypeScript declaration files (`.d.ts`).\n *\n * By default, this option is true, also auto-detected based on your project's `package.json`:\n * - If the `types` field is present, or if the main `exports` contains a `types` entry, declaration file generation is enabled by default.\n * - Otherwise, declaration file generation is disabled by default.\n *\n * @default true\n */\n dts?: _UserConfig[\"dts\"];\n\n /** Clean directories before build.\n *\n * Default to output directory.\n * @default [\"dist/*\"]\n */\n clean?: _UserConfig[\"clean\"];\n\n /** Minification strategy.\n *\n * @default false\n */\n minify?: _UserConfig[\"minify\"];\n\n /** Bundle only the dependencies listed here; throw an error if any others are missing.\n *\n * - `undefined`: Show warnings for bundled dependencies.\n * - `false` **(default)**: Suppress all warnings about `inlineOnly` option.\n *\n * Note: Be sure to include all required sub-dependencies as well.\n *\n * ----------------------------------------------------------------\n * ⚠️ Version Compatibility\n *\n * - Only effective in **tsdown below v0.21.0**.\n * - Versions **v0.21.0** **`>=`** **v0.21.01**:\n * - Use {@link DepsConfig.onlyAllowBundle | **`deps.onlyAllowBundle`**}.\n * - ***Example:***\n * ```json\n * {\n * deps: {\n * onlyAllowBundle: true\n * }\n * }\n * ```\n * - Versions **v0.21.2** or higher use\n * - Use {@link DepsConfig.onlyBundle | **`deps.onlyBundle`**}\n * as the transitional option.\n * - ***Example:***\n * ```json\n * {\n * deps: {\n * onlyBundle: true\n * }\n * }\n * ```\n *\n * ----------------------------------------------------------------\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.0}\n * @see {@link https://github.com/rolldown/tsdown/releases/tag/v0.21.2}\n */\n inlineOnly?: _UserConfig[\"inlineOnly\"];\n\n /** Whether to generate source map files.\n *\n * Note that this option will always be `true` if you have\n * [`declarationMap`](https://www.typescriptlang.org/tsconfig/#declarationMap)\n * option enabled in your `tsconfig.json`.\n *\n * @default true\n */\n sourcemap?: _UserConfig[\"sourcemap\"];\n\n /** Output formats to generate.\n *\n * - Available formats are:\n * - `esm`: ESM.\n * - `cjs`: CommonJS.\n * - `iife`: IIFE.\n * - `umd`: UMD.\n * @default [\"cjs\", \"esm\"]\n */\n format?: _UserConfig[\"format\"];\n\n /** Use a fixed extension for output files.\n * - If `true`, the extension will always be `.cjs` or `.mjs`.\n * - Otherwise, it will depend on the package type.\n *\n * @default false\n */\n fixedExtension?: _UserConfig[\"fixedExtension\"];\n\n /** Custom banner string injected into output files.\n *\n * Defaults to the value generated by **`generatePackageBanner`**.\n *\n * Set to `false` if you want to disable automatic banner injection.\n */\n banner?: _UserConfig[\"banner\"] | false;\n\n /** Dependency handling options.\n *\n * - **⚠️ Warning:**\n * - Only effective in tsdown **v0.21.0** or later.\n * - Versions below **v0.21.0** will ignore these options.\n */\n deps?: DepsConfig;\n};\ntype UserConfigInternal = InternalUserConfigBase & UserConfigDefault;\n\ntype UserConfigOptionsResult = Prettify<\n OverrideTypes<UserConfigInternal, { banner?: UserConfig[\"banner\"] }>\n>;\n\n/** ----------------------------------------------------------------\n * * ***Default config input variants.***\n * ----------------------------------------------------------------\n *\n * - ***Supported forms:***\n * - Single config object.\n * - Array of config objects.\n * - Async config resolver function.\n * - Promise resolving to any of the above.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * resolveDefaultConfig({\n * dts: false,\n * format: [\"esm\"]\n * });\n *\n *\n * resolveDefaultConfig([\n * { format: [\"cjs\"] },\n * { format: [\"esm\"] }\n * ]);\n *\n * resolveDefaultConfig(async () => ({\n * sourcemap: false\n * }));\n *\n * resolveDefaultConfig((_, ctx) => [\n * { format: [\"esm\"] },\n * ctx.ci ? { minify: true } : { sourcemap: true }\n * ]);\n * ```\n */\nexport type ConfigOptions = StrictAwaitable<\n UserConfigFn | Arrayable<UserConfig>\n>;\n\n/** ----------------------------------------------------------------\n * * ***User config override function.***\n * ----------------------------------------------------------------\n *\n * Allows dynamic configuration based on build context.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * import { type UserConfigFn } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const overrideConfig: UserConfigFn = (inline, ctx) => {\n * if (ctx.ci) {\n * return {\n * sourcemap: false,\n * minify: true\n * };\n * }\n *\n * return {\n * sourcemap: true\n * };\n * };\n * ```\n */\nexport type UserConfigFn = (\n inlineConfig: InlineConfig,\n context: {\n ci: boolean;\n }\n) => StrictAwaitable<Arrayable<UserConfig>>;\n\n/** ----------------------------------------------------------------\n * * ***Config export variants.***\n * ----------------------------------------------------------------\n *\n * Represents all supported **exported configuration forms**\n * that a user can provide to the config resolver.\n *\n * This type mirrors the typical patterns used in modern\n * build tools and bundlers where configuration can be:\n *\n * - A **static config object**\n * - An **array of config objects**\n * - A **config resolver function**\n * - A **Promise resolving to either of the above**\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | `tsdown`} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this type\n * to be resolved correctly.\n *\n * ❌ **If `tsdown` is not installed**, TypeScript will fail to resolve\n * the underlying types (e.g.\n * `Cannot find module \"tsdown\" or its corresponding type declarations`),\n * and the related types may degrade to `any`.\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * // Static config\n * const config: UserConfigExport = {\n * format: [\"esm\"]\n * };\n *\n * // Multiple configs\n * const config: UserConfigExport = [\n * { format: [\"esm\"] },\n * { format: [\"cjs\"] }\n * ];\n *\n * // Dynamic config\n * const config: UserConfigExport = (_, ctx) => ({\n * sourcemap: !ctx.ci\n * });\n *\n * // Async config\n * const config: UserConfigExport = Promise.resolve({\n * minify: true\n * });\n * ```\n */\nexport type UserConfigExport =\n | UserConfigFn\n | Arrayable<UserConfig>\n | Promise<UserConfigFn | Arrayable<UserConfig>>;\n\ntype TsdownCompat = {\n useOnlyBundle: boolean;\n useOnlyAllowBundle: boolean;\n allowInlineOnly: boolean;\n};\nfunction resolveTsdownCompat(version?: string): TsdownCompat {\n if (typeof version !== \"string\") {\n return {\n useOnlyBundle: true,\n useOnlyAllowBundle: false,\n allowInlineOnly: false\n };\n }\n\n return {\n useOnlyBundle: semver.gte(version, \"0.21.2\"),\n useOnlyAllowBundle: semver.lt(version, \"0.21.2\"),\n allowInlineOnly: semver.lt(version, \"0.21.0\")\n };\n}\n\n/** ----------------------------------------------------------------\n * * ***Base default configuration.***\n * ----------------------------------------------------------------\n *\n * Used as the foundation for all resolved configurations.\n *\n */\nexport const BASE_DEFAULT_CONFIG: Pick<\n UserConfigDefault,\n \"dts\" | \"minify\" | \"clean\" | \"sourcemap\" | \"format\" | \"fixedExtension\"\n> & {\n /** Custom banner string injected into output files.\n *\n * Defaults `undefined`.\n */\n banner?: _UserConfig[\"banner\"] | false;\n} = {\n dts: true,\n minify: false,\n clean: [\"dist/*\"],\n sourcemap: true,\n format: [\"cjs\", \"esm\"],\n banner: undefined,\n // inlineOnly: false,\n // deps: {\n // onlyBundle: false\n // },\n fixedExtension: false\n} as const;\n\nlet _cachedCompat: TsdownCompat | null = null;\n\nasync function getTsdownCompat(): Promise<TsdownCompat> {\n if (_cachedCompat) return _cachedCompat;\n\n const pkg = await getPackageJson();\n\n const raw =\n pkg.dependencies?.tsdown ||\n pkg.devDependencies?.tsdown ||\n pkg.peerDependencies?.tsdown;\n\n const version = raw ? semver.coerce(raw)?.version : undefined;\n\n _cachedCompat = resolveTsdownCompat(version);\n\n return _cachedCompat;\n}\n\nasync function createInternalDefaultConfig(): Promise<UserConfigOptionsResult> {\n const defaultBanner = await generatePackageBanner();\n const compat = await getTsdownCompat();\n\n return {\n ...BASE_DEFAULT_CONFIG,\n\n // INLINE ONLY\n ...(compat.allowInlineOnly && {\n inlineOnly: false\n }),\n\n // DEPS (dynamic)\n deps: {\n ...(compat.useOnlyBundle && { onlyBundle: false }),\n ...(compat.useOnlyAllowBundle && { onlyAllowBundle: false })\n },\n\n banner: defaultBanner\n };\n}\n\nconst isDisableBanner = (\n banner?: UserConfigInternal[\"banner\"]\n): banner is false => {\n return banner === false;\n};\n\n/** ----------------------------------------------------------------\n * * ***Resolve default configuration.***\n * ----------------------------------------------------------------\n *\n * Normalizes all supported config input shapes into a resolved config.\n *\n * This function is designed to act as a **config composition layer**\n * on top of bundler configuration tools such as\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**}.\n *\n * - *Behavior:*\n * - Merges user configuration with `INTERNAL_DEFAULT_CONFIG`.\n * - Automatically injects a banner generated by `generatePackageBanner`.\n * - Set `options.banner` to `false` to disable automatic banner injection.\n *\n * - *Supported input forms:*\n * - Plain config object.\n * - Array of config objects.\n * - Resolver function returning a config or config array.\n * - Promise resolving to any of the above.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/tsdown | **`tsdown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"tsdown\"`).\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/tsdown | **`tsdown`**} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @param options\n * User-provided configuration or resolver.\n *\n * - **May be:**\n * - A config object.\n * - An array of config objects.\n * - A resolver function returning a config or config array.\n * - A Promise resolving to any of the above.\n *\n * ----------------------------------------------------------------\n *\n * @returns\n * A resolved configuration object or an array of configs,\n * depending on the original input shape.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Basic usage**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await resolveDefaultConfig({\n * entry: \"src/index.ts\",\n * dts: false\n * });\n *\n * // ➔ returns an array of configs\n * // ➔ each item is merged with BASE_DEFAULT_CONFIG\n * ```\n * @see {@link BASE_DEFAULT_CONFIG | **`BASE_DEFAULT_CONFIG`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Direct usage in `tsdown.config.ts`**\n *\n * `resolveDefaultConfig` can be exported directly as the config.\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default resolveDefaultConfig({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * This works because `tsdown` accepts **awaitable config values**\n * (objects, arrays, promises, or resolver functions).\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ❌ **Invalid (nested resolver — will throw in tsdown)**\n *\n * ```ts\n * export default defineConfig(async () =>\n * resolveDefaultConfig(async (_, ctx) => ({\n * entry: [\"src/index.ts\"],\n * sourcemap: !ctx.ci\n * }))\n * );\n * ```\n *\n * ✅ **Valid**\n *\n * ```ts\n * export default defineConfig(\n * resolveDefaultConfig(async (_, ctx) => ({\n * entry: [\"src/index.ts\"],\n * sourcemap: !ctx.ci\n * }))\n * );\n * ```\n *\n * Resolver functions must be passed **directly** to `defineConfig`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Promise-based configuration**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await resolveDefaultConfig(\n * Promise.resolve({\n * entry: [\"src/index.ts\"],\n * sourcemap: false\n * })\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Conditional configuration (CI-aware)**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await resolveDefaultConfig((_, ctx) => {\n * return ctx.ci\n * ? { entry: [\"src/index.ts\"], sourcemap: false, minify: true }\n * : { entry: [\"src/index.ts\"], sourcemap: true };\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Conditional resolver returning multiple configs**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const configs = await resolveDefaultConfig((_, ctx) => [\n * { format: [\"esm\"] },\n * ctx.ci\n * ? { minify: true }\n * : { sourcemap: true }\n * ]);\n *\n * // ➜ returns an array of configs\n * // ➜ each item is merged with BASE_DEFAULT_CONFIG\n * ```\n *\n * @see {@link BASE_DEFAULT_CONFIG | **`BASE_DEFAULT_CONFIG`**}.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Multiple entry configurations**\n *\n * ```ts\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const configs = await resolveDefaultConfig([\n * {\n * entry: [\"src/index.ts\"]\n * },\n * {\n * entry: [\"src/cli/*\"],\n * outDir: \"dist/cli\",\n * format: [\"cjs\"],\n * dts: false\n * }\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with `defineConfig` from `tsdown`**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import { resolveDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default defineConfig(\n * resolveDefaultConfig([\n * { entry: [\"src/index.ts\"] },\n * {\n * entry: [\"src/cli/*\"],\n * outDir: \"dist/cli\",\n * format: [\"cjs\"],\n * dts: false\n * }\n * ])\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with the bundled `tsdown` facade**\n *\n * ```ts\n * import {\n * tsdown,\n * resolveDefaultConfig\n * } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default tsdown.defineConfig(\n * resolveDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @environment `node`\n *\n * @remarks\n *\n * - This function intentionally **preserves the input shape**\n * (single object or array) to allow flexible composition.\n *\n * - The resolver performs a **shallow merge only**, nested objects are not deeply merged.\n */\nexport async function resolveDefaultConfig(\n options: UserConfigFn\n): Promise<UserConfigFn>;\nexport async function resolveDefaultConfig(\n options: UserConfig[]\n): Promise<UserConfig>;\nexport async function resolveDefaultConfig(\n options: UserConfig\n): Promise<UserConfig[]>;\nexport async function resolveDefaultConfig(\n options: UserConfigExport\n): Promise<UserConfigExport>;\nexport async function resolveDefaultConfig(\n options: UserConfig | UserConfig[] | UserConfigFn | UserConfigExport\n): Promise<UserConfigExport> {\n const resolved = await Promise.resolve(options);\n // const defaultBanner = await generatePackageBanner();\n\n // const _BASE_DEFAULT_CONFIG: UserConfigOptionsResult = {\n // ...BASE_DEFAULT_CONFIG,\n // banner: defaultBanner\n // };\n\n const _BASE_DEFAULT_CONFIG = await createInternalDefaultConfig();\n\n async function mergeDefaultConfig(\n input: Arrayable<StrictAwaitable<UserConfigInternal>>\n ) {\n const resolvedList = await Promise.all(toArray(input));\n const data: UserConfigOptionsResult[] = [];\n\n for (const opts of resolvedList) {\n if (!opts || typeof opts !== \"object\") continue;\n\n data.push({\n ..._BASE_DEFAULT_CONFIG,\n ...opts,\n banner: isDisableBanner(opts.banner)\n ? undefined\n : (opts.banner ?? _BASE_DEFAULT_CONFIG.banner)\n });\n }\n\n return data;\n\n // const list = toArray(input);\n\n // const resolvedList: UserConfigInternal[] = [];\n // for (const item of list) {\n // resolvedList.push(await item);\n // }\n\n // const data: UserConfigOptionsResult[] = [];\n\n // for (const opts of resolvedList) {\n // if (!opts || typeof opts !== \"object\") continue;\n\n // data.push({\n // ..._BASE_DEFAULT_CONFIG,\n // ...opts,\n // banner: isDisableBanner(opts.banner) ? undefined : opts.banner\n // });\n // }\n\n // return data;\n }\n\n // Promise\n if (isFunction(resolved)) {\n return async (inline, ctx) => {\n const next = await resolved(inline, ctx);\n\n if (isFunction(next)) {\n throw new Error(\n \"resolveDefaultConfig(): Nested resolver functions are not supported.\"\n );\n }\n\n const merged = await mergeDefaultConfig(next);\n\n return merged;\n };\n }\n\n // Array\n if (isArray(resolved)) {\n if (resolved.length === 0) {\n return [_BASE_DEFAULT_CONFIG];\n }\n\n return mergeDefaultConfig(resolved);\n }\n\n // Object\n if (resolved) {\n return {\n ..._BASE_DEFAULT_CONFIG,\n ...resolved,\n banner: isDisableBanner(resolved.banner)\n ? undefined\n : (resolved.banner ?? _BASE_DEFAULT_CONFIG.banner)\n };\n }\n\n // Empty\n return _BASE_DEFAULT_CONFIG;\n}\n\n/** ----------------------------------------------------------------\n * * ***Create default config.***\n * ----------------------------------------------------------------\n *\n * Shorthand helper for merging user overrides with the internal\n * base default configuration.\n *\n * This helper mirrors the typical **`resolveDefaultConfig()`**\n * pattern commonly used in bundler `defineConfig()` factories.\n *\n * Unlike {@link resolveDefaultConfig | `resolveDefaultConfig`}, this helper is intended for\n * **static configuration objects only**.\n *\n * ----------------------------------------------------------------\n *\n * @description\n * - Designed for **simple configuration factories**.\n * - Accepts a single config object and merges it with\n * `INTERNAL_DEFAULT_CONFIG`.\n * - Does **not support resolver functions** or contextual\n * configuration.\n *\n * If you need dynamic configuration based on environment or CI\n * context, use {@link resolveDefaultConfig | `resolveDefaultConfig`} instead.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/tsdown | **`tsdown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"tsdown\"`).\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/tsdown | **`tsdown`**} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @param options\n * User config overrides.\n *\n * ----------------------------------------------------------------\n *\n * @returns\n * A configuration object merged with `INTERNAL_DEFAULT_CONFIG`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Basic usage**\n *\n * ```ts\n * import { createDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * const config = await createDefaultConfig({\n * entry: [\"src/index.ts\"],\n * format: [\"esm\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with `defineConfig` (direct import)**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import { createDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default defineConfig([\n * await createDefaultConfig({\n * entry: [\"src/browser.ts\"],\n * format: \"umd\",\n * sourcemap: false\n * }),\n * await createDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with bundled `tsdown` facade**\n *\n * ```ts\n * import { tsdown, createDefaultConfig } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n * export default tsdown.defineConfig([\n * await createDefaultConfig({\n * entry: [\"src/browser.ts\"],\n * format: \"umd\",\n * sourcemap: false\n * }),\n * await createDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Mixed usage with `resolveDefaultConfig`**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n * import {\n * createDefaultConfig,\n * resolveDefaultConfig\n * } from \"@rzl-zone/build-tools/bundler/tsdown\";\n *\n *\n * // When wrapped with `resolveDefaultConfig`, configuration entries\n * // may be provided either synchronously or asynchronously,\n * // as the resolver accepts Awaitable values.\n * export default defineConfig(\n * resolveDefaultConfig([\n * await createDefaultConfig({\n * entry: [\"src/browser.ts\"],\n * format: \"umd\",\n * sourcemap: false\n * }),\n * createDefaultConfig({\n * entry: [\"src/index.ts\"]\n * })\n * ])\n * );\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @see {@link resolveDefaultConfig | `resolveDefaultConfig`}\n * @environment `node`\n */\nexport const createDefaultConfig = async (\n options: UserConfig\n): Promise<UserConfigOptionsResult> => {\n const base = await createInternalDefaultConfig();\n\n const finalBanner = isDisableBanner(options.banner)\n ? undefined\n : (options.banner ?? base.banner);\n\n return {\n ...base,\n ...options,\n\n deps: {\n ...base.deps,\n ...options.deps\n },\n\n banner: finalBanner\n };\n\n // return {\n // ...BASE_DEFAULT_CONFIG,\n // ...options,\n // banner: finalBanner\n // };\n};\n\ntype TsDown = typeof _tsDown;\n\n/** ----------------------------------------------------------------\n * * ***Package `tsdown` bundler API (Node.js only).***\n * ----------------------------------------------------------------\n * Thin namespace re-export of the {@link https://github.com/rolldown/tsdown | **`tsdown`**} package.\n *\n * - This export is provided as a **convenience facade** only.\n * - The actual implementation is resolved from the consumer's\n * dependency graph.\n * - *Typical use cases:*\n * - `defineConfig()` usage.\n * - Programmatic bundler configuration.\n * - Build pipelines and tooling.\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Peer dependency required.***\n *\n * {@link https://github.com/rolldown/tsdown | **`tsdown`**} is declared as a\n * **peer dependency** of this package.\n *\n * You **MUST install it explicitly** in your project for this export\n * to resolve correctly.\n *\n * ❌ **If {@link https://github.com/rolldown/tsdown | **`tsdown`**} is not installed**, importing this module will\n * result in a **runtime module resolution error** (e.g. `Cannot find module \"tsdown\"`).\n *\n * @see {@link https://tsdown.dev/guide/getting-started#installation | **`tsdown installation guide`**.}\n *\n * ----------------------------------------------------------------\n * ⚠️ ***Node.js only.***\n *\n * **DO NOT import this module in browser or client-side code.**\n *\n * - {@link https://github.com/rolldown/tsdown | **`tsdown`**} relies on Node.js–specific features such as:\n * - filesystem access.\n * - process environment variables.\n * - native module resolution.\n * ----------------------------------------------------------------\n *\n * @see {@link https://tsdown.dev | **`https://tsdown.dev`**.}\n * @environment `node`.\n *\n */\nexport const tsdown: TsDown = _tsDown;\n\n/** ----------------------------------------------------------------\n * * ***Filter process warnings at runtime.***\n * ----------------------------------------------------------------\n *\n * Monkey-patches `process.stderr.write` to suppress specific noisy\n * warnings emitted by tooling such as `tsdown`, `rolldown`,\n * or other build-time utilities that bypass the official logger API.\n *\n * These warnings are written directly to stderr, making them\n * impossible to silence using standard logger hooks.\n *\n * ----------------------------------------------------------------\n *\n * @description\n *\n * - Intercepts all `process.stderr.write` calls.\n * - Extracts string content from the output chunk.\n * - Suppresses messages that match configured patterns.\n * - Forwards all other messages to the original stderr writer.\n *\n * This utility acts as a **last-resort filtering mechanism**\n * when upstream tooling does not expose proper logging hooks.\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * This utility is **not tied to any specific config helper**.\n *\n * - Can be used with:\n * - `resolveDefaultConfig`\n * - `createDefaultConfig`\n * - native `tsdown` config (`defineConfig`)\n * - direct `build()` API\n * - or any custom build script\n *\n * It works by patching the global `process.stderr.write`,\n * so it applies to **any tool emitting warnings to stderr**.\n *\n * ----------------------------------------------------------------\n *\n * @param patterns\n * Additional patterns used to match and suppress warnings.\n *\n * - Each pattern is matched using `String.prototype.includes`.\n * - Invalid values (non-string, empty, or whitespace-only) are **ignored at runtime**.\n * - Patterns are automatically **trimmed and sanitized**.\n *\n * ----------------------------------------------------------------\n *\n * @param options\n * Optional configuration for filter behavior.\n *\n * ----------------------------------------------------------------\n *\n * @returns\n * `void`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Basic usage (default behavior)**\n *\n * ```ts\n * applyWarningFilter();\n * ```\n *\n * Filters:\n * - `[MISSING_EXPORT] Warning`\n * - `[PLUGIN_TIMINGS] Warning`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Extend default filter**\n *\n * ```ts\n * applyWarningFilter([\n * \"[ANOTHER_WARNING]\"\n * ]);\n * ```\n *\n * Filters:\n * - `[MISSING_EXPORT] Warning`\n * - `[PLUGIN_TIMINGS] Warning`\n * - `[ANOTHER_WARNING]`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Override default filters**\n *\n * ```ts\n * applyWarningFilter(\n * [\"[ANOTHER_WARNING]\"],\n * {\n * includeMissingExportWarning: false,\n * includePluginTimingsWarning: false\n * }\n * );\n * ```\n *\n * Filters:\n * - `[ANOTHER_WARNING]`\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Partial match (recommended)**\n *\n * ```ts\n * applyWarningFilter([\n * \"MISSING_EXPORT\",\n * \"PLUGIN_TIMINGS\"\n * ]);\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage (top-level, recommended)**\n *\n * Apply the filter once at the top of your config file:\n *\n * ```ts\n * applyWarningFilter();\n *\n * export default resolveDefaultConfig({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage inside config resolver**\n *\n * You can also call the filter inside a resolver function.\n * This is useful when applying dynamic configuration:\n *\n * ```ts\n * export default resolveDefaultConfig(() => {\n * applyWarningFilter(\n * [\"[ANOTHER_WARNING]\"]\n * );\n *\n * return [\n * {\n * entry: {\n * index: \"src/index.ts\"\n * }\n * }\n * ];\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Usage with native tsdown config**\n *\n * ```ts\n * import { defineConfig } from \"tsdown\";\n *\n * applyWarningFilter([\"MISSING_EXPORT\"]);\n *\n * export default defineConfig({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * @example\n * **Programmatic usage (build script)**\n *\n * ```ts\n * import { build } from \"tsdown\";\n *\n * applyWarningFilter();\n *\n * await build({\n * entry: [\"src/index.ts\"]\n * });\n * ```\n *\n * ----------------------------------------------------------------\n *\n * ⚠️ ***Important Notes***\n *\n * - This modifies global process behavior (**side-effect**).\n * - Must be executed **before** build tools emit logs.\n * - Not recommended for long-running applications.\n *\n * ----------------------------------------------------------------\n *\n * ⚠️ ***Node.js only***\n *\n * **DO NOT use this in browser or client-side environments.**\n *\n * ----------------------------------------------------------------\n *\n * @category Build Utilities\n * @environment `node`\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * This utility is **not tied to any specific configuration helper**.\n *\n * - It can be used with:\n * - `resolveDefaultConfig`\n * - `createDefaultConfig`\n * - native `tsdown` config (`defineConfig`)\n * - direct `build()` API\n * - or any custom Node.js build script\n *\n * ----------------------------------------------------------------\n *\n * Internally, this function patches the global `process.stderr.write`,\n * meaning it will affect **all warnings emitted to stderr** during\n * the current process lifecycle.\n *\n * - As a result:\n * - The filter applies globally across all tools.\n * - It is not limited to `tsdown` or any specific bundler.\n * - It may also suppress warnings from unrelated libraries if\n * they match the provided patterns.\n *\n * ----------------------------------------------------------------\n *\n * For predictable behavior, it is recommended to call this function:\n * - once\n * - as early as possible (before any build or logging starts)\n *\n * ----------------------------------------------------------------\n */\nexport function applyWarningFilter(\n patterns?: readonly string[],\n options?: {\n /** ----------------------------------------------------------------\n * * ***Include `[MISSING_EXPORT]` warning filter.***\n * ----------------------------------------------------------------\n *\n * Controls whether the built-in filter for:\n *\n * ```txt\n * [MISSING_EXPORT] Warning\n * ```\n *\n * is applied.\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * - When `true` **(default)**, this pattern is included and merged\n * with user-provided `patterns`.\n * - When `false`, it is excluded unless explicitly provided.\n *\n * ----------------------------------------------------------------\n *\n * This warning is typically emitted by underlying tooling\n * (e.g. dts bundling or rolldown internals) and may not be\n * configurable through official `tsdown` options.\n *\n * In such cases, filtering the output is the only practical way\n * to suppress this warning.\n *\n * ----------------------------------------------------------------\n *\n * This utility only suppresses warnings at the output level.\n * It does not disable the underlying checks or warning generation.\n *\n * ----------------------------------------------------------------\n *\n * @default true\n */\n includeMissingExportWarning?: boolean;\n\n /** ----------------------------------------------------------------\n * * ***Include `[PLUGIN_TIMINGS]` warning filter.***\n * ----------------------------------------------------------------\n *\n * Controls whether the built-in filter for:\n *\n * ```txt\n * [PLUGIN_TIMINGS] Warning\n * ```\n *\n * is applied.\n *\n * ----------------------------------------------------------------\n *\n * @remarks\n *\n * - When `true` **(default)**, this pattern is included and merged\n * with user-provided `patterns`.\n * - When `false`, it is excluded unless explicitly provided.\n *\n * ----------------------------------------------------------------\n *\n * This warning can also be disabled via the official `tsdown`\n * configuration:\n *\n * ```ts\n * checks: {\n * pluginTimings: false\n * }\n * ```\n *\n * In such cases, using the built-in configuration is preferred\n * over filtering the output.\n *\n * ----------------------------------------------------------------\n *\n * This utility only suppresses warnings at the output level.\n * It does not disable the underlying checks or warning generation.\n *\n * ----------------------------------------------------------------\n *\n * @default true\n */\n includePluginTimingsWarning?: boolean;\n }\n): void {\n const DEFAULT_PATTERNS: string[] = [];\n\n if (options?.includeMissingExportWarning ?? true) {\n DEFAULT_PATTERNS.push(\"[MISSING_EXPORT] Warning\");\n DEFAULT_PATTERNS.push(\"\\x1b[33m[MISSING_EXPORT]\");\n }\n\n if (options?.includePluginTimingsWarning ?? true) {\n DEFAULT_PATTERNS.push(\"[PLUGIN_TIMINGS] Warning\");\n DEFAULT_PATTERNS.push(\"\\x1b[33m[PLUGIN_TIMINGS]\");\n }\n\n const safePatterns = (patterns ?? [])\n .filter((p): p is string => typeof p === \"string\")\n .map((p) => p.trim())\n .filter((p) => p.length > 0);\n\n const finalPatterns = Array.from(\n new Set([...DEFAULT_PATTERNS, ...safePatterns])\n );\n\n const orig = process.stderr.write.bind(process.stderr);\n\n process.stderr.write = ((\n ...args: Parameters<typeof process.stderr.write>\n ): ReturnType<typeof process.stderr.write> => {\n const [chunk] = args;\n\n let text = \"\";\n\n if (typeof chunk === \"string\") {\n text = chunk;\n } else if (Buffer.isBuffer(chunk)) {\n text = chunk.toString(\"utf8\");\n }\n\n if (finalPatterns.some((p) => text.includes(p))) {\n return true;\n }\n\n return orig(...args);\n }) as typeof process.stderr.write;\n}\n"],"mappings":"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"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { l as StrictAwaitable, n as Arrayable, o as OverrideTypes, s as Prettify } from "../extra-
|
|
11
|
+
import { l as StrictAwaitable, n as Arrayable, o as OverrideTypes, s as Prettify } from "../extra-haYf2y7g.cjs";
|
|
12
12
|
import * as _tsDown from "tsdown";
|
|
13
13
|
import { DepsConfig as DepsConfig$1, InlineConfig as InlineConfig$1, UserConfig as UserConfig$1 } from "tsdown";
|
|
14
14
|
|
|
@@ -384,14 +384,12 @@ type UserConfigExport = UserConfigFn | Arrayable<UserConfig> | Promise<UserConfi
|
|
|
384
384
|
* Used as the foundation for all resolved configurations.
|
|
385
385
|
*
|
|
386
386
|
*/
|
|
387
|
-
declare const BASE_DEFAULT_CONFIG: {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
readonly banner: undefined;
|
|
394
|
-
readonly fixedExtension: false;
|
|
387
|
+
declare const BASE_DEFAULT_CONFIG: Pick<UserConfigDefault, "dts" | "minify" | "clean" | "sourcemap" | "format" | "fixedExtension"> & {
|
|
388
|
+
/** Custom banner string injected into output files.
|
|
389
|
+
*
|
|
390
|
+
* Defaults `undefined`.
|
|
391
|
+
*/
|
|
392
|
+
banner?: UserConfig$1["banner"] | false;
|
|
395
393
|
};
|
|
396
394
|
/** ----------------------------------------------------------------
|
|
397
395
|
* * ***Resolve default configuration.***
|
package/dist/bundler/tsdown.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { l as StrictAwaitable, n as Arrayable, o as OverrideTypes, s as Prettify } from "../extra-
|
|
11
|
+
import { l as StrictAwaitable, n as Arrayable, o as OverrideTypes, s as Prettify } from "../extra-haYf2y7g.js";
|
|
12
12
|
import * as _tsDown from "tsdown";
|
|
13
13
|
import { DepsConfig as DepsConfig$1, InlineConfig as InlineConfig$1, UserConfig as UserConfig$1 } from "tsdown";
|
|
14
14
|
|
|
@@ -384,14 +384,12 @@ type UserConfigExport = UserConfigFn | Arrayable<UserConfig> | Promise<UserConfi
|
|
|
384
384
|
* Used as the foundation for all resolved configurations.
|
|
385
385
|
*
|
|
386
386
|
*/
|
|
387
|
-
declare const BASE_DEFAULT_CONFIG: {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
readonly banner: undefined;
|
|
394
|
-
readonly fixedExtension: false;
|
|
387
|
+
declare const BASE_DEFAULT_CONFIG: Pick<UserConfigDefault, "dts" | "minify" | "clean" | "sourcemap" | "format" | "fixedExtension"> & {
|
|
388
|
+
/** Custom banner string injected into output files.
|
|
389
|
+
*
|
|
390
|
+
* Defaults `undefined`.
|
|
391
|
+
*/
|
|
392
|
+
banner?: UserConfig$1["banner"] | false;
|
|
395
393
|
};
|
|
396
394
|
/** ----------------------------------------------------------------
|
|
397
395
|
* * ***Resolve default configuration.***
|
package/dist/bundler/tsdown.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.14-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { D as toArray, f as isArray, h as isFunction } from "../formatter-
|
|
12
|
-
import { n as getPackageJson, t as generatePackageBanner } from "../package-banner-
|
|
11
|
+
import { D as toArray, f as isArray, h as isFunction } from "../formatter-BK-4zd0G.js";
|
|
12
|
+
import { n as getPackageJson, t as generatePackageBanner } from "../package-banner-BDtg5TtW.js";
|
|
13
13
|
import "@rzl-zone/node-only";
|
|
14
14
|
import semver from "semver";
|
|
15
15
|
import * as _tsDown from "tsdown";
|
|
@@ -115,7 +115,7 @@ function applyWarningFilter(patterns, options) {
|
|
|
115
115
|
DEFAULT_PATTERNS.push("\x1B[33m[PLUGIN_TIMINGS]");
|
|
116
116
|
}
|
|
117
117
|
const safePatterns = (patterns ?? []).filter((p) => typeof p === "string").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
118
|
-
const finalPatterns = Array.from(new Set([...DEFAULT_PATTERNS, ...safePatterns]));
|
|
118
|
+
const finalPatterns = Array.from(/* @__PURE__ */ new Set([...DEFAULT_PATTERNS, ...safePatterns]));
|
|
119
119
|
const orig = process.stderr.write.bind(process.stderr);
|
|
120
120
|
process.stderr.write = ((...args) => {
|
|
121
121
|
const [chunk] = args;
|