keycloakify 10.0.0-rc.63 → 10.0.0-rc.65

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 (34) hide show
  1. package/account/KcContext/KcContext.d.ts +1 -0
  2. package/account/KcContext/KcContext.js.map +1 -1
  3. package/account/KcContext/kcContextMocks.js +2 -1
  4. package/account/KcContext/kcContextMocks.js.map +1 -1
  5. package/account/pages/Totp.js +2 -7
  6. package/account/pages/Totp.js.map +1 -1
  7. package/bin/190.index.js +67 -101
  8. package/bin/{991.index.js → 203.index.js} +40 -19
  9. package/bin/{952.index.js → 363.index.js} +174 -154
  10. package/bin/{214.index.js → 430.index.js} +2 -161
  11. package/bin/526.index.js +130 -90
  12. package/bin/538.index.js +37 -28
  13. package/bin/{98.index.js → 827.index.js} +39 -187
  14. package/bin/{941.index.js → 890.index.js} +159 -2
  15. package/bin/932.index.js +104 -129
  16. package/bin/97.index.js +1 -1
  17. package/bin/main.js +7 -7
  18. package/package.json +9 -8
  19. package/src/account/KcContext/KcContext.ts +1 -0
  20. package/src/account/KcContext/kcContextMocks.ts +2 -1
  21. package/src/account/pages/Totp.tsx +1 -7
  22. package/src/bin/add-story.ts +1 -1
  23. package/src/bin/keycloakify/buildJars/buildJar.ts +24 -27
  24. package/src/bin/keycloakify/buildJars/buildJars.ts +5 -5
  25. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +8 -6
  26. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +33 -32
  27. package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +22 -26
  28. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +135 -108
  29. package/src/bin/shared/getImplementedThemeTypes.ts +38 -0
  30. package/src/bin/shared/getThemeSrcDirPath.ts +44 -32
  31. package/src/bin/shared/metaInfKeycloakThemes.ts +16 -60
  32. package/src/bin/start-keycloak/keycloakifyBuild.ts +1 -1
  33. package/src/bin/start-keycloak/start-keycloak.ts +35 -70
  34. package/vite-plugin/index.js +1917 -100
@@ -16,7 +16,7 @@ import { readFileSync } from "fs";
16
16
  import { isInside } from "../../tools/isInside";
17
17
  import child_process from "child_process";
18
18
  import { rmSync } from "../../tools/fs.rmSync";
19
- import { getMetaInfKeycloakThemesJsonFilePath } from "../../shared/metaInfKeycloakThemes";
19
+ import { writeMetaInfKeycloakThemes } from "../../shared/metaInfKeycloakThemes";
20
20
 
21
21
  export type BuildContextLike = BuildContextLike_generatePom & {
22
22
  keycloakifyBuildDirPath: string;
@@ -50,9 +50,16 @@ export async function buildJar(params: {
50
50
 
51
51
  rmSync(keycloakifyBuildTmpDirPath, { recursive: true, force: true });
52
52
 
53
+ const tmpResourcesDirPath = pathJoin(
54
+ keycloakifyBuildTmpDirPath,
55
+ "src",
56
+ "main",
57
+ "resources"
58
+ );
59
+
53
60
  transformCodebase({
54
61
  srcDirPath: resourcesDirPath,
55
- destDirPath: pathJoin(keycloakifyBuildTmpDirPath, "src", "main", "resources"),
62
+ destDirPath: tmpResourcesDirPath,
56
63
  transformSourceCode:
57
64
  keycloakAccountV1Version !== null
58
65
  ? undefined
@@ -71,31 +78,6 @@ export async function buildJar(params: {
71
78
  return undefined;
72
79
  }
73
80
 
74
- if (
75
- fileRelativePath ===
76
- getMetaInfKeycloakThemesJsonFilePath({
77
- resourcesDirPath: "."
78
- })
79
- ) {
80
- const keycloakThemesJsonParsed = JSON.parse(
81
- sourceCode.toString("utf8")
82
- ) as {
83
- themes: { name: string; types: string[] }[];
84
- };
85
-
86
- keycloakThemesJsonParsed.themes =
87
- keycloakThemesJsonParsed.themes.filter(
88
- ({ name }) => name !== accountV1ThemeName
89
- );
90
-
91
- return {
92
- modifiedSourceCode: Buffer.from(
93
- JSON.stringify(keycloakThemesJsonParsed, null, 2),
94
- "utf8"
95
- )
96
- };
97
- }
98
-
99
81
  for (const themeName of buildContext.themeNames) {
100
82
  if (
101
83
  fileRelativePath ===
@@ -123,6 +105,21 @@ export async function buildJar(params: {
123
105
  }
124
106
  });
125
107
 
108
+ if (keycloakAccountV1Version === null) {
109
+ writeMetaInfKeycloakThemes({
110
+ resourcesDirPath: tmpResourcesDirPath,
111
+ getNewMetaInfKeycloakTheme: ({ metaInfKeycloakTheme }) => {
112
+ assert(metaInfKeycloakTheme !== undefined);
113
+
114
+ metaInfKeycloakTheme.themes = metaInfKeycloakTheme.themes.filter(
115
+ ({ name }) => name !== accountV1ThemeName
116
+ );
117
+
118
+ return metaInfKeycloakTheme;
119
+ }
120
+ });
121
+ }
122
+
126
123
  route_legacy_pages: {
127
124
  // NOTE: If there's no account theme there is no special target for keycloak 24 and up so we create
128
125
  // the pages anyway. If there is an account pages, since we know that account-v1 is only support keycloak
@@ -8,10 +8,10 @@ import { getKeycloakVersionRangeForJar } from "./getKeycloakVersionRangeForJar";
8
8
  import { buildJar, BuildContextLike as BuildContextLike_buildJar } from "./buildJar";
9
9
  import type { BuildContext } from "../../shared/buildContext";
10
10
  import { getJarFileBasename } from "../../shared/getJarFileBasename";
11
- import { readMetaInfKeycloakThemes_fromResourcesDirPath } from "../../shared/metaInfKeycloakThemes";
12
- import { accountV1ThemeName } from "../../shared/constants";
11
+ import { getImplementedThemeTypes } from "../../shared/getImplementedThemeTypes";
13
12
 
14
13
  export type BuildContextLike = BuildContextLike_buildJar & {
14
+ projectDirPath: string;
15
15
  keycloakifyBuildDirPath: string;
16
16
  };
17
17
 
@@ -24,9 +24,9 @@ export async function buildJars(params: {
24
24
  }): Promise<void> {
25
25
  const { onlyBuildJarFileBasename, resourcesDirPath, buildContext } = params;
26
26
 
27
- const doesImplementAccountTheme = readMetaInfKeycloakThemes_fromResourcesDirPath({
28
- resourcesDirPath
29
- }).themes.some(({ name }) => name === accountV1ThemeName);
27
+ const doesImplementAccountTheme = getImplementedThemeTypes({
28
+ projectDirPath: buildContext.projectDirPath
29
+ }).implementedThemeTypes.account;
30
30
 
31
31
  await Promise.all(
32
32
  keycloakAccountV1Versions
@@ -305,12 +305,14 @@ function decodeHtmlEntities(htmlStr){
305
305
  </#if>
306
306
 
307
307
  <#if are_same_path(path, ["totp", "policy", "getAlgorithmKey"])>
308
- <#local returnValue = "">
309
- <#attempt>
310
- <#local returnValue = totp.policy.getAlgorithmKey()>
311
- <#recover>
312
- <#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
313
- </#attempt>
308
+ <#local returnValue = "error">
309
+ <#if mode?? && mode = "manual">
310
+ <#attempt>
311
+ <#local returnValue = totp.policy.getAlgorithmKey()>
312
+ <#recover>
313
+ <#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
314
+ </#attempt>
315
+ </#if>
314
316
  <#return 'function(){ return "' + returnValue + '"; }'>
315
317
  </#if>
316
318
 
@@ -1,6 +1,6 @@
1
1
  import { transformCodebase } from "../../tools/transformCodebase";
2
2
  import * as fs from "fs";
3
- import { join as pathJoin, resolve as pathResolve } from "path";
3
+ import { join as pathJoin, resolve as pathResolve, relative as pathRelative } from "path";
4
4
  import { replaceImportsInJsCode } from "../replacers/replaceImportsInJsCode";
5
5
  import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
6
6
  import {
@@ -16,7 +16,6 @@ import {
16
16
  loginThemePageIds,
17
17
  accountThemePageIds
18
18
  } from "../../shared/constants";
19
- import { isInside } from "../../tools/isInside";
20
19
  import type { BuildContext } from "../../shared/buildContext";
21
20
  import { assert, type Equals } from "tsafe/assert";
22
21
  import {
@@ -39,6 +38,7 @@ import {
39
38
  } from "../../shared/metaInfKeycloakThemes";
40
39
  import { objectEntries } from "tsafe/objectEntries";
41
40
  import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
41
+ import { getImplementedThemeTypes } from "../../shared/getImplementedThemeTypes";
42
42
 
43
43
  export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
44
44
  BuildContextLike_downloadKeycloakStaticResources &
@@ -63,6 +63,10 @@ export async function generateResourcesForMainTheme(params: {
63
63
  projectDirPath: buildContext.projectDirPath
64
64
  });
65
65
 
66
+ const { implementedThemeTypes } = getImplementedThemeTypes({
67
+ projectDirPath: buildContext.projectDirPath
68
+ });
69
+
66
70
  const getThemeTypeDirPath = (params: { themeType: ThemeType | "email" }) => {
67
71
  const { themeType } = params;
68
72
  return pathJoin(resourcesDirPath, "theme", themeName, themeType);
@@ -70,19 +74,11 @@ export async function generateResourcesForMainTheme(params: {
70
74
 
71
75
  const cssGlobalsToDefine: Record<string, string> = {};
72
76
 
73
- const implementedThemeTypes: Record<ThemeType | "email", boolean> = {
74
- login: false,
75
- account: false,
76
- email: false
77
- };
78
-
79
77
  for (const themeType of ["login", "account"] as const) {
80
- if (!fs.existsSync(pathJoin(themeSrcDirPath, themeType))) {
78
+ if (!implementedThemeTypes[themeType]) {
81
79
  continue;
82
80
  }
83
81
 
84
- implementedThemeTypes[themeType] = true;
85
-
86
82
  const themeTypeDirPath = getThemeTypeDirPath({ themeType });
87
83
 
88
84
  apply_replacers_and_move_to_theme_resources: {
@@ -112,25 +108,32 @@ export async function generateResourcesForMainTheme(params: {
112
108
  break apply_replacers_and_move_to_theme_resources;
113
109
  }
114
110
 
111
+ {
112
+ const dirPath = pathJoin(
113
+ buildContext.projectBuildDirPath,
114
+ keycloak_resources
115
+ );
116
+
117
+ if (fs.existsSync(dirPath)) {
118
+ assert(buildContext.bundler === "webpack");
119
+
120
+ throw new Error(
121
+ [
122
+ `Keycloakify build error: The ${keycloak_resources} directory shouldn't exist in your build directory.`,
123
+ `(${pathRelative(process.cwd(), dirPath)}).\n`,
124
+ `Theses assets are only required for local development with Storybook.",
125
+ "Please remove this directory as an additional step of your command.\n`,
126
+ `For example: \`"build": "... && rimraf ${pathRelative(buildContext.projectDirPath, dirPath)}"\``
127
+ ].join(" ")
128
+ );
129
+ }
130
+ }
131
+
115
132
  transformCodebase({
116
133
  srcDirPath: buildContext.projectBuildDirPath,
117
134
  destDirPath,
118
135
  transformSourceCode: ({ filePath, sourceCode }) => {
119
- //NOTE: Prevent cycles, excludes the folder we generated for debug in public/
120
- // This should not happen if users follow the new instruction setup but we keep it for retrocompatibility.
121
- if (
122
- isInside({
123
- dirPath: pathJoin(
124
- buildContext.projectBuildDirPath,
125
- keycloak_resources
126
- ),
127
- filePath
128
- })
129
- ) {
130
- return undefined;
131
- }
132
-
133
- if (/\.css?$/i.test(filePath)) {
136
+ if (filePath.endsWith(".css")) {
134
137
  const {
135
138
  cssGlobalsToDefine: cssGlobalsToDefineForThisFile,
136
139
  fixedCssCode
@@ -149,7 +152,7 @@ export async function generateResourcesForMainTheme(params: {
149
152
  };
150
153
  }
151
154
 
152
- if (/\.js?$/i.test(filePath)) {
155
+ if (filePath.endsWith(".js")) {
153
156
  const { fixedJsCode } = replaceImportsInJsCode({
154
157
  jsCode: sourceCode.toString("utf8"),
155
158
  buildContext
@@ -262,13 +265,11 @@ export async function generateResourcesForMainTheme(params: {
262
265
  }
263
266
 
264
267
  email: {
265
- const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
266
-
267
- if (!fs.existsSync(emailThemeSrcDirPath)) {
268
+ if (!implementedThemeTypes.email) {
268
269
  break email;
269
270
  }
270
271
 
271
- implementedThemeTypes.email = true;
272
+ const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
272
273
 
273
274
  transformCodebase({
274
275
  srcDirPath: emailThemeSrcDirPath,
@@ -302,7 +303,7 @@ export async function generateResourcesForMainTheme(params: {
302
303
 
303
304
  writeMetaInfKeycloakThemes({
304
305
  resourcesDirPath,
305
- metaInfKeycloakThemes
306
+ getNewMetaInfKeycloakTheme: () => metaInfKeycloakThemes
306
307
  });
307
308
  }
308
309
  }
@@ -1,10 +1,7 @@
1
1
  import { join as pathJoin, extname as pathExtname, sep as pathSep } from "path";
2
2
  import { transformCodebase } from "../../tools/transformCodebase";
3
3
  import type { BuildContext } from "../../shared/buildContext";
4
- import {
5
- readMetaInfKeycloakThemes_fromResourcesDirPath,
6
- writeMetaInfKeycloakThemes
7
- } from "../../shared/metaInfKeycloakThemes";
4
+ import { writeMetaInfKeycloakThemes } from "../../shared/metaInfKeycloakThemes";
8
5
  import { assert } from "tsafe/assert";
9
6
 
10
7
  export type BuildContextLike = {
@@ -34,8 +31,8 @@ export function generateResourcesForThemeVariant(params: {
34
31
  Buffer.from(sourceCode)
35
32
  .toString("utf-8")
36
33
  .replace(
37
- `out["themeName"] = "${themeName}";`,
38
- `out["themeName"] = "${themeVariantName}";`
34
+ `kcContext.themeName = "${themeName}";`,
35
+ `kcContext.themeName = "${themeVariantName}";`
39
36
  ),
40
37
  "utf8"
41
38
  );
@@ -49,26 +46,25 @@ export function generateResourcesForThemeVariant(params: {
49
46
  }
50
47
  });
51
48
 
52
- {
53
- const updatedMetaInfKeycloakThemes =
54
- readMetaInfKeycloakThemes_fromResourcesDirPath({
55
- resourcesDirPath
56
- });
49
+ writeMetaInfKeycloakThemes({
50
+ resourcesDirPath,
51
+ getNewMetaInfKeycloakTheme: ({ metaInfKeycloakTheme }) => {
52
+ assert(metaInfKeycloakTheme !== undefined);
57
53
 
58
- updatedMetaInfKeycloakThemes.themes.push({
59
- name: themeVariantName,
60
- types: (() => {
61
- const theme = updatedMetaInfKeycloakThemes.themes.find(
62
- ({ name }) => name === themeName
63
- );
64
- assert(theme !== undefined);
65
- return theme.types;
66
- })()
67
- });
54
+ const newMetaInfKeycloakTheme = metaInfKeycloakTheme;
55
+
56
+ newMetaInfKeycloakTheme.themes.push({
57
+ name: themeVariantName,
58
+ types: (() => {
59
+ const theme = newMetaInfKeycloakTheme.themes.find(
60
+ ({ name }) => name === themeName
61
+ );
62
+ assert(theme !== undefined);
63
+ return theme.types;
64
+ })()
65
+ });
68
66
 
69
- writeMetaInfKeycloakThemes({
70
- resourcesDirPath,
71
- metaInfKeycloakThemes: updatedMetaInfKeycloakThemes
72
- });
73
- }
67
+ return newMetaInfKeycloakTheme;
68
+ }
69
+ });
74
70
  }
@@ -3,7 +3,6 @@ import { type BuildContext } from "./buildContext";
3
3
  import { assert } from "tsafe/assert";
4
4
  import { lastKeycloakVersionWithAccountV1 } from "./constants";
5
5
  import { downloadAndExtractArchive } from "../tools/downloadAndExtractArchive";
6
- import { isInside } from "../tools/isInside";
7
6
 
8
7
  export type BuildContextLike = {
9
8
  cacheDirPath: string;
@@ -18,27 +17,25 @@ export async function downloadKeycloakDefaultTheme(params: {
18
17
  }): Promise<{ defaultThemeDirPath: string }> {
19
18
  const { keycloakVersion, buildContext } = params;
20
19
 
20
+ let kcNodeModulesKeepFilePaths: string[] | undefined = undefined;
21
+ let kcNodeModulesKeepFilePaths_lastAccountV1: string[] | undefined = undefined;
22
+
21
23
  const { extractedDirPath } = await downloadAndExtractArchive({
22
24
  url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
23
25
  cacheDirPath: buildContext.cacheDirPath,
24
26
  npmWorkspaceRootDirPath: buildContext.npmWorkspaceRootDirPath,
25
27
  uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
26
28
  onArchiveFile: async params => {
27
- if (!isInside({ dirPath: "theme", filePath: params.fileRelativePath })) {
29
+ const fileRelativePath = pathRelative("theme", params.fileRelativePath);
30
+
31
+ if (fileRelativePath.startsWith("..")) {
28
32
  return;
29
33
  }
30
34
 
31
35
  const { readFile, writeFile } = params;
32
36
 
33
- const fileRelativePath = pathRelative("theme", params.fileRelativePath);
34
-
35
37
  skip_keycloak_v2: {
36
- if (
37
- !isInside({
38
- dirPath: pathJoin("keycloak.v2"),
39
- filePath: fileRelativePath
40
- })
41
- ) {
38
+ if (!fileRelativePath.startsWith(pathJoin("keycloak.v2"))) {
42
39
  break skip_keycloak_v2;
43
40
  }
44
41
 
@@ -50,87 +47,102 @@ export async function downloadKeycloakDefaultTheme(params: {
50
47
  break last_account_v1_transformations;
51
48
  }
52
49
 
53
- patch_account_css: {
50
+ skip_web_modules: {
54
51
  if (
55
- fileRelativePath !==
56
- pathJoin("keycloak", "account", "resources", "css", "account.css")
52
+ !fileRelativePath.startsWith(
53
+ pathJoin("keycloak", "common", "resources", "web_modules")
54
+ )
57
55
  ) {
58
- break patch_account_css;
56
+ break skip_web_modules;
59
57
  }
60
58
 
61
- await writeFile({
62
- fileRelativePath,
63
- modifiedData: Buffer.from(
64
- (await readFile())
65
- .toString("utf8")
66
- .replace("top: -34px;", "top: -34px !important;"),
67
- "utf8"
68
- )
69
- });
70
-
71
59
  return;
72
60
  }
73
61
 
74
- skip_web_modules: {
62
+ skip_lib: {
75
63
  if (
76
- !isInside({
77
- dirPath: pathJoin(
78
- "keycloak",
79
- "common",
80
- "resources",
81
- "web_modules"
82
- ),
83
- filePath: fileRelativePath
84
- })
64
+ !fileRelativePath.startsWith(
65
+ pathJoin("keycloak", "common", "resources", "lib")
66
+ )
85
67
  ) {
86
- break skip_web_modules;
68
+ break skip_lib;
87
69
  }
88
70
 
89
71
  return;
90
72
  }
91
73
 
92
- skip_unused_node_modules: {
93
- const nodeModulesDirPath = pathJoin(
94
- "keycloak",
95
- "common",
96
- "resources",
97
- "node_modules"
98
- );
99
-
74
+ skip_node_modules: {
100
75
  if (
101
- !isInside({
102
- dirPath: nodeModulesDirPath,
103
- filePath: fileRelativePath
104
- })
76
+ !fileRelativePath.startsWith(
77
+ pathJoin("keycloak", "common", "resources", "node_modules")
78
+ )
105
79
  ) {
106
- break skip_unused_node_modules;
80
+ break skip_node_modules;
107
81
  }
108
82
 
109
- const toKeepPrefixes = [
110
- ...[
111
- "patternfly.min.css",
112
- "patternfly-additions.min.css",
113
- "patternfly-additions.min.css"
114
- ].map(fileBasename =>
83
+ if (kcNodeModulesKeepFilePaths_lastAccountV1 === undefined) {
84
+ kcNodeModulesKeepFilePaths_lastAccountV1 = [
85
+ pathJoin("patternfly", "dist", "css", "patternfly.min.css"),
115
86
  pathJoin(
116
- nodeModulesDirPath,
117
87
  "patternfly",
118
88
  "dist",
119
89
  "css",
120
- fileBasename
90
+ "patternfly-additions.min.css"
91
+ ),
92
+ pathJoin(
93
+ "patternfly",
94
+ "dist",
95
+ "fonts",
96
+ "OpenSans-Regular-webfont.woff2"
97
+ ),
98
+ pathJoin(
99
+ "patternfly",
100
+ "dist",
101
+ "fonts",
102
+ "OpenSans-Bold-webfont.woff2"
103
+ ),
104
+ pathJoin(
105
+ "patternfly",
106
+ "dist",
107
+ "fonts",
108
+ "OpenSans-Light-webfont.woff2"
109
+ ),
110
+ pathJoin(
111
+ "patternfly",
112
+ "dist",
113
+ "fonts",
114
+ "OpenSans-Semibold-webfont.woff2"
121
115
  )
122
- ),
123
- pathJoin(nodeModulesDirPath, "patternfly", "dist", "fonts")
124
- ];
116
+ ];
117
+ }
118
+
119
+ for (const keepPath of kcNodeModulesKeepFilePaths_lastAccountV1) {
120
+ if (fileRelativePath.endsWith(keepPath)) {
121
+ break skip_node_modules;
122
+ }
123
+ }
124
+
125
+ return;
126
+ }
125
127
 
128
+ patch_account_css: {
126
129
  if (
127
- toKeepPrefixes.find(prefix =>
128
- fileRelativePath.startsWith(prefix)
129
- ) !== undefined
130
+ fileRelativePath !==
131
+ pathJoin("keycloak", "account", "resources", "css", "account.css")
130
132
  ) {
131
- break skip_unused_node_modules;
133
+ break patch_account_css;
132
134
  }
133
135
 
136
+ await writeFile({
137
+ fileRelativePath,
138
+ modifiedData: Buffer.from(
139
+ (await readFile())
140
+ .toString("utf8")
141
+ .replace("top: -34px;", "top: -34px !important;"),
142
+ "utf8"
143
+ )
144
+ });
145
+
134
146
  return;
135
147
  }
136
148
  }
@@ -140,61 +152,76 @@ export async function downloadKeycloakDefaultTheme(params: {
140
152
  break skip_unused_resources;
141
153
  }
142
154
 
143
- for (const dirBasename of [
144
- "@patternfly-v5",
145
- "@rollup",
146
- "rollup",
147
- "react",
148
- "react-dom",
149
- "shx",
150
- ".pnpm"
151
- ]) {
155
+ skip_node_modules: {
152
156
  if (
153
- isInside({
154
- dirPath: pathJoin(
155
- "keycloak",
156
- "common",
157
- "resources",
158
- "node_modules",
159
- dirBasename
160
- ),
161
- filePath: fileRelativePath
162
- })
157
+ !fileRelativePath.startsWith(
158
+ pathJoin("keycloak", "common", "resources", "node_modules")
159
+ )
163
160
  ) {
164
- return;
161
+ break skip_node_modules;
165
162
  }
163
+
164
+ if (kcNodeModulesKeepFilePaths === undefined) {
165
+ kcNodeModulesKeepFilePaths = [
166
+ pathJoin("@patternfly", "patternfly", "patternfly.min.css"),
167
+ pathJoin("patternfly", "dist", "css", "patternfly.min.css"),
168
+ pathJoin(
169
+ "patternfly",
170
+ "dist",
171
+ "css",
172
+ "patternfly-additions.min.css"
173
+ ),
174
+ pathJoin(
175
+ "patternfly",
176
+ "dist",
177
+ "fonts",
178
+ "OpenSans-Regular-webfont.woff2"
179
+ ),
180
+ pathJoin(
181
+ "patternfly",
182
+ "dist",
183
+ "fonts",
184
+ "OpenSans-Light-webfont.woff2"
185
+ ),
186
+ pathJoin(
187
+ "patternfly",
188
+ "dist",
189
+ "fonts",
190
+ "fontawesome-webfont.woff2"
191
+ ),
192
+ pathJoin("jquery", "dist", "jquery.min.js")
193
+ ];
194
+ }
195
+
196
+ for (const keepPath of kcNodeModulesKeepFilePaths) {
197
+ if (fileRelativePath.endsWith(keepPath)) {
198
+ break skip_node_modules;
199
+ }
200
+ }
201
+
202
+ return;
166
203
  }
167
204
 
168
- for (const dirBasename of ["react", "react-dom"]) {
205
+ skip_vendor: {
169
206
  if (
170
- isInside({
171
- dirPath: pathJoin(
172
- "keycloak",
173
- "common",
174
- "resources",
175
- "vendor",
176
- dirBasename
177
- ),
178
- filePath: fileRelativePath
179
- })
207
+ !fileRelativePath.startsWith(
208
+ pathJoin("keycloak", "common", "resources", "vendor")
209
+ )
180
210
  ) {
181
- return;
211
+ break skip_vendor;
182
212
  }
213
+
214
+ return;
183
215
  }
184
216
 
185
- if (
186
- isInside({
187
- dirPath: pathJoin(
188
- "keycloak",
189
- "common",
190
- "resources",
191
- "node_modules",
192
- "@patternfly",
193
- "react-core"
194
- ),
195
- filePath: fileRelativePath
196
- })
197
- ) {
217
+ skip_rollup_config: {
218
+ if (
219
+ fileRelativePath !==
220
+ pathJoin("keycloak", "common", "resources", "rollup.config.js")
221
+ ) {
222
+ break skip_rollup_config;
223
+ }
224
+
198
225
  return;
199
226
  }
200
227
  }