From 9686a8803e311d532c37fe919e0684feca91a04f Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Mon, 22 Apr 2024 17:07:36 +0200 Subject: feat: add jsx precompile skip element option (#23457) This PR wires up a new `jsxPrecompileSkipElements` option in `compilerOptions` that can be used to exempt a list of elements from being precompiled with the `precompile` JSX transform. --- tests/integration/run_tests.rs | 6 ++++++ tests/testdata/jsx/deno-jsx-precompile-skip.jsonc | 7 +++++++ tests/testdata/run/jsx_precompile/skip.out | 3 +++ tests/testdata/run/jsx_precompile/skip.tsx | 9 +++++++++ 4 files changed, 25 insertions(+) create mode 100644 tests/testdata/jsx/deno-jsx-precompile-skip.jsonc create mode 100644 tests/testdata/run/jsx_precompile/skip.out create mode 100644 tests/testdata/run/jsx_precompile/skip.tsx (limited to 'tests') diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index dfbebeaf1..c298e4f5b 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -2098,6 +2098,12 @@ itest!(jsx_import_source_precompile_import_map { http_server: true, }); +itest!(jsx_import_source_precompile_import_map_skip_element { + args: "run --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile-skip.jsonc run/jsx_precompile/skip.tsx", + output: "run/jsx_precompile/skip.out", + http_server: true, +}); + itest!(jsx_import_source_import_map { args: "run --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc run/jsx_import_source_no_pragma.tsx", output: "run/jsx_import_source_import_map.out", diff --git a/tests/testdata/jsx/deno-jsx-precompile-skip.jsonc b/tests/testdata/jsx/deno-jsx-precompile-skip.jsonc new file mode 100644 index 000000000..3c9e4fa1f --- /dev/null +++ b/tests/testdata/jsx/deno-jsx-precompile-skip.jsonc @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "precompile", + "jsxImportSource": "jsx-precompile", + "jsxPrecompileSkipElements": ["a", "img"] + } +} diff --git a/tests/testdata/run/jsx_precompile/skip.out b/tests/testdata/run/jsx_precompile/skip.out new file mode 100644 index 000000000..a32b616f0 --- /dev/null +++ b/tests/testdata/run/jsx_precompile/skip.out @@ -0,0 +1,3 @@ +Download http://localhost:4545/jsx/jsx-precompile/index.ts +Check file:///[WILDCARD]/run/jsx_precompile/skip.tsx +imported http://localhost:4545/jsx/jsx-precompile/index.ts diff --git a/tests/testdata/run/jsx_precompile/skip.tsx b/tests/testdata/run/jsx_precompile/skip.tsx new file mode 100644 index 000000000..49bc4e2b7 --- /dev/null +++ b/tests/testdata/run/jsx_precompile/skip.tsx @@ -0,0 +1,9 @@ +export function A() { + return ( +
+ foo +

hello

+ +
+ ); +} -- cgit v1.2.3