frontend-hamroun 1.2.10 → 1.2.11

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": "frontend-hamroun",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "A lightweight frontend and backend framework for building modern web applications",
5
5
  "type": "module",
6
6
  "main": "dist/frontend-hamroun.umd.js",
@@ -733,3 +733,38 @@ export default defineConfig({
733
733
 
734
734
  console.log(`✅ Created minimal basic template at ${templateDir}`);
735
735
  }
736
+
737
+ // Create React compatibility shims
738
+ function createTemplateShims(templateDir) {
739
+ // Create src directory if it doesn't exist
740
+ const srcDir = path.join(templateDir, 'src');
741
+ if (!fs.existsSync(srcDir)) {
742
+ fs.mkdirSync(srcDir, { recursive: true });
743
+ }
744
+
745
+ // Create shims.ts file for React JSX compatibility
746
+ fs.writeFileSync(
747
+ path.join(srcDir, 'shims.ts'),
748
+ `// This file provides compatibility shims for React JSX imports
749
+
750
+ import { jsx } from 'frontend-hamroun';
751
+
752
+ // Export the jsx function as jsxDEV for React compatibility
753
+ export const jsxDEV = jsx;
754
+
755
+ // Export a Fragment symbol
756
+ export const Fragment = Symbol('Fragment');
757
+
758
+ // Default export as React compatibility layer
759
+ export default {
760
+ createElement: jsx,
761
+ Fragment
762
+ };
763
+ `
764
+ );
765
+
766
+ console.log(`✅ Created React compatibility shims in ${templateDir}`);
767
+ }
768
+
769
+ // Call this function when creating templates
770
+ // ...existing code...
@@ -0,0 +1,9 @@
1
+ // This file provides compatibility shims for React JSX imports
2
+
3
+ import { jsx } from 'frontend-hamroun';
4
+
5
+ // Export the jsx function as jsxDEV for React compatibility
6
+ export const jsxDEV = jsx;
7
+
8
+ // Export a Fragment symbol
9
+ export const Fragment = Symbol('Fragment');
@@ -1,5 +1,6 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import { nodePolyfills } from 'vite-plugin-node-polyfills';
3
+ import path from 'path';
3
4
 
4
5
  export default defineConfig({
5
6
  build: {
@@ -48,10 +49,10 @@ export default defineConfig({
48
49
  'jsonwebtoken': 'frontend-hamroun',
49
50
  'mongoose': 'frontend-hamroun',
50
51
  // Alias React imports to empty modules
51
- 'react': 'frontend-hamroun',
52
+ 'react': path.resolve(__dirname, 'src/shims.ts'),
52
53
  'react-dom': 'frontend-hamroun',
53
- 'react/jsx-runtime': 'frontend-hamroun',
54
- 'react/jsx-dev-runtime': 'frontend-hamroun'
54
+ 'react/jsx-runtime': path.resolve(__dirname, 'src/shims.ts'),
55
+ 'react/jsx-dev-runtime': path.resolve(__dirname, 'src/shims.ts')
55
56
  }
56
57
  }
57
58
  });
@@ -0,0 +1,9 @@
1
+ // This file provides compatibility shims for React JSX imports
2
+
3
+ import { jsx } from 'frontend-hamroun';
4
+
5
+ // Export the jsx function as jsxDEV for React compatibility
6
+ export const jsxDEV = jsx;
7
+
8
+ // Export a Fragment symbol
9
+ export const Fragment = Symbol('Fragment');
@@ -1,5 +1,6 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import { nodePolyfills } from 'vite-plugin-node-polyfills';
3
+ import path from 'path';
3
4
 
4
5
  export default defineConfig({
5
6
  esbuild: {
@@ -74,7 +75,11 @@ export default defineConfig({
74
75
  resolve: {
75
76
  alias: {
76
77
  '@mswjs/interceptors/presets/node': { find: /^@mswjs\/interceptors\/presets\/node/, replacement: '{}' },
77
- './util/nw-pre-gyp/index.html': { find: './util/nw-pre-gyp/index.html', replacement: '{}' }
78
+ './util/nw-pre-gyp/index.html': { find: './util/nw-pre-gyp/index.html', replacement: '{}' },
79
+ 'react/jsx-runtime': path.resolve(__dirname, 'src/shims.ts'),
80
+ 'react/jsx-dev-runtime': path.resolve(__dirname, 'src/shims.ts'),
81
+ 'react': path.resolve(__dirname, 'src/shims.ts'),
82
+ 'react-dom': 'frontend-hamroun'
78
83
  }
79
84
  }
80
85
  });