@kubb/core 0.44.0 → 0.44.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/index.d.ts CHANGED
@@ -40,7 +40,7 @@ type KubbConfig = {
40
40
  * the defined root option.
41
41
  */
42
42
  path: string;
43
- } | string;
43
+ };
44
44
  output: {
45
45
  /**
46
46
  * Path to be used to export all generated files. Can be an absolute path, or a path relative based of the defined root option.
@@ -186,6 +186,8 @@ type PathMode = 'file' | 'directory';
186
186
  declare const getPathMode: (path: string | undefined | null) => PathMode;
187
187
  declare const read: (path: string) => Promise<string>;
188
188
 
189
+ declare const isURL: (data: string) => boolean;
190
+
189
191
  type Import = {
190
192
  name: string | string[];
191
193
  path: string;
@@ -368,4 +370,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
368
370
  abstract build(schema: TInput, name: string, description?: string): TOutput;
369
371
  }
370
372
 
371
- export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, File, FileManager, FileName, Generator, KubbBuild, KubbConfig, KubbJSONPlugin, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, clean, createPlugin, createPluginCache, build as default, defineConfig, getPathMode, getRelativePath, hooks, isPromise, name, read, validatePlugins, write };
373
+ export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, File, FileManager, FileName, Generator, KubbBuild, KubbConfig, KubbJSONPlugin, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, clean, createPlugin, createPluginCache, build as default, defineConfig, getPathMode, getRelativePath, hooks, isPromise, isURL, name, read, validatePlugins, write };
@@ -16902,6 +16902,22 @@ var kubb = (function (exports) {
16902
16902
 
16903
16903
  // src/build.ts
16904
16904
  init_define_process();
16905
+
16906
+ // src/utils/isURL.ts
16907
+ init_define_process();
16908
+ var isURL = (data) => {
16909
+ try {
16910
+ const url = new URL(data);
16911
+ if (url?.href) {
16912
+ return true;
16913
+ }
16914
+ } catch (error) {
16915
+ return false;
16916
+ }
16917
+ return false;
16918
+ };
16919
+
16920
+ // src/build.ts
16905
16921
  var import_path4 = __toESM(require_path_browserify());
16906
16922
 
16907
16923
  // src/managers/pluginManager/PluginManager.ts
@@ -17618,18 +17634,16 @@ ${curr.source}`,
17618
17634
  }
17619
17635
  if (code) {
17620
17636
  const transformedCode = await pluginManager.hookReduceArg0("transform", [code, path], transformReducer);
17621
- if (typeof config.input === "object") {
17622
- await pluginManager.hookParallel("writeFile", [transformedCode, path]);
17623
- }
17637
+ await pluginManager.hookParallel("writeFile", [transformedCode, path]);
17624
17638
  fileManager.setStatus(id, "success");
17625
17639
  fileManager.remove(id);
17626
17640
  }
17627
17641
  });
17628
17642
  await pluginManager.hookParallel("buildStart", [config]);
17629
17643
  pluginManager.fileManager.add({
17630
- path: typeof config.input === "string" ? "input" : import_path4.default.resolve(config.root, config.input.path),
17631
- fileName: typeof config.input === "string" ? "input" : config.input.path,
17632
- source: typeof config.input === "string" ? config.input : await read(import_path4.default.resolve(config.root, config.input.path))
17644
+ path: isURL(config.input.path) ? config.input.path : import_path4.default.resolve(config.root, config.input.path),
17645
+ fileName: isURL(config.input.path) ? "input" : config.input.path,
17646
+ source: isURL(config.input.path) ? config.input.path : await read(import_path4.default.resolve(config.root, config.input.path))
17633
17647
  });
17634
17648
  }
17635
17649
  function build(options) {
@@ -17717,6 +17731,7 @@ ${curr.source}`,
17717
17731
  exports.getRelativePath = getRelativePath;
17718
17732
  exports.hooks = hooks;
17719
17733
  exports.isPromise = isPromise;
17734
+ exports.isURL = isURL;
17720
17735
  exports.name = name;
17721
17736
  exports.read = read;
17722
17737
  exports.validatePlugins = validatePlugins;