@flexireact/core 3.0.0 → 3.0.2

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.
Files changed (56) hide show
  1. package/README.md +204 -52
  2. package/dist/cli/index.js +1514 -0
  3. package/dist/cli/index.js.map +1 -0
  4. package/dist/core/client/index.js +373 -0
  5. package/dist/core/client/index.js.map +1 -0
  6. package/dist/core/index.js +6415 -0
  7. package/dist/core/index.js.map +1 -0
  8. package/dist/core/server/index.js +3094 -0
  9. package/dist/core/server/index.js.map +1 -0
  10. package/package.json +80 -80
  11. package/bin/flexireact.js +0 -23
  12. package/cli/generators.ts +0 -616
  13. package/cli/index.ts +0 -1182
  14. package/core/actions/index.ts +0 -364
  15. package/core/api.ts +0 -143
  16. package/core/build/index.ts +0 -425
  17. package/core/cli/logger.ts +0 -353
  18. package/core/client/Link.tsx +0 -345
  19. package/core/client/hydration.ts +0 -147
  20. package/core/client/index.ts +0 -12
  21. package/core/client/islands.ts +0 -143
  22. package/core/client/navigation.ts +0 -212
  23. package/core/client/runtime.ts +0 -52
  24. package/core/config.ts +0 -116
  25. package/core/context.ts +0 -83
  26. package/core/dev.ts +0 -47
  27. package/core/devtools/index.ts +0 -644
  28. package/core/edge/cache.ts +0 -344
  29. package/core/edge/fetch-polyfill.ts +0 -247
  30. package/core/edge/handler.ts +0 -248
  31. package/core/edge/index.ts +0 -81
  32. package/core/edge/ppr.ts +0 -264
  33. package/core/edge/runtime.ts +0 -161
  34. package/core/font/index.ts +0 -306
  35. package/core/helpers.ts +0 -494
  36. package/core/image/index.ts +0 -413
  37. package/core/index.ts +0 -218
  38. package/core/islands/index.ts +0 -293
  39. package/core/loader.ts +0 -111
  40. package/core/logger.ts +0 -242
  41. package/core/metadata/index.ts +0 -622
  42. package/core/middleware/index.ts +0 -416
  43. package/core/plugins/index.ts +0 -373
  44. package/core/render/index.ts +0 -1243
  45. package/core/render.ts +0 -136
  46. package/core/router/index.ts +0 -551
  47. package/core/router.ts +0 -141
  48. package/core/rsc/index.ts +0 -199
  49. package/core/server/index.ts +0 -779
  50. package/core/server.ts +0 -203
  51. package/core/ssg/index.ts +0 -346
  52. package/core/start-dev.ts +0 -6
  53. package/core/start-prod.ts +0 -6
  54. package/core/tsconfig.json +0 -30
  55. package/core/types.ts +0 -239
  56. package/core/utils.ts +0 -176
package/core/context.ts DELETED
@@ -1,83 +0,0 @@
1
- /**
2
- * FlexiReact Context System
3
- * Provides request context and shared state for SSR/RSC
4
- */
5
-
6
- import React from 'react';
7
-
8
- // Server-side request context
9
- export const RequestContext = React.createContext(null);
10
-
11
- // Route context for nested routes
12
- export const RouteContext = React.createContext(null);
13
-
14
- // Layout context
15
- export const LayoutContext = React.createContext(null);
16
-
17
- /**
18
- * Creates a request context value
19
- */
20
- export function createRequestContext(req, res, params = {}, query = {}) {
21
- return {
22
- req,
23
- res,
24
- params,
25
- query,
26
- url: req.url,
27
- method: req.method,
28
- headers: req.headers,
29
- cookies: parseCookies(req.headers.cookie || '')
30
- };
31
- }
32
-
33
- /**
34
- * Parse cookies from header string
35
- */
36
- function parseCookies(cookieHeader) {
37
- const cookies = {};
38
- if (!cookieHeader) return cookies;
39
-
40
- cookieHeader.split(';').forEach(cookie => {
41
- const [name, ...rest] = cookie.split('=');
42
- if (name) {
43
- cookies[name.trim()] = rest.join('=').trim();
44
- }
45
- });
46
-
47
- return cookies;
48
- }
49
-
50
- /**
51
- * Hook to access request context (server-side only)
52
- */
53
- export function useRequest() {
54
- const context = React.useContext(RequestContext);
55
- if (!context) {
56
- throw new Error('useRequest must be used within a RequestContext provider');
57
- }
58
- return context;
59
- }
60
-
61
- /**
62
- * Hook to access route params
63
- */
64
- export function useParams() {
65
- const context = React.useContext(RouteContext);
66
- return context?.params || {};
67
- }
68
-
69
- /**
70
- * Hook to access query parameters
71
- */
72
- export function useQuery() {
73
- const context = React.useContext(RouteContext);
74
- return context?.query || {};
75
- }
76
-
77
- /**
78
- * Hook to access current pathname
79
- */
80
- export function usePathname() {
81
- const context = React.useContext(RouteContext);
82
- return context?.pathname || '/';
83
- }
package/core/dev.ts DELETED
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * FlexiReact Dev Server Launcher
5
- * This script starts the server with the JSX loader enabled
6
- */
7
-
8
- import { spawn } from 'child_process';
9
- import { fileURLToPath, pathToFileURL } from 'url';
10
- import path from 'path';
11
-
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = path.dirname(__filename);
14
-
15
- const serverPath = path.join(__dirname, 'server.js');
16
- const loaderPath = path.join(__dirname, 'loader.js');
17
-
18
- // Convert to file:// URLs for Windows compatibility
19
- const loaderUrl = pathToFileURL(loaderPath).href;
20
-
21
- // Start Node.js with the custom loader
22
- const child = spawn(
23
- process.execPath,
24
- [
25
- '--import',
26
- `data:text/javascript,import { register } from 'node:module'; register('${loaderUrl.replace(/\\/g, '/')}', import.meta.url);`,
27
- serverPath
28
- ],
29
- {
30
- stdio: 'inherit',
31
- cwd: process.cwd(),
32
- env: process.env
33
- }
34
- );
35
-
36
- child.on('error', (error) => {
37
- console.error('Failed to start server:', error);
38
- process.exit(1);
39
- });
40
-
41
- child.on('exit', (code) => {
42
- process.exit(code || 0);
43
- });
44
-
45
- // Forward signals to child process
46
- process.on('SIGINT', () => child.kill('SIGINT'));
47
- process.on('SIGTERM', () => child.kill('SIGTERM'));