keycloakify 11.2.10 → 11.3.0-rc.1

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.
Files changed (48) hide show
  1. package/bin/193.index.js +1 -5
  2. package/bin/453.index.js +21 -26
  3. package/bin/526.index.js +1 -5
  4. package/bin/573.index.js +1 -5
  5. package/bin/780.index.js +1 -5
  6. package/bin/786.index.js +3 -8
  7. package/bin/932.index.js +9 -12
  8. package/bin/97.index.js +11 -16
  9. package/bin/add-story.d.ts +4 -0
  10. package/bin/copy-keycloak-resources-to-public.d.ts +4 -0
  11. package/bin/eject-page.d.ts +5 -0
  12. package/bin/initialize-email-theme.d.ts +4 -0
  13. package/bin/main.d.ts +2 -0
  14. package/bin/main.js +5289 -277
  15. package/bin/shared/buildContext.js.map +1 -1
  16. package/bin/shared/constants.js +4 -0
  17. package/bin/shared/constants.js.map +1 -1
  18. package/bin/shared/customHandler.js +20 -0
  19. package/bin/shared/customHandler.js.map +1 -0
  20. package/bin/shared/customHandler_caller.js.map +1 -0
  21. package/bin/update-kc-gen.d.ts +4 -0
  22. package/package.json +12 -11
  23. package/src/bin/add-story.ts +3 -8
  24. package/src/bin/copy-keycloak-resources-to-public.ts +3 -6
  25. package/src/bin/eject-page.ts +3 -8
  26. package/src/bin/initialize-account-theme/initialize-account-theme.ts +3 -6
  27. package/src/bin/initialize-email-theme.ts +3 -6
  28. package/src/bin/keycloakify/keycloakify.ts +3 -6
  29. package/src/bin/main.ts +181 -124
  30. package/src/bin/shared/buildContext.ts +5 -8
  31. package/src/bin/shared/constants.ts +5 -0
  32. package/src/bin/shared/customHandler.ts +35 -0
  33. package/src/bin/shared/customHandler_caller.ts +47 -0
  34. package/src/bin/start-keycloak/start-keycloak.ts +10 -12
  35. package/src/bin/tools/fetchProxyOptions.ts +8 -6
  36. package/src/bin/update-kc-gen.ts +3 -8
  37. package/src/vite-plugin/vite-plugin.ts +1 -3
  38. package/vite-plugin/index.js +8 -6
  39. package/bin/31.index.js +0 -883
  40. package/bin/347.index.js +0 -4081
  41. package/bin/shared/KeycloakVersionRange.d.ts +0 -5
  42. package/bin/shared/buildContext.d.ts +0 -108
  43. package/bin/shared/constants.d.ts +0 -18
  44. package/bin/shared/copyKeycloakResourcesToPublic.d.ts +0 -6
  45. package/bin/shared/generateKcGenTs.d.ts +0 -15
  46. package/bin/shared/getLatestsSemVersionedTag.d.ts +0 -15
  47. package/bin/shared/metaInfKeycloakThemes.d.ts +0 -13
  48. package/bin/shared/promptKeycloakVersion.d.ts +0 -10
package/bin/31.index.js DELETED
@@ -1,883 +0,0 @@
1
- "use strict";
2
- exports.id = 31;
3
- exports.ids = [31];
4
- exports.modules = {
5
-
6
- /***/ 56031:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
-
10
- // EXPORTS
11
- __webpack_require__.d(__webpack_exports__, {
12
- "s": () => (/* binding */ getBuildContext)
13
- });
14
-
15
- // EXTERNAL MODULE: external "url"
16
- var external_url_ = __webpack_require__(57310);
17
- // EXTERNAL MODULE: external "path"
18
- var external_path_ = __webpack_require__(71017);
19
- // EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
20
- var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
21
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
22
- var lib = __webpack_require__(52300);
23
- // EXTERNAL MODULE: external "fs"
24
- var external_fs_ = __webpack_require__(57147);
25
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
26
- var assert = __webpack_require__(29041);
27
- // EXTERNAL MODULE: external "child_process"
28
- var external_child_process_ = __webpack_require__(32081);
29
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
30
- var constants = __webpack_require__(173);
31
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/index.mjs
32
- var esm = __webpack_require__(55140);
33
- // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
34
- var crawl = __webpack_require__(73036);
35
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/objectEntries.mjs
36
- var objectEntries = __webpack_require__(91040);
37
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
38
- var id = __webpack_require__(38469);
39
- // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
40
- var source = __webpack_require__(78818);
41
- var source_default = /*#__PURE__*/__webpack_require__.n(source);
42
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
43
- var exclude = __webpack_require__(83101);
44
- ;// CONCATENATED MODULE: ./dist/bin/tools/fetchProxyOptions.js
45
-
46
-
47
-
48
- function getProxyFetchOptions(params) {
49
- var _a, _b, _c;
50
- const { npmConfigGetCwd } = params;
51
- const cfg = (() => {
52
- const output = external_child_process_.execSync("npm config get", {
53
- cwd: npmConfigGetCwd
54
- })
55
- .toString("utf8");
56
- return output
57
- .split("\n")
58
- .filter(line => !line.startsWith(";"))
59
- .map(line => line.trim())
60
- .map(line => {
61
- const [key, value] = line.split("=");
62
- if (key === undefined) {
63
- return undefined;
64
- }
65
- if (value === undefined) {
66
- return undefined;
67
- }
68
- return [key.trim(), value.trim()];
69
- })
70
- .filter((0,exclude/* exclude */.D)(undefined))
71
- .filter(([key]) => key !== "")
72
- .map(([key, value]) => {
73
- if (value.startsWith('"') && value.endsWith('"')) {
74
- return [key, value.slice(1, -1)];
75
- }
76
- if (value === "true" || value === "false") {
77
- return [key, value];
78
- }
79
- return undefined;
80
- })
81
- .filter((0,exclude/* exclude */.D)(undefined))
82
- .reduce((cfg, [key, value]) => key in cfg
83
- ? Object.assign(Object.assign({}, cfg), { [key]: [...ensureArray(cfg[key]), value] }) : Object.assign(Object.assign({}, cfg), { [key]: value }), {});
84
- })();
85
- const proxy = ensureSingleOrNone((_a = cfg["https-proxy"]) !== null && _a !== void 0 ? _a : cfg["proxy"]);
86
- const noProxy = (_b = cfg["noproxy"]) !== null && _b !== void 0 ? _b : cfg["no-proxy"];
87
- const strictSSL = ensureSingleOrNone(cfg["strict-ssl"]) === "true";
88
- const cert = cfg["cert"];
89
- const ca = ensureArray((_c = cfg["ca"]) !== null && _c !== void 0 ? _c : cfg["ca[]"]);
90
- const cafile = ensureSingleOrNone(cfg["cafile"]);
91
- if (cafile !== undefined) {
92
- ca.push(...(() => {
93
- const cafileContent = external_fs_.readFileSync(cafile).toString("utf8");
94
- const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
95
- const chunks = (arr, size = 2) => arr
96
- .map((_, i) => i % size == 0 && arr.slice(i, i + size))
97
- .filter(Boolean);
98
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
99
- .join("")
100
- .replace(/\r?\n/g, newLinePlaceholder)
101
- .replace(new RegExp(`^${newLinePlaceholder}`), "")
102
- .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
103
- })());
104
- }
105
- return {
106
- proxy,
107
- noProxy,
108
- strictSSL,
109
- cert,
110
- ca: ca.length === 0 ? undefined : ca
111
- };
112
- }
113
- function ensureArray(arg0) {
114
- return Array.isArray(arg0) ? arg0 : arg0 === undefined ? [] : [arg0];
115
- }
116
- function ensureSingleOrNone(arg0) {
117
- if (!Array.isArray(arg0))
118
- return arg0;
119
- if (arg0.length === 0)
120
- return undefined;
121
- if (arg0.length === 1)
122
- return arg0[0];
123
- throw new Error("Illegal configuration, expected a single value but found multiple: " +
124
- arg0.map(String).join(", "));
125
- }
126
- //# sourceMappingURL=fetchProxyOptions.js.map
127
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
128
- var is = __webpack_require__(16453);
129
- ;// CONCATENATED MODULE: ./dist/bin/shared/buildContext.js
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
- (0,assert/* assert */.h)();
147
- function getBuildContext(params) {
148
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
149
- const { cliCommandOptions } = params;
150
- const projectDirPath = cliCommandOptions.projectDirPath !== undefined
151
- ? (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
152
- pathIsh: cliCommandOptions.projectDirPath,
153
- cwd: process.cwd()
154
- })
155
- : process.cwd();
156
- const { themeSrcDirPath } = (() => {
157
- const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
158
- const themeSrcDirPath = (0,crawl/* crawl */.J)({
159
- dirPath: srcDirPath,
160
- returnedPathsType: "relative to dirPath"
161
- })
162
- .map(fileRelativePath => {
163
- for (const themeSrcDirBasename of ["keycloak-theme", "keycloak_theme"]) {
164
- const split = fileRelativePath.split(themeSrcDirBasename);
165
- if (split.length === 2) {
166
- return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
167
- }
168
- }
169
- return undefined;
170
- })
171
- .filter((0,esm/* exclude */.De)(undefined))[0];
172
- if (themeSrcDirPath !== undefined) {
173
- return { themeSrcDirPath };
174
- }
175
- for (const themeType of [...constants/* THEME_TYPES */.Jh, "email"]) {
176
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
177
- continue;
178
- }
179
- return { themeSrcDirPath: srcDirPath };
180
- }
181
- console.log(source_default().red([
182
- `Can't locate your Keycloak theme source directory in .${external_path_.sep}${(0,external_path_.relative)(process.cwd(), srcDirPath)}`,
183
- `Make sure to either use the Keycloakify CLI in the root of your Keycloakify project or use the --project CLI option`,
184
- `If you are collocating your Keycloak theme with your app you must have a directory named 'keycloak-theme' or 'keycloak_theme' in your 'src' directory`
185
- ].join("\n")));
186
- process.exit(1);
187
- })();
188
- const { resolvedViteConfig } = (() => {
189
- if (external_fs_.readdirSync(projectDirPath)
190
- .find(fileBasename => fileBasename.startsWith("vite.config")) ===
191
- undefined) {
192
- return { resolvedViteConfig: undefined };
193
- }
194
- const output = external_child_process_.execSync("npx vite", {
195
- cwd: projectDirPath,
196
- env: Object.assign(Object.assign({}, process.env), { [constants/* VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG */.TE.RESOLVE_VITE_CONFIG]: "true" })
197
- })
198
- .toString("utf8");
199
- (0,assert/* assert */.h)(output.includes(constants/* VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG */.TE.RESOLVE_VITE_CONFIG), "Seems like the Keycloakify's Vite plugin is not installed.");
200
- const resolvedViteConfigStr = output
201
- .split(constants/* VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.RESOLVE_VITE_CONFIG */.TE.RESOLVE_VITE_CONFIG)
202
- .reverse()[0];
203
- const resolvedViteConfig = JSON.parse(resolvedViteConfigStr);
204
- return { resolvedViteConfig };
205
- })();
206
- const packageJsonFilePath = (function getPackageJSonDirPath(upCount) {
207
- var _a, _b;
208
- const dirPath = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(upCount).fill("..")]));
209
- (0,assert/* assert */.h)(dirPath !== external_path_.sep, "Root package.json not found");
210
- success: {
211
- const packageJsonFilePath = (0,external_path_.join)(dirPath, "package.json");
212
- if (!external_fs_.existsSync(packageJsonFilePath)) {
213
- break success;
214
- }
215
- const parsedPackageJson = lib.z.object({
216
- name: lib.z.string().optional(),
217
- dependencies: lib.z.record(lib.z.string()).optional(),
218
- devDependencies: lib.z.record(lib.z.string()).optional()
219
- })
220
- .parse(JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8")));
221
- if (((_a = parsedPackageJson.dependencies) === null || _a === void 0 ? void 0 : _a.keycloakify) === undefined &&
222
- ((_b = parsedPackageJson.devDependencies) === null || _b === void 0 ? void 0 : _b.keycloakify) === undefined) {
223
- break success;
224
- }
225
- return packageJsonFilePath;
226
- }
227
- return getPackageJSonDirPath(upCount + 1);
228
- })(0);
229
- const parsedPackageJson = (() => {
230
- const zMultiPageApp = (() => {
231
- const zTargetType = lib.z.object({
232
- accountThemeImplementation: lib.z.literal("Multi-Page"),
233
- keycloakVersionTargets: lib.z.object({
234
- "21-and-below": lib.z.union([lib.z.boolean(), lib.z.string()]),
235
- "23": lib.z.union([lib.z.boolean(), lib.z.string()]),
236
- "24": lib.z.union([lib.z.boolean(), lib.z.string()]),
237
- "25": lib.z.union([lib.z.boolean(), lib.z.string()]),
238
- "26-and-above": lib.z.union([lib.z.boolean(), lib.z.string()])
239
- })
240
- .optional()
241
- });
242
- (0,assert/* assert */.h)();
243
- return (0,id.id)(zTargetType);
244
- })();
245
- const zSinglePageApp = (() => {
246
- const zTargetType = lib.z.object({
247
- accountThemeImplementation: lib.z.union([
248
- lib.z.literal("Single-Page"),
249
- lib.z.literal("none")
250
- ]),
251
- keycloakVersionTargets: lib.z.object({
252
- "22-to-25": lib.z.union([lib.z.boolean(), lib.z.string()]),
253
- "all-other-versions": lib.z.union([lib.z.boolean(), lib.z.string()])
254
- })
255
- .optional()
256
- });
257
- (0,assert/* assert */.h)();
258
- return (0,id.id)(zTargetType);
259
- })();
260
- const zAccountThemeImplAndKeycloakVersionTargets = (() => {
261
- const zTargetType = lib.z.union([zMultiPageApp, zSinglePageApp]);
262
- (0,assert/* assert */.h)();
263
- return (0,id.id)(zTargetType);
264
- })();
265
- const zStartKeycloakOptions = (() => {
266
- const zTargetType = lib.z.object({
267
- dockerImage: lib.z.string().optional(),
268
- extensionJars: lib.z.array(lib.z.string()).optional(),
269
- realmJsonFilePath: lib.z.string().optional(),
270
- dockerExtraArgs: lib.z.array(lib.z.string()).optional(),
271
- keycloakExtraArgs: lib.z.array(lib.z.string()).optional(),
272
- port: lib.z.number().optional()
273
- });
274
- (0,assert/* assert */.h)();
275
- return (0,id.id)(zTargetType);
276
- })();
277
- const zBuildOptions = (() => {
278
- const zTargetType = lib.z.intersection(lib.z.object({
279
- themeName: lib.z.union([lib.z.string(), lib.z.array(lib.z.string())]).optional(),
280
- themeVersion: lib.z.string().optional(),
281
- environmentVariables: lib.z.array(lib.z.object({
282
- name: lib.z.string(),
283
- default: lib.z.string()
284
- }))
285
- .optional(),
286
- extraThemeProperties: lib.z.array(lib.z.string()).optional(),
287
- artifactId: lib.z.string().optional(),
288
- groupId: lib.z.string().optional(),
289
- keycloakifyBuildDirPath: lib.z.string().optional(),
290
- kcContextExclusionsFtl: lib.z.string().optional(),
291
- startKeycloakOptions: zStartKeycloakOptions.optional()
292
- }), zAccountThemeImplAndKeycloakVersionTargets);
293
- (0,assert/* assert */.h)();
294
- return (0,id.id)(zTargetType);
295
- })();
296
- const zBuildOptions_packageJson = (() => {
297
- const zTargetType = lib.z.intersection(zBuildOptions, lib.z.object({
298
- projectBuildDirPath: lib.z.string().optional(),
299
- staticDirPathInProjectBuildDirPath: lib.z.string().optional(),
300
- publicDirPath: lib.z.string().optional()
301
- }));
302
- (0,assert/* assert */.h)();
303
- return (0,id.id)(zTargetType);
304
- })();
305
- const zParsedPackageJson = (() => {
306
- const zTargetType = lib.z.object({
307
- name: lib.z.string().optional(),
308
- version: lib.z.string().optional(),
309
- homepage: lib.z.string().optional(),
310
- keycloakify: zBuildOptions_packageJson.optional()
311
- });
312
- (0,assert/* assert */.h)();
313
- return (0,id.id)(zTargetType);
314
- })();
315
- const configurationPackageJsonFilePath = (() => {
316
- const rootPackageJsonFilePath = (0,external_path_.join)(projectDirPath, "package.json");
317
- return external_fs_.existsSync(rootPackageJsonFilePath)
318
- ? rootPackageJsonFilePath
319
- : packageJsonFilePath;
320
- })();
321
- return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync(configurationPackageJsonFilePath).toString("utf8")));
322
- })();
323
- const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
324
- if (bundler === "vite" && parsedPackageJson.keycloakify !== undefined) {
325
- console.error(source_default().red(`In vite projects, provide your Keycloakify options in vite.config.ts, not in package.json`));
326
- process.exit(-1);
327
- }
328
- const buildOptions = (() => {
329
- switch (bundler) {
330
- case "vite":
331
- (0,assert/* assert */.h)(resolvedViteConfig !== undefined);
332
- return resolvedViteConfig.buildOptions;
333
- case "webpack":
334
- (0,assert/* assert */.h)(parsedPackageJson.keycloakify !== undefined);
335
- return parsedPackageJson.keycloakify;
336
- }
337
- (0,assert/* assert */.h)(false);
338
- })();
339
- const implementedThemeTypes = {
340
- login: {
341
- isImplemented: external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, "login"))
342
- },
343
- email: {
344
- isImplemented: external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, "email"))
345
- },
346
- account: (() => {
347
- if (buildOptions.accountThemeImplementation === "none") {
348
- return { isImplemented: false };
349
- }
350
- return {
351
- isImplemented: true,
352
- type: buildOptions.accountThemeImplementation
353
- };
354
- })()
355
- };
356
- if (implementedThemeTypes.account.isImplemented &&
357
- !external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, "account"))) {
358
- console.error(source_default().red([
359
- `You have set 'accountThemeImplementation' to '${implementedThemeTypes.account.type}'`,
360
- `but the 'account' directory is missing in your theme source directory`,
361
- "Use the `npx keycloakify initialize-account-theme` command to create it"
362
- ].join(" ")));
363
- process.exit(-1);
364
- }
365
- const themeNames = (() => {
366
- const themeNames = (() => {
367
- if (buildOptions.themeName === undefined) {
368
- return parsedPackageJson.name === undefined
369
- ? ["keycloakify"]
370
- : [
371
- parsedPackageJson.name
372
- .replace(/^@(.*)/, "$1")
373
- .split("/")
374
- .join("-")
375
- ];
376
- }
377
- if (typeof buildOptions.themeName === "string") {
378
- return [buildOptions.themeName];
379
- }
380
- const [mainThemeName, ...themeVariantNames] = buildOptions.themeName;
381
- (0,assert/* assert */.h)(mainThemeName !== undefined);
382
- return [mainThemeName, ...themeVariantNames];
383
- })();
384
- for (const themeName of themeNames) {
385
- if (!/^[a-zA-Z0-9_-]+$/.test(themeName)) {
386
- console.error(source_default().red([
387
- `Invalid theme name: ${themeName}`,
388
- `Theme names should only contain letters, numbers, and "_" or "-"`
389
- ].join(" ")));
390
- process.exit(-1);
391
- }
392
- }
393
- return themeNames;
394
- })();
395
- const projectBuildDirPath = (() => {
396
- webpack: {
397
- if (bundler !== "webpack") {
398
- break webpack;
399
- }
400
- (0,assert/* assert */.h)(parsedPackageJson.keycloakify !== undefined);
401
- if (parsedPackageJson.keycloakify.projectBuildDirPath !== undefined) {
402
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
403
- pathIsh: parsedPackageJson.keycloakify.projectBuildDirPath,
404
- cwd: projectDirPath
405
- });
406
- }
407
- return (0,external_path_.join)(projectDirPath, "build");
408
- }
409
- (0,assert/* assert */.h)(bundler === "vite");
410
- (0,assert/* assert */.h)(resolvedViteConfig !== undefined);
411
- return (0,external_path_.join)(projectDirPath, resolvedViteConfig.buildDir);
412
- })();
413
- return {
414
- bundler,
415
- packageJsonFilePath,
416
- themeVersion: (_b = (_a = buildOptions.themeVersion) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
417
- themeNames,
418
- extraThemeProperties: buildOptions.extraThemeProperties,
419
- groupId: (() => {
420
- var _a, _b, _c, _d, _e;
421
- const fallbackGroupId = `${themeNames[0]}.keycloak`;
422
- return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : buildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
423
- ? fallbackGroupId
424
- : (_e = (_d = (_c = (0,external_url_.parse)(parsedPackageJson.homepage)
425
- .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");
426
- })(),
427
- artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : buildOptions.artifactId) !== null && _d !== void 0 ? _d : `${themeNames[0]}-keycloak-theme`,
428
- projectDirPath,
429
- projectBuildDirPath,
430
- keycloakifyBuildDirPath: (() => {
431
- if (buildOptions.keycloakifyBuildDirPath !== undefined) {
432
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
433
- pathIsh: buildOptions.keycloakifyBuildDirPath,
434
- cwd: projectDirPath
435
- });
436
- }
437
- return (0,external_path_.join)(projectDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
438
- ? "build_keycloak"
439
- : `${resolvedViteConfig.buildDir}_keycloak`);
440
- })(),
441
- publicDirPath: (() => {
442
- if (process.env.PUBLIC_DIR_PATH !== undefined) {
443
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
444
- pathIsh: process.env.PUBLIC_DIR_PATH,
445
- cwd: projectDirPath
446
- });
447
- }
448
- webpack: {
449
- if (bundler !== "webpack") {
450
- break webpack;
451
- }
452
- (0,assert/* assert */.h)(parsedPackageJson.keycloakify !== undefined);
453
- if (parsedPackageJson.keycloakify.publicDirPath !== undefined) {
454
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
455
- pathIsh: parsedPackageJson.keycloakify.publicDirPath,
456
- cwd: projectDirPath
457
- });
458
- }
459
- return (0,external_path_.join)(projectDirPath, "public");
460
- }
461
- (0,assert/* assert */.h)(bundler === "vite");
462
- (0,assert/* assert */.h)(resolvedViteConfig !== undefined);
463
- return (0,external_path_.join)(projectDirPath, resolvedViteConfig.publicDir);
464
- })(),
465
- cacheDirPath: (0,external_path_.join)((() => {
466
- if (process.env.XDG_CACHE_HOME !== undefined) {
467
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
468
- pathIsh: process.env.XDG_CACHE_HOME,
469
- cwd: process.cwd()
470
- });
471
- }
472
- return (0,external_path_.join)((0,external_path_.dirname)(packageJsonFilePath), "node_modules", ".cache");
473
- })(), "keycloakify"),
474
- urlPathname: (() => {
475
- webpack: {
476
- if (bundler !== "webpack") {
477
- break webpack;
478
- }
479
- const { homepage } = parsedPackageJson;
480
- let url = undefined;
481
- if (homepage !== undefined) {
482
- url = new URL(homepage);
483
- }
484
- if (url === undefined) {
485
- return undefined;
486
- }
487
- const out = url.pathname.replace(/([^/])$/, "$1/");
488
- return out === "/" ? undefined : out;
489
- }
490
- (0,assert/* assert */.h)(bundler === "vite");
491
- (0,assert/* assert */.h)(resolvedViteConfig !== undefined);
492
- return resolvedViteConfig.urlPathname;
493
- })(),
494
- assetsDirPath: (() => {
495
- webpack: {
496
- if (bundler !== "webpack") {
497
- break webpack;
498
- }
499
- (0,assert/* assert */.h)(parsedPackageJson.keycloakify !== undefined);
500
- if (parsedPackageJson.keycloakify.staticDirPathInProjectBuildDirPath !==
501
- undefined) {
502
- (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
503
- pathIsh: parsedPackageJson.keycloakify
504
- .staticDirPathInProjectBuildDirPath,
505
- cwd: projectBuildDirPath
506
- });
507
- }
508
- return (0,external_path_.join)(projectBuildDirPath, "static");
509
- }
510
- (0,assert/* assert */.h)(bundler === "vite");
511
- (0,assert/* assert */.h)(resolvedViteConfig !== undefined);
512
- return (0,external_path_.join)(projectBuildDirPath, resolvedViteConfig.assetsDir);
513
- })(),
514
- kcContextExclusionsFtlCode: (() => {
515
- if (buildOptions.kcContextExclusionsFtl === undefined) {
516
- return undefined;
517
- }
518
- if (buildOptions.kcContextExclusionsFtl.endsWith(".ftl")) {
519
- const kcContextExclusionsFtlPath = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
520
- pathIsh: buildOptions.kcContextExclusionsFtl,
521
- cwd: projectDirPath
522
- });
523
- return external_fs_.readFileSync(kcContextExclusionsFtlPath).toString("utf8");
524
- }
525
- return buildOptions.kcContextExclusionsFtl;
526
- })(),
527
- environmentVariables: (_e = buildOptions.environmentVariables) !== null && _e !== void 0 ? _e : [],
528
- implementedThemeTypes,
529
- themeSrcDirPath,
530
- fetchOptions: getProxyFetchOptions({
531
- npmConfigGetCwd: (function callee(upCount) {
532
- const dirPath = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(upCount).fill("..")]));
533
- (0,assert/* assert */.h)(dirPath !== external_path_.sep, "Couldn't find a place to run 'npm config get'");
534
- try {
535
- external_child_process_.execSync("npm config get", {
536
- cwd: dirPath,
537
- stdio: "pipe"
538
- });
539
- }
540
- catch (error) {
541
- if (String(error).includes("ENOWORKSPACES")) {
542
- return callee(upCount + 1);
543
- }
544
- throw error;
545
- }
546
- return dirPath;
547
- })(0)
548
- }),
549
- jarTargets: (() => {
550
- const getDefaultJarFileBasename = (range) => `keycloak-theme-for-kc-${range}.jar`;
551
- build_for_specific_keycloak_major_version: {
552
- const buildForKeycloakMajorVersionNumber = (() => {
553
- const envValue = process.env[constants/* BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME */.ac];
554
- if (envValue === undefined) {
555
- return undefined;
556
- }
557
- const major = parseInt(envValue);
558
- (0,assert/* assert */.h)(!isNaN(major));
559
- return major;
560
- })();
561
- if (buildForKeycloakMajorVersionNumber === undefined) {
562
- break build_for_specific_keycloak_major_version;
563
- }
564
- const keycloakVersionRange = (() => {
565
- if (implementedThemeTypes.account.isImplemented &&
566
- implementedThemeTypes.account.type === "Multi-Page") {
567
- const keycloakVersionRange = (() => {
568
- if (buildForKeycloakMajorVersionNumber <= 21) {
569
- return "21-and-below";
570
- }
571
- (0,assert/* assert */.h)(buildForKeycloakMajorVersionNumber !== 22);
572
- if (buildForKeycloakMajorVersionNumber === 23) {
573
- return "23";
574
- }
575
- if (buildForKeycloakMajorVersionNumber === 24) {
576
- return "24";
577
- }
578
- if (buildForKeycloakMajorVersionNumber === 25) {
579
- return "25";
580
- }
581
- return "26-and-above";
582
- })();
583
- (0,assert/* assert */.h)();
584
- return keycloakVersionRange;
585
- }
586
- else {
587
- const keycloakVersionRange = (() => {
588
- if (buildForKeycloakMajorVersionNumber <= 21 ||
589
- buildForKeycloakMajorVersionNumber >= 26) {
590
- return "all-other-versions";
591
- }
592
- return "22-to-25";
593
- })();
594
- (0,assert/* assert */.h)();
595
- return keycloakVersionRange;
596
- }
597
- })();
598
- const jarFileBasename = (() => {
599
- use_custom_jar_basename: {
600
- const { keycloakVersionTargets } = buildOptions;
601
- (0,assert/* assert */.h)((0,is.is)(keycloakVersionTargets));
602
- if (keycloakVersionTargets === undefined) {
603
- break use_custom_jar_basename;
604
- }
605
- const entry = (0,objectEntries/* objectEntries */.q)(keycloakVersionTargets).find(([keycloakVersionRange_entry]) => keycloakVersionRange_entry === keycloakVersionRange);
606
- if (entry === undefined) {
607
- break use_custom_jar_basename;
608
- }
609
- const maybeJarFileBasename = entry[1];
610
- if (typeof maybeJarFileBasename !== "string") {
611
- break use_custom_jar_basename;
612
- }
613
- return maybeJarFileBasename;
614
- }
615
- return getDefaultJarFileBasename(keycloakVersionRange);
616
- })();
617
- return [
618
- {
619
- keycloakVersionRange,
620
- jarFileBasename
621
- }
622
- ];
623
- }
624
- const jarTargets_default = (() => {
625
- const jarTargets = [];
626
- if (implementedThemeTypes.account.isImplemented &&
627
- implementedThemeTypes.account.type === "Multi-Page") {
628
- for (const keycloakVersionRange of [
629
- "21-and-below",
630
- "23",
631
- "24",
632
- "25",
633
- "26-and-above"
634
- ]) {
635
- (0,assert/* assert */.h)(true);
636
- jarTargets.push({
637
- keycloakVersionRange,
638
- jarFileBasename: getDefaultJarFileBasename(keycloakVersionRange)
639
- });
640
- }
641
- }
642
- else {
643
- for (const keycloakVersionRange of [
644
- "22-to-25",
645
- "all-other-versions"
646
- ]) {
647
- (0,assert/* assert */.h)(true);
648
- jarTargets.push({
649
- keycloakVersionRange,
650
- jarFileBasename: getDefaultJarFileBasename(keycloakVersionRange)
651
- });
652
- }
653
- }
654
- return jarTargets;
655
- })();
656
- if (buildOptions.keycloakVersionTargets === undefined) {
657
- return jarTargets_default;
658
- }
659
- const jarTargets = [];
660
- for (const [keycloakVersionRange, jarNameOrBoolean] of (0,objectEntries/* objectEntries */.q)((() => {
661
- const { keycloakVersionTargets } = buildOptions;
662
- (0,assert/* assert */.h)((0,is.is)(keycloakVersionTargets));
663
- return keycloakVersionTargets;
664
- })())) {
665
- if (jarNameOrBoolean === false) {
666
- continue;
667
- }
668
- if (jarNameOrBoolean === true) {
669
- jarTargets.push({
670
- keycloakVersionRange: keycloakVersionRange,
671
- jarFileBasename: getDefaultJarFileBasename(keycloakVersionRange)
672
- });
673
- continue;
674
- }
675
- const jarFileBasename = jarNameOrBoolean;
676
- if (!jarFileBasename.endsWith(".jar")) {
677
- console.log(source_default().red(`Bad ${jarFileBasename} should end with '.jar'\n`));
678
- process.exit(1);
679
- }
680
- if (jarFileBasename.includes("/") || jarFileBasename.includes("\\")) {
681
- console.log(source_default().red([
682
- `Invalid ${jarFileBasename}. It's not supposed to be a path,`,
683
- `Only the basename of the jar file is expected.`,
684
- `Example: keycloak-theme.jar`
685
- ].join(" ")));
686
- process.exit(1);
687
- }
688
- jarTargets.push({
689
- keycloakVersionRange: keycloakVersionRange,
690
- jarFileBasename: jarNameOrBoolean
691
- });
692
- }
693
- if (jarTargets.length === 0) {
694
- console.log(source_default().red("All jar targets are disabled. Please enable at least one jar target."));
695
- process.exit(1);
696
- }
697
- return jarTargets;
698
- })(),
699
- startKeycloakOptions: {
700
- dockerImage: (() => {
701
- var _a;
702
- if (((_a = buildOptions.startKeycloakOptions) === null || _a === void 0 ? void 0 : _a.dockerImage) === undefined) {
703
- return undefined;
704
- }
705
- const [reference, tag, ...rest] = buildOptions.startKeycloakOptions.dockerImage.split(":");
706
- (0,assert/* assert */.h)(reference !== undefined && tag !== undefined && rest.length === 0, `Invalid docker image: ${buildOptions.startKeycloakOptions.dockerImage}`);
707
- return { reference, tag };
708
- })(),
709
- dockerExtraArgs: (_g = (_f = buildOptions.startKeycloakOptions) === null || _f === void 0 ? void 0 : _f.dockerExtraArgs) !== null && _g !== void 0 ? _g : [],
710
- keycloakExtraArgs: (_j = (_h = buildOptions.startKeycloakOptions) === null || _h === void 0 ? void 0 : _h.keycloakExtraArgs) !== null && _j !== void 0 ? _j : [],
711
- extensionJars: ((_l = (_k = buildOptions.startKeycloakOptions) === null || _k === void 0 ? void 0 : _k.extensionJars) !== null && _l !== void 0 ? _l : []).map(urlOrPath => {
712
- if (/^https?:\/\//.test(urlOrPath)) {
713
- return { type: "url", url: urlOrPath };
714
- }
715
- return {
716
- type: "path",
717
- path: (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
718
- pathIsh: urlOrPath,
719
- cwd: projectDirPath
720
- })
721
- };
722
- }),
723
- realmJsonFilePath: ((_m = buildOptions.startKeycloakOptions) === null || _m === void 0 ? void 0 : _m.realmJsonFilePath) === undefined
724
- ? undefined
725
- : (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
726
- pathIsh: buildOptions.startKeycloakOptions.realmJsonFilePath,
727
- cwd: projectDirPath
728
- }),
729
- port: (_o = buildOptions.startKeycloakOptions) === null || _o === void 0 ? void 0 : _o.port
730
- }
731
- };
732
- }
733
- //# sourceMappingURL=buildContext.js.map
734
-
735
- /***/ }),
736
-
737
- /***/ 173:
738
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
739
-
740
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
741
- /* harmony export */ "Jh": () => (/* binding */ THEME_TYPES),
742
- /* harmony export */ "Ju": () => (/* binding */ WELL_KNOWN_DIRECTORY_BASE_NAME),
743
- /* harmony export */ "TE": () => (/* binding */ VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES),
744
- /* harmony export */ "XV": () => (/* binding */ LOGIN_THEME_PAGE_IDS),
745
- /* harmony export */ "_L": () => (/* binding */ FALLBACK_LANGUAGE_TAG),
746
- /* harmony export */ "ac": () => (/* binding */ BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME),
747
- /* harmony export */ "sv": () => (/* binding */ CONTAINER_NAME),
748
- /* harmony export */ "yV": () => (/* binding */ ACCOUNT_THEME_PAGE_IDS)
749
- /* harmony export */ });
750
- const WELL_KNOWN_DIRECTORY_BASE_NAME = {
751
- KEYCLOAKIFY_DEV_RESOURCES: "keycloakify-dev-resources",
752
- RESOURCES_COMMON: "resources-common",
753
- DIST: "dist"
754
- };
755
- const THEME_TYPES = ["login", "account"];
756
- const VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES = {
757
- RUN_POST_BUILD_SCRIPT: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
758
- RESOLVE_VITE_CONFIG: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
759
- };
760
- const BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME = "KEYCLOAKIFY_BUILD_FOR_KEYCLOAK_MAJOR_VERSION";
761
- const LOGIN_THEME_PAGE_IDS = [
762
- "login.ftl",
763
- "login-username.ftl",
764
- "login-password.ftl",
765
- "webauthn-authenticate.ftl",
766
- "webauthn-register.ftl",
767
- "register.ftl",
768
- "info.ftl",
769
- "error.ftl",
770
- "login-reset-password.ftl",
771
- "login-verify-email.ftl",
772
- "terms.ftl",
773
- "login-oauth2-device-verify-user-code.ftl",
774
- "login-oauth-grant.ftl",
775
- "login-otp.ftl",
776
- "login-update-profile.ftl",
777
- "login-update-password.ftl",
778
- "login-idp-link-confirm.ftl",
779
- "login-idp-link-email.ftl",
780
- "login-page-expired.ftl",
781
- "login-config-totp.ftl",
782
- "logout-confirm.ftl",
783
- "idp-review-user-profile.ftl",
784
- "update-email.ftl",
785
- "select-authenticator.ftl",
786
- "saml-post-form.ftl",
787
- "delete-credential.ftl",
788
- "code.ftl",
789
- "delete-account-confirm.ftl",
790
- "frontchannel-logout.ftl",
791
- "login-recovery-authn-code-config.ftl",
792
- "login-recovery-authn-code-input.ftl",
793
- "login-reset-otp.ftl",
794
- "login-x509-info.ftl",
795
- "webauthn-error.ftl",
796
- "login-passkeys-conditional-authenticate.ftl",
797
- "login-idp-link-confirm-override.ftl"
798
- ];
799
- const ACCOUNT_THEME_PAGE_IDS = [
800
- "password.ftl",
801
- "account.ftl",
802
- "sessions.ftl",
803
- "totp.ftl",
804
- "applications.ftl",
805
- "log.ftl",
806
- "federatedIdentity.ftl"
807
- ];
808
- const CONTAINER_NAME = "keycloak-keycloakify";
809
- const FALLBACK_LANGUAGE_TAG = "en";
810
- //# sourceMappingURL=constants.js.map
811
-
812
- /***/ }),
813
-
814
- /***/ 73036:
815
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
816
-
817
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
818
- /* harmony export */ "J": () => (/* binding */ crawl)
819
- /* harmony export */ });
820
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
821
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
822
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
823
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
824
-
825
-
826
- const crawlRec = (dirPath, filePaths) => {
827
- for (const basename of fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath)) {
828
- const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
829
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
830
- crawlRec(fileOrDirPath, filePaths);
831
- continue;
832
- }
833
- filePaths.push(fileOrDirPath);
834
- }
835
- };
836
- /** List all files in a given directory return paths relative to the dir_path */
837
- function crawl(params) {
838
- const { dirPath, returnedPathsType } = params;
839
- const filePaths = [];
840
- crawlRec(dirPath, filePaths);
841
- switch (returnedPathsType) {
842
- case "absolute":
843
- return filePaths;
844
- case "relative to dirPath":
845
- return filePaths.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(dirPath, filePath));
846
- }
847
- }
848
- //# sourceMappingURL=crawl.js.map
849
-
850
- /***/ }),
851
-
852
- /***/ 84794:
853
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
854
-
855
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
856
- /* harmony export */ "c": () => (/* binding */ getAbsoluteAndInOsFormatPath)
857
- /* harmony export */ });
858
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
859
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
860
- /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22037);
861
- /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
862
-
863
-
864
- function getAbsoluteAndInOsFormatPath(params) {
865
- const { pathIsh, cwd } = params;
866
- let pathOut = pathIsh;
867
- pathOut = pathOut.replace(/\//g, path__WEBPACK_IMPORTED_MODULE_0__.sep);
868
- if (pathOut.startsWith("~")) {
869
- pathOut = pathOut.replace("~", os__WEBPACK_IMPORTED_MODULE_1__.homedir());
870
- }
871
- pathOut = pathOut.endsWith(path__WEBPACK_IMPORTED_MODULE_0__.sep) ? pathOut.slice(0, -1) : pathOut;
872
- if (!(0,path__WEBPACK_IMPORTED_MODULE_0__.isAbsolute)(pathOut)) {
873
- pathOut = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(cwd, pathOut);
874
- }
875
- pathOut = (0,path__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathOut);
876
- return pathOut;
877
- }
878
- //# sourceMappingURL=getAbsoluteAndInOsFormatPath.js.map
879
-
880
- /***/ })
881
-
882
- };
883
- ;