@flexireact/core 3.0.1 → 3.0.3

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 (55) hide show
  1. package/dist/cli/index.js +1514 -0
  2. package/dist/cli/index.js.map +1 -0
  3. package/dist/core/client/index.js +373 -0
  4. package/dist/core/client/index.js.map +1 -0
  5. package/dist/core/index.js +6415 -0
  6. package/dist/core/index.js.map +1 -0
  7. package/dist/core/server/index.js +3094 -0
  8. package/dist/core/server/index.js.map +1 -0
  9. package/package.json +80 -80
  10. package/bin/flexireact.js +0 -23
  11. package/cli/generators.ts +0 -616
  12. package/cli/index.ts +0 -1182
  13. package/core/actions/index.ts +0 -364
  14. package/core/api.ts +0 -143
  15. package/core/build/index.ts +0 -425
  16. package/core/cli/logger.ts +0 -353
  17. package/core/client/Link.tsx +0 -345
  18. package/core/client/hydration.ts +0 -147
  19. package/core/client/index.ts +0 -12
  20. package/core/client/islands.ts +0 -143
  21. package/core/client/navigation.ts +0 -212
  22. package/core/client/runtime.ts +0 -52
  23. package/core/config.ts +0 -116
  24. package/core/context.ts +0 -83
  25. package/core/dev.ts +0 -47
  26. package/core/devtools/index.ts +0 -644
  27. package/core/edge/cache.ts +0 -344
  28. package/core/edge/fetch-polyfill.ts +0 -247
  29. package/core/edge/handler.ts +0 -248
  30. package/core/edge/index.ts +0 -81
  31. package/core/edge/ppr.ts +0 -264
  32. package/core/edge/runtime.ts +0 -161
  33. package/core/font/index.ts +0 -306
  34. package/core/helpers.ts +0 -494
  35. package/core/image/index.ts +0 -413
  36. package/core/index.ts +0 -218
  37. package/core/islands/index.ts +0 -293
  38. package/core/loader.ts +0 -111
  39. package/core/logger.ts +0 -242
  40. package/core/metadata/index.ts +0 -622
  41. package/core/middleware/index.ts +0 -416
  42. package/core/plugins/index.ts +0 -373
  43. package/core/render/index.ts +0 -1243
  44. package/core/render.ts +0 -136
  45. package/core/router/index.ts +0 -551
  46. package/core/router.ts +0 -141
  47. package/core/rsc/index.ts +0 -199
  48. package/core/server/index.ts +0 -779
  49. package/core/server.ts +0 -203
  50. package/core/ssg/index.ts +0 -346
  51. package/core/start-dev.ts +0 -6
  52. package/core/start-prod.ts +0 -6
  53. package/core/tsconfig.json +0 -30
  54. package/core/types.ts +0 -239
  55. 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'));