@kubb/core 4.5.1 → 4.5.3

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 (66) hide show
  1. package/dist/EventEmitter-3-rxpjGN.cjs +32 -0
  2. package/dist/EventEmitter-3-rxpjGN.cjs.map +1 -0
  3. package/dist/EventEmitter-IlDflnd2.js +25 -0
  4. package/dist/EventEmitter-IlDflnd2.js.map +1 -0
  5. package/dist/getBarrelFiles-B9LswRVo.d.cts +37 -0
  6. package/dist/getBarrelFiles-CB-XIF32.d.ts +37 -0
  7. package/dist/getBarrelFiles-D7p4n7Ug.js +962 -0
  8. package/dist/getBarrelFiles-D7p4n7Ug.js.map +1 -0
  9. package/dist/getBarrelFiles-o9ETjpTV.cjs +1017 -0
  10. package/dist/getBarrelFiles-o9ETjpTV.cjs.map +1 -0
  11. package/dist/hooks.d.cts +1 -2
  12. package/dist/hooks.d.ts +2 -3
  13. package/dist/index.cjs +83 -953
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +45 -62
  16. package/dist/index.d.ts +46 -63
  17. package/dist/index.js +51 -921
  18. package/dist/index.js.map +1 -1
  19. package/dist/{logger-Bxe022ug.js → logger-BGuor9Uu.js} +5 -26
  20. package/dist/logger-BGuor9Uu.js.map +1 -0
  21. package/dist/{logger-BIzTtBYJ.cjs → logger-CLbtdL9m.cjs} +4 -32
  22. package/dist/logger-CLbtdL9m.cjs.map +1 -0
  23. package/dist/{logger-BwhJWK-H.d.ts → logger-weazBKCW.d.ts} +1 -1
  24. package/dist/logger.cjs +2 -1
  25. package/dist/logger.d.ts +1 -1
  26. package/dist/logger.js +2 -1
  27. package/dist/{prompt-D5DZPtWc.cjs → prompt-39QFDCh6.cjs} +1 -1
  28. package/dist/{prompt-D5DZPtWc.cjs.map → prompt-39QFDCh6.cjs.map} +1 -1
  29. package/dist/{prompt-xM0onfy8.js → prompt-CIYhgpSM.js} +1 -1
  30. package/dist/{prompt-xM0onfy8.js.map → prompt-CIYhgpSM.js.map} +1 -1
  31. package/dist/{transformers-CeNW0G32.js → transformers-BaV4FwQd.js} +1 -1
  32. package/dist/{transformers-CeNW0G32.js.map → transformers-BaV4FwQd.js.map} +1 -1
  33. package/dist/{transformers-DWLXDYKb.cjs → transformers-BpnIvSiH.cjs} +1 -1
  34. package/dist/{transformers-DWLXDYKb.cjs.map → transformers-BpnIvSiH.cjs.map} +1 -1
  35. package/dist/transformers.cjs +1 -1
  36. package/dist/transformers.js +1 -1
  37. package/dist/{types-CyDeSlGF.d.ts → types-CqYAL0CK.d.ts} +29 -38
  38. package/dist/{types-CVONMhN_.d.cts → types-DqHtLxpp.d.cts} +28 -37
  39. package/dist/utils.cjs +7 -5
  40. package/dist/utils.cjs.map +1 -1
  41. package/dist/utils.d.cts +4 -2
  42. package/dist/utils.d.ts +4 -2
  43. package/dist/utils.js +4 -3
  44. package/dist/utils.js.map +1 -1
  45. package/package.json +4 -4
  46. package/src/BarrelManager.ts +1 -1
  47. package/src/PluginManager.ts +74 -76
  48. package/src/build.ts +24 -13
  49. package/src/config.ts +35 -29
  50. package/src/definePlugin.ts +12 -0
  51. package/src/index.ts +5 -5
  52. package/src/types.ts +19 -40
  53. package/src/utils/AsyncEventEmitter.ts +45 -0
  54. package/src/utils/TreeNode.ts +1 -1
  55. package/src/utils/__snapshots__/barrel.json +147 -0
  56. package/src/{FileManager.ts → utils/getBarrelFiles.ts} +4 -11
  57. package/src/utils/index.ts +1 -0
  58. package/dist/URLPath-DbWtfVa1.js +0 -116
  59. package/dist/URLPath-DbWtfVa1.js.map +0 -1
  60. package/dist/URLPath-Dir2mxRT.cjs +0 -133
  61. package/dist/URLPath-Dir2mxRT.cjs.map +0 -1
  62. package/dist/logger-BIzTtBYJ.cjs.map +0 -1
  63. package/dist/logger-Bxe022ug.js.map +0 -1
  64. package/dist/types-DCR_QgGt.d.ts +0 -5
  65. package/dist/types-DueAg3XP.d.cts +0 -5
  66. package/src/plugin.ts +0 -80
@@ -1 +1 @@
1
- {"version":3,"file":"transformers-DWLXDYKb.cjs","names":["preserveConsecutiveUppercase","camelCase","_camelcase","value"],"sources":["../src/transformers/transformReservedWord.ts","../src/transformers/trim.ts","../../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js","../src/transformers/casing.ts","../src/transformers/combineCodes.ts","../src/transformers/createJSDocBlockText.ts","../src/transformers/escape.ts","../src/transformers/indent.ts","../src/transformers/nameSorter.ts","../src/transformers/searchAndReplace.ts","../src/transformers/stringify.ts","../src/transformers/toRegExp.ts","../src/transformers/index.ts"],"sourcesContent":["/**\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = [\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n\n 'Array',\n 'Date',\n 'eval',\n 'function',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n]\n\nexport function transformReservedWord(word: string): string {\n if ((word && reservedWords.includes(word)) || word?.match(/^\\d/)) {\n return `_${word}`\n }\n\n return word\n}\n\nexport function isValidVarName(name: string) {\n try {\n Function(`var ${name}`)\n } catch (_e) {\n return false\n }\n return true\n}\n","export function trim(text: string): string {\n return text.replaceAll(/\\n/g, '').trim()\n}\n\nexport function trimQuotes(text: string): string {\n if (text.match(/^\"(.*)\"$/)) {\n return text.replace(/^\"(.*)\"$/, '$1')\n }\n if (text.match(/^'(.*)'$/)) {\n return text.replace(/^'(.*)'$/, '$1')\n }\n\n if (text.match(/^`(.*)`$/)) {\n return text.replace(/^`(.*)`$/, '$1')\n }\n\n return text\n}\n","const UPPERCASE = /[\\p{Lu}]/u;\nconst LOWERCASE = /[\\p{Ll}]/u;\nconst LEADING_CAPITAL = /^[\\p{Lu}](?![\\p{Lu}])/gu;\nconst IDENTIFIER = /([\\p{Alpha}\\p{N}_]|$)/u;\nconst SEPARATORS = /[_.\\- ]+/;\n\nconst LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);\nconst SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');\nconst NUMBERS_AND_IDENTIFIER = new RegExp('\\\\d+' + IDENTIFIER.source, 'gu');\n\nconst preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {\n\tlet isLastCharLower = false;\n\tlet isLastCharUpper = false;\n\tlet isLastLastCharUpper = false;\n\tlet isLastLastCharPreserved = false;\n\n\tfor (let index = 0; index < string.length; index++) {\n\t\tconst character = string[index];\n\t\tisLastLastCharPreserved = index > 2 ? string[index - 3] === '-' : true;\n\n\t\tif (isLastCharLower && UPPERCASE.test(character)) {\n\t\t\tstring = string.slice(0, index) + '-' + string.slice(index);\n\t\t\tisLastCharLower = false;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = true;\n\t\t\tindex++;\n\t\t} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {\n\t\t\tstring = string.slice(0, index - 1) + '-' + string.slice(index - 1);\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = false;\n\t\t\tisLastCharLower = true;\n\t\t} else {\n\t\t\tisLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;\n\t\t}\n\t}\n\n\treturn string;\n};\n\nconst preserveConsecutiveUppercase = (input, toLowerCase) => {\n\tLEADING_CAPITAL.lastIndex = 0;\n\n\treturn input.replaceAll(LEADING_CAPITAL, match => toLowerCase(match));\n};\n\nconst postProcess = (input, toUpperCase) => {\n\tSEPARATORS_AND_IDENTIFIER.lastIndex = 0;\n\tNUMBERS_AND_IDENTIFIER.lastIndex = 0;\n\n\treturn input\n\t\t.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ['_', '-'].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match))\n\t\t.replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));\n};\n\nexport default function camelCase(input, options) {\n\tif (!(typeof input === 'string' || Array.isArray(input))) {\n\t\tthrow new TypeError('Expected the input to be `string | string[]`');\n\t}\n\n\toptions = {\n\t\tpascalCase: false,\n\t\tpreserveConsecutiveUppercase: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(input)) {\n\t\tinput = input.map(x => x.trim())\n\t\t\t.filter(x => x.length)\n\t\t\t.join('-');\n\t} else {\n\t\tinput = input.trim();\n\t}\n\n\tif (input.length === 0) {\n\t\treturn '';\n\t}\n\n\tconst toLowerCase = options.locale === false\n\t\t? string => string.toLowerCase()\n\t\t: string => string.toLocaleLowerCase(options.locale);\n\n\tconst toUpperCase = options.locale === false\n\t\t? string => string.toUpperCase()\n\t\t: string => string.toLocaleUpperCase(options.locale);\n\n\tif (input.length === 1) {\n\t\tif (SEPARATORS.test(input)) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn options.pascalCase ? toUpperCase(input) : toLowerCase(input);\n\t}\n\n\tconst hasUpperCase = input !== toLowerCase(input);\n\n\tif (hasUpperCase) {\n\t\tinput = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);\n\t}\n\n\tinput = input.replace(LEADING_SEPARATORS, '');\n\tinput = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);\n\n\tif (options.pascalCase) {\n\t\tinput = toUpperCase(input.charAt(0)) + input.slice(1);\n\t}\n\n\treturn postProcess(input, toUpperCase);\n}\n","import _camelcase from 'camelcase'\n\ntype Options = {\n /**\n * When set it will replace all `.` with `/`.\n */\n isFile?: boolean\n prefix?: string\n suffix?: string\n}\n\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n const splitArray = text.split('.')\n return splitArray.map((item, i) => (i === splitArray.length - 1 ? camelCase(item, { prefix, suffix }) : camelCase(item))).join('/')\n }\n\n return _camelcase(`${prefix} ${text} ${suffix}`, { pascalCase: false, preserveConsecutiveUppercase: true }).replace(/[^a-zA-Z0-9]/g, '')\n}\n\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n const splitArray = text.split('.')\n return splitArray.map((item, i) => (i === splitArray.length - 1 ? pascalCase(item, { prefix, suffix }) : camelCase(item))).join('/')\n }\n\n return _camelcase(`${prefix} ${text} ${suffix}`, { pascalCase: true, preserveConsecutiveUppercase: true }).replace(/[^a-zA-Z0-9]/g, '')\n}\n","export function combineCodes(codes: string[]): string {\n return codes.join('\\n')\n}\n","export function createJSDocBlockText({ comments }: { comments: Array<string> }): string {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return ''\n }\n\n return `/**\\n * ${filteredComments.join('\\n * ')}\\n */`\n}\n","export function escape(text?: string): string {\n return text ? text.replaceAll('`', '\\\\`') : ''\n}\n\n/**\n * Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on\n * @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n * @link https://github.com/joliss/js-string-escape/blob/master/index.js\n */\n\nexport function jsStringEscape(input: any): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n // Four possible LineTerminator characters need to be escaped:\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n","export function createIndent(size: number): string {\n return Array.from({ length: size + 1 }).join(' ')\n}\n","export function nameSorter<T extends { name: string }>(a: T, b: T): 0 | 1 | -1 {\n if (a.name < b.name) {\n return -1\n }\n if (a.name > b.name) {\n return 1\n }\n return 0\n}\n","type Options = {\n text: string\n replaceBy: string\n prefix?: string\n key: string\n searchValues?: (prefix: string, key: string) => Array<RegExp | string>\n}\n\nexport function searchAndReplace(options: Options): string {\n const { text, replaceBy, prefix = '', key } = options\n\n const searchValues = options.searchValues?.(prefix, key) || [\n `${prefix}[\"${key}\"]`,\n `${prefix}['${key}']`,\n `${prefix}[\\`${key}\\`]`,\n `${prefix}\"${key}\"`,\n `${prefix}'${key}'`,\n `${prefix}\\`${key}\\``,\n new RegExp(`${prefix}${key}`, 'g'),\n ]\n\n return searchValues.reduce((prev, searchValue) => {\n return prev.toString().replaceAll(searchValue, replaceBy)\n }, text) as string\n}\n","import { trimQuotes } from './trim'\n\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) {\n return '\"\"'\n }\n\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\nexport function stringifyObject(value: object): string {\n const items = Object.entries(value)\n .map(([key, value]) => {\n if (typeof value === 'object') {\n return `${key}: {\n ${stringifyObject(value)}\n }`\n }\n\n return `${key}: ${value}`\n })\n .filter(Boolean)\n\n return items.join(',\\n')\n}\n","import { trimQuotes } from './trim'\n\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const [, replacementTarget = '', matchedFlags] = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i) ?? []\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const regex = new RegExp(cleaned, matchedFlags)\n const source = regex.source\n const flags = regex.flags\n\n if (func === null) {\n return `/${source}/${flags}`\n }\n\n // return as constructor → new RegExp(\"pattern\", \"flags\")\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { orderBy } from 'natural-orderby'\nimport { merge } from 'remeda'\n\nimport { camelCase, pascalCase } from './casing.ts'\nimport { combineCodes } from './combineCodes.ts'\nimport { createJSDocBlockText } from './createJSDocBlockText.ts'\nimport { escape, jsStringEscape } from './escape.ts'\nimport { createIndent } from './indent.ts'\nimport { nameSorter } from './nameSorter.ts'\nimport { searchAndReplace } from './searchAndReplace.ts'\nimport { stringify, stringifyObject } from './stringify.ts'\nimport { toRegExpString } from './toRegExp.ts'\nimport { isValidVarName, transformReservedWord } from './transformReservedWord.ts'\nimport { trim, trimQuotes } from './trim.ts'\n\nexport { orderBy } from 'natural-orderby'\nexport { merge } from 'remeda'\nexport { camelCase, pascalCase } from './casing.ts'\nexport { combineCodes } from './combineCodes.ts'\nexport { createJSDocBlockText } from './createJSDocBlockText.ts'\nexport { escape, jsStringEscape } from './escape.ts'\nexport { createIndent } from './indent.ts'\nexport { nameSorter } from './nameSorter.ts'\nexport { searchAndReplace } from './searchAndReplace.ts'\nexport { stringify, stringifyObject } from './stringify.ts'\nexport { toRegExpString } from './toRegExp.ts'\nexport { isValidVarName, transformReservedWord } from './transformReservedWord.ts'\nexport { trim, trimQuotes } from './trim.ts'\n\nexport default {\n combineCodes,\n escape,\n jsStringEscape,\n createIndent,\n transformReservedWord,\n isValidVarName,\n nameSorter,\n searchAndReplace,\n stringify,\n stringifyObject,\n toRegExpString,\n trim,\n trimQuotes,\n JSDoc: {\n createJSDocBlockText,\n },\n orderBy,\n merge,\n camelCase,\n pascalCase,\n} as const\n"],"x_google_ignoreList":[2],"mappings":";;;;;;;;;;AAGA,MAAM,gBAAgB;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;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,sBAAsB,MAAsB;AAC1D,KAAK,QAAQ,cAAc,SAAS,KAAK,IAAK,MAAM,MAAM,MAAM,CAC9D,QAAO,IAAI;AAGb,QAAO;;AAGT,SAAgB,eAAe,MAAc;AAC3C,KAAI;AACF,WAAS,OAAO,OAAO;UAChB,IAAI;AACX,SAAO;;AAET,QAAO;;;;;ACxGT,SAAgB,KAAK,MAAsB;AACzC,QAAO,KAAK,WAAW,OAAO,GAAG,CAAC,MAAM;;AAG1C,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,MAAM,WAAW,CACxB,QAAO,KAAK,QAAQ,YAAY,KAAK;AAEvC,KAAI,KAAK,MAAM,WAAW,CACxB,QAAO,KAAK,QAAQ,YAAY,KAAK;AAGvC,KAAI,KAAK,MAAM,WAAW,CACxB,QAAO,KAAK,QAAQ,YAAY,KAAK;AAGvC,QAAO;;;;;AChBT,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,qCAAqB,IAAI,OAAO,MAAM,W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UAAU,GAAG,CACrB,QAAQ,UAAU,GAAG,CACrB,QAAQ,mBAAmB,GAAG;CAEjC,MAAM,QAAQ,IAAI,OAAO,SAAS,aAAa;CAC/C,MAAM,SAAS,MAAM;CACrB,MAAM,QAAQ,MAAM;AAEpB,KAAI,SAAS,KACX,QAAO,IAAI,OAAO,GAAG;AAIvB,QAAO,OAAO,KAAK,GAAG,KAAK,UAAU,OAAO,GAAG,QAAQ,KAAK,KAAK,UAAU,MAAM,KAAK,GAAG;;;;;ACS3F,2BAAe;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAO,EACL,sBACD;CACD;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"transformers-BpnIvSiH.cjs","names":["preserveConsecutiveUppercase","camelCase","_camelcase","value"],"sources":["../src/transformers/transformReservedWord.ts","../src/transformers/trim.ts","../../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js","../src/transformers/casing.ts","../src/transformers/combineCodes.ts","../src/transformers/createJSDocBlockText.ts","../src/transformers/escape.ts","../src/transformers/indent.ts","../src/transformers/nameSorter.ts","../src/transformers/searchAndReplace.ts","../src/transformers/stringify.ts","../src/transformers/toRegExp.ts","../src/transformers/index.ts"],"sourcesContent":["/**\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = [\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n\n 'Array',\n 'Date',\n 'eval',\n 'function',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n]\n\nexport function transformReservedWord(word: string): string {\n if ((word && reservedWords.includes(word)) || word?.match(/^\\d/)) {\n return `_${word}`\n }\n\n return word\n}\n\nexport function isValidVarName(name: string) {\n try {\n Function(`var ${name}`)\n } catch (_e) {\n return false\n }\n return true\n}\n","export function trim(text: string): string {\n return text.replaceAll(/\\n/g, '').trim()\n}\n\nexport function trimQuotes(text: string): string {\n if (text.match(/^\"(.*)\"$/)) {\n return text.replace(/^\"(.*)\"$/, '$1')\n }\n if (text.match(/^'(.*)'$/)) {\n return text.replace(/^'(.*)'$/, '$1')\n }\n\n if (text.match(/^`(.*)`$/)) {\n return text.replace(/^`(.*)`$/, '$1')\n }\n\n return text\n}\n","const UPPERCASE = /[\\p{Lu}]/u;\nconst LOWERCASE = /[\\p{Ll}]/u;\nconst LEADING_CAPITAL = /^[\\p{Lu}](?![\\p{Lu}])/gu;\nconst IDENTIFIER = /([\\p{Alpha}\\p{N}_]|$)/u;\nconst SEPARATORS = /[_.\\- ]+/;\n\nconst LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);\nconst SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');\nconst NUMBERS_AND_IDENTIFIER = new RegExp('\\\\d+' + IDENTIFIER.source, 'gu');\n\nconst preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {\n\tlet isLastCharLower = false;\n\tlet isLastCharUpper = false;\n\tlet isLastLastCharUpper = false;\n\tlet isLastLastCharPreserved = false;\n\n\tfor (let index = 0; index < string.length; index++) {\n\t\tconst character = string[index];\n\t\tisLastLastCharPreserved = index > 2 ? string[index - 3] === '-' : true;\n\n\t\tif (isLastCharLower && UPPERCASE.test(character)) {\n\t\t\tstring = string.slice(0, index) + '-' + string.slice(index);\n\t\t\tisLastCharLower = false;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = true;\n\t\t\tindex++;\n\t\t} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {\n\t\t\tstring = string.slice(0, index - 1) + '-' + string.slice(index - 1);\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = false;\n\t\t\tisLastCharLower = true;\n\t\t} else {\n\t\t\tisLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;\n\t\t}\n\t}\n\n\treturn string;\n};\n\nconst preserveConsecutiveUppercase = (input, toLowerCase) => {\n\tLEADING_CAPITAL.lastIndex = 0;\n\n\treturn input.replaceAll(LEADING_CAPITAL, match => toLowerCase(match));\n};\n\nconst postProcess = (input, toUpperCase) => {\n\tSEPARATORS_AND_IDENTIFIER.lastIndex = 0;\n\tNUMBERS_AND_IDENTIFIER.lastIndex = 0;\n\n\treturn input\n\t\t.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ['_', '-'].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match))\n\t\t.replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));\n};\n\nexport default function camelCase(input, options) {\n\tif (!(typeof input === 'string' || Array.isArray(input))) {\n\t\tthrow new TypeError('Expected the input to be `string | string[]`');\n\t}\n\n\toptions = {\n\t\tpascalCase: false,\n\t\tpreserveConsecutiveUppercase: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(input)) {\n\t\tinput = input.map(x => x.trim())\n\t\t\t.filter(x => x.length)\n\t\t\t.join('-');\n\t} else {\n\t\tinput = input.trim();\n\t}\n\n\tif (input.length === 0) {\n\t\treturn '';\n\t}\n\n\tconst toLowerCase = options.locale === false\n\t\t? string => string.toLowerCase()\n\t\t: string => string.toLocaleLowerCase(options.locale);\n\n\tconst toUpperCase = options.locale === false\n\t\t? string => string.toUpperCase()\n\t\t: string => string.toLocaleUpperCase(options.locale);\n\n\tif (input.length === 1) {\n\t\tif (SEPARATORS.test(input)) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn options.pascalCase ? toUpperCase(input) : toLowerCase(input);\n\t}\n\n\tconst hasUpperCase = input !== toLowerCase(input);\n\n\tif (hasUpperCase) {\n\t\tinput = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);\n\t}\n\n\tinput = input.replace(LEADING_SEPARATORS, '');\n\tinput = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);\n\n\tif (options.pascalCase) {\n\t\tinput = toUpperCase(input.charAt(0)) + input.slice(1);\n\t}\n\n\treturn postProcess(input, toUpperCase);\n}\n","import _camelcase from 'camelcase'\n\ntype Options = {\n /**\n * When set it will replace all `.` with `/`.\n */\n isFile?: boolean\n prefix?: string\n suffix?: string\n}\n\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n const splitArray = text.split('.')\n return splitArray.map((item, i) => (i === splitArray.length - 1 ? camelCase(item, { prefix, suffix }) : camelCase(item))).join('/')\n }\n\n return _camelcase(`${prefix} ${text} ${suffix}`, { pascalCase: false, preserveConsecutiveUppercase: true }).replace(/[^a-zA-Z0-9]/g, '')\n}\n\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n const splitArray = text.split('.')\n return splitArray.map((item, i) => (i === splitArray.length - 1 ? pascalCase(item, { prefix, suffix }) : camelCase(item))).join('/')\n }\n\n return _camelcase(`${prefix} ${text} ${suffix}`, { pascalCase: true, preserveConsecutiveUppercase: true }).replace(/[^a-zA-Z0-9]/g, '')\n}\n","export function combineCodes(codes: string[]): string {\n return codes.join('\\n')\n}\n","export function createJSDocBlockText({ comments }: { comments: Array<string> }): string {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return ''\n }\n\n return `/**\\n * ${filteredComments.join('\\n * ')}\\n */`\n}\n","export function escape(text?: string): string {\n return text ? text.replaceAll('`', '\\\\`') : ''\n}\n\n/**\n * Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on\n * @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n * @link https://github.com/joliss/js-string-escape/blob/master/index.js\n */\n\nexport function jsStringEscape(input: any): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n // Four possible LineTerminator characters need to be escaped:\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n","export function createIndent(size: number): string {\n return Array.from({ length: size + 1 }).join(' ')\n}\n","export function nameSorter<T extends { name: string }>(a: T, b: T): 0 | 1 | -1 {\n if (a.name < b.name) {\n return -1\n }\n if (a.name > b.name) {\n return 1\n }\n return 0\n}\n","type Options = {\n text: string\n replaceBy: string\n prefix?: string\n key: string\n searchValues?: (prefix: string, key: string) => Array<RegExp | string>\n}\n\nexport function searchAndReplace(options: Options): string {\n const { text, replaceBy, prefix = '', key } = options\n\n const searchValues = options.searchValues?.(prefix, key) || [\n `${prefix}[\"${key}\"]`,\n `${prefix}['${key}']`,\n `${prefix}[\\`${key}\\`]`,\n `${prefix}\"${key}\"`,\n `${prefix}'${key}'`,\n `${prefix}\\`${key}\\``,\n new RegExp(`${prefix}${key}`, 'g'),\n ]\n\n return searchValues.reduce((prev, searchValue) => {\n return prev.toString().replaceAll(searchValue, replaceBy)\n }, text) as string\n}\n","import { trimQuotes } from './trim'\n\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) {\n return '\"\"'\n }\n\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\nexport function stringifyObject(value: object): string {\n const items = Object.entries(value)\n .map(([key, value]) => {\n if (typeof value === 'object') {\n return `${key}: {\n ${stringifyObject(value)}\n }`\n }\n\n return `${key}: ${value}`\n })\n .filter(Boolean)\n\n return items.join(',\\n')\n}\n","import { trimQuotes } from './trim'\n\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const [, replacementTarget = '', matchedFlags] = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i) ?? []\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const regex = new RegExp(cleaned, matchedFlags)\n const source = regex.source\n const flags = regex.flags\n\n if (func === null) {\n return `/${source}/${flags}`\n }\n\n // return as constructor → new RegExp(\"pattern\", \"flags\")\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { orderBy } from 'natural-orderby'\nimport { merge } from 'remeda'\n\nimport { camelCase, pascalCase } from './casing.ts'\nimport { combineCodes } from './combineCodes.ts'\nimport { createJSDocBlockText } from './createJSDocBlockText.ts'\nimport { escape, jsStringEscape } from './escape.ts'\nimport { createIndent } from './indent.ts'\nimport { nameSorter } from './nameSorter.ts'\nimport { searchAndReplace } from './searchAndReplace.ts'\nimport { stringify, stringifyObject } from './stringify.ts'\nimport { toRegExpString } from './toRegExp.ts'\nimport { isValidVarName, transformReservedWord } from './transformReservedWord.ts'\nimport { trim, trimQuotes } from './trim.ts'\n\nexport { orderBy } from 'natural-orderby'\nexport { merge } from 'remeda'\nexport { camelCase, pascalCase } from './casing.ts'\nexport { combineCodes } from './combineCodes.ts'\nexport { createJSDocBlockText } from './createJSDocBlockText.ts'\nexport { escape, jsStringEscape } from './escape.ts'\nexport { createIndent } from './indent.ts'\nexport { nameSorter } from './nameSorter.ts'\nexport { searchAndReplace } from './searchAndReplace.ts'\nexport { stringify, stringifyObject } from './stringify.ts'\nexport { toRegExpString } from './toRegExp.ts'\nexport { isValidVarName, transformReservedWord } from './transformReservedWord.ts'\nexport { trim, trimQuotes } from './trim.ts'\n\nexport default {\n combineCodes,\n escape,\n jsStringEscape,\n createIndent,\n transformReservedWord,\n isValidVarName,\n nameSorter,\n searchAndReplace,\n stringify,\n stringifyObject,\n toRegExpString,\n trim,\n trimQuotes,\n JSDoc: {\n createJSDocBlockText,\n },\n orderBy,\n merge,\n camelCase,\n pascalCase,\n} as const\n"],"x_google_ignoreList":[2],"mappings":";;;;;;;;;;AAGA,MAAM,gBAAgB;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;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,sBAAsB,MAAsB;AAC1D,KAAK,QAAQ,cAAc,SAAS,KAAK,IAAK,MAAM,MAAM,MAAM,CAC9D,QAAO,IAAI;AAGb,QAAO;;AAGT,SAAgB,eAAe,MAAc;AAC3C,KAAI;AACF,WAAS,OAAO,OAAO;UAChB,IAAI;AACX,SAAO;;AAET,QAAO;;;;;ACxGT,SAAgB,KAAK,MAAsB;AACzC,Q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AGrD,SAAgB,gBAAgB,OAAuB;AAarD,QAZc,OAAO,QAAQ,MAAM,CAChC,KAAK,CAAC,KAAKC,aAAW;AACrB,MAAI,OAAOA,YAAU,SACnB,QAAO,GAAG,IAAI;UACZ,gBAAgBA,QAAM,CAAC;;AAI3B,SAAO,GAAG,IAAI,IAAIA;GAClB,CACD,OAAO,QAAQ,CAEL,KAAK,MAAM;;;;;ACrB1B,SAAgB,eAAe,MAAc,OAAsB,UAAkB;CACnF,MAAM,MAAM,WAAW,KAAK;CAE5B,MAAM,GAAG,oBAAoB,IAAI,gBAAgB,IAAI,MAAM,0BAA0B,IAAI,EAAE;CAC3F,MAAM,UAAU,IACb,QAAQ,UAAU,GAAG,CACrB,QAAQ,UAAU,GAAG,CACrB,QAAQ,mBAAmB,GAAG;CAEjC,MAAM,QAAQ,IAAI,OAAO,SAAS,aAAa;CAC/C,MAAM,SAAS,MAAM;CACrB,MAAM,QAAQ,MAAM;AAEpB,KAAI,SAAS,KACX,QAAO,IAAI,OAAO,GAAG;AAIvB,QAAO,OAAO,KAAK,GAAG,KAAK,UAAU,OAAO,GAAG,QAAQ,KAAK,KAAK,UAAU,MAAM,KAAK,GAAG;;;;;ACS3F,2BAAe;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAO,EACL,sBACD;CACD;CACA;CACA;CACA;CACD"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_chunk = require('./chunk-CUT6urMc.cjs');
3
- const require_transformers = require('./transformers-DWLXDYKb.cjs');
3
+ const require_transformers = require('./transformers-BpnIvSiH.cjs');
4
4
  let natural_orderby = require("natural-orderby");
5
5
  natural_orderby = require_chunk.__toESM(natural_orderby);
6
6
  let remeda = require("remeda");
@@ -1,3 +1,3 @@
1
- import { _ as trimQuotes, a as stringify, c as nameSorter, d as jsStringEscape, f as createJSDocBlockText, g as trim, h as pascalCase, i as toRegExpString, l as createIndent, m as camelCase, n as orderBy, o as stringifyObject, p as combineCodes, r as transformers_default, s as searchAndReplace, t as merge, u as escape, v as isValidVarName, y as transformReservedWord } from "./transformers-CeNW0G32.js";
1
+ import { _ as trimQuotes, a as stringify, c as nameSorter, d as jsStringEscape, f as createJSDocBlockText, g as trim, h as pascalCase, i as toRegExpString, l as createIndent, m as camelCase, n as orderBy, o as stringifyObject, p as combineCodes, r as transformers_default, s as searchAndReplace, t as merge, u as escape, v as isValidVarName, y as transformReservedWord } from "./transformers-BaV4FwQd.js";
2
2
 
3
3
  export { camelCase, combineCodes, createIndent, createJSDocBlockText, transformers_default as default, escape, isValidVarName, jsStringEscape, merge, nameSorter, orderBy, pascalCase, searchAndReplace, stringify, stringifyObject, toRegExpString, transformReservedWord, trim, trimQuotes };
@@ -1,6 +1,5 @@
1
- import { n as Logger, o as EventEmitter } from "./logger-BwhJWK-H.js";
2
- import { t as PossiblePromise } from "./types-DCR_QgGt.js";
3
- import { Fabric, FileManager } from "@kubb/react-fabric";
1
+ import { n as Logger, o as EventEmitter } from "./logger-weazBKCW.js";
2
+ import { Fabric } from "@kubb/react-fabric";
4
3
  import { KubbFile } from "@kubb/fabric-core/types";
5
4
 
6
5
  //#region src/PluginManager.d.ts
@@ -39,15 +38,17 @@ type GetFileProps<TOptions = object> = {
39
38
  pluginKey: Plugin['key'];
40
39
  options?: TOptions;
41
40
  };
41
+ declare function getMode(fileOrFolder: string | undefined | null): KubbFile.Mode;
42
42
  declare class PluginManager {
43
43
  #private;
44
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
45
44
  readonly events: EventEmitter<Events>;
46
45
  readonly config: Config;
47
46
  readonly executed: Array<Executer>;
48
47
  readonly logger: Logger;
49
48
  readonly options: Options;
50
49
  constructor(config: Config, options: Options);
50
+ getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
51
+ get plugins(): Array<Plugin>;
51
52
  getFile<TOptions = object>({
52
53
  name,
53
54
  mode,
@@ -57,7 +58,7 @@ declare class PluginManager {
57
58
  }: GetFileProps<TOptions>): KubbFile.File<{
58
59
  pluginKey: Plugin['key'];
59
60
  }>;
60
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
61
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
61
62
  resolveName: (params: ResolveNameParams) => string;
62
63
  /**
63
64
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -145,11 +146,17 @@ declare class PluginManager {
145
146
  }): Promise<void>;
146
147
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
147
148
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
148
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
149
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
150
149
  }
151
150
  //#endregion
151
+ //#region src/utils/types.d.ts
152
+ type PossiblePromise<T> = Promise<T> | T;
153
+ //#endregion
152
154
  //#region src/types.d.ts
155
+ declare global {
156
+ namespace Kubb {
157
+ interface PluginContext {}
158
+ }
159
+ }
153
160
  /**
154
161
  * Config used in `kubb.config.ts`
155
162
  *
@@ -325,11 +332,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
325
332
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
326
333
  */
327
334
  post?: Array<string>;
328
- } & (TOptions['context'] extends never ? {
329
- context?: never;
330
- } : {
331
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
332
- });
335
+ inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
336
+ };
333
337
  type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
334
338
  type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>;
335
339
  type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
@@ -356,25 +360,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
356
360
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
357
361
  */
358
362
  options: TOptions['resolvedOptions'];
359
- } & (TOptions['context'] extends never ? {
360
- context?: never;
361
- } : {
362
- context: TOptions['context'];
363
- });
363
+ install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
364
+ /**
365
+ * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
366
+ */
367
+ inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
368
+ };
364
369
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
365
370
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
366
371
  /**
367
372
  * Start of the lifecycle of a plugin.
368
373
  * @type hookParallel
369
374
  */
370
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
375
+ install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
371
376
  /**
372
377
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
373
378
  * Options can als be included.
374
379
  * @type hookFirst
375
380
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
376
381
  */
377
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
382
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
378
383
  /**
379
384
  * Resolve to a name based on a string.
380
385
  * Useful when converting to PascalCase or camelCase.
@@ -382,11 +387,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
382
387
  * @example ('pet') => 'Pet'
383
388
  */
384
389
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
385
- /**
386
- * End of the plugin lifecycle.
387
- * @type hookParallel
388
- */
389
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
390
390
  };
391
391
  type PluginLifecycleHooks = keyof PluginLifecycle;
392
392
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -413,24 +413,15 @@ type ResolveNameParams = {
413
413
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
414
414
  fabric: Fabric;
415
415
  config: Config;
416
- /**
417
- * @deprecated
418
- */
419
- fileManager: FileManager;
420
416
  pluginManager: PluginManager;
421
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
422
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
423
- resolveName: (params: ResolveNameParams) => string;
417
+ addFile: (...file: Array<KubbFile.File>) => Promise<void>;
424
418
  logger: Logger;
425
- /**
426
- * All plugins
427
- */
428
- plugins: Plugin[];
419
+ mode: KubbFile.Mode;
429
420
  /**
430
421
  * Current plugin
431
422
  */
432
423
  plugin: Plugin<TOptions>;
433
- };
424
+ } & Kubb.PluginContext;
434
425
  /**
435
426
  * Specify the export location for the files and define the behavior of the output
436
427
  */
@@ -467,5 +458,5 @@ type Group = {
467
458
  name?: (context: GroupContext) => string;
468
459
  };
469
460
  //#endregion
470
- export { ResolvePathParams as _, InputData as a, UserPluginWithLifeCycle as b, Plugin as c, PluginKey as d, PluginLifecycle as f, ResolveNameParams as g, PluginWithLifeCycle as h, Group as i, PluginContext as l, PluginParameter as m, Config as n, InputPath as o, PluginLifecycleHooks as p, GetPluginFactoryOptions as r, Output as s, BarrelType as t, PluginFactoryOptions as u, UserConfig as v, PluginManager as x, UserPlugin as y };
471
- //# sourceMappingURL=types-CyDeSlGF.d.ts.map
461
+ export { getMode as C, PluginManager as S, ResolvePathParams as _, InputData as a, UserPluginWithLifeCycle as b, Plugin as c, PluginKey as d, PluginLifecycle as f, ResolveNameParams as g, PluginWithLifeCycle as h, Group as i, PluginContext as l, PluginParameter as m, Config as n, InputPath as o, PluginLifecycleHooks as p, GetPluginFactoryOptions as r, Output as s, BarrelType as t, PluginFactoryOptions as u, UserConfig as v, PossiblePromise as x, UserPlugin as y };
462
+ //# sourceMappingURL=types-CqYAL0CK.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { n as Logger, o as EventEmitter } from "./logger-BjfDkvkn.cjs";
2
- import { t as PossiblePromise } from "./types-DueAg3XP.cjs";
3
2
  import { KubbFile } from "@kubb/fabric-core/types";
4
- import { Fabric, FileManager } from "@kubb/react-fabric";
3
+ import { Fabric } from "@kubb/react-fabric";
5
4
 
6
5
  //#region src/PluginManager.d.ts
7
6
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
@@ -39,15 +38,17 @@ type GetFileProps<TOptions = object> = {
39
38
  pluginKey: Plugin['key'];
40
39
  options?: TOptions;
41
40
  };
41
+ declare function getMode(fileOrFolder: string | undefined | null): KubbFile.Mode;
42
42
  declare class PluginManager {
43
43
  #private;
44
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
45
44
  readonly events: EventEmitter<Events>;
46
45
  readonly config: Config;
47
46
  readonly executed: Array<Executer>;
48
47
  readonly logger: Logger;
49
48
  readonly options: Options;
50
49
  constructor(config: Config, options: Options);
50
+ getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
51
+ get plugins(): Array<Plugin>;
51
52
  getFile<TOptions = object>({
52
53
  name,
53
54
  mode,
@@ -57,7 +58,7 @@ declare class PluginManager {
57
58
  }: GetFileProps<TOptions>): KubbFile.File<{
58
59
  pluginKey: Plugin['key'];
59
60
  }>;
60
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
61
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
61
62
  resolveName: (params: ResolveNameParams) => string;
62
63
  /**
63
64
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -145,11 +146,17 @@ declare class PluginManager {
145
146
  }): Promise<void>;
146
147
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
147
148
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
148
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
149
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
150
149
  }
151
150
  //#endregion
151
+ //#region src/utils/types.d.ts
152
+ type PossiblePromise<T> = Promise<T> | T;
153
+ //#endregion
152
154
  //#region src/types.d.ts
155
+ declare global {
156
+ namespace Kubb {
157
+ interface PluginContext {}
158
+ }
159
+ }
153
160
  /**
154
161
  * Config used in `kubb.config.ts`
155
162
  *
@@ -325,11 +332,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
325
332
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
326
333
  */
327
334
  post?: Array<string>;
328
- } & (TOptions['context'] extends never ? {
329
- context?: never;
330
- } : {
331
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
332
- });
335
+ inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
336
+ };
333
337
  type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
334
338
  type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>;
335
339
  type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
@@ -356,25 +360,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
356
360
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
357
361
  */
358
362
  options: TOptions['resolvedOptions'];
359
- } & (TOptions['context'] extends never ? {
360
- context?: never;
361
- } : {
362
- context: TOptions['context'];
363
- });
363
+ install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
364
+ /**
365
+ * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
366
+ */
367
+ inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
368
+ };
364
369
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
365
370
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
366
371
  /**
367
372
  * Start of the lifecycle of a plugin.
368
373
  * @type hookParallel
369
374
  */
370
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
375
+ install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
371
376
  /**
372
377
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
373
378
  * Options can als be included.
374
379
  * @type hookFirst
375
380
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
376
381
  */
377
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
382
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
378
383
  /**
379
384
  * Resolve to a name based on a string.
380
385
  * Useful when converting to PascalCase or camelCase.
@@ -382,11 +387,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
382
387
  * @example ('pet') => 'Pet'
383
388
  */
384
389
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
385
- /**
386
- * End of the plugin lifecycle.
387
- * @type hookParallel
388
- */
389
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
390
390
  };
391
391
  type PluginLifecycleHooks = keyof PluginLifecycle;
392
392
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -413,24 +413,15 @@ type ResolveNameParams = {
413
413
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
414
414
  fabric: Fabric;
415
415
  config: Config;
416
- /**
417
- * @deprecated
418
- */
419
- fileManager: FileManager;
420
416
  pluginManager: PluginManager;
421
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
422
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
423
- resolveName: (params: ResolveNameParams) => string;
417
+ addFile: (...file: Array<KubbFile.File>) => Promise<void>;
424
418
  logger: Logger;
425
- /**
426
- * All plugins
427
- */
428
- plugins: Plugin[];
419
+ mode: KubbFile.Mode;
429
420
  /**
430
421
  * Current plugin
431
422
  */
432
423
  plugin: Plugin<TOptions>;
433
- };
424
+ } & Kubb.PluginContext;
434
425
  /**
435
426
  * Specify the export location for the files and define the behavior of the output
436
427
  */
@@ -467,5 +458,5 @@ type Group = {
467
458
  name?: (context: GroupContext) => string;
468
459
  };
469
460
  //#endregion
470
- export { ResolvePathParams as _, InputData as a, UserPluginWithLifeCycle as b, Plugin as c, PluginKey as d, PluginLifecycle as f, ResolveNameParams as g, PluginWithLifeCycle as h, Group as i, PluginContext as l, PluginParameter as m, Config as n, InputPath as o, PluginLifecycleHooks as p, GetPluginFactoryOptions as r, Output as s, BarrelType as t, PluginFactoryOptions as u, UserConfig as v, PluginManager as x, UserPlugin as y };
471
- //# sourceMappingURL=types-CVONMhN_.d.cts.map
461
+ export { getMode as C, PluginManager as S, ResolvePathParams as _, InputData as a, UserPluginWithLifeCycle as b, Plugin as c, PluginKey as d, PluginLifecycle as f, ResolveNameParams as g, PluginWithLifeCycle as h, Group as i, PluginContext as l, PluginParameter as m, Config as n, InputPath as o, PluginLifecycleHooks as p, GetPluginFactoryOptions as r, Output as s, BarrelType as t, PluginFactoryOptions as u, UserConfig as v, PossiblePromise as x, UserPlugin as y };
462
+ //# sourceMappingURL=types-DqHtLxpp.d.cts.map
package/dist/utils.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_transformers = require('./transformers-DWLXDYKb.cjs');
3
- const require_URLPath = require('./URLPath-Dir2mxRT.cjs');
2
+ const require_getBarrelFiles = require('./getBarrelFiles-o9ETjpTV.cjs');
3
+ require('./EventEmitter-3-rxpjGN.cjs');
4
+ const require_transformers = require('./transformers-BpnIvSiH.cjs');
4
5
  let node_path = require("node:path");
5
6
  node_path = require_chunk.__toESM(node_path);
6
7
  let natural_orderby = require("natural-orderby");
@@ -176,13 +177,14 @@ async function timeout(ms) {
176
177
  //#endregion
177
178
  exports.Cache = Cache;
178
179
  exports.FunctionParams = FunctionParams;
179
- exports.URLPath = require_URLPath.URLPath;
180
- exports.getUniqueName = require_URLPath.getUniqueName;
180
+ exports.URLPath = require_getBarrelFiles.URLPath;
181
+ exports.getBarrelFiles = require_getBarrelFiles.getBarrelFiles;
182
+ exports.getUniqueName = require_getBarrelFiles.getUniqueName;
181
183
  exports.isPromise = isPromise;
182
184
  exports.isPromiseFulfilledResult = isPromiseFulfilledResult;
183
185
  exports.isPromiseRejectedResult = isPromiseRejectedResult;
184
186
  exports.renderTemplate = renderTemplate;
185
187
  exports.resolveModuleSource = resolveModuleSource;
186
- exports.setUniqueName = require_URLPath.setUniqueName;
188
+ exports.setUniqueName = require_getBarrelFiles.setUniqueName;
187
189
  exports.timeout = timeout;
188
190
  //# sourceMappingURL=utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":["#buffer","#items","#orderItems","#addParams","camelCase","type: string[]","name: string[]","item","path"],"sources":["../src/utils/Cache.ts","../src/utils/FunctionParams.ts","../src/utils/promise.ts","../src/utils/renderTemplate.ts","../src/utils/resolveModuleSource.ts","../src/utils/timeout.ts"],"sourcesContent":["export class Cache<T> {\n #buffer = new Map<string, T>()\n\n async get(key: string): Promise<T | null> {\n return this.#buffer.get(key) ?? null\n }\n\n async set(key: string, value: T): Promise<void> {\n this.#buffer.set(key, value)\n }\n\n async delete(key: string): Promise<void> {\n this.#buffer.delete(key)\n }\n\n async clear(): Promise<void> {\n this.#buffer.clear()\n }\n\n async keys(): Promise<string[]> {\n return [...this.#buffer.keys()]\n }\n\n async values(): Promise<T[]> {\n return [...this.#buffer.values()]\n }\n\n async flush(): Promise<void> {\n // No-op for base cache\n }\n}\n","import { orderBy } from 'natural-orderby'\n\nimport { camelCase } from '../transformers/casing.ts'\n\ntype FunctionParamsASTWithoutType = {\n name?: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\ntype FunctionParamsASTWithType = {\n name?: never\n type: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n/**\n * @deprecated\n */\nexport type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType\n\n/**\n * @deprecated\n */\nexport class FunctionParams {\n #items: Array<FunctionParamsAST | FunctionParamsAST[]> = []\n constructor() {\n return this\n }\n\n get items(): FunctionParamsAST[] {\n return this.#items.flat()\n }\n\n add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams {\n if (!item) {\n return this\n }\n\n if (Array.isArray(item)) {\n item.filter(Boolean).forEach((it) => {\n this.#items.push(it)\n })\n return this\n }\n this.#items.push(item)\n\n return this\n }\n static #orderItems(items: Array<FunctionParamsAST | FunctionParamsAST[]>) {\n return orderBy(\n items.filter(Boolean),\n [\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return !v.default\n },\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return v.required ?? true\n },\n ],\n ['desc', 'desc'],\n )\n }\n\n static #addParams(acc: string[], item: FunctionParamsAST) {\n const { enabled = true, name, type, required = true, ...rest } = item\n\n if (!enabled) {\n return acc\n }\n\n if (!name) {\n // when name is not se we will use TypeScript generics\n acc.push(`${type}${rest.default ? ` = ${rest.default}` : ''}`)\n\n return acc\n }\n // TODO check whey we still need the camelcase here\n const parameterName = name.startsWith('{') ? name : camelCase(name)\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }\n\n static toObject(items: FunctionParamsAST[]): FunctionParamsAST {\n let type: string[] = []\n let name: string[] = []\n\n const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true\n const required = items.every((item) => item.required) ?? true\n\n items.forEach((item) => {\n name = FunctionParams.#addParams(name, { ...item, type: undefined })\n if (items.some((item) => item.type)) {\n type = FunctionParams.#addParams(type, item)\n }\n })\n\n return {\n name: `{ ${name.join(', ')} }`,\n type: type.length ? `{ ${type.join('; ')} }` : undefined,\n enabled,\n required,\n }\n }\n\n static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string {\n const sortedData = FunctionParams.#orderItems(items)\n\n return sortedData\n .reduce((acc, item) => {\n if (Array.isArray(item)) {\n if (item.length <= 0) {\n return acc\n }\n const subItems = FunctionParams.#orderItems(item) as FunctionParamsAST[]\n const objectItem = FunctionParams.toObject(subItems)\n\n return FunctionParams.#addParams(acc, objectItem)\n }\n\n return FunctionParams.#addParams(acc, item)\n }, [] as string[])\n .join(', ')\n }\n\n toObject(): FunctionParamsAST {\n const items = FunctionParams.#orderItems(this.#items).flat()\n\n return FunctionParams.toObject(items)\n }\n\n toString(): string {\n const items = FunctionParams.#orderItems(this.#items)\n\n return FunctionParams.toString(items)\n }\n}\n","import type { PossiblePromise } from './types.ts'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim()\n if (index === undefined) {\n return prev\n }\n const value = data[index]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","import { readFileSync } from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport createJiti from 'jiti'\n\nexport function resolveModuleSource(pkgName: string) {\n const parentURL = import.meta.url\n const jiti = createJiti(parentURL)\n\n const resolved = jiti.esmResolve(pkgName, parentURL)\n const filePath = resolved.startsWith('file:') ? fileURLToPath(resolved) : resolved\n const source = readFileSync(filePath, { encoding: 'utf-8' })\n const ext = path.extname(filePath)\n return { path: filePath, source, ext } as const\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAa,QAAb,MAAsB;CACpB,0BAAU,IAAI,KAAgB;CAE9B,MAAM,IAAI,KAAgC;AACxC,SAAO,MAAKA,OAAQ,IAAI,IAAI,IAAI;;CAGlC,MAAM,IAAI,KAAa,OAAyB;AAC9C,QAAKA,OAAQ,IAAI,KAAK,MAAM;;CAG9B,MAAM,OAAO,KAA4B;AACvC,QAAKA,OAAQ,OAAO,IAAI;;CAG1B,MAAM,QAAuB;AAC3B,QAAKA,OAAQ,OAAO;;CAGtB,MAAM,OAA0B;AAC9B,SAAO,CAAC,GAAG,MAAKA,OAAQ,MAAM,CAAC;;CAGjC,MAAM,SAAuB;AAC3B,SAAO,CAAC,GAAG,MAAKA,OAAQ,QAAQ,CAAC;;CAGnC,MAAM,QAAuB;;;;;;;;ACY/B,IAAa,iBAAb,MAAa,eAAe;CAC1B,SAAyD,EAAE;CAC3D,cAAc;AACZ,SAAO;;CAGT,IAAI,QAA6B;AAC/B,SAAO,MAAKC,MAAO,MAAM;;CAG3B,IAAI,MAAkH;AACpH,MAAI,CAAC,KACH,QAAO;AAGT,MAAI,MAAM,QAAQ,KAAK,EAAE;AACvB,QAAK,OAAO,QAAQ,CAAC,SAAS,OAAO;AACnC,UAAKA,MAAO,KAAK,GAAG;KACpB;AACF,UAAO;;AAET,QAAKA,MAAO,KAAK,KAAK;AAEtB,SA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AM,UAAU,MAAM;AAGlC,UAAQ,SAAoB;IAC5B,CACD,MAAM;IACR,SAAS,IAAI;;;;;ACvBpB,SAAgB,oBAAoB,SAAiB;CACnD,MAAM;CAGN,MAAM,6BAFkB,UAAU,CAEZ,WAAW,SAAS,UAAU;CACpD,MAAM,WAAW,SAAS,WAAW,QAAQ,+BAAiB,SAAS,GAAG;AAG1E,QAAO;EAAE,MAAM;EAAU,kCAFG,UAAU,EAAE,UAAU,SAAS,CAAC;EAE3B,KADrBO,kBAAK,QAAQ,SAAS;EACI;;;;;ACbxC,eAAsB,QAAQ,IAA8B;AAC1D,QAAO,IAAI,SAAS,YAAY;AAC9B,mBAAiB;AACf,WAAQ,KAAK;KACZ,GAAG;GACN"}
1
+ {"version":3,"file":"utils.cjs","names":["#buffer","#items","#orderItems","#addParams","camelCase","type: string[]","name: string[]","item","path"],"sources":["../src/utils/Cache.ts","../src/utils/FunctionParams.ts","../src/utils/promise.ts","../src/utils/renderTemplate.ts","../src/utils/resolveModuleSource.ts","../src/utils/timeout.ts"],"sourcesContent":["export class Cache<T> {\n #buffer = new Map<string, T>()\n\n async get(key: string): Promise<T | null> {\n return this.#buffer.get(key) ?? null\n }\n\n async set(key: string, value: T): Promise<void> {\n this.#buffer.set(key, value)\n }\n\n async delete(key: string): Promise<void> {\n this.#buffer.delete(key)\n }\n\n async clear(): Promise<void> {\n this.#buffer.clear()\n }\n\n async keys(): Promise<string[]> {\n return [...this.#buffer.keys()]\n }\n\n async values(): Promise<T[]> {\n return [...this.#buffer.values()]\n }\n\n async flush(): Promise<void> {\n // No-op for base cache\n }\n}\n","import { orderBy } from 'natural-orderby'\n\nimport { camelCase } from '../transformers/casing.ts'\n\ntype FunctionParamsASTWithoutType = {\n name?: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\ntype FunctionParamsASTWithType = {\n name?: never\n type: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n/**\n * @deprecated\n */\nexport type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType\n\n/**\n * @deprecated\n */\nexport class FunctionParams {\n #items: Array<FunctionParamsAST | FunctionParamsAST[]> = []\n constructor() {\n return this\n }\n\n get items(): FunctionParamsAST[] {\n return this.#items.flat()\n }\n\n add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams {\n if (!item) {\n return this\n }\n\n if (Array.isArray(item)) {\n item.filter(Boolean).forEach((it) => {\n this.#items.push(it)\n })\n return this\n }\n this.#items.push(item)\n\n return this\n }\n static #orderItems(items: Array<FunctionParamsAST | FunctionParamsAST[]>) {\n return orderBy(\n items.filter(Boolean),\n [\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return !v.default\n },\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return v.required ?? true\n },\n ],\n ['desc', 'desc'],\n )\n }\n\n static #addParams(acc: string[], item: FunctionParamsAST) {\n const { enabled = true, name, type, required = true, ...rest } = item\n\n if (!enabled) {\n return acc\n }\n\n if (!name) {\n // when name is not se we will use TypeScript generics\n acc.push(`${type}${rest.default ? ` = ${rest.default}` : ''}`)\n\n return acc\n }\n // TODO check whey we still need the camelcase here\n const parameterName = name.startsWith('{') ? name : camelCase(name)\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }\n\n static toObject(items: FunctionParamsAST[]): FunctionParamsAST {\n let type: string[] = []\n let name: string[] = []\n\n const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true\n const required = items.every((item) => item.required) ?? true\n\n items.forEach((item) => {\n name = FunctionParams.#addParams(name, { ...item, type: undefined })\n if (items.some((item) => item.type)) {\n type = FunctionParams.#addParams(type, item)\n }\n })\n\n return {\n name: `{ ${name.join(', ')} }`,\n type: type.length ? `{ ${type.join('; ')} }` : undefined,\n enabled,\n required,\n }\n }\n\n static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string {\n const sortedData = FunctionParams.#orderItems(items)\n\n return sortedData\n .reduce((acc, item) => {\n if (Array.isArray(item)) {\n if (item.length <= 0) {\n return acc\n }\n const subItems = FunctionParams.#orderItems(item) as FunctionParamsAST[]\n const objectItem = FunctionParams.toObject(subItems)\n\n return FunctionParams.#addParams(acc, objectItem)\n }\n\n return FunctionParams.#addParams(acc, item)\n }, [] as string[])\n .join(', ')\n }\n\n toObject(): FunctionParamsAST {\n const items = FunctionParams.#orderItems(this.#items).flat()\n\n return FunctionParams.toObject(items)\n }\n\n toString(): string {\n const items = FunctionParams.#orderItems(this.#items)\n\n return FunctionParams.toString(items)\n }\n}\n","import type { PossiblePromise } from './types.ts'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim()\n if (index === undefined) {\n return prev\n }\n const value = data[index]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","import { readFileSync } from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport createJiti from 'jiti'\n\nexport function resolveModuleSource(pkgName: string) {\n const parentURL = import.meta.url\n const jiti = createJiti(parentURL)\n\n const resolved = jiti.esmResolve(pkgName, parentURL)\n const filePath = resolved.startsWith('file:') ? fileURLToPath(resolved) : resolved\n const source = readFileSync(filePath, { encoding: 'utf-8' })\n const ext = path.extname(filePath)\n return { path: filePath, source, ext } as const\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAa,QAAb,MAAsB;CACpB,0BAAU,IAAI,KAAgB;CAE9B,MAAM,IAAI,KAAgC;AACxC,SAAO,MAAKA,OAAQ,IAAI,IAAI,IAAI;;CAGlC,MAAM,IAAI,KAAa,OAAyB;AAC9C,QAAKA,OAAQ,IAAI,KAAK,MAAM;;CAG9B,MAAM,OAAO,KAA4B;AACvC,QAAKA,OAAQ,OAAO,IAAI;;CAG1B,MAAM,QAAuB;AAC3B,QAAKA,OAAQ,OAAO;;CAGtB,MAAM,OAA0B;AAC9B,SAAO,CAAC,GAAG,MAAKA,OAAQ,MAAM,CAAC;;CAGjC,MAAM,SAAuB;AAC3B,SAAO,CAAC,GAAG,MAAKA,OAAQ,QAAQ,CAAC;;CAGnC,MAAM,QAAuB;;;;;;;;ACY/B,IAAa,iBAAb,MAAa,eAAe;CAC1B,SAAyD,EAAE;CAC3D,cAAc;AACZ,SAAO;;CAGT,IAAI,QAA6B;AAC/B,SAAO,MAAKC,MAAO,MAAM;;CAG3B,IAAI,MAAkH;AACpH,MAAI,CAAC,KACH,QAAO;AAGT,MAAI,MAAM,QAAQ,KAAK,EAAE;AACvB,QAAK,OAAO,QAAQ,CAAC,SAAS,OAAO;AACnC,UAAKA,MAAO,KAAK,GAAG;KACpB;AACF,UAAO;;AAET,QAAKA,MAAO,KAAK,KAAK;AAEtB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,MAAM,UAAU,MAAM;AAGlC,UAAQ,SAAoB;IAC5B,CACD,MAAM;IACR,SAAS,IAAI;;;;;ACvBpB,SAAgB,oBAAoB,SAAiB;CACnD,MAAM;CAGN,MAAM,6BAFkB,UAAU,CAEZ,WAAW,SAAS,UAAU;CACpD,MAAM,WAAW,SAAS,WAAW,QAAQ,+BAAiB,SAAS,GAAG;AAG1E,QAAO;EAAE,MAAM;EAAU,kCAFG,UAAU,EAAE,UAAU,SAAS,CAAC;EAE3B,KADrBO,kBAAK,QAAQ,SAAS;EACI;;;;;ACbxC,eAAsB,QAAQ,IAA8B;AAC1D,QAAO,IAAI,SAAS,YAAY;AAC9B,mBAAiB;AACf,WAAQ,KAAK;KACZ,GAAG;GACN"}
package/dist/utils.d.cts CHANGED
@@ -1,4 +1,6 @@
1
- import { t as PossiblePromise } from "./types-DueAg3XP.cjs";
1
+ import "./logger-BjfDkvkn.cjs";
2
+ import { x as PossiblePromise } from "./types-DqHtLxpp.cjs";
3
+ import { n as getBarrelFiles } from "./getBarrelFiles-B9LswRVo.cjs";
2
4
 
3
5
  //#region src/utils/Cache.d.ts
4
6
  declare class Cache<T> {
@@ -139,5 +141,5 @@ declare class URLPath {
139
141
  declare function getUniqueName(originalName: string, data: Record<string, number>): string;
140
142
  declare function setUniqueName(originalName: string, data: Record<string, number>): string;
141
143
  //#endregion
142
- export { Cache, FunctionParams, type FunctionParamsAST, type URLObject, URLPath, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, resolveModuleSource, setUniqueName, timeout };
144
+ export { Cache, FunctionParams, type FunctionParamsAST, type URLObject, URLPath, getBarrelFiles, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, resolveModuleSource, setUniqueName, timeout };
143
145
  //# sourceMappingURL=utils.d.cts.map
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { t as PossiblePromise } from "./types-DCR_QgGt.js";
1
+ import "./logger-weazBKCW.js";
2
+ import { x as PossiblePromise } from "./types-CqYAL0CK.js";
3
+ import { n as getBarrelFiles } from "./getBarrelFiles-CB-XIF32.js";
2
4
 
3
5
  //#region src/utils/Cache.d.ts
4
6
  declare class Cache<T> {
@@ -139,5 +141,5 @@ declare class URLPath {
139
141
  declare function getUniqueName(originalName: string, data: Record<string, number>): string;
140
142
  declare function setUniqueName(originalName: string, data: Record<string, number>): string;
141
143
  //#endregion
142
- export { Cache, FunctionParams, type FunctionParamsAST, type URLObject, URLPath, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, resolveModuleSource, setUniqueName, timeout };
144
+ export { Cache, FunctionParams, type FunctionParamsAST, type URLObject, URLPath, getBarrelFiles, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, resolveModuleSource, setUniqueName, timeout };
143
145
  //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js CHANGED
@@ -1,5 +1,6 @@
1
- import { m as camelCase } from "./transformers-CeNW0G32.js";
2
- import { n as getUniqueName, r as setUniqueName, t as URLPath } from "./URLPath-DbWtfVa1.js";
1
+ import { a as getUniqueName, n as URLPath, o as setUniqueName, t as getBarrelFiles } from "./getBarrelFiles-D7p4n7Ug.js";
2
+ import "./EventEmitter-IlDflnd2.js";
3
+ import { m as camelCase } from "./transformers-BaV4FwQd.js";
3
4
  import path from "node:path";
4
5
  import { orderBy } from "natural-orderby";
5
6
  import { fileURLToPath } from "node:url";
@@ -168,5 +169,5 @@ async function timeout(ms) {
168
169
  }
169
170
 
170
171
  //#endregion
171
- export { Cache, FunctionParams, URLPath, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, resolveModuleSource, setUniqueName, timeout };
172
+ export { Cache, FunctionParams, URLPath, getBarrelFiles, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, resolveModuleSource, setUniqueName, timeout };
172
173
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["#buffer","#items","#orderItems","#addParams","type: string[]","name: string[]","item"],"sources":["../src/utils/Cache.ts","../src/utils/FunctionParams.ts","../src/utils/promise.ts","../src/utils/renderTemplate.ts","../src/utils/resolveModuleSource.ts","../src/utils/timeout.ts"],"sourcesContent":["export class Cache<T> {\n #buffer = new Map<string, T>()\n\n async get(key: string): Promise<T | null> {\n return this.#buffer.get(key) ?? null\n }\n\n async set(key: string, value: T): Promise<void> {\n this.#buffer.set(key, value)\n }\n\n async delete(key: string): Promise<void> {\n this.#buffer.delete(key)\n }\n\n async clear(): Promise<void> {\n this.#buffer.clear()\n }\n\n async keys(): Promise<string[]> {\n return [...this.#buffer.keys()]\n }\n\n async values(): Promise<T[]> {\n return [...this.#buffer.values()]\n }\n\n async flush(): Promise<void> {\n // No-op for base cache\n }\n}\n","import { orderBy } from 'natural-orderby'\n\nimport { camelCase } from '../transformers/casing.ts'\n\ntype FunctionParamsASTWithoutType = {\n name?: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\ntype FunctionParamsASTWithType = {\n name?: never\n type: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n/**\n * @deprecated\n */\nexport type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType\n\n/**\n * @deprecated\n */\nexport class FunctionParams {\n #items: Array<FunctionParamsAST | FunctionParamsAST[]> = []\n constructor() {\n return this\n }\n\n get items(): FunctionParamsAST[] {\n return this.#items.flat()\n }\n\n add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams {\n if (!item) {\n return this\n }\n\n if (Array.isArray(item)) {\n item.filter(Boolean).forEach((it) => {\n this.#items.push(it)\n })\n return this\n }\n this.#items.push(item)\n\n return this\n }\n static #orderItems(items: Array<FunctionParamsAST | FunctionParamsAST[]>) {\n return orderBy(\n items.filter(Boolean),\n [\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return !v.default\n },\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return v.required ?? true\n },\n ],\n ['desc', 'desc'],\n )\n }\n\n static #addParams(acc: string[], item: FunctionParamsAST) {\n const { enabled = true, name, type, required = true, ...rest } = item\n\n if (!enabled) {\n return acc\n }\n\n if (!name) {\n // when name is not se we will use TypeScript generics\n acc.push(`${type}${rest.default ? ` = ${rest.default}` : ''}`)\n\n return acc\n }\n // TODO check whey we still need the camelcase here\n const parameterName = name.startsWith('{') ? name : camelCase(name)\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }\n\n static toObject(items: FunctionParamsAST[]): FunctionParamsAST {\n let type: string[] = []\n let name: string[] = []\n\n const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true\n const required = items.every((item) => item.required) ?? true\n\n items.forEach((item) => {\n name = FunctionParams.#addParams(name, { ...item, type: undefined })\n if (items.some((item) => item.type)) {\n type = FunctionParams.#addParams(type, item)\n }\n })\n\n return {\n name: `{ ${name.join(', ')} }`,\n type: type.length ? `{ ${type.join('; ')} }` : undefined,\n enabled,\n required,\n }\n }\n\n static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string {\n const sortedData = FunctionParams.#orderItems(items)\n\n return sortedData\n .reduce((acc, item) => {\n if (Array.isArray(item)) {\n if (item.length <= 0) {\n return acc\n }\n const subItems = FunctionParams.#orderItems(item) as FunctionParamsAST[]\n const objectItem = FunctionParams.toObject(subItems)\n\n return FunctionParams.#addParams(acc, objectItem)\n }\n\n return FunctionParams.#addParams(acc, item)\n }, [] as string[])\n .join(', ')\n }\n\n toObject(): FunctionParamsAST {\n const items = FunctionParams.#orderItems(this.#items).flat()\n\n return FunctionParams.toObject(items)\n }\n\n toString(): string {\n const items = FunctionParams.#orderItems(this.#items)\n\n return FunctionParams.toString(items)\n }\n}\n","import type { PossiblePromise } from './types.ts'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim()\n if (index === undefined) {\n return prev\n }\n const value = data[index]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","import { readFileSync } from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport createJiti from 'jiti'\n\nexport function resolveModuleSource(pkgName: string) {\n const parentURL = import.meta.url\n const jiti = createJiti(parentURL)\n\n const resolved = jiti.esmResolve(pkgName, parentURL)\n const filePath = resolved.startsWith('file:') ? fileURLToPath(resolved) : resolved\n const source = readFileSync(filePath, { encoding: 'utf-8' })\n const ext = path.extname(filePath)\n return { path: filePath, source, ext } as const\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n"],"mappings":";;;;;;;;;AAAA,IAAa,QAAb,MAAsB;CACpB,0BAAU,IAAI,KAAgB;C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ACf,aAAQ,KAAK;KACZ,GAAG;GACN"}
1
+ {"version":3,"file":"utils.js","names":["#buffer","#items","#orderItems","#addParams","type: string[]","name: string[]","item"],"sources":["../src/utils/Cache.ts","../src/utils/FunctionParams.ts","../src/utils/promise.ts","../src/utils/renderTemplate.ts","../src/utils/resolveModuleSource.ts","../src/utils/timeout.ts"],"sourcesContent":["export class Cache<T> {\n #buffer = new Map<string, T>()\n\n async get(key: string): Promise<T | null> {\n return this.#buffer.get(key) ?? null\n }\n\n async set(key: string, value: T): Promise<void> {\n this.#buffer.set(key, value)\n }\n\n async delete(key: string): Promise<void> {\n this.#buffer.delete(key)\n }\n\n async clear(): Promise<void> {\n this.#buffer.clear()\n }\n\n async keys(): Promise<string[]> {\n return [...this.#buffer.keys()]\n }\n\n async values(): Promise<T[]> {\n return [...this.#buffer.values()]\n }\n\n async flush(): Promise<void> {\n // No-op for base cache\n }\n}\n","import { orderBy } from 'natural-orderby'\n\nimport { camelCase } from '../transformers/casing.ts'\n\ntype FunctionParamsASTWithoutType = {\n name?: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\ntype FunctionParamsASTWithType = {\n name?: never\n type: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n/**\n * @deprecated\n */\nexport type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType\n\n/**\n * @deprecated\n */\nexport class FunctionParams {\n #items: Array<FunctionParamsAST | FunctionParamsAST[]> = []\n constructor() {\n return this\n }\n\n get items(): FunctionParamsAST[] {\n return this.#items.flat()\n }\n\n add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams {\n if (!item) {\n return this\n }\n\n if (Array.isArray(item)) {\n item.filter(Boolean).forEach((it) => {\n this.#items.push(it)\n })\n return this\n }\n this.#items.push(item)\n\n return this\n }\n static #orderItems(items: Array<FunctionParamsAST | FunctionParamsAST[]>) {\n return orderBy(\n items.filter(Boolean),\n [\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return !v.default\n },\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return v.required ?? true\n },\n ],\n ['desc', 'desc'],\n )\n }\n\n static #addParams(acc: string[], item: FunctionParamsAST) {\n const { enabled = true, name, type, required = true, ...rest } = item\n\n if (!enabled) {\n return acc\n }\n\n if (!name) {\n // when name is not se we will use TypeScript generics\n acc.push(`${type}${rest.default ? ` = ${rest.default}` : ''}`)\n\n return acc\n }\n // TODO check whey we still need the camelcase here\n const parameterName = name.startsWith('{') ? name : camelCase(name)\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }\n\n static toObject(items: FunctionParamsAST[]): FunctionParamsAST {\n let type: string[] = []\n let name: string[] = []\n\n const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true\n const required = items.every((item) => item.required) ?? true\n\n items.forEach((item) => {\n name = FunctionParams.#addParams(name, { ...item, type: undefined })\n if (items.some((item) => item.type)) {\n type = FunctionParams.#addParams(type, item)\n }\n })\n\n return {\n name: `{ ${name.join(', ')} }`,\n type: type.length ? `{ ${type.join('; ')} }` : undefined,\n enabled,\n required,\n }\n }\n\n static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string {\n const sortedData = FunctionParams.#orderItems(items)\n\n return sortedData\n .reduce((acc, item) => {\n if (Array.isArray(item)) {\n if (item.length <= 0) {\n return acc\n }\n const subItems = FunctionParams.#orderItems(item) as FunctionParamsAST[]\n const objectItem = FunctionParams.toObject(subItems)\n\n return FunctionParams.#addParams(acc, objectItem)\n }\n\n return FunctionParams.#addParams(acc, item)\n }, [] as string[])\n .join(', ')\n }\n\n toObject(): FunctionParamsAST {\n const items = FunctionParams.#orderItems(this.#items).flat()\n\n return FunctionParams.toObject(items)\n }\n\n toString(): string {\n const items = FunctionParams.#orderItems(this.#items)\n\n return FunctionParams.toString(items)\n }\n}\n","import type { PossiblePromise } from './types.ts'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim()\n if (index === undefined) {\n return prev\n }\n const value = data[index]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","import { readFileSync } from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport createJiti from 'jiti'\n\nexport function resolveModuleSource(pkgName: string) {\n const parentURL = import.meta.url\n const jiti = createJiti(parentURL)\n\n const resolved = jiti.esmResolve(pkgName, parentURL)\n const filePath = resolved.startsWith('file:') ? fileURLToPath(resolved) : resolved\n const source = readFileSync(filePath, { encoding: 'utf-8' })\n const ext = path.extname(filePath)\n return { path: filePath, source, ext } as const\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAa,QAAb,MAAsB;CACpB,0BAAU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