@fastly/hono-fastly-compute 0.3.3 → 0.3.5
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/CHANGELOG.md +15 -1
- package/README.md +10 -1
- package/build/fire.d.ts +2 -2
- package/build/handler.js +3 -3
- package/build/index.d.ts +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.5] - 2025-10-19
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Fixed incorrect type on FireFn overload
|
|
15
|
+
|
|
16
|
+
## [0.3.4] - 2025-10-17
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Improve `executionCtx` and `event` integration
|
|
21
|
+
|
|
10
22
|
## [0.3.3] - 2025-10-15
|
|
11
23
|
|
|
12
24
|
### Changed
|
|
@@ -42,7 +54,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
42
54
|
|
|
43
55
|
- Initial public release
|
|
44
56
|
|
|
45
|
-
[unreleased]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.
|
|
57
|
+
[unreleased]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.5...HEAD
|
|
58
|
+
[0.3.5]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.4...v0.3.5
|
|
59
|
+
[0.3.4]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.3...v0.3.4
|
|
46
60
|
[0.3.3]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.2...v0.3.3
|
|
47
61
|
[0.3.2]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.1...v0.3.2
|
|
48
62
|
[0.3.1]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.0...v0.3.1
|
package/README.md
CHANGED
|
@@ -101,9 +101,18 @@ The returned `fire` function has two purposes:
|
|
|
101
101
|
1. When called with a Hono app instance (`fire(app)`), it registers the app to handle fetch events.
|
|
102
102
|
2. It exposes a `Bindings` type (`typeof fire.Bindings`) that you can use to define your Hono `Env`.
|
|
103
103
|
|
|
104
|
+
### `fire(app, options)`
|
|
105
|
+
|
|
106
|
+
Registers your Hono app to handle fetch events. No user-defined bindings are
|
|
107
|
+
applied to `c.env`. Equivalent to the return value of `buildFire({})`.
|
|
108
|
+
|
|
109
|
+
### Type `Bindings`
|
|
110
|
+
|
|
111
|
+
Default bindings which can be used when no user-defined bindings are present. Alias of `fire.Bindings`.
|
|
112
|
+
|
|
104
113
|
### `handle(app, bindingsDefs, options)`
|
|
105
114
|
|
|
106
|
-
The core adapter function that connects Hono to the Fastly Compute `FetchEvent`. The `
|
|
115
|
+
The core adapter function that connects Hono to the Fastly Compute `FetchEvent`. The `fire` function is a higher-level utility that uses `handle` internally.
|
|
107
116
|
|
|
108
117
|
- **`app`**: The Hono application instance.
|
|
109
118
|
- **`bindingsDefs`**: The environment bindings definition.
|
package/build/fire.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Schema } from 'hono';
|
|
2
2
|
import type { HonoBase } from 'hono/hono-base';
|
|
3
|
-
import type { BindingsDefs
|
|
3
|
+
import type { BindingsDefs } from '@fastly/compute-js-context';
|
|
4
4
|
import { type BindingsWithClientInfo, type HandleOptions } from './handler.js';
|
|
5
5
|
/**
|
|
6
6
|
* Registers a Hono app to handle fetch events in Fastly Compute.
|
|
@@ -29,7 +29,7 @@ type FireFn<D extends BindingsDefs> = {
|
|
|
29
29
|
<V extends {
|
|
30
30
|
Variables?: object;
|
|
31
31
|
}, S extends Schema, BasePath extends string>(app: HonoBase<{
|
|
32
|
-
Bindings:
|
|
32
|
+
Bindings: BindingsWithClientInfo<D>;
|
|
33
33
|
} & V, S, BasePath>, options?: HandleOptions): void;
|
|
34
34
|
/**
|
|
35
35
|
* The inferred bindings type, derived from the defs passed to `buildFire()`.
|
package/build/handler.js
CHANGED
|
@@ -17,13 +17,13 @@ export const handle = (app, envBindingsDefs, opts = {
|
|
|
17
17
|
serverInfo: evt.server,
|
|
18
18
|
};
|
|
19
19
|
const env = buildContextProxyOn(envBase, envBindingsDefs);
|
|
20
|
-
const
|
|
21
|
-
waitUntil: evt.waitUntil.bind(evt),
|
|
20
|
+
const executionCtx = Object.assign(evt, {
|
|
22
21
|
passThroughOnException() {
|
|
23
22
|
throw new Error('Not implemented');
|
|
24
23
|
},
|
|
25
|
-
props:
|
|
24
|
+
props: {},
|
|
26
25
|
});
|
|
26
|
+
const res = await app.fetch(evt.request, env, executionCtx);
|
|
27
27
|
if (opts.fetch && res.status === 404) {
|
|
28
28
|
return await opts.fetch(evt.request);
|
|
29
29
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -3,4 +3,10 @@ export * from './handler.js';
|
|
|
3
3
|
export * from './utils.js';
|
|
4
4
|
export * from './conninfo.js';
|
|
5
5
|
export type { ResourceType, Context, ContextProxy, BindingsDefs, } from '@fastly/compute-js-context';
|
|
6
|
+
declare module 'hono/types' {
|
|
7
|
+
interface FetchEventLike {
|
|
8
|
+
readonly client: ClientInfo;
|
|
9
|
+
readonly server: ServerInfo;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
6
12
|
//# sourceMappingURL=index.d.ts.map
|