From 211b3ff244c33908f0e8c633e773a098bfee8eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 29 Feb 2024 11:54:57 +0000 Subject: fix(publish): print a warning when .jsx or .tsx is imported (#22631) This commit adds a warning when .jsx or .tsx is encountered during publishing. This is a stop-gap solution before we fix it proper. --- tests/testdata/publish/unsupported_jsx_tsx/foo.jsx | 5 +++++ tests/testdata/publish/unsupported_jsx_tsx/foo.tsx | 5 +++++ tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc | 11 +++++++++++ tests/testdata/publish/unsupported_jsx_tsx/mod.out | 17 +++++++++++++++++ tests/testdata/publish/unsupported_jsx_tsx/mod.ts | 7 +++++++ 5 files changed, 45 insertions(+) create mode 100644 tests/testdata/publish/unsupported_jsx_tsx/foo.jsx create mode 100644 tests/testdata/publish/unsupported_jsx_tsx/foo.tsx create mode 100644 tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc create mode 100644 tests/testdata/publish/unsupported_jsx_tsx/mod.out create mode 100644 tests/testdata/publish/unsupported_jsx_tsx/mod.ts (limited to 'tests/testdata/publish') diff --git a/tests/testdata/publish/unsupported_jsx_tsx/foo.jsx b/tests/testdata/publish/unsupported_jsx_tsx/foo.jsx new file mode 100644 index 000000000..021c2d49e --- /dev/null +++ b/tests/testdata/publish/unsupported_jsx_tsx/foo.jsx @@ -0,0 +1,5 @@ +import { renderToString } from "npm:preact-render-to-string"; + +export default function render() { + return renderToString(
foo.tsx
); +} diff --git a/tests/testdata/publish/unsupported_jsx_tsx/foo.tsx b/tests/testdata/publish/unsupported_jsx_tsx/foo.tsx new file mode 100644 index 000000000..021c2d49e --- /dev/null +++ b/tests/testdata/publish/unsupported_jsx_tsx/foo.tsx @@ -0,0 +1,5 @@ +import { renderToString } from "npm:preact-render-to-string"; + +export default function render() { + return renderToString(
foo.tsx
); +} diff --git a/tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc b/tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc new file mode 100644 index 000000000..7aea08842 --- /dev/null +++ b/tests/testdata/publish/unsupported_jsx_tsx/jsr.jsonc @@ -0,0 +1,11 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "npm:preact" + } +} diff --git a/tests/testdata/publish/unsupported_jsx_tsx/mod.out b/tests/testdata/publish/unsupported_jsx_tsx/mod.out new file mode 100644 index 000000000..5f085fb33 --- /dev/null +++ b/tests/testdata/publish/unsupported_jsx_tsx/mod.out @@ -0,0 +1,17 @@ +[WILDCARD] +Check file:///[WILDCARD]/publish/unsupported_jsx_tsx/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/publish/unsupported_jsx_tsx/mod.ts +warning[unsupported-jsx-tsx]: JSX and TSX files are currently not supported + --> [WILDCARD]foo.jsx + + info: follow https://github.com/jsr-io/jsr/issues/24 for updates + +warning[unsupported-jsx-tsx]: JSX and TSX files are currently not supported + --> [WILDCARD]foo.tsx + + info: follow https://github.com/jsr-io/jsr/issues/24 for updates + +Publishing @foo/bar@1.0.0 ... +Successfully published @foo/bar@1.0.0 +Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details diff --git a/tests/testdata/publish/unsupported_jsx_tsx/mod.ts b/tests/testdata/publish/unsupported_jsx_tsx/mod.ts new file mode 100644 index 000000000..4631a829d --- /dev/null +++ b/tests/testdata/publish/unsupported_jsx_tsx/mod.ts @@ -0,0 +1,7 @@ +import fooTsx from "./foo.tsx"; +import fooJsx from "./foo.jsx"; + +export function renderTsxJsx() { + console.log(fooTsx()); + console.log(fooJsx()); +} -- cgit v1.2.3