tsc-esm-fix
Advanced tools
Comparing version 2.20.0 to 2.20.1-beta.0
{ | ||
"git": { | ||
"commitId": "df73fcc0e9f341f94b18e37dca42a621950c2dab", | ||
"repoUrl": "https://github.com/antongolub/tsc-esm-fix", | ||
"commitId": "74e7b648f4e9a5a48d0b19ecac1e0b06705a8158", | ||
"repoUrl": "git@github.com:antongolub/tsc-esm-fix.git", | ||
"repoName": "antongolub/tsc-esm-fix" | ||
}, | ||
"date": "2022-07-21T18:33:41.182Z" | ||
"date": "2022-08-14T18:36:15.195Z" | ||
} |
{ | ||
"name": "tsc-esm-fix", | ||
"version": "2.20.0", | ||
"version": "2.20.1-beta.0", | ||
"private": false, | ||
@@ -66,12 +66,12 @@ "publishConfig": { | ||
"@types/jest": "^28.1.6", | ||
"@types/node": "^18.0.6", | ||
"@types/semver": "^7.3.10", | ||
"@types/node": "^18.7.3", | ||
"@types/semver": "^7.3.12", | ||
"cpy-cli": "^4.1.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.20.0", | ||
"eslint": "^8.22.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-qiwi": "^1.17.3", | ||
"eslint-config-qiwi": "^1.17.5", | ||
"glob-runner": "^1.0.6", | ||
"jest": "^28.1.3", | ||
"microbundle": "^0.15.0", | ||
"microbundle": "^0.15.1", | ||
"mkdirp": "^1.0.4", | ||
@@ -85,3 +85,3 @@ "prettier": "^2.7.1", | ||
"ts-jest": "^28.0.7", | ||
"typedoc": "^0.23.8", | ||
"typedoc": "^0.23.10", | ||
"typescript": "4.7" | ||
@@ -88,0 +88,0 @@ }, |
@@ -225,2 +225,3 @@ # tsc-esm-fix | ||
forceDefaultExport?: boolean | ||
sourceMap?: boolean | ||
ext: boolean | string | ||
@@ -227,0 +228,0 @@ unlink?: boolean, |
@@ -1,2 +0,2 @@ | ||
export { fix, fixBlankFiles, fixContents, fixFilenameVar, fixDirnameVar, fixModuleReferences, fixFilenameExtensions, fixDefaultExport, DEFAULT_FIX_OPTIONS, } from './fix'; | ||
export { fix, fixBlankFiles, fixContents, fixFilenameVar, fixDirnameVar, fixModuleReferences, fixFilenameExtensions, fixDefaultExport, fixSourceMapRef, DEFAULT_FIX_OPTIONS, } from './fix'; | ||
export * from './interface'; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("node:path"),require("fs-extra"),require("globby"),require("json5"),require("node:fs")):"function"==typeof define&&define.amd?define(["exports","node:path","fs-extra","globby","json5","node:fs"],n):n((e||self).tscEsmFix={},e.node_path,e.fsExtra,e.globby,e.json5,e.node_fs)}(this,function(e,n,r,t,o,u){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/i(r),s=/*#__PURE__*/i(o);function a(){return a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a.apply(this,arguments)}var l=function(e){return c.default.readFileSync(e,{encoding:"utf8"})},f=function(e,n){return c.default.outputFileSync(e,n,{encoding:"utf8"})},d=function(e){return s.default.parse(l(e))},p=function(e){return e?Array.isArray(e)?e:[e]:[]},m=c.default.unlinkSync,g=function(e){return e.replace(/\\/g,"/")},b=function e(r){var t=d(r);if(t.extends){var o=e(n.resolve(n.dirname(r),t.extends));return a({},o,t,{compilerOptions:a({},o.compilerOptions,t.compilerOptions)})}return t},v={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},x=function(e,r){return p(e).reduce(function(e,t){var o,u,i=b(n.resolve(r,t)),c=null==i||null==(o=i.compilerOptions)?void 0:o.outDir,s=null==i||null==(u=i.compilerOptions)||null==u.module.toLowerCase?void 0:u.module.toLowerCase();return c&&s.startsWith("es")?e.push(c):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),e},[])},y=function(e,n){return e.map(function(e){return e.endsWith(".d.ts")?e:e.replace(/\.[^./\\]+$/,n)})},h=function(e,r,t,o){return e.replace(/(\sfrom\s|[\s(](?:import|require)[ (])(["'])([^"']+\/[^"']+|\.{1,2})\/?(["'])/g,function(e,u,i,c,s){return""+u+i+function(e,r,t,o){var u=n.dirname(e),i=n.resolve(o,"node_modules"),c=/^\..+\.[^./\\]+$/.test(r)?[r,r.replace(/\.[^./\\]+$/,"")]:[r],s=[".js",".cjs",".mjs"].reduce(function(e,n){return c.forEach(function(r){return e.push(""+r+n,r+"/index"+n)}),e},[]);return s.find(function(e){return t.includes(g(n.resolve(u,e)))})||s.find(function(e){return t.includes(g(n.resolve(i,e)))})||r}(r,c,t,o)+s})},j=function(e){return e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]")},_=function(e){return e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]")},w=function(e){return e.includes("export default")?e:e+"\nexport default undefined\n"},F=function(e){return 0===e.trim().length?"\nexport {}\nexport default undefined\n":e},O=function(e,r,t,o,u){var i=o.dirnameVar,c=o.filenameVar,s=o.fillBlank,a=o.forceDefaultExport,l=o.sourceMap;void 0===u&&(u=r);var f=e;return o.ext&&(f=h(f,r,t,o.cwd)),i&&(f=j(f)),c&&(f=_(f)),s&&(f=F(f)),a&&(f=w(f)),l&&(f=function(e,r,t){return r===t?e:e.replace("//# sourceMappingURL="+n.basename(r)+".map","//# sourceMappingURL="+n.basename(t)+".map")}(f,u,r)),f};e.DEFAULT_FIX_OPTIONS=v,e.fix=function(e){try{var r=function(e){return a({},v,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:v.debug})}(e),o=r.cwd,i=r.target,c=r.src,s=r.tsconfig,b=r.out,h=r.ext,j=r.debug,_=r.unlink,w=r.sourceMap,F=n.resolve(o,void 0===b?o:b),E=p(c),P=[].concat(p(i),x(s,o));j("debug:cwd",o),j("debug:outdir",F),j("debug:sources",E),j("debug:targets",P);var k=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,P);return Promise.resolve(t.globby(k,{cwd:o,onlyFiles:!0,absolute:!0})).then(function(e){return Promise.resolve(function(e){try{return Promise.resolve(function(e){return t.globby(["node_modules/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(function(e){return e.filter(function(e){return d(e).exports}).map(function(e){return n.basename(n.dirname(e))})})}(e)).then(function(n){return t.globby(["node_modules/**/*.(m|c)?js","!node_modules/.cache","!node_modules/.bin","!node_modules/**/node_modules"].concat(n.map(function(e){return"!node_modules/"+e})),{cwd:e,onlyFiles:!0,absolute:!0})})}catch(e){return Promise.reject(e)}}(o)).then(function(t){j("debug:external-names",t);var i=[].concat(t,y(e,".js")),c="string"==typeof h?y(e,h):e,s=[].concat(t,c);j("debug:local-names",c),c.forEach(function(t,c){var a=t.endsWith(".d.ts")?i:s,p=e[c],b=(0===E.length?t:p).replace(g(o),g(F)),v=l(p),x=O(v,t,a,r,p);f(b,x),0===E.length&&_&&o===F&&b!==p&&m(p),w&&function(e,r,t){if(void 0===t&&(t=!1),e!==r){var o=e+".map";if(u.existsSync(o)){var i=r+".map",c=d(o);c.file=n.basename(r),f(i,JSON.stringify(c)),t&&m(o)}}}(p,b,_&&o===F)})})})}catch(e){return Promise.reject(e)}},e.fixBlankFiles=F,e.fixContents=O,e.fixDefaultExport=w,e.fixDirnameVar=j,e.fixFilenameExtensions=y,e.fixFilenameVar=_,e.fixModuleReferences=h}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("node:path"),require("fs-extra"),require("globby"),require("json5"),require("node:fs")):"function"==typeof define&&define.amd?define(["exports","node:path","fs-extra","globby","json5","node:fs"],n):n((e||self).tscEsmFix={},e.node_path,e.fsExtra,e.globby,e.json5,e.node_fs)}(this,function(e,n,r,t,o,u){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/i(r),a=/*#__PURE__*/i(o);function s(){return s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},s.apply(this,arguments)}var l=function(e){return c.default.readFileSync(e,{encoding:"utf8"})},f=function(e,n){return c.default.outputFileSync(e,n,{encoding:"utf8"})},d=function(e){return a.default.parse(l(e))},p=function(e){return e?Array.isArray(e)?e:[e]:[]},m=c.default.unlinkSync,g=function(e){return e.replace(/\\/g,"/")},b=function e(r){var t=d(r);if(t.extends){var o=e(n.resolve(n.dirname(r),t.extends));return s({},o,t,{compilerOptions:s({},o.compilerOptions,t.compilerOptions)})}return t},x={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},v=function(e,r){return p(e).reduce(function(e,t){var o,u,i=b(n.resolve(r,t)),c=null==i||null==(o=i.compilerOptions)?void 0:o.outDir,a=null==i||null==(u=i.compilerOptions)||null==u.module.toLowerCase?void 0:u.module.toLowerCase();return c&&a.startsWith("es")?e.push(c):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),e},[])},y=function(e,n){return e.map(function(e){return e.endsWith(".d.ts")?e:e.replace(/\.[^./\\]+$/,n)})},h=function(e,r,t,o){return e.replace(/(\sfrom\s|[\s(](?:import|require)[ (])(["'])([^"']+\/[^"']+|\.{1,2})\/?(["'])/g,function(e,u,i,c,a){return""+u+i+function(e,r,t,o){var u=n.dirname(e),i=n.resolve(o,"node_modules"),c=/^\..+\.[^./\\]+$/.test(r)?[r,r.replace(/\.[^./\\]+$/,"")]:[r],a=[".js",".cjs",".mjs"].reduce(function(e,n){return c.forEach(function(r){return e.push(""+r+n,r+"/index"+n)}),e},[]);return a.find(function(e){return t.includes(g(n.resolve(u,e)))})||a.find(function(e){return t.includes(g(n.resolve(i,e)))})||r}(r,c,t,o)+a})},j=function(e){return e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]")},_=function(e){return e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]")},w=function(e){return e.includes("export default")?e:e+"\nexport default undefined\n"},F=function(e){return 0===e.trim().length?"\nexport {}\nexport default undefined\n":e},O=function(e,r,t){return r===t?e:e.replace("//# sourceMappingURL="+n.basename(r)+".map","//# sourceMappingURL="+n.basename(t)+".map")},E=function(e,n,r,t,o){var u=t.dirnameVar,i=t.filenameVar,c=t.fillBlank,a=t.forceDefaultExport,s=t.sourceMap;void 0===o&&(o=n);var l=e;return t.ext&&(l=h(l,n,r,t.cwd)),u&&(l=j(l)),i&&(l=_(l)),c&&(l=F(l)),a&&(l=w(l)),s&&(l=O(l,o,n)),l};e.DEFAULT_FIX_OPTIONS=x,e.fix=function(e){try{var r=function(e){return s({},x,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:x.debug})}(e),o=r.cwd,i=r.target,c=r.src,a=r.tsconfig,b=r.out,h=r.ext,j=r.debug,_=r.unlink,w=r.sourceMap,F=n.resolve(o,void 0===b?o:b),O=p(c),P=[].concat(p(i),v(a,o));j("debug:cwd",o),j("debug:outdir",F),j("debug:sources",O),j("debug:targets",P);var S=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}"})}(O,P);return Promise.resolve(t.globby(S,{cwd:o,onlyFiles:!0,absolute:!0})).then(function(e){return Promise.resolve(function(e){try{return Promise.resolve(function(e){return t.globby(["node_modules/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(function(e){return e.filter(function(e){return d(e).exports}).map(function(e){return n.basename(n.dirname(e))})})}(e)).then(function(n){return t.globby(["node_modules/**/*.(m|c)?js","!node_modules/.cache","!node_modules/.bin","!node_modules/**/node_modules"].concat(n.map(function(e){return"!node_modules/"+e})),{cwd:e,onlyFiles:!0,absolute:!0})})}catch(e){return Promise.reject(e)}}(o)).then(function(t){j("debug:external-names",t);var i=[].concat(t,y(e,".js")),c="string"==typeof h?y(e,h):e,a=[].concat(t,c);j("debug:local-names",c),c.forEach(function(t,c){var s=t.endsWith(".d.ts")?i:a,p=e[c],b=(0===O.length?t:p).replace(g(o),g(F)),x=l(p),v=E(x,t,s,r,p);f(b,v),0===O.length&&_&&o===F&&b!==p&&m(p),w&&function(e,r,t){if(void 0===t&&(t=!1),e!==r){var o=e+".map";if(u.existsSync(o)){var i=r+".map",c=d(o);c.file=n.basename(r),f(i,JSON.stringify(c)),t&&m(o)}}}(p,b,_&&o===F)})})})}catch(e){return Promise.reject(e)}},e.fixBlankFiles=F,e.fixContents=E,e.fixDefaultExport=w,e.fixDirnameVar=j,e.fixFilenameExtensions=y,e.fixFilenameVar=_,e.fixModuleReferences=h,e.fixSourceMapRef=O}); | ||
//# sourceMappingURL=tsc-esm-fix.umd.js.map |
@@ -1,2 +0,2 @@ | ||
export { fix, fixBlankFiles, fixContents, fixFilenameVar, fixDirnameVar, fixModuleReferences, fixFilenameExtensions, fixDefaultExport, DEFAULT_FIX_OPTIONS, } from './fix.js'; | ||
export { fix, fixBlankFiles, fixContents, fixFilenameVar, fixDirnameVar, fixModuleReferences, fixFilenameExtensions, fixDefaultExport, fixSourceMapRef, DEFAULT_FIX_OPTIONS, } from './fix.js'; | ||
export * from './interface.js'; |
@@ -10,4 +10,5 @@ export { | ||
fixDefaultExport, | ||
fixSourceMapRef, | ||
DEFAULT_FIX_OPTIONS, | ||
} from './fix' | ||
export * from './interface' |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256
4
117551
31
801
3