@kubb/plugin-ts 5.4.0-canary.20261029T124214 → 5.4.0

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,5 @@
1
- import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
2
- import { KubbReactNode } from "kubb/jsx";
1
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "@kubb/kit";
2
+ import { KubbReactNode } from "@kubb/renderer-jsx";
3
3
  /**
4
4
  * A TS-ESTree node, the AST shape `yuku-codegen` prints. Nodes built here carry no source positions.
5
5
  */
@@ -489,7 +489,7 @@ export declare function Type({ name, node, printer, enum: enumOptions, resolver,
489
489
  * types. Drop-replace with a custom `Generator<PluginTs>` to change how
490
490
  * TypeScript output is produced.
491
491
  */
492
- export declare const typeGenerator: import("kubb/kit").Generator<PluginTs, unknown>;
492
+ export declare const typeGenerator: import("@kubb/kit").Generator<PluginTs, unknown>;
493
493
  /**
494
494
  * Canonical plugin name for `@kubb/plugin-ts`. Used for driver lookups and
495
495
  * cross-plugin dependency references.
@@ -519,7 +519,7 @@ export declare const pluginTsName = "plugin-ts";
519
519
  * })
520
520
  * ```
521
521
  */
522
- export declare const pluginTs: import("kubb/kit").PluginFactory<PluginTs>;
522
+ export declare const pluginTs: import("@kubb/kit").PluginFactory<PluginTs>;
523
523
  /**
524
524
  * A type expression used as a function parameter type annotation.
525
525
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
2
- import { KubbReactNode } from "kubb/jsx";
1
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "@kubb/kit";
2
+ import { KubbReactNode } from "@kubb/renderer-jsx";
3
3
  /**
4
4
  * A TS-ESTree node, the AST shape `yuku-codegen` prints. Nodes built here carry no source positions.
5
5
  */
@@ -489,7 +489,7 @@ export declare function Type({ name, node, printer, enum: enumOptions, resolver,
489
489
  * types. Drop-replace with a custom `Generator<PluginTs>` to change how
490
490
  * TypeScript output is produced.
491
491
  */
492
- export declare const typeGenerator: import("kubb/kit").Generator<PluginTs, unknown>;
492
+ export declare const typeGenerator: import("@kubb/kit").Generator<PluginTs, unknown>;
493
493
  /**
494
494
  * Canonical plugin name for `@kubb/plugin-ts`. Used for driver lookups and
495
495
  * cross-plugin dependency references.
@@ -519,7 +519,7 @@ export declare const pluginTsName = "plugin-ts";
519
519
  * })
520
520
  * ```
521
521
  */
522
- export declare const pluginTs: import("kubb/kit").PluginFactory<PluginTs>;
522
+ export declare const pluginTs: import("@kubb/kit").PluginFactory<PluginTs>;
523
523
  /**
524
524
  * A type expression used as a function parameter type annotation.
525
525
  *
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Resolver, addGenerator, ast, camelCase, createResolver, defineExtension, defineGenerator, isStringType, pascalCase, setMacros, setResolver, syncSchemaRef } from "kubb/kit";
2
- import { File, jsxRenderer } from "kubb/jsx";
1
+ import { createRequire } from "node:module";
2
+ import { Diagnostics, Resolver, addGenerator, ast, camelCase, createResolver, defineExtension, defineGenerator, isStringType, pascalCase, setMacros, setResolver, syncSchemaRef } from "@kubb/kit";
3
+ import { File, jsxRenderer } from "@kubb/renderer-jsx";
3
4
  import { generate } from "yuku-codegen";
4
- import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
5
- import { parserTs } from "@kubb/parser-ts";
5
+ import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
6
6
  // \0rolldown/runtime.js
7
7
  var __defProp = Object.defineProperty;
8
8
  var __name = (target, value) => __defProp(target, "name", {
@@ -1351,6 +1351,25 @@ function buildResponseUnion(node, { resolver }) {
1351
1351
  }
1352
1352
  // src/printers/printerTs.ts
1353
1353
  const { isNonNullable } = factory_exports;
1354
+ const requireModule = createRequire(import.meta.url);
1355
+ /**
1356
+ * Loads `@kubb/parser-ts` on first use. It is an optional peer dependency: only a deprecated `printer.nodes`
1357
+ * handler that returns a TypeScript compiler node needs it. Loads synchronously because node handlers are synchronous.
1358
+ */
1359
+ function loadParserTs(load = () => requireModule("@kubb/parser-ts")) {
1360
+ try {
1361
+ return load();
1362
+ } catch (error) {
1363
+ if (error.code !== "MODULE_NOT_FOUND" || !error.message.split("\n")[0].includes("@kubb/parser-ts")) throw error;
1364
+ throw new Diagnostics.Error({
1365
+ code: Diagnostics.code.missingDependency,
1366
+ severity: "error",
1367
+ message: "Missing dependency: @kubb/parser-ts. A `printer.nodes` handler returned a TypeScript compiler node, and printing it needs @kubb/parser-ts.",
1368
+ help: "Run `npm i -D @kubb/parser-ts` in the project, or return a string from the handler.",
1369
+ plugin: "plugin-ts"
1370
+ });
1371
+ }
1372
+ }
1354
1373
  /**
1355
1374
  * Adapts user overrides, which work in strings, to the node-based printer: `this.transform` hands them printed
1356
1375
  * strings and their result is wrapped back into a node. A deprecated compiler node prints through `@kubb/parser-ts`.
@@ -1366,7 +1385,7 @@ function toNodeHandlers(nodes) {
1366
1385
  transform
1367
1386
  }, node);
1368
1387
  if (result === null || result === void 0) return result;
1369
- return createRaw(typeof result === "string" ? result : parserTs().print(result).trimEnd());
1388
+ return createRaw(typeof result === "string" ? result : loadParserTs().parserTs().print(result).trimEnd());
1370
1389
  }]));
1371
1390
  }
1372
1391
  /**
@@ -1887,7 +1906,7 @@ var compatibility = {
1887
1906
  "node": ">=22.22"
1888
1907
  };
1889
1908
  // package.json
1890
- var version = "5.4.0-canary.20261029T124214";
1909
+ var version = "5.4.0";
1891
1910
  // src/resolvers/resolverTs.ts
1892
1911
  /**
1893
1912
  * Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths