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/40.index.js CHANGED
@@ -30,7 +30,7 @@ __webpack_require__.r(__webpack_exports__);
30
30
 
31
31
  async function command(params) {
32
32
  const { buildContext } = params;
33
- const { hasBeenHandled } = (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_0__/* .maybeDelegateCommandToCustomHandler */ .q)({
33
+ const { hasBeenHandled } = await (0,_shared_customHandler_delegate__WEBPACK_IMPORTED_MODULE_0__/* .maybeDelegateCommandToCustomHandler */ .q)({
34
34
  commandName: "copy-keycloak-resources-to-public",
35
35
  buildContext
36
36
  });
@@ -130,9 +130,11 @@ var external_fs_ = __webpack_require__(57147);
130
130
 
131
131
 
132
132
  (0,esm_assert/* assert */.h)();
133
- function maybeDelegateCommandToCustomHandler(params) {
133
+ async function maybeDelegateCommandToCustomHandler(params) {
134
134
  const { commandName, buildContext } = params;
135
- const nodeModulesBinDirPath = (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)();
135
+ const nodeModulesBinDirPath = await (0,tools_nodeModulesBinDirPath/* getNodeModulesBinDirPath */.K)({
136
+ packageJsonFilePath: buildContext.packageJsonFilePath
137
+ });
136
138
  if (!external_fs_.readdirSync(nodeModulesBinDirPath).includes(BIN_NAME)) {
137
139
  return { hasBeenHandled: false };
138
140
  }
@@ -240,6 +242,30 @@ var SemVer;
240
242
 
241
243
  /***/ }),
242
244
 
245
+ /***/ 43765:
246
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
247
+
248
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
249
+ /* harmony export */ "o": () => (/* binding */ existsAsync)
250
+ /* harmony export */ });
251
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
252
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
253
+
254
+ async function existsAsync(path) {
255
+ try {
256
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
257
+ return true;
258
+ }
259
+ catch (error) {
260
+ if (error.code === "ENOENT")
261
+ return false;
262
+ throw error;
263
+ }
264
+ }
265
+ //# sourceMappingURL=fs.existsAsync.js.map
266
+
267
+ /***/ }),
268
+
243
269
  /***/ 89693:
244
270
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
245
271
 
@@ -283,6 +309,82 @@ function rmSync(dirPath, options) {
283
309
 
284
310
  /***/ }),
285
311
 
312
+ /***/ 93721:
313
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
314
+
315
+
316
+ // EXPORTS
317
+ __webpack_require__.d(__webpack_exports__, {
318
+ "p": () => (/* binding */ getInstalledModuleDirPath)
319
+ });
320
+
321
+ // EXTERNAL MODULE: external "path"
322
+ var external_path_ = __webpack_require__(71017);
323
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
324
+ var fs_existsAsync = __webpack_require__(43765);
325
+ // EXTERNAL MODULE: external "child_process"
326
+ var external_child_process_ = __webpack_require__(32081);
327
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
328
+ var assert = __webpack_require__(29041);
329
+ ;// CONCATENATED MODULE: ./dist/bin/tools/isRootPath.js
330
+
331
+ function getIsRootPath(filePath) {
332
+ const path_normalized = (0,external_path_.normalize)(filePath);
333
+ // Unix-like root ("/")
334
+ if (path_normalized === "/") {
335
+ return true;
336
+ }
337
+ // Check for Windows drive root (e.g., "C:\\")
338
+ if (/^[a-zA-Z]:\\$/.test(path_normalized)) {
339
+ return true;
340
+ }
341
+ // Check for UNC root (e.g., "\\server\share")
342
+ if (/^\\\\[^\\]+\\[^\\]+\\?$/.test(path_normalized)) {
343
+ return true;
344
+ }
345
+ return false;
346
+ }
347
+ //# sourceMappingURL=isRootPath.js.map
348
+ ;// CONCATENATED MODULE: ./dist/bin/tools/getInstalledModuleDirPath.js
349
+
350
+
351
+
352
+
353
+
354
+ async function getInstalledModuleDirPath(params) {
355
+ const { moduleName, packageJsonDirPath } = params;
356
+ {
357
+ let dirPath = packageJsonDirPath;
358
+ while (true) {
359
+ const dirPath_candidate = (0,external_path_.join)(dirPath, "node_modules", ...moduleName.split("/"));
360
+ let doesExist;
361
+ try {
362
+ doesExist = await (0,fs_existsAsync/* existsAsync */.o)(dirPath_candidate);
363
+ }
364
+ catch (_a) {
365
+ doesExist = false;
366
+ }
367
+ if (doesExist) {
368
+ return dirPath_candidate;
369
+ }
370
+ if (getIsRootPath(dirPath)) {
371
+ break;
372
+ }
373
+ dirPath = (0,external_path_.join)(dirPath, "..");
374
+ }
375
+ }
376
+ const dirPath = external_child_process_.execSync(`npm list ${moduleName}`, {
377
+ cwd: packageJsonDirPath
378
+ })
379
+ .toString("utf8")
380
+ .trim();
381
+ (0,assert/* assert */.h)(dirPath !== "");
382
+ return dirPath;
383
+ }
384
+ //# sourceMappingURL=getInstalledModuleDirPath.js.map
385
+
386
+ /***/ }),
387
+
286
388
  /***/ 73776:
287
389
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
288
390
 
@@ -291,11 +393,38 @@ function rmSync(dirPath, options) {
291
393
  /* harmony export */ });
292
394
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
293
395
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
396
+ /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58822);
397
+ /* harmony import */ var _getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(93721);
398
+ /* harmony import */ var _fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
399
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(52300);
400
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(73292);
401
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_4__);
402
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29041);
403
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38469);
404
+
405
+
406
+
407
+
408
+
294
409
 
295
- let cache = undefined;
296
- function getNodeModulesBinDirPath() {
297
- if (cache !== undefined) {
298
- return cache;
410
+
411
+
412
+ let cache_bestEffort = undefined;
413
+ /** NOTE: Careful, this function can fail when the binary
414
+ * Used is not in the node_modules directory of the project
415
+ * (for example when running tests with vscode extension we'll get
416
+ * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
417
+ *
418
+ * instead of
419
+ * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
420
+ * or
421
+ * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
422
+ *
423
+ * as the value of process.argv[1]
424
+ */
425
+ function getNodeModulesBinDirPath_bestEffort() {
426
+ if (cache_bestEffort !== undefined) {
427
+ return cache_bestEffort;
299
428
  }
300
429
  const binPath = process.argv[1];
301
430
  const segments = [".bin"];
@@ -313,10 +442,71 @@ function getNodeModulesBinDirPath() {
313
442
  }
314
443
  segments.unshift(segment);
315
444
  }
445
+ if (!foundNodeModules) {
446
+ throw new Error(`Could not find node_modules in path ${binPath}`);
447
+ }
316
448
  const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
317
- cache = nodeModulesBinDirPath;
449
+ cache_bestEffort = nodeModulesBinDirPath;
318
450
  return nodeModulesBinDirPath;
319
451
  }
452
+ let cache_withPackageJsonFileDirPath = undefined;
453
+ async function getNodeModulesBinDirPath_withPackageJsonFileDirPath(params) {
454
+ const { packageJsonFilePath } = params;
455
+ use_cache: {
456
+ if (cache_withPackageJsonFileDirPath === undefined) {
457
+ break use_cache;
458
+ }
459
+ if (cache_withPackageJsonFileDirPath.packageJsonFilePath !== packageJsonFilePath) {
460
+ cache_withPackageJsonFileDirPath = undefined;
461
+ break use_cache;
462
+ }
463
+ return cache_withPackageJsonFileDirPath.nodeModulesBinDirPath;
464
+ }
465
+ // [...]node_modules/keycloakify
466
+ const installedModuleDirPath = await (0,_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getInstalledModuleDirPath */ .p)({
467
+ // Here it will always be "keycloakify" but since we are in tools/ we make something generic
468
+ moduleName: await (async () => {
469
+ const zParsedPackageJson = (() => {
470
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_6__.z.object({
471
+ name: zod__WEBPACK_IMPORTED_MODULE_6__.z.string()
472
+ });
473
+ tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h;
474
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_7__.id)(zTargetType);
475
+ })();
476
+ 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"));
477
+ zParsedPackageJson.parse(parsedPackageJson);
478
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__.is)(parsedPackageJson));
479
+ return parsedPackageJson.name;
480
+ })(),
481
+ packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(packageJsonFilePath)
482
+ });
483
+ const segments = installedModuleDirPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep);
484
+ while (true) {
485
+ const segment = segments.pop();
486
+ if (segment === undefined) {
487
+ throw new Error(`Could not find .bin directory relative to ${packageJsonFilePath}`);
488
+ }
489
+ if (segment !== "node_modules") {
490
+ continue;
491
+ }
492
+ const candidate = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep), segment, ".bin");
493
+ if (!(await (0,_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(candidate))) {
494
+ continue;
495
+ }
496
+ cache_withPackageJsonFileDirPath = {
497
+ packageJsonFilePath,
498
+ nodeModulesBinDirPath: candidate
499
+ };
500
+ break;
501
+ }
502
+ return cache_withPackageJsonFileDirPath.nodeModulesBinDirPath;
503
+ }
504
+ function getNodeModulesBinDirPath(params) {
505
+ const { packageJsonFilePath } = params !== null && params !== void 0 ? params : {};
506
+ return packageJsonFilePath === undefined
507
+ ? getNodeModulesBinDirPath_bestEffort()
508
+ : getNodeModulesBinDirPath_withPackageJsonFileDirPath({ packageJsonFilePath });
509
+ }
320
510
  //# sourceMappingURL=nodeModulesBinDirPath.js.map
321
511
 
322
512
  /***/ }),