Compare commits

..

6 Commits

5 changed files with 13 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "keycloakify", "name": "keycloakify",
"version": "11.3.12", "version": "11.3.15",
"description": "Framework to create custom Keycloak UIs", "description": "Framework to create custom Keycloak UIs",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -51,7 +51,7 @@ export async function command(params: { buildContext: BuildContext }) {
2 2
)};`, )};`,
``, ``,
`export type KcContext =`, `type KcContext =`,
hasLoginTheme && ` | import("./login/KcContext").KcContext`, hasLoginTheme && ` | import("./login/KcContext").KcContext`,
hasAccountTheme && ` | import("./account/KcContext").KcContext`, hasAccountTheme && ` | import("./account/KcContext").KcContext`,
` ;`, ` ;`,

View File

@ -102,7 +102,7 @@ export declare namespace KcContext {
showTryAnotherWayLink?: boolean; showTryAnotherWayLink?: boolean;
attemptedUsername?: string; attemptedUsername?: string;
}; };
scripts: string[]; scripts?: string[];
message?: { message?: {
type: "success" | "warning" | "error" | "info"; type: "success" | "warning" | "error" | "info";
summary: string; summary: string;

View File

@ -10,7 +10,7 @@ export type KcContextLike = {
resourcesPath: string; resourcesPath: string;
ssoLoginInOtherTabsUrl: string; ssoLoginInOtherTabsUrl: string;
}; };
scripts: string[]; scripts?: string[];
}; };
assert<keyof KcContextLike extends keyof KcContext ? true : false>(); assert<keyof KcContextLike extends keyof KcContext ? true : false>();
@ -45,10 +45,12 @@ export function useInitialize(params: {
type: "module", type: "module",
src: `${url.resourcesPath}/js/menu-button-links.js` src: `${url.resourcesPath}/js/menu-button-links.js`
}, },
...scripts.map(src => ({ ...(scripts === undefined
type: "text/javascript" as const, ? []
src : scripts.map(src => ({
})), type: "text/javascript" as const,
src
}))),
{ {
type: "module", type: "module",
textContent: ` textContent: `

View File

@ -16,6 +16,7 @@ import {
} from "../bin/shared/buildContext"; } from "../bin/shared/buildContext";
import MagicString from "magic-string"; import MagicString from "magic-string";
import { command as updateKcGenCommand } from "../bin/update-kc-gen"; import { command as updateKcGenCommand } from "../bin/update-kc-gen";
import { replaceAll } from "../bin/tools/String.prototype.replaceAll";
export namespace keycloakify { export namespace keycloakify {
export type Params = BuildOptions & { export type Params = BuildOptions & {
@ -130,6 +131,8 @@ export function keycloakify(params: keycloakify.Params) {
await updateKcGenCommand({ buildContext }); await updateKcGenCommand({ buildContext });
}, },
transform: (code, id) => { transform: (code, id) => {
id = replaceAll(id, "/", pathSep);
assert(command !== undefined); assert(command !== undefined);
assert(shouldGenerateSourcemap !== undefined); assert(shouldGenerateSourcemap !== undefined);