tsc-esm-fix
Advanced tools
Comparing version 2.15.1 to 2.16.0
{ | ||
"git": { | ||
"commitId": "e370d55447ca530c8c2c3ea53759cc0dd3a48944", | ||
"commitId": "fb03b28c2c06da2f504ed7cd2048dc6b52bc9814", | ||
"repoUrl": "https://github.com/antongolub/tsc-esm-fix", | ||
"repoName": "antongolub/tsc-esm-fix" | ||
}, | ||
"date": "2022-05-31T15:59:39.059Z" | ||
"date": "2022-06-03T19:50:10.872Z" | ||
} |
@@ -0,1 +1,8 @@ | ||
# [2.16.0](https://github.com/antongolub/tsc-esm-fix/compare/v2.15.1...v2.16.0) (2022-06-03) | ||
### Features | ||
* add `.js` ext to libdef files ([fb03b28](https://github.com/antongolub/tsc-esm-fix/commit/fb03b28c2c06da2f504ed7cd2048dc6b52bc9814)) | ||
## [2.15.1](https://github.com/antongolub/tsc-esm-fix/compare/v2.15.0...v2.15.1) (2022-05-31) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "tsc-esm-fix", | ||
"version": "2.15.1", | ||
"version": "2.16.0", | ||
"private": false, | ||
@@ -65,3 +65,3 @@ "publishConfig": { | ||
"@qiwi/npm-run-all": "^4.1.7", | ||
"@types/jest": "^27.5.1", | ||
"@types/jest": "^28.0.0", | ||
"@types/node": "^17.0.34", | ||
@@ -68,0 +68,0 @@ "@types/semver": "^7.3.9", |
@@ -51,3 +51,4 @@ # tsc-esm-fix | ||
* Pays attention to index files: `import {bar} from './bar'` → `import {bar} from './bar/index.js'` | ||
* Handles single '.': `export * from '.'` → `export * from './index.js'` | ||
* Handles single dot path: `export * from '.'` → `export * from './index.js'` | ||
* Injects `.js` extensions to libdef `.d.ts` files | ||
* Follows `outDir` found in **tsconfig.json**. | ||
@@ -54,0 +55,0 @@ * Searches and replaces `__dirname` and `__filename` refs with `import.meta`. |
@@ -1,2 +0,2 @@ | ||
import{resolve as e,dirname as o,basename as n}from"node:path";import t from"fs-extra";import{globby as r}from"globby";import l from"json5";function s(){return s=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},s.apply(this,arguments)}const i=e=>t.readFileSync(e,{encoding:"utf8"}),a=e=>l.parse(i(e)),u=e=>e?Array.isArray(e)?e:[e]:[],c=t.unlinkSync,d=e=>e.replace(/\\/g,"/"),p=n=>{const t=a(n);if(t.extends){const r=p(e(o(n),t.extends));return s({},r,t,{compilerOptions:s({},r.compilerOptions,t.compilerOptions)})}return t},m={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:()=>{}},g=(o,n)=>u(o).reduce((o,t)=>{var r,l;const s=p(e(n,t)),i=null==s||null==(r=s.compilerOptions)?void 0:r.outDir,a=null==s||null==(l=s.compilerOptions)||null==l.module.toLowerCase?void 0:l.module.toLowerCase();return i&&a.startsWith("es")?o.push(i):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),o},[]),f=(e,o)=>e.map(e=>e.replace(/\.[^./\\]+$/,o)),b=(n,t,r,l)=>n.replace(/(\sfrom\s|[\s(](?:import|require)[ (])(["'])([^"']+\/[^"']+|\.)(["'])/g,(n,s,i,a,u)=>`${s}${i}${((n,t,r,l)=>{const s=o(n),i=e(l,"node_modules"),a=/^\..+\.[^./\\]+$/.test(t)?[t,t.replace(/\.[^./\\]+$/,"")]:[t],u=[".js",".cjs",".mjs"].reduce((e,o)=>(a.forEach(n=>e.push(`${n}${o}`,`${n}/index${o}`)),e),[]);return u.find(o=>r.includes(d(e(s,o))))||u.find(o=>r.includes(d(e(i,o))))||t})(t,a,r,l)}${u}`),y=e=>e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]"),h=e=>e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]"),w=e=>0===e.trim().length?"\nexport {}\nexport default undefined\n":e,x=(e,o,n,{cwd:t,ext:r,dirnameVar:l,filenameVar:s,fillBlank:i})=>{let a=e;return r&&(a=b(a,o,n,t)),l&&(a=y(a)),s&&(a=h(a)),i&&(a=w(a)),a},$=e=>r(["node_modules/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(e=>e.filter(e=>a(e).exports).map(e=>n(o(e)))),_=async o=>{const n=(e=>s({},m,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:m.debug}))(o),{cwd:l,target:a,src:p,tsconfig:b,out:y=l,ext:h,debug:w,unlink:_}=n,j=e(l,y),v=u(p),O=[...u(a),...g(b,l)];w("debug:cwd",l),w("debug:outdir",j),w("debug:sources",v),w("debug:targets",O);const k=v.length>0?v.map(e=>`${e}/**/*.{ts,tsx}`):O.map(e=>`${e}/**/*.js`),F=await r(k,{cwd:l,onlyFiles:!0,absolute:!0}),V=await(async e=>r(["node_modules/**/*.(m|c)?js","!node_modules/.cache","!node_modules/.bin","!node_modules/**/node_modules",...(await $(e)).map(e=>`!node_modules/${e}`)],{cwd:e,onlyFiles:!0,absolute:!0}))(l);w("debug:external-names",V);const S="string"==typeof h?f(F,h):F;w("debug:local-names",S);const A=[...V,...S];S.forEach((e,o)=>{const r=(0===v.length?e:F[o]).replace(d(l),d(j)),s=i(F[o]);((e,o)=>{t.outputFileSync(e,o,{encoding:"utf8"})})(r,x(s,e,A,n)),0===v.length&&_&&l===j&&r!==F[o]&&c(F[o])})};export{m as DEFAULT_FIX_OPTIONS,_ as fix,w as fixBlankFiles,x as fixContents,y as fixDirnameVar,f as fixFilenameExtensions,h as fixFilenameVar,b as fixModuleReferences}; | ||
import{resolve as e,dirname as n,basename as o}from"node:path";import t from"fs-extra";import{globby as r}from"globby";import s from"json5";function l(){return l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},l.apply(this,arguments)}const d=e=>t.readFileSync(e,{encoding:"utf8"}),i=e=>s.parse(d(e)),a=e=>e?Array.isArray(e)?e:[e]:[],u=t.unlinkSync,c=e=>e.replace(/\\/g,"/"),p=o=>{const t=i(o);if(t.extends){const r=p(e(n(o),t.extends));return l({},r,t,{compilerOptions:l({},r.compilerOptions,t.compilerOptions)})}return t},m={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:()=>{}},g=(n,o)=>a(n).reduce((n,t)=>{var r,s;const l=p(e(o,t)),d=null==l||null==(r=l.compilerOptions)?void 0:r.outDir,i=null==l||null==(s=l.compilerOptions)||null==s.module.toLowerCase?void 0:s.module.toLowerCase();return d&&i.startsWith("es")?n.push(d):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),n},[]),f=(e,n)=>e.map(e=>e.endsWith("d.ts")?e:e.replace(/\.[^./\\]+$/,n)),b=(o,t,r,s)=>o.replace(/(\sfrom\s|[\s(](?:import|require)[ (])(["'])([^"']+\/[^"']+|\.)(["'])/g,(o,l,d,i,a)=>`${l}${d}${((o,t,r,s)=>{const l=n(o),d=e(s,"node_modules"),i=/^\..+\.[^./\\]+$/.test(t)?[t,t.replace(/\.[^./\\]+$/,"")]:[t],a=[".js",".cjs",".mjs"].reduce((e,n)=>(i.forEach(o=>e.push(`${o}${n}`,`${o}/index${n}`)),e),[]);return a.find(n=>r.includes(c(e(l,n))))||a.find(n=>r.includes(c(e(d,n))))||t})(t,i,r,s)}${a}`),h=e=>e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]"),y=e=>e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]"),w=e=>0===e.trim().length?"\nexport {}\nexport default undefined\n":e,x=(e,n,o,{cwd:t,ext:r,dirnameVar:s,filenameVar:l,fillBlank:d})=>{let i=e;return r&&(i=b(i,n,o,t)),s&&(i=h(i)),l&&(i=y(i)),d&&(i=w(i)),i},$=e=>r(["node_modules/*/package.json"],{cwd:e,onlyFiles:!0,absolute:!0}).then(e=>e.filter(e=>i(e).exports).map(e=>o(n(e)))),_=async n=>{const o=(e=>l({},m,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:m.debug}))(n),{cwd:s,target:i,src:p,tsconfig:b,out:h=s,ext:y,debug:w,unlink:_}=o,j=e(s,h),v=a(p),O=[...a(i),...g(b,s)];w("debug:cwd",s),w("debug:outdir",j),w("debug:sources",v),w("debug:targets",O);const k=v.length>0?v.map(e=>`${e}/**/*.{ts,tsx}`):O.map(e=>`${e}/**/*.{js,d.ts}`),F=await r(k,{cwd:s,onlyFiles:!0,absolute:!0}),V=await(async e=>r(["node_modules/**/*.(m|c)?js","!node_modules/.cache","!node_modules/.bin","!node_modules/**/node_modules",...(await $(e)).map(e=>`!node_modules/${e}`)],{cwd:e,onlyFiles:!0,absolute:!0}))(s);w("debug:external-names",V);const S=[...V,...f(F,".js")],W="string"==typeof y?f(F,y):F,A=[...V,...W];w("debug:local-names",W),W.forEach((e,n)=>{const r=e.endsWith("d.ts")?S:A,l=(0===v.length?e:F[n]).replace(c(s),c(j)),i=d(F[n]);((e,n)=>{t.outputFileSync(e,n,{encoding:"utf8"})})(l,x(i,e,r,o)),0===v.length&&_&&s===j&&l!==F[n]&&u(F[n])})};export{m as DEFAULT_FIX_OPTIONS,_ as fix,w as fixBlankFiles,x as fixContents,h as fixDirnameVar,f as fixFilenameExtensions,y as fixFilenameVar,b as fixModuleReferences}; | ||
//# sourceMappingURL=tsc-esm-fix.modern.js.map |
@@ -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")):"function"==typeof define&&define.amd?define(["exports","node:path","fs-extra","globby","json5"],n):n((e||self).tscEsmFix={},e.node_path,e.fsExtra,e.globby,e.json5)}(this,function(e,n,r,t,o){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/u(r),l=/*#__PURE__*/u(o);function c(){return c=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},c.apply(this,arguments)}var s=function(e){return i.default.readFileSync(e,{encoding:"utf8"})},a=function(e){return l.default.parse(s(e))},f=function(e){return e?Array.isArray(e)?e:[e]:[]},d=i.default.unlinkSync,m=function(e){return e.replace(/\\/g,"/")},p=function e(r){var t=a(r);if(t.extends){var o=e(n.resolve(n.dirname(r),t.extends));return c({},o,t,{compilerOptions:c({},o.compilerOptions,t.compilerOptions)})}return t},g={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},b=function(e,r){return f(e).reduce(function(e,t){var o,u,i=p(n.resolve(r,t)),l=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 l&&c.startsWith("es")?e.push(l):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),e},[])},v=function(e,n){return e.map(function(e){return e.replace(/\.[^./\\]+$/,n)})},x=function(e,r,t,o){return e.replace(/(\sfrom\s|[\s(](?:import|require)[ (])(["'])([^"']+\/[^"']+|\.)(["'])/g,function(e,u,i,l,c){return""+u+i+function(e,r,t,o){var u=n.dirname(e),i=n.resolve(o,"node_modules"),l=/^\..+\.[^./\\]+$/.test(r)?[r,r.replace(/\.[^./\\]+$/,"")]:[r],c=[".js",".cjs",".mjs"].reduce(function(e,n){return l.forEach(function(r){return e.push(""+r+n,r+"/index"+n)}),e},[]);return c.find(function(e){return t.includes(m(n.resolve(u,e)))})||c.find(function(e){return t.includes(m(n.resolve(i,e)))})||r}(r,l,t,o)+c})},y=function(e){return e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]")},h=function(e){return e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]")},j=function(e){return 0===e.trim().length?"\nexport {}\nexport default undefined\n":e},_=function(e,n,r,t){var o=t.dirnameVar,u=t.filenameVar,i=t.fillBlank,l=e;return t.ext&&(l=x(l,n,r,t.cwd)),o&&(l=y(l)),u&&(l=h(l)),i&&(l=j(l)),l};e.DEFAULT_FIX_OPTIONS=g,e.fix=function(e){try{var r=function(e){return c({},g,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:g.debug})}(e),o=r.cwd,u=r.target,l=r.src,p=r.tsconfig,x=r.out,y=r.ext,h=r.debug,j=r.unlink,w=n.resolve(o,void 0===x?o:x),F=f(l),O=[].concat(f(u),b(p,o));h("debug:cwd",o),h("debug:outdir",w),h("debug:sources",F),h("debug:targets",O);var P=F.length>0?F.map(function(e){return e+"/**/*.{ts,tsx}"}):O.map(function(e){return e+"/**/*.js"});return Promise.resolve(t.globby(P,{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 a(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(n){h("debug:external-names",n);var t="string"==typeof y?v(e,y):e;h("debug:local-names",t);var u=[].concat(n,t);t.forEach(function(n,t){var l=(0===F.length?n:e[t]).replace(m(o),m(w)),c=s(e[t]);!function(e,n){i.default.outputFileSync(e,n,{encoding:"utf8"})}(l,_(c,n,u,r)),0===F.length&&j&&o===w&&l!==e[t]&&d(e[t])})})})}catch(e){return Promise.reject(e)}},e.fixBlankFiles=j,e.fixContents=_,e.fixDirnameVar=y,e.fixFilenameExtensions=v,e.fixFilenameVar=h,e.fixModuleReferences=x}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("node:path"),require("fs-extra"),require("globby"),require("json5")):"function"==typeof define&&define.amd?define(["exports","node:path","fs-extra","globby","json5"],n):n((e||self).tscEsmFix={},e.node_path,e.fsExtra,e.globby,e.json5)}(this,function(e,n,r,t,o){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/u(r),c=/*#__PURE__*/u(o);function l(){return l=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},l.apply(this,arguments)}var s=function(e){return i.default.readFileSync(e,{encoding:"utf8"})},a=function(e){return c.default.parse(s(e))},f=function(e){return e?Array.isArray(e)?e:[e]:[]},d=i.default.unlinkSync,m=function(e){return e.replace(/\\/g,"/")},p=function e(r){var t=a(r);if(t.extends){var o=e(n.resolve(n.dirname(r),t.extends));return l({},o,t,{compilerOptions:l({},o.compilerOptions,t.compilerOptions)})}return t},g={cwd:process.cwd(),tsconfig:"./tsconfig.json",filenameVar:!0,dirnameVar:!0,ext:!0,unlink:!0,debug:function(){}},b=function(e,r){return f(e).reduce(function(e,t){var o,u,i=p(n.resolve(r,t)),c=null==i||null==(o=i.compilerOptions)?void 0:o.outDir,l=null==i||null==(u=i.compilerOptions)||null==u.module.toLowerCase?void 0:u.module.toLowerCase();return c&&l.startsWith("es")?e.push(c):console.warn("tsconfig should declare `outDir` and `module` type es6 or above"),e},[])},v=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)[ (])(["'])([^"']+\/[^"']+|\.)(["'])/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],l=[".js",".cjs",".mjs"].reduce(function(e,n){return c.forEach(function(r){return e.push(""+r+n,r+"/index"+n)}),e},[]);return l.find(function(e){return t.includes(m(n.resolve(u,e)))})||l.find(function(e){return t.includes(m(n.resolve(i,e)))})||r}(r,c,t,o)+l})},x=function(e){return e.replace(/__dirname/g,"/file:\\/\\/(.+)\\/[^/]/.exec(import.meta.url)[1]")},y=function(e){return e.replace(/__filename/g,"/file:\\/\\/(.+)/.exec(import.meta.url)[1]")},j=function(e){return 0===e.trim().length?"\nexport {}\nexport default undefined\n":e},_=function(e,n,r,t){var o=t.dirnameVar,u=t.filenameVar,i=t.fillBlank,c=e;return t.ext&&(c=h(c,n,r,t.cwd)),o&&(c=x(c)),u&&(c=y(c)),i&&(c=j(c)),c};e.DEFAULT_FIX_OPTIONS=g,e.fix=function(e){try{var r=function(e){return l({},g,e,{debug:"function"==typeof(null==e?void 0:e.debug)?e.debug:!0===(null==e?void 0:e.debug)?console.log:g.debug})}(e),o=r.cwd,u=r.target,c=r.src,p=r.tsconfig,h=r.out,x=r.ext,y=r.debug,j=r.unlink,w=n.resolve(o,void 0===h?o:h),F=f(c),O=[].concat(f(u),b(p,o));y("debug:cwd",o),y("debug:outdir",w),y("debug:sources",F),y("debug:targets",O);var P=F.length>0?F.map(function(e){return e+"/**/*.{ts,tsx}"}):O.map(function(e){return e+"/**/*.{js,d.ts}"});return Promise.resolve(t.globby(P,{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 a(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(n){y("debug:external-names",n);var t=[].concat(n,v(e,".js")),u="string"==typeof x?v(e,x):e,c=[].concat(n,u);y("debug:local-names",u),u.forEach(function(n,u){var l=n.endsWith("d.ts")?t:c,a=(0===F.length?n:e[u]).replace(m(o),m(w)),f=s(e[u]);!function(e,n){i.default.outputFileSync(e,n,{encoding:"utf8"})}(a,_(f,n,l,r)),0===F.length&&j&&o===w&&a!==e[u]&&d(e[u])})})})}catch(e){return Promise.reject(e)}},e.fixBlankFiles=j,e.fixContents=_,e.fixDirnameVar=x,e.fixFilenameExtensions=v,e.fixFilenameVar=y,e.fixModuleReferences=h}); | ||
//# sourceMappingURL=tsc-esm-fix.umd.js.map |
@@ -1,2 +0,2 @@ | ||
import { IFixOptions, IFixOptionsNormalized } from './interface'; | ||
import { IFixOptions, IFixOptionsNormalized } from './interface.js'; | ||
export declare const DEFAULT_FIX_OPTIONS: IFixOptionsNormalized; | ||
@@ -3,0 +3,0 @@ export declare const normalizeOptions: (opts?: IFixOptions) => IFixOptionsNormalized; |
@@ -1,2 +0,2 @@ | ||
export { fix, fixBlankFiles, fixContents, fixFilenameVar, fixDirnameVar, fixModuleReferences, fixFilenameExtensions, DEFAULT_FIX_OPTIONS, } from './fix'; | ||
export * from './interface'; | ||
export { fix, fixBlankFiles, fixContents, fixFilenameVar, fixDirnameVar, fixModuleReferences, fixFilenameExtensions, DEFAULT_FIX_OPTIONS, } from './fix.js'; | ||
export * from './interface.js'; |
/// <reference types="node" /> | ||
import fse from 'fs-extra'; | ||
import { globby } from 'globby'; | ||
import { TSConfig } from './interface'; | ||
import { TSConfig } from './interface.js'; | ||
export { globby }; | ||
@@ -6,0 +6,0 @@ export declare const read: (file: string) => string; |
@@ -80,3 +80,6 @@ import { Options as GlobbyOptions } from 'globby' | ||
export const fixFilenameExtensions = (names: string[], ext: string): string[] => | ||
names.map((name) => name.replace(/\.[^./\\]+$/, ext)) | ||
names.map((name) => | ||
name.endsWith('d.ts') | ||
? name | ||
: name.replace(/\.[^./\\]+$/, ext)) | ||
@@ -185,3 +188,3 @@ export const fixModuleReferences = ( | ||
? sources.map((src) => `${src}/**/*.{ts,tsx}`) | ||
: targets.map((target) => `${target}/**/*.js`) | ||
: targets.map((target) => `${target}/**/*.{js,d.ts}`) | ||
@@ -196,8 +199,10 @@ const names = await globby(patterns, { | ||
const _names = | ||
typeof ext === 'string' ? fixFilenameExtensions(names, ext) : names | ||
// NOTE d.ts may refer to .js ext only | ||
const allJsNames = [...externalNames, ...fixFilenameExtensions(names, '.js')] | ||
const _names = typeof ext === 'string' ? fixFilenameExtensions(names, ext) : names | ||
const allNames = [...externalNames, ..._names] | ||
debug('debug:local-names', _names) | ||
const allNames = [...externalNames, ..._names] | ||
_names.forEach((name, i) => { | ||
const all = name.endsWith('d.ts') ? allJsNames : allNames | ||
const nextName = (sources.length === 0 ? name : names[i]).replace( | ||
@@ -208,3 +213,3 @@ unixify(cwd), | ||
const contents = read(names[i]) | ||
const _contents = fixContents(contents, name, allNames, _opts) | ||
const _contents = fixContents(contents, name, all, _opts) | ||
@@ -211,0 +216,0 @@ write(nextName, _contents) |
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
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
114576
695
231