@cfworker/web
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -1,2 +0,2 @@ | ||
import { CookieSerializeOptions } from 'cookie'; | ||
import { SerializeOptions } from 'cookie'; | ||
export declare class Cookies { | ||
@@ -7,3 +7,3 @@ private readonly responseHeaders; | ||
get(name: string): string | null; | ||
set(name: string, val: string, options?: CookieSerializeOptions): void; | ||
set(name: string, val: string, options?: SerializeOptions): void; | ||
} |
@@ -26,9 +26,9 @@ "use strict"; | ||
const Path = (pattern, options) => { | ||
const regExp = (0, path_to_regexp_1.pathToRegexp)(pattern, options); | ||
const { regexp, keys } = (0, path_to_regexp_1.pathToRegexp)(pattern, options); | ||
return ({ req: { url, params } }) => { | ||
const match = url.pathname.match(regExp); | ||
const match = url.pathname.match(regexp); | ||
if (!match) { | ||
return false; | ||
} | ||
collectParameters(regExp.keys, match, params); | ||
collectParameters(keys, match, params); | ||
return true; | ||
@@ -39,3 +39,3 @@ }; | ||
exports.defaultRouterOptions = { | ||
pathToRegExpOptions: { strict: true } | ||
pathToRegExpOptions: {} | ||
}; | ||
@@ -42,0 +42,0 @@ class Router { |
@@ -1,2 +0,2 @@ | ||
import { CookieSerializeOptions } from 'cookie'; | ||
import { SerializeOptions } from 'cookie'; | ||
export declare class Cookies { | ||
@@ -7,3 +7,3 @@ private readonly responseHeaders; | ||
get(name: string): string | null; | ||
set(name: string, val: string, options?: CookieSerializeOptions): void; | ||
set(name: string, val: string, options?: SerializeOptions): void; | ||
} |
@@ -20,9 +20,9 @@ import { pathToRegexp } from 'path-to-regexp'; | ||
export const Path = (pattern, options) => { | ||
const regExp = pathToRegexp(pattern, options); | ||
const { regexp, keys } = pathToRegexp(pattern, options); | ||
return ({ req: { url, params } }) => { | ||
const match = url.pathname.match(regExp); | ||
const match = url.pathname.match(regexp); | ||
if (!match) { | ||
return false; | ||
} | ||
collectParameters(regExp.keys, match, params); | ||
collectParameters(keys, match, params); | ||
return true; | ||
@@ -32,3 +32,3 @@ }; | ||
export const defaultRouterOptions = { | ||
pathToRegExpOptions: { strict: true } | ||
pathToRegExpOptions: {} | ||
}; | ||
@@ -35,0 +35,0 @@ export class Router { |
{ | ||
"name": "@cfworker/web", | ||
"type": "module", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Web framework for Cloudflare Workers and service workers, inspired by Koa and fastify", | ||
@@ -42,10 +42,10 @@ "keywords": [ | ||
"dependencies": { | ||
"@cfworker/json-schema": "^3.0.0", | ||
"@types/cookie": "^0.6.0", | ||
"@cfworker/json-schema": "^3.0.1", | ||
"@types/cookie": "^1.0.0", | ||
"@types/html-escaper": "^3.0.2", | ||
"@types/statuses": "^2.0.5", | ||
"cookie": "^0.6.0", | ||
"cookie": "^1.0.1", | ||
"html-escaper": "^3.0.3", | ||
"negotiator": "^0.6.3", | ||
"path-to-regexp": "^7.1.0", | ||
"negotiator": "^1.0.0", | ||
"path-to-regexp": "^8.2.0", | ||
"secure-json-parse": "^2.7.0", | ||
@@ -55,11 +55,11 @@ "statuses": "^2.0.1" | ||
"devDependencies": { | ||
"@types/chai": "^4.3.17", | ||
"@types/mocha": "^10.0.7", | ||
"chai": "^5.1.1", | ||
"esbuild": "^0.23.1", | ||
"@types/chai": "^5.0.1", | ||
"@types/mocha": "^10.0.9", | ||
"chai": "^5.1.2", | ||
"esbuild": "^0.24.0", | ||
"jsonpointer": "^5.0.1", | ||
"mocha": "^10.7.3", | ||
"typescript": "^5.5.4", | ||
"wrangler": "^3.72.1" | ||
"mocha": "^10.8.2", | ||
"typescript": "^5.6.3", | ||
"wrangler": "^3.87.0" | ||
} | ||
} |
import { | ||
CookieSerializeOptions, | ||
parse as parseCookie, | ||
serialize as serializeCookie | ||
serialize as serializeCookie, | ||
SerializeOptions | ||
} from 'cookie'; | ||
@@ -24,7 +24,3 @@ | ||
public set( | ||
name: string, | ||
val: string, | ||
options?: CookieSerializeOptions | ||
): void { | ||
public set(name: string, val: string, options?: SerializeOptions): void { | ||
this.responseHeaders.append( | ||
@@ -31,0 +27,0 @@ 'Set-Cookie', |
@@ -33,10 +33,10 @@ import { Key, pathToRegexp, PathToRegexpOptions } from 'path-to-regexp'; | ||
) => Predicate = (pattern: string, options?: PathToRegexpOptions) => { | ||
const regExp = pathToRegexp(pattern, options); | ||
const { regexp, keys } = pathToRegexp(pattern, options); | ||
return ({ req: { url, params } }: Context) => { | ||
const match = url.pathname.match(regExp); | ||
const match = url.pathname.match(regexp); | ||
if (!match) { | ||
return false; | ||
} | ||
collectParameters(regExp.keys, match, params); | ||
collectParameters(keys, match, params); | ||
return true; | ||
@@ -58,3 +58,3 @@ }; | ||
export const defaultRouterOptions: RouterOptions = { | ||
pathToRegExpOptions: { strict: true } | ||
pathToRegExpOptions: {} | ||
}; | ||
@@ -61,0 +61,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
117169
0
2324
+ Added@types/cookie@1.0.0(transitive)
+ Addedcookie@1.0.2(transitive)
+ Addednegotiator@1.0.0(transitive)
+ Addedpath-to-regexp@8.2.0(transitive)
- Removed@types/cookie@0.6.0(transitive)
- Removedcookie@0.6.0(transitive)
- Removednegotiator@0.6.4(transitive)
- Removedpath-to-regexp@7.2.0(transitive)
Updated@cfworker/json-schema@^3.0.1
Updated@types/cookie@^1.0.0
Updatedcookie@^1.0.1
Updatednegotiator@^1.0.0
Updatedpath-to-regexp@^8.2.0