Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kubb/core

Package Overview
Dependencies
Maintainers
0
Versions
662
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubb/core - npm Package Compare versions

Comparing version 3.0.0-alpha.31 to 3.0.0-beta.1

dist/chunk-7FIOLZNC.cjs

4

dist/index.d.ts

@@ -1,3 +0,3 @@

import { P as PluginContext, F as FileManager, a as PluginManager, U as UserConfig, C as Config, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './FileManager-Dnafk2I5.js';
export { B as BarrelType, d as FileMetaBase, G as GetPluginFactoryOptions, o as Group, e as InputData, O as Output, i as Plugin, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './FileManager-Dnafk2I5.js';
import { P as PluginContext, F as FileManager, a as PluginManager, U as UserConfig, C as Config, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './FileManager-C9aZTwst.js';
export { B as BarrelType, d as FileMetaBase, G as GetPluginFactoryOptions, o as Group, e as InputData, O as Output, i as Plugin, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './FileManager-C9aZTwst.js';
import { L as Logger } from './logger-DvbHXjIO.js';

@@ -4,0 +4,0 @@ import { PossiblePromise } from '@kubb/types';

import { transformReservedWord } from './chunk-2EU7DMPM.js';
import { EventEmitter, createLogger } from './chunk-E6CN2CZC.js';
import { FileManager, setUniqueName, processFiles, URLPath } from './chunk-MD2LDZ3Z.js';
export { FileManager, getSource } from './chunk-MD2LDZ3Z.js';
import './chunk-4X5FFJPJ.js';
import { FileManager, setUniqueName, processFiles, URLPath } from './chunk-DXGMSPTW.js';
export { FileManager, getSource } from './chunk-DXGMSPTW.js';
import './chunk-BQXM32UO.js';
import './chunk-HBQM723K.js';

@@ -379,28 +379,2 @@ import { getRelativePath, read, readSync, clean } from '@kubb/fs';

/**
* Chain all plugins, `reduce` can be passed through to handle every returned value. The return value of the first plugin will be used as the first parameter for the plugin after that.
*/
hookReduceArg0({
hookName,
parameters,
reduce,
message
}) {
const [argument0, ...rest] = parameters;
const plugins = this.#getSortedPlugins(hookName);
let promise = Promise.resolve(argument0);
for (const plugin of plugins) {
promise = promise.then((arg0) => {
const value = this.#execute({
strategy: "hookReduceArg0",
hookName,
parameters: [arg0, ...rest],
plugin,
message
});
return value;
}).then((result) => reduce.call(this.#core.context, argument0, result, plugin));
}
return promise;
}
/**
* Chains plugins

@@ -407,0 +381,0 @@ */

import { ResolvedFile, File } from '@kubb/fs/types';
import { a as PluginManager } from './FileManager-Dnafk2I5.js';
import { a as PluginManager } from './FileManager-C9aZTwst.js';
import { L as Logger } from './logger-DvbHXjIO.js';

@@ -4,0 +4,0 @@ import '@kubb/fs';

@@ -1,3 +0,3 @@

import { getSource, createFile } from './chunk-MD2LDZ3Z.js';
import { camelCase, pascalCase } from './chunk-4X5FFJPJ.js';
import { getSource, createFile } from './chunk-DXGMSPTW.js';
import { camelCase, pascalCase } from './chunk-BQXM32UO.js';
import path from 'node:path';

@@ -4,0 +4,0 @@

import { transformReservedWord } from './chunk-2EU7DMPM.js';
export { transformReservedWord } from './chunk-2EU7DMPM.js';
import { orderBy, camelCase, pascalCase, pathCase } from './chunk-4X5FFJPJ.js';
export { camelCase, orderBy, pascalCase, pathCase } from './chunk-4X5FFJPJ.js';
import { orderBy, camelCase, pascalCase, pathCase } from './chunk-BQXM32UO.js';
export { camelCase, orderBy, pascalCase, pathCase } from './chunk-BQXM32UO.js';
import { merge } from 'remeda';

@@ -6,0 +6,0 @@ export { merge } from 'remeda';

@@ -1,4 +0,4 @@

export { FunctionParams, URLPath, createFile, createFileExport, createFileImport, createFileParser, getFileParser, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout } from './chunk-MD2LDZ3Z.js';
import './chunk-4X5FFJPJ.js';
export { FunctionParams, URLPath, createFile, createFileExport, createFileImport, createFileParser, getFileParser, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout } from './chunk-DXGMSPTW.js';
import './chunk-BQXM32UO.js';
//# sourceMappingURL=utils.js.map
//# sourceMappingURL=utils.js.map
{
"name": "@kubb/core",
"version": "3.0.0-alpha.31",
"version": "3.0.0-beta.1",
"description": "Generator core",

@@ -80,3 +80,3 @@ "keywords": [

"find-up": "^7.0.0",
"natural-orderby": "^3.0.2",
"natural-orderby": "^4.0.0",
"object-hash": "^3.0.0",

@@ -87,5 +87,5 @@ "p-queue": "^8.0.1",

"semver": "^7.6.3",
"@kubb/fs": "3.0.0-alpha.31",
"@kubb/parser-ts": "3.0.0-alpha.31",
"@kubb/types": "3.0.0-alpha.31"
"@kubb/fs": "3.0.0-beta.1",
"@kubb/parser-ts": "3.0.0-beta.1",
"@kubb/types": "3.0.0-beta.1"
},

@@ -101,4 +101,4 @@ "devDependencies": {

"typescript": "^5.6.2",
"@kubb/config-ts": "3.0.0-alpha.31",
"@kubb/config-tsup": "3.0.0-alpha.31"
"@kubb/config-ts": "3.0.0-beta.1",
"@kubb/config-tsup": "3.0.0-beta.1"
},

@@ -105,0 +105,0 @@ "engines": {

@@ -17,3 +17,3 @@ <div align="center">

<h4>
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
<span> · </span>

@@ -20,0 +20,0 @@ <a href="https://kubb.dev/" target="_blank">Documentation</a>

@@ -400,4 +400,3 @@ import { extname, join, relative } from 'node:path'

const message = file ? `Writing ${relative(config.root, file.path)}` : ''
const extnames = config.output.extension?.({})
const extname = extnames?.[file.extname]
const extname = config.output.extension?.[file.extname]

@@ -404,0 +403,0 @@ const source = await getSource(file, { logger, extname })

@@ -31,10 +31,4 @@ import { FileManager } from './FileManager.ts'

/**
* Get the type of the first argument in a function.
* @example Arg0<(a: string, b: number) => void> -> string
*/
type Argument0<H extends keyof PluginLifecycle> = Parameters<RequiredPluginLifecycle[H]>[0]
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq'
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq'
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {

@@ -400,38 +394,2 @@ message: string

/**
* Chain all plugins, `reduce` can be passed through to handle every returned value. The return value of the first plugin will be used as the first parameter for the plugin after that.
*/
hookReduceArg0<H extends PluginLifecycleHooks>({
hookName,
parameters,
reduce,
message,
}: {
hookName: H
parameters: PluginParameter<H>
reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: Plugin) => PossiblePromise<Argument0<H> | null>
message: string
}): Promise<Argument0<H>> {
const [argument0, ...rest] = parameters
const plugins = this.#getSortedPlugins(hookName)
let promise: Promise<Argument0<H>> = Promise.resolve(argument0)
for (const plugin of plugins) {
promise = promise
.then((arg0) => {
const value = this.#execute({
strategy: 'hookReduceArg0',
hookName,
parameters: [arg0, ...rest] as PluginParameter<H>,
plugin,
message,
})
return value
})
.then((result) => reduce.call(this.#core.context, argument0, result as ReturnType<ParseResult<H>>, plugin)) as Promise<Argument0<H>>
}
return promise
}
/**
* Chains plugins

@@ -438,0 +396,0 @@ */

@@ -46,5 +46,2 @@ import type * as KubbFile from '@kubb/fs/types'

type OutContext = {}
type OutExtension = (context: OutContext) => Record<KubbFile.Extname, KubbFile.Extname>
export type BarrelType = 'all' | 'named'

@@ -85,6 +82,6 @@

/**
* Override the extension to the generated imports and exports, default the plugin will add an extension
* @default `() => ({ '.ts': '.ts'})`
* Override the extension to the generated imports and exports, by default the plugin will add an extension
* @default `{ '.ts': '.ts'}`
*/
extension?: OutExtension
extension?: Record<KubbFile.Extname, KubbFile.Extname>
/**

@@ -273,4 +270,5 @@ * Define what needs to exported, here you can also disable the export of barrel files.

* `file` will be used to customize the name of the created file(use of camelCase)
* `function` can be used used to customize the exported functions(use of camelCase)
* `function` can be used to customize the exported functions(use of camelCase)
* `type` is a special type for TypeScript(use of PascalCase)
* `const` can be used for variables(use of camelCase)
*/

@@ -297,10 +295,12 @@ type?: 'file' | 'function' | 'type' | 'const'

}
/**
* Specify the export location for the files and define the behavior of the output
*/
export type Output = {
/**
* Output to save the generated files.
* Path to the output folder or file that will contain the generated code
*/
path: string
/**
* Define what needs to exported, here you can also disable the export of barrel files.
* Define what needs to be exported, here you can also disable the export of barrel files
* @default `'named'`

@@ -325,12 +325,9 @@ */

/**
* Tag will group based on the operation tag inside the Swagger file
* Define a type where to group the files on
*/
type: 'tag'
/**
* Relative path to save the grouped clients.
*
* @example `${output}/{{tag}}Controller` => `clients/PetController`
* @default `({ group }) => `${group}Controller``
* Return the name of a group based on the group name, this will be used for the file and name generation
*/
name?: (context: GroupContext) => string
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc