keycloakify 10.0.0-rc.110 → 10.0.0-rc.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PUBLIC_URL.js +2 -2
- package/PUBLIC_URL.js.map +1 -1
- package/account/KcContext/kcContextMocks.js +3 -3
- package/account/i18n/i18n.js +4 -4
- package/account/i18n/i18n.js.map +1 -1
- package/account/i18n/useI18n.d.ts +1 -1
- package/account/i18n/useI18n.js +2 -2
- package/account/i18n/useI18n.js.map +1 -1
- package/bin/193.index.js +4 -4
- package/bin/31.index.js +31 -31
- package/bin/440.index.js +52 -51
- package/bin/453.index.js +3 -3
- package/bin/526.index.js +5 -5
- package/bin/622.index.js +1 -1
- package/bin/97.index.js +3 -3
- package/bin/shared/buildContext.js.map +1 -1
- package/bin/shared/constants.d.ts +17 -17
- package/bin/shared/constants.js +14 -14
- package/bin/shared/constants.js.map +1 -1
- package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
- package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -1
- package/login/KcContext/kcContextMocks.js +3 -3
- package/login/i18n/i18n.js +4 -4
- package/login/i18n/i18n.js.map +1 -1
- package/login/i18n/useI18n.d.ts +1 -1
- package/login/i18n/useI18n.js +2 -11
- package/login/i18n/useI18n.js.map +1 -1
- package/package.json +1 -1
- package/src/PUBLIC_URL.ts +2 -2
- package/src/account/KcContext/kcContextMocks.ts +3 -3
- package/src/account/i18n/i18n.tsx +4 -4
- package/src/account/i18n/useI18n.tsx +2 -2
- package/src/bin/add-story.ts +6 -6
- package/src/bin/eject-page.ts +6 -6
- package/src/bin/keycloakify/buildJars/buildJar.ts +13 -8
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +15 -19
- package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +386 -375
- package/src/bin/keycloakify/generateResources/bringInAccountV1.ts +7 -7
- package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +2 -2
- package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +17 -19
- package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +2 -2
- package/src/bin/keycloakify/generateResources/readExtraPageNames.ts +4 -4
- package/src/bin/keycloakify/keycloakify.ts +7 -5
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +3 -4
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +6 -6
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +4 -4
- package/src/bin/shared/buildContext.ts +9 -8
- package/src/bin/shared/constants.ts +17 -17
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +6 -6
- package/src/bin/shared/downloadKeycloakDefaultTheme.ts +2 -2
- package/src/bin/shared/downloadKeycloakStaticResources.ts +2 -2
- package/src/bin/start-keycloak/keycloakifyBuild.ts +2 -2
- package/src/bin/start-keycloak/start-keycloak.ts +5 -5
- package/src/login/KcContext/kcContextMocks.ts +4 -4
- package/src/login/i18n/i18n.tsx +4 -4
- package/src/login/i18n/useI18n.tsx +2 -11
- package/src/vite-plugin/vite-plugin.ts +8 -8
- package/vite-plugin/index.js +42 -42
@@ -3,7 +3,7 @@ import { createGetI18n, type GenericI18n_noJsx, type KcContextLike, type Message
|
|
3
3
|
import { GenericI18n } from "./GenericI18n";
|
4
4
|
import { Reflect } from "tsafe/Reflect";
|
5
5
|
|
6
|
-
export function createUseI18n<MessageKey_themeDefined extends string = never>(
|
6
|
+
export function createUseI18n<MessageKey_themeDefined extends string = never>(messagesByLanguageTag: {
|
7
7
|
[languageTag: string]: { [key in MessageKey_themeDefined]: string };
|
8
8
|
}) {
|
9
9
|
type MessageKey = MessageKey_defaultSet | MessageKey_themeDefined;
|
@@ -22,15 +22,6 @@ export function createUseI18n<MessageKey_themeDefined extends string = never>(me
|
|
22
22
|
}}
|
23
23
|
/>
|
24
24
|
);
|
25
|
-
/*
|
26
|
-
return (
|
27
|
-
<span
|
28
|
-
dangerouslySetInnerHTML={{
|
29
|
-
"__html": htmlString
|
30
|
-
}}
|
31
|
-
/>
|
32
|
-
);
|
33
|
-
*/
|
34
25
|
}
|
35
26
|
|
36
27
|
function withJsx(i18n_noJsx: GenericI18n_noJsx<MessageKey>): I18n {
|
@@ -58,7 +49,7 @@ export function createUseI18n<MessageKey_themeDefined extends string = never>(me
|
|
58
49
|
return { withJsx };
|
59
50
|
})();
|
60
51
|
|
61
|
-
const { getI18n } = createGetI18n(
|
52
|
+
const { getI18n } = createGetI18n(messagesByLanguageTag);
|
62
53
|
|
63
54
|
function useI18n(params: { kcContext: KcContextLike }): { i18n: I18n } {
|
64
55
|
const { kcContext } = params;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
|
2
2
|
import type { Plugin } from "vite";
|
3
3
|
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR,
|
5
|
+
KEYCLOAK_RESOURCES,
|
6
|
+
VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES
|
7
7
|
} from "../bin/shared/constants";
|
8
8
|
import { id } from "tsafe/id";
|
9
9
|
import { rm } from "../bin/tools/fs.rm";
|
@@ -38,7 +38,7 @@ export function keycloakify(params?: Params) {
|
|
38
38
|
|
39
39
|
run_post_build_script_case: {
|
40
40
|
const envValue =
|
41
|
-
process.env[
|
41
|
+
process.env[VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RUN_POST_BUILD_SCRIPT];
|
42
42
|
|
43
43
|
if (envValue === undefined) {
|
44
44
|
break run_post_build_script_case;
|
@@ -94,13 +94,13 @@ export function keycloakify(params?: Params) {
|
|
94
94
|
|
95
95
|
resolve_vite_config_case: {
|
96
96
|
const envValue =
|
97
|
-
process.env[
|
97
|
+
process.env[VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG];
|
98
98
|
|
99
99
|
if (envValue === undefined) {
|
100
100
|
break resolve_vite_config_case;
|
101
101
|
}
|
102
102
|
|
103
|
-
console.log(
|
103
|
+
console.log(VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG);
|
104
104
|
|
105
105
|
console.log(
|
106
106
|
JSON.stringify(
|
@@ -172,7 +172,7 @@ export function keycloakify(params?: Params) {
|
|
172
172
|
`(`,
|
173
173
|
`(window.kcContext === undefined || import.meta.env.MODE === "development")?`,
|
174
174
|
`"${urlPathname ?? "/"}":`,
|
175
|
-
`(window.kcContext.
|
175
|
+
`(window.kcContext["x-keycloakify"].resourcesPath + "/${BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR}/")`,
|
176
176
|
`)`
|
177
177
|
].join("")
|
178
178
|
);
|
@@ -205,7 +205,7 @@ export function keycloakify(params?: Params) {
|
|
205
205
|
|
206
206
|
assert(buildDirPath !== undefined);
|
207
207
|
|
208
|
-
await rm(pathJoin(buildDirPath,
|
208
|
+
await rm(pathJoin(buildDirPath, KEYCLOAK_RESOURCES), {
|
209
209
|
recursive: true,
|
210
210
|
force: true
|
211
211
|
});
|
package/vite-plugin/index.js
CHANGED
@@ -4136,7 +4136,7 @@ function getBuildContext(params) {
|
|
4136
4136
|
if (themeSrcDirPath !== undefined) {
|
4137
4137
|
return { themeSrcDirPath };
|
4138
4138
|
}
|
4139
|
-
for (const themeType of [...constants.
|
4139
|
+
for (const themeType of [...constants.THEME_TYPES, "email"]) {
|
4140
4140
|
if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
|
4141
4141
|
continue;
|
4142
4142
|
}
|
@@ -4157,12 +4157,12 @@ function getBuildContext(params) {
|
|
4157
4157
|
}
|
4158
4158
|
const output = external_child_process_namespaceObject.execSync("npx vite", {
|
4159
4159
|
cwd: projectDirPath,
|
4160
|
-
env: Object.assign(Object.assign({}, process.env), { [constants.
|
4160
|
+
env: Object.assign(Object.assign({}, process.env), { [constants.VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG]: "true" })
|
4161
4161
|
})
|
4162
4162
|
.toString("utf8");
|
4163
|
-
(0,assert.assert)(output.includes(constants.
|
4163
|
+
(0,assert.assert)(output.includes(constants.VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG), "Seems like the Keycloakify's Vite plugin is not installed.");
|
4164
4164
|
const resolvedViteConfigStr = output
|
4165
|
-
.split(constants.
|
4165
|
+
.split(constants.VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG)
|
4166
4166
|
.reverse()[0];
|
4167
4167
|
const resolvedViteConfig = JSON.parse(resolvedViteConfigStr);
|
4168
4168
|
return { resolvedViteConfig };
|
@@ -4445,7 +4445,7 @@ function getBuildContext(params) {
|
|
4445
4445
|
const getDefaultJarFileBasename = (range) => `keycloak-theme-for-kc-${range}.jar`;
|
4446
4446
|
build_for_specific_keycloak_major_version: {
|
4447
4447
|
const buildForKeycloakMajorVersionNumber = (() => {
|
4448
|
-
const envValue = process.env[constants.
|
4448
|
+
const envValue = process.env[constants.BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME];
|
4449
4449
|
if (envValue === undefined) {
|
4450
4450
|
return undefined;
|
4451
4451
|
}
|
@@ -4635,31 +4635,31 @@ function getBuildContext(params) {
|
|
4635
4635
|
"use strict";
|
4636
4636
|
__nccwpck_require__.r(__webpack_exports__);
|
4637
4637
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
4638
|
-
/* harmony export */ "
|
4639
|
-
/* harmony export */ "
|
4640
|
-
/* harmony export */ "
|
4641
|
-
/* harmony export */ "
|
4642
|
-
/* harmony export */ "
|
4643
|
-
/* harmony export */ "
|
4644
|
-
/* harmony export */ "
|
4645
|
-
/* harmony export */ "
|
4646
|
-
/* harmony export */ "
|
4647
|
-
/* harmony export */ "
|
4648
|
-
/* harmony export */ "
|
4649
|
-
/* harmony export */ "
|
4638
|
+
/* harmony export */ "ACCOUNT_THEME_PAGE_IDS": () => (/* binding */ ACCOUNT_THEME_PAGE_IDS),
|
4639
|
+
/* harmony export */ "ACCOUNT_V1_THEME_NAME": () => (/* binding */ ACCOUNT_V1_THEME_NAME),
|
4640
|
+
/* harmony export */ "BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR": () => (/* binding */ BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR),
|
4641
|
+
/* harmony export */ "BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME": () => (/* binding */ BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME),
|
4642
|
+
/* harmony export */ "CONTAINER_NAME": () => (/* binding */ CONTAINER_NAME),
|
4643
|
+
/* harmony export */ "FALLBACK_LANGUAGE_TAG": () => (/* binding */ FALLBACK_LANGUAGE_TAG),
|
4644
|
+
/* harmony export */ "KEYCLOAK_RESOURCES": () => (/* binding */ KEYCLOAK_RESOURCES),
|
4645
|
+
/* harmony export */ "LAST_KEYCLOAK_VERSION_WITH_ACCOUNT_V1": () => (/* binding */ LAST_KEYCLOAK_VERSION_WITH_ACCOUNT_V1),
|
4646
|
+
/* harmony export */ "LOGIN_THEME_PAGE_IDS": () => (/* binding */ LOGIN_THEME_PAGE_IDS),
|
4647
|
+
/* harmony export */ "RESOURCES_COMMON": () => (/* binding */ RESOURCES_COMMON),
|
4648
|
+
/* harmony export */ "THEME_TYPES": () => (/* binding */ THEME_TYPES),
|
4649
|
+
/* harmony export */ "VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES": () => (/* binding */ VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES)
|
4650
4650
|
/* harmony export */ });
|
4651
|
-
const
|
4652
|
-
const
|
4653
|
-
const
|
4654
|
-
const
|
4655
|
-
const
|
4656
|
-
const
|
4657
|
-
const
|
4658
|
-
|
4659
|
-
|
4660
|
-
};
|
4661
|
-
const
|
4662
|
-
const
|
4651
|
+
const KEYCLOAK_RESOURCES = "keycloak-resources";
|
4652
|
+
const RESOURCES_COMMON = "resources-common";
|
4653
|
+
const LAST_KEYCLOAK_VERSION_WITH_ACCOUNT_V1 = "21.1.2";
|
4654
|
+
const BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR = "dist";
|
4655
|
+
const THEME_TYPES = ["login", "account"];
|
4656
|
+
const ACCOUNT_V1_THEME_NAME = "account-v1";
|
4657
|
+
const VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES = {
|
4658
|
+
RUN_POST_BUILD_SCRIPT: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
|
4659
|
+
RESOLVE_VITE_CONFIG: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
|
4660
|
+
};
|
4661
|
+
const BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME = "KEYCLOAKIFY_BUILD_FOR_KEYCLOAK_MAJOR_VERSION";
|
4662
|
+
const LOGIN_THEME_PAGE_IDS = [
|
4663
4663
|
"login.ftl",
|
4664
4664
|
"login-username.ftl",
|
4665
4665
|
"login-password.ftl",
|
@@ -4695,7 +4695,7 @@ const loginThemePageIds = [
|
|
4695
4695
|
"login-x509-info.ftl",
|
4696
4696
|
"webauthn-error.ftl"
|
4697
4697
|
];
|
4698
|
-
const
|
4698
|
+
const ACCOUNT_THEME_PAGE_IDS = [
|
4699
4699
|
"password.ftl",
|
4700
4700
|
"account.ftl",
|
4701
4701
|
"sessions.ftl",
|
@@ -4704,8 +4704,8 @@ const accountThemePageIds = [
|
|
4704
4704
|
"log.ftl",
|
4705
4705
|
"federatedIdentity.ftl"
|
4706
4706
|
];
|
4707
|
-
const
|
4708
|
-
const
|
4707
|
+
const CONTAINER_NAME = "keycloak-keycloakify";
|
4708
|
+
const FALLBACK_LANGUAGE_TAG = "en";
|
4709
4709
|
//# sourceMappingURL=constants.js.map
|
4710
4710
|
|
4711
4711
|
/***/ }),
|
@@ -5119,7 +5119,7 @@ async function downloadKeycloakDefaultTheme(params) {
|
|
5119
5119
|
return;
|
5120
5120
|
}
|
5121
5121
|
last_account_v1_transformations: {
|
5122
|
-
if (constants.
|
5122
|
+
if (constants.LAST_KEYCLOAK_VERSION_WITH_ACCOUNT_V1 !== keycloakVersion) {
|
5123
5123
|
break last_account_v1_transformations;
|
5124
5124
|
}
|
5125
5125
|
skip_web_modules: {
|
@@ -5255,7 +5255,7 @@ async function downloadKeycloakStaticResources(params) {
|
|
5255
5255
|
});
|
5256
5256
|
transformCodebase({
|
5257
5257
|
srcDirPath: (0,external_path_.join)(defaultThemeDirPath, "keycloak", "common", "resources"),
|
5258
|
-
destDirPath: (0,external_path_.join)(resourcesDirPath, constants.
|
5258
|
+
destDirPath: (0,external_path_.join)(resourcesDirPath, constants.RESOURCES_COMMON)
|
5259
5259
|
});
|
5260
5260
|
}
|
5261
5261
|
//# sourceMappingURL=downloadKeycloakStaticResources.js.map
|
@@ -5299,7 +5299,7 @@ function readThisNpmPackageVersion() {
|
|
5299
5299
|
(0,assert.assert)();
|
5300
5300
|
async function copyKeycloakResourcesToPublic(params) {
|
5301
5301
|
const { buildContext } = params;
|
5302
|
-
const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.
|
5302
|
+
const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.KEYCLOAK_RESOURCES);
|
5303
5303
|
const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
|
5304
5304
|
const keycloakifyBuildinfoRaw = JSON.stringify({
|
5305
5305
|
destDirPath,
|
@@ -5324,14 +5324,14 @@ async function copyKeycloakResourcesToPublic(params) {
|
|
5324
5324
|
rmSync(destDirPath, { force: true, recursive: true });
|
5325
5325
|
external_fs_.mkdirSync(destDirPath, { recursive: true });
|
5326
5326
|
external_fs_.writeFileSync((0,external_path_.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
5327
|
-
for (const themeType of constants.
|
5327
|
+
for (const themeType of constants.THEME_TYPES) {
|
5328
5328
|
await downloadKeycloakStaticResources({
|
5329
5329
|
keycloakVersion: (() => {
|
5330
5330
|
switch (themeType) {
|
5331
5331
|
case "login":
|
5332
5332
|
return buildContext.loginThemeResourcesFromKeycloakVersion;
|
5333
5333
|
case "account":
|
5334
|
-
return constants.
|
5334
|
+
return constants.LAST_KEYCLOAK_VERSION_WITH_ACCOUNT_V1;
|
5335
5335
|
}
|
5336
5336
|
})(),
|
5337
5337
|
themeType,
|
@@ -5669,7 +5669,7 @@ function keycloakify(params) {
|
|
5669
5669
|
configResolved: async (resolvedConfig) => {
|
5670
5670
|
shouldGenerateSourcemap = resolvedConfig.build.sourcemap !== false;
|
5671
5671
|
run_post_build_script_case: {
|
5672
|
-
const envValue = process.env[constants_1.
|
5672
|
+
const envValue = process.env[constants_1.VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RUN_POST_BUILD_SCRIPT];
|
5673
5673
|
if (envValue === undefined) {
|
5674
5674
|
break run_post_build_script_case;
|
5675
5675
|
}
|
@@ -5704,11 +5704,11 @@ function keycloakify(params) {
|
|
5704
5704
|
})();
|
5705
5705
|
buildDirPath = (0, path_1.join)(projectDirPath, resolvedConfig.build.outDir);
|
5706
5706
|
resolve_vite_config_case: {
|
5707
|
-
const envValue = process.env[constants_1.
|
5707
|
+
const envValue = process.env[constants_1.VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG];
|
5708
5708
|
if (envValue === undefined) {
|
5709
5709
|
break resolve_vite_config_case;
|
5710
5710
|
}
|
5711
|
-
console.log(constants_1.
|
5711
|
+
console.log(constants_1.VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG);
|
5712
5712
|
console.log(JSON.stringify((0, id_1.id)({
|
5713
5713
|
publicDir: (0, path_1.relative)(projectDirPath, resolvedConfig.publicDir),
|
5714
5714
|
assetsDir: resolvedConfig.build.assetsDir,
|
@@ -5757,7 +5757,7 @@ function keycloakify(params) {
|
|
5757
5757
|
`(`,
|
5758
5758
|
`(window.kcContext === undefined || import.meta.env.MODE === "development")?`,
|
5759
5759
|
`"${urlPathname !== null && urlPathname !== void 0 ? urlPathname : "/"}":`,
|
5760
|
-
`(window.kcContext.
|
5760
|
+
`(window.kcContext["x-keycloakify"].resourcesPath + "/${constants_1.BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR}/")`,
|
5761
5761
|
`)`
|
5762
5762
|
].join(""));
|
5763
5763
|
if (!transformedCode.hasChanged()) {
|
@@ -5782,7 +5782,7 @@ function keycloakify(params) {
|
|
5782
5782
|
return;
|
5783
5783
|
}
|
5784
5784
|
(0, assert_1.assert)(buildDirPath !== undefined);
|
5785
|
-
await (0, fs_rm_1.rm)((0, path_1.join)(buildDirPath, constants_1.
|
5785
|
+
await (0, fs_rm_1.rm)((0, path_1.join)(buildDirPath, constants_1.KEYCLOAK_RESOURCES), {
|
5786
5786
|
recursive: true,
|
5787
5787
|
force: true
|
5788
5788
|
});
|