resolvewithplus
Advanced tools
Comparing version 0.9.0 to 1.0.0
{ | ||
"name": "resolvewithplus", | ||
"version": "0.9.0", | ||
"version": "1.0.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12.16.0" |
@@ -7,3 +7,3 @@ resolvewithplus | ||
resolvewithplus('koa', '/root/resolvewith/test/') | ||
// '/root/resolvewith/node_modules/koa/dist/koa.mjs' | ||
// 'file:///root/resolvewith/node_modules/koa/dist/koa.mjs' | ||
``` | ||
@@ -10,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
import x from"fs";import l from"path";import R from"module";const u=R.createRequire(import.meta.url),A=x.realpathSync.native,b=new RegExp("^(?:node:)?("+R.builtinModules.join("|").replace("/","/")+")$"),I=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,d=/^.\.?(?=\/|\\)/,_=/\\/g,F=/^[a-zA-Z]:/,O=/index.[tj]sx?$/,W=/[\\/]resolvewithplus[\\/]/,w=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,j=/^#/,k=/(\*)/g,S=/([./])/g,P=[".js",".mjs",".ts",".tsx",".json",".node"],$="node_modules",g="package.json",v="node",E="default",y="import",p=".",h=n=>n&&typeof n=="object";export default(n=>(n=(e,s,t)=>{let r=n.cache[e+s];return r||(r=n.begin(e,s,t||{}),n.cache[e+s]=r)},n.cache={},n.pathToPosix=e=>_.test(e)?e.replace(F,"").replace(_,l.posix.sep):e,n.begin=(e,s,t)=>{var r=null;return s=typeof s=="string"?n.getasdirname(decodeURI(s)):process.cwd(),b.test(e)?r=e:(r=I.test(e)?n.getasfileordir(n.pathToPosix(e),s,t):n.getasnode_module(e,s),r=r&&A(r)),r},n.iscoremodule=e=>b.test(e),n.isfilesync=(e,s)=>{try{s=x.statSync(e)}catch{s=!1}return s&&(s.isFile()||s.isFIFO())},n.gettargetnameandspecifier=e=>(String(e).match(w)||[]).slice(1),n.ispathesmmatch=(e,s)=>new RegExp(e.replace(S,"\\$1").replace(k,".*")).test(s),n.getesemkeyvalglobreplaced=(e,s,t)=>{const r=new RegExp(e.replace(S,"\\$1").replace(k,"(.*)")),i=(t.match(r)||[])[1];return i&&s.replace("*",i)},n.getesmkeyvalmatch=(e,s,t,r=!1)=>(n.ispathesmmatch(e,t)&&(s.includes("*")?n.ispathesmmatch(s,t)?r=t:e.includes("*")&&e!==s&&(r=n.getesemkeyvalglobreplaced(e,s,t)):r=s),r),n.esmparsesugar=(e,s,t=null)=>(typeof e=="string"?t=e:h(e)&&(t=n.esmparsesugar(e[s],s)||n.esmparsesugar(e[p],s)),t),n.esmparselist=(e,s,t,r=e[0])=>e.length?(j.test(t)?j.test(r):d.test(r))&&typeof s[r]=="string"&&n.getesmkeyvalmatch(r,s[r],t)||n.esmparselist(e.slice(1),s,t):null,n.esmparse=(e,s)=>{let t=!1;return typeof e=="string"?e:(s===y&&(t=n.esmparsesugar(e,s)),!t&&h(e)&&(typeof e[s]=="string"&&(t=e[s]),!t&&e[v]&&(t=n.esmparse(e[v],s)),!t&&e[E]&&(t=n.esmparse(e[E],s)),!t&&e[s]&&(t=n.esmparse(e[s],s)),!t&&e[p]&&Array.isArray(e[p])&&(t=e[p].reduce((r,i)=>r||n.esmparse(i,s),null)),t||(t=n.esmparselist(Object.keys(e),e,s))),t)},n.gettargetindex=(e,s)=>{let r=s&&s.ismodule&&e.module||s&&s.browser&&e.browser,i=e.exports,o,a;return r&&(typeof r=="string"?a=r:h(r)&&([o]=Object.keys(r).filter(m=>O.test(m)),a=o in r&&r[o])),i&&(a=n.esmparse(i,y)),a},n.getasfilesync=e=>{var s=null;return n.isfilesync(e)?s=e:P.some(t=>n.isfilesync(e+t)&&(s=e+t)),s},n.getasdirsync=(e,s)=>{let t=null,r,i=l.join(e,g),o=n.isfilesync(i)&&u(i);return(r=n.gettargetindex(o,s))?t=n.getasfilesync(l.join(e,r)):(r=o.main)?t=n.getasfilesync(l.join(e,r))||n.getasfilesync(l.join(e,l.join(r,"index"))):P.some(a=>(a=l.join(e,`index${a}`))&&n.isfilesync(a)&&(t=a)),t},n.getasfileordir=(e,s,t)=>{const r=d.test(e)?l.join(s,e):e;return n.getasfilesync(r,t)||n.getasdirsync(r,t)},n.esmparseimport=(e,s,t)=>{const r=t&&t.imports,i=n.esmparse(r,s);return i&&(d.test(i)?l.join(e,i):n(i,e))},n.esmparseexport=(e,s,t,r)=>{const i=n.esmparse(r&&r.exports,t?"./"+t:y);return i&&l.join(e,s,i)},n.esmparseexportpkg=(e,s,t,r)=>{const i=l.join(e,s,g),o=n.isfilesync(i),a=o&&u(i);return o&&n.esmparseexport(e,s,t,a,r)},n.esmparseimportpkg=(e,s,t)=>{const r=n.getasfirst_parent_packagejson_path(s),i=l.dirname(r);return r&&n.esmparseimport(i,e,u(r),t)},n.getasnode_module=(e,s,t)=>{const[r,i]=n.gettargetnameandspecifier(e);if(j.test(r))return n.esmparseimportpkg(e,s,t);const o=n.getasnode_module_paths(s).sort((a,m)=>a.length>m.length);return function a(m,c,f=c-1){return c--?n.esmparseexportpkg(l.join(m[f-c]),r,i,t)||n.getasfileordir(l.join(m[f-c],e),null,t)||a(o,c,f):null}(o,o.length)},n.getfirstparent_packagejson=e=>{let{join:s,sep:t}=l,r=e.split(t),i,o;for(let a=r.length;a--;)if(r[a]&&(o=s(t,s.apply(a,r.slice(0,a+1)),i),n.isfilesync(o))){i=u(o);break}return i},n.getasnode_module_paths=e=>e.split(l.sep).slice(1).reduce((s,t,r)=>(t===$&&!W.test(e)||(t=l.resolve(l.join(r?s[0][r-1]:l.sep,t)),s[0].push(t),s[1].push(l.join(t,$))),s),[[],[]])[1].reverse(),n.getasfirst_parent_packagejson_path=e=>{const s=e.split(l.sep).slice(1).reduce((t,r,i)=>(t.push(l.resolve(l.join(i?t[i-1]:l.sep,r))),t),[]).reverse().find(t=>n.isfilesync(l.join(t,g)));return s&&l.join(s,g)},n.getasdirname=e=>l.resolve(l.extname(e)?l.dirname(e):e),n))(); | ||
import x from"fs";import a from"path";import y from"module";const d=y.createRequire(import.meta.url),R=x.realpathSync.native,b=new RegExp("^(?:node:)?("+y.builtinModules.join("|").replace("/","/")+")$"),v=/^\.?\.?([a-zA-Z]:)?(\/|\\)/,f=/^.\.?(?=\/|\\)/,_=/\\/g,F=/index.[tj]sx?$/,T=/[\\/]resolvewithplus[\\/]/,A=/(^@[^/]*\/[^/]*|^[^/]*)\/?(.*)$/,j=/^#/,k=/(\*)/g,P=/([./])/g,L=/^\//,w=/^node:/,C="file:///",S=[".js",".mjs",".ts",".tsx",".json",".node"],$="node_modules",p="package.json",E="node",O="default",h="import",u=".",I=t=>t&&typeof t=="object";export default(t=>(t=(e,s,n)=>{let r=t.cache[e+s];return r||(r=t.begin(e,s,n||{}),t.cache[e+s]=r)},t.cache={},t.pathToPosix=e=>_.test(e)?e.replace(_,a.posix.sep):e,t.begin=(e,s,n)=>{var r=null;return s=typeof s=="string"?t.getasdirname(decodeURI(s)):process.cwd(),b.test(e)?r=t.addprotocolnode(e):(r=v.test(e)?t.getasfileordir(t.pathToPosix(e),s,n):t.getasnode_module(e,s),r=r&&(n.isposixpath?R(r):t.addprotocolfile(t.pathToPosix(R(r))))),r},t.addprotocolnode=e=>w.test(e)?e:`node:${e}`,t.addprotocolfile=e=>e&&C+e.replace(L,""),t.iscoremodule=e=>b.test(e),t.isfilesync=(e,s)=>{try{s=x.statSync(e)}catch{s=!1}return s&&(s.isFile()||s.isFIFO())},t.gettargetnameandspecifier=e=>(String(e).match(A)||[]).slice(1),t.ispathesmmatch=(e,s)=>new RegExp(e.replace(P,"\\$1").replace(k,".*")).test(s),t.getesemkeyvalglobreplaced=(e,s,n)=>{const r=new RegExp(e.replace(P,"\\$1").replace(k,"(.*)")),i=(n.match(r)||[])[1];return i&&s.replace("*",i)},t.getesmkeyvalmatch=(e,s,n,r=!1)=>(t.ispathesmmatch(e,n)&&(s.includes("*")?t.ispathesmmatch(s,n)?r=n:e.includes("*")&&e!==s&&(r=t.getesemkeyvalglobreplaced(e,s,n)):r=s),r),t.esmparselist=(e,s,n,r=e[0])=>e.length?(j.test(n)?j.test(r):f.test(r))&&typeof s[r]=="string"&&t.getesmkeyvalmatch(r,s[r],n)||t.esmparselist(e.slice(1),s,n):null,t.esmparse=(e,s)=>{let n=!1;return typeof e=="string"?e:(!n&&Array.isArray(e)&&(n=e.reduce((r,i)=>r||t.esmparse(i,s),null)),!n&&I(e)&&(typeof e[s]=="string"&&(n=e[s]),!n&&e[E]&&(n=t.esmparse(e[E],s)),!n&&e[O]&&(n=t.esmparse(e[O],s)),!n&&e[s]&&(n=t.esmparse(e[s],s)),!n&&e[u]&&(n=typeof e[u]=="string"?s===h&&t.esmparse(e[u],s):t.esmparse(e[u],s)),n||(n=t.esmparselist(Object.keys(e),e,s))),n)},t.gettargetindex=(e,s)=>{let n=s&&s.ismodule&&e.module,r=n||s&&s.browser&&e.browser,i=e.exports,o,l;return r&&(typeof r=="string"?l=r:I(r)&&([o]=Object.keys(r).filter(c=>F.test(c)),l=o in r&&r[o])),i&&(l=t.esmparse(i,h)),l},t.getasfilesync=e=>{var s=null;return t.isfilesync(e)?s=e:S.some(n=>t.isfilesync(e+n)&&(s=e+n)),s},t.getasdirsync=(e,s)=>{let n=null,r,i=a.join(e,p),o=t.isfilesync(i)&&d(i);return(r=t.gettargetindex(o,s))?n=t.getasfilesync(a.join(e,r)):(r=o.main)?n=t.getasfilesync(a.join(e,r))||t.getasfilesync(a.join(e,a.join(r,"index"))):S.some(l=>(l=a.join(e,`index${l}`))&&t.isfilesync(l)&&(n=l)),n},t.getasfileordir=(e,s,n)=>{const r=f.test(e)?a.join(s,e):e;return t.getasfilesync(r,n)||t.getasdirsync(r,n)},t.esmparseimport=(e,s,n)=>{const r=n&&n.imports,i=t.esmparse(r,s);return i&&(f.test(i)?a.join(e,i):t(i,e,{isposixpath:!0}))},t.esmparseexport=(e,s,n,r)=>{const i=t.esmparse(r&&r.exports,n?"./"+n:h);return i&&a.join(e,s,i)},t.esmparseexportpkg=(e,s,n,r)=>{const i=a.join(e,s,p),o=t.isfilesync(i),l=o&&d(i);return o&&t.esmparseexport(e,s,n,l,r)},t.esmparseimportpkg=(e,s,n)=>{const r=t.getasfirst_parent_packagejson_path(s),i=a.dirname(r);return r&&t.esmparseimport(i,e,d(r),n)},t.getasnode_module=(e,s,n)=>{const[r,i]=t.gettargetnameandspecifier(e);if(j.test(r))return t.esmparseimportpkg(e,s,n);const o=t.getasnode_module_paths(s).sort((l,c)=>l.length>c.length);return function l(c,m,g=m-1){return m--?t.esmparseexportpkg(a.join(c[g-m]),r,i,n)||t.getasfileordir(a.join(c[g-m],e),null,n)||l(o,m,g):null}(o,o.length)},t.getfirstparent_packagejson=e=>{let{join:s,sep:n}=a,r=e.split(n),i,o;for(let l=r.length;l--;)if(r[l]&&(o=s(n,s.apply(l,r.slice(0,l+1)),i),t.isfilesync(o))){i=d(o);break}return i},t.getasnode_module_paths=e=>e.split(a.sep).slice(1).reduce((s,n,r)=>(n===$&&!T.test(e)||(n=a.resolve(a.join(r?s[0][r-1]:a.sep,n)),s[0].push(n),s[1].push(a.join(n,$))),s),[[],[]])[1].reverse(),t.getasfirst_parent_packagejson_path=e=>{const s=e.split(a.sep).slice(1).reduce((n,r,i)=>(n.push(a.resolve(a.join(i?n[i-1]:a.sep,r))),n),[]).reverse().find(n=>t.isfilesync(a.join(n,p)));return s&&a.join(s,p)},t.getasdirname=e=>a.resolve(a.extname(e)?a.dirname(e):e),t))(); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6952
1