@kubb/renderer-jsx 5.23.5 → 5.24.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.cjs CHANGED
@@ -329,22 +329,19 @@ function Schema({ node, printer, children }) {
329
329
  const output = printer.print(node);
330
330
  const imports = printer.drainImports();
331
331
  if (!output) return null;
332
- return /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [imports.map((imp) => /* @__PURE__ */ require_jsx_runtime.jsx(File.Import, {
333
- names: imp.names,
334
- name: imp.name,
335
- path: imp.path,
336
- root: imp.root,
337
- isTypeOnly: imp.isTypeOnly,
338
- isNameSpace: imp.isNameSpace
339
- }, [imp.path, imp.name].join("-"))), children(output)] });
332
+ return /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [imports.map((imp) => {
333
+ const names = _kubb_ast.ast.file.getNames(_kubb_ast.ast.factory.createImport(imp));
334
+ return /* @__PURE__ */ require_jsx_runtime.jsx(File.Import, {
335
+ names,
336
+ path: imp.path,
337
+ root: imp.root
338
+ }, [imp.path, ...names.map((item) => item.alias ?? item.name)].join("-"));
339
+ }), children(output)] });
340
340
  }
341
341
  // src/components/js/Type.tsx
342
342
  /**
343
343
  * Generates a TypeScript type alias declaration.
344
344
  *
345
- * Throws if `name` does not start with an uppercase letter. TypeScript type aliases
346
- * should follow PascalCase naming conventions.
347
- *
348
345
  * @example Simple exported type alias
349
346
  * ```tsx
350
347
  * <Type export name="PetId">
@@ -361,7 +358,6 @@ function Schema({ node, printer, children }) {
361
358
  * ```
362
359
  */
363
360
  function Type({ children, ...props }) {
364
- if (props.name.charAt(0).toUpperCase() !== props.name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
365
361
  return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-type", {
366
362
  ...props,
367
363
  children
package/dist/index.d.cts CHANGED
@@ -448,9 +448,6 @@ type TypeProps = Omit<ast.TypeNode, 'kind' | 'nodes'> & {
448
448
  /**
449
449
  * Generates a TypeScript type alias declaration.
450
450
  *
451
- * Throws if `name` does not start with an uppercase letter. TypeScript type aliases
452
- * should follow PascalCase naming conventions.
453
- *
454
451
  * @example Simple exported type alias
455
452
  * ```tsx
456
453
  * <Type export name="PetId">
package/dist/index.d.ts CHANGED
@@ -448,9 +448,6 @@ type TypeProps = Omit<ast.TypeNode, 'kind' | 'nodes'> & {
448
448
  /**
449
449
  * Generates a TypeScript type alias declaration.
450
450
  *
451
- * Throws if `name` does not start with an uppercase letter. TypeScript type aliases
452
- * should follow PascalCase naming conventions.
453
- *
454
451
  * @example Simple exported type alias
455
452
  * ```tsx
456
453
  * <Type export name="PetId">
package/dist/index.js CHANGED
@@ -328,22 +328,19 @@ function Schema({ node, printer, children }) {
328
328
  const output = printer.print(node);
329
329
  const imports = printer.drainImports();
330
330
  if (!output) return null;
331
- return /* @__PURE__ */ jsxs(Fragment, { children: [imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
332
- names: imp.names,
333
- name: imp.name,
334
- path: imp.path,
335
- root: imp.root,
336
- isTypeOnly: imp.isTypeOnly,
337
- isNameSpace: imp.isNameSpace
338
- }, [imp.path, imp.name].join("-"))), children(output)] });
331
+ return /* @__PURE__ */ jsxs(Fragment, { children: [imports.map((imp) => {
332
+ const names = ast.file.getNames(ast.factory.createImport(imp));
333
+ return /* @__PURE__ */ jsx(File.Import, {
334
+ names,
335
+ path: imp.path,
336
+ root: imp.root
337
+ }, [imp.path, ...names.map((item) => item.alias ?? item.name)].join("-"));
338
+ }), children(output)] });
339
339
  }
340
340
  // src/components/js/Type.tsx
341
341
  /**
342
342
  * Generates a TypeScript type alias declaration.
343
343
  *
344
- * Throws if `name` does not start with an uppercase letter. TypeScript type aliases
345
- * should follow PascalCase naming conventions.
346
- *
347
344
  * @example Simple exported type alias
348
345
  * ```tsx
349
346
  * <Type export name="PetId">
@@ -360,7 +357,6 @@ function Schema({ node, printer, children }) {
360
357
  * ```
361
358
  */
362
359
  function Type({ children, ...props }) {
363
- if (props.name.charAt(0).toUpperCase() !== props.name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
364
360
  return /* @__PURE__ */ jsx("kubb-type", {
365
361
  ...props,
366
362
  children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/renderer-jsx",
3
- "version": "5.23.5",
3
+ "version": "5.24.1",
4
4
  "description": "Self-contained synchronous JSX renderer for Kubb. Turns JSX into FileNodes with built-in components (File, Function, Type, Const). An alternative for the ast.factory syntax.",
5
5
  "keywords": [
6
6
  "codegen",
@@ -94,9 +94,14 @@
94
94
  "registry": "https://registry.npmjs.org/"
95
95
  },
96
96
  "dependencies": {
97
- "@kubb/ast": "^5.23.5",
98
97
  "yaml": "^2.9.1"
99
98
  },
99
+ "devDependencies": {
100
+ "@kubb/ast": "5.24.1"
101
+ },
102
+ "peerDependencies": {
103
+ "@kubb/ast": "^5.24.1"
104
+ },
100
105
  "engines": {
101
106
  "node": ">=22.22"
102
107
  },