aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-webextension/babel.config-linaria.json5
-rw-r--r--packages/taler-wallet-webextension/package.json2
-rw-r--r--packages/taler-wallet-webextension/src/mui/Alert.tsx6
-rw-r--r--packages/taler-wallet-webextension/src/mui/Avatar.tsx2
-rw-r--r--packages/taler-wallet-webextension/src/mui/Menu.tsx2
-rw-r--r--packages/taler-wallet-webextension/trim-extension.cjs23
6 files changed, 32 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/babel.config-linaria.json b/packages/taler-wallet-webextension/babel.config-linaria.json
index a5cf7ba9e..dc9d579f3 100644
--- a/packages/taler-wallet-webextension/babel.config-linaria.json
+++ b/packages/taler-wallet-webextension/babel.config-linaria.json
@@ -25,5 +25,6 @@
{
"presets": [
"preact-cli/babel",
- ]
-} \ No newline at end of file
+ ],
+ "plugins": ["./trim-extension.cjs"],
+}
diff --git a/packages/taler-wallet-webextension/package.json b/packages/taler-wallet-webextension/package.json
index cd71d06fb..6bb2af34a 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -4,6 +4,7 @@
"description": "GNU Taler Wallet browser extension",
"main": "./build/index.js",
"types": "./build/index.d.ts",
+ "type": "module",
"author": "Florian Dold",
"license": "AGPL-3.0-or-later",
"private": false,
@@ -46,6 +47,7 @@
"@babel/core": "7.18.9",
"@babel/plugin-transform-modules-commonjs": "7.18.6",
"@babel/plugin-transform-react-jsx-source": "7.18.6",
+ "@babel/plugin-transform-typescript": "^7.20.13",
"@babel/preset-typescript": "7.18.6",
"@babel/runtime": "7.18.9",
"@gnu-taler/pogen": "workspace:*",
diff --git a/packages/taler-wallet-webextension/src/mui/Alert.tsx b/packages/taler-wallet-webextension/src/mui/Alert.tsx
index b78a9af0e..d44472ca5 100644
--- a/packages/taler-wallet-webextension/src/mui/Alert.tsx
+++ b/packages/taler-wallet-webextension/src/mui/Alert.tsx
@@ -23,11 +23,9 @@ import InfoOutlinedIcon from "../svg/info_outlined_24px.svg";
import ReportProblemOutlinedIcon from "../svg/report_problem_outlined_24px.svg";
import SuccessOutlinedIcon from "../svg/success_outlined_24px.svg";
import { IconButton } from "./Button.js";
-// eslint-disable-next-line import/extensions
-import { darken, lighten } from "./colors/manipulation";
+import { darken, lighten } from "./colors/manipulation.js";
import { Paper } from "./Paper.js";
-// eslint-disable-next-line import/extensions
-import { theme } from "./style";
+import { theme } from "./style.jsx";
import { Typography } from "./Typography.js";
const defaultIconMapping = {
diff --git a/packages/taler-wallet-webextension/src/mui/Avatar.tsx b/packages/taler-wallet-webextension/src/mui/Avatar.tsx
index 14ec1ae9b..b6e37d2ce 100644
--- a/packages/taler-wallet-webextension/src/mui/Avatar.tsx
+++ b/packages/taler-wallet-webextension/src/mui/Avatar.tsx
@@ -16,7 +16,7 @@
import { css } from "@linaria/core";
import { h, JSX, VNode, ComponentChildren } from "preact";
// eslint-disable-next-line import/extensions
-import { theme } from "./style";
+import { theme } from "./style.jsx";
const root = css`
position: relative;
diff --git a/packages/taler-wallet-webextension/src/mui/Menu.tsx b/packages/taler-wallet-webextension/src/mui/Menu.tsx
index 941abfee4..dd8266931 100644
--- a/packages/taler-wallet-webextension/src/mui/Menu.tsx
+++ b/packages/taler-wallet-webextension/src/mui/Menu.tsx
@@ -19,7 +19,7 @@ import { buttonBaseStyle } from "./Button.js";
import { alpha } from "./colors/manipulation.js";
import { Paper } from "./Paper.js";
// eslint-disable-next-line import/extensions
-import { Colors, ripple, theme } from "./style";
+import { Colors, ripple, theme } from "./style.js";
interface Props {
children: ComponentChildren;
diff --git a/packages/taler-wallet-webextension/trim-extension.cjs b/packages/taler-wallet-webextension/trim-extension.cjs
new file mode 100644
index 000000000..4305e792b
--- /dev/null
+++ b/packages/taler-wallet-webextension/trim-extension.cjs
@@ -0,0 +1,23 @@
+// Simple plugin to trim extensions from the filename of relative import statements.
+// Required to get linaria to work with `moduleResulution: "Node16"` imports.
+// @author Florian Dold
+module.exports = function({ types: t }) {
+ return {
+ name: "trim-extension",
+ visitor: {
+ ImportDeclaration: (x) => {
+ const src = x.node.source;
+ if (src.value.startsWith("./")) {
+ if (src.value.endsWith(".js")) {
+ const newVal = src.value.replace(/[.]js$/, "")
+ x.node.source = t.stringLiteral(newVal);
+ }
+ }
+ if (src.value.endsWith(".jsx")) {
+ const newVal = src.value.replace(/[.]jsx$/, "")
+ x.node.source = t.stringLiteral(newVal);
+ }
+ },
+ }
+ };
+}