@fastly/hono-fastly-compute 0.2.0 → 0.3.1

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 CHANGED
@@ -7,11 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [unreleased]
9
9
 
10
- ## [0.2.0] - 2025-10-06
10
+ ## [0.3.1] - 2025-10-08
11
+
12
+ ### Fixed
13
+
14
+ - Fix typings when bindings are empty
15
+
16
+ ## [0.3.0] - 2025-10-06
11
17
 
12
18
  ### Changed
13
19
 
14
- - BREAKING: Updated to new identifiers from `@fastly/compute-js-context`
20
+ - Moved to `@fastly` scope
15
21
 
16
22
  ## [0.1.0] - 2025-10-03
17
23
 
@@ -19,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
25
 
20
26
  - Initial public release
21
27
 
22
- [unreleased]: https://github.com/fastly/hono-fastly-compute/compare/v0.2.0...HEAD
23
- [0.2.0]: https://github.com/fastly/hono-fastly-compute/compare/v0.1.0...v0.2.0
28
+ [unreleased]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.1...HEAD
29
+ [0.3.1]: https://github.com/fastly/hono-fastly-compute/compare/v0.3.0...v0.3.1
30
+ [0.3.0]: https://github.com/fastly/hono-fastly-compute/compare/v0.1.0...v0.3.0
24
31
  [0.1.0]: https://github.com/fastly/hono-fastly-compute/releases/tag/v0.1.0
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Hono Adapter for Fastly Compute
2
2
 
3
+ > NOTE: `@fastly/hono-fastly-compute` is provided as a Fastly Labs product. Visit the [Fastly Labs](https://www.fastlylabs.com/) site for terms of use.
4
+
3
5
  This library provides an adapter for using the [Hono](https://hono.dev/) web framework with [Fastly Compute](https://www.fastly.com/products/edge-compute). It simplifies the process of creating Hono applications that run on Fastly's edge platform.
4
6
 
5
7
  ## Features
@@ -95,7 +97,17 @@ The core adapter function that connects Hono to the Fastly Compute `FetchEvent`.
95
97
 
96
98
  ### `logFastlyServiceVersion()`
97
99
 
98
- A middleware for Hono that logs the string `FASTLY_SERVICE_VERSION: <service-version>` environment variable to the console.
100
+ A Hono middleware that logs to the console the string `FASTLY_SERVICE_VERSION` followed by the value of the environment variable **FASTLY_SERVICE_VERSION**.
101
+
102
+ ## Issues
103
+
104
+ If you encounter any non-security-related bug or unexpected behavior, please [file an issue][bug] using the bug report template.
105
+
106
+ [bug]: https://github.com/fastly/hono-fastly-compute/issues/new?labels=bug
107
+
108
+ ### Security issues
109
+
110
+ Please see our [SECURITY.md](SECURITY.md) for guidance on reporting security-related issues.
99
111
 
100
112
  ## License
101
113
 
package/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ ## Report a security issue
2
+
3
+ The project team welcomes security reports and is committed to providing prompt attention to security issues. Security
4
+ issues should be reported privately via [Fastly’s security issue reporting process](https://www.fastly.com/security/report-security-issue).
5
+
6
+ ## Security advisories
7
+
8
+ Remediation of security vulnerabilities is prioritized by the project team. The project team endeavors to coordinate
9
+ remediation with third-party stakeholders, and is committed to transparency in the disclosure process. The team announces
10
+ security issues via [GitHub](https://github.com/fastly/hono-fastly-compute/releases) on a best-effort basis.
11
+
12
+ Note that communications related to security issues in Fastly-maintained OSS as described here are distinct from
13
+ [Fastly Security Advisories](https://www.fastly.com/security-advisories).
package/build/fire.d.ts CHANGED
@@ -2,32 +2,35 @@ import type { Schema } from 'hono';
2
2
  import type { HonoBase } from 'hono/hono-base';
3
3
  import type { ContextProxy, BindingsDefs } from '@fastly/compute-js-context';
4
4
  import { type HandleOptions } from './handler.js';
5
+ /**
6
+ * Registers a Hono app to handle fetch events in Fastly Compute.
7
+ *
8
+ * This sets up `addEventListener('fetch', handle(app, envBindingsDefs, options))`
9
+ * using the bindings you passed to `buildFire()`.
10
+ *
11
+ * @param app - The Hono application instance to serve
12
+ * @param options - Options for handling requests (fetch defaults to undefined)
13
+ *
14
+ * @example
15
+ * const fire = buildFire({ foo: "KVStore" });
16
+ *
17
+ * type Env = {
18
+ * Variables: Variables;
19
+ * Bindings: typeof fire.Bindings;
20
+ * };
21
+ *
22
+ * const app = new Hono<Env>();
23
+ * fire(app);
24
+ */
5
25
  type FireFn<D extends BindingsDefs> = {
6
- /**
7
- * Registers a Hono app to handle fetch events in Fastly Compute.
8
- *
9
- * This sets up `addEventListener('fetch', handle(app, envBindingsDefs, options))`
10
- * using the bindings you passed to `buildFire()`.
11
- *
12
- * @param app - The Hono application instance to serve
13
- * @param options - Options for handling requests (fetch defaults to undefined)
14
- *
15
- * @example
16
- * const fire = buildFire({ foo: "KVStore" });
17
- *
18
- * type Env = {
19
- * Variables: Variables;
20
- * Bindings: typeof fire.Bindings;
21
- * };
22
- *
23
- * const app = new Hono<Env>();
24
- * fire(app);
25
- */
26
26
  <V extends {
27
27
  Variables?: object;
28
- }, S extends Schema, BasePath extends string>(app: HonoBase<(keyof D extends never ? {} : {
28
+ }, S extends Schema, BasePath extends string>(app: HonoBase<(keyof D extends never ? {} : never) & V, S, BasePath>, options?: HandleOptions): void;
29
+ <V extends {
30
+ Variables?: object;
31
+ }, S extends Schema, BasePath extends string>(app: HonoBase<{
29
32
  Bindings: ContextProxy<D>;
30
- }) & V, S, BasePath>, options?: HandleOptions): void;
33
+ } & V, S, BasePath>, options?: HandleOptions): void;
31
34
  /**
32
35
  * The inferred bindings type, derived from the defs passed to `buildFire()`.
33
36
  * Use this in your Env definition: `{ Bindings: typeof fire.Bindings }`.
package/build/fire.js CHANGED
@@ -34,9 +34,7 @@ import { handle } from './handler.js';
34
34
  * - Exposes a `.Bindings` type inferred from the given defs
35
35
  */
36
36
  export function buildFire(bindingsDefs) {
37
- const fireFn = ((app, options = {
38
- fetch: undefined,
39
- }) => {
37
+ const fireFn = ((app, options = { fetch: undefined, }) => {
40
38
  addEventListener('fetch', handle(app, bindingsDefs, options));
41
39
  });
42
40
  fireFn.defs = bindingsDefs;
@@ -5,14 +5,19 @@ type Handler = (evt: FetchEvent) => void;
5
5
  export type HandleOptions = {
6
6
  fetch?: typeof fetch;
7
7
  };
8
- export type MaybeBindings<D extends BindingsDefs> = keyof D extends never ? {} : {
9
- Bindings: ContextProxy<D>;
8
+ type HandleFn = {
9
+ <D extends BindingsDefs, V extends {
10
+ Variables?: object;
11
+ }, S extends Schema, BasePath extends string>(app: HonoBase<(keyof D extends never ? {} : never) & V, S, BasePath>, envBindingsDefs: D, opts?: HandleOptions): Handler;
12
+ <D extends BindingsDefs, V extends {
13
+ Variables?: object;
14
+ }, S extends Schema, BasePath extends string>(app: HonoBase<{
15
+ Bindings: ContextProxy<D>;
16
+ } & V, S, BasePath>, envBindingsDefs: D, opts?: HandleOptions): Handler;
10
17
  };
11
18
  /**
12
19
  * Adapter for Fastly Compute
13
20
  */
14
- export declare const handle: <D extends BindingsDefs, V extends {
15
- Variables?: object;
16
- }, S extends Schema, BasePath extends string>(app: HonoBase<MaybeBindings<D> & V, S, BasePath>, envBindingsDefs: D, opts?: HandleOptions) => Handler;
21
+ export declare const handle: HandleFn;
17
22
  export {};
18
23
  //# sourceMappingURL=handler.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastly/hono-fastly-compute",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Helper utilities for using Hono with Fastly Compute",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  "clean": "rm -rf build"
27
27
  },
28
28
  "dependencies": {
29
- "@fastly/js-compute": "^3.0.0",
30
- "@fastly/compute-js-context": "^0.3.0"
29
+ "@fastly/compute-js-context": "^0.4.2",
30
+ "@fastly/js-compute": "^3.0.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "hono": "^4.9.5",
@@ -43,7 +43,8 @@
43
43
  "build/**/*.d.ts",
44
44
  "LICENSE",
45
45
  "README.md",
46
- "CHANGELOG.md"
46
+ "CHANGELOG.md",
47
+ "SECURITY.md"
47
48
  ],
48
49
  "keywords": [
49
50
  "hono",