@cfworker/web 1.12.1 → 1.12.4

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/req.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Reviver } from 'secure-json-parse/index.js';
1
+ import { Reviver } from 'secure-json-parse';
2
2
  import { Accepts } from './accepts.js';
3
3
  export declare class Req {
4
4
  readonly raw: Request;
package/dist/req.js CHANGED
@@ -1,4 +1,4 @@
1
- import { safeParse } from 'secure-json-parse/index.js';
1
+ import { safeParse } from 'secure-json-parse';
2
2
  import { Accepts } from './accepts.js';
3
3
  export class Req {
4
4
  constructor(request) {
package/dist/router.d.ts CHANGED
@@ -13,7 +13,7 @@ export declare const Options: ({ req }: Context) => boolean;
13
13
  export declare const Header: (header: string, value: string) => ({ req }: Context) => boolean;
14
14
  export declare const Host: (host: string) => ({ req }: Context) => boolean;
15
15
  export declare const Referer: (host: string) => ({ req }: Context) => boolean;
16
- export declare const Path: (pattern: string, options?: PathToRegExpOptions | undefined) => ({ req: { url, params } }: Context) => boolean;
16
+ export declare const Path: (pattern: string, options?: PathToRegExpOptions) => ({ req: { url, params } }: Context) => boolean;
17
17
  export declare type RouteCondition = (context: Context) => boolean;
18
18
  export interface Route {
19
19
  conditions: RouteCondition[];
@@ -36,5 +36,5 @@ export declare class Router {
36
36
  all(pathname: string, ...middleware: Middleware[]): this;
37
37
  middleware: Middleware;
38
38
  compose(conditions: RouteCondition[], ...middleware: Middleware[]): this;
39
- private resolve;
39
+ resolve(ctx: Context): Route | undefined;
40
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfworker/web",
3
- "version": "1.12.1",
3
+ "version": "1.12.4",
4
4
  "description": "Web framework for Cloudflare Workers and service workers, inspired by Koa and fastify",
5
5
  "keywords": [
6
6
  "middleware",
@@ -34,26 +34,26 @@
34
34
  "test": "cfworker test test/**/*.spec.ts --nocheck"
35
35
  },
36
36
  "dependencies": {
37
- "@cfworker/json-schema": "^1.12.1",
38
- "@cfworker/worker-types": "^1.12.1",
37
+ "@cfworker/json-schema": "^1.12.4",
38
+ "@cfworker/worker-types": "^1.12.2",
39
39
  "@cloudflare/workers-types": "^2.2.2",
40
- "@types/cookie": "^0.4.1",
40
+ "@types/cookie": "^0.5.1",
41
41
  "@types/html-escaper": "^3.0.0",
42
42
  "@types/statuses": "^2.0.0",
43
- "cookie": "^0.4.1",
43
+ "cookie": "^0.5.0",
44
44
  "html-escaper": "^3.0.3",
45
- "negotiator": "^0.6.2",
46
- "path-to-regexp": "^6.2.0",
47
- "secure-json-parse": "^2.4.0",
45
+ "negotiator": "^0.6.3",
46
+ "path-to-regexp": "^6.2.1",
47
+ "secure-json-parse": "^2.5.0",
48
48
  "statuses": "^2.0.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@cfworker/dev": "^1.13.1",
52
- "@types/chai": "^4.3.0",
53
- "@types/mocha": "^9.1.0",
54
- "chai": "^4.3.4",
55
- "jsonpointer": "^5.0.0",
56
- "mocha": "^9.1.4",
57
- "typescript": "^4.5.5"
51
+ "@cfworker/dev": "^1.14.1",
52
+ "@types/chai": "^4.3.3",
53
+ "@types/mocha": "^9.1.1",
54
+ "chai": "^4.3.6",
55
+ "jsonpointer": "^5.0.1",
56
+ "mocha": "^10.0.0",
57
+ "typescript": "^4.7.4"
58
58
  }
59
59
  }
package/src/req.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Reviver, safeParse } from 'secure-json-parse/index.js';
1
+ import { Reviver, safeParse } from 'secure-json-parse';
2
2
  import { Accepts } from './accepts.js';
3
3
 
4
4
  export class Req {
package/src/router.ts CHANGED
@@ -117,7 +117,7 @@ export class Router {
117
117
  return this;
118
118
  }
119
119
 
120
- private resolve(ctx: Context) {
120
+ public resolve(ctx: Context) {
121
121
  return this.routes.find(
122
122
  ({ conditions }) =>
123
123
  conditions.length === 0 || conditions.every(c => c(ctx))