itty-router 4.0.11 → 4.0.13
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/Router.js +1 -37
- package/Router.mjs +1 -0
- package/StatusError.js +1 -10
- package/StatusError.mjs +1 -0
- package/createCors.js +1 -66
- package/createCors.mjs +1 -0
- package/createResponse.d.ts +1 -1
- package/createResponse.js +1 -14
- package/createResponse.mjs +1 -0
- package/error.js +1 -42
- package/error.mjs +1 -0
- package/html.js +1 -16
- package/html.mjs +1 -0
- package/index.js +1 -189
- package/index.mjs +1 -0
- package/jpeg.js +1 -16
- package/jpeg.mjs +1 -0
- package/json.js +1 -16
- package/json.mjs +1 -0
- package/package.json +104 -16
- package/png.js +1 -16
- package/png.mjs +1 -0
- package/status.d.ts +1 -1
- package/status.js +1 -3
- package/status.mjs +1 -0
- package/text.js +1 -3
- package/text.mjs +1 -0
- package/webp.js +1 -16
- package/webp.mjs +1 -0
- package/websocket.js +1 -20
- package/websocket.mjs +1 -0
- package/withContent.js +1 -7
- package/withContent.mjs +1 -0
- package/withCookies.js +1 -9
- package/withCookies.mjs +1 -0
- package/withParams.js +1 -12
- package/withParams.mjs +1 -0
- package/cjs/Router.d.ts +0 -49
- package/cjs/Router.js +0 -39
- package/cjs/StatusError.d.ts +0 -10
- package/cjs/StatusError.js +0 -12
- package/cjs/createCors.d.ts +0 -12
- package/cjs/createCors.js +0 -68
- package/cjs/createResponse.d.ts +0 -7
- package/cjs/createResponse.js +0 -16
- package/cjs/error.d.ts +0 -11
- package/cjs/error.js +0 -44
- package/cjs/html.d.ts +0 -1
- package/cjs/html.js +0 -18
- package/cjs/index.d.ts +0 -15
- package/cjs/index.js +0 -205
- package/cjs/jpeg.d.ts +0 -1
- package/cjs/jpeg.js +0 -18
- package/cjs/json.d.ts +0 -1
- package/cjs/json.js +0 -18
- package/cjs/png.d.ts +0 -1
- package/cjs/png.js +0 -18
- package/cjs/status.d.ts +0 -1
- package/cjs/status.js +0 -5
- package/cjs/text.d.ts +0 -1
- package/cjs/text.js +0 -5
- package/cjs/webp.d.ts +0 -1
- package/cjs/webp.js +0 -18
- package/cjs/websocket.d.ts +0 -1
- package/cjs/websocket.js +0 -22
- package/cjs/withContent.d.ts +0 -2
- package/cjs/withContent.js +0 -9
- package/cjs/withCookies.d.ts +0 -2
- package/cjs/withCookies.js +0 -11
- package/cjs/withParams.d.ts +0 -2
- package/cjs/withParams.js +0 -14
package/Router.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// @ts-expect-error TypeScript doesn't know that Proxy makes this work
|
|
3
|
-
({
|
|
4
|
-
__proto__: new Proxy({}, {
|
|
5
|
-
// @ts-expect-error (we're adding an expected prop "path" to the get)
|
|
6
|
-
get: (target, prop, receiver, path) => (route, ...handlers) => routes.push([
|
|
7
|
-
prop.toUpperCase(),
|
|
8
|
-
RegExp(`^${(path = (base + '/' + route).replace(/\/+(\/|$)/g, '$1')) // strip double & trailing splash
|
|
9
|
-
.replace(/(\/?\.?):(\w+)\+/g, '($1(?<$2>*))') // greedy params
|
|
10
|
-
.replace(/(\/?\.?):(\w+)/g, '($1(?<$2>[^$1/]+?))') // named params and image format
|
|
11
|
-
.replace(/\./g, '\\.') // dot in path
|
|
12
|
-
.replace(/(\/?)\*/g, '($1.*)?') // wildcard
|
|
13
|
-
}/*$`),
|
|
14
|
-
handlers,
|
|
15
|
-
path, // embed clean route path
|
|
16
|
-
]) && receiver
|
|
17
|
-
}),
|
|
18
|
-
routes,
|
|
19
|
-
async handle(request, ...args) {
|
|
20
|
-
let response, match, url = new URL(request.url), query = request.query = { __proto__: null };
|
|
21
|
-
for (let [k, v] of url.searchParams) {
|
|
22
|
-
query[k] = query[k] === undefined ? v : [query[k], v].flat();
|
|
23
|
-
}
|
|
24
|
-
for (let [method, regex, handlers, path] of routes) {
|
|
25
|
-
if ((method === request.method || method === 'ALL') && (match = url.pathname.match(regex))) {
|
|
26
|
-
request.params = match.groups || {}; // embed params in request
|
|
27
|
-
request.route = path; // embed route path in request
|
|
28
|
-
for (let handler of handlers) {
|
|
29
|
-
if ((response = await handler(request.proxy || request, ...args)) !== undefined)
|
|
30
|
-
return response;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export { Router };
|
|
1
|
+
"use strict";exports.Router=({base:e="",routes:r=[]}={})=>({__proto__:new Proxy({},{get:(o,t,a,p)=>(o,...l)=>r.push([t.toUpperCase(),RegExp(`^${(p=(e+"/"+o).replace(/\/+(\/|$)/g,"$1")).replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),l,p])&&a}),routes:r,async handle(e,...o){let t,a,p=new URL(e.url),l=e.query={__proto__:null};for(let[e,r]of p.searchParams)l[e]=void 0===l[e]?r:[l[e],r].flat();for(let[l,s,u,$]of r)if((l===e.method||"ALL"===l)&&(a=p.pathname.match(s))){e.params=a.groups||{},e.route=$;for(let r of u)if(void 0!==(t=await r(e.proxy||e,...o)))return t}}});
|
package/Router.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=({base:e="",routes:r=[]}={})=>({__proto__:new Proxy({},{get:(o,a,t,p)=>(o,...l)=>r.push([a.toUpperCase(),RegExp(`^${(p=(e+"/"+o).replace(/\/+(\/|$)/g,"$1")).replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),l,p])&&t}),routes:r,async handle(e,...o){let a,t,p=new URL(e.url),l=e.query={__proto__:null};for(let[e,r]of p.searchParams)l[e]=void 0===l[e]?r:[l[e],r].flat();for(let[l,s,$,c]of r)if((l===e.method||"ALL"===l)&&(t=p.pathname.match(s))){e.params=t.groups||{},e.route=c;for(let r of $)if(void 0!==(a=await r(e.proxy||e,...o)))return a}}});export{e as Router};
|
package/StatusError.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
class
|
|
2
|
-
status;
|
|
3
|
-
constructor(status = 500, body) {
|
|
4
|
-
super(typeof body === 'object' ? body.error : body);
|
|
5
|
-
typeof body === 'object' && Object.assign(this, body);
|
|
6
|
-
this.status = status;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { StatusError };
|
|
1
|
+
"use strict";class t extends Error{status;constructor(t=500,s){super("object"==typeof s?s.error:s),"object"==typeof s&&Object.assign(this,s),this.status=t}}exports.StatusError=t;
|
package/StatusError.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t extends Error{status;constructor(t=500,s){super("object"==typeof s?s.error:s),"object"==typeof s&&Object.assign(this,s),this.status=t}}export{t as StatusError};
|
package/createCors.js
CHANGED
|
@@ -1,66 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const createCors = (options = {}) => {
|
|
3
|
-
// Destructure and set defaults for options.
|
|
4
|
-
const { origins = ['*'], maxAge, methods = ['GET'], headers = {} } = options;
|
|
5
|
-
let allowOrigin;
|
|
6
|
-
// Initial response headers.
|
|
7
|
-
const rHeaders = {
|
|
8
|
-
'content-type': 'application/json',
|
|
9
|
-
'Access-Control-Allow-Methods': methods.join(', '),
|
|
10
|
-
...headers,
|
|
11
|
-
};
|
|
12
|
-
// Set max age if provided.
|
|
13
|
-
if (maxAge)
|
|
14
|
-
rHeaders['Access-Control-Max-Age'] = maxAge;
|
|
15
|
-
// Pre-flight function.
|
|
16
|
-
const preflight = (r) => {
|
|
17
|
-
// Use methods set.
|
|
18
|
-
const useMethods = [...new Set(['OPTIONS', ...methods])];
|
|
19
|
-
const origin = r.headers.get('origin') || '';
|
|
20
|
-
// Set allowOrigin globally.
|
|
21
|
-
allowOrigin = (origins.includes(origin) || origins.includes('*')) && {
|
|
22
|
-
'Access-Control-Allow-Origin': origin,
|
|
23
|
-
};
|
|
24
|
-
// Check if method is OPTIONS.
|
|
25
|
-
if (r.method === 'OPTIONS') {
|
|
26
|
-
const reqHeaders = {
|
|
27
|
-
...rHeaders,
|
|
28
|
-
'Access-Control-Allow-Methods': useMethods.join(', '),
|
|
29
|
-
'Access-Control-Allow-Headers': r.headers.get('Access-Control-Request-Headers'),
|
|
30
|
-
...allowOrigin,
|
|
31
|
-
};
|
|
32
|
-
// Handle CORS pre-flight request.
|
|
33
|
-
return new Response(null, {
|
|
34
|
-
headers: r.headers.get('Origin') &&
|
|
35
|
-
r.headers.get('Access-Control-Request-Method') &&
|
|
36
|
-
r.headers.get('Access-Control-Request-Headers')
|
|
37
|
-
? reqHeaders
|
|
38
|
-
: { Allow: useMethods.join(', ') },
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
// Corsify function.
|
|
43
|
-
const corsify = (response) => {
|
|
44
|
-
if (!response)
|
|
45
|
-
throw new Error('No fetch handler responded and no upstream to proxy to specified.');
|
|
46
|
-
const { headers, status, body } = response;
|
|
47
|
-
// Bypass for protocol shifts or redirects, or if CORS is already set.
|
|
48
|
-
if ([101, 301, 302, 308].includes(status) ||
|
|
49
|
-
headers.get('access-control-allow-origin'))
|
|
50
|
-
return response;
|
|
51
|
-
// Return new response with CORS headers.
|
|
52
|
-
return new Response(body, {
|
|
53
|
-
status,
|
|
54
|
-
headers: {
|
|
55
|
-
...Object.fromEntries(headers),
|
|
56
|
-
...rHeaders,
|
|
57
|
-
...allowOrigin,
|
|
58
|
-
'content-type': headers.get('content-type'),
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
// Return corsify and preflight methods.
|
|
63
|
-
return { corsify, preflight };
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export { createCors };
|
|
1
|
+
"use strict";exports.createCors=(e={})=>{const{origins:s=["*"],maxAge:o,methods:t=["GET"],headers:n={}}=e;let r;const c={"content-type":"application/json","Access-Control-Allow-Methods":t.join(", "),...n};o&&(c["Access-Control-Max-Age"]=o);return{corsify:e=>{if(!e)throw new Error("No fetch handler responded and no upstream to proxy to specified.");const{headers:s,status:o,body:t}=e;return[101,301,302,308].includes(o)||s.get("access-control-allow-origin")?e:new Response(t,{status:o,headers:{...Object.fromEntries(s),...c,...r,"content-type":s.get("content-type")}})},preflight:e=>{const o=[...new Set(["OPTIONS",...t])],n=e.headers.get("origin")||"";if(r=(s.includes(n)||s.includes("*"))&&{"Access-Control-Allow-Origin":n},"OPTIONS"===e.method){const s={...c,"Access-Control-Allow-Methods":o.join(", "),"Access-Control-Allow-Headers":e.headers.get("Access-Control-Request-Headers"),...r};return new Response(null,{headers:e.headers.get("Origin")&&e.headers.get("Access-Control-Request-Method")&&e.headers.get("Access-Control-Request-Headers")?s:{Allow:o.join(", ")}})}}}};
|
package/createCors.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e={})=>{const{origins:o=["*"],maxAge:s,methods:t=["GET"],headers:n={}}=e;let r;const c={"content-type":"application/json","Access-Control-Allow-Methods":t.join(", "),...n};s&&(c["Access-Control-Max-Age"]=s);return{corsify:e=>{if(!e)throw new Error("No fetch handler responded and no upstream to proxy to specified.");const{headers:o,status:s,body:t}=e;return[101,301,302,308].includes(s)||o.get("access-control-allow-origin")?e:new Response(t,{status:s,headers:{...Object.fromEntries(o),...c,...r,"content-type":o.get("content-type")}})},preflight:e=>{const s=[...new Set(["OPTIONS",...t])],n=e.headers.get("origin")||"";if(r=(o.includes(n)||o.includes("*"))&&{"Access-Control-Allow-Origin":n},"OPTIONS"===e.method){const o={...c,"Access-Control-Allow-Methods":s.join(", "),"Access-Control-Allow-Headers":e.headers.get("Access-Control-Request-Headers"),...r};return new Response(null,{headers:e.headers.get("Origin")&&e.headers.get("Access-Control-Request-Method")&&e.headers.get("Access-Control-Request-Headers")?o:{Allow:s.join(", ")}})}}}};export{e as createCors};
|
package/createResponse.d.ts
CHANGED
package/createResponse.js
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const { headers = {}, ...rest } = options;
|
|
3
|
-
if (body?.constructor.name === 'Response')
|
|
4
|
-
return body;
|
|
5
|
-
return new Response(transform ? transform(body) : body, {
|
|
6
|
-
headers: {
|
|
7
|
-
'content-type': format,
|
|
8
|
-
...headers,
|
|
9
|
-
},
|
|
10
|
-
...rest,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { createResponse };
|
|
1
|
+
"use strict";exports.createResponse=(e="text/plain; charset=utf-8",t)=>(s,n)=>{const{headers:r={},...o}=n||{};return"Response"===s?.constructor.name?s:new Response(t?t(s):s,{headers:{"content-type":e,...r},...o})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e="text/plain; charset=utf-8",t)=>(n,s)=>{const{headers:o={},...r}=s||{};return"Response"===n?.constructor.name?n:new Response(t?t(n):n,{headers:{"content-type":e,...o},...r})};export{e as createResponse};
|
package/error.js
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { headers = {}, ...rest } = options;
|
|
3
|
-
if (body?.constructor.name === 'Response')
|
|
4
|
-
return body;
|
|
5
|
-
return new Response(transform ? transform(body) : body, {
|
|
6
|
-
headers: {
|
|
7
|
-
'content-type': format,
|
|
8
|
-
...headers,
|
|
9
|
-
},
|
|
10
|
-
...rest,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const json = createResponse('application/json; charset=utf-8', JSON.stringify);
|
|
15
|
-
|
|
16
|
-
const getMessage = (code) => {
|
|
17
|
-
return ({
|
|
18
|
-
400: 'Bad Request',
|
|
19
|
-
401: 'Unauthorized',
|
|
20
|
-
403: 'Forbidden',
|
|
21
|
-
404: 'Not Found',
|
|
22
|
-
500: 'Internal Server Error',
|
|
23
|
-
}[code] || 'Unknown Error');
|
|
24
|
-
};
|
|
25
|
-
const error = (a = 500, b) => {
|
|
26
|
-
// handle passing an Error | StatusError directly in
|
|
27
|
-
if (a instanceof Error) {
|
|
28
|
-
const { message, ...err } = a;
|
|
29
|
-
a = a.status || 500;
|
|
30
|
-
b = {
|
|
31
|
-
error: message || getMessage(a),
|
|
32
|
-
...err,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
b = {
|
|
36
|
-
status: a,
|
|
37
|
-
...(typeof b === 'object' ? b : { error: b || getMessage(a) }),
|
|
38
|
-
};
|
|
39
|
-
return json(b, { status: a });
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { error };
|
|
1
|
+
"use strict";const r=((r="text/plain; charset=utf-8",e)=>(t,s)=>{const{headers:n={},...o}=s||{};return"Response"===t?.constructor.name?t:new Response(e?e(t):t,{headers:{"content-type":r,...n},...o})})("application/json; charset=utf-8",JSON.stringify),e=r=>({400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error"}[r]||"Unknown Error");exports.error=(t=500,s)=>{if(t instanceof Error){const{message:r,...n}=t;t=t.status||500,s={error:r||e(t),...n}}return s={status:t,..."object"==typeof s?s:{error:s||e(t)}},r(s,{status:t})};
|
package/error.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=((e="text/plain; charset=utf-8",r)=>(t,n)=>{const{headers:o={},...s}=n||{};return"Response"===t?.constructor.name?t:new Response(r?r(t):t,{headers:{"content-type":e,...o},...s})})("application/json; charset=utf-8",JSON.stringify),r=e=>({400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error"}[e]||"Unknown Error"),t=(t=500,n)=>{if(t instanceof Error){const{message:e,...o}=t;t=t.status||500,n={error:e||r(t),...o}}return n={status:t,..."object"==typeof n?n:{error:n||r(t)}},e(n,{status:t})};export{t as error};
|
package/html.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { headers = {}, ...rest } = options;
|
|
3
|
-
if (body?.constructor.name === 'Response')
|
|
4
|
-
return body;
|
|
5
|
-
return new Response(transform ? transform(body) : body, {
|
|
6
|
-
headers: {
|
|
7
|
-
'content-type': format,
|
|
8
|
-
...headers,
|
|
9
|
-
},
|
|
10
|
-
...rest,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const html = createResponse('text/html');
|
|
15
|
-
|
|
16
|
-
export { html };
|
|
1
|
+
"use strict";const t=((t="text/plain; charset=utf-8",e)=>(s,n)=>{const{headers:r={},...o}=n||{};return"Response"===s?.constructor.name?s:new Response(e?e(s):s,{headers:{"content-type":t,...r},...o})})("text/html");exports.html=t;
|
package/html.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=((e="text/plain; charset=utf-8",t)=>(n,s)=>{const{headers:o={},...r}=s||{};return"Response"===n?.constructor.name?n:new Response(t?t(n):n,{headers:{"content-type":e,...o},...r})})("text/html");export{e as html};
|
package/index.js
CHANGED
|
@@ -1,189 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
// @ts-expect-error TypeScript doesn't know that Proxy makes this work
|
|
3
|
-
({
|
|
4
|
-
__proto__: new Proxy({}, {
|
|
5
|
-
// @ts-expect-error (we're adding an expected prop "path" to the get)
|
|
6
|
-
get: (target, prop, receiver, path) => (route, ...handlers) => routes.push([
|
|
7
|
-
prop.toUpperCase(),
|
|
8
|
-
RegExp(`^${(path = (base + '/' + route).replace(/\/+(\/|$)/g, '$1')) // strip double & trailing splash
|
|
9
|
-
.replace(/(\/?\.?):(\w+)\+/g, '($1(?<$2>*))') // greedy params
|
|
10
|
-
.replace(/(\/?\.?):(\w+)/g, '($1(?<$2>[^$1/]+?))') // named params and image format
|
|
11
|
-
.replace(/\./g, '\\.') // dot in path
|
|
12
|
-
.replace(/(\/?)\*/g, '($1.*)?') // wildcard
|
|
13
|
-
}/*$`),
|
|
14
|
-
handlers,
|
|
15
|
-
path, // embed clean route path
|
|
16
|
-
]) && receiver
|
|
17
|
-
}),
|
|
18
|
-
routes,
|
|
19
|
-
async handle(request, ...args) {
|
|
20
|
-
let response, match, url = new URL(request.url), query = request.query = { __proto__: null };
|
|
21
|
-
for (let [k, v] of url.searchParams) {
|
|
22
|
-
query[k] = query[k] === undefined ? v : [query[k], v].flat();
|
|
23
|
-
}
|
|
24
|
-
for (let [method, regex, handlers, path] of routes) {
|
|
25
|
-
if ((method === request.method || method === 'ALL') && (match = url.pathname.match(regex))) {
|
|
26
|
-
request.params = match.groups || {}; // embed params in request
|
|
27
|
-
request.route = path; // embed route path in request
|
|
28
|
-
for (let handler of handlers) {
|
|
29
|
-
if ((response = await handler(request.proxy || request, ...args)) !== undefined)
|
|
30
|
-
return response;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
class StatusError extends Error {
|
|
38
|
-
status;
|
|
39
|
-
constructor(status = 500, body) {
|
|
40
|
-
super(typeof body === 'object' ? body.error : body);
|
|
41
|
-
typeof body === 'object' && Object.assign(this, body);
|
|
42
|
-
this.status = status;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const createResponse = (format = 'text/plain; charset=utf-8', transform) => (body, options = {}) => {
|
|
47
|
-
const { headers = {}, ...rest } = options;
|
|
48
|
-
if (body?.constructor.name === 'Response')
|
|
49
|
-
return body;
|
|
50
|
-
return new Response(transform ? transform(body) : body, {
|
|
51
|
-
headers: {
|
|
52
|
-
'content-type': format,
|
|
53
|
-
...headers,
|
|
54
|
-
},
|
|
55
|
-
...rest,
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const json = createResponse('application/json; charset=utf-8', JSON.stringify);
|
|
60
|
-
|
|
61
|
-
const getMessage = (code) => {
|
|
62
|
-
return ({
|
|
63
|
-
400: 'Bad Request',
|
|
64
|
-
401: 'Unauthorized',
|
|
65
|
-
403: 'Forbidden',
|
|
66
|
-
404: 'Not Found',
|
|
67
|
-
500: 'Internal Server Error',
|
|
68
|
-
}[code] || 'Unknown Error');
|
|
69
|
-
};
|
|
70
|
-
const error = (a = 500, b) => {
|
|
71
|
-
// handle passing an Error | StatusError directly in
|
|
72
|
-
if (a instanceof Error) {
|
|
73
|
-
const { message, ...err } = a;
|
|
74
|
-
a = a.status || 500;
|
|
75
|
-
b = {
|
|
76
|
-
error: message || getMessage(a),
|
|
77
|
-
...err,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
b = {
|
|
81
|
-
status: a,
|
|
82
|
-
...(typeof b === 'object' ? b : { error: b || getMessage(a) }),
|
|
83
|
-
};
|
|
84
|
-
return json(b, { status: a });
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const status = (status) => new Response(null, { status });
|
|
88
|
-
|
|
89
|
-
const text = (message, options) => new Response(message, options);
|
|
90
|
-
|
|
91
|
-
const html = createResponse('text/html');
|
|
92
|
-
|
|
93
|
-
const jpeg = createResponse('image/jpeg');
|
|
94
|
-
|
|
95
|
-
const png = createResponse('image/png');
|
|
96
|
-
|
|
97
|
-
const webp = createResponse('image/webp');
|
|
98
|
-
|
|
99
|
-
// withContent - embeds any request body as request.content
|
|
100
|
-
const withContent = async (request) => {
|
|
101
|
-
if (request.headers.get('content-type')?.includes('json'))
|
|
102
|
-
request.content = await request.json();
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// withCookies - embeds cookies object into the request
|
|
106
|
-
const withCookies = (r) => {
|
|
107
|
-
r.cookies = (r.headers.get('Cookie') || '')
|
|
108
|
-
.split(/;\s*/)
|
|
109
|
-
.map((p) => p.split(/=(.+)/))
|
|
110
|
-
.reduce((a, [k, v]) => (v ? ((a[k] = v), a) : a), {});
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const withParams = (request) => {
|
|
114
|
-
request.proxy = new Proxy(request.proxy || request, {
|
|
115
|
-
get: (obj, prop) => {
|
|
116
|
-
let p;
|
|
117
|
-
if ((p = obj[prop]) !== undefined)
|
|
118
|
-
return p.bind?.(request) || p;
|
|
119
|
-
return obj?.params?.[prop];
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// Create CORS function with default options.
|
|
125
|
-
const createCors = (options = {}) => {
|
|
126
|
-
// Destructure and set defaults for options.
|
|
127
|
-
const { origins = ['*'], maxAge, methods = ['GET'], headers = {} } = options;
|
|
128
|
-
let allowOrigin;
|
|
129
|
-
// Initial response headers.
|
|
130
|
-
const rHeaders = {
|
|
131
|
-
'content-type': 'application/json',
|
|
132
|
-
'Access-Control-Allow-Methods': methods.join(', '),
|
|
133
|
-
...headers,
|
|
134
|
-
};
|
|
135
|
-
// Set max age if provided.
|
|
136
|
-
if (maxAge)
|
|
137
|
-
rHeaders['Access-Control-Max-Age'] = maxAge;
|
|
138
|
-
// Pre-flight function.
|
|
139
|
-
const preflight = (r) => {
|
|
140
|
-
// Use methods set.
|
|
141
|
-
const useMethods = [...new Set(['OPTIONS', ...methods])];
|
|
142
|
-
const origin = r.headers.get('origin') || '';
|
|
143
|
-
// Set allowOrigin globally.
|
|
144
|
-
allowOrigin = (origins.includes(origin) || origins.includes('*')) && {
|
|
145
|
-
'Access-Control-Allow-Origin': origin,
|
|
146
|
-
};
|
|
147
|
-
// Check if method is OPTIONS.
|
|
148
|
-
if (r.method === 'OPTIONS') {
|
|
149
|
-
const reqHeaders = {
|
|
150
|
-
...rHeaders,
|
|
151
|
-
'Access-Control-Allow-Methods': useMethods.join(', '),
|
|
152
|
-
'Access-Control-Allow-Headers': r.headers.get('Access-Control-Request-Headers'),
|
|
153
|
-
...allowOrigin,
|
|
154
|
-
};
|
|
155
|
-
// Handle CORS pre-flight request.
|
|
156
|
-
return new Response(null, {
|
|
157
|
-
headers: r.headers.get('Origin') &&
|
|
158
|
-
r.headers.get('Access-Control-Request-Method') &&
|
|
159
|
-
r.headers.get('Access-Control-Request-Headers')
|
|
160
|
-
? reqHeaders
|
|
161
|
-
: { Allow: useMethods.join(', ') },
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
// Corsify function.
|
|
166
|
-
const corsify = (response) => {
|
|
167
|
-
if (!response)
|
|
168
|
-
throw new Error('No fetch handler responded and no upstream to proxy to specified.');
|
|
169
|
-
const { headers, status, body } = response;
|
|
170
|
-
// Bypass for protocol shifts or redirects, or if CORS is already set.
|
|
171
|
-
if ([101, 301, 302, 308].includes(status) ||
|
|
172
|
-
headers.get('access-control-allow-origin'))
|
|
173
|
-
return response;
|
|
174
|
-
// Return new response with CORS headers.
|
|
175
|
-
return new Response(body, {
|
|
176
|
-
status,
|
|
177
|
-
headers: {
|
|
178
|
-
...Object.fromEntries(headers),
|
|
179
|
-
...rHeaders,
|
|
180
|
-
...allowOrigin,
|
|
181
|
-
'content-type': headers.get('content-type'),
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
// Return corsify and preflight methods.
|
|
186
|
-
return { corsify, preflight };
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export { Router, StatusError, createCors, createResponse, error, html, jpeg, json, png, status, text, webp, withContent, withCookies, withParams };
|
|
1
|
+
"use strict";class e extends Error{status;constructor(e=500,t){super("object"==typeof t?t.error:t),"object"==typeof t&&Object.assign(this,t),this.status=e}}const t=(e="text/plain; charset=utf-8",t)=>(s,o)=>{const{headers:r={},...n}=o||{};return"Response"===s?.constructor.name?s:new Response(t?t(s):s,{headers:{"content-type":e,...r},...n})},s=t("application/json; charset=utf-8",JSON.stringify),o=e=>({400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error"}[e]||"Unknown Error"),r=t("text/html"),n=t("image/jpeg"),a=t("image/png"),c=t("image/webp");exports.Router=({base:e="",routes:t=[]}={})=>({__proto__:new Proxy({},{get:(s,o,r,n)=>(s,...a)=>t.push([o.toUpperCase(),RegExp(`^${(n=(e+"/"+s).replace(/\/+(\/|$)/g,"$1")).replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),a,n])&&r}),routes:t,async handle(e,...s){let o,r,n=new URL(e.url),a=e.query={__proto__:null};for(let[e,t]of n.searchParams)a[e]=void 0===a[e]?t:[a[e],t].flat();for(let[a,c,p,i]of t)if((a===e.method||"ALL"===a)&&(r=n.pathname.match(c))){e.params=r.groups||{},e.route=i;for(let t of p)if(void 0!==(o=await t(e.proxy||e,...s)))return o}}}),exports.StatusError=e,exports.createCors=(e={})=>{const{origins:t=["*"],maxAge:s,methods:o=["GET"],headers:r={}}=e;let n;const a={"content-type":"application/json","Access-Control-Allow-Methods":o.join(", "),...r};s&&(a["Access-Control-Max-Age"]=s);return{corsify:e=>{if(!e)throw new Error("No fetch handler responded and no upstream to proxy to specified.");const{headers:t,status:s,body:o}=e;return[101,301,302,308].includes(s)||t.get("access-control-allow-origin")?e:new Response(o,{status:s,headers:{...Object.fromEntries(t),...a,...n,"content-type":t.get("content-type")}})},preflight:e=>{const s=[...new Set(["OPTIONS",...o])],r=e.headers.get("origin")||"";if(n=(t.includes(r)||t.includes("*"))&&{"Access-Control-Allow-Origin":r},"OPTIONS"===e.method){const t={...a,"Access-Control-Allow-Methods":s.join(", "),"Access-Control-Allow-Headers":e.headers.get("Access-Control-Request-Headers"),...n};return new Response(null,{headers:e.headers.get("Origin")&&e.headers.get("Access-Control-Request-Method")&&e.headers.get("Access-Control-Request-Headers")?t:{Allow:s.join(", ")}})}}}},exports.createResponse=t,exports.error=(e=500,t)=>{if(e instanceof Error){const{message:s,...r}=e;e=e.status||500,t={error:s||o(e),...r}}return t={status:e,..."object"==typeof t?t:{error:t||o(e)}},s(t,{status:e})},exports.html=r,exports.jpeg=n,exports.json=s,exports.png=a,exports.status=(e,t)=>new Response(null,{...t,status:e}),exports.text=(e,t)=>new Response(e,t),exports.webp=c,exports.withContent=async e=>{e.headers.get("content-type")?.includes("json")&&(e.content=await e.json())},exports.withCookies=e=>{e.cookies=(e.headers.get("Cookie")||"").split(/;\s*/).map((e=>e.split(/=(.+)/))).reduce(((e,[t,s])=>s?(e[t]=s,e):e),{})},exports.withParams=e=>{e.proxy=new Proxy(e.proxy||e,{get:(t,s)=>{let o;return void 0!==(o=t[s])?o.bind?.(e)||o:t?.params?.[s]}})};
|
package/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=({base:e="",routes:t=[]}={})=>({__proto__:new Proxy({},{get:(o,s,r,n)=>(o,...a)=>t.push([s.toUpperCase(),RegExp(`^${(n=(e+"/"+o).replace(/\/+(\/|$)/g,"$1")).replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),a,n])&&r}),routes:t,async handle(e,...o){let s,r,n=new URL(e.url),a=e.query={__proto__:null};for(let[e,t]of n.searchParams)a[e]=void 0===a[e]?t:[a[e],t].flat();for(let[a,c,l,i]of t)if((a===e.method||"ALL"===a)&&(r=n.pathname.match(c))){e.params=r.groups||{},e.route=i;for(let t of l)if(void 0!==(s=await t(e.proxy||e,...o)))return s}}});class t extends Error{status;constructor(e=500,t){super("object"==typeof t?t.error:t),"object"==typeof t&&Object.assign(this,t),this.status=e}}const o=(e="text/plain; charset=utf-8",t)=>(o,s)=>{const{headers:r={},...n}=s||{};return"Response"===o?.constructor.name?o:new Response(t?t(o):o,{headers:{"content-type":e,...r},...n})},s=o("application/json; charset=utf-8",JSON.stringify),r=e=>({400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error"}[e]||"Unknown Error"),n=(e=500,t)=>{if(e instanceof Error){const{message:o,...s}=e;e=e.status||500,t={error:o||r(e),...s}}return t={status:e,..."object"==typeof t?t:{error:t||r(e)}},s(t,{status:e})},a=(e,t)=>new Response(null,{...t,status:e}),c=(e,t)=>new Response(e,t),l=o("text/html"),i=o("image/jpeg"),p=o("image/png"),d=o("image/webp"),u=async e=>{e.headers.get("content-type")?.includes("json")&&(e.content=await e.json())},g=e=>{e.cookies=(e.headers.get("Cookie")||"").split(/;\s*/).map((e=>e.split(/=(.+)/))).reduce(((e,[t,o])=>o?(e[t]=o,e):e),{})},h=e=>{e.proxy=new Proxy(e.proxy||e,{get:(t,o)=>{let s;return void 0!==(s=t[o])?s.bind?.(e)||s:t?.params?.[o]}})},f=(e={})=>{const{origins:t=["*"],maxAge:o,methods:s=["GET"],headers:r={}}=e;let n;const a={"content-type":"application/json","Access-Control-Allow-Methods":s.join(", "),...r};o&&(a["Access-Control-Max-Age"]=o);return{corsify:e=>{if(!e)throw new Error("No fetch handler responded and no upstream to proxy to specified.");const{headers:t,status:o,body:s}=e;return[101,301,302,308].includes(o)||t.get("access-control-allow-origin")?e:new Response(s,{status:o,headers:{...Object.fromEntries(t),...a,...n,"content-type":t.get("content-type")}})},preflight:e=>{const o=[...new Set(["OPTIONS",...s])],r=e.headers.get("origin")||"";if(n=(t.includes(r)||t.includes("*"))&&{"Access-Control-Allow-Origin":r},"OPTIONS"===e.method){const t={...a,"Access-Control-Allow-Methods":o.join(", "),"Access-Control-Allow-Headers":e.headers.get("Access-Control-Request-Headers"),...n};return new Response(null,{headers:e.headers.get("Origin")&&e.headers.get("Access-Control-Request-Method")&&e.headers.get("Access-Control-Request-Headers")?t:{Allow:o.join(", ")}})}}}};export{e as Router,t as StatusError,f as createCors,o as createResponse,n as error,l as html,i as jpeg,s as json,p as png,a as status,c as text,d as webp,u as withContent,g as withCookies,h as withParams};
|
package/jpeg.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { headers = {}, ...rest } = options;
|
|
3
|
-
if (body?.constructor.name === 'Response')
|
|
4
|
-
return body;
|
|
5
|
-
return new Response(transform ? transform(body) : body, {
|
|
6
|
-
headers: {
|
|
7
|
-
'content-type': format,
|
|
8
|
-
...headers,
|
|
9
|
-
},
|
|
10
|
-
...rest,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const jpeg = createResponse('image/jpeg');
|
|
15
|
-
|
|
16
|
-
export { jpeg };
|
|
1
|
+
"use strict";const e=((e="text/plain; charset=utf-8",t)=>(s,n)=>{const{headers:r={},...o}=n||{};return"Response"===s?.constructor.name?s:new Response(t?t(s):s,{headers:{"content-type":e,...r},...o})})("image/jpeg");exports.jpeg=e;
|
package/jpeg.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=((e="text/plain; charset=utf-8",t)=>(n,s)=>{const{headers:o={},...r}=s||{};return"Response"===n?.constructor.name?n:new Response(t?t(n):n,{headers:{"content-type":e,...o},...r})})("image/jpeg");export{e as jpeg};
|
package/json.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { headers = {}, ...rest } = options;
|
|
3
|
-
if (body?.constructor.name === 'Response')
|
|
4
|
-
return body;
|
|
5
|
-
return new Response(transform ? transform(body) : body, {
|
|
6
|
-
headers: {
|
|
7
|
-
'content-type': format,
|
|
8
|
-
...headers,
|
|
9
|
-
},
|
|
10
|
-
...rest,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const json = createResponse('application/json; charset=utf-8', JSON.stringify);
|
|
15
|
-
|
|
16
|
-
export { json };
|
|
1
|
+
"use strict";const t=((t="text/plain; charset=utf-8",e)=>(s,n)=>{const{headers:o={},...r}=n||{};return"Response"===s?.constructor.name?s:new Response(e?e(s):s,{headers:{"content-type":t,...o},...r})})("application/json; charset=utf-8",JSON.stringify);exports.json=t;
|
package/json.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=((e="text/plain; charset=utf-8",t)=>(n,s)=>{const{headers:o={},...r}=s||{};return"Response"===n?.constructor.name?n:new Response(t?t(n):n,{headers:{"content-type":e,...o},...r})})("application/json; charset=utf-8",JSON.stringify);export{e as json};
|
package/package.json
CHANGED
|
@@ -1,11 +1,97 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itty-router",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.13",
|
|
4
4
|
"description": "A tiny, zero-dependency router, designed to make beautiful APIs in any environment.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"module": "./index.js",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"module": "./index.mjs",
|
|
8
7
|
"types": "./index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./index.mjs",
|
|
11
|
+
"require": "./index.js",
|
|
12
|
+
"types": "./index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./createCors": {
|
|
15
|
+
"import": "./createCors.mjs",
|
|
16
|
+
"require": "./createCors.js",
|
|
17
|
+
"types": "./createCors.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./createResponse": {
|
|
20
|
+
"import": "./createResponse.mjs",
|
|
21
|
+
"require": "./createResponse.js",
|
|
22
|
+
"types": "./createResponse.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./error": {
|
|
25
|
+
"import": "./error.mjs",
|
|
26
|
+
"require": "./error.js",
|
|
27
|
+
"types": "./error.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./html": {
|
|
30
|
+
"import": "./html.mjs",
|
|
31
|
+
"require": "./html.js",
|
|
32
|
+
"types": "./html.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./jpeg": {
|
|
35
|
+
"import": "./jpeg.mjs",
|
|
36
|
+
"require": "./jpeg.js",
|
|
37
|
+
"types": "./jpeg.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./json": {
|
|
40
|
+
"import": "./json.mjs",
|
|
41
|
+
"require": "./json.js",
|
|
42
|
+
"types": "./json.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./png": {
|
|
45
|
+
"import": "./png.mjs",
|
|
46
|
+
"require": "./png.js",
|
|
47
|
+
"types": "./png.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./Router": {
|
|
50
|
+
"import": "./Router.mjs",
|
|
51
|
+
"require": "./Router.js",
|
|
52
|
+
"types": "./Router.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"./status": {
|
|
55
|
+
"import": "./status.mjs",
|
|
56
|
+
"require": "./status.js",
|
|
57
|
+
"types": "./status.d.ts"
|
|
58
|
+
},
|
|
59
|
+
"./StatusError": {
|
|
60
|
+
"import": "./StatusError.mjs",
|
|
61
|
+
"require": "./StatusError.js",
|
|
62
|
+
"types": "./StatusError.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./text": {
|
|
65
|
+
"import": "./text.mjs",
|
|
66
|
+
"require": "./text.js",
|
|
67
|
+
"types": "./text.d.ts"
|
|
68
|
+
},
|
|
69
|
+
"./webp": {
|
|
70
|
+
"import": "./webp.mjs",
|
|
71
|
+
"require": "./webp.js",
|
|
72
|
+
"types": "./webp.d.ts"
|
|
73
|
+
},
|
|
74
|
+
"./websocket": {
|
|
75
|
+
"import": "./websocket.mjs",
|
|
76
|
+
"require": "./websocket.js",
|
|
77
|
+
"types": "./websocket.d.ts"
|
|
78
|
+
},
|
|
79
|
+
"./withContent": {
|
|
80
|
+
"import": "./withContent.mjs",
|
|
81
|
+
"require": "./withContent.js",
|
|
82
|
+
"types": "./withContent.d.ts"
|
|
83
|
+
},
|
|
84
|
+
"./withCookies": {
|
|
85
|
+
"import": "./withCookies.mjs",
|
|
86
|
+
"require": "./withCookies.js",
|
|
87
|
+
"types": "./withCookies.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./withParams": {
|
|
90
|
+
"import": "./withParams.mjs",
|
|
91
|
+
"require": "./withParams.js",
|
|
92
|
+
"types": "./withParams.d.ts"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
9
95
|
"keywords": [
|
|
10
96
|
"api",
|
|
11
97
|
"router",
|
|
@@ -30,6 +116,7 @@
|
|
|
30
116
|
"coveralls": "yarn coverage && cat ./coverage/lcov.info | coveralls",
|
|
31
117
|
"verify": "echo 'verifying module...' && yarn build && yarn test:once",
|
|
32
118
|
"prerelease": "yarn verify",
|
|
119
|
+
"prerelease:next": "yarn verify",
|
|
33
120
|
"prebuild": "rimraf dist && mkdir dist",
|
|
34
121
|
"build": "rollup -c",
|
|
35
122
|
"release": "release --tag --push --patch --src=dist",
|
|
@@ -53,35 +140,36 @@
|
|
|
53
140
|
"@rollup/plugin-terser": "^0.4.3",
|
|
54
141
|
"@rollup/plugin-typescript": "^11.1.1",
|
|
55
142
|
"@skypack/package-check": "^0.2.2",
|
|
56
|
-
"@types/node": "^20.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
58
|
-
"@typescript-eslint/parser": "^5.
|
|
143
|
+
"@types/node": "^20.3.1",
|
|
144
|
+
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
145
|
+
"@typescript-eslint/parser": "^5.60.0",
|
|
59
146
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
60
|
-
"@vitest/coverage-c8": "^0.
|
|
61
|
-
"@
|
|
147
|
+
"@vitest/coverage-c8": "^0.32.2",
|
|
148
|
+
"@vitest/coverage-v8": "^0.32.2",
|
|
149
|
+
"@whatwg-node/server": "^0.8.12",
|
|
62
150
|
"coveralls": "^3.1.1",
|
|
63
|
-
"eslint": "^8.
|
|
151
|
+
"eslint": "^8.43.0",
|
|
64
152
|
"eslint-config-prettier": "^8.8.0",
|
|
65
153
|
"fetch-mock": "^9.11.0",
|
|
66
154
|
"fs-extra": "^11.1.1",
|
|
67
|
-
"globby": "^13.
|
|
155
|
+
"globby": "^13.2.0",
|
|
68
156
|
"gzip-size": "^7.0.0",
|
|
69
157
|
"http": "^0.0.1-security",
|
|
70
158
|
"isomorphic-fetch": "^3.0.0",
|
|
71
|
-
"itty-router": "^4.0.
|
|
159
|
+
"itty-router": "^4.0.11",
|
|
72
160
|
"jsdom": "^22.1.0",
|
|
73
161
|
"npm-run-all": "^4.1.5",
|
|
74
162
|
"prettier": "^2.8.8",
|
|
75
163
|
"rimraf": "^5.0.1",
|
|
76
|
-
"rollup": "^3.
|
|
164
|
+
"rollup": "^3.25.1",
|
|
77
165
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
78
166
|
"rollup-plugin-copy": "^3.4.0",
|
|
79
167
|
"rollup-plugin-multi-input": "^1.4.1",
|
|
80
168
|
"ts-node": "^10.9.1",
|
|
81
|
-
"typescript": "^5.
|
|
169
|
+
"typescript": "^5.1.3",
|
|
82
170
|
"vite": "^4.3.9",
|
|
83
|
-
"vitest": "^0.
|
|
171
|
+
"vitest": "^0.32.2",
|
|
84
172
|
"yarn": "^1.22.19",
|
|
85
|
-
"yarn-release": "^1.10.
|
|
173
|
+
"yarn-release": "^1.10.6"
|
|
86
174
|
}
|
|
87
175
|
}
|