From 03a9861f13bac7082dd60eb50484a77bc87f44e5 Mon Sep 17 00:00:00 2001 From: Eren Bets <0x142857@gmail.com> Date: Wed, 17 Mar 2021 02:19:11 +0800 Subject: [PATCH 1/3] fix: get rid of text decoder --- src/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index c3dd8cfa..a6063961 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,8 +25,6 @@ import { parseArgsStringToArgv } from 'string-argv' import type { ChildProcess } from 'child_process' import execa from 'execa' -const textDecoder = new TextDecoder('utf-8') - export type Format = 'cjs' | 'esm' | 'iife' export type Options = { @@ -204,11 +202,11 @@ export async function runEsbuild( const ext = extname(outPath) const comeFromSource = ext === '.js' || ext === outExtension['.js'] await fs.promises.mkdir(dir, { recursive: true }) + let contents = file.text let mode: number | undefined - if (file.contents[0] === 35 && file.contents[1] === 33) { + if (contents[0] === '#' && contents[1] === '!') { mode = 0o755 } - let contents = textDecoder.decode(file.contents) if (comeFromSource) { if (options.babel) { const babel = getBabel() From 2f99aed1fa07da9a54c00b9e9dd27983aa2631c6 Mon Sep 17 00:00:00 2001 From: Eren Bets <0x142857@gmail.com> Date: Wed, 17 Mar 2021 02:25:32 +0800 Subject: [PATCH 2/3] test node 10 and 12 --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 745cca44..2803852b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [14.x] + node-version: [10.x, 12.x, 14.x] steps: - uses: actions/checkout@v2 From dd1149116c08f58234cef68c8698b822412d6d61 Mon Sep 17 00:00:00 2001 From: Eren Bets <0x142857@gmail.com> Date: Wed, 17 Mar 2021 02:29:17 +0800 Subject: [PATCH 3/3] remove node 10 --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 2803852b..64b43924 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [12.x, 14.x] steps: - uses: actions/checkout@v2