@emberkit/edge 0.1.2-alpha.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +108 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @emberkit/edge
2
+
3
+ Edge runtime adapters for EmberKit — deploy to Cloudflare Workers, Deno Deploy, and other edge platforms.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @emberkit/edge
9
+ # or
10
+ pnpm add @emberkit/edge
11
+ ```
12
+
13
+ ## Cloudflare Workers
14
+
15
+ ```ts
16
+ import { createCloudflareAdapter } from '@emberkit/edge';
17
+
18
+ const adapter = createCloudflareAdapter();
19
+
20
+ export default {
21
+ fetch(request, env, ctx) {
22
+ return adapter.fetch(request, env, ctx);
23
+ },
24
+ };
25
+ ```
26
+
27
+ ## Deno Deploy
28
+
29
+ ```ts
30
+ import { createDenoAdapter } from '@emberkit/edge';
31
+
32
+ const adapter = createDenoAdapter();
33
+
34
+ Deno.serve((request) => adapter.fetch(request));
35
+ ```
36
+
37
+ ## Edge Adapter
38
+
39
+ ```ts
40
+ import { createEdgeAdapter } from '@emberkit/edge';
41
+
42
+ const adapter = createEdgeAdapter({
43
+ runtime: 'cloudflare',
44
+ streaming: true,
45
+ staticGeneration: true,
46
+ });
47
+
48
+ const response = await adapter.render(context, async () => {
49
+ return '<h1>Hello from the edge</h1>';
50
+ });
51
+ ```
52
+
53
+ ## Utilities
54
+
55
+ ### Bundle Analysis
56
+
57
+ ```ts
58
+ import { analyzeBundle } from '@emberkit/edge';
59
+
60
+ const stats = analyzeBundle(code);
61
+ console.log(stats.size); // bytes
62
+ console.log(stats.warnings); // array of warning strings
63
+ console.log(stats.errors); // array of error strings
64
+ ```
65
+
66
+ ### Static Pages
67
+
68
+ ```ts
69
+ import { StaticPage } from '@emberkit/edge';
70
+
71
+ const page = new StaticPage('<html>...</html>');
72
+ page.addStyle('/styles/main.css');
73
+ page.addScript('/app.js');
74
+ console.log(page.toHTML());
75
+ ```
76
+
77
+ ### Cache Headers
78
+
79
+ ```ts
80
+ import { createCacheHeaders } from '@emberkit/edge';
81
+
82
+ const headers = createCacheHeaders({
83
+ edge: 3600,
84
+ browser: 'public, max-age=300',
85
+ staleWhileRevalidate: 86400,
86
+ });
87
+ ```
88
+
89
+ ### Environment Detection
90
+
91
+ ```ts
92
+ import { isEdgeEnvironment } from '@emberkit/edge';
93
+
94
+ if (isEdgeEnvironment()) {
95
+ // Running on Cloudflare Workers, Deno, or Bun
96
+ }
97
+ ```
98
+
99
+ ## Bundle Size Limits
100
+
101
+ | Level | Size | Description |
102
+ |-------|------|-------------|
103
+ | Warning | 1KB | Bundle approaching limit |
104
+ | Maximum | 8KB | Hard limit for edge runtime |
105
+
106
+ ## License
107
+
108
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emberkit/edge",
3
- "version": "0.1.2-alpha.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Edge runtime adapter for EmberKit",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {},
32
32
  "devDependencies": {
33
- "@emberkit/tsconfig": "0.1.2-alpha.0"
33
+ "@emberkit/tsconfig": "0.1.2"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsc",