@keycloakify/angular 21.1.5 → 22.0.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 (152) hide show
  1. package/README.md +2 -0
  2. package/bin/index.js +72 -1113
  3. package/fesm2022/keycloakify-angular-account-directives-kc-class.mjs +3 -3
  4. package/fesm2022/keycloakify-angular-account-directives-kc-class.mjs.map +1 -1
  5. package/fesm2022/keycloakify-angular-account-pages-account.mjs +3 -3
  6. package/fesm2022/keycloakify-angular-account-pages-account.mjs.map +1 -1
  7. package/fesm2022/keycloakify-angular-account-pages-applications.mjs +3 -3
  8. package/fesm2022/keycloakify-angular-account-pages-applications.mjs.map +1 -1
  9. package/fesm2022/keycloakify-angular-account-pages-federatedIdentity.mjs +3 -3
  10. package/fesm2022/keycloakify-angular-account-pages-federatedIdentity.mjs.map +1 -1
  11. package/fesm2022/keycloakify-angular-account-pages-log.mjs +3 -3
  12. package/fesm2022/keycloakify-angular-account-pages-log.mjs.map +1 -1
  13. package/fesm2022/keycloakify-angular-account-pages-password.mjs +17 -10
  14. package/fesm2022/keycloakify-angular-account-pages-password.mjs.map +1 -1
  15. package/fesm2022/keycloakify-angular-account-pages-sessions.mjs +3 -3
  16. package/fesm2022/keycloakify-angular-account-pages-sessions.mjs.map +1 -1
  17. package/fesm2022/keycloakify-angular-account-pages-totp.mjs +3 -3
  18. package/fesm2022/keycloakify-angular-account-pages-totp.mjs.map +1 -1
  19. package/fesm2022/keycloakify-angular-account-services-account-resource-injector.mjs +3 -3
  20. package/fesm2022/keycloakify-angular-account-services-account-resource-injector.mjs.map +1 -1
  21. package/fesm2022/keycloakify-angular-account-services-i18n.mjs +3 -3
  22. package/fesm2022/keycloakify-angular-account-services-i18n.mjs.map +1 -1
  23. package/fesm2022/keycloakify-angular-account-template.mjs +5 -4
  24. package/fesm2022/keycloakify-angular-account-template.mjs.map +1 -1
  25. package/fesm2022/keycloakify-angular-lib-directives-attributes.mjs +5 -4
  26. package/fesm2022/keycloakify-angular-lib-directives-attributes.mjs.map +1 -1
  27. package/fesm2022/keycloakify-angular-lib-pipes-input-type.mjs +3 -3
  28. package/fesm2022/keycloakify-angular-lib-pipes-input-type.mjs.map +1 -1
  29. package/fesm2022/keycloakify-angular-lib-pipes-is-array-with-empty-object.mjs +3 -3
  30. package/fesm2022/keycloakify-angular-lib-pipes-is-array-with-empty-object.mjs.map +1 -1
  31. package/fesm2022/keycloakify-angular-lib-pipes-kc-sanitize.mjs +3 -3
  32. package/fesm2022/keycloakify-angular-lib-pipes-kc-sanitize.mjs.map +1 -1
  33. package/fesm2022/keycloakify-angular-lib-pipes-to-array.mjs +3 -3
  34. package/fesm2022/keycloakify-angular-lib-pipes-to-array.mjs.map +1 -1
  35. package/fesm2022/keycloakify-angular-lib-pipes-to-number.mjs +3 -3
  36. package/fesm2022/keycloakify-angular-lib-pipes-to-number.mjs.map +1 -1
  37. package/fesm2022/keycloakify-angular-lib-services-resource-injector.mjs +3 -3
  38. package/fesm2022/keycloakify-angular-lib-services-resource-injector.mjs.map +1 -1
  39. package/fesm2022/keycloakify-angular-login-components-add-remove-buttons-multi-valued-attribute.mjs +13 -8
  40. package/fesm2022/keycloakify-angular-login-components-add-remove-buttons-multi-valued-attribute.mjs.map +1 -1
  41. package/fesm2022/keycloakify-angular-login-components-field-errors.mjs +9 -6
  42. package/fesm2022/keycloakify-angular-login-components-field-errors.mjs.map +1 -1
  43. package/fesm2022/keycloakify-angular-login-components-group-label.mjs +9 -6
  44. package/fesm2022/keycloakify-angular-login-components-group-label.mjs.map +1 -1
  45. package/fesm2022/keycloakify-angular-login-components-input-field-by-type.mjs +11 -7
  46. package/fesm2022/keycloakify-angular-login-components-input-field-by-type.mjs.map +1 -1
  47. package/fesm2022/keycloakify-angular-login-components-input-tag-selects.mjs +13 -8
  48. package/fesm2022/keycloakify-angular-login-components-input-tag-selects.mjs.map +1 -1
  49. package/fesm2022/keycloakify-angular-login-components-input-tag.mjs +15 -9
  50. package/fesm2022/keycloakify-angular-login-components-input-tag.mjs.map +1 -1
  51. package/fesm2022/keycloakify-angular-login-components-logout-other-sessions.mjs +3 -3
  52. package/fesm2022/keycloakify-angular-login-components-logout-other-sessions.mjs.map +1 -1
  53. package/fesm2022/keycloakify-angular-login-components-password-wrapper.mjs +7 -5
  54. package/fesm2022/keycloakify-angular-login-components-password-wrapper.mjs.map +1 -1
  55. package/fesm2022/keycloakify-angular-login-components-select-tag.mjs +13 -8
  56. package/fesm2022/keycloakify-angular-login-components-select-tag.mjs.map +1 -1
  57. package/fesm2022/keycloakify-angular-login-components-textarea-tag.mjs +9 -6
  58. package/fesm2022/keycloakify-angular-login-components-textarea-tag.mjs.map +1 -1
  59. package/fesm2022/keycloakify-angular-login-components-user-profile-form-fields.mjs +3 -3
  60. package/fesm2022/keycloakify-angular-login-components-user-profile-form-fields.mjs.map +1 -1
  61. package/fesm2022/keycloakify-angular-login-directives-kc-class.mjs +3 -3
  62. package/fesm2022/keycloakify-angular-login-directives-kc-class.mjs.map +1 -1
  63. package/fesm2022/keycloakify-angular-login-pages-code.mjs +9 -6
  64. package/fesm2022/keycloakify-angular-login-pages-code.mjs.map +1 -1
  65. package/fesm2022/keycloakify-angular-login-pages-delete-account-confirm.mjs +9 -6
  66. package/fesm2022/keycloakify-angular-login-pages-delete-account-confirm.mjs.map +1 -1
  67. package/fesm2022/keycloakify-angular-login-pages-delete-credential.mjs +9 -6
  68. package/fesm2022/keycloakify-angular-login-pages-delete-credential.mjs.map +1 -1
  69. package/fesm2022/keycloakify-angular-login-pages-error.mjs +9 -6
  70. package/fesm2022/keycloakify-angular-login-pages-error.mjs.map +1 -1
  71. package/fesm2022/keycloakify-angular-login-pages-frontchannel-logout.mjs +11 -7
  72. package/fesm2022/keycloakify-angular-login-pages-frontchannel-logout.mjs.map +1 -1
  73. package/fesm2022/keycloakify-angular-login-pages-idp-review-user-profile.mjs +11 -7
  74. package/fesm2022/keycloakify-angular-login-pages-idp-review-user-profile.mjs.map +1 -1
  75. package/fesm2022/keycloakify-angular-login-pages-info.mjs +9 -6
  76. package/fesm2022/keycloakify-angular-login-pages-info.mjs.map +1 -1
  77. package/fesm2022/keycloakify-angular-login-pages-link-idp-action.mjs +9 -6
  78. package/fesm2022/keycloakify-angular-login-pages-link-idp-action.mjs.map +1 -1
  79. package/fesm2022/keycloakify-angular-login-pages-login-config-totp.mjs +9 -6
  80. package/fesm2022/keycloakify-angular-login-pages-login-config-totp.mjs.map +1 -1
  81. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm-override.mjs +9 -6
  82. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm-override.mjs.map +1 -1
  83. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm.mjs +9 -6
  84. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm.mjs.map +1 -1
  85. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-email.mjs +9 -6
  86. package/fesm2022/keycloakify-angular-login-pages-login-idp-link-email.mjs.map +1 -1
  87. package/fesm2022/keycloakify-angular-login-pages-login-oauth-grant.mjs +9 -6
  88. package/fesm2022/keycloakify-angular-login-pages-login-oauth-grant.mjs.map +1 -1
  89. package/fesm2022/keycloakify-angular-login-pages-login-oauth2-device-verify-user-code.mjs +9 -6
  90. package/fesm2022/keycloakify-angular-login-pages-login-oauth2-device-verify-user-code.mjs.map +1 -1
  91. package/fesm2022/keycloakify-angular-login-pages-login-otp.mjs +9 -6
  92. package/fesm2022/keycloakify-angular-login-pages-login-otp.mjs.map +1 -1
  93. package/fesm2022/keycloakify-angular-login-pages-login-page-expired.mjs +9 -6
  94. package/fesm2022/keycloakify-angular-login-pages-login-page-expired.mjs.map +1 -1
  95. package/fesm2022/keycloakify-angular-login-pages-login-passkeys-conditional-authenticate.mjs +9 -6
  96. package/fesm2022/keycloakify-angular-login-pages-login-passkeys-conditional-authenticate.mjs.map +1 -1
  97. package/fesm2022/keycloakify-angular-login-pages-login-password.mjs +11 -7
  98. package/fesm2022/keycloakify-angular-login-pages-login-password.mjs.map +1 -1
  99. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-config.mjs +11 -7
  100. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-config.mjs.map +1 -1
  101. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-input.mjs +9 -6
  102. package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-input.mjs.map +1 -1
  103. package/fesm2022/keycloakify-angular-login-pages-login-reset-otp.mjs +9 -6
  104. package/fesm2022/keycloakify-angular-login-pages-login-reset-otp.mjs.map +1 -1
  105. package/fesm2022/keycloakify-angular-login-pages-login-reset-password.mjs +9 -6
  106. package/fesm2022/keycloakify-angular-login-pages-login-reset-password.mjs.map +1 -1
  107. package/fesm2022/keycloakify-angular-login-pages-login-update-password.mjs +9 -6
  108. package/fesm2022/keycloakify-angular-login-pages-login-update-password.mjs.map +1 -1
  109. package/fesm2022/keycloakify-angular-login-pages-login-update-profile.mjs +11 -7
  110. package/fesm2022/keycloakify-angular-login-pages-login-update-profile.mjs.map +1 -1
  111. package/fesm2022/keycloakify-angular-login-pages-login-username.mjs +11 -7
  112. package/fesm2022/keycloakify-angular-login-pages-login-username.mjs.map +1 -1
  113. package/fesm2022/keycloakify-angular-login-pages-login-verify-email.mjs +9 -6
  114. package/fesm2022/keycloakify-angular-login-pages-login-verify-email.mjs.map +1 -1
  115. package/fesm2022/keycloakify-angular-login-pages-login-x509-info.mjs +9 -6
  116. package/fesm2022/keycloakify-angular-login-pages-login-x509-info.mjs.map +1 -1
  117. package/fesm2022/keycloakify-angular-login-pages-login.mjs +11 -7
  118. package/fesm2022/keycloakify-angular-login-pages-login.mjs.map +1 -1
  119. package/fesm2022/keycloakify-angular-login-pages-logout-confirm.mjs +9 -6
  120. package/fesm2022/keycloakify-angular-login-pages-logout-confirm.mjs.map +1 -1
  121. package/fesm2022/keycloakify-angular-login-pages-register.mjs +13 -8
  122. package/fesm2022/keycloakify-angular-login-pages-register.mjs.map +1 -1
  123. package/fesm2022/keycloakify-angular-login-pages-saml-post-form.mjs +11 -7
  124. package/fesm2022/keycloakify-angular-login-pages-saml-post-form.mjs.map +1 -1
  125. package/fesm2022/keycloakify-angular-login-pages-select-authenticator.mjs +9 -6
  126. package/fesm2022/keycloakify-angular-login-pages-select-authenticator.mjs.map +1 -1
  127. package/fesm2022/keycloakify-angular-login-pages-terms.mjs +9 -6
  128. package/fesm2022/keycloakify-angular-login-pages-terms.mjs.map +1 -1
  129. package/fesm2022/keycloakify-angular-login-pages-update-email.mjs +11 -7
  130. package/fesm2022/keycloakify-angular-login-pages-update-email.mjs.map +1 -1
  131. package/fesm2022/keycloakify-angular-login-pages-webauthn-authenticate.mjs +9 -6
  132. package/fesm2022/keycloakify-angular-login-pages-webauthn-authenticate.mjs.map +1 -1
  133. package/fesm2022/keycloakify-angular-login-pages-webauthn-error.mjs +9 -6
  134. package/fesm2022/keycloakify-angular-login-pages-webauthn-error.mjs.map +1 -1
  135. package/fesm2022/keycloakify-angular-login-pages-webauthn-register.mjs +9 -6
  136. package/fesm2022/keycloakify-angular-login-pages-webauthn-register.mjs.map +1 -1
  137. package/fesm2022/keycloakify-angular-login-services-i18n.mjs +3 -3
  138. package/fesm2022/keycloakify-angular-login-services-i18n.mjs.map +1 -1
  139. package/fesm2022/keycloakify-angular-login-services-login-resource-injector.mjs +3 -3
  140. package/fesm2022/keycloakify-angular-login-services-login-resource-injector.mjs.map +1 -1
  141. package/fesm2022/keycloakify-angular-login-services-user-profile-form.mjs +3 -3
  142. package/fesm2022/keycloakify-angular-login-services-user-profile-form.mjs.map +1 -1
  143. package/fesm2022/keycloakify-angular-login-template.mjs +13 -8
  144. package/fesm2022/keycloakify-angular-login-template.mjs.map +1 -1
  145. package/package.json +1 -1
  146. package/src/bin/initialize-account-theme/boilerplate/KcPageStory.ts +2 -0
  147. package/src/bin/tsconfig.json +4 -5
  148. package/bin/187.index.js +0 -514
  149. package/bin/202.index.js +0 -7778
  150. package/bin/476.index.js +0 -400
  151. package/bin/671.index.js +0 -1354
  152. package/bin/942.index.js +0 -911
package/bin/671.index.js DELETED
@@ -1,1354 +0,0 @@
1
- export const id = 671;
2
- export const ids = [671];
3
- export const modules = {
4
-
5
- /***/ 814:
6
- /***/ ((module) => {
7
-
8
-
9
- const x = module.exports;
10
- const ESC = '\u001B[';
11
- const OSC = '\u001B]';
12
- const BEL = '\u0007';
13
- const SEP = ';';
14
- const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
15
-
16
- x.cursorTo = (x, y) => {
17
- if (typeof x !== 'number') {
18
- throw new TypeError('The `x` argument is required');
19
- }
20
-
21
- if (typeof y !== 'number') {
22
- return ESC + (x + 1) + 'G';
23
- }
24
-
25
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
26
- };
27
-
28
- x.cursorMove = (x, y) => {
29
- if (typeof x !== 'number') {
30
- throw new TypeError('The `x` argument is required');
31
- }
32
-
33
- let ret = '';
34
-
35
- if (x < 0) {
36
- ret += ESC + (-x) + 'D';
37
- } else if (x > 0) {
38
- ret += ESC + x + 'C';
39
- }
40
-
41
- if (y < 0) {
42
- ret += ESC + (-y) + 'A';
43
- } else if (y > 0) {
44
- ret += ESC + y + 'B';
45
- }
46
-
47
- return ret;
48
- };
49
-
50
- x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
51
- x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
52
- x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
53
- x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
54
-
55
- x.cursorLeft = ESC + 'G';
56
- x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
57
- x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
58
- x.cursorGetPosition = ESC + '6n';
59
- x.cursorNextLine = ESC + 'E';
60
- x.cursorPrevLine = ESC + 'F';
61
- x.cursorHide = ESC + '?25l';
62
- x.cursorShow = ESC + '?25h';
63
-
64
- x.eraseLines = count => {
65
- let clear = '';
66
-
67
- for (let i = 0; i < count; i++) {
68
- clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
69
- }
70
-
71
- if (count) {
72
- clear += x.cursorLeft;
73
- }
74
-
75
- return clear;
76
- };
77
-
78
- x.eraseEndLine = ESC + 'K';
79
- x.eraseStartLine = ESC + '1K';
80
- x.eraseLine = ESC + '2K';
81
- x.eraseDown = ESC + 'J';
82
- x.eraseUp = ESC + '1J';
83
- x.eraseScreen = ESC + '2J';
84
- x.scrollUp = ESC + 'S';
85
- x.scrollDown = ESC + 'T';
86
-
87
- x.clearScreen = '\u001Bc';
88
-
89
- x.clearTerminal = process.platform === 'win32' ?
90
- `${x.eraseScreen}${ESC}0f` :
91
- // 1. Erases the screen (Only done in case `2` is not supported)
92
- // 2. Erases the whole screen including scrollback buffer
93
- // 3. Moves cursor to the top-left position
94
- // More info: https://www.real-world-systems.com/docs/ANSIcode.html
95
- `${x.eraseScreen}${ESC}3J${ESC}H`;
96
-
97
- x.beep = BEL;
98
-
99
- x.link = (text, url) => {
100
- return [
101
- OSC,
102
- '8',
103
- SEP,
104
- SEP,
105
- url,
106
- BEL,
107
- text,
108
- OSC,
109
- '8',
110
- SEP,
111
- SEP,
112
- BEL
113
- ].join('');
114
- };
115
-
116
- x.image = (buf, opts) => {
117
- opts = opts || {};
118
-
119
- let ret = OSC + '1337;File=inline=1';
120
-
121
- if (opts.width) {
122
- ret += `;width=${opts.width}`;
123
- }
124
-
125
- if (opts.height) {
126
- ret += `;height=${opts.height}`;
127
- }
128
-
129
- if (opts.preserveAspectRatio === false) {
130
- ret += ';preserveAspectRatio=0';
131
- }
132
-
133
- return ret + ':' + buf.toString('base64') + BEL;
134
- };
135
-
136
- x.iTerm = {};
137
-
138
- x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL;
139
-
140
-
141
- /***/ }),
142
-
143
- /***/ 672:
144
- /***/ ((__unused_webpack_module, exports) => {
145
-
146
-
147
-
148
- Object.defineProperty(exports, "__esModule", ({
149
- value: true
150
- }));
151
- exports.withPromise = exports.withCallback = void 0;
152
-
153
- /**
154
- * Open the input with a normal callback function
155
- *
156
- * @param {Input} input - input object
157
- * @param {function} valueMapper - function which maps the resulting id and value back to the expected format
158
- * @param {function} callback - callback function
159
- */
160
- const withCallback = (input, valueMapper, callback) => {
161
- input.open();
162
- input.onSelect((id, value) => callback(valueMapper(id, value)));
163
- };
164
- /**
165
- * Open the input with a promise
166
- *
167
- * @param {Input} input - input object
168
- * @param {function} valueMapper - function which maps the resulting id and value back to the expected format
169
- */
170
-
171
-
172
- exports.withCallback = withCallback;
173
-
174
- const withPromise = (input, valueMapper) => {
175
- return new Promise((resolve, reject) => {
176
- input.open();
177
- input.onSelect((id, value) => {
178
- if (id === null) {
179
- reject();
180
- } else {
181
- resolve(valueMapper(id, value));
182
- }
183
- });
184
- });
185
- };
186
-
187
- exports.withPromise = withPromise;
188
-
189
- /***/ }),
190
-
191
- /***/ 546:
192
- /***/ ((module, exports, __webpack_require__) => {
193
-
194
-
195
-
196
- Object.defineProperty(exports, "__esModule", ({
197
- value: true
198
- }));
199
- exports["default"] = void 0;
200
-
201
- var _input = _interopRequireDefault(__webpack_require__(938));
202
-
203
- var _renderer = _interopRequireDefault(__webpack_require__(547));
204
-
205
- var _callbackMappers = __webpack_require__(672);
206
-
207
- var _valueMappers = __webpack_require__(348);
208
-
209
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
210
-
211
- 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; }
212
-
213
- 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; }
214
-
215
- /**
216
- * Default options
217
- */
218
- const defaultOptions = {
219
- outputStream: process.stdout,
220
- inputStream: process.stdin,
221
- values: [],
222
- defaultValue: 0,
223
- selected: '(x)',
224
- unselected: '( )',
225
- indentation: 0,
226
- cleanup: true,
227
- valueRenderer: value => value
228
- };
229
- /**
230
- * Create an instance of cli-select with the given options
231
- *
232
- * @param {object} options - options for cli-select
233
- * @param {function} callback - if specified, a callback will be used, otherwise a promise gets returned (optional)
234
- */
235
-
236
- const creator = (options, callback) => {
237
- // merge options with default options
238
- options = _objectSpread({}, defaultOptions, options); // create renderer and input instances
239
-
240
- const renderer = new _renderer.default(options, options.outputStream);
241
- const input = new _input.default(options.inputStream);
242
- input.setDefaultValue(options.defaultValue);
243
- input.attachRenderer(renderer); // handle array and object values
244
-
245
- let valueMapper;
246
-
247
- if (Array.isArray(options.values)) {
248
- valueMapper = (0, _valueMappers.withArrayValues)(options);
249
- } else {
250
- valueMapper = (0, _valueMappers.withObjectValues)(options);
251
- } // map values
252
-
253
-
254
- options.values = valueMapper.input;
255
- input.setValues(options.values); // handle different callback methods
256
-
257
- if (typeof callback === 'function') {
258
- return (0, _callbackMappers.withCallback)(input, valueMapper.output, callback);
259
- } else {
260
- return (0, _callbackMappers.withPromise)(input, valueMapper.output);
261
- }
262
- };
263
-
264
- exports = module.exports = creator;
265
- Object.defineProperty(exports, "__esModule", ({
266
- value: true
267
- }));
268
- var _default = creator;
269
- exports["default"] = _default;
270
-
271
- /***/ }),
272
-
273
- /***/ 938:
274
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
275
-
276
-
277
-
278
- Object.defineProperty(exports, "__esModule", ({
279
- value: true
280
- }));
281
- exports["default"] = void 0;
282
-
283
- var _readline = _interopRequireDefault(__webpack_require__(785));
284
-
285
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
286
-
287
- /**
288
- * Handle cli input
289
- */
290
- class Input {
291
- /**
292
- * Input constructor
293
- *
294
- * @param {any} stream - stream to catch (optional)
295
- */
296
- constructor(stream = process.stdin) {
297
- // set default values
298
- this.stream = stream;
299
- this.values = [];
300
- this.selectedValue = 0;
301
-
302
- this.onSelectListener = () => {};
303
-
304
- this.onKeyPress = this.onKeyPress.bind(this);
305
- }
306
- /**
307
- * Set the available values
308
- *
309
- * @param {array} values - all available values
310
- */
311
-
312
-
313
- setValues(values) {
314
- this.values = values;
315
-
316
- if (this.renderer) {
317
- this.renderer.setValues(values);
318
- }
319
- }
320
- /**
321
- * Set the default value
322
- *
323
- * @param {number} defaultValue - default value id
324
- */
325
-
326
-
327
- setDefaultValue(defaultValue) {
328
- this.selectedValue = defaultValue;
329
- }
330
- /**
331
- * Attach a renderer to the input catcher
332
- *
333
- * @param {Renderer} renderer - renderer to use for rendering responses
334
- */
335
-
336
-
337
- attachRenderer(renderer) {
338
- this.renderer = renderer;
339
- this.renderer.setValues(this.values);
340
- }
341
- /**
342
- * Register an on select listener
343
- *
344
- * @param {function} listener - listener function which receives two parameters: valueId and value
345
- */
346
-
347
-
348
- onSelect(listener) {
349
- this.onSelectListener = listener;
350
- }
351
- /**
352
- * Open the stream and listen for input
353
- */
354
-
355
-
356
- open() {
357
- // register keypress event
358
- _readline.default.emitKeypressEvents(this.stream); // handle keypress
359
-
360
-
361
- this.stream.on('keypress', this.onKeyPress); // initially render the response
362
-
363
- if (this.renderer) {
364
- this.renderer.render(this.selectedValue);
365
- } // hide pressed keys and start listening on input
366
-
367
-
368
- this.stream.setRawMode(true);
369
- this.stream.resume();
370
- }
371
- /**
372
- * Close the stream
373
- *
374
- * @param {boolean} cancelled - true if no value was selected (optional)
375
- */
376
-
377
-
378
- close(cancelled = false) {
379
- // reset stream properties
380
- this.stream.setRawMode(false);
381
- this.stream.pause(); // cleanup the output
382
-
383
- if (this.renderer) {
384
- this.renderer.cleanup();
385
- } // call the on select listener
386
-
387
-
388
- if (cancelled) {
389
- this.onSelectListener(null);
390
- } else {
391
- this.onSelectListener(this.selectedValue, this.values[this.selectedValue]);
392
- }
393
-
394
- this.stream.removeListener('keypress', this.onKeyPress);
395
- }
396
- /**
397
- * Render the response
398
- */
399
-
400
-
401
- render() {
402
- if (!this.renderer) {
403
- return;
404
- }
405
-
406
- this.renderer.render(this.selectedValue);
407
- }
408
- /**
409
- * Handle key press event
410
- *
411
- * @param {string} string - input string
412
- * @param {object} key - object containing information about the pressed key
413
- */
414
-
415
-
416
- onKeyPress(string, key) {
417
- if (key) {
418
- if (key.name === 'up' && this.selectedValue > 0) {
419
- this.selectedValue--;
420
- this.render();
421
- } else if (key.name === 'down' && this.selectedValue + 1 < this.values.length) {
422
- this.selectedValue++;
423
- this.render();
424
- } else if (key.name === 'return') {
425
- this.close();
426
- } else if (key.name === 'escape' || key.name === 'c' && key.ctrl) {
427
- this.close(true);
428
- }
429
- }
430
- }
431
-
432
- }
433
-
434
- exports["default"] = Input;
435
-
436
- /***/ }),
437
-
438
- /***/ 547:
439
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
440
-
441
-
442
-
443
- Object.defineProperty(exports, "__esModule", ({
444
- value: true
445
- }));
446
- exports["default"] = void 0;
447
-
448
- var _readline = _interopRequireDefault(__webpack_require__(785));
449
-
450
- var _ansiEscapes = __webpack_require__(814);
451
-
452
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
453
-
454
- /**
455
- * Response renderer
456
- */
457
- class Renderer {
458
- /**
459
- * Renderer constructor
460
- *
461
- * @param {object} options - renderer options
462
- * @param {any} stream - stream to write to (optional)
463
- */
464
- constructor(options, stream = process.stdout) {
465
- this.options = options;
466
- this.stream = stream;
467
- this.values = [];
468
- this.initialRender = true;
469
- }
470
- /**
471
- * Set the available values
472
- *
473
- * @param {array} values - all available values
474
- */
475
-
476
-
477
- setValues(values) {
478
- this.values = values;
479
- }
480
- /**
481
- * Render the values
482
- *
483
- * @param {number} selectedValue - selected value (optional)
484
- */
485
-
486
-
487
- render(selectedValue = 0) {
488
- if (this.initialRender) {
489
- // hide the cursor initially
490
- this.initialRender = false;
491
- this.stream.write(_ansiEscapes.cursorHide);
492
- } else {
493
- // remove previous lines and values
494
- this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
495
- } // output the current values
496
-
497
-
498
- this.values.forEach((value, index) => {
499
- const symbol = selectedValue === index ? this.options.selected : this.options.unselected;
500
- const indentation = ' '.repeat(this.options.indentation);
501
- const renderedValue = this.options.valueRenderer(value, selectedValue === index);
502
- const end = index !== this.values.length - 1 ? '\n' : '';
503
- this.stream.write(indentation + symbol + ' ' + renderedValue + end);
504
- });
505
- }
506
- /**
507
- * Cleanup the console at the end
508
- */
509
-
510
-
511
- cleanup() {
512
- this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
513
- this.stream.write(_ansiEscapes.cursorShow);
514
- }
515
-
516
- }
517
-
518
- exports["default"] = Renderer;
519
-
520
- /***/ }),
521
-
522
- /***/ 348:
523
- /***/ ((__unused_webpack_module, exports) => {
524
-
525
-
526
-
527
- Object.defineProperty(exports, "__esModule", ({
528
- value: true
529
- }));
530
- exports.withObjectValues = exports.withArrayValues = void 0;
531
-
532
- /**
533
- * Map incoming and outgoing values if the initial values are an array
534
- *
535
- * @param {object} options - cli-select options
536
- */
537
- const withArrayValues = options => {
538
- return {
539
- input: options.values,
540
- output: (id, value) => {
541
- return {
542
- id,
543
- value
544
- };
545
- }
546
- };
547
- };
548
- /**
549
- * Map incoming and outgoing values if the initial values are an object
550
- *
551
- * @param {object} options - cli-select options
552
- */
553
-
554
-
555
- exports.withArrayValues = withArrayValues;
556
-
557
- const withObjectValues = options => {
558
- const originalValues = options.values;
559
- return {
560
- input: Object.values(originalValues),
561
- output: (id, value) => {
562
- return {
563
- id: Object.keys(originalValues)[id],
564
- value
565
- };
566
- }
567
- };
568
- };
569
-
570
- exports.withObjectValues = withObjectValues;
571
-
572
- /***/ }),
573
-
574
- /***/ 671:
575
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
576
-
577
-
578
- // EXPORTS
579
- __webpack_require__.d(__webpack_exports__, {
580
- command: () => (/* binding */ command)
581
- });
582
-
583
- // EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.ts
584
- var getThisCodebaseRootDirPath = __webpack_require__(221);
585
- // EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
586
- var dist = __webpack_require__(546);
587
- var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
588
- // EXTERNAL MODULE: ./node_modules/keycloakify/bin/shared/constants.js
589
- var constants = __webpack_require__(316);
590
- // EXTERNAL MODULE: external "fs"
591
- var external_fs_ = __webpack_require__(896);
592
- // EXTERNAL MODULE: external "path"
593
- var external_path_ = __webpack_require__(928);
594
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs
595
- var assert = __webpack_require__(559);
596
- // EXTERNAL MODULE: ./node_modules/chalk/source/index.js + 6 modules
597
- var source = __webpack_require__(276);
598
- ;// CONCATENATED MODULE: ./dist/bin/tools/crawl.ts
599
-
600
-
601
- const crawlRec = (dirPath, filePaths) => {
602
- for (const basename of external_fs_.readdirSync(dirPath)) {
603
- const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
604
- if (external_fs_.lstatSync(fileOrDirPath).isDirectory()) {
605
- crawlRec(fileOrDirPath, filePaths);
606
- continue;
607
- }
608
- filePaths.push(fileOrDirPath);
609
- }
610
- };
611
- /** List all files in a given directory return paths relative to the dir_path */
612
- function crawl(params) {
613
- const { dirPath, returnedPathsType } = params;
614
- const filePaths = [];
615
- crawlRec(dirPath, filePaths);
616
- switch (returnedPathsType) {
617
- case 'absolute':
618
- return filePaths;
619
- case 'relative to dirPath':
620
- return filePaths.map(filePath => (0,external_path_.relative)(dirPath, filePath));
621
- }
622
- }
623
-
624
- ;// CONCATENATED MODULE: ./dist/bin/tools/SemVer.ts
625
- var SemVer;
626
- (function (SemVer) {
627
- const bumpTypes = ['major', 'minor', 'patch', 'rc', 'no bump'];
628
- function parse(versionStr) {
629
- const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
630
- if (!match) {
631
- throw new Error(`${versionStr} is not a valid semantic version`);
632
- }
633
- const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
634
- const str = match[3];
635
- return str === undefined ? 0 : parseInt(str);
636
- })() }, (() => {
637
- const str = match[4];
638
- return str === undefined ? {} : { rc: parseInt(str) };
639
- })());
640
- const initialStr = stringify(semVer);
641
- Object.defineProperty(semVer, 'parsedFrom', {
642
- enumerable: true,
643
- get: function () {
644
- const currentStr = stringify(this);
645
- if (currentStr !== initialStr) {
646
- throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
647
- }
648
- return versionStr;
649
- }
650
- });
651
- return semVer;
652
- }
653
- SemVer.parse = parse;
654
- function stringify(v) {
655
- return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? '' : `-rc.${v.rc}`}`;
656
- }
657
- SemVer.stringify = stringify;
658
- /**
659
- *
660
- * v1 < v2 => -1
661
- * v1 === v2 => 0
662
- * v1 > v2 => 1
663
- *
664
- */
665
- function compare(v1, v2) {
666
- const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
667
- const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
668
- for (const level of ['major', 'minor', 'patch', 'rc']) {
669
- if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
670
- return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
671
- }
672
- }
673
- return 0;
674
- }
675
- SemVer.compare = compare;
676
- /*
677
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
678
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
679
- console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
680
- */
681
- function bumpType(params) {
682
- const versionAhead = typeof params.versionAhead === 'string'
683
- ? parse(params.versionAhead)
684
- : params.versionAhead;
685
- const versionBehind = typeof params.versionBehind === 'string'
686
- ? parse(params.versionBehind)
687
- : params.versionBehind;
688
- if (compare(versionBehind, versionAhead) === 1) {
689
- throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
690
- }
691
- for (const level of ['major', 'minor', 'patch', 'rc']) {
692
- if (versionBehind[level] !== versionAhead[level]) {
693
- return level;
694
- }
695
- }
696
- return 'no bump';
697
- }
698
- SemVer.bumpType = bumpType;
699
- })(SemVer || (SemVer = {}));
700
-
701
- ;// CONCATENATED MODULE: ./dist/bin/tools/fs.rmSync.ts
702
-
703
-
704
-
705
- /**
706
- * Polyfill of fs.rmSync(dirPath, { "recursive": true })
707
- * For older version of Node
708
- */
709
- function rmSync(dirPath, options) {
710
- if (SemVer.compare(SemVer.parse(process.version), SemVer.parse('14.14.0')) > 0) {
711
- external_fs_.rmSync(dirPath, options);
712
- return;
713
- }
714
- const { force = true } = options;
715
- if (force && !external_fs_.existsSync(dirPath)) {
716
- return;
717
- }
718
- const removeDir_rec = (dirPath) => external_fs_.readdirSync(dirPath).forEach(basename => {
719
- const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
720
- if (external_fs_.lstatSync(fileOrDirPath).isDirectory()) {
721
- removeDir_rec(fileOrDirPath);
722
- return;
723
- }
724
- else {
725
- external_fs_.unlinkSync(fileOrDirPath);
726
- }
727
- });
728
- removeDir_rec(dirPath);
729
- }
730
-
731
- ;// CONCATENATED MODULE: ./dist/bin/tools/transformCodebase_async.ts
732
-
733
-
734
-
735
-
736
- /**
737
- * Apply a transformation function to every file of directory
738
- * If source and destination are the same this function can be used to apply the transformation in place
739
- * like filtering out some files or modifying them.
740
- * */
741
- async function transformCodebase(params) {
742
- const { srcDirPath, transformSourceCode } = params;
743
- const isTargetSameAsSource = external_path_.relative(srcDirPath, params.destDirPath) === '';
744
- const destDirPath = isTargetSameAsSource
745
- ? external_path_.join(srcDirPath, '..', 'tmp_xOsPdkPsTdzPs34sOkHs')
746
- : params.destDirPath;
747
- external_fs_.mkdirSync(destDirPath, {
748
- recursive: true
749
- });
750
- for (const fileRelativePath of crawl({
751
- dirPath: srcDirPath,
752
- returnedPathsType: 'relative to dirPath'
753
- })) {
754
- const filePath = external_path_.join(srcDirPath, fileRelativePath);
755
- const destFilePath = external_path_.join(destDirPath, fileRelativePath);
756
- // NOTE: Optimization, if we don't need to transform the file, just copy
757
- // it using the lower level implementation.
758
- if (transformSourceCode === undefined) {
759
- external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
760
- recursive: true
761
- });
762
- external_fs_.copyFileSync(filePath, destFilePath);
763
- continue;
764
- }
765
- const transformSourceCodeResult = await transformSourceCode({
766
- sourceCode: external_fs_.readFileSync(filePath),
767
- filePath,
768
- fileRelativePath
769
- });
770
- if (transformSourceCodeResult === undefined) {
771
- continue;
772
- }
773
- external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
774
- recursive: true
775
- });
776
- const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
777
- external_fs_.writeFileSync(external_path_.join(external_path_.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : external_path_.basename(destFilePath)), modifiedSourceCode);
778
- }
779
- if (isTargetSameAsSource) {
780
- rmSync(srcDirPath, { recursive: true });
781
- external_fs_.renameSync(destDirPath, srcDirPath);
782
- }
783
- }
784
-
785
- ;// CONCATENATED MODULE: ./node_modules/tsafe/esm/capitalize.mjs
786
- /** @see <https://docs.tsafe.dev/capitalize> */
787
- function capitalize(str) {
788
- return (str.charAt(0).toUpperCase() + str.slice(1));
789
- }
790
- //# sourceMappingURL=capitalize.mjs.map
791
- ;// CONCATENATED MODULE: ./dist/bin/tools/kebabCaseToSnakeCase.ts
792
-
793
- function kebabCaseToCamelCase(kebabCaseString) {
794
- const [first, ...rest] = kebabCaseString.split('-');
795
- return [first, ...rest.map(capitalize)].join('');
796
- }
797
-
798
- ;// CONCATENATED MODULE: ./dist/bin/tools/String.prototype.replaceAll.ts
799
- function replaceAll(string, searchValue, replaceValue) {
800
- if (string.replaceAll !== undefined) {
801
- return string.replaceAll(searchValue, replaceValue);
802
- }
803
- // If the searchValue is a string
804
- if (typeof searchValue === 'string') {
805
- // Escape special characters in the string to be used in a regex
806
- var escapedSearchValue = searchValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
807
- var regex = new RegExp(escapedSearchValue, 'g');
808
- return string.replace(regex, replaceValue);
809
- }
810
- // If the searchValue is a global RegExp, use it directly
811
- if (searchValue instanceof RegExp && searchValue.global) {
812
- return string.replace(searchValue, replaceValue);
813
- }
814
- // If the searchValue is a non-global RegExp, throw an error
815
- if (searchValue instanceof RegExp) {
816
- throw new TypeError('replaceAll must be called with a global RegExp');
817
- }
818
- // Convert searchValue to string if it's not a string or RegExp
819
- var searchString = String(searchValue);
820
- var regexFromString = new RegExp(searchString.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
821
- return string.replace(regexFromString, replaceValue);
822
- }
823
-
824
- // EXTERNAL MODULE: ./dist/bin/tools/runPrettier.ts
825
- var runPrettier = __webpack_require__(915);
826
- ;// CONCATENATED MODULE: ./dist/bin/eject-page.ts
827
-
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
- async function command(params) {
840
- const { buildContext } = params;
841
- console.log(source/* default */.Ay.cyan('Theme type:'));
842
- const themeType = await (async () => {
843
- const values = constants/* THEME_TYPES */.qA.filter(themeType => {
844
- switch (themeType) {
845
- case 'account':
846
- return buildContext.implementedThemeTypes.account.isImplemented;
847
- case 'login':
848
- return buildContext.implementedThemeTypes.login.isImplemented;
849
- case 'admin':
850
- return false;
851
- }
852
- (0,assert/* assert */.v)(false);
853
- });
854
- (0,assert/* assert */.v)(values.length > 0, 'No theme is implemented in this project');
855
- if (values.length === 1) {
856
- return values[0];
857
- }
858
- const { value } = await dist_default()({
859
- values
860
- }).catch(() => {
861
- process.exit(-1);
862
- });
863
- return value;
864
- })();
865
- console.log(`→ ${themeType}`);
866
- console.log(source/* default */.Ay.cyan('Select the page you want to customize:'));
867
- const templateValue = 'template.ftl (Layout common to every page)';
868
- const userProfileFormFieldsValue = 'user-profile-commons.ftl (Renders the form of the register.ftl, login-update-profile.ftl, update-email.ftl and idp-review-user-profile.ftl)';
869
- const otherPageValue = "The page you're looking for isn't listed here";
870
- const { value: pageIdOrComponent } = await dist_default()({
871
- values: (() => {
872
- switch (themeType) {
873
- case 'login':
874
- return [
875
- templateValue,
876
- userProfileFormFieldsValue,
877
- ...constants/* LOGIN_THEME_PAGE_IDS */.hz,
878
- otherPageValue
879
- ];
880
- case 'account':
881
- return [templateValue, ...constants/* ACCOUNT_THEME_PAGE_IDS */.Hp, otherPageValue];
882
- case 'admin':
883
- return [];
884
- }
885
- (0,assert/* assert */.v)(false);
886
- })()
887
- }).catch(() => {
888
- process.exit(-1);
889
- });
890
- if (pageIdOrComponent === otherPageValue) {
891
- console.log([
892
- 'To style a page not included in the base Keycloak, such as one added by a third-party Keycloak extension,',
893
- 'refer to the documentation: https://docs.keycloakify.dev/features/styling-a-custom-page-not-included-in-base-keycloak'
894
- ].join(' '));
895
- process.exit(0);
896
- }
897
- console.log(`→ ${pageIdOrComponent}`);
898
- const componentRelativeDirPath_posix_to_componentRelativeFilePath_posix = (params) => {
899
- const { componentRelativeDirPath_posix } = params;
900
- return `${componentRelativeDirPath_posix}/${external_path_.posix.basename(componentRelativeDirPath_posix)}.component`;
901
- };
902
- const componentDirRelativeToThemeTypePath = (() => {
903
- if (pageIdOrComponent === templateValue) {
904
- return (0,external_path_.join)('template');
905
- }
906
- if (pageIdOrComponent === userProfileFormFieldsValue) {
907
- return (0,external_path_.join)('components', 'user-profile-form-fields');
908
- }
909
- return (0,external_path_.join)('pages', pageIdOrComponent.replace(/\.ftl$/, ''));
910
- })();
911
- let hasEjectedUserProfileFormFieldsComponent = false;
912
- {
913
- const componentDirRelativeToThemeTypePaths = [
914
- componentDirRelativeToThemeTypePath
915
- ];
916
- while (componentDirRelativeToThemeTypePaths.length !== 0) {
917
- const componentDirRelativeToThemeTypePath_i = componentDirRelativeToThemeTypePaths.pop();
918
- (0,assert/* assert */.v)(componentDirRelativeToThemeTypePath_i !== undefined);
919
- if (componentDirRelativeToThemeTypePath_i ===
920
- (0,external_path_.join)('components', 'user-profile-form-fields')) {
921
- hasEjectedUserProfileFormFieldsComponent = true;
922
- }
923
- const destDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType, componentDirRelativeToThemeTypePath_i);
924
- const dirName = (0,external_path_.basename)(destDirPath);
925
- const tsFilePath = (0,external_path_.join)(destDirPath, `${dirName}.component.ts`);
926
- if (external_fs_.existsSync(destDirPath) && external_fs_.readdirSync(destDirPath).length !== 0) {
927
- // Check if the directory contains a .ts file with the same name as the directory
928
- if (external_fs_.existsSync(tsFilePath)) {
929
- if (componentDirRelativeToThemeTypePath_i ===
930
- componentDirRelativeToThemeTypePath) {
931
- console.log(`${pageIdOrComponent.split('.ftl')[0]} is already ejected, ${(0,external_path_.relative)(process.cwd(), destDirPath)} already exists and contains ${dirName}.ts`);
932
- process.exit(-1);
933
- }
934
- continue;
935
- }
936
- }
937
- const localThemeTypeDirPath = (0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.J)(), 'src', themeType);
938
- await transformCodebase({
939
- srcDirPath: (0,external_path_.join)(localThemeTypeDirPath, componentDirRelativeToThemeTypePath_i),
940
- destDirPath,
941
- transformSourceCode: async ({ filePath, fileRelativePath, sourceCode }) => {
942
- if (!filePath.endsWith('.ts')) {
943
- let modifiedSourceCode_str = sourceCode.toString('utf8');
944
- run_prettier: {
945
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.L)())) {
946
- break run_prettier;
947
- }
948
- modifiedSourceCode_str = await (0,runPrettier/* runPrettier */.JS)({
949
- filePath: (0,external_path_.join)(destDirPath, fileRelativePath),
950
- sourceCode: modifiedSourceCode_str
951
- });
952
- }
953
- return {
954
- modifiedSourceCode: Buffer.from(modifiedSourceCode_str, 'utf8')
955
- };
956
- }
957
- if (filePath.endsWith('index.ts')) {
958
- return undefined;
959
- }
960
- const fileRelativeToThemeTypePath = (0,external_path_.relative)(localThemeTypeDirPath, filePath);
961
- let modifiedSourceCode_str = sourceCode.toString();
962
- const getPosixPathRelativeToFile = (params) => {
963
- const { pathRelativeToThemeType } = params;
964
- const path = (0,external_path_.relative)((0,external_path_.dirname)(fileRelativeToThemeTypePath), pathRelativeToThemeType)
965
- .split(external_path_.sep)
966
- .join('/');
967
- return path.startsWith('.') ? path : `./${path}`;
968
- };
969
- modifiedSourceCode_str = replaceAll(modifiedSourceCode_str, `@keycloakify/angular/${themeType}/i18n`, getPosixPathRelativeToFile({
970
- pathRelativeToThemeType: 'i18n'
971
- }));
972
- modifiedSourceCode_str = replaceAll(modifiedSourceCode_str, `@keycloakify/angular/${themeType}/KcContext`, getPosixPathRelativeToFile({
973
- pathRelativeToThemeType: 'KcContext'
974
- }));
975
- modifiedSourceCode_str = modifiedSourceCode_str.replace(new RegExp(`@keycloakify/angular/${themeType}/components/([^'"]+)`, 'g'), (...[, componentDirRelativeToComponentsPath]) => {
976
- const componentDirRelativeToThemeTypePath = (0,external_path_.join)('components', componentDirRelativeToComponentsPath);
977
- componentDirRelativeToThemeTypePaths.push(componentDirRelativeToThemeTypePath);
978
- return componentRelativeDirPath_posix_to_componentRelativeFilePath_posix({
979
- componentRelativeDirPath_posix: getPosixPathRelativeToFile({
980
- pathRelativeToThemeType: componentDirRelativeToThemeTypePath
981
- })
982
- });
983
- });
984
- run_prettier: {
985
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.L)())) {
986
- break run_prettier;
987
- }
988
- modifiedSourceCode_str = await (0,runPrettier/* runPrettier */.JS)({
989
- filePath: (0,external_path_.join)(destDirPath, fileRelativePath),
990
- sourceCode: modifiedSourceCode_str
991
- });
992
- }
993
- return {
994
- modifiedSourceCode: Buffer.from(modifiedSourceCode_str, 'utf8')
995
- };
996
- }
997
- });
998
- console.log(`${source/* default */.Ay.green('✓')} ${source/* default */.Ay.bold(`.${external_path_.sep}` + (0,external_path_.relative)(process.cwd(), destDirPath))} moved from the @keycloakify/angular to your project`);
999
- }
1000
- }
1001
- edit_KcFiles: {
1002
- const componentRelativeDirPath_posix = (() => {
1003
- if (pageIdOrComponent === templateValue) {
1004
- return 'template';
1005
- }
1006
- if (pageIdOrComponent === userProfileFormFieldsValue ||
1007
- hasEjectedUserProfileFormFieldsComponent) {
1008
- return 'components/user-profile-form-fields';
1009
- }
1010
- return undefined;
1011
- })();
1012
- if (componentRelativeDirPath_posix === undefined) {
1013
- break edit_KcFiles;
1014
- }
1015
- const filesToProcess = ['KcPage.ts', 'KcPageStory.ts'];
1016
- for (const fileName of filesToProcess) {
1017
- const filePath = (0,external_path_.join)(buildContext.themeSrcDirPath, themeType, fileName);
1018
- if (!external_fs_.existsSync(filePath)) {
1019
- console.log(source/* default */.Ay.yellow(`${fileName} not found, skipping`));
1020
- continue;
1021
- }
1022
- const originalCode = external_fs_.readFileSync(filePath).toString('utf8');
1023
- const modifiedCode = await (async () => {
1024
- let sourceCode = originalCode.replace(`@keycloakify/angular/${themeType}/${componentRelativeDirPath_posix}`, componentRelativeDirPath_posix_to_componentRelativeFilePath_posix({
1025
- componentRelativeDirPath_posix: `./${componentRelativeDirPath_posix}`
1026
- }));
1027
- run_prettier: {
1028
- if (!(await (0,runPrettier/* getIsPrettierAvailable */.L)())) {
1029
- break run_prettier;
1030
- }
1031
- sourceCode = await (0,runPrettier/* runPrettier */.JS)({
1032
- filePath,
1033
- sourceCode
1034
- });
1035
- }
1036
- return sourceCode;
1037
- })();
1038
- if (modifiedCode === originalCode) {
1039
- console.log(source/* default */.Ay.yellow(`No changes for file ${fileName}, ignoring.`));
1040
- continue;
1041
- }
1042
- try {
1043
- external_fs_.writeFileSync(filePath, Buffer.from(modifiedCode, 'utf8'));
1044
- console.log(`${source/* default */.Ay.green('✓')} ${source/* default */.Ay.bold(`.${external_path_.sep}${(0,external_path_.relative)(process.cwd(), filePath)}`)} Updated`);
1045
- }
1046
- catch (error) {
1047
- const errorMessage = error instanceof Error ? error.message : String(error);
1048
- console.log(source/* default */.Ay.red(`Unable to automatically update ${fileName}, please update it manually (${errorMessage})`));
1049
- }
1050
- }
1051
- return;
1052
- }
1053
- const pageId = pageIdOrComponent;
1054
- console.log([
1055
- ``,
1056
- `You now need to update your page router:`,
1057
- ``,
1058
- `${source/* default */.Ay.bold((0,external_path_.join)('.', (0,external_path_.relative)(process.cwd(), buildContext.themeSrcDirPath), themeType, 'KcPage.ts'))}:`,
1059
- source/* default */.Ay.grey('```'),
1060
- `// ...`,
1061
- ``,
1062
- ...(() => {
1063
- let inGreenBlock = false;
1064
- return [
1065
- ` export async function getKcPage(pageId: KcContext['pageId']): Promise<KcPage> {`,
1066
- ` switch (pageId) {`,
1067
- `+`,
1068
- ` case '${pageId}':`,
1069
- ` return {`,
1070
- ` PageComponent: (await import('${componentRelativeDirPath_posix_to_componentRelativeFilePath_posix({
1071
- componentRelativeDirPath_posix: `./${componentDirRelativeToThemeTypePath.split(external_path_.sep).join('/')}`
1072
- })}')).${kebabCaseToCamelCase(capitalize(pageId).replace(/\.ftl$/, ''))}Component,`,
1073
- ` TemplateComponent,`,
1074
- ...(themeType === 'login'
1075
- ? [` UserProfileFormFieldsComponent,`]
1076
- : []),
1077
- ...(themeType === 'login'
1078
- ? [` doMakeUserConfirmPassword,`]
1079
- : []),
1080
- ` doUseDefaultCss,`,
1081
- ` classes,`,
1082
- ` };`,
1083
- `+`,
1084
- ` //...`,
1085
- ` default:`,
1086
- ` return {`,
1087
- ` PageComponent: await getDefaultPageComponent(pageId),`,
1088
- ` TemplateComponent,`,
1089
- ...(themeType === 'login'
1090
- ? [` UserProfileFormFieldsComponent,`]
1091
- : []),
1092
- ...(themeType === 'login'
1093
- ? [` doMakeUserConfirmPassword,`]
1094
- : []),
1095
- ` doUseDefaultCss,`,
1096
- ` classes,`,
1097
- ` };`,
1098
- ` }`,
1099
- ` }`
1100
- ].map(line => {
1101
- if (line === `+`) {
1102
- inGreenBlock = !inGreenBlock;
1103
- }
1104
- if (inGreenBlock || line.startsWith('+')) {
1105
- return source/* default */.Ay.green(line);
1106
- }
1107
- if (line.startsWith('-')) {
1108
- return source/* default */.Ay.red(line);
1109
- }
1110
- return source/* default */.Ay.grey(line);
1111
- });
1112
- })(),
1113
- source/* default */.Ay.grey('```')
1114
- ].join('\n'));
1115
- }
1116
-
1117
-
1118
- /***/ }),
1119
-
1120
- /***/ 221:
1121
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1122
-
1123
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1124
- /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath),
1125
- /* harmony export */ x: () => (/* binding */ getNearestPackageJsonDirPath)
1126
- /* harmony export */ });
1127
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
1128
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
1129
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
1130
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
1131
- /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
1132
- /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_2__);
1133
-
1134
-
1135
-
1136
- const __dirname = path__WEBPACK_IMPORTED_MODULE_1__.dirname(url__WEBPACK_IMPORTED_MODULE_2__.fileURLToPath(import.meta.url));
1137
- function getThisCodebaseRootDirPath_rec(dirPath) {
1138
- if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'LICENSE'))) {
1139
- return dirPath;
1140
- }
1141
- return getThisCodebaseRootDirPath_rec(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
1142
- }
1143
- let result = undefined;
1144
- function getThisCodebaseRootDirPath() {
1145
- if (result !== undefined) {
1146
- return result;
1147
- }
1148
- return (result = getThisCodebaseRootDirPath_rec(__dirname));
1149
- }
1150
- function getNearestPackageJsonDirPath(dirPath) {
1151
- if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
1152
- return dirPath;
1153
- }
1154
- return getNearestPackageJsonDirPath(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
1155
- }
1156
-
1157
-
1158
- /***/ }),
1159
-
1160
- /***/ 395:
1161
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1162
-
1163
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1164
- /* harmony export */ p: () => (/* binding */ getNodeModulesBinDirPath)
1165
- /* harmony export */ });
1166
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
1167
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1168
- /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(221);
1169
-
1170
-
1171
- let cache = undefined;
1172
- /** NOTE: Careful, this function can fail when the binary
1173
- * Used is not in the node_modules directory of the project
1174
- * (for example when running tests with vscode extension we'll get
1175
- * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
1176
- *
1177
- * instead of
1178
- * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
1179
- * or
1180
- * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
1181
- *
1182
- * as the value of process.argv[1]
1183
- */
1184
- function getNodeModulesBinDirPath() {
1185
- if (cache !== undefined) {
1186
- return cache;
1187
- }
1188
- const binPath = process.argv[1];
1189
- special_case_running_not_from_distribution: {
1190
- if (!binPath.endsWith('.ts')) {
1191
- break special_case_running_not_from_distribution;
1192
- }
1193
- const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .x)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
1194
- const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, 'node_modules', '.bin');
1195
- return nodeModulesBinDirPath;
1196
- }
1197
- const segments = ['.bin'];
1198
- let foundNodeModules = false;
1199
- for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
1200
- skip_segment: {
1201
- if (foundNodeModules) {
1202
- break skip_segment;
1203
- }
1204
- if (segment === 'node_modules') {
1205
- foundNodeModules = true;
1206
- break skip_segment;
1207
- }
1208
- continue;
1209
- }
1210
- segments.unshift(segment);
1211
- }
1212
- if (!foundNodeModules) {
1213
- throw new Error(`Could not find node_modules in path ${binPath}`);
1214
- }
1215
- const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
1216
- cache = nodeModulesBinDirPath;
1217
- return nodeModulesBinDirPath;
1218
- }
1219
-
1220
-
1221
- /***/ }),
1222
-
1223
- /***/ 915:
1224
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
1225
-
1226
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1227
- /* harmony export */ JS: () => (/* binding */ runPrettier),
1228
- /* harmony export */ L: () => (/* binding */ getIsPrettierAvailable)
1229
- /* harmony export */ });
1230
- /* unused harmony export getPrettier */
1231
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(276);
1232
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(982);
1233
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_0__);
1234
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(943);
1235
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
1236
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(928);
1237
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
1238
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(559);
1239
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(94);
1240
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(886);
1241
- /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(395);
1242
- /* module decorator */ module = __webpack_require__.hmd(module);
1243
- /* eslint-disable @typescript-eslint/consistent-type-imports */
1244
-
1245
-
1246
-
1247
-
1248
-
1249
-
1250
-
1251
-
1252
- getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_3__.id)(undefined);
1253
- async function getIsPrettierAvailable() {
1254
- var _a;
1255
- if (getIsPrettierAvailable.cache !== undefined) {
1256
- return getIsPrettierAvailable.cache;
1257
- }
1258
- const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)();
1259
- const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(nodeModulesBinDirPath, 'prettier');
1260
- const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.stat(prettierBinPath).catch(() => undefined);
1261
- const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
1262
- getIsPrettierAvailable.cache = isPrettierAvailable;
1263
- return isPrettierAvailable;
1264
- }
1265
- getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_3__.id)(undefined);
1266
- async function getPrettier() {
1267
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .v)(getIsPrettierAvailable());
1268
- if (getPrettier.cache !== undefined) {
1269
- return getPrettier.cache;
1270
- }
1271
- let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_3__.id)(undefined);
1272
- import_prettier: {
1273
- const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_2__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
1274
- const isCJS = true && module.exports;
1275
- if (isCJS) {
1276
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_6__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
1277
- }
1278
- else {
1279
- prettier = await new Promise(_resolve => {
1280
- eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_2__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
1281
- });
1282
- }
1283
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(prettier));
1284
- break import_prettier;
1285
- }
1286
- const configHash = await (async () => {
1287
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getNodeModulesBinDirPath */ .p)(), '..', '..'));
1288
- if (configFilePath === null) {
1289
- return '';
1290
- }
1291
- const data = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile(configFilePath);
1292
- return crypto__WEBPACK_IMPORTED_MODULE_0__.createHash('sha256').update(data).digest('hex');
1293
- })();
1294
- const prettierAndConfig = {
1295
- prettier,
1296
- configHash
1297
- };
1298
- getPrettier.cache = prettierAndConfig;
1299
- return prettierAndConfig;
1300
- }
1301
- async function runPrettier(params) {
1302
- const { sourceCode, filePath } = params;
1303
- let formattedSourceCode;
1304
- try {
1305
- const { prettier } = await getPrettier();
1306
- const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
1307
- resolveConfig: true
1308
- });
1309
- if (ignored || inferredParser === null) {
1310
- return sourceCode;
1311
- }
1312
- const config = await prettier.resolveConfig(filePath);
1313
- formattedSourceCode = await prettier.format(typeof sourceCode === 'string' ? sourceCode : sourceCode.toString('utf8'), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
1314
- }
1315
- catch (error) {
1316
- console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.red(`You probably need to upgrade the version of prettier in your project`));
1317
- throw error;
1318
- }
1319
- return typeof sourceCode === 'string'
1320
- ? formattedSourceCode
1321
- : Buffer.from(formattedSourceCode, 'utf8');
1322
- }
1323
-
1324
-
1325
- /***/ }),
1326
-
1327
- /***/ 94:
1328
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1329
-
1330
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1331
- /* harmony export */ id: () => (/* binding */ id)
1332
- /* harmony export */ });
1333
- /** https://docs.tsafe.dev/id */
1334
- const id = (x) => x;
1335
- //# sourceMappingURL=id.mjs.map
1336
-
1337
- /***/ }),
1338
-
1339
- /***/ 886:
1340
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1341
-
1342
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1343
- /* harmony export */ I: () => (/* binding */ symToStr)
1344
- /* harmony export */ });
1345
- /** @see <https://docs.tsafe.dev/main/symtostr> */
1346
- function symToStr(wrap) {
1347
- // @ts-expect-error: We know better
1348
- return Object.keys(wrap)[0];
1349
- }
1350
- //# sourceMappingURL=symToStr.mjs.map
1351
-
1352
- /***/ })
1353
-
1354
- };