@flemist/simple-utils 2.0.2 → 2.1.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.
- package/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +115 -53
- package/build/common/async/index.d.ts +1 -0
- package/build/common/async/retry/index.d.ts +2 -0
- package/build/common/async/retry/types.d.ts +15 -0
- package/build/common/async/retry/withRetry.d.ts +28 -0
- package/build/common/debug/LogLevel.d.ts +6 -0
- package/build/common/debug/console/consoleIntercept.d.ts +18 -0
- package/build/common/debug/console/consoleReplace.d.ts +2 -1
- package/build/common/debug/console/index.d.ts +1 -0
- package/build/common/debug/index.d.ts +1 -0
- package/build/common/index.cjs +1 -1
- package/build/common/index.d.ts +2 -0
- package/build/common/index.mjs +115 -53
- package/build/common/rx/Derived.d.ts +11 -0
- package/build/common/rx/Subject.d.ts +35 -0
- package/build/common/rx/SubjectWithId.d.ts +15 -0
- package/build/common/rx/helpers.d.ts +2 -0
- package/build/common/rx/index.d.ts +5 -0
- package/build/common/rx/types.d.ts +35 -0
- package/build/common/rx/waitObservable.d.ts +3 -0
- package/build/node/index.cjs +5 -2
- package/build/node/index.d.ts +2 -0
- package/build/node/index.mjs +912 -238
- package/build/node/process/exec.d.ts +2 -0
- package/build/node/process/index.d.ts +1 -0
- package/build/urlGet-BCW9jvAm.mjs +1947 -0
- package/build/urlGet-BOGFUahf.js +17 -0
- package/package.json +1 -1
- package/build/urlGet-gscwyYHD.mjs +0 -780
- package/build/urlGet-jyEOC24k.js +0 -11
package/build/node/index.cjs
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../urlGet-BOGFUahf.js"),V=require("@flemist/async-utils"),M=require("@flemist/time-limits"),xt=require("node:os"),Et=require("path"),G=require("@flemist/priority-queue"),kt=require("fs"),jt=require("picomatch"),Pt=require("child_process");function it(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const F=it(Et),R=it(kt),Z=new M.Pool(xt.cpus().length);function z(t){return t.replace(/\\/g,"/")}let H=null;function Ct(t){H==null&&(H=new Map);const e=z(t);let o=H.get(e);return o==null&&(o=new V.Locker,H.set(e,o)),o}function Dt(t){const{filePath:e,func:o}=t;return Ct(e).lock(()=>M.poolRunWait({pool:Z,count:1,func:o}))}function ct(t){return t.match(/^[/\\]?[^/\\]+/)[0]}function at(t,e){return ct(t)+"|"+e.ino}function lt(t){return t.endsWith(":")&&(t+="/"),F.resolve(t)}function ot(t,e){t.totalSize+=e.totalSize,t.maxFileDateModified=Math.max(t.maxFileDateModified,e.maxFileDateModified),t.countFiles+=e.countFiles,t.countDirs+=e.countDirs,t.countLinks+=e.countLinks}const ut=function(e){return e.code==="ENOENT"};function ft(t){const e=t.paths;if(!e||e.length===0)return Promise.resolve({totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0});const o=t.level??0,s=t.walkedIds??new Set,r=t.abortSignal,i=t.pool??Z,c=t.handleError,f=t.priority??G.priorityCreate(0),h=t.walkLinks??!1,a=t.log,O=t.handlePath,u=t.matchPath;async function w(m){if(!(c&&await c(m))&&!ut(m))throw m}function P(m){return!(!a||a.minTotalContentSize!=null&&m<a.minTotalContentSize||a.maxNestedLevel!=null&&o>a.maxNestedLevel)}return V.useAbortController(async m=>{const g=V.combineAbortSignals(r,m),y={totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0};function I(b,j){if(P(j.totalSize)){const S=`${j.totalSize.toLocaleString("en-US").replace(/,/g," ").padStart(19)}: ${b}`;a?.handleLog?a.handleLog(S):console.log(S)}}async function l(b,j,p,S){return O?await M.poolRunWait({pool:i,func:async()=>{try{return await O({level:o,path:b,stat:j,itemStat:p,totalStat:y,abortSignal:g})}catch(k){return await w(k),!1}},count:1,priority:S,abortSignal:g}):!0}async function x(b,j,p,S){S||(S=b);const k=await M.poolRunWait({pool:i,func:()=>R.promises.lstat(b).catch(w),count:1,priority:G.priorityCreate(j,G.priorityCreate(1,f)),abortSignal:g});if(!k||!p&&k.isFile())return null;const D=at(b,k);if(s.has(D))return null;s.add(D);let d={totalSize:k.size,maxFileDateModified:k.isDirectory()?0:k.mtimeMs,countFiles:0,countDirs:0,countLinks:0};const A=G.priorityCreate(j,G.priorityCreate(k.isDirectory()?2:3,f));if(k.isSymbolicLink()){if(h){const C=await M.poolRunWait({pool:i,func:()=>R.promises.readlink(b).catch(w).then(T=>T??null),count:1,priority:A,abortSignal:g});if(C){const T=F.isAbsolute(C)?C:F.resolve(F.dirname(S),C),N=await x(T,j,p,S);N&&(d=N)}}return(p||d.countFiles+d.countDirs+d.countLinks>=1)&&(d.countLinks+=1,await l(S,k,d,A)&&(ot(y,d),I(S,d))),d}else if(k.isDirectory()){const C=await M.poolRunWait({pool:i,func:()=>R.promises.readdir(b).catch(w),count:1,priority:f,abortSignal:g});if(C){for(let T=0,N=C.length;T<N;T++)C[T]=F.join(S,C[T]);d=await ft({...t,paths:C,abortSignal:g,priority:A,level:o+1,walkedIds:s})}}return(p||d.countFiles+d.countDirs+d.countLinks>=1)&&(k.isDirectory()?d.countDirs+=1:k.isFile()&&(d.countFiles+=1),await l(S,k,d,A)&&(ot(y,d),I(S,d))),d}const E=[];for(let b=0,j=e.length;b<j;b++){const p=lt(e[b]),S=u?u(p):!0;S!==!1&&E.push(x(p,b,S))}return await Promise.all(E),y})}function At(t){return ft(t)}function Lt({globs:t,rootDir:e,noCase:o}){const s=[];return t.forEach(r=>{r=z(r).trim();const i=r.startsWith("^");i&&(r=r.substring(1).trim());const c=r.startsWith("!");if(c&&(r=r.substring(1).trim()),r.startsWith("!")||r.startsWith("^"))throw new Error(`Invalid glob pattern: "${r}". The syntax '${r.substring(0,2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`);r.startsWith("/")&&(r="."+r);const f=z(e?F.resolve(e,r):r);if(!f)return;let h;try{h=jt(f,{nocase:o??!1,dot:!0,strictBrackets:!0})}catch(a){throw new Error(`Invalid glob pattern: "${r}". ${a instanceof Error?a.message:"Unknown error"}. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class with balanced brackets), ! (negate pattern), ^ (exclude if included). Examples: "*.js", "src/**/*.ts", "!node_modules", "[abc]def.txt". Ensure all brackets [ ] are properly closed and balanced.`)}s.push({exclude:i,negative:c,debugInfo:f,match:h})}),function(i){i=z(i);let c=null,f=!1;for(let h=0,a=s.length;h<a;h++){const O=s[h];O.match(i)&&(O.exclude?f=!O.negative:(c=!O.negative,f=!1))}return f?!1:c}}function ht(t){const e=t.startsWith("!");return e&&(t=t.substring(1)),t.startsWith("/")?t=t.substring(1):!t.startsWith("**")&&!t.startsWith("../")&&(t=`**/${t}`),e&&(t="!"+t),t}function mt(t,e){if(!e||e===".")return t;const o=t.startsWith("^");o&&(t=t.substring(1));const s=t.startsWith("!");return s&&(t=t.substring(1)),t.startsWith("/")?(e.endsWith("/")&&(e=e.substring(0,e.length-1)),t=e+t):(e.endsWith("/")||(e+="/"),t.startsWith("./")?t=e+t.substring(2):t.startsWith("../")?t=e+t:(e.startsWith("..")&&(e=""),t.startsWith("**")?t=e+t:t=e+"**/"+t)),t=z(F.normalize(t)),s&&(t="!"+t),o&&(t="^"+t),t}function st(t){return"^"+t}async function dt(t){const o=(await R.promises.readFile(t,"utf-8")).split(`
|
|
2
|
+
`),s=[];return o.forEach(r=>{r=r.trim(),!(!r||r.startsWith("#"))&&s.push(r)}),s}async function It(t){const e=t.rootDir??".",o=[];if(!t.globs?.length)return o;const s=[];return t.globs.forEach(r=>{r.value&&(r.valueType==="file-contains-patterns"?s.push(r):r.valueType==="pattern"&&o.push(r.exclude?st(r.value):r.value))}),s.length&&await Promise.all(s.map(async r=>{await M.poolRunWait({pool:Z,count:1,func:async()=>{const i=F.resolve(e,r.value),c=await dt(i),f=F.relative(e,F.dirname(i));c.forEach(h=>{h=ht(h),h=mt(h,f),o.push(r.exclude?st(h):h)})}})})),o}function yt(t,e={}){return new Promise((o,s)=>{const r=Pt.spawn(t,{shell:!0,...e}),i=[];r.stdout.on("data",c=>{i.push(c)}),r.on("error",c=>{s(c)}),r.on("exit",c=>{const f=Buffer.concat(i).toString("utf8");if(c!==0){s(new Error(`[exec][exit] code: ${c}`));return}o(f)})})}async function pt({page:t,urlFilters:e,timeouts:o}){return o||(o={}),o.downloadInternal||(o.downloadInternal=10*1e3),o.downloadExternal||(o.downloadExternal=60*1e3),o.total||(o.total=300*1e3),await n.withTimeout(()=>t.evaluate(({urlFilters:r,timeouts:i})=>{function c(a){return function(u){let w=!1;for(let P=0,m=a.length;P<m;P++){const g=a[P];g.pattern.test(u)&&(w=g.value)}return w}}const f=r&&c(r);let h=performance.getEntries&&performance.getEntries();return h||(h=[]),h.push({name:location.href}),Promise.all(h.map(a=>{if(a.entryType!=null&&a.entryType!=="resource"||f&&!f(a.name))return null;if(a.responseStatus!=null)return a.responseStatus>=400?Promise.resolve({url:a.name,error:a.responseStatus}):null;if(navigator.userAgent.indexOf("Chrome")===-1)return null;const O=typeof AbortController<"u"?new AbortController:null,u=new URL(a.name).origin===location.origin,w=u?i.downloadInternal:i.downloadExternal;let P;const m=new Promise((l,x)=>{P=x}),g=w&&setTimeout(()=>{O?.abort(),P(new Error("[test][getPageHttpErrors] fetch timeout"))},w);let y=fetch(a.name,{mode:u?"same-origin":"no-cors",signal:O?.signal,cache:u?"force-cache":void 0,method:"HEAD"}).then(l=>l.ok?null:{url:a.name,error:l.status+" "+l.statusText}).catch(l=>({url:a.name,error:l.message}));O||(y=Promise.race([y,m]));function I(){g&&clearTimeout(g)}return y.then(l=>(I(),l),l=>{throw I(),l})})).then(a=>{const O=a.filter(u=>u).map(u=>({url:new URL(u.url),error:u.error}));return O.length>0?O:null})},{urlFilters:e,timeouts:o}),{timeout:o.total})}async function Tt({page:t,urlFilters:e,errorFilter:o}){let s=await pt({page:t,urlFilters:e});if(s&&(o&&(s=s.filter(o)),s.length>0))throw new Error(`[test][checkPageHttpErrors] Page has http errors: ${JSON.stringify(s,null,2)}`)}async function Ft({page:t,filter:e,onError:o}){const s="callback_191b355ea6f64499a6607ad571da5d4d",r=t.context().browser()?.browserType().name(),i=n.getStackTrace();function c(f){try{if(e&&!e({url:new URL(t.url()),error:f}))return}catch(h){f=String(h)}try{console.error(`[test][subscribeJsErrors] BROWSER JS ERROR (${r}): ${f}`);const h=new Error(f);h.stack=i,o(h)}catch(h){console.error("[test][subscribeJsErrors] error",h)}}await t.exposeFunction(s,c),await t.addInitScript(f=>{function h(u){if(Array.isArray(u))return u.map(h).join(`\r
|
|
3
|
+
\r
|
|
4
|
+
`);if(u instanceof Error)return u.stack||u.toString();if(typeof u=="object"&&u!=null){const w=new Set;return JSON.stringify(u,(P,m)=>{if(typeof m=="object"&&m!=null){if(w.has(m))return"[Circular]";w.add(m)}return m},2)}return String(u)}function a(u){window[f](u)}const O={warn:console.warn.bind(console),error:console.error.bind(console)};console.warn=function(...w){return a("console.warn: "+h(w)),O.warn.apply(this,w)},console.error=function(...w){return a("console.error: "+h(w)),O.error.apply(this,w)},window.addEventListener("error",function(u){a("window error: "+(u.message||JSON.stringify(u)))},!0),window.addEventListener("unhandledrejection",function(u){a("window unhandledrejection: "+h(u.reason))},!0)},s)}async function Rt(){try{process.platform==="win32"&&await yt(`wmic process where "commandline like '%ms-playwright%' and not commandline like '%wmic.exe%' and priority != 4" CALL setpriority "idle"`)}catch(t){const e=t?.message?.trim();if(/exit code: 2147749890/.test(e))return;console.warn("[test][setPlaywrightPriorityLow] error: "+e)}}async function v(t,e){const o=F.dirname(t);await R.promises.stat(o).catch(()=>null)||await R.promises.mkdir(o,{recursive:!0}),await R.promises.writeFile(t,JSON.stringify(e,null,4),{encoding:"utf-8"})}async function wt(t){if(!await R.promises.stat(t).catch(()=>null))return null;const e=await R.promises.readFile(t,{encoding:"utf-8"});return JSON.parse(e)}const Q="-",X="+";function $(t,e,o){if(t===e)return null;if(Array.isArray(t)){if(Array.isArray(e)){let r=null;for(let i=0,c=Math.max(e.length,e.length);i<c;i++){const f=$(t[i],e[i],o);f!=null&&(r||(r=[]),r.push(f))}return r!=null&&o&&(r=o(t,e,r)),r}}else if(t instanceof Object&&e instanceof Object){let r=null;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const c=$(t[i],e[i],o);c!=null&&(r||(r={}),r[i]=c)}for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&!Object.prototype.hasOwnProperty.call(t,i)){const c=$(t[i],e[i],o);c!=null&&(r||(r={}),r[i]=c)}return r!=null&&o&&(r=o(t,e,r)),r}let s={[Q]:t,[X]:e};return o&&(s=o(t,e,s)),s}function Y(t){function e(l){return l.sort((x,E)=>x[0]>E[0]?1:-1).reduce((x,E)=>(x[E[0]]=E[1],x),{})}function o(l){return l.reduce((x,E)=>(x[E]=!0,x),{})}const s=t.filters&&t.filters.excludeAttrs&&o(t.filters.excludeAttrs),r=t.filters&&t.filters.fixAttrs,i=t.filters&&t.filters.fixStyles,c=t.filters&&t.filters.excludeStyles&&o(t.filters.excludeStyles),f=t.filters&&t.filters.fixTags,h=t.filters&&t.filters.excludeClasses,a=t.filters&&t.filters.excludeIds,O=t.filters&&t.filters.excludeSelectorClasses,u=t.filters&&t.filters.excludeSelectorIds;let w;if(t.filters&&t.filters.excludeSelectors&&t.filters.excludeSelectors.length>0){const l=Array.from(document.querySelectorAll(t.filters.excludeSelectors.join(",")));l.length>0&&(w=new Set(l))}function P(l,x,E,b){const j=getComputedStyle(l,x),p=[];for(let S=0,k=j.length;S<k;S++){const D=j[S];if(c&&c[D])continue;let d=j[D];if(d&&i)for(let A=0,C=i.length;A<C;A++)i[A].name.test(D)&&(d=d.replace(i[A].search,i[A].replace));(!E||E[D]!==d)&&(!b||b[D]===d)&&p.push([D,d])}return e(p)}function m(l,x,E){return{_:P(l,void 0,x&&x._,E&&E._),before:P(l,"before",x&&x.before,E&&E.before),after:P(l,"after",x&&x.after,E&&E.after)}}function g(l,x,E,b,j){for(let p=0,S=l.childNodes.length;p<S;p++){const k=l.childNodes[p];if(!k)throw new Error(`child is null; index=${p}; ${b}, ${l.className}\r
|
|
5
|
+
You should wait js executions before test`);k instanceof Element&&y(k,x,E,b,j)}}function y(l,x,E,b,j){const p=j&&j[x.length];if(j&&!p||w&&w.has(l))return;let S=l.tagName&&l.tagName.toLowerCase();if(S==="head"&&(E=!1),f)for(let L=0,J=f.length;L<J;L++)S=S.replace(f[L].search,f[L].replace);if(p&&p.tag!==S)return;const k=[];for(let L=0,J=l.attributes.length;L<J;L++){const _=l.attributes.item(L);let W=_.name,B=_.value;if(W=W.toLowerCase(),W!=="class"&&!(s&&s[W])){if(r)for(let U=0,Ot=r.length;U<Ot;U++)r[U].name.test(W)&&(B=B.replace(r[U].search,r[U].replace));(!p||p.attrs&&p.attrs[W]===B)&&k.push([W,B])}}const D=[],d=[];for(let L=0,J=l.classList.length;L<J;L++){const _=l.classList.item(L);(!h||!h.test(_))&&D.push(_),(!O||!O.test(_))&&d.push(_)}const A=E?m(l,t.defaultStyle,p&&p.style):null,C=l.childElementCount?[]:null;l.id&&(!a||!a.test(l.id))&&l.id;const T=l.id&&(!u||!u.test(l.id))?l.id:"",N=(S||"")+(T?"#"+T:"")+(d.length>0?"."+d.join("."):""),rt=N?b?b+" > "+N:N:b,bt={tag:S,selector:rt,classes:D,attrs:k.length>0?e(k):null,style:A,childs:C};x.push(bt),C&&g(l,C,E,rt,p&&p.childs)}const I=[];return y(document.documentElement,I,!0,"",t.shouldEqualResult&&[t.shouldEqualResult]),I[0]}async function tt(t){const e=await t.context().newCDPSession(t);return await e.send("DOM.enable"),await e.send("CSS.enable"),e}async function et(t){await t.send("CSS.disable"),await t.send("DOM.disable"),await t.detach()}async function Nt(t,e){const o=await tt(t);try{return await e(o)}finally{await et(o)}}async function gt(t,e){const{nodes:o}=await t.send("DOM.getFlattenedDocument",{depth:-1,pierce:!0}),s=o.filter(r=>r.nodeType===1).map(r=>r.nodeId);for(const r of s)await t.send("CSS.forcePseudoState",{nodeId:r,forcedPseudoClasses:e})}function K(t,e){if(!t||!e)return e||null;let o=null;for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&e[s]!==t[s]&&(o||(o={}),o[s]=e[s]);for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(o||(o={}),o[s]="");return o}function _t(t,e){if(!t||!e)return e||null;const o=K(t._,e._),s=K(t.before,e.before),r=K(t.after,e.after);return!o&&!s&&!r?null:{_:o||{},before:s||{},after:r||{}}}function Wt(t,e){if(!t||!e)return e||null;if(t.length!==e.length)return e;for(let o=0,s=t.length;o<s;o++)if(t[o]!==e[o])return e;return null}function nt(t,e){const o=Wt(t.classes,e.classes),s=K(t.attrs,e.attrs),r=_t(t.style,e.style);let i=null;if(t.childs&&e.childs){const c=Math.min(t.childs.length,e.childs.length);for(let f=0;f<c;f++){const h=nt(t.childs[f],e.childs[f]);if(h){if(!i){i=[];for(let a=0;a<c;a++)i.push({})}i[f]=h}}}return!o&&!s&&!r&&!i?null:{tag:e.tag,selector:e.selector,classes:o,attrs:s,style:r,childs:i}}const q=(t,e,o,s)=>{const r=s(t,e,o,s);if(r==null)return r;if(Array.isArray(r))return r.map((i,c,f)=>q(i,c,f,s));if(typeof r=="object"){const i={};for(const c in r)Object.prototype.hasOwnProperty.call(r,c)&&(i[c]=q(r[c],c,r,s));return i}return r};function St(t,e){if(t.attrs&&e.excludeAttrs){for(let o=0,s=e.excludeAttrs.length;o<s;o++)delete t.attrs[e.excludeAttrs[o]];Object.keys(t.attrs).length===0&&(t.attrs=null)}if(t.classes&&e.excludeClasses&&(t.classes=t.classes.filter(o=>!e.excludeClasses.test(o))),t.style&&e.excludeStyles)for(const o of["_","before","after"]){const s=t.style[o];if(s)for(let r=0,i=e.excludeStyles.length;r<i;r++)delete s[e.excludeStyles[r]]}if(t.childs)for(let o=0,s=t.childs.length;o<s;o++)St(t.childs[o],e)}function Mt(t,e){for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const s=t[o];for(const r in s){if(!Object.prototype.hasOwnProperty.call(s,r))continue;const i=s[r];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&St(i[c],e)}}}function zt({actualResultFile:t,expectedResultFile:e,diffResultFile:o,filters:s,transform:r,pseudoStates:i}){let c,f,h,a={};return{async init(O){c=await wt(e),r&&(c=q(c,null,null,r)),c&&s&&Mt(c,s),await O.goto("about:blank"),f=await O.evaluate(Y,{filters:s}),h=f.style},async handlePage({page:O,testId:u,url:w,stateId:P,_filters:m}){let g=a[u];g||(g={},a[u]=g);let y=g[w.href];y||(y={},g[w.href]=y),await O.addStyleTag({content:"*, *::before, *::after { animation-name: none!important; transition-duration: 0s !important; }"});const I=i??[{states:[]}];let l=null,x;try{for(let E=0;E<I.length;E++){const b=I[E],j=b.states.length>0?P+":"+b.states.join(":"):P;let p=null;if(b.states.length>0){l||(l=await tt(O));const d=performance.now();await gt(l,b.states),p=performance.now()-d}b.delay&&await V.delay(b.delay);const S=performance.now(),k=await O.evaluate(Y,{filters:m||s,defaultStyle:h,shouldEqualResult:y[j]}),D=performance.now()-S;if(console.log(`SNAPSHOT ${j}:`+(p!=null?` forcePseudoClasses ${p.toFixed(0)}ms,`:"")+` getAllElements ${D.toFixed(0)}ms`),!x)x=k,y[j]=k;else{const d=nt(x,k);d&&(y[j]=d)}}}finally{l&&await et(l)}},async end({checkExistUrlsOnly:O}){if(a=n.getNormalizedObject(a),r&&(a=q(a,null,null,r)),c){let u,w;if(!O)u=c,w=a;else{u={},w={};for(const m in c)if(Object.prototype.hasOwnProperty.call(c,m)&&Object.prototype.hasOwnProperty.call(a,m)){u[m]={},w[m]={};for(const g in c[m])Object.prototype.hasOwnProperty.call(c[m],g)&&Object.prototype.hasOwnProperty.call(a[m],g)&&(u[m][g]=c[m][g],w[m][g]=a[m][g])}}const P=$(u,w,(m,g,y)=>y.selector&&(delete y.selector,Object.keys(y).length===0)?null:y.childs&&y.childs.length===1?y.childs[0]:(g&&g.selector?y[X]?y[X]=g.selector:y={selector:g.selector,...y}:m&&m.selector&&(y[Q]?y[Q]=m.selector:y={selector:m.selector,...y}),y));if(o&&await v(o,P||{}),P)throw await v(t,a),console.error("Pages elements changes: "+JSON.stringify(P,null,4).substring(0,5e3)),new Error("Pages elements changes detected");await R.promises.stat(t).catch(()=>null)&&await R.promises.unlink(t)}else await v(e,a);return a}}}exports.ConsoleMessageLevel=n.ConsoleMessageLevel;exports.Lazy=n.Lazy;exports.LazyWithId=n.LazyWithId;exports.LogLevel=n.LogLevel;exports.Random=n.Random;exports.Subject=n.Subject;exports.SubjectWithId=n.SubjectWithId;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=n.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertConsole=n.alertConsole;exports.alertReplace=n.alertReplace;exports.check=n.check;exports.consoleIntercept=n.consoleIntercept;exports.consoleMessageToString=n.consoleMessageToString;exports.consoleReplace=n.consoleReplace;exports.convertTimeZone=n.convertTimeZone;exports.createTaskDelayRetry=n.createTaskDelayRetry;exports.createUniquePseudoRandom=n.createUniquePseudoRandom;exports.dateNowUnique=n.dateNowUnique;exports.deepCloneJsonLike=n.deepCloneJsonLike;exports.deepEqualJsonLike=n.deepEqualJsonLike;exports.deepEqualJsonLikeMap=n.deepEqualJsonLikeMap;exports.equalArray=n.equalArray;exports.escapeHtml=n.escapeHtml;exports.escapeRegExp=n.escapeRegExp;exports.fixStackTrace=n.fixStackTrace;exports.formatAny=n.formatAny;exports.formatDate=n.formatDate;exports.formatDateFileName=n.formatDateFileName;exports.getConsoleMessages=n.getConsoleMessages;exports.getDateInet=n.getDateInet;exports.getNormalizedObject=n.getNormalizedObject;exports.getRandomFunc=n.getRandomFunc;exports.getRandomSeed=n.getRandomSeed;exports.getStackTrace=n.getStackTrace;exports.isObservable=n.isObservable;exports.match=n.match;exports.matchAnd=n.matchAnd;exports.matchAndPipe=n.matchAndPipe;exports.matchAny=n.matchAny;exports.matchArray=n.matchArray;exports.matchArrayBuffer=n.matchArrayBuffer;exports.matchArrayIncludes=n.matchArrayIncludes;exports.matchArrayItem=n.matchArrayItem;exports.matchArrayLength=n.matchArrayLength;exports.matchArrayWith=n.matchArrayWith;exports.matchBoolean=n.matchBoolean;exports.matchConstructor=n.matchConstructor;exports.matchConvert=n.matchConvert;exports.matchCustom=n.matchCustom;exports.matchDeep=n.matchDeep;exports.matchEnum=n.matchEnum;exports.matchFloat=n.matchFloat;exports.matchIn=n.matchIn;exports.matchInstanceOf=n.matchInstanceOf;exports.matchInt=n.matchInt;exports.matchIntDate=n.matchIntDate;exports.matchIs=n.matchIs;exports.matchIsNonStrict=n.matchIsNonStrict;exports.matchNever=n.matchNever;exports.matchNot=n.matchNot;exports.matchNotNullish=n.matchNotNullish;exports.matchNullish=n.matchNullish;exports.matchNumber=n.matchNumber;exports.matchObject=n.matchObject;exports.matchObjectEntries=n.matchObjectEntries;exports.matchObjectEntry=n.matchObjectEntry;exports.matchObjectKey=n.matchObjectKey;exports.matchObjectKeyValue=n.matchObjectKeyValue;exports.matchObjectKeys=n.matchObjectKeys;exports.matchObjectKeysNotNull=n.matchObjectKeysNotNull;exports.matchObjectPartial=n.matchObjectPartial;exports.matchObjectValue=n.matchObjectValue;exports.matchObjectValues=n.matchObjectValues;exports.matchObjectWith=n.matchObjectWith;exports.matchOptional=n.matchOptional;exports.matchOr=n.matchOr;exports.matchOrPipe=n.matchOrPipe;exports.matchRange=n.matchRange;exports.matchRangeDate=n.matchRangeDate;exports.matchRef=n.matchRef;exports.matchString=n.matchString;exports.matchStringLength=n.matchStringLength;exports.matchTypeOf=n.matchTypeOf;exports.matchUuid=n.matchUuid;exports.matchValueState=n.matchValueState;exports.max=n.max;exports.min=n.min;exports.minMax=n.minMax;exports.numberMod=n.numberMod;exports.randomBoolean=n.randomBoolean;exports.randomEnum=n.randomEnum;exports.randomFloat=n.randomFloat;exports.randomIndexWeighted=n.randomIndexWeighted;exports.randomInt=n.randomInt;exports.randomItem=n.randomItem;exports.randomItems=n.randomItems;exports.setFuncName=n.setFuncName;exports.sha256=n.sha256;exports.sha256Buffer=n.sha256Buffer;exports.timeoutAbortController=n.timeoutAbortController;exports.toHex=n.toHex;exports.truncateString=n.truncateString;exports.urlGetBoolean=n.urlGetBoolean;exports.urlGetFloat=n.urlGetFloat;exports.urlGetInt=n.urlGetInt;exports.urlGetParams=n.urlGetParams;exports.urlGetString=n.urlGetString;exports.urlParamToBoolean=n.urlParamToBoolean;exports.urlParamToFloat=n.urlParamToFloat;exports.urlParamToInt=n.urlParamToInt;exports.waitObservable=n.waitObservable;exports.withConsoleReplace=n.withConsoleReplace;exports.withRetry=n.withRetry;exports.withTimeout=n.withTimeout;exports.DIFF_NEW=X;exports.DIFF_OLD=Q;exports.checkPageHttpErrors=Tt;exports.createCDPSession=tt;exports.createMatchPath=Lt;exports.createPagesElementsChangesTest=zt;exports.destroyCDPSession=et;exports.exec=yt;exports.fileLock=Dt;exports.forcePseudoClasses=gt;exports.getAllElements=Y;exports.getDrive=ct;exports.getElementsStyleDiff=nt;exports.getFileId=at;exports.getObjectsDiff=$;exports.getPageHttpErrors=pt;exports.globGitIgnoreToPicomatch=ht;exports.globToRelative=mt;exports.loadGlobs=It;exports.loadGlobsFromFile=dt;exports.loadJson=wt;exports.objectTransform=q;exports.pathNormalize=z;exports.pathResolve=lt;exports.poolFs=Z;exports.saveJson=v;exports.setPlaywrightPriorityLow=Rt;exports.subscribeJsErrors=Ft;exports.usingCDPSession=Nt;exports.walkPathHandleErrorDefault=ut;exports.walkPaths=At;
|
package/build/node/index.d.ts
CHANGED