tsc-esm-fix
Advanced tools
Comparing version 2.7.3 to 2.7.4
{ | ||
"git": { | ||
"commitId": "27f67e1337ba1345b8615f81fc64aab988f9f0ef", | ||
"commitId": "987346267a99b9711c66ff2e9ac9cd97d754d5ee", | ||
"repoUrl": "https://github.com/antongolub/tsc-esm-fix", | ||
"repoName": "antongolub/tsc-esm-fix" | ||
}, | ||
"date": "2021-10-02T19:31:52.098Z" | ||
"date": "2021-11-12T15:21:38.509Z" | ||
} |
@@ -0,1 +1,3 @@ | ||
## [2.7.4](https://github.com/antongolub/tsc-esm-fix/compare/v2.7.3...v2.7.4) (2021-11-12) | ||
## [2.7.3](https://github.com/antongolub/tsc-esm-fix/compare/v2.7.2...v2.7.3) (2021-10-02) | ||
@@ -2,0 +4,0 @@ |
{ | ||
"name": "tsc-esm-fix", | ||
"version": "2.7.3", | ||
"version": "2.7.4", | ||
"private": false, | ||
@@ -31,5 +31,5 @@ "publishConfig": { | ||
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.json --runInBand", | ||
"test:it": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-modules\" node scripts/js/glob-script-runner.js src/test/**/*.it.js", | ||
"test:it": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-modules\" npx glob-runner src/test/**/*.it.js", | ||
"test:deps": "npm-run-all -p -l test:depcheck test:depauditfix", | ||
"test:depcheck": "npm_config_yes=true npx depcheck --ignore-patterns fixtures --ignores semver,tslib,@types/jest,@types/node,eslint-config-*,typedoc", | ||
"test:depcheck": "npm_config_yes=true npx depcheck --ignore-patterns fixtures --ignores glob-runner,tslib,@types/jest,@types/node,eslint-config-*,typedoc", | ||
"test:depaudit": "yarn audit --groups=dependencies --level=moderate; [[ $? -ge 4 ]] && exit 1 || exit 0", | ||
@@ -69,3 +69,3 @@ "test:depauditfix": "npm_config_yes=true npx yarn-audit-fix --audit-level=moderate", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "^16.10.2", | ||
"@types/node": "^16.10.3", | ||
"coveralls": "^3.1.1", | ||
@@ -77,4 +77,5 @@ "cpy-cli": "^3.1.1", | ||
"eslint-config-qiwi": "^1.13.6", | ||
"jest": "^27.2.4", | ||
"microbundle": "^0.13.3", | ||
"glob-runner": "^1.0.2", | ||
"jest": "^27.2.5", | ||
"microbundle": "^0.14.0", | ||
"mkdirp": "^1.0.4", | ||
@@ -84,3 +85,2 @@ "prettier": "^2.4.1", | ||
"rimraf": "^3.0.2", | ||
"semver": "^7.3.5", | ||
"tempy": "^2.0.0", | ||
@@ -87,0 +87,0 @@ "terser": "^5.9.0", |
@@ -42,3 +42,3 @@ # tsc-esm-fix | ||
* Follows `outDir` found in **tsconfig.json**. | ||
* Finds and replaces `__dirname` and `__filename` refs with `import.meta`. | ||
* Searches and replaces `__dirname` and `__filename` refs with `import.meta`. | ||
* Changes file extensions (applied to local deps only). | ||
@@ -198,3 +198,3 @@ * Supports Windows-based runtimes. | ||
## Contributing | ||
Feel free to open any issues: for bugs, feature requests or questions. | ||
Feel free to open any issues: bug reports, feature requests or questions. | ||
You're always welcome to suggest a PR. Just fork this repo, write some code, add some tests and push your changes. | ||
@@ -201,0 +201,0 @@ Any feedback is appreciated. |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("path"),require("fs"),require("fs-extra"),require("globby"),require("json5")):"function"==typeof define&&define.amd?define(["exports","path","fs","fs-extra","globby","json5"],n):n((e||self).tscEsmFix={},e.path,e.fs,e.fsExtra,e.globby,e.json5)}(this,function(e,n,r,t,o,u){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=i(t),l=i(u);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}).apply(this,arguments)}var a=function(e){return r.readFileSync(e,{encoding:"utf8"})},f=function(e){return l.default.parse(a(e))},d=function(e){return e?Array.isArray(e)?e:[e]:[]},p=r.unlinkSync,m=function(e){return e.replace(/\\/g,"/")},g=function e(r){var t=f(r);if(t.extends){var o=e(n.resolve(n.dirname(r),t.extends));return s({},o,{compilerOptions:s({},o.compilerOptions,t.compilerOptions)})}return t},b={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},v=function(e,r){return d(e).reduce(function(e,t){var o,u,i,c=g(n.resolve(r,t)),l=null==c||null==(o=c.compilerOptions)?void 0:o.outDir,s=null==c||null==(u=c.compilerOptions)||null==(i=u.module)?void 0:i.toLowerCase();return!l||"es2020"!==s&&"esnext"!==s||e.push(l),e},[])},y=function(e,n){return e.map(function(e){return e.replace(/\.[^./\\]+$/,n)})},x=function(e,r,t,o){return e.replace(/(\sfrom |\simport[ (])(["'])([^"']+\/[^"']+)(["'])/g,function(e,u,i,c,l){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];return[".js",".cjs",".mjs"].reduce(function(e,n){return c.forEach(function(r){return e.push(""+r+n,r+"/index"+n)}),e},[]).find(function(e){return t.includes(m(n.resolve(i,e)))||t.includes(m(n.resolve(u,e)))})||r}(r,c,t,o)+l})},h=function(e){return e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]")},j=function(e){return e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]")},_=function(e,n,r,t){var o=t.dirnameVar,u=t.filenameVar,i=e;return t.ext&&(i=x(i,n,r,t.cwd)),o&&(i=h(i)),u&&(i=j(i)),i};e.DEFAULT_FIX_OPTIONS=b,e.fix=function(e){try{var r=function(e){return s({},b,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:b.debug})}(e),t=r.cwd,u=r.target,i=r.src,l=r.tsconfig,g=r.out,x=r.ext,h=r.debug,j=r.unlink,w=n.resolve(t,void 0===g?t:g),F=d(i),O=[].concat(d(u),v(l,t));h("debug:cwd",t),h("debug:outdir",w),h("debug:sources",F),h("debug:targets",O);var P=F.length>0?F.map(function(e){return e+"/**/*.ts"}):O.map(function(e){return e+"/**/*.js"});return Promise.resolve(o.globby(P,{cwd:t,onlyFiles:!0,absolute:!0})).then(function(e){return Promise.resolve(function(e){try{return Promise.resolve(function(e){return o.globby(["node_modules/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(function(e){return e.filter(function(e){return f(e).exports}).map(function(e){return n.basename(n.dirname(e))})})}(e)).then(function(n){return o.globby(["node_modules/**/*.(m|c)?js","!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)}}(t)).then(function(n){h("debug:external-names",n);var o="string"==typeof x?y(e,x):e;h("debug:local-names",o);var u=[].concat(n,o);o.forEach(function(n,o){var l=(i?e[o]:n).replace(m(t),m(w)),s=a(e[o]);!function(e,n){c.default.outputFileSync(e,n,{encoding:"utf8"})}(l,_(s,n,u,r)),!i&&j&&t===w&&l!==e[o]&&p(e[o])})})})}catch(e){return Promise.reject(e)}},e.fixContents=_,e.fixDirnameVar=h,e.fixFilenameExtensions=y,e.fixFilenameVar=j,e.fixModuleReferences=x}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("path"),require("fs"),require("fs-extra"),require("globby"),require("json5")):"function"==typeof define&&define.amd?define(["exports","path","fs","fs-extra","globby","json5"],n):n((e||self).tscEsmFix={},e.path,e.fs,e.fsExtra,e.globby,e.json5)}(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(t),l=/*#__PURE__*/i(u);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 a=function(e){return r.readFileSync(e,{encoding:"utf8"})},f=function(e){return l.default.parse(a(e))},d=function(e){return e?Array.isArray(e)?e:[e]:[]},p=r.unlinkSync,m=function(e){return e.replace(/\\/g,"/")},g=function e(r){var t=f(r);if(t.extends){var o=e(n.resolve(n.dirname(r),t.extends));return s({},o,{compilerOptions:s({},o.compilerOptions,t.compilerOptions)})}return t},b={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},v=function(e,r){return d(e).reduce(function(e,t){var o,u,i,c=g(n.resolve(r,t)),l=null==c||null==(o=c.compilerOptions)?void 0:o.outDir,s=null==c||null==(u=c.compilerOptions)||null==(i=u.module)?void 0:i.toLowerCase();return!l||"es2020"!==s&&"esnext"!==s||e.push(l),e},[])},y=function(e,n){return e.map(function(e){return e.replace(/\.[^./\\]+$/,n)})},x=function(e,r,t,o){return e.replace(/(\sfrom |\simport[ (])(["'])([^"']+\/[^"']+)(["'])/g,function(e,u,i,c,l){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];return[".js",".cjs",".mjs"].reduce(function(e,n){return c.forEach(function(r){return e.push(""+r+n,r+"/index"+n)}),e},[]).find(function(e){return t.includes(m(n.resolve(i,e)))||t.includes(m(n.resolve(u,e)))})||r}(r,c,t,o)+l})},h=function(e){return e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]")},j=function(e){return e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]")},_=function(e,n,r,t){var o=t.dirnameVar,u=t.filenameVar,i=e;return t.ext&&(i=x(i,n,r,t.cwd)),o&&(i=h(i)),u&&(i=j(i)),i};e.DEFAULT_FIX_OPTIONS=b,e.fix=function(e){try{var r=function(e){return s({},b,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:b.debug})}(e),t=r.cwd,u=r.target,i=r.src,l=r.tsconfig,g=r.out,x=r.ext,h=r.debug,j=r.unlink,w=n.resolve(t,void 0===g?t:g),F=d(i),O=[].concat(d(u),v(l,t));h("debug:cwd",t),h("debug:outdir",w),h("debug:sources",F),h("debug:targets",O);var P=F.length>0?F.map(function(e){return e+"/**/*.ts"}):O.map(function(e){return e+"/**/*.js"});return Promise.resolve(o.globby(P,{cwd:t,onlyFiles:!0,absolute:!0})).then(function(e){return Promise.resolve(function(e){try{return Promise.resolve(function(e){return o.globby(["node_modules/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(function(e){return e.filter(function(e){return f(e).exports}).map(function(e){return n.basename(n.dirname(e))})})}(e)).then(function(n){return o.globby(["node_modules/**/*.(m|c)?js","!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)}}(t)).then(function(n){h("debug:external-names",n);var o="string"==typeof x?y(e,x):e;h("debug:local-names",o);var u=[].concat(n,o);o.forEach(function(n,o){var l=(i?e[o]:n).replace(m(t),m(w)),s=a(e[o]);!function(e,n){c.default.outputFileSync(e,n,{encoding:"utf8"})}(l,_(s,n,u,r)),!i&&j&&t===w&&l!==e[o]&&p(e[o])})})})}catch(e){return Promise.reject(e)}},e.fixContents=_,e.fixDirnameVar=h,e.fixFilenameExtensions=y,e.fixFilenameVar=j,e.fixModuleReferences=x}); | ||
//# sourceMappingURL=tsc-esm-fix.umd.js.map |
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
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
85441
619