keycloakify 10.0.0-rc.75 → 10.0.0-rc.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/440.index.js CHANGED
@@ -351,9 +351,10 @@ const { readAssetsDirSync } = (() => {
351
351
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/replacers/replaceImportsInCssCode.js
352
352
 
353
353
 
354
+
354
355
  (0,assert.assert)();
355
356
  function replaceImportsInCssCode(params) {
356
- const { cssCode, fileRelativeDirPath, buildContext } = params;
357
+ const { cssCode, cssFileRelativeDirPath, buildContext } = params;
357
358
  const fixedCssCode = cssCode.replace(/url\(["']?(\/[^/][^)"']+)["']?\)/g, (match, assetFileAbsoluteUrlPathname) => {
358
359
  if (buildContext.urlPathname !== undefined) {
359
360
  if (!assetFileAbsoluteUrlPathname.startsWith(buildContext.urlPathname)) {
@@ -362,7 +363,13 @@ function replaceImportsInCssCode(params) {
362
363
  }
363
364
  assetFileAbsoluteUrlPathname = assetFileAbsoluteUrlPathname.replace(buildContext.urlPathname, "/");
364
365
  }
365
- const assetFileRelativeUrlPathname = external_path_.posix.relative(fileRelativeDirPath.replace(/\\/g, "/"), assetFileAbsoluteUrlPathname.replace(/^\//, ""));
366
+ inline_style_in_html: {
367
+ if (cssFileRelativeDirPath !== undefined) {
368
+ break inline_style_in_html;
369
+ }
370
+ return `url(\${url.resourcesPath}/${constants/* basenameOfTheKeycloakifyResourcesDir */.M}${assetFileAbsoluteUrlPathname})`;
371
+ }
372
+ const assetFileRelativeUrlPathname = external_path_.posix.relative(cssFileRelativeDirPath.replace(/\\/g, "/"), assetFileAbsoluteUrlPathname.replace(/^\//, ""));
366
373
  return `url(${assetFileRelativeUrlPathname})`;
367
374
  });
368
375
  return { fixedCssCode };
@@ -401,7 +408,7 @@ function generateFtlFilesCodeFactory(params) {
401
408
  (0,assert.assert)(cssCode !== null);
402
409
  const { fixedCssCode } = replaceImportsInCssCode({
403
410
  cssCode,
404
- fileRelativeDirPath: ".",
411
+ cssFileRelativeDirPath: undefined,
405
412
  buildContext
406
413
  });
407
414
  $(element).text(fixedCssCode);
@@ -727,7 +734,7 @@ async function generateResourcesForMainTheme(params) {
727
734
  if (filePath.endsWith(".css")) {
728
735
  const { fixedCssCode } = replaceImportsInCssCode({
729
736
  cssCode: sourceCode.toString("utf8"),
730
- fileRelativeDirPath: (0,external_path_.dirname)(fileRelativePath),
737
+ cssFileRelativeDirPath: (0,external_path_.dirname)(fileRelativePath),
731
738
  buildContext
732
739
  });
733
740
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "10.0.0-rc.75",
3
+ "version": "10.0.0-rc.76",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,7 +64,7 @@ export function generateFtlFilesCodeFactory(params: {
64
64
 
65
65
  const { fixedCssCode } = replaceImportsInCssCode({
66
66
  cssCode,
67
- fileRelativeDirPath: ".",
67
+ cssFileRelativeDirPath: undefined,
68
68
  buildContext
69
69
  });
70
70
 
@@ -134,7 +134,7 @@ export async function generateResourcesForMainTheme(params: {
134
134
  if (filePath.endsWith(".css")) {
135
135
  const { fixedCssCode } = replaceImportsInCssCode({
136
136
  cssCode: sourceCode.toString("utf8"),
137
- fileRelativeDirPath: pathDirname(fileRelativePath),
137
+ cssFileRelativeDirPath: pathDirname(fileRelativePath),
138
138
  buildContext
139
139
  });
140
140
 
@@ -1,4 +1,5 @@
1
1
  import type { BuildContext } from "../../shared/buildContext";
2
+ import { basenameOfTheKeycloakifyResourcesDir } from "../../shared/constants";
2
3
  import { assert } from "tsafe/assert";
3
4
  import { posix } from "path";
4
5
 
@@ -10,12 +11,12 @@ assert<BuildContext extends BuildContextLike ? true : false>();
10
11
 
11
12
  export function replaceImportsInCssCode(params: {
12
13
  cssCode: string;
13
- fileRelativeDirPath: string;
14
+ cssFileRelativeDirPath: string | undefined;
14
15
  buildContext: BuildContextLike;
15
16
  }): {
16
17
  fixedCssCode: string;
17
18
  } {
18
- const { cssCode, fileRelativeDirPath, buildContext } = params;
19
+ const { cssCode, cssFileRelativeDirPath, buildContext } = params;
19
20
 
20
21
  const fixedCssCode = cssCode.replace(
21
22
  /url\(["']?(\/[^/][^)"']+)["']?\)/g,
@@ -31,8 +32,16 @@ export function replaceImportsInCssCode(params: {
31
32
  );
32
33
  }
33
34
 
35
+ inline_style_in_html: {
36
+ if (cssFileRelativeDirPath !== undefined) {
37
+ break inline_style_in_html;
38
+ }
39
+
40
+ return `url(\${url.resourcesPath}/${basenameOfTheKeycloakifyResourcesDir}${assetFileAbsoluteUrlPathname})`;
41
+ }
42
+
34
43
  const assetFileRelativeUrlPathname = posix.relative(
35
- fileRelativeDirPath.replace(/\\/g, "/"),
44
+ cssFileRelativeDirPath.replace(/\\/g, "/"),
36
45
  assetFileAbsoluteUrlPathname.replace(/^\//, "")
37
46
  );
38
47