From f1d3a170430501b4fab1a2d2abb5d77528251c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 5 Oct 2021 01:35:55 +0200 Subject: feat: add --compat flag to provide built-in Node modules (#12293) This commit adds "--compat" flag. When the flag is passed a set of mappings for built-in Node modules is injected into the import map. If user doesn't explicitly provide an import map (using "--import-map" flag) then a map is created on the fly. If there are already existing mappings in import map that would clash with built-in Node modules a set of diagnostics is printed to the terminal with suggestions how to proceed. --- cli/tests/integration/compat_tests.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cli/tests/integration/compat_tests.rs (limited to 'cli/tests/integration/compat_tests.rs') diff --git a/cli/tests/integration/compat_tests.rs b/cli/tests/integration/compat_tests.rs new file mode 100644 index 000000000..4d93d370d --- /dev/null +++ b/cli/tests/integration/compat_tests.rs @@ -0,0 +1,14 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +use crate::itest; + +itest!(fs_promises { + args: "run --compat --unstable -A compat/fs_promises.js", + output: "compat/fs_promises.out", +}); + +itest!(existing_import_map { + args: "run --compat --import-map compat/existing_import_map.json compat/fs_promises.js", + output: "compat/existing_import_map.out", + exit_code: 1, +}); -- cgit v1.2.3