keycloakify 10.0.0-rc.90 → 10.0.0-rc.91

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} +180 -131
  3. package/bin/440.index.js +7 -12
  4. package/bin/453.index.js +1 -1
  5. package/bin/526.index.js +78 -65
  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 +168 -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 +130 -90
  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 +187 -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,31 @@ 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
+ dependencies: z.record(z.string()).optional(),
4181
+ devDependencies: z.record(z.string()).optional()
4182
+ })
4183
+ .parse(JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8")));
4184
+ if (((_a = parsedPackageJson.dependencies) === null || _a === void 0 ? void 0 : _a.keycloakify) === undefined &&
4185
+ ((_b = parsedPackageJson.devDependencies) === null || _b === void 0 ? void 0 : _b.keycloakify) === undefined) {
4186
+ break success;
4187
+ }
4188
+ return packageJsonFilePath;
4189
+ }
4190
+ return getPackageJSonDirPath(upCount + 1);
4191
+ })(0);
4138
4192
  const parsedPackageJson = (() => {
4139
4193
  const zParsedPackageJson = z.object({
4140
- name: z.string(),
4194
+ name: z.string().optional(),
4141
4195
  version: z.string().optional(),
4142
4196
  homepage: z.string().optional(),
4143
4197
  keycloakify: (0,id.id)((() => {
@@ -4194,55 +4248,29 @@ function getBuildContext(params) {
4194
4248
  {
4195
4249
  (0,assert.assert)();
4196
4250
  }
4197
- return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(projectDirPath, "package.json")).toString("utf8")));
4251
+ const configurationPackageJsonFilePath = (() => {
4252
+ const rootPackageJsonFilePath = (0,external_path_.join)(projectDirPath, "package.json");
4253
+ return external_fs_.existsSync(rootPackageJsonFilePath)
4254
+ ? rootPackageJsonFilePath
4255
+ : packageJsonFilePath;
4256
+ })();
4257
+ return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync(configurationPackageJsonFilePath).toString("utf8")));
4198
4258
  })();
4199
- console.log("DEBUG:", { parsedPackageJson });
4200
4259
  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
4260
  const recordIsImplementedByThemeType = (0,objectFromEntries.objectFromEntries)(["login", "account", "email"].map(themeType => [
4234
4261
  themeType,
4235
4262
  external_fs_.existsSync((0,external_path_.join)(themeSrcDirPath, themeType))
4236
4263
  ]));
4237
- console.log("DEBUG:", { themeSrcDirPath });
4238
4264
  const themeNames = (() => {
4239
4265
  if (buildOptions.themeName === undefined) {
4240
- return [
4241
- parsedPackageJson.name
4242
- .replace(/^@(.*)/, "$1")
4243
- .split("/")
4244
- .join("-")
4245
- ];
4266
+ return parsedPackageJson.name === undefined
4267
+ ? ["keycloakify"]
4268
+ : [
4269
+ parsedPackageJson.name
4270
+ .replace(/^@(.*)/, "$1")
4271
+ .split("/")
4272
+ .join("-")
4273
+ ];
4246
4274
  }
4247
4275
  if (typeof buildOptions.themeName === "string") {
4248
4276
  return [buildOptions.themeName];
@@ -4251,7 +4279,6 @@ function getBuildContext(params) {
4251
4279
  (0,assert.assert)(mainThemeName !== undefined);
4252
4280
  return [mainThemeName, ...themeVariantNames];
4253
4281
  })();
4254
- console.log("DEBUG:", { themeNames });
4255
4282
  const projectBuildDirPath = (() => {
4256
4283
  webpack: {
4257
4284
  if (resolvedViteConfig !== undefined) {
@@ -4267,15 +4294,21 @@ function getBuildContext(params) {
4267
4294
  }
4268
4295
  return (0,external_path_.join)(projectDirPath, resolvedViteConfig.buildDir);
4269
4296
  })();
4270
- console.log("DEBUG:", { projectBuildDirPath });
4271
- const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
4272
- projectDirPath,
4273
- dependencyExpected: "keycloakify"
4274
- });
4275
- console.log("DEBUG:", { npmWorkspaceRootDirPath });
4276
4297
  const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
4277
- const buildContext = {
4278
- bundler,
4298
+ return {
4299
+ bundler: resolvedViteConfig !== undefined
4300
+ ? { type: "vite" }
4301
+ : (() => {
4302
+ const { scripts } = z.object({
4303
+ scripts: z.record(z.string()).optional()
4304
+ })
4305
+ .parse(JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8")));
4306
+ return {
4307
+ type: "webpack",
4308
+ packageJsonDirPath: (0,external_path_.dirname)(packageJsonFilePath),
4309
+ packageJsonScripts: scripts !== null && scripts !== void 0 ? scripts : {}
4310
+ };
4311
+ })(),
4279
4312
  themeVersion: (_b = (_a = buildOptions.themeVersion) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
4280
4313
  themeNames,
4281
4314
  extraThemeProperties: buildOptions.extraThemeProperties,
@@ -4331,7 +4364,7 @@ function getBuildContext(params) {
4331
4364
  cwd: process.cwd()
4332
4365
  });
4333
4366
  }
4334
- return (0,external_path_.join)(npmWorkspaceRootDirPath, "node_modules", ".cache");
4367
+ return (0,external_path_.join)((0,external_path_.dirname)(packageJsonFilePath), "node_modules", ".cache");
4335
4368
  })(), "keycloakify");
4336
4369
  return cacheDirPath;
4337
4370
  })(),
@@ -4368,7 +4401,6 @@ function getBuildContext(params) {
4368
4401
  }
4369
4402
  return (0,external_path_.join)(projectBuildDirPath, resolvedViteConfig.assetsDir);
4370
4403
  })(),
4371
- npmWorkspaceRootDirPath,
4372
4404
  kcContextExclusionsFtlCode: (() => {
4373
4405
  if (buildOptions.kcContextExclusionsFtl === undefined) {
4374
4406
  return undefined;
@@ -4385,6 +4417,25 @@ function getBuildContext(params) {
4385
4417
  environmentVariables: (_f = buildOptions.environmentVariables) !== null && _f !== void 0 ? _f : [],
4386
4418
  recordIsImplementedByThemeType,
4387
4419
  themeSrcDirPath,
4420
+ fetchOptions: getProxyFetchOptions({
4421
+ npmConfigGetCwd: (function callee(upCount) {
4422
+ const dirPath = (0,external_path_.resolve)((0,external_path_.join)(...[projectDirPath, ...Array(upCount).fill("..")]));
4423
+ (0,assert.assert)(dirPath !== external_path_.sep, "Couldn't find a place to run 'npm config get'");
4424
+ try {
4425
+ external_child_process_namespaceObject.execSync("npm config get", {
4426
+ cwd: dirPath,
4427
+ stdio: "ignore"
4428
+ });
4429
+ }
4430
+ catch (error) {
4431
+ if (String(error).includes("ENOWORKSPACES")) {
4432
+ return callee(upCount + 1);
4433
+ }
4434
+ throw error;
4435
+ }
4436
+ return dirPath;
4437
+ })(0)
4438
+ }),
4388
4439
  jarTargets: (() => {
4389
4440
  const getDefaultJarFileBasename = (range) => `keycloak-theme-for-kc-${range}.jar`;
4390
4441
  build_for_specific_keycloak_major_version: {
@@ -4566,8 +4617,6 @@ function getBuildContext(params) {
4566
4617
  return jarTargets;
4567
4618
  })()
4568
4619
  };
4569
- console.log("DEBUG:", JSON.stringify({ buildContext }, null, 2));
4570
- return buildContext;
4571
4620
  }
4572
4621
  //# sourceMappingURL=buildContext.js.map
4573
4622
 
@@ -4654,7 +4703,7 @@ const fallbackLanguageTag = "en";
4654
4703
 
4655
4704
  /***/ }),
4656
4705
 
4657
- /***/ 4901:
4706
+ /***/ 3695:
4658
4707
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
4659
4708
 
4660
4709
  "use strict";
@@ -4874,90 +4923,11 @@ async function extractArchive(params) {
4874
4923
  await dDone.pr;
4875
4924
  }
4876
4925
  //# 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
4926
  // EXTERNAL MODULE: external "crypto"
4956
4927
  var external_crypto_ = __nccwpck_require__(6113);
4957
4928
  // EXTERNAL MODULE: ./dist/bin/tools/fs.rm.js
4958
4929
  var fs_rm = __nccwpck_require__(8699);
4959
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.js
4960
-
4930
+ ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive.js
4961
4931
 
4962
4932
 
4963
4933
 
@@ -4968,7 +4938,7 @@ var fs_rm = __nccwpck_require__(8699);
4968
4938
 
4969
4939
  async function downloadAndExtractArchive(params) {
4970
4940
  var _a;
4971
- const { url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, npmWorkspaceRootDirPath } = params;
4941
+ const { url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, fetchOptions } = params;
4972
4942
  const archiveFileBasename = url.split("?")[0].split("/").reverse()[0];
4973
4943
  const archiveFilePath = (0,external_path_.join)(cacheDirPath, archiveFileBasename);
4974
4944
  download: {
@@ -4987,7 +4957,7 @@ async function downloadAndExtractArchive(params) {
4987
4957
  });
4988
4958
  }
4989
4959
  await (0,promises_.mkdir)((0,external_path_.dirname)(archiveFilePath), { recursive: true });
4990
- const response = await lib_default()(url, await getProxyFetchOptions({ npmWorkspaceRootDirPath }));
4960
+ const response = await lib_default()(url, fetchOptions);
4991
4961
  (_a = response.body) === null || _a === void 0 ? void 0 : _a.setMaxListeners(Number.MAX_VALUE);
4992
4962
  (0,assert.assert)(typeof response.body !== "undefined" && response.body != null);
4993
4963
  await (0,promises_.writeFile)(archiveFilePath, response.body);
@@ -5114,9 +5084,6 @@ var SuccessTracker;
5114
5084
  SuccessTracker.removeFromExtracted = removeFromExtracted;
5115
5085
  })(SuccessTracker || (SuccessTracker = {}));
5116
5086
  //# sourceMappingURL=downloadAndExtractArchive.js.map
5117
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/index.js
5118
-
5119
- //# sourceMappingURL=index.js.map
5120
5087
  ;// CONCATENATED MODULE: ./dist/bin/shared/downloadKeycloakDefaultTheme.js
5121
5088
 
5122
5089
 
@@ -5130,7 +5097,7 @@ async function downloadKeycloakDefaultTheme(params) {
5130
5097
  const { extractedDirPath } = await downloadAndExtractArchive({
5131
5098
  url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
5132
5099
  cacheDirPath: buildContext.cacheDirPath,
5133
- npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
5100
+ fetchOptions: buildContext.fetchOptions,
5134
5101
  uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
5135
5102
  onArchiveFile: async (params) => {
5136
5103
  const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
@@ -5331,7 +5298,7 @@ async function copyKeycloakResourcesToPublic(params) {
5331
5298
  buildContext: {
5332
5299
  loginThemeResourcesFromKeycloakVersion: readThisNpmPackageVersion(),
5333
5300
  cacheDirPath: (0,external_path_.relative)(destDirPath, buildContext.cacheDirPath),
5334
- npmWorkspaceRootDirPath: (0,external_path_.relative)(destDirPath, buildContext.npmWorkspaceRootDirPath)
5301
+ fetchOptions: buildContext.fetchOptions
5335
5302
  }
5336
5303
  }, null, 2);
5337
5304
  skip_if_already_done: {
@@ -5676,9 +5643,9 @@ const path_1 = __nccwpck_require__(1017);
5676
5643
  const constants_1 = __nccwpck_require__(173);
5677
5644
  const id_1 = __nccwpck_require__(3047);
5678
5645
  const fs_rm_1 = __nccwpck_require__(8699);
5679
- const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(4901);
5646
+ const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(3695);
5680
5647
  const assert_1 = __nccwpck_require__(8078);
5681
- const buildContext_1 = __nccwpck_require__(8355);
5648
+ const buildContext_1 = __nccwpck_require__(1273);
5682
5649
  const magic_string_1 = __importDefault(__nccwpck_require__(5734));
5683
5650
  const generateKcGenTs_1 = __nccwpck_require__(8585);
5684
5651
  function keycloakify(params) {
@@ -44027,14 +43994,6 @@ module.exports = require("buffer");
44027
43994
 
44028
43995
  /***/ }),
44029
43996
 
44030
- /***/ 2081:
44031
- /***/ ((module) => {
44032
-
44033
- "use strict";
44034
- module.exports = require("child_process");
44035
-
44036
- /***/ }),
44037
-
44038
43997
  /***/ 6113:
44039
43998
  /***/ ((module) => {
44040
43999
 
@@ -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
- }