resolvewithplus
Advanced tools
Comparing version 2.0.6 to 2.0.7
{ | ||
"name": "resolvewithplus", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "resolvewith with extra power", | ||
@@ -5,0 +5,0 @@ "readmeFilename": "README.md", |
@@ -1,1 +0,1 @@ | ||
import w from"fs";import S from"url";import i from"path";import _ from"module";const g=_.createRequire(import.meta.url),$=w.realpathSync.native,E=new RegExp("^(?:node:)?("+_.builtinModules.join("|").replace("/","/")+")$"),C=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,x=/^.\.?(?=\/|\\)/,P=/\\/g,D=/index.[tj]sx?$/,G=/[\\/]resolvewithplus[\\/]/,v=/\.js$/,J=/\.ts$/,Z=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,y=/^#/,F=/(\*)/g,A=/([./])/g,H=/^node:/,Q=/^file:/,O=[".js",".mjs",".ts",".tsx",".json",".node"],X=O.map(e=>`index${e}`),T="node_modules",h="package.json",U="node",L="default",Y="browser",d="import",j=".",N=e=>e&&typeof e=="object",b={},I=e=>H.test(e)?e:`node:${e}`,ee=e=>e&&S.pathToFileURL(e).href,te=e=>E.test(e),ne=e=>Q.test(e)?S.fileURLToPath(e):e,se=e=>i.resolve(i.extname(e)?i.dirname(e):e)+i.sep,R=e=>P.test(e)?e.replace(P,i.posix.sep):e,a=(e,s)=>{try{s=w.statSync(e)}catch{s=!1}return s&&(s.isFile()||s.isFIFO())},re=(e,s)=>{const t=s.find(n=>a(e+n))||null;return t&&e+t},oe=(e,s)=>{const t=s.find(n=>a(i.join(e,n)))||null;return t&&i.join(e,t)},k=(e,s=e.split(i.sep))=>{const t=(n,r=[[],[]])=>{if(!n.length)return r[1].reverse();if(n[0]===T&&!G.test(e))return t(n.slice(1),r);const o=r[0].length?i.join(r[0].slice(-1)[0],n[0]):n[0]||i.sep;return r[0].push(o),r[1].push(i.resolve(i.join(o,T))),t(n.slice(1),r)};return t(s)},ie=e=>{const s=e.split(i.sep).slice(1).reduce((t,n,r)=>(t.push(i.resolve(i.join(r?t[r-1]:i.sep,n))),t),[]).reverse().find(t=>a(i.join(t,h)));return s&&i.join(s,h)},ce=e=>(String(e).match(Z)||[]).slice(1),q=(e,s)=>new RegExp(e.replace(A,"\\$1").replace(F,".*")).test(s),le=(e,s,t)=>{const n=new RegExp(e.replace(A,"\\$1").replace(F,"(.*)")),r=(t.match(n)||[])[1];return r&&s.replace("*",r)},K=(e,s,t,n=!1)=>(q(e,t)&&(s.includes("*")?q(s,t)?n=t:e.includes("*")&&e!==s&&(n=le(e,s,t)):n=s),n),M=(e,s,t,n=e[0])=>e.length?(y.test(t)?y.test(n):x.test(n))&&typeof s[n]=="string"&&K(n,s[n],t)||M(e.slice(1),s,t):null,l=(e,s,t={})=>{let n=!1;return typeof e=="string"?e:(!n&&Array.isArray(e)&&(n=e.reduce((r,o)=>r||l(o,s,t),null)),!n&&N(e)&&(typeof e[s]=="string"&&(n=e[s]),n||(n=(t.priority||[U,L]).reduce((r,o)=>r||l(e[o],s,t),!1)),!n&&e[s]&&(n=l(e[s],s,t)),!n&&e[j]&&(n=typeof e[j]=="string"?s===d&&l(e[j],s,t):l(e[j],s,t)),n||(n=M(Object.keys(e),e,s))),n)},V=(e,s)=>{let t=s&&s.isimport&&e.module,n=t||s&&s.isbrowser&&e.browser,r=e.exports,o,c;return n&&(typeof n=="string"?c=n:N(n)&&([o]=Object.keys(n).filter(u=>D.test(u)),c=o in n&&n[o])),r&&(c=l(r,d,s)),c},m=(e,s={})=>{var t=null,n=s.istypescript&&v.test(e)&&e.replace(v,".ts");return a(n)?t=n:a(e)?t=e:t=re(e,O),t},W=(e,s)=>{let t=null,n,r=i.join(e,h),o=a(r)&&g(r);return(n=V(o,s))?t=m(i.join(e,n)):(n=o.main)?t=m(i.join(e,n),s)||m(i.join(e,i.join(n,"index"))):t=oe(e,X),t},z=(e,s,t)=>{const n=x.test(e)?i.join(s,e):e;return m(n,t)||W(n,t)},ae=(e,s,t,n)=>{const r=t&&t.imports,o=l(r,s,n);return o&&(x.test(o)?i.join(e,o):B(o,e,{isposixpath:!0}))},ue=(e,s,t,n,r)=>{const o=l(n&&n.exports,t?"./"+t:d,r);return o&&i.join(e,s,o)},fe=(e,s,t,n)=>{const r=i.join(e,s,h),o=a(r),c=o&&g(r);return o&&ue(e,s,t,c,n)},me=(e,s,t)=>{const n=ie(s),r=i.dirname(n);return n&&ae(r,e,g(n),t)},he=(e,s,t)=>{const[n,r]=ce(e);if(y.test(n))return me(e,s,t);const o=k(s).sort((c,u)=>c.length>u.length);return function c(u,f,p=f-1){return f--?fe(i.join(u[p-f]),n,r,t)||z(i.join(u[p-f],e),null,t)||c(o,f,p):null}(o,o.length)},de=(e,s,t)=>{var n=null;return s=typeof s=="string"?se(ne(decodeURI(s))):process.cwd(),E.test(e)?n=I(e):(n=C.test(e)?z(R(e),s,t):he(e,s,t),n=n&&(t.isposixpath?$(n):ee(R($(n))))),n},je=(e,s,t)=>{const n=(r,o)=>typeof r=="boolean"?r:o;return t=t||{},t.istypescript=n(t.istypescript,J.test(s)),t.isbrowser=n(t.isbrowser,!1),t.isimport=n(t.isimport,!0),Array.isArray(t.priority)||(t.priority=[],t.isbrowser&&t.priority.push(Y),t.isimport&&t.priority.push(d),t.priority.push(U),t.priority.push(L)),t},B=(e,s,t)=>{let n=b[e+s];return n||(t=je(e,s,t),n=de(e,s,t),b[e+s]=n)};export default Object.assign(B,{pathToPosix:R,getasnode_module_paths:k,getesmkeyvalmatch:K,getasfilesync:m,getasdirsync:W,gettargetindex:V,iscoremodule:te,esmparse:l,cache:b}); | ||
import S from"fs";import _ from"url";import i from"path";import $ from"module";const d=$.createRequire(import.meta.url),E=S.realpathSync.native,P=new RegExp("^(?:node:)?("+$.builtinModules.join("|").replace("/","/")+")$"),Z=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,j=/^.\.?(?=\/|\\)/,F=/\\/g,k=/index.[tj]sx?$/,H=/[\\/]resolvewithplus[\\/]/,A=/\.js$/,Q=/\.ts$/,X=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,R=/^#/,O=/(\*)/g,q=/([./])/g,Y=/^node:/,I=/^file:/,T=[".js",".mjs",".ts",".tsx",".json",".node"],tt=T.map(t=>`index${t}`),U="node_modules",f="package.json",L="node",m="default",et="browser",x="import",N=":spectype",st="module",nt="import",K="commonjs",ot="require",h=".",rt=t=>t&&typeof t=="object",b={},M=t=>({[st]:nt,[K]:ot})[t]||null,it=t=>Y.test(t)?t:`node:${t}`,ct=t=>t&&_.pathToFileURL(t).href,lt=t=>P.test(t),at=t=>I.test(t)?_.fileURLToPath(t):t,ut=t=>i.resolve(i.extname(t)?i.dirname(t):t)+i.sep,w=t=>F.test(t)?t.replace(F,i.posix.sep):t,l=(t,n)=>{try{n=S.statSync(t)}catch{n=!1}return n&&(n.isFile()||n.isFIFO())},pt=(t,n)=>{const s=n.find(e=>l(t+e))||null;return s&&t+s},ft=(t,n)=>{const s=n.find(e=>l(i.join(t,e)))||null;return s&&i.join(t,s)},V=(t,n=t.split(i.sep))=>{const s=(e,o=[[],[]])=>{if(!e.length)return o[1].reverse();if(e[0]===U&&!H.test(t))return s(e.slice(1),o);const r=o[0].length?i.join(o[0].slice(-1)[0],e[0]):e[0]||i.sep;return o[0].push(r),o[1].push(i.resolve(i.join(r,U))),s(e.slice(1),o)};return s(n)},mt=t=>{const n=t.split(i.sep).slice(1).reduce((s,e,o)=>(s.push(i.resolve(i.join(o?s[o-1]:i.sep,e))),s),[]).reverse().find(s=>l(i.join(s,f)));return n&&i.join(n,f)},ht=t=>(String(t).match(X)||[]).slice(1),W=(t,n)=>new RegExp(t.replace(q,"\\$1").replace(O,".*")).test(n),gt=(t,n,s)=>{const e=new RegExp(t.replace(q,"\\$1").replace(O,"(.*)")),o=(s.match(e)||[])[1];return o&&n.replace("*",o)},v=(t,n,s,e=!1)=>(W(t,s)&&(n.includes("*")?W(n,s)?e=s:t.includes("*")&&t!==n&&(e=gt(t,n,s)):e=n),e),z=(t,n,s,e=t[0])=>t.length?(R.test(s)?R.test(e):j.test(e))&&typeof n[e]=="string"&&v(e,n[e],s)||z(t.slice(1),n,s):null,c=(t,n,s={})=>{let e=!1;return typeof t=="string"?t:(!e&&Array.isArray(t)&&(e=t.reduce((o,r)=>o||c(r,n,s),null)),!e&&rt(t)&&(typeof t[n]=="string"&&(e=t[n]),e||(e=(s.priority||[L,m]).reduce((o,r)=>o||(r=r===N?M(s.packagejsontype):r,c(t[r],n,s)),!1)),!e&&t[m]&&(e=c(t[m],n)),!e&&t[n]&&(e=c(t[n],n,s)),!e&&t[h]&&(e=typeof t[h]=="string"?n===x&&c(t[h],n,s):c(t[h],n,s)),e||(e=z(Object.keys(t),t,n))),e)},g=(t,n={})=>{var s=null,e=n.istypescript&&A.test(t)&&t.replace(A,".ts");return l(e)?s=e:l(t)?s=t:s=pt(t,T),s},yt=t=>t.type||K,dt=(t,n={},s="")=>{const e=s?i.join(s,t):t;return g(e,n)||!k.test(t)&&g(i.join(e,"index"))},jt=(t,n={},s="",e=!1)=>{const o=n.packagejsontype;return n.isspectype!==!1&&(e=t[o]||t[M(o)]),!e&&t.main&&(e=dt(t.main,n,s)),e||null},B=(t,n={},s="",e)=>{const o=yt(t),r=Object.assign({packagejsontype:o},n);return n.isbrowser&&t.browser&&(e=c(t.browser,x,r)),!e&&t.exports&&(e=c(t.exports,o,r)),e||(e=jt(t,r,s)),e},C=(t,n)=>{const s=i.join(t,f),e=l(s)&&d(s),o=e?B(e,n,t):!1;return o||ft(t,tt)},D=(t,n,s)=>{const e=j.test(t)?i.join(n,t):t;return g(e,s)||C(e,s)},Rt=(t,n,s,e)=>{const o=s&&s.imports,r=c(o,n,e);return r&&(j.test(r)?i.join(t,r):J(r,t,{isposixpath:!0}))},xt=(t,n,s,e,o)=>{const r=c(e&&e.exports,s?"./"+s:x,o);return r&&i.join(t,n,r)},bt=(t,n,s,e)=>{const o=i.join(t,n,f),r=l(o),a=r&&d(o);return r&&xt(t,n,s,a,e)},wt=(t,n,s)=>{const e=mt(n),o=i.dirname(e);return e&&Rt(o,t,d(e),s)},St=(t,n,s)=>{const[e,o]=ht(t);if(R.test(e))return wt(t,n,s);const r=V(n).sort((a,p)=>a.length>p.length);return function a(p,u,y=u-1){return u--?bt(i.join(p[y-u]),e,o,s)||D(i.join(p[y-u],t),null,s)||a(r,u,y):null}(r,r.length)},_t=(t,n,s)=>{var e=null;return n=typeof n=="string"?ut(at(decodeURI(n))):process.cwd(),P.test(t)?e=it(t):(e=Z.test(t)?D(w(t),n,s):St(t,n,s),e=e&&(s.isposixpath?E(e):ct(w(E(e))))),e},G=(t,n,s)=>{const e=(o,r)=>typeof o=="boolean"?o:r;return s=s||{},s.istypescript=e(s.istypescript,Q.test(n)),s.isbrowser=e(s.isbrowser,!1),s.isspectype=e(s.isspectype,!0),Array.isArray(s.priority)||(s.priority=s.isbrowser?[et]:[],s.priority.push(N),s.priority.push(L),s.priority.push(m)),s},J=(t,n,s)=>{let e=b[t+n];return e||(s=G(t,n,s),e=_t(t,n,s),b[t+n]=e)};export default Object.assign(J,{pathToPosix:w,getasnode_module_paths:V,getesmkeyvalmatch:v,getasfilesync:g,getasdirsync:C,gettargetindex:B,iscoremodule:lt,createopts:G,esmparse:c,cache:b}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7257
17