@esbuild-kit/esm-loader
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -1,1 +0,1 @@ | ||
import y from"path";import{fileURLToPath as F,pathToFileURL as R}from"url";import{installSourceMapSupport as L,resolveTsPath as M,transform as P,applySourceMap as f,transformDynamicImport as O}from"@esbuild-kit/core-utils";import{parseTsconfig as A,getTsconfig as x,createPathsMatcher as C}from"get-tsconfig";import j from"fs";const u=L(),d=process.env.ESBK_TSCONFIG_PATH?{path:process.env.ESBK_TSCONFIG_PATH,config:A(process.env.ESBK_TSCONFIG_PATH)}:x(),v=d==null?void 0:d.config,S=d&&C(d),_=/\.([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"},g=new Map;async function $(t){if(g.has(t))return g.get(t);if(!await j.promises.access(t).then(()=>!0,()=>!1)){g.set(t,void 0);return}const s=await j.promises.readFile(t,"utf8");try{const o=JSON.parse(s);return g.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function B(t){let r=new URL("package.json",t);for(;!r.pathname.endsWith("/node_modules/package.json");){const s=F(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 E(t){var r;const s=await B(t);return(r=s==null?void 0:s.type)!=null?r:"commonjs"}var H=Object.defineProperty,K=Object.defineProperties,V=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,U=(t,r,s)=>r in t?H(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,D=(t,r)=>{for(var s in r||(r={}))G.call(r,s)&&U(t,s,r[s]);if(T)for(var s of T(r))q.call(r,s)&&U(t,s,r[s]);return t},N=(t,r)=>K(t,V(r));const z=[".js",".json",".ts",".tsx",".jsx"];async function I(t,r,s){let o;for(const n of z)try{return await h(t+n,r,s,!0)}catch(e){if(o===void 0){const{message:i}=e;e.message=e.message.replace(`${n}'`,"'"),e.stack=e.stack.replace(i,e.message),o=e}}throw o}async function J(t,r,s){const o=t.endsWith("/")?"index":"/index";try{return await I(t+o,r,s)}catch(n){const{message:e}=n;throw n.message=n.message.replace(`${o.replace("/",y.sep)}'`,"'"),n.stack=n.stack.replace(e,n.message),n}}const W="file://",Q=/^\.{0,2}\//,h=async function(t,r,s,o){var n,e;if(t.startsWith("node:")&&(t=t.slice(5)),t.endsWith("/"))return await J(t,r,s);const i=t.startsWith(W)||Q.test(t);if(S&&!i&&!((n=r.parentURL)!=null&&n.includes("/node_modules/"))){const a=S(t);for(const m of a)try{return await h(R(m).toString(),r,s)}catch{}}if(_.test(r.parentURL)){const a=M(t);if(a)try{return await h(a,r,s,!0)}catch(m){if(m.code!=="ERR_MODULE_NOT_FOUND")throw m}}let c;try{c=await s(t,r,s)}catch(a){if(a instanceof Error&&!o){if(a.code==="ERR_UNSUPPORTED_DIR_IMPORT")return await J(t,r,s);if(a.code==="ERR_MODULE_NOT_FOUND")return await I(t,r,s)}throw a}if(c.url.endsWith(".json"))return N(D({},c),{format:"json"});let{format:p}=c;return c.url.startsWith(W)&&(p=(e=k(c.url))!=null?e:p,p||(p=await E(c.url))),N(D({},c),{format:p})},X=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"||_.test(t)){const i=await P(n,t,{tsconfigRaw:v});return{format:"module",source:f(i,t,u)}}const e=O(n);return e&&(o.source=f(e,t,u)),o},Y=async function(t,r,s){var o;return t.endsWith(".json")?{format:"module"}:t.startsWith("file:")?{format:(o=k(t))!=null?o:await E(t)}:await s(t,r,s)},Z=async function(t,r,s){const{url:o}=r;if(process.send&&process.send({type:"dependency",path:o}),o.endsWith(".json")||_.test(o)){const i=await P(t.toString(),o,{tsconfigRaw:v});return{source:f(i,o,u)}}const n=await s(t,r,s),e=O(n.source.toString());return e&&(n.source=f(e,o,u)),n},l=[16,12,0],w=process.version.slice(1).split(".").map(Number),b=(w[0]-l[0]||w[1]-l[1]||w[2]-l[2])<0,tt=b?Y:void 0,rt=b?Z:void 0;export{tt as getFormat,X as load,h as resolve,rt as transformSource}; | ||
import l from"path";import{fileURLToPath as W,pathToFileURL as v}from"url";import{installSourceMapSupport as F,compareNodeVersion as w,resolveTsPath as R,transform as _,applySourceMap as f,transformDynamicImport as k}from"@esbuild-kit/core-utils";import{parseTsconfig as D,getTsconfig as I,createPathsMatcher as L}from"get-tsconfig";import S from"fs";const u=F(),d=process.env.ESBK_TSCONFIG_PATH?{path:process.env.ESBK_TSCONFIG_PATH,config:D(process.env.ESBK_TSCONFIG_PATH)}:I(),j=d==null?void 0:d.config,P=d&&L(d),y=/\.([cm]?ts|[tj]sx)$/,T=t=>{const s=l.extname(t);if(s===".mjs"||s===".mts")return"module";if(s===".cjs"||s===".cts")return"commonjs"},g=new Map;async function M(t){if(g.has(t))return g.get(t);if(!await S.promises.access(t).then(()=>!0,()=>!1)){g.set(t,void 0);return}const o=await S.promises.readFile(t,"utf8");try{const n=JSON.parse(o);return g.set(t,n),n}catch{throw new Error(`Error parsing: ${t}`)}}async function x(t){let s=new URL("package.json",t);for(;!s.pathname.endsWith("/node_modules/package.json");){const o=W(s),n=await M(o);if(n)return n;const r=s;if(s=new URL("../package.json",s),s.pathname===r.pathname)break}}async function E(t){var s;const o=await x(t);return(s=o==null?void 0:o.type)!=null?s:"commonjs"}const A=[".js",".json",".ts",".tsx",".jsx"];async function U(t,s,o){let n;for(const r of A)try{return await h(t+r,s,o,!0)}catch(a){if(n===void 0){const{message:i}=a;a.message=a.message.replace(`${r}'`,"'"),a.stack=a.stack.replace(i,a.message),n=a}}throw n}async function O(t,s,o){const n=t.endsWith("/")?"index":"/index";try{return await U(t+n,s,o)}catch(r){const{message:a}=r;throw r.message=r.message.replace(`${n.replace("/",l.sep)}'`,"'"),r.stack=r.stack.replace(a,r.message),r}}const N="file://",b=/^\.{0,2}\//,C=w([14,13,1])>=0||w([12,20,0])>=0,h=async function(t,s,o,n){var r,a;if(!C&&t.startsWith("node:")&&(t=t.slice(5)),t.endsWith("/"))return await O(t,s,o);const i=t.startsWith(N)||b.test(t);if(P&&!i&&!((r=s.parentURL)!=null&&r.includes("/node_modules/"))){const e=P(t);for(const p of e)try{return await h(v(p).toString(),s,o)}catch{}}if(y.test(s.parentURL)){const e=R(t);if(e)try{return await h(e,s,o,!0)}catch(p){if(p.code!=="ERR_MODULE_NOT_FOUND")throw p}}let c;try{c=await o(t,s,o)}catch(e){if(e instanceof Error&&!n){if(e.code==="ERR_UNSUPPORTED_DIR_IMPORT")return await O(t,s,o);if(e.code==="ERR_MODULE_NOT_FOUND")return await U(t,s,o)}throw e}if(c.url.endsWith(".json"))return{...c,format:"json"};let{format:m}=c;return c.url.startsWith(N)&&(m=(a=T(c.url))!=null?a:m,m||(m=await E(c.url))),{...c,format:m}},$=async function(t,s,o){process.send&&process.send({type:"dependency",path:t}),t.endsWith(".json")&&(s.importAssertions||(s.importAssertions={}),s.importAssertions.type="json");const n=await o(t,s,o);if(!n.source)return n;const r=n.source.toString();if(n.format==="json"||y.test(t)){const i=await _(r,t,{tsconfigRaw:j});return{format:"module",source:f(i,t,u)}}const a=k(r);return a&&(n.source=f(a,t,u)),n},B=async function(t,s,o){var n;return t.endsWith(".json")?{format:"module"}:t.startsWith("file:")?{format:(n=T(t))!=null?n:await E(t)}:await o(t,s,o)},H=async function(t,s,o){const{url:n}=s;if(process.send&&process.send({type:"dependency",path:n}),n.endsWith(".json")||y.test(n)){const i=await _(t.toString(),n,{tsconfigRaw:j});return{source:f(i,n,u)}}const r=await o(t,s,o),a=k(r.source.toString());return a&&(r.source=f(a,n,u)),r},J=w([16,12,0])<0,K=J?B:void 0,G=J?H:void 0;export{K as getFormat,$ as load,h as resolve,G as transformSource}; |
{ | ||
"name": "@esbuild-kit/esm-loader", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"publishConfig": { | ||
@@ -34,17 +34,17 @@ "access": "public" | ||
"dependencies": { | ||
"@esbuild-kit/core-utils": "^2.0.0", | ||
"@esbuild-kit/core-utils": "^2.1.0", | ||
"get-tsconfig": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"@pvtnbr/eslint-config": "^0.22.0", | ||
"@types/node": "^17.0.33", | ||
"@types/semver": "^7.3.9", | ||
"eslint": "^8.15.0", | ||
"@pvtnbr/eslint-config": "^0.26.2", | ||
"@types/node": "^18.0.0", | ||
"@types/semver": "^7.3.10", | ||
"eslint": "^8.18.0", | ||
"execa": "^6.1.0", | ||
"get-node": "^13.0.1", | ||
"manten": "^0.1.0", | ||
"pkgroll": "^1.3.0", | ||
"get-node": "^13.1.0", | ||
"manten": "^0.2.1", | ||
"pkgroll": "^1.3.1", | ||
"semver": "^7.3.7", | ||
"source-map-support": "^0.5.21", | ||
"type-fest": "^2.12.2", | ||
"type-fest": "^2.15.1", | ||
"typescript": "^4.7.4" | ||
@@ -56,17 +56,4 @@ }, | ||
"tests/fixtures" | ||
], | ||
"rules": { | ||
"import/no-unresolved": "off", | ||
"@typescript-eslint/no-shadow": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"test", | ||
"describe", | ||
"runTestSuite" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
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
9635
14