frontend-hamroun 1.2.11 → 1.2.12
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/bin/cli.mjs +1 -1
- package/package.json +1 -1
- package/scripts/build-cli.js +90 -1
- package/templates/basic-app/package.json +4 -0
- package/templates/basic-app/src/react/index.ts +35 -0
- package/templates/basic-app/src/react/jsx-dev-runtime.ts +13 -0
- package/templates/basic-app/src/react/jsx-runtime.ts +12 -0
- package/templates/basic-app/vite.config.ts +6 -5
package/bin/cli.mjs
CHANGED
@@ -34,7 +34,7 @@ function printBanner() {
|
|
34
34
|
${colors.blue}${colors.bright}╔══════════════════════════════════════════════╗
|
35
35
|
║ ║
|
36
36
|
║ Frontend Hamroun v${packageJson.version.padEnd(25)}║
|
37
|
-
║ A lightweight frontend & backend framework
|
37
|
+
║ A lightweight frontend & backend framework ║
|
38
38
|
║ ║
|
39
39
|
╚══════════════════════════════════════════════╝${colors.reset}
|
40
40
|
`);
|
package/package.json
CHANGED
package/scripts/build-cli.js
CHANGED
@@ -50,7 +50,7 @@ function printBanner() {
|
|
50
50
|
\${colors.blue}\${colors.bright}╔══════════════════════════════════════════════╗
|
51
51
|
║ ║
|
52
52
|
║ Frontend Hamroun v\${packageJson.version.padEnd(25)}║
|
53
|
-
║ A lightweight frontend & backend framework
|
53
|
+
║ A lightweight frontend & backend framework ║
|
54
54
|
║ ║
|
55
55
|
╚══════════════════════════════════════════════╝\${colors.reset}
|
56
56
|
\`);
|
@@ -732,6 +732,95 @@ export default defineConfig({
|
|
732
732
|
);
|
733
733
|
|
734
734
|
console.log(`✅ Created minimal basic template at ${templateDir}`);
|
735
|
+
|
736
|
+
// Create React compatibility layer
|
737
|
+
createReactCompatibilityLayer(templateDir);
|
738
|
+
}
|
739
|
+
|
740
|
+
// Create React compatibility layer
|
741
|
+
function createReactCompatibilityLayer(templateDir) {
|
742
|
+
// Create React compatibility directory
|
743
|
+
const reactDir = path.join(templateDir, 'src/react');
|
744
|
+
if (!fs.existsSync(reactDir)) {
|
745
|
+
fs.mkdirSync(reactDir, { recursive: true });
|
746
|
+
}
|
747
|
+
|
748
|
+
// Create jsx-dev-runtime.ts
|
749
|
+
fs.writeFileSync(
|
750
|
+
path.join(reactDir, 'jsx-dev-runtime.ts'),
|
751
|
+
`import { jsx } from 'frontend-hamroun';
|
752
|
+
|
753
|
+
// Export jsx as jsxDEV for React compatibility
|
754
|
+
export const jsxDEV = jsx;
|
755
|
+
export const Fragment = Symbol('Fragment');
|
756
|
+
export const jsxs = jsx;
|
757
|
+
|
758
|
+
// Default export
|
759
|
+
export default {
|
760
|
+
jsxDEV,
|
761
|
+
Fragment,
|
762
|
+
jsxs
|
763
|
+
};`
|
764
|
+
);
|
765
|
+
|
766
|
+
// Create jsx-runtime.ts
|
767
|
+
fs.writeFileSync(
|
768
|
+
path.join(reactDir, 'jsx-runtime.ts'),
|
769
|
+
`import { jsx } from 'frontend-hamroun';
|
770
|
+
|
771
|
+
// Export jsx functions for React compatibility
|
772
|
+
export const jsxs = jsx;
|
773
|
+
export const Fragment = Symbol('Fragment');
|
774
|
+
|
775
|
+
// Default export
|
776
|
+
export default {
|
777
|
+
jsx,
|
778
|
+
jsxs,
|
779
|
+
Fragment
|
780
|
+
};`
|
781
|
+
);
|
782
|
+
|
783
|
+
// Create index.ts
|
784
|
+
fs.writeFileSync(
|
785
|
+
path.join(reactDir, 'index.ts'),
|
786
|
+
`import {
|
787
|
+
useState,
|
788
|
+
useEffect,
|
789
|
+
useRef,
|
790
|
+
useMemo,
|
791
|
+
useContext,
|
792
|
+
createContext,
|
793
|
+
jsx
|
794
|
+
} from 'frontend-hamroun';
|
795
|
+
|
796
|
+
// Provide React compatibility layer
|
797
|
+
const React = {
|
798
|
+
createElement: jsx,
|
799
|
+
Fragment: Symbol('Fragment'),
|
800
|
+
useState,
|
801
|
+
useEffect,
|
802
|
+
useRef,
|
803
|
+
useMemo,
|
804
|
+
useContext,
|
805
|
+
createContext
|
806
|
+
};
|
807
|
+
|
808
|
+
// Export hooks directly for named imports
|
809
|
+
export {
|
810
|
+
useState,
|
811
|
+
useEffect,
|
812
|
+
useRef,
|
813
|
+
useMemo,
|
814
|
+
useContext,
|
815
|
+
createContext,
|
816
|
+
jsx as createElement
|
817
|
+
};
|
818
|
+
|
819
|
+
// Default export
|
820
|
+
export default React;`
|
821
|
+
);
|
822
|
+
|
823
|
+
console.log(`✅ Created React compatibility layer in ${templateDir}`);
|
735
824
|
}
|
736
825
|
|
737
826
|
// Create React compatibility shims
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import {
|
2
|
+
useState,
|
3
|
+
useEffect,
|
4
|
+
useRef,
|
5
|
+
useMemo,
|
6
|
+
useContext,
|
7
|
+
createContext,
|
8
|
+
jsx
|
9
|
+
} from 'frontend-hamroun';
|
10
|
+
|
11
|
+
// Provide React compatibility layer
|
12
|
+
const React = {
|
13
|
+
createElement: jsx,
|
14
|
+
Fragment: Symbol('Fragment'),
|
15
|
+
useState,
|
16
|
+
useEffect,
|
17
|
+
useRef,
|
18
|
+
useMemo,
|
19
|
+
useContext,
|
20
|
+
createContext
|
21
|
+
};
|
22
|
+
|
23
|
+
// Export hooks directly for named imports
|
24
|
+
export {
|
25
|
+
useState,
|
26
|
+
useEffect,
|
27
|
+
useRef,
|
28
|
+
useMemo,
|
29
|
+
useContext,
|
30
|
+
createContext,
|
31
|
+
jsx as createElement
|
32
|
+
};
|
33
|
+
|
34
|
+
// Default export
|
35
|
+
export default React;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { jsx } from 'frontend-hamroun';
|
2
|
+
|
3
|
+
// Export jsx as jsxDEV for React compatibility
|
4
|
+
export const jsxDEV = jsx;
|
5
|
+
export const Fragment = Symbol('Fragment');
|
6
|
+
export const jsxs = jsx;
|
7
|
+
|
8
|
+
// Default export
|
9
|
+
export default {
|
10
|
+
jsxDEV,
|
11
|
+
Fragment,
|
12
|
+
jsxs
|
13
|
+
};
|
@@ -35,7 +35,8 @@ export default defineConfig({
|
|
35
35
|
define: {
|
36
36
|
global: 'globalThis'
|
37
37
|
}
|
38
|
-
}
|
38
|
+
},
|
39
|
+
include: ['frontend-hamroun']
|
39
40
|
},
|
40
41
|
plugins: [
|
41
42
|
nodePolyfills({
|
@@ -48,11 +49,11 @@ export default defineConfig({
|
|
48
49
|
'bcrypt': 'frontend-hamroun',
|
49
50
|
'jsonwebtoken': 'frontend-hamroun',
|
50
51
|
'mongoose': 'frontend-hamroun',
|
51
|
-
//
|
52
|
-
'react': path.resolve(__dirname, 'src/
|
52
|
+
// Map React imports to our compatibility layer
|
53
|
+
'react': path.resolve(__dirname, 'src/react/index.ts'),
|
53
54
|
'react-dom': 'frontend-hamroun',
|
54
|
-
'react/jsx-runtime': path.resolve(__dirname, 'src/
|
55
|
-
'react/jsx-dev-runtime': path.resolve(__dirname, 'src/
|
55
|
+
'react/jsx-runtime': path.resolve(__dirname, 'src/react/jsx-runtime.ts'),
|
56
|
+
'react/jsx-dev-runtime': path.resolve(__dirname, 'src/react/jsx-dev-runtime.ts')
|
56
57
|
}
|
57
58
|
}
|
58
59
|
});
|