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 1.1.1 to 1.1.2

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