keycloakify 11.8.18 → 11.8.20

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/932.index.js CHANGED
@@ -44,8 +44,8 @@ __webpack_require__.r(__webpack_exports__);
44
44
  async function command(params) {
45
45
  var _a;
46
46
  const { buildContext } = params;
47
- const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_1__/* .maybeDelegateCommandToCustomHandler */ .q)({
48
- commandName: "initialize-account-theme",
47
+ const { hasBeenHandled } = await (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_1__/* .maybeDelegateCommandToCustomHandler */ .q)({
48
+ commandName: "initialize-email-theme",
49
49
  buildContext
50
50
  });
51
51
  if (hasBeenHandled) {
@@ -180,9 +180,11 @@ var external_fs_ = __webpack_require__(57147);
180
180
 
181
181
 
182
182
  (0,esm_assert/* assert */.h)();
183
- function maybeDelegateCommandToCustomHandler(params) {
183
+ async function maybeDelegateCommandToCustomHandler(params) {
184
184
  const { commandName, buildContext } = params;
185
- const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
185
+ const nodeModulesBinDirPath = await (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)({
186
+ packageJsonFilePath: buildContext.packageJsonFilePath
187
+ });
186
188
  if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
187
189
  return { hasBeenHandled: false };
188
190
  }
@@ -246,6 +248,106 @@ function exitIfUncommittedChanges(params) {
246
248
 
247
249
  /***/ }),
248
250
 
251
+ /***/ 43765:
252
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
253
+
254
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
255
+ /* harmony export */ "o": () => (/* binding */ existsAsync)
256
+ /* harmony export */ });
257
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
258
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
259
+
260
+ async function existsAsync(path) {
261
+ try {
262
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
263
+ return true;
264
+ }
265
+ catch (error) {
266
+ if (error.code === "ENOENT")
267
+ return false;
268
+ throw error;
269
+ }
270
+ }
271
+ //# sourceMappingURL=fs.existsAsync.js.map
272
+
273
+ /***/ }),
274
+
275
+ /***/ 93721:
276
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
277
+
278
+
279
+ // EXPORTS
280
+ __webpack_require__.d(__webpack_exports__, {
281
+ "p": () => (/* binding */ getInstalledModuleDirPath)
282
+ });
283
+
284
+ // EXTERNAL MODULE: external "path"
285
+ var external_path_ = __webpack_require__(71017);
286
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
287
+ var fs_existsAsync = __webpack_require__(43765);
288
+ // EXTERNAL MODULE: external "child_process"
289
+ var external_child_process_ = __webpack_require__(32081);
290
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
291
+ var assert = __webpack_require__(29041);
292
+ ;// CONCATENATED MODULE: ./dist/bin/tools/isRootPath.js
293
+
294
+ function getIsRootPath(filePath) {
295
+ const path_normalized = (0,external_path_.normalize)(filePath);
296
+ // Unix-like root ("/")
297
+ if (path_normalized === "/") {
298
+ return true;
299
+ }
300
+ // Check for Windows drive root (e.g., "C:\\")
301
+ if (/^[a-zA-Z]:\\$/.test(path_normalized)) {
302
+ return true;
303
+ }
304
+ // Check for UNC root (e.g., "\\server\share")
305
+ if (/^\\\\[^\\]+\\[^\\]+\\?$/.test(path_normalized)) {
306
+ return true;
307
+ }
308
+ return false;
309
+ }
310
+ //# sourceMappingURL=isRootPath.js.map
311
+ ;// CONCATENATED MODULE: ./dist/bin/tools/getInstalledModuleDirPath.js
312
+
313
+
314
+
315
+
316
+
317
+ async function getInstalledModuleDirPath(params) {
318
+ const { moduleName, packageJsonDirPath } = params;
319
+ {
320
+ let dirPath = packageJsonDirPath;
321
+ while (true) {
322
+ const dirPath_candidate = (0,external_path_.join)(dirPath, "node_modules", ...moduleName.split("/"));
323
+ let doesExist;
324
+ try {
325
+ doesExist = await (0,fs_existsAsync/* existsAsync */.o)(dirPath_candidate);
326
+ }
327
+ catch (_a) {
328
+ doesExist = false;
329
+ }
330
+ if (doesExist) {
331
+ return dirPath_candidate;
332
+ }
333
+ if (getIsRootPath(dirPath)) {
334
+ break;
335
+ }
336
+ dirPath = (0,external_path_.join)(dirPath, "..");
337
+ }
338
+ }
339
+ const dirPath = external_child_process_.execSync(`npm list ${moduleName}`, {
340
+ cwd: packageJsonDirPath
341
+ })
342
+ .toString("utf8")
343
+ .trim();
344
+ (0,assert/* assert */.h)(dirPath !== "");
345
+ return dirPath;
346
+ }
347
+ //# sourceMappingURL=getInstalledModuleDirPath.js.map
348
+
349
+ /***/ }),
350
+
249
351
  /***/ 73776:
250
352
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
251
353
 
@@ -254,11 +356,38 @@ function exitIfUncommittedChanges(params) {
254
356
  /* harmony export */ });
255
357
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
256
358
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
359
+ /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58822);
360
+ /* harmony import */ var _getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(93721);
361
+ /* harmony import */ var _fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
362
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(52300);
363
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(73292);
364
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_4__);
365
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29041);
366
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
367
+
368
+
369
+
370
+
371
+
372
+
373
+
257
374
 
258
- let cache = undefined;
259
- function getNodeModulesBinDirPath() {
260
- if (cache !== undefined) {
261
- return cache;
375
+ let cache_bestEffort = undefined;
376
+ /** NOTE: Careful, this function can fail when the binary
377
+ * Used is not in the node_modules directory of the project
378
+ * (for example when running tests with vscode extension we'll get
379
+ * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
380
+ *
381
+ * instead of
382
+ * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
383
+ * or
384
+ * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
385
+ *
386
+ * as the value of process.argv[1]
387
+ */
388
+ function getNodeModulesBinDirPath_bestEffort() {
389
+ if (cache_bestEffort !== undefined) {
390
+ return cache_bestEffort;
262
391
  }
263
392
  const binPath = process.argv[1];
264
393
  const segments = [".bin"];
@@ -276,10 +405,71 @@ function getNodeModulesBinDirPath() {
276
405
  }
277
406
  segments.unshift(segment);
278
407
  }
408
+ if (!foundNodeModules) {
409
+ throw new Error(`Could not find node_modules in path ${binPath}`);
410
+ }
279
411
  const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
280
- cache = nodeModulesBinDirPath;
412
+ cache_bestEffort = nodeModulesBinDirPath;
281
413
  return nodeModulesBinDirPath;
282
414
  }
415
+ let cache_withPackageJsonFileDirPath = undefined;
416
+ async function getNodeModulesBinDirPath_withPackageJsonFileDirPath(params) {
417
+ const { packageJsonFilePath } = params;
418
+ use_cache: {
419
+ if (cache_withPackageJsonFileDirPath === undefined) {
420
+ break use_cache;
421
+ }
422
+ if (cache_withPackageJsonFileDirPath.packageJsonFilePath !== packageJsonFilePath) {
423
+ cache_withPackageJsonFileDirPath = undefined;
424
+ break use_cache;
425
+ }
426
+ return cache_withPackageJsonFileDirPath.nodeModulesBinDirPath;
427
+ }
428
+ // [...]node_modules/keycloakify
429
+ const installedModuleDirPath = await (0,_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getInstalledModuleDirPath */ .p)({
430
+ // Here it will always be "keycloakify" but since we are in tools/ we make something generic
431
+ moduleName: await (async () => {
432
+ const zParsedPackageJson = (() => {
433
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_6__.z.object({
434
+ name: zod__WEBPACK_IMPORTED_MODULE_6__.z.string()
435
+ });
436
+ tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h;
437
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(zTargetType);
438
+ })();
439
+ const parsedPackageJson = JSON.parse((await fs_promises__WEBPACK_IMPORTED_MODULE_4__.readFile((0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getThisCodebaseRootDirPath */ .e)(), "package.json"))).toString("utf8"));
440
+ zParsedPackageJson.parse(parsedPackageJson);
441
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(parsedPackageJson));
442
+ return parsedPackageJson.name;
443
+ })(),
444
+ packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(packageJsonFilePath)
445
+ });
446
+ const segments = installedModuleDirPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep);
447
+ while (true) {
448
+ const segment = segments.pop();
449
+ if (segment === undefined) {
450
+ throw new Error(`Could not find .bin directory relative to ${packageJsonFilePath}`);
451
+ }
452
+ if (segment !== "node_modules") {
453
+ continue;
454
+ }
455
+ const candidate = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep), segment, ".bin");
456
+ if (!(await (0,_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(candidate))) {
457
+ continue;
458
+ }
459
+ cache_withPackageJsonFileDirPath = {
460
+ packageJsonFilePath,
461
+ nodeModulesBinDirPath: candidate
462
+ };
463
+ break;
464
+ }
465
+ return cache_withPackageJsonFileDirPath.nodeModulesBinDirPath;
466
+ }
467
+ function getNodeModulesBinDirPath(params) {
468
+ const { packageJsonFilePath } = params !== null && params !== void 0 ? params : {};
469
+ return packageJsonFilePath === undefined
470
+ ? getNodeModulesBinDirPath_bestEffort()
471
+ : getNodeModulesBinDirPath_withPackageJsonFileDirPath({ packageJsonFilePath });
472
+ }
283
473
  //# sourceMappingURL=nodeModulesBinDirPath.js.map
284
474
 
285
475
  /***/ }),
@@ -320,7 +510,9 @@ async function getIsPrettierAvailable() {
320
510
  if (getIsPrettierAvailable.cache !== undefined) {
321
511
  return getIsPrettierAvailable.cache;
322
512
  }
323
- const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)();
513
+ const nodeModulesBinDirPath = (0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({
514
+ packageJsonFilePath: undefined
515
+ });
324
516
  const prettierBinPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(nodeModulesBinDirPath, "prettier");
325
517
  const stats = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.stat(prettierBinPath).catch(() => undefined);
326
518
  const isPrettierAvailable = (_a = stats === null || stats === void 0 ? void 0 : stats.isFile()) !== null && _a !== void 0 ? _a : false;
@@ -340,14 +532,14 @@ async function getPrettier() {
340
532
  // So we do a sketchy eval to bypass ncc.
341
533
  // We make sure to only do that when linking, otherwise we import properly.
342
534
  if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_6__/* .readThisNpmPackageVersion */ .K)().startsWith("0.0.0")) {
343
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
535
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), "..", "prettier"))}")`);
344
536
  (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__.is)(prettier));
345
537
  break import_prettier;
346
538
  }
347
539
  prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
348
540
  }
349
541
  const configHash = await (async () => {
350
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
542
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)({ packageJsonFilePath: undefined }), ".."));
351
543
  if (configFilePath === null) {
352
544
  return "";
353
545
  }