@rzl-zone/build-tools 0.0.11 → 0.0.12

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 (80) 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 +4 -4
  4. package/dist/bundler/rolldown.cjs.map +1 -1
  5. package/dist/bundler/rolldown.d.cts +2 -2
  6. package/dist/bundler/rolldown.d.ts +2 -2
  7. package/dist/bundler/rolldown.js +1 -1
  8. package/dist/bundler/rolldown.js.map +1 -1
  9. package/dist/bundler/tsdown.cjs +9 -9
  10. package/dist/bundler/tsdown.cjs.map +1 -1
  11. package/dist/bundler/tsdown.d.cts +2 -2
  12. package/dist/bundler/tsdown.d.ts +2 -2
  13. package/dist/bundler/tsdown.js +3 -3
  14. package/dist/bundler/tsdown.js.map +1 -1
  15. package/dist/bundler/utils.cjs +2 -2
  16. package/dist/bundler/utils.cjs.map +1 -1
  17. package/dist/bundler/utils.d.cts +2 -2
  18. package/dist/bundler/utils.d.ts +2 -2
  19. package/dist/bundler/utils.js +2 -2
  20. package/dist/bundler/utils.js.map +1 -1
  21. package/dist/client-B-L0njjX.js +75 -0
  22. package/dist/client-B-L0njjX.js.map +1 -0
  23. package/dist/client-BxJj_VrQ.cjs +81 -0
  24. package/dist/client-BxJj_VrQ.cjs.map +1 -0
  25. package/dist/commander-kit/index.cjs +84 -65
  26. package/dist/commander-kit/index.cjs.map +1 -1
  27. package/dist/commander-kit/index.d.cts +3 -3
  28. package/dist/commander-kit/index.d.ts +3 -3
  29. package/dist/commander-kit/index.js +24 -5
  30. package/dist/commander-kit/index.js.map +1 -1
  31. package/dist/{extra-BleSbKJp.d.ts → extra-CNDyFVA8.d.ts} +2 -2
  32. package/dist/{extra-C8r3KWjP.d.cts → extra-CtuOwfZ4.d.cts} +2 -2
  33. package/dist/{fast-globe-options-DnV58KJc.d.ts → fast-globe-options-Dj630IVV.d.ts} +3 -3
  34. package/dist/{fast-globe-options-D7S2fQZZ.d.cts → fast-globe-options-NcQT6Fg5.d.cts} +3 -3
  35. package/dist/{helper-C0AShk-j.js → formatter-Bd8fVs2h.js} +88 -3
  36. package/dist/formatter-Bd8fVs2h.js.map +1 -0
  37. package/dist/{helper-DNj9Sj4w.cjs → formatter-DEp7VUev.cjs} +142 -14
  38. package/dist/formatter-DEp7VUev.cjs.map +1 -0
  39. package/dist/{identity-CcYkvy9q.js → identity-BaFHc-2R.js} +5 -6
  40. package/dist/{identity-CcYkvy9q.js.map → identity-BaFHc-2R.js.map} +1 -1
  41. package/dist/{identity-Crq3bzhv.cjs → identity-C9ff_g77.cjs} +14 -15
  42. package/dist/{identity-Crq3bzhv.cjs.map → identity-C9ff_g77.cjs.map} +1 -1
  43. package/dist/{index-DlH2PDPD.d.cts → index-BXqEWtZV.d.cts} +2 -2
  44. package/dist/{index-BdtMQyzF.d.cts → index-DgaO182z.d.cts} +2 -2
  45. package/dist/{index-CwHGSras.d.ts → index-qpwsLgqK.d.ts} +2 -2
  46. package/dist/{index-NLQcJJFO.d.ts → index-uMbOxPvL.d.ts} +2 -2
  47. package/dist/index.cjs +221 -274
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +5 -5
  50. package/dist/index.d.ts +5 -5
  51. package/dist/index.js +5 -58
  52. package/dist/index.js.map +1 -1
  53. package/dist/{package-banner-DkNDAjMK.js → package-banner-Bk5L__8h.js} +4 -5
  54. package/dist/{package-banner-DkNDAjMK.js.map → package-banner-Bk5L__8h.js.map} +1 -1
  55. package/dist/package-banner-Pjznq5SP.cjs +59 -0
  56. package/dist/{package-banner-BoS7Lbi9.cjs.map → package-banner-Pjznq5SP.cjs.map} +1 -1
  57. package/dist/server-BsqxhpCl.js +198 -0
  58. package/dist/server-BsqxhpCl.js.map +1 -0
  59. package/dist/server-CyO1Pxp8.cjs +255 -0
  60. package/dist/server-CyO1Pxp8.cjs.map +1 -0
  61. package/dist/utils/client.cjs +12 -11
  62. package/dist/utils/client.d.cts +1 -1
  63. package/dist/utils/client.d.ts +1 -1
  64. package/dist/utils/client.js +3 -2
  65. package/dist/utils/server.cjs +5 -2
  66. package/dist/utils/server.d.cts +433 -3
  67. package/dist/utils/server.d.ts +433 -3
  68. package/dist/utils/server.js +3 -3
  69. package/package.json +6 -4
  70. package/dist/client-CuivP4z0.cjs +0 -221
  71. package/dist/client-CuivP4z0.cjs.map +0 -1
  72. package/dist/client-DzeqTq6Y.js +0 -160
  73. package/dist/client-DzeqTq6Y.js.map +0 -1
  74. package/dist/helper-C0AShk-j.js.map +0 -1
  75. package/dist/helper-DNj9Sj4w.cjs.map +0 -1
  76. package/dist/package-banner-BoS7Lbi9.cjs +0 -60
  77. package/dist/server-CvLC0e2m.cjs +0 -181
  78. package/dist/server-CvLC0e2m.cjs.map +0 -1
  79. package/dist/server-Dc93jndm.js +0 -142
  80. package/dist/server-Dc93jndm.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-DzeqTq6Y.js","names":[],"sources":["../src/utils/helper/node-require.ts","../src/utils/helper/formatter.ts","../src/utils/errors/configuration-error.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Module } from \"node:module\";\nimport { isFunction, isObject } from \"@/_internal/utils/helper\";\n\n/** ----------------------------------------------------------------\n * * ***Typed mapping of commonly-used Node.js builtin module identifiers\n * (including `node:`-prefixed and legacy aliases).***\n * ----------------------------------------------------------------\n *\n * This is a **best-effort typing helper**, not a canonical or version-\n * exhaustive list of all Node.js builtins.\n *\n * - ***⚠️ Note:***\n * - This map provides **type-level hints only**.\n * - Presence in this map does **not guarantee runtime availability**.\n * - Availability of entries depends on the installed TypeScript version and `@types/node`.\n *\n * Consumers must ensure a Node.js runtime before calling `require`\n * with these identifiers.\n */\nexport type NodeBuiltinModuleMap = {\n // ======================\n // Filesystem\n // ======================\n \"node:fs\": typeof import(\"node:fs\");\n fs: typeof import(\"node:fs\");\n \"node:fs/promises\": typeof import(\"node:fs/promises\");\n \"fs/promises\": typeof import(\"node:fs/promises\");\n\n // ======================\n // Path / URL\n // ======================\n \"node:path\": typeof import(\"node:path\");\n path: typeof import(\"node:path\");\n \"node:url\": typeof import(\"node:url\");\n url: typeof import(\"node:url\");\n\n // ======================\n // OS / Process\n // ======================\n \"node:os\": typeof import(\"node:os\");\n os: typeof import(\"node:os\");\n \"node:process\": typeof import(\"node:process\");\n process: typeof import(\"node:process\");\n\n // ======================\n // Module system\n // ======================\n \"node:module\": typeof import(\"node:module\");\n module: typeof import(\"node:module\");\n\n // ======================\n // Buffer / Timers\n // ======================\n \"node:buffer\": typeof import(\"node:buffer\");\n buffer: typeof import(\"node:buffer\");\n \"node:timers\": typeof import(\"node:timers\");\n timers: typeof import(\"node:timers\");\n \"node:timers/promises\": typeof import(\"node:timers/promises\");\n \"timers/promises\": typeof import(\"node:timers/promises\");\n\n // ======================\n // Streams\n // ======================\n \"node:stream\": typeof import(\"node:stream\");\n stream: typeof import(\"node:stream\");\n \"node:stream/promises\": typeof import(\"node:stream/promises\");\n \"stream/promises\": typeof import(\"node:stream/promises\");\n \"node:stream/consumers\": typeof import(\"node:stream/consumers\");\n \"stream/consumers\": typeof import(\"node:stream/consumers\");\n \"node:stream/web\": typeof import(\"node:stream/web\");\n \"stream/web\": typeof import(\"node:stream/web\");\n\n // ======================\n // Crypto / Net / TLS\n // ======================\n \"node:crypto\": typeof import(\"node:crypto\");\n crypto: typeof import(\"node:crypto\");\n \"node:net\": typeof import(\"node:net\");\n net: typeof import(\"node:net\");\n \"node:tls\": typeof import(\"node:tls\");\n tls: typeof import(\"node:tls\");\n\n // ======================\n // HTTP\n // ======================\n \"node:http\": typeof import(\"node:http\");\n http: typeof import(\"node:http\");\n \"node:https\": typeof import(\"node:https\");\n https: typeof import(\"node:https\");\n \"node:http2\": typeof import(\"node:http2\");\n http2: typeof import(\"node:http2\");\n\n // ======================\n // Child / Worker\n // ======================\n \"node:child_process\": typeof import(\"node:child_process\");\n child_process: typeof import(\"node:child_process\");\n \"node:worker_threads\": typeof import(\"node:worker_threads\");\n worker_threads: typeof import(\"node:worker_threads\");\n\n // ======================\n // Events / Util / Assert\n // ======================\n \"node:events\": typeof import(\"node:events\");\n events: typeof import(\"node:events\");\n \"node:util\": typeof import(\"node:util\");\n util: typeof import(\"node:util\");\n \"node:assert\": typeof import(\"node:assert\");\n assert: typeof import(\"node:assert\");\n \"node:assert/strict\": typeof import(\"node:assert/strict\");\n \"assert/strict\": typeof import(\"node:assert/strict\");\n\n // ======================\n // Diagnostics / Debug\n // ======================\n \"node:diagnostics_channel\": typeof import(\"node:diagnostics_channel\");\n diagnostics_channel: typeof import(\"node:diagnostics_channel\");\n \"node:inspector\": typeof import(\"node:inspector\");\n inspector: typeof import(\"node:inspector\");\n\n // ======================\n // Encoding\n // ======================\n \"node:string_decoder\": typeof import(\"node:string_decoder\");\n string_decoder: typeof import(\"node:string_decoder\");\n\n // ======================\n // Readline / REPL\n // ======================\n \"node:readline\": typeof import(\"node:readline\");\n readline: typeof import(\"node:readline\");\n \"node:readline/promises\": typeof import(\"node:readline/promises\");\n \"readline/promises\": typeof import(\"node:readline/promises\");\n \"node:repl\": typeof import(\"node:repl\");\n repl: typeof import(\"node:repl\");\n\n // ======================\n // DNS\n // ======================\n \"node:dns\": typeof import(\"node:dns\");\n dns: typeof import(\"node:dns\");\n \"node:dns/promises\": typeof import(\"node:dns/promises\");\n \"dns/promises\": typeof import(\"node:dns/promises\");\n\n // ======================\n // Zlib\n // ======================\n \"node:zlib\": typeof import(\"node:zlib\");\n zlib: typeof import(\"node:zlib\");\n\n // ======================\n // VM / V8\n // ======================\n \"node:vm\": typeof import(\"node:vm\");\n vm: typeof import(\"node:vm\");\n \"node:v8\": typeof import(\"node:v8\");\n v8: typeof import(\"node:v8\");\n\n // ======================\n // Performance / Trace\n // ======================\n \"node:perf_hooks\": typeof import(\"node:perf_hooks\");\n perf_hooks: typeof import(\"node:perf_hooks\");\n \"node:trace_events\": typeof import(\"node:trace_events\");\n trace_events: typeof import(\"node:trace_events\");\n\n // ======================\n // Async / Legacy\n // ======================\n \"node:async_hooks\": typeof import(\"node:async_hooks\");\n async_hooks: typeof import(\"node:async_hooks\");\n \"node:domain\": typeof import(\"node:domain\");\n domain: typeof import(\"node:domain\");\n\n // ======================\n // Constants\n // ======================\n \"node:constants\": typeof import(\"node:constants\");\n constants: typeof import(\"node:constants\");\n};\n\n/** ----------------------------------------------------------------\n * * ***Callable `require`-like interface (runtime-safe).***\n * ----------------------------------------------------------------\n *\n * Represents a **minimal, honest abstraction** of Node.js `require`\n * that is safe to reference in mixed runtimes (CJS, ESM, bundlers,\n * and non-Node environments).\n *\n * - ***This type intentionally:***\n * - Requires only the callable signature `(id: string) => any`.\n * - Treats all standard `require` properties (`resolve`, `cache`,\n * `main`, etc.) as **optional**.\n *\n * This avoids lying to the type system while still allowing\n * property access when a real Node.js `require` is available.\n *\n */\ntype RequireCallable = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (id: string): any;\n} & Partial<NodeJS.Require>;\n\n/** ------------------------------------------------------------------------\n * * Global object shape exposing a `require` function.\n * -------------------------------------------------------------------------\n *\n * Describes environments where a global `require` function may exist.\n *\n * This is commonly used for **runtime detection**, such as checking\n * whether `require` is available before attempting to use it.\n *\n * @example\n * ```ts\n * const g = globalThis as typeof globalThis & GlobalWithRequire;\n *\n * if (typeof g.require === \"function\") {\n * const fs = g.require(\"fs\");\n * }\n * ```\n */\ntype GlobalWithRequire = { require: RequireCallable };\n\n/** ----------------------------------------------------------------\n * * ***Runtime type guard for a global `require` function.***\n * ----------------------------------------------------------------\n *\n * Determines whether a given value exposes a **callable `require`\n * property** at runtime.\n *\n * This guard does **not assume a Node.js environment** and does not\n * rely on environment heuristics such as `process`, `Node`, or\n * `process.versions.node`.\n *\n * - ***Instead, it performs a **pure runtime structural check**:***\n * - The value must be an object.\n * - It must expose a `require` property.\n * - That property must be callable.\n *\n * - ***This makes the guard safe to use in:***\n * - Node.js (CommonJS).\n * - Node.js (ESM / loader contexts).\n * - Bundler execution environments.\n * - Browsers (where it will correctly return `false`).\n *\n * Implemented as a **user-defined type guard** to enable proper\n * TypeScript narrowing, allowing safe access to `value.require`\n * without repeated casting.\n *\n * @param value - Any value to test for a global `require` function.\n * @returns `true` if the value exposes a callable `require` property.\n *\n */\nexport const hasGlobalRequire = (value: unknown): value is GlobalWithRequire =>\n isObject(value) && isFunction(value.require);\n\n/** ----------------------------------------------------------------\n * * ***Safely resolve the global `require` function.***\n * ----------------------------------------------------------------\n *\n * Attempts to retrieve the global CommonJS `require` function\n * if and only if it is **actually available at runtime**.\n *\n * Unlike naive Node checks (e.g. `process.versions.node`),\n * this function avoids false positives in environments such as:\n * - Node.js ESM loaders.\n * - Build-time execution environments.\n * - Bundler config evaluation.\n *\n * If `require` is not present, this function returns `undefined`\n * instead of throwing.\n *\n * ----------------------------------------------------------------\n * - ***⚠️ Note:***\n * - This helper intentionally does not attempt to detect\n * loader-injected or sandboxed `require` bindings.\n * ----------------------------------------------------------------\n *\n * @returns The global `require` function if available; otherwise `undefined`.\n */\nexport const getRuntimeRequire = (): RequireCallable | undefined => {\n if (!hasGlobalRequire(globalThis)) return undefined;\n return globalThis.require;\n};\n\n/** ----------------------------------------------------------------\n * * ***Deferred runtime `require` accessor.***\n * ----------------------------------------------------------------\n *\n * Provides a **lazy, runtime-resolved accessor** for a `require`\n * function without creating a static reference.\n *\n * - ***Intended for:***\n * - Runtime-agnostic tooling.\n * - Build / bundler utilities.\n * - CLI infrastructure.\n * - ***Behavior:***\n * - Delegates to a real `require` function *only if one exists at runtime*.\n * - Avoids top-level `require` references that bundlers may rewrite.\n * - Remains callable even when `require` is absent.\n *\n * When `Proxy` is available, property access (e.g. `require.resolve`)\n * is dynamically forwarded to the real `require` once it becomes\n * available.\n *\n * If invoked in an environment that does not expose `require`,\n * the call fails with a descriptive runtime error.\n *\n * ⚠️ Typed overloads do not guarantee that the requested module\n * exists or can be resolved at runtime.\n *\n * Runtime errors may still occur depending on the execution environment.\n *\n * ⚠️ This is **not** a polyfill and does **not** emulate Node.js\n * CommonJS resolution. It merely defers access to an existing\n * `require` function when present.\n *\n * ⚠️ When accessed before a real `require` is available,\n * properties such as `resolve`, `cache`, or `main`\n * may be `undefined`.\n */\nexport const __runtimeRequire: {\n <K extends keyof NodeBuiltinModuleMap>(id: K): NodeBuiltinModuleMap[K];\n (id: string): unknown;\n} = ((x: RequireCallable) => {\n const r = getRuntimeRequire();\n\n if (r) return r;\n\n if (typeof Proxy !== \"undefined\") {\n return new Proxy(x, {\n get(target, prop: keyof RequireCallable) {\n const r2 = getRuntimeRequire();\n return r2 ? r2[prop] : target[prop];\n }\n });\n }\n\n return x;\n})(function (this: unknown, id: string) {\n const r = getRuntimeRequire();\n if (r) return r.call(this, id);\n\n throw new Error(\n `Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`\n );\n});\n\n/** ----------------------------------------------------------------\n * * ***Lazily resolves Node.js `createRequire`.***\n * ----------------------------------------------------------------\n *\n * Lazily resolves Node.js {@link Module.createRequire | **`createRequire`**}\n * **at runtime** using a strategy that is safe across mixed execution\n * environments (CJS, ESM, bundlers, and tooling contexts).\n *\n * - ***This helper intentionally avoids:***\n * - Static ESM imports that may execute during build time.\n * - Direct top-level `require` access that bundlers can rewrite or hoist.\n *\n * - ***Resolution strategy:***\n * - If a global CommonJS `require` is available at runtime, the\n * `node:module` builtin is loaded through the deferred.\n * {@link __runtimeRequire | **`__runtimeRequire`**} accessor.\n * - Otherwise, falls back to a dynamic `import(\"node:module\")`,\n * which is safe in ESM-only or bundled environments.\n *\n * This function does **not** assume a Node.js environment at evaluation\n * time, but **does require Node.js at runtime**. It will throw if the\n * `node:module` builtin cannot be resolved by either strategy.\n *\n * - ***Intended for:***\n * - Tooling that operates across mixed CJS / ESM runtimes.\n * - Bundler or compiler internals.\n * - CLI configuration and plugin loaders.\n *\n * @returns\n * A reference to Node.js {@link Module.createRequire | **`createRequire`**}.\n *\n * @throws\n * Throws if the `node:module` builtin cannot be resolved at runtime.\n *\n * @example\n * ***ESM / bundler-safe usage:***\n * ```ts\n * const createRequire = await getCreateRequire();\n *\n * const require = createRequire(import.meta.url);\n *\n * const fs = require(\"fs\");\n * const path = require(\"path\");\n *\n * console.log(fs.existsSync(path.resolve(\"package.json\")));\n * ```\n *\n * @example\n * ***Loading CommonJS or JSON config from ESM:***\n * ```ts\n * const createRequire = await getCreateRequire();\n *\n * const require = createRequire(process.cwd() + \"/\");\n *\n * const config = require(\"./my.config.cjs\");\n * const pkg = require(\"./package.json\");\n * ```\n *\n * @example\n * ***CommonJS (Node.js – compatibility usage):***\n *\n * In pure CommonJS environments this helper is usually unnecessary.\n * This example demonstrates interoperability with the same runtime-safe API.\n *\n * ```js\n * (async () => {\n * const { getCreateRequire } = await import(\"./getCreateRequire.js\");\n *\n * const createRequire = await getCreateRequire();\n * const requireFromHere = createRequire(__filename);\n *\n * const pkg = requireFromHere(\"some-cjs-only-package\");\n * console.log(pkg);\n * })();\n * ```\n *\n * @example\n * ***UMD / IIFE (Node execution):***\n * ```js\n * const createRequire = await getCreateRequire();\n *\n * const requireFromHere =\n * typeof __filename !== \"undefined\"\n * ? createRequire(__filename)\n * : createRequire(import.meta.url);\n *\n * const pkg = requireFromHere(\"some-cjs-only-package\");\n * ```\n */\nexport async function getCreateRequire(): Promise<\n typeof import(\"node:module\").createRequire\n> {\n const r = getRuntimeRequire();\n if (r) {\n return __runtimeRequire(\"node:module\").createRequire;\n }\n\n // ESM-safe fallback (unrun / tsdown / bundlers)\n const mod = await import(\"node:module\");\n return mod.createRequire;\n}\n","import type { Colors } from \"picocolors/types\";\nimport pcr from \"picocolors\";\n\nimport {\n isArray,\n isBoolean,\n isMap,\n isNil,\n isNonEmptyString,\n isNumber,\n isObject,\n isPlainObject,\n isRegExp,\n isSet,\n isString\n} from \"@/_internal/utils/helper\";\nimport { __runtimeRequire, hasGlobalRequire } from \"./node-require\";\n\ntype Picocolors = Colors & {\n createColors: (enabled?: boolean) => Colors;\n};\n\n/** ----------------------------------------------------------------\n * * ***Re-export of the `picocolors` default export.***\n * ----------------------------------------------------------------\n * This utility provides a lightweight and dependency-free\n * terminal color formatting helper, identical to the\n * original `picocolors` package export.\n *\n * - **It is re-exported to:**\n * - Provide a stable internal import path.\n * - Avoid direct dependency imports in consumers.\n * - Ensure consistent color handling across the codebase.\n *\n * @see {@link https://github.com/alexeyraspopov/picocolors | **`picocolors repository`**.}\n */\nexport const picocolors: Picocolors = pcr;\n\n/** ----------------------------------------------------------------\n * * ***Normalized newline character.***\n * ----------------------------------------------------------------\n *\n * Represents a single line feed character (`\\n`), used as a\n * **consistent newline** across all platforms.\n *\n * This value is intentionally **not platform-specific** and does\n * not vary between operating systems (e.g. Windows CRLF vs POSIX LF).\n * It is suitable for generated files, formatters, and build tools\n * where deterministic output is required.\n *\n * The value is base64-encoded to avoid embedding a literal newline\n * in the bundled output during minification.\n *\n * @type {string}\n */\nexport const NEWLINE: string = atob(\"Cg==\");\n\n/** ----------------------------------------------------------------\n * * ***Platform-specific end-of-line character.***\n * ----------------------------------------------------------------\n *\n * Resolves to the operating system's default end-of-line sequence:\n * - `\\n` on POSIX systems (Linux, macOS)\n * - `\\r\\n` on Windows\n *\n * Used to ensure generated multiline strings are compatible\n * with the host environment.\n *\n * In non-Node environments, this value falls back to `\\n`.\n * The fallback is encoded to avoid embedding a literal newline\n * in the bundled output during minification.\n *\n * @type {string}\n */\nexport const EOL: string = hasGlobalRequire(globalThis)\n ? __runtimeRequire(\"node:os\").EOL\n : NEWLINE;\n\n/** -------------------------------------------------------\n * * ***Utility Function: `plural`.***\n * -------------------------------------------------------\n * **Returns the correct singular or plural form of a word\n * based on a numeric count.**\n *\n * This helper is commonly used when generating human-readable\n * CLI messages where a word must change depending on quantity.\n *\n * By default, the function pluralizes a word by appending `\"s\"`\n * when the `count` is not equal to `1`.\n *\n * For irregular plural forms, a custom `pluralWord` may be\n * provided explicitly.\n *\n * ⚠️ This utility performs **simple English pluralization only**.\n * It does **not** automatically handle irregular plural forms\n * such as `person ➔ people` or `child ➔ children` unless the\n * plural form is provided manually.\n *\n * - **Behavior:**\n * - If `count === 1` ➔ returns the singular `word`.\n * - Otherwise ➔ returns `pluralWord` if provided,\n * or `${word}s` by default.\n *\n * @param count - The numeric count used to determine pluralization.\n * @param word - The singular form of the word.\n * @param pluralWord - Optional explicit plural form.\n *\n * @returns The appropriate singular or plural word form.\n *\n * @example\n * ```ts\n * plural(1, \"file\");\n * // ➔ \"file\"\n *\n * plural(3, \"file\");\n * // ➔ \"files\"\n * ```\n *\n * @example\n * ```ts\n * plural(1, \"person\", \"people\");\n * // ➔ \"person\"\n *\n * plural(5, \"person\", \"people\");\n * // ➔ \"people\"\n * ```\n *\n * @example\n * ```ts\n * const count = 2;\n * console.log(`${count} ${plural(count, \"file\")} copied`);\n * // ➔ \"2 files copied\"\n * ```\n */\nexport function plural(\n count: number,\n word: string,\n pluralWord?: string\n): string {\n if (count === 1) return word;\n return pluralWord ?? `${word}s`;\n}\n\n/** ----------------------------------------------------------------\n * * ***Conditionally pads a value with leading and/or trailing spaces.***\n * ----------------------------------------------------------------\n *\n * Formats a value by optionally prepending and/or appending a single\n * space character (`\" \"`), depending on the provided options.\n *\n * Only **valid non-empty strings** are padded.\n * A value is considered **invalid** when it is:\n * - not a string.\n * - an empty string (`\"\"`).\n * - a string containing only whitespace.\n *\n * When the value is invalid, this utility can optionally return\n * a single space instead of an empty string.\n *\n * @param {unknown} value - The value to be padded.\n * @param {{ start?: boolean; end?: boolean; padOnInvalid?: boolean; }} options - Padding behavior configuration.\n * @param options.start - Prepend a single space before the value.\n * @param options.end - Append a single space after the value.\n * @param options.padOnInvalid - Return a single space when the value\n * is not a valid non-empty string.\n *\n * @returns A formatted string with optional leading and/or trailing\n * spaces, or a single space / empty string when the input is invalid.\n *\n * @example\n * ```ts\n * padText(\"hello\");\n * // ➔ \" hello \"\n * ```\n *\n * @example\n * ```ts\n * padText(\"hello\", { start: true, end: false });\n * // ➔ \" hello\"\n * ```\n *\n * @example\n * ```ts\n * padText(\"\", { padOnInvalid: true });\n * // ➔ \" \"\n * ```\n *\n * @example\n * ```ts\n * padText(null, { padOnInvalid: false });\n * // ➔ \"\"\n * ```\n */\nexport function padText(\n value: unknown,\n options: {\n /**\n * Whether to prepend a single space to the output.\n *\n * @default true\n */\n start?: boolean;\n\n /**\n * Whether to append a single space to the output.\n *\n * @default true\n */\n end?: boolean;\n\n /**\n * Return a single space when the input is not a valid non-empty string.\n *\n * This applies to non-string values, empty strings,\n * or strings containing only whitespace.\n *\n * @default true\n */\n padOnInvalid?: boolean;\n } = {}\n): string {\n const { start = true, end = true, padOnInvalid = true } = options;\n if (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n return `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\n\n/** ----------------------------------------------------------------\n * * ***Joins text segments into a compact space-separated string.***\n * ----------------------------------------------------------------\n *\n * Joins multiple values into a single string separated by a\n * **single space character** (`\" \"`).\n *\n * This utility removes all non-renderable values before joining,\n * producing a compact inline string without unintended spacing.\n *\n * - *Filtering behavior:*\n * - `false`, `null`, and `undefined` are removed.\n * - Empty strings (`\"\"`) are also removed.\n *\n * This makes the output suitable for inline text composition\n * where line breaks and extra spacing are not desired.\n *\n * - *Useful for:*\n * - Inline CLI messages.\n * - Error summaries.\n * - Concatenating optional labels or fragments.\n * - Single-line log output.\n *\n * @param {Array<string | false | null | undefined>} text - A list of\n * strings or falsy values to be joined. Empty strings are excluded\n * to prevent extra spaces in the output.\n *\n * @returns {string} A single string with values joined by a\n * single space character.\n *\n * @example\n * ```ts\n * joinInline(\"Hello\", false, \"\", \"world\");\n * // ➔ \"Hello world\"\n * ```\n *\n * @example\n * ```ts\n * joinInline(\n * \"Error:\",\n * undefined,\n * \"Invalid\",\n * null,\n * \"input\"\n * );\n * // ➔ \"Error: Invalid input\"\n * ```\n */\nexport function joinInline(\n ...text: Array<string | false | null | undefined>\n): string {\n return text.filter(Boolean).join(\" \");\n}\n\n/** ----------------------------------------------------------------\n * * ***Joins text lines into a compact newline-separated string.***\n * ----------------------------------------------------------------\n *\n * Joins multiple values into a single string separated by the\n * platform-specific end-of-line character ({@link EOL | **`EOL`**}).\n *\n * This utility removes all non-renderable values before joining,\n * ensuring a compact output with no unintended blank lines.\n *\n * - *Filtering behavior:*\n * - `false`, `null`, and `undefined` are removed.\n * - Empty strings (`\"\"`) are also removed.\n *\n * This makes the output dense and suitable for cases where\n * vertical spacing should not be preserved.\n *\n * - *Useful for:*\n * - CLI error messages.\n * - Compact help or status output.\n * - Multi-line logs without spacing gaps.\n *\n * @param {Array<string | false | null | undefined>} text - A list of\n * strings or falsy values to be joined. Empty strings are excluded\n * to prevent blank lines in the output.\n *\n * @returns {string} A single string joined using the OS-specific\n * end-of-line character.\n *\n * @example\n * ```ts\n * joinLines(\"Line 1\", false, \"\", \"Line 2\");\n * // ➔ \"Line 1\\nLine 2\"\n * ```\n *\n * @example\n * ```ts\n * joinLines(\n * \"Header\",\n * undefined,\n * \"\",\n * \"Body\",\n * null,\n * \"Footer\"\n * );\n * // ➔ \"Header\\nBody\\nFooter\"\n * ```\n */\nexport function joinLines(\n ...text: Array<string | false | null | undefined>\n): string {\n return text.filter(Boolean).join(EOL);\n}\n\n/** ----------------------------------------------------------------\n * * ***Joins text lines while preserving explicit empty lines.***\n * ----------------------------------------------------------------\n *\n * Joins multiple values into a single string separated by the\n * platform-specific end-of-line character ({@link EOL | **`EOL`**}).\n *\n * Unlike {@link joinLines | **`joinLines`**}, this variant **preserves empty strings**\n * (`\"\"`) to intentionally create blank lines in the output.\n *\n * - *Filtering behavior:*\n * - `false`, `null`, and `undefined` are removed.\n * - Empty strings (`\"\"`) are kept as-is.\n *\n * This allows precise control over vertical spacing when composing\n * formatted text.\n *\n * - *Useful for:*\n * - CLI help output with paragraph separation.\n * - Multi-section descriptions.\n * - Human-readable documentation formatting.\n *\n * @param {Array<string | false | null | undefined>} text - A list of\n * strings or falsy values to be joined. Empty strings are preserved\n * to produce blank lines in the output.\n *\n * @returns {string} A single string joined using the OS-specific\n * end-of-line character.\n *\n * @example\n * ```ts\n * joinLinesLoose(\n * \"Line one\",\n * \"Line two\",\n * \"\",\n * \"New paragraph\"\n * );\n * // ➔ \"Line one\\nLine two\\n\\nNew paragraph\"\n * ```\n *\n * @example\n * ```ts\n * joinLinesLoose(\n * \"Header\",\n * null,\n * \"\",\n * \"Body\",\n * false,\n * null,\n * undefined\n * );\n * // ➔ \"Header\\n\\nBody\"\n * ```\n */\nexport function joinLinesLoose(\n ...text: Array<string | false | null | undefined>\n): string {\n return text\n .filter((v): v is string => v !== false && v !== null && v !== undefined)\n .join(EOL);\n}\n\ntype FormatOptionValueOptions = {\n /**\n * @default false\n */\n pretty?: boolean;\n /**\n * @default 2\n */\n indent?: number;\n /**\n * @default false\n */\n sortKeys?: boolean;\n /**\n * @default false\n */\n sortArray?: boolean;\n};\n\n/** ----------------------------------------------------------------\n * * Formats a value into a compact, colorized CLI representation.\n * ----------------------------------------------------------------\n *\n * Recursively converts an arbitrary value into a human-readable,\n * ANSI-colored string intended strictly for terminal output.\n *\n * This formatter is designed for developer-facing CLI diagnostics\n * and must NOT be used for logging, serialization, persistence,\n * or programmatic comparison.\n *\n * - *Behavior:*\n * - Arrays are rendered inline: `[a, b, c]`.\n * - `Set` values are converted to arrays before rendering.\n * - `Map` values are converted to plain objects via `Object.fromEntries`.\n * - Plain objects are rendered inline: `{ key: value }`.\n * - `RegExp` values are colorized by delimiter, source, and flags.\n * - Strings are wrapped in double quotes.\n * - Numbers (including `NaN`) and booleans are highlighted.\n * - `null` and `undefined` are red-bright color.\n * - Other objects fall back to `Object.prototype.toString`.\n *\n * - *Characteristics:*\n * - Recursive.\n * - Compact (single-line).\n * - No pretty-print indentation.\n * - No key or array sorting.\n * - No JSON serialization.\n * - No circular reference handling.\n *\n * @param value - The value to format for CLI display.\n *\n * @returns A colorized string optimized for terminal readability.\n *\n * @example\n * formatOptionValue([\"a\", \"b\"]);\n * // ➔ [ \"a\", \"b\" ]\n *\n * @example\n * formatOptionValue({ foo: 1, bar: true });\n * // ➔ { foo: 1, bar: true }\n *\n * @example\n * formatOptionValue(new Set([\"dist/**\"]));\n * // ➔ [ \"dist/**\" ]\n *\n * @example\n * formatOptionValue(/abc/i);\n * // ➔ /abc/i (colorized segments)\n */\nexport function formatOptionValue(\n value: unknown,\n options?: FormatOptionValueOptions\n): string {\n const {\n pretty = false,\n indent = 2,\n sortKeys = false,\n sortArray = false\n } = options ?? {};\n\n const indentUnit = \" \".repeat(indent);\n\n function formatRecursive(input: unknown, depth = 0): string {\n const currentIndent = indentUnit.repeat(depth);\n const nextIndent = indentUnit.repeat(depth + 1);\n const joinInline = picocolors.dim(\", \");\n const joinPretty = `,${EOL}`;\n\n /* ------------------------------------------------------------ */\n /* Set ➔ Array */\n /* ------------------------------------------------------------ */\n if (isSet(input)) {\n return formatRecursive([...input], depth);\n }\n\n /* ------------------------------------------------------------ */\n /* Map ➔ Plain Object */\n /* ------------------------------------------------------------ */\n if (isMap(input)) {\n return formatRecursive(Object.fromEntries(input), depth);\n }\n\n /* ------------------------------------------------------------ */\n /* Array */\n /* ------------------------------------------------------------ */\n if (isArray(input)) {\n const arr = sortArray ? [...input].sort() : input;\n\n if (arr.length === 0) return picocolors.gray(\"[]\");\n\n if (!pretty) {\n const items = arr\n .map((v) => formatRecursive(v, depth))\n .join(joinInline);\n return picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n }\n\n const items = arr\n .map((v) => nextIndent + formatRecursive(v, depth + 1))\n .join(joinPretty);\n\n return (\n picocolors.gray(`[${EOL}`) +\n items +\n EOL +\n currentIndent +\n picocolors.gray(\"]\")\n );\n }\n\n /* ------------------------------------------------------------ */\n /* Plain Object */\n /* ------------------------------------------------------------ */\n if (isPlainObject(input)) {\n let entries = Object.entries(input);\n\n if (sortKeys) {\n entries = entries.sort(([a], [b]) => a.localeCompare(b));\n }\n\n if (entries.length === 0) return picocolors.gray(\"{}\");\n\n if (!pretty) {\n const props = entries\n .map(([key, val]) => {\n return (\n picocolors.dim(key) +\n picocolors.gray(\": \") +\n formatRecursive(val, depth)\n );\n })\n .join(joinInline);\n\n return picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n }\n\n const props = entries\n .map(([key, val]) => {\n return (\n nextIndent +\n picocolors.dim(key) +\n picocolors.gray(\": \") +\n formatRecursive(val, depth + 1)\n );\n })\n .join(joinPretty);\n\n return (\n picocolors.gray(`{${EOL}`) +\n props +\n EOL +\n currentIndent +\n picocolors.gray(\"}\")\n );\n }\n\n /* ------------------------------------------------------------ */\n /* RegExp */\n /* ------------------------------------------------------------ */\n if (isRegExp(input)) {\n return (\n picocolors.greenBright(\"/\") +\n picocolors.redBright(input.source) +\n picocolors.greenBright(\"/\") +\n picocolors.magentaBright(input.flags)\n );\n }\n\n /* ------------------------------------------------------------ */\n /* Primitive */\n /* ------------------------------------------------------------ */\n if (isString(input)) {\n return picocolors.gray(`\"${input}\"`);\n }\n\n if (isNumber(input, { includeNaN: true })) {\n return picocolors.redBright(String(input));\n }\n\n if (isBoolean(input)) {\n return picocolors.redBright(String(input));\n }\n\n if (isNil(input)) {\n return picocolors.redBright(String(input));\n }\n\n if (isObject(input)) {\n return picocolors.cyanBright(Object.prototype.toString.call(input));\n }\n\n return picocolors.cyanBright(String(input));\n }\n\n return formatRecursive(value);\n}\n","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8PA,MAAa,oBAAoB,UAC/B,SAAS,MAAM,IAAI,WAAW,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;AA0B9C,MAAa,0BAAuD;AAClE,KAAI,CAAC,iBAAiB,WAAW,CAAE,QAAO;AAC1C,QAAO,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCpB,MAAa,qBAGP,MAAuB;CAC3B,MAAM,IAAI,mBAAmB;AAE7B,KAAI,E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AAM,QAAQ,EACjD;GACE;GACA,GAAI,UAAU,EAAE,SAAS,GAAG,EAAE;GAC/B,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper-C0AShk-j.js","names":[],"sources":["../src/_internal/utils/helper.ts"],"sourcesContent":["import type {\n AnObjectNonArray,\n AnyFunction,\n Arrayable,\n Extends,\n IsArray,\n IsNever,\n NonPlainObject,\n OrArr,\n ReadonlyDeep\n} from \"@/_internal/types/extra\";\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function deepFreeze<T>(value: T): ReadonlyDeep<T> {\n if (typeof value !== \"object\" || value === null) {\n return value as ReadonlyDeep<T>;\n }\n\n const seen = new WeakSet<object>();\n const stack: object[] = [value as object];\n\n while (stack.length) {\n const obj = stack.pop()!;\n\n if (seen.has(obj) || Object.isFrozen(obj)) continue;\n\n seen.add(obj);\n\n // Map\n if (isMap(obj)) {\n for (const [k, v] of obj) {\n if (typeof k === \"object\" && k !== null) stack.push(k);\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n }\n\n // Set\n else if (isSet(obj)) {\n for (const v of obj) {\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n }\n\n // Fast path Array\n else if (isArray(obj)) {\n for (const v of obj) {\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n } else {\n const record = obj as Record<PropertyKey, unknown>;\n\n for (const key of Reflect.ownKeys(record)) {\n const v = record[key];\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n\n // const descriptors = Object.getOwnPropertyDescriptors(obj);\n\n // for (const key of Reflect.ownKeys(descriptors)) {\n // const desc = descriptors[key as keyof typeof descriptors];\n // if (!desc) continue;\n\n // if (\"value\" in desc) {\n // const v = desc.value;\n // if (typeof v === \"object\" && v !== null) stack.push(v);\n // }\n // }\n }\n\n Object.freeze(obj);\n }\n\n return value as ReadonlyDeep<T>;\n}\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function isObjectLoose<T>(\n value: T\n): value is Extract<T, object | AnyFunction> {\n return !isNil(value) && (isObjectOrArray(value) || isFunction(value));\n}\n\nexport function isObjectLike<T>(value: T): value is Extract<T, object> {\n return !isFunction(value) && isObjectLoose(value);\n}\n// ----------------------------------------------------------------\n\n/** ----------------------------------------------------------------\n * * ***Check whether a value is thenable (Promise-like).***\n * ----------------------------------------------------------------\n *\n * Determines whether a value implements a `.then()` method and can be\n * treated as a **thenable** object.\n *\n * This includes:\n * - Native `Promise`.\n * - Promise-like objects returned by libraries.\n * - Custom objects implementing `.then()`.\n *\n * ----------------------------------------------------------------\n *\n * @typeParam T\n * The resolved value type of the thenable.\n *\n * @param v\n * The value to check.\n *\n * @returns\n * `true` if the value is thenable, otherwise `false`.\n *\n * When `true`, the value is narrowed to `PromiseLike<T>`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * isThenable(Promise.resolve(1));\n * // ➔ true\n *\n * isThenable({ then: () => {} });\n * // ➔ true\n *\n * isThenable(123);\n * // ➔ false\n * ```\n *\n * @example\n * ```ts\n * async function unwrap<T>(value: T | Promise<T>) {\n * if (isThenable<T>(value)) {\n * return await value;\n * }\n *\n * return value;\n * }\n * ```\n *\n * @remarks\n * Thenables are typically resolved before function execution to support async config factories without enforcing `Promise` instances.\n * - This function checks **behavior**, not identity.\n * - The value does **not** have to be an instance of `Promise`.\n * - Useful for async utilities, lazy evaluation, and hybrid sync/async APIs.\n *\n * @internal\n */\nexport const isThenable = <T = unknown>(v: unknown): v is PromiseLike<T> =>\n v != null &&\n (typeof v === \"object\" || typeof v === \"function\") &&\n typeof (v as PromiseLike<T>).then === \"function\";\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isRegExp = (value: unknown): value is RegExp => {\n return value instanceof RegExp;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isString = (value: unknown): value is string => {\n return typeof value === \"string\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function isSet<T = unknown>(value: Set<T>): value is Set<T>;\nexport function isSet(value: unknown): value is Set<unknown>;\nexport function isSet(value: unknown): boolean {\n return (\n Object.prototype.toString.call(value) === \"[object Set]\" ||\n value instanceof Set\n );\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function isMap<K = unknown, V = unknown>(\n value: Map<K, V>\n): value is Map<K, V>;\nexport function isMap(value: unknown): value is Map<unknown, unknown>;\nexport function isMap(value: unknown): boolean {\n return (\n Object.prototype.toString.call(value) === \"[object Map]\" ||\n value instanceof Map\n );\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype ArrayFallback<T> =\n IsNever<Extract<T, unknown[] | readonly unknown[]>> extends true\n ? unknown[] & T\n : Extract<T, unknown[] | readonly unknown[]>;\n\n/** @internal */\nexport function isArray<T>(value: T): value is ArrayFallback<T>;\n// export function isArray<T>(value: T): value is IsNever<Extract<T, unknown[]>> extends true ? unknown[]: Extract<T, unknown[]>;\nexport function isArray(value: unknown): value is unknown[];\nexport function isArray(value: unknown): boolean {\n return Array.isArray(value);\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isNull = (val: unknown): val is null => val === null;\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsPlainObjectResult<T> = unknown extends T\n ? Record<PropertyKey, unknown> & T\n : T extends object\n ? T extends NonPlainObject\n ? never\n : IsHasKeysObject<T> extends false\n ? Record<PropertyKey, unknown> & T\n : T\n : Extract<T, Record<PropertyKey, unknown>>;\n\n/** @internal */\nexport function isPlainObject<T>(value: T): value is IsPlainObjectResult<T>;\nexport function isPlainObject<T>(\n value: T\n): value is NonNullable<Extract<T, Record<PropertyKey, unknown>>>;\nexport function isPlainObject(value: unknown) {\n if (!isObject(value)) return false;\n\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsObject<T> = unknown extends T\n ? T & Record<PropertyKey, unknown>\n : T extends object\n ? T extends AnObjectNonArray\n ? T\n : IsHasKeysObject<T> extends false\n ? T & Record<PropertyKey, unknown>\n : IsArray<T> extends true\n ? Exclude<T, unknown[]>\n : T\n : never;\n\n/** @internal */\nexport function isObject<T extends object>(value: T): value is IsObject<T>;\nexport function isObject(value: unknown): value is Record<PropertyKey, unknown>;\nexport function isObject(value: unknown): boolean {\n return typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsHasKeysObject<T> = keyof T extends never ? false : true;\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsObjectOrArray<T> =\n OrArr<\n [IsNever<T>, Extends<T, Record<PropertyKey, unknown>>, Extends<unknown, T>]\n > extends true\n ? T & Record<PropertyKey, unknown> & unknown[]\n : T extends object\n ? T extends unknown[]\n ? T\n : T extends AnObjectNonArray\n ? T\n : IsHasKeysObject<T> extends false\n ? T & Record<PropertyKey, unknown>\n : T\n : Extract<T, Record<PropertyKey, unknown> & unknown[]>;\n\n/** @internal */\nexport function isObjectOrArray(value: []): value is [];\nexport function isObjectOrArray<T>(value: T): value is IsObjectOrArray<T>;\nexport function isObjectOrArray<T>(value: T): boolean {\n return isArray(value) || isObject(value);\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isNil = (value: unknown): value is null | undefined => {\n return value == null;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isBoolean = (value: unknown): value is boolean => {\n return typeof value === \"boolean\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isUndefined = (value: unknown): value is undefined => {\n return typeof value === \"undefined\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n return typeof value === \"function\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport const isNumberObject = (value: unknown): value is Number => {\n return (\n isObject(value) &&\n Object.prototype.toString.call(value) === \"[object Number]\"\n );\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport const isStringObject = (value: unknown): value is String => {\n return (\n isObject(value) &&\n Object.prototype.toString.call(value) === \"[object String]\"\n );\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport const isBooleanObject = (value: unknown): value is Boolean => {\n return (\n isObject(value) &&\n Object.prototype.toString.call(value) === \"[object Boolean]\"\n );\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isInfinityNumber = (value: unknown): boolean => {\n if (typeof value === \"number\" || isNumberObject(value)) {\n const num = Number(value);\n return num === Infinity || num === -Infinity;\n }\n return false;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isSymbol = (value: unknown): value is symbol => {\n return typeof value === \"symbol\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isBigInt = (value: unknown): value is bigint => {\n return typeof value === \"bigint\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isNaN = (value: unknown): boolean => {\n return typeof value === \"number\"\n ? Number.isNaN(value)\n : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsNonEmptyStringOptions = {\n /** Whether to trim the string before checking, defaultValue: `true`.\n *\n * @default true */\n trim?: boolean;\n};\n\n/** @internal */\nexport const isNonEmptyString = (\n value: unknown,\n options: IsNonEmptyStringOptions = {}\n): value is string => {\n if (!isString(value)) return false;\n\n const trim = options.trim ?? true;\n\n const str = trim ? value.trim() : value;\n\n return str.length > 0;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsNumberOptions = {\n /** If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.\n *\n * @default false\n */\n includeNaN?: boolean;\n};\n\n/** @internal */\nexport const isNumber = (\n value: unknown,\n options: IsNumberOptions = {}\n): value is number => {\n const includeNaN =\n isPlainObject(options) && isBoolean(options.includeNaN)\n ? options.includeNaN\n : false;\n\n const aNumber = typeof value === \"number\";\n return includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isError = (error: unknown): error is Error => {\n return (\n Object.prototype.toString.call(error) === \"[object Error]\" ||\n error instanceof Error\n );\n};\n// ----------------------------------------------------------------\n\n/** @internal */\ntype isDateOptions = {\n /** * ***Skip the validity check (`!isNaN(date.getTime())`).***\n *\n * When `true`, the function only checks that the value is an\n * instance of `Date` without verifying that it represents a valid\n * date value, default: `false`.\n *\n * @default false\n */\n skipInvalidDate?: boolean;\n};\n\n/** @internal */\nexport const isDate = (\n value: unknown,\n options: isDateOptions = {}\n): value is Date => {\n const skipInvalidDate =\n isPlainObject(options) && isBoolean(options.skipInvalidDate)\n ? options.skipInvalidDate\n : false;\n\n const instanceDate = value instanceof Date;\n\n if (skipInvalidDate) return instanceDate;\n return instanceDate && !isNaN(value.getTime());\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport type SafeStableStringifyOptions = {\n /** -------------------------------------------------\n * * ***Whether to sort **object keys** alphabetically (recursively).***\n * -------------------------------------------------\n *\n * - `true` (default): object keys are sorted to ensure stable output.\n * - `false`: preserves original insertion order of keys.\n *\n * @default true\n */\n sortKeys?: boolean;\n /** -------------------------------------------------\n * * ***Whether to sort **primitive values inside arrays**.***\n * -------------------------------------------------\n *\n * - `true`: primitive values in arrays are sorted to ensure stable output.\n * - `false` (default): arrays retain their original order; objects and nested arrays are not reordered.\n *\n * @default false\n */\n sortArray?: boolean;\n /** -------------------------------------------------\n * * ***Whether to pretty-print JSON output with 2-space indentation.***\n * -------------------------------------------------\n *\n * - `true`: output is formatted with indentation and newlines.\n * - `false` (default): produces compact single-line JSON.\n *\n * @default false\n */\n pretty?: boolean;\n /** -------------------------------------------------\n * * ***Preserve `undefined` values instead of converting them to `null`.***\n * -------------------------------------------------\n * **Controls how the internal `deepProcess` step rewrites values\n * **before** the final `JSON.stringify` call.**\n * - **Default (`false`):**\n * * Every `undefined` value (object properties **and** array elements)\n * is replaced with `null` **before** serialization, because this happens\n * first, the key is **not removed** by `JSON.stringify`.\n * - **`true`** – Leaves `undefined` untouched so the final\n * `JSON.stringify` call behaves natively:\n * * Object properties with `undefined` are **removed**.\n * * Array elements that are `undefined` become `null`.\n * @default false\n * @example\n * // ✅ keepUndefined = true: behaves like native JSON.stringify\n * safeStableStringify({ a: undefined }, { keepUndefined: true });\n * // ➔ '{}' // key removed\n *\n * // ✅ Default (false): convert undefined to null, key kept\n * safeStableStringify({ a: undefined });\n * // ➔ '{\"a\":null}' // key present, value null\n *\n * // Arrays\n * safeStableStringify([undefined]);\n * // ➔ '[null]' // same, but via pre-replacement\n * safeStableStringify([undefined], { keepUndefined: true });\n * // ➔ '[null]' // element becomes null\n */\n keepUndefined?: boolean;\n};\n\n/** @internal */\nexport const safeStableStringify = (\n value: unknown,\n options: SafeStableStringifyOptions = {}\n): string => {\n const pretty = options.pretty ?? false;\n const sortKeys = options.sortKeys ?? true;\n const sortArray = options.sortArray ?? false;\n const keepUndefined = options.keepUndefined ?? false;\n\n if (isUndefined(value)) {\n return keepUndefined ? \"undefined\" : \"null\";\n }\n\n const seen = new WeakSet();\n\n const isPrimitive = (val: unknown): boolean =>\n isNull(val) || (!isObjectOrArray(val) && !isFunction(val));\n\n const deepProcess = (val: unknown): unknown => {\n if (isNumberObject(val)) {\n const valOf = val.valueOf();\n return isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n }\n if (isStringObject(val)) return val.valueOf();\n if (isBooleanObject(val)) return val.valueOf();\n if (isFunction(val) || isSymbol(val)) return undefined;\n if (isBigInt(val)) return val.toString();\n if (isNaN(val) || isInfinityNumber(val)) return null;\n if (isUndefined(val)) {\n return keepUndefined ? undefined : null;\n }\n\n if (isObjectOrArray(val)) {\n if (seen.has(val)) return \"[Circular]\";\n seen.add(val);\n\n if (isDate(val)) return val.toISOString();\n if (isMap(val)) {\n return {\n map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)])\n };\n }\n if (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\n if (isArray(val)) {\n const processedArr = val.map(deepProcess);\n if (sortArray) {\n const primitives: unknown[] = [];\n const nonPrimitives: unknown[] = [];\n\n for (const item of processedArr) {\n if (isPrimitive(item)) primitives.push(item);\n else nonPrimitives.push(item);\n }\n primitives.sort((a, b) => {\n if (isNumber(a) && isNumber(b)) return a - b;\n return String(a).localeCompare(String(b));\n });\n return [...primitives, ...nonPrimitives];\n }\n return processedArr;\n }\n\n const keys = Object.keys(val);\n if (sortKeys) {\n keys.sort((a, b) => {\n const na = Number(a);\n const nb = Number(b);\n if (!isNaN(na) && !isNaN(nb)) return na - nb;\n return a.localeCompare(b);\n });\n }\n\n const result: Record<string, unknown> = {};\n\n if (isObject(val)) {\n for (const k of keys) {\n const v = deepProcess(val[k]);\n if (!isUndefined(v)) result[k] = v;\n }\n }\n\n return result;\n }\n\n return val;\n };\n\n try {\n return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n } catch (err) {\n console.warn(\"Error in safeStableStringify:\", err);\n return \"{}\";\n }\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** @internal */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n\n// ----------------------------------------------------------------\n\n/** ----------------------------------------------------------------\n * * ***Checks whether a value is an array of strings.***\n * ----------------------------------------------------------------\n *\n * Type guard that validates the input is an `Array` where **all**\n * elements are strings.\n *\n * @param {unknown} v - The value to test.\n *\n * @returns {boolean} `true` if the value is a `string[]`.\n *\n * @internal\n */\nexport const isStringArray = (v: unknown): v is string[] =>\n isArray(v) && v.every((i) => isString(i));\n\n/** ----------------------------------------------------------------\n * * ***Checks whether a value is a Set of strings.***\n * ----------------------------------------------------------------\n *\n * Type guard that validates the input is a `Set` where **all**\n * entries are strings.\n *\n * @param {unknown} v - The value to test.\n *\n * @returns {boolean} `true` if the value is a `Set<string>`.\n *\n * @internal\n */\nexport const isStringSet = (v: unknown): v is Set<string> =>\n isSet(v) && [...v].every((i) => isString(i));\n\n/** ----------------------------------------------------------------\n * * ***Asserts that a value is a valid pattern input.***\n * ----------------------------------------------------------------\n *\n * Runtime assertion that validates the provided value is one of the\n * supported pattern types:\n * - `string`.\n * - `string[]`.\n * - `Set<string>`.\n *\n * This function is intended to be used at API boundaries to ensure\n * type safety before further processing.\n *\n * @param {unknown} v - The value to validate.\n * @param {string|undefined} parameterKey - The key parameter to identity which is invalid, default `\"pattern\"`.\n *\n * @throws {TypeError} If the value is not a valid pattern input.\n *\n * @example\n * ```ts\n * assertValidatePatternArgs(pattern);\n * // pattern is now typed as:\n * // string | string[] | Set<string>\n * ```\n *\n * @internal\n */\nexport const assertValidatePatternArgs: (\n v: unknown,\n parameterKey?: string\n) => asserts v is string | string[] | Set<string> = (\n v: unknown,\n parameterKey: string = \"pattern\"\n) => {\n if (!isString(v) && !isStringArray(v) && !isStringSet(v)) {\n throw new TypeError(\n `The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`\n );\n }\n};\n\n/** ----------------------------------------------------------------\n * * ***Flattens nested arrays and extracts string values only.***\n * ----------------------------------------------------------------\n *\n * Recursively flattens an input array to **infinite depth** and\n * filters out all non-string values.\n *\n * - *Normalization rules:*\n * - Nested arrays are flattened using `Array.prototype.flat(Infinity)`.\n * - Only values with `typeof === \"string\"` are kept.\n * - Non-string values are discarded.\n *\n * The returned array is always a **new instance** and does not mutate\n * the original input.\n *\n * @param {readonly unknown[]} input - Arbitrary nested array input.\n *\n * @returns {string[]} A flat array containing only string values.\n *\n * @example\n * ```ts\n * flattenStrings([\"a\", [\"b\", [\"c\"]], 1, null]);\n * // ➔ [\"a\", \"b\", \"c\"]\n * ```\n *\n * @internal\n */\nexport const flattenStrings = (input: readonly unknown[]): string[] => {\n return input.flat(Infinity).filter((v): v is string => typeof v === \"string\");\n};\n\n/** ----------------------------------------------------------------\n * * ***Normalizes pattern input into a new `Set<string>` instance.***\n * ----------------------------------------------------------------\n *\n * Converts a pattern value into a deduplicated `Set<string>` for\n * consistent internal handling.\n *\n * #### Normalization behavior\n * - `string` ➔ wrapped into a `Set`.\n * - `string[]` ➔ converted into a `Set` (duplicates removed).\n * - `Set<string>` ➔ cloned into a new `Set`.\n *\n * The returned set is **always a new instance** and the original\n * input is never mutated.\n *\n * #### Validation\n * When `withValidationType` is `true` (default), the input will be\n * validated before normalization.\n *\n * If the provided `pattern` is not one of the supported types,\n * a `TypeError` will be thrown.\n *\n * @param pattern - Pattern value to normalize.\n * @param options - Optional configuration object.\n * @param options.withValidationType - Whether to validate the input\n * before normalization. Defaults to `true`.\n * @param options.parameterKey - The key parameter to identity which is invalid, default `\"pattern\"`.\n *\n * @returns A new deduplicated `Set<string>` instance.\n *\n * @throws {TypeError}\n * Thrown when `pattern` is not a `string`, `string[]`, or `Set<string>`\n * and validation is enabled.\n *\n * @example\n * ```ts\n * toStringSet(\"a\");\n * // ➔ Set { \"a\" }\n * ```\n *\n * @example\n * ```ts\n * toStringSet([\"a\", \"b\", \"a\"]);\n * // ➔ Set { \"a\", \"b\" }\n * ```\n *\n * @example\n * ```ts\n * toStringSet(new Set([\"x\", \"y\"]));\n * // ➔ Set { \"x\", \"y\" }\n * ```\n *\n * @example\n * ```ts\n * toStringSet(123 as any);\n * // ❌ Throws TypeError\n * ```\n *\n * @example\n * ```ts\n * // Disable validation (use cautiously)\n * toStringSet(\"a\", { withValidationType: false });\n * toStringSet(123 as any, { withValidationType: false });\n * ```\n *\n * @internal\n */\nexport const toStringSet = (\n pattern: string | string[] | Set<string>,\n options: {\n withValidationType?: boolean;\n /**\n * The key parameter to identity which is invalid.\n *\n * @default \"pattern\"\n */\n parameterKey?: string;\n } = {}\n): Set<string> => {\n const { withValidationType = true, parameterKey = \"pattern\" } = options;\n if (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\n return toObjectSet(pattern);\n};\n\n/** ----------------------------------------------------------------\n * * ***Normalizes a value into a deduplicated `Set`.***\n * ----------------------------------------------------------------\n *\n * Converts a single value, array, or existing `Set` into a `Set<T>`\n * for consistent internal handling.\n *\n * - *Normalization rules:*\n * - `T` ➔ wrapped in a `Set`.\n * - `T[]` ➔ converted to a `Set` (duplicates removed).\n * - `Set<T>` ➔ returned as-is.\n *\n * The returned `Set` is **not mutated** internally by this function.\n * If an existing `Set` is provided, it will be reused.\n *\n * @typeParam T - Value type stored in the set.\n *\n * @param {T | T[] | Set<T>} value - Value to normalize.\n *\n * @returns {Set<T>} A deduplicated set of values.\n *\n * @example\n * ```ts\n * toObjectSet(1);\n * // ➔ Set { 1 }\n * ```\n *\n * @example\n * ```ts\n * toObjectSet([1, 2, 1]);\n * // ➔ Set { 1, 2 }\n * ```\n *\n * @example\n * ```ts\n * toObjectSet(new Set([1, 2]));\n * // ➔ Set { 1, 2 }\n * ```\n *\n * @internal\n */\nexport const toObjectSet = <T>(value: T | T[] | Set<T>): Set<T> => {\n if (isSet(value)) return value;\n\n return new Set(isArray(value) ? value : [value]);\n};\n\n/** ----------------------------------------------------------------\n * * ***Normalize a value into an array.***\n * ----------------------------------------------------------------\n *\n * Converts a single value or an array-like value into a **new array**\n * with consistent typing.\n *\n * - If `value` is already an array ➔ returned as-is.\n * - If `value` is a single item ➔ wrapped in an array.\n *\n * This utility is useful for APIs or configs that accept\n * either a single value or multiple values.\n *\n * ----------------------------------------------------------------\n *\n * @typeParam T\n * The element type of the resulting array.\n *\n * @param value\n * A value or array of values.\n *\n * @returns\n * A normalized array of type `T[]`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * toArray(1);\n * // ➔ [1]\n *\n * toArray(\"hello\");\n * // ➔ [\"hello\"]\n *\n * toArray([1, 2, 3]);\n * // ➔ [1, 2, 3]\n * ```\n *\n * @example\n * ```ts\n * type User = { id: number };\n *\n * toArray<User>({ id: 1 });\n * // ➔ [{ id: 1 }]\n *\n * toArray<User>([{ id: 1 }, { id: 2 }]);\n * // ➔ [{ id: 1 }, { id: 2 }]\n * ```\n *\n * @remarks\n * This function does **not** flatten nested arrays.\n * If `value` is already an array, the original reference is preserved.\n *\n * @internal\n */\nexport const toArray = <T>(value: Arrayable<T>): T[] => {\n return isArray(value) ? value : [value];\n};\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,WAAc,OAA2B;AACvD,KAAI,OAAO,UAAU,YAAY,UAAU,KACzC,QAAO;CAGT,MAAM,uBAAO,IAAI,SAAiB;CAClC,MAAM,QAAkB,CAAC,MAAgB;AAEzC,QAAO,MAAM,QAAQ;EACnB,MAAM,MAAM,MAAM,KAAK;AAEvB,MAAI,KAAK,IAAI,IAAI,IAAI,OAAO,SAAS,IAAI,CAAE;AAE3C,OAAK,IAAI,IAAI;AAGb,MAAI,MAAM,IAAI,CACZ,MAAK,MAAM,CAAC,GAAG,MAAM,KAAK;AACxB,OAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;AACtD,OAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;;WAKjD,MAAM,IAAI,EACjB;QAAK,MAAM,KAAK,IACd,KAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;aAKjD,QAAQ,IAAI,EACnB;QAAK,MAAM,KAAK,IACd,KAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;SAEnD;GACL,MAAM,SAA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Nj9Sj4w.cjs","names":[],"sources":["../src/_internal/utils/helper.ts"],"sourcesContent":["import type {\n AnObjectNonArray,\n AnyFunction,\n Arrayable,\n Extends,\n IsArray,\n IsNever,\n NonPlainObject,\n OrArr,\n ReadonlyDeep\n} from \"@/_internal/types/extra\";\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function deepFreeze<T>(value: T): ReadonlyDeep<T> {\n if (typeof value !== \"object\" || value === null) {\n return value as ReadonlyDeep<T>;\n }\n\n const seen = new WeakSet<object>();\n const stack: object[] = [value as object];\n\n while (stack.length) {\n const obj = stack.pop()!;\n\n if (seen.has(obj) || Object.isFrozen(obj)) continue;\n\n seen.add(obj);\n\n // Map\n if (isMap(obj)) {\n for (const [k, v] of obj) {\n if (typeof k === \"object\" && k !== null) stack.push(k);\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n }\n\n // Set\n else if (isSet(obj)) {\n for (const v of obj) {\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n }\n\n // Fast path Array\n else if (isArray(obj)) {\n for (const v of obj) {\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n } else {\n const record = obj as Record<PropertyKey, unknown>;\n\n for (const key of Reflect.ownKeys(record)) {\n const v = record[key];\n if (typeof v === \"object\" && v !== null) stack.push(v);\n }\n\n // const descriptors = Object.getOwnPropertyDescriptors(obj);\n\n // for (const key of Reflect.ownKeys(descriptors)) {\n // const desc = descriptors[key as keyof typeof descriptors];\n // if (!desc) continue;\n\n // if (\"value\" in desc) {\n // const v = desc.value;\n // if (typeof v === \"object\" && v !== null) stack.push(v);\n // }\n // }\n }\n\n Object.freeze(obj);\n }\n\n return value as ReadonlyDeep<T>;\n}\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function isObjectLoose<T>(\n value: T\n): value is Extract<T, object | AnyFunction> {\n return !isNil(value) && (isObjectOrArray(value) || isFunction(value));\n}\n\nexport function isObjectLike<T>(value: T): value is Extract<T, object> {\n return !isFunction(value) && isObjectLoose(value);\n}\n// ----------------------------------------------------------------\n\n/** ----------------------------------------------------------------\n * * ***Check whether a value is thenable (Promise-like).***\n * ----------------------------------------------------------------\n *\n * Determines whether a value implements a `.then()` method and can be\n * treated as a **thenable** object.\n *\n * This includes:\n * - Native `Promise`.\n * - Promise-like objects returned by libraries.\n * - Custom objects implementing `.then()`.\n *\n * ----------------------------------------------------------------\n *\n * @typeParam T\n * The resolved value type of the thenable.\n *\n * @param v\n * The value to check.\n *\n * @returns\n * `true` if the value is thenable, otherwise `false`.\n *\n * When `true`, the value is narrowed to `PromiseLike<T>`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * isThenable(Promise.resolve(1));\n * // ➔ true\n *\n * isThenable({ then: () => {} });\n * // ➔ true\n *\n * isThenable(123);\n * // ➔ false\n * ```\n *\n * @example\n * ```ts\n * async function unwrap<T>(value: T | Promise<T>) {\n * if (isThenable<T>(value)) {\n * return await value;\n * }\n *\n * return value;\n * }\n * ```\n *\n * @remarks\n * Thenables are typically resolved before function execution to support async config factories without enforcing `Promise` instances.\n * - This function checks **behavior**, not identity.\n * - The value does **not** have to be an instance of `Promise`.\n * - Useful for async utilities, lazy evaluation, and hybrid sync/async APIs.\n *\n * @internal\n */\nexport const isThenable = <T = unknown>(v: unknown): v is PromiseLike<T> =>\n v != null &&\n (typeof v === \"object\" || typeof v === \"function\") &&\n typeof (v as PromiseLike<T>).then === \"function\";\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isRegExp = (value: unknown): value is RegExp => {\n return value instanceof RegExp;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isString = (value: unknown): value is string => {\n return typeof value === \"string\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function isSet<T = unknown>(value: Set<T>): value is Set<T>;\nexport function isSet(value: unknown): value is Set<unknown>;\nexport function isSet(value: unknown): boolean {\n return (\n Object.prototype.toString.call(value) === \"[object Set]\" ||\n value instanceof Set\n );\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport function isMap<K = unknown, V = unknown>(\n value: Map<K, V>\n): value is Map<K, V>;\nexport function isMap(value: unknown): value is Map<unknown, unknown>;\nexport function isMap(value: unknown): boolean {\n return (\n Object.prototype.toString.call(value) === \"[object Map]\" ||\n value instanceof Map\n );\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype ArrayFallback<T> =\n IsNever<Extract<T, unknown[] | readonly unknown[]>> extends true\n ? unknown[] & T\n : Extract<T, unknown[] | readonly unknown[]>;\n\n/** @internal */\nexport function isArray<T>(value: T): value is ArrayFallback<T>;\n// export function isArray<T>(value: T): value is IsNever<Extract<T, unknown[]>> extends true ? unknown[]: Extract<T, unknown[]>;\nexport function isArray(value: unknown): value is unknown[];\nexport function isArray(value: unknown): boolean {\n return Array.isArray(value);\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isNull = (val: unknown): val is null => val === null;\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsPlainObjectResult<T> = unknown extends T\n ? Record<PropertyKey, unknown> & T\n : T extends object\n ? T extends NonPlainObject\n ? never\n : IsHasKeysObject<T> extends false\n ? Record<PropertyKey, unknown> & T\n : T\n : Extract<T, Record<PropertyKey, unknown>>;\n\n/** @internal */\nexport function isPlainObject<T>(value: T): value is IsPlainObjectResult<T>;\nexport function isPlainObject<T>(\n value: T\n): value is NonNullable<Extract<T, Record<PropertyKey, unknown>>>;\nexport function isPlainObject(value: unknown) {\n if (!isObject(value)) return false;\n\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsObject<T> = unknown extends T\n ? T & Record<PropertyKey, unknown>\n : T extends object\n ? T extends AnObjectNonArray\n ? T\n : IsHasKeysObject<T> extends false\n ? T & Record<PropertyKey, unknown>\n : IsArray<T> extends true\n ? Exclude<T, unknown[]>\n : T\n : never;\n\n/** @internal */\nexport function isObject<T extends object>(value: T): value is IsObject<T>;\nexport function isObject(value: unknown): value is Record<PropertyKey, unknown>;\nexport function isObject(value: unknown): boolean {\n return typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsHasKeysObject<T> = keyof T extends never ? false : true;\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsObjectOrArray<T> =\n OrArr<\n [IsNever<T>, Extends<T, Record<PropertyKey, unknown>>, Extends<unknown, T>]\n > extends true\n ? T & Record<PropertyKey, unknown> & unknown[]\n : T extends object\n ? T extends unknown[]\n ? T\n : T extends AnObjectNonArray\n ? T\n : IsHasKeysObject<T> extends false\n ? T & Record<PropertyKey, unknown>\n : T\n : Extract<T, Record<PropertyKey, unknown> & unknown[]>;\n\n/** @internal */\nexport function isObjectOrArray(value: []): value is [];\nexport function isObjectOrArray<T>(value: T): value is IsObjectOrArray<T>;\nexport function isObjectOrArray<T>(value: T): boolean {\n return isArray(value) || isObject(value);\n}\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isNil = (value: unknown): value is null | undefined => {\n return value == null;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isBoolean = (value: unknown): value is boolean => {\n return typeof value === \"boolean\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isUndefined = (value: unknown): value is undefined => {\n return typeof value === \"undefined\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n return typeof value === \"function\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport const isNumberObject = (value: unknown): value is Number => {\n return (\n isObject(value) &&\n Object.prototype.toString.call(value) === \"[object Number]\"\n );\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport const isStringObject = (value: unknown): value is String => {\n return (\n isObject(value) &&\n Object.prototype.toString.call(value) === \"[object String]\"\n );\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport const isBooleanObject = (value: unknown): value is Boolean => {\n return (\n isObject(value) &&\n Object.prototype.toString.call(value) === \"[object Boolean]\"\n );\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isInfinityNumber = (value: unknown): boolean => {\n if (typeof value === \"number\" || isNumberObject(value)) {\n const num = Number(value);\n return num === Infinity || num === -Infinity;\n }\n return false;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isSymbol = (value: unknown): value is symbol => {\n return typeof value === \"symbol\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isBigInt = (value: unknown): value is bigint => {\n return typeof value === \"bigint\";\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isNaN = (value: unknown): boolean => {\n return typeof value === \"number\"\n ? Number.isNaN(value)\n : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsNonEmptyStringOptions = {\n /** Whether to trim the string before checking, defaultValue: `true`.\n *\n * @default true */\n trim?: boolean;\n};\n\n/** @internal */\nexport const isNonEmptyString = (\n value: unknown,\n options: IsNonEmptyStringOptions = {}\n): value is string => {\n if (!isString(value)) return false;\n\n const trim = options.trim ?? true;\n\n const str = trim ? value.trim() : value;\n\n return str.length > 0;\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype IsNumberOptions = {\n /** If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.\n *\n * @default false\n */\n includeNaN?: boolean;\n};\n\n/** @internal */\nexport const isNumber = (\n value: unknown,\n options: IsNumberOptions = {}\n): value is number => {\n const includeNaN =\n isPlainObject(options) && isBoolean(options.includeNaN)\n ? options.includeNaN\n : false;\n\n const aNumber = typeof value === \"number\";\n return includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport const isError = (error: unknown): error is Error => {\n return (\n Object.prototype.toString.call(error) === \"[object Error]\" ||\n error instanceof Error\n );\n};\n// ----------------------------------------------------------------\n\n/** @internal */\ntype isDateOptions = {\n /** * ***Skip the validity check (`!isNaN(date.getTime())`).***\n *\n * When `true`, the function only checks that the value is an\n * instance of `Date` without verifying that it represents a valid\n * date value, default: `false`.\n *\n * @default false\n */\n skipInvalidDate?: boolean;\n};\n\n/** @internal */\nexport const isDate = (\n value: unknown,\n options: isDateOptions = {}\n): value is Date => {\n const skipInvalidDate =\n isPlainObject(options) && isBoolean(options.skipInvalidDate)\n ? options.skipInvalidDate\n : false;\n\n const instanceDate = value instanceof Date;\n\n if (skipInvalidDate) return instanceDate;\n return instanceDate && !isNaN(value.getTime());\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\nexport type SafeStableStringifyOptions = {\n /** -------------------------------------------------\n * * ***Whether to sort **object keys** alphabetically (recursively).***\n * -------------------------------------------------\n *\n * - `true` (default): object keys are sorted to ensure stable output.\n * - `false`: preserves original insertion order of keys.\n *\n * @default true\n */\n sortKeys?: boolean;\n /** -------------------------------------------------\n * * ***Whether to sort **primitive values inside arrays**.***\n * -------------------------------------------------\n *\n * - `true`: primitive values in arrays are sorted to ensure stable output.\n * - `false` (default): arrays retain their original order; objects and nested arrays are not reordered.\n *\n * @default false\n */\n sortArray?: boolean;\n /** -------------------------------------------------\n * * ***Whether to pretty-print JSON output with 2-space indentation.***\n * -------------------------------------------------\n *\n * - `true`: output is formatted with indentation and newlines.\n * - `false` (default): produces compact single-line JSON.\n *\n * @default false\n */\n pretty?: boolean;\n /** -------------------------------------------------\n * * ***Preserve `undefined` values instead of converting them to `null`.***\n * -------------------------------------------------\n * **Controls how the internal `deepProcess` step rewrites values\n * **before** the final `JSON.stringify` call.**\n * - **Default (`false`):**\n * * Every `undefined` value (object properties **and** array elements)\n * is replaced with `null` **before** serialization, because this happens\n * first, the key is **not removed** by `JSON.stringify`.\n * - **`true`** – Leaves `undefined` untouched so the final\n * `JSON.stringify` call behaves natively:\n * * Object properties with `undefined` are **removed**.\n * * Array elements that are `undefined` become `null`.\n * @default false\n * @example\n * // ✅ keepUndefined = true: behaves like native JSON.stringify\n * safeStableStringify({ a: undefined }, { keepUndefined: true });\n * // ➔ '{}' // key removed\n *\n * // ✅ Default (false): convert undefined to null, key kept\n * safeStableStringify({ a: undefined });\n * // ➔ '{\"a\":null}' // key present, value null\n *\n * // Arrays\n * safeStableStringify([undefined]);\n * // ➔ '[null]' // same, but via pre-replacement\n * safeStableStringify([undefined], { keepUndefined: true });\n * // ➔ '[null]' // element becomes null\n */\n keepUndefined?: boolean;\n};\n\n/** @internal */\nexport const safeStableStringify = (\n value: unknown,\n options: SafeStableStringifyOptions = {}\n): string => {\n const pretty = options.pretty ?? false;\n const sortKeys = options.sortKeys ?? true;\n const sortArray = options.sortArray ?? false;\n const keepUndefined = options.keepUndefined ?? false;\n\n if (isUndefined(value)) {\n return keepUndefined ? \"undefined\" : \"null\";\n }\n\n const seen = new WeakSet();\n\n const isPrimitive = (val: unknown): boolean =>\n isNull(val) || (!isObjectOrArray(val) && !isFunction(val));\n\n const deepProcess = (val: unknown): unknown => {\n if (isNumberObject(val)) {\n const valOf = val.valueOf();\n return isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n }\n if (isStringObject(val)) return val.valueOf();\n if (isBooleanObject(val)) return val.valueOf();\n if (isFunction(val) || isSymbol(val)) return undefined;\n if (isBigInt(val)) return val.toString();\n if (isNaN(val) || isInfinityNumber(val)) return null;\n if (isUndefined(val)) {\n return keepUndefined ? undefined : null;\n }\n\n if (isObjectOrArray(val)) {\n if (seen.has(val)) return \"[Circular]\";\n seen.add(val);\n\n if (isDate(val)) return val.toISOString();\n if (isMap(val)) {\n return {\n map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)])\n };\n }\n if (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\n if (isArray(val)) {\n const processedArr = val.map(deepProcess);\n if (sortArray) {\n const primitives: unknown[] = [];\n const nonPrimitives: unknown[] = [];\n\n for (const item of processedArr) {\n if (isPrimitive(item)) primitives.push(item);\n else nonPrimitives.push(item);\n }\n primitives.sort((a, b) => {\n if (isNumber(a) && isNumber(b)) return a - b;\n return String(a).localeCompare(String(b));\n });\n return [...primitives, ...nonPrimitives];\n }\n return processedArr;\n }\n\n const keys = Object.keys(val);\n if (sortKeys) {\n keys.sort((a, b) => {\n const na = Number(a);\n const nb = Number(b);\n if (!isNaN(na) && !isNaN(nb)) return na - nb;\n return a.localeCompare(b);\n });\n }\n\n const result: Record<string, unknown> = {};\n\n if (isObject(val)) {\n for (const k of keys) {\n const v = deepProcess(val[k]);\n if (!isUndefined(v)) result[k] = v;\n }\n }\n\n return result;\n }\n\n return val;\n };\n\n try {\n return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n } catch (err) {\n console.warn(\"Error in safeStableStringify:\", err);\n return \"{}\";\n }\n};\n\n// ----------------------------------------------------------------\n\n/** @internal */\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** @internal */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n\n// ----------------------------------------------------------------\n\n/** ----------------------------------------------------------------\n * * ***Checks whether a value is an array of strings.***\n * ----------------------------------------------------------------\n *\n * Type guard that validates the input is an `Array` where **all**\n * elements are strings.\n *\n * @param {unknown} v - The value to test.\n *\n * @returns {boolean} `true` if the value is a `string[]`.\n *\n * @internal\n */\nexport const isStringArray = (v: unknown): v is string[] =>\n isArray(v) && v.every((i) => isString(i));\n\n/** ----------------------------------------------------------------\n * * ***Checks whether a value is a Set of strings.***\n * ----------------------------------------------------------------\n *\n * Type guard that validates the input is a `Set` where **all**\n * entries are strings.\n *\n * @param {unknown} v - The value to test.\n *\n * @returns {boolean} `true` if the value is a `Set<string>`.\n *\n * @internal\n */\nexport const isStringSet = (v: unknown): v is Set<string> =>\n isSet(v) && [...v].every((i) => isString(i));\n\n/** ----------------------------------------------------------------\n * * ***Asserts that a value is a valid pattern input.***\n * ----------------------------------------------------------------\n *\n * Runtime assertion that validates the provided value is one of the\n * supported pattern types:\n * - `string`.\n * - `string[]`.\n * - `Set<string>`.\n *\n * This function is intended to be used at API boundaries to ensure\n * type safety before further processing.\n *\n * @param {unknown} v - The value to validate.\n * @param {string|undefined} parameterKey - The key parameter to identity which is invalid, default `\"pattern\"`.\n *\n * @throws {TypeError} If the value is not a valid pattern input.\n *\n * @example\n * ```ts\n * assertValidatePatternArgs(pattern);\n * // pattern is now typed as:\n * // string | string[] | Set<string>\n * ```\n *\n * @internal\n */\nexport const assertValidatePatternArgs: (\n v: unknown,\n parameterKey?: string\n) => asserts v is string | string[] | Set<string> = (\n v: unknown,\n parameterKey: string = \"pattern\"\n) => {\n if (!isString(v) && !isStringArray(v) && !isStringSet(v)) {\n throw new TypeError(\n `The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`\n );\n }\n};\n\n/** ----------------------------------------------------------------\n * * ***Flattens nested arrays and extracts string values only.***\n * ----------------------------------------------------------------\n *\n * Recursively flattens an input array to **infinite depth** and\n * filters out all non-string values.\n *\n * - *Normalization rules:*\n * - Nested arrays are flattened using `Array.prototype.flat(Infinity)`.\n * - Only values with `typeof === \"string\"` are kept.\n * - Non-string values are discarded.\n *\n * The returned array is always a **new instance** and does not mutate\n * the original input.\n *\n * @param {readonly unknown[]} input - Arbitrary nested array input.\n *\n * @returns {string[]} A flat array containing only string values.\n *\n * @example\n * ```ts\n * flattenStrings([\"a\", [\"b\", [\"c\"]], 1, null]);\n * // ➔ [\"a\", \"b\", \"c\"]\n * ```\n *\n * @internal\n */\nexport const flattenStrings = (input: readonly unknown[]): string[] => {\n return input.flat(Infinity).filter((v): v is string => typeof v === \"string\");\n};\n\n/** ----------------------------------------------------------------\n * * ***Normalizes pattern input into a new `Set<string>` instance.***\n * ----------------------------------------------------------------\n *\n * Converts a pattern value into a deduplicated `Set<string>` for\n * consistent internal handling.\n *\n * #### Normalization behavior\n * - `string` ➔ wrapped into a `Set`.\n * - `string[]` ➔ converted into a `Set` (duplicates removed).\n * - `Set<string>` ➔ cloned into a new `Set`.\n *\n * The returned set is **always a new instance** and the original\n * input is never mutated.\n *\n * #### Validation\n * When `withValidationType` is `true` (default), the input will be\n * validated before normalization.\n *\n * If the provided `pattern` is not one of the supported types,\n * a `TypeError` will be thrown.\n *\n * @param pattern - Pattern value to normalize.\n * @param options - Optional configuration object.\n * @param options.withValidationType - Whether to validate the input\n * before normalization. Defaults to `true`.\n * @param options.parameterKey - The key parameter to identity which is invalid, default `\"pattern\"`.\n *\n * @returns A new deduplicated `Set<string>` instance.\n *\n * @throws {TypeError}\n * Thrown when `pattern` is not a `string`, `string[]`, or `Set<string>`\n * and validation is enabled.\n *\n * @example\n * ```ts\n * toStringSet(\"a\");\n * // ➔ Set { \"a\" }\n * ```\n *\n * @example\n * ```ts\n * toStringSet([\"a\", \"b\", \"a\"]);\n * // ➔ Set { \"a\", \"b\" }\n * ```\n *\n * @example\n * ```ts\n * toStringSet(new Set([\"x\", \"y\"]));\n * // ➔ Set { \"x\", \"y\" }\n * ```\n *\n * @example\n * ```ts\n * toStringSet(123 as any);\n * // ❌ Throws TypeError\n * ```\n *\n * @example\n * ```ts\n * // Disable validation (use cautiously)\n * toStringSet(\"a\", { withValidationType: false });\n * toStringSet(123 as any, { withValidationType: false });\n * ```\n *\n * @internal\n */\nexport const toStringSet = (\n pattern: string | string[] | Set<string>,\n options: {\n withValidationType?: boolean;\n /**\n * The key parameter to identity which is invalid.\n *\n * @default \"pattern\"\n */\n parameterKey?: string;\n } = {}\n): Set<string> => {\n const { withValidationType = true, parameterKey = \"pattern\" } = options;\n if (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\n return toObjectSet(pattern);\n};\n\n/** ----------------------------------------------------------------\n * * ***Normalizes a value into a deduplicated `Set`.***\n * ----------------------------------------------------------------\n *\n * Converts a single value, array, or existing `Set` into a `Set<T>`\n * for consistent internal handling.\n *\n * - *Normalization rules:*\n * - `T` ➔ wrapped in a `Set`.\n * - `T[]` ➔ converted to a `Set` (duplicates removed).\n * - `Set<T>` ➔ returned as-is.\n *\n * The returned `Set` is **not mutated** internally by this function.\n * If an existing `Set` is provided, it will be reused.\n *\n * @typeParam T - Value type stored in the set.\n *\n * @param {T | T[] | Set<T>} value - Value to normalize.\n *\n * @returns {Set<T>} A deduplicated set of values.\n *\n * @example\n * ```ts\n * toObjectSet(1);\n * // ➔ Set { 1 }\n * ```\n *\n * @example\n * ```ts\n * toObjectSet([1, 2, 1]);\n * // ➔ Set { 1, 2 }\n * ```\n *\n * @example\n * ```ts\n * toObjectSet(new Set([1, 2]));\n * // ➔ Set { 1, 2 }\n * ```\n *\n * @internal\n */\nexport const toObjectSet = <T>(value: T | T[] | Set<T>): Set<T> => {\n if (isSet(value)) return value;\n\n return new Set(isArray(value) ? value : [value]);\n};\n\n/** ----------------------------------------------------------------\n * * ***Normalize a value into an array.***\n * ----------------------------------------------------------------\n *\n * Converts a single value or an array-like value into a **new array**\n * with consistent typing.\n *\n * - If `value` is already an array ➔ returned as-is.\n * - If `value` is a single item ➔ wrapped in an array.\n *\n * This utility is useful for APIs or configs that accept\n * either a single value or multiple values.\n *\n * ----------------------------------------------------------------\n *\n * @typeParam T\n * The element type of the resulting array.\n *\n * @param value\n * A value or array of values.\n *\n * @returns\n * A normalized array of type `T[]`.\n *\n * ----------------------------------------------------------------\n *\n * @example\n * ```ts\n * toArray(1);\n * // ➔ [1]\n *\n * toArray(\"hello\");\n * // ➔ [\"hello\"]\n *\n * toArray([1, 2, 3]);\n * // ➔ [1, 2, 3]\n * ```\n *\n * @example\n * ```ts\n * type User = { id: number };\n *\n * toArray<User>({ id: 1 });\n * // ➔ [{ id: 1 }]\n *\n * toArray<User>([{ id: 1 }, { id: 2 }]);\n * // ➔ [{ id: 1 }, { id: 2 }]\n * ```\n *\n * @remarks\n * This function does **not** flatten nested arrays.\n * If `value` is already an array, the original reference is preserved.\n *\n * @internal\n */\nexport const toArray = <T>(value: Arrayable<T>): T[] => {\n return isArray(value) ? value : [value];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAgB,WAAc,OAA2B;AACvD,KAAI,OAAO,UAAU,YAAY,UAAU,KACzC,QAAO;CAGT,MAAM,uBAAO,IAAI,SAAiB;CAClC,MAAM,QAAkB,CAAC,MAAgB;AAEzC,QAAO,MAAM,QAAQ;EACnB,MAAM,MAAM,MAAM,KAAK;AAEvB,MAAI,KAAK,IAAI,IAAI,IAAI,OAAO,SAAS,IAAI,CAAE;AAE3C,OAAK,IAAI,IAAI;AAGb,MAAI,MAAM,IAAI,CACZ,MAAK,MAAM,CAAC,GAAG,MAAM,KAAK;AACxB,OAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;AACtD,OAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;;WAKjD,MAAM,IAAI,EACjB;QAAK,MAAM,KAAK,IACd,KAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;aAKjD,QAAQ,IAAI,EACnB;QAAK,MAAM,KAAK,IACd,KAAI,OAAO,MAAM,YAAY,MAAM,KAAM,OAAM,KAAK,EAAE;SAEnD;GACL,MAAM,SAAS;AAEf,QAAK,MAAM,OAAO,QAAQ,QAAQ,OAAO,EAAE;IACzC,MAAM,IAAI,OAAO;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AAQ,IAAI;;;;;;;;;;;;;;;AAkBnC,MAAa,iBAAiB,MAC5B,QAAQ,EAAE,IAAI,EAAE,OAAO,MAAM,SAAS,EAAE,CAAC;;;;;;;;;;;;;;AAe3C,MAAa,eAAe,MAC1B,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,MAAM,SAAS,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6B9C,MAAa,6BAIX,GACA,eAAuB,cACpB;AACH,KAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,EAAE,CACtD,OAAM,IAAI,UACR,SAAS,aAAa,wDACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BL,MAAa,kBAAkB,UAAwC;AACrE,QAAO,MAAM,KAAK,SAAS,CAAC,QAAQ,MAAmB,OAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsE/E,MAAa,eACX,SACA,UAQI,EAAE,KACU;CAChB,MAAM,EAAE,qBAAqB,MAAM,eAAe,cAAc;AAChE,KAAI,mBAAoB,2BAA0B,SAAS,aAAa;AAExE,QAAO,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4C7B,MAAa,eAAkB,UAAoC;AACjE,KAAI,MAAM,MAAM,CAAE,QAAO;AAEzB,QAAO,IAAI,IAAI,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DlD,MAAa,WAAc,UAA6B;AACtD,QAAO,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM"}
@@ -1,60 +0,0 @@
1
- /*!
2
- * ========================================================================
3
- * @rzl-zone/build-tools
4
- * ------------------------------------------------------------------------
5
- * Version: `0.0.11`
6
- * Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
7
- * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
8
- * ========================================================================
9
- */
10
-
11
- "use strict";
12
- const require_helper = require('./helper-DNj9Sj4w.cjs');
13
- const require_server = require('./server-CvLC0e2m.cjs');
14
- const require_client = require('./client-CuivP4z0.cjs');
15
- require("@rzl-zone/node-only");
16
- let node_path = require("node:path");
17
- node_path = require_helper.__toESM(node_path, 1);
18
- const getPackageJson = async (options = {}) => {
19
- let current = require_helper.isNonEmptyString(options.cwd) ? node_path.default.resolve(options.cwd) : process.cwd();
20
- while (true) {
21
- const pkgPath = node_path.default.join(current, "package.json");
22
- if (require_server.fsExtra.existsSync(pkgPath)) try {
23
- return JSON.parse(require_server.fsExtra.readFileSync(pkgPath, "utf-8"));
24
- } catch (err) {
25
- throw new Error(`[@rzl-zone/build-tools] - (get-package-json): Invalid package.json at '${pkgPath}'` + require_client.EOL + `Reason: ${err?.message || "unknown"}`, { cause: err });
26
- }
27
- const parent = node_path.default.dirname(current);
28
- if (parent === current) break;
29
- current = parent;
30
- }
31
- throw new Error("[@rzl-zone/build-tools] - (get-package-json): Unable to locate package.json");
32
- };
33
- const generatePackageBanner = async (options = {}) => {
34
- let pkgJson;
35
- if (require_helper.isPlainObject(options.packageJson)) pkgJson = options.packageJson;
36
- else try {
37
- pkgJson = await getPackageJson();
38
- } catch (error) {
39
- throw new Error("[@rzl-zone/build-tools] - (generate-package-banner): Failed to resolve package.json" + require_client.EOL + `Reason: ${error?.message || "unknown"}`, { cause: error });
40
- }
41
- const withEof = options.withEof ?? true;
42
- const title = options.title ?? (require_helper.isNonEmptyString(pkgJson.name) ? pkgJson.name : "Unknown Package");
43
- const version = require_helper.isNonEmptyString(pkgJson.version) ? pkgJson.version : "Unknown";
44
- const author = options.author ?? (require_helper.isNonEmptyString(pkgJson.author) ? pkgJson.author : require_helper.isPlainObject(pkgJson.author) && require_helper.isNonEmptyString(pkgJson.author.name) ? pkgJson.author.name : "Unknown");
45
- const repository = require_helper.isNonEmptyString(pkgJson.homepage) ? pkgJson.homepage.split("#")[0] : require_helper.isNonEmptyString(pkgJson.repository) ? pkgJson.repository.replace(/^git\+/, "").replace(/\.git$/, "") : require_helper.isPlainObject(pkgJson.repository) && require_helper.isNonEmptyString(pkgJson.repository.url) ? pkgJson.repository.url.replace(/^git\+/, "").replace(/\.git$/, "") : "Unknown";
46
- return require_client.joinLinesLoose("/*!", "* ========================================================================", `* ${title}`, "* ------------------------------------------------------------------------", `* Version: \`${version}\``, `* Author: \`${author}\``, `* Repository: \`${repository}\``, "* ========================================================================", "*/", withEof ? "" : false);
47
- };
48
- Object.defineProperty(exports, 'generatePackageBanner', {
49
- enumerable: true,
50
- get: function () {
51
- return generatePackageBanner;
52
- }
53
- });
54
- Object.defineProperty(exports, 'getPackageJson', {
55
- enumerable: true,
56
- get: function () {
57
- return getPackageJson;
58
- }
59
- });
60
- //# sourceMappingURL=package-banner-BoS7Lbi9.cjs.map
@@ -1,181 +0,0 @@
1
- /*!
2
- * ========================================================================
3
- * @rzl-zone/build-tools
4
- * ------------------------------------------------------------------------
5
- * Version: `0.0.11`
6
- * Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
7
- * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
8
- * ========================================================================
9
- */
10
-
11
- "use strict";
12
- const require_helper = require('./helper-DNj9Sj4w.cjs');
13
- require("@rzl-zone/node-only");
14
- let node_os = require("node:os");
15
- node_os = require_helper.__toESM(node_os, 1);
16
- let fast_glob = require("fast-glob");
17
- fast_glob = require_helper.__toESM(fast_glob, 1);
18
- let fs_extra = require("fs-extra");
19
- fs_extra = require_helper.__toESM(fs_extra, 1);
20
- require("dotenv/config");
21
- const defaultPatternOptions = {
22
- absolute: false,
23
- baseNameMatch: false,
24
- caseSensitiveMatch: true,
25
- concurrency: node_os.default.cpus().length,
26
- dot: true,
27
- followSymbolicLinks: true,
28
- globstar: true,
29
- ignore: [],
30
- markDirectories: false,
31
- objectMode: false,
32
- onlyDirectories: false,
33
- onlyFiles: true,
34
- unique: true,
35
- throwErrorOnBrokenSymbolicLink: false
36
- };
37
- function isKeyAllowed(key, policy) {
38
- if (!policy) return true;
39
- if (policy.filesOnly && (key === "onlyFiles" || key === "onlyDirectories")) return false;
40
- if (policy.forceUnique && key === "unique") return false;
41
- return true;
42
- }
43
- const PATTERN_OPTION_KEYS = new Set(Object.keys(defaultPatternOptions));
44
- function assignIfAllowed(key, source, target) {
45
- target[key] = source[key];
46
- }
47
- function sanitizePatternOptions(input, policy) {
48
- if (!require_helper.isPlainObject(input)) return {};
49
- const source = input;
50
- const result = {};
51
- for (const key of Object.keys(source)) if (PATTERN_OPTION_KEYS.has(key) && isKeyAllowed(key, policy)) assignIfAllowed(key, source, result);
52
- return result;
53
- }
54
- function resolvePatternOptions(input, policy) {
55
- const clean = sanitizePatternOptions(input, policy);
56
- const options = {
57
- ...defaultPatternOptions,
58
- ...clean
59
- };
60
- if (policy?.filesOnly) {
61
- delete options.onlyFiles;
62
- delete options.onlyDirectories;
63
- }
64
- if (policy?.forceUnique) delete options.unique;
65
- return options;
66
- }
67
- function sourceOfPatternOptions(value, defaultValue) {
68
- const stableStringifyOptions = {
69
- keepUndefined: true,
70
- sortArray: true,
71
- sortKeys: true
72
- };
73
- return require_helper.safeStableStringify(value, stableStringifyOptions) === require_helper.safeStableStringify(defaultValue, stableStringifyOptions) ? "default" : "overridden";
74
- }
75
- const USE_EMOJI = process.env.FORCE_EMOJI === "1";
76
- const emojiIcons = {
77
- start: "🕐",
78
- arrowRight: "▶️",
79
- arrowRightMini: "›",
80
- bulletBold: "●",
81
- bullet: "•",
82
- whiteCircle: "○",
83
- whiteBullet: "◦",
84
- smallSquare: "▪",
85
- success: "✅",
86
- warn: "⚠️",
87
- error: "❌",
88
- config: "⚙️",
89
- settings: "🛠️",
90
- file: "📄",
91
- files: "📁",
92
- folder: "📂",
93
- path: "🧭",
94
- add: "➕",
95
- remove: "➖",
96
- update: "♻️",
97
- copy: "📋",
98
- move: "📦",
99
- clean: "🧹",
100
- build: "🏗️",
101
- generate: "🧩",
102
- compile: "⚡",
103
- watch: "👀",
104
- info: "ℹ️",
105
- debug: "🐛",
106
- question: "❓",
107
- separator: "━"
108
- };
109
- const asciiIcons = {
110
- start: "▶",
111
- arrowRight: "▶",
112
- arrowRightMini: "›",
113
- bulletBold: "●",
114
- bullet: "•",
115
- whiteCircle: "○",
116
- whiteBullet: "◦",
117
- smallSquare: "▪",
118
- success: "✅",
119
- warn: "⚠️ ",
120
- error: "❌",
121
- config: "#",
122
- settings: "@",
123
- file: "F",
124
- files: "DIR",
125
- folder: "DIR",
126
- path: "~",
127
- add: "+",
128
- remove: "-",
129
- update: "~",
130
- copy: "=",
131
- move: ">",
132
- clean: "x",
133
- build: "#",
134
- generate: "*",
135
- compile: ">",
136
- watch: "o",
137
- info: "i",
138
- debug: "d",
139
- question: "?",
140
- separator: "-"
141
- };
142
- const ICONS = Object.freeze(USE_EMOJI ? emojiIcons : asciiIcons);
143
- const fsExtra = fs_extra.default;
144
- const fastGlob = fast_glob.default;
145
- Object.defineProperty(exports, 'ICONS', {
146
- enumerable: true,
147
- get: function () {
148
- return ICONS;
149
- }
150
- });
151
- Object.defineProperty(exports, 'defaultPatternOptions', {
152
- enumerable: true,
153
- get: function () {
154
- return defaultPatternOptions;
155
- }
156
- });
157
- Object.defineProperty(exports, 'fastGlob', {
158
- enumerable: true,
159
- get: function () {
160
- return fastGlob;
161
- }
162
- });
163
- Object.defineProperty(exports, 'fsExtra', {
164
- enumerable: true,
165
- get: function () {
166
- return fsExtra;
167
- }
168
- });
169
- Object.defineProperty(exports, 'resolvePatternOptions', {
170
- enumerable: true,
171
- get: function () {
172
- return resolvePatternOptions;
173
- }
174
- });
175
- Object.defineProperty(exports, 'sourceOfPatternOptions', {
176
- enumerable: true,
177
- get: function () {
178
- return sourceOfPatternOptions;
179
- }
180
- });
181
- //# sourceMappingURL=server-CvLC0e2m.cjs.map