@keycloakify/angular 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/338.index.js CHANGED
@@ -173,6 +173,72 @@ function getThisCodebaseRootDirPath() {
173
173
  }
174
174
 
175
175
 
176
+ /***/ }),
177
+
178
+ /***/ 49:
179
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
180
+
181
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
182
+ /* harmony export */ J: () => (/* binding */ runFormat)
183
+ /* harmony export */ });
184
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
185
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
186
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
187
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
188
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
189
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(797);
190
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94);
191
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(383);
192
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
193
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(317);
194
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_4__);
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ function runFormat(params) {
204
+ const { packageJsonFilePath } = params;
205
+ const parsedPackageJson = (() => {
206
+ const zParsedPackageJson = (() => {
207
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
208
+ scripts: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
209
+ });
210
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)();
211
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
212
+ })();
213
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString('utf8'));
214
+ zParsedPackageJson.parse(parsedPackageJson);
215
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_3__.is)(parsedPackageJson));
216
+ return parsedPackageJson;
217
+ })();
218
+ const { scripts } = parsedPackageJson;
219
+ if (scripts === undefined) {
220
+ return;
221
+ }
222
+ for (const scriptName of ['format', 'lint']) {
223
+ if (!(scriptName in scripts)) {
224
+ continue;
225
+ }
226
+ const command = `npm run ${scriptName}`;
227
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.grey(`$ ${command}`));
228
+ try {
229
+ child_process__WEBPACK_IMPORTED_MODULE_4__.execSync(`npm run ${scriptName}`, {
230
+ stdio: 'inherit',
231
+ cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
232
+ });
233
+ }
234
+ catch (_a) {
235
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
236
+ }
237
+ return;
238
+ }
239
+ }
240
+
241
+
176
242
  /***/ }),
177
243
 
178
244
  /***/ 758:
@@ -185,23 +251,24 @@ function getThisCodebaseRootDirPath() {
185
251
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
186
252
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
187
253
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
254
+ /* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49);
255
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
256
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
257
+
258
+
188
259
 
189
260
 
190
261
  function command(params) {
191
262
  const { buildContext } = params;
192
263
  const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, 'kc.gen.ts');
193
- const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)
194
- ? fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath)
195
- : undefined;
196
264
  const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
197
- const newContent = Buffer.from([
198
- `/* prettier-ignore-start */`,
265
+ const newContent = [
199
266
  ``,
200
267
  `/* eslint-disable */`,
201
268
  ``,
202
- `// noinspection JSUnusedGlobalSymbols`,
269
+ `// @ts-nocheck`,
203
270
  ``,
204
- `// This file is auto-generated by Keycloakify`,
271
+ `// noinspection JSUnusedGlobalSymbols`,
205
272
  ``,
206
273
  `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
207
274
  ``,
@@ -299,14 +366,26 @@ function command(params) {
299
366
  .flat(),
300
367
  ` }`,
301
368
  `}`,
302
- ``,
303
- `/* prettier-ignore-end */`,
304
369
  ``
305
- ].join('\n'), 'utf8');
306
- if (currentContent !== undefined && currentContent.equals(newContent)) {
370
+ ].join('\n');
371
+ const hash = crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(newContent).digest('hex');
372
+ skip_if_no_changes: {
373
+ if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)) {
374
+ break skip_if_no_changes;
375
+ }
376
+ const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath).toString('utf8');
377
+ if (!currentContent.includes(hash)) {
378
+ break skip_if_no_changes;
379
+ }
307
380
  return;
308
381
  }
309
- fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, newContent);
382
+ fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, Buffer.from([
383
+ `// This file is auto-generated by keycloakify. Do not edit it manually.`,
384
+ `// Hash: ${hash}`,
385
+ ``,
386
+ newContent
387
+ ].join('\n'), 'utf8'));
388
+ (0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_3__/* .runFormat */ .J)({ packageJsonFilePath: buildContext.packageJsonFilePath });
310
389
  }
311
390
 
312
391
 
package/bin/758.index.js CHANGED
@@ -3,6 +3,72 @@ exports.id = 758;
3
3
  exports.ids = [758];
4
4
  exports.modules = {
5
5
 
6
+ /***/ 49:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
+ /* harmony export */ J: () => (/* binding */ runFormat)
11
+ /* harmony export */ });
12
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
13
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
14
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
15
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
16
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
17
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(797);
18
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94);
19
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(383);
20
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
21
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(317);
22
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_4__);
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ function runFormat(params) {
32
+ const { packageJsonFilePath } = params;
33
+ const parsedPackageJson = (() => {
34
+ const zParsedPackageJson = (() => {
35
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
36
+ scripts: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
37
+ });
38
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)();
39
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
40
+ })();
41
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString('utf8'));
42
+ zParsedPackageJson.parse(parsedPackageJson);
43
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_3__.is)(parsedPackageJson));
44
+ return parsedPackageJson;
45
+ })();
46
+ const { scripts } = parsedPackageJson;
47
+ if (scripts === undefined) {
48
+ return;
49
+ }
50
+ for (const scriptName of ['format', 'lint']) {
51
+ if (!(scriptName in scripts)) {
52
+ continue;
53
+ }
54
+ const command = `npm run ${scriptName}`;
55
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.grey(`$ ${command}`));
56
+ try {
57
+ child_process__WEBPACK_IMPORTED_MODULE_4__.execSync(`npm run ${scriptName}`, {
58
+ stdio: 'inherit',
59
+ cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
60
+ });
61
+ }
62
+ catch (_a) {
63
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
64
+ }
65
+ return;
66
+ }
67
+ }
68
+
69
+
70
+ /***/ }),
71
+
6
72
  /***/ 758:
7
73
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
74
 
@@ -13,23 +79,24 @@ exports.modules = {
13
79
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
14
80
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
15
81
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
82
+ /* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49);
83
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
84
+ /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
85
+
86
+
16
87
 
17
88
 
18
89
  function command(params) {
19
90
  const { buildContext } = params;
20
91
  const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, 'kc.gen.ts');
21
- const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)
22
- ? fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath)
23
- : undefined;
24
92
  const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
25
- const newContent = Buffer.from([
26
- `/* prettier-ignore-start */`,
93
+ const newContent = [
27
94
  ``,
28
95
  `/* eslint-disable */`,
29
96
  ``,
30
- `// noinspection JSUnusedGlobalSymbols`,
97
+ `// @ts-nocheck`,
31
98
  ``,
32
- `// This file is auto-generated by Keycloakify`,
99
+ `// noinspection JSUnusedGlobalSymbols`,
33
100
  ``,
34
101
  `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
35
102
  ``,
@@ -127,14 +194,26 @@ function command(params) {
127
194
  .flat(),
128
195
  ` }`,
129
196
  `}`,
130
- ``,
131
- `/* prettier-ignore-end */`,
132
197
  ``
133
- ].join('\n'), 'utf8');
134
- if (currentContent !== undefined && currentContent.equals(newContent)) {
198
+ ].join('\n');
199
+ const hash = crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(newContent).digest('hex');
200
+ skip_if_no_changes: {
201
+ if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)) {
202
+ break skip_if_no_changes;
203
+ }
204
+ const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath).toString('utf8');
205
+ if (!currentContent.includes(hash)) {
206
+ break skip_if_no_changes;
207
+ }
135
208
  return;
136
209
  }
137
- fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, newContent);
210
+ fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, Buffer.from([
211
+ `// This file is auto-generated by keycloakify. Do not edit it manually.`,
212
+ `// Hash: ${hash}`,
213
+ ``,
214
+ newContent
215
+ ].join('\n'), 'utf8'));
216
+ (0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_3__/* .runFormat */ .J)({ packageJsonFilePath: buildContext.packageJsonFilePath });
138
217
  }
139
218
 
140
219
 
package/bin/925.index.js CHANGED
@@ -257,14 +257,8 @@ function replaceAll(string, searchValue, replaceValue) {
257
257
  return string.replace(regexFromString, replaceValue);
258
258
  }
259
259
 
260
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
261
- var id = __webpack_require__(94);
262
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
263
- var lib = __webpack_require__(383);
264
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
265
- var is = __webpack_require__(289);
266
- // EXTERNAL MODULE: external "child_process"
267
- var external_child_process_ = __webpack_require__(317);
260
+ // EXTERNAL MODULE: ./dist/bin/tools/runFormat.js
261
+ var runFormat = __webpack_require__(49);
268
262
  ;// CONCATENATED MODULE: ./dist/bin/eject-page.js
269
263
 
270
264
 
@@ -278,9 +272,6 @@ var external_child_process_ = __webpack_require__(317);
278
272
 
279
273
 
280
274
 
281
-
282
-
283
-
284
275
  async function command(params) {
285
276
  const { buildContext } = params;
286
277
  console.log(source/* default */.Ay.cyan('Theme type:'));
@@ -399,42 +390,9 @@ async function command(params) {
399
390
  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`);
400
391
  }
401
392
  }
402
- run_format: {
403
- const parsedPackageJson = (() => {
404
- const zParsedPackageJson = (() => {
405
- const zTargetType = lib.z.object({
406
- scripts: lib.z.record(lib.z.string()).optional()
407
- });
408
- (0,assert/* assert */.v)();
409
- return (0,id.id)(zTargetType);
410
- })();
411
- const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString('utf8'));
412
- zParsedPackageJson.parse(parsedPackageJson);
413
- (0,assert/* assert */.v)((0,is.is)(parsedPackageJson));
414
- return parsedPackageJson;
415
- })();
416
- const { scripts } = parsedPackageJson;
417
- if (scripts === undefined) {
418
- break run_format;
419
- }
420
- for (const scriptName of ['format', 'lint']) {
421
- if (!(scriptName in scripts)) {
422
- continue;
423
- }
424
- const command = `npm run ${scriptName}`;
425
- console.log(source/* default */.Ay.grey(`$ ${command}`));
426
- try {
427
- external_child_process_.execSync(`npm run ${scriptName}`, {
428
- stdio: 'inherit',
429
- cwd: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
430
- });
431
- }
432
- catch (_a) {
433
- console.log(source/* default */.Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
434
- }
435
- break run_format;
436
- }
437
- }
393
+ (0,runFormat/* runFormat */.J)({
394
+ packageJsonFilePath: buildContext.packageJsonFilePath
395
+ });
438
396
  edit_KcPage: {
439
397
  if (pageIdOrComponent !== templateValue &&
440
398
  pageIdOrComponent !== userProfileFormFieldsValue) {
@@ -540,6 +498,72 @@ function getThisCodebaseRootDirPath() {
540
498
  }
541
499
 
542
500
 
501
+ /***/ }),
502
+
503
+ /***/ 49:
504
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
505
+
506
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
507
+ /* harmony export */ J: () => (/* binding */ runFormat)
508
+ /* harmony export */ });
509
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
510
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
511
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
512
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
513
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
514
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(797);
515
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94);
516
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(383);
517
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
518
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(317);
519
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_4__);
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+ function runFormat(params) {
529
+ const { packageJsonFilePath } = params;
530
+ const parsedPackageJson = (() => {
531
+ const zParsedPackageJson = (() => {
532
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
533
+ scripts: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
534
+ });
535
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)();
536
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
537
+ })();
538
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString('utf8'));
539
+ zParsedPackageJson.parse(parsedPackageJson);
540
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_3__.is)(parsedPackageJson));
541
+ return parsedPackageJson;
542
+ })();
543
+ const { scripts } = parsedPackageJson;
544
+ if (scripts === undefined) {
545
+ return;
546
+ }
547
+ for (const scriptName of ['format', 'lint']) {
548
+ if (!(scriptName in scripts)) {
549
+ continue;
550
+ }
551
+ const command = `npm run ${scriptName}`;
552
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.grey(`$ ${command}`));
553
+ try {
554
+ child_process__WEBPACK_IMPORTED_MODULE_4__.execSync(`npm run ${scriptName}`, {
555
+ stdio: 'inherit',
556
+ cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
557
+ });
558
+ }
559
+ catch (_a) {
560
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
561
+ }
562
+ return;
563
+ }
564
+ }
565
+
566
+
543
567
  /***/ }),
544
568
 
545
569
  /***/ 672:
package/bin/main.js CHANGED
@@ -88,6 +88,13 @@ module.exports = require("child_process");
88
88
 
89
89
  /***/ }),
90
90
 
91
+ /***/ 982:
92
+ /***/ ((module) => {
93
+
94
+ module.exports = require("crypto");
95
+
96
+ /***/ }),
97
+
91
98
  /***/ 896:
92
99
  /***/ ((module) => {
93
100
 
@@ -442,7 +449,7 @@ const { buildContext, commandName } = readParams({ apiVersion: 'v1' });
442
449
  return;
443
450
  case 'update-kc-gen':
444
451
  {
445
- const { command } = await __nccwpck_require__.e(/* import() */ 758).then(__nccwpck_require__.bind(__nccwpck_require__, 758));
452
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(603), __nccwpck_require__.e(758)]).then(__nccwpck_require__.bind(__nccwpck_require__, 758));
446
453
  command({ buildContext });
447
454
  }
448
455
  return;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@keycloakify/angular",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "peerDependencies": {
5
- "keycloakify": "^11.3.9",
5
+ "keycloakify": "^11.3.11",
6
6
  "@angular/core": "^18.0.0",
7
7
  "@angular/common": "^18.0.0",
8
8
  "@angular/platform-browser": "^18.0.0"
@@ -231,6 +231,12 @@
231
231
  "esm": "./esm2022/login/classes/component-reference/keycloakify-angular-login-classes-component-reference.mjs",
232
232
  "default": "./fesm2022/keycloakify-angular-login-classes-component-reference.mjs"
233
233
  },
234
+ "./login/containers/template": {
235
+ "types": "./login/containers/template/index.d.ts",
236
+ "esm2022": "./esm2022/login/containers/template/keycloakify-angular-login-containers-template.mjs",
237
+ "esm": "./esm2022/login/containers/template/keycloakify-angular-login-containers-template.mjs",
238
+ "default": "./fesm2022/keycloakify-angular-login-containers-template.mjs"
239
+ },
234
240
  "./login/components/add-remove-buttons-multi-valued-attribute": {
235
241
  "types": "./login/components/add-remove-buttons-multi-valued-attribute/index.d.ts",
236
242
  "esm2022": "./esm2022/login/components/add-remove-buttons-multi-valued-attribute/keycloakify-angular-login-components-add-remove-buttons-multi-valued-attribute.mjs",
@@ -297,24 +303,12 @@
297
303
  "esm": "./esm2022/login/components/user-profile-form-fields/keycloakify-angular-login-components-user-profile-form-fields.mjs",
298
304
  "default": "./fesm2022/keycloakify-angular-login-components-user-profile-form-fields.mjs"
299
305
  },
300
- "./login/containers/template": {
301
- "types": "./login/containers/template/index.d.ts",
302
- "esm2022": "./esm2022/login/containers/template/keycloakify-angular-login-containers-template.mjs",
303
- "esm": "./esm2022/login/containers/template/keycloakify-angular-login-containers-template.mjs",
304
- "default": "./fesm2022/keycloakify-angular-login-containers-template.mjs"
305
- },
306
306
  "./login/directives/kc-class": {
307
307
  "types": "./login/directives/kc-class/index.d.ts",
308
308
  "esm2022": "./esm2022/login/directives/kc-class/keycloakify-angular-login-directives-kc-class.mjs",
309
309
  "esm": "./esm2022/login/directives/kc-class/keycloakify-angular-login-directives-kc-class.mjs",
310
310
  "default": "./fesm2022/keycloakify-angular-login-directives-kc-class.mjs"
311
311
  },
312
- "./login/providers/keycloakify-angular": {
313
- "types": "./login/providers/keycloakify-angular/index.d.ts",
314
- "esm2022": "./esm2022/login/providers/keycloakify-angular/keycloakify-angular-login-providers-keycloakify-angular.mjs",
315
- "esm": "./esm2022/login/providers/keycloakify-angular/keycloakify-angular-login-providers-keycloakify-angular.mjs",
316
- "default": "./fesm2022/keycloakify-angular-login-providers-keycloakify-angular.mjs"
317
- },
318
312
  "./login/pages/code": {
319
313
  "types": "./login/pages/code/index.d.ts",
320
314
  "esm2022": "./esm2022/login/pages/code/keycloakify-angular-login-pages-code.mjs",
@@ -531,6 +525,12 @@
531
525
  "esm": "./esm2022/login/pages/webauthn-register/keycloakify-angular-login-pages-webauthn-register.mjs",
532
526
  "default": "./fesm2022/keycloakify-angular-login-pages-webauthn-register.mjs"
533
527
  },
528
+ "./login/providers/keycloakify-angular": {
529
+ "types": "./login/providers/keycloakify-angular/index.d.ts",
530
+ "esm2022": "./esm2022/login/providers/keycloakify-angular/keycloakify-angular-login-providers-keycloakify-angular.mjs",
531
+ "esm": "./esm2022/login/providers/keycloakify-angular/keycloakify-angular-login-providers-keycloakify-angular.mjs",
532
+ "default": "./fesm2022/keycloakify-angular-login-providers-keycloakify-angular.mjs"
533
+ },
534
534
  "./login/services/i18n": {
535
535
  "types": "./login/services/i18n/index.d.ts",
536
536
  "esm2022": "./esm2022/login/services/i18n/keycloakify-angular-login-services-i18n.mjs",
@@ -25,10 +25,7 @@ import { transformCodebase } from './tools/transformCodebase';
25
25
  import { kebabCaseToCamelCase } from './tools/kebabCaseToSnakeCase';
26
26
  import { replaceAll } from './tools/String.prototype.replaceAll';
27
27
  import { capitalize } from 'tsafe/capitalize';
28
- import { id } from 'tsafe/id';
29
- import { z } from 'zod';
30
- import { is } from 'tsafe/is';
31
- import * as child_process from 'child_process';
28
+ import { runFormat } from './tools/runFormat';
32
29
 
33
30
  export async function command(params: { buildContext: BuildContext }) {
34
31
  const { buildContext } = params;
@@ -246,66 +243,9 @@ export async function command(params: { buildContext: BuildContext }) {
246
243
  }
247
244
  }
248
245
 
249
- run_format: {
250
- const parsedPackageJson = (() => {
251
- type ParsedPackageJson = {
252
- scripts?: Record<string, string>;
253
- };
254
-
255
- const zParsedPackageJson = (() => {
256
- type TargetType = ParsedPackageJson;
257
-
258
- const zTargetType = z.object({
259
- scripts: z.record(z.string()).optional()
260
- });
261
-
262
- assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
263
-
264
- return id<z.ZodType<TargetType>>(zTargetType);
265
- })();
266
-
267
- const parsedPackageJson = JSON.parse(
268
- fs.readFileSync(buildContext.packageJsonFilePath).toString('utf8')
269
- );
270
-
271
- zParsedPackageJson.parse(parsedPackageJson);
272
-
273
- assert(is<ParsedPackageJson>(parsedPackageJson));
274
-
275
- return parsedPackageJson;
276
- })();
277
-
278
- const { scripts } = parsedPackageJson;
279
-
280
- if (scripts === undefined) {
281
- break run_format;
282
- }
283
-
284
- for (const scriptName of ['format', 'lint']) {
285
- if (!(scriptName in scripts)) {
286
- continue;
287
- }
288
-
289
- const command = `npm run ${scriptName}`;
290
-
291
- console.log(chalk.grey(`$ ${command}`));
292
-
293
- try {
294
- child_process.execSync(`npm run ${scriptName}`, {
295
- stdio: 'inherit',
296
- cwd: pathDirname(buildContext.packageJsonFilePath)
297
- });
298
- } catch {
299
- console.log(
300
- chalk.yellow(
301
- `\`${command}\` failed, please format your code manually, continuing...`
302
- )
303
- );
304
- }
305
-
306
- break run_format;
307
- }
308
- }
246
+ runFormat({
247
+ packageJsonFilePath: buildContext.packageJsonFilePath
248
+ });
309
249
 
310
250
  edit_KcPage: {
311
251
  if (
@@ -0,0 +1,71 @@
1
+ import * as fs from 'fs';
2
+ import { dirname as pathDirname } from 'path';
3
+ import { assert, Equals } from 'tsafe/assert';
4
+ import chalk from 'chalk';
5
+ import { id } from 'tsafe/id';
6
+ import { z } from 'zod';
7
+ import { is } from 'tsafe/is';
8
+ import * as child_process from 'child_process';
9
+
10
+ export function runFormat(params: { packageJsonFilePath: string }) {
11
+ const { packageJsonFilePath } = params;
12
+
13
+ const parsedPackageJson = (() => {
14
+ type ParsedPackageJson = {
15
+ scripts?: Record<string, string>;
16
+ };
17
+
18
+ const zParsedPackageJson = (() => {
19
+ type TargetType = ParsedPackageJson;
20
+
21
+ const zTargetType = z.object({
22
+ scripts: z.record(z.string()).optional()
23
+ });
24
+
25
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
26
+
27
+ return id<z.ZodType<TargetType>>(zTargetType);
28
+ })();
29
+
30
+ const parsedPackageJson = JSON.parse(
31
+ fs.readFileSync(packageJsonFilePath).toString('utf8')
32
+ );
33
+
34
+ zParsedPackageJson.parse(parsedPackageJson);
35
+
36
+ assert(is<ParsedPackageJson>(parsedPackageJson));
37
+
38
+ return parsedPackageJson;
39
+ })();
40
+
41
+ const { scripts } = parsedPackageJson;
42
+
43
+ if (scripts === undefined) {
44
+ return;
45
+ }
46
+
47
+ for (const scriptName of ['format', 'lint']) {
48
+ if (!(scriptName in scripts)) {
49
+ continue;
50
+ }
51
+
52
+ const command = `npm run ${scriptName}`;
53
+
54
+ console.log(chalk.grey(`$ ${command}`));
55
+
56
+ try {
57
+ child_process.execSync(`npm run ${scriptName}`, {
58
+ stdio: 'inherit',
59
+ cwd: pathDirname(packageJsonFilePath)
60
+ });
61
+ } catch {
62
+ console.log(
63
+ chalk.yellow(
64
+ `\`${command}\` failed, please format your code manually, continuing...`
65
+ )
66
+ );
67
+ }
68
+
69
+ return;
70
+ }
71
+ }
@@ -1,149 +1,165 @@
1
1
  import type { BuildContext } from './core';
2
2
  import * as fs from 'fs';
3
3
  import { join as pathJoin } from 'path';
4
+ import { runFormat } from './tools/runFormat';
5
+ import * as crypto from 'crypto';
4
6
 
5
7
  export function command(params: { buildContext: BuildContext }) {
6
8
  const { buildContext } = params;
7
9
 
8
10
  const filePath = pathJoin(buildContext.themeSrcDirPath, 'kc.gen.ts');
9
11
 
10
- const currentContent = fs.existsSync(filePath)
11
- ? fs.readFileSync(filePath)
12
- : undefined;
13
-
14
12
  const implementedThemeTypes = (['login', 'account'] as const).filter(
15
13
  themeType => buildContext.implementedThemeTypes[themeType].isImplemented
16
14
  );
17
15
 
18
- const newContent = Buffer.from(
19
- [
20
- `/* prettier-ignore-start */`,
21
- ``,
22
- `/* eslint-disable */`,
23
- ``,
24
- `// noinspection JSUnusedGlobalSymbols`,
25
- ``,
26
- `// This file is auto-generated by Keycloakify`,
27
- ``,
28
- `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
29
- ``,
30
- `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(' | ')};`,
31
- ``,
32
- `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(', ')}];`,
33
- ``,
34
- `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? 'never' : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(' | ')};`,
35
- ``,
36
- `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(', ')}];`,
37
- ``,
38
- `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(
39
- Object.fromEntries(
40
- buildContext.environmentVariables.map(
41
- ({ name, default: defaultValue }) => [name, defaultValue]
42
- )
43
- ),
44
- null,
45
- 2
46
- )};`,
47
- ``,
48
- `export type KcContext =`,
49
- ...implementedThemeTypes.map(
50
- themeType => ` | import("./${themeType}/KcContext").KcContext`
51
- ),
52
- ` ;`,
53
- ``,
54
- `declare global {`,
55
- ` interface Window {`,
56
- ` kcContext?: KcContext;`,
57
- ` }`,
58
- `}`,
59
- ``,
60
- `type ApplicationRefLike = {`,
61
- ` components: ComponentRef<any>[];`,
62
- `};`,
63
- ``,
64
- `export async function bootstrapKcApplication(params: {`,
65
- ` kcContext: KcContext;`,
66
- ` bootstrapApplication: (params: {`,
67
- ` KcRootComponent: Type<unknown>;`,
68
- ` kcProvider: EnvironmentProviders;`,
69
- ` }) => Promise<ApplicationRefLike>;`,
70
- `}) {`,
71
- ` const { kcContext, bootstrapApplication } = params;`,
72
- ``,
73
- ` switch (kcContext.themeType) {`,
74
- ...(['login', 'account'] as const)
75
- .filter(
76
- themeType =>
77
- buildContext.implementedThemeTypes[themeType].isImplemented
16
+ const newContent = [
17
+ ``,
18
+ `/* eslint-disable */`,
19
+ ``,
20
+ `// @ts-nocheck`,
21
+ ``,
22
+ `// noinspection JSUnusedGlobalSymbols`,
23
+ ``,
24
+ `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
25
+ ``,
26
+ `export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(' | ')};`,
27
+ ``,
28
+ `export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(', ')}];`,
29
+ ``,
30
+ `export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? 'never' : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(' | ')};`,
31
+ ``,
32
+ `export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(', ')}];`,
33
+ ``,
34
+ `export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(
35
+ Object.fromEntries(
36
+ buildContext.environmentVariables.map(
37
+ ({ name, default: defaultValue }) => [name, defaultValue]
78
38
  )
79
- .map(themeType => [
80
- ` case "${themeType}":`,
81
- ` {`,
82
- ` const [`,
83
- ` { provideKeycloakifyAngular },`,
84
- ` { getI18n },`,
85
- ` {`,
86
- ` PageComponent,`,
87
- ` TemplateComponent,`,
88
- ` doUseDefaultCss,`,
89
- ` classes,`,
90
- ...(themeType === 'login'
91
- ? [
92
- ` UserProfileFormFieldsComponent,`,
93
- ` doMakeUserConfirmPassword,`
94
- ]
95
- : []),
96
- ` },`,
97
- ` ] = await Promise.all([`,
98
- ` import('@keycloakify/angular/login/providers/keycloakify-angular'),`,
99
- ` import('./${themeType}/i18n'),`,
100
- ` import('./${themeType}/KcPage').then(({ getKcPage }) => getKcPage(kcContext.pageId)),`,
101
- ` ] as const);`,
102
- ``,
103
- ` const appRef = await bootstrapApplication({`,
104
- ` KcRootComponent: TemplateComponent,`,
105
- ` kcProvider: provideKeycloakifyAngular({`,
106
- ` kcContext,`,
107
- ` classes,`,
108
- ` getI18n,`,
109
- ` doUseDefaultCss,`,
110
- ...(themeType === 'login'
111
- ? [` doMakeUserConfirmPassword,`]
112
- : []),
113
- ` })`,
114
- ` });`,
115
- ``,
116
- ` appRef.components.forEach(componentRef => {`,
117
- ` if ("page" in componentRef.instance) {`,
118
- ` componentRef.setInput("page", PageComponent);`,
119
- ` }`,
120
- ...(themeType === 'login'
121
- ? [
122
- ` if ("userProfileFormFields" in componentRef.instance) {`,
123
- ` componentRef.setInput(`,
124
- ` "userProfileFormFields",`,
125
- ` UserProfileFormFieldsComponent`,
126
- ` );`,
127
- ` }`
128
- ]
129
- : []),
130
- ` });`,
131
- ` }`,
132
- ` break;`
133
- ])
134
- .flat(),
135
- ` }`,
136
- `}`,
137
- ``,
138
- `/* prettier-ignore-end */`,
139
- ``
140
- ].join('\n'),
141
- 'utf8'
142
- );
39
+ ),
40
+ null,
41
+ 2
42
+ )};`,
43
+ ``,
44
+ `export type KcContext =`,
45
+ ...implementedThemeTypes.map(
46
+ themeType => ` | import("./${themeType}/KcContext").KcContext`
47
+ ),
48
+ ` ;`,
49
+ ``,
50
+ `declare global {`,
51
+ ` interface Window {`,
52
+ ` kcContext?: KcContext;`,
53
+ ` }`,
54
+ `}`,
55
+ ``,
56
+ `type ApplicationRefLike = {`,
57
+ ` components: ComponentRef<any>[];`,
58
+ `};`,
59
+ ``,
60
+ `export async function bootstrapKcApplication(params: {`,
61
+ ` kcContext: KcContext;`,
62
+ ` bootstrapApplication: (params: {`,
63
+ ` KcRootComponent: Type<unknown>;`,
64
+ ` kcProvider: EnvironmentProviders;`,
65
+ ` }) => Promise<ApplicationRefLike>;`,
66
+ `}) {`,
67
+ ` const { kcContext, bootstrapApplication } = params;`,
68
+ ``,
69
+ ` switch (kcContext.themeType) {`,
70
+ ...(['login', 'account'] as const)
71
+ .filter(
72
+ themeType => buildContext.implementedThemeTypes[themeType].isImplemented
73
+ )
74
+ .map(themeType => [
75
+ ` case "${themeType}":`,
76
+ ` {`,
77
+ ` const [`,
78
+ ` { provideKeycloakifyAngular },`,
79
+ ` { getI18n },`,
80
+ ` {`,
81
+ ` PageComponent,`,
82
+ ` TemplateComponent,`,
83
+ ` doUseDefaultCss,`,
84
+ ` classes,`,
85
+ ...(themeType === 'login'
86
+ ? [
87
+ ` UserProfileFormFieldsComponent,`,
88
+ ` doMakeUserConfirmPassword,`
89
+ ]
90
+ : []),
91
+ ` },`,
92
+ ` ] = await Promise.all([`,
93
+ ` import('@keycloakify/angular/login/providers/keycloakify-angular'),`,
94
+ ` import('./${themeType}/i18n'),`,
95
+ ` import('./${themeType}/KcPage').then(({ getKcPage }) => getKcPage(kcContext.pageId)),`,
96
+ ` ] as const);`,
97
+ ``,
98
+ ` const appRef = await bootstrapApplication({`,
99
+ ` KcRootComponent: TemplateComponent,`,
100
+ ` kcProvider: provideKeycloakifyAngular({`,
101
+ ` kcContext,`,
102
+ ` classes,`,
103
+ ` getI18n,`,
104
+ ` doUseDefaultCss,`,
105
+ ...(themeType === 'login'
106
+ ? [` doMakeUserConfirmPassword,`]
107
+ : []),
108
+ ` })`,
109
+ ` });`,
110
+ ``,
111
+ ` appRef.components.forEach(componentRef => {`,
112
+ ` if ("page" in componentRef.instance) {`,
113
+ ` componentRef.setInput("page", PageComponent);`,
114
+ ` }`,
115
+ ...(themeType === 'login'
116
+ ? [
117
+ ` if ("userProfileFormFields" in componentRef.instance) {`,
118
+ ` componentRef.setInput(`,
119
+ ` "userProfileFormFields",`,
120
+ ` UserProfileFormFieldsComponent`,
121
+ ` );`,
122
+ ` }`
123
+ ]
124
+ : []),
125
+ ` });`,
126
+ ` }`,
127
+ ` break;`
128
+ ])
129
+ .flat(),
130
+ ` }`,
131
+ `}`,
132
+ ``
133
+ ].join('\n');
134
+
135
+ const hash = crypto.createHash('sha256').update(newContent).digest('hex');
136
+
137
+ skip_if_no_changes: {
138
+ if (!fs.existsSync(filePath)) {
139
+ break skip_if_no_changes;
140
+ }
141
+
142
+ const currentContent = fs.readFileSync(filePath).toString('utf8');
143
+
144
+ if (!currentContent.includes(hash)) {
145
+ break skip_if_no_changes;
146
+ }
143
147
 
144
- if (currentContent !== undefined && currentContent.equals(newContent)) {
145
148
  return;
146
149
  }
147
150
 
148
- fs.writeFileSync(filePath, newContent);
151
+ fs.writeFileSync(
152
+ filePath,
153
+ Buffer.from(
154
+ [
155
+ `// This file is auto-generated by keycloakify. Do not edit it manually.`,
156
+ `// Hash: ${hash}`,
157
+ ``,
158
+ newContent
159
+ ].join('\n'),
160
+ 'utf8'
161
+ )
162
+ );
163
+
164
+ runFormat({ packageJsonFilePath: buildContext.packageJsonFilePath });
149
165
  }