@kubb/core 5.0.0-alpha.5 → 5.0.0-alpha.6
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/hooks.cjs.map +1 -1
- package/dist/hooks.d.ts +9 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/hooks/useKubb.ts +10 -1
package/dist/hooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useKubb.ts","../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useFabric } from '@kubb/react-fabric'\nimport type { GetFileOptions, PluginManager } from '../PluginManager.ts'\nimport type { Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams } from '../types.ts'\n\ntype UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n plugin: Plugin<TOptions>\n mode: KubbFile.Mode\n config: Config\n /**\n * Returns the plugin whose `name` matches `pluginName`, defaulting to the current plugin.\n */\n getPluginByName: (pluginName?: string) => Plugin | undefined\n /**\n * Resolves a file reference, defaulting `pluginName` to the current plugin.\n */\n getFile:
|
|
1
|
+
{"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useKubb.ts","../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useFabric } from '@kubb/react-fabric'\nimport type { GetFileOptions, PluginManager } from '../PluginManager.ts'\nimport type { Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams } from '../types.ts'\n\ntype ResolvePathOptions = {\n pluginName?: string\n group?: {\n tag?: string\n path?: string\n }\n type?: ResolveNameParams['type']\n}\n\ntype UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n plugin: Plugin<TOptions>\n mode: KubbFile.Mode\n config: Config\n /**\n * Returns the plugin whose `name` matches `pluginName`, defaulting to the current plugin.\n */\n getPluginByName: (pluginName?: string) => Plugin | undefined\n /**\n * Resolves a file reference, defaulting `pluginName` to the current plugin.\n */\n getFile: (params: Omit<GetFileOptions<ResolvePathOptions>, 'pluginName'> & { pluginName?: string }) => KubbFile.File<{ pluginName: string }>\n /**\n * Resolves a name, defaulting `pluginName` to the current plugin.\n */\n resolveName: (params: Omit<ResolveNameParams, 'pluginName'> & { pluginName?: string }) => string\n /**\n * Resolves a path, defaulting `pluginName` to the current plugin.\n */\n resolvePath: <TPathOptions = object>(params: Omit<ResolvePathParams<TPathOptions>, 'pluginName'> & { pluginName?: string }) => KubbFile.Path\n}\n\nexport function useKubb<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): UseKubbReturn<TOptions> {\n const { meta } = useFabric<{\n plugin: Plugin<TOptions>\n mode: KubbFile.Mode\n pluginManager: PluginManager\n }>()\n\n const defaultPluginName = meta.plugin.name\n\n return {\n plugin: meta.plugin as Plugin<TOptions>,\n mode: meta.mode,\n config: meta.pluginManager.config,\n getPluginByName: (pluginName = defaultPluginName) => meta.pluginManager.getPluginByName.call(meta.pluginManager, pluginName),\n getFile: ({ pluginName = defaultPluginName, ...rest }) => meta.pluginManager.getFile.call(meta.pluginManager, { pluginName, ...rest }),\n resolveName: ({ pluginName = defaultPluginName, ...rest }) => meta.pluginManager.resolveName.call(meta.pluginManager, { pluginName, ...rest }),\n resolvePath: ({ pluginName = defaultPluginName, ...rest }) => meta.pluginManager.resolvePath.call(meta.pluginManager, { pluginName, ...rest }),\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useFabric } from '@kubb/react-fabric'\n\n/**\n * @deprecated use `useKubb` instead\n */\nexport function useMode(): KubbFile.Mode {\n const { meta } = useFabric<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useFabric } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\n/**\n * @deprecated use useKubb instead\n */\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useFabric<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useFabric } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\n/**\n * @deprecated use `useKubb` instead\n */\nexport function usePluginManager(): PluginManager {\n const { meta } = useFabric<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":";;;;AAoCA,SAAgB,UAAiG;CAC/G,MAAM,EAAE,UAAA,GAAA,mBAAA,YAIJ;CAEJ,MAAM,oBAAoB,KAAK,OAAO;AAEtC,QAAO;EACL,QAAQ,KAAK;EACb,MAAM,KAAK;EACX,QAAQ,KAAK,cAAc;EAC3B,kBAAkB,aAAa,sBAAsB,KAAK,cAAc,gBAAgB,KAAK,KAAK,eAAe,WAAW;EAC5H,UAAU,EAAE,aAAa,mBAAmB,GAAG,WAAW,KAAK,cAAc,QAAQ,KAAK,KAAK,eAAe;GAAE;GAAY,GAAG;GAAM,CAAC;EACtI,cAAc,EAAE,aAAa,mBAAmB,GAAG,WAAW,KAAK,cAAc,YAAY,KAAK,KAAK,eAAe;GAAE;GAAY,GAAG;GAAM,CAAC;EAC9I,cAAc,EAAE,aAAa,mBAAmB,GAAG,WAAW,KAAK,cAAc,YAAY,KAAK,KAAK,eAAe;GAAE;GAAY,GAAG;GAAM,CAAC;EAC/I;;;;;;;AC/CH,SAAgB,UAAyB;CACvC,MAAM,EAAE,UAAA,GAAA,mBAAA,YAA6C;AAErD,QAAO,KAAK;;;;;;;ACHd,SAAgB,YAA4F;CAC1G,MAAM,EAAE,UAAA,GAAA,mBAAA,YAAkD;AAE1D,QAAO,KAAK;;;;;;;ACHd,SAAgB,mBAAkC;CAChD,MAAM,EAAE,UAAA,GAAA,mBAAA,YAAsD;AAE9D,QAAO,KAAK"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -3,6 +3,14 @@ import { D as ResolveNameParams, O as ResolvePathParams, b as PluginFactoryOptio
|
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useKubb.d.ts
|
|
6
|
+
type ResolvePathOptions = {
|
|
7
|
+
pluginName?: string;
|
|
8
|
+
group?: {
|
|
9
|
+
tag?: string;
|
|
10
|
+
path?: string;
|
|
11
|
+
};
|
|
12
|
+
type?: ResolveNameParams['type'];
|
|
13
|
+
};
|
|
6
14
|
type UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
7
15
|
plugin: Plugin<TOptions>;
|
|
8
16
|
mode: KubbFile.Mode;
|
|
@@ -14,7 +22,7 @@ type UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
14
22
|
/**
|
|
15
23
|
* Resolves a file reference, defaulting `pluginName` to the current plugin.
|
|
16
24
|
*/
|
|
17
|
-
getFile:
|
|
25
|
+
getFile: (params: Omit<GetFileOptions<ResolvePathOptions>, 'pluginName'> & {
|
|
18
26
|
pluginName?: string;
|
|
19
27
|
}) => KubbFile.File<{
|
|
20
28
|
pluginName: string;
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks/useKubb.ts","../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useFabric } from '@kubb/react-fabric'\nimport type { GetFileOptions, PluginManager } from '../PluginManager.ts'\nimport type { Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams } from '../types.ts'\n\ntype UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n plugin: Plugin<TOptions>\n mode: KubbFile.Mode\n config: Config\n /**\n * Returns the plugin whose `name` matches `pluginName`, defaulting to the current plugin.\n */\n getPluginByName: (pluginName?: string) => Plugin | undefined\n /**\n * Resolves a file reference, defaulting `pluginName` to the current plugin.\n */\n getFile:
|
|
1
|
+
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks/useKubb.ts","../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useFabric } from '@kubb/react-fabric'\nimport type { GetFileOptions, PluginManager } from '../PluginManager.ts'\nimport type { Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams } from '../types.ts'\n\ntype ResolvePathOptions = {\n pluginName?: string\n group?: {\n tag?: string\n path?: string\n }\n type?: ResolveNameParams['type']\n}\n\ntype UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n plugin: Plugin<TOptions>\n mode: KubbFile.Mode\n config: Config\n /**\n * Returns the plugin whose `name` matches `pluginName`, defaulting to the current plugin.\n */\n getPluginByName: (pluginName?: string) => Plugin | undefined\n /**\n * Resolves a file reference, defaulting `pluginName` to the current plugin.\n */\n getFile: (params: Omit<GetFileOptions<ResolvePathOptions>, 'pluginName'> & { pluginName?: string }) => KubbFile.File<{ pluginName: string }>\n /**\n * Resolves a name, defaulting `pluginName` to the current plugin.\n */\n resolveName: (params: Omit<ResolveNameParams, 'pluginName'> & { pluginName?: string }) => string\n /**\n * Resolves a path, defaulting `pluginName` to the current plugin.\n */\n resolvePath: <TPathOptions = object>(params: Omit<ResolvePathParams<TPathOptions>, 'pluginName'> & { pluginName?: string }) => KubbFile.Path\n}\n\nexport function useKubb<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): UseKubbReturn<TOptions> {\n const { meta } = useFabric<{\n plugin: Plugin<TOptions>\n mode: KubbFile.Mode\n pluginManager: PluginManager\n }>()\n\n const defaultPluginName = meta.plugin.name\n\n return {\n plugin: meta.plugin as Plugin<TOptions>,\n mode: meta.mode,\n config: meta.pluginManager.config,\n getPluginByName: (pluginName = defaultPluginName) => meta.pluginManager.getPluginByName.call(meta.pluginManager, pluginName),\n getFile: ({ pluginName = defaultPluginName, ...rest }) => meta.pluginManager.getFile.call(meta.pluginManager, { pluginName, ...rest }),\n resolveName: ({ pluginName = defaultPluginName, ...rest }) => meta.pluginManager.resolveName.call(meta.pluginManager, { pluginName, ...rest }),\n resolvePath: ({ pluginName = defaultPluginName, ...rest }) => meta.pluginManager.resolvePath.call(meta.pluginManager, { pluginName, ...rest }),\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useFabric } from '@kubb/react-fabric'\n\n/**\n * @deprecated use `useKubb` instead\n */\nexport function useMode(): KubbFile.Mode {\n const { meta } = useFabric<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useFabric } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\n/**\n * @deprecated use useKubb instead\n */\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useFabric<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useFabric } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\n/**\n * @deprecated use `useKubb` instead\n */\nexport function usePluginManager(): PluginManager {\n const { meta } = useFabric<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":";;;AAoCA,SAAgB,UAAiG;CAC/G,MAAM,EAAE,SAAS,WAIb;CAEJ,MAAM,oBAAoB,KAAK,OAAO;AAEtC,QAAO;EACL,QAAQ,KAAK;EACb,MAAM,KAAK;EACX,QAAQ,KAAK,cAAc;EAC3B,kBAAkB,aAAa,sBAAsB,KAAK,cAAc,gBAAgB,KAAK,KAAK,eAAe,WAAW;EAC5H,UAAU,EAAE,aAAa,mBAAmB,GAAG,WAAW,KAAK,cAAc,QAAQ,KAAK,KAAK,eAAe;GAAE;GAAY,GAAG;GAAM,CAAC;EACtI,cAAc,EAAE,aAAa,mBAAmB,GAAG,WAAW,KAAK,cAAc,YAAY,KAAK,KAAK,eAAe;GAAE;GAAY,GAAG;GAAM,CAAC;EAC9I,cAAc,EAAE,aAAa,mBAAmB,GAAG,WAAW,KAAK,cAAc,YAAY,KAAK,KAAK,eAAe;GAAE;GAAY,GAAG;GAAM,CAAC;EAC/I;;;;;;;AC/CH,SAAgB,UAAyB;CACvC,MAAM,EAAE,SAAS,WAAoC;AAErD,QAAO,KAAK;;;;;;;ACHd,SAAgB,YAA4F;CAC1G,MAAM,EAAE,SAAS,WAAyC;AAE1D,QAAO,KAAK;;;;;;;ACHd,SAAgB,mBAAkC;CAChD,MAAM,EAAE,SAAS,WAA6C;AAE9D,QAAO,KAAK"}
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.6",
|
|
4
4
|
"description": "Core functionality for Kubb's plugin-based code generation system, providing the foundation for transforming OpenAPI specifications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"remeda": "^2.33.6",
|
|
72
72
|
"semver": "^7.7.4",
|
|
73
73
|
"tinyexec": "^1.0.4",
|
|
74
|
-
"@kubb/ast": "5.0.0-alpha.
|
|
74
|
+
"@kubb/ast": "5.0.0-alpha.6"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/semver": "^7.7.1",
|
package/src/hooks/useKubb.ts
CHANGED
|
@@ -3,6 +3,15 @@ import { useFabric } from '@kubb/react-fabric'
|
|
|
3
3
|
import type { GetFileOptions, PluginManager } from '../PluginManager.ts'
|
|
4
4
|
import type { Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams } from '../types.ts'
|
|
5
5
|
|
|
6
|
+
type ResolvePathOptions = {
|
|
7
|
+
pluginName?: string
|
|
8
|
+
group?: {
|
|
9
|
+
tag?: string
|
|
10
|
+
path?: string
|
|
11
|
+
}
|
|
12
|
+
type?: ResolveNameParams['type']
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
type UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
7
16
|
plugin: Plugin<TOptions>
|
|
8
17
|
mode: KubbFile.Mode
|
|
@@ -14,7 +23,7 @@ type UseKubbReturn<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
14
23
|
/**
|
|
15
24
|
* Resolves a file reference, defaulting `pluginName` to the current plugin.
|
|
16
25
|
*/
|
|
17
|
-
getFile:
|
|
26
|
+
getFile: (params: Omit<GetFileOptions<ResolvePathOptions>, 'pluginName'> & { pluginName?: string }) => KubbFile.File<{ pluginName: string }>
|
|
18
27
|
/**
|
|
19
28
|
* Resolves a name, defaulting `pluginName` to the current plugin.
|
|
20
29
|
*/
|