keycloakify 10.0.0-rc.75 → 10.0.0-rc.77
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 +11 -4
- package/bin/453.index.js +3 -2
- package/package.json +1 -1
- package/src/bin/eject-page.ts +4 -5
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +1 -1
- package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +1 -1
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +12 -3
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,
|
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
|
-
|
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
|
-
|
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
|
-
|
737
|
+
cssFileRelativeDirPath: (0,external_path_.dirname)(fileRelativePath),
|
731
738
|
buildContext
|
732
739
|
});
|
733
740
|
return {
|
package/bin/453.index.js
CHANGED
@@ -124,6 +124,7 @@ async function command(params) {
|
|
124
124
|
return;
|
125
125
|
}
|
126
126
|
const userProfileFormFieldComponentName = "UserProfileFormFields";
|
127
|
+
const componentName = componentBasename.replace(/.tsx$/, "");
|
127
128
|
console.log([
|
128
129
|
``,
|
129
130
|
`You now need to update your page router:`,
|
@@ -132,7 +133,7 @@ async function command(params) {
|
|
132
133
|
chalk__WEBPACK_IMPORTED_MODULE_9___default().grey("```"),
|
133
134
|
`// ...`,
|
134
135
|
``,
|
135
|
-
chalk__WEBPACK_IMPORTED_MODULE_9___default().green(`+const ${
|
136
|
+
chalk__WEBPACK_IMPORTED_MODULE_9___default().green(`+const ${componentName} = lazy(() => import("./pages/${componentName}"));`),
|
136
137
|
...[
|
137
138
|
``,
|
138
139
|
` export default function KcPage(props: { kcContext: KcContext; }) {`,
|
@@ -145,7 +146,7 @@ async function command(params) {
|
|
145
146
|
` switch (kcContext.pageId) {`,
|
146
147
|
` // ...`,
|
147
148
|
`+ case "${pageIdOrComponent}": return (`,
|
148
|
-
`+ <${
|
149
|
+
`+ <${componentName}`,
|
149
150
|
`+ {...{ kcContext, i18n, classes }}`,
|
150
151
|
`+ Template={Template}`,
|
151
152
|
`+ doUseDefaultCss={true}`,
|
package/package.json
CHANGED
package/src/bin/eject-page.ts
CHANGED
@@ -190,6 +190,8 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
190
190
|
|
191
191
|
const userProfileFormFieldComponentName = "UserProfileFormFields";
|
192
192
|
|
193
|
+
const componentName = componentBasename.replace(/.tsx$/, "");
|
194
|
+
|
193
195
|
console.log(
|
194
196
|
[
|
195
197
|
``,
|
@@ -207,10 +209,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
207
209
|
`// ...`,
|
208
210
|
``,
|
209
211
|
chalk.green(
|
210
|
-
`+const ${
|
211
|
-
/.tsx$/,
|
212
|
-
""
|
213
|
-
)} = lazy(() => import("./pages/${componentBasename}"));`
|
212
|
+
`+const ${componentName} = lazy(() => import("./pages/${componentName}"));`
|
214
213
|
),
|
215
214
|
...[
|
216
215
|
``,
|
@@ -224,7 +223,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
224
223
|
` switch (kcContext.pageId) {`,
|
225
224
|
` // ...`,
|
226
225
|
`+ case "${pageIdOrComponent}": return (`,
|
227
|
-
`+ <${
|
226
|
+
`+ <${componentName}`,
|
228
227
|
`+ {...{ kcContext, i18n, classes }}`,
|
229
228
|
`+ Template={Template}`,
|
230
229
|
`+ doUseDefaultCss={true}`,
|
@@ -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
|
-
|
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
|
-
|
14
|
+
cssFileRelativeDirPath: string | undefined;
|
14
15
|
buildContext: BuildContextLike;
|
15
16
|
}): {
|
16
17
|
fixedCssCode: string;
|
17
18
|
} {
|
18
|
-
const { cssCode,
|
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
|
-
|
44
|
+
cssFileRelativeDirPath.replace(/\\/g, "/"),
|
36
45
|
assetFileAbsoluteUrlPathname.replace(/^\//, "")
|
37
46
|
);
|
38
47
|
|