keycloakify 10.0.0-rc.65 → 10.0.0-rc.67

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 (53) hide show
  1. package/bin/193.index.js +51 -0
  2. package/bin/246.index.js +371 -75118
  3. package/bin/363.index.js +64 -165
  4. package/bin/453.index.js +603 -23
  5. package/bin/{890.index.js → 456.index.js} +1831 -3
  6. package/bin/490.index.js +75195 -0
  7. package/bin/526.index.js +294 -173
  8. package/bin/538.index.js +1 -509
  9. package/bin/{203.index.js → 751.index.js} +306 -305
  10. package/bin/772.index.js +1 -1
  11. package/bin/{190.index.js → 837.index.js} +259 -35
  12. package/bin/932.index.js +1 -578
  13. package/bin/97.index.js +594 -14
  14. package/bin/main.js +8 -8
  15. package/bin/shared/KeycloakVersionRange.d.ts +5 -0
  16. package/bin/shared/KeycloakVersionRange.js.map +1 -0
  17. package/bin/shared/buildContext.d.ts +16 -0
  18. package/bin/shared/buildContext.js.map +1 -0
  19. package/bin/shared/constants.d.ts +1 -1
  20. package/bin/shared/constants.js.map +1 -1
  21. package/bin/shared/copyKeycloakResourcesToPublic.d.ts +8 -0
  22. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -0
  23. package/bin/shared/downloadKeycloakDefaultTheme.d.ts +10 -0
  24. package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -0
  25. package/bin/shared/downloadKeycloakStaticResources.d.ts +9 -0
  26. package/bin/shared/downloadKeycloakStaticResources.js.map +1 -0
  27. package/bin/shared/generateKcGenTs.d.ts +12 -0
  28. package/bin/shared/generateKcGenTs.js.map +1 -0
  29. package/bin/shared/metaInfKeycloakThemes.d.ts +13 -0
  30. package/bin/shared/metaInfKeycloakThemes.js.map +1 -0
  31. package/bin/shared/promptKeycloakVersion.d.ts +7 -0
  32. package/bin/shared/promptKeycloakVersion.js.map +1 -0
  33. package/package.json +21 -12
  34. package/src/bin/add-story.ts +1 -6
  35. package/src/bin/eject-page.ts +7 -8
  36. package/src/bin/initialize-email-theme.ts +1 -6
  37. package/src/bin/keycloakify/buildJars/buildJars.ts +23 -49
  38. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +15 -20
  39. package/src/bin/keycloakify/keycloakify.ts +6 -8
  40. package/src/bin/shared/buildContext.ts +434 -42
  41. package/src/bin/shared/constants.ts +2 -1
  42. package/src/bin/shared/generateKcGenTs.ts +2 -6
  43. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  44. package/src/bin/start-keycloak/start-keycloak.ts +40 -83
  45. package/src/vite-plugin/vite-plugin.ts +5 -4
  46. package/vite-plugin/index.js +341 -117
  47. package/bin/480.index.js +0 -466
  48. package/bin/818.index.js +0 -1802
  49. package/bin/827.index.js +0 -1094
  50. package/bin/shared/constants.js +0 -59
  51. package/src/bin/shared/getImplementedThemeTypes.ts +0 -38
  52. package/src/bin/shared/getJarFileBasename.ts +0 -11
  53. package/src/bin/shared/getThemeSrcDirPath.ts +0 -62
package/bin/827.index.js DELETED
@@ -1,1094 +0,0 @@
1
- "use strict";
2
- exports.id = 827;
3
- exports.ids = [827];
4
- exports.modules = {
5
-
6
- /***/ 87751:
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__(86644);
21
- // EXTERNAL MODULE: external "child_process"
22
- var external_child_process_ = __webpack_require__(32081);
23
- // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
24
- var assert = __webpack_require__(88078);
25
- // EXTERNAL MODULE: external "fs"
26
- var external_fs_ = __webpack_require__(57147);
27
- ;// CONCATENATED MODULE: ./dist/bin/tools/getNpmWorkspaceRootDirPath.js
28
-
29
-
30
-
31
-
32
- function getNpmWorkspaceRootDirPath(params) {
33
- const { projectDirPath, dependencyExpected } = params;
34
- const npmWorkspaceRootDirPath = (function callee(depth) {
35
- const cwd = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(depth).fill("..")]));
36
- (0,assert.assert)(cwd !== external_path_.sep, "NPM workspace not found");
37
- try {
38
- external_child_process_.execSync("npm config get", {
39
- cwd,
40
- stdio: "ignore"
41
- });
42
- }
43
- catch (error) {
44
- if (String(error).includes("ENOWORKSPACES")) {
45
- return callee(depth + 1);
46
- }
47
- throw error;
48
- }
49
- const packageJsonFilePath = (0,external_path_.join)(cwd, "package.json");
50
- if (!external_fs_.existsSync(packageJsonFilePath)) {
51
- return callee(depth + 1);
52
- }
53
- (0,assert.assert)(external_fs_.existsSync(packageJsonFilePath));
54
- const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
55
- let isExpectedDependencyFound = false;
56
- for (const dependenciesOrDevDependencies of [
57
- "dependencies",
58
- "devDependencies"
59
- ]) {
60
- const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
61
- if (dependencies === undefined) {
62
- continue;
63
- }
64
- (0,assert.assert)(dependencies instanceof Object);
65
- if (dependencies[dependencyExpected] === undefined) {
66
- continue;
67
- }
68
- isExpectedDependencyFound = true;
69
- }
70
- if (!isExpectedDependencyFound && parsedPackageJson.name !== dependencyExpected) {
71
- return callee(depth + 1);
72
- }
73
- return cwd;
74
- })(0);
75
- return { npmWorkspaceRootDirPath };
76
- }
77
- //# sourceMappingURL=getNpmWorkspaceRootDirPath.js.map
78
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
79
- var lib = __webpack_require__(52300);
80
- // EXTERNAL MODULE: ./node_modules/tsafe/index.js
81
- var tsafe = __webpack_require__(1666);
82
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
83
- var constants = __webpack_require__(173);
84
- ;// CONCATENATED MODULE: ./dist/bin/shared/buildContext.js
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
- function getBuildContext(params) {
95
- var _a, _b, _c, _d, _e, _f;
96
- const { cliCommandOptions } = params;
97
- const projectDirPath = (() => {
98
- if (cliCommandOptions.projectDirPath === undefined) {
99
- return process.cwd();
100
- }
101
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
102
- pathIsh: cliCommandOptions.projectDirPath,
103
- cwd: process.cwd()
104
- });
105
- })();
106
- const { resolvedViteConfig } = (() => {
107
- if (external_fs_.readdirSync(projectDirPath)
108
- .find(fileBasename => fileBasename.startsWith("vite.config")) ===
109
- undefined) {
110
- return { resolvedViteConfig: undefined };
111
- }
112
- const output = external_child_process_.execSync("npx vite", {
113
- cwd: projectDirPath,
114
- env: Object.assign(Object.assign({}, process.env), { [constants/* vitePluginSubScriptEnvNames.resolveViteConfig */.fe.resolveViteConfig]: "true" })
115
- })
116
- .toString("utf8");
117
- (0,tsafe.assert)(output.includes(constants/* vitePluginSubScriptEnvNames.resolveViteConfig */.fe.resolveViteConfig), "Seems like the Keycloakify's Vite plugin is not installed.");
118
- const resolvedViteConfigStr = output
119
- .split(constants/* vitePluginSubScriptEnvNames.resolveViteConfig */.fe.resolveViteConfig)
120
- .reverse()[0];
121
- const resolvedViteConfig = JSON.parse(resolvedViteConfigStr);
122
- return { resolvedViteConfig };
123
- })();
124
- const parsedPackageJson = (() => {
125
- {
126
- (0,tsafe.assert)();
127
- }
128
- const zParsedPackageJson = lib.z.object({
129
- name: lib.z.string(),
130
- version: lib.z.string().optional(),
131
- homepage: lib.z.string().optional(),
132
- keycloakify: lib.z.object({
133
- extraThemeProperties: lib.z.array(lib.z.string()).optional(),
134
- artifactId: lib.z.string().optional(),
135
- groupId: lib.z.string().optional(),
136
- loginThemeResourcesFromKeycloakVersion: lib.z.string().optional(),
137
- projectBuildDirPath: lib.z.string().optional(),
138
- keycloakifyBuildDirPath: lib.z.string().optional(),
139
- kcContextExclusionsFtl: lib.z.string().optional(),
140
- environmentVariables: lib.z.array(lib.z.object({
141
- name: lib.z.string(),
142
- default: lib.z.string()
143
- }))
144
- .optional(),
145
- themeName: lib.z.union([lib.z.string(), lib.z.array(lib.z.string())]).optional()
146
- })
147
- .optional()
148
- });
149
- {
150
- (0,tsafe.assert)();
151
- }
152
- return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(projectDirPath, "package.json")).toString("utf8")));
153
- })();
154
- const buildOptions = Object.assign(Object.assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildOptions);
155
- const themeNames = (() => {
156
- if (buildOptions.themeName === undefined) {
157
- return [
158
- parsedPackageJson.name
159
- .replace(/^@(.*)/, "$1")
160
- .split("/")
161
- .join("-")
162
- ];
163
- }
164
- if (typeof buildOptions.themeName === "string") {
165
- return [buildOptions.themeName];
166
- }
167
- const [mainThemeName, ...themeVariantNames] = buildOptions.themeName;
168
- (0,tsafe.assert)(mainThemeName !== undefined);
169
- return [mainThemeName, ...themeVariantNames];
170
- })();
171
- const projectBuildDirPath = (() => {
172
- var _a;
173
- webpack: {
174
- if (resolvedViteConfig !== undefined) {
175
- break webpack;
176
- }
177
- if (((_a = parsedPackageJson.keycloakify) === null || _a === void 0 ? void 0 : _a.projectBuildDirPath) !== undefined) {
178
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
179
- pathIsh: parsedPackageJson.keycloakify.projectBuildDirPath,
180
- cwd: projectDirPath
181
- });
182
- }
183
- return (0,external_path_.join)(projectDirPath, "build");
184
- }
185
- return (0,external_path_.join)(projectDirPath, resolvedViteConfig.buildDir);
186
- })();
187
- const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
188
- projectDirPath,
189
- dependencyExpected: "keycloakify"
190
- });
191
- return {
192
- bundler: resolvedViteConfig !== undefined ? "vite" : "webpack",
193
- themeVersion: (_b = (_a = process.env.KEYCLOAKIFY_THEME_VERSION) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
194
- themeNames,
195
- extraThemeProperties: buildOptions.extraThemeProperties,
196
- groupId: (() => {
197
- var _a, _b, _c, _d, _e;
198
- const fallbackGroupId = `${themeNames[0]}.keycloak`;
199
- return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : buildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
200
- ? fallbackGroupId
201
- : (_e = (_d = (_c = (0,external_url_.parse)(parsedPackageJson.homepage)
202
- .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");
203
- })(),
204
- artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : buildOptions.artifactId) !== null && _d !== void 0 ? _d : `${themeNames[0]}-keycloak-theme`,
205
- loginThemeResourcesFromKeycloakVersion: (_e = buildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
206
- projectDirPath,
207
- projectBuildDirPath,
208
- keycloakifyBuildDirPath: (() => {
209
- if (buildOptions.keycloakifyBuildDirPath !== undefined) {
210
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
211
- pathIsh: buildOptions.keycloakifyBuildDirPath,
212
- cwd: projectDirPath
213
- });
214
- }
215
- return (0,external_path_.join)(projectDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
216
- ? "build_keycloak"
217
- : `${resolvedViteConfig.buildDir}_keycloak`);
218
- })(),
219
- publicDirPath: (() => {
220
- webpack: {
221
- if (resolvedViteConfig !== undefined) {
222
- break webpack;
223
- }
224
- if (process.env.PUBLIC_DIR_PATH !== undefined) {
225
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
226
- pathIsh: process.env.PUBLIC_DIR_PATH,
227
- cwd: projectDirPath
228
- });
229
- }
230
- return (0,external_path_.join)(projectDirPath, "public");
231
- }
232
- return (0,external_path_.join)(projectDirPath, resolvedViteConfig.publicDir);
233
- })(),
234
- cacheDirPath: (() => {
235
- const cacheDirPath = (0,external_path_.join)((() => {
236
- if (process.env.XDG_CACHE_HOME !== undefined) {
237
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
238
- pathIsh: process.env.XDG_CACHE_HOME,
239
- cwd: process.cwd()
240
- });
241
- }
242
- return (0,external_path_.join)(npmWorkspaceRootDirPath, "node_modules", ".cache");
243
- })(), "keycloakify");
244
- return cacheDirPath;
245
- })(),
246
- urlPathname: (() => {
247
- webpack: {
248
- if (resolvedViteConfig !== undefined) {
249
- break webpack;
250
- }
251
- const { homepage } = parsedPackageJson;
252
- let url = undefined;
253
- if (homepage !== undefined) {
254
- url = new URL(homepage);
255
- }
256
- if (url === undefined) {
257
- return undefined;
258
- }
259
- const out = url.pathname.replace(/([^/])$/, "$1/");
260
- return out === "/" ? undefined : out;
261
- }
262
- return resolvedViteConfig.urlPathname;
263
- })(),
264
- assetsDirPath: (() => {
265
- webpack: {
266
- if (resolvedViteConfig !== undefined) {
267
- break webpack;
268
- }
269
- return (0,external_path_.join)(projectBuildDirPath, "static");
270
- }
271
- return (0,external_path_.join)(projectBuildDirPath, resolvedViteConfig.assetsDir);
272
- })(),
273
- npmWorkspaceRootDirPath,
274
- kcContextExclusionsFtlCode: (() => {
275
- if (buildOptions.kcContextExclusionsFtl === undefined) {
276
- return undefined;
277
- }
278
- if (buildOptions.kcContextExclusionsFtl.endsWith(".ftl")) {
279
- const kcContextExclusionsFtlPath = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
280
- pathIsh: buildOptions.kcContextExclusionsFtl,
281
- cwd: projectDirPath
282
- });
283
- return external_fs_.readFileSync(kcContextExclusionsFtlPath).toString("utf8");
284
- }
285
- return buildOptions.kcContextExclusionsFtl;
286
- })(),
287
- environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : []
288
- };
289
- }
290
- //# sourceMappingURL=buildContext.js.map
291
-
292
- /***/ }),
293
-
294
- /***/ 173:
295
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
296
-
297
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
298
- /* harmony export */ "Dv": () => (/* binding */ onlyBuildJarFileBasenameEnvName),
299
- /* harmony export */ "M": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
300
- /* harmony export */ "N$": () => (/* binding */ keycloak_resources),
301
- /* harmony export */ "UX": () => (/* binding */ accountThemePageIds),
302
- /* harmony export */ "fe": () => (/* binding */ vitePluginSubScriptEnvNames),
303
- /* harmony export */ "h6": () => (/* binding */ containerName),
304
- /* harmony export */ "lg": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
305
- /* harmony export */ "rO": () => (/* binding */ themeTypes),
306
- /* harmony export */ "sj": () => (/* binding */ loginThemePageIds),
307
- /* harmony export */ "v$": () => (/* binding */ lastKeycloakVersionWithAccountV1),
308
- /* harmony export */ "y_": () => (/* binding */ accountV1ThemeName),
309
- /* harmony export */ "z0": () => (/* binding */ resources_common)
310
- /* harmony export */ });
311
- const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
312
- const keycloak_resources = "keycloak-resources";
313
- const resources_common = "resources-common";
314
- const lastKeycloakVersionWithAccountV1 = "21.1.2";
315
- const basenameOfTheKeycloakifyResourcesDir = "build";
316
- const themeTypes = ["login", "account"];
317
- const accountV1ThemeName = "account-v1";
318
- const vitePluginSubScriptEnvNames = {
319
- runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
320
- resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
321
- };
322
- const onlyBuildJarFileBasenameEnvName = "KEYCLOAKIFY_ONLY_BUILD_JAR_FILE_BASENAME";
323
- const loginThemePageIds = [
324
- "login.ftl",
325
- "login-username.ftl",
326
- "login-password.ftl",
327
- "webauthn-authenticate.ftl",
328
- "webauthn-register.ftl",
329
- "register.ftl",
330
- "info.ftl",
331
- "error.ftl",
332
- "login-reset-password.ftl",
333
- "login-verify-email.ftl",
334
- "terms.ftl",
335
- "login-oauth2-device-verify-user-code.ftl",
336
- "login-oauth-grant.ftl",
337
- "login-otp.ftl",
338
- "login-update-profile.ftl",
339
- "login-update-password.ftl",
340
- "login-idp-link-confirm.ftl",
341
- "login-idp-link-email.ftl",
342
- "login-page-expired.ftl",
343
- "login-config-totp.ftl",
344
- "logout-confirm.ftl",
345
- "idp-review-user-profile.ftl",
346
- "update-email.ftl",
347
- "select-authenticator.ftl",
348
- "saml-post-form.ftl",
349
- "delete-credential.ftl",
350
- "code.ftl",
351
- "delete-account-confirm.ftl",
352
- "frontchannel-logout.ftl",
353
- "login-recovery-authn-code-config.ftl",
354
- "login-recovery-authn-code-input.ftl",
355
- "login-reset-otp.ftl",
356
- "login-x509-info.ftl",
357
- "webauthn-error.ftl"
358
- ];
359
- const accountThemePageIds = [
360
- "password.ftl",
361
- "account.ftl",
362
- "sessions.ftl",
363
- "totp.ftl",
364
- "applications.ftl",
365
- "log.ftl",
366
- "federatedIdentity.ftl"
367
- ];
368
- const containerName = "keycloak-keycloakify";
369
- //# sourceMappingURL=constants.js.map
370
-
371
- /***/ }),
372
-
373
- /***/ 39216:
374
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
375
-
376
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
377
- /* harmony export */ "f": () => (/* binding */ getThemeSrcDirPath)
378
- /* harmony export */ });
379
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
380
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
381
- /* harmony import */ var tsafe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1666);
382
- /* harmony import */ var tsafe__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(tsafe__WEBPACK_IMPORTED_MODULE_1__);
383
- /* harmony import */ var _tools_crawl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73036);
384
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71017);
385
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
386
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(173);
387
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(78818);
388
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_5__);
389
-
390
-
391
-
392
-
393
-
394
-
395
- let cache = undefined;
396
- /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
397
- function getThemeSrcDirPath(params) {
398
- const { projectDirPath } = params;
399
- if (cache !== undefined && cache.projectDirPath === projectDirPath) {
400
- const { themeSrcDirPath } = cache;
401
- return { themeSrcDirPath };
402
- }
403
- cache = undefined;
404
- const { themeSrcDirPath } = (() => {
405
- const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(projectDirPath, "src");
406
- const themeSrcDirPath = (0,_tools_crawl__WEBPACK_IMPORTED_MODULE_2__/* .crawl */ .J)({
407
- dirPath: srcDirPath,
408
- returnedPathsType: "relative to dirPath"
409
- })
410
- .map(fileRelativePath => {
411
- for (const themeSrcDirBasename of themeSrcDirBasenames) {
412
- const split = fileRelativePath.split(themeSrcDirBasename);
413
- if (split.length === 2) {
414
- return (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, split[0] + themeSrcDirBasename);
415
- }
416
- }
417
- return undefined;
418
- })
419
- .filter((0,tsafe__WEBPACK_IMPORTED_MODULE_1__.exclude)(undefined))[0];
420
- if (themeSrcDirPath !== undefined) {
421
- return { themeSrcDirPath };
422
- }
423
- for (const themeType of [..._constants__WEBPACK_IMPORTED_MODULE_4__/* .themeTypes */ .rO, "email"]) {
424
- if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync((0,path__WEBPACK_IMPORTED_MODULE_3__.join)(srcDirPath, themeType))) {
425
- continue;
426
- }
427
- return { themeSrcDirPath: srcDirPath };
428
- }
429
- console.log(chalk__WEBPACK_IMPORTED_MODULE_5___default().red("Can't locate your theme source directory. It should be either: "));
430
- process.exit(-1);
431
- })();
432
- cache = { projectDirPath, themeSrcDirPath };
433
- return { themeSrcDirPath };
434
- }
435
- const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
436
- //# sourceMappingURL=getThemeSrcDirPath.js.map
437
-
438
- /***/ }),
439
-
440
- /***/ 73036:
441
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
442
-
443
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
444
- /* harmony export */ "J": () => (/* binding */ crawl)
445
- /* harmony export */ });
446
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
447
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
448
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
449
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
450
-
451
-
452
- const crawlRec = (dirPath, filePaths) => {
453
- for (const basename of fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath)) {
454
- const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
455
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
456
- crawlRec(fileOrDirPath, filePaths);
457
- continue;
458
- }
459
- filePaths.push(fileOrDirPath);
460
- }
461
- };
462
- /** List all files in a given directory return paths relative to the dir_path */
463
- function crawl(params) {
464
- const { dirPath, returnedPathsType } = params;
465
- const filePaths = [];
466
- crawlRec(dirPath, filePaths);
467
- switch (returnedPathsType) {
468
- case "absolute":
469
- return filePaths;
470
- case "relative to dirPath":
471
- return filePaths.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(dirPath, filePath));
472
- }
473
- }
474
- //# sourceMappingURL=crawl.js.map
475
-
476
- /***/ }),
477
-
478
- /***/ 86644:
479
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
480
-
481
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
482
- /* harmony export */ "c": () => (/* binding */ getAbsoluteAndInOsFormatPath)
483
- /* harmony export */ });
484
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
485
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
486
- /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22037);
487
- /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
488
-
489
-
490
- function getAbsoluteAndInOsFormatPath(params) {
491
- const { pathIsh, cwd } = params;
492
- let pathOut = pathIsh;
493
- pathOut = pathOut.replace(/\//g, path__WEBPACK_IMPORTED_MODULE_0__.sep);
494
- if (pathOut.startsWith("~")) {
495
- pathOut = pathOut.replace("~", os__WEBPACK_IMPORTED_MODULE_1__.homedir());
496
- }
497
- pathOut = pathOut.endsWith(path__WEBPACK_IMPORTED_MODULE_0__.sep) ? pathOut.slice(0, -1) : pathOut;
498
- if (!(0,path__WEBPACK_IMPORTED_MODULE_0__.isAbsolute)(pathOut)) {
499
- pathOut = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(cwd, pathOut);
500
- }
501
- pathOut = (0,path__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathOut);
502
- return pathOut;
503
- }
504
- //# sourceMappingURL=getAbsoluteAndInOsFormatPath.js.map
505
-
506
- /***/ }),
507
-
508
- /***/ 17192:
509
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
510
-
511
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
512
- /* harmony export */ "A": () => (/* binding */ kebabCaseToCamelCase)
513
- /* harmony export */ });
514
- /* harmony import */ var tsafe_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61502);
515
-
516
- function kebabCaseToCamelCase(kebabCaseString) {
517
- const [first, ...rest] = kebabCaseString.split("-");
518
- return [first, ...rest.map(tsafe_capitalize__WEBPACK_IMPORTED_MODULE_0__.capitalize)].join("");
519
- }
520
- //# sourceMappingURL=kebabCaseToSnakeCase.js.map
521
-
522
- /***/ }),
523
-
524
- /***/ 18512:
525
- /***/ ((module) => {
526
-
527
-
528
- const x = module.exports;
529
- const ESC = '\u001B[';
530
- const OSC = '\u001B]';
531
- const BEL = '\u0007';
532
- const SEP = ';';
533
- const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
534
-
535
- x.cursorTo = (x, y) => {
536
- if (typeof x !== 'number') {
537
- throw new TypeError('The `x` argument is required');
538
- }
539
-
540
- if (typeof y !== 'number') {
541
- return ESC + (x + 1) + 'G';
542
- }
543
-
544
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
545
- };
546
-
547
- x.cursorMove = (x, y) => {
548
- if (typeof x !== 'number') {
549
- throw new TypeError('The `x` argument is required');
550
- }
551
-
552
- let ret = '';
553
-
554
- if (x < 0) {
555
- ret += ESC + (-x) + 'D';
556
- } else if (x > 0) {
557
- ret += ESC + x + 'C';
558
- }
559
-
560
- if (y < 0) {
561
- ret += ESC + (-y) + 'A';
562
- } else if (y > 0) {
563
- ret += ESC + y + 'B';
564
- }
565
-
566
- return ret;
567
- };
568
-
569
- x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
570
- x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
571
- x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
572
- x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
573
-
574
- x.cursorLeft = ESC + 'G';
575
- x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
576
- x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
577
- x.cursorGetPosition = ESC + '6n';
578
- x.cursorNextLine = ESC + 'E';
579
- x.cursorPrevLine = ESC + 'F';
580
- x.cursorHide = ESC + '?25l';
581
- x.cursorShow = ESC + '?25h';
582
-
583
- x.eraseLines = count => {
584
- let clear = '';
585
-
586
- for (let i = 0; i < count; i++) {
587
- clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
588
- }
589
-
590
- if (count) {
591
- clear += x.cursorLeft;
592
- }
593
-
594
- return clear;
595
- };
596
-
597
- x.eraseEndLine = ESC + 'K';
598
- x.eraseStartLine = ESC + '1K';
599
- x.eraseLine = ESC + '2K';
600
- x.eraseDown = ESC + 'J';
601
- x.eraseUp = ESC + '1J';
602
- x.eraseScreen = ESC + '2J';
603
- x.scrollUp = ESC + 'S';
604
- x.scrollDown = ESC + 'T';
605
-
606
- x.clearScreen = '\u001Bc';
607
-
608
- x.clearTerminal = process.platform === 'win32' ?
609
- `${x.eraseScreen}${ESC}0f` :
610
- // 1. Erases the screen (Only done in case `2` is not supported)
611
- // 2. Erases the whole screen including scrollback buffer
612
- // 3. Moves cursor to the top-left position
613
- // More info: https://www.real-world-systems.com/docs/ANSIcode.html
614
- `${x.eraseScreen}${ESC}3J${ESC}H`;
615
-
616
- x.beep = BEL;
617
-
618
- x.link = (text, url) => {
619
- return [
620
- OSC,
621
- '8',
622
- SEP,
623
- SEP,
624
- url,
625
- BEL,
626
- text,
627
- OSC,
628
- '8',
629
- SEP,
630
- SEP,
631
- BEL
632
- ].join('');
633
- };
634
-
635
- x.image = (buf, opts) => {
636
- opts = opts || {};
637
-
638
- let ret = OSC + '1337;File=inline=1';
639
-
640
- if (opts.width) {
641
- ret += `;width=${opts.width}`;
642
- }
643
-
644
- if (opts.height) {
645
- ret += `;height=${opts.height}`;
646
- }
647
-
648
- if (opts.preserveAspectRatio === false) {
649
- ret += ';preserveAspectRatio=0';
650
- }
651
-
652
- return ret + ':' + buf.toString('base64') + BEL;
653
- };
654
-
655
- x.iTerm = {};
656
-
657
- x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL;
658
-
659
-
660
- /***/ }),
661
-
662
- /***/ 39340:
663
- /***/ ((__unused_webpack_module, exports) => {
664
-
665
-
666
-
667
- Object.defineProperty(exports, "__esModule", ({
668
- value: true
669
- }));
670
- exports.withPromise = exports.withCallback = void 0;
671
-
672
- /**
673
- * Open the input with a normal callback function
674
- *
675
- * @param {Input} input - input object
676
- * @param {function} valueMapper - function which maps the resulting id and value back to the expected format
677
- * @param {function} callback - callback function
678
- */
679
- const withCallback = (input, valueMapper, callback) => {
680
- input.open();
681
- input.onSelect((id, value) => callback(valueMapper(id, value)));
682
- };
683
- /**
684
- * Open the input with a promise
685
- *
686
- * @param {Input} input - input object
687
- * @param {function} valueMapper - function which maps the resulting id and value back to the expected format
688
- */
689
-
690
-
691
- exports.withCallback = withCallback;
692
-
693
- const withPromise = (input, valueMapper) => {
694
- return new Promise((resolve, reject) => {
695
- input.open();
696
- input.onSelect((id, value) => {
697
- if (id === null) {
698
- reject();
699
- } else {
700
- resolve(valueMapper(id, value));
701
- }
702
- });
703
- });
704
- };
705
-
706
- exports.withPromise = withPromise;
707
-
708
- /***/ }),
709
-
710
- /***/ 99398:
711
- /***/ ((module, exports, __webpack_require__) => {
712
-
713
-
714
-
715
- Object.defineProperty(exports, "__esModule", ({
716
- value: true
717
- }));
718
- exports["default"] = void 0;
719
-
720
- var _input = _interopRequireDefault(__webpack_require__(25730));
721
-
722
- var _renderer = _interopRequireDefault(__webpack_require__(16059));
723
-
724
- var _callbackMappers = __webpack_require__(39340);
725
-
726
- var _valueMappers = __webpack_require__(26730);
727
-
728
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
729
-
730
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
731
-
732
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
733
-
734
- /**
735
- * Default options
736
- */
737
- const defaultOptions = {
738
- outputStream: process.stdout,
739
- inputStream: process.stdin,
740
- values: [],
741
- defaultValue: 0,
742
- selected: '(x)',
743
- unselected: '( )',
744
- indentation: 0,
745
- cleanup: true,
746
- valueRenderer: value => value
747
- };
748
- /**
749
- * Create an instance of cli-select with the given options
750
- *
751
- * @param {object} options - options for cli-select
752
- * @param {function} callback - if specified, a callback will be used, otherwise a promise gets returned (optional)
753
- */
754
-
755
- const creator = (options, callback) => {
756
- // merge options with default options
757
- options = _objectSpread({}, defaultOptions, options); // create renderer and input instances
758
-
759
- const renderer = new _renderer.default(options, options.outputStream);
760
- const input = new _input.default(options.inputStream);
761
- input.setDefaultValue(options.defaultValue);
762
- input.attachRenderer(renderer); // handle array and object values
763
-
764
- let valueMapper;
765
-
766
- if (Array.isArray(options.values)) {
767
- valueMapper = (0, _valueMappers.withArrayValues)(options);
768
- } else {
769
- valueMapper = (0, _valueMappers.withObjectValues)(options);
770
- } // map values
771
-
772
-
773
- options.values = valueMapper.input;
774
- input.setValues(options.values); // handle different callback methods
775
-
776
- if (typeof callback === 'function') {
777
- return (0, _callbackMappers.withCallback)(input, valueMapper.output, callback);
778
- } else {
779
- return (0, _callbackMappers.withPromise)(input, valueMapper.output);
780
- }
781
- };
782
-
783
- exports = module.exports = creator;
784
- Object.defineProperty(exports, "__esModule", ({
785
- value: true
786
- }));
787
- var _default = creator;
788
- exports["default"] = _default;
789
-
790
- /***/ }),
791
-
792
- /***/ 25730:
793
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
794
-
795
-
796
-
797
- Object.defineProperty(exports, "__esModule", ({
798
- value: true
799
- }));
800
- exports["default"] = void 0;
801
-
802
- var _readline = _interopRequireDefault(__webpack_require__(14521));
803
-
804
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
805
-
806
- /**
807
- * Handle cli input
808
- */
809
- class Input {
810
- /**
811
- * Input constructor
812
- *
813
- * @param {any} stream - stream to catch (optional)
814
- */
815
- constructor(stream = process.stdin) {
816
- // set default values
817
- this.stream = stream;
818
- this.values = [];
819
- this.selectedValue = 0;
820
-
821
- this.onSelectListener = () => {};
822
-
823
- this.onKeyPress = this.onKeyPress.bind(this);
824
- }
825
- /**
826
- * Set the available values
827
- *
828
- * @param {array} values - all available values
829
- */
830
-
831
-
832
- setValues(values) {
833
- this.values = values;
834
-
835
- if (this.renderer) {
836
- this.renderer.setValues(values);
837
- }
838
- }
839
- /**
840
- * Set the default value
841
- *
842
- * @param {number} defaultValue - default value id
843
- */
844
-
845
-
846
- setDefaultValue(defaultValue) {
847
- this.selectedValue = defaultValue;
848
- }
849
- /**
850
- * Attach a renderer to the input catcher
851
- *
852
- * @param {Renderer} renderer - renderer to use for rendering responses
853
- */
854
-
855
-
856
- attachRenderer(renderer) {
857
- this.renderer = renderer;
858
- this.renderer.setValues(this.values);
859
- }
860
- /**
861
- * Register an on select listener
862
- *
863
- * @param {function} listener - listener function which receives two parameters: valueId and value
864
- */
865
-
866
-
867
- onSelect(listener) {
868
- this.onSelectListener = listener;
869
- }
870
- /**
871
- * Open the stream and listen for input
872
- */
873
-
874
-
875
- open() {
876
- // register keypress event
877
- _readline.default.emitKeypressEvents(this.stream); // handle keypress
878
-
879
-
880
- this.stream.on('keypress', this.onKeyPress); // initially render the response
881
-
882
- if (this.renderer) {
883
- this.renderer.render(this.selectedValue);
884
- } // hide pressed keys and start listening on input
885
-
886
-
887
- this.stream.setRawMode(true);
888
- this.stream.resume();
889
- }
890
- /**
891
- * Close the stream
892
- *
893
- * @param {boolean} cancelled - true if no value was selected (optional)
894
- */
895
-
896
-
897
- close(cancelled = false) {
898
- // reset stream properties
899
- this.stream.setRawMode(false);
900
- this.stream.pause(); // cleanup the output
901
-
902
- if (this.renderer) {
903
- this.renderer.cleanup();
904
- } // call the on select listener
905
-
906
-
907
- if (cancelled) {
908
- this.onSelectListener(null);
909
- } else {
910
- this.onSelectListener(this.selectedValue, this.values[this.selectedValue]);
911
- }
912
-
913
- this.stream.removeListener('keypress', this.onKeyPress);
914
- }
915
- /**
916
- * Render the response
917
- */
918
-
919
-
920
- render() {
921
- if (!this.renderer) {
922
- return;
923
- }
924
-
925
- this.renderer.render(this.selectedValue);
926
- }
927
- /**
928
- * Handle key press event
929
- *
930
- * @param {string} string - input string
931
- * @param {object} key - object containing information about the pressed key
932
- */
933
-
934
-
935
- onKeyPress(string, key) {
936
- if (key) {
937
- if (key.name === 'up' && this.selectedValue > 0) {
938
- this.selectedValue--;
939
- this.render();
940
- } else if (key.name === 'down' && this.selectedValue + 1 < this.values.length) {
941
- this.selectedValue++;
942
- this.render();
943
- } else if (key.name === 'return') {
944
- this.close();
945
- } else if (key.name === 'escape' || key.name === 'c' && key.ctrl) {
946
- this.close(true);
947
- }
948
- }
949
- }
950
-
951
- }
952
-
953
- exports["default"] = Input;
954
-
955
- /***/ }),
956
-
957
- /***/ 16059:
958
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
959
-
960
-
961
-
962
- Object.defineProperty(exports, "__esModule", ({
963
- value: true
964
- }));
965
- exports["default"] = void 0;
966
-
967
- var _readline = _interopRequireDefault(__webpack_require__(14521));
968
-
969
- var _ansiEscapes = __webpack_require__(18512);
970
-
971
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
972
-
973
- /**
974
- * Response renderer
975
- */
976
- class Renderer {
977
- /**
978
- * Renderer constructor
979
- *
980
- * @param {object} options - renderer options
981
- * @param {any} stream - stream to write to (optional)
982
- */
983
- constructor(options, stream = process.stdout) {
984
- this.options = options;
985
- this.stream = stream;
986
- this.values = [];
987
- this.initialRender = true;
988
- }
989
- /**
990
- * Set the available values
991
- *
992
- * @param {array} values - all available values
993
- */
994
-
995
-
996
- setValues(values) {
997
- this.values = values;
998
- }
999
- /**
1000
- * Render the values
1001
- *
1002
- * @param {number} selectedValue - selected value (optional)
1003
- */
1004
-
1005
-
1006
- render(selectedValue = 0) {
1007
- if (this.initialRender) {
1008
- // hide the cursor initially
1009
- this.initialRender = false;
1010
- this.stream.write(_ansiEscapes.cursorHide);
1011
- } else {
1012
- // remove previous lines and values
1013
- this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
1014
- } // output the current values
1015
-
1016
-
1017
- this.values.forEach((value, index) => {
1018
- const symbol = selectedValue === index ? this.options.selected : this.options.unselected;
1019
- const indentation = ' '.repeat(this.options.indentation);
1020
- const renderedValue = this.options.valueRenderer(value, selectedValue === index);
1021
- const end = index !== this.values.length - 1 ? '\n' : '';
1022
- this.stream.write(indentation + symbol + ' ' + renderedValue + end);
1023
- });
1024
- }
1025
- /**
1026
- * Cleanup the console at the end
1027
- */
1028
-
1029
-
1030
- cleanup() {
1031
- this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
1032
- this.stream.write(_ansiEscapes.cursorShow);
1033
- }
1034
-
1035
- }
1036
-
1037
- exports["default"] = Renderer;
1038
-
1039
- /***/ }),
1040
-
1041
- /***/ 26730:
1042
- /***/ ((__unused_webpack_module, exports) => {
1043
-
1044
-
1045
-
1046
- Object.defineProperty(exports, "__esModule", ({
1047
- value: true
1048
- }));
1049
- exports.withObjectValues = exports.withArrayValues = void 0;
1050
-
1051
- /**
1052
- * Map incoming and outgoing values if the initial values are an array
1053
- *
1054
- * @param {object} options - cli-select options
1055
- */
1056
- const withArrayValues = options => {
1057
- return {
1058
- input: options.values,
1059
- output: (id, value) => {
1060
- return {
1061
- id,
1062
- value
1063
- };
1064
- }
1065
- };
1066
- };
1067
- /**
1068
- * Map incoming and outgoing values if the initial values are an object
1069
- *
1070
- * @param {object} options - cli-select options
1071
- */
1072
-
1073
-
1074
- exports.withArrayValues = withArrayValues;
1075
-
1076
- const withObjectValues = options => {
1077
- const originalValues = options.values;
1078
- return {
1079
- input: Object.values(originalValues),
1080
- output: (id, value) => {
1081
- return {
1082
- id: Object.keys(originalValues)[id],
1083
- value
1084
- };
1085
- }
1086
- };
1087
- };
1088
-
1089
- exports.withObjectValues = withObjectValues;
1090
-
1091
- /***/ })
1092
-
1093
- };
1094
- ;