resolvewithplus
Advanced tools
Comparing version 2.1.3 to 2.1.4
{ | ||
"name": "resolvewithplus", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "resolvewith with extra power", | ||
@@ -5,0 +5,0 @@ "readmeFilename": "README.md", |
@@ -1,1 +0,1 @@ | ||
import _ from"fs";import $ from"url";import i from"path";import E from"module";const P=E.createRequire(import.meta.url),F=_.realpathSync.native,O=new RegExp("^(?:node:)?("+E.builtinModules.join("|").replace("/","/")+")$"),A=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,g=/^.\.?(?=\/|\\)/,q=/\\/g,I=/index.[tj]sx?$/,tt=/[\\/]resolvewithplus[\\/]/,T=/\.js$/,et=/\.ts$/,st=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,h=/^#/,U=/(\*)/g,L=/([./])/g,nt=/^node:/,ot=/^file:/,N=[".js",".mjs",".ts",".tsx",".json",".node"],rt=N.map(t=>`index${t}`),k="node_modules",f="package.json",K="node",m="default",it="browser",M="import",y=":spectype",V="module",W="import",z="commonjs",ct="require",j=".",lt=t=>t&&typeof t=="object",d={},R=t=>({[V]:W,[z]:ct})[t]||null,at=t=>nt.test(t)?t:`node:${t}`,ut=t=>t&&$.pathToFileURL(t).href,ft=t=>O.test(t),mt=t=>ot.test(t)?$.fileURLToPath(t):t,pt=t=>i.resolve(i.extname(t)?i.dirname(t):t)+i.sep,b=t=>q.test(t)?t.replace(q,i.posix.sep):t,a=(t,n)=>{try{n=_.statSync(t)}catch{n=!1}return n&&(n.isFile()||n.isFIFO())},B=(t,n)=>n.packagejsonmap&&n.packagejsonmap[t]||a(t)&&P(t),gt=(t,n)=>{const e=n.find(s=>a(t+s))||null;return e&&t+e},ht=(t,n)=>{const e=n.find(s=>a(i.join(t,s)))||null;return e&&i.join(t,e)},C=(t,n=t.split(i.sep))=>{const e=(s,o=[[],[]])=>{if(!s.length)return o[1];if(s[0]===k&&tt.test(t))return e(s.slice(1),o);const r=o[0].length?i.join(o[0].slice(-1)[0],s[0]):s[0]||i.sep;return o[0].push(r),o[1].push(i.resolve(i.join(r,k))),e(s.slice(1),o)};return e(n)},yt=t=>{const n=t.split(i.sep).slice(1).reduce((e,s,o)=>(e.push(i.resolve(i.join(o?e[o-1]:i.sep,s))),e),[]).reverse().find(e=>a(i.join(e,f)));return n&&i.join(n,f)},jt=t=>(String(t).match(st)||[]).slice(1),D=(t,n)=>new RegExp(t.replace(L,"\\$1").replace(U,".*")).test(n),dt=(t,n,e)=>{const s=new RegExp(t.replace(L,"\\$1").replace(U,"(.*)")),o=(e.match(s)||[])[1];return o&&n.replace("*",o)},G=(t,n,e,s=!1)=>(D(t,e)&&(n.includes("*")?D(n,e)?s=e:t.includes("*")&&t!==n&&(s=dt(t,n,e)):s=n),s),J=(t,n,e,s=t[0])=>t.length?(h.test(e)?h.test(s):g.test(s))&&typeof n[s]=="string"&&G(s,n[s],e)||J(t.slice(1),n,e):null,l=(t,n,e={})=>{const s=e.priority||[K,m];let o=!1;return typeof t=="string"?t:(!o&&Array.isArray(t)&&(o=t.reduce((r,c)=>r||l(c,n,e),null)),!o&<(t)&&(typeof t[n]=="string"&&(o=t[n]),o||(o=s.reduce((r,c)=>r||(c=c===y?R(e.packagejsontype):c,l(t[c],n,e)),!1)),!o&&t[m]&&(o=l(t[m],n)),!o&&t[n]&&(o=l(t[n],n,e)),o||(o=J(Object.keys(t),t,n)),!o&&t[j]&&(s.includes(n)?o=s.reduce((r,c)=>r||(c=c===y?R(e.packagejsontype):c,l(t[j],c,e)),!1):o=l(t[j],n,e))),o)},p=(t,n={})=>{var e=null,s=n.istypescript&&T.test(t)&&t.replace(T,".ts");return a(s)?e=s:a(t)?e=t:e=gt(t,N),e},x=t=>t.type||"exports"in t&&V||z,w=(t,n={},e="")=>{const s=e?i.join(e,t):t;return p(s,n)||!I.test(t)&&p(i.join(s,"index"))},Z=(t,n={},e="",s=!1)=>{const o=x(t);return n.isspectype!==!1&&(s=t[o]||t[R(o)],s=s&&w(s,n,e)),!s&&(n.priority||[]).includes(W)&&t.module&&(s=w(t.module,n,e)),!s&&t.main&&(s=w(t.main,n,e)),s||null},H=(t,n={},e="",s)=>{const o=x(t),r=Object.assign({packagejsontype:o},n);return n.isbrowser&&t.browser&&(s=l(t.browser,M,r),s=s&&!A.test(s)?i.join(e,s):s),s||(s=Z(t,r,e)),s},Q=(t,n)=>{const e=i.join(t,f),s=B(e,n),o=s?H(s,n,t):!1;return o||ht(t,rt)},X=(t,n,e)=>{const s=g.test(t)?i.join(n,t):t;return p(s,e)||Q(s,e)},Rt=(t,n,e,s)=>{const o=e&&e.imports,r=l(o,n,s);return r&&(g.test(r)?i.join(t,r):v(r,t,{isposixpath:!0}))},bt=(t,n,e,s,o)=>{const r=l(s&&s.exports,e?"./"+e:M,o);return r&&i.join(t,n,r)},xt=(t,n,e,s)=>{const o=i.join(t,n,f),r=B(o,s),c=r&&x(r);return r&&bt(t,n,e,r,Object.assign({packagejsontype:c},s))},wt=(t,n,e)=>{const s=yt(n),o=i.dirname(s);return s&&Rt(o,t,P(s),e)},St=(t,n,e)=>{const[s,o]=jt(t);if(h.test(s))return wt(t,n,e);const r=C(n);return function c(S,u){return u--?xt(i.join(S[u]),s,o,e)||X(i.join(S[u],t),null,e)||c(r,u):null}(r,r.length)},_t=(t,n,e)=>{var s=null;return n=typeof n=="string"?pt(mt(decodeURI(n))):process.cwd(),O.test(t)?s=at(t):(s=A.test(t)?X(b(t),n,e):St(t,n,e),s=s&&(e.isposixpath?F(s):ut(b(F(s))))),s},Y=(t,n,e)=>{const s=(o,r)=>typeof o=="boolean"?o:r;return e=e||{},e.istypescript=s(e.istypescript,et.test(n)),e.isbrowser=s(e.isbrowser,!1),e.isspectype=s(e.isspectype,!0),e.packagejsonmap=e.packagejsonmap||null,Array.isArray(e.priority)||(e.priority=e.isbrowser?[it]:[],e.priority.push(y),e.priority.push(K),e.priority.push(m)),e},v=(t,n,e)=>{let s=d[t+n];return s||(e=Y(t,n,e),s=_t(t,n,e),d[t+n]=s)};export default Object.assign(v,{pathToPosix:b,getasnode_module_paths:C,getesmkeyvalmatch:G,getasfilesync:p,getasdirsync:Q,gettargetindex:H,iscoremodule:ft,createopts:Y,esmparse:l,cache:d});export{Z as gettargetindextop}; | ||
import E from"fs";import P from"url";import i from"path";import F from"module";const O=F.createRequire(import.meta.url),A=E.realpathSync.native,q=new RegExp("^(?:node:)?("+F.builtinModules.join("|").replace("/","/")+")$"),T=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,j=/^.\.?(?=\/|\\)/,U=/\\/g,ot=/index.[tj]sx?$/,rt=/[\\/]resolvewithplus[\\/]/,L=/\.js$/,it=/\.ts$/,ct=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,y=/^#/,N=/(\*)/g,K=/([./])/g,lt=/^node:/,ut=/^file:/,M=[".js",".mjs",".ts",".tsx",".json",".node"],at=M.map(t=>`index${t}`),V="node_modules",p="package.json",W="node",m="default",ft="browser",z="import",d=":spectype",B="module",C="import",D="commonjs",pt="require",R=".",b=t=>t&&typeof t=="object",x={},w=t=>({[B]:C,[D]:pt})[t]||null,mt=t=>lt.test(t)?t:`node:${t}`,gt=t=>t&&P.pathToFileURL(t).href,ht=t=>q.test(t),jt=t=>ut.test(t)?P.fileURLToPath(t):t,yt=t=>i.resolve(i.extname(t)?i.dirname(t):t)+i.sep,S=t=>U.test(t)?t.replace(U,i.posix.sep):t,a=(t,n)=>{try{n=E.statSync(t)}catch{n=!1}return n&&(n.isFile()||n.isFIFO())},G=(t,n)=>n.packagejsonmap&&n.packagejsonmap[t]||a(t)&&O(t),dt=(t,n)=>{const e=n.find(s=>a(t+s))||null;return e&&t+e},Rt=(t,n)=>{const e=n.find(s=>a(i.join(t,s)))||null;return e&&i.join(t,e)},J=(t,n=t.split(i.sep))=>{const e=(s,o=[[],[]])=>{if(!s.length)return o[1];if(s[0]===V&&rt.test(t))return e(s.slice(1),o);const r=o[0].length?i.join(o[0].slice(-1)[0],s[0]):s[0]||i.sep;return o[0].push(r),o[1].push(i.resolve(i.join(r,V))),e(s.slice(1),o)};return e(n)},bt=t=>{const n=t.split(i.sep).slice(1).reduce((e,s,o)=>(e.push(i.resolve(i.join(o?e[o-1]:i.sep,s))),e),[]).reverse().find(e=>a(i.join(e,p)));return n&&i.join(n,p)},xt=t=>(String(t).match(ct)||[]).slice(1),Z=(t,n)=>new RegExp(t.replace(K,"\\$1").replace(N,".*")).test(n),H=(t,n,e)=>{const s=new RegExp(t.replace(K,"\\$1").replace(N,"(.*)")),o=(e.match(s)||[])[1];return o&&n.replace("*",o)},Q=(t,n,e,s,o=!1)=>{if(Z(t,e))if(String(n).includes("*"))Z(n,e)?o=e:t.includes("*")&&t!==n&&(o=H(t,n,e));else{if(b(n)&&t.includes("*")){const r=e,c=i.posix.join(e,t),f=Object.keys(n).reduce((u,h)=>{const nt=n[h].split(/\.?\//).find(st=>st);return u[h]=H(c,i.posix.join(nt,c),i.posix.join(r,n[h].split("*")[1])),u},{});return l(f,e,s)}o=o||n}return o},X=(t,n,e,s,o=t[0])=>t.length?(y.test(e)?y.test(o):j.test(o))&&(typeof n[o]=="string"||b(n[o]))&&Q(o,n[o],e,s)||X(t.slice(1),n,e,s):null,l=(t,n,e={})=>{const s=e.priority||[W,m];let o=!1;return typeof t=="string"?t:(!o&&Array.isArray(t)&&(o=t.reduce((r,c)=>r||l(c,n,e),null)),!o&&b(t)&&(typeof t[n]=="string"&&(o=t[n]),o||(o=s.reduce((r,c)=>r||(c=c===d?w(e.packagejsontype):c,l(t[c],n,e)),!1)),!o&&t[m]&&(o=l(t[m],n)),!o&&t[n]&&(o=l(t[n],n,e)),o||(o=X(Object.keys(t),t,n,e)),!o&&t[R]&&(s.includes(n)?o=s.reduce((r,c)=>r||(c=c===d?w(e.packagejsontype):c,l(t[R],c,e)),!1):o=l(t[R],n,e))),o)},g=(t,n={})=>{var e=null,s=n.istypescript&&L.test(t)&&t.replace(L,".ts");return a(s)?e=s:a(t)?e=t:e=dt(t,M),e},_=t=>t.type||"exports"in t&&B||D,$=(t,n={},e="")=>{const s=e?i.join(e,t):t;return g(s,n)||!ot.test(t)&&g(i.join(s,"index"))},Y=(t,n={},e="",s=!1)=>{const o=_(t);return n.isspectype!==!1&&(s=t[o]||t[w(o)],s=s&&$(s,n,e)),!s&&(n.priority||[]).includes(C)&&t.module&&(s=$(t.module,n,e)),!s&&t.main&&(s=$(t.main,n,e)),s||null},k=(t,n={},e="",s)=>{const o=_(t),r=Object.assign({packagejsontype:o},n);return n.isbrowser&&t.browser&&(s=l(t.browser,z,r),s=s&&!T.test(s)?i.join(e,s):s),s||(s=Y(t,r,e)),s},I=(t,n)=>{const e=i.join(t,p),s=G(e,n),o=s?k(s,n,t):!1;return o||Rt(t,at)},v=(t,n,e)=>{const s=j.test(t)?i.join(n,t):t;return g(s,e)||I(s,e)},wt=(t,n,e,s)=>{const o=e&&e.imports,r=l(o,n,s);return r&&(j.test(r)?i.join(t,r):et(r,t,{isposixpath:!0}))},St=(t,n,e,s,o)=>{const r=l(s&&s.exports,e?"./"+e:z,o);return r&&i.join(t,n,r)},_t=(t,n,e,s)=>{const o=i.join(t,n,p),r=G(o,s),c=r&&_(r);return r&&St(t,n,e,r,Object.assign({packagejsontype:c},s))},$t=(t,n,e)=>{const s=bt(n),o=i.dirname(s);return s&&wt(o,t,O(s),e)},Et=(t,n,e)=>{const[s,o]=xt(t);if(y.test(s))return $t(t,n,e);const r=J(n);return function c(f,u){return u--?_t(i.join(f[u]),s,o,e)||v(i.join(f[u],t),null,e)||c(r,u):null}(r,r.length)},Pt=(t,n,e)=>{var s=null;return n=typeof n=="string"?yt(jt(decodeURI(n))):process.cwd(),q.test(t)?s=mt(t):(s=T.test(t)?v(S(t),n,e):Et(t,n,e),s=s&&(e.isposixpath?A(s):gt(S(A(s))))),s},tt=(t,n,e)=>{const s=(o,r)=>typeof o=="boolean"?o:r;return e=e||{},e.istypescript=s(e.istypescript,it.test(n)),e.isbrowser=s(e.isbrowser,!1),e.isspectype=s(e.isspectype,!0),e.packagejsonmap=e.packagejsonmap||null,Array.isArray(e.priority)||(e.priority=e.isbrowser?[ft]:[],e.priority.push(d),e.priority.push(W),e.priority.push(m)),e},et=(t,n,e)=>{let s=x[t+n];return s||(e=tt(t,n,e),s=Pt(t,n,e),x[t+n]=s)};export default Object.assign(et,{pathToPosix:S,getasnode_module_paths:J,getesmkeyvalmatch:Q,getasfilesync:g,getasdirsync:I,gettargetindex:k,iscoremodule:ht,createopts:tt,esmparse:l,cache:x});export{Y as gettargetindextop}; |
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
7764
19