@kubb/core 3.17.1 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/{FileManager-Cj9zsnb4.cjs → FileManager-8HHGE4Dj.cjs} +41 -62
  2. package/dist/FileManager-8HHGE4Dj.cjs.map +1 -0
  3. package/dist/{FileManager-BXXRjW30.js → FileManager-QMZbSUsa.js} +38 -59
  4. package/dist/FileManager-QMZbSUsa.js.map +1 -0
  5. package/dist/{PluginManager-Cvj5AlsU.d.cts → PluginManager-C62HGihR.d.cts} +23 -2
  6. package/dist/{PluginManager-1jPxuyQK.d.ts → PluginManager-H8G0i6KS.d.ts} +24 -3
  7. package/dist/acorn-3HQnxDj2.js +5106 -0
  8. package/dist/acorn-3HQnxDj2.js.map +1 -0
  9. package/dist/acorn-Biw1D1Ce.cjs +5108 -0
  10. package/dist/acorn-Biw1D1Ce.cjs.map +1 -0
  11. package/dist/angular-B3ddRl90.cjs +3637 -0
  12. package/dist/angular-B3ddRl90.cjs.map +1 -0
  13. package/dist/angular-n5qYWkcx.js +3635 -0
  14. package/dist/angular-n5qYWkcx.js.map +1 -0
  15. package/dist/babel-BrKqHp9Q.cjs +10056 -0
  16. package/dist/babel-BrKqHp9Q.cjs.map +1 -0
  17. package/dist/babel-mOBF3g2e.js +10054 -0
  18. package/dist/babel-mOBF3g2e.js.map +1 -0
  19. package/dist/{chunk-DWy1uDak.cjs → chunk-DoeelZqw.cjs} +12 -0
  20. package/dist/estree-D6ftINJ3.cjs +6948 -0
  21. package/dist/estree-D6ftINJ3.cjs.map +1 -0
  22. package/dist/estree-QGbwcVbp.js +6944 -0
  23. package/dist/estree-QGbwcVbp.js.map +1 -0
  24. package/dist/flow-BWEc100n.cjs +52419 -0
  25. package/dist/flow-BWEc100n.cjs.map +1 -0
  26. package/dist/flow-C1RsRESZ.js +52417 -0
  27. package/dist/flow-C1RsRESZ.js.map +1 -0
  28. package/dist/{fs-BazSaf2y.cjs → fs-CeOer54w.cjs} +27 -15
  29. package/dist/fs-CeOer54w.cjs.map +1 -0
  30. package/dist/{fs-BacxV1CO.js → fs-DkMVXz_s.js} +21 -15
  31. package/dist/fs-DkMVXz_s.js.map +1 -0
  32. package/dist/fs.cjs +3 -2
  33. package/dist/fs.d.cts +2 -2
  34. package/dist/fs.d.ts +2 -2
  35. package/dist/fs.js +2 -2
  36. package/dist/glimmer-CwkHq8v_.cjs +7307 -0
  37. package/dist/glimmer-CwkHq8v_.cjs.map +1 -0
  38. package/dist/glimmer-DZXQWVfc.js +7303 -0
  39. package/dist/glimmer-DZXQWVfc.js.map +1 -0
  40. package/dist/graphql-DWNpg5AH.js +1902 -0
  41. package/dist/graphql-DWNpg5AH.js.map +1 -0
  42. package/dist/graphql-ftPsRNd8.cjs +1907 -0
  43. package/dist/graphql-ftPsRNd8.cjs.map +1 -0
  44. package/dist/html-DMFSHL-z.cjs +6563 -0
  45. package/dist/html-DMFSHL-z.cjs.map +1 -0
  46. package/dist/html-Lx7YOmUI.js +6558 -0
  47. package/dist/html-Lx7YOmUI.js.map +1 -0
  48. package/dist/{index-BfD6z1P5.d.cts → index-3smcdUnJ.d.ts} +11 -9
  49. package/dist/{index-Cb4pChs8.d.ts → index-B428LQ0Z.d.ts} +4 -5
  50. package/dist/{index-BKHQGQVq.d.ts → index-Bglrijef.d.cts} +12 -8
  51. package/dist/{index-D2ptHzfn.d.cts → index-DERUIhQK.d.cts} +3 -4
  52. package/dist/index.cjs +6 -6
  53. package/dist/index.d.cts +3 -3
  54. package/dist/index.d.ts +4 -4
  55. package/dist/index.js +3 -3
  56. package/dist/{logger-xcdTETKy.d.ts → logger-B-4AXUmB.d.ts} +1 -1
  57. package/dist/{logger-Cs45J4yy.js → logger-M0gDQMDh.js} +2 -2
  58. package/dist/{logger-Cs45J4yy.js.map → logger-M0gDQMDh.js.map} +1 -1
  59. package/dist/{logger-BxvJpQMX.cjs → logger-OgWv9Jyy.cjs} +4 -4
  60. package/dist/{logger-BxvJpQMX.cjs.map → logger-OgWv9Jyy.cjs.map} +1 -1
  61. package/dist/logger.cjs +2 -2
  62. package/dist/logger.d.ts +1 -1
  63. package/dist/logger.js +1 -1
  64. package/dist/markdown-BYsFO1cu.cjs +6761 -0
  65. package/dist/markdown-BYsFO1cu.cjs.map +1 -0
  66. package/dist/markdown-Dt7fmgWb.js +6756 -0
  67. package/dist/markdown-Dt7fmgWb.js.map +1 -0
  68. package/dist/meriyah-BA-YCwVg.cjs +8940 -0
  69. package/dist/meriyah-BA-YCwVg.cjs.map +1 -0
  70. package/dist/meriyah-CEYm-XS7.js +8938 -0
  71. package/dist/meriyah-CEYm-XS7.js.map +1 -0
  72. package/dist/mocks.cjs +16962 -11
  73. package/dist/mocks.cjs.map +1 -1
  74. package/dist/mocks.d.cts +2 -2
  75. package/dist/mocks.d.ts +3 -3
  76. package/dist/mocks.js +16963 -8
  77. package/dist/mocks.js.map +1 -1
  78. package/dist/postcss-BQcSCAcI.cjs +6723 -0
  79. package/dist/postcss-BQcSCAcI.cjs.map +1 -0
  80. package/dist/postcss-CI4qZzdL.js +6718 -0
  81. package/dist/postcss-CI4qZzdL.js.map +1 -0
  82. package/dist/{prompt-DwEAzq0q.js → prompt-D3dP3KNu.js} +1 -1
  83. package/dist/{prompt-DwEAzq0q.js.map → prompt-D3dP3KNu.js.map} +1 -1
  84. package/dist/{prompt-qiwl6Be9.cjs → prompt-DslNpUPc.cjs} +2 -2
  85. package/dist/{prompt-qiwl6Be9.cjs.map → prompt-DslNpUPc.cjs.map} +1 -1
  86. package/dist/{transformers-C7XTcwrX.cjs → transformers-BUNfHgNe.cjs} +2 -2
  87. package/dist/{transformers-C7XTcwrX.cjs.map → transformers-BUNfHgNe.cjs.map} +1 -1
  88. package/dist/transformers.cjs +2 -2
  89. package/dist/typescript-Bq-hjiJ0.js +3 -0
  90. package/dist/typescript-DDBRxbn7.cjs +23121 -0
  91. package/dist/typescript-DDBRxbn7.cjs.map +1 -0
  92. package/dist/typescript-DvVkagAX.cjs +4 -0
  93. package/dist/typescript-eE7YJ2-c.js +23109 -0
  94. package/dist/typescript-eE7YJ2-c.js.map +1 -0
  95. package/dist/utils.cjs +4 -4
  96. package/dist/utils.d.cts +3 -3
  97. package/dist/utils.d.ts +4 -4
  98. package/dist/utils.js +2 -2
  99. package/dist/{write-l_NzIqyy.cjs → write-cvT4uBev.cjs} +2 -2
  100. package/dist/{write-l_NzIqyy.cjs.map → write-cvT4uBev.cjs.map} +1 -1
  101. package/dist/yaml-DZASOrDL.js +5304 -0
  102. package/dist/yaml-DZASOrDL.js.map +1 -0
  103. package/dist/yaml-v1i11ZlS.cjs +5310 -0
  104. package/dist/yaml-v1i11ZlS.cjs.map +1 -0
  105. package/package.json +3 -4
  106. package/src/FileManager.ts +3 -7
  107. package/src/fs/index.ts +3 -2
  108. package/src/fs/unlink.ts +5 -0
  109. package/src/mocks/index.ts +7 -1
  110. package/src/types.ts +24 -4
  111. package/src/utils/parser.ts +2 -17
  112. package/dist/FileManager-BXXRjW30.js.map +0 -1
  113. package/dist/FileManager-Cj9zsnb4.cjs.map +0 -1
  114. package/dist/fs-BacxV1CO.js.map +0 -1
  115. package/dist/fs-BazSaf2y.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
1
+ const require_chunk = require('./chunk-DoeelZqw.cjs');
2
2
  const node_path = require_chunk.__toESM(require("node:path"));
3
3
  const fs_extra = require_chunk.__toESM(require("fs-extra"));
4
4
  const js_runtime = require_chunk.__toESM(require("js-runtime"));
@@ -9,53 +9,59 @@ async function clean(path) {
9
9
  }
10
10
 
11
11
  //#endregion
12
- //#region src/fs/read.ts
12
+ //#region src/fs/exists.ts
13
13
  const reader$1 = (0, js_runtime.switcher)({
14
14
  node: async (path) => {
15
- return fs_extra.default.readFile(path, { encoding: "utf8" });
15
+ return fs_extra.default.pathExists(path);
16
16
  },
17
17
  bun: async (path) => {
18
18
  const file = Bun.file(path);
19
- return file.text();
19
+ return file.exists();
20
20
  }
21
21
  }, "node");
22
22
  const syncReader$1 = (0, js_runtime.switcher)({
23
23
  node: (path) => {
24
- return fs_extra.default.readFileSync(path, { encoding: "utf8" });
24
+ return fs_extra.default.pathExistsSync(path);
25
25
  },
26
26
  bun: () => {
27
27
  throw new Error("Bun cannot read sync");
28
28
  }
29
29
  }, "node");
30
- async function read(path) {
30
+ async function exists(path) {
31
31
  return reader$1(path);
32
32
  }
33
- function readSync(path) {
34
- return syncReader$1(path);
35
- }
36
33
 
37
34
  //#endregion
38
- //#region src/fs/exists.ts
35
+ //#region src/fs/read.ts
39
36
  const reader = (0, js_runtime.switcher)({
40
37
  node: async (path) => {
41
- return fs_extra.default.pathExists(path);
38
+ return fs_extra.default.readFile(path, { encoding: "utf8" });
42
39
  },
43
40
  bun: async (path) => {
44
41
  const file = Bun.file(path);
45
- return file.exists();
42
+ return file.text();
46
43
  }
47
44
  }, "node");
48
45
  const syncReader = (0, js_runtime.switcher)({
49
46
  node: (path) => {
50
- return fs_extra.default.pathExistsSync(path);
47
+ return fs_extra.default.readFileSync(path, { encoding: "utf8" });
51
48
  },
52
49
  bun: () => {
53
50
  throw new Error("Bun cannot read sync");
54
51
  }
55
52
  }, "node");
56
- async function exists(path) {
53
+ async function read(path) {
57
54
  return reader(path);
58
55
  }
56
+ function readSync(path) {
57
+ return syncReader(path);
58
+ }
59
+
60
+ //#endregion
61
+ //#region src/fs/unlink.ts
62
+ async function unlink(path) {
63
+ return fs_extra.default.unlink(path);
64
+ }
59
65
 
60
66
  //#endregion
61
67
  //#region src/fs/utils.ts
@@ -126,4 +132,10 @@ Object.defineProperty(exports, 'types_exports', {
126
132
  return types_exports;
127
133
  }
128
134
  });
129
- //# sourceMappingURL=fs-BazSaf2y.cjs.map
135
+ Object.defineProperty(exports, 'unlink', {
136
+ enumerable: true,
137
+ get: function () {
138
+ return unlink;
139
+ }
140
+ });
141
+ //# sourceMappingURL=fs-CeOer54w.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-CeOer54w.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;AAClB;;;;ACDD,MAAMC,oCACJ;CACE,MAAM,OAAO,SAAiB;AAC5B,SAAOC,iBAAG,WAAW;CACtB;CACD,KAAK,OAAO,SAAiB;EAC3B,MAAM,OAAO,IAAI,KAAK;AAEtB,SAAO,KAAK;CACb;CACF,EACD;AAGF,MAAMC,wCACJ;CACE,OAAO,SAAiB;AACtB,SAAOD,iBAAG,eAAe;CAC1B;CACD,WAAW;AACT,QAAM,IAAI,MAAM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fs/read.ts
11
+ //#region src/fs/exists.ts
12
12
  const reader$1 = switcher({
13
13
  node: async (path$1) => {
14
- return fs.readFile(path$1, { encoding: "utf8" });
14
+ return fs.pathExists(path$1);
15
15
  },
16
16
  bun: async (path$1) => {
17
17
  const file = Bun.file(path$1);
18
- return file.text();
18
+ return file.exists();
19
19
  }
20
20
  }, "node");
21
21
  const syncReader$1 = switcher({
22
22
  node: (path$1) => {
23
- return fs.readFileSync(path$1, { encoding: "utf8" });
23
+ return fs.pathExistsSync(path$1);
24
24
  },
25
25
  bun: () => {
26
26
  throw new Error("Bun cannot read sync");
27
27
  }
28
28
  }, "node");
29
- async function read(path$1) {
29
+ async function exists(path$1) {
30
30
  return reader$1(path$1);
31
31
  }
32
- function readSync(path$1) {
33
- return syncReader$1(path$1);
34
- }
35
32
 
36
33
  //#endregion
37
- //#region src/fs/exists.ts
34
+ //#region src/fs/read.ts
38
35
  const reader = switcher({
39
36
  node: async (path$1) => {
40
- return fs.pathExists(path$1);
37
+ return fs.readFile(path$1, { encoding: "utf8" });
41
38
  },
42
39
  bun: async (path$1) => {
43
40
  const file = Bun.file(path$1);
44
- return file.exists();
41
+ return file.text();
45
42
  }
46
43
  }, "node");
47
44
  const syncReader = switcher({
48
45
  node: (path$1) => {
49
- return fs.pathExistsSync(path$1);
46
+ return fs.readFileSync(path$1, { encoding: "utf8" });
50
47
  },
51
48
  bun: () => {
52
49
  throw new Error("Bun cannot read sync");
53
50
  }
54
51
  }, "node");
55
- async function exists(path$1) {
52
+ async function read(path$1) {
56
53
  return reader(path$1);
57
54
  }
55
+ function readSync(path$1) {
56
+ return syncReader(path$1);
57
+ }
58
+
59
+ //#endregion
60
+ //#region src/fs/unlink.ts
61
+ async function unlink(path$1) {
62
+ return fs.unlink(path$1);
63
+ }
58
64
 
59
65
  //#endregion
60
66
  //#region src/fs/utils.ts
@@ -83,5 +89,5 @@ function trimExtName(text) {
83
89
  }
84
90
 
85
91
  //#endregion
86
- export { clean, exists, getRelativePath, read, readSync, trimExtName, types_exports };
87
- //# sourceMappingURL=fs-BacxV1CO.js.map
92
+ export { clean, exists, getRelativePath, read, readSync, trimExtName, types_exports, unlink };
93
+ //# sourceMappingURL=fs-DkMVXz_s.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-DkMVXz_s.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;AAClB;;;;ACDD,MAAMC,WAAS,SACb;CACE,MAAM,OAAO,WAAiB;AAC5B,SAAO,GAAG,WAAWC;CACtB;CACD,KAAK,OAAO,WAAiB;EAC3B,MAAM,OAAO,IAAI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O;AAGT,QAAO,KAAK;AACb;;;;;;;;AExBD,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa;AAClC"}
package/dist/fs.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_fs = require('./fs-BazSaf2y.cjs');
2
- const require_write = require('./write-l_NzIqyy.cjs');
1
+ const require_fs = require('./fs-CeOer54w.cjs');
2
+ const require_write = require('./write-cvT4uBev.cjs');
3
3
 
4
4
  Object.defineProperty(exports, 'KubbFile', {
5
5
  enumerable: true,
@@ -13,4 +13,5 @@ exports.getRelativePath = require_fs.getRelativePath;
13
13
  exports.read = require_fs.read;
14
14
  exports.readSync = require_fs.readSync;
15
15
  exports.trimExtName = require_fs.trimExtName;
16
+ exports.unlink = require_fs.unlink;
16
17
  exports.write = require_write.write;
package/dist/fs.d.cts CHANGED
@@ -1,2 +1,2 @@
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 };
1
+ import { clean, exists, getRelativePath, read, readSync, trimExtName, types_d_exports, unlink, write } from "./index-Bglrijef.cjs";
2
+ export { types_d_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, unlink, write };
package/dist/fs.d.ts CHANGED
@@ -1,2 +1,2 @@
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 };
1
+ import { clean, exists, getRelativePath, read, readSync, trimExtName, types_d_exports, unlink, write } from "./index-3smcdUnJ.js";
2
+ export { types_d_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, unlink, write };
package/dist/fs.js CHANGED
@@ -1,4 +1,4 @@
1
- import { clean, exists, getRelativePath, read, readSync, trimExtName, types_exports } from "./fs-BacxV1CO.js";
1
+ import { clean, exists, getRelativePath, read, readSync, trimExtName, types_exports, unlink } from "./fs-DkMVXz_s.js";
2
2
  import { write } from "./write-CLTPlucv.js";
3
3
 
4
- export { types_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, write };
4
+ export { types_exports as KubbFile, clean, exists, getRelativePath, read, readSync, trimExtName, unlink, write };