frontend-hamroun 1.1.60 → 1.1.61

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.60",
3
+ "version": "1.1.61",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,19 +1,20 @@
1
- {
2
- "name": "esbuild",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "npx frontend-hamroun dev",
8
- "build": "npx frontend-hamroun build",
9
- "lint": "eslint src --ext ts,tsx"
10
- },
11
- "dependencies": {
12
- "frontend-hamroun": "latest"
13
- },
14
- "devDependencies": {
15
- "esbuild": "^0.19.2",
16
- "sirv-cli": "^2.0.2",
17
- "typescript": "^5.0.0"
18
- }
19
- }
1
+ {
2
+ "name": "ctttt",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "npx frontend-hamroun dev",
8
+ "build": "npx frontend-hamroun build",
9
+ "lint": "eslint src --ext ts,tsx",
10
+ "typecheck": "tsc --noEmit"
11
+ },
12
+ "devDependencies": {
13
+ "esbuild": "^0.19.2",
14
+ "sirv-cli": "^2.0.2",
15
+ "typescript": "^5.0.0"
16
+ },
17
+ "dependencies": {
18
+ "frontend-hamroun": "^1.1.59"
19
+ }
20
+ }
@@ -1,15 +1,19 @@
1
- import { render, useState, Link, useRouter } from 'frontend-hamroun';
1
+ import { render, useState, Link, useRouter, jsx, Fragment } from 'frontend-hamroun';
2
2
 
3
3
  // Home component
4
4
  function Home() {
5
- const [count, setCount] = useState(0);
5
+ const [count, setCount] = useState<number>(0);
6
+
7
+ const decrement = () => setCount((prev: number) => Math.max(0, prev - 1));
8
+ const increment = () => setCount((prev: number) => prev + 1);
9
+
6
10
  return (
7
11
  <div>
8
12
  <h1>Home Page</h1>
9
13
  <div>
10
- <button onClick={() => setCount(count - 1)}>-</button>
11
- <span style={{ margin: '0 10px' }}>{count}</span>
12
- <button onClick={() => setCount(count + 1)}>+</button>
14
+ <button onClick={decrement}>-</button>
15
+ <span>{count ?? 0}</span>
16
+ <button onClick={increment}>+</button>
13
17
  </div>
14
18
  </div>
15
19
  );
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ES2020",
4
- "module": "ESNext",
4
+ "useDefineForClassFields": true,
5
5
  "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
- "jsx": "preserve",
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
7
8
  "moduleResolution": "bundler",
8
- "esModuleInterop": true,
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "preserve",
14
+ "jsxFactory": "jsx",
15
+ "jsxImportSource": "frontend-hamroun",
9
16
  "strict": true,
10
- "skipLibCheck": true
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "noFallthroughCasesInSwitch": true
11
20
  },
12
21
  "include": ["src"]
13
22
  }
@@ -1,28 +0,0 @@
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,24 +0,0 @@
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
- });
@@ -1,4 +0,0 @@
1
- import { jsx as createElement, Fragment } from 'frontend-hamroun';
2
-
3
- window.createElement = createElement;
4
- window.Fragment = Fragment;