@rzl-zone/build-tools 0.0.13 → 0.0.14

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.
Files changed (65) hide show
  1. package/dist/.references/index.d.cts +1 -1
  2. package/dist/.references/index.d.ts +1 -1
  3. package/dist/bundler/rolldown.cjs +2 -2
  4. package/dist/bundler/rolldown.d.cts +2 -2
  5. package/dist/bundler/rolldown.d.ts +2 -2
  6. package/dist/bundler/rolldown.js +1 -1
  7. package/dist/bundler/tsdown.cjs +4 -4
  8. package/dist/bundler/tsdown.cjs.map +1 -1
  9. package/dist/bundler/tsdown.d.cts +8 -10
  10. package/dist/bundler/tsdown.d.ts +8 -10
  11. package/dist/bundler/tsdown.js +4 -4
  12. package/dist/bundler/tsdown.js.map +1 -1
  13. package/dist/bundler/utils.cjs +2 -2
  14. package/dist/bundler/utils.d.cts +2 -2
  15. package/dist/bundler/utils.d.ts +2 -2
  16. package/dist/bundler/utils.js +2 -2
  17. package/dist/{client-DowGlRm4.cjs → client-6kvCwMAP.cjs} +3 -3
  18. package/dist/{client-DowGlRm4.cjs.map → client-6kvCwMAP.cjs.map} +1 -1
  19. package/dist/{client-DgQRjdo8.js → client-fLOTSaWY.js} +3 -3
  20. package/dist/{client-DgQRjdo8.js.map → client-fLOTSaWY.js.map} +1 -1
  21. package/dist/commander-kit/index.cjs +5 -5
  22. package/dist/commander-kit/index.cjs.map +1 -1
  23. package/dist/commander-kit/index.d.cts +3 -3
  24. package/dist/commander-kit/index.d.ts +3 -3
  25. package/dist/commander-kit/index.js +5 -5
  26. package/dist/commander-kit/index.js.map +1 -1
  27. package/dist/{extra-B0cm-axJ.d.cts → extra-B9B5shoY.d.cts} +2 -2
  28. package/dist/{extra-B0cm-axJ.d.ts → extra-B9B5shoY.d.ts} +2 -2
  29. package/dist/{fast-globe-options-DXVzXC8B.d.cts → fast-globe-options-BBkxmhty.d.cts} +96 -4
  30. package/dist/{fast-globe-options-CUaH5spu.d.ts → fast-globe-options-Di1Z8m7n.d.ts} +96 -4
  31. package/dist/{formatter-C-Yt_Gvf.cjs → formatter-BAkIXFPg.cjs} +2 -2
  32. package/dist/{formatter-C-Yt_Gvf.cjs.map → formatter-BAkIXFPg.cjs.map} +1 -1
  33. package/dist/{formatter-BFgV1HhV.js → formatter-CIMnJqKX.js} +2 -2
  34. package/dist/{formatter-BFgV1HhV.js.map → formatter-CIMnJqKX.js.map} +1 -1
  35. package/dist/{identity-DPB1Qgy4.js → identity-ClU64-C5.js} +5 -5
  36. package/dist/{identity-DPB1Qgy4.js.map → identity-ClU64-C5.js.map} +1 -1
  37. package/dist/{identity-8Wy_JtzU.cjs → identity-DiOI-xFi.cjs} +5 -5
  38. package/dist/{identity-8Wy_JtzU.cjs.map → identity-DiOI-xFi.cjs.map} +1 -1
  39. package/dist/{index-8QVWHQzC.d.cts → index-DLqTtod5.d.cts} +2 -2
  40. package/dist/{index-8QVWHQzC.d.ts → index-DLqTtod5.d.ts} +2 -2
  41. package/dist/{index-CyGIoXau.d.ts → index-isU4mh4U.d.cts} +3 -3
  42. package/dist/{index-CyGIoXau.d.cts → index-isU4mh4U.d.ts} +3 -3
  43. package/dist/index.cjs +7 -7
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.cts +13 -37
  46. package/dist/index.d.ts +13 -37
  47. package/dist/index.js +7 -7
  48. package/dist/index.js.map +1 -1
  49. package/dist/{package-banner-BjakxfTu.js → package-banner-DMt2fZXQ.js} +4 -4
  50. package/dist/{package-banner-BjakxfTu.js.map → package-banner-DMt2fZXQ.js.map} +1 -1
  51. package/dist/{package-banner-Cf5uu-7p.cjs → package-banner-DyZ9SDgK.cjs} +4 -4
  52. package/dist/{package-banner-Cf5uu-7p.cjs.map → package-banner-DyZ9SDgK.cjs.map} +1 -1
  53. package/dist/{server-B1jiYLZq.js → server-CDjzX9MQ.js} +3 -3
  54. package/dist/{server-B1jiYLZq.js.map → server-CDjzX9MQ.js.map} +1 -1
  55. package/dist/{server-BRuKWcjy.cjs → server-DXTo5kvY.cjs} +3 -3
  56. package/dist/{server-BRuKWcjy.cjs.map → server-DXTo5kvY.cjs.map} +1 -1
  57. package/dist/utils/client.cjs +3 -3
  58. package/dist/utils/client.d.cts +1 -1
  59. package/dist/utils/client.d.ts +1 -1
  60. package/dist/utils/client.js +3 -3
  61. package/dist/utils/server.cjs +2 -2
  62. package/dist/utils/server.d.cts +3 -3
  63. package/dist/utils/server.d.ts +3 -3
  64. package/dist/utils/server.js +2 -2
  65. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.js","names":[],"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":";;;;;;;;;;;;;;;;;AAwbA,SAAS,oBAAoB,SAAgC;CAC3D,IAAI,OAAO,YAAY,UACrB,OAAO;EACL,eAAe;EACf,oBAAoB;EACpB,iBAAiB;CACnB;CAGF,OAAO;EACL,eAAe,OAAO,IAAI,SAAS,QAAQ;EAC3C,oBAAoB,OAAO,GAAG,SAAS,QAAQ;EAC/C,iBAAiB,OAAO,GAAG,SAAS,QAAQ;CAC9C;AACF;;;;;;;;AASA,MAAa,sB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AS,+BAA+B,MAAM;EAChD,iBAAiB,KAAK,0BAA0B;EAChD,iBAAiB,KAAK,0BAA0B;CAClD;CAEA,IAAI,SAAS,+BAA+B,MAAM;EAChD,iBAAiB,KAAK,0BAA0B;EAChD,iBAAiB,KAAK,0BAA0B;CAClD;CAEA,MAAM,gBAAgB,YAAY,CAAC,GAChC,QAAQ,MAAmB,OAAO,MAAM,QAAQ,EAChD,KAAK,MAAM,EAAE,KAAK,CAAC,EACnB,QAAQ,MAAM,EAAE,SAAS,CAAC;CAE7B,MAAM,gBAAgB,MAAM,KAC1B,IAAI,IAAI,CAAC,GAAG,kBAAkB,GAAG,YAAY,CAAC,CAChD;CAEA,MAAM,OAAO,QAAQ,OAAO,MAAM,KAAK,QAAQ,MAAM;CAErD,QAAQ,OAAO,UACb,GAAG,SACyC;EAC5C,MAAM,CAAC,SAAS;EAEhB,IAAI,OAAO;EAEX,IAAI,OAAO,UAAU,UACnB,OAAO;OACF,IAAI,OAAO,SAAS,KAAK,GAC9B,OAAO,MAAM,SAAS,MAAM;EAG9B,IAAI,cAAc,MAAM,MAAM,KAAK,SAAS,CAAC,CAAC,GAC5C,OAAO;EAGT,OAAO,KAAK,GAAG,IAAI;CACrB;AACF"}
1
+ {"version":3,"file":"tsdown.js","names":[],"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":";;;;;;;;;;;;;;;;;AAwbA,SAAS,oBAAoB,SAAgC;CAC3D,IAAI,OAAO,YAAY,UACrB,OAAO;EACL,eAAe;EACf,oBAAoB;EACpB,iBAAiB;CACnB;CAGF,OAAO;EACL,eAAe,OAAO,IAAI,SAAS,QAAQ;EAC3C,oBAAoB,OAAO,GAAG,SAAS,QAAQ;EAC/C,iBAAiB,OAAO,GAAG,SAAS,QAAQ;CAC9C;AACF;;;;;;;;AASA,MAAa,sBAST;CACF,KAAK;CACL,QAAQ;CACR,OAAO,CAAC,QAAQ;CAChB,WAAW;CACX,QAAQ,CAAC,OAAO,KAAK;CACrB,QAAQ;CAKR,gBAAgB;AAClB;AAEA,IAAI,gBAAqC;AAEzC,eAAe,kBAAyC;CACtD,IAAI,eAAe,OAAO;CAE1B,MAAM,MAAM,MAAM,eAAe;CAEjC,MAAM,MACJ,IAAI,cAAc,UAClB,IAAI,iBAAiB,UACrB,IAAI,kBAAkB;CAIxB,gBAAgB,oBAFA,MAAM,OAAO,OAAO,GAAG,CAAC,EAAE,UAAU,MAET;CAE3C,OAAO;AACT;AAEA,eAAe,8BAAgE;CAC7E,MAAM,gBAAgB,MAAM,sBAAsB;CAClD,MAAM,SAAS,MAAM,gBAAgB;CAErC,OAAO;EACL,GAAG;EAGH,GAAI,OAAO,mBAAmB,EAC5B,YAAY,MACd;EAGA,MAAM;GACJ,GAAI,OAAO,iBAAiB,EAAE,YAAY,MAAM;GAChD,GAAI,OAAO,sBAAsB,EAAE,iBAAiB,MAAM;EAC5D;EAEA,QAAQ;CACV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M;EAG9B,IAAI,cAAc,MAAM,MAAM,KAAK,SAAS,CAAC,CAAC,GAC5C,OAAO;EAGT,OAAO,KAAK,GAAG,IAAI;CACrB;AACF"}
@@ -2,7 +2,7 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.13`
5
+ * Version: `0.0.14`
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_package_banner = require('../package-banner-Cf5uu-7p.cjs');
13
+ const require_package_banner = require('../package-banner-DyZ9SDgK.cjs');
14
14
  const nodeExternalPatterns = [
15
15
  /^node:/,
16
16
  /^node/,
@@ -2,13 +2,13 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.13`
5
+ * Version: `0.0.14`
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 { t as GeneratePackageBannerOptions } from "../index-CyGIoXau.cjs";
11
+ import { t as GeneratePackageBannerOptions } from "../index-isU4mh4U.cjs";
12
12
 
13
13
  /** ----------------------------------------------------------------
14
14
  * * ***External modules matching patterns.***
@@ -2,13 +2,13 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.13`
5
+ * Version: `0.0.14`
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 { t as GeneratePackageBannerOptions } from "../index-CyGIoXau.js";
11
+ import { t as GeneratePackageBannerOptions } from "../index-isU4mh4U.js";
12
12
 
13
13
  /** ----------------------------------------------------------------
14
14
  * * ***External modules matching patterns.***
@@ -2,13 +2,13 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.13`
5
+ * Version: `0.0.14`
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 { t as generatePackageBanner } from "../package-banner-BjakxfTu.js";
11
+ import { t as generatePackageBanner } from "../package-banner-DMt2fZXQ.js";
12
12
  const nodeExternalPatterns = [
13
13
  /^node:/,
14
14
  /^node/,
@@ -2,14 +2,14 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.13`
5
+ * Version: `0.0.14`
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
11
  "use strict";
12
- const require_formatter = require('./formatter-C-Yt_Gvf.cjs');
12
+ const require_formatter = require('./formatter-BAkIXFPg.cjs');
13
13
  var ConfigurationError = class ConfigurationError extends Error {
14
14
  static _LABEL = "Invalid configuration";
15
15
  static _normalizeReason(reason) {
@@ -78,4 +78,4 @@ Object.defineProperty(exports, 'ConfigurationError', {
78
78
  return ConfigurationError;
79
79
  }
80
80
  });
81
- //# sourceMappingURL=client-DowGlRm4.cjs.map
81
+ //# sourceMappingURL=client-6kvCwMAP.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-DowGlRm4.cjs","names":["deepFreeze","isNonEmptyString"],"sources":["../src/utils/errors/configuration-error.ts"],"sourcesContent":["import { deepFreeze, isNonEmptyString } from \"@/_internal/utils/helper\";\n\n/** ----------------------------------------------------------------\n * * ***Structured metadata for {@link ConfigurationError | `ConfigurationError`}.***\n * ----------------------------------------------------------------\n *\n * Describes machine-readable contextual information attached to a\n * {@link ConfigurationError | `ConfigurationError`} instance.\n *\n * - ***This structure is designed to:***\n * - Provide debugging insight without parsing the error message.\n * - Support structured logging and telemetry pipelines.\n * - Remain extensible while preserving strong autocomplete support.\n *\n * ----------------------------------------------------------------\n * #### Common Fields:\n * ----------------------------------------------------------------\n *\n * - `received` — The actual value that failed validation.\n * - `context` — Logical origin of the validation\n * (e.g. function or factory name).\n *\n * Additional custom metadata may be attached as needed.\n *\n * ----------------------------------------------------------------\n * @remarks\n * - All properties are optional.\n * - This type intentionally allows arbitrary additional keys.\n * - Intended for machine-readable data (not human-facing text).\n */\nexport interface ConfigurationErrorDetails {\n /** * ***The actual received value that caused the validation failure.***\n *\n */\n readonly received?: unknown;\n\n /** * ***Logical origin of the validation (e.g. function name).***\n *\n */\n readonly context?: string;\n\n /** * ***Additional arbitrary metadata.***\n *\n */\n readonly [key: string]: unknown;\n}\n\n/** ----------------------------------------------------------------\n * * ***Represents a developer configuration error.***\n * ----------------------------------------------------------------\n *\n * Thrown when invalid, inconsistent, or malformed configuration\n * is detected during application or library initialization.\n *\n * This error indicates a **programmer mistake** in how a component,\n * module, or library has been configured. It should **not** be used\n * for runtime user input validation.\n *\n * ----------------------------------------------------------------\n * #### When to use?\n * ----------------------------------------------------------------\n *\n * Use `ConfigurationError` for configuration-related issues such as:\n *\n * - Invalid initialization or factory options.\n * - Incorrect constructor arguments.\n * - Broken integration or adapter contracts.\n * - Misconfigured environment or setup parameters.\n * - Violations of expected configuration schemas.\n *\n * Do **not** use this error type for runtime user input validation\n * (such as request payloads, form data, or command arguments).\n * Those scenarios should use domain-specific validation errors instead.\n *\n * ----------------------------------------------------------------\n * #### Behavior\n * ----------------------------------------------------------------\n *\n * - Extends the native {@link Error | `Error`}.\n * - Sets `.name` to `\"ConfigurationError\"`.\n * - Preserves the original stack trace.\n * - Supports contextual metadata via `details`.\n * - Exposes a stable `code` identifier for programmatic handling.\n *\n * ----------------------------------------------------------------\n * #### Handling\n * ----------------------------------------------------------------\n *\n * Consumers may safely narrow using `instanceof`\n * or {@link ConfigurationError.is | `ConfigurationError.is`}\n * to access structured metadata.\n *\n * @example\n * ```ts\n * try {\n * initializeSetup(options);\n * } catch (err) {\n * if (err instanceof ConfigurationError) {\n * console.error(err.message);\n * console.error(\"Code:\", err.code);\n * console.error(\"Details:\", err.details);\n * }\n * }\n * ```\n *\n * @example\n * ```ts\n * throw ConfigurationError.invalid(\n * \"options.timeout\",\n * \"must be a positive number\",\n * { received: value },\n * \"createComponent\"\n * );\n * ```\n *\n * @example\n * ```ts\n * throw ConfigurationError.type(\n * \"config.adapter\",\n * \"function\",\n * value\n * );\n * ```\n *\n * ----------------------------------------------------------------\n * @remarks\n * - Represents a **programmer-level configuration mistake**.\n * - Typically indicates a **non-recoverable initialization failure**.\n * - Intended for validating configuration in libraries or frameworks.\n */\nexport class ConfigurationError extends Error {\n /** ----------------------------------------------------------------\n * * ***Stable base label for configuration error messages.***\n * ----------------------------------------------------------------\n *\n * Used as the standardized prefix when composing error messages.\n * Extracted to avoid string duplication and enable future\n * refactoring or localization.\n *\n * @private\n * @internal\n */\n private static readonly _LABEL = \"Invalid configuration\";\n\n /** ----------------------------------------------------------------\n * * ***Normalizes a reason fragment for error message composition.***\n * ----------------------------------------------------------------\n *\n * Ensures consistent formatting of message fragments used in\n * factory helpers such as {@link invalid | `ConfigurationError.invalid`}\n * and {@link type | `ConfigurationError.type`}.\n *\n * - Trims surrounding whitespace.\n * - Removes trailing period(s).\n * - Converts the first character to lowercase.\n *\n * This guarantees that reason fragments behave as natural\n * sentence continuations when appended after a field reference.\n *\n * @param reason - Raw reason fragment (may contain punctuation or capitalization).\n * @returns A normalized, lowercase, punctuation-free fragment.\n *\n * @private\n * @internal\n */\n private static _normalizeReason(reason: string): string {\n const trimmed = reason.trim().replace(/\\.*$/, \"\");\n\n if (trimmed.length === 0) {\n return trimmed;\n }\n\n return trimmed.charAt(0).toLowerCase() + trimmed.slice(1);\n }\n\n /** ----------------------------------------------------------------\n * * ***Composes a standardized configuration error message.***\n * ----------------------------------------------------------------\n *\n * Centralizes message construction logic for all factory helpers.\n *\n * - Applies context prefix when provided.\n * - Wraps field and context in inline-code formatting.\n * - Ensures the final message is normalized via {@link format | `format`}.\n *\n * This prevents duplication and guarantees consistent structure\n * across all configuration-related errors.\n *\n * @param field - Dot-notated configuration path.\n * @param body - Already-normalized message fragment.\n * @param context - Optional logical origin of the validation.\n *\n * @returns A fully formatted error message.\n *\n * @private\n * @internal\n */\n private static _compose(\n field: string,\n body: string,\n context?: string\n ): string {\n const prefix = context\n ? `${ConfigurationError._LABEL} in ${ConfigurationError.wrapCode(context)}:`\n : `${ConfigurationError._LABEL}:`;\n\n return ConfigurationError.format(\n `${prefix} ${ConfigurationError.wrapCode(field)} ${body}`\n );\n }\n\n /** ----------------------------------------------------------------\n * * ***Creates a new `ConfigurationError` instance.***\n * ----------------------------------------------------------------\n *\n * @param message - Fully formatted error message.\n * @param details - Optional structured metadata describing the error.\n *\n * @remarks\n * - The message is expected to be finalized (including punctuation).\n * - Restores the prototype chain for ES5 targets.\n * - Captures a clean stack trace in Node.js environments.\n */\n public constructor(\n message: string,\n details?: Readonly<ConfigurationErrorDetails>\n ) {\n super(message);\n\n this.name = ConfigurationError.NAME;\n this.code = ConfigurationError.CODE;\n\n // Deep-ish metadata immutability guard\n this.details = details ? deepFreeze({ ...details }) : undefined;\n\n // Fix prototype chain (important for TS + ES5 targets)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Capture clean stack (Node.js environments)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ConfigurationError);\n }\n\n // Freeze instance to prevent runtime mutation\n if (Object.getPrototypeOf(this) === ConfigurationError.prototype) {\n Object.freeze(this);\n }\n }\n\n /** ----------------------------------------------------------------\n * * ***Stable runtime name for this error type.***\n * ----------------------------------------------------------------\n *\n * - ***Mirrors the class identifier and is used to:***\n * - Set the `.name` property consistently.\n * - Provide cross-runtime identification.\n * - Avoid hardcoded string duplication.\n *\n * This value should remain stable across versions.\n */\n public static readonly NAME = \"ConfigurationError\" as const;\n\n /** ----------------------------------------------------------------\n * * ***Stable error identifier for `ConfigurationError`.***\n * ----------------------------------------------------------------\n *\n * Can be used for:\n * - Programmatic error discrimination.\n * - Cross-bundle or cross-runtime error detection.\n * - Structured logging and telemetry systems.\n *\n * This identifier is guaranteed to remain stable across versions.\n */\n public static readonly CODE = \"CONFIGURATION_ERROR\" as const;\n\n /** ----------------------------------------------------------------\n * * ***Stable error code associated with this instance.***\n * ----------------------------------------------------------------\n *\n * Mirrors {@link CODE | `ConfigurationError.CODE`}.\n *\n * Useful when `instanceof` checks are not reliable\n * across different runtime contexts.\n */\n public readonly code: \"CONFIGURATION_ERROR\" = ConfigurationError.CODE;\n\n /** ----------------------------------------------------------------\n * * ***Optional structured metadata associated with this error.***\n * ----------------------------------------------------------------\n *\n * Provides additional contextual information useful for:\n *\n * - Debugging.\n * - Structured logging.\n * - Programmatic error handling.\n *\n * The structure of this object is defined by\n * {@link ConfigurationErrorDetails| `ConfigurationErrorDetails`}.\n *\n * ----------------------------------------------------------------\n * #### Common Usage\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * try {\n * throw ConfigurationError.type(\n * \"options.myFunction\",\n * \"myFunction\",\n * value\n * );\n * } catch (err) {\n * if (err instanceof ConfigurationError) {\n * console.log(err.details?.received);\n * console.log(err.details?.context);\n * }\n * }\n * ```\n * ----------------------------------------------------------------\n * @remarks\n * - Intended for machine-readable data.\n * - Immutable (`readonly`) to prevent accidental mutation.\n * - May contain additional custom metadata fields.\n */\n public readonly details?: Readonly<ConfigurationErrorDetails>;\n\n /** ----------------------------------------------------------------\n * * ***Normalizes an error message to ensure a single trailing period.***\n * ----------------------------------------------------------------\n *\n * - Trims surrounding whitespace.\n * - Removes any existing trailing period(s).\n * - Appends exactly one `.` at the end.\n *\n * This guarantees consistent punctuation regardless of how\n * the message fragments are constructed.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * ConfigurationError.format(\"Invalid value\")\n * // ➔ \"Invalid value.\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.format(\"Invalid value.\")\n * // ➔ \"Invalid value.\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.format(\" Invalid value... \")\n * // ➔ \"Invalid value.\"\n * ```\n * ----------------------------------------------------------------\n */\n static format(message: string): string {\n if (typeof message !== \"string\" || message.trim().length === 0) {\n throw new TypeError(\n `${this._LABEL}: ${ConfigurationError.NAME}.format(message) expects a non-empty string.`\n );\n }\n\n const trimmed = message.trim().replace(/\\.*$/, \"\");\n return trimmed + \".\";\n }\n\n /** ----------------------------------------------------------------\n * * ***Safely wraps a string in a single pair of backticks.***\n * ----------------------------------------------------------------\n *\n * Ensures consistent inline-code formatting while preventing\n * duplicated or nested backticks.\n *\n * - Removes any existing backticks from the input.\n * - Trims surrounding whitespace.\n * - Wraps the cleaned value in exactly one pair of backticks.\n *\n * This prevents malformed output such as:\n *\n * ```text\n * ``validateConfig``\n * ```\n *\n * ----------------------------------------------------------------\n * @param value - Raw string to be formatted as inline code.\n * @returns The sanitized value wrapped in a single pair of backticks.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * ConfigurationError.wrapCode(\"fieldName\")\n * // ➔ \"`fieldName`\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.wrapCode(\"`fieldName`\")\n * // ➔ \"`fieldName`\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.wrapCode(\" ``fieldName`` \")\n * // ➔ \"`fieldName`\"\n * ```\n * ----------------------------------------------------------------\n */\n static wrapCode(value: string): string {\n if (!isNonEmptyString(value)) {\n throw new TypeError(\n `${this._LABEL}: ${ConfigurationError.NAME}.wrapCode(value) expects a non-empty string.`\n );\n }\n\n const cleaned = value.replace(/`+/g, \"\").trim();\n return `\\`${cleaned}\\``;\n }\n\n /** ----------------------------------------------------------------\n * * ***Type guard for `ConfigurationError`.***\n * ----------------------------------------------------------------\n *\n * Provides a robust alternative to `instanceof`,\n * especially across bundle boundaries or mixed module systems.\n *\n * @param value - Unknown value to test.\n * @returns `true` if the value is a {@link ConfigurationError | `ConfigurationError`}.\n *\n * @example\n * if (ConfigurationError.is(err)) {\n * console.error(err.code);\n * }\n */\n static is(value: unknown): value is ConfigurationError {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n if (!(\"code\" in value) || !(\"name\" in value)) {\n return false;\n }\n\n const { code, name } = value as {\n code?: unknown;\n name?: unknown;\n };\n\n return code === ConfigurationError.CODE && name === ConfigurationError.NAME;\n }\n\n /** ----------------------------------------------------------------\n * * ***Serializes the error into a structured JSON representation.***\n * ----------------------------------------------------------------\n *\n * Provides a stable, machine-readable representation of the error,\n * suitable for:\n *\n * - Structured logging.\n * - Transport across process boundaries.\n * - Diagnostics.\n * - JSON.stringify().\n *\n * Unlike the native `Error` object, this method ensures that:\n *\n * - `name`, `message`, and `code` are always included.\n * - `details` is preserved (if provided).\n * - `stack` is included only when available.\n *\n * This guarantees predictable output when serializing errors.\n *\n * ----------------------------------------------------------------\n * @returns A plain JSON-safe object describing the error.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * const err = ConfigurationError.invalid(\n * \"options.title\",\n * \"must be a non-empty string\",\n * { received: \"\" }\n * );\n *\n * console.log(JSON.stringify(err, null, 2));\n * ```\n *\n * Possible output:\n *\n * ```json\n * {\n * \"name\": \"ConfigurationError\",\n * \"message\": \"Invalid configuration: `options.title` must be a non-empty string.\",\n * \"code\": \"CONFIGURATION_ERROR\",\n * \"details\": { \"received\": \"\" },\n * \"stack\": \"ConfigurationError: ...\"\n * }\n * ```\n * ----------------------------------------------------------------\n */\n toJSON(): {\n /** ----------------------------------------------------------------\n * * ***Runtime identifier of the error instance.***\n * ----------------------------------------------------------------\n *\n * Mirrors {@link ConfigurationError.NAME | `ConfigurationError.NAME`}.\n *\n * - ***Intended for:***\n * - Programmatic error discrimination.\n * - Logging and diagnostic pipelines.\n * - Cross-runtime error identification.\n *\n * This property is useful when `instanceof` checks are unreliable\n * across module boundaries or bundled execution contexts.\n */\n name: string;\n\n /** ----------------------------------------------------------------\n * * ***Fully formatted error message.***\n * ----------------------------------------------------------------\n *\n * The message is guaranteed to be normalized by internal factory helpers.\n *\n * - ***Guarantees:***\n * - Consistent punctuation rules.\n * - Safe inline-code formatting.\n * - Stable human-readable output.\n *\n * The message is expected to represent a finalized diagnostic string\n * suitable for display, logging, or transport.\n */\n message: string;\n\n /** ----------------------------------------------------------------\n * * ***Stable machine-readable error code.***\n * ----------------------------------------------------------------\n *\n * Mirrors {@link ConfigurationError.CODE | `ConfigurationError.CODE`}.\n *\n * - ***Intended for:***\n * - Cross-runtime error identification.\n * - Structured logging systems.\n * - Type-safe error discrimination without relying on `instanceof`.\n *\n * This identifier is guaranteed to remain stable across versions.\n */\n code: typeof ConfigurationError.CODE;\n\n /** ----------------------------------------------------------------\n * * ***Optional structured debugging metadata attached to the error.***\n * ----------------------------------------------------------------\n *\n * #### Contains machine-readable contextual information such as:\n * - Validation input values that caused the error.\n * - Logical origin or execution context.\n * - Custom diagnostic extensions.\n *\n * #### This field is designed for:\n * - Developer debugging.\n * - Telemetry collection.\n * - Internal system analysis.\n *\n * The structure is defined by\n * {@link ConfigurationErrorDetails | `ConfigurationErrorDetails`}.\n */\n details?: Readonly<ConfigurationErrorDetails>;\n\n /** ----------------------------------------------------------------\n * * ***Optional stack trace captured at the error creation site.***\n * ----------------------------------------------------------------\n *\n * May be undefined in environments where stack capture is unavailable.\n *\n * Stack traces are preserved primarily for debugging and\n * post-mortem diagnostics.\n */\n stack?: string;\n } {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n details: this.details,\n stack: this.stack\n };\n }\n\n /** ----------------------------------------------------------------\n * * ***Factory helper for generic configuration validation errors.***\n * ----------------------------------------------------------------\n *\n * Produces a standardized error when a configuration field\n * fails validation.\n *\n * @param field - Dot-notated configuration path (e.g. `\"ui.usage\"`).\n * @param reason - Short descriptive phrase explaining the issue\n * (without trailing period).\n * @param details - Optional structured metadata for debugging.\n * @param context - Optional logical origin of the validation\n * (e.g. `\"validateConfig\"`), when provided,\n * it is included in {@link details | `details`}\n * under the `context` key and reflected in the error message.\n *\n * @returns A `ConfigurationError` instance with a normalized message.\n *\n * @example\n * ConfigurationError.invalid(\n * \"ui.usage\",\n * \"must be a non-empty string\",\n * { received: usage },\n * \"validateConfig\"\n * );\n *\n * // ➔ Invalid configuration in `validateConfig`:\n * // `ui.usage` must be a non-empty string.\n */\n static invalid(\n field: string,\n reason: string,\n details?: Record<string, unknown>,\n context?: string\n ): ConfigurationError {\n const body = ConfigurationError._normalizeReason(reason);\n\n return new ConfigurationError(\n ConfigurationError._compose(field, body, context),\n {\n ...details,\n ...(context ? { context } : {})\n }\n );\n }\n\n /** ----------------------------------------------------------------\n * * ***Factory helper for configuration type mismatch errors.***\n * ----------------------------------------------------------------\n *\n * Produces a standardized error when a configuration field\n * does not match the expected type or structural contract.\n *\n * @param field - Dot-notated configuration path.\n * @param expected - Short description of the expected type or shape\n * (without trailing period).\n * @param received - The actual received value.\n * @param context - Optional logical origin of the validation\n * (e.g. `\"myFunction\"`), when provided,\n * it is included in {@link details | `details`}\n * under the `context` key and reflected in the error message.\n *\n * @returns A `ConfigurationError` instance including the received value.\n *\n * @example\n * ConfigurationError.type(\n * \"options.myMainFunction\",\n * \"MyMainFunction\",\n * value,\n * \"myFunction\"\n * );\n *\n * // ➔ Invalid configuration in `myFunction`:\n * // `options.myMainFunction` must be MyMainFunction.\n */\n static type(\n field: string,\n expected: string,\n received: unknown,\n context?: string\n ): ConfigurationError {\n const body = `must be ${expected}`;\n\n return new ConfigurationError(\n ConfigurationError._compose(field, body, context),\n {\n received,\n ...(context ? { context } : {})\n }\n );\n }\n}\n"],"mappings":";;;;;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,SAAS,OAAO,MAAM,OAAO,GAChD;GACE;GACA,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;EAC/B,CACF;CACF;AACF"}
1
+ {"version":3,"file":"client-6kvCwMAP.cjs","names":["deepFreeze","isNonEmptyString"],"sources":["../src/utils/errors/configuration-error.ts"],"sourcesContent":["import { deepFreeze, isNonEmptyString } from \"@/_internal/utils/helper\";\n\n/** ----------------------------------------------------------------\n * * ***Structured metadata for {@link ConfigurationError | `ConfigurationError`}.***\n * ----------------------------------------------------------------\n *\n * Describes machine-readable contextual information attached to a\n * {@link ConfigurationError | `ConfigurationError`} instance.\n *\n * - ***This structure is designed to:***\n * - Provide debugging insight without parsing the error message.\n * - Support structured logging and telemetry pipelines.\n * - Remain extensible while preserving strong autocomplete support.\n *\n * ----------------------------------------------------------------\n * #### Common Fields:\n * ----------------------------------------------------------------\n *\n * - `received` — The actual value that failed validation.\n * - `context` — Logical origin of the validation\n * (e.g. function or factory name).\n *\n * Additional custom metadata may be attached as needed.\n *\n * ----------------------------------------------------------------\n * @remarks\n * - All properties are optional.\n * - This type intentionally allows arbitrary additional keys.\n * - Intended for machine-readable data (not human-facing text).\n */\nexport interface ConfigurationErrorDetails {\n /** * ***The actual received value that caused the validation failure.***\n *\n */\n readonly received?: unknown;\n\n /** * ***Logical origin of the validation (e.g. function name).***\n *\n */\n readonly context?: string;\n\n /** * ***Additional arbitrary metadata.***\n *\n */\n readonly [key: string]: unknown;\n}\n\n/** ----------------------------------------------------------------\n * * ***Represents a developer configuration error.***\n * ----------------------------------------------------------------\n *\n * Thrown when invalid, inconsistent, or malformed configuration\n * is detected during application or library initialization.\n *\n * This error indicates a **programmer mistake** in how a component,\n * module, or library has been configured. It should **not** be used\n * for runtime user input validation.\n *\n * ----------------------------------------------------------------\n * #### When to use?\n * ----------------------------------------------------------------\n *\n * Use `ConfigurationError` for configuration-related issues such as:\n *\n * - Invalid initialization or factory options.\n * - Incorrect constructor arguments.\n * - Broken integration or adapter contracts.\n * - Misconfigured environment or setup parameters.\n * - Violations of expected configuration schemas.\n *\n * Do **not** use this error type for runtime user input validation\n * (such as request payloads, form data, or command arguments).\n * Those scenarios should use domain-specific validation errors instead.\n *\n * ----------------------------------------------------------------\n * #### Behavior\n * ----------------------------------------------------------------\n *\n * - Extends the native {@link Error | `Error`}.\n * - Sets `.name` to `\"ConfigurationError\"`.\n * - Preserves the original stack trace.\n * - Supports contextual metadata via `details`.\n * - Exposes a stable `code` identifier for programmatic handling.\n *\n * ----------------------------------------------------------------\n * #### Handling\n * ----------------------------------------------------------------\n *\n * Consumers may safely narrow using `instanceof`\n * or {@link ConfigurationError.is | `ConfigurationError.is`}\n * to access structured metadata.\n *\n * @example\n * ```ts\n * try {\n * initializeSetup(options);\n * } catch (err) {\n * if (err instanceof ConfigurationError) {\n * console.error(err.message);\n * console.error(\"Code:\", err.code);\n * console.error(\"Details:\", err.details);\n * }\n * }\n * ```\n *\n * @example\n * ```ts\n * throw ConfigurationError.invalid(\n * \"options.timeout\",\n * \"must be a positive number\",\n * { received: value },\n * \"createComponent\"\n * );\n * ```\n *\n * @example\n * ```ts\n * throw ConfigurationError.type(\n * \"config.adapter\",\n * \"function\",\n * value\n * );\n * ```\n *\n * ----------------------------------------------------------------\n * @remarks\n * - Represents a **programmer-level configuration mistake**.\n * - Typically indicates a **non-recoverable initialization failure**.\n * - Intended for validating configuration in libraries or frameworks.\n */\nexport class ConfigurationError extends Error {\n /** ----------------------------------------------------------------\n * * ***Stable base label for configuration error messages.***\n * ----------------------------------------------------------------\n *\n * Used as the standardized prefix when composing error messages.\n * Extracted to avoid string duplication and enable future\n * refactoring or localization.\n *\n * @private\n * @internal\n */\n private static readonly _LABEL = \"Invalid configuration\";\n\n /** ----------------------------------------------------------------\n * * ***Normalizes a reason fragment for error message composition.***\n * ----------------------------------------------------------------\n *\n * Ensures consistent formatting of message fragments used in\n * factory helpers such as {@link invalid | `ConfigurationError.invalid`}\n * and {@link type | `ConfigurationError.type`}.\n *\n * - Trims surrounding whitespace.\n * - Removes trailing period(s).\n * - Converts the first character to lowercase.\n *\n * This guarantees that reason fragments behave as natural\n * sentence continuations when appended after a field reference.\n *\n * @param reason - Raw reason fragment (may contain punctuation or capitalization).\n * @returns A normalized, lowercase, punctuation-free fragment.\n *\n * @private\n * @internal\n */\n private static _normalizeReason(reason: string): string {\n const trimmed = reason.trim().replace(/\\.*$/, \"\");\n\n if (trimmed.length === 0) {\n return trimmed;\n }\n\n return trimmed.charAt(0).toLowerCase() + trimmed.slice(1);\n }\n\n /** ----------------------------------------------------------------\n * * ***Composes a standardized configuration error message.***\n * ----------------------------------------------------------------\n *\n * Centralizes message construction logic for all factory helpers.\n *\n * - Applies context prefix when provided.\n * - Wraps field and context in inline-code formatting.\n * - Ensures the final message is normalized via {@link format | `format`}.\n *\n * This prevents duplication and guarantees consistent structure\n * across all configuration-related errors.\n *\n * @param field - Dot-notated configuration path.\n * @param body - Already-normalized message fragment.\n * @param context - Optional logical origin of the validation.\n *\n * @returns A fully formatted error message.\n *\n * @private\n * @internal\n */\n private static _compose(\n field: string,\n body: string,\n context?: string\n ): string {\n const prefix = context\n ? `${ConfigurationError._LABEL} in ${ConfigurationError.wrapCode(context)}:`\n : `${ConfigurationError._LABEL}:`;\n\n return ConfigurationError.format(\n `${prefix} ${ConfigurationError.wrapCode(field)} ${body}`\n );\n }\n\n /** ----------------------------------------------------------------\n * * ***Creates a new `ConfigurationError` instance.***\n * ----------------------------------------------------------------\n *\n * @param message - Fully formatted error message.\n * @param details - Optional structured metadata describing the error.\n *\n * @remarks\n * - The message is expected to be finalized (including punctuation).\n * - Restores the prototype chain for ES5 targets.\n * - Captures a clean stack trace in Node.js environments.\n */\n public constructor(\n message: string,\n details?: Readonly<ConfigurationErrorDetails>\n ) {\n super(message);\n\n this.name = ConfigurationError.NAME;\n this.code = ConfigurationError.CODE;\n\n // Deep-ish metadata immutability guard\n this.details = details ? deepFreeze({ ...details }) : undefined;\n\n // Fix prototype chain (important for TS + ES5 targets)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Capture clean stack (Node.js environments)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ConfigurationError);\n }\n\n // Freeze instance to prevent runtime mutation\n if (Object.getPrototypeOf(this) === ConfigurationError.prototype) {\n Object.freeze(this);\n }\n }\n\n /** ----------------------------------------------------------------\n * * ***Stable runtime name for this error type.***\n * ----------------------------------------------------------------\n *\n * - ***Mirrors the class identifier and is used to:***\n * - Set the `.name` property consistently.\n * - Provide cross-runtime identification.\n * - Avoid hardcoded string duplication.\n *\n * This value should remain stable across versions.\n */\n public static readonly NAME = \"ConfigurationError\" as const;\n\n /** ----------------------------------------------------------------\n * * ***Stable error identifier for `ConfigurationError`.***\n * ----------------------------------------------------------------\n *\n * Can be used for:\n * - Programmatic error discrimination.\n * - Cross-bundle or cross-runtime error detection.\n * - Structured logging and telemetry systems.\n *\n * This identifier is guaranteed to remain stable across versions.\n */\n public static readonly CODE = \"CONFIGURATION_ERROR\" as const;\n\n /** ----------------------------------------------------------------\n * * ***Stable error code associated with this instance.***\n * ----------------------------------------------------------------\n *\n * Mirrors {@link CODE | `ConfigurationError.CODE`}.\n *\n * Useful when `instanceof` checks are not reliable\n * across different runtime contexts.\n */\n public readonly code: \"CONFIGURATION_ERROR\" = ConfigurationError.CODE;\n\n /** ----------------------------------------------------------------\n * * ***Optional structured metadata associated with this error.***\n * ----------------------------------------------------------------\n *\n * Provides additional contextual information useful for:\n *\n * - Debugging.\n * - Structured logging.\n * - Programmatic error handling.\n *\n * The structure of this object is defined by\n * {@link ConfigurationErrorDetails| `ConfigurationErrorDetails`}.\n *\n * ----------------------------------------------------------------\n * #### Common Usage\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * try {\n * throw ConfigurationError.type(\n * \"options.myFunction\",\n * \"myFunction\",\n * value\n * );\n * } catch (err) {\n * if (err instanceof ConfigurationError) {\n * console.log(err.details?.received);\n * console.log(err.details?.context);\n * }\n * }\n * ```\n * ----------------------------------------------------------------\n * @remarks\n * - Intended for machine-readable data.\n * - Immutable (`readonly`) to prevent accidental mutation.\n * - May contain additional custom metadata fields.\n */\n public readonly details?: Readonly<ConfigurationErrorDetails>;\n\n /** ----------------------------------------------------------------\n * * ***Normalizes an error message to ensure a single trailing period.***\n * ----------------------------------------------------------------\n *\n * - Trims surrounding whitespace.\n * - Removes any existing trailing period(s).\n * - Appends exactly one `.` at the end.\n *\n * This guarantees consistent punctuation regardless of how\n * the message fragments are constructed.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * ConfigurationError.format(\"Invalid value\")\n * // ➔ \"Invalid value.\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.format(\"Invalid value.\")\n * // ➔ \"Invalid value.\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.format(\" Invalid value... \")\n * // ➔ \"Invalid value.\"\n * ```\n * ----------------------------------------------------------------\n */\n static format(message: string): string {\n if (typeof message !== \"string\" || message.trim().length === 0) {\n throw new TypeError(\n `${this._LABEL}: ${ConfigurationError.NAME}.format(message) expects a non-empty string.`\n );\n }\n\n const trimmed = message.trim().replace(/\\.*$/, \"\");\n return trimmed + \".\";\n }\n\n /** ----------------------------------------------------------------\n * * ***Safely wraps a string in a single pair of backticks.***\n * ----------------------------------------------------------------\n *\n * Ensures consistent inline-code formatting while preventing\n * duplicated or nested backticks.\n *\n * - Removes any existing backticks from the input.\n * - Trims surrounding whitespace.\n * - Wraps the cleaned value in exactly one pair of backticks.\n *\n * This prevents malformed output such as:\n *\n * ```text\n * ``validateConfig``\n * ```\n *\n * ----------------------------------------------------------------\n * @param value - Raw string to be formatted as inline code.\n * @returns The sanitized value wrapped in a single pair of backticks.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * ConfigurationError.wrapCode(\"fieldName\")\n * // ➔ \"`fieldName`\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.wrapCode(\"`fieldName`\")\n * // ➔ \"`fieldName`\"\n * ```\n *\n * @example\n * ```ts\n * ConfigurationError.wrapCode(\" ``fieldName`` \")\n * // ➔ \"`fieldName`\"\n * ```\n * ----------------------------------------------------------------\n */\n static wrapCode(value: string): string {\n if (!isNonEmptyString(value)) {\n throw new TypeError(\n `${this._LABEL}: ${ConfigurationError.NAME}.wrapCode(value) expects a non-empty string.`\n );\n }\n\n const cleaned = value.replace(/`+/g, \"\").trim();\n return `\\`${cleaned}\\``;\n }\n\n /** ----------------------------------------------------------------\n * * ***Type guard for `ConfigurationError`.***\n * ----------------------------------------------------------------\n *\n * Provides a robust alternative to `instanceof`,\n * especially across bundle boundaries or mixed module systems.\n *\n * @param value - Unknown value to test.\n * @returns `true` if the value is a {@link ConfigurationError | `ConfigurationError`}.\n *\n * @example\n * if (ConfigurationError.is(err)) {\n * console.error(err.code);\n * }\n */\n static is(value: unknown): value is ConfigurationError {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n if (!(\"code\" in value) || !(\"name\" in value)) {\n return false;\n }\n\n const { code, name } = value as {\n code?: unknown;\n name?: unknown;\n };\n\n return code === ConfigurationError.CODE && name === ConfigurationError.NAME;\n }\n\n /** ----------------------------------------------------------------\n * * ***Serializes the error into a structured JSON representation.***\n * ----------------------------------------------------------------\n *\n * Provides a stable, machine-readable representation of the error,\n * suitable for:\n *\n * - Structured logging.\n * - Transport across process boundaries.\n * - Diagnostics.\n * - JSON.stringify().\n *\n * Unlike the native `Error` object, this method ensures that:\n *\n * - `name`, `message`, and `code` are always included.\n * - `details` is preserved (if provided).\n * - `stack` is included only when available.\n *\n * This guarantees predictable output when serializing errors.\n *\n * ----------------------------------------------------------------\n * @returns A plain JSON-safe object describing the error.\n *\n * ----------------------------------------------------------------\n * @example\n * ```ts\n * const err = ConfigurationError.invalid(\n * \"options.title\",\n * \"must be a non-empty string\",\n * { received: \"\" }\n * );\n *\n * console.log(JSON.stringify(err, null, 2));\n * ```\n *\n * Possible output:\n *\n * ```json\n * {\n * \"name\": \"ConfigurationError\",\n * \"message\": \"Invalid configuration: `options.title` must be a non-empty string.\",\n * \"code\": \"CONFIGURATION_ERROR\",\n * \"details\": { \"received\": \"\" },\n * \"stack\": \"ConfigurationError: ...\"\n * }\n * ```\n * ----------------------------------------------------------------\n */\n toJSON(): {\n /** ----------------------------------------------------------------\n * * ***Runtime identifier of the error instance.***\n * ----------------------------------------------------------------\n *\n * Mirrors {@link ConfigurationError.NAME | `ConfigurationError.NAME`}.\n *\n * - ***Intended for:***\n * - Programmatic error discrimination.\n * - Logging and diagnostic pipelines.\n * - Cross-runtime error identification.\n *\n * This property is useful when `instanceof` checks are unreliable\n * across module boundaries or bundled execution contexts.\n */\n name: string;\n\n /** ----------------------------------------------------------------\n * * ***Fully formatted error message.***\n * ----------------------------------------------------------------\n *\n * The message is guaranteed to be normalized by internal factory helpers.\n *\n * - ***Guarantees:***\n * - Consistent punctuation rules.\n * - Safe inline-code formatting.\n * - Stable human-readable output.\n *\n * The message is expected to represent a finalized diagnostic string\n * suitable for display, logging, or transport.\n */\n message: string;\n\n /** ----------------------------------------------------------------\n * * ***Stable machine-readable error code.***\n * ----------------------------------------------------------------\n *\n * Mirrors {@link ConfigurationError.CODE | `ConfigurationError.CODE`}.\n *\n * - ***Intended for:***\n * - Cross-runtime error identification.\n * - Structured logging systems.\n * - Type-safe error discrimination without relying on `instanceof`.\n *\n * This identifier is guaranteed to remain stable across versions.\n */\n code: typeof ConfigurationError.CODE;\n\n /** ----------------------------------------------------------------\n * * ***Optional structured debugging metadata attached to the error.***\n * ----------------------------------------------------------------\n *\n * #### Contains machine-readable contextual information such as:\n * - Validation input values that caused the error.\n * - Logical origin or execution context.\n * - Custom diagnostic extensions.\n *\n * #### This field is designed for:\n * - Developer debugging.\n * - Telemetry collection.\n * - Internal system analysis.\n *\n * The structure is defined by\n * {@link ConfigurationErrorDetails | `ConfigurationErrorDetails`}.\n */\n details?: Readonly<ConfigurationErrorDetails>;\n\n /** ----------------------------------------------------------------\n * * ***Optional stack trace captured at the error creation site.***\n * ----------------------------------------------------------------\n *\n * May be undefined in environments where stack capture is unavailable.\n *\n * Stack traces are preserved primarily for debugging and\n * post-mortem diagnostics.\n */\n stack?: string;\n } {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n details: this.details,\n stack: this.stack\n };\n }\n\n /** ----------------------------------------------------------------\n * * ***Factory helper for generic configuration validation errors.***\n * ----------------------------------------------------------------\n *\n * Produces a standardized error when a configuration field\n * fails validation.\n *\n * @param field - Dot-notated configuration path (e.g. `\"ui.usage\"`).\n * @param reason - Short descriptive phrase explaining the issue\n * (without trailing period).\n * @param details - Optional structured metadata for debugging.\n * @param context - Optional logical origin of the validation\n * (e.g. `\"validateConfig\"`), when provided,\n * it is included in {@link details | `details`}\n * under the `context` key and reflected in the error message.\n *\n * @returns A `ConfigurationError` instance with a normalized message.\n *\n * @example\n * ConfigurationError.invalid(\n * \"ui.usage\",\n * \"must be a non-empty string\",\n * { received: usage },\n * \"validateConfig\"\n * );\n *\n * // ➔ Invalid configuration in `validateConfig`:\n * // `ui.usage` must be a non-empty string.\n */\n static invalid(\n field: string,\n reason: string,\n details?: Record<string, unknown>,\n context?: string\n ): ConfigurationError {\n const body = ConfigurationError._normalizeReason(reason);\n\n return new ConfigurationError(\n ConfigurationError._compose(field, body, context),\n {\n ...details,\n ...(context ? { context } : {})\n }\n );\n }\n\n /** ----------------------------------------------------------------\n * * ***Factory helper for configuration type mismatch errors.***\n * ----------------------------------------------------------------\n *\n * Produces a standardized error when a configuration field\n * does not match the expected type or structural contract.\n *\n * @param field - Dot-notated configuration path.\n * @param expected - Short description of the expected type or shape\n * (without trailing period).\n * @param received - The actual received value.\n * @param context - Optional logical origin of the validation\n * (e.g. `\"myFunction\"`), when provided,\n * it is included in {@link details | `details`}\n * under the `context` key and reflected in the error message.\n *\n * @returns A `ConfigurationError` instance including the received value.\n *\n * @example\n * ConfigurationError.type(\n * \"options.myMainFunction\",\n * \"MyMainFunction\",\n * value,\n * \"myFunction\"\n * );\n *\n * // ➔ Invalid configuration in `myFunction`:\n * // `options.myMainFunction` must be MyMainFunction.\n */\n static type(\n field: string,\n expected: string,\n received: unknown,\n context?: string\n ): ConfigurationError {\n const body = `must be ${expected}`;\n\n return new ConfigurationError(\n ConfigurationError._compose(field, body, context),\n {\n received,\n ...(context ? { context } : {})\n }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,IAAa,qBAAb,MAAa,2BAA2B,MAAM;;;;;;;;;;;;CAY5C,OAAwB,SAAS;;;;;;;;;;;;;;;;;;;;;;CAuBjC,OAAe,iBAAiB,QAAwB;EACtD,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE;EAEhD,IAAI,QAAQ,WAAW,GACrB,OAAO;EAGT,OAAO,QAAQ,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,QAAQ,MAAM,CAAC;CAC1D;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAe,SACb,OACA,MACA,SACQ;EACR,MAAM,SAAS,UACX,GAAG,mBAAmB,OAAO,MAAM,mBAAmB,SAAS,OAAO,EAAE,KACxE,GAAG,mBAAmB,OAAO;EAEjC,OAAO,mBAAmB,OACxB,GAAG,OAAO,GAAG,mBAAmB,SAAS,KAAK,EAAE,GAAG,MACrD;CACF;;;;;;;;;;;;;CAcA,AAAO,YACL,SACA,SACA;EACA,MAAM,OAAO;EAEb,KAAK,OAAO,mBAAmB;EAC/B,KAAK,OAAO,mBAAmB;EAG/B,KAAK,UAAU,UAAUA,6BAAW,EAAE,GAAG,QAAQ,CAAC,IAAI;EAGtD,OAAO,eAAe,MAAM,IAAI,OAAO,SAAS;EAGhD,IAAI,MAAM,mBACR,MAAM,kBAAkB,MAAM,kBAAkB;EAIlD,IAAI,OAAO,eAAe,IAAI,MAAM,mBAAmB,WACrD,OAAO,OAAO,IAAI;CAEtB;;;;;;;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B,SAAS,OAAO,MAAM,OAAO,GAChD;GACE,GAAG;GACH,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;EAC/B,CACF;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BA,OAAO,KACL,OACA,UACA,UACA,SACoB;EACpB,MAAM,OAAO,WAAW;EAExB,OAAO,IAAI,mBACT,mBAAmB,SAAS,OAAO,MAAM,OAAO,GAChD;GACE;GACA,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;EAC/B,CACF;CACF;AACF"}
@@ -2,13 +2,13 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.13`
5
+ * Version: `0.0.14`
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 { _ as isNonEmptyString, u as deepFreeze } from "./formatter-BFgV1HhV.js";
11
+ import { _ as isNonEmptyString, u as deepFreeze } from "./formatter-CIMnJqKX.js";
12
12
  var ConfigurationError = class ConfigurationError extends Error {
13
13
  static _LABEL = "Invalid configuration";
14
14
  static _normalizeReason(reason) {
@@ -72,4 +72,4 @@ var ConfigurationError = class ConfigurationError extends Error {
72
72
  }
73
73
  };
74
74
  export { ConfigurationError as t };
75
- //# sourceMappingURL=client-DgQRjdo8.js.map
75
+ //# sourceMappingURL=client-fLOTSaWY.js.map