@kubb/core 3.16.2 → 3.16.4

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 (106) hide show
  1. package/dist/FileManager-Dk759iZ3.js +918 -0
  2. package/dist/FileManager-Dk759iZ3.js.map +1 -0
  3. package/dist/FileManager-DsRjYJa_.cjs +1031 -0
  4. package/dist/FileManager-DsRjYJa_.cjs.map +1 -0
  5. package/dist/PluginManager-1jPxuyQK.d.ts +511 -0
  6. package/dist/PluginManager-Cvj5AlsU.d.cts +511 -0
  7. package/dist/chunk-DWy1uDak.cjs +39 -0
  8. package/dist/chunk-DbvY3SJr.js +33 -0
  9. package/dist/fs-BacxV1CO.js +87 -0
  10. package/dist/fs-BacxV1CO.js.map +1 -0
  11. package/dist/fs-BazSaf2y.cjs +129 -0
  12. package/dist/fs-BazSaf2y.cjs.map +1 -0
  13. package/dist/fs.cjs +15 -39
  14. package/dist/fs.d.cts +2 -19
  15. package/dist/fs.d.ts +2 -19
  16. package/dist/fs.js +4 -3
  17. package/dist/index-BKHQGQVq.d.ts +140 -0
  18. package/dist/index-BfD6z1P5.d.cts +141 -0
  19. package/dist/index-Cb4pChs8.d.ts +180 -0
  20. package/dist/index-D2ptHzfn.d.cts +180 -0
  21. package/dist/index.cjs +997 -1077
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +107 -89
  24. package/dist/index.d.ts +107 -89
  25. package/dist/index.js +1020 -864
  26. package/dist/index.js.map +1 -1
  27. package/dist/logger-BxvJpQMX.cjs +1115 -0
  28. package/dist/logger-BxvJpQMX.cjs.map +1 -0
  29. package/dist/logger-Cs45J4yy.js +1085 -0
  30. package/dist/logger-Cs45J4yy.js.map +1 -0
  31. package/dist/logger-OWS6fqk0.d.cts +69 -0
  32. package/dist/logger-xcdTETKy.d.ts +69 -0
  33. package/dist/logger.cjs +6 -24
  34. package/dist/logger.d.cts +2 -3
  35. package/dist/logger.d.ts +2 -3
  36. package/dist/logger.js +4 -4
  37. package/dist/mocks.cjs +49 -65
  38. package/dist/mocks.cjs.map +1 -1
  39. package/dist/mocks.d.cts +6 -6
  40. package/dist/mocks.d.ts +6 -6
  41. package/dist/mocks.js +48 -59
  42. package/dist/mocks.js.map +1 -1
  43. package/dist/prompt-DwEAzq0q.js +853 -0
  44. package/dist/prompt-DwEAzq0q.js.map +1 -0
  45. package/dist/prompt-qiwl6Be9.cjs +855 -0
  46. package/dist/prompt-qiwl6Be9.cjs.map +1 -0
  47. package/dist/transformers-B3CHtwuB.cjs +948 -0
  48. package/dist/transformers-B3CHtwuB.cjs.map +1 -0
  49. package/dist/transformers-CJqBQFIl.js +829 -0
  50. package/dist/transformers-CJqBQFIl.js.map +1 -0
  51. package/dist/transformers.cjs +33 -88
  52. package/dist/transformers.d.cts +75 -54
  53. package/dist/transformers.d.ts +75 -54
  54. package/dist/transformers.js +4 -3
  55. package/dist/utils.cjs +20 -73
  56. package/dist/utils.d.cts +5 -126
  57. package/dist/utils.d.ts +5 -126
  58. package/dist/utils.js +6 -5
  59. package/dist/write-CLTPlucv.js +42 -0
  60. package/dist/write-CLTPlucv.js.map +1 -0
  61. package/dist/write-l_NzIqyy.cjs +48 -0
  62. package/dist/write-l_NzIqyy.cjs.map +1 -0
  63. package/package.json +25 -32
  64. package/src/BarrelManager.ts +1 -0
  65. package/src/PromiseManager.ts +1 -7
  66. package/src/build.ts +9 -11
  67. package/src/index.ts +5 -5
  68. package/src/logger.ts +10 -10
  69. package/src/utils/FunctionParams.ts +3 -1
  70. package/src/utils/TreeNode.ts +3 -1
  71. package/dist/PluginManager-E3SghPP9.d.cts +0 -458
  72. package/dist/PluginManager-PDmRCu9k.d.ts +0 -458
  73. package/dist/chunk-4V7HK7PT.js +0 -1199
  74. package/dist/chunk-4V7HK7PT.js.map +0 -1
  75. package/dist/chunk-BHSTNFNQ.cjs +0 -701
  76. package/dist/chunk-BHSTNFNQ.cjs.map +0 -1
  77. package/dist/chunk-CAZ37TGB.js +0 -918
  78. package/dist/chunk-CAZ37TGB.js.map +0 -1
  79. package/dist/chunk-E4XLCCPK.cjs +0 -170
  80. package/dist/chunk-E4XLCCPK.cjs.map +0 -1
  81. package/dist/chunk-GBYHPDPK.js +0 -595
  82. package/dist/chunk-GBYHPDPK.js.map +0 -1
  83. package/dist/chunk-L3A3DTAX.cjs +0 -1074
  84. package/dist/chunk-L3A3DTAX.cjs.map +0 -1
  85. package/dist/chunk-MCNA6SYG.cjs +0 -1231
  86. package/dist/chunk-MCNA6SYG.cjs.map +0 -1
  87. package/dist/chunk-YRPOID7E.js +0 -157
  88. package/dist/chunk-YRPOID7E.js.map +0 -1
  89. package/dist/fs.cjs.map +0 -1
  90. package/dist/fs.js.map +0 -1
  91. package/dist/logger-BWq-oJU_.d.cts +0 -63
  92. package/dist/logger-BWq-oJU_.d.ts +0 -63
  93. package/dist/logger.cjs.map +0 -1
  94. package/dist/logger.js.map +0 -1
  95. package/dist/parser-C1vOjVEd.d.ts +0 -41
  96. package/dist/parser-D6vU1kA9.d.cts +0 -41
  97. package/dist/prompt-ELTHGQK6.js +0 -753
  98. package/dist/prompt-ELTHGQK6.js.map +0 -1
  99. package/dist/prompt-U7M5G25C.cjs +0 -761
  100. package/dist/prompt-U7M5G25C.cjs.map +0 -1
  101. package/dist/transformers.cjs.map +0 -1
  102. package/dist/transformers.js.map +0 -1
  103. package/dist/types-CA8nQKwM.d.cts +0 -132
  104. package/dist/types-CA8nQKwM.d.ts +0 -132
  105. package/dist/utils.cjs.map +0 -1
  106. package/dist/utils.js.map +0 -1
@@ -0,0 +1,129 @@
1
+ const require_chunk = require('./chunk-DWy1uDak.cjs');
2
+ const node_path = require_chunk.__toESM(require("node:path"));
3
+ const fs_extra = require_chunk.__toESM(require("fs-extra"));
4
+ const js_runtime = require_chunk.__toESM(require("js-runtime"));
5
+
6
+ //#region src/fs/clean.ts
7
+ async function clean(path) {
8
+ return fs_extra.default.remove(path);
9
+ }
10
+
11
+ //#endregion
12
+ //#region src/fs/read.ts
13
+ const reader$1 = (0, js_runtime.switcher)({
14
+ node: async (path) => {
15
+ return fs_extra.default.readFile(path, { encoding: "utf8" });
16
+ },
17
+ bun: async (path) => {
18
+ const file = Bun.file(path);
19
+ return file.text();
20
+ }
21
+ }, "node");
22
+ const syncReader$1 = (0, js_runtime.switcher)({
23
+ node: (path) => {
24
+ return fs_extra.default.readFileSync(path, { encoding: "utf8" });
25
+ },
26
+ bun: () => {
27
+ throw new Error("Bun cannot read sync");
28
+ }
29
+ }, "node");
30
+ async function read(path) {
31
+ return reader$1(path);
32
+ }
33
+ function readSync(path) {
34
+ return syncReader$1(path);
35
+ }
36
+
37
+ //#endregion
38
+ //#region src/fs/exists.ts
39
+ const reader = (0, js_runtime.switcher)({
40
+ node: async (path) => {
41
+ return fs_extra.default.pathExists(path);
42
+ },
43
+ bun: async (path) => {
44
+ const file = Bun.file(path);
45
+ return file.exists();
46
+ }
47
+ }, "node");
48
+ const syncReader = (0, js_runtime.switcher)({
49
+ node: (path) => {
50
+ return fs_extra.default.pathExistsSync(path);
51
+ },
52
+ bun: () => {
53
+ throw new Error("Bun cannot read sync");
54
+ }
55
+ }, "node");
56
+ async function exists(path) {
57
+ return reader(path);
58
+ }
59
+
60
+ //#endregion
61
+ //#region src/fs/utils.ts
62
+ function slash(path, platform = "linux") {
63
+ const isWindowsPath = /^\\\\\?\\/.test(path);
64
+ const normalizedPath = (0, node_path.normalize)(path);
65
+ if (["linux", "mac"].includes(platform) && !isWindowsPath) return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
66
+ return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
67
+ }
68
+ function getRelativePath(rootDir, filePath, platform = "linux") {
69
+ if (!rootDir || !filePath) throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
70
+ const relativePath = (0, node_path.relative)(rootDir, filePath);
71
+ const slashedPath = slash(relativePath, platform);
72
+ if (slashedPath.startsWith("../")) return slashedPath;
73
+ return `./${slashedPath}`;
74
+ }
75
+
76
+ //#endregion
77
+ //#region src/fs/types.ts
78
+ var types_exports = {};
79
+
80
+ //#endregion
81
+ //#region src/fs/index.ts
82
+ function trimExtName(text) {
83
+ return text.replace(/\.[^/.]+$/, "");
84
+ }
85
+
86
+ //#endregion
87
+ Object.defineProperty(exports, 'clean', {
88
+ enumerable: true,
89
+ get: function () {
90
+ return clean;
91
+ }
92
+ });
93
+ Object.defineProperty(exports, 'exists', {
94
+ enumerable: true,
95
+ get: function () {
96
+ return exists;
97
+ }
98
+ });
99
+ Object.defineProperty(exports, 'getRelativePath', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return getRelativePath;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, 'read', {
106
+ enumerable: true,
107
+ get: function () {
108
+ return read;
109
+ }
110
+ });
111
+ Object.defineProperty(exports, 'readSync', {
112
+ enumerable: true,
113
+ get: function () {
114
+ return readSync;
115
+ }
116
+ });
117
+ Object.defineProperty(exports, 'trimExtName', {
118
+ enumerable: true,
119
+ get: function () {
120
+ return trimExtName;
121
+ }
122
+ });
123
+ Object.defineProperty(exports, 'types_exports', {
124
+ enumerable: true,
125
+ get: function () {
126
+ return types_exports;
127
+ }
128
+ });
129
+ //# sourceMappingURL=fs-BazSaf2y.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-BazSaf2y.cjs","names":["path: string","fs","reader","path: string","fs","syncReader","path: string","fs","path: string","platform: 'windows' | 'mac' | 'linux'","rootDir?: string | null","filePath?: string | null","text: string"],"sources":["../src/fs/clean.ts","../src/fs/read.ts","../src/fs/exists.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.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'\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 { 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 { read, readSync } from './read.ts'\nexport { write } from './write.ts'\nexport { exists } from './exists.ts'\nexport { getRelativePath } from './utils.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport * as KubbFile from './types.ts'\n"],"mappings":";;;;;;AAEA,eAAsB,MAAMA,MAA6B;AACvD,QAAOC,iBAAG,OAAO,KAAK;AACvB;;;;ACDD,MAAMC,oCACJ;CACE,MAAM,OAAOC,SAAiB;AAC5B,SAAOC,iBAAG,SAAS,MAAM,EAAE,UAAU,OAAQ,EAAC;CAC/C;CACD,KAAK,OAAOD,SAAiB;EAC3B,MAAM,OAAO,IAAI,KAAK,KAAK;AAE3B,SAAO,KAAK,MAAM;CACnB;AACF,GACD,OACD;AAED,MAAME,wCACJ;CACE,MAAM,CAACF,SAAiB;AACtB,SAAOC,iBAAG,aAAa,MAAM,EAAE,UAAU,OAAQ,EAAC;CACnD;CACD,KAAK,MAAM;AACT,QAAM,IAAI,MAAM;CACjB;AACF,GACD,OACD;AAED,eAAsB,KAAKD,MAA+B;AACxD,QAAOD,SAAO,KAAK;AACpB;AAED,SAAgB,SAASC,MAAsB;AAC7C,QAAOE,aAAW,KAAK;AACxB;;;;AChCD,MAAM,kCACJ;CACE,MAAM,OAAOC,SAAiB;AAC5B,SAAOC,iBAAG,WAAW,KAAK;CAC3B;CACD,KAAK,OAAOD,SAAiB;EAC3B,MAAM,OAAO,IAAI,KAAK,KAAK;AAE3B,SAAO,KAAK,QAAQ;CACrB;AACF,GACD,OACD;AAED,MAAM,sCACJ;CACE,MAAM,CAACA,SAAiB;AACtB,SAAOC,iBAAG,eAAe,KAAK;CAC/B;CACD,KAAK,MAAM;AACT,QAAM,IAAI,MAAM;CACjB;AACF,GACD,OACD;AAED,eAAsB,OAAOD,MAAgC;AAC3D,QAAO,OAAO,KAAK;AACpB;;;;AC7BD,SAAS,MAAME,MAAcC,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAK,KAAK;CAC5C,MAAM,0CAA2B,KAAK;AAEtC,KAAI,CAAC,SAAS,KAAM,EAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAChE;AAED,SAAgB,gBAAgBC,SAAyBC,UAA0BF,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,CAAC,oEAAoE,EAAE,WAAW,GAAG,CAAC,EAAE,YAAY,IAAI;CAG1H,MAAM,uCAAwB,SAAS,SAAS;CAIhD,MAAM,cAAc,MAAM,cAAc,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,CAAC,EAAE,EAAE,aAAa;AAC1B;;;;;;;;AEzBD,SAAgB,YAAYG,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG;AACrC"}
package/dist/fs.cjs CHANGED
@@ -1,40 +1,16 @@
1
- 'use strict';
1
+ const require_fs = require('./fs-BazSaf2y.cjs');
2
+ const require_write = require('./write-l_NzIqyy.cjs');
2
3
 
3
- var chunkE4XLCCPK_cjs = require('./chunk-E4XLCCPK.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "KubbFile", {
8
- enumerable: true,
9
- get: function () { return chunkE4XLCCPK_cjs.types_exports; }
10
- });
11
- Object.defineProperty(exports, "clean", {
12
- enumerable: true,
13
- get: function () { return chunkE4XLCCPK_cjs.clean; }
14
- });
15
- Object.defineProperty(exports, "exists", {
16
- enumerable: true,
17
- get: function () { return chunkE4XLCCPK_cjs.exists; }
18
- });
19
- Object.defineProperty(exports, "getRelativePath", {
20
- enumerable: true,
21
- get: function () { return chunkE4XLCCPK_cjs.getRelativePath; }
22
- });
23
- Object.defineProperty(exports, "read", {
24
- enumerable: true,
25
- get: function () { return chunkE4XLCCPK_cjs.read; }
26
- });
27
- Object.defineProperty(exports, "readSync", {
28
- enumerable: true,
29
- get: function () { return chunkE4XLCCPK_cjs.readSync; }
30
- });
31
- Object.defineProperty(exports, "trimExtName", {
32
- enumerable: true,
33
- get: function () { return chunkE4XLCCPK_cjs.trimExtName; }
34
- });
35
- Object.defineProperty(exports, "write", {
36
- enumerable: true,
37
- get: function () { return chunkE4XLCCPK_cjs.write; }
38
- });
39
- //# sourceMappingURL=fs.cjs.map
40
- //# sourceMappingURL=fs.cjs.map
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.write = require_write.write;
package/dist/fs.d.cts CHANGED
@@ -1,19 +1,2 @@
1
- export { t as KubbFile } from './types-CA8nQKwM.cjs';
2
-
3
- declare function clean(path: string): Promise<void>;
4
-
5
- declare function read(path: string): Promise<string>;
6
- declare function readSync(path: string): string;
7
-
8
- type Options = {
9
- sanity?: boolean;
10
- };
11
- declare function write(path: string, data: string, options?: Options): Promise<string | undefined>;
12
-
13
- declare function exists(path: string): Promise<boolean>;
14
-
15
- declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
16
-
17
- declare function trimExtName(text: string): string;
18
-
19
- export { clean, exists, getRelativePath, read, readSync, trimExtName, write };
1
+ import { clean, exists, getRelativePath, read, readSync, trimExtName, types_d_exports, write } from "./index-BfD6z1P5.cjs";
2
+ export { types_d_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, write };
package/dist/fs.d.ts CHANGED
@@ -1,19 +1,2 @@
1
- export { t as KubbFile } from './types-CA8nQKwM.js';
2
-
3
- declare function clean(path: string): Promise<void>;
4
-
5
- declare function read(path: string): Promise<string>;
6
- declare function readSync(path: string): string;
7
-
8
- type Options = {
9
- sanity?: boolean;
10
- };
11
- declare function write(path: string, data: string, options?: Options): Promise<string | undefined>;
12
-
13
- declare function exists(path: string): Promise<boolean>;
14
-
15
- declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
16
-
17
- declare function trimExtName(text: string): string;
18
-
19
- export { clean, exists, getRelativePath, read, readSync, trimExtName, write };
1
+ import { clean, exists, getRelativePath, read, readSync, trimExtName, types_d_exports, write } from "./index-BKHQGQVq.js";
2
+ export { types_d_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, write };
package/dist/fs.js CHANGED
@@ -1,3 +1,4 @@
1
- export { types_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, write } from './chunk-YRPOID7E.js';
2
- //# sourceMappingURL=fs.js.map
3
- //# sourceMappingURL=fs.js.map
1
+ import { clean, exists, getRelativePath, read, readSync, trimExtName, types_exports } from "./fs-BacxV1CO.js";
2
+ import { write } from "./write-CLTPlucv.js";
3
+
4
+ export { types_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, write };
@@ -0,0 +1,140 @@
1
+ //#region src/fs/clean.d.ts
2
+ declare function clean(path: string): Promise<void>;
3
+ //#endregion
4
+ //#region src/fs/read.d.ts
5
+ declare function read(path: string): Promise<string>;
6
+ declare function readSync(path: string): string;
7
+ //#endregion
8
+ //#region src/fs/write.d.ts
9
+ type Options = {
10
+ sanity?: boolean;
11
+ };
12
+ declare function write(path: string, data: string, options?: Options): Promise<string | undefined>;
13
+ //#endregion
14
+ //#region src/fs/exists.d.ts
15
+ declare function exists(path: string): Promise<boolean>;
16
+ //#endregion
17
+ //#region src/fs/utils.d.ts
18
+ declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
19
+ declare namespace types_d_exports {
20
+ export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
21
+ }
22
+ type BasePath<T extends string = string> = `${T}/`;
23
+ type Import = {
24
+ /**
25
+ * Import name to be used
26
+ * @example ["useState"]
27
+ * @example "React"
28
+ */
29
+ name: string | Array<string | {
30
+ propertyName: string;
31
+ name?: string;
32
+ }>;
33
+ /**
34
+ * Path for the import
35
+ * @example '@kubb/core'
36
+ */
37
+ path: string;
38
+ /**
39
+ * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
40
+ */
41
+ isTypeOnly?: boolean;
42
+ isNameSpace?: boolean;
43
+ /**
44
+ * When root is set it will get the path with relative getRelativePath(root, path).
45
+ */
46
+ root?: string;
47
+ };
48
+ type Source = {
49
+ name?: string;
50
+ value?: string;
51
+ isTypeOnly?: boolean;
52
+ /**
53
+ * Has const or type 'export'
54
+ * @default false
55
+ */
56
+ isExportable?: boolean;
57
+ /**
58
+ * When set, barrel generation will add this
59
+ * @default false
60
+ */
61
+ isIndexable?: boolean;
62
+ };
63
+ type Export = {
64
+ /**
65
+ * Export name to be used.
66
+ * @example ["useState"]
67
+ * @example "React"
68
+ */
69
+ name?: string | Array<string>;
70
+ /**
71
+ * Path for the import.
72
+ * @example '@kubb/core'
73
+ */
74
+ path: string;
75
+ /**
76
+ * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
77
+ */
78
+ isTypeOnly?: boolean;
79
+ /**
80
+ * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
81
+ */
82
+ asAlias?: boolean;
83
+ };
84
+ type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
85
+ type Mode = 'single' | 'split';
86
+ /**
87
+ * Name to be used to dynamicly create the baseName(based on input.path)
88
+ * Based on UNIX basename
89
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
90
+ */
91
+ type BaseName = `${string}.${string}`;
92
+ /**
93
+ * Path will be full qualified path to a specified file
94
+ */
95
+ type Path = string;
96
+ type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
97
+ type OptionalPath = Path | undefined | null;
98
+ type File<TMeta extends object = object> = {
99
+ /**
100
+ * Name to be used to create the path
101
+ * Based on UNIX basename, `${name}.extname`
102
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
103
+ */
104
+ baseName: BaseName;
105
+ /**
106
+ * Path will be full qualified path to a specified file
107
+ */
108
+ path: AdvancedPath<BaseName> | Path;
109
+ sources: Array<Source>;
110
+ imports?: Array<Import>;
111
+ exports?: Array<Export>;
112
+ /**
113
+ * Use extra meta, this is getting used to generate the barrel/index files.
114
+ */
115
+ meta?: TMeta;
116
+ banner?: string;
117
+ footer?: string;
118
+ };
119
+ type ResolvedImport = Import;
120
+ type ResolvedExport = Export;
121
+ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
122
+ /**
123
+ * @default object-hash
124
+ */
125
+ id: string;
126
+ /**
127
+ * Contains the first part of the baseName, generated based on baseName
128
+ * @link https://nodejs.org/api/path.html#pathformatpathobject
129
+ */
130
+ name: string;
131
+ extname: Extname;
132
+ imports: Array<ResolvedImport>;
133
+ exports: Array<ResolvedExport>;
134
+ };
135
+ //#endregion
136
+ //#region src/fs/index.d.ts
137
+ declare function trimExtName(text: string): string;
138
+ //#endregion
139
+ export { BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, clean, exists, getRelativePath, read, readSync, trimExtName, types_d_exports, write };
140
+ //# sourceMappingURL=index-BKHQGQVq.d.ts.map
@@ -0,0 +1,141 @@
1
+ //#endregion
2
+ //#region src/fs/clean.d.ts
3
+ declare function clean(path: string): Promise<void>;
4
+ //#endregion
5
+ //#region src/fs/read.d.ts
6
+ declare function read(path: string): Promise<string>;
7
+ declare function readSync(path: string): string;
8
+ //#endregion
9
+ //#region src/fs/write.d.ts
10
+ type Options = {
11
+ sanity?: boolean;
12
+ };
13
+ declare function write(path: string, data: string, options?: Options): Promise<string | undefined>;
14
+ //#endregion
15
+ //#region src/fs/exists.d.ts
16
+ declare function exists(path: string): Promise<boolean>;
17
+ //#endregion
18
+ //#region src/fs/utils.d.ts
19
+ declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
20
+ declare namespace types_d_exports {
21
+ export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
22
+ }
23
+ type BasePath<T extends string = string> = `${T}/`;
24
+ type Import = {
25
+ /**
26
+ * Import name to be used
27
+ * @example ["useState"]
28
+ * @example "React"
29
+ */
30
+ name: string | Array<string | {
31
+ propertyName: string;
32
+ name?: string;
33
+ }>;
34
+ /**
35
+ * Path for the import
36
+ * @example '@kubb/core'
37
+ */
38
+ path: string;
39
+ /**
40
+ * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
41
+ */
42
+ isTypeOnly?: boolean;
43
+ isNameSpace?: boolean;
44
+ /**
45
+ * When root is set it will get the path with relative getRelativePath(root, path).
46
+ */
47
+ root?: string;
48
+ };
49
+ type Source = {
50
+ name?: string;
51
+ value?: string;
52
+ isTypeOnly?: boolean;
53
+ /**
54
+ * Has const or type 'export'
55
+ * @default false
56
+ */
57
+ isExportable?: boolean;
58
+ /**
59
+ * When set, barrel generation will add this
60
+ * @default false
61
+ */
62
+ isIndexable?: boolean;
63
+ };
64
+ type Export = {
65
+ /**
66
+ * Export name to be used.
67
+ * @example ["useState"]
68
+ * @example "React"
69
+ */
70
+ name?: string | Array<string>;
71
+ /**
72
+ * Path for the import.
73
+ * @example '@kubb/core'
74
+ */
75
+ path: string;
76
+ /**
77
+ * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
78
+ */
79
+ isTypeOnly?: boolean;
80
+ /**
81
+ * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
82
+ */
83
+ asAlias?: boolean;
84
+ };
85
+ type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
86
+ type Mode = 'single' | 'split';
87
+ /**
88
+ * Name to be used to dynamicly create the baseName(based on input.path)
89
+ * Based on UNIX basename
90
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
91
+ */
92
+ type BaseName = `${string}.${string}`;
93
+ /**
94
+ * Path will be full qualified path to a specified file
95
+ */
96
+ type Path = string;
97
+ type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
98
+ type OptionalPath = Path | undefined | null;
99
+ type File<TMeta extends object = object> = {
100
+ /**
101
+ * Name to be used to create the path
102
+ * Based on UNIX basename, `${name}.extname`
103
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
104
+ */
105
+ baseName: BaseName;
106
+ /**
107
+ * Path will be full qualified path to a specified file
108
+ */
109
+ path: AdvancedPath<BaseName> | Path;
110
+ sources: Array<Source>;
111
+ imports?: Array<Import>;
112
+ exports?: Array<Export>;
113
+ /**
114
+ * Use extra meta, this is getting used to generate the barrel/index files.
115
+ */
116
+ meta?: TMeta;
117
+ banner?: string;
118
+ footer?: string;
119
+ };
120
+ type ResolvedImport = Import;
121
+ type ResolvedExport = Export;
122
+ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
123
+ /**
124
+ * @default object-hash
125
+ */
126
+ id: string;
127
+ /**
128
+ * Contains the first part of the baseName, generated based on baseName
129
+ * @link https://nodejs.org/api/path.html#pathformatpathobject
130
+ */
131
+ name: string;
132
+ extname: Extname;
133
+ imports: Array<ResolvedImport>;
134
+ exports: Array<ResolvedExport>;
135
+ };
136
+ //#endregion
137
+ //#region src/fs/index.d.ts
138
+ declare function trimExtName(text: string): string;
139
+ //#endregion
140
+ export { BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, clean, exists, getRelativePath, read, readSync, trimExtName, types_d_exports, write };
141
+ //# sourceMappingURL=index-BfD6z1P5.d.cts.map