Ship /src/lib in ESM for enabeling dynamic imports
This commit is contained in:
@ -4,7 +4,7 @@ import type { KcProps } from "./KcProps";
|
||||
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
||||
import { getMsg } from "../i18n";
|
||||
import { headInsert } from "../tools/headInsert";
|
||||
import { pathJoin } from "../tools/pathJoin";
|
||||
import { pathJoin } from "../../bin/tools/pathJoin";
|
||||
import { useCssAndCx } from "tss-react";
|
||||
|
||||
const LoginOtp = memo(({ kcContext, ...props }: { kcContext: KcContextBase.LoginOtp } & KcProps) => {
|
||||
|
@ -6,7 +6,7 @@ import type { KcContextBase } from "../getKcContext/KcContextBase";
|
||||
import { assert } from "../tools/assert";
|
||||
import { useCallbackFactory } from "powerhooks/useCallbackFactory";
|
||||
import { headInsert } from "../tools/headInsert";
|
||||
import { pathJoin } from "../tools/pathJoin";
|
||||
import { pathJoin } from "../../bin/tools/pathJoin";
|
||||
import { useConstCallback } from "powerhooks/useConstCallback";
|
||||
import type { KcTemplateProps } from "./KcProps";
|
||||
import { useCssAndCx } from "tss-react";
|
||||
|
@ -7,9 +7,9 @@ import { exclude } from "tsafe/exclude";
|
||||
import { assert } from "tsafe/assert";
|
||||
import type { ExtendsKcContextBase } from "./getKcContextFromWindow";
|
||||
import { getKcContextFromWindow } from "./getKcContextFromWindow";
|
||||
import { pathJoin } from "../tools/pathJoin";
|
||||
import { pathJoin } from "../../bin/tools/pathJoin";
|
||||
import { pathBasename } from "../tools/pathBasename";
|
||||
import { resourcesCommonPath } from "./kcContextMocks/urlResourcesPath";
|
||||
import { resourcesCommonPath } from "../../bin/urlResourcesPath";
|
||||
|
||||
export function getKcContext<KcContextExtended extends { pageId: string } = never>(params?: {
|
||||
mockPageId?: ExtendsKcContextBase<KcContextExtended>["pageId"];
|
||||
|
@ -1,9 +1,9 @@
|
||||
import "minimal-polyfills/Object.fromEntries";
|
||||
import type { KcContextBase, Attribute } from "../KcContextBase";
|
||||
//NOTE: Aside because we want to be able to import them from node
|
||||
import { resourcesCommonPath, resourcesPath } from "./urlResourcesPath";
|
||||
import { resourcesCommonPath, resourcesPath } from "../../../bin/urlResourcesPath";
|
||||
import { id } from "tsafe/id";
|
||||
import { pathJoin } from "../../tools/pathJoin";
|
||||
import { pathJoin } from "../../../bin/tools/pathJoin";
|
||||
|
||||
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
import { pathJoin } from "../../tools/pathJoin";
|
||||
|
||||
export const subDirOfPublicDirBasename = "keycloak_static";
|
||||
export const resourcesPath = pathJoin(subDirOfPublicDirBasename, "resources");
|
||||
export const resourcesCommonPath = pathJoin(resourcesPath, "resources_common");
|
@ -1,6 +0,0 @@
|
||||
export function pathJoin(...path: string[]): string {
|
||||
return path
|
||||
.map((part, i) => (i === 0 ? part : part.replace(/^\/+/, "")))
|
||||
.map((part, i) => (i === path.length - 1 ? part : part.replace(/\/+$/, "")))
|
||||
.join("/");
|
||||
}
|
18
src/lib/tsconfig.json
Normal file
18
src/lib/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsproject.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/lib",
|
||||
"rootDir": ".",
|
||||
"module": "ES2020",
|
||||
"target": "ES2020",
|
||||
"lib": ["es2015", "DOM", "ES2019.Object"],
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react-jsx",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "../bin"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user