keycloakify 10.0.0-rc.112 → 10.0.0-rc.114

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
@@ -355,23 +355,29 @@ const { readAssetsDirSync } = (() => {
355
355
  (0,assert.assert)();
356
356
  function replaceImportsInCssCode(params) {
357
357
  const { cssCode, cssFileRelativeDirPath, buildContext } = params;
358
- const fixedCssCode = cssCode.replace(/url\(["']?(\/[^/][^)"']+)["']?\)/g, (match, assetFileAbsoluteUrlPathname) => {
358
+ let fixedCssCode = cssCode;
359
+ [
360
+ /url\("(\/[^/][^"]+)"\)/g,
361
+ /url\('(\/[^/][^']+)'\)/g,
362
+ /url\((\/[^/][^)]+)\)/g
363
+ ].forEach(regex => (fixedCssCode = fixedCssCode.replace(regex, (match, assetFileAbsoluteUrlPathname) => {
359
364
  if (buildContext.urlPathname !== undefined) {
360
365
  if (!assetFileAbsoluteUrlPathname.startsWith(buildContext.urlPathname)) {
361
366
  // NOTE: Should never happen
362
367
  return match;
363
368
  }
364
- assetFileAbsoluteUrlPathname = assetFileAbsoluteUrlPathname.replace(buildContext.urlPathname, "/");
369
+ assetFileAbsoluteUrlPathname =
370
+ assetFileAbsoluteUrlPathname.replace(buildContext.urlPathname, "/");
365
371
  }
366
372
  inline_style_in_html: {
367
373
  if (cssFileRelativeDirPath !== undefined) {
368
374
  break inline_style_in_html;
369
375
  }
370
- return `url(\${xKeycloakify.resourcesPath}/${constants/* BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR */.F_}${assetFileAbsoluteUrlPathname})`;
376
+ return `url("\${xKeycloakify.resourcesPath}/${constants/* BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR */.F_}${assetFileAbsoluteUrlPathname}")`;
371
377
  }
372
378
  const assetFileRelativeUrlPathname = external_path_.posix.relative(cssFileRelativeDirPath.replace(/\\/g, "/"), assetFileAbsoluteUrlPathname.replace(/^\//, ""));
373
- return `url(${assetFileRelativeUrlPathname})`;
374
- });
379
+ return `url("${assetFileRelativeUrlPathname}")`;
380
+ })));
375
381
  return { fixedCssCode };
376
382
  }
377
383
  //# sourceMappingURL=replaceImportsInCssCode.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "10.0.0-rc.112",
3
+ "version": "10.0.0-rc.114",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,35 +18,49 @@ export function replaceImportsInCssCode(params: {
18
18
  } {
19
19
  const { cssCode, cssFileRelativeDirPath, buildContext } = params;
20
20
 
21
- const fixedCssCode = cssCode.replace(
22
- /url\(["']?(\/[^/][^)"']+)["']?\)/g,
23
- (match, assetFileAbsoluteUrlPathname) => {
24
- if (buildContext.urlPathname !== undefined) {
25
- if (!assetFileAbsoluteUrlPathname.startsWith(buildContext.urlPathname)) {
26
- // NOTE: Should never happen
27
- return match;
28
- }
29
- assetFileAbsoluteUrlPathname = assetFileAbsoluteUrlPathname.replace(
30
- buildContext.urlPathname,
31
- "/"
32
- );
33
- }
34
-
35
- inline_style_in_html: {
36
- if (cssFileRelativeDirPath !== undefined) {
37
- break inline_style_in_html;
38
- }
21
+ let fixedCssCode = cssCode;
22
+
23
+ [
24
+ /url\("(\/[^/][^"]+)"\)/g,
25
+ /url\('(\/[^/][^']+)'\)/g,
26
+ /url\((\/[^/][^)]+)\)/g
27
+ ].forEach(
28
+ regex =>
29
+ (fixedCssCode = fixedCssCode.replace(
30
+ regex,
31
+ (match, assetFileAbsoluteUrlPathname) => {
32
+ if (buildContext.urlPathname !== undefined) {
33
+ if (
34
+ !assetFileAbsoluteUrlPathname.startsWith(
35
+ buildContext.urlPathname
36
+ )
37
+ ) {
38
+ // NOTE: Should never happen
39
+ return match;
40
+ }
41
+ assetFileAbsoluteUrlPathname =
42
+ assetFileAbsoluteUrlPathname.replace(
43
+ buildContext.urlPathname,
44
+ "/"
45
+ );
46
+ }
39
47
 
40
- return `url(\${xKeycloakify.resourcesPath}/${BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR}${assetFileAbsoluteUrlPathname})`;
41
- }
48
+ inline_style_in_html: {
49
+ if (cssFileRelativeDirPath !== undefined) {
50
+ break inline_style_in_html;
51
+ }
42
52
 
43
- const assetFileRelativeUrlPathname = posix.relative(
44
- cssFileRelativeDirPath.replace(/\\/g, "/"),
45
- assetFileAbsoluteUrlPathname.replace(/^\//, "")
46
- );
53
+ return `url("\${xKeycloakify.resourcesPath}/${BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR}${assetFileAbsoluteUrlPathname}")`;
54
+ }
47
55
 
48
- return `url(${assetFileRelativeUrlPathname})`;
49
- }
56
+ const assetFileRelativeUrlPathname = posix.relative(
57
+ cssFileRelativeDirPath.replace(/\\/g, "/"),
58
+ assetFileAbsoluteUrlPathname.replace(/^\//, "")
59
+ );
60
+
61
+ return `url("${assetFileRelativeUrlPathname}")`;
62
+ }
63
+ ))
50
64
  );
51
65
 
52
66
  return { fixedCssCode };