mirror of
https://github.com/egoist/tsup.git
synced 2025-12-08 20:35:58 +00:00
16 lines
308 B
TypeScript
16 lines
308 B
TypeScript
import { Plugin } from '../plugin'
|
|
|
|
export const shebang = (): Plugin => {
|
|
return {
|
|
name: 'shebang',
|
|
|
|
renderChunk(_, info) {
|
|
if (info.type === 'chunk' && /\.(cjs|js|mjs)$/.test(info.path)) {
|
|
if (info.code.startsWith('#!')) {
|
|
info.mode = 0o755
|
|
}
|
|
}
|
|
},
|
|
}
|
|
}
|