@kubb/plugin-ts 5.0.0-beta.36 → 5.0.0-beta.42

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.js CHANGED
@@ -2,7 +2,6 @@ import { t as __name } from "./chunk-C0LytTxp.js";
2
2
  import { parserTs } from "@kubb/parser-ts";
3
3
  import { File, jsxRendererSync } from "@kubb/renderer-jsx";
4
4
  import { ast, defineGenerator, definePlugin, defineResolver } from "@kubb/core";
5
- import { isNumber } from "remeda";
6
5
  import ts from "typescript";
7
6
  import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
8
7
  //#region ../../internals/utils/src/casing.ts
@@ -309,6 +308,9 @@ const PARAM_RANK = {
309
308
  //#endregion
310
309
  //#region src/factory.ts
311
310
  const { SyntaxKind, factory } = ts;
311
+ function isNumber(value) {
312
+ return typeof value === "number" && !Number.isNaN(value);
313
+ }
312
314
  /**
313
315
  * TypeScript AST modifiers for common keywords (async, export, const, static).
314
316
  */
@@ -332,8 +334,13 @@ function isNonNullable$1(value) {
332
334
  __name(isNonNullable$1, "isNonNullable");
333
335
  function isValidIdentifier(str) {
334
336
  if (!str.length || str.trim() !== str) return false;
335
- const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest);
336
- return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind) === void 0;
337
+ let ch = str.codePointAt(0);
338
+ if (!ts.isIdentifierStart(ch, ts.ScriptTarget.Latest)) return false;
339
+ for (let i = ch > 65535 ? 2 : 1; i < str.length; i += ch > 65535 ? 2 : 1) {
340
+ ch = str.codePointAt(i);
341
+ if (!ts.isIdentifierPart(ch, ts.ScriptTarget.Latest)) return false;
342
+ }
343
+ return true;
337
344
  }
338
345
  function propertyName(name) {
339
346
  if (typeof name === "string") return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name);
@@ -1623,10 +1630,10 @@ function rank(param) {
1623
1630
  return param.optional ? PARAM_RANK.optional : PARAM_RANK.required;
1624
1631
  }
1625
1632
  function sortParams(params) {
1626
- return [...params].sort((a, b) => rank(a) - rank(b));
1633
+ return params.toSorted((a, b) => rank(a) - rank(b));
1627
1634
  }
1628
1635
  function sortChildParams(params) {
1629
- return [...params].sort((a, b) => rank(a) - rank(b));
1636
+ return params.toSorted((a, b) => rank(a) - rank(b));
1630
1637
  }
1631
1638
  /**
1632
1639
  * Default function-signature printer.