@maltty/cli 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -0
  3. package/bin/maltty.js +3 -0
  4. package/dist/_format-CeQhQTl5.js +23 -0
  5. package/dist/_format-CeQhQTl5.js.map +1 -0
  6. package/dist/attemptAsync-BdXzRSIT.js +42 -0
  7. package/dist/attemptAsync-BdXzRSIT.js.map +1 -0
  8. package/dist/chunk-DsIazq42.js +26 -0
  9. package/dist/commands/add/command.d.ts +7 -0
  10. package/dist/commands/add/command.d.ts.map +1 -0
  11. package/dist/commands/add/command.js +123 -0
  12. package/dist/commands/add/command.js.map +1 -0
  13. package/dist/commands/add/config.d.ts +7 -0
  14. package/dist/commands/add/config.d.ts.map +1 -0
  15. package/dist/commands/add/config.js +57 -0
  16. package/dist/commands/add/config.js.map +1 -0
  17. package/dist/commands/add/index.d.ts +7 -0
  18. package/dist/commands/add/index.d.ts.map +1 -0
  19. package/dist/commands/add/index.js +7 -0
  20. package/dist/commands/add/index.js.map +1 -0
  21. package/dist/commands/add/middleware.d.ts +7 -0
  22. package/dist/commands/add/middleware.d.ts.map +1 -0
  23. package/dist/commands/add/middleware.js +88 -0
  24. package/dist/commands/add/middleware.js.map +1 -0
  25. package/dist/commands/build.d.ts +15 -0
  26. package/dist/commands/build.d.ts.map +1 -0
  27. package/dist/commands/build.js +246 -0
  28. package/dist/commands/build.js.map +1 -0
  29. package/dist/commands/commands.d.ts +14 -0
  30. package/dist/commands/commands.d.ts.map +1 -0
  31. package/dist/commands/commands.js +189 -0
  32. package/dist/commands/commands.js.map +1 -0
  33. package/dist/commands/dev.d.ts +13 -0
  34. package/dist/commands/dev.d.ts.map +1 -0
  35. package/dist/commands/dev.js +58 -0
  36. package/dist/commands/dev.js.map +1 -0
  37. package/dist/commands/doctor.d.ts +13 -0
  38. package/dist/commands/doctor.d.ts.map +1 -0
  39. package/dist/commands/doctor.js +658 -0
  40. package/dist/commands/doctor.js.map +1 -0
  41. package/dist/commands/init.d.ts +7 -0
  42. package/dist/commands/init.d.ts.map +1 -0
  43. package/dist/commands/init.js +305 -0
  44. package/dist/commands/init.js.map +1 -0
  45. package/dist/commands/run.d.ts +19 -0
  46. package/dist/commands/run.d.ts.map +1 -0
  47. package/dist/commands/run.js +478 -0
  48. package/dist/commands/run.js.map +1 -0
  49. package/dist/commands/stories.d.ts +11 -0
  50. package/dist/commands/stories.d.ts.map +1 -0
  51. package/dist/commands/stories.js +22 -0
  52. package/dist/commands/stories.js.map +1 -0
  53. package/dist/config-helpers-pv_2Spux.js +15 -0
  54. package/dist/config-helpers-pv_2Spux.js.map +1 -0
  55. package/dist/defu-BBwssjW3.js +192 -0
  56. package/dist/defu-BBwssjW3.js.map +1 -0
  57. package/dist/detect-AOq1ehTE.js +61 -0
  58. package/dist/detect-AOq1ehTE.js.map +1 -0
  59. package/dist/dist-DW_gRP7_.js +1119 -0
  60. package/dist/dist-DW_gRP7_.js.map +1 -0
  61. package/dist/dist-Xa07jNxS.js +15617 -0
  62. package/dist/dist-Xa07jNxS.js.map +1 -0
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.js +46 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/jiti-CxWlVmZ_.js +5458 -0
  67. package/dist/jiti-CxWlVmZ_.js.map +1 -0
  68. package/dist/json-D7WbuVK1.js +43 -0
  69. package/dist/json-D7WbuVK1.js.map +1 -0
  70. package/dist/json5-z-PGDMyy.js +777 -0
  71. package/dist/json5-z-PGDMyy.js.map +1 -0
  72. package/dist/jsonc-DqZkfC3S.js +401 -0
  73. package/dist/jsonc-DqZkfC3S.js.map +1 -0
  74. package/dist/jsonc-KADMdSjU.js +2 -0
  75. package/dist/lib/templates/command/command.ts.liquid +12 -0
  76. package/dist/lib/templates/config/config.ts.liquid +16 -0
  77. package/dist/lib/templates/middleware/middleware.ts.liquid +9 -0
  78. package/dist/lib/templates/project/gitignore.liquid +3 -0
  79. package/dist/lib/templates/project/maltty.config.ts.liquid +6 -0
  80. package/dist/lib/templates/project/package.json.liquid +30 -0
  81. package/dist/lib/templates/project/src/commands/hello.ts.liquid +12 -0
  82. package/dist/lib/templates/project/src/config.ts.liquid +16 -0
  83. package/dist/lib/templates/project/src/index.ts.liquid +13 -0
  84. package/dist/lib/templates/project/tsconfig.json.liquid +19 -0
  85. package/dist/lib/templates/project/vitest.config.ts.liquid +8 -0
  86. package/dist/main-C_8x2aB3.js +274 -0
  87. package/dist/main-C_8x2aB3.js.map +1 -0
  88. package/dist/manifest-BIKVDJML.js +112 -0
  89. package/dist/manifest-BIKVDJML.js.map +1 -0
  90. package/dist/multipart-parser-MNkxNO83.js +174 -0
  91. package/dist/multipart-parser-MNkxNO83.js.map +1 -0
  92. package/dist/node-C91xGGqn.js +644 -0
  93. package/dist/node-C91xGGqn.js.map +1 -0
  94. package/dist/node-Drmc03fL.js +3973 -0
  95. package/dist/node-Drmc03fL.js.map +1 -0
  96. package/dist/ohash-BPoV4zBH.js +185 -0
  97. package/dist/ohash-BPoV4zBH.js.map +1 -0
  98. package/dist/pnpm-workspace.yaml +26 -0
  99. package/dist/toml-LuHsHQtV.js +646 -0
  100. package/dist/toml-LuHsHQtV.js.map +1 -0
  101. package/dist/utils-DlIJNGLQ.js +1905 -0
  102. package/dist/utils-DlIJNGLQ.js.map +1 -0
  103. package/dist/validate-C_SXBoLq.js +18 -0
  104. package/dist/validate-C_SXBoLq.js.map +1 -0
  105. package/dist/write-CSwG4Stj.js +152 -0
  106. package/dist/write-CSwG4Stj.js.map +1 -0
  107. package/dist/yaml-BS9RDuUr.js +1067 -0
  108. package/dist/yaml-BS9RDuUr.js.map +1 -0
  109. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-DlIJNGLQ.js","names":["read","extname","resolve","join","isAbsolute","parseJSON","parseJSONC","dirname","resolve","loadConfig","rc9.read","rc9.readUser","dirname","basename","join","extname"],"sources":["../../utils/dist/tag.js","../../../node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs","../../../node_modules/.pnpm/rc9@3.0.1/node_modules/rc9/dist/_chunks/libs/flat.mjs","../../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs","../../../node_modules/.pnpm/rc9@3.0.1/node_modules/rc9/dist/index.mjs","../../../node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs","../../../node_modules/.pnpm/c12@4.0.0-beta.4_chokidar@5.0.0_dotenv@17.4.2_giget@1.2.5_jiti@2.7.0_magicast@0.5.2/node_modules/c12/dist/index.mjs","../../utils/dist/validate.js","../../config/dist/utils.js"],"sourcesContent":["//#region src/tag.ts\n/**\n* Property key used to brand objects with a tag string.\n*\n* Defined via `Object.defineProperty` as non-enumerable, non-writable, and\n* non-configurable, so it does not appear in `Object.keys`, `JSON.stringify`,\n* `for...in`, or spread.\n*/\nconst TAG = \"__tag\";\n/**\n* Create a shallow copy of `obj` with a non-enumerable {@link TAG} property.\n*\n* The original object is not mutated. The tag is defined as non-enumerable,\n* non-writable, and non-configurable via `Object.defineProperty`.\n*\n* @param obj - The source object to copy and tag.\n* @param tag - The tag string to brand the copy with.\n* @returns A new object with all own enumerable properties of `obj` plus the hidden tag.\n*/\nfunction withTag(obj, tag) {\n\tconst copy = { ...obj };\n\tObject.defineProperty(copy, TAG, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: tag,\n\t\twritable: false\n\t});\n\treturn copy;\n}\n/**\n* Type guard that checks whether `value` carries the given tag.\n*\n* @param value - The value to inspect.\n* @param tag - The expected tag string.\n* @returns `true` when `value` is a non-null object whose `[TAG]` equals `tag`.\n*/\nfunction hasTag(value, tag) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn value[TAG] === tag;\n}\n/**\n* Read the tag from a value, if present.\n*\n* @param value - The value to inspect.\n* @returns The tag string, or `undefined` when the value is untagged.\n*/\nfunction getTag(value) {\n\tif (typeof value !== \"object\" || value === null) return;\n\tconst tag = value[TAG];\n\tif (typeof tag === \"string\") return tag;\n}\n//#endregion\nexport { TAG, getTag, hasTag, withTag };\n\n//# sourceMappingURL=tag.js.map","import fs, { lstatSync, realpathSync, statSync } from \"node:fs\";\nimport { URL as URL$1, fileURLToPath, pathToFileURL } from \"node:url\";\nimport path, { isAbsolute } from \"node:path\";\nimport assert from \"node:assert\";\nimport process$1 from \"node:process\";\nimport v8 from \"node:v8\";\nimport { format, inspect } from \"node:util\";\n\n//#region src/internal/builtins.ts\nconst nodeBuiltins = [\n\t\"_http_agent\",\n\t\"_http_client\",\n\t\"_http_common\",\n\t\"_http_incoming\",\n\t\"_http_outgoing\",\n\t\"_http_server\",\n\t\"_stream_duplex\",\n\t\"_stream_passthrough\",\n\t\"_stream_readable\",\n\t\"_stream_transform\",\n\t\"_stream_wrap\",\n\t\"_stream_writable\",\n\t\"_tls_common\",\n\t\"_tls_wrap\",\n\t\"assert\",\n\t\"assert/strict\",\n\t\"async_hooks\",\n\t\"buffer\",\n\t\"child_process\",\n\t\"cluster\",\n\t\"console\",\n\t\"constants\",\n\t\"crypto\",\n\t\"dgram\",\n\t\"diagnostics_channel\",\n\t\"dns\",\n\t\"dns/promises\",\n\t\"domain\",\n\t\"events\",\n\t\"fs\",\n\t\"fs/promises\",\n\t\"http\",\n\t\"http2\",\n\t\"https\",\n\t\"inspector\",\n\t\"inspector/promises\",\n\t\"module\",\n\t\"net\",\n\t\"os\",\n\t\"path\",\n\t\"path/posix\",\n\t\"path/win32\",\n\t\"perf_hooks\",\n\t\"process\",\n\t\"punycode\",\n\t\"querystring\",\n\t\"readline\",\n\t\"readline/promises\",\n\t\"repl\",\n\t\"stream\",\n\t\"stream/consumers\",\n\t\"stream/promises\",\n\t\"stream/web\",\n\t\"string_decoder\",\n\t\"sys\",\n\t\"timers\",\n\t\"timers/promises\",\n\t\"tls\",\n\t\"trace_events\",\n\t\"tty\",\n\t\"url\",\n\t\"util\",\n\t\"util/types\",\n\t\"v8\",\n\t\"vm\",\n\t\"wasi\",\n\t\"worker_threads\",\n\t\"zlib\"\n];\n\n//#endregion\n//#region src/internal/errors.ts\nconst own$1 = {}.hasOwnProperty;\nconst classRegExp = /^([A-Z][a-z\\d]*)+$/;\nconst kTypes = new Set([\n\t\"string\",\n\t\"function\",\n\t\"number\",\n\t\"object\",\n\t\"Function\",\n\t\"Object\",\n\t\"boolean\",\n\t\"bigint\",\n\t\"symbol\"\n]);\nconst messages = /* @__PURE__ */ new Map();\nconst nodeInternalPrefix = \"__node_internal_\";\nlet userStackTraceLimit;\n/**\n* Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.\n* We cannot use Intl.ListFormat because it's not available in\n* --without-intl builds.\n*\n* @param {Array<string>} array\n* An array of strings.\n* @param {string} [type]\n* The list type to be inserted before the last element.\n* @returns {string}\n*/\nfunction formatList(array, type = \"and\") {\n\treturn array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(\", \")}, ${type} ${array.at(-1)}`;\n}\n/**\n* Utility function for registering the error codes.\n*/\nfunction createError(sym, value, constructor) {\n\tmessages.set(sym, value);\n\treturn makeNodeErrorWithCode(constructor, sym);\n}\nfunction makeNodeErrorWithCode(Base, key) {\n\treturn function NodeError(...parameters) {\n\t\tconst limit = Error.stackTraceLimit;\n\t\tif (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;\n\t\tconst error = new Base();\n\t\tif (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;\n\t\tconst message = getMessage(key, parameters, error);\n\t\tObject.defineProperties(error, {\n\t\t\tmessage: {\n\t\t\t\tvalue: message,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: true,\n\t\t\t\tconfigurable: true\n\t\t\t},\n\t\t\ttoString: {\n\t\t\t\tvalue() {\n\t\t\t\t\treturn `${this.name} [${key}]: ${this.message}`;\n\t\t\t\t},\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: true,\n\t\t\t\tconfigurable: true\n\t\t\t}\n\t\t});\n\t\tcaptureLargerStackTrace(error);\n\t\terror.code = key;\n\t\treturn error;\n\t};\n}\nfunction isErrorStackTraceLimitWritable() {\n\ttry {\n\t\tif (v8.startupSnapshot.isBuildingSnapshot()) return false;\n\t} catch {}\n\tconst desc = Object.getOwnPropertyDescriptor(Error, \"stackTraceLimit\");\n\tif (desc === void 0) return Object.isExtensible(Error);\n\treturn own$1.call(desc, \"writable\") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;\n}\n/**\n* This function removes unnecessary frames from Node.js core errors.\n*/\nfunction hideStackFrames(wrappedFunction) {\n\tconst hidden = nodeInternalPrefix + wrappedFunction.name;\n\tObject.defineProperty(wrappedFunction, \"name\", { value: hidden });\n\treturn wrappedFunction;\n}\nconst captureLargerStackTrace = hideStackFrames(function(error) {\n\tconst stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();\n\tif (stackTraceLimitIsWritable) {\n\t\tuserStackTraceLimit = Error.stackTraceLimit;\n\t\tError.stackTraceLimit = Number.POSITIVE_INFINITY;\n\t}\n\tError.captureStackTrace(error);\n\tif (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;\n\treturn error;\n});\nfunction getMessage(key, parameters, self) {\n\tconst message = messages.get(key);\n\tassert.ok(message !== void 0, \"expected `message` to be found\");\n\tif (typeof message === \"function\") {\n\t\tassert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);\n\t\treturn Reflect.apply(message, self, parameters);\n\t}\n\tconst regex = /%[dfijoOs]/g;\n\tlet expectedLength = 0;\n\twhile (regex.exec(message) !== null) expectedLength++;\n\tassert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);\n\tif (parameters.length === 0) return message;\n\tparameters.unshift(message);\n\treturn Reflect.apply(format, null, parameters);\n}\n/**\n* Determine the specific type of a value for type-mismatch errors.\n*/\nfunction determineSpecificType(value) {\n\tif (value === null || value === void 0) return String(value);\n\tif (typeof value === \"function\" && value.name) return `function ${value.name}`;\n\tif (typeof value === \"object\") {\n\t\tif (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;\n\t\treturn `${inspect(value, { depth: -1 })}`;\n\t}\n\tlet inspected = inspect(value, { colors: false });\n\tif (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;\n\treturn `type ${typeof value} (${inspected})`;\n}\nconst ERR_INVALID_ARG_TYPE = createError(\"ERR_INVALID_ARG_TYPE\", (name, expected, actual) => {\n\tassert.ok(typeof name === \"string\", \"'name' must be a string\");\n\tif (!Array.isArray(expected)) expected = [expected];\n\tlet message = \"The \";\n\tif (name.endsWith(\" argument\")) message += `${name} `;\n\telse {\n\t\tconst type = name.includes(\".\") ? \"property\" : \"argument\";\n\t\tmessage += `\"${name}\" ${type} `;\n\t}\n\tmessage += \"must be \";\n\tconst types = [];\n\tconst instances = [];\n\tconst other = [];\n\tfor (const value of expected) {\n\t\tassert.ok(typeof value === \"string\", \"All expected entries have to be of type string\");\n\t\tif (kTypes.has(value)) types.push(value.toLowerCase());\n\t\telse if (classRegExp.exec(value) === null) {\n\t\t\tassert.ok(value !== \"object\", \"The value \\\"object\\\" should be written as \\\"Object\\\"\");\n\t\t\tother.push(value);\n\t\t} else instances.push(value);\n\t}\n\tif (instances.length > 0) {\n\t\tconst pos = types.indexOf(\"object\");\n\t\tif (pos !== -1) {\n\t\t\ttypes.slice(pos, 1);\n\t\t\tinstances.push(\"Object\");\n\t\t}\n\t}\n\tif (types.length > 0) {\n\t\tmessage += `${types.length > 1 ? \"one of type\" : \"of type\"} ${formatList(types, \"or\")}`;\n\t\tif (instances.length > 0 || other.length > 0) message += \" or \";\n\t}\n\tif (instances.length > 0) {\n\t\tmessage += `an instance of ${formatList(instances, \"or\")}`;\n\t\tif (other.length > 0) message += \" or \";\n\t}\n\tif (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, \"or\")}`;\n\telse {\n\t\tif (other[0]?.toLowerCase() !== other[0]) message += \"an \";\n\t\tmessage += `${other[0]}`;\n\t}\n\tmessage += `. Received ${determineSpecificType(actual)}`;\n\treturn message;\n}, TypeError);\nconst ERR_INVALID_MODULE_SPECIFIER = createError(\n\t\"ERR_INVALID_MODULE_SPECIFIER\",\n\t/**\n\t* @param {string} request\n\t* @param {string} reason\n\t* @param {string} [base]\n\t*/\n\t(request, reason, base) => {\n\t\treturn `Invalid module \"${request}\" ${reason}${base ? ` imported from ${base}` : \"\"}`;\n\t},\n\tTypeError\n);\nconst ERR_INVALID_PACKAGE_CONFIG = createError(\"ERR_INVALID_PACKAGE_CONFIG\", (path$1, base, message) => {\n\treturn `Invalid package config ${path$1}${base ? ` while importing ${base}` : \"\"}${message ? `. ${message}` : \"\"}`;\n}, Error);\nconst ERR_INVALID_PACKAGE_TARGET = createError(\"ERR_INVALID_PACKAGE_TARGET\", (packagePath, key, target, isImport = false, base) => {\n\tconst relatedError = typeof target === \"string\" && !isImport && target.length > 0 && !target.startsWith(\"./\");\n\tif (key === \".\") {\n\t\tassert.ok(isImport === false);\n\t\treturn `Invalid \"exports\" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : \"\"}${relatedError ? \"; targets must start with \\\"./\\\"\" : \"\"}`;\n\t}\n\treturn `Invalid \"${isImport ? \"imports\" : \"exports\"}\" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : \"\"}${relatedError ? \"; targets must start with \\\"./\\\"\" : \"\"}`;\n}, Error);\nconst ERR_MODULE_NOT_FOUND = createError(\"ERR_MODULE_NOT_FOUND\", (path$1, base, exactUrl = false) => {\n\treturn `Cannot find ${exactUrl ? \"module\" : \"package\"} '${path$1}' imported from ${base}`;\n}, Error);\nconst ERR_NETWORK_IMPORT_DISALLOWED = createError(\"ERR_NETWORK_IMPORT_DISALLOWED\", \"import of '%s' by %s is not supported: %s\", Error);\nconst ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(\"ERR_PACKAGE_IMPORT_NOT_DEFINED\", (specifier, packagePath, base) => {\n\treturn `Package import specifier \"${specifier}\" is not defined${packagePath ? ` in package ${packagePath || \"\"}package.json` : \"\"} imported from ${base}`;\n}, TypeError);\nconst ERR_PACKAGE_PATH_NOT_EXPORTED = createError(\n\t\"ERR_PACKAGE_PATH_NOT_EXPORTED\",\n\t/**\n\t* @param {string} packagePath\n\t* @param {string} subpath\n\t* @param {string} [base]\n\t*/\n\t(packagePath, subpath, base) => {\n\t\tif (subpath === \".\") return `No \"exports\" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : \"\"}`;\n\t\treturn `Package subpath '${subpath}' is not defined by \"exports\" in ${packagePath}package.json${base ? ` imported from ${base}` : \"\"}`;\n\t},\n\tError\n);\nconst ERR_UNSUPPORTED_DIR_IMPORT = createError(\"ERR_UNSUPPORTED_DIR_IMPORT\", \"Directory import '%s' is not supported resolving ES modules imported from %s\", Error);\nconst ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(\"ERR_UNSUPPORTED_RESOLVE_REQUEST\", \"Failed to resolve module specifier \\\"%s\\\" from \\\"%s\\\": Invalid relative URL or base scheme is not hierarchical.\", TypeError);\nconst ERR_UNKNOWN_FILE_EXTENSION = createError(\"ERR_UNKNOWN_FILE_EXTENSION\", (extension, path$1) => {\n\treturn `Unknown file extension \"${extension}\" for ${path$1}`;\n}, TypeError);\nconst ERR_INVALID_ARG_VALUE = createError(\"ERR_INVALID_ARG_VALUE\", (name, value, reason = \"is invalid\") => {\n\tlet inspected = inspect(value);\n\tif (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;\n\treturn `The ${name.includes(\".\") ? \"property\" : \"argument\"} '${name}' ${reason}. Received ${inspected}`;\n}, TypeError);\n\n//#endregion\n//#region src/internal/package-json-reader.ts\nconst hasOwnProperty$1 = {}.hasOwnProperty;\nconst cache = /* @__PURE__ */ new Map();\nfunction read(jsonPath, { base, specifier }) {\n\tconst existing = cache.get(jsonPath);\n\tif (existing) return existing;\n\tlet string;\n\ttry {\n\t\tstring = fs.readFileSync(path.toNamespacedPath(jsonPath), \"utf8\");\n\t} catch (error) {\n\t\tconst exception = error;\n\t\tif (exception.code !== \"ENOENT\") throw exception;\n\t}\n\tconst result = {\n\t\texists: false,\n\t\tpjsonPath: jsonPath,\n\t\tmain: void 0,\n\t\tname: void 0,\n\t\ttype: \"none\",\n\t\texports: void 0,\n\t\timports: void 0\n\t};\n\tif (string !== void 0) {\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(string);\n\t\t} catch (error_) {\n\t\t\tconst error = new ERR_INVALID_PACKAGE_CONFIG(jsonPath, (base ? `\"${specifier}\" from ` : \"\") + fileURLToPath(base || specifier), error_.message);\n\t\t\terror.cause = error_;\n\t\t\tthrow error;\n\t\t}\n\t\tresult.exists = true;\n\t\tif (hasOwnProperty$1.call(parsed, \"name\") && typeof parsed.name === \"string\") result.name = parsed.name;\n\t\tif (hasOwnProperty$1.call(parsed, \"main\") && typeof parsed.main === \"string\") result.main = parsed.main;\n\t\tif (hasOwnProperty$1.call(parsed, \"exports\")) result.exports = parsed.exports;\n\t\tif (hasOwnProperty$1.call(parsed, \"imports\")) result.imports = parsed.imports;\n\t\tif (hasOwnProperty$1.call(parsed, \"type\") && (parsed.type === \"commonjs\" || parsed.type === \"module\")) result.type = parsed.type;\n\t}\n\tcache.set(jsonPath, result);\n\treturn result;\n}\nfunction getPackageScopeConfig(resolved) {\n\tlet packageJSONUrl = new URL(\"package.json\", resolved);\n\twhile (true) {\n\t\tif (packageJSONUrl.pathname.endsWith(\"node_modules/package.json\")) break;\n\t\tconst packageConfig = read(fileURLToPath(packageJSONUrl), { specifier: resolved });\n\t\tif (packageConfig.exists) return packageConfig;\n\t\tconst lastPackageJSONUrl = packageJSONUrl;\n\t\tpackageJSONUrl = new URL(\"../package.json\", packageJSONUrl);\n\t\tif (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break;\n\t}\n\treturn {\n\t\tpjsonPath: fileURLToPath(packageJSONUrl),\n\t\texists: false,\n\t\ttype: \"none\"\n\t};\n}\n\n//#endregion\n//#region src/internal/get-format.ts\nconst hasOwnProperty = {}.hasOwnProperty;\nconst extensionFormatMap = {\n\t__proto__: null,\n\t\".json\": \"json\",\n\t\".cjs\": \"commonjs\",\n\t\".cts\": \"commonjs\",\n\t\".js\": \"module\",\n\t\".ts\": \"module\",\n\t\".mts\": \"module\",\n\t\".mjs\": \"module\"\n};\nconst protocolHandlers = {\n\t__proto__: null,\n\t\"data:\": getDataProtocolModuleFormat,\n\t\"file:\": getFileProtocolModuleFormat,\n\t\"node:\": () => \"builtin\"\n};\nfunction mimeToFormat(mime) {\n\tif (mime && /\\s*(text|application)\\/javascript\\s*(;\\s*charset=utf-?8\\s*)?/i.test(mime)) return \"module\";\n\tif (mime === \"application/json\") return \"json\";\n\treturn null;\n}\nfunction getDataProtocolModuleFormat(parsed) {\n\tconst { 1: mime } = /^([^/]+\\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t];\n\treturn mimeToFormat(mime);\n}\n/**\n* Returns the file extension from a URL.\n*\n* Should give similar result to\n* `require('node:path').extname(require('node:url').fileURLToPath(url))`\n* when used with a `file:` URL.\n*\n*/\nfunction extname(url) {\n\tconst pathname = url.pathname;\n\tlet index = pathname.length;\n\twhile (index--) {\n\t\tconst code = pathname.codePointAt(index);\n\t\tif (code === 47) return \"\";\n\t\tif (code === 46) return pathname.codePointAt(index - 1) === 47 ? \"\" : pathname.slice(index);\n\t}\n\treturn \"\";\n}\nfunction getFileProtocolModuleFormat(url, _context, ignoreErrors) {\n\tconst ext = extname(url);\n\tif (ext === \".js\") {\n\t\tconst { type: packageType } = getPackageScopeConfig(url);\n\t\tif (packageType !== \"none\") return packageType;\n\t\treturn \"commonjs\";\n\t}\n\tif (ext === \"\") {\n\t\tconst { type: packageType } = getPackageScopeConfig(url);\n\t\tif (packageType === \"none\" || packageType === \"commonjs\") return \"commonjs\";\n\t\treturn \"module\";\n\t}\n\tconst format$1 = extensionFormatMap[ext];\n\tif (format$1) return format$1;\n\tif (ignoreErrors) return;\n\tthrow new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));\n}\nfunction defaultGetFormatWithoutErrors(url, context) {\n\tconst protocol = url.protocol;\n\tif (!hasOwnProperty.call(protocolHandlers, protocol)) return null;\n\treturn protocolHandlers[protocol](url, context, true) || null;\n}\n\n//#endregion\n//#region src/internal/resolve.ts\nconst RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];\nconst own = {}.hasOwnProperty;\nconst invalidSegmentRegEx = /(^|\\\\|\\/)((\\.|%2e)(\\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\\\|\\/|$)/i;\nconst deprecatedInvalidSegmentRegEx = /(^|\\\\|\\/)((\\.|%2e)(\\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\\\|\\/|$)/i;\nconst invalidPackageNameRegEx = /^\\.|%|\\\\/;\nconst patternRegEx = /\\*/g;\nconst encodedSeparatorRegEx = /%2f|%5c/i;\nconst emittedPackageWarnings = /* @__PURE__ */ new Set();\nconst doubleSlashRegEx = /[/\\\\]{2}/;\nfunction emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {\n\tif (process$1.noDeprecation) return;\n\tconst pjsonPath = fileURLToPath(packageJsonUrl);\n\tconst double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;\n\tprocess$1.emitWarning(`Use of deprecated ${double ? \"double slash\" : \"leading or trailing slash matching\"} resolving \"${target}\" for module request \"${request}\" ${request === match ? \"\" : `matched to \"${match}\" `}in the \"${internal ? \"imports\" : \"exports\"}\" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : \"\"}.`, \"DeprecationWarning\", \"DEP0166\");\n}\nfunction emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {\n\tif (process$1.noDeprecation) return;\n\tif (defaultGetFormatWithoutErrors(url, { parentURL: base.href }) !== \"module\") return;\n\tconst urlPath = fileURLToPath(url.href);\n\tconst packagePath = fileURLToPath(new URL$1(\".\", packageJsonUrl));\n\tconst basePath = fileURLToPath(base);\n\tif (!main) process$1.emitWarning(`No \"main\" or \"exports\" field defined in the package.json for ${packagePath} resolving the main entry point \"${urlPath.slice(packagePath.length)}\", imported from ${basePath}.\\nDefault \"index\" lookups for the main are deprecated for ES modules.`, \"DeprecationWarning\", \"DEP0151\");\n\telse if (path.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a \"main\" field set to \"${main}\", excluding the full filename and extension to the resolved file at \"${urlPath.slice(packagePath.length)}\", imported from ${basePath}.\\n Automatic extension resolution of the \"main\" field is deprecated for ES modules.`, \"DeprecationWarning\", \"DEP0151\");\n}\nfunction tryStatSync(path$1) {\n\ttry {\n\t\treturn statSync(path$1);\n\t} catch {}\n}\n/**\n* Legacy CommonJS main resolution:\n* 1. let M = pkg_url + (json main field)\n* 2. TRY(M, M.js, M.json, M.node)\n* 3. TRY(M/index.js, M/index.json, M/index.node)\n* 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)\n* 5. NOT_FOUND\n*/\nfunction fileExists(url) {\n\tconst stats = statSync(url, { throwIfNoEntry: false });\n\tconst isFile = stats ? stats.isFile() : void 0;\n\treturn isFile === null || isFile === void 0 ? false : isFile;\n}\nfunction legacyMainResolve(packageJsonUrl, packageConfig, base) {\n\tlet guess;\n\tif (packageConfig.main !== void 0) {\n\t\tguess = new URL$1(packageConfig.main, packageJsonUrl);\n\t\tif (fileExists(guess)) return guess;\n\t\tconst tries$1 = [\n\t\t\t`./${packageConfig.main}.js`,\n\t\t\t`./${packageConfig.main}.json`,\n\t\t\t`./${packageConfig.main}.node`,\n\t\t\t`./${packageConfig.main}/index.js`,\n\t\t\t`./${packageConfig.main}/index.json`,\n\t\t\t`./${packageConfig.main}/index.node`\n\t\t];\n\t\tlet i$1 = -1;\n\t\twhile (++i$1 < tries$1.length) {\n\t\t\tguess = new URL$1(tries$1[i$1], packageJsonUrl);\n\t\t\tif (fileExists(guess)) break;\n\t\t\tguess = void 0;\n\t\t}\n\t\tif (guess) {\n\t\t\temitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);\n\t\t\treturn guess;\n\t\t}\n\t}\n\tconst tries = [\n\t\t\"./index.js\",\n\t\t\"./index.json\",\n\t\t\"./index.node\"\n\t];\n\tlet i = -1;\n\twhile (++i < tries.length) {\n\t\tguess = new URL$1(tries[i], packageJsonUrl);\n\t\tif (fileExists(guess)) break;\n\t\tguess = void 0;\n\t}\n\tif (guess) {\n\t\temitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);\n\t\treturn guess;\n\t}\n\tthrow new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(\".\", packageJsonUrl)), fileURLToPath(base));\n}\nfunction finalizeResolution(resolved, base, preserveSymlinks) {\n\tif (encodedSeparatorRegEx.exec(resolved.pathname) !== null) throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, String.raw`must not include encoded \"/\" or \"\\\" characters`, fileURLToPath(base));\n\tlet filePath;\n\ttry {\n\t\tfilePath = fileURLToPath(resolved);\n\t} catch (error) {\n\t\tObject.defineProperty(error, \"input\", { value: String(resolved) });\n\t\tObject.defineProperty(error, \"module\", { value: String(base) });\n\t\tthrow error;\n\t}\n\tconst stats = tryStatSync(filePath.endsWith(\"/\") ? filePath.slice(-1) : filePath);\n\tif (stats && stats.isDirectory()) {\n\t\tconst error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));\n\t\terror.url = String(resolved);\n\t\tthrow error;\n\t}\n\tif (!stats || !stats.isFile()) {\n\t\tconst error = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && fileURLToPath(base), true);\n\t\terror.url = String(resolved);\n\t\tthrow error;\n\t}\n\tif (!preserveSymlinks) {\n\t\tconst real = realpathSync(filePath);\n\t\tconst { search, hash } = resolved;\n\t\tresolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? \"/\" : \"\"));\n\t\tresolved.search = search;\n\t\tresolved.hash = hash;\n\t}\n\treturn resolved;\n}\nfunction importNotDefined(specifier, packageJsonUrl, base) {\n\treturn new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath(new URL$1(\".\", packageJsonUrl)), fileURLToPath(base));\n}\nfunction exportsNotFound(subpath, packageJsonUrl, base) {\n\treturn new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(\".\", packageJsonUrl)), subpath, base && fileURLToPath(base));\n}\nfunction throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {\n\tthrow new ERR_INVALID_MODULE_SPECIFIER(request, `request is not a valid match in pattern \"${match}\" for the \"${internal ? \"imports\" : \"exports\"}\" resolution of ${fileURLToPath(packageJsonUrl)}`, base && fileURLToPath(base));\n}\nfunction invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {\n\ttarget = typeof target === \"object\" && target !== null ? JSON.stringify(target, null, \"\") : `${target}`;\n\treturn new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(\".\", packageJsonUrl)), subpath, target, internal, base && fileURLToPath(base));\n}\nfunction resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) {\n\tif (subpath !== \"\" && !pattern && target.at(-1) !== \"/\") throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\tif (!target.startsWith(\"./\")) {\n\t\tif (internal && !target.startsWith(\"../\") && !target.startsWith(\"/\")) {\n\t\t\tlet isURL = false;\n\t\t\ttry {\n\t\t\t\tnew URL$1(target);\n\t\t\t\tisURL = true;\n\t\t\t} catch {}\n\t\t\tif (!isURL) return packageResolve(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath, packageJsonUrl, conditions);\n\t\t}\n\t\tthrow invalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\t}\n\tif (invalidSegmentRegEx.exec(target.slice(2)) !== null) if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {\n\t\tif (!isPathMap) {\n\t\t\tconst request = pattern ? match.replace(\"*\", () => subpath) : match + subpath;\n\t\t\temitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, true);\n\t\t}\n\t} else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\tconst resolved = new URL$1(target, packageJsonUrl);\n\tconst resolvedPath = resolved.pathname;\n\tconst packagePath = new URL$1(\".\", packageJsonUrl).pathname;\n\tif (!resolvedPath.startsWith(packagePath)) throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\tif (subpath === \"\") return resolved;\n\tif (invalidSegmentRegEx.exec(subpath) !== null) {\n\t\tconst request = pattern ? match.replace(\"*\", () => subpath) : match + subpath;\n\t\tif (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {\n\t\t\tif (!isPathMap) emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, false);\n\t\t} else throwInvalidSubpath(request, match, packageJsonUrl, internal, base);\n\t}\n\tif (pattern) return new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath));\n\treturn new URL$1(subpath, resolved);\n}\nfunction isArrayIndex(key) {\n\tconst keyNumber = Number(key);\n\tif (`${keyNumber}` !== key) return false;\n\treturn keyNumber >= 0 && keyNumber < 4294967295;\n}\nfunction resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) {\n\tif (typeof target === \"string\") return resolvePackageTargetString(target, subpath, packageSubpath, packageJsonUrl, base, pattern, internal, isPathMap, conditions);\n\tif (Array.isArray(target)) {\n\t\tconst targetList = target;\n\t\tif (targetList.length === 0) return null;\n\t\tlet lastException;\n\t\tlet i = -1;\n\t\twhile (++i < targetList.length) {\n\t\t\tconst targetItem = targetList[i];\n\t\t\tlet resolveResult;\n\t\t\ttry {\n\t\t\t\tresolveResult = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);\n\t\t\t} catch (error) {\n\t\t\t\tconst exception = error;\n\t\t\t\tlastException = exception;\n\t\t\t\tif (exception.code === \"ERR_INVALID_PACKAGE_TARGET\") continue;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tif (resolveResult === void 0) continue;\n\t\t\tif (resolveResult === null) {\n\t\t\t\tlastException = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn resolveResult;\n\t\t}\n\t\tif (lastException === void 0 || lastException === null) return null;\n\t\tthrow lastException;\n\t}\n\tif (typeof target === \"object\" && target !== null) {\n\t\tconst keys = Object.getOwnPropertyNames(target);\n\t\tlet i = -1;\n\t\twhile (++i < keys.length) {\n\t\t\tconst key = keys[i];\n\t\t\tif (isArrayIndex(key)) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), fileURLToPath(base), \"\\\"exports\\\" cannot contain numeric property keys.\");\n\t\t}\n\t\ti = -1;\n\t\twhile (++i < keys.length) {\n\t\t\tconst key = keys[i];\n\t\t\tif (key === \"default\" || conditions && conditions.has(key)) {\n\t\t\t\tconst conditionalTarget = target[key];\n\t\t\t\tconst resolveResult = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);\n\t\t\t\tif (resolveResult === void 0) continue;\n\t\t\t\treturn resolveResult;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\tif (target === null) return null;\n\tthrow invalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base);\n}\nfunction isConditionalExportsMainSugar(exports, packageJsonUrl, base) {\n\tif (typeof exports === \"string\" || Array.isArray(exports)) return true;\n\tif (typeof exports !== \"object\" || exports === null) return false;\n\tconst keys = Object.getOwnPropertyNames(exports);\n\tlet isConditionalSugar = false;\n\tlet i = 0;\n\tlet keyIndex = -1;\n\twhile (++keyIndex < keys.length) {\n\t\tconst key = keys[keyIndex];\n\t\tconst currentIsConditionalSugar = key === \"\" || key[0] !== \".\";\n\t\tif (i++ === 0) isConditionalSugar = currentIsConditionalSugar;\n\t\telse if (isConditionalSugar !== currentIsConditionalSugar) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), fileURLToPath(base), \"\\\"exports\\\" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.\");\n\t}\n\treturn isConditionalSugar;\n}\nfunction emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {\n\tif (process$1.noDeprecation) return;\n\tconst pjsonPath = fileURLToPath(pjsonUrl);\n\tif (emittedPackageWarnings.has(pjsonPath + \"|\" + match)) return;\n\temittedPackageWarnings.add(pjsonPath + \"|\" + match);\n\tprocess$1.emitWarning(`Use of deprecated trailing slash pattern mapping \"${match}\" in the \"exports\" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : \"\"}. Mapping specifiers ending in \"/\" is no longer supported.`, \"DeprecationWarning\", \"DEP0155\");\n}\nfunction packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {\n\tlet exports = packageConfig.exports;\n\tif (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) exports = { \".\": exports };\n\tif (own.call(exports, packageSubpath) && !packageSubpath.includes(\"*\") && !packageSubpath.endsWith(\"/\")) {\n\t\tconst target = exports[packageSubpath];\n\t\tconst resolveResult = resolvePackageTarget(packageJsonUrl, target, \"\", packageSubpath, base, false, false, false, conditions);\n\t\tif (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);\n\t\treturn resolveResult;\n\t}\n\tlet bestMatch = \"\";\n\tlet bestMatchSubpath = \"\";\n\tconst keys = Object.getOwnPropertyNames(exports);\n\tlet i = -1;\n\twhile (++i < keys.length) {\n\t\tconst key = keys[i];\n\t\tconst patternIndex = key.indexOf(\"*\");\n\t\tif (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {\n\t\t\tif (packageSubpath.endsWith(\"/\")) emitTrailingSlashPatternDeprecation(packageSubpath, packageJsonUrl, base);\n\t\t\tconst patternTrailer = key.slice(patternIndex + 1);\n\t\t\tif (packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf(\"*\") === patternIndex) {\n\t\t\t\tbestMatch = key;\n\t\t\t\tbestMatchSubpath = packageSubpath.slice(patternIndex, packageSubpath.length - patternTrailer.length);\n\t\t\t}\n\t\t}\n\t}\n\tif (bestMatch) {\n\t\tconst target = exports[bestMatch];\n\t\tconst resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith(\"/\"), conditions);\n\t\tif (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);\n\t\treturn resolveResult;\n\t}\n\tthrow exportsNotFound(packageSubpath, packageJsonUrl, base);\n}\nfunction patternKeyCompare(a, b) {\n\tconst aPatternIndex = a.indexOf(\"*\");\n\tconst bPatternIndex = b.indexOf(\"*\");\n\tconst baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;\n\tconst baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;\n\tif (baseLengthA > baseLengthB) return -1;\n\tif (baseLengthB > baseLengthA) return 1;\n\tif (aPatternIndex === -1) return 1;\n\tif (bPatternIndex === -1) return -1;\n\tif (a.length > b.length) return -1;\n\tif (b.length > a.length) return 1;\n\treturn 0;\n}\nfunction packageImportsResolve(name, base, conditions) {\n\tif (name === \"#\" || name.startsWith(\"#/\") || name.endsWith(\"/\")) throw new ERR_INVALID_MODULE_SPECIFIER(name, \"is not a valid internal imports specifier name\", fileURLToPath(base));\n\tlet packageJsonUrl;\n\tconst packageConfig = getPackageScopeConfig(base);\n\tif (packageConfig.exists) {\n\t\tpackageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n\t\tconst imports = packageConfig.imports;\n\t\tif (imports) if (own.call(imports, name) && !name.includes(\"*\")) {\n\t\t\tconst resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], \"\", name, base, false, true, false, conditions);\n\t\t\tif (resolveResult !== null && resolveResult !== void 0) return resolveResult;\n\t\t} else {\n\t\t\tlet bestMatch = \"\";\n\t\t\tlet bestMatchSubpath = \"\";\n\t\t\tconst keys = Object.getOwnPropertyNames(imports);\n\t\t\tlet i = -1;\n\t\t\twhile (++i < keys.length) {\n\t\t\t\tconst key = keys[i];\n\t\t\t\tconst patternIndex = key.indexOf(\"*\");\n\t\t\t\tif (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {\n\t\t\t\t\tconst patternTrailer = key.slice(patternIndex + 1);\n\t\t\t\t\tif (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf(\"*\") === patternIndex) {\n\t\t\t\t\t\tbestMatch = key;\n\t\t\t\t\t\tbestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (bestMatch) {\n\t\t\t\tconst target = imports[bestMatch];\n\t\t\t\tconst resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, true, false, conditions);\n\t\t\t\tif (resolveResult !== null && resolveResult !== void 0) return resolveResult;\n\t\t\t}\n\t\t}\n\t}\n\tthrow importNotDefined(name, packageJsonUrl, base);\n}\n/**\n* @param {string} specifier\n* @param {URL} base\n*/\nfunction parsePackageName(specifier, base) {\n\tlet separatorIndex = specifier.indexOf(\"/\");\n\tlet validPackageName = true;\n\tlet isScoped = false;\n\tif (specifier[0] === \"@\") {\n\t\tisScoped = true;\n\t\tif (separatorIndex === -1 || specifier.length === 0) validPackageName = false;\n\t\telse separatorIndex = specifier.indexOf(\"/\", separatorIndex + 1);\n\t}\n\tconst packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);\n\tif (invalidPackageNameRegEx.exec(packageName) !== null) validPackageName = false;\n\tif (!validPackageName) throw new ERR_INVALID_MODULE_SPECIFIER(specifier, \"is not a valid package name\", fileURLToPath(base));\n\treturn {\n\t\tpackageName,\n\t\tpackageSubpath: \".\" + (separatorIndex === -1 ? \"\" : specifier.slice(separatorIndex)),\n\t\tisScoped\n\t};\n}\nfunction packageResolve(specifier, base, conditions) {\n\tif (nodeBuiltins.includes(specifier)) return new URL$1(\"node:\" + specifier);\n\tconst { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);\n\tconst packageConfig = getPackageScopeConfig(base);\n\tif (packageConfig.exists && packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(pathToFileURL(packageConfig.pjsonPath), packageSubpath, packageConfig, base, conditions);\n\tlet packageJsonUrl = new URL$1(\"./node_modules/\" + packageName + \"/package.json\", base);\n\tlet packageJsonPath = fileURLToPath(packageJsonUrl);\n\tlet lastPath;\n\tdo {\n\t\tconst stat = tryStatSync(packageJsonPath.slice(0, -13));\n\t\tif (!stat || !stat.isDirectory()) {\n\t\t\tlastPath = packageJsonPath;\n\t\t\tpackageJsonUrl = new URL$1((isScoped ? \"../../../../node_modules/\" : \"../../../node_modules/\") + packageName + \"/package.json\", packageJsonUrl);\n\t\t\tpackageJsonPath = fileURLToPath(packageJsonUrl);\n\t\t\tcontinue;\n\t\t}\n\t\tconst packageConfig$1 = read(packageJsonPath, {\n\t\t\tbase,\n\t\t\tspecifier\n\t\t});\n\t\tif (packageConfig$1.exports !== void 0 && packageConfig$1.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig$1, base, conditions);\n\t\tif (packageSubpath === \".\") return legacyMainResolve(packageJsonUrl, packageConfig$1, base);\n\t\treturn new URL$1(packageSubpath, packageJsonUrl);\n\t} while (packageJsonPath.length !== lastPath.length);\n\tthrow new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false);\n}\nfunction isRelativeSpecifier(specifier) {\n\tif (specifier[0] === \".\") {\n\t\tif (specifier.length === 1 || specifier[1] === \"/\") return true;\n\t\tif (specifier[1] === \".\" && (specifier.length === 2 || specifier[2] === \"/\")) return true;\n\t}\n\treturn false;\n}\nfunction shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {\n\tif (specifier === \"\") return false;\n\tif (specifier[0] === \"/\") return true;\n\treturn isRelativeSpecifier(specifier);\n}\n/**\n* The “Resolver Algorithm Specification” as detailed in the Node docs (which is\n* sync and slightly lower-level than `resolve`).\n*\n* @param {string} specifier\n* `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc.\n* @param {URL} base\n* Full URL (to a file) that `specifier` is resolved relative from.\n* @param {Set<string>} [conditions]\n* Conditions.\n* @param {boolean} [preserveSymlinks]\n* Keep symlinks instead of resolving them.\n* @returns {URL}\n* A URL object to the found thing.\n*/\nfunction moduleResolve(specifier, base, conditions, preserveSymlinks) {\n\tconst protocol = base.protocol;\n\tconst isData = protocol === \"data:\";\n\tlet resolved;\n\tif (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) try {\n\t\tresolved = new URL$1(specifier, base);\n\t} catch (error_) {\n\t\tconst error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);\n\t\terror.cause = error_;\n\t\tthrow error;\n\t}\n\telse if (protocol === \"file:\" && specifier[0] === \"#\") resolved = packageImportsResolve(specifier, base, conditions);\n\telse try {\n\t\tresolved = new URL$1(specifier);\n\t} catch (error_) {\n\t\tif (isData && !nodeBuiltins.includes(specifier)) {\n\t\t\tconst error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);\n\t\t\terror.cause = error_;\n\t\t\tthrow error;\n\t\t}\n\t\tresolved = packageResolve(specifier, base, conditions);\n\t}\n\tassert.ok(resolved !== void 0, \"expected to be defined\");\n\tif (resolved.protocol !== \"file:\") return resolved;\n\treturn finalizeResolution(resolved, base, preserveSymlinks);\n}\n\n//#endregion\n//#region src/resolve.ts\nconst DEFAULT_CONDITIONS_SET = /* @__PURE__ */ new Set([\"node\", \"import\"]);\nconst isWindows = /* @__PURE__ */ (() => process.platform === \"win32\")();\nconst globalCache = /* @__PURE__ */ (() => globalThis[\"__EXSOLVE_CACHE__\"] ||= /* @__PURE__ */ new Map())();\n/**\n* Synchronously resolves a module url based on the options provided.\n*\n* @param {string} input - The identifier or path of the module to resolve.\n* @param {ResolveOptions} [options] - Options to resolve the module. See {@link ResolveOptions}.\n* @returns {string} The resolved URL as a string.\n*/\nfunction resolveModuleURL(input, options) {\n\tconst parsedInput = _parseInput(input);\n\tif (\"external\" in parsedInput) return parsedInput.external;\n\tconst specifier = parsedInput.specifier;\n\tlet url = parsedInput.url;\n\tlet absolutePath = parsedInput.absolutePath;\n\tlet cacheKey;\n\tlet cacheObj;\n\tif (options?.cache !== false) {\n\t\tcacheKey = _cacheKey(absolutePath || specifier, options);\n\t\tcacheObj = options?.cache && typeof options?.cache === \"object\" ? options.cache : globalCache;\n\t}\n\tif (cacheObj) {\n\t\tconst cached = cacheObj.get(cacheKey);\n\t\tif (typeof cached === \"string\") return cached;\n\t\tif (cached instanceof Error) {\n\t\t\tif (options?.try) return;\n\t\t\tthrow cached;\n\t\t}\n\t}\n\tif (absolutePath) try {\n\t\tconst stat = lstatSync(absolutePath);\n\t\tif (stat.isSymbolicLink()) {\n\t\t\tabsolutePath = realpathSync(absolutePath);\n\t\t\turl = pathToFileURL(absolutePath);\n\t\t}\n\t\tif (stat.isFile()) {\n\t\t\tif (cacheObj) cacheObj.set(cacheKey, url.href);\n\t\t\treturn url.href;\n\t\t}\n\t} catch (error) {\n\t\tif (error?.code !== \"ENOENT\") {\n\t\t\tif (cacheObj) cacheObj.set(cacheKey, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\tconst conditionsSet = options?.conditions ? new Set(options.conditions) : DEFAULT_CONDITIONS_SET;\n\tconst target = specifier || url.href;\n\tconst bases = _normalizeBases(options?.from);\n\tconst suffixes = options?.suffixes || [\"\"];\n\tconst extensions = options?.extensions ? [\"\", ...options.extensions] : [\"\"];\n\tlet resolved;\n\tfor (const base of bases) {\n\t\tfor (const suffix of suffixes) {\n\t\t\tlet name = _join(target, suffix);\n\t\t\tif (name === \".\") name += \"/.\";\n\t\t\tfor (const extension of extensions) {\n\t\t\t\tresolved = _tryModuleResolve(name + extension, base, conditionsSet);\n\t\t\t\tif (resolved) break;\n\t\t\t}\n\t\t\tif (resolved) break;\n\t\t}\n\t\tif (resolved) break;\n\t}\n\tif (!resolved) {\n\t\tconst error = /* @__PURE__ */ new Error(`Cannot resolve module \"${input}\" (from: ${bases.map((u) => _fmtPath(u)).join(\", \")})`);\n\t\terror.code = \"ERR_MODULE_NOT_FOUND\";\n\t\tif (cacheObj) cacheObj.set(cacheKey, error);\n\t\tif (options?.try) return;\n\t\tthrow error;\n\t}\n\tif (cacheObj) cacheObj.set(cacheKey, resolved.href);\n\treturn resolved.href;\n}\n/**\n* Synchronously resolves a module then converts it to a file path\n*\n* (throws error if reolved path is not file:// scheme)\n*\n* @param {string} id - The identifier or path of the module to resolve.\n* @param {ResolveOptions} [options] - Options to resolve the module. See {@link ResolveOptions}.\n* @returns {string} The resolved URL as a string.\n*/\nfunction resolveModulePath(id, options) {\n\tconst resolved = resolveModuleURL(id, options);\n\tif (!resolved) return;\n\tif (!resolved.startsWith(\"file://\") && options?.try) return;\n\tconst absolutePath = fileURLToPath(resolved);\n\treturn isWindows ? _normalizeWinPath(absolutePath) : absolutePath;\n}\nfunction createResolver(defaults) {\n\tif (defaults?.from) defaults = {\n\t\t...defaults,\n\t\tfrom: _normalizeBases(defaults?.from)\n\t};\n\treturn {\n\t\tresolveModuleURL: (id, opts) => resolveModuleURL(id, {\n\t\t\t...defaults,\n\t\t\t...opts\n\t\t}),\n\t\tresolveModulePath: (id, opts) => resolveModulePath(id, {\n\t\t\t...defaults,\n\t\t\t...opts\n\t\t}),\n\t\tclearResolveCache: () => {\n\t\t\tif (defaults?.cache !== false) if (defaults?.cache && typeof defaults?.cache === \"object\") defaults.cache.clear();\n\t\t\telse globalCache.clear();\n\t\t}\n\t};\n}\nfunction clearResolveCache() {\n\tglobalCache.clear();\n}\nfunction _tryModuleResolve(specifier, base, conditions) {\n\ttry {\n\t\treturn moduleResolve(specifier, base, conditions);\n\t} catch {}\n}\nfunction _normalizeBases(inputs) {\n\tconst urls = (Array.isArray(inputs) ? inputs : [inputs]).flatMap((input) => _normalizeBase(input));\n\tif (urls.length === 0) return [pathToFileURL(\"./\")];\n\treturn urls;\n}\nfunction _normalizeBase(input) {\n\tif (!input) return [];\n\tif (_isURL(input)) return [input];\n\tif (typeof input !== \"string\") return [];\n\tif (/^(?:node|data|http|https|file):/.test(input)) return new URL(input);\n\ttry {\n\t\tif (input.endsWith(\"/\") || statSync(input).isDirectory()) return pathToFileURL(input + \"/\");\n\t\treturn pathToFileURL(input);\n\t} catch {\n\t\treturn [pathToFileURL(input + \"/\"), pathToFileURL(input)];\n\t}\n}\nfunction _fmtPath(input) {\n\ttry {\n\t\treturn fileURLToPath(input);\n\t} catch {\n\t\treturn input;\n\t}\n}\nfunction _cacheKey(id, opts) {\n\treturn JSON.stringify([\n\t\tid,\n\t\t(opts?.conditions || [\"node\", \"import\"]).sort(),\n\t\topts?.extensions,\n\t\topts?.from,\n\t\topts?.suffixes\n\t]);\n}\nfunction _join(a, b) {\n\tif (!a || !b || b === \"/\") return a;\n\treturn (a.endsWith(\"/\") ? a : a + \"/\") + (b.startsWith(\"/\") ? b.slice(1) : b);\n}\nfunction _normalizeWinPath(path$1) {\n\treturn path$1.replace(/\\\\/g, \"/\").replace(/^[a-z]:\\//, (r) => r.toUpperCase());\n}\nfunction _isURL(input) {\n\treturn input instanceof URL || input?.constructor?.name === \"URL\";\n}\nfunction _parseInput(input) {\n\tif (typeof input === \"string\") {\n\t\tif (input.startsWith(\"file:\")) {\n\t\t\tconst url = new URL(input);\n\t\t\treturn {\n\t\t\t\turl,\n\t\t\t\tabsolutePath: fileURLToPath(url)\n\t\t\t};\n\t\t}\n\t\tif (isAbsolute(input)) return {\n\t\t\turl: pathToFileURL(input),\n\t\t\tabsolutePath: input\n\t\t};\n\t\tif (/^(?:node|data|http|https):/.test(input)) return { external: input };\n\t\tif (nodeBuiltins.includes(input) && !input.includes(\":\")) return { external: `node:${input}` };\n\t\treturn { specifier: input };\n\t}\n\tif (_isURL(input)) {\n\t\tif (input.protocol === \"file:\") return {\n\t\t\turl: input,\n\t\t\tabsolutePath: fileURLToPath(input)\n\t\t};\n\t\treturn { external: input.href };\n\t}\n\tthrow new TypeError(\"id must be a `string` or `URL`\");\n}\n\n//#endregion\nexport { clearResolveCache, createResolver, resolveModulePath, resolveModuleURL };","//#region node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js\nfunction isBuffer(obj) {\n\treturn obj && obj.constructor && typeof obj.constructor.isBuffer === \"function\" && obj.constructor.isBuffer(obj);\n}\nfunction keyIdentity(key) {\n\treturn key;\n}\nfunction flatten(target, opts) {\n\topts = opts || {};\n\tconst delimiter = opts.delimiter || \".\";\n\tconst maxDepth = opts.maxDepth;\n\tconst transformKey = opts.transformKey || keyIdentity;\n\tconst output = {};\n\tfunction step(object, prev, currentDepth) {\n\t\tcurrentDepth = currentDepth || 1;\n\t\tObject.keys(object).forEach(function(key) {\n\t\t\tconst value = object[key];\n\t\t\tconst isarray = opts.safe && Array.isArray(value);\n\t\t\tconst type = Object.prototype.toString.call(value);\n\t\t\tconst isbuffer = isBuffer(value);\n\t\t\tconst isobject = type === \"[object Object]\" || type === \"[object Array]\";\n\t\t\tconst newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);\n\t\t\tif (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);\n\t\t\toutput[newKey] = value;\n\t\t});\n\t}\n\tstep(target);\n\treturn output;\n}\nfunction unflatten(target, opts) {\n\topts = opts || {};\n\tconst delimiter = opts.delimiter || \".\";\n\tconst overwrite = opts.overwrite || false;\n\tconst transformKey = opts.transformKey || keyIdentity;\n\tconst result = {};\n\tif (isBuffer(target) || Object.prototype.toString.call(target) !== \"[object Object]\") return target;\n\tfunction getkey(key) {\n\t\tconst parsedKey = Number(key);\n\t\treturn isNaN(parsedKey) || key.indexOf(\".\") !== -1 || opts.object ? key : parsedKey;\n\t}\n\tfunction addKeys(keyPrefix, recipient, target) {\n\t\treturn Object.keys(target).reduce(function(result, key) {\n\t\t\tresult[keyPrefix + delimiter + key] = target[key];\n\t\t\treturn result;\n\t\t}, recipient);\n\t}\n\tfunction isEmpty(val) {\n\t\tconst type = Object.prototype.toString.call(val);\n\t\tconst isArray = type === \"[object Array]\";\n\t\tconst isObject = type === \"[object Object]\";\n\t\tif (!val) return true;\n\t\telse if (isArray) return !val.length;\n\t\telse if (isObject) return !Object.keys(val).length;\n\t}\n\ttarget = Object.keys(target).reduce(function(result, key) {\n\t\tconst type = Object.prototype.toString.call(target[key]);\n\t\tif (!(type === \"[object Object]\" || type === \"[object Array]\") || isEmpty(target[key])) {\n\t\t\tresult[key] = target[key];\n\t\t\treturn result;\n\t\t} else return addKeys(key, result, flatten(target[key], opts));\n\t}, {});\n\tObject.keys(target).forEach(function(key) {\n\t\tconst split = key.split(delimiter).map(transformKey);\n\t\tlet key1 = getkey(split.shift());\n\t\tlet key2 = getkey(split[0]);\n\t\tlet recipient = result;\n\t\twhile (key2 !== void 0) {\n\t\t\tif (key1 === \"__proto__\") return;\n\t\t\tconst type = Object.prototype.toString.call(recipient[key1]);\n\t\t\tconst isobject = type === \"[object Object]\" || type === \"[object Array]\";\n\t\t\tif (!overwrite && !isobject && typeof recipient[key1] !== \"undefined\") return;\n\t\t\tif (overwrite && !isobject || !overwrite && recipient[key1] == null) recipient[key1] = typeof key2 === \"number\" && !opts.object ? [] : {};\n\t\t\trecipient = recipient[key1];\n\t\t\tif (split.length > 0) {\n\t\t\t\tkey1 = getkey(split.shift());\n\t\t\t\tkey2 = getkey(split[0]);\n\t\t\t}\n\t\t}\n\t\trecipient[key1] = unflatten(target[key], opts);\n\t});\n\treturn result;\n}\n//#endregion\nexport { unflatten as n, flatten as t };\n","const suspectProtoRx = /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/;\nconst suspectConstructorRx = /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/;\nfunction jsonParseTransform(key, value) {\n if (key === \"__proto__\" || key === \"constructor\" && value && typeof value === \"object\" && \"prototype\" in value) {\n warnKeyDropped(key);\n return;\n }\n return value;\n}\nfunction warnKeyDropped(key) {\n console.warn(`[destr] Dropping \"${key}\" key to prevent prototype pollution.`);\n}\nfunction destr(value, options = {}) {\n if (typeof value !== \"string\") {\n return value;\n }\n if (value[0] === '\"' && value[value.length - 1] === '\"' && value.indexOf(\"\\\\\") === -1) {\n return value.slice(1, -1);\n }\n const _value = value.trim();\n if (_value.length <= 9) {\n switch (_value.toLowerCase()) {\n case \"true\": {\n return true;\n }\n case \"false\": {\n return false;\n }\n case \"undefined\": {\n return void 0;\n }\n case \"null\": {\n return null;\n }\n case \"nan\": {\n return Number.NaN;\n }\n case \"infinity\": {\n return Number.POSITIVE_INFINITY;\n }\n case \"-infinity\": {\n return Number.NEGATIVE_INFINITY;\n }\n }\n }\n if (!JsonSigRx.test(value)) {\n if (options.strict) {\n throw new SyntaxError(\"[destr] Invalid JSON\");\n }\n return value;\n }\n try {\n if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {\n if (options.strict) {\n throw new Error(\"[destr] Possible prototype pollution\");\n }\n return JSON.parse(value, jsonParseTransform);\n }\n return JSON.parse(value);\n } catch (error) {\n if (options.strict) {\n throw error;\n }\n return value;\n }\n}\nfunction safeDestr(value, options = {}) {\n return destr(value, { ...options, strict: true });\n}\n\nexport { destr as default, destr, safeDestr };\n","import { n as unflatten, t as flatten } from \"./_chunks/libs/flat.mjs\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport destr from \"destr\";\nimport { defu } from \"defu\";\n//#region src/index.ts\nconst RE_KEY_VAL = /^\\s*([^\\s=]+)\\s*=\\s*(.*)?\\s*$/;\nconst RE_LINES = /\\n|\\r|\\r\\n/;\n/**\n* The default options for the configuration file.\n*/\nconst defaults = {\n\tname: \".conf\",\n\tdir: process.cwd(),\n\tflat: false\n};\nfunction withDefaults(options) {\n\tif (typeof options === \"string\") options = { name: options };\n\treturn {\n\t\t...defaults,\n\t\t...options\n\t};\n}\nfunction parse(contents, options = {}) {\n\tconst config = {};\n\tconst lines = contents.split(RE_LINES);\n\tfor (const line of lines) {\n\t\tconst match = line.match(RE_KEY_VAL);\n\t\tif (!match) continue;\n\t\tconst key = match[1];\n\t\tif (!key || key === \"__proto__\" || key === \"constructor\") continue;\n\t\tconst value = destr((match[2] || \"\").trim());\n\t\tif (key.endsWith(\"[]\")) {\n\t\t\tconst nkey = key.slice(0, Math.max(0, key.length - 2));\n\t\t\tconfig[nkey] = (config[nkey] || []).concat(value);\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[key] = value;\n\t}\n\treturn options.flat ? config : unflatten(config, { overwrite: true });\n}\n/**\n* Parses a configuration string into an object.\n* @param {string} contents - The configuration data as a raw string.\n* @param {RCOptions} [options={}] - Options to control the parsing behaviour. See {@link RCOptions}.\n* @returns {RC} - The parsed configuration object. See {@link RC}.\n*/\nfunction parseFile(path, options) {\n\tif (!existsSync(path)) return {};\n\treturn parse(readFileSync(path, \"utf8\"), options);\n}\n/**\n* Reads a configuration file from a default or specified location and parses its contents.\n* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @returns {RC} - The parsed configuration object. See {@link RC}.\n*/\nfunction read(options) {\n\toptions = withDefaults(options);\n\treturn parseFile(resolve(options.dir, options.name), options);\n}\n/**\n* Reads a custom configuration file from a default or specified location and parses its contents.\n* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @returns {RC} - The parsed configuration object.\n* @deprecated Use {@link readUserConfig} instead, which uses `~/.config` following XDG conventions.\n*/\nfunction readUser(options) {\n\toptions = withDefaults(options);\n\toptions.dir = process.env.XDG_CONFIG_HOME || homedir();\n\treturn read(options);\n}\n/**\n* Serialises a configuration object to a string format.\n* @param {RC} config - The configuration object to serialise. See {@link RC}.\n* @returns {string} - The serialised configuration string.\n*/\nfunction serialize(config) {\n\treturn Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(\"\\n\");\n}\n/**\n* Writes a configuration object to a file in a default or specified location.\n* @param {RC} config - The configuration object to write. See {@link RC}.\n* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.\n*/\nfunction write(config, options) {\n\toptions = withDefaults(options);\n\twriteFileSync(resolve(options.dir, options.name), serialize(config), { encoding: \"utf8\" });\n}\n/**\n* Writes a custom configuration object to a file in a default or specified location.\n* @param {RC} config - The configuration object to write. See {@link RC}.\n* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @deprecated Use {@link writeUserConfig} instead, which uses `~/.config` following XDG conventions.\n*/\nfunction writeUser(config, options) {\n\toptions = withDefaults(options);\n\toptions.dir = process.env.XDG_CONFIG_HOME || homedir();\n\twrite(config, options);\n}\n/**\n* Reads a configuration file from `$XDG_CONFIG_HOME` or `$HOME/.config` and parses its contents.\n* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @returns {RC} - The parsed configuration object.\n*/\nfunction readUserConfig(options) {\n\toptions = withDefaults(options);\n\toptions.dir = process.env.XDG_CONFIG_HOME || resolve(homedir(), \".config\");\n\treturn read(options);\n}\n/**\n* Writes a configuration object to a file in `$XDG_CONFIG_HOME` or `$HOME/.config`.\n* @param {RC} config - The configuration object to write. See {@link RC}.\n* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.\n*/\nfunction writeUserConfig(config, options) {\n\toptions = withDefaults(options);\n\toptions.dir = process.env.XDG_CONFIG_HOME || resolve(homedir(), \".config\");\n\twrite(config, options);\n}\n/**\n* Updates a configuration object in `$XDG_CONFIG_HOME` or `$HOME/.config` by merging and writing the result.\n* @param {RC} config - The configuration object to update. See {@link RC}.\n* @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @returns {RC} - The updated configuration object.\n*/\nfunction updateUserConfig(config, options) {\n\toptions = withDefaults(options);\n\toptions.dir = process.env.XDG_CONFIG_HOME || resolve(homedir(), \".config\");\n\treturn update(config, options);\n}\n/**\n* Updates an existing configuration object by merging it with the contents of a configuration file and writing the result.\n* @param {RC} config - The configuration object to update. See {@link RC}.\n* @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @returns {RC} - The updated configuration object. See {@link RC}.\n*/\nfunction update(config, options) {\n\toptions = withDefaults(options);\n\tif (!options.flat) config = unflatten(config, { overwrite: true });\n\tconst newConfig = defu(config, read(options));\n\twrite(newConfig, options);\n\treturn newConfig;\n}\n/**\n* Updates a custom configuration object by merging it with the contents of a configuration file in a default location and writing the result.\n* @param {RC} config - The configuration object to update. See {@link RC}.\n* @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.\n* @returns {RC} - The updated configuration object. See {@link RC}.\n* @deprecated Use {@link updateUserConfig} instead, which uses `~/.config` following XDG conventions.\n*/\nfunction updateUser(config, options) {\n\toptions = withDefaults(options);\n\toptions.dir = process.env.XDG_CONFIG_HOME || homedir();\n\treturn update(config, options);\n}\n//#endregion\nexport { defaults, parse, parseFile, read, readUser, readUserConfig, serialize, update, updateUser, updateUserConfig, write, writeUser, writeUserConfig };\n","import { statSync, promises } from 'node:fs';\nimport { resolve, join, normalize, isAbsolute, dirname } from 'pathe';\nimport { parseJSONC, stringifyJSONC, parseJSON, stringifyJSON, parseJSON5, parseYAML, stringifyJSON5, stringifyYAML } from 'confbox';\nimport { resolveModulePath } from 'exsolve';\nimport { fileURLToPath } from 'node:url';\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { parseINI, stringifyINI } from 'confbox/ini';\n\nconst defaultFindOptions = {\n startingFrom: \".\",\n rootPattern: /^node_modules$/,\n reverse: false,\n test: (filePath) => {\n try {\n if (statSync(filePath).isFile()) {\n return true;\n }\n } catch {\n }\n }\n};\nasync function findFile(filename, _options = {}) {\n const filenames = Array.isArray(filename) ? filename : [filename];\n const options = { ...defaultFindOptions, ..._options };\n const basePath = resolve(options.startingFrom);\n const leadingSlash = basePath[0] === \"/\";\n const segments = basePath.split(\"/\").filter(Boolean);\n if (filenames.includes(segments.at(-1)) && await options.test(basePath)) {\n return basePath;\n }\n if (leadingSlash) {\n segments[0] = \"/\" + segments[0];\n }\n let root = segments.findIndex((r) => r.match(options.rootPattern));\n if (root === -1) {\n root = 0;\n }\n if (options.reverse) {\n for (let index = root + 1; index <= segments.length; index++) {\n for (const filename2 of filenames) {\n const filePath = join(...segments.slice(0, index), filename2);\n if (await options.test(filePath)) {\n return filePath;\n }\n }\n }\n } else {\n for (let index = segments.length; index > root; index--) {\n for (const filename2 of filenames) {\n const filePath = join(...segments.slice(0, index), filename2);\n if (await options.test(filePath)) {\n return filePath;\n }\n }\n }\n }\n throw new Error(\n `Cannot find matching ${filename} in ${options.startingFrom} or parent directories`\n );\n}\nfunction findNearestFile(filename, options = {}) {\n return findFile(filename, options);\n}\nfunction findFarthestFile(filename, options = {}) {\n return findFile(filename, { ...options, reverse: true });\n}\n\nfunction _resolvePath(id, opts = {}) {\n if (id instanceof URL || id.startsWith(\"file://\")) {\n return normalize(fileURLToPath(id));\n }\n if (isAbsolute(id)) {\n return normalize(id);\n }\n return resolveModulePath(id, {\n ...opts,\n from: opts.from || opts.parent || opts.url\n });\n}\n\nconst FileCache$1 = /* @__PURE__ */ new Map();\nfunction defineTSConfig(tsconfig) {\n return tsconfig;\n}\nasync function readTSConfig(id, options = {}) {\n const resolvedPath = await resolveTSConfig(id, options);\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : FileCache$1;\n if (options.cache && cache.has(resolvedPath)) {\n return cache.get(resolvedPath);\n }\n const text = await promises.readFile(resolvedPath, \"utf8\");\n const parsed = parseJSONC(text);\n cache.set(resolvedPath, parsed);\n return parsed;\n}\nasync function writeTSConfig(path, tsconfig) {\n await promises.writeFile(path, stringifyJSONC(tsconfig));\n}\nasync function resolveTSConfig(id = process.cwd(), options = {}) {\n return findNearestFile(\"tsconfig.json\", {\n ...options,\n startingFrom: _resolvePath(id, options)\n });\n}\n\nconst lockFiles = [\n \"yarn.lock\",\n \"package-lock.json\",\n \"pnpm-lock.yaml\",\n \"npm-shrinkwrap.json\",\n \"bun.lockb\",\n \"bun.lock\",\n \"deno.lock\"\n];\nconst packageFiles = [\"package.json\", \"package.json5\", \"package.yaml\"];\nconst workspaceFiles = [\n \"pnpm-workspace.yaml\",\n \"lerna.json\",\n \"turbo.json\",\n \"rush.json\",\n \"deno.json\",\n \"deno.jsonc\"\n];\nconst FileCache = /* @__PURE__ */ new Map();\nfunction definePackageJSON(pkg) {\n return pkg;\n}\nasync function findPackage(id = process.cwd(), options = {}) {\n return findNearestFile(packageFiles, {\n ...options,\n startingFrom: _resolvePath(id, options)\n });\n}\nasync function readPackage(id, options = {}) {\n const resolvedPath = await findPackage(id, options);\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : FileCache;\n if (options.cache && cache.has(resolvedPath)) {\n return cache.get(resolvedPath);\n }\n const blob = await promises.readFile(resolvedPath, \"utf8\");\n let parsed;\n if (resolvedPath.endsWith(\".json5\")) {\n parsed = parseJSON5(blob);\n } else if (resolvedPath.endsWith(\".yaml\")) {\n parsed = parseYAML(blob);\n } else {\n try {\n parsed = parseJSON(blob);\n } catch {\n parsed = parseJSONC(blob);\n }\n }\n cache.set(resolvedPath, parsed);\n return parsed;\n}\nasync function writePackage(path, pkg) {\n let content;\n if (path.endsWith(\".json5\")) {\n content = stringifyJSON5(pkg);\n } else if (path.endsWith(\".yaml\")) {\n content = stringifyYAML(pkg);\n } else {\n content = stringifyJSON(pkg);\n }\n await promises.writeFile(path, content);\n}\nasync function readPackageJSON(id, options = {}) {\n const resolvedPath = await resolvePackageJSON(id, options);\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : FileCache;\n if (options.cache && cache.has(resolvedPath)) {\n return cache.get(resolvedPath);\n }\n const blob = await promises.readFile(resolvedPath, \"utf8\");\n let parsed;\n try {\n parsed = parseJSON(blob);\n } catch {\n parsed = parseJSONC(blob);\n }\n cache.set(resolvedPath, parsed);\n return parsed;\n}\nasync function writePackageJSON(path, pkg) {\n await promises.writeFile(path, stringifyJSON(pkg));\n}\nasync function resolvePackageJSON(id = process.cwd(), options = {}) {\n return findNearestFile(\"package.json\", {\n ...options,\n startingFrom: _resolvePath(id, options)\n });\n}\nasync function resolveLockfile(id = process.cwd(), options = {}) {\n return findNearestFile(lockFiles, {\n ...options,\n startingFrom: _resolvePath(id, options)\n });\n}\nconst workspaceTests = {\n workspaceFile: (opts) => findFile(workspaceFiles, opts).then((r) => dirname(r)),\n gitConfig: (opts) => findFile(\".git/config\", opts).then((r) => resolve(r, \"../..\")),\n lockFile: (opts) => findFile(lockFiles, opts).then((r) => dirname(r)),\n packageJson: (opts) => findFile(packageFiles, opts).then((r) => dirname(r))\n};\nasync function findWorkspaceDir(id = process.cwd(), options = {}) {\n const startingFrom = _resolvePath(id, options);\n const tests = options.tests || [\"workspaceFile\", \"gitConfig\", \"lockFile\", \"packageJson\"];\n for (const testName of tests) {\n const test = workspaceTests[testName];\n if (options[testName] === false || !test) {\n continue;\n }\n const direction = options[testName] || (testName === \"gitConfig\" ? \"closest\" : \"furthest\");\n const detected = await test({\n ...options,\n startingFrom,\n reverse: direction === \"furthest\"\n }).catch(() => {\n });\n if (detected) {\n return detected;\n }\n }\n throw new Error(`Cannot detect workspace root from ${id}`);\n}\nasync function updatePackage(id, callback, options = {}) {\n const resolvedPath = await findPackage(id, options);\n const pkg = await readPackage(id, options);\n const proxy = new Proxy(pkg, {\n get(target, prop) {\n if (typeof prop === \"string\" && objectKeys.has(prop) && !Object.hasOwn(target, prop)) {\n target[prop] = {};\n }\n return Reflect.get(target, prop);\n }\n });\n const updated = await callback(proxy) || pkg;\n await writePackage(resolvedPath, updated);\n}\nfunction sortPackage(pkg) {\n const sorted = {};\n const originalKeys = Object.keys(pkg);\n const knownKeysPresent = defaultFieldOrder.filter(\n (key) => Object.hasOwn(pkg, key)\n );\n for (const key of originalKeys) {\n const currentIndex = knownKeysPresent.indexOf(key);\n if (currentIndex === -1) {\n sorted[key] = pkg[key];\n continue;\n }\n for (let i = 0; i <= currentIndex; i++) {\n const knownKey = knownKeysPresent[i];\n if (!Object.hasOwn(sorted, knownKey)) {\n sorted[knownKey] = pkg[knownKey];\n }\n }\n }\n for (const key of [...dependencyKeys, \"scripts\"]) {\n const value = sorted[key];\n if (isObject(value)) {\n sorted[key] = sortObject(value);\n }\n }\n return sorted;\n}\nfunction normalizePackage(pkg) {\n const normalized = sortPackage(pkg);\n for (const key of dependencyKeys) {\n if (!Object.hasOwn(normalized, key)) {\n continue;\n }\n const value = normalized[key];\n if (!isObject(value)) {\n delete normalized[key];\n }\n }\n return normalized;\n}\nfunction isObject(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction sortObject(obj) {\n return Object.fromEntries(\n Object.entries(obj).sort(([a], [b]) => a.localeCompare(b))\n );\n}\nconst dependencyKeys = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\"\n];\nconst objectKeys = /* @__PURE__ */ new Set([\n \"typesVersions\",\n \"scripts\",\n \"resolutions\",\n \"overrides\",\n \"dependencies\",\n \"devDependencies\",\n \"dependenciesMeta\",\n \"peerDependencies\",\n \"peerDependenciesMeta\",\n \"optionalDependencies\",\n \"engines\",\n \"publishConfig\"\n]);\nconst defaultFieldOrder = [\n \"$schema\",\n \"name\",\n \"version\",\n \"private\",\n \"description\",\n \"keywords\",\n \"homepage\",\n \"bugs\",\n \"repository\",\n \"funding\",\n \"license\",\n \"author\",\n \"sideEffects\",\n \"type\",\n \"imports\",\n \"exports\",\n \"main\",\n \"module\",\n \"browser\",\n \"types\",\n \"typesVersions\",\n \"typings\",\n \"bin\",\n \"man\",\n \"files\",\n \"workspaces\",\n \"scripts\",\n \"resolutions\",\n \"overrides\",\n \"dependencies\",\n \"devDependencies\",\n \"dependenciesMeta\",\n \"peerDependencies\",\n \"peerDependenciesMeta\",\n \"optionalDependencies\",\n \"bundledDependencies\",\n \"bundleDependencies\",\n \"packageManager\",\n \"engines\",\n \"publishConfig\"\n];\n\nfunction defineGitConfig(config) {\n return config;\n}\nasync function resolveGitConfig(dir, opts) {\n return findNearestFile(\".git/config\", { ...opts, startingFrom: dir });\n}\nasync function readGitConfig(dir, opts) {\n const path = await resolveGitConfig(dir, opts);\n const ini = await readFile(path, \"utf8\");\n return parseGitConfig(ini);\n}\nasync function writeGitConfig(path, config) {\n await writeFile(path, stringifyGitConfig(config));\n}\nfunction parseGitConfig(ini) {\n return parseINI(ini.replaceAll(/^\\[(\\w+) \"(.+)\"\\]$/gm, \"[$1.$2]\"));\n}\nfunction stringifyGitConfig(config) {\n return stringifyINI(config).replaceAll(/^\\[(\\w+)\\.(\\w+)\\]$/gm, '[$1 \"$2\"]');\n}\n\nexport { defineGitConfig, definePackageJSON, defineTSConfig, findFarthestFile, findFile, findNearestFile, findPackage, findWorkspaceDir, normalizePackage, parseGitConfig, readGitConfig, readPackage, readPackageJSON, readTSConfig, resolveGitConfig, resolveLockfile, resolvePackageJSON, resolveTSConfig, sortPackage, stringifyGitConfig, updatePackage, writeGitConfig, writePackage, writePackageJSON, writeTSConfig };\n","import { t as debounce } from \"./_chunks/libs/perfect-debounce.mjs\";\nimport { existsSync, readFileSync, statSync } from \"node:fs\";\nimport * as nodeUtil from \"node:util\";\nimport { basename, dirname, extname, join, normalize, resolve } from \"pathe\";\nimport { readFile, rm } from \"node:fs/promises\";\nimport { pathToFileURL } from \"node:url\";\nimport { homedir } from \"node:os\";\nimport { resolveModulePath } from \"exsolve\";\nimport * as rc9 from \"rc9\";\nimport { defu } from \"defu\";\nimport { findWorkspaceDir, readPackageJSON } from \"pkg-types\";\n//#region src/dotenv.ts\n/**\n* Load and interpolate environment variables into `process.env`.\n* If you need more control (or access to the values), consider using `loadDotenv` instead\n*\n*/\nasync function setupDotenv(options) {\n\tconst targetEnvironment = options.env ?? process.env;\n\tconst environment = await loadDotenv({\n\t\tcwd: options.cwd,\n\t\tfileName: options.fileName ?? \".env\",\n\t\tenv: targetEnvironment,\n\t\tinterpolate: options.interpolate ?? true,\n\t\texpandFileReferences: options.expandFileReferences ?? false\n\t});\n\tconst dotenvVars = getDotEnvVars(targetEnvironment);\n\tfor (const key in environment) {\n\t\tif (key.startsWith(\"_\")) continue;\n\t\tif (targetEnvironment[key] === void 0 || dotenvVars.has(key)) targetEnvironment[key] = environment[key];\n\t}\n\treturn environment;\n}\n/** Load environment variables into an object. */\nasync function loadDotenv(options) {\n\tconst environment = Object.create(null);\n\tconst cwd = resolve(options.cwd || \".\");\n\tconst _fileName = options.fileName || \".env\";\n\tconst dotenvFiles = typeof _fileName === \"string\" ? [_fileName] : _fileName;\n\tconst dotenvVars = getDotEnvVars(options.env || {});\n\tObject.assign(environment, options.env);\n\tfor (const file of dotenvFiles) {\n\t\tconst dotenvFile = resolve(cwd, file);\n\t\tif (!statSync(dotenvFile, { throwIfNoEntry: false })?.isFile()) continue;\n\t\tconst parsed = await readEnvFile(dotenvFile);\n\t\tfor (const key in parsed) {\n\t\t\tif (key in environment && !dotenvVars.has(key)) continue;\n\t\t\tenvironment[key] = parsed[key];\n\t\t\tdotenvVars.add(key);\n\t\t}\n\t}\n\tif (options.expandFileReferences) {\n\t\tfor (const key in environment) if (key.endsWith(\"_FILE\")) {\n\t\t\tconst targetKey = key.slice(0, -5);\n\t\t\tif (environment[targetKey] === void 0) {\n\t\t\t\tconst filePath = environment[key];\n\t\t\t\tif (filePath && statSync(filePath, { throwIfNoEntry: false })?.isFile()) {\n\t\t\t\t\tenvironment[targetKey] = readFileSync(filePath, \"utf8\").trim();\n\t\t\t\t\tdotenvVars.add(targetKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (options.interpolate) interpolate(environment);\n\treturn environment;\n}\nlet _parseEnv = nodeUtil.parseEnv;\nasync function readEnvFile(path) {\n\tconst src = readFileSync(path, \"utf8\");\n\tif (!_parseEnv) try {\n\t\tconst dotenv = await import(\"dotenv\");\n\t\t_parseEnv = (src) => dotenv.parse(src);\n\t} catch {\n\t\tthrow new Error(\"Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime or install `dotenv` as a dependency.\");\n\t}\n\treturn _parseEnv(src);\n}\nfunction interpolate(target, source = {}, parse = (v) => v) {\n\tfunction getValue(key) {\n\t\treturn source[key] === void 0 ? target[key] : source[key];\n\t}\n\tfunction interpolate(value, parents = []) {\n\t\tif (typeof value !== \"string\") return value;\n\t\treturn parse((value.match(/(.?\\${?(?:[\\w:]+)?}?)/g) || []).reduce((newValue, match) => {\n\t\t\tconst parts = /(.?)\\${?([\\w:]+)?}?/g.exec(match) || [];\n\t\t\tconst prefix = parts[1];\n\t\t\tlet value, replacePart;\n\t\t\tif (prefix === \"\\\\\") {\n\t\t\t\treplacePart = parts[0] || \"\";\n\t\t\t\tvalue = replacePart.replace(String.raw`\\$`, \"$\");\n\t\t\t} else {\n\t\t\t\tconst key = parts[2];\n\t\t\t\treplacePart = (parts[0] || \"\").slice(prefix.length);\n\t\t\t\tif (parents.includes(key)) {\n\t\t\t\t\tconsole.warn(`Please avoid recursive environment variables ( loop: ${parents.join(\" > \")} > ${key} )`);\n\t\t\t\t\treturn \"\";\n\t\t\t\t}\n\t\t\t\tvalue = getValue(key);\n\t\t\t\tvalue = interpolate(value, [...parents, key]);\n\t\t\t}\n\t\t\treturn value === void 0 ? newValue : newValue.replace(replacePart, value);\n\t\t}, value));\n\t}\n\tfor (const key in target) target[key] = interpolate(getValue(key));\n}\nfunction getDotEnvVars(targetEnvironment) {\n\tconst globalRegistry = globalThis.__c12_dotenv_vars__ ||= /* @__PURE__ */ new Map();\n\tif (!globalRegistry.has(targetEnvironment)) globalRegistry.set(targetEnvironment, /* @__PURE__ */ new Set());\n\treturn globalRegistry.get(targetEnvironment);\n}\n//#endregion\n//#region src/loader.ts\nconst _normalize = (p) => p?.replace(/\\\\/g, \"/\");\nlet importCounter = 0;\nconst ASYNC_LOADERS = {\n\t\".yaml\": () => import(\"confbox/yaml\").then((r) => r.parseYAML),\n\t\".yml\": () => import(\"confbox/yaml\").then((r) => r.parseYAML),\n\t\".jsonc\": () => import(\"confbox/jsonc\").then((r) => r.parseJSONC),\n\t\".json5\": () => import(\"confbox/json5\").then((r) => r.parseJSON5),\n\t\".toml\": () => import(\"confbox/toml\").then((r) => r.parseTOML)\n};\nconst SUPPORTED_EXTENSIONS = Object.freeze([\n\t\".js\",\n\t\".ts\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".mts\",\n\t\".cts\",\n\t\".json\",\n\t\".jsonc\",\n\t\".json5\",\n\t\".yaml\",\n\t\".yml\",\n\t\".toml\"\n]);\nasync function loadConfig(options) {\n\toptions.cwd = resolve(process.cwd(), options.cwd || \".\");\n\toptions.name = options.name || \"config\";\n\toptions.envName = options.envName ?? process.env.NODE_ENV;\n\toptions.configFile = options.configFile ?? (options.name === \"config\" ? \"config\" : `${options.name}.config`);\n\toptions.rcFile = options.rcFile ?? `.${options.name}rc`;\n\tif (options.extend !== false) options.extend = {\n\t\textendKey: \"extends\",\n\t\t...options.extend\n\t};\n\tconst _merger = options.merger || defu;\n\tconst r = {\n\t\tconfig: {},\n\t\tcwd: options.cwd,\n\t\tconfigFile: resolve(options.cwd, options.configFile),\n\t\tlayers: [],\n\t\t_configFile: void 0\n\t};\n\tconst rawConfigs = {\n\t\toverrides: options.overrides,\n\t\tmain: void 0,\n\t\trc: void 0,\n\t\tpackageJson: void 0,\n\t\tdefaultConfig: options.defaultConfig\n\t};\n\tif (options.dotenv) await setupDotenv({\n\t\tcwd: options.cwd,\n\t\t...options.dotenv === true ? {} : options.dotenv\n\t});\n\tconst _mainConfig = await resolveConfig(\".\", options);\n\tif (_mainConfig.configFile) {\n\t\trawConfigs.main = _mainConfig.config;\n\t\tr.configFile = _mainConfig.configFile;\n\t\tr._configFile = _mainConfig._configFile;\n\t}\n\tif (_mainConfig.meta) r.meta = _mainConfig.meta;\n\tif (options.rcFile) {\n\t\tconst rcSources = [];\n\t\trcSources.push(rc9.read({\n\t\t\tname: options.rcFile,\n\t\t\tdir: options.cwd\n\t\t}));\n\t\tif (options.globalRc) {\n\t\t\tconst workspaceDir = await findWorkspaceDir(options.cwd).catch(() => {});\n\t\t\tif (workspaceDir) rcSources.push(rc9.read({\n\t\t\t\tname: options.rcFile,\n\t\t\t\tdir: workspaceDir\n\t\t\t}));\n\t\t\trcSources.push(rc9.readUser({\n\t\t\t\tname: options.rcFile,\n\t\t\t\tdir: options.cwd\n\t\t\t}));\n\t\t}\n\t\trawConfigs.rc = _merger({}, ...rcSources);\n\t}\n\tif (options.packageJson) {\n\t\tconst keys = (Array.isArray(options.packageJson) ? options.packageJson : [typeof options.packageJson === \"string\" ? options.packageJson : options.name]).filter((t) => t && typeof t === \"string\");\n\t\tconst pkgJsonFile = await readPackageJSON(options.cwd).catch(() => {});\n\t\trawConfigs.packageJson = _merger({}, ...keys.map((key) => pkgJsonFile?.[key]));\n\t}\n\tconst configs = {};\n\tfor (const key in rawConfigs) {\n\t\tconst value = rawConfigs[key];\n\t\tconfigs[key] = await (typeof value === \"function\" ? value({\n\t\t\tconfigs,\n\t\t\trawConfigs\n\t\t}) : value);\n\t}\n\tif (Array.isArray(configs.main)) r.config = configs.main;\n\telse {\n\t\tr.config = _merger(configs.overrides, configs.main, configs.rc, configs.packageJson, configs.defaultConfig);\n\t\tif (options.extend) {\n\t\t\tawait extendConfig(r.config, options);\n\t\t\tr.layers = r.config._layers;\n\t\t\tdelete r.config._layers;\n\t\t\tr.config = _merger(r.config, ...r.layers.map((e) => e.config));\n\t\t}\n\t}\n\tr.layers = [...[\n\t\tconfigs.overrides && {\n\t\t\tconfig: configs.overrides,\n\t\t\tconfigFile: void 0,\n\t\t\tcwd: void 0\n\t\t},\n\t\t{\n\t\t\tconfig: configs.main,\n\t\t\tconfigFile: options.configFile,\n\t\t\tcwd: options.cwd\n\t\t},\n\t\tconfigs.rc && {\n\t\t\tconfig: configs.rc,\n\t\t\tconfigFile: options.rcFile\n\t\t},\n\t\tconfigs.packageJson && {\n\t\t\tconfig: configs.packageJson,\n\t\t\tconfigFile: \"package.json\"\n\t\t}\n\t].filter((l) => l && l.config), ...r.layers];\n\tif (options.defaults) r.config = _merger(r.config, options.defaults);\n\tif (options.omit$Keys) {\n\t\tfor (const key in r.config) if (key.startsWith(\"$\")) delete r.config[key];\n\t}\n\tif (options.configFileRequired && !r._configFile) throw new Error(`Required config (${r.configFile}) cannot be resolved.`);\n\treturn r;\n}\nasync function extendConfig(config, options) {\n\tconfig._layers = config._layers || [];\n\tif (!options.extend) return;\n\tlet keys = options.extend.extendKey;\n\tif (typeof keys === \"string\") keys = [keys];\n\tconst extendSources = [];\n\tfor (const key of keys) {\n\t\textendSources.push(...(Array.isArray(config[key]) ? config[key] : [config[key]]).filter(Boolean));\n\t\tdelete config[key];\n\t}\n\tfor (let extendSource of extendSources) {\n\t\tconst originalExtendSource = extendSource;\n\t\tlet sourceOptions = {};\n\t\tif (extendSource.source) {\n\t\t\tsourceOptions = extendSource.options || {};\n\t\t\textendSource = extendSource.source;\n\t\t}\n\t\tif (Array.isArray(extendSource)) {\n\t\t\tsourceOptions = extendSource[1] || {};\n\t\t\textendSource = extendSource[0];\n\t\t}\n\t\tif (typeof extendSource !== \"string\") {\n\t\t\tconsole.warn(`Cannot extend config from \\`${JSON.stringify(originalExtendSource)}\\` in ${options.cwd}`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst _config = await resolveConfig(extendSource, options, sourceOptions);\n\t\tif (!_config.config) {\n\t\t\tconsole.warn(`Cannot extend config from \\`${extendSource}\\` in ${options.cwd}`);\n\t\t\tcontinue;\n\t\t}\n\t\tawait extendConfig(_config.config, {\n\t\t\t...options,\n\t\t\tcwd: _config.cwd\n\t\t});\n\t\tconfig._layers.push(_config);\n\t\tif (_config.config._layers) {\n\t\t\tconfig._layers.push(..._config.config._layers);\n\t\t\tdelete _config.config._layers;\n\t\t}\n\t}\n}\nconst GIGET_PREFIXES = [\n\t\"gh:\",\n\t\"github:\",\n\t\"gitlab:\",\n\t\"bitbucket:\",\n\t\"https://\",\n\t\"http://\"\n];\nconst NPM_PACKAGE_RE = /^(@[\\da-z~-][\\d._a-z~-]*\\/)?[\\da-z~-][\\d._a-z~-]*($|\\/.*)/;\nasync function resolveConfig(source, options, sourceOptions = {}) {\n\tif (options.resolve) {\n\t\tconst res = await options.resolve(source, options);\n\t\tif (res) return res;\n\t}\n\tconst _merger = options.merger || defu;\n\tconst customProviderKeys = Object.keys(sourceOptions.giget?.providers || {}).map((key) => `${key}:`);\n\tconst gigetPrefixes = customProviderKeys.length > 0 ? [...new Set([...customProviderKeys, ...GIGET_PREFIXES])] : GIGET_PREFIXES;\n\tif (options.giget !== false && gigetPrefixes.some((prefix) => source.startsWith(prefix))) {\n\t\tconst { downloadTemplate } = await import(\"giget\").catch((error) => {\n\t\t\tthrow new Error(`Extending config from \\`${source}\\` requires \\`giget\\` peer dependency to be installed.\\n\\nInstall it with: \\`npx nypm i giget\\``, { cause: error });\n\t\t});\n\t\tconst { digest } = await import(\"./_chunks/libs/ohash.mjs\").then((n) => n.n);\n\t\tconst cloneName = source.replace(/\\W+/g, \"_\").split(\"_\").splice(0, 3).join(\"_\") + \"_\" + digest(source).slice(0, 10).replace(/[-_]/g, \"\");\n\t\tlet cloneDir;\n\t\tconst localNodeModules = resolve(options.cwd, \"node_modules\");\n\t\tconst parentDir = dirname(options.cwd);\n\t\tif (basename(parentDir) === \".c12\") cloneDir = join(parentDir, cloneName);\n\t\telse if (existsSync(localNodeModules)) cloneDir = join(localNodeModules, \".c12\", cloneName);\n\t\telse cloneDir = process.env.XDG_CACHE_HOME ? resolve(process.env.XDG_CACHE_HOME, \"c12\", cloneName) : resolve(homedir(), \".cache/c12\", cloneName);\n\t\tif (existsSync(cloneDir) && !sourceOptions.install) await rm(cloneDir, { recursive: true });\n\t\tsource = (await downloadTemplate(source, {\n\t\t\tdir: cloneDir,\n\t\t\tinstall: sourceOptions.install,\n\t\t\tforce: sourceOptions.install,\n\t\t\tauth: sourceOptions.auth,\n\t\t\t...options.giget,\n\t\t\t...sourceOptions.giget\n\t\t})).dir;\n\t}\n\tif (NPM_PACKAGE_RE.test(source)) source = tryResolve(source, options) || source;\n\tconst ext = extname(source);\n\tconst isDir = _isDirectory(resolve(options.cwd, source)) ?? (!ext || ext === basename(source));\n\tconst cwd = resolve(options.cwd, isDir ? source : dirname(source));\n\tif (isDir) source = options.configFile;\n\tconst res = {\n\t\tconfig: void 0,\n\t\tconfigFile: void 0,\n\t\tcwd,\n\t\tsource,\n\t\tsourceOptions\n\t};\n\tres.configFile = tryResolve(resolve(cwd, source), options) || tryResolve(resolve(cwd, \".config\", source.replace(/\\.config$/, \"\")), options) || tryResolve(resolve(cwd, \".config\", source), options) || source;\n\tif (!existsSync(res.configFile)) return res;\n\tres._configFile = res.configFile;\n\tconst configFileExt = extname(res.configFile) || \"\";\n\tif (configFileExt in ASYNC_LOADERS) res.config = (await ASYNC_LOADERS[configFileExt]())(await readFile(res.configFile, \"utf8\"));\n\telse {\n\t\tconst _resolveModule = options.resolveModule || ((mod) => mod.default || mod);\n\t\tif (options.import) res.config = _resolveModule(await options.import(res.configFile));\n\t\telse {\n\t\t\tconst _configURL = pathToFileURL(res.configFile);\n\t\t\t_configURL.search = `_${++importCounter}`;\n\t\t\tres.config = await import(_configURL.href).then(_resolveModule, async (error) => {\n\t\t\t\tconst { createJiti } = await import(\"jiti\").catch(() => {\n\t\t\t\t\tthrow new Error(`Failed to load config file \\`${res.configFile}\\`: ${error?.message}. Hint install \\`jiti\\` for compatibility.`, { cause: error });\n\t\t\t\t});\n\t\t\t\tconst jiti = createJiti(join(options.cwd || \".\", options.configFile || \"/\"), {\n\t\t\t\t\tinteropDefault: true,\n\t\t\t\t\tmoduleCache: false,\n\t\t\t\t\textensions: [...SUPPORTED_EXTENSIONS]\n\t\t\t\t});\n\t\t\t\toptions.import = (id) => jiti.import(id);\n\t\t\t\treturn _resolveModule(await options.import(res.configFile));\n\t\t\t});\n\t\t}\n\t}\n\tif (typeof res.config === \"function\") res.config = await res.config(options.context);\n\tif (options.envName) {\n\t\tconst envConfig = {\n\t\t\t...res.config[\"$\" + options.envName],\n\t\t\t...res.config.$env?.[options.envName]\n\t\t};\n\t\tif (Object.keys(envConfig).length > 0) res.config = _merger(envConfig, res.config);\n\t}\n\tres.meta = defu(res.sourceOptions.meta, res.config.$meta);\n\tdelete res.config.$meta;\n\tif (res.sourceOptions.overrides) res.config = _merger(res.sourceOptions.overrides, res.config);\n\tres.configFile = _normalize(res.configFile);\n\tres.source = _normalize(res.source);\n\treturn res;\n}\nfunction tryResolve(id, options) {\n\tconst res = resolveModulePath(id, {\n\t\ttry: true,\n\t\tfrom: pathToFileURL(join(options.cwd || \".\", options.configFile || \"/\")),\n\t\tsuffixes: [\"\", \"/index\"],\n\t\textensions: SUPPORTED_EXTENSIONS,\n\t\tcache: false\n\t});\n\treturn res ? normalize(res) : void 0;\n}\n/** Returns `true`/`false` if the path exists, `null` if it doesn't. */\nfunction _isDirectory(path) {\n\ttry {\n\t\treturn statSync(path).isDirectory();\n\t} catch {\n\t\treturn null;\n\t}\n}\n//#endregion\n//#region src/types.ts\nfunction createDefineConfig() {\n\treturn (input) => input;\n}\n//#endregion\n//#region src/watch.ts\nconst eventMap = {\n\tadd: \"created\",\n\tchange: \"updated\",\n\tunlink: \"removed\"\n};\nasync function watchConfig(options) {\n\tlet config = await loadConfig(options);\n\tconst configName = options.name || \"config\";\n\tconst configFileName = options.configFile ?? (options.name === \"config\" ? \"config\" : `${options.name}.config`);\n\tconst watchingFiles = [...new Set((config.layers || []).filter((l) => l.cwd).flatMap((l) => [\n\t\t...SUPPORTED_EXTENSIONS.flatMap((ext) => [\n\t\t\tresolve(l.cwd, configFileName + ext),\n\t\t\tresolve(l.cwd, \".config\", configFileName + ext),\n\t\t\tresolve(l.cwd, \".config\", configFileName.replace(/\\.config$/, \"\") + ext)\n\t\t]),\n\t\tl.source && resolve(l.cwd, l.source),\n\t\toptions.rcFile && resolve(l.cwd, typeof options.rcFile === \"string\" ? options.rcFile : `.${configName}rc`),\n\t\toptions.packageJson && resolve(l.cwd, \"package.json\")\n\t]).filter(Boolean))];\n\tconst watch = await import(\"chokidar\").then((r) => r.watch || r.default || r);\n\tconst { diff } = await import(\"./_chunks/libs/ohash.mjs\").then((n) => n.t);\n\tconst _fswatcher = watch(watchingFiles, {\n\t\tignoreInitial: true,\n\t\t...options.chokidarOptions\n\t});\n\tconst onChange = async (event, path) => {\n\t\tconst type = eventMap[event];\n\t\tif (!type) return;\n\t\tif (options.onWatch) await options.onWatch({\n\t\t\ttype,\n\t\t\tpath\n\t\t});\n\t\tconst oldConfig = config;\n\t\ttry {\n\t\t\tconfig = await loadConfig(options);\n\t\t} catch (error) {\n\t\t\tconsole.warn(`Failed to load config ${path}\\n${error}`);\n\t\t\treturn;\n\t\t}\n\t\tconst changeCtx = {\n\t\t\tnewConfig: config,\n\t\t\toldConfig,\n\t\t\tgetDiff: () => diff(oldConfig.config, config.config)\n\t\t};\n\t\tif (options.acceptHMR) {\n\t\t\tif (await options.acceptHMR(changeCtx)) return;\n\t\t}\n\t\tif (options.onUpdate) await options.onUpdate(changeCtx);\n\t};\n\tif (options.debounce === false) _fswatcher.on(\"all\", onChange);\n\telse _fswatcher.on(\"all\", debounce(onChange, options.debounce ?? 100));\n\tconst utils = {\n\t\twatchingFiles,\n\t\tunwatch: async () => {\n\t\t\tawait _fswatcher.close();\n\t\t}\n\t};\n\treturn new Proxy(utils, { get(_, prop) {\n\t\tif (prop in utils) return utils[prop];\n\t\treturn config[prop];\n\t} });\n}\n//#endregion\nexport { SUPPORTED_EXTENSIONS, createDefineConfig, loadConfig, loadDotenv, setupDotenv, watchConfig };\n","import { n as ok, t as err } from \"./result-D_NYcfr2.js\";\n//#region src/validate.ts\n/**\n* Validate unknown input against a Zod schema.\n*\n* When validation fails, issues are automatically formatted into a human-readable\n* message. If a `createError` factory is provided, it receives the formatted\n* issues and message. Otherwise, a plain `Error` with the formatted message is\n* returned.\n*\n* @param options - The validation options.\n* @param options.schema - The Zod schema to validate against.\n* @param options.params - The unknown value to validate.\n* @param options.createError - Optional factory invoked when validation fails.\n* @returns A Result tuple - either [Error, null] on failure or [null, T] on success.\n*/\nfunction validate({ schema, params, createError }) {\n\tconst result = schema.safeParse(params);\n\tif (!result.success) {\n\t\tconst formatted = formatZodIssues(result.error.issues);\n\t\tif (createError) return err(createError(formatted));\n\t\treturn err(formatted.message);\n\t}\n\treturn ok(result.data);\n}\n/**\n* Format raw Zod validation issues into structured objects and a human-readable string.\n*\n* @private\n* @param issues - Raw Zod validation issues.\n* @param separator - Separator between formatted issue strings.\n* @returns An object containing the formatted issues array and a joined message string.\n*/\nfunction formatZodIssues(issues, separator = \"\\n \") {\n\tconst formatted = issues.map((issue) => ({\n\t\tmessage: issue.message,\n\t\tpath: issue.path.map(String).join(\".\")\n\t}));\n\treturn {\n\t\tissues: formatted,\n\t\tmessage: formatted.map((item) => {\n\t\t\tif (item.path.length > 0) return `${item.path}: ${item.message}`;\n\t\t\treturn item.message;\n\t\t}).join(separator)\n\t};\n}\n//#endregion\nexport { validate };\n\n//# sourceMappingURL=validate.js.map","import { withTag } from \"@maltty/utils/tag\";\nimport { err, ok, toError } from \"@maltty/utils/fp\";\nimport { loadConfig as loadConfig$1 } from \"c12\";\nimport { attemptAsync } from \"es-toolkit\";\nimport { validate } from \"@maltty/utils/validate\";\nimport { z } from \"zod\";\n//#region src/utils/compile.ts\n/**\n* All supported cross-compilation targets with human-readable labels.\n*\n* This is the single source of truth — the {@link CompileTarget} union type\n* and the Zod validation schema are both derived from this array.\n*\n* Targets marked `default: true` are compiled when no explicit targets are configured,\n* covering ~95% of developer environments.\n*/\nconst compileTargets = [\n\t{\n\t\ttarget: \"darwin-arm64\",\n\t\tlabel: \"macOS Apple Silicon\",\n\t\tdefault: true\n\t},\n\t{\n\t\ttarget: \"darwin-x64\",\n\t\tlabel: \"macOS Intel\",\n\t\tdefault: true\n\t},\n\t{\n\t\ttarget: \"linux-arm64\",\n\t\tlabel: \"Linux ARM64\",\n\t\tdefault: false\n\t},\n\t{\n\t\ttarget: \"linux-x64\",\n\t\tlabel: \"Linux x64\",\n\t\tdefault: true\n\t},\n\t{\n\t\ttarget: \"linux-x64-musl\",\n\t\tlabel: \"Linux x64 (musl)\",\n\t\tdefault: false\n\t},\n\t{\n\t\ttarget: \"windows-arm64\",\n\t\tlabel: \"Windows ARM64\",\n\t\tdefault: false\n\t},\n\t{\n\t\ttarget: \"windows-x64\",\n\t\tlabel: \"Windows x64\",\n\t\tdefault: true\n\t}\n];\n//#endregion\n//#region src/utils/schema.ts\n/**\n* @private\n*/\nconst compileTargetValues = compileTargets.map((entry) => entry.target);\n/**\n* @private\n*/\nconst CompileTargetSchema = z.enum(compileTargetValues);\n/**\n* @private\n*/\nconst BuildOptionsSchema = z.object({\n\tclean: z.boolean().optional(),\n\tdefine: z.record(z.string(), z.string()).optional(),\n\texternal: z.array(z.string()).optional(),\n\tminify: z.boolean().optional(),\n\tout: z.string().optional(),\n\tsourcemap: z.boolean().optional(),\n\ttarget: z.string().optional()\n}).strict();\n/**\n* @private\n*/\nconst CompileOptionsSchema = z.object({\n\tautoloadDotenv: z.boolean().optional(),\n\tname: z.string().optional(),\n\tout: z.string().optional(),\n\ttargets: z.array(CompileTargetSchema).optional()\n}).strict();\n/**\n* Zod schema validating the {@link MalttyConfig} shape.\n*/\nconst MalttyConfigSchema = z.object({\n\tbuild: BuildOptionsSchema.optional(),\n\tcommands: z.string().optional(),\n\tcompile: z.union([z.boolean(), CompileOptionsSchema]).optional(),\n\tentry: z.string().optional(),\n\tinclude: z.array(z.string()).optional()\n}).strict();\n/**\n* Validate arbitrary data against the {@link MalttyConfigSchema}.\n*\n* @param data - The unknown value to validate.\n* @returns A Result tuple - `[null, MalttyConfig]` on success or `[Error, null]` on failure.\n*/\nfunction validateConfig(data) {\n\treturn validate({\n\t\tschema: MalttyConfigSchema,\n\t\tparams: data,\n\t\tcreateError: ({ message }) => /* @__PURE__ */ new Error(`Invalid maltty config:\\n ${message}`)\n\t});\n}\n//#endregion\n//#region src/utils/loader.ts\n/**\n* Load and validate a `maltty.config.ts` file using c12.\n*\n* Searches for a config file named `maltty` (e.g. `maltty.config.ts`, `maltty.config.mts`)\n* in the given working directory, validates it against the build config schema,\n* and returns a tagged config object.\n*\n* @param options - Optional loader configuration.\n* @returns A Result tuple - `[null, LoadConfigResult]` on success or `[Error, null]` on failure.\n*/\nasync function loadConfig(options) {\n\tconst { cwd, defaults, overrides } = options ?? {};\n\tconst [loadError, loaded] = await attemptAsync(() => loadConfig$1({\n\t\tcwd,\n\t\tdefaults,\n\t\tname: \"maltty\",\n\t\toverrides\n\t}));\n\tif (loadError) return err(`Failed to load maltty config: ${toError(loadError).message}`);\n\tif (!loaded) return err(\"Failed to load maltty config: no configuration was returned\");\n\tconst [validateError, config] = validateConfig(loaded.config);\n\tif (validateError) return err(validateError);\n\treturn ok({\n\t\tconfig: withTag(config, \"MalttyConfig\"),\n\t\tconfigFile: loaded.configFile\n\t});\n}\n//#endregion\nexport { MalttyConfigSchema, compileTargets, loadConfig, validateConfig };\n\n//# sourceMappingURL=utils.js.map"],"x_google_ignoreList":[1,2,3,4,5,6],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,MAAM;;;;;;;;;;;AAWZ,SAAS,QAAQ,KAAK,KAAK;CAC1B,MAAM,OAAO,EAAE,GAAG,KAAK;AACvB,QAAO,eAAe,MAAM,KAAK;EAChC,cAAc;EACd,YAAY;EACZ,OAAO;EACP,UAAU;EACV,CAAC;AACF,QAAO;;;;AClBR,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAID,MAAM,QAAQ,EAA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C5C,QAAO,GAAG;EACT,QAAQ,QAAQ,QAAQ,eAAe;EACvC,YAAY,OAAO;EACnB,CAAC"}
@@ -0,0 +1,18 @@
1
+ //#region src/lib/validate.ts
2
+ const KEBAB_CASE_CHARS_RE = /^[a-z][\da-z-]*$/;
3
+ /**
4
+ * Check whether a string is valid kebab-case.
5
+ *
6
+ * @param value - The string to validate.
7
+ * @returns True when the string is kebab-case.
8
+ */
9
+ function isKebabCase(value) {
10
+ if (!KEBAB_CASE_CHARS_RE.test(value)) return false;
11
+ if (value.endsWith("-")) return false;
12
+ if (value.includes("--")) return false;
13
+ return true;
14
+ }
15
+ //#endregion
16
+ export { isKebabCase as t };
17
+
18
+ //# sourceMappingURL=validate-C_SXBoLq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-C_SXBoLq.js","names":[],"sources":["../src/lib/validate.ts"],"sourcesContent":["export const KEBAB_CASE_CHARS_RE = /^[a-z][\\da-z-]*$/ as RegExp\n\n/**\n * Check whether a string is valid kebab-case.\n *\n * @param value - The string to validate.\n * @returns True when the string is kebab-case.\n */\nexport function isKebabCase(value: string): boolean {\n if (!KEBAB_CASE_CHARS_RE.test(value)) {\n return false\n }\n if (value.endsWith('-')) {\n return false\n }\n if (value.includes('--')) {\n return false\n }\n return true\n}\n"],"mappings":";AAAA,MAAa,sBAAsB;;;;;;;AAQnC,SAAgB,YAAY,OAAwB;AAClD,KAAI,CAAC,oBAAoB,KAAK,MAAM,CAClC,QAAO;AAET,KAAI,MAAM,SAAS,IAAI,CACrB,QAAO;AAET,KAAI,MAAM,SAAS,KAAK,CACtB,QAAO;AAET,QAAO"}
@@ -0,0 +1,152 @@
1
+ import { i as toError, r as ok, t as attemptAsync } from "./attemptAsync-BdXzRSIT.js";
2
+ import { r as fs_exports, t as path_exports } from "./node-C91xGGqn.js";
3
+ import { dirname, join, relative } from "node:path";
4
+ import { readFile, readdir } from "node:fs/promises";
5
+ import { Liquid } from "liquidjs";
6
+ //#region src/lib/render.ts
7
+ /**
8
+ * Render all `.liquid` templates in a directory using LiquidJS.
9
+ *
10
+ * Recursively collects `.liquid` files under `templateDir`, renders each
11
+ * with the provided variables, and strips the `.liquid` extension from
12
+ * the output path. Files named `gitignore.liquid` are mapped to `.gitignore`.
13
+ *
14
+ * @param params - Template directory and variable bindings.
15
+ * @returns An async Result containing rendered files or a GenerateError.
16
+ */
17
+ async function renderTemplate(params) {
18
+ const engine = new Liquid({ root: params.templateDir });
19
+ const entries = await collectLiquidFiles(params.templateDir);
20
+ if (entries.length === 0) return ok([]);
21
+ const results = await Promise.all(entries.map(async (entry) => {
22
+ const [renderError, content] = await renderSingleFile(engine, join(params.templateDir, entry), params.variables);
23
+ if (renderError) return renderError;
24
+ return {
25
+ content,
26
+ relativePath: mapOutputPath(entry)
27
+ };
28
+ }));
29
+ const firstError = results.find(isGenerateError);
30
+ if (firstError) return [firstError, null];
31
+ return ok(results);
32
+ }
33
+ /**
34
+ * Recursively collect all `.liquid` file paths relative to root.
35
+ *
36
+ * @param root - The directory to scan.
37
+ * @returns Relative paths of all `.liquid` files.
38
+ * @private
39
+ */
40
+ async function collectLiquidFiles(root) {
41
+ return (await readdir(root, {
42
+ recursive: true,
43
+ withFileTypes: true
44
+ })).filter((entry) => entry.isFile() && entry.name.endsWith(".liquid")).map((entry) => {
45
+ const parent = entry.parentPath;
46
+ return path_exports.toPosixPath(relative(root, join(parent, entry.name)));
47
+ });
48
+ }
49
+ /**
50
+ * Render a single `.liquid` file with the given variables.
51
+ *
52
+ * @param engine - The LiquidJS engine instance.
53
+ * @param absolutePath - Absolute path to the `.liquid` file.
54
+ * @param variables - Template variable bindings.
55
+ * @returns A Result tuple with the rendered content or a GenerateError.
56
+ * @private
57
+ */
58
+ async function renderSingleFile(engine, absolutePath, variables) {
59
+ const [renderError, content] = await attemptAsync(async () => {
60
+ const template = await readFile(absolutePath, "utf8");
61
+ return engine.parseAndRender(template, variables);
62
+ });
63
+ if (renderError) return [{
64
+ message: `Failed to render template: ${toError(renderError).message}`,
65
+ path: absolutePath,
66
+ type: "render_error"
67
+ }, null];
68
+ return ok(content);
69
+ }
70
+ /**
71
+ * Map a `.liquid` relative path to its output path.
72
+ *
73
+ * Strips the `.liquid` extension and renames bare `gitignore` segments
74
+ * to `.gitignore` so dotfiles survive version control.
75
+ *
76
+ * @param liquidPath - Relative path ending in `.liquid`.
77
+ * @returns The output-relative path without the `.liquid` suffix.
78
+ * @private
79
+ */
80
+ function mapOutputPath(liquidPath) {
81
+ return liquidPath.replace(/\.liquid$/, "").replaceAll(/(^|\/)gitignore($|\/)/g, "$1.gitignore$2");
82
+ }
83
+ /**
84
+ * Type guard for GenerateError objects.
85
+ *
86
+ * @param value - The value to check.
87
+ * @returns True when value has a `type` and `message` property matching GenerateError.
88
+ * @private
89
+ */
90
+ function isGenerateError(value) {
91
+ if (typeof value !== "object" || value === null) return false;
92
+ return "type" in value && "message" in value;
93
+ }
94
+ //#endregion
95
+ //#region src/lib/write.ts
96
+ /**
97
+ * Write rendered files to disk with optional conflict detection.
98
+ *
99
+ * For each file, resolves the target path under `outputDir`, creates parent
100
+ * directories as needed, and writes the content. When `overwrite` is false,
101
+ * existing files are skipped rather than overwritten.
102
+ *
103
+ * @param params - Files to write, target directory, and overwrite flag.
104
+ * @returns An async Result with counts of written/skipped files or a GenerateError.
105
+ */
106
+ async function writeFiles(params) {
107
+ const results = await Promise.all(params.files.map((file) => writeSingleFile(file, params.outputDir, params.overwrite)));
108
+ const firstError = results.find((r) => r[0] !== null);
109
+ if (firstError) return [firstError[0], null];
110
+ const validStatuses = results.filter((r) => r[1] !== null);
111
+ const written = validStatuses.filter(([, status]) => status.action === "written").map(([, status]) => status.path);
112
+ return ok({
113
+ skipped: validStatuses.filter(([, status]) => status.action === "skipped").map(([, status]) => status.path),
114
+ written
115
+ });
116
+ }
117
+ /**
118
+ * Write a single rendered file to disk.
119
+ *
120
+ * @param file - The rendered file to write.
121
+ * @param outputDir - The root output directory.
122
+ * @param overwrite - Whether to overwrite existing files.
123
+ * @returns A Result tuple with the write status or a GenerateError.
124
+ * @private
125
+ */
126
+ async function writeSingleFile(file, outputDir, overwrite) {
127
+ const targetPath = join(outputDir, file.relativePath);
128
+ if (await fs_exports.exists(targetPath) && !overwrite) return ok({
129
+ action: "skipped",
130
+ path: file.relativePath
131
+ });
132
+ const [mkdirError] = await fs_exports.mkdir(dirname(targetPath));
133
+ if (mkdirError) return [{
134
+ message: `Failed to write file: ${mkdirError.message}`,
135
+ path: targetPath,
136
+ type: "write_error"
137
+ }, null];
138
+ const [writeError] = await fs_exports.write(targetPath, file.content);
139
+ if (writeError) return [{
140
+ message: `Failed to write file: ${writeError.message}`,
141
+ path: targetPath,
142
+ type: "write_error"
143
+ }, null];
144
+ return ok({
145
+ action: "written",
146
+ path: file.relativePath
147
+ });
148
+ }
149
+ //#endregion
150
+ export { renderTemplate as n, writeFiles as t };
151
+
152
+ //# sourceMappingURL=write-CSwG4Stj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-CSwG4Stj.js","names":["path","fs"],"sources":["../src/lib/render.ts","../src/lib/write.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises'\nimport { join, relative } from 'node:path'\n\nimport { attemptAsync, ok, toError } from '@maltty/utils/fp'\nimport type { ResultAsync } from '@maltty/utils/fp'\nimport { path } from '@maltty/utils/node'\nimport { Liquid } from 'liquidjs'\n\nimport type { GenerateError, RenderedFile, RenderTemplateParams } from './types.js'\n\n/**\n * Render all `.liquid` templates in a directory using LiquidJS.\n *\n * Recursively collects `.liquid` files under `templateDir`, renders each\n * with the provided variables, and strips the `.liquid` extension from\n * the output path. Files named `gitignore.liquid` are mapped to `.gitignore`.\n *\n * @param params - Template directory and variable bindings.\n * @returns An async Result containing rendered files or a GenerateError.\n */\nexport async function renderTemplate(\n params: RenderTemplateParams\n): ResultAsync<readonly RenderedFile[], GenerateError> {\n const engine = new Liquid({ root: params.templateDir })\n\n const entries = await collectLiquidFiles(params.templateDir)\n if (entries.length === 0) {\n return ok([])\n }\n\n const results = await Promise.all(\n entries.map(async (entry): Promise<RenderedFile | GenerateError> => {\n const absolutePath = join(params.templateDir, entry)\n const [renderError, content] = await renderSingleFile(engine, absolutePath, params.variables)\n if (renderError) {\n return renderError\n }\n const relativePath = mapOutputPath(entry)\n return { content, relativePath }\n })\n )\n\n const firstError = results.find(isGenerateError)\n if (firstError) {\n return [firstError as GenerateError, null]\n }\n\n return ok(results as readonly RenderedFile[])\n}\n\n// ---------------------------------------------------------------------------\n// Private helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Recursively collect all `.liquid` file paths relative to root.\n *\n * @param root - The directory to scan.\n * @returns Relative paths of all `.liquid` files.\n * @private\n */\nasync function collectLiquidFiles(root: string): Promise<readonly string[]> {\n const dirEntries = await readdir(root, { recursive: true, withFileTypes: true })\n return dirEntries\n .filter((entry) => entry.isFile() && entry.name.endsWith('.liquid'))\n .map((entry) => {\n const parent = entry.parentPath\n return path.toPosixPath(relative(root, join(parent, entry.name)))\n })\n}\n\n/**\n * Render a single `.liquid` file with the given variables.\n *\n * @param engine - The LiquidJS engine instance.\n * @param absolutePath - Absolute path to the `.liquid` file.\n * @param variables - Template variable bindings.\n * @returns A Result tuple with the rendered content or a GenerateError.\n * @private\n */\nasync function renderSingleFile(\n engine: Liquid,\n absolutePath: string,\n variables: Record<string, unknown>\n): ResultAsync<string, GenerateError> {\n const [renderError, content] = await attemptAsync(async () => {\n const template = await readFile(absolutePath, 'utf8')\n return engine.parseAndRender(template, variables)\n })\n\n if (renderError) {\n return [\n {\n message: `Failed to render template: ${toError(renderError).message}`,\n path: absolutePath,\n type: 'render_error' as const,\n },\n null,\n ]\n }\n\n return ok(content)\n}\n\n/**\n * Map a `.liquid` relative path to its output path.\n *\n * Strips the `.liquid` extension and renames bare `gitignore` segments\n * to `.gitignore` so dotfiles survive version control.\n *\n * @param liquidPath - Relative path ending in `.liquid`.\n * @returns The output-relative path without the `.liquid` suffix.\n * @private\n */\nfunction mapOutputPath(liquidPath: string): string {\n const stripped = liquidPath.replace(/\\.liquid$/, '')\n return stripped.replaceAll(/(^|\\/)gitignore($|\\/)/g, '$1.gitignore$2')\n}\n\n/**\n * Type guard for GenerateError objects.\n *\n * @param value - The value to check.\n * @returns True when value has a `type` and `message` property matching GenerateError.\n * @private\n */\nfunction isGenerateError(value: unknown): value is GenerateError {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n return 'type' in value && 'message' in value\n}\n","import { dirname, join } from 'node:path'\n\nimport { ok } from '@maltty/utils/fp'\nimport type { ResultAsync } from '@maltty/utils/fp'\nimport { fs } from '@maltty/utils/node'\n\nimport type { GenerateError, RenderedFile, WriteFilesParams, WriteResult } from './types.js'\n\n/**\n * Write rendered files to disk with optional conflict detection.\n *\n * For each file, resolves the target path under `outputDir`, creates parent\n * directories as needed, and writes the content. When `overwrite` is false,\n * existing files are skipped rather than overwritten.\n *\n * @param params - Files to write, target directory, and overwrite flag.\n * @returns An async Result with counts of written/skipped files or a GenerateError.\n */\nexport async function writeFiles(\n params: WriteFilesParams\n): ResultAsync<WriteResult, GenerateError> {\n const results = await Promise.all(\n params.files.map((file) => writeSingleFile(file, params.outputDir, params.overwrite))\n )\n\n const firstError = results.find((r): r is readonly [GenerateError, null] => r[0] !== null)\n if (firstError) {\n return [firstError[0], null]\n }\n\n const validStatuses = results.filter((r): r is readonly [null, FileWriteStatus] => r[1] !== null)\n\n const written = validStatuses\n .filter(([, status]) => status.action === 'written')\n .map(([, status]) => status.path)\n\n const skipped = validStatuses\n .filter(([, status]) => status.action === 'skipped')\n .map(([, status]) => status.path)\n\n return ok({ skipped, written })\n}\n\n/**\n * Status of a single file write operation.\n *\n * Tracks the path and whether the file was written or skipped.\n */\ninterface FileWriteStatus {\n readonly path: string\n readonly action: 'written' | 'skipped'\n}\n\n/**\n * Write a single rendered file to disk.\n *\n * @param file - The rendered file to write.\n * @param outputDir - The root output directory.\n * @param overwrite - Whether to overwrite existing files.\n * @returns A Result tuple with the write status or a GenerateError.\n * @private\n */\nasync function writeSingleFile(\n file: RenderedFile,\n outputDir: string,\n overwrite: boolean\n): ResultAsync<FileWriteStatus, GenerateError> {\n const targetPath = join(outputDir, file.relativePath)\n\n const pathExists = await fs.exists(targetPath)\n if (pathExists && !overwrite) {\n return ok({ action: 'skipped' as const, path: file.relativePath })\n }\n\n const [mkdirError] = await fs.mkdir(dirname(targetPath))\n if (mkdirError) {\n return [\n {\n message: `Failed to write file: ${mkdirError.message}`,\n path: targetPath,\n type: 'write_error' as const,\n },\n null,\n ]\n }\n\n const [writeError] = await fs.write(targetPath, file.content)\n if (writeError) {\n return [\n {\n message: `Failed to write file: ${writeError.message}`,\n path: targetPath,\n type: 'write_error' as const,\n },\n null,\n ]\n }\n\n return ok({ action: 'written' as const, path: file.relativePath })\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,eAAsB,eACpB,QACqD;CACrD,MAAM,SAAS,IAAI,OAAO,EAAE,MAAM,OAAO,aAAa,CAAC;CAEvD,MAAM,UAAU,MAAM,mBAAmB,OAAO,YAAY;AAC5D,KAAI,QAAQ,WAAW,EACrB,QAAO,GAAG,EAAE,CAAC;CAGf,MAAM,UAAU,MAAM,QAAQ,IAC5B,QAAQ,IAAI,OAAO,UAAiD;EAElE,MAAM,CAAC,aAAa,WAAW,MAAM,iBAAiB,QADjC,KAAK,OAAO,aAAa,MAAM,EACwB,OAAO,UAAU;AAC7F,MAAI,YACF,QAAO;AAGT,SAAO;GAAE;GAAS,cADG,cAAc,MAAM;GACT;GAChC,CACH;CAED,MAAM,aAAa,QAAQ,KAAK,gBAAgB;AAChD,KAAI,WACF,QAAO,CAAC,YAA6B,KAAK;AAG5C,QAAO,GAAG,QAAmC;;;;;;;;;AAc/C,eAAe,mBAAmB,MAA0C;AAE1E,SADmB,MAAM,QAAQ,MAAM;EAAE,WAAW;EAAM,eAAe;EAAM,CAAC,EAE7E,QAAQ,UAAU,MAAM,QAAQ,IAAI,MAAM,KAAK,SAAS,UAAU,CAAC,CAC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