keycloakify 10.0.0-rc.60 → 10.0.0-rc.62

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/PUBLIC_URL.js CHANGED
@@ -1,11 +1,11 @@
1
- import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "./bin/shared/constants";
1
+ import { basenameOfTheKeycloakifyResourcesDir } from "./bin/shared/constants";
2
2
  import { assert } from "tsafe/assert";
3
3
  /**
4
4
  * This is an equivalent of process.env.PUBLIC_URL that you can use in Webpack projects.
5
5
  * This works both in your main app and in your Keycloak theme.
6
6
  */
7
7
  export const PUBLIC_URL = (() => {
8
- const kcContext = window[nameOfTheGlobal];
8
+ const kcContext = window.kcContext;
9
9
  if (kcContext === undefined || process.env.NODE_ENV === "development") {
10
10
  assert(process.env.PUBLIC_URL !== undefined, `If you use keycloakify/PUBLIC_URL you should be in Webpack and thus process.env.PUBLIC_URL should be defined`);
11
11
  return process.env.PUBLIC_URL;
package/PUBLIC_URL.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"PUBLIC_URL.js","sourceRoot":"","sources":["src/PUBLIC_URL.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,oCAAoC,EACvC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE;IAC5B,MAAM,SAAS,GAAI,MAAc,CAAC,eAAe,CAAC,CAAC;IAEnD,IAAI,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QACnE,MAAM,CACF,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,EACpC,8GAA8G,CACjH,CAAC;QAEF,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;KACjC;IAED,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,aAAa,IAAI,oCAAoC,EAAE,CAAC;AACpF,CAAC,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"PUBLIC_URL.js","sourceRoot":"","sources":["src/PUBLIC_URL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE;IAC5B,MAAM,SAAS,GAAI,MAAc,CAAC,SAAS,CAAC;IAE5C,IAAI,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QACnE,MAAM,CACF,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,EACpC,8GAA8G,CACjH,CAAC;QAEF,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;KACjC;IAED,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,aAAa,IAAI,oCAAoC,EAAE,CAAC;AACpF,CAAC,CAAC,EAAE,CAAC"}
package/bin/190.index.js CHANGED
@@ -88,7 +88,12 @@ async function getProxyFetchOptions(params) {
88
88
  .filter(Boolean);
89
89
  }
90
90
  const cafileContent = await (0,promises_.readFile)(cafile, "utf-8");
91
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n"));
91
+ const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
92
+ return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
93
+ .join("")
94
+ .replace(/\r?\n/g, newLinePlaceholder)
95
+ .replace(new RegExp(`^${newLinePlaceholder}`), "")
96
+ .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
92
97
  })()));
93
98
  }
94
99
  return {
package/bin/538.index.js CHANGED
@@ -299,7 +299,6 @@ function getBuildContext(params) {
299
299
  /* harmony export */ "M": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
300
300
  /* harmony export */ "N$": () => (/* binding */ keycloak_resources),
301
301
  /* harmony export */ "UX": () => (/* binding */ accountThemePageIds),
302
- /* harmony export */ "X4": () => (/* binding */ nameOfTheGlobal),
303
302
  /* harmony export */ "fe": () => (/* binding */ vitePluginSubScriptEnvNames),
304
303
  /* harmony export */ "h6": () => (/* binding */ containerName),
305
304
  /* harmony export */ "lg": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
@@ -309,7 +308,6 @@ function getBuildContext(params) {
309
308
  /* harmony export */ "y_": () => (/* binding */ accountV1ThemeName),
310
309
  /* harmony export */ "z0": () => (/* binding */ resources_common)
311
310
  /* harmony export */ });
312
- const nameOfTheGlobal = "kcContext";
313
311
  const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
314
312
  const keycloak_resources = "keycloak-resources";
315
313
  const resources_common = "resources-common";
package/bin/932.index.js CHANGED
@@ -148,7 +148,12 @@ async function getProxyFetchOptions(params) {
148
148
  .filter(Boolean);
149
149
  }
150
150
  const cafileContent = await (0,promises_.readFile)(cafile, "utf-8");
151
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n"));
151
+ const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
152
+ return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
153
+ .join("")
154
+ .replace(/\r?\n/g, newLinePlaceholder)
155
+ .replace(new RegExp(`^${newLinePlaceholder}`), "")
156
+ .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
152
157
  })()));
153
158
  }
154
159
  return {
package/bin/952.index.js CHANGED
@@ -242,8 +242,8 @@ function replaceImportsInJsCode_vite(params) {
242
242
  .map(basenameOfAssetsFile => `${staticDir}${basenameOfAssetsFile}`)
243
243
  .forEach(relativePathOfAssetFile => {
244
244
  var _a;
245
- fixedJsCode = replaceAll(fixedJsCode, `"${relativePathOfAssetFile}"`, `(window.${constants/* nameOfTheGlobal */.X4}.url.resourcesPath.substring(1) + "/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${relativePathOfAssetFile}")`);
246
- fixedJsCode = replaceAll(fixedJsCode, `"${(_a = buildContext.urlPathname) !== null && _a !== void 0 ? _a : "/"}${relativePathOfAssetFile}"`, `(window.${constants/* nameOfTheGlobal */.X4}.url.resourcesPath + "/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${relativePathOfAssetFile}")`);
245
+ fixedJsCode = replaceAll(fixedJsCode, `"${relativePathOfAssetFile}"`, `(window.kcContext.url.resourcesPath.substring(1) + "/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${relativePathOfAssetFile}")`);
246
+ fixedJsCode = replaceAll(fixedJsCode, `"${(_a = buildContext.urlPathname) !== null && _a !== void 0 ? _a : "/"}${relativePathOfAssetFile}"`, `(window.kcContext.url.resourcesPath + "/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${relativePathOfAssetFile}")`);
247
247
  });
248
248
  }
249
249
  return { fixedJsCode };
@@ -284,7 +284,7 @@ function replaceImportsInJsCode_webpack(params) {
284
284
  var pd = Object.getOwnPropertyDescriptor(${n}, "p");
285
285
  if( pd === undefined || pd.configurable ){
286
286
  Object.defineProperty(${n}, "p", {
287
- get: function() { return window.${constants/* nameOfTheGlobal */.X4}.url.resourcesPath; },
287
+ get: function() { return window.kcContext.url.resourcesPath; },
288
288
  set: function() {}
289
289
  });
290
290
  }
@@ -297,7 +297,7 @@ function replaceImportsInJsCode_webpack(params) {
297
297
  fixedJsCode = fixedJsCode
298
298
  .replace(...getReplaceArgs("js"))
299
299
  .replace(...getReplaceArgs("css"))
300
- .replace(new RegExp(`[a-zA-Z]+\\.[a-zA-Z]+\\+"${staticDir.replace(/\//g, "\\/")}`, "g"), `window.${constants/* nameOfTheGlobal */.X4}.url.resourcesPath + "/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${staticDir}`);
300
+ .replace(new RegExp(`[a-zA-Z]+\\.[a-zA-Z]+\\+"${staticDir.replace(/\//g, "\\/")}`, "g"), `window.kcContext.url.resourcesPath + "/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}/${staticDir}`);
301
301
  return { fixedJsCode };
302
302
  }
303
303
  //# sourceMappingURL=webpack.js.map
@@ -466,9 +466,8 @@ function generateFtlFilesCodeFactory(params) {
466
466
  }
467
467
  }
468
468
  //FTL is no valid html, we can't insert with cheerio, we put placeholder for injecting later.
469
- const ftlObjectToJsCodeDeclaringAnObject = external_fs_.readFileSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "keycloakify", "generateFtl", "ftl_object_to_js_code_declaring_an_object.ftl"))
469
+ const kcContextDeclarationTemplateFtl = external_fs_.readFileSync((0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "keycloakify", "generateFtl", "kcContextDeclarationTemplate.ftl"))
470
470
  .toString("utf8")
471
- .match(/^<script>const _=((?:.|\n)+)<\/script>[\n]?$/)[1]
472
471
  .replace("FIELD_NAMES_eKsIY4ZsZ4xeM", fieldNames.map(name => `"${name}"`).join(", "))
473
472
  .replace("KEYCLOAKIFY_VERSION_xEdKd3xEdr", keycloakifyVersion)
474
473
  .replace("KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx", buildContext.themeVersion)
@@ -478,7 +477,7 @@ function generateFtlFilesCodeFactory(params) {
478
477
  .replace("lOCALIZATION_REALM_OVERRIDES_USER_PROFILE_PROPERTY_KEY_aaGLsPgGIdeeX", constants/* nameOfTheLocalizationRealmOverridesUserProfileProperty */.lg)
479
478
  .replace("USER_DEFINED_EXCLUSIONS_eKsaY4ZsZ4eMr2", (_a = buildContext.kcContextExclusionsFtlCode) !== null && _a !== void 0 ? _a : "");
480
479
  const ftlObjectToJsCodeDeclaringAnObjectPlaceholder = '{ "x": "vIdLqMeOed9sdLdIdOxdK0d" }';
481
- $("head").prepend(`<script>\nwindow.${constants/* nameOfTheGlobal */.X4}=${ftlObjectToJsCodeDeclaringAnObjectPlaceholder}</script>`);
480
+ $("head").prepend(`<script>\n${ftlObjectToJsCodeDeclaringAnObjectPlaceholder}\n</script>`);
482
481
  // Remove part of the document marked as ignored.
483
482
  {
484
483
  const startTags = $('meta[name="keycloakify-ignore-start"]');
@@ -504,7 +503,7 @@ function generateFtlFilesCodeFactory(params) {
504
503
  const $ = esm/* default.load */.ZP.load(partiallyFixedIndexHtmlCode);
505
504
  let ftlCode = $.html();
506
505
  Object.entries({
507
- [ftlObjectToJsCodeDeclaringAnObjectPlaceholder]: ftlObjectToJsCodeDeclaringAnObject,
506
+ [ftlObjectToJsCodeDeclaringAnObjectPlaceholder]: kcContextDeclarationTemplateFtl,
508
507
  PAGE_ID_xIgLsPgGId9D8e: pageId
509
508
  }).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue)));
510
509
  return { ftlCode };
@@ -1195,7 +1194,7 @@ async function buildJar(params) {
1195
1194
  }
1196
1195
  (0,assert.assert)(false);
1197
1196
  })();
1198
- const modifiedFtlFileContent = ftlFileContent.replace(`out.pageId = "\${pageId}";`, `out.pageId = "${pageId}"; out.realPageId = "${realPageId}";`);
1197
+ const modifiedFtlFileContent = ftlFileContent.replace(`kcContext.pageId = "\${pageId}";`, `kcContext.pageId = "${pageId}"; kcContext.realPageId = "${realPageId}";`);
1199
1198
  (0,assert.assert)(modifiedFtlFileContent !== ftlFileContent);
1200
1199
  promises_.writeFile((0,external_path_.join)((0,external_path_.dirname)(ftlFilePath), realPageId), Buffer.from(modifiedFtlFileContent, "utf8"));
1201
1200
  }));
package/bin/98.index.js CHANGED
@@ -299,7 +299,6 @@ function getBuildContext(params) {
299
299
  /* harmony export */ "M": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
300
300
  /* harmony export */ "N$": () => (/* binding */ keycloak_resources),
301
301
  /* harmony export */ "UX": () => (/* binding */ accountThemePageIds),
302
- /* harmony export */ "X4": () => (/* binding */ nameOfTheGlobal),
303
302
  /* harmony export */ "fe": () => (/* binding */ vitePluginSubScriptEnvNames),
304
303
  /* harmony export */ "h6": () => (/* binding */ containerName),
305
304
  /* harmony export */ "lg": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
@@ -309,7 +308,6 @@ function getBuildContext(params) {
309
308
  /* harmony export */ "y_": () => (/* binding */ accountV1ThemeName),
310
309
  /* harmony export */ "z0": () => (/* binding */ resources_common)
311
310
  /* harmony export */ });
312
- const nameOfTheGlobal = "kcContext";
313
311
  const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
314
312
  const keycloak_resources = "keycloak-resources";
315
313
  const resources_common = "resources-common";
package/bin/991.index.js CHANGED
@@ -299,7 +299,6 @@ function getBuildContext(params) {
299
299
  /* harmony export */ "M": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
300
300
  /* harmony export */ "N$": () => (/* binding */ keycloak_resources),
301
301
  /* harmony export */ "UX": () => (/* binding */ accountThemePageIds),
302
- /* harmony export */ "X4": () => (/* binding */ nameOfTheGlobal),
303
302
  /* harmony export */ "fe": () => (/* binding */ vitePluginSubScriptEnvNames),
304
303
  /* harmony export */ "h6": () => (/* binding */ containerName),
305
304
  /* harmony export */ "lg": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
@@ -309,7 +308,6 @@ function getBuildContext(params) {
309
308
  /* harmony export */ "y_": () => (/* binding */ accountV1ThemeName),
310
309
  /* harmony export */ "z0": () => (/* binding */ resources_common)
311
310
  /* harmony export */ });
312
- const nameOfTheGlobal = "kcContext";
313
311
  const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
314
312
  const keycloak_resources = "keycloak-resources";
315
313
  const resources_common = "resources-common";
@@ -546,7 +544,7 @@ async function extractArchive(params) {
546
544
  zipFile.on("entry", async (entry) => {
547
545
  handle_file: {
548
546
  // NOTE: Skip directories
549
- if (entry.fileName.endsWith(path__WEBPACK_IMPORTED_MODULE_5__.sep)) {
547
+ if (entry.fileName.endsWith("/")) {
550
548
  break handle_file;
551
549
  }
552
550
  let hasEarlyExitBeenCalled = false;
@@ -1,4 +1,3 @@
1
- export declare const nameOfTheGlobal = "kcContext";
2
1
  export declare const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
3
2
  export declare const keycloak_resources = "keycloak-resources";
4
3
  export declare const resources_common = "resources-common";
@@ -1,4 +1,3 @@
1
- export const nameOfTheGlobal = "kcContext";
2
1
  export const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
3
2
  export const keycloak_resources = "keycloak-resources";
4
3
  export const resources_common = "resources-common";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/bin/shared/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,MAAM,CAAC,MAAM,sDAAsD,GAC/D,yCAAyC,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,gCAAgC,GAAG,QAAQ,CAAC;AACzD,MAAM,CAAC,MAAM,oCAAoC,GAAG,OAAO,CAAC;AAE5D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAI/C,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACvC,kBAAkB,EAAE,mCAAmC;IACvD,iBAAiB,EAAE,iCAAiC;CAC9C,CAAC;AAEX,MAAM,CAAC,MAAM,+BAA+B,GAAG,0CAA0C,CAAC;AAE1F,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,WAAW;IACX,oBAAoB;IACpB,oBAAoB;IACpB,2BAA2B;IAC3B,uBAAuB;IACvB,cAAc;IACd,UAAU;IACV,WAAW;IACX,0BAA0B;IAC1B,wBAAwB;IACxB,WAAW;IACX,0CAA0C;IAC1C,uBAAuB;IACvB,eAAe;IACf,0BAA0B;IAC1B,2BAA2B;IAC3B,4BAA4B;IAC5B,0BAA0B;IAC1B,wBAAwB;IACxB,uBAAuB;IACvB,oBAAoB;IACpB,6BAA6B;IAC7B,kBAAkB;IAClB,0BAA0B;IAC1B,oBAAoB;IACpB,uBAAuB;IACvB,UAAU;IACV,4BAA4B;IAC5B,yBAAyB;IACzB,sCAAsC;IACtC,qCAAqC;IACrC,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,cAAc;IACd,aAAa;IACb,cAAc;IACd,UAAU;IACV,kBAAkB;IAClB,SAAS;IACT,uBAAuB;CACjB,CAAC;AAKX,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/bin/shared/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sDAAsD,GAC/D,yCAAyC,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,gCAAgC,GAAG,QAAQ,CAAC;AACzD,MAAM,CAAC,MAAM,oCAAoC,GAAG,OAAO,CAAC;AAE5D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAI/C,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACvC,kBAAkB,EAAE,mCAAmC;IACvD,iBAAiB,EAAE,iCAAiC;CAC9C,CAAC;AAEX,MAAM,CAAC,MAAM,+BAA+B,GAAG,0CAA0C,CAAC;AAE1F,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,WAAW;IACX,oBAAoB;IACpB,oBAAoB;IACpB,2BAA2B;IAC3B,uBAAuB;IACvB,cAAc;IACd,UAAU;IACV,WAAW;IACX,0BAA0B;IAC1B,wBAAwB;IACxB,WAAW;IACX,0CAA0C;IAC1C,uBAAuB;IACvB,eAAe;IACf,0BAA0B;IAC1B,2BAA2B;IAC3B,4BAA4B;IAC5B,0BAA0B;IAC1B,wBAAwB;IACxB,uBAAuB;IACvB,oBAAoB;IACpB,6BAA6B;IAC7B,kBAAkB;IAClB,0BAA0B;IAC1B,oBAAoB;IACpB,uBAAuB;IACvB,UAAU;IACV,4BAA4B;IAC5B,yBAAyB;IACzB,sCAAsC;IACtC,qCAAqC;IACrC,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,cAAc;IACd,aAAa;IACb,cAAc;IACd,UAAU;IACV,kBAAkB;IAClB,SAAS;IACT,uBAAuB;CACjB,CAAC;AAKX,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "10.0.0-rc.60",
3
+ "version": "10.0.0-rc.62",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -464,9 +464,9 @@
464
464
  "src/bin/keycloakify/buildJars/generatePom.ts",
465
465
  "src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts",
466
466
  "src/bin/keycloakify/buildJars/index.ts",
467
- "src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl",
468
467
  "src/bin/keycloakify/generateFtl/generateFtl.ts",
469
468
  "src/bin/keycloakify/generateFtl/index.ts",
469
+ "src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl",
470
470
  "src/bin/keycloakify/generateResources/bringInAccountV1.ts",
471
471
  "src/bin/keycloakify/generateResources/generateMessageProperties.ts",
472
472
  "src/bin/keycloakify/generateResources/generateResources.ts",
@@ -517,7 +517,6 @@
517
517
  "src/bin/tools/downloadAndExtractArchive/index.ts",
518
518
  "src/bin/tools/escapeStringForPropertiesFile.ts",
519
519
  "src/bin/tools/extractArchive.ts",
520
- "src/bin/tools/fetchProxyOptions.ts",
521
520
  "src/bin/tools/fs.existsAsync.ts",
522
521
  "src/bin/tools/fs.rm.ts",
523
522
  "src/bin/tools/fs.rmSync.ts",
package/src/PUBLIC_URL.ts CHANGED
@@ -1,7 +1,4 @@
1
- import {
2
- nameOfTheGlobal,
3
- basenameOfTheKeycloakifyResourcesDir
4
- } from "keycloakify/bin/shared/constants";
1
+ import { basenameOfTheKeycloakifyResourcesDir } from "keycloakify/bin/shared/constants";
5
2
  import { assert } from "tsafe/assert";
6
3
 
7
4
  /**
@@ -9,7 +6,7 @@ import { assert } from "tsafe/assert";
9
6
  * This works both in your main app and in your Keycloak theme.
10
7
  */
11
8
  export const PUBLIC_URL = (() => {
12
- const kcContext = (window as any)[nameOfTheGlobal];
9
+ const kcContext = (window as any).kcContext;
13
10
 
14
11
  if (kcContext === undefined || process.env.NODE_ENV === "development") {
15
12
  assert(
@@ -168,8 +168,8 @@ export async function buildJar(params: {
168
168
  })();
169
169
 
170
170
  const modifiedFtlFileContent = ftlFileContent.replace(
171
- `out.pageId = "\${pageId}";`,
172
- `out.pageId = "${pageId}"; out.realPageId = "${realPageId}";`
171
+ `kcContext.pageId = "\${pageId}";`,
172
+ `kcContext.pageId = "${pageId}"; kcContext.realPageId = "${realPageId}";`
173
173
  );
174
174
 
175
175
  assert(modifiedFtlFileContent !== ftlFileContent);
@@ -8,7 +8,6 @@ import type { BuildContext } from "../../shared/buildContext";
8
8
  import { assert } from "tsafe/assert";
9
9
  import {
10
10
  type ThemeType,
11
- nameOfTheGlobal,
12
11
  basenameOfTheKeycloakifyResourcesDir,
13
12
  resources_common,
14
13
  nameOfTheLocalizationRealmOverridesUserProfileProperty
@@ -116,7 +115,7 @@ export function generateFtlFilesCodeFactory(params: {
116
115
  }
117
116
 
118
117
  //FTL is no valid html, we can't insert with cheerio, we put placeholder for injecting later.
119
- const ftlObjectToJsCodeDeclaringAnObject = fs
118
+ const kcContextDeclarationTemplateFtl = fs
120
119
  .readFileSync(
121
120
  pathJoin(
122
121
  getThisCodebaseRootDirPath(),
@@ -124,11 +123,10 @@ export function generateFtlFilesCodeFactory(params: {
124
123
  "bin",
125
124
  "keycloakify",
126
125
  "generateFtl",
127
- "ftl_object_to_js_code_declaring_an_object.ftl"
126
+ "kcContextDeclarationTemplate.ftl"
128
127
  )
129
128
  )
130
129
  .toString("utf8")
131
- .match(/^<script>const _=((?:.|\n)+)<\/script>[\n]?$/)![1]
132
130
  .replace(
133
131
  "FIELD_NAMES_eKsIY4ZsZ4xeM",
134
132
  fieldNames.map(name => `"${name}"`).join(", ")
@@ -150,7 +148,7 @@ export function generateFtlFilesCodeFactory(params: {
150
148
  '{ "x": "vIdLqMeOed9sdLdIdOxdK0d" }';
151
149
 
152
150
  $("head").prepend(
153
- `<script>\nwindow.${nameOfTheGlobal}=${ftlObjectToJsCodeDeclaringAnObjectPlaceholder}</script>`
151
+ `<script>\n${ftlObjectToJsCodeDeclaringAnObjectPlaceholder}\n</script>`
154
152
  );
155
153
 
156
154
  // Remove part of the document marked as ignored.
@@ -189,7 +187,7 @@ export function generateFtlFilesCodeFactory(params: {
189
187
 
190
188
  Object.entries({
191
189
  [ftlObjectToJsCodeDeclaringAnObjectPlaceholder]:
192
- ftlObjectToJsCodeDeclaringAnObject,
190
+ kcContextDeclarationTemplateFtl,
193
191
  PAGE_ID_xIgLsPgGId9D8e: pageId
194
192
  }).map(
195
193
  ([searchValue, replaceValue]) =>
@@ -1,10 +1,8 @@
1
- <script>const _=
2
- (()=>{
3
1
  <#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
4
- const out = ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
5
- if( out.messagesPerField ){
6
- var existsError_singleFieldName = out.messagesPerField.existsError;
7
- out.messagesPerField.existsError = function (){
2
+ const kcContext = ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
3
+ if( kcContext.messagesPerField ){
4
+ var existsError_singleFieldName = kcContext.messagesPerField.existsError;
5
+ kcContext.messagesPerField.existsError = function (){
8
6
  for( let i = 0; i < arguments.length; i++ ){
9
7
  if( existsError_singleFieldName(arguments[i]) ){
10
8
  return true;
@@ -12,31 +10,31 @@ if( out.messagesPerField ){
12
10
  }
13
11
  return false;
14
12
  };
15
- out.messagesPerField.exists = function (fieldName) {
16
- return out.messagesPerField.get(fieldName) !== "";
13
+ kcContext.messagesPerField.exists = function (fieldName) {
14
+ return kcContext.messagesPerField.get(fieldName) !== "";
17
15
  };
18
- out.messagesPerField.printIfExists = function (fieldName, text) {
19
- return out.messagesPerField.exists(fieldName) ? text : undefined;
16
+ kcContext.messagesPerField.printIfExists = function (fieldName, text) {
17
+ return kcContext.messagesPerField.exists(fieldName) ? text : undefined;
20
18
  };
21
- out.messagesPerField.getFirstError = function () {
19
+ kcContext.messagesPerField.getFirstError = function () {
22
20
  for( let i = 0; i < arguments.length; i++ ){
23
21
  const fieldName = arguments[i];
24
- if( out.messagesPerField.existsError(fieldName) ){
25
- return out.messagesPerField.get(fieldName);
22
+ if( kcContext.messagesPerField.existsError(fieldName) ){
23
+ return kcContext.messagesPerField.get(fieldName);
26
24
  }
27
25
  }
28
26
  };
29
27
  }
30
- out.keycloakifyVersion = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
31
- out.themeVersion = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
32
- out.themeType = "KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr";
33
- out.themeName = "KEYCLOAKIFY_THEME_NAME_cXxKd3xEer";
34
- out.pageId = "${pageId}";
35
- if( out.url && out.url.resourcesPath ){
36
- out.url.resourcesCommonPath = out.url.resourcesPath + "/" + "RESOURCES_COMMON_cLsLsMrtDkpVv";
28
+ kcContext.keycloakifyVersion = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
29
+ kcContext.themeVersion = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
30
+ kcContext.themeType = "KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr";
31
+ kcContext.themeName = "KEYCLOAKIFY_THEME_NAME_cXxKd3xEer";
32
+ kcContext.pageId = "${pageId}";
33
+ if( kcContext.url && kcContext.url.resourcesPath ){
34
+ kcContext.url.resourcesCommonPath = kcContext.url.resourcesPath + "/" + "RESOURCES_COMMON_cLsLsMrtDkpVv";
37
35
  }
38
36
  <#if profile?? && profile.attributes??>
39
- out.lOCALIZATION_REALM_OVERRIDES_USER_PROFILE_PROPERTY_KEY_aaGLsPgGIdeeX = {
37
+ kcContext.lOCALIZATION_REALM_OVERRIDES_USER_PROFILE_PROPERTY_KEY_aaGLsPgGIdeeX = {
40
38
  <#list profile.attributes as attribute>
41
39
  <#if attribute.annotations?? && attribute.displayName??>
42
40
  "${attribute.displayName}": decodeHtmlEntities("${advancedMsg(attribute.displayName)?js_string}"),
@@ -64,21 +62,20 @@ if( out.url && out.url.resourcesPath ){
64
62
  };
65
63
  </#if>
66
64
  attributes_to_attributesByName: {
67
- if( !out.profile ){
65
+ if( !kcContext.profile ){
68
66
  break attributes_to_attributesByName;
69
67
  }
70
- if( !out.profile.attributes ){
68
+ if( !kcContext.profile.attributes ){
71
69
  break attributes_to_attributesByName;
72
70
  }
73
- var attributes = out.profile.attributes;
74
- delete out.profile.attributes;
75
- out.profile.attributesByName = {};
71
+ var attributes = kcContext.profile.attributes;
72
+ delete kcContext.profile.attributes;
73
+ kcContext.profile.attributesByName = {};
76
74
  attributes.forEach(function(attribute){
77
- out.profile.attributesByName[attribute.name] = attribute;
75
+ kcContext.profile.attributesByName[attribute.name] = attribute;
78
76
  });
79
77
  }
80
- return out;
81
-
78
+ window.kcContext = kcContext;
82
79
  function decodeHtmlEntities(htmlStr){
83
80
  var element = decodeHtmlEntities.element;
84
81
  if (!element) {
@@ -88,7 +85,7 @@ function decodeHtmlEntities(htmlStr){
88
85
  element.innerHTML = htmlStr;
89
86
  return element.value;
90
87
  }
91
- })();
88
+
92
89
  <#function ftl_object_to_js_code_declaring_an_object object path>
93
90
 
94
91
  <#local isHash = "">
@@ -341,7 +338,7 @@ function decodeHtmlEntities(htmlStr){
341
338
  <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
342
339
 
343
340
  <#if messagesPerField.exists('username') || messagesPerField.exists('password')>
344
- <#local jsFunctionCode += "return out.message && out.message.summary ? out.message.summary : 'error'; ">
341
+ <#local jsFunctionCode += "return kcContext.message && kcContext.message.summary ? kcContext.message.summary : 'error'; ">
345
342
  <#else>
346
343
  <#local jsFunctionCode += "return ''; ">
347
344
  </#if>
@@ -551,5 +548,4 @@ function decodeHtmlEntities(htmlStr){
551
548
 
552
549
  <#function are_same_path path searchedPath>
553
550
  <#return path?size == searchedPath?size && is_subpath(path, searchedPath)>
554
- </#function>
555
- </script>
551
+ </#function>
@@ -1,7 +1,4 @@
1
- import {
2
- nameOfTheGlobal,
3
- basenameOfTheKeycloakifyResourcesDir
4
- } from "../../../shared/constants";
1
+ import { basenameOfTheKeycloakifyResourcesDir } from "../../../shared/constants";
5
2
  import { assert } from "tsafe/assert";
6
3
  import type { BuildContext } from "../../../shared/buildContext";
7
4
  import * as nodePath from "path";
@@ -88,13 +85,13 @@ export function replaceImportsInJsCode_vite(params: {
88
85
  fixedJsCode = replaceAll(
89
86
  fixedJsCode,
90
87
  `"${relativePathOfAssetFile}"`,
91
- `(window.${nameOfTheGlobal}.url.resourcesPath.substring(1) + "/${basenameOfTheKeycloakifyResourcesDir}/${relativePathOfAssetFile}")`
88
+ `(window.kcContext.url.resourcesPath.substring(1) + "/${basenameOfTheKeycloakifyResourcesDir}/${relativePathOfAssetFile}")`
92
89
  );
93
90
 
94
91
  fixedJsCode = replaceAll(
95
92
  fixedJsCode,
96
93
  `"${buildContext.urlPathname ?? "/"}${relativePathOfAssetFile}"`,
97
- `(window.${nameOfTheGlobal}.url.resourcesPath + "/${basenameOfTheKeycloakifyResourcesDir}/${relativePathOfAssetFile}")`
94
+ `(window.kcContext.url.resourcesPath + "/${basenameOfTheKeycloakifyResourcesDir}/${relativePathOfAssetFile}")`
98
95
  );
99
96
  });
100
97
  }
@@ -1,7 +1,4 @@
1
- import {
2
- nameOfTheGlobal,
3
- basenameOfTheKeycloakifyResourcesDir
4
- } from "../../../shared/constants";
1
+ import { basenameOfTheKeycloakifyResourcesDir } from "../../../shared/constants";
5
2
  import { assert } from "tsafe/assert";
6
3
  import type { BuildContext } from "../../../shared/buildContext";
7
4
  import * as nodePath from "path";
@@ -86,7 +83,7 @@ export function replaceImportsInJsCode_webpack(params: {
86
83
  var pd = Object.getOwnPropertyDescriptor(${n}, "p");
87
84
  if( pd === undefined || pd.configurable ){
88
85
  Object.defineProperty(${n}, "p", {
89
- get: function() { return window.${nameOfTheGlobal}.url.resourcesPath; },
86
+ get: function() { return window.kcContext.url.resourcesPath; },
90
87
  set: function() {}
91
88
  });
92
89
  }
@@ -107,7 +104,7 @@ export function replaceImportsInJsCode_webpack(params: {
107
104
  `[a-zA-Z]+\\.[a-zA-Z]+\\+"${staticDir.replace(/\//g, "\\/")}`,
108
105
  "g"
109
106
  ),
110
- `window.${nameOfTheGlobal}.url.resourcesPath + "/${basenameOfTheKeycloakifyResourcesDir}/${staticDir}`
107
+ `window.kcContext.url.resourcesPath + "/${basenameOfTheKeycloakifyResourcesDir}/${staticDir}`
111
108
  );
112
109
 
113
110
  return { fixedJsCode };
@@ -1,4 +1,3 @@
1
- export const nameOfTheGlobal = "kcContext";
2
1
  export const nameOfTheLocalizationRealmOverridesUserProfileProperty =
3
2
  "__localizationRealmOverridesUserProfile";
4
3
  export const keycloak_resources = "keycloak-resources";
@@ -79,8 +79,16 @@ export async function getProxyFetchOptions(params: {
79
79
  }
80
80
 
81
81
  const cafileContent = await readFile(cafile, "utf-8");
82
+
83
+ const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
84
+
82
85
  return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(
83
- ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n")
86
+ ca =>
87
+ ca
88
+ .join("")
89
+ .replace(/\r?\n/g, newLinePlaceholder)
90
+ .replace(new RegExp(`^${newLinePlaceholder}`), "")
91
+ .replace(new RegExp(newLinePlaceholder, "g"), "\\n")
84
92
  );
85
93
  })())
86
94
  );
@@ -109,7 +109,7 @@ export async function extractArchive(params: {
109
109
  zipFile.on("entry", async (entry: yauzl.Entry) => {
110
110
  handle_file: {
111
111
  // NOTE: Skip directories
112
- if (entry.fileName.endsWith(pathSep)) {
112
+ if (entry.fileName.endsWith("/")) {
113
113
  break handle_file;
114
114
  }
115
115
 
@@ -1,7 +1,6 @@
1
1
  import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
2
2
  import type { Plugin } from "vite";
3
3
  import {
4
- nameOfTheGlobal,
5
4
  basenameOfTheKeycloakifyResourcesDir,
6
5
  keycloak_resources,
7
6
  vitePluginSubScriptEnvNames
@@ -170,9 +169,9 @@ export function keycloakify(params?: Params) {
170
169
  /import\.meta\.env(?:(?:\.BASE_URL)|(?:\["BASE_URL"\]))/g,
171
170
  [
172
171
  `(`,
173
- `(window.${nameOfTheGlobal} === undefined || import.meta.env.MODE === "development")?`,
172
+ `(window.kcContext === undefined || import.meta.env.MODE === "development")?`,
174
173
  `"${urlPathname ?? "/"}":`,
175
- `(window.${nameOfTheGlobal}.url.resourcesPath + "/${basenameOfTheKeycloakifyResourcesDir}/")`,
174
+ `(window.kcContext.url.resourcesPath + "/${basenameOfTheKeycloakifyResourcesDir}/")`,
176
175
  `)`
177
176
  ].join("")
178
177
  );
@@ -4276,14 +4276,12 @@ __nccwpck_require__.r(__webpack_exports__);
4276
4276
  /* harmony export */ "keycloak_resources": () => (/* binding */ keycloak_resources),
4277
4277
  /* harmony export */ "lastKeycloakVersionWithAccountV1": () => (/* binding */ lastKeycloakVersionWithAccountV1),
4278
4278
  /* harmony export */ "loginThemePageIds": () => (/* binding */ loginThemePageIds),
4279
- /* harmony export */ "nameOfTheGlobal": () => (/* binding */ nameOfTheGlobal),
4280
4279
  /* harmony export */ "nameOfTheLocalizationRealmOverridesUserProfileProperty": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
4281
4280
  /* harmony export */ "onlyBuildJarFileBasenameEnvName": () => (/* binding */ onlyBuildJarFileBasenameEnvName),
4282
4281
  /* harmony export */ "resources_common": () => (/* binding */ resources_common),
4283
4282
  /* harmony export */ "themeTypes": () => (/* binding */ themeTypes),
4284
4283
  /* harmony export */ "vitePluginSubScriptEnvNames": () => (/* binding */ vitePluginSubScriptEnvNames)
4285
4284
  /* harmony export */ });
4286
- const nameOfTheGlobal = "kcContext";
4287
4285
  const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
4288
4286
  const keycloak_resources = "keycloak-resources";
4289
4287
  const resources_common = "resources-common";
@@ -4542,7 +4540,7 @@ async function extractArchive(params) {
4542
4540
  zipFile.on("entry", async (entry) => {
4543
4541
  handle_file: {
4544
4542
  // NOTE: Skip directories
4545
- if (entry.fileName.endsWith(external_path_.sep)) {
4543
+ if (entry.fileName.endsWith("/")) {
4546
4544
  break handle_file;
4547
4545
  }
4548
4546
  let hasEarlyExitBeenCalled = false;
@@ -4627,7 +4625,12 @@ async function getProxyFetchOptions(params) {
4627
4625
  .filter(Boolean);
4628
4626
  }
4629
4627
  const cafileContent = await (0,promises_.readFile)(cafile, "utf-8");
4630
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n"));
4628
+ const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt";
4629
+ return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca
4630
+ .join("")
4631
+ .replace(/\r?\n/g, newLinePlaceholder)
4632
+ .replace(new RegExp(`^${newLinePlaceholder}`), "")
4633
+ .replace(new RegExp(newLinePlaceholder, "g"), "\\n"));
4631
4634
  })()));
4632
4635
  }
4633
4636
  return {
@@ -5520,9 +5523,9 @@ function keycloakify(params) {
5520
5523
  const transformedCode = new magic_string_1.default(code);
5521
5524
  transformedCode.replaceAll(/import\.meta\.env(?:(?:\.BASE_URL)|(?:\["BASE_URL"\]))/g, [
5522
5525
  `(`,
5523
- `(window.${constants_1.nameOfTheGlobal} === undefined || import.meta.env.MODE === "development")?`,
5526
+ `(window.kcContext === undefined || import.meta.env.MODE === "development")?`,
5524
5527
  `"${urlPathname !== null && urlPathname !== void 0 ? urlPathname : "/"}":`,
5525
- `(window.${constants_1.nameOfTheGlobal}.url.resourcesPath + "/${constants_1.basenameOfTheKeycloakifyResourcesDir}/")`,
5528
+ `(window.kcContext.url.resourcesPath + "/${constants_1.basenameOfTheKeycloakifyResourcesDir}/")`,
5526
5529
  `)`
5527
5530
  ].join(""));
5528
5531
  if (!transformedCode.hasChanged()) {
@@ -1,96 +0,0 @@
1
- import { exec as execCallback } from "child_process";
2
- import { readFile } from "fs/promises";
3
- import { type FetchOptions } from "make-fetch-happen";
4
- import { promisify } from "util";
5
-
6
- function ensureArray<T>(arg0: T | T[]) {
7
- return Array.isArray(arg0) ? arg0 : typeof arg0 === "undefined" ? [] : [arg0];
8
- }
9
-
10
- function ensureSingleOrNone<T>(arg0: T | T[]) {
11
- if (!Array.isArray(arg0)) return arg0;
12
- if (arg0.length === 0) return undefined;
13
- if (arg0.length === 1) return arg0[0];
14
- throw new Error(
15
- "Illegal configuration, expected a single value but found multiple: " +
16
- arg0.map(String).join(", ")
17
- );
18
- }
19
-
20
- type NPMConfig = Record<string, string | string[]>;
21
-
22
- /**
23
- * Get npm configuration as map
24
- */
25
- async function getNmpConfig(params: { npmWorkspaceRootDirPath: string }) {
26
- const { npmWorkspaceRootDirPath } = params;
27
-
28
- const exec = promisify(execCallback);
29
-
30
- const stdout = await exec("npm config get", {
31
- encoding: "utf8",
32
- cwd: npmWorkspaceRootDirPath
33
- }).then(({ stdout }) => stdout);
34
-
35
- const npmConfigReducer = (cfg: NPMConfig, [key, value]: [string, string]) =>
36
- key in cfg
37
- ? { ...cfg, [key]: [...ensureArray(cfg[key]), value] }
38
- : { ...cfg, [key]: value };
39
-
40
- return stdout
41
- .split("\n")
42
- .filter(line => !line.startsWith(";"))
43
- .map(line => line.trim())
44
- .map(line => line.split("=", 2) as [string, string])
45
- .reduce(npmConfigReducer, {} as NPMConfig);
46
- }
47
-
48
- export type ProxyFetchOptions = Pick<
49
- FetchOptions,
50
- "proxy" | "noProxy" | "strictSSL" | "cert" | "ca"
51
- >;
52
-
53
- export async function getProxyFetchOptions(params: {
54
- npmWorkspaceRootDirPath: string;
55
- }): Promise<ProxyFetchOptions> {
56
- const { npmWorkspaceRootDirPath } = params;
57
-
58
- const cfg = await getNmpConfig({ npmWorkspaceRootDirPath });
59
-
60
- const proxy = ensureSingleOrNone(cfg["https-proxy"] ?? cfg["proxy"]);
61
- const noProxy = cfg["noproxy"] ?? cfg["no-proxy"];
62
-
63
- function maybeBoolean(arg0: string | undefined) {
64
- return typeof arg0 === "undefined" ? undefined : Boolean(arg0);
65
- }
66
-
67
- const strictSSL = maybeBoolean(ensureSingleOrNone(cfg["strict-ssl"]));
68
- const cert = cfg["cert"];
69
- const ca = ensureArray(cfg["ca"] ?? cfg["ca[]"]);
70
- const cafile = ensureSingleOrNone(cfg["cafile"]);
71
-
72
- if (typeof cafile !== "undefined" && cafile !== "null") {
73
- ca.push(
74
- ...(await (async () => {
75
- function chunks<T>(arr: T[], size: number = 2) {
76
- return arr
77
- .map((_, i) => i % size == 0 && arr.slice(i, i + size))
78
- .filter(Boolean) as T[][];
79
- }
80
-
81
- const cafileContent = await readFile(cafile, "utf-8");
82
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(
83
- ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n")
84
- );
85
- })())
86
- );
87
- }
88
-
89
- return {
90
- proxy,
91
- noProxy,
92
- strictSSL,
93
- cert,
94
- ca: ca.length === 0 ? undefined : ca
95
- };
96
- }