@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.
- package/dist/edge-client.js +1 -1
- package/dist/edge-server.d.ts +8 -9
- package/dist/edge-server.js +1 -1
- package/package.json +1 -1
- package/readme.md +54 -5
package/dist/edge-client.js
CHANGED
package/dist/edge-server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @lengkapp/edge v0.0.
|
|
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
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
}
|
package/dist/edge-server.js
CHANGED
package/package.json
CHANGED
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
|
-
|
|
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
|