Socket
Socket
Sign inDemoInstall

@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 1.1.0 to 1.1.1

2

dist/index.js

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

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

@@ -5,0 +5,0 @@ "access": "public"

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