tsup/src/plugins/shebang.ts
三咲智子 Kevin Deng e8c6079cdf
refactor: lint
eslint --fix by @sxzz/eslint-config

- add `node:` protocol
- sort imports
- ...
2024-07-17 23:46:22 +08:00

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
}
},
}
}