From 41f618a1df6bb8c66d7968ac64456139b9f4c197 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 17 May 2023 17:38:50 -0400 Subject: fix(npm): improved optional dependency support (#19135) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: If the package information has already been cached, then this requires running with `--reload` or for the registry information to be fetched some other way (ex. the cache busting). Closes #15544 --------- Co-authored-by: Bartek IwaƄczuk --- .../npm/registry/@denotest/binary-package/1.0.0/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 cli/tests/testdata/npm/registry/@denotest/binary-package/1.0.0/index.js (limited to 'cli/tests/testdata/npm/registry/@denotest/binary-package/1.0.0/index.js') diff --git a/cli/tests/testdata/npm/registry/@denotest/binary-package/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/binary-package/1.0.0/index.js new file mode 100644 index 000000000..5870118e7 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/binary-package/1.0.0/index.js @@ -0,0 +1,13 @@ +const packageByOs = { + "darwin": "@denotest/binary-package-mac", + "linux": "@denotest/binary-package-linux", + "win32": "@denotest/binary-package-windows", +} + +const selectedPackage = packageByOs[process.platform]; + +if (!selectedPackage) { + throw new Error("trying to run on unsupported platform"); +} + +require(selectedPackage); \ No newline at end of file -- cgit v1.2.3