esbuild-wasm
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -5,9 +5,29 @@ const child_process = require('child_process'); | ||
function binPath() { | ||
// This file is used for both the "esbuild" package and the "esbuild-wasm" | ||
// package. The publishing script copies this file into the "esbuild-wasm" | ||
// package and then sets this variable to true. | ||
const WASM = true; | ||
function esbuildSpawn({ flags, stdio }) { | ||
if ((process.platform === 'linux' || process.platform === 'darwin') && os.arch() === 'x64') { | ||
return path.join(__dirname, '..', 'bin', 'esbuild'); | ||
return child_process.spawn(path.join(__dirname, '..', 'bin', 'esbuild'), flags, { | ||
cwd: process.cwd(), | ||
stdio, | ||
}); | ||
} | ||
if (process.platform === 'win32' && os.arch() === 'x64') { | ||
return path.join(__dirname, '..', '.install', 'node_modules', 'esbuild-windows-64', 'esbuild.exe'); | ||
if (WASM) { | ||
return child_process.spawn(['node'], [path.join(__dirname, '..', 'bin', 'esbuild')].concat(flags), { | ||
cwd: process.cwd(), | ||
windowsHide: true, | ||
stdio, | ||
}); | ||
} else { | ||
return child_process.spawn(path.join(__dirname, '..', 'esbuild.exe'), flags, { | ||
cwd: process.cwd(), | ||
windowsHide: true, | ||
stdio, | ||
}); | ||
} | ||
} | ||
@@ -63,3 +83,3 @@ | ||
const child = child_process.spawn(binPath(), flags, { cwd: process.cwd(), windowsHide: true, stdio }); | ||
const child = esbuildSpawn({ flags, stdio }); | ||
child.on('error', error => reject(error)); | ||
@@ -109,4 +129,4 @@ | ||
return new Promise((resolve, reject) => { | ||
const child = child_process.spawn(binPath(), ['--service'], { | ||
windowsHide: true, | ||
const child = esbuildSpawn({ | ||
flags: ['--service'], | ||
stdio: ['pipe', 'pipe', 'inherit'], | ||
@@ -265,4 +285,4 @@ }); | ||
}, | ||
})); | ||
}), error => reject(error)); | ||
}); | ||
}; |
{ | ||
"name": "esbuild-wasm", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/evanw/esbuild", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4499979
1152