keycloakify 9.4.0-rc.8 → 9.4.0-rc.9

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.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * This is an equivalent of process.env.PUBLIC_URL thay you can use in Webpack projects.
3
3
  * This works both in your main app and in your Keycloak theme.
4
4
  */
5
- export declare const PUBLIC_URL: string | undefined;
5
+ export declare const PUBLIC_URL: string;
package/PUBLIC_URL.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "./bin/constants";
2
+ import { assert } from "tsafe/assert";
2
3
  /**
3
4
  * This is an equivalent of process.env.PUBLIC_URL thay you can use in Webpack projects.
4
5
  * This works both in your main app and in your Keycloak theme.
5
6
  */
6
7
  export const PUBLIC_URL = (() => {
7
8
  const kcContext = window[nameOfTheGlobal];
8
- return kcContext === undefined || process.env.NODE_ENV === "development"
9
- ? process.env.PUBLIC_URL
10
- : `${kcContext.url.resourcesPath}/${basenameOfTheKeycloakifyResourcesDir}`;
9
+ if (kcContext === undefined || process.env.NODE_ENV === "development") {
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
+ return process.env.PUBLIC_URL;
12
+ }
13
+ return `${kcContext.url.resourcesPath}/${basenameOfTheKeycloakifyResourcesDir}`;
11
14
  })();
12
15
  //# sourceMappingURL=PUBLIC_URL.js.map
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,EAAE,eAAe,EAAE,oCAAoC,EAAE,MAAM,2BAA2B,CAAC;AAElG;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE;IAC5B,MAAM,SAAS,GAAI,MAAc,CAAC,eAAe,CAAC,CAAC;IAEnD,OAAO,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;QACpE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU;QACxB,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,aAAa,IAAI,oCAAoC,EAAE,CAAC;AACnF,CAAC,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"PUBLIC_URL.js","sourceRoot":"","sources":["src/PUBLIC_URL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC,EAAE,MAAM,2BAA2B,CAAC;AAClG,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "9.4.0-rc.8",
3
+ "version": "9.4.0-rc.9",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
package/src/PUBLIC_URL.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "keycloakify/bin/constants";
2
+ import { assert } from "tsafe/assert";
2
3
 
3
4
  /**
4
5
  * This is an equivalent of process.env.PUBLIC_URL thay you can use in Webpack projects.
@@ -7,7 +8,14 @@ import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "keycloaki
7
8
  export const PUBLIC_URL = (() => {
8
9
  const kcContext = (window as any)[nameOfTheGlobal];
9
10
 
10
- return kcContext === undefined || process.env.NODE_ENV === "development"
11
- ? process.env.PUBLIC_URL
12
- : `${kcContext.url.resourcesPath}/${basenameOfTheKeycloakifyResourcesDir}`;
11
+ if (kcContext === undefined || process.env.NODE_ENV === "development") {
12
+ assert(
13
+ process.env.PUBLIC_URL !== undefined,
14
+ `If you use keycloakify/PUBLIC_URL you should be in Webpack and thus process.env.PUBLIC_URL should be defined`
15
+ );
16
+
17
+ return process.env.PUBLIC_URL;
18
+ }
19
+
20
+ return `${kcContext.url.resourcesPath}/${basenameOfTheKeycloakifyResourcesDir}`;
13
21
  })();