rspack-plugin-mock 1.1.0 → 1.3.0

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.
@@ -0,0 +1 @@
1
+ import{isArray as e,isBoolean as t,isEmptyObject as n,isFunction as r,isPlainObject as i,random as a,sleep as o,sortBy as s,timestamp as c,toArray as l,uniq as u}from"@pengzhanbo/utils";import d from"node:path";import f from"ansis";import p from"picomatch";import{loadPackageJSONSync as m}from"local-pkg";import{match as h,parse as g,pathToRegexp as _}from"path-to-regexp";import v from"node:os";import{fileURLToPath as y}from"node:url";import b from"debug";import{Volume as x,createFsFromVolume as S}from"memfs";import{parse as C}from"node:querystring";import w from"co-body";import T from"formidable";import E from"node:http";import D from"node:crypto";import{Buffer as O}from"node:buffer";import k from"http-status";import*as A from"mime-types";import{WebSocketServer as j}from"ws";function ee(e,t){let n=[],r=[`**/node_modules/**`,...l(t)];return l(e).forEach(e=>{e[0]===`!`?r.push(e.slice(1)):n.push(e)}),{pattern:n,ignore:r,isMatch:p(n,{ignore:r})}}function M(e,t,n){return typeof e==`function`?e(t,n):e[0]===`^`&&new RegExp(e).test(t)||t.startsWith(e)}function N(e){let{dependencies:t,devDependencies:n,peerDependencies:r,optionalDependencies:i}=m(e)||{};return{...t,...n,...r,...i}}function P(e){let t=N(e);return u(Object.keys(t))}function te(e){return typeof e==`object`&&!!e&&typeof e.pipe==`function`}function ne(e){return te(e)&&e.readable!==!1&&typeof e._read==`function`&&typeof e._readableState==`object`}function F(e,t){if(!t)return!0;for(let n in t)if(!I(e[n],t[n]))return!1;return!0}function I(t,n){if(e(t)&&e(n)){let e=new Set;return n.every(n=>t.some((t,r)=>{if(e.has(r))return!1;let i=I(t,n);return i&&e.add(r),i}))}return i(t)&&i(n)?F(t,n):Object.is(t,n)}const L=new Map;function R(e,t){let n=L.get(e);return n||(n=_(e).regexp,L.set(e,n)),n.test(t)}const z={silent:0,error:1,warn:2,info:3,debug:4};function re(e,n=`info`){e=`[${e}]`;function r(r,i,a){if(a=t(a)?a?n:`error`:a,z[a]>=z[r]){let t=r===`info`||r===`debug`?`log`:r,n=r===`debug`?f.magenta.bold(e):r===`info`?f.cyan.bold(e):r===`warn`?f.yellow.bold(e):f.red.bold(e),a=`${f.dim(new Date().toLocaleTimeString())} ${n} ${i}`;console[t](a)}}return{debug(e,t=n){r(`debug`,e,t)},info(e,t=n){r(`info`,e,t)},warn(e,t=n){r(`warn`,e,t)},error(e,t=n){r(`error`,e,t)}}}ae(import.meta.url);const ie=S(new x);function ae(e){return d.dirname(y(e))}b(`vite:mock-dev-server`);const oe=/\\/g,se=v.platform()===`win32`;function ce(e){return e.replace(oe,`/`)}function le(e){return d.posix.normalize(se?ce(e):e)}function B(e){let t=new URL(e,`http://example.com`);return{pathname:decodeURIComponent(t.pathname),query:C(t.search.replace(/^\?/,``))}}function ue(e,t=5){return function n(r,i=0){let a=r();a?e(a):i<t&&setTimeout(()=>n(r,i+1),100)}}function de(e){return e.filter(e=>e[0]).map(([e,t])=>{let n;return e.default?n=Array.isArray(e.default)?e.default.map(e=>({...e,__filepath__:t})):{...e.default,__filepath__:t}:`url`in e?n={...e,__filepath__:t}:(n=[],Object.keys(e||{}).forEach(r=>{Array.isArray(e[r])?n.push(...e[r].map(e=>({...e,__filepath__:t}))):n.push({...e[r],__filepath__:t})})),n})}function fe(e){let t=[];for(let[,n]of e.entries())n&&t.push(...l(n));let a={};return t.filter(e=>i(e)&&e.enabled!==!1&&e.url).forEach(e=>{let{pathname:t,query:i}=B(e.url),o=a[t]??=[],s={...e,url:t};if(s.ws!==!0){let e=s.validator;n(i)||(r(e)?s.validator=function(t){return F(t.query,i)&&e(t)}:e?(s.validator={...e},s.validator.query=s.validator.query?{...i,...s.validator.query}:i):s.validator={query:i})}o.push(s)}),Object.keys(a).forEach(e=>{a[e]=V(a[e])}),a}function V(e){return s(e,e=>{if(e.ws===!0)return 0;let{validator:t}=e;return!t||n(t)?2:r(t)?0:1/Object.keys(t).reduce((e,n)=>e+pe(t[n]),0)})}function pe(e){return e?Object.keys(e).length:0}async function me(e,t,n={}){let r=e.method.toUpperCase();if([`HEAD`,`OPTIONS`].includes(r))return;let i=e.headers[`content-type`]?.toLocaleLowerCase()||``,{limit:a,formLimit:o,jsonLimit:s,textLimit:c,...l}=n;try{if(i.startsWith(`application/json`))return await w.json(e,{limit:s||a,...l});if(i.startsWith(`application/x-www-form-urlencoded`))return await w.form(e,{limit:o||a,...l});if(i.startsWith(`text/plain`))return await w.text(e,{limit:c||a,...l});if(i.startsWith(`multipart/form-data`))return await ge(e,t)}catch(e){console.error(e)}}const he={keepExtensions:!0,filename(e,t,n){return n?.originalFilename||`${e}.${Date.now()}${t?`.${t}`:``}`}};async function ge(e,t){let n=T({...he,...t});return new Promise((t,r)=>{n.parse(e,(e,n,i)=>{if(e){r(e);return}t({...n,...i})})})}const H=new Map;function U(e,t){let n=H.get(e);n||(n=h(e,{decode:decodeURIComponent}),H.set(e,n));let r=n(t);return r?r.params:{}}function _e(e,t){return F(e.headers,t.headers)&&F(e.body,t.body)&&F(e.params,t.params)&&F(e.query,t.query)&&F(e.refererQuery,t.refererQuery)}function W(e,t){return!t||n(t)?``:` ${f.gray(`${e}:`)}${JSON.stringify(t)}`}function ve(e,t){let{url:n,method:r,query:i,params:a,body:o}=e,{pathname:s}=new URL(n,`http://example.com`);s=f.green(decodeURIComponent(s));let c=f.magenta.bold(r),l=W(`query`,i),u=W(`params`,a),d=W(`body`,o),p=` ${f.dim.underline(`(${t})`)}`;return`${c} ${s}${l}${u}${d}${p}`}function ye(t,n,{pathname:i,method:a,request:o}){return t.find(t=>{if(!i||!t||!t.url||t.ws||!(t.method?e(t.method)?t.method:[t.method]:[`GET`,`POST`]).includes(a))return!1;let s=R(t.url,i);if(s&&t.validator){let e=U(t.url,i);if(r(t.validator))return t.validator({params:e,...o});try{return _e({params:e,...o},t.validator)}catch(e){let r=t.__filepath__;return n.error(`${f.red(`mock error at ${i}`)}\n${e}\n at validator (${f.underline(r)})`,t.log),!1}}return s})}const G=/^[\t\u0020-\u007E\u0080-\u00FF]+$/,be=/^(?:low|medium|high)$/i,K=Object.create(null),xe=/[\^$\\.*+?()[\]{}|]/g,Se=/[;=]/,Ce=/;/,we=/^(?:lax|none|strict)$/i;var Te=class{name;value;maxAge;expires;path=`/`;domain;secure=!1;httpOnly=!0;sameSite=!1;overwrite=!1;priority;partitioned;constructor(e,t,n={}){if(!G.test(e)||Se.test(e))throw TypeError(`argument name is invalid`);if(t&&(!G.test(t)||Ce.test(t)))throw TypeError(`argument value is invalid`);if(this.name=e,this.value=t,Object.assign(this,n),this.value||(this.expires=new Date(0),this.maxAge=void 0),this.path&&!G.test(this.path))throw TypeError(`[Cookie] option path is invalid`);if(this.domain&&!G.test(this.domain))throw TypeError(`[Cookie] option domain is invalid`);if(typeof this.maxAge==`number`?Number.isNaN(this.maxAge)||!Number.isFinite(this.maxAge):this.maxAge)throw TypeError(`[Cookie] option maxAge is invalid`);if(this.priority&&!be.test(this.priority))throw TypeError(`[Cookie] option priority is invalid`);if(this.sameSite&&this.sameSite!==!0&&!we.test(this.sameSite))throw TypeError(`[Cookie] option sameSite is invalid`)}toString(){return`${this.name}=${this.value}`}toHeader(){let e=this.toString();return this.maxAge&&(this.expires=new Date(Date.now()+this.maxAge)),this.path&&(e+=`; path=${this.path}`),this.expires&&(e+=`; expires=${this.expires.toUTCString()}`),this.domain&&(e+=`; domain=${this.domain}`),this.priority&&(e+=`; priority=${this.priority.toLowerCase()}`),this.sameSite&&(e+=`; samesite=${this.sameSite===!0?`strict`:this.sameSite.toLowerCase()}`),this.secure&&(e+=`; secure`),this.httpOnly&&(e+=`; httponly`),this.partitioned&&(e+=`; partitioned`),e}};function Ee(e,t){if(e.length!==t.length)return!1;if(D.timingSafeEqual)return D.timingSafeEqual(e,t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function q(e,t){return D.createHmac(`sha256`,e).update(t).digest()}function De(e,t){let n=String(e),r=String(t),i=D.randomBytes(32);return Ee(q(i,n),q(i,r))&&e===t}const Oe=/[/+=]/g,ke={"/":`_`,"+":`-`,"=":``};var J=class{algorithm;encoding;keys=[];constructor(e,t,n){this.keys=e,this.algorithm=t||`sha256`,this.encoding=n||`base64`}sign(e,t=this.keys[0]){return D.createHmac(this.algorithm,t).update(e).digest(this.encoding).replace(Oe,e=>ke[e])}index(e,t){for(let n=0,r=this.keys.length;n<r;n++)if(De(t,this.sign(e,this.keys[n])))return n;return-1}verify(e,t){return this.index(e,t)>-1}},Y=class{request;response;secure;keys;constructor(t,n,r={}){this.request=t,this.response=n,this.secure=r.secure,r.keys instanceof J?this.keys=r.keys:e(r.keys)&&(this.keys=new J(r.keys))}set(e,t,n){let r=this.request,i=this.response,a=l(i.getHeader(`Set-Cookie`)),o=new Te(e,t,n),s=n?.signed??!!this.keys,c=this.secure===void 0?r.protocol===`https`||je(r):!!this.secure;if(!c&&n?.secure)throw Error(`Cannot send secure cookie over unencrypted connection`);if(o.secure=n?.secure??c,Me(a,o),s&&n){if(!this.keys)throw Error(`.keys required for signed cookies`);o.value=this.keys.sign(o.toString()),o.name+=`.sig`,Me(a,o)}return(i.set?E.OutgoingMessage.prototype.setHeader:i.setHeader).call(i,`Set-Cookie`,a),this}get(e,t){let n=`${e}.sig`,r=t?.signed??!!this.keys,i=this.request.headers.cookie;if(!i)return;let a=i.match(Ae(e));if(!a)return;let o=a[1];if(o[0]===`"`&&(o=o.slice(1,-1)),!t||!r)return o;let s=this.get(n);if(!s)return;let c=`${e}=${o}`;if(!this.keys)throw Error(`.keys required for signed cookies`);let l=this.keys.index(c,s);if(l<0)this.set(n,null,{path:`/`,signed:!1});else return l&&this.set(n,this.keys.sign(c),{signed:!1}),o}};function Ae(e){return K[e]||(K[e]=RegExp(`(?:^|;) *${e.replace(xe,`\\$&`)}=([^;]*)`)),K[e]}function je(e){return!!(e.socket?e.socket.encrypted:e.connection.encrypted)}function Me(e,t){if(t.overwrite)for(let n=e.length-1;n>=0;n--)e[n].indexOf(`${t.name}=`)===0&&e.splice(n,1);e.push(t.toHeader())}const X={};function Z(e){if(X[e])return X[e];let t=[],n=(e,r=!1)=>{for(let i of e)if(i.type===`text`){let e=i.value.split(`/`).filter(Boolean);e.length&&t.push(...e.map(e=>({type:`text`,value:e})))}else i.type===`group`?n(i.tokens,!0):(r&&(i.optional=!0),t.push(i))};return n(g(e).tokens),X[e]=t,t}function Ne(e){let t=e.map(e=>Z(e).length);return t=t.length===0?[1]:t,Math.max(...t)+2}function Pe(e){let t=Z(e),n=0;for(let e=0;e<t.length;e++)t[e].type!==`text`&&(n+=10**(e+1)),n+=10**(e+1);return n}function Fe(e){let t=[],n=[];for(let t of e){let e=Z(t).filter(e=>e.type!==`text`).length;n[e]||(n[e]=[]),n[e].push(t)}for(let e of n.filter(e=>e&&e.length>0))t=[...t,...s(e,Pe).reverse()];return t}function Ie(e){let t=Ne(e);return s(e,e=>{let n=Z(e),r=n.filter(e=>e.type!==`text`);if(r.length===0)return 0;let i=r.length,a=0;for(let e=0;e<n.length;e++){let r=n[e],o=r.type!==`text`,s=r.type===`wildcard`,c=!!r.optional;a+=o?1:0,e===n.length-1&&s?i+=(c?5:4)*10**(n.length===1?t+1:t):(s?i+=3*10**(t-1):i+=2*10**a,c&&(i+=10**a))}return i})}function Le(t,r,i){let a=Ie(Fe(t.filter(e=>R(e,r)))),{global:o=[],special:s={}}=i;if(o.length===0&&n(s)||a.length===0)return a;let[c,l]=Re(a),d=o.filter(e=>l.includes(e));if(d.length>0&&(a=u([...c,...d,...l])),n(s))return a;let f=Object.keys(s).filter(e=>a.includes(e))[0];if(!f)return a;let p=s[f],{rules:m,when:h}=e(p)?{rules:p,when:[]}:p;return m.includes(a[0])&&(h.length===0||h.some(e=>_(e).regexp.test(r)))&&(a=u([f,...a])),a}function Re(e){let t=[],n=[];for(let r of e)Z(r).filter(e=>e.type!==`text`).length>0?n.push(r):t.push(r);return[t,n]}const Q=new WeakMap;function ze(e){let t=[];e.addListener(`data`,e=>{t.push(O.from(e))}),e.addListener(`end`,()=>{t.length&&Q.set(e,O.concat(t))})}function Be(e,t){let n=Q.get(t);n&&(Q.delete(t),e.headersSent||e.setHeader(`Content-Length`,n.byteLength),e.writableEnded||e.write(n))}function Ve(e){return k[e]||`Unknown`}function $(e,t=200,n){e.statusCode=t,e.statusMessage=n||Ve(t)}async function He(e,t,n,i){let{headers:a,type:o=`json`}=n,s=n.__filepath__,c=A.contentType(o)||A.contentType(A.lookup(o)||``);if(c&&t.setHeader(`Content-Type`,c),t.setHeader(`Cache-Control`,`no-cache,max-age=0`),t.setHeader(`X-Mock-Power-By`,`vite-plugin-mock-dev-server`),s&&t.setHeader(`X-File-Path`,s),a)try{let n=r(a)?await a(e):a;Object.keys(n).forEach(e=>{t.setHeader(e,n[e])})}catch(t){i.error(`${f.red(`mock error at ${e.url.split(`?`)[0]}`)}\n${t}\n at headers (${f.underline(s)})`,n.log)}}async function Ue(t,n,i,a){let{cookies:o}=i,s=i.__filepath__;if(o)try{let i=r(o)?await o(t):o;Object.keys(i).forEach(t=>{let r=i[t];if(e(r)){let[e,i]=r;n.setCookie(t,e,i)}else n.setCookie(t,r)})}catch(e){a.error(`${f.red(`mock error at ${t.url.split(`?`)[0]}`)}\n${e}\n at cookies (${f.underline(s)})`,i.log)}}function We(e,t,n){if(ne(t))t.pipe(e);else if(O.isBuffer(t))e.end(n===`text`||n===`json`?t.toString(`utf-8`):t);else{let r=typeof t==`string`?t:JSON.stringify(t);e.end(n===`buffer`?O.from(r):r)}}async function Ge(t,n){if(!n||typeof n==`number`&&n<=0||e(n)&&n.length!==2)return;let r=0;if(e(n)){let[e,t]=n;r=a(e,t)}else r=n-(c()-t);r>0&&await o(r)}function Ke(e,{formidableOptions:t={},bodyParserOptions:n={},proxies:i,cookiesOptions:a,logger:o,priority:s={}}){return async function(l,u,d){let p=c(),{query:m,pathname:h}=B(l.url);if(!h||i.length===0||!i.some(e=>M(e,l.url,l)))return d();let g=e.mockData,_=Le(Object.keys(g),h,s);if(_.length===0)return d();ze(l);let{query:v}=B(l.headers.referer||``),y=await me(l,t,n),b=new Y(l,u,a),x=b.get.bind(b),S=l.method.toUpperCase(),C,w;for(let e of _)if(C=ye(g[e],o,{pathname:h,method:S,request:{query:m,refererQuery:v,body:y,headers:l.headers,getCookie:x}}),C){w=e;break}if(!C){let e=_.map(e=>e===w?f.underline.bold(e):f.dim(e)).join(`, `);return o.warn(`${f.green(h)} matches ${e} , but mock data is not found.`),d()}let T=l,E=u;T.body=y,T.query=m,T.refererQuery=v,T.params=U(C.url,h),T.getCookie=x,E.setCookie=b.set.bind(b);let{body:D,delay:O,type:k=`json`,response:A,status:j=200,statusText:ee,log:N,__filepath__:P}=C;if($(E,j,ee),await He(T,E,C,o),await Ue(T,E,C,o),o.info(ve(T,P),N),o.debug(`${f.magenta(`DEBUG`)} ${f.underline(h)} matches: [ ${_.map(e=>e===w?f.underline.bold(e):f.dim(e)).join(`, `)} ]\n`),D){try{let e=r(D)?await D(T):D;await Ge(p,O),We(E,e,k)}catch(e){o.error(`${f.red(`mock error at ${h}`)}\n${e}\n at body (${f.underline(P)})`,N),$(E,500),u.end(``)}return}if(A){try{await Ge(p,O),await A(T,E,d)}catch(e){o.error(`${f.red(`mock error at ${h}`)}\n${e}\n at response (${f.underline(P)})`,N),$(E,500),u.end(``)}return}u.end(``)}}function qe(e,t,{wsProxies:n,cookiesOptions:r,logger:i}){let a=new Map,o=new Map,s=new WeakMap,c=e=>{let t=o.get(e);return t||o.set(e,t=new Map),t},l=(e,t)=>{let n=a.get(e);n||a.set(e,n=new Set),n.add(t)},u=(e,t,n,r,a,o)=>{try{n.setup?.(t,r),t.on(`close`,()=>e.delete(a)),t.on(`error`,e=>{i.error(`${f.red(`WebSocket mock error at ${t.path}`)}\n${e}\n at setup (${o})`,n.log)})}catch(e){i.error(`${f.red(`WebSocket mock error at ${t.path}`)}\n${e}\n at setup (${o})`,n.log)}},d=(e,t,n,r,i)=>{let{cleanupList:a,connectionList:o,context:c}=s.get(t);Xe(a),o.forEach(({ws:e})=>e.removeAllListeners()),t.removeAllListeners(),u(e,t,n,c,r,i),o.forEach(({ws:e,req:n})=>Ye(t,e,n,o))};e.on(`update`,({filepath:t})=>{if(!a.has(t))return;let n=a.get(t);if(n)for(let r of n.values())for(let n of e.mockData[r]){if(!n.ws||n.__filepath__!==t)return;let e=c(r);for(let[r,i]of e.entries())d(e,i,n,r,t)}}),t?.on(`upgrade`,(t,a,o)=>{let{pathname:d,query:p}=B(t.url);if(!d||n.length===0||!n.some(e=>M(e,t.url,t)))return;let m=e.mockData,h=Object.keys(m).find(e=>R(e,d));if(!h)return;let g=m[h].find(e=>e.url&&e.ws&&R(e.url,d));if(!g)return;let _=g.__filepath__;l(_,h);let v=c(h),y=Je(v,d),b=s.get(y);if(!b){let e=[],t={onCleanup:t=>e.push(t)};b={cleanupList:e,context:t,connectionList:[]},s.set(y,b),u(v,y,g,t,d,_)}let x=t,S=new Y(t,t,r),{query:C}=B(t.headers.referer||``);x.query=p,x.refererQuery=C,x.params=U(h,d),x.getCookie=S.get.bind(S),y.handleUpgrade(x,a,o,e=>{i.info(`${f.magenta(f.bold(`WebSocket`))} ${f.green(t.url)} connected ${f.dim(`(${_})`)}`,g.log),b.connectionList.push({req:x,ws:e}),Ye(y,e,x,b.connectionList)})}),t?.on(`close`,()=>{for(let e of o.values()){for(let t of e.values())Xe(s.get(t).cleanupList),t.close();e.clear()}o.clear(),a.clear()})}function Je(e,t){let n=e.get(t);return n||e.set(t,n=new j({noServer:!0})),n}function Ye(e,t,n,r){e.emit(`connection`,t,n),t.on(`close`,()=>{let e=r.findIndex(e=>e.ws===t);e!==-1&&r.splice(e,1)})}function Xe(e){let t;for(;t=e.shift();)t?.()}export{ee as _,de as a,B as c,re as d,z as f,M as g,N as h,fe as i,le as l,P as m,Ke as n,V as o,R as p,Be as r,ue as s,qe as t,ie as u};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rspack-plugin-mock",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.3.0",
5
5
  "description": "inject api mock server to development server",
6
6
  "author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo)",
7
7
  "license": "MIT",
@@ -24,53 +24,37 @@
24
24
  "exports": {
25
25
  ".": {
26
26
  "import": {
27
- "types": "./dist/index.d.ts",
28
- "default": "./dist/index.js"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
33
29
  }
34
30
  },
35
31
  "./server": {
36
32
  "import": {
37
- "types": "./dist/server.d.ts",
38
- "default": "./dist/server.js"
39
- },
40
- "require": {
41
- "types": "./dist/server.d.cts",
42
- "default": "./dist/server.cjs"
33
+ "types": "./dist/server.d.mts",
34
+ "default": "./dist/server.mjs"
43
35
  }
44
36
  },
45
37
  "./rsbuild": {
46
38
  "import": {
47
- "types": "./dist/rsbuild.d.ts",
48
- "default": "./dist/rsbuild.js"
49
- },
50
- "require": {
51
- "types": "./dist/rsbuild.d.cts",
52
- "default": "./dist/rsbuild.cjs"
39
+ "types": "./dist/rsbuild.d.mts",
40
+ "default": "./dist/rsbuild.mjs"
53
41
  }
54
42
  },
55
43
  "./helper": {
56
44
  "import": {
57
- "types": "./dist/helper.d.ts",
58
- "default": "./dist/helper.js"
59
- },
60
- "require": {
61
- "types": "./dist/helper.d.cts",
62
- "default": "./dist/helper.cjs"
45
+ "types": "./dist/helper.d.mts",
46
+ "default": "./dist/helper.mjs"
63
47
  }
64
48
  },
65
49
  "./package.json": "./package.json"
66
50
  },
67
- "main": "dist/index.js",
68
- "types": "dist/index.d.ts",
51
+ "main": "dist/index.mjs",
52
+ "types": "dist/index.d.mts",
69
53
  "files": [
70
54
  "dist"
71
55
  ],
72
56
  "engines": {
73
- "node": ">=18.20.0",
57
+ "node": ">=20.19.0",
74
58
  "pnpm": ">=9"
75
59
  },
76
60
  "peerDependencies": {
@@ -86,54 +70,59 @@
86
70
  }
87
71
  },
88
72
  "dependencies": {
89
- "@pengzhanbo/utils": "^2.0.0",
90
- "@rollup/pluginutils": "^5.1.4",
91
- "chokidar": "3.6.0",
73
+ "@pengzhanbo/utils": "^2.1.2",
74
+ "ansis": "^4.2.0",
75
+ "chokidar": "^5.0.0",
92
76
  "co-body": "^6.2.0",
93
- "cookies": "^0.9.1",
94
77
  "cors": "^2.8.5",
95
- "debug": "^4.4.0",
96
- "fast-glob": "^3.3.3",
97
- "formidable": "2.1.2",
78
+ "debug": "^4.4.3",
79
+ "formidable": "^3.5.4",
98
80
  "http-status": "^2.1.0",
99
81
  "is-core-module": "^2.16.1",
100
82
  "json5": "^2.2.3",
101
- "memfs": "^4.17.0",
102
- "mime-types": "^3.0.1",
103
- "path-to-regexp": "6.3.0",
104
- "picocolors": "^1.1.1",
105
- "portfinder": "^1.0.36",
106
- "ws": "^8.18.1"
83
+ "local-pkg": "^1.1.2",
84
+ "memfs": "^4.51.1",
85
+ "mime-types": "^3.0.2",
86
+ "path-to-regexp": "^8.3.0",
87
+ "picomatch": "^4.0.3",
88
+ "portfinder": "^1.0.38",
89
+ "tinyglobby": "^0.2.15",
90
+ "ws": "^8.18.3"
107
91
  },
108
92
  "devDependencies": {
109
- "@pengzhanbo/eslint-config": "^1.29.0",
110
- "@rsbuild/core": "^1.3.6",
111
- "@rspack/core": "^1.3.4",
93
+ "@pengzhanbo/eslint-config": "^1.45.0",
94
+ "@rsbuild/core": "^1.6.15",
95
+ "@rspack/core": "^1.6.8",
112
96
  "@types/co-body": "^6.1.3",
113
- "@types/cookies": "^0.9.0",
114
- "@types/cors": "^2.8.17",
97
+ "@types/cors": "^2.8.19",
115
98
  "@types/debug": "^4.1.12",
116
- "@types/formidable": "2.0.6",
99
+ "@types/formidable": "^3.4.6",
117
100
  "@types/is-core-module": "^2.2.2",
118
- "@types/mime-types": "^2.1.4",
119
- "@types/node": "^22.14.1",
101
+ "@types/mime-types": "^3.0.1",
102
+ "@types/node": "^25.0.3",
103
+ "@types/picomatch": "^4.0.2",
120
104
  "@types/ws": "^8.18.1",
121
- "bumpp": "^10.1.0",
105
+ "bumpp": "^10.3.2",
122
106
  "conventional-changelog-cli": "^5.0.0",
123
- "eslint": "^9.24.0",
107
+ "eslint": "^9.39.2",
124
108
  "husky": "^9.1.7",
125
- "lint-staged": "^15.5.1",
126
- "tsup": "^8.4.0",
127
- "typescript": "^5.8.3"
109
+ "lint-staged": "^16.2.7",
110
+ "tsdown": "^0.18.3",
111
+ "typescript": "^5.9.3"
128
112
  },
129
113
  "lint-staged": {
130
114
  "*": "eslint --fix"
131
115
  },
116
+ "publishConfig": {
117
+ "access": "public",
118
+ "provenance": true
119
+ },
132
120
  "scripts": {
133
- "dev": "tsup src --watch",
134
- "build": "tsup",
121
+ "dev": "tsdown src --watch",
122
+ "build": "tsdown",
135
123
  "lint": "eslint .",
124
+ "release:publish": "pnpm -r publish",
136
125
  "release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
137
- "release": "bumpp package.json --execute=\"pnpm release:changelog\" --commit --all --push --tag && pnpm publish --access public"
126
+ "release": "bumpp package.json --execute=\"pnpm release:changelog\" --commit --all --push --tag"
138
127
  }
139
128
  }