Skip to content

Commit c353d20

Browse files
Merge branch 'develop'
2 parents 33e7cab + aa47dc2 commit c353d20

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
# Changing version will trigger a new release!
66
# Please make the version change as the last step of your development.
7-
__version__ = "1.32.0"
7+
__version__ = "1.33.0"
88
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/workflows/nodejs_npm_esbuild/esbuild.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ def run(self, args, cwd=None):
101101

102102
NON_CONFIGURABLE_VALUES = {"bundle", "platform", "outdir"}
103103

104+
# Ignore the values below. These are options that Lambda Builders accepts for
105+
# Node.js related workflows, but are not relevant to esbuild itself.
106+
ESBUILD_IGNORE_VALUES = {"use_npm_ci", "entry_points"}
107+
104108

105109
class EsbuildCommandBuilder:
106110
ENTRY_POINTS = "entry_points"
@@ -142,8 +146,7 @@ def build_esbuild_args_from_config(self) -> "EsbuildCommandBuilder":
142146
config_value,
143147
)
144148
continue
145-
if config_key == "entry_points":
146-
# Entry points are a required parameter and are handled by the build_entry_points() method
149+
if config_key in ESBUILD_IGNORE_VALUES:
147150
continue
148151
configuration_type_callback = self._get_config_type_callback(config_value)
149152
LOG.debug("Configuring the parameter '%s=%s'", config_key, config_value)

requirements/dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
coverage==7.2.5
1+
coverage==7.2.6
22
flake8==3.3.0; python_version < '3.8'
33
flake8==3.8.4; python_version >= '3.8'
4-
pytest-cov==4.0.0
4+
pytest-cov==4.1.0
55

66
isort>=4.2.5,<5; python_version < '3.8'
77

@@ -12,4 +12,4 @@ pyelftools~=0.29 # Used to verify the generated Go binary architecture in integr
1212

1313
# formatter
1414
black==23.3.0
15-
ruff==0.0.269
15+
ruff==0.0.270

tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,24 @@ def test_esbuild_can_build_in_source_with_local_dependency(self, runtime):
491491
expected_files = {"included.js"}
492492
output_files = set(os.listdir(self.artifacts_dir))
493493
self.assertEqual(expected_files, output_files)
494+
495+
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
496+
def test_builds_javascript_project_ignoring_relevant_flags(self, runtime):
497+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild")
498+
499+
options = {"entry_points": ["included.js"], "use_npm_ci": True}
500+
501+
self.builder.build(
502+
source_dir,
503+
self.artifacts_dir,
504+
self.scratch_dir,
505+
os.path.join(source_dir, "package.json"),
506+
runtime=runtime,
507+
options=options,
508+
experimental_flags=[],
509+
executable_search_paths=[self.binpath],
510+
)
511+
512+
expected_files = {"included.js"}
513+
output_files = set(os.listdir(self.artifacts_dir))
514+
self.assertEqual(expected_files, output_files)

tests/unit/workflows/nodejs_npm_esbuild/test_actions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,30 @@ def test_building_with_skip_deps_fails_if_esbuild_version_less_than_minimum(
329329
with self.assertRaises(ActionFailedError):
330330
action.execute()
331331

332+
def test_packages_javascript_ignoring_non_relevant_flags(self):
333+
action = EsbuildBundleAction(
334+
"source",
335+
"artifacts",
336+
{"entry_points": ["x.js"], "use_npm_ci": True},
337+
self.osutils,
338+
self.subprocess_esbuild,
339+
"package.json",
340+
)
341+
action.execute()
342+
343+
self.subprocess_esbuild.run.assert_called_with(
344+
[
345+
"x.js",
346+
"--bundle",
347+
"--platform=node",
348+
"--outdir=artifacts",
349+
"--target=es2020",
350+
"--format=cjs",
351+
"--minify",
352+
],
353+
cwd="source",
354+
)
355+
332356

333357
class TestEsbuildVersionChecker(TestCase):
334358
@parameterized.expand(["0.14.0", "0.0.0", "0.14.12"])

0 commit comments

Comments
 (0)