-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(esbuild): add max_threads setting to limit number of threads used
- Loading branch information
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
load("//:index.bzl", "generated_file_test", "nodejs_binary", "npm_package_bin") | ||
load("//packages/esbuild/test:tests.bzl", "esbuild") | ||
|
||
esbuild( | ||
name = "bundle", | ||
# JS sources can be set directly on the esbuild rule | ||
srcs = [ | ||
"env.js", | ||
"main.js", | ||
], | ||
entry_point = "main.js", | ||
# Setting this to test the code path | ||
# This isn't needed for this bundle to run | ||
max_threads = 1, | ||
platform = "node", | ||
) | ||
|
||
nodejs_binary( | ||
name = "bin", | ||
data = [ | ||
":bundle", | ||
], | ||
entry_point = "bundle.js", | ||
) | ||
|
||
npm_package_bin( | ||
name = "runner", | ||
env = { | ||
"ESBUILD_TEST": "YES", | ||
}, | ||
stdout = "out.txt", | ||
tool = ":bin", | ||
) | ||
|
||
generated_file_test( | ||
name = "test", | ||
src = "out.golden.txt", | ||
generated = "out.txt", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function getEnvVars() { | ||
return process.env; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const {get} = require('https'); | ||
const {getEnvVars} = require('./env'); | ||
|
||
const ESBUILD_TEST = getEnvVars().ESBUILD_TEST; | ||
|
||
console.log(`ESBUILD_TEST=${ESBUILD_TEST}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ESBUILD_TEST=YES |