@kubb/core 5.12.0 → 5.12.2

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.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Enforce, FileNode, HttpMethod, ImportNode, InputMeta, InputNode, Macro, Node, OperationNode, SchemaNode, UserFileNode } from "@kubb/ast";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
+ import net from "node:net";
3
4
  //#region ../../internals/utils/src/promise.d.ts
4
5
  /** A value that may already be resolved or still pending.
5
6
  *
@@ -3543,12 +3544,25 @@ export declare function createResolver<T extends PluginType>(options: ResolverOp
3543
3544
  * Fetches one commit of a git repository into a temporary directory with a shallow `git fetch`,
3544
3545
  * so any host and the user's own git credentials work, and relative `$ref` files resolve.
3545
3546
  * Resolves to the spec path on disk and a `dispose` that deletes the checkout.
3547
+ *
3548
+ * With `publicOnly`, the repository must be an https URL on public addresses, the fetch connects to
3549
+ * the addresses checked, and it does not follow a redirect.
3546
3550
  */
3547
- export declare function checkoutGitInput(input: string, signal?: AbortSignal): Promise<{
3551
+ export declare function checkoutGitInput(input: string, signal?: AbortSignal, { publicOnly }?: {
3552
+ publicOnly?: boolean;
3553
+ }): Promise<{
3548
3554
  path: string;
3549
3555
  dispose: () => Promise<void>;
3550
3556
  }>;
3551
3557
  //#endregion
3558
+ //#region src/publicAddress.d.ts
3559
+ /**
3560
+ * Whether `address` is a routable public IP. Loopback, private, link-local, cloud metadata, and
3561
+ * multicast ranges are not, and an IPv4-mapped IPv6 address counts as the IPv4 address it wraps.
3562
+ * Pass `blocked` to replace the ranges.
3563
+ */
3564
+ export declare function isPublicAddress(address: string, blocked?: net.BlockList): boolean;
3565
+ //#endregion
3552
3566
  //#region src/input.d.ts
3553
3567
  /**
3554
3568
  * What an `input` value points at, once Kubb has looked at it.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { $ as NodeCache, $t as ReporterContext, A as PluginFactory, At as KubbInfoContext, B as ResolveImportsOptions, Bt as RunHookOptions, C as NormalizedPlugin, Ct as KubbGenerationEndContext, D as Override, Dt as KubbHookLineContext, E as OutputOptions, Et as KubbHookEndContext, F as definePlugin, Ft as KubbWarnContext, G as ResolverFile, Gt as createOutputManifest, H as ResolvePathOptions, Ht as KubbDriver, I as BannerMeta, It as PossibleConfig, J as ResolverPatch, Jt as createRenderer, K as ResolverFileParams, Kt as Renderer, L as ResolveBannerContext, Lt as PostGenerateCommand, M as PluginType, Mt as KubbMessageContext, N as ResolvePluginOptions, Nt as KubbPluginsEndContext, O as Plugin, Ot as KubbHookStartContext, P as assertPluginOption, Pt as KubbSuccessContext, Q as defineGenerator, Qt as Reporter, R as ResolveBannerFile, Rt as UserConfig, S as KubbPluginStartContext, St as KubbFilesProcessingUpdateContext, T as OutputMode, Tt as KubbGenerationSummaryContext, U as Resolver, Ut as Hookable, V as ResolveOptionsContext, Vt as runHook, W as ResolverDefault, Wt as OutputManifest, X as Generator, Xt as createStorage, Y as ResolverPathParams, Yt as Storage, Z as GeneratorContext, Zt as GenerationResult, _ as Filter, _t as KubbDiagnosticContext, a as AdapterSource, an as DiagnosticFormatOptions, at as Diagnostics, b as KubbPluginEndContext, bt as KubbFilesProcessingEndContext, c as ExtensionDependency, cn as ParserDefinition, ct as ProblemDiagnostic, d as ExtensionKind, dt as CLIOptions, en as ReporterName, et as Diagnostic, f as ExtensionMeta, ft as Config, g as Exclude, gt as KubbBuildStartContext, h as resolveMeta, ht as KubbBuildEndContext, i as AdapterFactoryOptions, in as logLevel, it as DiagnosticSeverity, j as PluginName, jt as KubbLifecycleStartContext, k as PluginDefinition, kt as KubbHooks, l as ExtensionDependencyRecord, ln as ParserFactory, lt as UpdateDiagnostic, m as defineExtension, mt as Input, n as AdapterDefinition, nn as UserReporter, nt as DiagnosticKind, o as createAdapter, on as SerializedDiagnostic, ot as PerformanceDiagnostic, p as checkCompatibility, pt as FilesContext, q as ResolverFilePathParams, qt as RendererFactory, r as AdapterFactory, rn as createReporter, rt as DiagnosticLocation, s as ExtensionDependencies, sn as Parser, st as ProblemCode, t as Adapter, tn as ReporterPluginFiles, tt as DiagnosticDoc, u as ExtensionFactory, un as defineParser, ut as BuildOutput, v as Group, vt as KubbErrorContext, w as Output, wt as KubbGenerationStartContext, x as KubbPluginSetupContext, xt as KubbFilesProcessingStartContext, y as Include, yt as KubbFileProcessingUpdate, z as ResolveFileOptions, zt as HookResult } from "./createAdapter-DFXvZLZC.js";
2
2
  import { FileNode, Macro, UserFileNode } from "@kubb/ast";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
+ import net from "node:net";
4
5
  //#region src/composables.d.ts
5
6
  /**
6
7
  * Holds the setup context of the plugin whose `setup` or `kubb:plugin:setup` is running. `KubbDriver` sets it for each plugin.
@@ -321,12 +322,25 @@ export declare function createResolver<T extends PluginType>(options: ResolverOp
321
322
  * Fetches one commit of a git repository into a temporary directory with a shallow `git fetch`,
322
323
  * so any host and the user's own git credentials work, and relative `$ref` files resolve.
323
324
  * Resolves to the spec path on disk and a `dispose` that deletes the checkout.
325
+ *
326
+ * With `publicOnly`, the repository must be an https URL on public addresses, the fetch connects to
327
+ * the addresses checked, and it does not follow a redirect.
324
328
  */
325
- export declare function checkoutGitInput(input: string, signal?: AbortSignal): Promise<{
329
+ export declare function checkoutGitInput(input: string, signal?: AbortSignal, { publicOnly }?: {
330
+ publicOnly?: boolean;
331
+ }): Promise<{
326
332
  path: string;
327
333
  dispose: () => Promise<void>;
328
334
  }>;
329
335
  //#endregion
336
+ //#region src/publicAddress.d.ts
337
+ /**
338
+ * Whether `address` is a routable public IP. Loopback, private, link-local, cloud metadata, and
339
+ * multicast ranges are not, and an IPv4-mapped IPv6 address counts as the IPv4 address it wraps.
340
+ * Pass `blocked` to replace the ranges.
341
+ */
342
+ export declare function isPublicAddress(address: string, blocked?: net.BlockList): boolean;
343
+ //#endregion
330
344
  //#region src/input.d.ts
331
345
  /**
332
346
  * What an `input` value points at, once Kubb has looked at it.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as getElapsedMs, C as useKubb, D as resolveMeta, E as defineExtension, F as read, I as rm$1, L as write, M as existsSync$1, N as isPathInside, O as Diagnostics, P as listFiles, R as writeRaw, S as useConfig, T as checkCompatibility, _ as requirePlugin, b as setResolver, c as Resolver, d as assertPluginOption, f as definePlugin, g as kubbContext, h as injectFile, j as inParallel, k as formatMs, l as getInputKind, m as addMacro, n as KubbDriver, o as _usingCtx, p as addGenerator, s as createResolver, t as Hookable, u as checkoutGitInput, v as setMacros, w as useOptions, x as tryUseKubb, y as setOptions, z as toError } from "./Hookable-Cqx0g2T-.js";
1
+ import { A as formatMs, B as toError, C as useConfig, D as defineExtension, E as checkCompatibility, F as listFiles, I as read, L as rm$1, M as inParallel, N as existsSync$1, O as resolveMeta, P as isPathInside, R as write, S as tryUseKubb, T as useOptions, _ as kubbContext, b as setOptions, c as Resolver, d as isPublicAddress, f as assertPluginOption, g as injectFile, h as addMacro, j as getElapsedMs, k as Diagnostics, l as getInputKind, m as addGenerator, n as KubbDriver, o as _usingCtx, p as definePlugin, s as createResolver, t as Hookable, u as checkoutGitInput, v as requirePlugin, w as useKubb, x as setResolver, y as setMacros, z as writeRaw } from "./Hookable-DuUzYJNA.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { isValid } from "verkit";
4
4
  import process$1 from "node:process";
@@ -1384,6 +1384,6 @@ async function readInstalledPackages({ root, packages = [], resolveFrom = [] })
1384
1384
  }));
1385
1385
  }
1386
1386
  //#endregion
1387
- export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, assertPluginOption, cacheStorage, checkCompatibility, checkoutGitInput, cliReporter, createAdapter, createCliReporter, createKubb, createOutputManifest, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memoryStorage, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
1387
+ export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, assertPluginOption, cacheStorage, checkCompatibility, checkoutGitInput, cliReporter, createAdapter, createCliReporter, createKubb, createOutputManifest, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isPublicAddress, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memoryStorage, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
1388
1388
 
1389
1389
  //# sourceMappingURL=index.js.map
package/dist/mocks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as camelCase, a as FileManager, i as createNodeCache, r as pluginNotFoundError, t as Hookable } from "./Hookable-Cqx0g2T-.js";
1
+ import { V as camelCase, a as FileManager, i as createNodeCache, r as pluginNotFoundError, t as Hookable } from "./Hookable-DuUzYJNA.js";
2
2
  import path, { resolve } from "node:path";
3
3
  import { applyMacros, ast } from "@kubb/ast";
4
4
  import { expect, vi } from "vitest";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "5.12.0",
3
+ "version": "5.12.2",
4
4
  "description": "Core engine for Kubb. Provides the plugin driver, file manager and build orchestration used by every Kubb plugin.",
5
5
  "keywords": [
6
6
  "code-generator",
@@ -77,7 +77,7 @@
77
77
  "registry": "https://registry.npmjs.org/"
78
78
  },
79
79
  "dependencies": {
80
- "@kubb/ast": "5.12.0",
80
+ "@kubb/ast": "5.12.2",
81
81
  "tinyexec": "^1.3.1",
82
82
  "unstorage": "^1.17.6",
83
83
  "verkit": "^0.5.0"