@kubb/core 4.3.1 → 4.4.1

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 (147) hide show
  1. package/dist/{URLPath-BYceu_vY.js → URLPath-DbWtfVa1.js} +2 -3
  2. package/dist/{URLPath-BYceu_vY.js.map → URLPath-DbWtfVa1.js.map} +1 -1
  3. package/dist/{URLPath-8WVzHBnA.cjs → URLPath-Dir2mxRT.cjs} +6 -7
  4. package/dist/{URLPath-8WVzHBnA.cjs.map → URLPath-Dir2mxRT.cjs.map} +1 -1
  5. package/dist/{chunk-CZg_9w7l.cjs → chunk-CUT6urMc.cjs} +0 -23
  6. package/dist/hooks.cjs +6 -6
  7. package/dist/hooks.cjs.map +1 -1
  8. package/dist/hooks.d.cts +5 -5
  9. package/dist/hooks.d.ts +5 -5
  10. package/dist/hooks.js +1 -1
  11. package/dist/hooks.js.map +1 -1
  12. package/dist/index.cjs +128 -62
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +22 -18
  15. package/dist/index.d.ts +22 -18
  16. package/dist/index.js +116 -53
  17. package/dist/index.js.map +1 -1
  18. package/dist/{logger-BXL0YCrv.cjs → logger-BIzTtBYJ.cjs} +48 -5
  19. package/dist/logger-BIzTtBYJ.cjs.map +1 -0
  20. package/dist/{logger-DpoDtxfo.d.cts → logger-BjfDkvkn.d.cts} +1 -1
  21. package/dist/{logger-BA-za85-.d.ts → logger-BwhJWK-H.d.ts} +1 -1
  22. package/dist/{logger-CDxSrFkR.js → logger-Bxe022ug.js} +39 -4
  23. package/dist/logger-Bxe022ug.js.map +1 -0
  24. package/dist/logger.cjs +1 -2
  25. package/dist/logger.d.cts +1 -1
  26. package/dist/logger.d.ts +1 -1
  27. package/dist/logger.js +1 -2
  28. package/dist/{prompt-DgONOpPH.cjs → prompt-D5DZPtWc.cjs} +2 -2
  29. package/dist/{prompt-DgONOpPH.cjs.map → prompt-D5DZPtWc.cjs.map} +1 -1
  30. package/dist/{prompt-DBVnG4Me.js → prompt-xM0onfy8.js} +1 -1
  31. package/dist/{prompt-DBVnG4Me.js.map → prompt-xM0onfy8.js.map} +1 -1
  32. package/dist/transformers-CeNW0G32.js +339 -0
  33. package/dist/transformers-CeNW0G32.js.map +1 -0
  34. package/dist/transformers-DWLXDYKb.cjs +443 -0
  35. package/dist/transformers-DWLXDYKb.cjs.map +1 -0
  36. package/dist/transformers.cjs +7 -6
  37. package/dist/transformers.js +1 -3
  38. package/dist/{types-DPeNK0FO.d.ts → types-CVONMhN_.d.cts} +51 -53
  39. package/dist/{types-DNxlynJr.d.cts → types-CyDeSlGF.d.ts} +51 -53
  40. package/dist/{types-BzI9JlV8.d.ts → types-DCR_QgGt.d.ts} +1 -1
  41. package/dist/{types-C3ea5qNG.d.cts → types-DueAg3XP.d.cts} +1 -1
  42. package/dist/utils.cjs +7 -7
  43. package/dist/utils.cjs.map +1 -1
  44. package/dist/utils.d.cts +1 -1
  45. package/dist/utils.d.ts +1 -1
  46. package/dist/utils.js +4 -6
  47. package/dist/utils.js.map +1 -1
  48. package/package.json +15 -20
  49. package/src/BarrelManager.ts +1 -1
  50. package/src/FileManager.ts +5 -2
  51. package/src/PluginManager.ts +4 -8
  52. package/src/build.ts +39 -42
  53. package/src/fs/index.ts +0 -7
  54. package/src/hooks/useMode.ts +2 -2
  55. package/src/hooks/usePlugin.ts +1 -1
  56. package/src/hooks/usePluginManager.ts +1 -1
  57. package/src/plugin.ts +10 -5
  58. package/src/types.ts +3 -2
  59. package/src/utils/TreeNode.ts +1 -1
  60. package/dist/acorn-BAVXZMtK.cjs +0 -5082
  61. package/dist/acorn-BAVXZMtK.cjs.map +0 -1
  62. package/dist/acorn-D-VhIOLw.js +0 -5080
  63. package/dist/acorn-D-VhIOLw.js.map +0 -1
  64. package/dist/angular-Bp0XO9db.cjs +0 -3631
  65. package/dist/angular-Bp0XO9db.cjs.map +0 -1
  66. package/dist/angular-Czhp4eq5.js +0 -3629
  67. package/dist/angular-Czhp4eq5.js.map +0 -1
  68. package/dist/babel-DCR_B4Qn.js +0 -10033
  69. package/dist/babel-DCR_B4Qn.js.map +0 -1
  70. package/dist/babel-NI0v59ga.cjs +0 -10035
  71. package/dist/babel-NI0v59ga.cjs.map +0 -1
  72. package/dist/casing-BSeq_teY.js +0 -100
  73. package/dist/casing-BSeq_teY.js.map +0 -1
  74. package/dist/casing-CP-9GGdK.cjs +0 -112
  75. package/dist/casing-CP-9GGdK.cjs.map +0 -1
  76. package/dist/chunk-1SJ2vVWa.js +0 -35
  77. package/dist/estree-C3BZPlpU.cjs +0 -6930
  78. package/dist/estree-C3BZPlpU.cjs.map +0 -1
  79. package/dist/estree-DU2NummP.js +0 -6926
  80. package/dist/estree-DU2NummP.js.map +0 -1
  81. package/dist/flow-CWUBUkoi.cjs +0 -52252
  82. package/dist/flow-CWUBUkoi.cjs.map +0 -1
  83. package/dist/flow-JiEbweKj.js +0 -52250
  84. package/dist/flow-JiEbweKj.js.map +0 -1
  85. package/dist/fs-BIPMUfpW.js +0 -90
  86. package/dist/fs-BIPMUfpW.js.map +0 -1
  87. package/dist/fs-RSVoUw3S.cjs +0 -141
  88. package/dist/fs-RSVoUw3S.cjs.map +0 -1
  89. package/dist/fs.cjs +0 -17
  90. package/dist/fs.d.cts +0 -2
  91. package/dist/fs.d.ts +0 -2
  92. package/dist/fs.js +0 -4
  93. package/dist/glimmer-CX9OqG1j.cjs +0 -7275
  94. package/dist/glimmer-CX9OqG1j.cjs.map +0 -1
  95. package/dist/glimmer-t9nWn9aE.js +0 -7271
  96. package/dist/glimmer-t9nWn9aE.js.map +0 -1
  97. package/dist/graphql-DjErlIi5.js +0 -1897
  98. package/dist/graphql-DjErlIi5.js.map +0 -1
  99. package/dist/graphql-GOxQAKxM.cjs +0 -1902
  100. package/dist/graphql-GOxQAKxM.cjs.map +0 -1
  101. package/dist/html-CWrdYAhQ.cjs +0 -6560
  102. package/dist/html-CWrdYAhQ.cjs.map +0 -1
  103. package/dist/html-_apcbx34.js +0 -6555
  104. package/dist/html-_apcbx34.js.map +0 -1
  105. package/dist/index-BTe91LHd.d.ts +0 -145
  106. package/dist/index-BmQIxvw0.d.cts +0 -144
  107. package/dist/logger-BXL0YCrv.cjs.map +0 -1
  108. package/dist/logger-CDxSrFkR.js.map +0 -1
  109. package/dist/markdown-ckUc3Q6q.js +0 -6750
  110. package/dist/markdown-ckUc3Q6q.js.map +0 -1
  111. package/dist/markdown-pzqiRmft.cjs +0 -6755
  112. package/dist/markdown-pzqiRmft.cjs.map +0 -1
  113. package/dist/meriyah-BjnGqpUs.js +0 -8928
  114. package/dist/meriyah-BjnGqpUs.js.map +0 -1
  115. package/dist/meriyah-D_x7itbT.cjs +0 -8930
  116. package/dist/meriyah-D_x7itbT.cjs.map +0 -1
  117. package/dist/mocks.cjs +0 -16830
  118. package/dist/mocks.cjs.map +0 -1
  119. package/dist/mocks.d.cts +0 -13
  120. package/dist/mocks.d.ts +0 -13
  121. package/dist/mocks.js +0 -16818
  122. package/dist/mocks.js.map +0 -1
  123. package/dist/postcss-B_c2wbFu.cjs +0 -6689
  124. package/dist/postcss-B_c2wbFu.cjs.map +0 -1
  125. package/dist/postcss-v7BP6SZ-.js +0 -6684
  126. package/dist/postcss-v7BP6SZ-.js.map +0 -1
  127. package/dist/transformers-BH0KLJJP.cjs +0 -804
  128. package/dist/transformers-BH0KLJJP.cjs.map +0 -1
  129. package/dist/transformers-DzHGqYO2.js +0 -702
  130. package/dist/transformers-DzHGqYO2.js.map +0 -1
  131. package/dist/typescript-6kMN6Wqz.cjs +0 -23014
  132. package/dist/typescript-6kMN6Wqz.cjs.map +0 -1
  133. package/dist/typescript-B_IBfKSe.js +0 -23002
  134. package/dist/typescript-B_IBfKSe.js.map +0 -1
  135. package/dist/typescript-C5hce4HG.cjs +0 -4
  136. package/dist/typescript-Cas1XcNz.js +0 -3
  137. package/dist/write-BJfM7G1_.cjs +0 -49
  138. package/dist/write-BJfM7G1_.cjs.map +0 -1
  139. package/dist/write-CxO1CDML.js +0 -40
  140. package/dist/write-CxO1CDML.js.map +0 -1
  141. package/dist/yaml-BfWM_B73.js +0 -5209
  142. package/dist/yaml-BfWM_B73.js.map +0 -1
  143. package/dist/yaml-DZs6MhV1.cjs +0 -5215
  144. package/dist/yaml-DZs6MhV1.cjs.map +0 -1
  145. package/src/fs/types.ts +0 -132
  146. package/src/fs/unlink.ts +0 -5
  147. package/src/mocks/index.ts +0 -82
@@ -1,90 +0,0 @@
1
- import { normalize, relative } from "node:path";
2
- import fs from "fs-extra";
3
- import { switcher } from "js-runtime";
4
-
5
- //#region src/fs/clean.ts
6
- async function clean(path$1) {
7
- return fs.remove(path$1);
8
- }
9
-
10
- //#endregion
11
- //#region src/fs/exists.ts
12
- const reader$1 = switcher({
13
- node: async (path$1) => {
14
- return fs.pathExists(path$1);
15
- },
16
- bun: async (path$1) => {
17
- return Bun.file(path$1).exists();
18
- }
19
- }, "node");
20
- const syncReader$1 = switcher({
21
- node: (path$1) => {
22
- return fs.pathExistsSync(path$1);
23
- },
24
- bun: () => {
25
- throw new Error("Bun cannot read sync");
26
- }
27
- }, "node");
28
- async function exists(path$1) {
29
- return reader$1(path$1);
30
- }
31
-
32
- //#endregion
33
- //#region src/fs/read.ts
34
- const reader = switcher({
35
- node: async (path$1) => {
36
- return fs.readFile(path$1, { encoding: "utf8" });
37
- },
38
- bun: async (path$1) => {
39
- return Bun.file(path$1).text();
40
- }
41
- }, "node");
42
- const syncReader = switcher({
43
- node: (path$1) => {
44
- return fs.readFileSync(path$1, { encoding: "utf8" });
45
- },
46
- bun: () => {
47
- throw new Error("Bun cannot read sync");
48
- }
49
- }, "node");
50
- async function read(path$1) {
51
- return reader(path$1);
52
- }
53
- function readSync(path$1) {
54
- return syncReader(path$1);
55
- }
56
-
57
- //#endregion
58
- //#region src/fs/unlink.ts
59
- async function unlink(path$1) {
60
- return fs.unlink(path$1);
61
- }
62
-
63
- //#endregion
64
- //#region src/fs/utils.ts
65
- function slash(path$1, platform = "linux") {
66
- const isWindowsPath = /^\\\\\?\\/.test(path$1);
67
- const normalizedPath = normalize(path$1);
68
- if (["linux", "mac"].includes(platform) && !isWindowsPath) return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
69
- return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
70
- }
71
- function getRelativePath(rootDir, filePath, platform = "linux") {
72
- if (!rootDir || !filePath) throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
73
- const slashedPath = slash(relative(rootDir, filePath), platform);
74
- if (slashedPath.startsWith("../")) return slashedPath;
75
- return `./${slashedPath}`;
76
- }
77
-
78
- //#endregion
79
- //#region src/fs/types.ts
80
- var types_exports = {};
81
-
82
- //#endregion
83
- //#region src/fs/index.ts
84
- function trimExtName(text) {
85
- return text.replace(/\.[^/.]+$/, "");
86
- }
87
-
88
- //#endregion
89
- export { read as a, clean as c, unlink as i, types_exports as n, readSync as o, getRelativePath as r, exists as s, trimExtName as t };
90
- //# sourceMappingURL=fs-BIPMUfpW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-BIPMUfpW.js","names":["path","reader","path","syncReader","path","path","path"],"sources":["../src/fs/clean.ts","../src/fs/exists.ts","../src/fs/read.ts","../src/fs/unlink.ts","../src/fs/utils.ts","../src/fs/types.ts","../src/fs/index.ts"],"sourcesContent":["import fs from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n","import fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.pathExists(path)\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.exists()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.pathExistsSync(path)\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function exists(path: string): Promise<boolean> {\n return reader(path)\n}\n\nexport function existsSync(path: string): boolean {\n return syncReader(path)\n}\n","import fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n","import fs from 'fs-extra'\n\nexport async function unlink(path: string): Promise<void> {\n return fs.unlink(path)\n}\n","import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n","type BasePath<T extends string = string> = `${T}/`\n\nexport type Import = {\n /**\n * Import name to be used\n * @example [\"useState\"]\n * @example \"React\"\n */\n name:\n | string\n | Array<\n | string\n | {\n propertyName: string\n name?: string\n }\n >\n /**\n * Path for the import\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n\n isNameSpace?: boolean\n /**\n * When root is set it will get the path with relative getRelativePath(root, path).\n */\n root?: string\n}\n\nexport type Source = {\n name?: string\n value?: string\n isTypeOnly?: boolean\n /**\n * Has const or type 'export'\n * @default false\n */\n isExportable?: boolean\n /**\n * When set, barrel generation will add this\n * @default false\n */\n isIndexable?: boolean\n}\n\nexport type Export = {\n /**\n * Export name to be used.\n * @example [\"useState\"]\n * @example \"React\"\n */\n name?: string | Array<string>\n /**\n * Path for the import.\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n /**\n * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.\n */\n asAlias?: boolean\n}\n\nexport type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\nexport type Mode = 'single' | 'split'\n\n/**\n * Name to be used to dynamicly create the baseName(based on input.path)\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\nexport type BaseName = `${string}.${string}`\n\n/**\n * Path will be full qualified path to a specified file\n */\nexport type Path = string\n\nexport type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`\n\nexport type OptionalPath = Path | undefined | null\n\nexport type File<TMeta extends object = object> = {\n /**\n * Name to be used to create the path\n * Based on UNIX basename, `${name}.extname`\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: BaseName\n /**\n * Path will be full qualified path to a specified file\n */\n path: AdvancedPath<BaseName> | Path\n sources: Array<Source>\n imports?: Array<Import>\n exports?: Array<Export>\n /**\n * Use extra meta, this is getting used to generate the barrel/index files.\n */\n meta?: TMeta\n banner?: string\n footer?: string\n}\n\nexport type ResolvedImport = Import\n\nexport type ResolvedExport = Export\n\nexport type ResolvedFile<TMeta extends object = object> = File<TMeta> & {\n /**\n * @default object-hash\n */\n id: string\n /**\n * Contains the first part of the baseName, generated based on baseName\n * @link https://nodejs.org/api/path.html#pathformatpathobject\n */\n name: string\n extname: Extname\n imports: Array<ResolvedImport>\n exports: Array<ResolvedExport>\n}\n","export { clean } from './clean.ts'\nexport { exists } from './exists.ts'\nexport { read, readSync } from './read.ts'\nexport { unlink } from './unlink.ts'\nexport { getRelativePath } from './utils.ts'\nexport { write } from './write.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport * as KubbFile from './types.ts'\n"],"mappings":";;;;;AAEA,eAAsB,MAAM,QAA6B;AACvD,QAAO,GAAG,OAAOA,OAAK;;;;;ACAxB,MAAMC,WAAS,SACb;CACE,MAAM,OAAO,WAAiB;AAC5B,SAAO,GAAG,WAAWC,OAAK;;CAE5B,KAAK,OAAO,WAAiB;AAG3B,SAFa,IAAI,KAAKA,OAAK,CAEf,QAAQ;;CAEvB,EACD,OACD;AAED,MAAMC,eAAa,SACjB;CACE,OAAO,WAAiB;AACtB,SAAO,GAAG,eAAeD,OAAK;;CAEhC,WAAW;AACT,QAAM,IAAI,MAAM,uBAAuB;;CAE1C,EACD,OACD;AAED,eAAsB,OAAO,QAAgC;AAC3D,QAAOD,SAAOC,OAAK;;;;;AC3BrB,MAAM,SAAS,SACb;CACE,MAAM,OAAO,WAAiB;AAC5B,SAAO,GAAG,SAASE,QAAM,EAAE,UAAU,QAAQ,CAAC;;CAEhD,KAAK,OAAO,WAAiB;AAG3B,SAFa,IAAI,KAAKA,OAAK,CAEf,MAAM;;CAErB,EACD,OACD;AAED,MAAM,aAAa,SACjB;CACE,OAAO,WAAiB;AACtB,SAAO,GAAG,aAAaA,QAAM,EAAE,UAAU,QAAQ,CAAC;;CAEpD,WAAW;AACT,QAAM,IAAI,MAAM,uBAAuB;;CAE1C,EACD,OACD;AAED,eAAsB,KAAK,QAA+B;AACxD,QAAO,OAAOA,OAAK;;AAGrB,SAAgB,SAAS,QAAsB;AAC7C,QAAO,WAAWA,OAAK;;;;;AChCzB,eAAsB,OAAO,QAA6B;AACxD,QAAO,GAAG,OAAOC,OAAK;;;;;ACDxB,SAAS,MAAM,QAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAKC,OAAK;CAC5C,MAAM,iBAAiB,UAAUA,OAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,MAJC,SAAS,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK;;;;;;;;;AEvBd,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG"}
@@ -1,141 +0,0 @@
1
- const require_chunk = require('./chunk-CZg_9w7l.cjs');
2
- let node_path = require("node:path");
3
- node_path = require_chunk.__toESM(node_path);
4
- let fs_extra = require("fs-extra");
5
- fs_extra = require_chunk.__toESM(fs_extra);
6
- let js_runtime = require("js-runtime");
7
- js_runtime = require_chunk.__toESM(js_runtime);
8
-
9
- //#region src/fs/clean.ts
10
- async function clean(path) {
11
- return fs_extra.default.remove(path);
12
- }
13
-
14
- //#endregion
15
- //#region src/fs/exists.ts
16
- const reader$1 = (0, js_runtime.switcher)({
17
- node: async (path) => {
18
- return fs_extra.default.pathExists(path);
19
- },
20
- bun: async (path) => {
21
- return Bun.file(path).exists();
22
- }
23
- }, "node");
24
- const syncReader$1 = (0, js_runtime.switcher)({
25
- node: (path) => {
26
- return fs_extra.default.pathExistsSync(path);
27
- },
28
- bun: () => {
29
- throw new Error("Bun cannot read sync");
30
- }
31
- }, "node");
32
- async function exists(path) {
33
- return reader$1(path);
34
- }
35
-
36
- //#endregion
37
- //#region src/fs/read.ts
38
- const reader = (0, js_runtime.switcher)({
39
- node: async (path) => {
40
- return fs_extra.default.readFile(path, { encoding: "utf8" });
41
- },
42
- bun: async (path) => {
43
- return Bun.file(path).text();
44
- }
45
- }, "node");
46
- const syncReader = (0, js_runtime.switcher)({
47
- node: (path) => {
48
- return fs_extra.default.readFileSync(path, { encoding: "utf8" });
49
- },
50
- bun: () => {
51
- throw new Error("Bun cannot read sync");
52
- }
53
- }, "node");
54
- async function read(path) {
55
- return reader(path);
56
- }
57
- function readSync(path) {
58
- return syncReader(path);
59
- }
60
-
61
- //#endregion
62
- //#region src/fs/unlink.ts
63
- async function unlink(path) {
64
- return fs_extra.default.unlink(path);
65
- }
66
-
67
- //#endregion
68
- //#region src/fs/utils.ts
69
- function slash(path, platform = "linux") {
70
- const isWindowsPath = /^\\\\\?\\/.test(path);
71
- const normalizedPath = (0, node_path.normalize)(path);
72
- if (["linux", "mac"].includes(platform) && !isWindowsPath) return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
73
- return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
74
- }
75
- function getRelativePath(rootDir, filePath, platform = "linux") {
76
- if (!rootDir || !filePath) throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
77
- const slashedPath = slash((0, node_path.relative)(rootDir, filePath), platform);
78
- if (slashedPath.startsWith("../")) return slashedPath;
79
- return `./${slashedPath}`;
80
- }
81
-
82
- //#endregion
83
- //#region src/fs/types.ts
84
- var types_exports = {};
85
-
86
- //#endregion
87
- //#region src/fs/index.ts
88
- function trimExtName(text) {
89
- return text.replace(/\.[^/.]+$/, "");
90
- }
91
-
92
- //#endregion
93
- Object.defineProperty(exports, 'clean', {
94
- enumerable: true,
95
- get: function () {
96
- return clean;
97
- }
98
- });
99
- Object.defineProperty(exports, 'exists', {
100
- enumerable: true,
101
- get: function () {
102
- return exists;
103
- }
104
- });
105
- Object.defineProperty(exports, 'getRelativePath', {
106
- enumerable: true,
107
- get: function () {
108
- return getRelativePath;
109
- }
110
- });
111
- Object.defineProperty(exports, 'read', {
112
- enumerable: true,
113
- get: function () {
114
- return read;
115
- }
116
- });
117
- Object.defineProperty(exports, 'readSync', {
118
- enumerable: true,
119
- get: function () {
120
- return readSync;
121
- }
122
- });
123
- Object.defineProperty(exports, 'trimExtName', {
124
- enumerable: true,
125
- get: function () {
126
- return trimExtName;
127
- }
128
- });
129
- Object.defineProperty(exports, 'types_exports', {
130
- enumerable: true,
131
- get: function () {
132
- return types_exports;
133
- }
134
- });
135
- Object.defineProperty(exports, 'unlink', {
136
- enumerable: true,
137
- get: function () {
138
- return unlink;
139
- }
140
- });
141
- //# sourceMappingURL=fs-RSVoUw3S.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs-RSVoUw3S.cjs","names":["fs","reader","fs","syncReader","fs","fs"],"sources":["../src/fs/clean.ts","../src/fs/exists.ts","../src/fs/read.ts","../src/fs/unlink.ts","../src/fs/utils.ts","../src/fs/types.ts","../src/fs/index.ts"],"sourcesContent":["import fs from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n","import fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.pathExists(path)\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.exists()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.pathExistsSync(path)\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function exists(path: string): Promise<boolean> {\n return reader(path)\n}\n\nexport function existsSync(path: string): boolean {\n return syncReader(path)\n}\n","import fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n","import fs from 'fs-extra'\n\nexport async function unlink(path: string): Promise<void> {\n return fs.unlink(path)\n}\n","import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n","type BasePath<T extends string = string> = `${T}/`\n\nexport type Import = {\n /**\n * Import name to be used\n * @example [\"useState\"]\n * @example \"React\"\n */\n name:\n | string\n | Array<\n | string\n | {\n propertyName: string\n name?: string\n }\n >\n /**\n * Path for the import\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n\n isNameSpace?: boolean\n /**\n * When root is set it will get the path with relative getRelativePath(root, path).\n */\n root?: string\n}\n\nexport type Source = {\n name?: string\n value?: string\n isTypeOnly?: boolean\n /**\n * Has const or type 'export'\n * @default false\n */\n isExportable?: boolean\n /**\n * When set, barrel generation will add this\n * @default false\n */\n isIndexable?: boolean\n}\n\nexport type Export = {\n /**\n * Export name to be used.\n * @example [\"useState\"]\n * @example \"React\"\n */\n name?: string | Array<string>\n /**\n * Path for the import.\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n /**\n * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.\n */\n asAlias?: boolean\n}\n\nexport type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\nexport type Mode = 'single' | 'split'\n\n/**\n * Name to be used to dynamicly create the baseName(based on input.path)\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\nexport type BaseName = `${string}.${string}`\n\n/**\n * Path will be full qualified path to a specified file\n */\nexport type Path = string\n\nexport type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`\n\nexport type OptionalPath = Path | undefined | null\n\nexport type File<TMeta extends object = object> = {\n /**\n * Name to be used to create the path\n * Based on UNIX basename, `${name}.extname`\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: BaseName\n /**\n * Path will be full qualified path to a specified file\n */\n path: AdvancedPath<BaseName> | Path\n sources: Array<Source>\n imports?: Array<Import>\n exports?: Array<Export>\n /**\n * Use extra meta, this is getting used to generate the barrel/index files.\n */\n meta?: TMeta\n banner?: string\n footer?: string\n}\n\nexport type ResolvedImport = Import\n\nexport type ResolvedExport = Export\n\nexport type ResolvedFile<TMeta extends object = object> = File<TMeta> & {\n /**\n * @default object-hash\n */\n id: string\n /**\n * Contains the first part of the baseName, generated based on baseName\n * @link https://nodejs.org/api/path.html#pathformatpathobject\n */\n name: string\n extname: Extname\n imports: Array<ResolvedImport>\n exports: Array<ResolvedExport>\n}\n","export { clean } from './clean.ts'\nexport { exists } from './exists.ts'\nexport { read, readSync } from './read.ts'\nexport { unlink } from './unlink.ts'\nexport { getRelativePath } from './utils.ts'\nexport { write } from './write.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport * as KubbFile from './types.ts'\n"],"mappings":";;;;;;;;;AAEA,eAAsB,MAAM,MAA6B;AACvD,QAAOA,iBAAG,OAAO,KAAK;;;;;ACAxB,MAAMC,oCACJ;CACE,MAAM,OAAO,SAAiB;AAC5B,SAAOC,iBAAG,WAAW,KAAK;;CAE5B,KAAK,OAAO,SAAiB;AAG3B,SAFa,IAAI,KAAK,KAAK,CAEf,QAAQ;;CAEvB,EACD,OACD;AAED,MAAMC,wCACJ;CACE,OAAO,SAAiB;AACtB,SAAOD,iBAAG,eAAe,KAAK;;CAEhC,WAAW;AACT,QAAM,IAAI,MAAM,uBAAuB;;CAE1C,EACD,OACD;AAED,eAAsB,OAAO,MAAgC;AAC3D,QAAOD,SAAO,KAAK;;;;;AC3BrB,MAAM,kCACJ;CACE,MAAM,OAAO,SAAiB;AAC5B,SAAOG,iBAAG,SAAS,MAAM,EAAE,UAAU,QAAQ,CAAC;;CAEhD,KAAK,OAAO,SAAiB;AAG3B,SAFa,IAAI,KAAK,KAAK,CAEf,MAAM;;CAErB,EACD,OACD;AAED,MAAM,sCACJ;CACE,OAAO,SAAiB;AACtB,SAAOA,iBAAG,aAAa,MAAM,EAAE,UAAU,QAAQ,CAAC;;CAEpD,WAAW;AACT,QAAM,IAAI,MAAM,uBAAuB;;CAE1C,EACD,OACD;AAED,eAAsB,KAAK,MAA+B;AACxD,QAAO,OAAO,KAAK;;AAGrB,SAAgB,SAAS,MAAsB;AAC7C,QAAO,WAAW,KAAK;;;;;AChCzB,eAAsB,OAAO,MAA6B;AACxD,QAAOC,iBAAG,OAAO,KAAK;;;;;ACDxB,SAAS,MAAM,MAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAK,KAAK;CAC5C,MAAM,0CAA2B,KAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,8BAJU,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK;;;;;;;;;AEvBd,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG"}
package/dist/fs.cjs DELETED
@@ -1,17 +0,0 @@
1
- const require_fs = require('./fs-RSVoUw3S.cjs');
2
- const require_write = require('./write-BJfM7G1_.cjs');
3
-
4
- Object.defineProperty(exports, 'KubbFile', {
5
- enumerable: true,
6
- get: function () {
7
- return require_fs.types_exports;
8
- }
9
- });
10
- exports.clean = require_fs.clean;
11
- exports.exists = require_fs.exists;
12
- exports.getRelativePath = require_fs.getRelativePath;
13
- exports.read = require_fs.read;
14
- exports.readSync = require_fs.readSync;
15
- exports.trimExtName = require_fs.trimExtName;
16
- exports.unlink = require_fs.unlink;
17
- exports.write = require_write.write;
package/dist/fs.d.cts DELETED
@@ -1,2 +0,0 @@
1
- import { c as types_d_exports, d as unlink, f as read, h as clean, l as write, m as exists, p as readSync, t as trimExtName, u as getRelativePath } from "./index-BmQIxvw0.cjs";
2
- export { types_d_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, unlink, write };
package/dist/fs.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { c as types_d_exports, d as unlink, f as read, h as clean, l as write, m as exists, p as readSync, t as trimExtName, u as getRelativePath } from "./index-BTe91LHd.js";
2
- export { types_d_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, unlink, write };
package/dist/fs.js DELETED
@@ -1,4 +0,0 @@
1
- import { a as read, c as clean, i as unlink, n as types_exports, o as readSync, r as getRelativePath, s as exists, t as trimExtName } from "./fs-BIPMUfpW.js";
2
- import { t as write } from "./write-CxO1CDML.js";
3
-
4
- export { types_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, unlink, write };