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