keycloakify 10.0.0-rc.118 → 10.0.0-rc.119
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/bin/{490.index.js → 246.index.js} +20 -2
- package/bin/31.index.js +151 -159
- package/bin/440.index.js +27 -22
- package/bin/526.index.js +168 -56
- package/bin/599.index.js +560 -0
- package/bin/622.index.js +4 -2
- package/bin/{36.index.js → 678.index.js} +577 -71
- package/bin/{180.index.js → 697.index.js} +611 -526
- package/bin/743.index.js +70 -0
- package/bin/780.index.js +729 -0
- package/bin/932.index.js +725 -48
- package/bin/{966.index.js → 941.index.js} +2 -19
- package/bin/main.js +19 -7
- package/bin/shared/buildContext.d.ts +28 -19
- package/bin/shared/buildContext.js.map +1 -1
- package/bin/shared/getLatestsSemVersionedTag.d.ts +10 -0
- package/bin/shared/getLatestsSemVersionedTag.js.map +1 -0
- package/bin/shared/promptKeycloakVersion.js.map +1 -1
- package/package.json +24 -5
- package/src/bin/initialize-account-theme/copyBoilerplate.ts +32 -0
- package/src/bin/initialize-account-theme/index.ts +1 -0
- package/src/bin/initialize-account-theme/initialize-account-theme.ts +95 -0
- package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +21 -0
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +150 -0
- package/src/bin/initialize-account-theme/src/multi-page/KcContext.ts +12 -0
- package/src/bin/initialize-account-theme/src/multi-page/KcPage.tsx +25 -0
- package/src/bin/initialize-account-theme/src/multi-page/KcPageStory.tsx +38 -0
- package/src/bin/initialize-account-theme/src/multi-page/i18n.ts +5 -0
- package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +7 -0
- package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +11 -0
- package/src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts +92 -0
- package/src/bin/keycloakify/buildJars/buildJar.ts +2 -2
- package/src/bin/keycloakify/buildJars/buildJars.ts +3 -4
- package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +26 -20
- package/src/bin/keycloakify/keycloakify.ts +1 -1
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +2 -2
- package/src/bin/main.ts +14 -0
- package/src/bin/shared/buildContext.ts +246 -225
- package/src/bin/shared/getLatestsSemVersionedTag.ts +180 -0
- package/src/bin/shared/promptKeycloakVersion.ts +8 -77
- package/src/bin/start-keycloak/appBuild.ts +13 -9
- package/src/bin/tools/downloadAndExtractArchive.ts +4 -2
- package/src/bin/tools/npmInstall.ts +63 -0
- package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +3 -2
- package/src/bin/tsconfig.json +3 -1
- package/src/vite-plugin/vite-plugin.ts +7 -5
- package/vite-plugin/index.js +156 -180
- package/vite-plugin/vite-plugin.d.ts +6 -4
@@ -1,5 +1,5 @@
|
|
1
|
-
exports.id =
|
2
|
-
exports.ids = [
|
1
|
+
exports.id = 246;
|
2
|
+
exports.ids = [246];
|
3
3
|
exports.modules = {
|
4
4
|
|
5
5
|
/***/ 15573:
|
@@ -22698,6 +22698,24 @@ module.exports = function toFastproperties(o) {
|
|
22698
22698
|
};
|
22699
22699
|
|
22700
22700
|
|
22701
|
+
/***/ }),
|
22702
|
+
|
22703
|
+
/***/ 47986:
|
22704
|
+
/***/ ((__unused_webpack_module, exports) => {
|
22705
|
+
|
22706
|
+
"use strict";
|
22707
|
+
var __webpack_unused_export__;
|
22708
|
+
|
22709
|
+
__webpack_unused_export__ = ({ value: true });
|
22710
|
+
exports.r = void 0;
|
22711
|
+
/** @see <https://docs.tsafe.dev/main/symtostr> */
|
22712
|
+
function symToStr(wrap) {
|
22713
|
+
// @ts-expect-error: We know better
|
22714
|
+
return Object.keys(wrap)[0];
|
22715
|
+
}
|
22716
|
+
exports.r = symToStr;
|
22717
|
+
//# sourceMappingURL=symToStr.js.map
|
22718
|
+
|
22701
22719
|
/***/ }),
|
22702
22720
|
|
22703
22721
|
/***/ 4351:
|
package/bin/31.index.js
CHANGED
@@ -32,14 +32,10 @@ var constants = __webpack_require__(173);
|
|
32
32
|
var tsafe = __webpack_require__(1666);
|
33
33
|
// EXTERNAL MODULE: ./dist/bin/tools/crawl.js
|
34
34
|
var crawl = __webpack_require__(73036);
|
35
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/objectFromEntries.js
|
36
|
-
var objectFromEntries = __webpack_require__(68634);
|
37
35
|
// EXTERNAL MODULE: ./node_modules/tsafe/objectEntries.js
|
38
36
|
var objectEntries = __webpack_require__(39612);
|
39
37
|
// EXTERNAL MODULE: ./node_modules/tsafe/id.js
|
40
38
|
var id = __webpack_require__(43047);
|
41
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/symToStr.js
|
42
|
-
var symToStr = __webpack_require__(47986);
|
43
39
|
// EXTERNAL MODULE: ./node_modules/chalk/source/index.js
|
44
40
|
var source = __webpack_require__(78818);
|
45
41
|
var source_default = /*#__PURE__*/__webpack_require__.n(source);
|
@@ -108,19 +104,6 @@ function ensureSingleOrNone(arg0) {
|
|
108
104
|
}
|
109
105
|
//# sourceMappingURL=fetchProxyOptions.js.map
|
110
106
|
;// CONCATENATED MODULE: ./dist/bin/shared/buildContext.js
|
111
|
-
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
112
|
-
var t = {};
|
113
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
114
|
-
t[p] = s[p];
|
115
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
116
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
117
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
118
|
-
t[p[i]] = s[p[i]];
|
119
|
-
}
|
120
|
-
return t;
|
121
|
-
};
|
122
|
-
|
123
|
-
|
124
107
|
|
125
108
|
|
126
109
|
|
@@ -136,8 +119,9 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
136
119
|
|
137
120
|
|
138
121
|
|
122
|
+
(0,assert.assert)();
|
139
123
|
function getBuildContext(params) {
|
140
|
-
var _a, _b, _c, _d, _e, _f
|
124
|
+
var _a, _b, _c, _d, _e, _f;
|
141
125
|
const { cliCommandOptions } = params;
|
142
126
|
const projectDirPath = cliCommandOptions.projectDirPath !== undefined
|
143
127
|
? (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
@@ -221,65 +205,78 @@ function getBuildContext(params) {
|
|
221
205
|
return getPackageJSonDirPath(upCount + 1);
|
222
206
|
})(0);
|
223
207
|
const parsedPackageJson = (() => {
|
224
|
-
const
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
keycloakifyBuildDirPath: lib.z.string().optional(),
|
236
|
-
kcContextExclusionsFtl: lib.z.string().optional(),
|
237
|
-
environmentVariables: lib.z.array(lib.z.object({
|
238
|
-
name: lib.z.string(),
|
239
|
-
default: lib.z.string()
|
240
|
-
}))
|
241
|
-
.optional(),
|
242
|
-
themeName: lib.z.union([lib.z.string(), lib.z.array(lib.z.string())]).optional(),
|
243
|
-
themeVersion: lib.z.string().optional(),
|
244
|
-
staticDirPathInProjectBuildDirPath: lib.z.string().optional(),
|
245
|
-
publicDirPath: lib.z.string().optional(),
|
246
|
-
keycloakVersionTargets: (0,id.id)((() => {
|
247
|
-
const zKeycloakVersionTargets = lib.z.union([
|
248
|
-
lib.z.object({
|
249
|
-
hasAccountTheme: lib.z.literal(true),
|
250
|
-
"21-and-below": lib.z.union([
|
251
|
-
lib.z.boolean(),
|
252
|
-
lib.z.string()
|
253
|
-
]),
|
254
|
-
"23": lib.z.union([lib.z.boolean(), lib.z.string()]),
|
255
|
-
"24": lib.z.union([lib.z.boolean(), lib.z.string()]),
|
256
|
-
"25-and-above": lib.z.union([lib.z.boolean(), lib.z.string()])
|
257
|
-
}),
|
258
|
-
lib.z.object({
|
259
|
-
hasAccountTheme: lib.z.literal(false),
|
260
|
-
"21-and-below": lib.z.union([
|
261
|
-
lib.z.boolean(),
|
262
|
-
lib.z.string()
|
263
|
-
]),
|
264
|
-
"22-and-above": lib.z.union([lib.z.boolean(), lib.z.string()])
|
265
|
-
})
|
266
|
-
]);
|
267
|
-
{
|
268
|
-
(0,assert.assert)();
|
269
|
-
}
|
270
|
-
return zKeycloakVersionTargets;
|
271
|
-
})()).optional(),
|
272
|
-
doUseAccountV3: lib.z.boolean().optional()
|
273
|
-
});
|
274
|
-
{
|
275
|
-
(0,assert.assert)();
|
276
|
-
}
|
277
|
-
return zBuildOptions_packageJson;
|
278
|
-
})()).optional()
|
279
|
-
});
|
280
|
-
{
|
208
|
+
const zMultiPageApp = (() => {
|
209
|
+
const zTargetType = lib.z.object({
|
210
|
+
accountThemeImplementation: lib.z.literal("Multi-Page"),
|
211
|
+
keycloakVersionTargets: lib.z.object({
|
212
|
+
"21-and-below": lib.z.union([lib.z.boolean(), lib.z.string()]),
|
213
|
+
"23": lib.z.union([lib.z.boolean(), lib.z.string()]),
|
214
|
+
"24": lib.z.union([lib.z.boolean(), lib.z.string()]),
|
215
|
+
"25-and-above": lib.z.union([lib.z.boolean(), lib.z.string()])
|
216
|
+
})
|
217
|
+
.optional()
|
218
|
+
});
|
281
219
|
(0,assert.assert)();
|
282
|
-
|
220
|
+
return (0,id.id)(zTargetType);
|
221
|
+
})();
|
222
|
+
const zSinglePageApp = (() => {
|
223
|
+
const zTargetType = lib.z.object({
|
224
|
+
accountThemeImplementation: lib.z.union([
|
225
|
+
lib.z.literal("Single-Page"),
|
226
|
+
lib.z.literal("none")
|
227
|
+
]),
|
228
|
+
keycloakVersionTargets: lib.z.object({
|
229
|
+
"21-and-below": lib.z.union([lib.z.boolean(), lib.z.string()]),
|
230
|
+
"22-and-above": lib.z.union([lib.z.boolean(), lib.z.string()])
|
231
|
+
})
|
232
|
+
.optional()
|
233
|
+
});
|
234
|
+
(0,assert.assert)();
|
235
|
+
return (0,id.id)(zTargetType);
|
236
|
+
})();
|
237
|
+
const zAccountThemeImplAndKeycloakVersionTargets = (() => {
|
238
|
+
const zTargetType = lib.z.union([zMultiPageApp, zSinglePageApp]);
|
239
|
+
(0,assert.assert)();
|
240
|
+
return (0,id.id)(zTargetType);
|
241
|
+
})();
|
242
|
+
const zBuildOptions = (() => {
|
243
|
+
const zTargetType = lib.z.intersection(lib.z.object({
|
244
|
+
themeName: lib.z.union([lib.z.string(), lib.z.array(lib.z.string())]).optional(),
|
245
|
+
themeVersion: lib.z.string().optional(),
|
246
|
+
environmentVariables: lib.z.array(lib.z.object({
|
247
|
+
name: lib.z.string(),
|
248
|
+
default: lib.z.string()
|
249
|
+
}))
|
250
|
+
.optional(),
|
251
|
+
extraThemeProperties: lib.z.array(lib.z.string()).optional(),
|
252
|
+
artifactId: lib.z.string().optional(),
|
253
|
+
groupId: lib.z.string().optional(),
|
254
|
+
loginThemeResourcesFromKeycloakVersion: lib.z.string().optional(),
|
255
|
+
keycloakifyBuildDirPath: lib.z.string().optional(),
|
256
|
+
kcContextExclusionsFtl: lib.z.string().optional()
|
257
|
+
}), zAccountThemeImplAndKeycloakVersionTargets);
|
258
|
+
(0,assert.assert)();
|
259
|
+
return (0,id.id)(zTargetType);
|
260
|
+
})();
|
261
|
+
const zBuildOptions_packageJson = (() => {
|
262
|
+
const zTargetType = lib.z.intersection(zBuildOptions, lib.z.object({
|
263
|
+
projectBuildDirPath: lib.z.string().optional(),
|
264
|
+
staticDirPathInProjectBuildDirPath: lib.z.string().optional(),
|
265
|
+
publicDirPath: lib.z.string().optional()
|
266
|
+
}));
|
267
|
+
(0,assert.assert)();
|
268
|
+
return (0,id.id)(zTargetType);
|
269
|
+
})();
|
270
|
+
const zParsedPackageJson = (() => {
|
271
|
+
const zTargetType = lib.z.object({
|
272
|
+
name: lib.z.string().optional(),
|
273
|
+
version: lib.z.string().optional(),
|
274
|
+
homepage: lib.z.string().optional(),
|
275
|
+
keycloakify: zBuildOptions_packageJson.optional()
|
276
|
+
});
|
277
|
+
(0,assert.assert)();
|
278
|
+
return (0,id.id)(zTargetType);
|
279
|
+
})();
|
283
280
|
const configurationPackageJsonFilePath = (() => {
|
284
281
|
const rootPackageJsonFilePath = (0,external_path_.join)(projectDirPath, "package.json");
|
285
282
|
return external_fs_.existsSync(rootPackageJsonFilePath)
|
@@ -288,11 +285,48 @@ function getBuildContext(params) {
|
|
288
285
|
})();
|
289
286
|
return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync(configurationPackageJsonFilePath).toString("utf8")));
|
290
287
|
})();
|
291
|
-
const
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
288
|
+
const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
|
289
|
+
if (bundler === "vite" && parsedPackageJson.keycloakify !== undefined) {
|
290
|
+
console.error(source_default().red(`In vite projects, provide your Keycloakify options in vite.config.ts, not in package.json`));
|
291
|
+
process.exit(-1);
|
292
|
+
}
|
293
|
+
const buildOptions = (() => {
|
294
|
+
switch (bundler) {
|
295
|
+
case "vite":
|
296
|
+
(0,assert.assert)(resolvedViteConfig !== undefined);
|
297
|
+
return resolvedViteConfig.buildOptions;
|
298
|
+
case "webpack":
|
299
|
+
(0,assert.assert)(parsedPackageJson.keycloakify !== undefined);
|
300
|
+
return parsedPackageJson.keycloakify;
|
301
|
+
}
|
302
|
+
(0,assert.assert)(false);
|
303
|
+
})();
|
304
|
+
const implementedThemeTypes = {
|
305
|
+
login: {
|
306
|
+
isImplemented: external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, "login"))
|
307
|
+
},
|
308
|
+
email: {
|
309
|
+
isImplemented: external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, "email"))
|
310
|
+
},
|
311
|
+
account: (() => {
|
312
|
+
if (buildOptions.accountThemeImplementation === "none") {
|
313
|
+
return { isImplemented: false };
|
314
|
+
}
|
315
|
+
return {
|
316
|
+
isImplemented: true,
|
317
|
+
type: buildOptions.accountThemeImplementation
|
318
|
+
};
|
319
|
+
})()
|
320
|
+
};
|
321
|
+
if (implementedThemeTypes.account.isImplemented &&
|
322
|
+
!external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, "account"))) {
|
323
|
+
console.error(source_default().red([
|
324
|
+
`You have set 'accountThemeImplementation' to '${implementedThemeTypes.account.type}'`,
|
325
|
+
`but the 'account' directory is missing in your theme source directory`,
|
326
|
+
"Use the `npx keycloakify initialize-account-theme` command to create it"
|
327
|
+
].join(" ")));
|
328
|
+
process.exit(-1);
|
329
|
+
}
|
296
330
|
const themeNames = (() => {
|
297
331
|
if (buildOptions.themeName === undefined) {
|
298
332
|
return parsedPackageJson.name === undefined
|
@@ -313,36 +347,26 @@ function getBuildContext(params) {
|
|
313
347
|
})();
|
314
348
|
const projectBuildDirPath = (() => {
|
315
349
|
webpack: {
|
316
|
-
if (
|
350
|
+
if (bundler !== "webpack") {
|
317
351
|
break webpack;
|
318
352
|
}
|
319
|
-
|
353
|
+
(0,assert.assert)(parsedPackageJson.keycloakify !== undefined);
|
354
|
+
if (parsedPackageJson.keycloakify.projectBuildDirPath !== undefined) {
|
320
355
|
return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
321
|
-
pathIsh:
|
356
|
+
pathIsh: parsedPackageJson.keycloakify.projectBuildDirPath,
|
322
357
|
cwd: projectDirPath
|
323
358
|
});
|
324
359
|
}
|
325
360
|
return (0,external_path_.join)(projectDirPath, "build");
|
326
361
|
}
|
362
|
+
(0,assert.assert)(bundler === "vite");
|
363
|
+
(0,assert.assert)(resolvedViteConfig !== undefined);
|
327
364
|
return (0,external_path_.join)(projectDirPath, resolvedViteConfig.buildDir);
|
328
365
|
})();
|
329
|
-
const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
|
330
|
-
const doUseAccountV3 = (_a = buildOptions.doUseAccountV3) !== null && _a !== void 0 ? _a : false;
|
331
366
|
return {
|
332
|
-
bundler
|
333
|
-
|
334
|
-
|
335
|
-
const { scripts } = lib.z.object({
|
336
|
-
scripts: lib.z.record(lib.z.string()).optional()
|
337
|
-
})
|
338
|
-
.parse(JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8")));
|
339
|
-
return {
|
340
|
-
type: "webpack",
|
341
|
-
packageJsonDirPath: (0,external_path_.dirname)(packageJsonFilePath),
|
342
|
-
packageJsonScripts: scripts !== null && scripts !== void 0 ? scripts : {}
|
343
|
-
};
|
344
|
-
})(),
|
345
|
-
themeVersion: (_c = (_b = buildOptions.themeVersion) !== null && _b !== void 0 ? _b : parsedPackageJson.version) !== null && _c !== void 0 ? _c : "0.0.0",
|
367
|
+
bundler,
|
368
|
+
packageJsonFilePath,
|
369
|
+
themeVersion: (_b = (_a = buildOptions.themeVersion) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
|
346
370
|
themeNames,
|
347
371
|
extraThemeProperties: buildOptions.extraThemeProperties,
|
348
372
|
groupId: (() => {
|
@@ -353,8 +377,8 @@ function getBuildContext(params) {
|
|
353
377
|
: (_e = (_d = (_c = (0,external_url_.parse)(parsedPackageJson.homepage)
|
354
378
|
.host) === null || _c === void 0 ? void 0 : _c.replace(/:[0-9]+$/, "")) === null || _d === void 0 ? void 0 : _d.split(".").reverse().join(".")) !== null && _e !== void 0 ? _e : fallbackGroupId) + ".keycloak");
|
355
379
|
})(),
|
356
|
-
artifactId: (
|
357
|
-
loginThemeResourcesFromKeycloakVersion: (
|
380
|
+
artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : buildOptions.artifactId) !== null && _d !== void 0 ? _d : `${themeNames[0]}-keycloak-theme`,
|
381
|
+
loginThemeResourcesFromKeycloakVersion: (_e = buildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
|
358
382
|
projectDirPath,
|
359
383
|
projectBuildDirPath,
|
360
384
|
keycloakifyBuildDirPath: (() => {
|
@@ -376,17 +400,20 @@ function getBuildContext(params) {
|
|
376
400
|
});
|
377
401
|
}
|
378
402
|
webpack: {
|
379
|
-
if (
|
403
|
+
if (bundler !== "webpack") {
|
380
404
|
break webpack;
|
381
405
|
}
|
382
|
-
|
406
|
+
(0,assert.assert)(parsedPackageJson.keycloakify !== undefined);
|
407
|
+
if (parsedPackageJson.keycloakify.publicDirPath !== undefined) {
|
383
408
|
return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
384
|
-
pathIsh:
|
409
|
+
pathIsh: parsedPackageJson.keycloakify.publicDirPath,
|
385
410
|
cwd: projectDirPath
|
386
411
|
});
|
387
412
|
}
|
388
413
|
return (0,external_path_.join)(projectDirPath, "public");
|
389
414
|
}
|
415
|
+
(0,assert.assert)(bundler === "vite");
|
416
|
+
(0,assert.assert)(resolvedViteConfig !== undefined);
|
390
417
|
return (0,external_path_.join)(projectDirPath, resolvedViteConfig.publicDir);
|
391
418
|
})(),
|
392
419
|
cacheDirPath: (() => {
|
@@ -403,7 +430,7 @@ function getBuildContext(params) {
|
|
403
430
|
})(),
|
404
431
|
urlPathname: (() => {
|
405
432
|
webpack: {
|
406
|
-
if (
|
433
|
+
if (bundler !== "webpack") {
|
407
434
|
break webpack;
|
408
435
|
}
|
409
436
|
const { homepage } = parsedPackageJson;
|
@@ -417,21 +444,28 @@ function getBuildContext(params) {
|
|
417
444
|
const out = url.pathname.replace(/([^/])$/, "$1/");
|
418
445
|
return out === "/" ? undefined : out;
|
419
446
|
}
|
447
|
+
(0,assert.assert)(bundler === "vite");
|
448
|
+
(0,assert.assert)(resolvedViteConfig !== undefined);
|
420
449
|
return resolvedViteConfig.urlPathname;
|
421
450
|
})(),
|
422
451
|
assetsDirPath: (() => {
|
423
452
|
webpack: {
|
424
|
-
if (
|
453
|
+
if (bundler !== "webpack") {
|
425
454
|
break webpack;
|
426
455
|
}
|
427
|
-
|
456
|
+
(0,assert.assert)(parsedPackageJson.keycloakify !== undefined);
|
457
|
+
if (parsedPackageJson.keycloakify.staticDirPathInProjectBuildDirPath !==
|
458
|
+
undefined) {
|
428
459
|
(0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
429
|
-
pathIsh:
|
460
|
+
pathIsh: parsedPackageJson.keycloakify
|
461
|
+
.staticDirPathInProjectBuildDirPath,
|
430
462
|
cwd: projectBuildDirPath
|
431
463
|
});
|
432
464
|
}
|
433
465
|
return (0,external_path_.join)(projectBuildDirPath, "static");
|
434
466
|
}
|
467
|
+
(0,assert.assert)(bundler === "vite");
|
468
|
+
(0,assert.assert)(resolvedViteConfig !== undefined);
|
435
469
|
return (0,external_path_.join)(projectBuildDirPath, resolvedViteConfig.assetsDir);
|
436
470
|
})(),
|
437
471
|
kcContextExclusionsFtlCode: (() => {
|
@@ -447,8 +481,8 @@ function getBuildContext(params) {
|
|
447
481
|
}
|
448
482
|
return buildOptions.kcContextExclusionsFtl;
|
449
483
|
})(),
|
450
|
-
environmentVariables: (
|
451
|
-
|
484
|
+
environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : [],
|
485
|
+
implementedThemeTypes,
|
452
486
|
themeSrcDirPath,
|
453
487
|
fetchOptions: getProxyFetchOptions({
|
454
488
|
npmConfigGetCwd: (function callee(upCount) {
|
@@ -485,8 +519,8 @@ function getBuildContext(params) {
|
|
485
519
|
break build_for_specific_keycloak_major_version;
|
486
520
|
}
|
487
521
|
const keycloakVersionRange = (() => {
|
488
|
-
|
489
|
-
|
522
|
+
if (implementedThemeTypes.account.isImplemented &&
|
523
|
+
implementedThemeTypes.account.type === "Multi-Page") {
|
490
524
|
const keycloakVersionRange = (() => {
|
491
525
|
if (buildForKeycloakMajorVersionNumber <= 21) {
|
492
526
|
return "21-and-below";
|
@@ -541,7 +575,8 @@ function getBuildContext(params) {
|
|
541
575
|
}
|
542
576
|
const jarTargets_default = (() => {
|
543
577
|
const jarTargets = [];
|
544
|
-
if (
|
578
|
+
if (implementedThemeTypes.account.isImplemented &&
|
579
|
+
implementedThemeTypes.account.type === "Multi-Page") {
|
545
580
|
for (const keycloakVersionRange of [
|
546
581
|
"21-and-below",
|
547
582
|
"23",
|
@@ -572,50 +607,8 @@ function getBuildContext(params) {
|
|
572
607
|
if (buildOptions.keycloakVersionTargets === undefined) {
|
573
608
|
return jarTargets_default;
|
574
609
|
}
|
575
|
-
if (buildOptions.keycloakVersionTargets.hasAccountTheme !== doUseAccountV3
|
576
|
-
? false
|
577
|
-
: recordIsImplementedByThemeType.account) {
|
578
|
-
console.log(source_default().red((() => {
|
579
|
-
const { keycloakVersionTargets } = buildOptions;
|
580
|
-
let message = `Bad ${(0,symToStr/* symToStr */.r)({ keycloakVersionTargets })} configuration.\n`;
|
581
|
-
if (keycloakVersionTargets.hasAccountTheme) {
|
582
|
-
message +=
|
583
|
-
"Your codebase does not seem to implement an account theme ";
|
584
|
-
}
|
585
|
-
else {
|
586
|
-
message += "Your codebase implements an account theme ";
|
587
|
-
}
|
588
|
-
const { hasAccountTheme } = keycloakVersionTargets;
|
589
|
-
message += `but you have set ${(0,symToStr/* symToStr */.r)({ keycloakVersionTargets })}.${(0,symToStr/* symToStr */.r)({ hasAccountTheme })}`;
|
590
|
-
message += ` to ${hasAccountTheme} in your `;
|
591
|
-
message += (() => {
|
592
|
-
switch (bundler) {
|
593
|
-
case "vite":
|
594
|
-
return "vite.config.ts";
|
595
|
-
case "webpack":
|
596
|
-
return "package.json";
|
597
|
-
}
|
598
|
-
(0,assert.assert)(false);
|
599
|
-
})();
|
600
|
-
message += `. Please set it to ${!hasAccountTheme} `;
|
601
|
-
message +=
|
602
|
-
"and fill up the relevant keycloak version ranges.\n";
|
603
|
-
message += "Example:\n";
|
604
|
-
message += JSON.stringify((0,id.id)({
|
605
|
-
keycloakVersionTargets: Object.assign({ hasAccountTheme: recordIsImplementedByThemeType.account }, (0,objectFromEntries.objectFromEntries)(jarTargets_default.map(({ keycloakVersionRange, jarFileBasename }) => [
|
606
|
-
keycloakVersionRange,
|
607
|
-
jarFileBasename
|
608
|
-
])))
|
609
|
-
}), null, 2);
|
610
|
-
message +=
|
611
|
-
"\nSee: https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions";
|
612
|
-
return message;
|
613
|
-
})()));
|
614
|
-
process.exit(1);
|
615
|
-
}
|
616
610
|
const jarTargets = [];
|
617
|
-
const
|
618
|
-
for (const [keycloakVersionRange, jarNameOrBoolean] of (0,objectEntries.objectEntries)(rest)) {
|
611
|
+
for (const [keycloakVersionRange, jarNameOrBoolean] of (0,objectEntries.objectEntries)(buildOptions.keycloakVersionTargets)) {
|
619
612
|
if (jarNameOrBoolean === false) {
|
620
613
|
continue;
|
621
614
|
}
|
@@ -649,8 +642,7 @@ function getBuildContext(params) {
|
|
649
642
|
process.exit(1);
|
650
643
|
}
|
651
644
|
return jarTargets;
|
652
|
-
})()
|
653
|
-
doUseAccountV3
|
645
|
+
})()
|
654
646
|
};
|
655
647
|
}
|
656
648
|
//# sourceMappingURL=buildContext.js.map
|
package/bin/440.index.js
CHANGED
@@ -310,7 +310,7 @@ function replaceImportsInJsCode_webpack(params) {
|
|
310
310
|
function replaceImportsInJsCode(params) {
|
311
311
|
const { jsCode, buildContext } = params;
|
312
312
|
const { fixedJsCode } = (() => {
|
313
|
-
switch (buildContext.bundler
|
313
|
+
switch (buildContext.bundler) {
|
314
314
|
case "vite":
|
315
315
|
return replaceImportsInJsCode_vite({
|
316
316
|
jsCode,
|
@@ -712,17 +712,19 @@ async function generateResourcesForMainTheme(params) {
|
|
712
712
|
return (0,external_path_.join)(resourcesDirPath, "theme", themeName, themeType);
|
713
713
|
};
|
714
714
|
for (const themeType of ["login", "account"]) {
|
715
|
-
|
716
|
-
if (!buildContext.recordIsImplementedByThemeType[themeType]) {
|
715
|
+
if (!buildContext.implementedThemeTypes[themeType].isImplemented) {
|
717
716
|
continue;
|
718
717
|
}
|
718
|
+
const isForAccountSpa = themeType === "account" &&
|
719
|
+
((0,assert.assert)(buildContext.implementedThemeTypes.account.isImplemented),
|
720
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page");
|
719
721
|
const themeTypeDirPath = getThemeTypeDirPath({ themeType });
|
720
722
|
apply_replacers_and_move_to_theme_resources: {
|
721
723
|
const destDirPath = (0,external_path_.join)(themeTypeDirPath, "resources", constants/* BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR */.F_);
|
722
724
|
// NOTE: Prevent accumulation of files in the assets dir, as names are hashed they pile up.
|
723
725
|
(0,fs_rmSync/* rmSync */.a)(destDirPath, { recursive: true, force: true });
|
724
726
|
if (themeType === "account" &&
|
725
|
-
buildContext.
|
727
|
+
buildContext.implementedThemeTypes.login.isImplemented) {
|
726
728
|
// NOTE: We prevent doing it twice, it has been done for the login theme.
|
727
729
|
(0,transformCodebase/* transformCodebase */.N)({
|
728
730
|
srcDirPath: (0,external_path_.join)(getThemeTypeDirPath({
|
@@ -735,7 +737,7 @@ async function generateResourcesForMainTheme(params) {
|
|
735
737
|
{
|
736
738
|
const dirPath = (0,external_path_.join)(buildContext.projectBuildDirPath, constants/* KEYCLOAK_RESOURCES */.lj);
|
737
739
|
if (external_fs_.existsSync(dirPath)) {
|
738
|
-
(0,assert.assert)(buildContext.bundler
|
740
|
+
(0,assert.assert)(buildContext.bundler === "webpack");
|
739
741
|
throw new Error([
|
740
742
|
`Keycloakify build error: The ${constants/* KEYCLOAK_RESOURCES */.lj} directory shouldn't exist in your build directory.`,
|
741
743
|
`(${(0,external_path_.relative)(process.cwd(), dirPath)}).\n`,
|
@@ -790,10 +792,10 @@ async function generateResourcesForMainTheme(params) {
|
|
790
792
|
case "login":
|
791
793
|
return constants/* LOGIN_THEME_PAGE_IDS */.XV;
|
792
794
|
case "account":
|
793
|
-
return
|
795
|
+
return isForAccountSpa ? ["index.ftl"] : constants/* ACCOUNT_THEME_PAGE_IDS */.yV;
|
794
796
|
}
|
795
797
|
})(),
|
796
|
-
...(
|
798
|
+
...(isForAccountSpa
|
797
799
|
? []
|
798
800
|
: readExtraPagesNames({
|
799
801
|
themeType,
|
@@ -804,7 +806,7 @@ async function generateResourcesForMainTheme(params) {
|
|
804
806
|
external_fs_.writeFileSync((0,external_path_.join)(themeTypeDirPath, pageId), Buffer.from(ftlCode, "utf8"));
|
805
807
|
});
|
806
808
|
i18n_messages_generation: {
|
807
|
-
if (
|
809
|
+
if (isForAccountSpa) {
|
808
810
|
break i18n_messages_generation;
|
809
811
|
}
|
810
812
|
(0,generateMessageProperties/* generateMessageProperties */.k)({
|
@@ -820,7 +822,7 @@ async function generateResourcesForMainTheme(params) {
|
|
820
822
|
});
|
821
823
|
}
|
822
824
|
keycloak_static_resources: {
|
823
|
-
if (
|
825
|
+
if (isForAccountSpa) {
|
824
826
|
break keycloak_static_resources;
|
825
827
|
}
|
826
828
|
await (0,downloadKeycloakStaticResources/* downloadKeycloakStaticResources */.p)({
|
@@ -841,19 +843,19 @@ async function generateResourcesForMainTheme(params) {
|
|
841
843
|
`parent=${(() => {
|
842
844
|
switch (themeType) {
|
843
845
|
case "account":
|
844
|
-
return
|
846
|
+
return isForAccountSpa ? "base" : constants/* ACCOUNT_V1_THEME_NAME */.ZQ;
|
845
847
|
case "login":
|
846
848
|
return "keycloak";
|
847
849
|
}
|
848
850
|
(0,assert.assert)(false);
|
849
851
|
})()}`,
|
850
|
-
...(
|
852
|
+
...(isForAccountSpa ? ["deprecatedMode=false"] : []),
|
851
853
|
...((_a = buildContext.extraThemeProperties) !== null && _a !== void 0 ? _a : []),
|
852
854
|
...buildContext.environmentVariables.map(({ name, default: defaultValue }) => `${name}=\${env.${name}:${(0,escapeStringForPropertiesFile/* escapeStringForPropertiesFile */.y)(defaultValue)}}`)
|
853
855
|
].join("\n\n"), "utf8"));
|
854
856
|
}
|
855
857
|
email: {
|
856
|
-
if (!buildContext.
|
858
|
+
if (!buildContext.implementedThemeTypes.email.isImplemented) {
|
857
859
|
break email;
|
858
860
|
}
|
859
861
|
const emailThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "email");
|
@@ -863,10 +865,10 @@ async function generateResourcesForMainTheme(params) {
|
|
863
865
|
});
|
864
866
|
}
|
865
867
|
bring_in_account_v1: {
|
866
|
-
if (buildContext.
|
868
|
+
if (!buildContext.implementedThemeTypes.account.isImplemented) {
|
867
869
|
break bring_in_account_v1;
|
868
870
|
}
|
869
|
-
if (
|
871
|
+
if (buildContext.implementedThemeTypes.account.type !== "Multi-Page") {
|
870
872
|
break bring_in_account_v1;
|
871
873
|
}
|
872
874
|
await bringInAccountV1({
|
@@ -875,7 +877,10 @@ async function generateResourcesForMainTheme(params) {
|
|
875
877
|
});
|
876
878
|
}
|
877
879
|
bring_in_account_v3_i18n_messages: {
|
878
|
-
if (!buildContext.
|
880
|
+
if (!buildContext.implementedThemeTypes.account.isImplemented) {
|
881
|
+
break bring_in_account_v3_i18n_messages;
|
882
|
+
}
|
883
|
+
if (buildContext.implementedThemeTypes.account.type !== "Single-Page") {
|
879
884
|
break bring_in_account_v3_i18n_messages;
|
880
885
|
}
|
881
886
|
const { extractedDirPath } = await (0,downloadAndExtractArchive/* downloadAndExtractArchive */.I)({
|
@@ -901,11 +906,11 @@ async function generateResourcesForMainTheme(params) {
|
|
901
906
|
const metaInfKeycloakThemes = { themes: [] };
|
902
907
|
metaInfKeycloakThemes.themes.push({
|
903
908
|
name: themeName,
|
904
|
-
types: (0,objectEntries.objectEntries)(buildContext.
|
905
|
-
.filter(([, isImplemented]) => isImplemented)
|
909
|
+
types: (0,objectEntries.objectEntries)(buildContext.implementedThemeTypes)
|
910
|
+
.filter(([, { isImplemented }]) => isImplemented)
|
906
911
|
.map(([themeType]) => themeType)
|
907
912
|
});
|
908
|
-
if (buildContext.
|
913
|
+
if (buildContext.implementedThemeTypes.account.isImplemented) {
|
909
914
|
metaInfKeycloakThemes.themes.push({
|
910
915
|
name: constants/* ACCOUNT_V1_THEME_NAME */.ZQ,
|
911
916
|
types: ["account"]
|
@@ -1199,7 +1204,7 @@ async function buildJar(params) {
|
|
1199
1204
|
});
|
1200
1205
|
}
|
1201
1206
|
route_legacy_pages: {
|
1202
|
-
if (!buildContext.
|
1207
|
+
if (!buildContext.implementedThemeTypes.login.isImplemented) {
|
1203
1208
|
break route_legacy_pages;
|
1204
1209
|
}
|
1205
1210
|
// NOTE: If there's no account theme there is no special target for keycloak 24 and up so we create
|
@@ -1267,8 +1272,8 @@ async function buildJar(params) {
|
|
1267
1272
|
(0,assert.assert)();
|
1268
1273
|
async function buildJars(params) {
|
1269
1274
|
const { resourcesDirPath, buildContext } = params;
|
1270
|
-
const doesImplementAccountV1Theme = buildContext.
|
1271
|
-
|
1275
|
+
const doesImplementAccountV1Theme = buildContext.implementedThemeTypes.account.isImplemented &&
|
1276
|
+
buildContext.implementedThemeTypes.account.type === "Multi-Page";
|
1272
1277
|
await Promise.all(keycloakAccountV1Versions.map(keycloakAccountV1Version => keycloakThemeAdditionalInfoExtensionVersions.map(keycloakThemeAdditionalInfoExtensionVersion => {
|
1273
1278
|
const keycloakVersionRange = getKeycloakVersionRangeForJar({
|
1274
1279
|
doesImplementAccountV1Theme,
|
@@ -1362,7 +1367,7 @@ async function command(params) {
|
|
1362
1367
|
buildContext
|
1363
1368
|
});
|
1364
1369
|
run_post_build_script: {
|
1365
|
-
if (buildContext.bundler
|
1370
|
+
if (buildContext.bundler !== "vite") {
|
1366
1371
|
break run_post_build_script;
|
1367
1372
|
}
|
1368
1373
|
external_child_process_.execSync("npx vite", {
|