@kubb/core 4.4.0 → 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.
- package/dist/{URLPath-Bpc_OJmh.js → URLPath-DbWtfVa1.js} +2 -2
- package/dist/{URLPath-Bpc_OJmh.js.map → URLPath-DbWtfVa1.js.map} +1 -1
- package/dist/{URLPath-Bu6Wkco7.cjs → URLPath-Dir2mxRT.cjs} +2 -2
- package/dist/{URLPath-Bu6Wkco7.cjs.map → URLPath-Dir2mxRT.cjs.map} +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +5 -5
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +87 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +79 -8
- package/dist/index.js.map +1 -1
- package/dist/{logger-C7JFdYpj.cjs → logger-BIzTtBYJ.cjs} +47 -4
- package/dist/logger-BIzTtBYJ.cjs.map +1 -0
- package/dist/{logger-DpoDtxfo.d.cts → logger-BjfDkvkn.d.cts} +1 -1
- package/dist/{logger-D_jvWsUF.d.ts → logger-BwhJWK-H.d.ts} +1 -1
- package/dist/{logger-khF_Lft4.js → logger-Bxe022ug.js} +39 -4
- package/dist/logger-Bxe022ug.js.map +1 -0
- package/dist/logger.cjs +1 -2
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +1 -2
- package/dist/{prompt-CgJLZzbf.cjs → prompt-D5DZPtWc.cjs} +1 -1
- package/dist/{prompt-CgJLZzbf.cjs.map → prompt-D5DZPtWc.cjs.map} +1 -1
- package/dist/{prompt-CIpZjUDy.js → prompt-xM0onfy8.js} +1 -1
- package/dist/{prompt-CIpZjUDy.js.map → prompt-xM0onfy8.js.map} +1 -1
- package/dist/{transformers-BN5jfIAt.js → transformers-CeNW0G32.js} +1 -1
- package/dist/{transformers-BN5jfIAt.js.map → transformers-CeNW0G32.js.map} +1 -1
- package/dist/{transformers-BpnIvSiH.cjs → transformers-DWLXDYKb.cjs} +1 -1
- package/dist/{transformers-BpnIvSiH.cjs.map → transformers-DWLXDYKb.cjs.map} +1 -1
- package/dist/transformers.cjs +1 -1
- package/dist/transformers.js +1 -1
- package/dist/{types-CCUiy4jG.d.ts → types-CVONMhN_.d.cts} +14 -14
- package/dist/{types-EV6-sImo.d.cts → types-CyDeSlGF.d.ts} +14 -14
- package/dist/{types-ClXc6HFo.d.ts → types-DCR_QgGt.d.ts} +1 -1
- package/dist/{types-C3ea5qNG.d.cts → types-DueAg3XP.d.cts} +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +12 -11
- package/src/BarrelManager.ts +1 -1
- package/src/FileManager.ts +5 -2
- package/src/PluginManager.ts +1 -1
- package/src/build.ts +2 -1
- package/src/fs/index.ts +0 -7
- package/src/hooks/useMode.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/TreeNode.ts +1 -1
- package/dist/fs-BIPMUfpW.js +0 -90
- package/dist/fs-BIPMUfpW.js.map +0 -1
- package/dist/fs-CM7ohZSu.cjs +0 -141
- package/dist/fs-CM7ohZSu.cjs.map +0 -1
- package/dist/fs.cjs +0 -17
- package/dist/fs.d.cts +0 -2
- package/dist/fs.d.ts +0 -2
- package/dist/fs.js +0 -4
- package/dist/index-BmQIxvw0.d.cts +0 -144
- package/dist/index-DdO15F70.d.ts +0 -144
- package/dist/logger-C7JFdYpj.cjs.map +0 -1
- package/dist/logger-khF_Lft4.js.map +0 -1
- package/dist/write-BsFt8M9e.cjs +0 -49
- package/dist/write-BsFt8M9e.cjs.map +0 -1
- package/dist/write-CxO1CDML.js +0 -40
- package/dist/write-CxO1CDML.js.map +0 -1
- package/src/fs/types.ts +0 -132
- package/src/fs/unlink.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as camelCase, v as isValidVarName } from "./transformers-
|
|
1
|
+
import { m as camelCase, v as isValidVarName } from "./transformers-CeNW0G32.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/uniqueName.ts
|
|
4
4
|
function getUniqueName(originalName, data) {
|
|
@@ -113,4 +113,4 @@ var URLPath = class {
|
|
|
113
113
|
|
|
114
114
|
//#endregion
|
|
115
115
|
export { getUniqueName as n, setUniqueName as r, URLPath as t };
|
|
116
|
-
//# sourceMappingURL=URLPath-
|
|
116
|
+
//# sourceMappingURL=URLPath-DbWtfVa1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLPath-
|
|
1
|
+
{"version":3,"file":"URLPath-DbWtfVa1.js","names":["#options","params: Record<string, string>"],"sources":["../src/utils/uniqueName.ts","../src/utils/URLPath.ts"],"sourcesContent":["export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n\n return originalName\n }\n data[originalName] = 1\n return originalName\n}\n","import { camelCase, isValidVarName } from '../transformers'\n\nexport type URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\ntype Options = {\n casing?: 'camelcase'\n}\n\nexport class URLPath {\n path: string\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n\n return this\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isURL(): boolean {\n try {\n const url = new URL(this.path)\n if (url?.href) {\n return true\n }\n } catch (_error) {\n return false\n }\n return false\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n let newPath = this.path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, path) => {\n const pathWithoutBrackets = path.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(pathWithoutBrackets) ? pathWithoutBrackets : camelCase(pathWithoutBrackets)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n return prev.replace(path, `\\${${replacer ? replacer(param) : param}}`)\n }, this.path)\n }\n\n return `\\`${prefix}${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(item) ? item : camelCase(item)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n const key = replacer ? replacer(param) : param\n\n params[key] = key\n }, this.path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return this.path.replaceAll('{', ':').replaceAll('}', '')\n }\n}\n"],"mappings":";;;AAAA,SAAgB,cAAc,cAAsB,MAAsC;CACxF,IAAI,OAAO,KAAK,iBAAiB;AACjC,KAAI,MAAM;AACR,OAAK,gBAAgB,EAAE;AACvB,kBAAgB;;AAElB,MAAK,gBAAgB;AACrB,QAAO;;AAGT,SAAgB,cAAc,cAAsB,MAAsC;CACxF,IAAI,OAAO,KAAK,iBAAiB;AACjC,KAAI,MAAM;AACR,OAAK,gBAAgB,EAAE;AAEvB,SAAO;;AAET,MAAK,gBAAgB;AACrB,QAAO;;;;;ACDT,IAAa,UAAb,MAAqB;CACnB;CACA;CAEA,YAAY,MAAc,UAAmB,EAAE,EAAE;AAC/C,OAAK,OAAO;AACZ,QAAKA,UAAW;AAEhB,SAAO;;;;;;CAOT,IAAI,MAAc;AAChB,SAAO,KAAK,WAAW;;CAEzB,IAAI,QAAiB;AACnB,MAAI;AAEF,OADY,IAAI,IAAI,KAAK,KAAK,EACrB,KACP,QAAO;WAEF,QAAQ;AACf,UAAO;;AAET,SAAO;;;;;;;;CAST,IAAI,WAAmB;AACrB,SAAO,KAAK,kBAAkB;;CAEhC,IAAI,SAA6B;AAC/B,SAAO,KAAK,UAAU;;CAExB,IAAI,SAA6C;AAC/C,SAAO,KAAK,WAAW;;CAGzB,SAAS,EAAE,OAAO,QAAQ,UAAU,cAA6B,EAAE,EAAsB;EACvF,MAAM,SAAS;GACb,KAAK,SAAS,SAAS,KAAK,WAAW,GAAG,KAAK,iBAAiB,EAAE,UAAU,CAAC;GAC7E,QAAQ,KAAK,WAAW;GACzB;AAED,MAAI,WAAW;AACb,OAAI,SAAS,WACX,QAAO,KAA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W,KAAK,GAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_transformers = require('./transformers-
|
|
1
|
+
const require_transformers = require('./transformers-DWLXDYKb.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/utils/uniqueName.ts
|
|
4
4
|
function getUniqueName(originalName, data) {
|
|
@@ -130,4 +130,4 @@ Object.defineProperty(exports, 'setUniqueName', {
|
|
|
130
130
|
return setUniqueName;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
-
//# sourceMappingURL=URLPath-
|
|
133
|
+
//# sourceMappingURL=URLPath-Dir2mxRT.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLPath-
|
|
1
|
+
{"version":3,"file":"URLPath-Dir2mxRT.cjs","names":["#options","isValidVarName","camelCase","params: Record<string, string>"],"sources":["../src/utils/uniqueName.ts","../src/utils/URLPath.ts"],"sourcesContent":["export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n\n return originalName\n }\n data[originalName] = 1\n return originalName\n}\n","import { camelCase, isValidVarName } from '../transformers'\n\nexport type URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\ntype Options = {\n casing?: 'camelcase'\n}\n\nexport class URLPath {\n path: string\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n\n return this\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isURL(): boolean {\n try {\n const url = new URL(this.path)\n if (url?.href) {\n return true\n }\n } catch (_error) {\n return false\n }\n return false\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n let newPath = this.path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, path) => {\n const pathWithoutBrackets = path.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(pathWithoutBrackets) ? pathWithoutBrackets : camelCase(pathWithoutBrackets)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n return prev.replace(path, `\\${${replacer ? replacer(param) : param}}`)\n }, this.path)\n }\n\n return `\\`${prefix}${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(item) ? item : camelCase(item)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n const key = replacer ? replacer(param) : param\n\n params[key] = key\n }, this.path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return this.path.replaceAll('{', ':').replaceAll('}', '')\n }\n}\n"],"mappings":";;;AAAA,SAAgB,cAAc,cAAsB,MAAsC;CACxF,IAAI,OAAO,KAAK,iBAAiB;AACjC,KAAI,MAAM;AACR,OAAK,gBAAgB,EAAE;AACvB,kBAAgB;;AAElB,MAAK,gBAAgB;AACrB,QAAO;;AAGT,SAAgB,cAAc,cAAsB,MAAsC;CACxF,IAAI,OAAO,KAAK,iBAAiB;AACjC,KAAI,MAAM;AACR,OAAK,gBAAgB,EAAE;AAEvB,SAAO;;AAET,MAAK,gBAAgB;AACrB,QAAO;;;;;ACDT,IAAa,UAAb,MAAqB;CACnB;CACA;CAEA,YAAY,MAAc,UAAmB,EAAE,EAAE;AAC/C,OAAK,OAAO;AACZ,QAAKA,UAAW;AAEhB,SAAO;;;;;;CAOT,IAAI,MAAc;AAChB,SAAO,KAAK,WAAW;;CAEzB,IAAI,QAAiB;AACnB,MAAI;AAEF,OADY,IAAI,IAAI,KAAK,KAAK,EACrB,KACP,QAAO;WAEF,QAAQ;AACf,UAAO;;AAET,SAAO;;;;;;;;CAST,IAAI,WAAmB;AACrB,SAAO,KAAK,kBAAkB;;CAEhC,IAAI,SAA6B;AAC/B,SAAO,KAAK,UAAU;;CAExB,IAAI,SAA6C;AAC/C,SAAO,KAAK,WAAW;;CAGzB,SAAS,EAAE,OAAO,QAAQ,UAAU,cAA6B,EAAE,EAAsB;EACvF,MAAM,SAAS;GACb,KAAK,SAAS,SAAS,KAAK,WAAW,GAAG,KAAK,iBAAiB,EAAE,UAAU,CAAC;GAC7E,QAAQ,KAAK,WAAW;GACzB;AAED,MAAI,WA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AAO,KAAK,KAAK,WAAW,KAAK,IAAI,CAAC,WAAW,KAAK,GAAG"}
|
package/dist/hooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useMode(): KubbFile.Mode {\n const { meta } = useApp<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useApp<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\nexport function usePluginManager(): PluginManager {\n const { meta } = useApp<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":";;;;;AAGA,SAAgB,UAAyB;CACvC,MAAM,EAAE,0CAA0C;AAElD,QAAO,KAAK;;;;;ACHd,SAAgB,YAA4F;CAC1G,MAAM,EAAE,0CAA+C;AAEvD,QAAO,KAAK;;;;;ACHd,SAAgB,mBAAkC;CAChD,MAAM,EAAE,0CAAmD;AAE3D,QAAO,KAAK"}
|
package/dist/hooks.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
1
|
+
import "./logger-BjfDkvkn.cjs";
|
|
2
|
+
import { c as Plugin, u as PluginFactoryOptions, x as PluginManager } from "./types-CVONMhN_.cjs";
|
|
3
|
+
import "./types-DueAg3XP.cjs";
|
|
4
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
5
5
|
|
|
6
6
|
//#region src/hooks/useMode.d.ts
|
|
7
|
-
declare function useMode(): Mode;
|
|
7
|
+
declare function useMode(): KubbFile.Mode;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/hooks/usePlugin.d.ts
|
|
10
10
|
declare function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions>;
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
1
|
+
import "./logger-BwhJWK-H.js";
|
|
2
|
+
import { c as Plugin, u as PluginFactoryOptions, x as PluginManager } from "./types-CyDeSlGF.js";
|
|
3
|
+
import "./types-DCR_QgGt.js";
|
|
4
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
5
5
|
|
|
6
6
|
//#region src/hooks/useMode.d.ts
|
|
7
|
-
declare function useMode(): Mode;
|
|
7
|
+
declare function useMode(): KubbFile.Mode;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/hooks/usePlugin.d.ts
|
|
10
10
|
declare function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions>;
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useMode(): KubbFile.Mode {\n const { meta } = useApp<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useApp<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\nexport function usePluginManager(): PluginManager {\n const { meta } = useApp<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":";;;AAGA,SAAgB,UAAyB;CACvC,MAAM,EAAE,SAAS,QAAiC;AAElD,QAAO,KAAK;;;;;ACHd,SAAgB,YAA4F;CAC1G,MAAM,EAAE,SAAS,QAAsC;AAEvD,QAAO,KAAK;;;;;ACHd,SAAgB,mBAAkC;CAChD,MAAM,EAAE,SAAS,QAA0C;AAE3D,QAAO,KAAK"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_transformers = require('./transformers-BpnIvSiH.cjs');
|
|
7
|
-
const require_URLPath = require('./URLPath-Bu6Wkco7.cjs');
|
|
3
|
+
const require_logger = require('./logger-BIzTtBYJ.cjs');
|
|
4
|
+
const require_transformers = require('./transformers-DWLXDYKb.cjs');
|
|
5
|
+
const require_URLPath = require('./URLPath-Dir2mxRT.cjs');
|
|
8
6
|
let node_path = require("node:path");
|
|
9
7
|
node_path = require_chunk.__toESM(node_path);
|
|
10
8
|
let __kubb_react_fabric = require("@kubb/react-fabric");
|
|
@@ -17,6 +15,10 @@ let picocolors = require("picocolors");
|
|
|
17
15
|
picocolors = require_chunk.__toESM(picocolors);
|
|
18
16
|
let remeda = require("remeda");
|
|
19
17
|
remeda = require_chunk.__toESM(remeda);
|
|
18
|
+
let fs_extra = require("fs-extra");
|
|
19
|
+
fs_extra = require_chunk.__toESM(fs_extra);
|
|
20
|
+
let js_runtime = require("js-runtime");
|
|
21
|
+
js_runtime = require_chunk.__toESM(js_runtime);
|
|
20
22
|
let node_process = require("node:process");
|
|
21
23
|
node_process = require_chunk.__toESM(node_process);
|
|
22
24
|
let node_module = require("node:module");
|
|
@@ -69,6 +71,74 @@ function isInputPath(result) {
|
|
|
69
71
|
return !!result && "path" in result?.input;
|
|
70
72
|
}
|
|
71
73
|
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/fs/clean.ts
|
|
76
|
+
async function clean(path$3) {
|
|
77
|
+
return fs_extra.default.remove(path$3);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/fs/exists.ts
|
|
82
|
+
const reader$1 = (0, js_runtime.switcher)({
|
|
83
|
+
node: async (path$3) => {
|
|
84
|
+
return fs_extra.default.pathExists(path$3);
|
|
85
|
+
},
|
|
86
|
+
bun: async (path$3) => {
|
|
87
|
+
return Bun.file(path$3).exists();
|
|
88
|
+
}
|
|
89
|
+
}, "node");
|
|
90
|
+
const syncReader$1 = (0, js_runtime.switcher)({
|
|
91
|
+
node: (path$3) => {
|
|
92
|
+
return fs_extra.default.pathExistsSync(path$3);
|
|
93
|
+
},
|
|
94
|
+
bun: () => {
|
|
95
|
+
throw new Error("Bun cannot read sync");
|
|
96
|
+
}
|
|
97
|
+
}, "node");
|
|
98
|
+
async function exists(path$3) {
|
|
99
|
+
return reader$1(path$3);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/fs/read.ts
|
|
104
|
+
const reader = (0, js_runtime.switcher)({
|
|
105
|
+
node: async (path$3) => {
|
|
106
|
+
return fs_extra.default.readFile(path$3, { encoding: "utf8" });
|
|
107
|
+
},
|
|
108
|
+
bun: async (path$3) => {
|
|
109
|
+
return Bun.file(path$3).text();
|
|
110
|
+
}
|
|
111
|
+
}, "node");
|
|
112
|
+
const syncReader = (0, js_runtime.switcher)({
|
|
113
|
+
node: (path$3) => {
|
|
114
|
+
return fs_extra.default.readFileSync(path$3, { encoding: "utf8" });
|
|
115
|
+
},
|
|
116
|
+
bun: () => {
|
|
117
|
+
throw new Error("Bun cannot read sync");
|
|
118
|
+
}
|
|
119
|
+
}, "node");
|
|
120
|
+
async function read(path$3) {
|
|
121
|
+
return reader(path$3);
|
|
122
|
+
}
|
|
123
|
+
function readSync(path$3) {
|
|
124
|
+
return syncReader(path$3);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/fs/utils.ts
|
|
129
|
+
function slash(path$3, platform = "linux") {
|
|
130
|
+
const isWindowsPath = /^\\\\\?\\/.test(path$3);
|
|
131
|
+
const normalizedPath = (0, node_path.normalize)(path$3);
|
|
132
|
+
if (["linux", "mac"].includes(platform) && !isWindowsPath) return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
|
|
133
|
+
return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
|
|
134
|
+
}
|
|
135
|
+
function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
136
|
+
if (!rootDir || !filePath) throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
|
|
137
|
+
const slashedPath = slash((0, node_path.relative)(rootDir, filePath), platform);
|
|
138
|
+
if (slashedPath.startsWith("../")) return slashedPath;
|
|
139
|
+
return `./${slashedPath}`;
|
|
140
|
+
}
|
|
141
|
+
|
|
72
142
|
//#endregion
|
|
73
143
|
//#region src/errors.ts
|
|
74
144
|
var ValidationPluginError = class extends Error {};
|
|
@@ -741,7 +811,7 @@ async function setup(options) {
|
|
|
741
811
|
const { config: userConfig, logger = require_logger.createLogger() } = options;
|
|
742
812
|
if (Array.isArray(userConfig.input)) console.warn(picocolors.default.yellow("This feature is still under development — use with caution"));
|
|
743
813
|
try {
|
|
744
|
-
if (isInputPath(userConfig) && !new require_URLPath.URLPath(userConfig.input.path).isURL) await
|
|
814
|
+
if (isInputPath(userConfig) && !new require_URLPath.URLPath(userConfig.input.path).isURL) await exists(userConfig.input.path);
|
|
745
815
|
} catch (e) {
|
|
746
816
|
if (isInputPath(userConfig)) throw new Error(`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${userConfig.input.path}`, { cause: e });
|
|
747
817
|
}
|
|
@@ -758,8 +828,8 @@ async function setup(options) {
|
|
|
758
828
|
plugins: userConfig.plugins
|
|
759
829
|
};
|
|
760
830
|
if (definedConfig.output.clean) {
|
|
761
|
-
await
|
|
762
|
-
await
|
|
831
|
+
await clean(definedConfig.output.path);
|
|
832
|
+
await clean((0, node_path.join)(definedConfig.root, ".kubb"));
|
|
763
833
|
}
|
|
764
834
|
const fabric = (0, __kubb_react_fabric.createFabric)();
|
|
765
835
|
fabric.use(__kubb_react_fabric_plugins.fsPlugin, { dryRun: !definedConfig.output.write });
|
|
@@ -810,7 +880,7 @@ async function safeBuild(options, overrides) {
|
|
|
810
880
|
if (!pluginOptions || pluginOptions?.output?.barrelType === false) return;
|
|
811
881
|
return {
|
|
812
882
|
name: config.output.barrelType === "all" ? void 0 : [source.name],
|
|
813
|
-
path:
|
|
883
|
+
path: getRelativePath(rootPath, file.path),
|
|
814
884
|
isTypeOnly: config.output.barrelType === "all" ? containsOnlyTypes : source.isTypeOnly
|
|
815
885
|
};
|
|
816
886
|
}).filter(Boolean);
|
|
@@ -833,7 +903,7 @@ async function safeBuild(options, overrides) {
|
|
|
833
903
|
id: "files",
|
|
834
904
|
message
|
|
835
905
|
});
|
|
836
|
-
if (source) await
|
|
906
|
+
if (source) await require_logger.write(file.path, source, { sanity: false });
|
|
837
907
|
});
|
|
838
908
|
fabric.context.events.on("process:end", () => {
|
|
839
909
|
pluginManager.logger.emit("progress_stop", { id: "files" });
|
|
@@ -1012,7 +1082,7 @@ var BarrelManager = class {
|
|
|
1012
1082
|
if (!barrelFile.exports) barrelFile.exports = [];
|
|
1013
1083
|
if (!!treeNode.parent?.data.path?.split?.("/")?.length) barrelFile.exports.push({
|
|
1014
1084
|
name: [source.name],
|
|
1015
|
-
path:
|
|
1085
|
+
path: getRelativePath(treeNode.parent?.data.path, item.data.path),
|
|
1016
1086
|
isTypeOnly: source.isTypeOnly
|
|
1017
1087
|
});
|
|
1018
1088
|
else barrelFile.exports.push({
|
|
@@ -1044,11 +1114,14 @@ function getMode(path$3) {
|
|
|
1044
1114
|
if (!path$3) return "split";
|
|
1045
1115
|
return (0, node_path.extname)(path$3) ? "single" : "split";
|
|
1046
1116
|
}
|
|
1117
|
+
function trimExtName(text) {
|
|
1118
|
+
return text.replace(/\.[^/.]+$/, "");
|
|
1119
|
+
}
|
|
1047
1120
|
async function getBarrelFiles(files, { type, meta = {}, root, output, logger }) {
|
|
1048
1121
|
if (!type || type === "propagate") return [];
|
|
1049
1122
|
const barrelManager = new BarrelManager({ logger });
|
|
1050
1123
|
const pathToBuildFrom = (0, node_path.join)(root, output.path);
|
|
1051
|
-
if (
|
|
1124
|
+
if (trimExtName(pathToBuildFrom).endsWith("index")) {
|
|
1052
1125
|
logger?.emit("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation");
|
|
1053
1126
|
return [];
|
|
1054
1127
|
}
|
|
@@ -1290,13 +1363,13 @@ var PackageManager = class PackageManager {
|
|
|
1290
1363
|
async getPackageJSON() {
|
|
1291
1364
|
const pkgPath = await findUp(["package.json"], { cwd: this.#cwd });
|
|
1292
1365
|
if (!pkgPath) return;
|
|
1293
|
-
const json = await
|
|
1366
|
+
const json = await read(pkgPath);
|
|
1294
1367
|
return JSON.parse(json);
|
|
1295
1368
|
}
|
|
1296
1369
|
getPackageJSONSync() {
|
|
1297
1370
|
const pkgPath = findUpSync(["package.json"], { cwd: this.#cwd });
|
|
1298
1371
|
if (!pkgPath) return;
|
|
1299
|
-
const json =
|
|
1372
|
+
const json = readSync(pkgPath);
|
|
1300
1373
|
return JSON.parse(json);
|
|
1301
1374
|
}
|
|
1302
1375
|
static setVersion(dependency, version) {
|