@kubb/core
Advanced tools
Comparing version 0.21.1 to 0.22.0
@@ -226,2 +226,6 @@ import EventEmitter from 'events'; | ||
declare const format: (text: string) => string; | ||
declare const getRelativePath: (from?: string | null, to?: string | null) => string; | ||
/** | ||
@@ -232,4 +236,6 @@ * Get the type of the first argument in a function. | ||
type Argument0<H extends keyof PluginLifecycle> = Parameters<PluginLifecycle[H]>[0]; | ||
type Strategy = 'hookFirst' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq'; | ||
declare const hooks: [keyof PluginLifecycle]; | ||
declare class PluginDriver { | ||
declare class PluginManager { | ||
plugins: KubbPlugin[]; | ||
@@ -271,6 +277,2 @@ readonly fileManager: FileManager; | ||
declare const format: (text: string) => string; | ||
declare const getRelativePath: (from?: string | null, to?: string | null) => string; | ||
export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, EmittedFile, File, FileManager, KubbConfig, KubbPlugin, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, PluginContext, PluginDriver, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, Status, TransformResult, UUID, UserFile, ValidationResult, build, createPlugin, createPluginCache, build as default, defineConfig, format, getRelativePath, hooks, isPromise, write }; | ||
export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, EmittedFile, File, FileManager, KubbConfig, KubbPlugin, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, Status, Strategy, TransformResult, UUID, UserFile, ValidationResult, build, createPlugin, createPluginCache, build as default, defineConfig, format, getRelativePath, hooks, isPromise, write }; |
@@ -140,3 +140,3 @@ 'use strict'; | ||
// src/managers/utils/getFileManagerEvents.ts | ||
// src/managers/fileManager/events.ts | ||
var keys = { | ||
@@ -189,3 +189,3 @@ getEmitFileKey: () => `emit-file`, | ||
// src/managers/FileManager.ts | ||
// src/managers/fileManager/FileManager.ts | ||
var FileManager = class { | ||
@@ -252,3 +252,3 @@ cache = /* @__PURE__ */ new Map(); | ||
// src/utils/PluginDriver.ts | ||
// src/managers/pluginManager/PluginManager.ts | ||
var hookNames = { | ||
@@ -264,3 +264,3 @@ validate: 1, | ||
var hooks = Object.keys(hookNames); | ||
var PluginDriver = class { | ||
var PluginManager = class { | ||
plugins; | ||
@@ -412,5 +412,6 @@ fileManager = new FileManager(); | ||
} | ||
const pluginDriver = new PluginDriver(config, { logger }); | ||
const pluginManager = new PluginManager(config, { logger }); | ||
const { plugins, fileManager } = pluginManager; | ||
const input = fse.readFileSync(path2.resolve(config.root, config.input.path), "utf-8"); | ||
const validations = await pluginDriver.hookParallel("validate", [pluginDriver.plugins]); | ||
const validations = await pluginManager.hookParallel("validate", [plugins]); | ||
const validationsWithMessage = validations.filter(Boolean); | ||
@@ -425,3 +426,3 @@ if (validationsWithMessage.some((validation) => typeof validation !== "boolean")) { | ||
} | ||
pluginDriver.fileManager.events.onAdd(async (id, file) => { | ||
fileManager.events.onAdd(async (id, file) => { | ||
let fileName = file.fileName; | ||
@@ -432,3 +433,3 @@ let { name: name2, source: code } = file; | ||
} | ||
const loadedResult = await pluginDriver.hookFirst("load", [fileName]); | ||
const loadedResult = await pluginManager.hookFirst("load", [fileName]); | ||
if (loadedResult) { | ||
@@ -438,15 +439,15 @@ code = loadedResult; | ||
if (code) { | ||
const transformedCode = await pluginDriver.hookReduceArg0("transform", [code, fileName], transformReducer); | ||
await pluginDriver.hookParallel("writeFile", [transformedCode, fileName]); | ||
pluginDriver.fileManager.setStatus(id, "success"); | ||
pluginDriver.fileManager.remove(id); | ||
const transformedCode = await pluginManager.hookReduceArg0("transform", [code, fileName], transformReducer); | ||
await pluginManager.hookParallel("writeFile", [transformedCode, fileName]); | ||
fileManager.setStatus(id, "success"); | ||
fileManager.remove(id); | ||
} | ||
}); | ||
await pluginDriver.hookParallel("buildStart", [config]); | ||
pluginDriver.fileManager.add({ | ||
await pluginManager.hookParallel("buildStart", [config]); | ||
fileManager.add({ | ||
fileName: path2.resolve(config.root, config.input.path), | ||
source: input | ||
}); | ||
pluginDriver.fileManager.events.onSuccess(async () => { | ||
await pluginDriver.hookParallel("buildEnd"); | ||
fileManager.events.onSuccess(async () => { | ||
await pluginManager.hookParallel("buildEnd"); | ||
setTimeout(() => { | ||
@@ -474,3 +475,3 @@ done(); | ||
exports.FileManager = FileManager; | ||
exports.PluginDriver = PluginDriver; | ||
exports.PluginManager = PluginManager; | ||
exports.build = build; | ||
@@ -477,0 +478,0 @@ exports.createPlugin = createPlugin; |
{ | ||
"name": "@kubb/core", | ||
"version": "0.21.1", | ||
"version": "0.22.0", | ||
"description": "Generator core", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1247
106279