@flexireact/core 3.0.3 → 4.0.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <img src="./assets/flexireact.webp" alt="FlexiReact Logo" width="400" />
3
3
  </p>
4
4
 
5
- <h1 align="center">⚡ FlexiReact v3</h1>
5
+ <h1 align="center">⚡ FlexiReact v4</h1>
6
6
 
7
7
  <p align="center">
8
8
  <strong>The Future of React Development</strong>
@@ -48,16 +48,14 @@ Open [http://localhost:3000](http://localhost:3000) 🎉
48
48
 
49
49
  ---
50
50
 
51
- ## 🆕 What's New in v3.0
51
+ ## 🆕 What's New in v4
52
52
 
53
- ### v3.0.0 — The Future of React
54
- - **🌐 Universal Edge Runtime** — Deploy anywhere: Node.js, Bun, Deno, Cloudflare Workers, Vercel Edge
55
- - **⚡ Smart Caching** — TTL, stale-while-revalidate, tag-based invalidation
56
- - **🎯 Partial Prerendering (PPR)** — Static shell + streaming dynamic content
57
- - **🛠️ CLI Scaffolding** — Generate pages, components, hooks, APIs with `flexi g`
58
- - **🔧 Advanced DevTools** — Routes, Components, Network, Performance monitoring
59
- - **🎨 FlexiUI Integration** — 50+ beautiful, accessible React components
60
- - **📱 Sexy Templates** — Modern, responsive landing pages out of the box
53
+ ### v4.0.0 — React 19 Native Edition
54
+ - **⚛️ React 19 Native** — Full support for React 19 (Actions, `useActionState`, `useOptimistic`, `useFormStatus`, `use()`)
55
+ - **🚀 Enhanced Actions** — Simplified server action handling with native React 19 primitives
56
+ - **🔄 Improved Hydration** — Leveraging React 19 `onRecoverableError` for better error resilience
57
+ - **📦 New Hooks API** — Centralized `core/hooks` module for React 19 + FlexiReact utilities
58
+ - **⚡ Version 4.0** — Major release with stability improvements and updated CLI templates
61
59
 
62
60
  ## ✨ Features
63
61
 
@@ -92,8 +90,9 @@ Open [http://localhost:3000](http://localhost:3000) 🎉
92
90
  | 🚀 **Prefetch** | Automatic link prefetching for instant navigation |
93
91
  | 🔍 **TanStack Query** | Built-in support for useQuery, useMutation, and caching |
94
92
  | 🐻 **Zustand / Jotai** | Lightweight state management integration |
95
- | ⚡ **Optimistic Updates** | Instant UI feedback with automatic rollback |
96
- | ⏳ **Suspense Ready** | React Suspense for loading states and streaming |
93
+ | ⚡ **Optimistic Updates** | Instant UI feedback with `useOptimistic` (React 19) |
94
+ | ⏳ **Suspense Ready** | React Suspense and `use()` hook for async data |
95
+ | 🏗️ **Actions State** | Native `useActionState` and `useFormStatus` support |
97
96
 
98
97
  ### 🛡️ Middleware & Security
99
98
 
@@ -147,7 +146,7 @@ Open [http://localhost:3000](http://localhost:3000) 🎉
147
146
  | 🎣 **Lifecycle Hooks** | `beforeRender`, `afterRender`, `onError` hooks |
148
147
  | 📦 **Custom Templates** | Create and share your own project templates |
149
148
  | 🔄 **Migration Tools** | Automatic migration from Next.js, CRA, Vite |
150
- | ⚙️ **Config API** | Fully customizable `flexireact.config.ts` |
149
+ | ⚙️ **Config API** | Fully customizable `@flexireact/core.config.ts` |
151
150
 
152
151
  ---
153
152
 
@@ -746,7 +745,7 @@ export default {
746
745
  ### Built-in Plugins
747
746
 
748
747
  ```js
749
- import { builtinPlugins } from 'flexireact';
748
+ import { builtinPlugins } from '@flexireact/core';
750
749
 
751
750
  export default {
752
751
  plugins: [
@@ -859,7 +858,7 @@ Islands provide partial hydration:
859
858
 
860
859
  | Package | Version | Description |
861
860
  |---------|---------|-------------|
862
- | [@flexireact/core](https://www.npmjs.com/package/@flexireact/core) | ![npm](https://img.shields.io/npm/v/@flexireact/core?color=00FF9C) | Core framework |
861
+ | [flexireact](https://www.npmjs.com/package/flexireact) | ![npm](https://img.shields.io/npm/v/@flexireact/core?color=00FF9C) | Core framework |
863
862
  | [@flexireact/flexi-ui](https://www.npmjs.com/package/@flexireact/flexi-ui) | ![npm](https://img.shields.io/npm/v/@flexireact/flexi-ui?color=00FF9C) | UI components |
864
863
  | [create-flexireact](https://www.npmjs.com/package/create-flexireact) | ![npm](https://img.shields.io/npm/v/create-flexireact?color=00FF9C) | Project scaffolding |
865
864
 
package/dist/cli/index.js CHANGED
@@ -730,8 +730,8 @@ async function createDefaultTemplate(projectPath, name, useTypeScript) {
730
730
  doctor: "flexi doctor"
731
731
  },
732
732
  dependencies: {
733
- react: "^18.3.1",
734
- "react-dom": "^18.3.1",
733
+ react: "^19.0.0",
734
+ "react-dom": "^19.0.0",
735
735
  "class-variance-authority": "^0.7.0",
736
736
  clsx: "^2.1.1",
737
737
  "tailwind-merge": "^2.5.5",
@@ -743,8 +743,8 @@ async function createDefaultTemplate(projectPath, name, useTypeScript) {
743
743
  autoprefixer: "^10.4.20",
744
744
  ...useTypeScript ? {
745
745
  typescript: "^5.7.2",
746
- "@types/react": "^18.3.14",
747
- "@types/react-dom": "^18.3.2",
746
+ "@types/react": "^19.0.0",
747
+ "@types/react-dom": "^19.0.0",
748
748
  "@types/node": "^22.10.1"
749
749
  } : {}
750
750
  }
@@ -1104,7 +1104,7 @@ const styles = {
1104
1104
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1105
1105
  },
1106
1106
  nav: {
1107
- position: 'fixed' as const,
1107
+ position: 'fixed',
1108
1108
  top: 0,
1109
1109
  left: 0,
1110
1110
  right: 0,
@@ -1136,10 +1136,10 @@ const styles = {
1136
1136
  navLink: { color: '#94a3b8', textDecoration: 'none', fontSize: 14 },
1137
1137
  hero: {
1138
1138
  display: 'flex',
1139
- flexDirection: 'column' as const,
1139
+ flexDirection: 'column',
1140
1140
  alignItems: 'center',
1141
1141
  justifyContent: 'center',
1142
- textAlign: 'center' as const,
1142
+ textAlign: 'center',
1143
1143
  padding: '140px 24px 80px',
1144
1144
  },
1145
1145
  badge: {
@@ -1168,7 +1168,7 @@ const styles = {
1168
1168
  lineHeight: 1.6,
1169
1169
  marginBottom: 32,
1170
1170
  },
1171
- buttons: { display: 'flex', gap: 16, flexWrap: 'wrap' as const, justifyContent: 'center' },
1171
+ buttons: { display: 'flex', gap: 16, flexWrap: 'wrap', justifyContent: 'center' },
1172
1172
  primaryBtn: {
1173
1173
  background: 'linear-gradient(135deg, #6366f1, #8b5cf6)',
1174
1174
  color: '#fff',
@@ -1195,7 +1195,7 @@ const styles = {
1195
1195
  featuresTitle: {
1196
1196
  fontSize: 32,
1197
1197
  fontWeight: 700,
1198
- textAlign: 'center' as const,
1198
+ textAlign: 'center',
1199
1199
  marginBottom: 48,
1200
1200
  },
1201
1201
  grid: {
@@ -1213,7 +1213,7 @@ const styles = {
1213
1213
  cardTitle: { fontSize: 18, fontWeight: 600, marginBottom: 8 },
1214
1214
  cardDesc: { fontSize: 14, color: '#94a3b8', lineHeight: 1.5 },
1215
1215
  footer: {
1216
- textAlign: 'center' as const,
1216
+ textAlign: 'center',
1217
1217
  padding: 32,
1218
1218
  color: '#64748b',
1219
1219
  borderTop: '1px solid rgba(255,255,255,0.1)',
@@ -1229,7 +1229,7 @@ export function get(req${ext === "tsx" ? ": any" : ""}, res${ext === "tsx" ? ":
1229
1229
  res.json({
1230
1230
  message: 'Hello from FlexiReact API! \u{1F680}',
1231
1231
  timestamp: new Date().toISOString(),
1232
- framework: 'FlexiReact v2.1'
1232
+ framework: 'FlexiReact v3.1'
1233
1233
  });
1234
1234
  }
1235
1235
 
@@ -1254,15 +1254,24 @@ ${pc2.cyan(" \u2502")} ${pc2.dim("The Modern React Framework")} ${p
1254
1254
  ${pc2.cyan(" \u2502")} ${pc2.cyan("\u2502")}
1255
1255
  ${pc2.cyan(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F")}
1256
1256
  `);
1257
- const startDevPath = path2.join(__dirname2, "..", "core", "start-dev.ts");
1257
+ const isBuilt = __dirname2.includes("dist");
1258
+ const ext = isBuilt ? "js" : "ts";
1259
+ const startDevDir = isBuilt ? path2.join(__dirname2, "..", "core") : path2.join(__dirname2, "..", "core");
1260
+ const startDevPath = path2.join(startDevDir, `start-dev.${ext}`);
1261
+ const tsxBin = "tsx";
1258
1262
  const child = spawn(
1259
1263
  "npx",
1260
- ["tsx", startDevPath],
1264
+ [tsxBin, startDevPath],
1261
1265
  {
1262
1266
  stdio: "inherit",
1263
1267
  cwd: process.cwd(),
1264
1268
  shell: true,
1265
- env: { ...process.env, NODE_ENV: "development", FORCE_COLOR: "1" }
1269
+ env: {
1270
+ ...process.env,
1271
+ NODE_ENV: "development",
1272
+ FORCE_COLOR: "1",
1273
+ NODE_PATH: path2.join(process.cwd(), "node_modules")
1274
+ }
1266
1275
  }
1267
1276
  );
1268
1277
  child.on("error", (error) => {
@@ -1282,8 +1291,11 @@ async function runBuild(options = {}) {
1282
1291
  log2.blank();
1283
1292
  const spinner = ora({ text: "Compiling...", color: "cyan" }).start();
1284
1293
  try {
1285
- const buildPath = path2.join(__dirname2, "..", "core", "build", "index.js");
1286
- const configPath = path2.join(__dirname2, "..", "core", "config.js");
1294
+ const isBuilt = __dirname2.includes("dist");
1295
+ const ext = isBuilt ? "js" : "ts";
1296
+ const coreDir = isBuilt ? path2.join(__dirname2, "..", "core") : path2.join(__dirname2, "..", "core");
1297
+ const buildPath = path2.join(coreDir, "build", `index.${ext}`);
1298
+ const configPath = path2.join(coreDir, `config.${ext}`);
1287
1299
  const buildModule = await import(pathToFileURL(buildPath).href);
1288
1300
  const configModule = await import(pathToFileURL(configPath).href);
1289
1301
  const projectRoot = process.cwd();
@@ -1338,7 +1350,9 @@ async function runStart() {
1338
1350
  log2.blank();
1339
1351
  log2.info("Starting production server...");
1340
1352
  log2.blank();
1341
- const startProdPath = path2.join(__dirname2, "..", "core", "start-prod.ts");
1353
+ const isBuilt = __dirname2.includes("dist");
1354
+ const ext = isBuilt ? "js" : "ts";
1355
+ const startProdPath = path2.join(__dirname2, "..", "core", `start-prod.${ext}`);
1342
1356
  const child = spawn(
1343
1357
  "npx",
1344
1358
  ["tsx", startProdPath],