frontend-hamroun 1.1.61 → 1.1.63

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.js CHANGED
@@ -36,8 +36,8 @@ async function buildProject(root, isDev = false) {
36
36
  bundle: true,
37
37
  outfile: path.join(root, 'dist/bundle.js'),
38
38
  loader: { '.tsx': 'tsx', '.ts': 'ts' },
39
- jsxFactory: '_jsx',
40
- jsxFragment: '_Fragment',
39
+ jsxFactory: 'createElement',
40
+ jsxFragment: 'Fragment',
41
41
  platform: 'browser',
42
42
  target: 'es2020',
43
43
  minify: !isDev,
@@ -45,7 +45,19 @@ async function buildProject(root, isDev = false) {
45
45
  define: {
46
46
  'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production')
47
47
  },
48
- inject: [path.join(root, 'src/jsx-shim.js')],
48
+ plugins: [{
49
+ name: 'jsx-import',
50
+ setup(build) {
51
+ build.onResolve({ filter: /\.[tj]sx$/ }, args => ({
52
+ path: args.path,
53
+ namespace: 'jsx-namespace'
54
+ }));
55
+ build.onLoad({ filter: /\.[tj]sx$/, namespace: 'jsx-namespace' }, async args => ({
56
+ contents: `import { createElement, Fragment } from 'frontend-hamroun';\n${await fs.readFile(args.path, 'utf8')}`,
57
+ loader: 'tsx'
58
+ }));
59
+ }
60
+ }]
49
61
  };
50
62
 
51
63
  if (isDev) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.1.61",
3
+ "version": "1.1.63",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "license": "MIT",
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "your-repo-url"
45
+ "url": "https://github.com/your-username/frontend-hamroun"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/react": "^19.0.8",
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from 'vite';
2
+ import path from 'path';
3
+
4
+ export default defineConfig({
5
+ resolve: {
6
+ alias: {
7
+ 'frontend-hamroun': path.resolve(__dirname, 'node_modules/frontend-hamroun')
8
+ }
9
+ },
10
+ esbuild: {
11
+ jsxFactory: 'createElement',
12
+ jsxFragment: 'Fragment',
13
+ jsxInject: `import { createElement, Fragment } from 'frontend-hamroun'`
14
+ }
15
+ });