tshy
Version:
TypeScript HYbridizer - Hybrid (CommonJS/ESM) TypeScript node package builder
19 lines • 750 B
JavaScript
// rewrite package.json sideEffects for the built dialect folders
// strip the ./src/ and turn ts extension into js for built paths,
// mirroring the behavior of built-imports. boolean values and paths
// that don't point into ./src/ are left alone.
export default (pkg) => {
const { sideEffects } = pkg;
if (sideEffects === undefined)
return undefined;
if (typeof sideEffects === 'boolean')
return sideEffects;
return sideEffects.map(v => typeof v === 'string' && v.startsWith('./src/') ?
'./' +
v
.substring('./src/'.length)
.replace(/\.([cm]?)ts$/, '.$1js')
.replace(/\.tsx$/, '.js')
: v);
};
//# sourceMappingURL=built-side-effects.js.map