@lengkapp/edge 0.0.19 → 0.0.20

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @lengkapp/edge v0.0.19
2
+ * @lengkapp/edge v0.0.20
3
3
  * MIT License
4
4
  *
5
5
  * LengkApp Edge License
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @lengkapp/edge v0.0.19
2
+ * @lengkapp/edge v0.0.20
3
3
  * MIT License
4
4
  *
5
5
  * LengkApp Edge License
@@ -32,7 +32,7 @@
32
32
  */
33
33
  // edge-server.d.ts
34
34
 
35
- export const Fragment: unique symbol;
35
+ export function Fragment(props: { children?: any }): JSXNode;
36
36
 
37
37
  export interface JSXNode {
38
38
  type: unknown;
@@ -169,12 +169,11 @@ export class Edge<E = any> {
169
169
 
170
170
  /* ---------------- JSX typing for this runtime ---------------- */
171
171
 
172
- export namespace JSX {
173
- type Element = JSXNode;
174
- interface IntrinsicElements {
175
- [elemName: string]: any;
176
- }
177
- interface ElementChildrenAttribute {
178
- children: {};
172
+ declare global {
173
+ namespace JSX {
174
+ type Element = JSXNode;
175
+ type ElementType = string | symbol | ((props: any) => JSXNode);
176
+ interface IntrinsicElements { [elemName: string]: any; }
177
+ interface ElementChildrenAttribute { children: {}; }
179
178
  }
180
179
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @lengkapp/edge v0.0.19
2
+ * @lengkapp/edge v0.0.20
3
3
  * MIT License
4
4
  *
5
5
  * LengkApp Edge License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lengkapp/edge",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Edge framework used by Lengkapp",
5
5
  "main": "dist/edge-server.js",
6
6
  "types": "dist/edge-server.d.ts",
package/readme.md CHANGED
@@ -54,9 +54,51 @@ const app = new Edge();
54
54
  app.get('/', (ctx) => ctx.text('Hello World!'));
55
55
  app.get('/users/:id', (ctx) => ctx.json({ id: ctx.params.id }));
56
56
 
57
- export default {
58
- fetch: (request, env, ctx) => app.fetch(request, env, ctx),
59
- };
57
+ export default app;
58
+ ```
59
+
60
+ or if you will use jsx `worker.tsx`:
61
+
62
+ ```ts
63
+ import { Edge, jsx, Fragment } from '@lengkapp/edge';
64
+
65
+ const app = new Edge();
66
+
67
+ const Card = () => (
68
+ <div>card</div>
69
+ );
70
+
71
+ const LandingPage = () => (
72
+ <>
73
+ <h1>
74
+ hello world
75
+ </h1>
76
+ <Card />
77
+ </>
78
+ );
79
+ app.get('/', () => <LandingPage />);
80
+
81
+ export default app;
82
+ ```
83
+
84
+ if you use typescript `tsconfig.json`:
85
+
86
+ ```typescript
87
+ {
88
+ "compilerOptions": {
89
+ "jsx": "react",
90
+ "jsxFactory": "jsx",
91
+ "jsxFragmentFactory": "Fragment",
92
+ "paths": { "@/*": ["./src/*"] },
93
+ "types": ["@cloudflare/workers-types"],
94
+ "target": "ESNext",
95
+ "module": "ESNext",
96
+ "moduleResolution": "Bundler",
97
+ "strict": true,
98
+ "skipLibCheck": true,
99
+ "lib": ["ESNext", "WebWorker"]
100
+ }
101
+ }
60
102
  ```
61
103
 
62
104
  `wrangler.jsonc`:
@@ -66,11 +108,18 @@ export default {
66
108
  "$schema": "./node_modules/wrangler/config-schema.json",
67
109
  "name": "my-edge-app",
68
110
  "main": "worker.js",
69
- "compatibility_date": "2026-09-06",
70
- "observability": { "enabled": true }
111
+ "compatibility_date": "2026-09-06"
71
112
  }
72
113
  ```
73
114
 
115
+ or `wrangler.toml`:
116
+
117
+ ```toml
118
+ name = "my-edge-app"
119
+ main = "worker.js"
120
+ compatibility_date = "2026-09-14"
121
+ ```
122
+
74
123
  Deploy:
75
124
 
76
125
  ```bash