@kubb/react-fabric 0.12.11 → 0.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/react-fabric",
3
- "version": "0.12.11",
3
+ "version": "0.13.0",
4
4
  "description": "React integration for Kubb's fabric - JSX runtime and component-based code generation with React reconciler for building type-safe generators",
5
5
  "keywords": [
6
6
  "react",
@@ -102,16 +102,13 @@
102
102
  }
103
103
  ],
104
104
  "dependencies": {
105
- "execa": "^9.6.1",
106
- "natural-orderby": "^5.0.0",
107
105
  "react-devtools-core": "6.1.5",
108
- "remeda": "^2.33.5",
109
- "signal-exit": "^4.1.0",
106
+ "remeda": "^2.33.6",
110
107
  "ws": "8.18.0",
111
- "@kubb/fabric-core": "0.12.11"
108
+ "@kubb/fabric-core": "0.13.0"
112
109
  },
113
110
  "devDependencies": {
114
- "@types/react": "^19.2.13",
111
+ "@types/react": "^19.2.14",
115
112
  "@types/react-reconciler": "0.32.0",
116
113
  "@types/ws": "^8.18.1",
117
114
  "react": "19.2.3",
@@ -127,7 +124,7 @@
127
124
  "scripts": {
128
125
  "build": "tsdown && size-limit",
129
126
  "start": "tsdown --watch ./src",
130
- "clean": "npx rimraf ./dist",
127
+ "clean": "node -e \"require('fs').rmSync('./dist', {recursive:true,force:true})\"",
131
128
  "lint": "pnpm biome lint .",
132
129
  "lint:fix": "pnpm biome lint --fix --unsafe .",
133
130
  "release": "pnpm publish --no-git-check",
package/src/Runtime.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import process from 'node:process'
2
- import { type FileManager, TreeNode } from '@kubb/fabric-core'
2
+ import { type FileManager, onProcessExit, TreeNode } from '@kubb/fabric-core'
3
3
  import { ConcurrentRoot } from 'react-reconciler/constants.js'
4
- import { onExit } from 'signal-exit'
5
4
  import { Root } from './components/Root.tsx'
5
+
6
6
  import { createNode } from './dom.ts'
7
7
  import type { FiberRoot } from './Renderer.ts'
8
8
  import { Renderer } from './Renderer.ts'
@@ -71,12 +71,10 @@ export class Runtime {
71
71
  )
72
72
 
73
73
  // Unmount when process exits
74
- this.unsubscribeExit = onExit(
75
- (code) => {
76
- this.unmount(code)
77
- },
78
- { alwaysLast: false },
79
- ).bind(this)
74
+ // Unmount when process exits
75
+ this.unsubscribeExit = onProcessExit((code) => {
76
+ this.unmount(code)
77
+ })
80
78
  }
81
79
 
82
80
  get fileManager() {
package/src/devtools.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { execa } from 'execa'
2
- import { onExit } from 'signal-exit'
1
+ import { spawn } from 'node:child_process'
2
+ import { onProcessExit } from '@kubb/fabric-core'
3
3
  import ws from 'ws'
4
-
5
4
  import { Renderer } from './Renderer.ts'
6
5
 
7
6
  declare global {
@@ -92,12 +91,12 @@ export function openDevtools() {
92
91
  console.info('Opening devtools')
93
92
  const controller = new AbortController()
94
93
  if (!isOpen) {
95
- execa({
94
+ const child = spawn('npx', ['react-devtools@6.1.5'], {
95
+ signal: controller.signal,
96
96
  stdio: 'pipe',
97
- preferLocal: true,
98
- cancelSignal: controller.signal,
99
- gracefulCancel: true,
100
- })`npx react-devtools@6.1.5`
97
+ detached: true,
98
+ })
99
+ child.unref()
101
100
  }
102
101
 
103
102
  isOpen = true
@@ -133,12 +132,9 @@ export function openDevtools() {
133
132
  console.info('Error when connecting the devtools')
134
133
  }
135
134
 
136
- onExit(
137
- () => {
138
- console.info('Disconnecting devtools')
139
- controller.abort()
140
- },
141
- { alwaysLast: false },
142
- )
135
+ onProcessExit(() => {
136
+ console.info('Disconnecting devtools')
137
+ controller.abort()
138
+ })
143
139
  })
144
140
  }
@@ -1,4 +1,4 @@
1
- import { orderBy } from 'natural-orderby'
1
+ import { sortBy } from 'remeda'
2
2
 
3
3
  export type Param = {
4
4
  /**
@@ -44,28 +44,22 @@ type Options = {
44
44
  }
45
45
 
46
46
  function order(items: Array<[key: string, item?: ParamItem]>) {
47
- return orderBy(
48
- items.filter(Boolean),
49
- [
50
- ([_key, item]) => {
51
- if (item?.children) {
52
- return 0 // Treat items with children as required (they'll get = {} if all children are optional)
53
- }
54
- // Priority order: required (0) → optional (1) → default-only (2)
55
- if (item?.optional) {
56
- return 1 // Optional parameters (with or without default)
57
- }
58
- if (item?.default) {
59
- // Parameters with default only (not marked as optional)
60
- // Note: While the ParamItem type suggests optional and default are mutually exclusive,
61
- // this handles the case where a parameter has a default value but isn't explicitly marked as optional
62
- return 2
63
- }
64
- return 0 // Required parameters
65
- },
66
- ],
67
- ['asc'],
68
- )
47
+ return sortBy(items.filter(Boolean) as Array<[key: string, item?: ParamItem]>, ([_key, item]) => {
48
+ if (item?.children) {
49
+ return 0 // Treat items with children as required (they'll get = {} if all children are optional)
50
+ }
51
+ // Priority order: required (0) → optional (1) → default-only (2)
52
+ if (item?.optional) {
53
+ return 1 // Optional parameters (with or without default)
54
+ }
55
+ if (item?.default) {
56
+ // Parameters with default only (not marked as optional)
57
+ // Note: While the ParamItem type suggests optional and default are mutually exclusive,
58
+ // this handles the case where a parameter has a default value but isn't explicitly marked as optional
59
+ return 2
60
+ }
61
+ return 0 // Required parameters
62
+ })
69
63
  }
70
64
 
71
65
  function parseChild(key: string, item: ParamItem, options: Options): string | null {