Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@esbuild-kit/esm-loader

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esbuild-kit/esm-loader - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

2

dist/index.js

@@ -1,1 +0,1 @@

import u from"path";import{installSourceMapSupport as g,resolveTsPath as N,transform as w,transformDynamicImport as y}from"@esbuild-kit/core-utils";import _ from"get-tsconfig";import{init as T}from"es-module-lexer";import h from"fs";import{fileURLToPath as $}from"url";const i=/\.([cm]?ts|[tj]sx)$/,l=t=>{const r=u.extname(t);if(r===".mjs"||r===".mts")return"module";if(r===".cjs"||r===".cts")return"commonjs"};T.then(()=>{});const c=new Map;async function x(t){if(c.has(t))return c.get(t);if(!await h.promises.access(t).then(()=>!0,()=>!1)){c.set(t,void 0);return}const s=await h.promises.readFile(t,"utf8");try{const o=JSON.parse(s);return c.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function I(t){let r=new URL("package.json",t);for(;!r.pathname.endsWith("/node_modules/package.json");){const s=$(r),o=await x(s);if(o)return o;const n=r;if(r=new URL("../package.json",r),r.pathname===n.pathname)break}}async function j(t){var r;const s=await I(t);return(r=s==null?void 0:s.type)!=null?r:"commonjs"}var b=Object.defineProperty,F=Object.defineProperties,L=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,v=(t,r,s)=>r in t?b(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,P=(t,r)=>{for(var s in r||(r={}))M.call(r,s)&&v(t,s,r[s]);if(O)for(var s of O(r))A.call(r,s)&&v(t,s,r[s]);return t},k=(t,r)=>F(t,L(r));const E=g(),S=_(),V=S==null?void 0:S.config,C=/\.\w+$/,q=[".js",".json",".ts",".tsx",".jsx"];async function D(t,r,s){let o;for(const n of q)try{return await m(t+n,r,s)}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 U(t,r,s){const o=t.endsWith("/")?"index":`${u.sep}index`;try{return await D(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 m=async function(t,r,s){var o;if(t.startsWith("node:")&&(t=t.slice(5)),t.endsWith("/"))return await U(t,r,s);if(i.test(r.parentURL)){const a=N(t);if(a)try{return await m(a,r,s)}catch(d){if(d.code!=="ERR_MODULE_NOT_FOUND")throw d}}let n;try{n=await s(t,r,s)}catch(a){if(a instanceof Error){if(a.code==="ERR_UNSUPPORTED_DIR_IMPORT")return await U(t,r,s);if(a.code==="ERR_MODULE_NOT_FOUND"&&!C.test(t))return await D(t,r,s)}throw a}if(n.url.endsWith(".json"))return k(P({},n),{format:"json"});let{format:e}=n;return n.url.startsWith("file:")&&(e=(o=l(n.url))!=null?o:e,e||(e=await j(n.url))),k(P({},n),{format:e})},z=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"||i.test(t)){const a=await w(n,t,{format:"esm",tsconfigRaw:V});return a.map&&E.set(t,a.map),{format:"module",source:a.code}}const e=y({code:n});return e&&(o.source=e.code,e.map&&E.set(t,e.map)),o},J=_(),B=J==null?void 0:J.config,R=g(),H=async function(t,r,s){var o;return t.endsWith(".json")?{format:"module"}:t.startsWith("file:")?{format:(o=l(t))!=null?o:await j(t)}:await s(t,r,s)},K=async function(t,r,s){const{url:o}=r;if(process.send&&process.send({type:"dependency",path:o}),o.endsWith(".json")||i.test(o)){const a=await w(t.toString(),o,{format:"esm",tsconfigRaw:B});return a.map&&R.set(o,a.map),{source:a.code}}const n=await s(t,r,s),e=y({code:n.source.toString()});return e&&(n.source=e.code,e.map&&R.set(o,e.map)),n},p=[16,12,0],f=process.version.slice(1).split(".").map(Number),W=(f[0]-p[0]||f[1]-p[1]||f[2]-p[2])<0,Q=W?H:void 0,X=W?K:void 0;export{Q as getFormat,z as load,m as resolve,X as transformSource};
import g from"path";import{installSourceMapSupport as w,resolveTsPath as T,transform as y,transformDynamicImport as _}from"@esbuild-kit/core-utils";import l from"get-tsconfig";import{init as I}from"es-module-lexer";import h from"fs";import{fileURLToPath as $}from"url";const m=/\.([cm]?ts|[tj]sx)$/,j=t=>{const r=g.extname(t);if(r===".mjs"||r===".mts")return"module";if(r===".cjs"||r===".cts")return"commonjs"};I.then(()=>{});const i=new Map;async function b(t){if(i.has(t))return i.get(t);if(!await h.promises.access(t).then(()=>!0,()=>!1)){i.set(t,void 0);return}const s=await h.promises.readFile(t,"utf8");try{const o=JSON.parse(s);return i.set(t,o),o}catch{throw new Error(`Error parsing: ${t}`)}}async function x(t){let r=new URL("package.json",t);for(;!r.pathname.endsWith("/node_modules/package.json");){const s=$(r),o=await b(s);if(o)return o;const n=r;if(r=new URL("../package.json",r),r.pathname===n.pathname)break}}async function O(t){var r;const s=await x(t);return(r=s==null?void 0:s.type)!=null?r:"commonjs"}var F=Object.defineProperty,L=Object.defineProperties,M=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,k=(t,r,s)=>r in t?F(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,P=(t,r)=>{for(var s in r||(r={}))A.call(r,s)&&k(t,s,r[s]);if(v)for(var s of v(r))V.call(r,s)&&k(t,s,r[s]);return t},E=(t,r)=>L(t,M(r));const S=w(),D=l(),C=D==null?void 0:D.config,q=[".js",".json",".ts",".tsx",".jsx"];async function U(t,r,s){let o;for(const n of q)try{return await p(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 J(t,r,s){const o=t.endsWith("/")?"index":`${g.sep}index`;try{return await U(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 p=async function(t,r,s,o){var n;if(t.startsWith("node:")&&(t=t.slice(5)),t.endsWith("/"))return await J(t,r,s);if(m.test(r.parentURL)){const c=T(t);if(c)try{return await p(c,r,s,!0)}catch(u){if(u.code!=="ERR_MODULE_NOT_FOUND")throw u}}let e;try{e=await s(t,r,s)}catch(c){if(c instanceof Error&&!o){if(c.code==="ERR_UNSUPPORTED_DIR_IMPORT")return await J(t,r,s);if(c.code==="ERR_MODULE_NOT_FOUND")return await U(t,r,s)}throw c}if(e.url.endsWith(".json"))return E(P({},e),{format:"json"});let{format:a}=e;return e.url.startsWith("file:")&&(a=(n=j(e.url))!=null?n:a,a||(a=await O(e.url))),E(P({},e),{format:a})},z=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"||m.test(t)){const a=await y(n,t,{format:"esm",tsconfigRaw:C});return a.map&&S.set(t,a.map),{format:"module",source:a.code}}const e=_({code:n});return e&&(o.source=e.code,e.map&&S.set(t,e.map)),o},R=l(),B=R==null?void 0:R.config,W=w(),H=async function(t,r,s){var o;return t.endsWith(".json")?{format:"module"}:t.startsWith("file:")?{format:(o=j(t))!=null?o:await O(t)}:await s(t,r,s)},K=async function(t,r,s){const{url:o}=r;if(process.send&&process.send({type:"dependency",path:o}),o.endsWith(".json")||m.test(o)){const a=await y(t.toString(),o,{format:"esm",tsconfigRaw:B});return a.map&&W.set(o,a.map),{source:a.code}}const n=await s(t,r,s),e=_({code:n.source.toString()});return e&&(n.source=e.code,e.map&&W.set(o,e.map)),n},f=[16,12,0],d=process.version.slice(1).split(".").map(Number),N=(d[0]-f[0]||d[1]-f[1]||d[2]-f[2])<0,Q=N?H:void 0,X=N?K:void 0;export{Q as getFormat,z as load,p as resolve,X as transformSource};
{
"name": "@esbuild-kit/esm-loader",
"version": "2.1.3",
"version": "2.1.4",
"publishConfig": {

@@ -34,3 +34,3 @@ "access": "public"

"dependencies": {
"@esbuild-kit/core-utils": "^1.2.0",
"@esbuild-kit/core-utils": "^1.2.1",
"es-module-lexer": "^0.10.5",

@@ -37,0 +37,0 @@ "get-tsconfig": "^3.0.1"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc