@esbuild-kit/esm-loader
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -1,1 +0,1 @@ | ||
import y from"path";import{fileURLToPath as N,pathToFileURL as R}from"url";import{installSourceMapSupport as I,resolveTsPath as F,transform as _,transformDynamicImport as l}from"@esbuild-kit/core-utils";import{getTsconfig as L,createPathsMatcher as M}from"get-tsconfig";import P from"fs";const m=I(),f=L(),j=f==null?void 0:f.config,O=f&&M(f),g=/\.([cm]?ts|[tj]sx)$/,k=t=>{const r=y.extname(t);if(r===".mjs"||r===".mts")return"module";if(r===".cjs"||r===".cts")return"commonjs"},d=new Map;async function x(t){if(d.has(t))return d.get(t);if(!await P.promises.access(t).then(()=>!0,()=>!1)){d.set(t,void 0);return}const s=await P.promises.readFile(t,"utf8");try{const o=JSON.parse(s);return d.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function $(t){let r=new URL("package.json",t);for(;!r.pathname.endsWith("/node_modules/package.json");){const s=N(r),o=await x(s);if(o)return o;const e=r;if(r=new URL("../package.json",r),r.pathname===e.pathname)break}}async function v(t){var r;const s=await $(t);return(r=s==null?void 0:s.type)!=null?r:"commonjs"}var A=Object.defineProperty,V=Object.defineProperties,C=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,S=(t,r,s)=>r in t?A(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,U=(t,r)=>{for(var s in r||(r={}))q.call(r,s)&&S(t,s,r[s]);if(E)for(var s of E(r))z.call(r,s)&&S(t,s,r[s]);return t},D=(t,r)=>V(t,C(r));const B=[".js",".json",".ts",".tsx",".jsx"];async function J(t,r,s){let o;for(const e of B)try{return await u(t+e,r,s,!0)}catch(n){if(o===void 0){const{message:a}=n;n.message=n.message.replace(`${e}'`,"'"),n.stack=n.stack.replace(a,n.message),o=n}}throw o}async function W(t,r,s){const o=t.endsWith("/")?"index":`${y.sep}index`;try{return await J(t+o,r,s)}catch(e){const{message:n}=e;throw e.message=e.message.replace(`${o}'`,"'"),e.stack=e.stack.replace(n,e.message),e}}const T="file://",H=/^\.{0,2}\//,u=async function(t,r,s,o){var e;if(t.startsWith("node:")&&(t=t.slice(5)),t.endsWith("/"))return await W(t,r,s);const n=t.startsWith(T)||H.test(t);if(O&&!n){const c=O(t);for(const p of c)try{return await u(R(p).toString(),r,s)}catch{}}if(g.test(r.parentURL)){const c=F(t);if(c)try{return await u(c,r,s,!0)}catch(p){if(p.code!=="ERR_MODULE_NOT_FOUND")throw p}}let a;try{a=await s(t,r,s)}catch(c){if(c instanceof Error&&!o){if(c.code==="ERR_UNSUPPORTED_DIR_IMPORT")return await W(t,r,s);if(c.code==="ERR_MODULE_NOT_FOUND")return await J(t,r,s)}throw c}if(a.url.endsWith(".json"))return D(U({},a),{format:"json"});let{format:i}=a;return a.url.startsWith(T)&&(i=(e=k(a.url))!=null?e:i,i||(i=await v(a.url))),D(U({},a),{format:i})},K=async function(t,r,s){process.send&&process.send({type:"dependency",path:t}),t.endsWith(".json")&&(r.importAssertions||(r.importAssertions={}),r.importAssertions.type="json");const o=await s(t,r,s);if(!o.source)return o;const e=o.source.toString();if(o.format==="json"||g.test(t)){const a=await _(e,t,{format:"esm",tsconfigRaw:j});return a.map&&m.set(t,a.map),{format:"module",source:a.code}}const n=l({code:e});return n&&(o.source=n.code,n.map&&m.set(t,n.map)),o},Q=async function(t,r,s){var o;return t.endsWith(".json")?{format:"module"}:t.startsWith("file:")?{format:(o=k(t))!=null?o:await v(t)}:await s(t,r,s)},X=async function(t,r,s){const{url:o}=r;if(process.send&&process.send({type:"dependency",path:o}),o.endsWith(".json")||g.test(o)){const a=await _(t.toString(),o,{format:"esm",tsconfigRaw:j});return a.map&&m.set(o,a.map),{source:a.code}}const e=await s(t,r,s),n=l({code:e.source.toString()});return n&&(e.source=n.code,n.map&&m.set(o,n.map)),e},h=[16,12,0],w=process.version.slice(1).split(".").map(Number),b=(w[0]-h[0]||w[1]-h[1]||w[2]-h[2])<0,Y=b?Q:void 0,Z=b?X:void 0;export{Y as getFormat,K as load,u as resolve,Z as transformSource}; | ||
import l from"path";import{fileURLToPath as R,pathToFileURL as I}from"url";import{installSourceMapSupport as M,resolveTsPath as F,transform as _,applySourceMap as m,transformDynamicImport as P}from"@esbuild-kit/core-utils";import{getTsconfig as L,createPathsMatcher as x}from"get-tsconfig";import j from"fs";const f=M(),u=L(),O=u==null?void 0:u.config,k=u&&x(u),h=/\.([cm]?ts|[tj]sx)$/,v=t=>{const r=l.extname(t);if(r===".mjs"||r===".mts")return"module";if(r===".cjs"||r===".cts")return"commonjs"},d=new Map;async function $(t){if(d.has(t))return d.get(t);if(!await j.promises.access(t).then(()=>!0,()=>!1)){d.set(t,void 0);return}const s=await j.promises.readFile(t,"utf8");try{const o=JSON.parse(s);return d.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function A(t){let r=new URL("package.json",t);for(;!r.pathname.endsWith("/node_modules/package.json");){const s=R(r),o=await $(s);if(o)return o;const n=r;if(r=new URL("../package.json",r),r.pathname===n.pathname)break}}async function S(t){var r;const s=await A(t);return(r=s==null?void 0:s.type)!=null?r:"commonjs"}var V=Object.defineProperty,C=Object.defineProperties,q=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,U=(t,r,s)=>r in t?V(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,D=(t,r)=>{for(var s in r||(r={}))z.call(r,s)&&U(t,s,r[s]);if(E)for(var s of E(r))B.call(r,s)&&U(t,s,r[s]);return t},J=(t,r)=>C(t,q(r));const H=[".js",".json",".ts",".tsx",".jsx"];async function W(t,r,s){let o;for(const n of H)try{return await g(t+n,r,s,!0)}catch(e){if(o===void 0){const{message:a}=e;e.message=e.message.replace(`${n}'`,"'"),e.stack=e.stack.replace(a,e.message),o=e}}throw o}async function T(t,r,s){const o=t.endsWith("/")?"index":`${l.sep}index`;try{return await W(t+o,r,s)}catch(n){const{message:e}=n;throw n.message=n.message.replace(`${o}'`,"'"),n.stack=n.stack.replace(e,n.message),n}}const b="file://",K=/^\.{0,2}\//,g=async function(t,r,s,o){var n;if(t.startsWith("node:")&&(t=t.slice(5)),t.endsWith("/"))return await T(t,r,s);const e=t.startsWith(b)||K.test(t);if(k&&!e){const c=k(t);for(const p of c)try{return await g(I(p).toString(),r,s)}catch{}}if(h.test(r.parentURL)){const c=F(t);if(c)try{return await g(c,r,s,!0)}catch(p){if(p.code!=="ERR_MODULE_NOT_FOUND")throw p}}let a;try{a=await s(t,r,s)}catch(c){if(c instanceof Error&&!o){if(c.code==="ERR_UNSUPPORTED_DIR_IMPORT")return await T(t,r,s);if(c.code==="ERR_MODULE_NOT_FOUND")return await W(t,r,s)}throw c}if(a.url.endsWith(".json"))return J(D({},a),{format:"json"});let{format:i}=a;return a.url.startsWith(b)&&(i=(n=v(a.url))!=null?n:i,i||(i=await S(a.url))),J(D({},a),{format:i})},Q=async function(t,r,s){process.send&&process.send({type:"dependency",path:t}),t.endsWith(".json")&&(r.importAssertions||(r.importAssertions={}),r.importAssertions.type="json");const o=await s(t,r,s);if(!o.source)return o;const n=o.source.toString();if(o.format==="json"||h.test(t)){const a=await _(n,t,{tsconfigRaw:O});return{format:"module",source:m(a,t,f)}}const e=P(n);return e&&(o.source=m(e,t,f)),o},X=async function(t,r,s){var o;return t.endsWith(".json")?{format:"module"}:t.startsWith("file:")?{format:(o=v(t))!=null?o:await S(t)}:await s(t,r,s)},Y=async function(t,r,s){const{url:o}=r;if(process.send&&process.send({type:"dependency",path:o}),o.endsWith(".json")||h.test(o)){const a=await _(t.toString(),o,{tsconfigRaw:O});return{source:m(a,o,f)}}const n=await s(t,r,s),e=P(n.source.toString());return e&&(n.source=m(e,o,f)),n},w=[16,12,0],y=process.version.slice(1).split(".").map(Number),N=(y[0]-w[0]||y[1]-w[1]||y[2]-w[2])<0,Z=N?X:void 0,G=N?Y:void 0;export{Z as getFormat,Q as load,g as resolve,G as transformSource}; |
{ | ||
"name": "@esbuild-kit/esm-loader", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"publishConfig": { | ||
@@ -34,3 +34,3 @@ "access": "public" | ||
"dependencies": { | ||
"@esbuild-kit/core-utils": "^1.3.3", | ||
"@esbuild-kit/core-utils": "^2.0.0", | ||
"get-tsconfig": "^4.0.0" | ||
@@ -50,3 +50,3 @@ }, | ||
"type-fest": "^2.12.2", | ||
"typescript": "^4.6.4" | ||
"typescript": "^4.7.4" | ||
}, | ||
@@ -53,0 +53,0 @@ "eslintConfig": { |
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
8695
+ Added@esbuild-kit/core-utils@2.3.2(transitive)
+ Added@esbuild/android-arm@0.15.18(transitive)
+ Added@esbuild/linux-loong64@0.15.18(transitive)
+ Addedesbuild@0.15.18(transitive)
+ Addedesbuild-android-64@0.15.18(transitive)
+ Addedesbuild-android-arm64@0.15.18(transitive)
+ Addedesbuild-darwin-64@0.15.18(transitive)
+ Addedesbuild-darwin-arm64@0.15.18(transitive)
+ Addedesbuild-freebsd-64@0.15.18(transitive)
+ Addedesbuild-freebsd-arm64@0.15.18(transitive)
+ Addedesbuild-linux-32@0.15.18(transitive)
+ Addedesbuild-linux-64@0.15.18(transitive)
+ Addedesbuild-linux-arm@0.15.18(transitive)
+ Addedesbuild-linux-arm64@0.15.18(transitive)
+ Addedesbuild-linux-mips64le@0.15.18(transitive)
+ Addedesbuild-linux-ppc64le@0.15.18(transitive)
+ Addedesbuild-linux-riscv64@0.15.18(transitive)
+ Addedesbuild-linux-s390x@0.15.18(transitive)
+ Addedesbuild-netbsd-64@0.15.18(transitive)
+ Addedesbuild-openbsd-64@0.15.18(transitive)
+ Addedesbuild-sunos-64@0.15.18(transitive)
+ Addedesbuild-windows-32@0.15.18(transitive)
+ Addedesbuild-windows-64@0.15.18(transitive)
+ Addedesbuild-windows-arm64@0.15.18(transitive)
- Removed@esbuild-kit/core-utils@1.4.0(transitive)
- Removed@esbuild/linux-loong64@0.14.54(transitive)
- Removedesbuild@0.14.54(transitive)
- Removedesbuild-android-64@0.14.54(transitive)
- Removedesbuild-android-arm64@0.14.54(transitive)
- Removedesbuild-darwin-64@0.14.54(transitive)
- Removedesbuild-darwin-arm64@0.14.54(transitive)
- Removedesbuild-freebsd-64@0.14.54(transitive)
- Removedesbuild-freebsd-arm64@0.14.54(transitive)
- Removedesbuild-linux-32@0.14.54(transitive)
- Removedesbuild-linux-64@0.14.54(transitive)
- Removedesbuild-linux-arm@0.14.54(transitive)
- Removedesbuild-linux-arm64@0.14.54(transitive)
- Removedesbuild-linux-mips64le@0.14.54(transitive)
- Removedesbuild-linux-ppc64le@0.14.54(transitive)
- Removedesbuild-linux-riscv64@0.14.54(transitive)
- Removedesbuild-linux-s390x@0.14.54(transitive)
- Removedesbuild-netbsd-64@0.14.54(transitive)
- Removedesbuild-openbsd-64@0.14.54(transitive)
- Removedesbuild-sunos-64@0.14.54(transitive)
- Removedesbuild-windows-32@0.14.54(transitive)
- Removedesbuild-windows-64@0.14.54(transitive)
- Removedesbuild-windows-arm64@0.14.54(transitive)