Enabling shorter import paths [automatic]
This commit is contained in:
15
bin/build-keycloak-theme/generateFtl/error.ftl
Normal file
15
bin/build-keycloak-theme/generateFtl/error.ftl
Normal file
@ -0,0 +1,15 @@
|
||||
<script>const _=
|
||||
{
|
||||
"client": (function (){
|
||||
|
||||
<#if client??>
|
||||
return {
|
||||
"baseUrl": "${(client.baseUrl!'')?no_esc}" || undefined
|
||||
};
|
||||
</#if>
|
||||
|
||||
return undefined;
|
||||
|
||||
})()
|
||||
}
|
||||
</script>
|
12
bin/build-keycloak-theme/generateFtl/index.d.ts
vendored
Normal file
12
bin/build-keycloak-theme/generateFtl/index.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
export declare type PageId = "login.ftl" | "register.ftl" | "info.ftl" | "error.ftl";
|
||||
export declare function generateFtlFilesCodeFactory(params: {
|
||||
ftlValuesGlobalName: string;
|
||||
cssGlobalsToDefine: Record<string, string>;
|
||||
indexHtmlCode: string;
|
||||
}): {
|
||||
generateFtlFilesCode: (params: {
|
||||
pageId: PageId;
|
||||
}) => {
|
||||
ftlCode: string;
|
||||
};
|
||||
};
|
163
bin/build-keycloak-theme/generateFtl/index.js
Normal file
163
bin/build-keycloak-theme/generateFtl/index.js
Normal file
@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateFtlFilesCodeFactory = void 0;
|
||||
var cheerio_1 = __importDefault(require("cheerio"));
|
||||
var replaceImportFromStatic_1 = require("../replaceImportFromStatic");
|
||||
var fs_1 = __importDefault(require("fs"));
|
||||
var path_1 = require("path");
|
||||
var objectKeys_1 = require("evt/tools/typeSafety/objectKeys");
|
||||
function loadFtlFile(ftlFileBasename) {
|
||||
return fs_1.default.readFileSync(path_1.join(__dirname, ftlFileBasename))
|
||||
.toString("utf8")
|
||||
.match(/^<script>const _=((?:.|\n)+)<\/script>[\n]?$/)[1];
|
||||
}
|
||||
function generateFtlFilesCodeFactory(params) {
|
||||
var ftlValuesGlobalName = params.ftlValuesGlobalName, cssGlobalsToDefine = params.cssGlobalsToDefine, indexHtmlCode = params.indexHtmlCode;
|
||||
var $ = cheerio_1.default.load(indexHtmlCode);
|
||||
$("script:not([src])").each(function () {
|
||||
var _a = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_a[_i] = arguments[_i];
|
||||
}
|
||||
var _b = __read(_a, 2), element = _b[1];
|
||||
var fixedJsCode = replaceImportFromStatic_1.replaceImportFromStaticInJsCode({
|
||||
ftlValuesGlobalName: ftlValuesGlobalName,
|
||||
"jsCode": $(element).html()
|
||||
}).fixedJsCode;
|
||||
$(element).text(fixedJsCode);
|
||||
});
|
||||
[
|
||||
["link", "href"],
|
||||
["script", "src"],
|
||||
].forEach(function (_a) {
|
||||
var _b = __read(_a, 2), selector = _b[0], attrName = _b[1];
|
||||
return $(selector).each(function () {
|
||||
var _a = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_a[_i] = arguments[_i];
|
||||
}
|
||||
var _b = __read(_a, 2), element = _b[1];
|
||||
var href = $(element).attr(attrName);
|
||||
if (!(href === null || href === void 0 ? void 0 : href.startsWith("/"))) {
|
||||
return;
|
||||
}
|
||||
$(element).attr(attrName, "${url.resourcesPath}/build" + href);
|
||||
});
|
||||
});
|
||||
//FTL is no valid html, we can't insert with cheerio, we put placeholder for injecting later.
|
||||
var ftlCommonPlaceholders = {
|
||||
'{ "x": "vIdLqMeOed9sdLdIdOxdK0d" }': loadFtlFile("template.ftl"),
|
||||
'<!-- xIdLqMeOedErIdLsPdNdI9dSlxI -->': [
|
||||
'<#if scripts??>',
|
||||
' <#list scripts as script>',
|
||||
' <script src="${script}" type="text/javascript"></script>',
|
||||
' </#list>',
|
||||
'</#if>',
|
||||
].join("\n")
|
||||
};
|
||||
$("head").prepend(__spreadArray(__spreadArray([], __read((Object.keys(cssGlobalsToDefine).length === 0 ? [] : [
|
||||
'',
|
||||
'<style>',
|
||||
replaceImportFromStatic_1.generateCssCodeToDefineGlobals({ cssGlobalsToDefine: cssGlobalsToDefine }).cssCodeToPrependInHead,
|
||||
'</style>',
|
||||
''
|
||||
]))), [
|
||||
'<script>',
|
||||
' Object.deepAssign(',
|
||||
" window." + ftlValuesGlobalName + ",",
|
||||
" " + objectKeys_1.objectKeys(ftlCommonPlaceholders)[0],
|
||||
' );',
|
||||
'</script>',
|
||||
'',
|
||||
objectKeys_1.objectKeys(ftlCommonPlaceholders)[1],
|
||||
''
|
||||
]).join("\n"));
|
||||
var partiallyFixedIndexHtmlCode = $.html();
|
||||
function generateFtlFilesCode(params) {
|
||||
var pageId = params.pageId;
|
||||
var $ = cheerio_1.default.load(partiallyFixedIndexHtmlCode);
|
||||
var ftlPlaceholders = __assign({ '{ "x": "kxOlLqMeOed9sdLdIdOxd444" }': loadFtlFile(pageId) }, ftlCommonPlaceholders);
|
||||
$("head").prepend([
|
||||
'',
|
||||
'<script>',
|
||||
'',
|
||||
" window." + ftlValuesGlobalName + " = Object.assign(",
|
||||
" { \"pageId\": \"" + pageId + "\" },",
|
||||
" " + objectKeys_1.objectKeys(ftlPlaceholders)[0],
|
||||
' );',
|
||||
'',
|
||||
' Object.defineProperty(',
|
||||
' Object,',
|
||||
' "deepAssign",',
|
||||
' {',
|
||||
' "value": function callee(target, source) {',
|
||||
' Object.keys(source).forEach(function (key) {',
|
||||
' var value = source[key];',
|
||||
' if( target[key] === undefined ){',
|
||||
' target[key]= value;',
|
||||
' return;',
|
||||
' }',
|
||||
' if( value instanceof Object ){',
|
||||
' if( value instanceof Array ){',
|
||||
' value.forEach(function (entry){',
|
||||
' target[key].push(entry);',
|
||||
' });',
|
||||
' return;',
|
||||
' }',
|
||||
' callee(target[key], value);',
|
||||
' return;',
|
||||
' }',
|
||||
' target[key]= value;',
|
||||
' });',
|
||||
' return target;',
|
||||
' }',
|
||||
' }',
|
||||
' );',
|
||||
'',
|
||||
'</script>',
|
||||
''
|
||||
].join("\n"));
|
||||
var ftlCode = $.html();
|
||||
objectKeys_1.objectKeys(ftlPlaceholders)
|
||||
.forEach(function (id) { return ftlCode = ftlCode.replace(id, ftlPlaceholders[id]); });
|
||||
return { ftlCode: ftlCode };
|
||||
}
|
||||
return { generateFtlFilesCode: generateFtlFilesCode };
|
||||
}
|
||||
exports.generateFtlFilesCodeFactory = generateFtlFilesCodeFactory;
|
||||
//# sourceMappingURL=index.js.map
|
1
bin/build-keycloak-theme/generateFtl/index.js.map
Normal file
1
bin/build-keycloak-theme/generateFtl/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/build-keycloak-theme/generateFtl/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oD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theme/generateFtl/info.ftl
Normal file
37
bin/build-keycloak-theme/generateFtl/info.ftl
Normal file
@ -0,0 +1,37 @@
|
||||
<script>const _=
|
||||
{
|
||||
"messageHeader": "${messageHeader!''}" || undefined,
|
||||
"requiredActions": (function (){
|
||||
|
||||
<#if requiredActions??>
|
||||
|
||||
var out =[];
|
||||
|
||||
<#list requiredActions>
|
||||
<#items as reqActionItem>
|
||||
out.push("${reqActionItem}");
|
||||
</#items></b>
|
||||
</#list>
|
||||
|
||||
return out;
|
||||
|
||||
<#else>
|
||||
|
||||
return undefined;
|
||||
|
||||
})(),
|
||||
"skipLink": (function (){
|
||||
|
||||
<#if skipLink??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
})(),
|
||||
"pageRedirectUri": "${(pageRedirectUri!'')?no_esc}" || undefined,
|
||||
"actionUri": "${(actionUri!'')?no_esc}" || undefined,
|
||||
"client": {
|
||||
"baseUrl": "${(client.baseUrl!'')?no_esc}" || undefined
|
||||
}
|
||||
}
|
||||
</script>
|
83
bin/build-keycloak-theme/generateFtl/login.ftl
Normal file
83
bin/build-keycloak-theme/generateFtl/login.ftl
Normal file
@ -0,0 +1,83 @@
|
||||
<script>const _=
|
||||
{
|
||||
"url": {
|
||||
"loginResetCredentialsUrl": "${url.loginResetCredentialsUrl?no_esc}",
|
||||
"registrationUrl": "${url.registrationUrl?no_esc}"
|
||||
},
|
||||
"realm": {
|
||||
"loginWithEmailAllowed": ${realm.loginWithEmailAllowed?c},
|
||||
"rememberMe": ${realm.rememberMe?c},
|
||||
"password": ${realm.password?c},
|
||||
"resetPasswordAllowed": ${realm.resetPasswordAllowed?c},
|
||||
"registrationAllowed": ${realm.registrationAllowed?c}
|
||||
},
|
||||
"auth": (function (){
|
||||
|
||||
<#if auth?has_content>
|
||||
|
||||
var out= {
|
||||
"selectedCredential": "${auth.selectedCredential!''}" || undefined
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
</#if>
|
||||
|
||||
return undefined;
|
||||
|
||||
})(),
|
||||
"social": {
|
||||
"displayInfo": ${social.displayInfo?c},
|
||||
"providers": (()=>{
|
||||
|
||||
<#if social.providers??>
|
||||
|
||||
var out= [];
|
||||
|
||||
<#list social.providers as p>
|
||||
out.push({
|
||||
"loginUrl": "${p.loginUrl?no_esc}",
|
||||
"alias": "${p.alias}",
|
||||
"providerId": "${p.providerId}",
|
||||
"displayName": "${p.displayName}"
|
||||
});
|
||||
</#list>
|
||||
|
||||
return out;
|
||||
|
||||
</#if>
|
||||
|
||||
return undefined;
|
||||
|
||||
})()
|
||||
},
|
||||
"usernameEditDisabled": (function () {
|
||||
|
||||
<#if usernameEditDisabled??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
})(),
|
||||
"login": {
|
||||
"username": "${login.username!''}" || undefined,
|
||||
"rememberMe": (function (){
|
||||
|
||||
<#if login.rememberMe??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
|
||||
})()
|
||||
},
|
||||
"registrationDisabled": (function (){
|
||||
|
||||
<#if registrationDisabled??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
})()
|
||||
}
|
||||
</script>
|
46
bin/build-keycloak-theme/generateFtl/register.ftl
Normal file
46
bin/build-keycloak-theme/generateFtl/register.ftl
Normal file
@ -0,0 +1,46 @@
|
||||
<script>const _=
|
||||
{
|
||||
"url": {
|
||||
"registrationAction": "${url.registrationAction?no_esc}"
|
||||
},
|
||||
"messagesPerField": {
|
||||
"printIfExists": function (key, x) {
|
||||
switch(key){
|
||||
case "userLabel": "${messagesPerField.printIfExists('userLabel','1')}" ? x : undefined;
|
||||
case "username": "${messagesPerField.printIfExists('username','1')}" ? x : undefined;
|
||||
case "email": "${messagesPerField.printIfExists('email','1')}" ? x : undefined;
|
||||
case "firstName": "${messagesPerField.printIfExists('firstName','1')}" ? x : undefined;
|
||||
case "lastName": "${messagesPerField.printIfExists('lastName','1')}" ? x : undefined;
|
||||
case "password": "${messagesPerField.printIfExists('password','1')}" ? x : undefined;
|
||||
case "password-confirm": "${messagesPerField.printIfExists('password-confirm','1')}" ? x : undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
"register": {
|
||||
"formData": {
|
||||
"firstName": "${register.formData.firstName!''}" || undefined,
|
||||
"displayName": "${register.formData.displayName!''}" || undefined,
|
||||
"lastName": "${register.formData.lastName!''}" || undefined,
|
||||
"email": "${register.formData.email!''}" || undefined,
|
||||
"username": "${register.formData.username!''}" || undefined
|
||||
}
|
||||
},
|
||||
"passwordRequired": (function (){
|
||||
|
||||
<#if passwordRequired??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
})(),
|
||||
"recaptchaRequired": (function (){
|
||||
|
||||
<#if passwordRequired??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
})(),
|
||||
"recaptchaSiteKey": "${recaptchaSiteKey!''}" || undefined
|
||||
}
|
||||
</script>
|
114
bin/build-keycloak-theme/generateFtl/template.ftl
Normal file
114
bin/build-keycloak-theme/generateFtl/template.ftl
Normal file
@ -0,0 +1,114 @@
|
||||
<script>const _=
|
||||
{
|
||||
"url": {
|
||||
"loginAction": "${url.loginAction?no_esc}",
|
||||
"resourcesPath": "${url.resourcesPath?no_esc}",
|
||||
"resourcesCommonPath": "${url.resourcesCommonPath?no_esc}",
|
||||
"loginRestartFlowUrl": "${url.loginRestartFlowUrl?no_esc}",
|
||||
"loginUrl": "${url.loginUrl?no_esc}"
|
||||
},
|
||||
"realm": {
|
||||
"displayName": "${realm.displayName!''}" || undefined,
|
||||
"displayNameHtml": "${realm.displayNameHtml!''}" || undefined,
|
||||
"internationalizationEnabled": ${realm.internationalizationEnabled?c},
|
||||
"registrationEmailAsUsername": ${realm.registrationEmailAsUsername?c},
|
||||
},
|
||||
"locale": (function (){
|
||||
|
||||
<#if realm.internationalizationEnabled>
|
||||
|
||||
return {
|
||||
"supported": (function(){
|
||||
|
||||
<#if realm.internationalizationEnabled>
|
||||
|
||||
var out= [];
|
||||
|
||||
<#list locale.supported as lng>
|
||||
out.push({
|
||||
"url": "${lng.url?no_esc}",
|
||||
"label": "${lng.label}",
|
||||
"languageTag": "${lng.languageTag}"
|
||||
});
|
||||
</#list>
|
||||
|
||||
return out;
|
||||
|
||||
</#if>
|
||||
|
||||
return undefined;
|
||||
|
||||
})(),
|
||||
"current": "${locale.current}"
|
||||
};
|
||||
|
||||
</#if>
|
||||
|
||||
return undefined;
|
||||
|
||||
})(),
|
||||
"auth": (function (){
|
||||
|
||||
|
||||
<#if auth?has_content>
|
||||
|
||||
var out= {
|
||||
"showUsername": ${auth.showUsername()?c},
|
||||
"showResetCredentials": ${auth.showResetCredentials()?c},
|
||||
"showTryAnotherWayLink": ${auth.showTryAnotherWayLink()?c},
|
||||
};
|
||||
|
||||
<#if auth.showUsername() && !auth.showResetCredentials()>
|
||||
Object.assign(
|
||||
out,
|
||||
{
|
||||
"attemptedUsername": "${auth.attemptedUsername}"
|
||||
}
|
||||
);
|
||||
</#if>
|
||||
|
||||
return out;
|
||||
|
||||
</#if>
|
||||
|
||||
|
||||
return undefined;
|
||||
|
||||
})(),
|
||||
"scripts": (function(){
|
||||
|
||||
var out = [];
|
||||
|
||||
<#if scripts??>
|
||||
<#list scripts as script>
|
||||
out.push("${script}");
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
return out;
|
||||
|
||||
})(),
|
||||
"message": (function (){
|
||||
|
||||
<#if message?has_content>
|
||||
|
||||
return {
|
||||
"type": "${message.type}",
|
||||
"summary": "${kcSanitize(message.summary)?no_esc}"
|
||||
};
|
||||
|
||||
</#if>
|
||||
|
||||
return undefined;
|
||||
|
||||
})(),
|
||||
"isAppInitiatedAction": (function (){
|
||||
|
||||
<#if isAppInitiatedAction??>
|
||||
return true;
|
||||
</#if>
|
||||
return false;
|
||||
|
||||
})()
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user