keycloakify 10.0.0-rc.90 → 10.0.0-rc.92

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 (31) hide show
  1. package/bin/193.index.js +3 -3
  2. package/bin/{751.index.js → 31.index.js} +183 -131
  3. package/bin/440.index.js +7 -12
  4. package/bin/453.index.js +1 -1
  5. package/bin/526.index.js +79 -68
  6. package/bin/538.index.js +1 -1
  7. package/bin/{837.index.js → 893.index.js} +7 -89
  8. package/bin/932.index.js +2 -2
  9. package/bin/97.index.js +1 -1
  10. package/bin/main.js +7 -7
  11. package/bin/shared/buildContext.d.ts +9 -2
  12. package/bin/shared/buildContext.js.map +1 -1
  13. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
  14. package/bin/shared/downloadKeycloakDefaultTheme.d.ts +2 -1
  15. package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -1
  16. package/package.json +7 -9
  17. package/src/bin/keycloakify/generateFtl/generateFtl.ts +14 -10
  18. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +2 -1
  19. package/src/bin/keycloakify/keycloakify.ts +1 -7
  20. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +2 -2
  21. package/src/bin/shared/buildContext.ts +170 -92
  22. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +1 -4
  23. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +2 -2
  24. package/src/bin/start-keycloak/appBuild.ts +131 -94
  25. package/src/bin/start-keycloak/keycloakifyBuild.ts +0 -1
  26. package/src/bin/start-keycloak/start-keycloak.ts +1 -1
  27. package/src/bin/tools/{downloadAndExtractArchive/downloadAndExtractArchive.ts → downloadAndExtractArchive.ts} +9 -17
  28. package/src/bin/tools/{downloadAndExtractArchive/fetchProxyOptions.ts → fetchProxyOptions.ts} +52 -60
  29. package/vite-plugin/index.js +190 -228
  30. package/src/bin/tools/downloadAndExtractArchive/index.ts +0 -1
  31. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +0 -84
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 8355:
4
+ /***/ 1273:
5
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
6
6
 
7
7
  "use strict";
@@ -37,70 +37,6 @@ function getAbsoluteAndInOsFormatPath(params) {
37
37
  return pathOut;
38
38
  }
39
39
  //# sourceMappingURL=getAbsoluteAndInOsFormatPath.js.map
40
- // EXTERNAL MODULE: external "child_process"
41
- var external_child_process_ = __nccwpck_require__(2081);
42
- // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
43
- var assert = __nccwpck_require__(8078);
44
- // EXTERNAL MODULE: external "fs"
45
- var external_fs_ = __nccwpck_require__(7147);
46
- ;// CONCATENATED MODULE: ./dist/bin/tools/getNpmWorkspaceRootDirPath.js
47
-
48
-
49
-
50
-
51
- function getNpmWorkspaceRootDirPath(params) {
52
- const { projectDirPath, dependencyExpected } = params;
53
- console.log("DEBUG getNpmWorkspaceRootDirPath:", {
54
- projectDirPath,
55
- dependencyExpected
56
- });
57
- const npmWorkspaceRootDirPath = (function callee(depth) {
58
- const cwd = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(depth).fill("..")]));
59
- console.log("DEBUG getNpmWorkspaceRootDirPath:", { cwd });
60
- (0,assert.assert)(cwd !== external_path_.sep, "NPM workspace not found");
61
- try {
62
- external_child_process_.execSync("npm config get", {
63
- cwd,
64
- stdio: "ignore"
65
- });
66
- }
67
- catch (error) {
68
- console.log("DEBUG getNpmWorkspaceRootDirPath: got error npm config get");
69
- if (String(error).includes("ENOWORKSPACES")) {
70
- return callee(depth + 1);
71
- }
72
- throw error;
73
- }
74
- console.log("DEBUG getNpmWorkspaceRootDirPath: npm workspace found");
75
- const packageJsonFilePath = (0,external_path_.join)(cwd, "package.json");
76
- if (!external_fs_.existsSync(packageJsonFilePath)) {
77
- return callee(depth + 1);
78
- }
79
- (0,assert.assert)(external_fs_.existsSync(packageJsonFilePath));
80
- const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
81
- let isExpectedDependencyFound = false;
82
- for (const dependenciesOrDevDependencies of [
83
- "dependencies",
84
- "devDependencies"
85
- ]) {
86
- const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
87
- if (dependencies === undefined) {
88
- continue;
89
- }
90
- (0,assert.assert)(dependencies instanceof Object);
91
- if (dependencies[dependencyExpected] === undefined) {
92
- continue;
93
- }
94
- isExpectedDependencyFound = true;
95
- }
96
- if (!isExpectedDependencyFound && parsedPackageJson.name !== dependencyExpected) {
97
- return callee(depth + 1);
98
- }
99
- return cwd;
100
- })(0);
101
- return { npmWorkspaceRootDirPath };
102
- }
103
- //# sourceMappingURL=getNpmWorkspaceRootDirPath.js.map
104
40
  ;// CONCATENATED MODULE: ./node_modules/zod/lib/index.mjs
105
41
  var util;
106
42
  (function (util) {
@@ -4056,6 +3992,12 @@ var z = /*#__PURE__*/Object.freeze({
4056
3992
 
4057
3993
 
4058
3994
 
3995
+ // EXTERNAL MODULE: external "fs"
3996
+ var external_fs_ = __nccwpck_require__(7147);
3997
+ // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
3998
+ var assert = __nccwpck_require__(8078);
3999
+ ;// CONCATENATED MODULE: external "child_process"
4000
+ const external_child_process_namespaceObject = require("child_process");
4059
4001
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
4060
4002
  var constants = __nccwpck_require__(173);
4061
4003
  // EXTERNAL MODULE: ./node_modules/tsafe/index.js
@@ -4073,6 +4015,70 @@ var symToStr = __nccwpck_require__(6564);
4073
4015
  // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
4074
4016
  var source = __nccwpck_require__(8818);
4075
4017
  var source_default = /*#__PURE__*/__nccwpck_require__.n(source);
4018
+ ;// CONCATENATED MODULE: ./dist/bin/tools/fetchProxyOptions.js
4019
+
4020
+
4021
+ function getProxyFetchOptions(params) {
4022
+ var _a, _b, _c;
4023
+ const { npmConfigGetCwd } = params;
4024
+ const cfg = (() => {
4025
+ const output = external_child_process_namespaceObject.execSync("npm config get", {
4026
+ cwd: npmConfigGetCwd
4027
+ })
4028
+ .toString("utf8");
4029
+ return output
4030
+ .split("\n")
4031
+ .filter(line => !line.startsWith(";"))
4032
+ .map(line => line.trim())
4033
+ .map(line => line.split("=", 2))
4034
+ .reduce((cfg, [key, value]) => key in cfg
4035
+ ? Object.assign(Object.assign({}, cfg), { [key]: [...ensureArray(cfg[key]), value] }) : Object.assign(Object.assign({}, cfg), { [key]: value }), {});
4036
+ })();
4037
+ const proxy = ensureSingleOrNone((_a = cfg["https-proxy"]) !== null && _a !== void 0 ? _a : cfg["proxy"]);
4038
+ const noProxy = (_b = cfg["noproxy"]) !== null && _b !== void 0 ? _b : cfg["no-proxy"];
4039
+ function maybeBoolean(arg0) {
4040
+ return typeof arg0 === "undefined" ? undefined : Boolean(arg0);
4041
+ }
4042
+ const strictSSL = maybeBoolean(ensureSingleOrNone(cfg["strict-ssl"]));
4043
+ const cert = cfg["cert"];
4044
+ const ca = ensureArray((_c = cfg["ca"]) !== null && _c !== void 0 ? _c : cfg["ca[]"]);
4045
+ const cafile = ensureSingleOrNone(cfg["cafile"]);
4046
+ if (typeof cafile !== "undefined" && cafile !== "null") {
4047
+ ca.push(...(() => {
4048
+ const cafileContent = external_fs_.readFileSync(cafile).toString("utf8");
4049
+ const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
4050
+ const chunks = (arr, size = 2) => arr
4051
+ .map((_, i) => i % size == 0 && arr.slice(i, i + size))
4052
+ .filter(Boolean);
4053
+ return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
4054
+ .join("")
4055
+ .replace(/\r?\n/g, newLinePlaceholder)
4056
+ .replace(new RegExp(`^${newLinePlaceholder}`), "")
4057
+ .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
4058
+ })());
4059
+ }
4060
+ return {
4061
+ proxy,
4062
+ noProxy,
4063
+ strictSSL,
4064
+ cert,
4065
+ ca: ca.length === 0 ? undefined : ca
4066
+ };
4067
+ }
4068
+ function ensureArray(arg0) {
4069
+ return Array.isArray(arg0) ? arg0 : typeof arg0 === "undefined" ? [] : [arg0];
4070
+ }
4071
+ function ensureSingleOrNone(arg0) {
4072
+ if (!Array.isArray(arg0))
4073
+ return arg0;
4074
+ if (arg0.length === 0)
4075
+ return undefined;
4076
+ if (arg0.length === 1)
4077
+ return arg0[0];
4078
+ throw new Error("Illegal configuration, expected a single value but found multiple: " +
4079
+ arg0.map(String).join(", "));
4080
+ }
4081
+ //# sourceMappingURL=fetchProxyOptions.js.map
4076
4082
  ;// CONCATENATED MODULE: ./dist/bin/shared/buildContext.js
4077
4083
  var __rest = (undefined && undefined.__rest) || function (s, e) {
4078
4084
  var t = {};
@@ -4105,24 +4111,51 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
4105
4111
  function getBuildContext(params) {
4106
4112
  var _a, _b, _c, _d, _e, _f;
4107
4113
  const { cliCommandOptions } = params;
4108
- console.log("DEBUG:", { cliCommandOptions });
4109
- const projectDirPath = (() => {
4110
- if (cliCommandOptions.projectDirPath === undefined) {
4111
- return process.cwd();
4112
- }
4113
- return getAbsoluteAndInOsFormatPath({
4114
+ const projectDirPath = cliCommandOptions.projectDirPath !== undefined
4115
+ ? getAbsoluteAndInOsFormatPath({
4114
4116
  pathIsh: cliCommandOptions.projectDirPath,
4115
4117
  cwd: process.cwd()
4116
- });
4118
+ })
4119
+ : process.cwd();
4120
+ const { themeSrcDirPath } = (() => {
4121
+ const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
4122
+ const themeSrcDirPath = (0,crawl/* crawl */.J)({
4123
+ dirPath: srcDirPath,
4124
+ returnedPathsType: "relative to dirPath"
4125
+ })
4126
+ .map(fileRelativePath => {
4127
+ for (const themeSrcDirBasename of ["keycloak-theme", "keycloak_theme"]) {
4128
+ const split = fileRelativePath.split(themeSrcDirBasename);
4129
+ if (split.length === 2) {
4130
+ return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
4131
+ }
4132
+ }
4133
+ return undefined;
4134
+ })
4135
+ .filter((0,tsafe.exclude)(undefined))[0];
4136
+ if (themeSrcDirPath !== undefined) {
4137
+ return { themeSrcDirPath };
4138
+ }
4139
+ for (const themeType of [...constants.themeTypes, "email"]) {
4140
+ if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
4141
+ continue;
4142
+ }
4143
+ return { themeSrcDirPath: srcDirPath };
4144
+ }
4145
+ console.log(source_default().red([
4146
+ `Can't locate your Keycloak theme source directory in .${external_path_.sep}${(0,external_path_.relative)(process.cwd(), srcDirPath)}`,
4147
+ `Make sure to either use the Keycloakify CLI in the root of your Keycloakify project or use the --project CLI option`,
4148
+ `If you are collocating your Keycloak theme with your app you must have a directory named 'keycloak-theme' or 'keycloak_theme' in your 'src' directory`
4149
+ ].join("\n")));
4150
+ process.exit(1);
4117
4151
  })();
4118
- console.log("DEBUG:", { projectDirPath });
4119
4152
  const { resolvedViteConfig } = (() => {
4120
4153
  if (external_fs_.readdirSync(projectDirPath)
4121
4154
  .find(fileBasename => fileBasename.startsWith("vite.config")) ===
4122
4155
  undefined) {
4123
4156
  return { resolvedViteConfig: undefined };
4124
4157
  }
4125
- const output = external_child_process_.execSync("npx vite", {
4158
+ const output = external_child_process_namespaceObject.execSync("npx vite", {
4126
4159
  cwd: projectDirPath,
4127
4160
  env: Object.assign(Object.assign({}, process.env), { [constants.vitePluginSubScriptEnvNames.resolveViteConfig]: "true" })
4128
4161
  })
@@ -4134,10 +4167,34 @@ function getBuildContext(params) {
4134
4167
  const resolvedViteConfig = JSON.parse(resolvedViteConfigStr);
4135
4168
  return { resolvedViteConfig };
4136
4169
  })();
4137
- console.log("DEBUG:", { resolvedViteConfig });
4170
+ const packageJsonFilePath = (function getPackageJSonDirPath(upCount) {
4171
+ var _a, _b;
4172
+ const dirPath = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(upCount).fill("..")]));
4173
+ (0,assert.assert)(dirPath !== external_path_.sep, "Root package.json not found");
4174
+ success: {
4175
+ const packageJsonFilePath = (0,external_path_.join)(dirPath, "package.json");
4176
+ if (!external_fs_.existsSync(packageJsonFilePath)) {
4177
+ break success;
4178
+ }
4179
+ const parsedPackageJson = z.object({
4180
+ name: z.string().optional(),
4181
+ dependencies: z.record(z.string()).optional(),
4182
+ devDependencies: z.record(z.string()).optional()
4183
+ })
4184
+ .parse(JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8")));
4185
+ if (((_a = parsedPackageJson.dependencies) === null || _a === void 0 ? void 0 : _a.keycloakify) === undefined &&
4186
+ ((_b = parsedPackageJson.devDependencies) === null || _b === void 0 ? void 0 : _b.keycloakify) === undefined &&
4187
+ parsedPackageJson.name !== "keycloakify" // NOTE: For local storybook build
4188
+ ) {
4189
+ break success;
4190
+ }
4191
+ return packageJsonFilePath;
4192
+ }
4193
+ return getPackageJSonDirPath(upCount + 1);
4194
+ })(0);
4138
4195
  const parsedPackageJson = (() => {
4139
4196
  const zParsedPackageJson = z.object({
4140
- name: z.string(),
4197
+ name: z.string().optional(),
4141
4198
  version: z.string().optional(),
4142
4199
  homepage: z.string().optional(),
4143
4200
  keycloakify: (0,id.id)((() => {
@@ -4194,55 +4251,29 @@ function getBuildContext(params) {
4194
4251
  {
4195
4252
  (0,assert.assert)();
4196
4253
  }
4197
- return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(projectDirPath, "package.json")).toString("utf8")));
4254
+ const configurationPackageJsonFilePath = (() => {
4255
+ const rootPackageJsonFilePath = (0,external_path_.join)(projectDirPath, "package.json");
4256
+ return external_fs_.existsSync(rootPackageJsonFilePath)
4257
+ ? rootPackageJsonFilePath
4258
+ : packageJsonFilePath;
4259
+ })();
4260
+ return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync(configurationPackageJsonFilePath).toString("utf8")));
4198
4261
  })();
4199
- console.log("DEBUG:", { parsedPackageJson });
4200
4262
  const buildOptions = Object.assign(Object.assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildOptions);
4201
- console.log("DEBUG:", { buildOptions });
4202
- const { themeSrcDirPath } = (() => {
4203
- const srcDirPath = (0,external_path_.join)(projectDirPath, "src");
4204
- const themeSrcDirPath = (0,crawl/* crawl */.J)({
4205
- dirPath: srcDirPath,
4206
- returnedPathsType: "relative to dirPath"
4207
- })
4208
- .map(fileRelativePath => {
4209
- for (const themeSrcDirBasename of ["keycloak-theme", "keycloak_theme"]) {
4210
- const split = fileRelativePath.split(themeSrcDirBasename);
4211
- if (split.length === 2) {
4212
- return (0,external_path_.join)(srcDirPath, split[0] + themeSrcDirBasename);
4213
- }
4214
- }
4215
- return undefined;
4216
- })
4217
- .filter((0,tsafe.exclude)(undefined))[0];
4218
- if (themeSrcDirPath !== undefined) {
4219
- return { themeSrcDirPath };
4220
- }
4221
- for (const themeType of [...constants.themeTypes, "email"]) {
4222
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
4223
- continue;
4224
- }
4225
- return { themeSrcDirPath: srcDirPath };
4226
- }
4227
- console.log(source_default().red([
4228
- "Can't locate your keycloak theme source directory.",
4229
- "See: https://docs.keycloakify.dev/v/v10/keycloakify-in-my-app/collocation"
4230
- ].join("\n")));
4231
- process.exit(1);
4232
- })();
4233
4263
  const recordIsImplementedByThemeType = (0,objectFromEntries.objectFromEntries)(["login", "account", "email"].map(themeType => [
4234
4264
  themeType,
4235
4265
  external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, themeType))
4236
4266
  ]));
4237
- console.log("DEBUG:", { themeSrcDirPath });
4238
4267
  const themeNames = (() => {
4239
4268
  if (buildOptions.themeName === undefined) {
4240
- return [
4241
- parsedPackageJson.name
4242
- .replace(/^@(.*)/, "$1")
4243
- .split("/")
4244
- .join("-")
4245
- ];
4269
+ return parsedPackageJson.name === undefined
4270
+ ? ["keycloakify"]
4271
+ : [
4272
+ parsedPackageJson.name
4273
+ .replace(/^@(.*)/, "$1")
4274
+ .split("/")
4275
+ .join("-")
4276
+ ];
4246
4277
  }
4247
4278
  if (typeof buildOptions.themeName === "string") {
4248
4279
  return [buildOptions.themeName];
@@ -4251,7 +4282,6 @@ function getBuildContext(params) {
4251
4282
  (0,assert.assert)(mainThemeName !== undefined);
4252
4283
  return [mainThemeName, ...themeVariantNames];
4253
4284
  })();
4254
- console.log("DEBUG:", { themeNames });
4255
4285
  const projectBuildDirPath = (() => {
4256
4286
  webpack: {
4257
4287
  if (resolvedViteConfig !== undefined) {
@@ -4267,15 +4297,21 @@ function getBuildContext(params) {
4267
4297
  }
4268
4298
  return (0,external_path_.join)(projectDirPath, resolvedViteConfig.buildDir);
4269
4299
  })();
4270
- console.log("DEBUG:", { projectBuildDirPath });
4271
- const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
4272
- projectDirPath,
4273
- dependencyExpected: "keycloakify"
4274
- });
4275
- console.log("DEBUG:", { npmWorkspaceRootDirPath });
4276
4300
  const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
4277
- const buildContext = {
4278
- bundler,
4301
+ return {
4302
+ bundler: resolvedViteConfig !== undefined
4303
+ ? { type: "vite" }
4304
+ : (() => {
4305
+ const { scripts } = z.object({
4306
+ scripts: z.record(z.string()).optional()
4307
+ })
4308
+ .parse(JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8")));
4309
+ return {
4310
+ type: "webpack",
4311
+ packageJsonDirPath: (0,external_path_.dirname)(packageJsonFilePath),
4312
+ packageJsonScripts: scripts !== null && scripts !== void 0 ? scripts : {}
4313
+ };
4314
+ })(),
4279
4315
  themeVersion: (_b = (_a = buildOptions.themeVersion) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
4280
4316
  themeNames,
4281
4317
  extraThemeProperties: buildOptions.extraThemeProperties,
@@ -4331,7 +4367,7 @@ function getBuildContext(params) {
4331
4367
  cwd: process.cwd()
4332
4368
  });
4333
4369
  }
4334
- return (0,external_path_.join)(npmWorkspaceRootDirPath, "node_modules", ".cache");
4370
+ return (0,external_path_.join)((0,external_path_.dirname)(packageJsonFilePath), "node_modules", ".cache");
4335
4371
  })(), "keycloakify");
4336
4372
  return cacheDirPath;
4337
4373
  })(),
@@ -4368,7 +4404,6 @@ function getBuildContext(params) {
4368
4404
  }
4369
4405
  return (0,external_path_.join)(projectBuildDirPath, resolvedViteConfig.assetsDir);
4370
4406
  })(),
4371
- npmWorkspaceRootDirPath,
4372
4407
  kcContextExclusionsFtlCode: (() => {
4373
4408
  if (buildOptions.kcContextExclusionsFtl === undefined) {
4374
4409
  return undefined;
@@ -4385,6 +4420,25 @@ function getBuildContext(params) {
4385
4420
  environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : [],
4386
4421
  recordIsImplementedByThemeType,
4387
4422
  themeSrcDirPath,
4423
+ fetchOptions: getProxyFetchOptions({
4424
+ npmConfigGetCwd: (function callee(upCount) {
4425
+ const dirPath = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(upCount).fill("..")]));
4426
+ (0,assert.assert)(dirPath !== external_path_.sep, "Couldn't find a place to run 'npm config get'");
4427
+ try {
4428
+ external_child_process_namespaceObject.execSync("npm config get", {
4429
+ cwd: dirPath,
4430
+ stdio: "ignore"
4431
+ });
4432
+ }
4433
+ catch (error) {
4434
+ if (String(error).includes("ENOWORKSPACES")) {
4435
+ return callee(upCount + 1);
4436
+ }
4437
+ throw error;
4438
+ }
4439
+ return dirPath;
4440
+ })(0)
4441
+ }),
4388
4442
  jarTargets: (() => {
4389
4443
  const getDefaultJarFileBasename = (range) => `keycloak-theme-for-kc-${range}.jar`;
4390
4444
  build_for_specific_keycloak_major_version: {
@@ -4566,8 +4620,6 @@ function getBuildContext(params) {
4566
4620
  return jarTargets;
4567
4621
  })()
4568
4622
  };
4569
- console.log("DEBUG:", JSON.stringify({ buildContext }, null, 2));
4570
- return buildContext;
4571
4623
  }
4572
4624
  //# sourceMappingURL=buildContext.js.map
4573
4625
 
@@ -4654,7 +4706,7 @@ const fallbackLanguageTag = "en";
4654
4706
 
4655
4707
  /***/ }),
4656
4708
 
4657
- /***/ 4901:
4709
+ /***/ 3695:
4658
4710
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
4659
4711
 
4660
4712
  "use strict";
@@ -4874,90 +4926,11 @@ async function extractArchive(params) {
4874
4926
  await dDone.pr;
4875
4927
  }
4876
4928
  //# sourceMappingURL=extractArchive.js.map
4877
- // EXTERNAL MODULE: external "child_process"
4878
- var external_child_process_ = __nccwpck_require__(2081);
4879
- // EXTERNAL MODULE: external "util"
4880
- var external_util_ = __nccwpck_require__(3837);
4881
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/fetchProxyOptions.js
4882
-
4883
-
4884
-
4885
- function ensureArray(arg0) {
4886
- return Array.isArray(arg0) ? arg0 : typeof arg0 === "undefined" ? [] : [arg0];
4887
- }
4888
- function ensureSingleOrNone(arg0) {
4889
- if (!Array.isArray(arg0))
4890
- return arg0;
4891
- if (arg0.length === 0)
4892
- return undefined;
4893
- if (arg0.length === 1)
4894
- return arg0[0];
4895
- throw new Error("Illegal configuration, expected a single value but found multiple: " +
4896
- arg0.map(String).join(", "));
4897
- }
4898
- /**
4899
- * Get npm configuration as map
4900
- */
4901
- async function getNmpConfig(params) {
4902
- const { npmWorkspaceRootDirPath } = params;
4903
- const exec = (0,external_util_.promisify)(external_child_process_.exec);
4904
- const stdout = await exec("npm config get", {
4905
- encoding: "utf8",
4906
- cwd: npmWorkspaceRootDirPath
4907
- }).then(({ stdout }) => stdout);
4908
- const npmConfigReducer = (cfg, [key, value]) => key in cfg
4909
- ? Object.assign(Object.assign({}, cfg), { [key]: [...ensureArray(cfg[key]), value] }) : Object.assign(Object.assign({}, cfg), { [key]: value });
4910
- return stdout
4911
- .split("\n")
4912
- .filter(line => !line.startsWith(";"))
4913
- .map(line => line.trim())
4914
- .map(line => line.split("=", 2))
4915
- .reduce(npmConfigReducer, {});
4916
- }
4917
- async function getProxyFetchOptions(params) {
4918
- var _a, _b, _c;
4919
- const { npmWorkspaceRootDirPath } = params;
4920
- const cfg = await getNmpConfig({ npmWorkspaceRootDirPath });
4921
- const proxy = ensureSingleOrNone((_a = cfg["https-proxy"]) !== null && _a !== void 0 ? _a : cfg["proxy"]);
4922
- const noProxy = (_b = cfg["noproxy"]) !== null && _b !== void 0 ? _b : cfg["no-proxy"];
4923
- function maybeBoolean(arg0) {
4924
- return typeof arg0 === "undefined" ? undefined : Boolean(arg0);
4925
- }
4926
- const strictSSL = maybeBoolean(ensureSingleOrNone(cfg["strict-ssl"]));
4927
- const cert = cfg["cert"];
4928
- const ca = ensureArray((_c = cfg["ca"]) !== null && _c !== void 0 ? _c : cfg["ca[]"]);
4929
- const cafile = ensureSingleOrNone(cfg["cafile"]);
4930
- if (typeof cafile !== "undefined" && cafile !== "null") {
4931
- ca.push(...(await (async () => {
4932
- function chunks(arr, size = 2) {
4933
- return arr
4934
- .map((_, i) => i % size == 0 && arr.slice(i, i + size))
4935
- .filter(Boolean);
4936
- }
4937
- const cafileContent = await (0,promises_.readFile)(cafile, "utf-8");
4938
- const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
4939
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
4940
- .join("")
4941
- .replace(/\r?\n/g, newLinePlaceholder)
4942
- .replace(new RegExp(`^${newLinePlaceholder}`), "")
4943
- .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
4944
- })()));
4945
- }
4946
- return {
4947
- proxy,
4948
- noProxy,
4949
- strictSSL,
4950
- cert,
4951
- ca: ca.length === 0 ? undefined : ca
4952
- };
4953
- }
4954
- //# sourceMappingURL=fetchProxyOptions.js.map
4955
4929
  // EXTERNAL MODULE: external "crypto"
4956
4930
  var external_crypto_ = __nccwpck_require__(6113);
4957
4931
  // EXTERNAL MODULE: ./dist/bin/tools/fs.rm.js
4958
4932
  var fs_rm = __nccwpck_require__(8699);
4959
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.js
4960
-
4933
+ ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive.js
4961
4934
 
4962
4935
 
4963
4936
 
@@ -4968,7 +4941,7 @@ var fs_rm = __nccwpck_require__(8699);
4968
4941
 
4969
4942
  async function downloadAndExtractArchive(params) {
4970
4943
  var _a;
4971
- const { url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, npmWorkspaceRootDirPath } = params;
4944
+ const { url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, fetchOptions } = params;
4972
4945
  const archiveFileBasename = url.split("?")[0].split("/").reverse()[0];
4973
4946
  const archiveFilePath = (0,external_path_.join)(cacheDirPath, archiveFileBasename);
4974
4947
  download: {
@@ -4987,7 +4960,7 @@ async function downloadAndExtractArchive(params) {
4987
4960
  });
4988
4961
  }
4989
4962
  await (0,promises_.mkdir)((0,external_path_.dirname)(archiveFilePath), { recursive: true });
4990
- const response = await lib_default()(url, await getProxyFetchOptions({ npmWorkspaceRootDirPath }));
4963
+ const response = await lib_default()(url, fetchOptions);
4991
4964
  (_a = response.body) === null || _a === void 0 ? void 0 : _a.setMaxListeners(Number.MAX_VALUE);
4992
4965
  (0,assert.assert)(typeof response.body !== "undefined" && response.body != null);
4993
4966
  await (0,promises_.writeFile)(archiveFilePath, response.body);
@@ -5114,9 +5087,6 @@ var SuccessTracker;
5114
5087
  SuccessTracker.removeFromExtracted = removeFromExtracted;
5115
5088
  })(SuccessTracker || (SuccessTracker = {}));
5116
5089
  //# sourceMappingURL=downloadAndExtractArchive.js.map
5117
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/index.js
5118
-
5119
- //# sourceMappingURL=index.js.map
5120
5090
  ;// CONCATENATED MODULE: ./dist/bin/shared/downloadKeycloakDefaultTheme.js
5121
5091
 
5122
5092
 
@@ -5130,7 +5100,7 @@ async function downloadKeycloakDefaultTheme(params) {
5130
5100
  const { extractedDirPath } = await downloadAndExtractArchive({
5131
5101
  url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
5132
5102
  cacheDirPath: buildContext.cacheDirPath,
5133
- npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
5103
+ fetchOptions: buildContext.fetchOptions,
5134
5104
  uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
5135
5105
  onArchiveFile: async (params) => {
5136
5106
  const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
@@ -5331,7 +5301,7 @@ async function copyKeycloakResourcesToPublic(params) {
5331
5301
  buildContext: {
5332
5302
  loginThemeResourcesFromKeycloakVersion: readThisNpmPackageVersion(),
5333
5303
  cacheDirPath: (0,external_path_.relative)(destDirPath, buildContext.cacheDirPath),
5334
- npmWorkspaceRootDirPath: (0,external_path_.relative)(destDirPath, buildContext.npmWorkspaceRootDirPath)
5304
+ fetchOptions: buildContext.fetchOptions
5335
5305
  }
5336
5306
  }, null, 2);
5337
5307
  skip_if_already_done: {
@@ -5676,9 +5646,9 @@ const path_1 = __nccwpck_require__(1017);
5676
5646
  const constants_1 = __nccwpck_require__(173);
5677
5647
  const id_1 = __nccwpck_require__(3047);
5678
5648
  const fs_rm_1 = __nccwpck_require__(8699);
5679
- const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(4901);
5649
+ const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(3695);
5680
5650
  const assert_1 = __nccwpck_require__(8078);
5681
- const buildContext_1 = __nccwpck_require__(8355);
5651
+ const buildContext_1 = __nccwpck_require__(1273);
5682
5652
  const magic_string_1 = __importDefault(__nccwpck_require__(5734));
5683
5653
  const generateKcGenTs_1 = __nccwpck_require__(8585);
5684
5654
  function keycloakify(params) {
@@ -44027,14 +43997,6 @@ module.exports = require("buffer");
44027
43997
 
44028
43998
  /***/ }),
44029
43999
 
44030
- /***/ 2081:
44031
- /***/ ((module) => {
44032
-
44033
- "use strict";
44034
- module.exports = require("child_process");
44035
-
44036
- /***/ }),
44037
-
44038
44000
  /***/ 6113:
44039
44001
  /***/ ((module) => {
44040
44002
 
@@ -1 +0,0 @@
1
- export * from "./downloadAndExtractArchive";
@@ -1,84 +0,0 @@
1
- import * as child_process from "child_process";
2
- import { join as pathJoin, resolve as pathResolve, sep as pathSep } from "path";
3
- import { assert } from "tsafe/assert";
4
- import * as fs from "fs";
5
-
6
- export function getNpmWorkspaceRootDirPath(params: {
7
- projectDirPath: string;
8
- dependencyExpected: string;
9
- }) {
10
- const { projectDirPath, dependencyExpected } = params;
11
-
12
- console.log("DEBUG getNpmWorkspaceRootDirPath:", {
13
- projectDirPath,
14
- dependencyExpected
15
- });
16
-
17
- const npmWorkspaceRootDirPath = (function callee(depth: number): string {
18
- const cwd = pathResolve(
19
- pathJoin(...[projectDirPath, ...Array(depth).fill("..")])
20
- );
21
-
22
- console.log("DEBUG getNpmWorkspaceRootDirPath:", { cwd });
23
-
24
- assert(cwd !== pathSep, "NPM workspace not found");
25
-
26
- try {
27
- child_process.execSync("npm config get", {
28
- cwd,
29
- stdio: "ignore"
30
- });
31
- } catch (error) {
32
- console.log("DEBUG getNpmWorkspaceRootDirPath: got error npm config get");
33
-
34
- if (String(error).includes("ENOWORKSPACES")) {
35
- return callee(depth + 1);
36
- }
37
-
38
- throw error;
39
- }
40
-
41
- console.log("DEBUG getNpmWorkspaceRootDirPath: npm workspace found");
42
-
43
- const packageJsonFilePath = pathJoin(cwd, "package.json");
44
-
45
- if (!fs.existsSync(packageJsonFilePath)) {
46
- return callee(depth + 1);
47
- }
48
-
49
- assert(fs.existsSync(packageJsonFilePath));
50
-
51
- const parsedPackageJson = JSON.parse(
52
- fs.readFileSync(packageJsonFilePath).toString("utf8")
53
- );
54
-
55
- let isExpectedDependencyFound = false;
56
-
57
- for (const dependenciesOrDevDependencies of [
58
- "dependencies",
59
- "devDependencies"
60
- ] as const) {
61
- const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
62
-
63
- if (dependencies === undefined) {
64
- continue;
65
- }
66
-
67
- assert(dependencies instanceof Object);
68
-
69
- if (dependencies[dependencyExpected] === undefined) {
70
- continue;
71
- }
72
-
73
- isExpectedDependencyFound = true;
74
- }
75
-
76
- if (!isExpectedDependencyFound && parsedPackageJson.name !== dependencyExpected) {
77
- return callee(depth + 1);
78
- }
79
-
80
- return cwd;
81
- })(0);
82
-
83
- return { npmWorkspaceRootDirPath };
84
- }