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.1 to 2.1.2

2

dist/index.js

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

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

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

"dependencies": {
"@esbuild-kit/core-utils": "^1.1.2",
"@esbuild-kit/core-utils": "^1.2.0",
"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