update web-utils imports

This commit is contained in:
Sebastian 2023-05-05 08:36:48 -03:00
parent d61e4fa719
commit e90991973c
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
42 changed files with 71 additions and 65 deletions

View File

@ -15,7 +15,13 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { buildProd } from "@gnu-taler/web-util/lib/index.build" import { build } from "@gnu-taler/web-util/build";
await buildProd(["src/index.tsx"]) await build({
source: {
js: ["src/index.tsx"],
assets: ["src/index.html"],
},
destination: "./dist/prod",
css: "sass",
});

View File

@ -15,21 +15,26 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { serve } from "@gnu-taler/web-util/lib/index.node"; import { serve } from "@gnu-taler/web-util/node";
import { initializeDev, getFilesInSource } from "@gnu-taler/web-util/lib/index.build" import { initializeDev, getFilesInDirectory } from "@gnu-taler/web-util/build";
const allTestFiles = getFilesInSource(/.test.tsx?$/); const allTestFiles = getFilesInDirectory("src", /.test.tsx?$/);
const devEntryPoints = ["src/stories.tsx", "src/index.tsx", ...allTestFiles]; const devEntryPoints = ["src/stories.tsx", "src/index.tsx", ...allTestFiles];
const buildDev = initializeDev(devEntryPoints) const build = initializeDev({
source: {
js: devEntryPoints,
assets: ["src/index.html"],
},
destination: "./dist/dev",
css: "sass",
});
await buildDev(); await build();
serve({ serve({
folder: './dist/dev', folder: "./dist/dev",
port: 8080, port: 8080,
source: './src', source: "./src",
insecure: true, onSourceUpdate: build,
development: true, });
onUpdate: buildDev
})

View File

@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { HttpError, utils } from "@gnu-taler/web-util/lib/index.browser"; import { HttpError, utils } from "@gnu-taler/web-util/browser";
import { Loading } from "../Loading.js"; import { Loading } from "../Loading.js";
// import { compose, StateViewMap } from "../../utils/index.js"; // import { compose, StateViewMap } from "../../utils/index.js";
// import { wxApi } from "../../wxApi.js"; // import { wxApi } from "../../wxApi.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { ReadyView } from "./views.js"; import { ReadyView } from "./views.js";
export default { export default {

View File

@ -19,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { SwrMockEnvironment } from "@gnu-taler/web-util/lib/tests/swr"; import { SwrMockEnvironment } from "@gnu-taler/web-util/testing";
import { expect } from "chai"; import { expect } from "chai";
import { CASHOUT_API_EXAMPLE } from "../../endpoints.js"; import { CASHOUT_API_EXAMPLE } from "../../endpoints.js";
import { Props } from "./index.js"; import { Props } from "./index.js";

View File

@ -15,7 +15,7 @@
*/ */
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { State } from "./index.js"; import { State } from "./index.js";
import { format } from "date-fns"; import { format } from "date-fns";
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";

View File

@ -15,7 +15,7 @@
*/ */
import { Loading } from "../../components/Loading.js"; import { Loading } from "../../components/Loading.js";
import { HookError, utils } from "@gnu-taler/web-util/lib/index.browser"; import { HookError, utils } from "@gnu-taler/web-util/browser";
//import { compose, StateViewMap } from "../../utils/index.js"; //import { compose, StateViewMap } from "../../utils/index.js";
//import { wxApi } from "../../wxApi.js"; //import { wxApi } from "../../wxApi.js";
import { useComponentState } from "./state.js"; import { useComponentState } from "./state.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { ReadyView } from "./views.js"; import { ReadyView } from "./views.js";
export default { export default {

View File

@ -15,7 +15,7 @@
*/ */
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { State } from "./index.js"; import { State } from "./index.js";
export function LoadingUriView({ error }: State.LoadingUriError): VNode { export function LoadingUriView({ error }: State.LoadingUriError): VNode {

View File

@ -21,7 +21,7 @@
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { strings as messages } from "../i18n/strings.js"; import { strings as messages } from "../i18n/strings.js";
type LangsNames = { type LangsNames = {

View File

@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { HttpError, utils } from "@gnu-taler/web-util/lib/index.browser"; import { HttpError, utils } from "@gnu-taler/web-util/browser";
import { Loading } from "../Loading.js"; import { Loading } from "../Loading.js";
// import { compose, StateViewMap } from "../../utils/index.js"; // import { compose, StateViewMap } from "../../utils/index.js";
// import { wxApi } from "../../wxApi.js"; // import { wxApi } from "../../wxApi.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { ReadyView } from "./views.js"; import { ReadyView } from "./views.js";
export default { export default {

View File

@ -19,8 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { ErrorType, tests } from "@gnu-taler/web-util/lib/index.browser"; import { ErrorType } from "@gnu-taler/web-util/browser";
import { SwrMockEnvironment } from "@gnu-taler/web-util/lib/tests/swr"; import * as tests from "@gnu-taler/web-util/testing";
import { SwrMockEnvironment } from "@gnu-taler/web-util/testing";
import { expect } from "chai"; import { expect } from "chai";
import { TRANSACTION_API_EXAMPLE } from "../../endpoints.js"; import { TRANSACTION_API_EXAMPLE } from "../../endpoints.js";
import { Props } from "./index.js"; import { Props } from "./index.js";

View File

@ -15,7 +15,7 @@
*/ */
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { State } from "./index.js"; import { State } from "./index.js";
import { format } from "date-fns"; import { format } from "date-fns";
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";

View File

@ -18,7 +18,7 @@ import {
globalLogLevel, globalLogLevel,
setGlobalLogLevelFromString, setGlobalLogLevelFromString,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { TranslationProvider } from "@gnu-taler/web-util/lib/index.browser"; import { TranslationProvider } from "@gnu-taler/web-util/browser";
import { FunctionalComponent, h } from "preact"; import { FunctionalComponent, h } from "preact";
import { SWRConfig } from "swr"; import { SWRConfig } from "swr";
import { BackendStateProvider } from "../context/backend.js"; import { BackendStateProvider } from "../context/backend.js";

View File

@ -19,7 +19,7 @@ import {
HttpResponseOk, HttpResponseOk,
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";
import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils.js"; import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils.js";

View File

@ -20,13 +20,13 @@ import {
HttpError, HttpError,
RequestError, RequestError,
useLocalStorage, useLocalStorage,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { import {
HttpResponse, HttpResponse,
HttpResponseOk, HttpResponseOk,
RequestOptions, RequestOptions,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useApiContext } from "@gnu-taler/web-util/lib/index.browser"; import { useApiContext } from "@gnu-taler/web-util/browser";
import { useCallback, useEffect, useState } from "preact/hooks"; import { useCallback, useEffect, useState } from "preact/hooks";
import { useSWRConfig } from "swr"; import { useSWRConfig } from "swr";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";

View File

@ -20,7 +20,7 @@ import {
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
useApiContext, useApiContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useEffect, useMemo, useState } from "preact/hooks"; import { useEffect, useMemo, useState } from "preact/hooks";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";
import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils.js"; import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils.js";

View File

@ -20,7 +20,7 @@
*/ */
import { StateUpdater } from "preact/hooks"; import { StateUpdater } from "preact/hooks";
import { useLocalStorage } from "@gnu-taler/web-util/lib/index.browser"; import { useLocalStorage } from "@gnu-taler/web-util/browser";
export type ValueOrFunction<T> = T | ((p: T) => T); export type ValueOrFunction<T> = T | ((p: T) => T);
const calculateRootPath = () => { const calculateRootPath = () => {

View File

@ -1,5 +1,5 @@
import { TranslatedString } from "@gnu-taler/taler-util"; import { TranslatedString } from "@gnu-taler/taler-util";
import { memoryMap } from "@gnu-taler/web-util/lib/index.browser"; import { memoryMap } from "@gnu-taler/web-util/browser";
import { StateUpdater, useEffect, useState } from "preact/hooks"; import { StateUpdater, useEffect, useState } from "preact/hooks";
export type NotificationMessage = ErrorNotification | InfoNotification; export type NotificationMessage = ErrorNotification | InfoNotification;

View File

@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { useLocalStorage } from "@gnu-taler/web-util/lib/index.browser"; import { useLocalStorage } from "@gnu-taler/web-util/browser";
interface Settings { interface Settings {
currentWithdrawalOperationId: string | undefined; currentWithdrawalOperationId: string | undefined;

View File

@ -19,7 +19,7 @@ import {
ErrorType, ErrorType,
HttpResponsePaginated, HttpResponsePaginated,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { Transactions } from "../components/Transactions/index.js"; import { Transactions } from "../components/Transactions/index.js";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";

View File

@ -20,7 +20,7 @@ import {
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Cashouts } from "../components/Cashouts/index.js"; import { Cashouts } from "../components/Cashouts/index.js";

View File

@ -15,7 +15,7 @@
*/ */
import { Logger, TranslatedString } from "@gnu-taler/taler-util"; import { Logger, TranslatedString } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { ComponentChildren, Fragment, h, VNode } from "preact"; import { ComponentChildren, Fragment, h, VNode } from "preact";
import { StateUpdater, useEffect, useState } from "preact/hooks"; import { StateUpdater, useEffect, useState } from "preact/hooks";
import talerLogo from "../assets/logo-white.svg"; import talerLogo from "../assets/logo-white.svg";

View File

@ -24,7 +24,7 @@ import {
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { StateUpdater, useEffect, useState } from "preact/hooks"; import { StateUpdater, useEffect, useState } from "preact/hooks";
import { Cashouts } from "../components/Cashouts/index.js"; import { Cashouts } from "../components/Cashouts/index.js";

View File

@ -25,7 +25,7 @@ import {
HttpResponse, HttpResponse,
HttpResponsePaginated, HttpResponsePaginated,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { Loading } from "../components/Loading.js"; import { Loading } from "../components/Loading.js";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";

View File

@ -15,10 +15,7 @@
*/ */
import { HttpStatusCode } from "@gnu-taler/taler-util"; import { HttpStatusCode } from "@gnu-taler/taler-util";
import { import { ErrorType, useTranslationContext } from "@gnu-taler/web-util/browser";
ErrorType,
useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { useEffect, useRef, useState } from "preact/hooks"; import { useEffect, useRef, useState } from "preact/hooks";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { PaymentOptions } from "./PaymentOptions.js"; import { PaymentOptions } from "./PaymentOptions.js";
export default { export default {

View File

@ -15,7 +15,7 @@
*/ */
import { AmountJson } from "@gnu-taler/taler-util"; import { AmountJson } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { notifyInfo } from "../hooks/notification.js"; import { notifyInfo } from "../hooks/notification.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { PaytoWireTransferForm } from "./PaytoWireTransferForm.js"; import { PaytoWireTransferForm } from "./PaytoWireTransferForm.js";
export default { export default {

View File

@ -26,7 +26,7 @@ import {
import { import {
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useEffect, useRef, useState } from "preact/hooks"; import { useEffect, useRef, useState } from "preact/hooks";
import { notifyError } from "../hooks/notification.js"; import { notifyError } from "../hooks/notification.js";

View File

@ -15,7 +15,7 @@
*/ */
import { Logger } from "@gnu-taler/taler-util"; import { Logger } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Transactions } from "../components/Transactions/index.js"; import { Transactions } from "../components/Transactions/index.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { QrCodeSection } from "./QrCodeSection.js"; import { QrCodeSection } from "./QrCodeSection.js";
import { parseWithdrawUri } from "@gnu-taler/taler-util"; import { parseWithdrawUri } from "@gnu-taler/taler-util";

View File

@ -22,7 +22,7 @@ import {
import { import {
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useEffect } from "preact/hooks"; import { useEffect } from "preact/hooks";
import { QR } from "../components/QR.js"; import { QR } from "../components/QR.js";

View File

@ -17,7 +17,7 @@ import { HttpStatusCode, Logger } from "@gnu-taler/taler-util";
import { import {
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";

View File

@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { createHashHistory } from "history"; import { createHashHistory } from "history";
import { VNode, h } from "preact"; import { VNode, h } from "preact";
import { Route, Router, route } from "preact-router"; import { Route, Router, route } from "preact-router";

View File

@ -24,7 +24,7 @@ import {
import { import {
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { VNode, h } from "preact"; import { VNode, h } from "preact";
import { useEffect, useRef, useState } from "preact/hooks"; import { useEffect, useRef, useState } from "preact/hooks";
import { useAccessAPI } from "../hooks/access.js"; import { useAccessAPI } from "../hooks/access.js";

View File

@ -22,7 +22,7 @@ import {
import { import {
RequestError, RequestError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { useMemo, useState } from "preact/hooks"; import { useMemo, useState } from "preact/hooks";
import { useAccessAnonAPI } from "../hooks/access.js"; import { useAccessAnonAPI } from "../hooks/access.js";

View File

@ -19,10 +19,7 @@ import {
Logger, Logger,
WithdrawUriResult, WithdrawUriResult,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import { ErrorType, useTranslationContext } from "@gnu-taler/web-util/browser";
ErrorType,
useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser";
import { Fragment, VNode, h } from "preact"; import { Fragment, VNode, h } from "preact";
import { Loading } from "../components/Loading.js"; import { Loading } from "../components/Loading.js";
import { useWithdrawalDetails } from "../hooks/access.js"; import { useWithdrawalDetails } from "../hooks/access.js";

View File

@ -19,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { setupI18n } from "@gnu-taler/taler-util"; import { setupI18n } from "@gnu-taler/taler-util";
import { parseGroupImport, tests } from "@gnu-taler/web-util/lib/index.browser"; import { parseGroupImport } from "@gnu-taler/web-util/browser";
import * as tests from "@gnu-taler/web-util/testing";
import * as components from "./components/index.examples.js"; import * as components from "./components/index.examples.js";
import * as pages from "./pages/index.stories.js"; import * as pages from "./pages/index.stories.js";

View File

@ -23,7 +23,7 @@ import { strings } from "./i18n/strings.js";
import * as pages from "./pages/index.stories.js"; import * as pages from "./pages/index.stories.js";
import * as components from "./components/index.examples.js"; import * as components from "./components/index.examples.js";
import { renderStories } from "@gnu-taler/web-util/lib/index.browser"; import { renderStories } from "@gnu-taler/web-util/browser";
import "./scss/main.scss"; import "./scss/main.scss";

View File

@ -19,7 +19,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { ErrorMessage } from "./hooks/notification.js"; import { ErrorMessage } from "./hooks/notification.js";
/** /**