frontend-hamroun 1.1.34 → 1.1.36

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.1.34",
3
+ "version": "1.1.36",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,28 @@
1
+ import * as esbuild from 'esbuild';
2
+
3
+ const isWatch = process.argv.includes('--watch');
4
+
5
+ const config = {
6
+ entryPoints: ['src/main.tsx'],
7
+ bundle: true,
8
+ outfile: 'dist/bundle.js',
9
+ loader: { '.tsx': 'tsx' },
10
+ jsxFactory: 'createElement',
11
+ jsxFragment: 'null',
12
+ platform: 'browser',
13
+ target: 'es2020',
14
+ minify: true,
15
+ inject: ['./src/jsx-shim.ts'],
16
+ define: {
17
+ 'Fragment': 'null'
18
+ }
19
+ };
20
+
21
+ if (isWatch) {
22
+ const ctx = await esbuild.context(config);
23
+ await ctx.watch();
24
+ console.log('Watching...');
25
+ } else {
26
+ await esbuild.build(config);
27
+ console.log('Build complete');
28
+ }
@@ -1,25 +1,19 @@
1
1
  {
2
- "name": "my-app",
2
+ "name": "esbuild",
3
3
  "private": true,
4
4
  "version": "0.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "vite",
8
- "build": "tsc && vite build",
9
- "preview": "vite preview",
10
- "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11
- "lint:fix": "eslint src --ext ts,tsx --fix"
7
+ "dev": "node server.js",
8
+ "build": "node esbuild.config.js",
9
+ "lint": "eslint src --ext ts,tsx"
12
10
  },
13
11
  "dependencies": {
14
12
  "frontend-hamroun": "latest"
15
13
  },
16
14
  "devDependencies": {
17
- "typescript": "^5.0.0",
18
- "vite": "^4.4.9",
19
- "@typescript-eslint/eslint-plugin": "^6.0.0",
20
- "@typescript-eslint/parser": "^6.0.0",
21
- "eslint": "^8.45.0",
22
- "eslint-plugin-react-hooks": "^4.6.0",
23
- "eslint-plugin-react-refresh": "^0.4.3"
15
+ "esbuild": "^0.19.2",
16
+ "sirv-cli": "^2.0.2",
17
+ "typescript": "^5.0.0"
24
18
  }
25
19
  }
@@ -0,0 +1,24 @@
1
+ import { spawn } from 'child_process';
2
+ import sirv from 'sirv';
3
+ import http from 'http';
4
+
5
+ // Start esbuild in watch mode
6
+ const esbuild = spawn('node', ['esbuild.config.js', '--watch'], {
7
+ stdio: 'inherit'
8
+ });
9
+
10
+ // Create simple static server
11
+ const serve = sirv('.', {
12
+ dev: true,
13
+ single: true
14
+ });
15
+
16
+ const server = http.createServer(serve);
17
+ server.listen(3000);
18
+ console.log('Server running at http://localhost:3000');
19
+
20
+ process.on('SIGTERM', () => {
21
+ esbuild.kill();
22
+ server.close();
23
+ process.exit();
24
+ });