@keycloakify/angular 0.2.2 → 0.2.3

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.
@@ -0,0 +1,508 @@
1
+ export const id = 187;
2
+ export const ids = [187];
3
+ export const modules = {
4
+
5
+ /***/ 187:
6
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7
+
8
+
9
+ // EXPORTS
10
+ __webpack_require__.d(__webpack_exports__, {
11
+ command: () => (/* reexport */ command)
12
+ });
13
+
14
+ // EXTERNAL MODULE: external "child_process"
15
+ var external_child_process_ = __webpack_require__(317);
16
+ var external_child_process_default = /*#__PURE__*/__webpack_require__.n(external_child_process_);
17
+ // EXTERNAL MODULE: ./node_modules/chalk/source/index.js + 3 modules
18
+ var source = __webpack_require__(797);
19
+ // EXTERNAL MODULE: external "path"
20
+ var external_path_ = __webpack_require__(928);
21
+ // EXTERNAL MODULE: external "fs"
22
+ var external_fs_ = __webpack_require__(896);
23
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
24
+ var assert = __webpack_require__(966);
25
+ // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
26
+ var lib = __webpack_require__(383);
27
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
28
+ var id = __webpack_require__(94);
29
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
30
+ var is = __webpack_require__(289);
31
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ (0,assert/* assert */.v)();
40
+ function updateAccountThemeImplementationInConfig(params) {
41
+ const { buildContext, accountThemeType } = params;
42
+ switch (buildContext.bundler) {
43
+ case 'vite':
44
+ {
45
+ const viteConfigPath = (0,external_path_.join)(buildContext.projectDirPath, 'vite.config.ts');
46
+ if (!external_fs_.existsSync(viteConfigPath)) {
47
+ console.log(source/* default */.Ay.bold(`You must manually set the accountThemeImplementation to "${accountThemeType}" in your vite config`));
48
+ break;
49
+ }
50
+ const viteConfigContent = external_fs_.readFileSync(viteConfigPath)
51
+ .toString('utf8');
52
+ const modifiedViteConfigContent = viteConfigContent.replace(/["']?accountThemeImplementation["']?\s*:\s*["']none["']/, `accountThemeImplementation: '${accountThemeType}'`);
53
+ if (modifiedViteConfigContent === viteConfigContent) {
54
+ console.log(source/* default */.Ay.yellow(`You must manually set the accountThemeImplementation to "${accountThemeType}" in your vite.config.ts`));
55
+ break;
56
+ }
57
+ external_fs_.writeFileSync(viteConfigPath, modifiedViteConfigContent);
58
+ }
59
+ break;
60
+ case 'webpack':
61
+ {
62
+ const parsedPackageJson = (() => {
63
+ const zParsedPackageJson = (() => {
64
+ const zTargetType = lib.z.object({
65
+ keycloakify: lib.z.record(lib.z.unknown())
66
+ });
67
+ (0,assert/* assert */.v)();
68
+ return (0,id.id)(zTargetType);
69
+ })();
70
+ const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString('utf8'));
71
+ zParsedPackageJson.parse(parsedPackageJson);
72
+ (0,assert/* assert */.v)((0,is.is)(parsedPackageJson));
73
+ return parsedPackageJson;
74
+ })();
75
+ parsedPackageJson.keycloakify.accountThemeImplementation =
76
+ accountThemeType;
77
+ external_fs_.writeFileSync(buildContext.packageJsonFilePath, Buffer.from(JSON.stringify(parsedPackageJson, undefined, 4), 'utf8'));
78
+ }
79
+ break;
80
+ }
81
+ }
82
+
83
+ // EXTERNAL MODULE: ./dist/bin/update-kc-gen.ts
84
+ var update_kc_gen = __webpack_require__(476);
85
+ // EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.ts
86
+ var getThisCodebaseRootDirPath = __webpack_require__(221);
87
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/initialize-account-theme.ts
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ async function command(params) {
96
+ const { buildContext } = params;
97
+ const accountThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, 'account');
98
+ if (external_fs_.existsSync(accountThemeSrcDirPath) &&
99
+ external_fs_.readdirSync(accountThemeSrcDirPath).length > 0) {
100
+ console.warn(source/* default */.Ay.red(`There is already a ${(0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath)} directory in your project. Aborting.`));
101
+ process.exit(-1);
102
+ }
103
+ exit_if_uncommitted_changes: {
104
+ let hasUncommittedChanges = undefined;
105
+ try {
106
+ hasUncommittedChanges =
107
+ external_child_process_default().execSync(`git status --porcelain`, {
108
+ cwd: buildContext.projectDirPath
109
+ })
110
+ .toString()
111
+ .trim() !== '';
112
+ }
113
+ catch (_a) {
114
+ // Probably not a git repository
115
+ break exit_if_uncommitted_changes;
116
+ }
117
+ if (!hasUncommittedChanges) {
118
+ break exit_if_uncommitted_changes;
119
+ }
120
+ console.warn([
121
+ source/* default */.Ay.red('Please commit or stash your changes before running this command.\n'),
122
+ "This command will modify your project's files so it's better to have a clean working directory",
123
+ 'so that you can easily see what has been changed and revert if needed.'
124
+ ].join(' '));
125
+ process.exit(-1);
126
+ }
127
+ const accountThemeType = 'Multi-Page';
128
+ external_fs_.cpSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.J)(), 'src', 'bin', 'initialize-account-theme', 'boilerplate'), accountThemeSrcDirPath, { recursive: true });
129
+ updateAccountThemeImplementationInConfig({ buildContext, accountThemeType });
130
+ (0,update_kc_gen.command)({
131
+ buildContext: Object.assign(Object.assign({}, buildContext), { implementedThemeTypes: Object.assign(Object.assign({}, buildContext.implementedThemeTypes), { account: {
132
+ isImplemented: true,
133
+ type: accountThemeType
134
+ } }) })
135
+ });
136
+ console.log([
137
+ source/* default */.Ay.green(`The ${accountThemeType} account theme has been initialized.`),
138
+ `Directory created: ${source/* default */.Ay.bold((0,external_path_.relative)(process.cwd(), accountThemeSrcDirPath))}`
139
+ ].join('\n'));
140
+ }
141
+
142
+ ;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/index.ts
143
+
144
+
145
+
146
+ /***/ }),
147
+
148
+ /***/ 221:
149
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
150
+
151
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
152
+ /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath)
153
+ /* harmony export */ });
154
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
155
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
156
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
157
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
158
+
159
+
160
+ function getThisCodebaseRootDirPath_rec(dirPath) {
161
+ if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
162
+ return dirPath;
163
+ }
164
+ return getThisCodebaseRootDirPath_rec(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
165
+ }
166
+ let result = undefined;
167
+ function getThisCodebaseRootDirPath() {
168
+ if (result !== undefined) {
169
+ return result;
170
+ }
171
+ return (result = getThisCodebaseRootDirPath_rec(__dirname));
172
+ }
173
+
174
+
175
+ /***/ }),
176
+
177
+ /***/ 395:
178
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
179
+
180
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
181
+ /* harmony export */ p: () => (/* binding */ getNodeModulesBinDirPath)
182
+ /* harmony export */ });
183
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
184
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
185
+
186
+ let cache = undefined;
187
+ function getNodeModulesBinDirPath() {
188
+ if (cache !== undefined) {
189
+ return cache;
190
+ }
191
+ const binPath = process.argv[1];
192
+ const segments = ['.bin'];
193
+ let foundNodeModules = false;
194
+ for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
195
+ skip_segment: {
196
+ if (foundNodeModules) {
197
+ break skip_segment;
198
+ }
199
+ if (segment === 'node_modules') {
200
+ foundNodeModules = true;
201
+ break skip_segment;
202
+ }
203
+ continue;
204
+ }
205
+ segments.unshift(segment);
206
+ }
207
+ const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
208
+ cache = nodeModulesBinDirPath;
209
+ return nodeModulesBinDirPath;
210
+ }
211
+
212
+
213
+ /***/ }),
214
+
215
+ /***/ 972:
216
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
217
+
218
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
219
+ /* harmony export */ M: () => (/* binding */ readThisNpmPackageVersion)
220
+ /* harmony export */ });
221
+ /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(221);
222
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(966);
223
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(896);
224
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
225
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(928);
226
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
227
+
228
+
229
+
230
+
231
+ let cache = undefined;
232
+ function readThisNpmPackageVersion() {
233
+ if (cache !== undefined) {
234
+ return cache;
235
+ }
236
+ const version = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_3__/* .getThisCodebaseRootDirPath */ .J)(), 'package.json'))
237
+ .toString('utf8'))['version'];
238
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .v)(typeof version === 'string');
239
+ cache = version;
240
+ return version;
241
+ }
242
+
243
+
244
+ /***/ }),
245
+
246
+ /***/ 915:
247
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
248
+
249
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
250
+ /* harmony export */ JS: () => (/* binding */ runPrettier),
251
+ /* harmony export */ L: () => (/* binding */ getIsPrettierAvailable)
252
+ /* harmony export */ });
253
+ /* unused harmony export getPrettier */
254
+ /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(395);
255
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
256
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
257
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(943);
258
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
259
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(94);
260
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
261
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(797);
262
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(982);
263
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_3__);
264
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(289);
265
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(886);
266
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(972);
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_5__.id)(undefined);
278
+ async function getIsPrettierAvailable() {
279
+ var _a;
280
+ if (getIsPrettierAvailable.cache !== undefined) {
281
+ return getIsPrettierAvailable.cache;
282
+ }
283
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_6__/* .getNodeModulesBinDirPath */ .p)();
284
+ const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(nodeModulesBinDirPath, 'prettier');
285
+ const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.stat(prettierBinPath).catch(() => undefined);
286
+ const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
287
+ getIsPrettierAvailable.cache = isPrettierAvailable;
288
+ return isPrettierAvailable;
289
+ }
290
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_5__.id)(undefined);
291
+ async function getPrettier() {
292
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)(getIsPrettierAvailable());
293
+ if (getPrettier.cache !== undefined) {
294
+ return getPrettier.cache;
295
+ }
296
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_5__.id)(undefined);
297
+ import_prettier: {
298
+ // NOTE: When module is linked we want to make sure we import the correct version
299
+ // of prettier, that is the one of the project, not the one of this repo.
300
+ // So we do a sketchy eval to bypass ncc.
301
+ // We make sure to only do that when linking, otherwise we import properly.
302
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__/* .readThisNpmPackageVersion */ .M)().startsWith('0.0.0')) {
303
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .I)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_0__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_6__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'))}")`);
304
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)(!(0,tsafe_is__WEBPACK_IMPORTED_MODULE_4__.is)(prettier));
305
+ break import_prettier;
306
+ }
307
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 166));
308
+ }
309
+ const configHash = await (async () => {
310
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_6__/* .getNodeModulesBinDirPath */ .p)(), '..'));
311
+ if (configFilePath === null) {
312
+ return '';
313
+ }
314
+ const data = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile(configFilePath);
315
+ return crypto__WEBPACK_IMPORTED_MODULE_3__.createHash('sha256').update(data).digest('hex');
316
+ })();
317
+ const prettierAndConfig = {
318
+ prettier,
319
+ configHash
320
+ };
321
+ getPrettier.cache = prettierAndConfig;
322
+ return prettierAndConfig;
323
+ }
324
+ async function runPrettier(params) {
325
+ const { sourceCode, filePath } = params;
326
+ let formattedSourceCode;
327
+ try {
328
+ const { prettier } = await getPrettier();
329
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
330
+ resolveConfig: true
331
+ });
332
+ if (ignored) {
333
+ return sourceCode;
334
+ }
335
+ const config = await prettier.resolveConfig(filePath);
336
+ formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
337
+ }
338
+ catch (error) {
339
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Ay.red(`You probably need to upgrade the version of prettier in your project`));
340
+ throw error;
341
+ }
342
+ return formattedSourceCode;
343
+ }
344
+
345
+
346
+ /***/ }),
347
+
348
+ /***/ 476:
349
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
350
+
351
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
352
+ /* harmony export */ command: () => (/* binding */ command)
353
+ /* harmony export */ });
354
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
355
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
356
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
357
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
358
+ /* harmony import */ var _tools_runPrettier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(915);
359
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
360
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
361
+
362
+
363
+
364
+
365
+ async function command(params) {
366
+ const { buildContext } = params;
367
+ const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, 'kc.gen.ts');
368
+ const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
369
+ const newContent = [
370
+ ``,
371
+ `/* eslint-disable */`,
372
+ ``,
373
+ `// @ts-nocheck`,
374
+ ``,
375
+ `// noinspection JSUnusedGlobalSymbols`,
376
+ ``,
377
+ `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
378
+ ``,
379
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(' | ')};`,
380
+ ``,
381
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(', ')}];`,
382
+ ``,
383
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? 'never' : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(' | ')};`,
384
+ ``,
385
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(', ')}];`,
386
+ ``,
387
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(Object.fromEntries(buildContext.environmentVariables.map(({ name, default: defaultValue }) => [name, defaultValue])), null, 2)};`,
388
+ ``,
389
+ `export type KcContext =`,
390
+ ...implementedThemeTypes.map(themeType => ` | import("./${themeType}/KcContext").KcContext`),
391
+ ` ;`,
392
+ ``,
393
+ `declare global {`,
394
+ ` interface Window {`,
395
+ ` kcContext?: KcContext;`,
396
+ ` }`,
397
+ `}`,
398
+ ``,
399
+ `type ApplicationRefLike = {`,
400
+ ` components: ComponentRef<any>[];`,
401
+ `};`,
402
+ ``,
403
+ `export async function bootstrapKcApplication(params: {`,
404
+ ` kcContext: KcContext;`,
405
+ ` bootstrapApplication: (params: {`,
406
+ ` KcRootComponent: Type<unknown>;`,
407
+ ` kcProvider: EnvironmentProviders;`,
408
+ ` }) => Promise<ApplicationRefLike>;`,
409
+ `}) {`,
410
+ ` const { kcContext, bootstrapApplication } = params;`,
411
+ ``,
412
+ ` switch (kcContext.themeType) {`,
413
+ ...['login', 'account']
414
+ .filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented)
415
+ .map(themeType => [
416
+ ` case "${themeType}":`,
417
+ ` {`,
418
+ ` const [`,
419
+ ` { provideKeycloakifyAngular },`,
420
+ ` { getI18n },`,
421
+ ` {`,
422
+ ` PageComponent,`,
423
+ ` TemplateComponent,`,
424
+ ` doUseDefaultCss,`,
425
+ ` classes,`,
426
+ ...(themeType === 'login'
427
+ ? [
428
+ ` UserProfileFormFieldsComponent,`,
429
+ ` doMakeUserConfirmPassword,`
430
+ ]
431
+ : []),
432
+ ` },`,
433
+ ` ] = await Promise.all([`,
434
+ ` import('@keycloakify/angular/login/providers/keycloakify-angular'),`,
435
+ ` import('./${themeType}/i18n'),`,
436
+ ` import('./${themeType}/KcPage').then(({ getKcPage }) => getKcPage(kcContext.pageId)),`,
437
+ ` ] as const);`,
438
+ ``,
439
+ ` const appRef = await bootstrapApplication({`,
440
+ ` KcRootComponent: TemplateComponent,`,
441
+ ` kcProvider: provideKeycloakifyAngular({`,
442
+ ` kcContext,`,
443
+ ` classes,`,
444
+ ` getI18n,`,
445
+ ` doUseDefaultCss,`,
446
+ ...(themeType === 'login'
447
+ ? [` doMakeUserConfirmPassword,`]
448
+ : []),
449
+ ` })`,
450
+ ` });`,
451
+ ``,
452
+ ` appRef.components.forEach(componentRef => {`,
453
+ ` // page must be defined first `,
454
+ ` if ("page" in componentRef.instance) {`,
455
+ ` componentRef.setInput("page", PageComponent);`,
456
+ ` }`,
457
+ ...(themeType === 'login'
458
+ ? [
459
+ ` if ("userProfileFormFields" in componentRef.instance) {`,
460
+ ` componentRef.setInput(`,
461
+ ` "userProfileFormFields",`,
462
+ ` UserProfileFormFieldsComponent`,
463
+ ` );`,
464
+ ` }`
465
+ ]
466
+ : []),
467
+ ` });`,
468
+ ` }`,
469
+ ` break;`
470
+ ])
471
+ .flat(),
472
+ ` }`,
473
+ `}`,
474
+ ``
475
+ ].join('\n');
476
+ const hash = crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(newContent).digest('hex');
477
+ skip_if_no_changes: {
478
+ if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)) {
479
+ break skip_if_no_changes;
480
+ }
481
+ const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath).toString('utf8');
482
+ if (!currentContent.includes(hash)) {
483
+ break skip_if_no_changes;
484
+ }
485
+ return;
486
+ }
487
+ let sourceCode = [
488
+ `// This file is auto-generated by keycloakify. Do not edit it manually.`,
489
+ `// Hash: ${hash}`,
490
+ ``,
491
+ newContent
492
+ ].join('\n');
493
+ run_prettier: {
494
+ if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_3__/* .getIsPrettierAvailable */ .L)())) {
495
+ break run_prettier;
496
+ }
497
+ sourceCode = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_3__/* .runPrettier */ .JS)({
498
+ filePath,
499
+ sourceCode
500
+ });
501
+ }
502
+ fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, Buffer.from(sourceCode, 'utf8'));
503
+ }
504
+
505
+
506
+ /***/ })
507
+
508
+ };