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

tsc-esm-fix

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsc-esm-fix - npm Package Compare versions

Comparing version 2.20.26 to 2.20.27

8

buildstamp.json
{
"date": "2024-02-20T19:32:31.091Z",
"date": "2024-04-23T20:26:14.332Z",
"git_commit_branch": "master",
"git_commit_id": "a024fb92e424c96d854193d257d0fa09c95cfebc",
"git_commit_id": "8c3fd043ba621f711f9f38b596041cbea27e9f67",
"git_repo_url": "https://github.com/antongolub/tsc-esm-fix",
"git_repo_name": "antongolub/tsc-esm-fix",
"ci_run_id": "7978977564",
"ci_run_url": "https://github.com/antongolub/tsc-esm-fix/actions/runs/7978977564"
"ci_run_id": "8806783006",
"ci_run_url": "https://github.com/antongolub/tsc-esm-fix/actions/runs/8806783006"
}

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

## [2.20.27](https://github.com/antongolub/tsc-esm-fix/compare/v2.20.26...v2.20.27) (2024-04-23)
### Fixes & improvements
* fix: handle malformed exports map ([f845eee](https://github.com/antongolub/tsc-esm-fix/commit/f845eee7056c630911a6a029fb5c4313f0ed4df0))
## [2.20.26](https://github.com/antongolub/tsc-esm-fix/compare/v2.20.25...v2.20.26) (2024-02-20)

@@ -2,0 +7,0 @@

{
"name": "tsc-esm-fix",
"version": "2.20.26",
"version": "2.20.27",
"bin": {

@@ -45,3 +45,3 @@ "tsc-esm-fix": "./target/es6/cli.mjs"

"dependencies": {
"depseek": "^0.4.0",
"depseek": "^0.4.1",
"fs-extra": "^11.2.0",

@@ -57,4 +57,4 @@ "globby": "^13.2.2",

"@types/jest": "^29.5.12",
"@types/node": "^20.11.17",
"@types/semver": "^7.5.7",
"@types/node": "^20.12.7",
"@types/semver": "^7.5.8",
"cpy-cli": "^5.0.0",

@@ -75,4 +75,4 @@ "cross-env": "^7.0.3",

"ts-jest": "^29.1.2",
"typedoc": "^0.25.8",
"typescript": "^5.3.3"
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
},

@@ -79,0 +79,0 @@ "repository": {

@@ -8,1 +8,5 @@ export declare const getTsconfigTargets: (tsconfig: string | string[], cwd: string) => string[];

}>;
type Entry = string | string[] | Record<string, string | string[] | Record<string, string | string[]>>;
export declare const parseConditional: (e: Entry) => string[];
export declare const getExportsEntries: (exports: string | Entry) => [string, string[]][];
export {};

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("node:path"),require("fs-extra"),require("json5"),require("globby"),require("node:fs"),require("depseek")):"function"==typeof define&&define.amd?define(["exports","node:path","fs-extra","json5","globby","node:fs","depseek"],n):n((e||self).tscEsmFix={},e.path,e.fsExtra,e.json5,e.globby,e.node_fs,e.depseek)}(this,function(e,n,t,r,o,u,i){function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/s(n),l=/*#__PURE__*/s(t),a=/*#__PURE__*/s(r);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f.apply(this,arguments)}var d=function(e){var n=e.contents;return f({},e,{contents:0===n.trim().length?"\nexport {}\nexport default undefined\n":n})},m=function(e){return f({},e,{contents:e.contents.replace(/__dirname/g,"`${process.platform === 'win32' ? '' : '/'}${/file:\\/{2,3}(.+)\\/[^/]/.exec(import.meta.url)"+(e.isSource?"!":"")+"[1]}`")})},p=function(e){return f({},e,{contents:e.contents.replace(/__filename/g,"`${process.platform === 'win32' ? '' : '/'}${/file:\\/{2,3}(.+)/.exec(import.meta.url)"+(e.isSource?"!":"")+"[1]}`")})},g=function(e){return l.default.readFileSync(e,{encoding:"utf8"})},v=function(e,n){return l.default.outputFileSync(e,n,{encoding:"utf8"})},b=function(e){return a.default.parse(g(e))},h=function(e){return e?Array.isArray(e)?e:[e]:[]},y=l.default.unlinkSync,x=function(e){return e.replace(/\\/g,"/")},j=function e(t){var r=b(t);if(r.extends){var o=e(n.resolve(n.dirname(t),r.extends));return f({},o,r,{compilerOptions:f({},o.compilerOptions,r.compilerOptions)})}return r},P=function(e){var n=e.filename,t=e.filenames,r=e.options.cwd,o=e.ignore;return f({},e,{contents:i.patchRefs(e.contents,function(e){var u=e.endsWith("/")?e.slice(0,-1):e;return!u.includes("/")&&"."!==u&&".."!==u||o.includes(u)?e:M(n,u,t,r)})})},M=function(e,t,r,o){var u=n.dirname(e),i=n.resolve(o,"node_modules"),s=/^\..+\.[^./\\]+$/.test(t)?[t,t.replace(/\.[^./\\]+$/,"")]:[t],c=[".js",".cjs",".mjs"].reduce(function(e,n){return s.forEach(function(t){return e.push(""+t+n,t+"/index"+n)}),e},[]);return c.find(function(e){return r.includes(x(n.resolve(u,e)))})||c.find(function(e){return r.includes(x(n.resolve(i,e)))})||t},_=function(e){var t=e.contents,r=e.originName,o=e.filename;return f({},e,{contents:r===o?t:t.replace("//# sourceMappingURL="+n.basename(r)+".map","//# sourceMappingURL="+n.basename(o)+".map")})},w=function(e){var n=e.contents;return f({},e,{contents:n.includes("export default")?n:n+"\nexport default undefined\n"})},O=function(e){var n=e.options,t=e;return n.ext&&(t=P(t)),n.dirnameVar&&(t=m(t)),n.filenameVar&&(t=p(t)),n.fillBlank&&(t=d(t)),n.forceDefaultExport&&(t=w(t)),n.sourceMap&&(t=_(t)),t},S=function(e,t){return h(e).reduce(function(e,r){var o,u,i=j(n.resolve(t,r)),s=null==i||null==(o=i.compilerOptions)?void 0:o.outDir,c=null==i||null==(u=i.compilerOptions)||null==u.module.toLowerCase?void 0:u.module.toLowerCase();return s&&c.startsWith("es")?e.push(s):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),e},[])},k=function(e,t){if(!t)return e;var r=t;return r.includes("*")&&(r=r.slice(0,r.indexOf("*"))).includes("/")&&(r=r.slice(0,r.lastIndexOf("/"))),n.join(e,r)},F={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},D=function(e,n){return e.map(function(e){return e.endsWith(".d.ts")?e:e.replace(/\.[^./\\]+$/,n)})};e.DEFAULT_FIX_OPTIONS=F,e.fix=function(e){try{var t=function(e){return f({},F,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:F.debug})}(e);return Promise.resolve(function(e){try{var t=e.cwd,r=e.target,u=e.src,i=e.tsconfig,s=e.out,l=e.ext,a=e.debug,f=c.default.resolve(t,void 0===s?t:s),d=h(u),m=[].concat(h(r),S(i,t));a("debug:cwd",t),a("debug:outdir",f),a("debug:sources",d),a("debug:targets",m);var p=d.length>0;return Promise.resolve(function(e,n,t){return o.globby(function(e,n){return e.length>0?e.map(function(e){return e.includes("*")?e:e+"/**/*.{ts,tsx}"}):n.map(function(e){return e.includes("*")?e:e+"/**/*.{js,d.ts}"})}(e,n),{cwd:t,onlyFiles:!0,absolute:!0})}(d,m,t)).then(function(e){return Promise.resolve(function(e){try{return Promise.resolve(function(e){return o.globby(["node_modules/*/package.json","node_modules/@*/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(function(e){try{return Promise.resolve(Promise.all(e.map(function(e){try{return Promise.resolve(b(e)).then(function(t){var r=t.name,u=t.exports;if(!u)return{name:r};var i=n.dirname(e),s=function(e){var n=Object.entries(e),t=function e(n){return"string"==typeof n?[n]:Object.values(n).map(e).flat(2)};return"string"!=typeof e&&Object.keys(e).some(function(e){return e.startsWith(".")})?n.map(function(e){return[e[0],t(e[1])]}):[[".",t(e)]]}(u);return Promise.resolve(Promise.all(s.map(function(e){var t=e[0];return Promise.all(e[1].map(function(e){try{return Promise.resolve(o.globby(e,{cwd:i,onlyFiles:!0,absolute:!1})).then(function(o){return o.map(function(o){return n.join(o).replace(k(".",e),k(r,t))})})}catch(e){return Promise.reject(e)}}))}))).then(function(e){return{name:r,files:e.flat(2)}})})}catch(e){return Promise.reject(e)}}))).then(function(e){return e.reduce(function(e,n){var t,r=n.name,o=n.files;return r&&e.names.push(r),o&&(t=e.files).push.apply(t,o),e},{names:[],files:[]})})}catch(e){return Promise.reject(e)}})}(e)).then(function(n){var t=n.names,r=n.files;return Promise.resolve(o.globby(["!node_modules/.cache","!node_modules/.bin","!node_modules/**/node_modules"].concat(t.map(function(e){return"!node_modules/"+e}),["node_modules/**/*.(m|c)?js"]),{cwd:e,onlyFiles:!0,absolute:!0})).then(function(e){return{cjsModules:e,esmModules:r,allPackages:t}})})}catch(e){return Promise.reject(e)}}(t)).then(function(n){var t=n.cjsModules,r=n.esmModules,o=n.allPackages;a("debug:external-cjs-modules",t),a("debug:external-esm-modules",r);var u=[].concat(r,o),i="string"==typeof l?D(e,l):e,s=[].concat(t,i),c=[].concat(t,D(e,".js"));return a("debug:local-modules",i),{outDir:f,isSource:p,ignore:u,allJsModules:c,allModules:s,_localModules:i,localModules:e}})})}catch(e){return Promise.reject(e)}}(t)).then(function(e){return Promise.resolve(function(e,n){try{var t=n.cwd,r=n.unlink,o=n.sourceMap,i=e.outDir,s=e.isSource,l=e.ignore,a=e.allJsModules,f=e.allModules,d=e.localModules;return Promise.resolve(Promise.all(e._localModules.map(function(e,m){try{var p=e.endsWith(".d.ts")?a:f,h=d[m],j=(s?h:e).replace(x(t),x(i)),P=g(h),M=O({options:n,contents:P,isSource:s,ignore:l,filename:e,filenames:p,originName:h,nextName:j});return v(j,M.contents),!s&&r&&t===i&&j!==h&&y(h),o&&function(e,n,t){if(void 0===t&&(t=!1),e!==n){var r=e+".map";if(u.existsSync(r)){var o=n+".map",i=b(r);i.file=c.default.basename(n),v(o,JSON.stringify(i)),t&&y(r)}}}(h,j,r&&t===i),Promise.resolve()}catch(e){return Promise.reject(e)}}))).then(function(){})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})})}catch(e){return Promise.reject(e)}},e.fixBlankFiles=function(e){return d({contents:e}).contents},e.fixContents=function(e,n,t,r,o,u,i){return void 0===o&&(o=n),void 0===u&&(u=!1),void 0===i&&(i=[]),O({contents:e,filename:n,filenames:t,options:r,originName:o,isSource:u,ignore:i}).contents},e.fixDefaultExport=function(e){return w({contents:e}).contents},e.fixDirnameVar=function(e,n){return m({contents:e,isSource:n}).contents},e.fixFilenameExtensions=D,e.fixFilenameVar=function(e,n){return p({contents:e,isSource:n}).contents},e.fixModuleReferences=function(e,n,t,r,o){return P({contents:e,filename:n,filenames:t,options:{cwd:r},ignore:o}).contents},e.fixSourceMapRef=function(e,n,t){return _({contents:e,originName:n,filename:t}).contents}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("node:path"),require("fs-extra"),require("json5"),require("globby"),require("node:fs"),require("depseek")):"function"==typeof define&&define.amd?define(["exports","node:path","fs-extra","json5","globby","node:fs","depseek"],n):n((e||self).tscEsmFix={},e.path,e.fsExtra,e.json5,e.globby,e.node_fs,e.depseek)}(this,function(e,n,t,r,o,u,i){function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/s(n),l=/*#__PURE__*/s(t),a=/*#__PURE__*/s(r);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f.apply(this,arguments)}var d=function(e){var n=e.contents;return f({},e,{contents:0===n.trim().length?"\nexport {}\nexport default undefined\n":n})},m=function(e){return f({},e,{contents:e.contents.replace(/__dirname/g,"`${process.platform === 'win32' ? '' : '/'}${/file:\\/{2,3}(.+)\\/[^/]/.exec(import.meta.url)"+(e.isSource?"!":"")+"[1]}`")})},p=function(e){return f({},e,{contents:e.contents.replace(/__filename/g,"`${process.platform === 'win32' ? '' : '/'}${/file:\\/{2,3}(.+)/.exec(import.meta.url)"+(e.isSource?"!":"")+"[1]}`")})},g=function(e){return l.default.readFileSync(e,{encoding:"utf8"})},v=function(e,n){return l.default.outputFileSync(e,n,{encoding:"utf8"})},b=function(e){return a.default.parse(g(e))},h=function(e){return e?Array.isArray(e)?e:[e]:[]},y=l.default.unlinkSync,x=function(e){return e.replace(/\\/g,"/")},j=function e(t){var r=b(t);if(r.extends){var o=e(n.resolve(n.dirname(t),r.extends));return f({},o,r,{compilerOptions:f({},o.compilerOptions,r.compilerOptions)})}return r},P=function(e){var n=e.filename,t=e.filenames,r=e.options.cwd,o=e.ignore;return f({},e,{contents:i.patchRefs(e.contents,function(e){var u=e.endsWith("/")?e.slice(0,-1):e;return!u.includes("/")&&"."!==u&&".."!==u||o.includes(u)?e:M(n,u,t,r)})})},M=function(e,t,r,o){var u=n.dirname(e),i=n.resolve(o,"node_modules"),s=/^\..+\.[^./\\]+$/.test(t)?[t,t.replace(/\.[^./\\]+$/,"")]:[t],c=[".js",".cjs",".mjs"].reduce(function(e,n){return s.forEach(function(t){return e.push(""+t+n,t+"/index"+n)}),e},[]);return c.find(function(e){return r.includes(x(n.resolve(u,e)))})||c.find(function(e){return r.includes(x(n.resolve(i,e)))})||t},_=function(e){var t=e.contents,r=e.originName,o=e.filename;return f({},e,{contents:r===o?t:t.replace("//# sourceMappingURL="+n.basename(r)+".map","//# sourceMappingURL="+n.basename(o)+".map")})},w=function(e){var n=e.contents;return f({},e,{contents:n.includes("export default")?n:n+"\nexport default undefined\n"})},O=function(e){var n=e.options,t=e;return n.ext&&(t=P(t)),n.dirnameVar&&(t=m(t)),n.filenameVar&&(t=p(t)),n.fillBlank&&(t=d(t)),n.forceDefaultExport&&(t=w(t)),n.sourceMap&&(t=_(t)),t},S=function(e,t){return h(e).reduce(function(e,r){var o,u,i=j(n.resolve(t,r)),s=null==i||null==(o=i.compilerOptions)?void 0:o.outDir,c=null==i||null==(u=i.compilerOptions)||null==u.module.toLowerCase?void 0:u.module.toLowerCase();return s&&c.startsWith("es")?e.push(s):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),e},[])},k=function e(n){return n?"string"==typeof n?[n]:Object.values(n).map(e).flat(2):[]},F=function(e,t){if(!t)return e;var r=t;return r.includes("*")&&(r=r.slice(0,r.indexOf("*"))).includes("/")&&(r=r.slice(0,r.lastIndexOf("/"))),n.join(e,r)},D={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},E=function(e,n){return e.map(function(e){return e.endsWith(".d.ts")?e:e.replace(/\.[^./\\]+$/,n)})};e.DEFAULT_FIX_OPTIONS=D,e.fix=function(e){try{var t=function(e){return f({},D,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:D.debug})}(e);return Promise.resolve(function(e){try{var t=e.cwd,r=e.target,u=e.src,i=e.tsconfig,s=e.out,l=e.ext,a=e.debug,f=c.default.resolve(t,void 0===s?t:s),d=h(u),m=[].concat(h(r),S(i,t));a("debug:cwd",t),a("debug:outdir",f),a("debug:sources",d),a("debug:targets",m);var p=d.length>0;return Promise.resolve(function(e,n,t){return o.globby(function(e,n){return e.length>0?e.map(function(e){return e.includes("*")?e:e+"/**/*.{ts,tsx}"}):n.map(function(e){return e.includes("*")?e:e+"/**/*.{js,d.ts}"})}(e,n),{cwd:t,onlyFiles:!0,absolute:!0})}(d,m,t)).then(function(e){return Promise.resolve(function(e){try{return Promise.resolve(function(e){return o.globby(["node_modules/*/package.json","node_modules/@*/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(function(e){try{return Promise.resolve(Promise.all(e.map(function(e){try{return Promise.resolve(b(e)).then(function(t){var r=t.name,u=t.exports;if(!u)return{name:r};var i=n.dirname(e),s=function(e){return e?Object.keys(e).some(function(e){return e.startsWith(".")})?Object.entries(e).map(function(e){return[e[0],k(e[1])]}):[[".",k(e)]]:[]}(u);return Promise.resolve(Promise.all(s.map(function(e){var t=e[0];return Promise.all(e[1].map(function(e){try{return Promise.resolve(o.globby(e,{cwd:i,onlyFiles:!0,absolute:!1})).then(function(o){return o.map(function(o){return n.join(o).replace(F(".",e),F(r,t))})})}catch(e){return Promise.reject(e)}}))}))).then(function(e){return{name:r,files:e.flat(2)}})})}catch(e){return Promise.reject(e)}}))).then(function(e){return e.reduce(function(e,n){var t,r=n.name,o=n.files;return r&&e.names.push(r),o&&(t=e.files).push.apply(t,o),e},{names:[],files:[]})})}catch(e){return Promise.reject(e)}})}(e)).then(function(n){var t=n.names,r=n.files;return Promise.resolve(o.globby(["!node_modules/.cache","!node_modules/.bin","!node_modules/**/node_modules"].concat(t.map(function(e){return"!node_modules/"+e}),["node_modules/**/*.(m|c)?js"]),{cwd:e,onlyFiles:!0,absolute:!0})).then(function(e){return{cjsModules:e,esmModules:r,allPackages:t}})})}catch(e){return Promise.reject(e)}}(t)).then(function(n){var t=n.cjsModules,r=n.esmModules,o=n.allPackages;a("debug:external-cjs-modules",t),a("debug:external-esm-modules",r);var u=[].concat(r,o),i="string"==typeof l?E(e,l):e,s=[].concat(t,i),c=[].concat(t,E(e,".js"));return a("debug:local-modules",i),{outDir:f,isSource:p,ignore:u,allJsModules:c,allModules:s,_localModules:i,localModules:e}})})}catch(e){return Promise.reject(e)}}(t)).then(function(e){return Promise.resolve(function(e,n){try{var t=n.cwd,r=n.unlink,o=n.sourceMap,i=e.outDir,s=e.isSource,l=e.ignore,a=e.allJsModules,f=e.allModules,d=e.localModules;return Promise.resolve(Promise.all(e._localModules.map(function(e,m){try{var p=e.endsWith(".d.ts")?a:f,h=d[m],j=(s?h:e).replace(x(t),x(i)),P=g(h),M=O({options:n,contents:P,isSource:s,ignore:l,filename:e,filenames:p,originName:h,nextName:j});return v(j,M.contents),!s&&r&&t===i&&j!==h&&y(h),o&&function(e,n,t){if(void 0===t&&(t=!1),e!==n){var r=e+".map";if(u.existsSync(r)){var o=n+".map",i=b(r);i.file=c.default.basename(n),v(o,JSON.stringify(i)),t&&y(r)}}}(h,j,r&&t===i),Promise.resolve()}catch(e){return Promise.reject(e)}}))).then(function(){})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})})}catch(e){return Promise.reject(e)}},e.fixBlankFiles=function(e){return d({contents:e}).contents},e.fixContents=function(e,n,t,r,o,u,i){return void 0===o&&(o=n),void 0===u&&(u=!1),void 0===i&&(i=[]),O({contents:e,filename:n,filenames:t,options:r,originName:o,isSource:u,ignore:i}).contents},e.fixDefaultExport=function(e){return w({contents:e}).contents},e.fixDirnameVar=function(e,n){return m({contents:e,isSource:n}).contents},e.fixFilenameExtensions=E,e.fixFilenameVar=function(e,n){return p({contents:e,isSource:n}).contents},e.fixModuleReferences=function(e,n,t,r,o){return P({contents:e,filename:n,filenames:t,options:{cwd:r},ignore:o}).contents},e.fixSourceMapRef=function(e,n,t){return _({contents:e,originName:n,filename:t}).contents}});
//# sourceMappingURL=tsc-esm-fix.umd.js.map

@@ -9,5 +9,5 @@ /// <reference types="node" />

export declare const readJson: <D = any>(file: string) => D;
export declare const asArray: <T>(value: T | T[] | undefined) => T[];
export declare const asArray: <T>(value: T[] | T | undefined) => T[];
export declare const remove: typeof fse.unlinkSync;
export declare const unixify: (path: string) => string;
export declare const resolveTsConfig: (file: string) => TSConfig;

@@ -8,1 +8,5 @@ export declare const getTsconfigTargets: (tsconfig: string | string[], cwd: string) => string[];

}>;
type Entry = string | string[] | Record<string, string | string[] | Record<string, string | string[]>>;
export declare const parseConditional: (e: Entry) => string[];
export declare const getExportsEntries: (exports: string | Entry) => [string, string[]][];
export {};

@@ -9,5 +9,5 @@ /// <reference types="node" />

export declare const readJson: <D = any>(file: string) => D;
export declare const asArray: <T>(value: T | T[] | undefined) => T[];
export declare const asArray: <T>(value: T[] | T | undefined) => T[];
export declare const remove: typeof fse.unlinkSync;
export declare const unixify: (path: string) => string;
export declare const resolveTsConfig: (file: string) => TSConfig;

@@ -64,8 +64,16 @@ import { dirname, join, resolve } from 'node:path'

const getExportsEntries = (exports: string | Entry): [string, string[]][] => {
const entries: [string, Entry][] = Object.entries(exports)
const parseConditional = (e: Entry): string[] => typeof e === 'string' ? [e] : Object.values(e).map(parseConditional).flat(2)
export const parseConditional = (e: Entry): string[] => e
? typeof e === 'string'
? [e]
: Object.values(e).map(parseConditional).flat(2)
: []
export const getExportsEntries = (exports: string | Entry): [string, string[]][] => {
if (!exports) {
return []
}
// has subpaths
if (typeof exports !== 'string' && Object.keys(exports).some((k) => k.startsWith('.'))) {
if (Object.keys(exports).some((k) => k.startsWith('.'))) {
const entries: [string, Entry][] = Object.entries(exports)
return entries.map(([k, v]) => [k, parseConditional(v)])

@@ -72,0 +80,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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