Compare commits
73 Commits
v7.13.0
...
v8.0.0-rc.
Author | SHA1 | Date | |
---|---|---|---|
801b08359a | |||
c469dee158 | |||
2aa7eda1e9 | |||
f1246c9e00 | |||
2749cbe4d1 | |||
d2a9280ab3 | |||
8e25ee0fc9 | |||
55026f913b | |||
7cc40e2453 | |||
cb6b19952d | |||
983af57842 | |||
3c2820dc31 | |||
1c25b69160 | |||
641cc38ae4 | |||
cd68b07e19 | |||
2b252c9abb | |||
e2e8370bb9 | |||
e9e31394c4 | |||
2825ccbcd5 | |||
377a14ff72 | |||
a83997b9b4 | |||
3e155d8e80 | |||
6953b72ee6 | |||
ab370a1dda | |||
20845e5860 | |||
9ed3257006 | |||
2221e30c0a | |||
ce43dca23b | |||
4acf5d0931 | |||
b742ed73aa | |||
5156b2e0cc | |||
6b81cf4a24 | |||
cca3a68fe4 | |||
adb2904872 | |||
d68b8d03dd | |||
e7afb88f22 | |||
48cbfc64c0 | |||
0b067858bc | |||
2d44d98f17 | |||
74ef3096ae | |||
8f1163fd75 | |||
a240d503c5 | |||
e331a641b2 | |||
85db4b8e0a | |||
0aa139cf4a | |||
4140ca6fbd | |||
a8ce9da9ee | |||
476a33c0ab | |||
8e868c9fda | |||
17c8b1a172 | |||
b374c04d73 | |||
e750d824ad | |||
dd4c50c3eb | |||
20cc869299 | |||
7214dbccdb | |||
e6cebdd546 | |||
0301003ccf | |||
de2efe0c01 | |||
90d765d7f6 | |||
3e0a1721ce | |||
7214fbcd4c | |||
4b8aecfe91 | |||
387c71c0aa | |||
8d5ce21df4 | |||
f6dfcfbae9 | |||
69e9595db9 | |||
de390678fd | |||
cf9a7b8c60 | |||
73e9c16a8d | |||
9775623981 | |||
20b7bb3c99 | |||
3defc16658 | |||
0dbe592182 |
3
.github/workflows/ci.yaml
vendored
3
.github/workflows/ci.yaml
vendored
@ -34,7 +34,7 @@ jobs:
|
|||||||
- uses: bahmutov/npm-install@v1
|
- uses: bahmutov/npm-install@v1
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
- run: yarn test
|
- run: yarn test
|
||||||
- run: yarn test:keycloakify-starter
|
#- run: yarn test:keycloakify-starter
|
||||||
|
|
||||||
storybook:
|
storybook:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -74,7 +74,6 @@ jobs:
|
|||||||
id: step1
|
id: step1
|
||||||
with:
|
with:
|
||||||
action_name: is_package_json_version_upgraded
|
action_name: is_package_json_version_upgraded
|
||||||
branch: ${{ github.head_ref || github.ref }}
|
|
||||||
|
|
||||||
create_github_release:
|
create_github_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
79
README.md
79
README.md
@ -45,6 +45,14 @@
|
|||||||
> when using React; it's a well-regarded solution that many
|
> when using React; it's a well-regarded solution that many
|
||||||
> developers appreciate.
|
> developers appreciate.
|
||||||
|
|
||||||
|
> 📣 🛑 Account themes generated by Keycloakify are not currently compatible with Keycloak 22.
|
||||||
|
> We are working on a solution. [Follow progress](https://github.com/keycloakify/keycloakify/issues/389).
|
||||||
|
> Login and email themes are not affected.
|
||||||
|
|
||||||
|
Keycloakify is fully compatible with Keycloak, starting from version 11 and is anticipated to maintain compatibility with all future versions.
|
||||||
|
You can update your Keycloak, your Keycloakify generated theme won't break.
|
||||||
|
To understand the basis of my confidence in this, you can [visit this discussion thread where I've explained in detail](https://github.com/keycloakify/keycloakify/discussions/346#discussioncomment-5889791).
|
||||||
|
|
||||||
## Sponsor 👼
|
## Sponsor 👼
|
||||||
|
|
||||||
We are exclusively sponsored by [Cloud IAM](https://cloud-iam.com/?mtm_campaign=keycloakify-deal&mtm_source=keycloakify-github), a French company offering Keycloak as a service.
|
We are exclusively sponsored by [Cloud IAM](https://cloud-iam.com/?mtm_campaign=keycloakify-deal&mtm_source=keycloakify-github), a French company offering Keycloak as a service.
|
||||||
@ -117,9 +125,78 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
|
|
||||||
# Changelog highlights
|
# Changelog highlights
|
||||||
|
|
||||||
|
## 8.0 (candidate)
|
||||||
|
|
||||||
|
- Much smaller .jar size. 70.2 MB -> 7.8 MB.
|
||||||
|
Keycloakify now detects which of the static resources from the default theme are actually used by your theme and only include those in the .jar.
|
||||||
|
- Build time: The first build is slowed but the subsequent build are faster. Update your CI so that nodes_modules/.cache is not deleted between builds.
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
There are very few breaking changes in this major version.
|
||||||
|
|
||||||
|
- The [`--external-assets` build option has been removed](https://docs.keycloakify.dev/v/v7/build-options#external-assets-deprecated) it was a performance optimization that is no longer relevant now that
|
||||||
|
we have lazy loading.
|
||||||
|
|
||||||
|
- The `usePrepareTemplate` prototype has been changed, you can search and replace:
|
||||||
|
|
||||||
|
`src/keycloak-theme/login/Template.tsx`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
"stylesCommon": [
|
||||||
|
"node_modules/patternfly/dist/css/patternfly.min.css",
|
||||||
|
"node_modules/patternfly/dist/css/patternfly-additions.min.css",
|
||||||
|
"lib/zocial/zocial.css"
|
||||||
|
],
|
||||||
|
"styles": ["css/login.css"],
|
||||||
|
```
|
||||||
|
|
||||||
|
by
|
||||||
|
|
||||||
|
```ts
|
||||||
|
"styles": [
|
||||||
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
|
||||||
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
|
||||||
|
`${url.resourcesCommonPath}/lib/zocial/zocial.css`,
|
||||||
|
`${url.resourcesPath}/css/login.css`
|
||||||
|
],
|
||||||
|
```
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
`src/keycloak-theme/account/Template.css`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
"stylesCommon": ["node_modules/patternfly/dist/css/patternfly.min.css", "node_modules/patternfly/dist/css/patternfly-additions.min.css"],
|
||||||
|
"styles": ["css/account.css"],
|
||||||
|
```
|
||||||
|
|
||||||
|
by
|
||||||
|
|
||||||
|
```ts
|
||||||
|
"styles": [
|
||||||
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
|
||||||
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
|
||||||
|
`${url.resourcesPath}/css/account.css`
|
||||||
|
],
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7.15
|
||||||
|
|
||||||
|
- The i18n messages you defines in your theme are now also maid available to Keycloak.
|
||||||
|
In practice this mean that you can now customize the `kcContext.message.summary` that
|
||||||
|
display a general alert and the values returned by `kcContext.messagesPerField.get()` that
|
||||||
|
are used to display specific error on some field of the form.
|
||||||
|
[See video](https://youtu.be/D6tZcemReTI)
|
||||||
|
|
||||||
|
## 7.14
|
||||||
|
|
||||||
|
- Deprecate the `extraPages` build option. Keycloakify is now able to analyze your code to detect extra pages.
|
||||||
|
|
||||||
## 7.13
|
## 7.13
|
||||||
|
|
||||||
- Deprecate `customUserAttribute`, Keycloakify now analyze your code to predict field name usage. [See doc](https://docs.keycloakify.dev/build-options#customuserattributes).
|
- Deprecate `customUserAttribute`, Keycloakify now analyze your code to predict field name usage. [See doc](https://docs.keycloakify.dev/build-options#customuserattributes).
|
||||||
|
It's now mandatory to [adopt the new directory structure](https://docs.keycloakify.dev/migration-guides/v6-greater-than-v7).
|
||||||
|
|
||||||
## 7.12
|
## 7.12
|
||||||
|
|
||||||
|
@ -30,18 +30,6 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extraLoginPages": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extraAccountPages": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extraThemeProperties": {
|
"extraThemeProperties": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@ -70,12 +58,6 @@
|
|||||||
"keycloakifyBuildDirPath": {
|
"keycloakifyBuildDirPath": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"customUserAttributes": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"themeName": {
|
"themeName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "keycloakify",
|
"name": "keycloakify",
|
||||||
"version": "7.13.0",
|
"version": "8.0.0-rc.2",
|
||||||
"description": "Create Keycloak themes using React",
|
"description": "Create Keycloak themes using React",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -79,12 +79,14 @@
|
|||||||
"@storybook/manager-webpack5": "^6.5.13",
|
"@storybook/manager-webpack5": "^6.5.13",
|
||||||
"@storybook/react": "^6.5.13",
|
"@storybook/react": "^6.5.13",
|
||||||
"@storybook/testing-library": "^0.0.13",
|
"@storybook/testing-library": "^0.0.13",
|
||||||
|
"@types/babel__generator": "^7.6.4",
|
||||||
"@types/make-fetch-happen": "^10.0.1",
|
"@types/make-fetch-happen": "^10.0.1",
|
||||||
"@types/minimist": "^1.2.2",
|
"@types/minimist": "^1.2.2",
|
||||||
"@types/node": "^18.15.3",
|
"@types/node": "^18.15.3",
|
||||||
"@types/react": "^18.0.35",
|
"@types/react": "^18.0.35",
|
||||||
"@types/react-dom": "^18.0.11",
|
"@types/react-dom": "^18.0.11",
|
||||||
"@types/yauzl": "^2.10.0",
|
"@types/yauzl": "^2.10.0",
|
||||||
|
"@types/yazl": "^2.4.2",
|
||||||
"concurrently": "^8.0.1",
|
"concurrently": "^8.0.1",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"eslint-plugin-storybook": "^0.6.7",
|
"eslint-plugin-storybook": "^0.6.7",
|
||||||
@ -106,8 +108,10 @@
|
|||||||
"zod-to-json-schema": "^3.20.4"
|
"zod-to-json-schema": "^3.20.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/generator": "^7.22.9",
|
||||||
|
"@babel/parser": "^7.22.7",
|
||||||
|
"@babel/types": "^7.22.5",
|
||||||
"@octokit/rest": "^18.12.0",
|
"@octokit/rest": "^18.12.0",
|
||||||
"@types/yazl": "^2.4.2",
|
|
||||||
"cheerio": "^1.0.0-rc.5",
|
"cheerio": "^1.0.0-rc.5",
|
||||||
"cli-select": "^1.1.2",
|
"cli-select": "^1.1.2",
|
||||||
"evt": "^2.4.18",
|
"evt": "^2.4.18",
|
||||||
@ -116,6 +120,7 @@
|
|||||||
"minimist": "^1.2.6",
|
"minimist": "^1.2.6",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"react-markdown": "^5.0.3",
|
"react-markdown": "^5.0.3",
|
||||||
|
"recast": "^0.23.3",
|
||||||
"rfc4648": "^1.5.2",
|
"rfc4648": "^1.5.2",
|
||||||
"tsafe": "^1.6.0",
|
"tsafe": "^1.6.0",
|
||||||
"yauzl": "^2.10.0",
|
"yauzl": "^2.10.0",
|
||||||
|
@ -24,9 +24,9 @@ async function main() {
|
|||||||
fs.rmSync(tmpDirPath, { "recursive": true, "force": true });
|
fs.rmSync(tmpDirPath, { "recursive": true, "force": true });
|
||||||
|
|
||||||
await downloadBuiltinKeycloakTheme({
|
await downloadBuiltinKeycloakTheme({
|
||||||
|
"projectDirPath": getProjectRoot(),
|
||||||
keycloakVersion,
|
keycloakVersion,
|
||||||
"destDirPath": tmpDirPath,
|
"destDirPath": tmpDirPath
|
||||||
isSilent
|
|
||||||
});
|
});
|
||||||
|
|
||||||
type Dictionary = { [idiomId: string]: string };
|
type Dictionary = { [idiomId: string]: string };
|
||||||
@ -37,7 +37,10 @@ async function main() {
|
|||||||
const baseThemeDirPath = pathJoin(tmpDirPath, "base");
|
const baseThemeDirPath = pathJoin(tmpDirPath, "base");
|
||||||
const re = new RegExp(`^([^\\${pathSep}]+)\\${pathSep}messages\\${pathSep}messages_([^.]+).properties$`);
|
const re = new RegExp(`^([^\\${pathSep}]+)\\${pathSep}messages\\${pathSep}messages_([^.]+).properties$`);
|
||||||
|
|
||||||
crawl(baseThemeDirPath).forEach(filePath => {
|
crawl({
|
||||||
|
"dirPath": baseThemeDirPath,
|
||||||
|
"returnedPathsType": "relative to dirPath"
|
||||||
|
}).forEach(filePath => {
|
||||||
const match = filePath.match(re);
|
const match = filePath.match(re);
|
||||||
|
|
||||||
if (match === null) {
|
if (match === null) {
|
||||||
|
@ -17,9 +17,11 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|||||||
|
|
||||||
const { isReady } = usePrepareTemplate({
|
const { isReady } = usePrepareTemplate({
|
||||||
"doFetchDefaultThemeResources": doUseDefaultCss,
|
"doFetchDefaultThemeResources": doUseDefaultCss,
|
||||||
url,
|
"styles": [
|
||||||
"stylesCommon": ["node_modules/patternfly/dist/css/patternfly.min.css", "node_modules/patternfly/dist/css/patternfly-additions.min.css"],
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
|
||||||
"styles": ["css/account.css"],
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
|
||||||
|
`${url.resourcesPath}/css/account.css`
|
||||||
|
],
|
||||||
"htmlClassName": undefined,
|
"htmlClassName": undefined,
|
||||||
"bodyClassName": clsx("admin-console", "user", getClassName("kcBodyClass"))
|
"bodyClassName": clsx("admin-console", "user", getClassName("kcBodyClass"))
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,7 @@ export default Fallback;
|
|||||||
|
|
||||||
export { getKcContext } from "keycloakify/account/kcContext/getKcContext";
|
export { getKcContext } from "keycloakify/account/kcContext/getKcContext";
|
||||||
export { createGetKcContext } from "keycloakify/account/kcContext/createGetKcContext";
|
export { createGetKcContext } from "keycloakify/account/kcContext/createGetKcContext";
|
||||||
|
export type { AccountThemePageId as PageId } from "keycloakify/bin/keycloakify/generateFtl";
|
||||||
export { createUseI18n } from "keycloakify/account/i18n/i18n";
|
export { createUseI18n } from "keycloakify/account/i18n/i18n";
|
||||||
|
|
||||||
export type { PageProps } from "keycloakify/account/pages/PageProps";
|
export type { PageProps } from "keycloakify/account/pages/PageProps";
|
||||||
|
@ -4,7 +4,7 @@ import { pathJoin } from "keycloakify/bin/tools/pathJoin";
|
|||||||
import { id } from "tsafe/id";
|
import { id } from "tsafe/id";
|
||||||
import type { KcContext } from "./KcContext";
|
import type { KcContext } from "./KcContext";
|
||||||
|
|
||||||
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
|
const PUBLIC_URL = (typeof process !== "object" ? undefined : process.env?.["PUBLIC_URL"]) || "/";
|
||||||
|
|
||||||
export const kcContextCommonMock: KcContext.Common = {
|
export const kcContextCommonMock: KcContext.Common = {
|
||||||
"keycloakifyVersion": "0.0.0",
|
"keycloakifyVersion": "0.0.0",
|
||||||
@ -132,10 +132,6 @@ export const kcContextCommonMock: KcContext.Common = {
|
|||||||
],
|
],
|
||||||
"currentLanguageTag": "en"
|
"currentLanguageTag": "en"
|
||||||
},
|
},
|
||||||
"message": {
|
|
||||||
"type": "success",
|
|
||||||
"summary": "This is a test message"
|
|
||||||
},
|
|
||||||
"features": {
|
"features": {
|
||||||
"authorization": true,
|
"authorization": true,
|
||||||
"identityFederation": true,
|
"identityFederation": true,
|
||||||
|
@ -24,10 +24,11 @@ import * as fs from "fs";
|
|||||||
|
|
||||||
for (const themeType of themeTypes) {
|
for (const themeType of themeTypes) {
|
||||||
await downloadKeycloakStaticResources({
|
await downloadKeycloakStaticResources({
|
||||||
"isSilent": false,
|
projectDirPath,
|
||||||
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
||||||
"themeType": themeType,
|
"themeType": themeType,
|
||||||
"themeDirPath": keycloakDirInPublicDir
|
"themeDirPath": keycloakDirInPublicDir,
|
||||||
|
"usedResources": undefined
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,19 +4,76 @@ import { downloadAndUnzip } from "./tools/downloadAndUnzip";
|
|||||||
import { promptKeycloakVersion } from "./promptKeycloakVersion";
|
import { promptKeycloakVersion } from "./promptKeycloakVersion";
|
||||||
import { getLogger } from "./tools/logger";
|
import { getLogger } from "./tools/logger";
|
||||||
import { readBuildOptions } from "./keycloakify/BuildOptions";
|
import { readBuildOptions } from "./keycloakify/BuildOptions";
|
||||||
|
import * as child_process from "child_process";
|
||||||
|
import * as fs from "fs";
|
||||||
|
|
||||||
export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; isSilent: boolean }) {
|
export async function downloadBuiltinKeycloakTheme(params: { projectDirPath: string; keycloakVersion: string; destDirPath: string }) {
|
||||||
const { keycloakVersion, destDirPath } = params;
|
const { projectDirPath, keycloakVersion, destDirPath } = params;
|
||||||
|
|
||||||
await Promise.all(
|
const start = Date.now();
|
||||||
["", "-community"].map(ext =>
|
|
||||||
downloadAndUnzip({
|
await downloadAndUnzip({
|
||||||
"destDirPath": destDirPath,
|
"doUseCache": true,
|
||||||
"url": `https://github.com/keycloak/keycloak/archive/refs/tags/${keycloakVersion}.zip`,
|
projectDirPath,
|
||||||
"pathOfDirToExtractInArchive": `keycloak-${keycloakVersion}/themes/src/main/resources${ext}/theme`
|
destDirPath,
|
||||||
})
|
"url": `https://github.com/keycloak/keycloak/archive/refs/tags/${keycloakVersion}.zip`,
|
||||||
)
|
"specificDirsToExtract": ["", "-community"].map(ext => `keycloak-${keycloakVersion}/themes/src/main/resources${ext}/theme`),
|
||||||
);
|
"preCacheTransform": {
|
||||||
|
"actionCacheId": "npm install and build",
|
||||||
|
"action": async ({ destDirPath }) => {
|
||||||
|
install_common_node_modules: {
|
||||||
|
const commonResourcesDirPath = pathJoin(destDirPath, "keycloak", "common", "resources");
|
||||||
|
|
||||||
|
if (!fs.existsSync(commonResourcesDirPath)) {
|
||||||
|
break install_common_node_modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(pathJoin(commonResourcesDirPath, "package.json"))) {
|
||||||
|
break install_common_node_modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(pathJoin(commonResourcesDirPath, "node_modules"))) {
|
||||||
|
break install_common_node_modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
child_process.execSync("npm install --omit=dev", {
|
||||||
|
"cwd": commonResourcesDirPath,
|
||||||
|
"stdio": "ignore"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
install_and_move_to_common_resources_generated_in_keycloak_v2: {
|
||||||
|
const accountV2DirSrcDirPath = pathJoin(destDirPath, "keycloak.v2", "account", "src");
|
||||||
|
|
||||||
|
if (!fs.existsSync(accountV2DirSrcDirPath)) {
|
||||||
|
break install_and_move_to_common_resources_generated_in_keycloak_v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
child_process.execSync("npm install", { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
|
||||||
|
|
||||||
|
const packageJsonFilePath = pathJoin(accountV2DirSrcDirPath, "package.json");
|
||||||
|
|
||||||
|
const packageJsonRaw = fs.readFileSync(packageJsonFilePath);
|
||||||
|
|
||||||
|
const parsedPackageJson = JSON.parse(packageJsonRaw.toString("utf8"));
|
||||||
|
|
||||||
|
parsedPackageJson.scripts.build = parsedPackageJson.scripts.build
|
||||||
|
.replace("npm run check-types", "true")
|
||||||
|
.replace("npm run babel", "true");
|
||||||
|
|
||||||
|
fs.writeFileSync(packageJsonFilePath, Buffer.from(JSON.stringify(parsedPackageJson, null, 2), "utf8"));
|
||||||
|
|
||||||
|
child_process.execSync("npm run build", { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
|
||||||
|
|
||||||
|
fs.writeFileSync(packageJsonFilePath, packageJsonRaw);
|
||||||
|
|
||||||
|
fs.rmSync(pathJoin(accountV2DirSrcDirPath, "node_modules"), { "recursive": true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Downloaded Keycloak theme in", Date.now() - start, "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
@ -33,9 +90,9 @@ async function main() {
|
|||||||
logger.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);
|
logger.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);
|
||||||
|
|
||||||
await downloadBuiltinKeycloakTheme({
|
await downloadBuiltinKeycloakTheme({
|
||||||
|
"projectDirPath": process.cwd(),
|
||||||
keycloakVersion,
|
keycloakVersion,
|
||||||
destDirPath,
|
destDirPath
|
||||||
"isSilent": buildOptions.isSilent
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,10 +51,6 @@ import { getThemeSrcDirPath } from "./getSrcDirPath";
|
|||||||
|
|
||||||
const { themeSrcDirPath } = getThemeSrcDirPath({ "projectDirPath": process.cwd() });
|
const { themeSrcDirPath } = getThemeSrcDirPath({ "projectDirPath": process.cwd() });
|
||||||
|
|
||||||
if (themeSrcDirPath === undefined) {
|
|
||||||
throw new Error("Couldn't locate your theme sources");
|
|
||||||
}
|
|
||||||
|
|
||||||
const targetFilePath = pathJoin(themeSrcDirPath, themeType, "pages", pageBasename);
|
const targetFilePath = pathJoin(themeSrcDirPath, themeType, "pages", pageBasename);
|
||||||
|
|
||||||
if (existsSync(targetFilePath)) {
|
if (existsSync(targetFilePath)) {
|
||||||
|
@ -2,15 +2,17 @@ import * as fs from "fs";
|
|||||||
import { exclude } from "tsafe";
|
import { exclude } from "tsafe";
|
||||||
import { crawl } from "./tools/crawl";
|
import { crawl } from "./tools/crawl";
|
||||||
import { join as pathJoin } from "path";
|
import { join as pathJoin } from "path";
|
||||||
|
import { themeTypes } from "./keycloakify/generateFtl";
|
||||||
|
|
||||||
const themeSrcDirBasename = "keycloak-theme";
|
const themeSrcDirBasename = "keycloak-theme";
|
||||||
|
|
||||||
|
/** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
|
||||||
export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
||||||
const { projectDirPath } = params;
|
const { projectDirPath } = params;
|
||||||
|
|
||||||
const srcDirPath = pathJoin(projectDirPath, "src");
|
const srcDirPath = pathJoin(projectDirPath, "src");
|
||||||
|
|
||||||
const themeSrcDirPath: string | undefined = crawl(srcDirPath)
|
const themeSrcDirPath: string | undefined = crawl({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })
|
||||||
.map(fileRelativePath => {
|
.map(fileRelativePath => {
|
||||||
const split = fileRelativePath.split(themeSrcDirBasename);
|
const split = fileRelativePath.split(themeSrcDirBasename);
|
||||||
|
|
||||||
@ -22,12 +24,24 @@ export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
|||||||
})
|
})
|
||||||
.filter(exclude(undefined))[0];
|
.filter(exclude(undefined))[0];
|
||||||
|
|
||||||
if (themeSrcDirPath === undefined) {
|
if (themeSrcDirPath !== undefined) {
|
||||||
if (fs.existsSync(pathJoin(srcDirPath, "login")) || fs.existsSync(pathJoin(srcDirPath, "account"))) {
|
return { themeSrcDirPath };
|
||||||
return { "themeSrcDirPath": srcDirPath };
|
|
||||||
}
|
|
||||||
return { "themeSrcDirPath": undefined };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { themeSrcDirPath };
|
for (const themeType of [...themeTypes, "email"]) {
|
||||||
|
if (!fs.existsSync(pathJoin(srcDirPath, themeType))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return { "themeSrcDirPath": srcDirPath };
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(
|
||||||
|
[
|
||||||
|
"Can't locate your theme source directory. It should be either: ",
|
||||||
|
"src/ or src/keycloak-theme.",
|
||||||
|
"Example in the starter: https://github.com/keycloakify/keycloakify-starter/tree/main/src/keycloak-theme"
|
||||||
|
].join("\n")
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
@ -10,23 +10,19 @@ import { getLogger } from "./tools/logger";
|
|||||||
import { getThemeSrcDirPath } from "./getSrcDirPath";
|
import { getThemeSrcDirPath } from "./getSrcDirPath";
|
||||||
|
|
||||||
export async function main() {
|
export async function main() {
|
||||||
|
const projectDirPath = process.cwd();
|
||||||
|
|
||||||
const { isSilent } = readBuildOptions({
|
const { isSilent } = readBuildOptions({
|
||||||
"projectDirPath": process.cwd(),
|
projectDirPath,
|
||||||
"processArgv": process.argv.slice(2)
|
"processArgv": process.argv.slice(2)
|
||||||
});
|
});
|
||||||
|
|
||||||
const logger = getLogger({ isSilent });
|
const logger = getLogger({ isSilent });
|
||||||
|
|
||||||
const { themeSrcDirPath } = getThemeSrcDirPath({
|
const { themeSrcDirPath } = getThemeSrcDirPath({
|
||||||
"projectDirPath": process.cwd()
|
projectDirPath
|
||||||
});
|
});
|
||||||
|
|
||||||
if (themeSrcDirPath === undefined) {
|
|
||||||
logger.warn("Couldn't locate your theme source directory");
|
|
||||||
|
|
||||||
process.exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
|
const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
|
||||||
|
|
||||||
if (fs.existsSync(emailThemeSrcDirPath)) {
|
if (fs.existsSync(emailThemeSrcDirPath)) {
|
||||||
@ -40,9 +36,9 @@ export async function main() {
|
|||||||
const builtinKeycloakThemeTmpDirPath = pathJoin(emailThemeSrcDirPath, "..", "tmp_xIdP3_builtin_keycloak_theme");
|
const builtinKeycloakThemeTmpDirPath = pathJoin(emailThemeSrcDirPath, "..", "tmp_xIdP3_builtin_keycloak_theme");
|
||||||
|
|
||||||
await downloadBuiltinKeycloakTheme({
|
await downloadBuiltinKeycloakTheme({
|
||||||
|
projectDirPath,
|
||||||
keycloakVersion,
|
keycloakVersion,
|
||||||
"destDirPath": builtinKeycloakThemeTmpDirPath,
|
"destDirPath": builtinKeycloakThemeTmpDirPath
|
||||||
isSilent
|
|
||||||
});
|
});
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
|
@ -4,242 +4,135 @@ import { parse as urlParse } from "url";
|
|||||||
import { typeGuard } from "tsafe/typeGuard";
|
import { typeGuard } from "tsafe/typeGuard";
|
||||||
import { symToStr } from "tsafe/symToStr";
|
import { symToStr } from "tsafe/symToStr";
|
||||||
import { bundlers, getParsedPackageJson, type Bundler } from "./parsedPackageJson";
|
import { bundlers, getParsedPackageJson, type Bundler } from "./parsedPackageJson";
|
||||||
import * as fs from "fs";
|
|
||||||
import { join as pathJoin, sep as pathSep } from "path";
|
import { join as pathJoin, sep as pathSep } from "path";
|
||||||
import parseArgv from "minimist";
|
import parseArgv from "minimist";
|
||||||
|
|
||||||
/** Consolidated build option gathered form CLI arguments and config in package.json */
|
/** Consolidated build option gathered form CLI arguments and config in package.json */
|
||||||
export type BuildOptions = BuildOptions.Standalone | BuildOptions.ExternalAssets;
|
export type BuildOptions = {
|
||||||
|
isSilent: boolean;
|
||||||
export namespace BuildOptions {
|
themeVersion: string;
|
||||||
export type Common = {
|
themeName: string;
|
||||||
isSilent: boolean;
|
extraThemeNames: string[];
|
||||||
themeVersion: string;
|
extraThemeProperties: string[] | undefined;
|
||||||
themeName: string;
|
groupId: string;
|
||||||
extraThemeNames: string[];
|
artifactId: string;
|
||||||
extraLoginPages: string[] | undefined;
|
bundler: Bundler;
|
||||||
extraAccountPages: string[] | undefined;
|
keycloakVersionDefaultAssets: string;
|
||||||
extraThemeProperties?: string[];
|
/** Directory of your built react project. Defaults to {cwd}/build */
|
||||||
groupId: string;
|
reactAppBuildDirPath: string;
|
||||||
artifactId: string;
|
/** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */
|
||||||
bundler: Bundler;
|
keycloakifyBuildDirPath: string;
|
||||||
keycloakVersionDefaultAssets: string;
|
/** If your app is hosted under a subpath, it's the case in CRA if you have "homepage": "https://example.com/my-app" in your package.json
|
||||||
/** Directory of your built react project. Defaults to {cwd}/build */
|
* In this case the urlPathname will be "/my-app/" */
|
||||||
reactAppBuildDirPath: string;
|
urlPathname: string | undefined;
|
||||||
/** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */
|
};
|
||||||
keycloakifyBuildDirPath: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Standalone = Common & {
|
|
||||||
isStandalone: true;
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ExternalAssets = ExternalAssets.SameDomain | ExternalAssets.DifferentDomains;
|
|
||||||
|
|
||||||
export namespace ExternalAssets {
|
|
||||||
export type CommonExternalAssets = Common & {
|
|
||||||
isStandalone: false;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type SameDomain = CommonExternalAssets & {
|
|
||||||
areAppAndKeycloakServerSharingSameDomain: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DifferentDomains = CommonExternalAssets & {
|
|
||||||
areAppAndKeycloakServerSharingSameDomain: false;
|
|
||||||
urlOrigin: string;
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function readBuildOptions(params: { projectDirPath: string; processArgv: string[] }): BuildOptions {
|
export function readBuildOptions(params: { projectDirPath: string; processArgv: string[] }): BuildOptions {
|
||||||
const { projectDirPath, processArgv } = params;
|
const { projectDirPath, processArgv } = params;
|
||||||
|
|
||||||
const { isExternalAssetsCliParamProvided, isSilentCliParamProvided } = (() => {
|
const { isSilentCliParamProvided } = (() => {
|
||||||
const argv = parseArgv(processArgv);
|
const argv = parseArgv(processArgv);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"isSilentCliParamProvided": typeof argv["silent"] === "boolean" ? argv["silent"] : false,
|
"isSilentCliParamProvided": typeof argv["silent"] === "boolean" ? argv["silent"] : false
|
||||||
"isExternalAssetsCliParamProvided": typeof argv["external-assets"] === "boolean" ? argv["external-assets"] : false
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const parsedPackageJson = getParsedPackageJson({ projectDirPath });
|
const parsedPackageJson = getParsedPackageJson({ projectDirPath });
|
||||||
|
|
||||||
const url = (() => {
|
const { name, keycloakify = {}, version, homepage } = parsedPackageJson;
|
||||||
const { homepage } = parsedPackageJson;
|
|
||||||
|
|
||||||
let url: URL | undefined = undefined;
|
const { extraThemeProperties, groupId, artifactId, bundler, keycloakVersionDefaultAssets, extraThemeNames = [] } = keycloakify ?? {};
|
||||||
|
|
||||||
if (homepage !== undefined) {
|
const themeName =
|
||||||
url = new URL(homepage);
|
keycloakify.themeName ??
|
||||||
}
|
name
|
||||||
|
.replace(/^@(.*)/, "$1")
|
||||||
|
.split("/")
|
||||||
|
.join("-");
|
||||||
|
|
||||||
const CNAME = (() => {
|
return {
|
||||||
const cnameFilePath = pathJoin(projectDirPath, "public", "CNAME");
|
themeName,
|
||||||
|
extraThemeNames,
|
||||||
|
"bundler": (() => {
|
||||||
|
const { KEYCLOAKIFY_BUNDLER } = process.env;
|
||||||
|
|
||||||
if (!fs.existsSync(cnameFilePath)) {
|
assert(
|
||||||
|
typeGuard<Bundler | undefined>(KEYCLOAKIFY_BUNDLER, [undefined, ...id<readonly string[]>(bundlers)].includes(KEYCLOAKIFY_BUNDLER)),
|
||||||
|
`${symToStr({ KEYCLOAKIFY_BUNDLER })} should be one of ${bundlers.join(", ")}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return KEYCLOAKIFY_BUNDLER ?? bundler ?? "keycloakify";
|
||||||
|
})(),
|
||||||
|
"artifactId": process.env.KEYCLOAKIFY_ARTIFACT_ID ?? artifactId ?? `${themeName}-keycloak-theme`,
|
||||||
|
"groupId": (() => {
|
||||||
|
const fallbackGroupId = `${themeName}.keycloak`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
process.env.KEYCLOAKIFY_GROUP_ID ??
|
||||||
|
groupId ??
|
||||||
|
(!homepage
|
||||||
|
? fallbackGroupId
|
||||||
|
: urlParse(homepage)
|
||||||
|
.host?.replace(/:[0-9]+$/, "")
|
||||||
|
?.split(".")
|
||||||
|
.reverse()
|
||||||
|
.join(".") ?? fallbackGroupId) + ".keycloak"
|
||||||
|
);
|
||||||
|
})(),
|
||||||
|
"themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? process.env.KEYCLOAKIFY_VERSION ?? version ?? "0.0.0",
|
||||||
|
extraThemeProperties,
|
||||||
|
"isSilent": isSilentCliParamProvided,
|
||||||
|
"keycloakVersionDefaultAssets": keycloakVersionDefaultAssets ?? "11.0.3",
|
||||||
|
"reactAppBuildDirPath": (() => {
|
||||||
|
let { reactAppBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
|
||||||
|
|
||||||
|
if (reactAppBuildDirPath === undefined) {
|
||||||
|
return pathJoin(projectDirPath, "build");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pathSep === "\\") {
|
||||||
|
reactAppBuildDirPath = reactAppBuildDirPath.replace(/\//g, pathSep);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reactAppBuildDirPath.startsWith(`.${pathSep}`)) {
|
||||||
|
return pathJoin(projectDirPath, reactAppBuildDirPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return reactAppBuildDirPath;
|
||||||
|
})(),
|
||||||
|
"keycloakifyBuildDirPath": (() => {
|
||||||
|
let { keycloakifyBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
|
||||||
|
|
||||||
|
if (keycloakifyBuildDirPath === undefined) {
|
||||||
|
return pathJoin(projectDirPath, "build_keycloak");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pathSep === "\\") {
|
||||||
|
keycloakifyBuildDirPath = keycloakifyBuildDirPath.replace(/\//g, pathSep);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keycloakifyBuildDirPath.startsWith(`.${pathSep}`)) {
|
||||||
|
return pathJoin(projectDirPath, keycloakifyBuildDirPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return keycloakifyBuildDirPath;
|
||||||
|
})(),
|
||||||
|
"urlPathname": (() => {
|
||||||
|
const { homepage } = parsedPackageJson;
|
||||||
|
|
||||||
|
let url: URL | undefined = undefined;
|
||||||
|
|
||||||
|
if (homepage !== undefined) {
|
||||||
|
url = new URL(homepage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fs.readFileSync(cnameFilePath).toString("utf8");
|
const out = url.pathname.replace(/([^/])$/, "$1/");
|
||||||
})();
|
return out === "/" ? undefined : out;
|
||||||
|
})()
|
||||||
if (CNAME !== undefined) {
|
};
|
||||||
url = new URL(`https://${CNAME.replace(/\s+$/, "")}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (url === undefined) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
"origin": url.origin,
|
|
||||||
"pathname": (() => {
|
|
||||||
const out = url.pathname.replace(/([^/])$/, "$1/");
|
|
||||||
|
|
||||||
return out === "/" ? undefined : out;
|
|
||||||
})()
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
const common: BuildOptions.Common = (() => {
|
|
||||||
const { name, keycloakify = {}, version, homepage } = parsedPackageJson;
|
|
||||||
|
|
||||||
const {
|
|
||||||
extraPages,
|
|
||||||
extraLoginPages,
|
|
||||||
extraAccountPages,
|
|
||||||
extraThemeProperties,
|
|
||||||
groupId,
|
|
||||||
artifactId,
|
|
||||||
bundler,
|
|
||||||
keycloakVersionDefaultAssets,
|
|
||||||
extraThemeNames = []
|
|
||||||
} = keycloakify ?? {};
|
|
||||||
|
|
||||||
const themeName =
|
|
||||||
keycloakify.themeName ??
|
|
||||||
name
|
|
||||||
.replace(/^@(.*)/, "$1")
|
|
||||||
.split("/")
|
|
||||||
.join("-");
|
|
||||||
|
|
||||||
return {
|
|
||||||
themeName,
|
|
||||||
extraThemeNames,
|
|
||||||
"bundler": (() => {
|
|
||||||
const { KEYCLOAKIFY_BUNDLER } = process.env;
|
|
||||||
|
|
||||||
assert(
|
|
||||||
typeGuard<Bundler | undefined>(
|
|
||||||
KEYCLOAKIFY_BUNDLER,
|
|
||||||
[undefined, ...id<readonly string[]>(bundlers)].includes(KEYCLOAKIFY_BUNDLER)
|
|
||||||
),
|
|
||||||
`${symToStr({ KEYCLOAKIFY_BUNDLER })} should be one of ${bundlers.join(", ")}`
|
|
||||||
);
|
|
||||||
|
|
||||||
return KEYCLOAKIFY_BUNDLER ?? bundler ?? "keycloakify";
|
|
||||||
})(),
|
|
||||||
"artifactId": process.env.KEYCLOAKIFY_ARTIFACT_ID ?? artifactId ?? `${themeName}-keycloak-theme`,
|
|
||||||
"groupId": (() => {
|
|
||||||
const fallbackGroupId = `${themeName}.keycloak`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
process.env.KEYCLOAKIFY_GROUP_ID ??
|
|
||||||
groupId ??
|
|
||||||
(!homepage
|
|
||||||
? fallbackGroupId
|
|
||||||
: urlParse(homepage)
|
|
||||||
.host?.replace(/:[0-9]+$/, "")
|
|
||||||
?.split(".")
|
|
||||||
.reverse()
|
|
||||||
.join(".") ?? fallbackGroupId) + ".keycloak"
|
|
||||||
);
|
|
||||||
})(),
|
|
||||||
"themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? process.env.KEYCLOAKIFY_VERSION ?? version ?? "0.0.0",
|
|
||||||
"extraLoginPages": [...(extraPages ?? []), ...(extraLoginPages ?? [])],
|
|
||||||
extraAccountPages,
|
|
||||||
extraThemeProperties,
|
|
||||||
"isSilent": isSilentCliParamProvided,
|
|
||||||
"keycloakVersionDefaultAssets": keycloakVersionDefaultAssets ?? "11.0.3",
|
|
||||||
"reactAppBuildDirPath": (() => {
|
|
||||||
let { reactAppBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
|
|
||||||
|
|
||||||
if (reactAppBuildDirPath === undefined) {
|
|
||||||
return pathJoin(projectDirPath, "build");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pathSep === "\\") {
|
|
||||||
reactAppBuildDirPath = reactAppBuildDirPath.replace(/\//g, pathSep);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reactAppBuildDirPath.startsWith(`.${pathSep}`)) {
|
|
||||||
return pathJoin(projectDirPath, reactAppBuildDirPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return reactAppBuildDirPath;
|
|
||||||
})(),
|
|
||||||
"keycloakifyBuildDirPath": (() => {
|
|
||||||
let { keycloakifyBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
|
|
||||||
|
|
||||||
if (keycloakifyBuildDirPath === undefined) {
|
|
||||||
return pathJoin(projectDirPath, "build_keycloak");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pathSep === "\\") {
|
|
||||||
keycloakifyBuildDirPath = keycloakifyBuildDirPath.replace(/\//g, pathSep);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keycloakifyBuildDirPath.startsWith(`.${pathSep}`)) {
|
|
||||||
return pathJoin(projectDirPath, keycloakifyBuildDirPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return keycloakifyBuildDirPath;
|
|
||||||
})()
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (isExternalAssetsCliParamProvided) {
|
|
||||||
const commonExternalAssets = id<BuildOptions.ExternalAssets.CommonExternalAssets>({
|
|
||||||
...common,
|
|
||||||
"isStandalone": false
|
|
||||||
});
|
|
||||||
|
|
||||||
if (parsedPackageJson.keycloakify?.areAppAndKeycloakServerSharingSameDomain) {
|
|
||||||
return id<BuildOptions.ExternalAssets.SameDomain>({
|
|
||||||
...commonExternalAssets,
|
|
||||||
"areAppAndKeycloakServerSharingSameDomain": true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
assert(
|
|
||||||
url !== undefined,
|
|
||||||
[
|
|
||||||
"Can't compile in external assets mode if we don't know where",
|
|
||||||
"the app will be hosted.",
|
|
||||||
"You should provide a homepage field in the package.json (or create a",
|
|
||||||
"public/CNAME file.",
|
|
||||||
"Alternatively, if your app and the Keycloak server are on the same domain, ",
|
|
||||||
"eg https://example.com is your app and https://example.com/auth is the keycloak",
|
|
||||||
'admin UI, you can set "keycloakify": { "areAppAndKeycloakServerSharingSameDomain": true }',
|
|
||||||
"in your package.json"
|
|
||||||
].join(" ")
|
|
||||||
);
|
|
||||||
|
|
||||||
return id<BuildOptions.ExternalAssets.DifferentDomains>({
|
|
||||||
...commonExternalAssets,
|
|
||||||
"areAppAndKeycloakServerSharingSameDomain": false,
|
|
||||||
"urlOrigin": url.origin,
|
|
||||||
"urlPathname": url.pathname
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return id<BuildOptions.Standalone>({
|
|
||||||
...common,
|
|
||||||
"isStandalone": true,
|
|
||||||
"urlPathname": url?.pathname
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -26,64 +26,34 @@
|
|||||||
|
|
||||||
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
||||||
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
||||||
</#if>
|
<#else>
|
||||||
|
<#list fieldNames as fieldName>
|
||||||
|
if(fieldName === "${fieldName}" ){
|
||||||
|
|
||||||
<#list fieldNames as fieldName>
|
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
||||||
if(fieldName === "${fieldName}" ){
|
<#if !messagesPerField.existsError??>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
<#if !messagesPerField.existsError??>
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
<#assign doExistMessageForUsernameOrPassword = "">
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#if !doExistMessageForUsernameOrPassword>
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
||||||
<#recover>
|
<#recover>
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
</#if>
|
|
||||||
|
|
||||||
return <#if doExistMessageForUsernameOrPassword>text<#else>undefined</#if>;
|
<#if !doExistMessageForUsernameOrPassword>
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
</#if>
|
||||||
|
|
||||||
<#else>
|
return <#if doExistMessageForUsernameOrPassword>text<#else>undefined</#if>;
|
||||||
|
|
||||||
<#assign doExistMessageForField = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForField = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#else>
|
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#if doExistErrorOnUsernameOrPassword>
|
|
||||||
return text;
|
|
||||||
<#else>
|
<#else>
|
||||||
|
|
||||||
<#assign doExistMessageForField = "">
|
<#assign doExistMessageForField = "">
|
||||||
@ -100,107 +70,139 @@
|
|||||||
|
|
||||||
<#else>
|
<#else>
|
||||||
|
|
||||||
<#assign doExistMessageForField = "">
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#attempt>
|
<#assign doExistErrorOnUsernameOrPassword = "">
|
||||||
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForField = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
<#attempt>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
<#if doExistErrorOnUsernameOrPassword>
|
||||||
|
return text;
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#assign doExistMessageForField = "">
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForField = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#assign doExistMessageForField = "">
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForField = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
</#if>
|
}
|
||||||
|
</#list>
|
||||||
|
|
||||||
}
|
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
||||||
</#list>
|
</#if>
|
||||||
|
|
||||||
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
|
||||||
},
|
},
|
||||||
"existsError": function (fieldName) {
|
"existsError": function (fieldName) {
|
||||||
|
|
||||||
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
||||||
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
||||||
</#if>
|
<#else>
|
||||||
|
<#list fieldNames as fieldName>
|
||||||
|
if(fieldName === "${fieldName}" ){
|
||||||
|
|
||||||
<#list fieldNames as fieldName>
|
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
||||||
if(fieldName === "${fieldName}" ){
|
<#if !messagesPerField.existsError??>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
<#if !messagesPerField.existsError??>
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
<#assign doExistMessageForUsernameOrPassword = "">
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#if !doExistMessageForUsernameOrPassword>
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
||||||
<#recover>
|
<#recover>
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
|
||||||
|
<#if !doExistMessageForUsernameOrPassword>
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
return <#if doExistMessageForUsernameOrPassword>true<#else>false</#if>;
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#assign doExistMessageForField = "">
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForField = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistMessageForField>true<#else>false</#if>;
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
return <#if doExistMessageForUsernameOrPassword>true<#else>false</#if>;
|
|
||||||
|
|
||||||
<#else>
|
<#else>
|
||||||
|
|
||||||
<#assign doExistMessageForField = "">
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#attempt>
|
<#assign doExistErrorOnUsernameOrPassword = "">
|
||||||
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForField = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistMessageForField>true<#else>false</#if>;
|
<#attempt>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#assign doExistErrorMessageForField = "">
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistErrorMessageForField = messagesPerField.existsError('${fieldName}')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistErrorMessageForField = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#else>
|
}
|
||||||
|
</#list>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = "">
|
</#if>
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
|
||||||
|
|
||||||
<#else>
|
|
||||||
|
|
||||||
<#assign doExistErrorMessageForField = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistErrorMessageForField = messagesPerField.existsError('${fieldName}')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistErrorMessageForField = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
}
|
|
||||||
</#list>
|
|
||||||
|
|
||||||
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
|
||||||
|
|
||||||
},
|
},
|
||||||
"get": function (fieldName) {
|
"get": function (fieldName) {
|
||||||
@ -208,184 +210,185 @@
|
|||||||
|
|
||||||
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
||||||
throw new Error("You're not supposed to use messagesPerField.get in this page");
|
throw new Error("You're not supposed to use messagesPerField.get in this page");
|
||||||
</#if>
|
<#else>
|
||||||
|
<#list fieldNames as fieldName>
|
||||||
|
if(fieldName === "${fieldName}" ){
|
||||||
|
|
||||||
<#list fieldNames as fieldName>
|
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
||||||
if(fieldName === "${fieldName}" ){
|
<#if !messagesPerField.existsError??>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
<#if !messagesPerField.existsError??>
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
<#assign doExistMessageForUsernameOrPassword = "">
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#if !doExistMessageForUsernameOrPassword>
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
||||||
<#recover>
|
<#recover>
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#if !doExistMessageForUsernameOrPassword>
|
<#if !doExistMessageForUsernameOrPassword>
|
||||||
return "";
|
<#attempt>
|
||||||
<#else>
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
||||||
<#attempt>
|
<#recover>
|
||||||
return "${kcSanitize(msg('invalidUserMessage'))?no_esc}";
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
<#recover>
|
</#attempt>
|
||||||
return "Invalid username or password.";
|
</#if>
|
||||||
</#attempt>
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#else>
|
<#if !doExistMessageForUsernameOrPassword>
|
||||||
|
return "";
|
||||||
<#attempt>
|
<#else>
|
||||||
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
<#attempt>
|
||||||
<#recover>
|
return "${kcSanitize(msg('invalidUserMessage'))?no_esc}";
|
||||||
return "invalid field";
|
<#recover>
|
||||||
</#attempt>
|
return "Invalid username or password.";
|
||||||
|
</#attempt>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#else>
|
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#if doExistErrorOnUsernameOrPassword>
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
return "${kcSanitize(msg('invalidUserMessage'))?no_esc}";
|
|
||||||
<#recover>
|
|
||||||
return "Invalid username or password.";
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#else>
|
<#else>
|
||||||
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
||||||
<#recover>
|
<#recover>
|
||||||
return "";
|
return "invalid field";
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#else>
|
<#else>
|
||||||
|
|
||||||
<#attempt>
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
<#recover>
|
|
||||||
return "invalid field";
|
<#assign doExistErrorOnUsernameOrPassword = "">
|
||||||
</#attempt>
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
<#if doExistErrorOnUsernameOrPassword>
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
return "${kcSanitize(msg('invalidUserMessage'))?no_esc}";
|
||||||
|
<#recover>
|
||||||
|
return "Invalid username or password.";
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
||||||
|
<#recover>
|
||||||
|
return "";
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
||||||
|
<#recover>
|
||||||
|
return "invalid field";
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
</#if>
|
}
|
||||||
|
</#list>
|
||||||
|
|
||||||
}
|
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
||||||
</#list>
|
|
||||||
|
|
||||||
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
</#if>
|
||||||
|
|
||||||
},
|
},
|
||||||
"exists": function (fieldName) {
|
"exists": function (fieldName) {
|
||||||
|
|
||||||
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
||||||
throw new Error("You're not supposed to use messagesPerField.exists in this page");
|
throw new Error("You're not supposed to use messagesPerField.exists in this page");
|
||||||
</#if>
|
<#else>
|
||||||
|
<#list fieldNames as fieldName>
|
||||||
|
if(fieldName === "${fieldName}" ){
|
||||||
|
|
||||||
<#list fieldNames as fieldName>
|
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
||||||
if(fieldName === "${fieldName}" ){
|
<#if !messagesPerField.existsError??>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/359 Compat with Keycloak prior v12 -->
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
<#if !messagesPerField.existsError??>
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
<#assign doExistMessageForUsernameOrPassword = "">
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
|
||||||
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
<#if !doExistMessageForUsernameOrPassword>
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('username')>
|
||||||
<#recover>
|
<#recover>
|
||||||
<#assign doExistMessageForUsernameOrPassword = true>
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
|
||||||
|
<#if !doExistMessageForUsernameOrPassword>
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForUsernameOrPassword = messagesPerField.exists('password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
return <#if doExistMessageForUsernameOrPassword>true<#else>false</#if>;
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#assign doExistMessageForField = "">
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistMessageForField = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistMessageForField>true<#else>false</#if>;
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
return <#if doExistMessageForUsernameOrPassword>true<#else>false</#if>;
|
|
||||||
|
|
||||||
<#else>
|
<#else>
|
||||||
|
|
||||||
<#assign doExistMessageForField = "">
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
||||||
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
||||||
|
|
||||||
<#attempt>
|
<#assign doExistErrorOnUsernameOrPassword = "">
|
||||||
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistMessageForField = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistMessageForField>true<#else>false</#if>;
|
<#attempt>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistErrorOnUsernameOrPassword = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
|
||||||
|
<#assign doExistErrorMessageForField = "">
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#assign doExistErrorMessageForField = messagesPerField.exists('${fieldName}')>
|
||||||
|
<#recover>
|
||||||
|
<#assign doExistErrorMessageForField = true>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#else>
|
}
|
||||||
|
</#list>
|
||||||
|
|
||||||
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
||||||
<#if '${fieldName}' == 'username' || '${fieldName}' == 'password'>
|
</#if>
|
||||||
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistErrorOnUsernameOrPassword = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
|
||||||
|
|
||||||
<#else>
|
|
||||||
|
|
||||||
<#assign doExistErrorMessageForField = "">
|
|
||||||
|
|
||||||
<#attempt>
|
|
||||||
<#assign doExistErrorMessageForField = messagesPerField.exists('${fieldName}')>
|
|
||||||
<#recover>
|
|
||||||
<#assign doExistErrorMessageForField = true>
|
|
||||||
</#attempt>
|
|
||||||
|
|
||||||
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
}
|
|
||||||
</#list>
|
|
||||||
|
|
||||||
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -454,7 +457,7 @@
|
|||||||
<#-- https://github.com/keycloakify/keycloakify/issues/357 -->
|
<#-- https://github.com/keycloakify/keycloakify/issues/357 -->
|
||||||
key == "loginAction" &&
|
key == "loginAction" &&
|
||||||
are_same_path(path, ["url"]) &&
|
are_same_path(path, ["url"]) &&
|
||||||
["saml-post-form.ftl", "error.ftl", "info.ftl", "login-oauth-grant.ftl"]?seq_contains(pageId) &&
|
["saml-post-form.ftl", "error.ftl", "info.ftl", "login-oauth-grant.ftl", "logout-confirm.ftl"]?seq_contains(pageId) &&
|
||||||
!(auth?has_content && auth.showTryAnotherWayLink())
|
!(auth?has_content && auth.showTryAnotherWayLink())
|
||||||
) || (
|
) || (
|
||||||
<#-- https://github.com/keycloakify/keycloakify/issues/362 -->
|
<#-- https://github.com/keycloakify/keycloakify/issues/362 -->
|
||||||
@ -481,16 +484,15 @@
|
|||||||
<#continue>
|
<#continue>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if key == "attemptedUsername" && are_same_path(path, ["auth"])>
|
<#if pageId == "register.ftl" && key == "attemptedUsername" && are_same_path(path, ["auth"])>
|
||||||
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#-- https://github.com/keycloak/keycloak/blob/3a2bf0c04bcde185e497aaa32d0bb7ab7520cf4a/themes/src/main/resources/theme/base/login/template.ftl#L63 -->
|
<#-- https://github.com/keycloak/keycloak/blob/3a2bf0c04bcde185e497aaa32d0bb7ab7520cf4a/themes/src/main/resources/theme/base/login/template.ftl#L63 -->
|
||||||
|
<#-- https://github.com/keycloakify/keycloakify/discussions/406 -->
|
||||||
<#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>
|
<#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>
|
||||||
<#continue>
|
<#continue>
|
||||||
</#if>
|
</#if>
|
||||||
<#recover>
|
<#recover>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
|
@ -13,39 +13,11 @@ export const themeTypes = ["login", "account"] as const;
|
|||||||
|
|
||||||
export type ThemeType = (typeof themeTypes)[number];
|
export type ThemeType = (typeof themeTypes)[number];
|
||||||
|
|
||||||
export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.ExternalAssets;
|
export type BuildOptionsLike = {
|
||||||
|
themeName: string;
|
||||||
export namespace BuildOptionsLike {
|
themeVersion: string;
|
||||||
export type Common = {
|
urlPathname: string | undefined;
|
||||||
themeName: string;
|
};
|
||||||
themeVersion: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Standalone = Common & {
|
|
||||||
isStandalone: true;
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ExternalAssets = ExternalAssets.SameDomain | ExternalAssets.DifferentDomains;
|
|
||||||
|
|
||||||
export namespace ExternalAssets {
|
|
||||||
export type CommonExternalAssets = {
|
|
||||||
isStandalone: false;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type SameDomain = Common &
|
|
||||||
CommonExternalAssets & {
|
|
||||||
areAppAndKeycloakServerSharingSameDomain: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DifferentDomains = Common &
|
|
||||||
CommonExternalAssets & {
|
|
||||||
areAppAndKeycloakServerSharingSameDomain: false;
|
|
||||||
urlOrigin: string;
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
|
|
||||||
@ -63,22 +35,23 @@ export function generateFtlFilesCodeFactory(params: {
|
|||||||
const $ = cheerio.load(indexHtmlCode);
|
const $ = cheerio.load(indexHtmlCode);
|
||||||
|
|
||||||
fix_imports_statements: {
|
fix_imports_statements: {
|
||||||
if (!buildOptions.isStandalone && buildOptions.areAppAndKeycloakServerSharingSameDomain) {
|
|
||||||
break fix_imports_statements;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("script:not([src])").each((...[, element]) => {
|
$("script:not([src])").each((...[, element]) => {
|
||||||
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
const jsCode = $(element).html();
|
||||||
"jsCode": $(element).html()!,
|
|
||||||
buildOptions
|
assert(jsCode !== null);
|
||||||
});
|
|
||||||
|
const { fixedJsCode } = replaceImportsFromStaticInJsCode({ jsCode });
|
||||||
|
|
||||||
$(element).text(fixedJsCode);
|
$(element).text(fixedJsCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("style").each((...[, element]) => {
|
$("style").each((...[, element]) => {
|
||||||
|
const cssCode = $(element).html();
|
||||||
|
|
||||||
|
assert(cssCode !== null);
|
||||||
|
|
||||||
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
||||||
"cssCode": $(element).html()!,
|
cssCode,
|
||||||
buildOptions
|
buildOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,9 +73,7 @@ export function generateFtlFilesCodeFactory(params: {
|
|||||||
|
|
||||||
$(element).attr(
|
$(element).attr(
|
||||||
attrName,
|
attrName,
|
||||||
buildOptions.isStandalone
|
href.replace(new RegExp(`^${(buildOptions.urlPathname ?? "/").replace(/\//g, "\\/")}`), "${url.resourcesPath}/build/")
|
||||||
? href.replace(new RegExp(`^${(buildOptions.urlPathname ?? "/").replace(/\//g, "\\/")}`), "${url.resourcesPath}/build/")
|
|
||||||
: href.replace(/^\//, `${buildOptions.urlOrigin}/`)
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { join as pathJoin, dirname as pathDirname } from "path";
|
import { join as pathJoin, dirname as pathDirname } from "path";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { Reflect } from "tsafe/Reflect";
|
|
||||||
import type { BuildOptions } from "./BuildOptions";
|
import type { BuildOptions } from "./BuildOptions";
|
||||||
import type { ThemeType } from "./generateFtl";
|
import type { ThemeType } from "./generateFtl";
|
||||||
|
|
||||||
@ -9,15 +8,11 @@ export type BuildOptionsLike = {
|
|||||||
themeName: string;
|
themeName: string;
|
||||||
extraThemeNames: string[];
|
extraThemeNames: string[];
|
||||||
groupId: string;
|
groupId: string;
|
||||||
artifactId?: string;
|
artifactId: string;
|
||||||
themeVersion: string;
|
themeVersion: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
const buildOptions = Reflect<BuildOptions>();
|
|
||||||
|
|
||||||
assert<typeof buildOptions extends BuildOptionsLike ? true : false>();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function generateJavaStackFiles(params: {
|
export function generateJavaStackFiles(params: {
|
||||||
keycloakThemeBuildingDirPath: string;
|
keycloakThemeBuildingDirPath: string;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { join as pathJoin } from "path";
|
import { join as pathJoin } from "path";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { Reflect } from "tsafe/Reflect";
|
|
||||||
import type { BuildOptions } from "./BuildOptions";
|
import type { BuildOptions } from "./BuildOptions";
|
||||||
|
|
||||||
export type BuildOptionsLike = {
|
export type BuildOptionsLike = {
|
||||||
@ -9,11 +8,7 @@ export type BuildOptionsLike = {
|
|||||||
extraThemeNames: string[];
|
extraThemeNames: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
const buildOptions = Reflect<BuildOptions>();
|
|
||||||
|
|
||||||
assert<typeof buildOptions extends BuildOptionsLike ? true : false>();
|
|
||||||
}
|
|
||||||
|
|
||||||
generateStartKeycloakTestingContainer.basename = "start_keycloak_testing_container.sh";
|
generateStartKeycloakTestingContainer.basename = "start_keycloak_testing_container.sh";
|
||||||
|
|
||||||
@ -46,7 +41,6 @@ export function generateStartKeycloakTestingContainer(params: {
|
|||||||
` --name ${containerName} \\`,
|
` --name ${containerName} \\`,
|
||||||
" -e KEYCLOAK_ADMIN=admin \\",
|
" -e KEYCLOAK_ADMIN=admin \\",
|
||||||
" -e KEYCLOAK_ADMIN_PASSWORD=admin \\",
|
" -e KEYCLOAK_ADMIN_PASSWORD=admin \\",
|
||||||
" -e JAVA_OPTS=-Dkeycloak.profile=preview \\",
|
|
||||||
...[themeName, ...extraThemeNames].map(
|
...[themeName, ...extraThemeNames].map(
|
||||||
themeName =>
|
themeName =>
|
||||||
` -v "${pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName).replace(
|
` -v "${pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName).replace(
|
||||||
@ -55,7 +49,7 @@ export function generateStartKeycloakTestingContainer(params: {
|
|||||||
)}":"/opt/keycloak/themes/${themeName}":rw \\`
|
)}":"/opt/keycloak/themes/${themeName}":rw \\`
|
||||||
),
|
),
|
||||||
` -it quay.io/keycloak/keycloak:${keycloakVersion} \\`,
|
` -it quay.io/keycloak/keycloak:${keycloakVersion} \\`,
|
||||||
` start-dev`,
|
` start-dev --features=declarative-user-profile`,
|
||||||
""
|
""
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
"utf8"
|
"utf8"
|
||||||
|
@ -13,13 +13,17 @@ import * as crypto from "crypto";
|
|||||||
export async function downloadKeycloakStaticResources(
|
export async function downloadKeycloakStaticResources(
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
params: {
|
params: {
|
||||||
|
projectDirPath: string;
|
||||||
themeType: ThemeType;
|
themeType: ThemeType;
|
||||||
themeDirPath: string;
|
themeDirPath: string;
|
||||||
isSilent: boolean;
|
|
||||||
keycloakVersion: string;
|
keycloakVersion: string;
|
||||||
|
usedResources: {
|
||||||
|
resourcesCommonFilePaths: string[];
|
||||||
|
resourcesFilePaths: string[];
|
||||||
|
} | undefined
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const { themeType, isSilent, themeDirPath, keycloakVersion } = params;
|
const { projectDirPath, themeType, themeDirPath, keycloakVersion, usedResources } = params;
|
||||||
|
|
||||||
const tmpDirPath = pathJoin(
|
const tmpDirPath = pathJoin(
|
||||||
themeDirPath,
|
themeDirPath,
|
||||||
@ -28,19 +32,39 @@ export async function downloadKeycloakStaticResources(
|
|||||||
);
|
);
|
||||||
|
|
||||||
await downloadBuiltinKeycloakTheme({
|
await downloadBuiltinKeycloakTheme({
|
||||||
|
projectDirPath,
|
||||||
keycloakVersion,
|
keycloakVersion,
|
||||||
"destDirPath": tmpDirPath,
|
"destDirPath": tmpDirPath
|
||||||
isSilent
|
|
||||||
});
|
});
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
"srcDirPath": pathJoin(tmpDirPath, "keycloak", themeType, "resources"),
|
"srcDirPath": pathJoin(tmpDirPath, "keycloak", themeType, "resources"),
|
||||||
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir))
|
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir)),
|
||||||
|
"transformSourceCode":
|
||||||
|
usedResources === undefined
|
||||||
|
? undefined
|
||||||
|
: ({ fileRelativePath, sourceCode }) => {
|
||||||
|
if (!usedResources.resourcesFilePaths.includes(fileRelativePath)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { "modifiedSourceCode": sourceCode };
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
"srcDirPath": pathJoin(tmpDirPath, "keycloak", "common", "resources"),
|
"srcDirPath": pathJoin(tmpDirPath, "keycloak", "common", "resources"),
|
||||||
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesCommonDirPathRelativeToPublicDir))
|
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesCommonDirPathRelativeToPublicDir)),
|
||||||
|
"transformSourceCode":
|
||||||
|
usedResources === undefined
|
||||||
|
? undefined
|
||||||
|
: ({ fileRelativePath, sourceCode }) => {
|
||||||
|
if (!usedResources.resourcesCommonFilePaths.includes(fileRelativePath)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { "modifiedSourceCode": sourceCode };
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.rmSync(tmpDirPath, { "recursive": true, "force": true });
|
fs.rmSync(tmpDirPath, { "recursive": true, "force": true });
|
||||||
|
179
src/bin/keycloakify/generateTheme/generateMessageProperties.ts
Normal file
179
src/bin/keycloakify/generateTheme/generateMessageProperties.ts
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
import type { ThemeType } from "../generateFtl";
|
||||||
|
import { crawl } from "../../tools/crawl";
|
||||||
|
import { join as pathJoin } from "path";
|
||||||
|
import { readFileSync } from "fs";
|
||||||
|
import { symToStr } from "tsafe/symToStr";
|
||||||
|
import { removeDuplicates } from "evt/tools/reducers/removeDuplicates";
|
||||||
|
import * as recast from "recast";
|
||||||
|
import * as babelParser from "@babel/parser";
|
||||||
|
import babelGenerate from "@babel/generator";
|
||||||
|
import * as babelTypes from "@babel/types";
|
||||||
|
|
||||||
|
export function generateMessageProperties(params: {
|
||||||
|
themeSrcDirPath: string;
|
||||||
|
themeType: ThemeType;
|
||||||
|
}): { languageTag: string; propertiesFileSource: string }[] {
|
||||||
|
const { themeSrcDirPath, themeType } = params;
|
||||||
|
|
||||||
|
let files = crawl({
|
||||||
|
"dirPath": pathJoin(themeSrcDirPath, themeType),
|
||||||
|
"returnedPathsType": "absolute"
|
||||||
|
});
|
||||||
|
|
||||||
|
files = files.filter(file => {
|
||||||
|
const regex = /\.(js|ts|tsx)$/;
|
||||||
|
return regex.test(file);
|
||||||
|
});
|
||||||
|
|
||||||
|
files = files.sort((a, b) => {
|
||||||
|
const regex = /\.i18n\.(ts|js|tsx)$/;
|
||||||
|
const aIsI18nFile = regex.test(a);
|
||||||
|
const bIsI18nFile = regex.test(b);
|
||||||
|
return aIsI18nFile === bIsI18nFile ? 0 : aIsI18nFile ? -1 : 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
files = files.sort((a, b) => a.length - b.length);
|
||||||
|
|
||||||
|
files = files.filter(file => readFileSync(file).toString("utf8").includes("createUseI18n"));
|
||||||
|
|
||||||
|
if (files.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const extraMessages = files
|
||||||
|
.map(file => {
|
||||||
|
const root = recast.parse(readFileSync(file).toString("utf8"), {
|
||||||
|
"parser": {
|
||||||
|
"parse": (code: string) => babelParser.parse(code, { "sourceType": "module", "plugins": ["typescript"] }),
|
||||||
|
"generator": babelGenerate,
|
||||||
|
"types": babelTypes
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const codes: string[] = [];
|
||||||
|
|
||||||
|
recast.visit(root, {
|
||||||
|
"visitCallExpression": function (path) {
|
||||||
|
if (path.node.callee.type === "Identifier" && path.node.callee.name === "createUseI18n") {
|
||||||
|
codes.push(babelGenerate(path.node.arguments[0] as any).code);
|
||||||
|
}
|
||||||
|
this.traverse(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return codes;
|
||||||
|
})
|
||||||
|
.flat()
|
||||||
|
.map(code => {
|
||||||
|
let extraMessages: { [languageTag: string]: Record<string, string> } = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
eval(`${symToStr({ extraMessages })} = ${code}`);
|
||||||
|
} catch {
|
||||||
|
console.warn(
|
||||||
|
[
|
||||||
|
"WARNING: Make sure that the first argument of createUseI18n can be evaluated in a javascript",
|
||||||
|
"runtime where only the node globals are available.",
|
||||||
|
"This is important because we need to put your i18n messages in messages_*.properties files",
|
||||||
|
"or they won't be available server side.",
|
||||||
|
"\n",
|
||||||
|
"The following code could not be evaluated:",
|
||||||
|
"\n",
|
||||||
|
code
|
||||||
|
].join(" ")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return extraMessages;
|
||||||
|
});
|
||||||
|
|
||||||
|
const languageTags = extraMessages
|
||||||
|
.map(extraMessage => Object.keys(extraMessage))
|
||||||
|
.flat()
|
||||||
|
.reduce(...removeDuplicates<string>());
|
||||||
|
|
||||||
|
const keyValueMapByLanguageTag: Record<string, Record<string, string>> = {};
|
||||||
|
|
||||||
|
for (const languageTag of languageTags) {
|
||||||
|
const keyValueMap: Record<string, string> = {};
|
||||||
|
|
||||||
|
for (const extraMessage of extraMessages) {
|
||||||
|
const keyValueMap_i = extraMessage[languageTag];
|
||||||
|
|
||||||
|
if (keyValueMap_i === undefined) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(keyValueMap_i)) {
|
||||||
|
if (keyValueMap[key] !== undefined) {
|
||||||
|
console.warn(
|
||||||
|
[
|
||||||
|
"WARNING: The following key is defined multiple times:",
|
||||||
|
"\n",
|
||||||
|
key,
|
||||||
|
"\n",
|
||||||
|
"The following value will be ignored:",
|
||||||
|
"\n",
|
||||||
|
value,
|
||||||
|
"\n",
|
||||||
|
"The following value was already defined:",
|
||||||
|
"\n",
|
||||||
|
keyValueMap[key]
|
||||||
|
].join(" ")
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyValueMap[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
keyValueMapByLanguageTag[languageTag] = keyValueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
const out: { languageTag: string; propertiesFileSource: string }[] = [];
|
||||||
|
|
||||||
|
for (const [languageTag, keyValueMap] of Object.entries(keyValueMapByLanguageTag)) {
|
||||||
|
const propertiesFileSource = Object.entries(keyValueMap)
|
||||||
|
.map(([key, value]) => `${key}=${escapeString(value)}`)
|
||||||
|
.join("\n");
|
||||||
|
|
||||||
|
out.push({
|
||||||
|
languageTag,
|
||||||
|
"propertiesFileSource": ["# This file was generated by keycloakify", "", "parent=base", "", propertiesFileSource, ""].join("\n")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert a JavaScript string to UTF-16 encoding
|
||||||
|
function toUTF16(codePoint: number): string {
|
||||||
|
if (codePoint <= 0xffff) {
|
||||||
|
// BMP character
|
||||||
|
return "\\u" + codePoint.toString(16).padStart(4, "0");
|
||||||
|
} else {
|
||||||
|
// Non-BMP character
|
||||||
|
codePoint -= 0x10000;
|
||||||
|
let highSurrogate = (codePoint >> 10) + 0xd800;
|
||||||
|
let lowSurrogate = (codePoint % 0x400) + 0xdc00;
|
||||||
|
return "\\u" + highSurrogate.toString(16).padStart(4, "0") + "\\u" + lowSurrogate.toString(16).padStart(4, "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Escapes special characters and converts unicode to UTF-16 encoding
|
||||||
|
function escapeString(str: string): string {
|
||||||
|
let escapedStr = "";
|
||||||
|
for (const char of [...str]) {
|
||||||
|
const codePoint = char.codePointAt(0);
|
||||||
|
if (!codePoint) continue;
|
||||||
|
if (char === "'") {
|
||||||
|
escapedStr += "''"; // double single quotes
|
||||||
|
} else if (codePoint > 0x7f) {
|
||||||
|
escapedStr += toUTF16(codePoint); // non-ascii characters
|
||||||
|
} else {
|
||||||
|
escapedStr += char;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return escapedStr;
|
||||||
|
}
|
@ -10,55 +10,38 @@ import type { BuildOptions } from "../BuildOptions";
|
|||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { downloadKeycloakStaticResources } from "./downloadKeycloakStaticResources";
|
import { downloadKeycloakStaticResources } from "./downloadKeycloakStaticResources";
|
||||||
import { readFieldNameUsage } from "./readFieldNameUsage";
|
import { readFieldNameUsage } from "./readFieldNameUsage";
|
||||||
|
import { readExtraPagesNames } from "./readExtraPageNames";
|
||||||
|
import { generateMessageProperties } from "./generateMessageProperties";
|
||||||
|
import { readStaticResourcesUsage } from "./readStaticResourcesUsage";
|
||||||
|
|
||||||
export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.ExternalAssets;
|
export type BuildOptionsLike = {
|
||||||
|
themeName: string;
|
||||||
export namespace BuildOptionsLike {
|
extraThemeProperties: string[] | undefined;
|
||||||
export type Common = {
|
themeVersion: string;
|
||||||
themeName: string;
|
keycloakVersionDefaultAssets: string;
|
||||||
extraLoginPages?: string[];
|
urlPathname: string | undefined;
|
||||||
extraAccountPages?: string[];
|
};
|
||||||
extraThemeProperties?: string[];
|
|
||||||
isSilent: boolean;
|
|
||||||
themeVersion: string;
|
|
||||||
keycloakVersionDefaultAssets: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Standalone = Common & {
|
|
||||||
isStandalone: true;
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ExternalAssets = ExternalAssets.SameDomain | ExternalAssets.DifferentDomains;
|
|
||||||
|
|
||||||
export namespace ExternalAssets {
|
|
||||||
export type CommonExternalAssets = Common & {
|
|
||||||
isStandalone: false;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type SameDomain = CommonExternalAssets & {
|
|
||||||
areAppAndKeycloakServerSharingSameDomain: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DifferentDomains = CommonExternalAssets & {
|
|
||||||
areAppAndKeycloakServerSharingSameDomain: false;
|
|
||||||
urlOrigin: string;
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
|
|
||||||
export async function generateTheme(params: {
|
export async function generateTheme(params: {
|
||||||
|
projectDirPath: string;
|
||||||
reactAppBuildDirPath: string;
|
reactAppBuildDirPath: string;
|
||||||
keycloakThemeBuildingDirPath: string;
|
keycloakThemeBuildingDirPath: string;
|
||||||
themeSrcDirPath: string | undefined;
|
themeSrcDirPath: string;
|
||||||
keycloakifySrcDirPath: string;
|
keycloakifySrcDirPath: string;
|
||||||
buildOptions: BuildOptionsLike;
|
buildOptions: BuildOptionsLike;
|
||||||
keycloakifyVersion: string;
|
keycloakifyVersion: string;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const { reactAppBuildDirPath, keycloakThemeBuildingDirPath, themeSrcDirPath, keycloakifySrcDirPath, buildOptions, keycloakifyVersion } = params;
|
const {
|
||||||
|
projectDirPath,
|
||||||
|
reactAppBuildDirPath,
|
||||||
|
keycloakThemeBuildingDirPath,
|
||||||
|
themeSrcDirPath,
|
||||||
|
keycloakifySrcDirPath,
|
||||||
|
buildOptions,
|
||||||
|
keycloakifyVersion
|
||||||
|
} = params;
|
||||||
|
|
||||||
const getThemeDirPath = (themeType: ThemeType | "email") =>
|
const getThemeDirPath = (themeType: ThemeType | "email") =>
|
||||||
pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", buildOptions.themeName, themeType);
|
pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", buildOptions.themeName, themeType);
|
||||||
@ -68,22 +51,25 @@ export async function generateTheme(params: {
|
|||||||
let generateFtlFilesCode_glob: ReturnType<typeof generateFtlFilesCodeFactory>["generateFtlFilesCode"] | undefined = undefined;
|
let generateFtlFilesCode_glob: ReturnType<typeof generateFtlFilesCodeFactory>["generateFtlFilesCode"] | undefined = undefined;
|
||||||
|
|
||||||
for (const themeType of themeTypes) {
|
for (const themeType of themeTypes) {
|
||||||
|
if (!fs.existsSync(pathJoin(themeSrcDirPath, themeType))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const themeDirPath = getThemeDirPath(themeType);
|
const themeDirPath = getThemeDirPath(themeType);
|
||||||
|
|
||||||
copy_app_resources_to_theme_path: {
|
copy_app_resources_to_theme_path: {
|
||||||
const isFirstPass = themeType.indexOf(themeType) === 0;
|
const isFirstPass = themeType.indexOf(themeType) === 0;
|
||||||
|
|
||||||
if (!isFirstPass && !buildOptions.isStandalone) {
|
if (!isFirstPass) {
|
||||||
break copy_app_resources_to_theme_path;
|
break copy_app_resources_to_theme_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
"destDirPath": buildOptions.isStandalone ? pathJoin(themeDirPath, "resources", "build") : reactAppBuildDirPath,
|
"destDirPath": pathJoin(themeDirPath, "resources", "build"),
|
||||||
"srcDirPath": reactAppBuildDirPath,
|
"srcDirPath": reactAppBuildDirPath,
|
||||||
"transformSourceCode": ({ filePath, sourceCode }) => {
|
"transformSourceCode": ({ filePath, sourceCode }) => {
|
||||||
//NOTE: Prevent cycles, excludes the folder we generated for debug in public/
|
//NOTE: Prevent cycles, excludes the folder we generated for debug in public/
|
||||||
if (
|
if (
|
||||||
buildOptions.isStandalone &&
|
|
||||||
isInside({
|
isInside({
|
||||||
"dirPath": pathJoin(reactAppBuildDirPath, basenameOfKeycloakDirInPublicDir),
|
"dirPath": pathJoin(reactAppBuildDirPath, basenameOfKeycloakDirInPublicDir),
|
||||||
filePath
|
filePath
|
||||||
@ -93,10 +79,6 @@ export async function generateTheme(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (/\.css?$/i.test(filePath)) {
|
if (/\.css?$/i.test(filePath)) {
|
||||||
if (!buildOptions.isStandalone) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { cssGlobalsToDefine, fixedCssCode } = replaceImportsInCssCode({
|
const { cssGlobalsToDefine, fixedCssCode } = replaceImportsInCssCode({
|
||||||
"cssCode": sourceCode.toString("utf8")
|
"cssCode": sourceCode.toString("utf8")
|
||||||
});
|
});
|
||||||
@ -116,43 +98,33 @@ export async function generateTheme(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (/\.js?$/i.test(filePath)) {
|
if (/\.js?$/i.test(filePath)) {
|
||||||
if (!buildOptions.isStandalone && buildOptions.areAppAndKeycloakServerSharingSameDomain) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
||||||
"jsCode": sourceCode.toString("utf8"),
|
"jsCode": sourceCode.toString("utf8")
|
||||||
buildOptions
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return { "modifiedSourceCode": Buffer.from(fixedJsCode, "utf8") };
|
return { "modifiedSourceCode": Buffer.from(fixedJsCode, "utf8") };
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildOptions.isStandalone ? { "modifiedSourceCode": sourceCode } : undefined;
|
return { "modifiedSourceCode": sourceCode };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateFtlFilesCode = (() => {
|
const generateFtlFilesCode =
|
||||||
if (generateFtlFilesCode_glob !== undefined) {
|
generateFtlFilesCode_glob !== undefined
|
||||||
return generateFtlFilesCode_glob;
|
? generateFtlFilesCode_glob
|
||||||
}
|
: generateFtlFilesCodeFactory({
|
||||||
|
"indexHtmlCode": fs.readFileSync(pathJoin(reactAppBuildDirPath, "index.html")).toString("utf8"),
|
||||||
const { generateFtlFilesCode } = generateFtlFilesCodeFactory({
|
"cssGlobalsToDefine": allCssGlobalsToDefine,
|
||||||
"indexHtmlCode": fs.readFileSync(pathJoin(reactAppBuildDirPath, "index.html")).toString("utf8"),
|
buildOptions,
|
||||||
"cssGlobalsToDefine": allCssGlobalsToDefine,
|
keycloakifyVersion,
|
||||||
buildOptions,
|
themeType,
|
||||||
keycloakifyVersion,
|
"fieldNames": readFieldNameUsage({
|
||||||
themeType,
|
keycloakifySrcDirPath,
|
||||||
"fieldNames": readFieldNameUsage({
|
themeSrcDirPath,
|
||||||
keycloakifySrcDirPath,
|
themeType
|
||||||
themeSrcDirPath,
|
})
|
||||||
themeType
|
}).generateFtlFilesCode;
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
return generateFtlFilesCode;
|
|
||||||
})();
|
|
||||||
|
|
||||||
[
|
[
|
||||||
...(() => {
|
...(() => {
|
||||||
@ -163,14 +135,10 @@ export async function generateTheme(params: {
|
|||||||
return accountThemePageIds;
|
return accountThemePageIds;
|
||||||
}
|
}
|
||||||
})(),
|
})(),
|
||||||
...((() => {
|
...readExtraPagesNames({
|
||||||
switch (themeType) {
|
themeType,
|
||||||
case "login":
|
themeSrcDirPath
|
||||||
return buildOptions.extraLoginPages;
|
})
|
||||||
case "account":
|
|
||||||
return buildOptions.extraAccountPages;
|
|
||||||
}
|
|
||||||
})() ?? [])
|
|
||||||
].forEach(pageId => {
|
].forEach(pageId => {
|
||||||
const { ftlCode } = generateFtlFilesCode({ pageId });
|
const { ftlCode } = generateFtlFilesCode({ pageId });
|
||||||
|
|
||||||
@ -179,6 +147,19 @@ export async function generateTheme(params: {
|
|||||||
fs.writeFileSync(pathJoin(themeDirPath, pageId), Buffer.from(ftlCode, "utf8"));
|
fs.writeFileSync(pathJoin(themeDirPath, pageId), Buffer.from(ftlCode, "utf8"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
generateMessageProperties({
|
||||||
|
themeSrcDirPath,
|
||||||
|
themeType
|
||||||
|
}).forEach(({ languageTag, propertiesFileSource }) => {
|
||||||
|
const messagesDirPath = pathJoin(themeDirPath, "messages");
|
||||||
|
|
||||||
|
fs.mkdirSync(pathJoin(themeDirPath, "messages"), { "recursive": true });
|
||||||
|
|
||||||
|
const propertiesFilePath = pathJoin(messagesDirPath, `messages_${languageTag}.properties`);
|
||||||
|
|
||||||
|
fs.writeFileSync(propertiesFilePath, Buffer.from(propertiesFileSource, "utf8"));
|
||||||
|
});
|
||||||
|
|
||||||
//TODO: Remove this block we left it for now only for backward compatibility
|
//TODO: Remove this block we left it for now only for backward compatibility
|
||||||
// we now have a separate script for this
|
// we now have a separate script for this
|
||||||
copy_keycloak_resources_to_public: {
|
copy_keycloak_resources_to_public: {
|
||||||
@ -189,10 +170,11 @@ export async function generateTheme(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await downloadKeycloakStaticResources({
|
await downloadKeycloakStaticResources({
|
||||||
"isSilent": buildOptions.isSilent,
|
projectDirPath,
|
||||||
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
||||||
"themeDirPath": keycloakDirInPublicDir,
|
"themeDirPath": keycloakDirInPublicDir,
|
||||||
themeType
|
themeType,
|
||||||
|
"usedResources": undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
if (themeType !== themeTypes[0]) {
|
if (themeType !== themeTypes[0]) {
|
||||||
@ -214,23 +196,24 @@ export async function generateTheme(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await downloadKeycloakStaticResources({
|
await downloadKeycloakStaticResources({
|
||||||
"isSilent": buildOptions.isSilent,
|
projectDirPath,
|
||||||
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
||||||
themeDirPath,
|
themeDirPath,
|
||||||
themeType
|
themeType,
|
||||||
|
"usedResources": readStaticResourcesUsage({
|
||||||
|
keycloakifySrcDirPath,
|
||||||
|
themeSrcDirPath,
|
||||||
|
themeType
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
pathJoin(themeDirPath, "theme.properties"),
|
pathJoin(themeDirPath, "theme.properties"),
|
||||||
Buffer.from(["parent=keycloak", ...(buildOptions.extraThemeProperties ?? [])].join("\n\n"), "utf8")
|
Buffer.from([`parent=keycloak`, ...(buildOptions.extraThemeProperties ?? [])].join("\n\n"), "utf8")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
email: {
|
email: {
|
||||||
if (themeSrcDirPath === undefined) {
|
|
||||||
break email;
|
|
||||||
}
|
|
||||||
|
|
||||||
const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
|
const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
|
||||||
|
|
||||||
if (!fs.existsSync(emailThemeSrcDirPath)) {
|
if (!fs.existsSync(emailThemeSrcDirPath)) {
|
||||||
|
38
src/bin/keycloakify/generateTheme/readExtraPageNames.ts
Normal file
38
src/bin/keycloakify/generateTheme/readExtraPageNames.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { crawl } from "../../tools/crawl";
|
||||||
|
import { type ThemeType, accountThemePageIds, loginThemePageIds } from "../generateFtl";
|
||||||
|
import { id } from "tsafe/id";
|
||||||
|
import { removeDuplicates } from "evt/tools/reducers/removeDuplicates";
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { join as pathJoin } from "path";
|
||||||
|
|
||||||
|
export function readExtraPagesNames(params: { themeSrcDirPath: string; themeType: ThemeType }): string[] {
|
||||||
|
const { themeSrcDirPath, themeType } = params;
|
||||||
|
|
||||||
|
const filePaths = crawl({
|
||||||
|
"dirPath": pathJoin(themeSrcDirPath, themeType),
|
||||||
|
"returnedPathsType": "absolute"
|
||||||
|
}).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
||||||
|
|
||||||
|
const candidateFilePaths = filePaths.filter(filePath => /kcContext\.[^.]+$/.test(filePath));
|
||||||
|
|
||||||
|
if (candidateFilePaths.length === 0) {
|
||||||
|
candidateFilePaths.push(...filePaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
const extraPages: string[] = [];
|
||||||
|
|
||||||
|
for (const candidateFilPath of candidateFilePaths) {
|
||||||
|
const rawSourceFile = fs.readFileSync(candidateFilPath).toString("utf8");
|
||||||
|
|
||||||
|
extraPages.push(...Array.from(rawSourceFile.matchAll(/["']?pageId["']?\s*:\s*["']([^.]+.ftl)["']/g), m => m[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return extraPages.reduce(...removeDuplicates<string>()).filter(pageId => {
|
||||||
|
switch (themeType) {
|
||||||
|
case "account":
|
||||||
|
return !id<readonly string[]>(accountThemePageIds).includes(pageId);
|
||||||
|
case "login":
|
||||||
|
return !id<readonly string[]>(loginThemePageIds).includes(pageId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
@ -3,79 +3,15 @@ import { removeDuplicates } from "evt/tools/reducers/removeDuplicates";
|
|||||||
import { join as pathJoin } from "path";
|
import { join as pathJoin } from "path";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import type { ThemeType } from "../generateFtl";
|
import type { ThemeType } from "../generateFtl";
|
||||||
import { exclude } from "tsafe/exclude";
|
|
||||||
|
|
||||||
export function readFieldNameUsage(params: {
|
/** Assumes the theme type exists */
|
||||||
keycloakifySrcDirPath: string;
|
export function readFieldNameUsage(params: { keycloakifySrcDirPath: string; themeSrcDirPath: string; themeType: ThemeType }): string[] {
|
||||||
themeSrcDirPath: string | undefined;
|
|
||||||
themeType: ThemeType | "email";
|
|
||||||
}): string[] {
|
|
||||||
const { keycloakifySrcDirPath, themeSrcDirPath, themeType } = params;
|
const { keycloakifySrcDirPath, themeSrcDirPath, themeType } = params;
|
||||||
|
|
||||||
const fieldNames: string[] = [];
|
const fieldNames: string[] = [];
|
||||||
|
|
||||||
if (themeSrcDirPath === undefined) {
|
for (const srcDirPath of [pathJoin(keycloakifySrcDirPath, themeType), pathJoin(themeSrcDirPath, themeType)]) {
|
||||||
//If we can't detect the user theme directory we restore the fieldNames we had previously to prevent errors.
|
const filePaths = crawl({ "dirPath": srcDirPath, "returnedPathsType": "absolute" }).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
||||||
fieldNames.push(
|
|
||||||
...[
|
|
||||||
"global",
|
|
||||||
"userLabel",
|
|
||||||
"username",
|
|
||||||
"email",
|
|
||||||
"firstName",
|
|
||||||
"lastName",
|
|
||||||
"password",
|
|
||||||
"password-confirm",
|
|
||||||
"totp",
|
|
||||||
"totpSecret",
|
|
||||||
"SAMLRequest",
|
|
||||||
"SAMLResponse",
|
|
||||||
"relayState",
|
|
||||||
"device_user_code",
|
|
||||||
"code",
|
|
||||||
"password-new",
|
|
||||||
"rememberMe",
|
|
||||||
"login",
|
|
||||||
"authenticationExecution",
|
|
||||||
"cancel-aia",
|
|
||||||
"clientDataJSON",
|
|
||||||
"authenticatorData",
|
|
||||||
"signature",
|
|
||||||
"credentialId",
|
|
||||||
"userHandle",
|
|
||||||
"error",
|
|
||||||
"authn_use_chk",
|
|
||||||
"authenticationExecution",
|
|
||||||
"isSetRetry",
|
|
||||||
"try-again",
|
|
||||||
"attestationObject",
|
|
||||||
"publicKeyCredentialId",
|
|
||||||
"authenticatorLabel"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const srcDirPath of (
|
|
||||||
[
|
|
||||||
pathJoin(keycloakifySrcDirPath, themeType),
|
|
||||||
(() => {
|
|
||||||
if (themeSrcDirPath === undefined) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const srcDirPath = pathJoin(themeSrcDirPath, themeType);
|
|
||||||
|
|
||||||
if (!fs.existsSync(srcDirPath)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return srcDirPath;
|
|
||||||
})()
|
|
||||||
] as const
|
|
||||||
).filter(exclude(undefined))) {
|
|
||||||
const filePaths = crawl(srcDirPath)
|
|
||||||
.filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath))
|
|
||||||
.map(filePath => pathJoin(srcDirPath, filePath));
|
|
||||||
|
|
||||||
for (const filePath of filePaths) {
|
for (const filePath of filePaths) {
|
||||||
const rawSourceFile = fs.readFileSync(filePath).toString("utf8");
|
const rawSourceFile = fs.readFileSync(filePath).toString("utf8");
|
||||||
@ -85,7 +21,7 @@ export function readFieldNameUsage(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fieldNames.push(
|
fieldNames.push(
|
||||||
...Array.from(rawSourceFile.matchAll(/(?:(?:printIfExists)|(?:existsError)|(?:get)|(?:exists))\(["']([^"']+)["']/g), m => m[1])
|
...Array.from(rawSourceFile.matchAll(/(?:(?:printIfExists)|(?:existsError)|(?:get)|(?:exists))\(\s*["']([^"']+)["']/g), m => m[1])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
import { crawl } from "../../tools/crawl";
|
||||||
|
import { join as pathJoin } from "path";
|
||||||
|
import * as fs from "fs";
|
||||||
|
import type { ThemeType } from "../generateFtl";
|
||||||
|
|
||||||
|
/** Assumes the theme type exists */
|
||||||
|
export function readStaticResourcesUsage(params: { keycloakifySrcDirPath: string; themeSrcDirPath: string; themeType: ThemeType }): {
|
||||||
|
resourcesCommonFilePaths: string[];
|
||||||
|
resourcesFilePaths: string[];
|
||||||
|
} {
|
||||||
|
const { keycloakifySrcDirPath, themeSrcDirPath, themeType } = params;
|
||||||
|
|
||||||
|
const resourcesCommonFilePaths = new Set<string>();
|
||||||
|
const resourcesFilePaths = new Set<string>();
|
||||||
|
|
||||||
|
for (const srcDirPath of [pathJoin(keycloakifySrcDirPath, themeType), pathJoin(themeSrcDirPath, themeType)]) {
|
||||||
|
const filePaths = crawl({ "dirPath": srcDirPath, "returnedPathsType": "absolute" }).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
||||||
|
|
||||||
|
for (const filePath of filePaths) {
|
||||||
|
const rawSourceFile = fs.readFileSync(filePath).toString("utf8");
|
||||||
|
|
||||||
|
if (!rawSourceFile.includes("resourcesCommonPath") && !rawSourceFile.includes("resourcesPath")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wrap = readPaths({ rawSourceFile });
|
||||||
|
|
||||||
|
wrap.resourcesCommonFilePaths.forEach(filePath => resourcesCommonFilePaths.add(filePath));
|
||||||
|
wrap.resourcesFilePaths.forEach(filePath => resourcesFilePaths.add(filePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"resourcesCommonFilePaths": Array.from(resourcesCommonFilePaths),
|
||||||
|
"resourcesFilePaths": Array.from(resourcesFilePaths)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Exported for testing purpose */
|
||||||
|
export function readPaths(params: { rawSourceFile: string }): {
|
||||||
|
resourcesCommonFilePaths: string[];
|
||||||
|
resourcesFilePaths: string[];
|
||||||
|
} {
|
||||||
|
const { rawSourceFile } = params;
|
||||||
|
|
||||||
|
const resourcesCommonFilePaths = new Set<string>();
|
||||||
|
const resourcesFilePaths = new Set<string>();
|
||||||
|
|
||||||
|
for (const isCommon of [true, false]) {
|
||||||
|
const set = isCommon ? resourcesCommonFilePaths : resourcesFilePaths;
|
||||||
|
|
||||||
|
{
|
||||||
|
const regexp = new RegExp(`resources${isCommon ? "Common" : ""}Path\\s*}([^\`]+)\``, "g");
|
||||||
|
|
||||||
|
const matches = [...rawSourceFile.matchAll(regexp)];
|
||||||
|
|
||||||
|
for (const match of matches) {
|
||||||
|
const filePath = match[1];
|
||||||
|
|
||||||
|
set.add(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const regexp = new RegExp(`resources${isCommon ? "Common" : ""}Path\\s*[+,]\\s*["']([^"'\`]+)["'\`]`, "g");
|
||||||
|
|
||||||
|
const matches = [...rawSourceFile.matchAll(regexp)];
|
||||||
|
|
||||||
|
for (const match of matches) {
|
||||||
|
const filePath = match[1];
|
||||||
|
|
||||||
|
set.add(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const removePrefixSlash = (filePath: string) => (filePath.startsWith("/") ? filePath.slice(1) : filePath);
|
||||||
|
|
||||||
|
return {
|
||||||
|
"resourcesCommonFilePaths": Array.from(resourcesCommonFilePaths).map(removePrefixSlash),
|
||||||
|
"resourcesFilePaths": Array.from(resourcesFilePaths).map(removePrefixSlash)
|
||||||
|
};
|
||||||
|
}
|
@ -30,6 +30,7 @@ export async function main() {
|
|||||||
|
|
||||||
for (const themeName of [buildOptions.themeName, ...buildOptions.extraThemeNames]) {
|
for (const themeName of [buildOptions.themeName, ...buildOptions.extraThemeNames]) {
|
||||||
await generateTheme({
|
await generateTheme({
|
||||||
|
projectDirPath,
|
||||||
"keycloakThemeBuildingDirPath": buildOptions.keycloakifyBuildDirPath,
|
"keycloakThemeBuildingDirPath": buildOptions.keycloakifyBuildDirPath,
|
||||||
themeSrcDirPath,
|
themeSrcDirPath,
|
||||||
"keycloakifySrcDirPath": pathJoin(keycloakifyDirPath, "src"),
|
"keycloakifySrcDirPath": pathJoin(keycloakifyDirPath, "src"),
|
||||||
@ -57,12 +58,6 @@ export async function main() {
|
|||||||
"email": false
|
"email": false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (themeSrcDirPath === undefined) {
|
|
||||||
implementedThemeTypes["login"] = true;
|
|
||||||
implementedThemeTypes["account"] = true;
|
|
||||||
return implementedThemeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const themeType of objectKeys(implementedThemeTypes)) {
|
for (const themeType of objectKeys(implementedThemeTypes)) {
|
||||||
if (!fs.existsSync(pathJoin(themeSrcDirPath, themeType))) {
|
if (!fs.existsSync(pathJoin(themeSrcDirPath, themeType))) {
|
||||||
continue;
|
continue;
|
||||||
@ -98,7 +93,7 @@ export async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We want, however, to test in a container running the latest Keycloak version
|
// We want, however, to test in a container running the latest Keycloak version
|
||||||
const containerKeycloakVersion = "20.0.1";
|
const containerKeycloakVersion = "21.1.2";
|
||||||
|
|
||||||
generateStartKeycloakTestingContainer({
|
generateStartKeycloakTestingContainer({
|
||||||
keycloakThemeBuildingDirPath: buildOptions.keycloakifyBuildDirPath,
|
keycloakThemeBuildingDirPath: buildOptions.keycloakifyBuildDirPath,
|
||||||
|
@ -11,10 +11,6 @@ export type ParsedPackageJson = {
|
|||||||
version?: string;
|
version?: string;
|
||||||
homepage?: string;
|
homepage?: string;
|
||||||
keycloakify?: {
|
keycloakify?: {
|
||||||
/** @deprecated: use extraLoginPages instead */
|
|
||||||
extraPages?: string[];
|
|
||||||
extraLoginPages?: string[];
|
|
||||||
extraAccountPages?: string[];
|
|
||||||
extraThemeProperties?: string[];
|
extraThemeProperties?: string[];
|
||||||
areAppAndKeycloakServerSharingSameDomain?: boolean;
|
areAppAndKeycloakServerSharingSameDomain?: boolean;
|
||||||
artifactId?: string;
|
artifactId?: string;
|
||||||
@ -34,9 +30,6 @@ export const zParsedPackageJson = z.object({
|
|||||||
"homepage": z.string().optional(),
|
"homepage": z.string().optional(),
|
||||||
"keycloakify": z
|
"keycloakify": z
|
||||||
.object({
|
.object({
|
||||||
"extraPages": z.array(z.string()).optional(),
|
|
||||||
"extraLoginPages": z.array(z.string()).optional(),
|
|
||||||
"extraAccountPages": z.array(z.string()).optional(),
|
|
||||||
"extraThemeProperties": z.array(z.string()).optional(),
|
"extraThemeProperties": z.array(z.string()).optional(),
|
||||||
"areAppAndKeycloakServerSharingSameDomain": z.boolean().optional(),
|
"areAppAndKeycloakServerSharingSameDomain": z.boolean().optional(),
|
||||||
"artifactId": z.string().optional(),
|
"artifactId": z.string().optional(),
|
||||||
|
@ -1,31 +1,6 @@
|
|||||||
import { ftlValuesGlobalName } from "../ftlValuesGlobalName";
|
import { ftlValuesGlobalName } from "../ftlValuesGlobalName";
|
||||||
import type { BuildOptions } from "../BuildOptions";
|
|
||||||
import { assert } from "tsafe/assert";
|
|
||||||
import { is } from "tsafe/is";
|
|
||||||
import { Reflect } from "tsafe/Reflect";
|
|
||||||
|
|
||||||
export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.ExternalAssets;
|
export function replaceImportsFromStaticInJsCode(params: { jsCode: string }): { fixedJsCode: string } {
|
||||||
|
|
||||||
export namespace BuildOptionsLike {
|
|
||||||
export type Standalone = {
|
|
||||||
isStandalone: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ExternalAssets = {
|
|
||||||
isStandalone: false;
|
|
||||||
urlOrigin: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const buildOptions = Reflect<BuildOptions>();
|
|
||||||
|
|
||||||
assert(!is<BuildOptions.ExternalAssets.CommonExternalAssets>(buildOptions));
|
|
||||||
|
|
||||||
assert<typeof buildOptions extends BuildOptionsLike ? true : false>();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function replaceImportsFromStaticInJsCode(params: { jsCode: string; buildOptions: BuildOptionsLike }): { fixedJsCode: string } {
|
|
||||||
/*
|
/*
|
||||||
NOTE:
|
NOTE:
|
||||||
|
|
||||||
@ -38,7 +13,7 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; build
|
|||||||
will always run in keycloak context.
|
will always run in keycloak context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { jsCode, buildOptions } = params;
|
const { jsCode } = params;
|
||||||
|
|
||||||
const getReplaceArgs = (language: "js" | "css"): Parameters<typeof String.prototype.replace> => [
|
const getReplaceArgs = (language: "js" | "css"): Parameters<typeof String.prototype.replace> => [
|
||||||
new RegExp(`([a-zA-Z_]+)\\.([a-zA-Z]+)=function\\(([a-zA-Z]+)\\){return"static\\/${language}\\/"`, "g"),
|
new RegExp(`([a-zA-Z_]+)\\.([a-zA-Z]+)=function\\(([a-zA-Z]+)\\){return"static\\/${language}\\/"`, "g"),
|
||||||
@ -46,40 +21,23 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; build
|
|||||||
${n}[(function(){
|
${n}[(function(){
|
||||||
var pd= Object.getOwnPropertyDescriptor(${n}, "p");
|
var pd= Object.getOwnPropertyDescriptor(${n}, "p");
|
||||||
if( pd === undefined || pd.configurable ){
|
if( pd === undefined || pd.configurable ){
|
||||||
${
|
|
||||||
buildOptions.isStandalone
|
|
||||||
? `
|
|
||||||
Object.defineProperty(${n}, "p", {
|
|
||||||
get: function() { return window.${ftlValuesGlobalName}.url.resourcesPath; },
|
|
||||||
set: function (){}
|
|
||||||
});
|
|
||||||
`
|
|
||||||
: `
|
|
||||||
var p= "";
|
|
||||||
Object.defineProperty(${n}, "p", {
|
Object.defineProperty(${n}, "p", {
|
||||||
get: function() { return "${ftlValuesGlobalName}" in window ? "${buildOptions.urlOrigin}/" : p; },
|
get: function() { return window.${ftlValuesGlobalName}.url.resourcesPath; },
|
||||||
set: function (value){ p = value;}
|
set: function (){}
|
||||||
});
|
});
|
||||||
`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return "${u}";
|
return "${u}";
|
||||||
})()] = function(${e}) { return "${buildOptions.isStandalone ? "/build/" : ""}static/${language}/"`
|
})()] = function(${e}) { return "${true ? "/build/" : ""}static/${language}/"`
|
||||||
];
|
];
|
||||||
|
|
||||||
const fixedJsCode = jsCode
|
const fixedJsCode = jsCode
|
||||||
.replace(...getReplaceArgs("js"))
|
.replace(...getReplaceArgs("js"))
|
||||||
.replace(...getReplaceArgs("css"))
|
.replace(...getReplaceArgs("css"))
|
||||||
.replace(/([a-zA-Z]+\.[a-zA-Z]+)\+"static\//g, (...[, group]) =>
|
.replace(/[a-zA-Z]+\.[a-zA-Z]+\+"static\//g, `window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/`)
|
||||||
buildOptions.isStandalone
|
|
||||||
? `window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/`
|
|
||||||
: `("${ftlValuesGlobalName}" in window ? "${buildOptions.urlOrigin}/" : ${group}) + "static/`
|
|
||||||
)
|
|
||||||
//TODO: Write a test case for this
|
//TODO: Write a test case for this
|
||||||
.replace(/".chunk.css",([a-zA-Z])+=([a-zA-Z]+\.[a-zA-Z]+)\+([a-zA-Z]+),/, (...[, group1, group2, group3]) =>
|
.replace(
|
||||||
buildOptions.isStandalone
|
/".chunk.css",([a-zA-Z])+=[a-zA-Z]+\.[a-zA-Z]+\+([a-zA-Z]+),/,
|
||||||
? `".chunk.css",${group1} = window.${ftlValuesGlobalName}.url.resourcesPath + "/build/" + ${group3},`
|
(...[, group1, group2]) => `".chunk.css",${group1} = window.${ftlValuesGlobalName}.url.resourcesPath + "/build/" + ${group2},`
|
||||||
: `".chunk.css",${group1} = ("${ftlValuesGlobalName}" in window ? "${buildOptions.urlOrigin}/" : ${group2}) + ${group3},`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return { fixedJsCode };
|
return { fixedJsCode };
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
import * as crypto from "crypto";
|
import * as crypto from "crypto";
|
||||||
import type { BuildOptions } from "../BuildOptions";
|
import type { BuildOptions } from "../BuildOptions";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { is } from "tsafe/is";
|
|
||||||
import { Reflect } from "tsafe/Reflect";
|
|
||||||
|
|
||||||
export type BuildOptionsLike = {
|
export type BuildOptionsLike = {
|
||||||
urlPathname: string | undefined;
|
urlPathname: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
const buildOptions = Reflect<BuildOptions>();
|
|
||||||
|
|
||||||
assert(!is<BuildOptions.ExternalAssets.CommonExternalAssets>(buildOptions));
|
|
||||||
|
|
||||||
assert<typeof buildOptions extends BuildOptionsLike ? true : false>();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function replaceImportsInCssCode(params: { cssCode: string }): {
|
export function replaceImportsInCssCode(params: { cssCode: string }): {
|
||||||
fixedCssCode: string;
|
fixedCssCode: string;
|
||||||
|
@ -1,32 +1,11 @@
|
|||||||
import type { BuildOptions } from "../BuildOptions";
|
import type { BuildOptions } from "../BuildOptions";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { is } from "tsafe/is";
|
|
||||||
import { Reflect } from "tsafe/Reflect";
|
|
||||||
|
|
||||||
export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.ExternalAssets;
|
export type BuildOptionsLike = {
|
||||||
|
urlPathname: string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
export namespace BuildOptionsLike {
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
export type Common = {
|
|
||||||
urlPathname: string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Standalone = Common & {
|
|
||||||
isStandalone: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ExternalAssets = Common & {
|
|
||||||
isStandalone: false;
|
|
||||||
urlOrigin: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const buildOptions = Reflect<BuildOptions>();
|
|
||||||
|
|
||||||
assert(!is<BuildOptions.ExternalAssets.CommonExternalAssets>(buildOptions));
|
|
||||||
|
|
||||||
assert<typeof buildOptions extends BuildOptionsLike ? true : false>();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function replaceImportsInInlineCssCode(params: { cssCode: string; buildOptions: BuildOptionsLike }): {
|
export function replaceImportsInInlineCssCode(params: { cssCode: string; buildOptions: BuildOptionsLike }): {
|
||||||
fixedCssCode: string;
|
fixedCssCode: string;
|
||||||
@ -37,10 +16,7 @@ export function replaceImportsInInlineCssCode(params: { cssCode: string; buildOp
|
|||||||
buildOptions.urlPathname === undefined
|
buildOptions.urlPathname === undefined
|
||||||
? /url\(["']?\/([^/][^)"']+)["']?\)/g
|
? /url\(["']?\/([^/][^)"']+)["']?\)/g
|
||||||
: new RegExp(`url\\(["']?${buildOptions.urlPathname}([^)"']+)["']?\\)`, "g"),
|
: new RegExp(`url\\(["']?${buildOptions.urlPathname}([^)"']+)["']?\\)`, "g"),
|
||||||
(...[, group]) =>
|
(...[, group]) => `url(\${url.resourcesPath}/build/${group})`
|
||||||
`url(${
|
|
||||||
buildOptions.isStandalone ? "${url.resourcesPath}/build/" + group : buildOptions.urlOrigin + (buildOptions.urlPathname ?? "/") + group
|
|
||||||
})`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return { fixedCssCode };
|
return { fixedCssCode };
|
||||||
|
@ -1,27 +1,32 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
/** List all files in a given directory return paths relative to the dir_path */
|
const crawlRec = (dir_path: string, paths: string[]) => {
|
||||||
export const crawl = (() => {
|
for (const file_name of fs.readdirSync(dir_path)) {
|
||||||
const crawlRec = (dir_path: string, paths: string[]) => {
|
const file_path = path.join(dir_path, file_name);
|
||||||
for (const file_name of fs.readdirSync(dir_path)) {
|
|
||||||
const file_path = path.join(dir_path, file_name);
|
|
||||||
|
|
||||||
if (fs.lstatSync(file_path).isDirectory()) {
|
if (fs.lstatSync(file_path).isDirectory()) {
|
||||||
crawlRec(file_path, paths);
|
crawlRec(file_path, paths);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
paths.push(file_path);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
return function crawl(dir_path: string): string[] {
|
paths.push(file_path);
|
||||||
const paths: string[] = [];
|
}
|
||||||
|
};
|
||||||
|
|
||||||
crawlRec(dir_path, paths);
|
/** List all files in a given directory return paths relative to the dir_path */
|
||||||
|
export function crawl(params: { dirPath: string; returnedPathsType: "absolute" | "relative to dirPath" }): string[] {
|
||||||
|
const { dirPath, returnedPathsType } = params;
|
||||||
|
|
||||||
return paths.map(file_path => path.relative(dir_path, file_path));
|
const filePaths: string[] = [];
|
||||||
};
|
|
||||||
})();
|
crawlRec(dirPath, filePaths);
|
||||||
|
|
||||||
|
switch (returnedPathsType) {
|
||||||
|
case "absolute":
|
||||||
|
return filePaths;
|
||||||
|
case "relative to dirPath":
|
||||||
|
return filePaths.map(filePath => path.relative(dirPath, filePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,18 +1,55 @@
|
|||||||
import { exec as execCallback } from "child_process";
|
import { exec as execCallback } from "child_process";
|
||||||
import { createHash } from "crypto";
|
import { createHash } from "crypto";
|
||||||
import { mkdir, readFile, stat, writeFile } from "fs/promises";
|
import { mkdir, readFile, stat, writeFile, unlink, rm } from "fs/promises";
|
||||||
import fetch, { type FetchOptions } from "make-fetch-happen";
|
import fetch, { type FetchOptions } from "make-fetch-happen";
|
||||||
import { dirname as pathDirname, join as pathJoin } from "path";
|
import { dirname as pathDirname, join as pathJoin, resolve as pathResolve, sep as pathSep } from "path";
|
||||||
import { assert } from "tsafe";
|
import { assert } from "tsafe/assert";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import { getProjectRoot } from "./getProjectRoot";
|
|
||||||
import { transformCodebase } from "./transformCodebase";
|
import { transformCodebase } from "./transformCodebase";
|
||||||
import { unzip } from "./unzip";
|
import { unzip, zip } from "./unzip";
|
||||||
|
|
||||||
const exec = promisify(execCallback);
|
const exec = promisify(execCallback);
|
||||||
|
|
||||||
function hash(s: string) {
|
function generateFileNameFromURL(params: {
|
||||||
return createHash("sha256").update(s).digest("hex");
|
url: string;
|
||||||
|
preCacheTransform:
|
||||||
|
| {
|
||||||
|
actionCacheId: string;
|
||||||
|
actionFootprint: string;
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
|
}): string {
|
||||||
|
const { preCacheTransform } = params;
|
||||||
|
|
||||||
|
// Parse the URL
|
||||||
|
const url = new URL(params.url);
|
||||||
|
|
||||||
|
// Extract pathname and remove leading slashes
|
||||||
|
let fileName = url.pathname.replace(/^\//, "").replace(/\//g, "_");
|
||||||
|
|
||||||
|
// Optionally, add query parameters replacing special characters
|
||||||
|
if (url.search) {
|
||||||
|
fileName += url.search.replace(/[&=?]/g, "-");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace any characters that are not valid in filenames
|
||||||
|
fileName = fileName.replace(/[^a-zA-Z0-9-_]/g, "");
|
||||||
|
|
||||||
|
// Trim or pad the fileName to a specific length
|
||||||
|
fileName = fileName.substring(0, 50);
|
||||||
|
|
||||||
|
add_pre_cache_transform: {
|
||||||
|
if (preCacheTransform === undefined) {
|
||||||
|
break add_pre_cache_transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanitize actionCacheId the same way as other components
|
||||||
|
const sanitizedActionCacheId = preCacheTransform.actionCacheId.replace(/[^a-zA-Z0-9-_]/g, "_");
|
||||||
|
|
||||||
|
fileName += `_${sanitizedActionCacheId}_${createHash("sha256").update(preCacheTransform.actionFootprint).digest("hex").substring(0, 5)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exists(path: string) {
|
async function exists(path: string) {
|
||||||
@ -48,9 +85,26 @@ async function getNmpConfig() {
|
|||||||
return readNpmConfig().then(parseNpmConfig);
|
return readNpmConfig().then(parseNpmConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function readNpmConfig() {
|
function readNpmConfig(): Promise<string> {
|
||||||
const { stdout } = await exec("npm config get", { encoding: "utf8" });
|
return (async function callee(depth: number): Promise<string> {
|
||||||
return stdout;
|
const cwd = pathResolve(pathJoin(...[process.cwd(), ...Array(depth).fill("..")]));
|
||||||
|
|
||||||
|
let stdout: string;
|
||||||
|
|
||||||
|
try {
|
||||||
|
stdout = await exec("npm config get", { "encoding": "utf8", cwd }).then(({ stdout }) => stdout);
|
||||||
|
} catch (error) {
|
||||||
|
if (String(error).includes("ENOWORKSPACES")) {
|
||||||
|
assert(cwd !== pathSep);
|
||||||
|
|
||||||
|
return callee(depth + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stdout;
|
||||||
|
})(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseNpmConfig(stdout: string) {
|
function parseNpmConfig(stdout: string) {
|
||||||
@ -96,14 +150,43 @@ async function getFetchOptions(): Promise<Pick<FetchOptions, "proxy" | "noProxy"
|
|||||||
return { proxy, noProxy, strictSSL, cert, ca: ca.length === 0 ? undefined : ca };
|
return { proxy, noProxy, strictSSL, cert, ca: ca.length === 0 ? undefined : ca };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadAndUnzip(params: { url: string; destDirPath: string; pathOfDirToExtractInArchive?: string }) {
|
export async function downloadAndUnzip(
|
||||||
const { url, destDirPath, pathOfDirToExtractInArchive } = params;
|
params: {
|
||||||
|
url: string;
|
||||||
|
destDirPath: string;
|
||||||
|
specificDirsToExtract?: string[];
|
||||||
|
preCacheTransform?: {
|
||||||
|
actionCacheId: string;
|
||||||
|
action: (params: { destDirPath: string }) => Promise<void>;
|
||||||
|
};
|
||||||
|
} & (
|
||||||
|
| {
|
||||||
|
doUseCache: true;
|
||||||
|
projectDirPath: string;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
doUseCache: false;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
const { url, destDirPath, specificDirsToExtract, preCacheTransform, ...rest } = params;
|
||||||
|
|
||||||
const downloadHash = hash(JSON.stringify({ url })).substring(0, 15);
|
const zipFileBasename = generateFileNameFromURL({
|
||||||
const projectRoot = getProjectRoot();
|
url,
|
||||||
const cacheRoot = process.env.XDG_CACHE_HOME ?? pathJoin(projectRoot, "node_modules", ".cache");
|
"preCacheTransform":
|
||||||
const zipFilePath = pathJoin(cacheRoot, "keycloakify", "zip", `_${downloadHash}.zip`);
|
preCacheTransform === undefined
|
||||||
const extractDirPath = pathJoin(cacheRoot, "keycloakify", "unzip", `_${downloadHash}`);
|
? undefined
|
||||||
|
: {
|
||||||
|
"actionCacheId": preCacheTransform.actionCacheId,
|
||||||
|
"actionFootprint": preCacheTransform.action.toString()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const cacheRoot = !rest.doUseCache
|
||||||
|
? `tmp_${Math.random().toString().slice(2, 12)}`
|
||||||
|
: pathJoin(process.env.XDG_CACHE_HOME ?? pathJoin(rest.projectDirPath, "node_modules", ".cache"), "keycloakify");
|
||||||
|
const zipFilePath = pathJoin(cacheRoot, `${zipFileBasename}.zip`);
|
||||||
|
const extractDirPath = pathJoin(cacheRoot, `tmp_unzip_${zipFileBasename}`);
|
||||||
|
|
||||||
if (!(await exists(zipFilePath))) {
|
if (!(await exists(zipFilePath))) {
|
||||||
const opts = await getFetchOptions();
|
const opts = await getFetchOptions();
|
||||||
@ -119,12 +202,32 @@ export async function downloadAndUnzip(params: { url: string; destDirPath: strin
|
|||||||
response.body?.setMaxListeners(Number.MAX_VALUE);
|
response.body?.setMaxListeners(Number.MAX_VALUE);
|
||||||
assert(typeof response.body !== "undefined" && response.body != null);
|
assert(typeof response.body !== "undefined" && response.body != null);
|
||||||
await writeFile(zipFilePath, response.body);
|
await writeFile(zipFilePath, response.body);
|
||||||
|
|
||||||
|
if (specificDirsToExtract !== undefined || preCacheTransform !== undefined) {
|
||||||
|
await unzip(zipFilePath, extractDirPath, specificDirsToExtract);
|
||||||
|
|
||||||
|
await preCacheTransform?.action({
|
||||||
|
"destDirPath": extractDirPath
|
||||||
|
});
|
||||||
|
|
||||||
|
await unlink(zipFilePath);
|
||||||
|
|
||||||
|
await zip(extractDirPath, zipFilePath);
|
||||||
|
|
||||||
|
await rm(extractDirPath, { "recursive": true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await unzip(zipFilePath, extractDirPath, pathOfDirToExtractInArchive);
|
await unzip(zipFilePath, extractDirPath);
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
"srcDirPath": extractDirPath,
|
"srcDirPath": extractDirPath,
|
||||||
"destDirPath": destDirPath
|
"destDirPath": destDirPath
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!rest.doUseCache) {
|
||||||
|
await rm(cacheRoot, { "recursive": true });
|
||||||
|
} else {
|
||||||
|
await rm(extractDirPath, { "recursive": true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import * as path from "path";
|
|||||||
import { crawl } from "./crawl";
|
import { crawl } from "./crawl";
|
||||||
import { id } from "tsafe/id";
|
import { id } from "tsafe/id";
|
||||||
|
|
||||||
type TransformSourceCode = (params: { sourceCode: Buffer; filePath: string }) =>
|
type TransformSourceCode = (params: { sourceCode: Buffer; filePath: string; fileRelativePath: string }) =>
|
||||||
| {
|
| {
|
||||||
modifiedSourceCode: Buffer;
|
modifiedSourceCode: Buffer;
|
||||||
newFileName?: string;
|
newFileName?: string;
|
||||||
@ -20,26 +20,27 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
|
|||||||
}))
|
}))
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
for (const file_relative_path of crawl(srcDirPath)) {
|
for (const fileRelativePath of crawl({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })) {
|
||||||
const filePath = path.join(srcDirPath, file_relative_path);
|
const filePath = path.join(srcDirPath, fileRelativePath);
|
||||||
|
|
||||||
const transformSourceCodeResult = transformSourceCode({
|
const transformSourceCodeResult = transformSourceCode({
|
||||||
"sourceCode": fs.readFileSync(filePath),
|
"sourceCode": fs.readFileSync(filePath),
|
||||||
"filePath": path.join(srcDirPath, file_relative_path)
|
filePath,
|
||||||
|
fileRelativePath
|
||||||
});
|
});
|
||||||
|
|
||||||
if (transformSourceCodeResult === undefined) {
|
if (transformSourceCodeResult === undefined) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.mkdirSync(path.dirname(path.join(destDirPath, file_relative_path)), {
|
fs.mkdirSync(path.dirname(path.join(destDirPath, fileRelativePath)), {
|
||||||
"recursive": true
|
"recursive": true
|
||||||
});
|
});
|
||||||
|
|
||||||
const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
|
const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.join(path.dirname(path.join(destDirPath, file_relative_path)), newFileName ?? path.basename(file_relative_path)),
|
path.join(path.dirname(path.join(destDirPath, fileRelativePath)), newFileName ?? path.basename(fileRelativePath)),
|
||||||
modifiedSourceCode
|
modifiedSourceCode
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import fsp from "node:fs/promises";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import yauzl from "yauzl";
|
import yauzl from "yauzl";
|
||||||
|
import yazl from "yazl";
|
||||||
import stream from "node:stream";
|
import stream from "node:stream";
|
||||||
import { promisify } from "node:util";
|
import { promisify } from "node:util";
|
||||||
|
|
||||||
@ -19,11 +20,16 @@ async function pathExists(path: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function unzip(file: string, targetFolder: string, unzipSubPath?: string) {
|
// Handlings of non posix path is not implemented correctly
|
||||||
// add trailing slash to unzipSubPath and targetFolder
|
// it work by coincidence. Don't have the time to fix but it should be fixed.
|
||||||
if (unzipSubPath && (!unzipSubPath.endsWith("/") || !unzipSubPath.endsWith("\\"))) {
|
export async function unzip(file: string, targetFolder: string, specificDirsToExtract?: string[]) {
|
||||||
unzipSubPath += "/";
|
specificDirsToExtract = specificDirsToExtract?.map(dirPath => {
|
||||||
}
|
if (!dirPath.endsWith("/") || !dirPath.endsWith("\\")) {
|
||||||
|
dirPath += "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirPath;
|
||||||
|
});
|
||||||
|
|
||||||
if (!targetFolder.endsWith("/") || !targetFolder.endsWith("\\")) {
|
if (!targetFolder.endsWith("/") || !targetFolder.endsWith("\\")) {
|
||||||
targetFolder += "/";
|
targetFolder += "/";
|
||||||
@ -42,15 +48,17 @@ export async function unzip(file: string, targetFolder: string, unzipSubPath?: s
|
|||||||
zipfile.readEntry();
|
zipfile.readEntry();
|
||||||
|
|
||||||
zipfile.on("entry", async entry => {
|
zipfile.on("entry", async entry => {
|
||||||
if (unzipSubPath) {
|
if (specificDirsToExtract !== undefined) {
|
||||||
|
const dirPath = specificDirsToExtract.find(dirPath => entry.fileName.startsWith(dirPath));
|
||||||
|
|
||||||
// Skip files outside of the unzipSubPath
|
// Skip files outside of the unzipSubPath
|
||||||
if (!entry.fileName.startsWith(unzipSubPath)) {
|
if (dirPath === undefined) {
|
||||||
zipfile.readEntry();
|
zipfile.readEntry();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the unzipSubPath from the file name
|
// Remove the unzipSubPath from the file name
|
||||||
entry.fileName = entry.fileName.substring(unzipSubPath.length);
|
entry.fileName = entry.fileName.substring(dirPath.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const target = path.join(targetFolder, entry.fileName);
|
const target = path.join(targetFolder, entry.fileName);
|
||||||
@ -77,6 +85,8 @@ export async function unzip(file: string, targetFolder: string, unzipSubPath?: s
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await fsp.mkdir(path.dirname(target), { "recursive": true });
|
||||||
|
|
||||||
await pipeline(readStream, fs.createWriteStream(target));
|
await pipeline(readStream, fs.createWriteStream(target));
|
||||||
|
|
||||||
zipfile.readEntry();
|
zipfile.readEntry();
|
||||||
@ -90,3 +100,42 @@ export async function unzip(file: string, targetFolder: string, unzipSubPath?: s
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: This code was directly copied from ChatGPT and appears to function as expected.
|
||||||
|
// However, confidence in its complete accuracy and robustness is limited.
|
||||||
|
export async function zip(sourceFolder: string, targetZip: string) {
|
||||||
|
return new Promise<void>(async (resolve, reject) => {
|
||||||
|
const zipfile = new yazl.ZipFile();
|
||||||
|
const files: string[] = [];
|
||||||
|
|
||||||
|
// Recursive function to explore directories and their subdirectories
|
||||||
|
async function exploreDir(dir: string) {
|
||||||
|
const dirContent = await fsp.readdir(dir);
|
||||||
|
for (const file of dirContent) {
|
||||||
|
const filePath = path.join(dir, file);
|
||||||
|
const stat = await fsp.stat(filePath);
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
await exploreDir(filePath);
|
||||||
|
} else if (stat.isFile()) {
|
||||||
|
files.push(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collecting all files to be zipped
|
||||||
|
await exploreDir(sourceFolder);
|
||||||
|
|
||||||
|
// Adding files to zip
|
||||||
|
for (const file of files) {
|
||||||
|
const relativePath = path.relative(sourceFolder, file);
|
||||||
|
zipfile.addFile(file, relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
zipfile.outputStream
|
||||||
|
.pipe(fs.createWriteStream(targetZip))
|
||||||
|
.on("close", () => resolve())
|
||||||
|
.on("error", err => reject(err)); // Listen to error events
|
||||||
|
|
||||||
|
zipfile.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -1,21 +1,15 @@
|
|||||||
import { useReducer, useEffect } from "react";
|
import { useReducer, useEffect } from "react";
|
||||||
import { headInsert } from "keycloakify/tools/headInsert";
|
import { headInsert } from "keycloakify/tools/headInsert";
|
||||||
import { pathJoin } from "keycloakify/bin/tools/pathJoin";
|
|
||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
|
|
||||||
export function usePrepareTemplate(params: {
|
export function usePrepareTemplate(params: {
|
||||||
doFetchDefaultThemeResources: boolean;
|
doFetchDefaultThemeResources: boolean;
|
||||||
stylesCommon?: string[];
|
|
||||||
styles?: string[];
|
styles?: string[];
|
||||||
scripts?: string[];
|
scripts?: string[];
|
||||||
url: {
|
|
||||||
resourcesCommonPath: string;
|
|
||||||
resourcesPath: string;
|
|
||||||
};
|
|
||||||
htmlClassName: string | undefined;
|
htmlClassName: string | undefined;
|
||||||
bodyClassName: string | undefined;
|
bodyClassName: string | undefined;
|
||||||
}) {
|
}) {
|
||||||
const { doFetchDefaultThemeResources, stylesCommon = [], styles = [], url, scripts = [], htmlClassName, bodyClassName } = params;
|
const { doFetchDefaultThemeResources, styles = [], scripts = [], htmlClassName, bodyClassName } = params;
|
||||||
|
|
||||||
const [isReady, setReady] = useReducer(() => true, !doFetchDefaultThemeResources);
|
const [isReady, setReady] = useReducer(() => true, !doFetchDefaultThemeResources);
|
||||||
|
|
||||||
@ -31,23 +25,18 @@ export function usePrepareTemplate(params: {
|
|||||||
(async () => {
|
(async () => {
|
||||||
const prLoadedArray: Promise<void>[] = [];
|
const prLoadedArray: Promise<void>[] = [];
|
||||||
|
|
||||||
[
|
styles.reverse().forEach(href => {
|
||||||
...stylesCommon.map(relativePath => pathJoin(url.resourcesCommonPath, relativePath)),
|
const { prLoaded, remove } = headInsert({
|
||||||
...styles.map(relativePath => pathJoin(url.resourcesPath, relativePath))
|
"type": "css",
|
||||||
]
|
"position": "prepend",
|
||||||
.reverse()
|
href
|
||||||
.forEach(href => {
|
|
||||||
const { prLoaded, remove } = headInsert({
|
|
||||||
"type": "css",
|
|
||||||
"position": "prepend",
|
|
||||||
href
|
|
||||||
});
|
|
||||||
|
|
||||||
removeArray.push(remove);
|
|
||||||
|
|
||||||
prLoadedArray.push(prLoaded);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
removeArray.push(remove);
|
||||||
|
|
||||||
|
prLoadedArray.push(prLoaded);
|
||||||
|
});
|
||||||
|
|
||||||
await Promise.all(prLoadedArray);
|
await Promise.all(prLoadedArray);
|
||||||
|
|
||||||
if (isUnmounted) {
|
if (isUnmounted) {
|
||||||
@ -57,10 +46,10 @@ export function usePrepareTemplate(params: {
|
|||||||
setReady();
|
setReady();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
scripts.forEach(relativePath => {
|
scripts.forEach(src => {
|
||||||
const { remove } = headInsert({
|
const { remove } = headInsert({
|
||||||
"type": "javascript",
|
"type": "javascript",
|
||||||
"src": pathJoin(url.resourcesPath, relativePath)
|
src
|
||||||
});
|
});
|
||||||
|
|
||||||
removeArray.push(remove);
|
removeArray.push(remove);
|
||||||
|
@ -31,13 +31,12 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|||||||
|
|
||||||
const { isReady } = usePrepareTemplate({
|
const { isReady } = usePrepareTemplate({
|
||||||
"doFetchDefaultThemeResources": doUseDefaultCss,
|
"doFetchDefaultThemeResources": doUseDefaultCss,
|
||||||
url,
|
"styles": [
|
||||||
"stylesCommon": [
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
|
||||||
"node_modules/patternfly/dist/css/patternfly.min.css",
|
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
|
||||||
"node_modules/patternfly/dist/css/patternfly-additions.min.css",
|
`${url.resourcesCommonPath}/lib/zocial/zocial.css`,
|
||||||
"lib/zocial/zocial.css"
|
`${url.resourcesPath}/css/login.css`
|
||||||
],
|
],
|
||||||
"styles": ["css/login.css"],
|
|
||||||
"htmlClassName": getClassName("kcHtmlClass"),
|
"htmlClassName": getClassName("kcHtmlClass"),
|
||||||
"bodyClassName": undefined
|
"bodyClassName": undefined
|
||||||
});
|
});
|
||||||
|
@ -211,7 +211,8 @@ const keycloakifyExtraMessages = {
|
|||||||
"shouldBeDifferent": "{0} should be different to {1}",
|
"shouldBeDifferent": "{0} should be different to {1}",
|
||||||
"shouldMatchPattern": "Pattern should match: `/{0}/`",
|
"shouldMatchPattern": "Pattern should match: `/{0}/`",
|
||||||
"mustBeAnInteger": "Must be an integer",
|
"mustBeAnInteger": "Must be an integer",
|
||||||
"notAValidOption": "Not a valid option"
|
"notAValidOption": "Not a valid option",
|
||||||
|
"selectAnOption": "Select an option"
|
||||||
},
|
},
|
||||||
"fr": {
|
"fr": {
|
||||||
/* spell-checker: disable */
|
/* spell-checker: disable */
|
||||||
@ -223,7 +224,8 @@ const keycloakifyExtraMessages = {
|
|||||||
|
|
||||||
"logoutConfirmTitle": "Déconnexion",
|
"logoutConfirmTitle": "Déconnexion",
|
||||||
"logoutConfirmHeader": "Êtes-vous sûr(e) de vouloir vous déconnecter ?",
|
"logoutConfirmHeader": "Êtes-vous sûr(e) de vouloir vous déconnecter ?",
|
||||||
"doLogout": "Se déconnecter"
|
"doLogout": "Se déconnecter",
|
||||||
|
"selectAnOption": "Sélectionner une option"
|
||||||
/* spell-checker: enable */
|
/* spell-checker: enable */
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@ export default Fallback;
|
|||||||
export { useDownloadTerms } from "keycloakify/login/lib/useDownloadTerms";
|
export { useDownloadTerms } from "keycloakify/login/lib/useDownloadTerms";
|
||||||
export { getKcContext } from "keycloakify/login/kcContext/getKcContext";
|
export { getKcContext } from "keycloakify/login/kcContext/getKcContext";
|
||||||
export { createGetKcContext } from "keycloakify/login/kcContext/createGetKcContext";
|
export { createGetKcContext } from "keycloakify/login/kcContext/createGetKcContext";
|
||||||
|
export type { LoginThemePageId as PageId } from "keycloakify/bin/keycloakify/generateFtl";
|
||||||
export { createUseI18n } from "keycloakify/login/i18n/i18n";
|
export { createUseI18n } from "keycloakify/login/i18n/i18n";
|
||||||
|
|
||||||
export type { PageProps } from "keycloakify/login/pages/PageProps";
|
export type { PageProps } from "keycloakify/login/pages/PageProps";
|
||||||
|
@ -145,7 +145,7 @@ export declare namespace KcContext {
|
|||||||
rememberMe?: string;
|
rememberMe?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
};
|
};
|
||||||
usernameEditDisabled: boolean;
|
usernameHidden?: boolean;
|
||||||
social: {
|
social: {
|
||||||
displayInfo: boolean;
|
displayInfo: boolean;
|
||||||
providers?: {
|
providers?: {
|
||||||
|
@ -6,7 +6,7 @@ import { id } from "tsafe/id";
|
|||||||
import { assert, type Equals } from "tsafe/assert";
|
import { assert, type Equals } from "tsafe/assert";
|
||||||
import type { LoginThemePageId } from "keycloakify/bin/keycloakify/generateFtl";
|
import type { LoginThemePageId } from "keycloakify/bin/keycloakify/generateFtl";
|
||||||
|
|
||||||
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
|
const PUBLIC_URL = (typeof process !== "object" ? undefined : process.env?.["PUBLIC_URL"]) || "/";
|
||||||
|
|
||||||
const attributes: Attribute[] = [
|
const attributes: Attribute[] = [
|
||||||
{
|
{
|
||||||
@ -234,10 +234,6 @@ export const kcContextCommonMock: KcContext.Common = {
|
|||||||
"clientId": "myApp"
|
"clientId": "myApp"
|
||||||
},
|
},
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
"message": {
|
|
||||||
"type": "success",
|
|
||||||
"summary": "This is a test message"
|
|
||||||
},
|
|
||||||
"isAppInitiatedAction": false
|
"isAppInitiatedAction": false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -264,7 +260,7 @@ export const kcContextMocks = [
|
|||||||
"social": {
|
"social": {
|
||||||
"displayInfo": true
|
"displayInfo": true
|
||||||
},
|
},
|
||||||
"usernameEditDisabled": false,
|
"usernameHidden": false,
|
||||||
"login": {},
|
"login": {},
|
||||||
"registrationDisabled": false
|
"registrationDisabled": false
|
||||||
}),
|
}),
|
||||||
|
@ -25,16 +25,7 @@ export function useFormValidation(params: {
|
|||||||
passwordValidators?: Validators;
|
passwordValidators?: Validators;
|
||||||
i18n: I18n;
|
i18n: I18n;
|
||||||
}) {
|
}) {
|
||||||
const {
|
const { kcContext, passwordValidators = {}, i18n } = params;
|
||||||
kcContext,
|
|
||||||
passwordValidators = {
|
|
||||||
"length": {
|
|
||||||
"ignore.empty.value": true,
|
|
||||||
"min": "4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i18n
|
|
||||||
} = params;
|
|
||||||
|
|
||||||
const attributesWithPassword = useMemo(
|
const attributesWithPassword = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@ -211,7 +202,7 @@ function useGetErrors(params: {
|
|||||||
const { value: defaultValue, validators } = attributes.find(attribute => attribute.name === name)!;
|
const { value: defaultValue, validators } = attributes.find(attribute => attribute.name === name)!;
|
||||||
|
|
||||||
block: {
|
block: {
|
||||||
if (defaultValue !== value) {
|
if ((defaultValue ?? "") !== value) {
|
||||||
break block;
|
break block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
|
|||||||
classes
|
classes
|
||||||
});
|
});
|
||||||
|
|
||||||
const { social, realm, url, usernameEditDisabled, login, auth, registrationDisabled } = kcContext;
|
const { social, realm, url, usernameHidden, login, auth, registrationDisabled } = kcContext;
|
||||||
|
|
||||||
const { msg, msgStr } = i18n;
|
const { msg, msgStr } = i18n;
|
||||||
|
|
||||||
@ -66,40 +66,37 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
|
|||||||
{realm.password && (
|
{realm.password && (
|
||||||
<form id="kc-form-login" onSubmit={onSubmit} action={url.loginAction} method="post">
|
<form id="kc-form-login" onSubmit={onSubmit} action={url.loginAction} method="post">
|
||||||
<div className={getClassName("kcFormGroupClass")}>
|
<div className={getClassName("kcFormGroupClass")}>
|
||||||
{(() => {
|
{!usernameHidden &&
|
||||||
const label = !realm.loginWithEmailAllowed
|
(() => {
|
||||||
? "username"
|
const label = !realm.loginWithEmailAllowed
|
||||||
: realm.registrationEmailAsUsername
|
? "username"
|
||||||
? "email"
|
: realm.registrationEmailAsUsername
|
||||||
: "usernameOrEmail";
|
? "email"
|
||||||
|
: "usernameOrEmail";
|
||||||
|
|
||||||
const autoCompleteHelper: typeof label = label === "usernameOrEmail" ? "username" : label;
|
const autoCompleteHelper: typeof label = label === "usernameOrEmail" ? "username" : label;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<label htmlFor={autoCompleteHelper} className={getClassName("kcLabelClass")}>
|
<label htmlFor={autoCompleteHelper} className={getClassName("kcLabelClass")}>
|
||||||
{msg(label)}
|
{msg(label)}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
tabIndex={1}
|
tabIndex={1}
|
||||||
id={autoCompleteHelper}
|
id={autoCompleteHelper}
|
||||||
className={getClassName("kcInputClass")}
|
className={getClassName("kcInputClass")}
|
||||||
//NOTE: This is used by Google Chrome auto fill so we use it to tell
|
//NOTE: This is used by Google Chrome auto fill so we use it to tell
|
||||||
//the browser how to pre fill the form but before submit we put it back
|
//the browser how to pre fill the form but before submit we put it back
|
||||||
//to username because it is what keycloak expects.
|
//to username because it is what keycloak expects.
|
||||||
name={autoCompleteHelper}
|
name={autoCompleteHelper}
|
||||||
defaultValue={login.username ?? ""}
|
defaultValue={login.username ?? ""}
|
||||||
type="text"
|
type="text"
|
||||||
{...(usernameEditDisabled
|
autoFocus={true}
|
||||||
? { "disabled": true }
|
autoComplete="off"
|
||||||
: {
|
/>
|
||||||
"autoFocus": true,
|
</>
|
||||||
"autoComplete": "off"
|
);
|
||||||
})}
|
})()}
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
})()}
|
|
||||||
</div>
|
</div>
|
||||||
<div className={getClassName("kcFormGroupClass")}>
|
<div className={getClassName("kcFormGroupClass")}>
|
||||||
<label htmlFor="password" className={getClassName("kcLabelClass")}>
|
<label htmlFor="password" className={getClassName("kcLabelClass")}>
|
||||||
@ -116,7 +113,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
|
|||||||
</div>
|
</div>
|
||||||
<div className={clsx(getClassName("kcFormGroupClass"), getClassName("kcFormSettingClass"))}>
|
<div className={clsx(getClassName("kcFormGroupClass"), getClassName("kcFormSettingClass"))}>
|
||||||
<div id="kc-form-options">
|
<div id="kc-form-options">
|
||||||
{realm.rememberMe && !usernameEditDisabled && (
|
{realm.rememberMe && !usernameHidden && (
|
||||||
<div className="checkbox">
|
<div className="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { headInsert } from "keycloakify/tools/headInsert";
|
import { headInsert } from "keycloakify/tools/headInsert";
|
||||||
import { pathJoin } from "keycloakify/bin/tools/pathJoin";
|
|
||||||
import { clsx } from "keycloakify/tools/clsx";
|
import { clsx } from "keycloakify/tools/clsx";
|
||||||
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
||||||
import { useGetClassName } from "keycloakify/login/lib/useGetClassName";
|
import { useGetClassName } from "keycloakify/login/lib/useGetClassName";
|
||||||
@ -24,7 +23,7 @@ export default function LoginOtp(props: PageProps<Extract<KcContext, { pageId: "
|
|||||||
|
|
||||||
const { prLoaded, remove } = headInsert({
|
const { prLoaded, remove } = headInsert({
|
||||||
"type": "javascript",
|
"type": "javascript",
|
||||||
"src": pathJoin(kcContext.url.resourcesCommonPath, "node_modules/jquery/dist/jquery.min.js")
|
"src": `${kcContext.url.resourcesCommonPath}/node_modules/jquery/dist/jquery.min.js`
|
||||||
});
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -123,7 +123,7 @@ export default function LoginUpdatePassword(props: PageProps<Extract<KcContext,
|
|||||||
getClassName("kcButtonLargeClass")
|
getClassName("kcButtonLargeClass")
|
||||||
)}
|
)}
|
||||||
type="submit"
|
type="submit"
|
||||||
defaultValue={msgStr("doSubmit")}
|
value={msgStr("doSubmit")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,7 +17,7 @@ export type UserProfileFormFieldsProps = {
|
|||||||
export function UserProfileFormFields(props: UserProfileFormFieldsProps) {
|
export function UserProfileFormFields(props: UserProfileFormFieldsProps) {
|
||||||
const { kcContext, onIsFormSubmittableValueChange, i18n, getClassName, BeforeField, AfterField } = props;
|
const { kcContext, onIsFormSubmittableValueChange, i18n, getClassName, BeforeField, AfterField } = props;
|
||||||
|
|
||||||
const { advancedMsg } = i18n;
|
const { advancedMsg, msg } = i18n;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
formValidationState: { fieldStateByAttributeName, isFormSubmittable },
|
formValidationState: { fieldStateByAttributeName, isFormSubmittable },
|
||||||
@ -98,11 +98,16 @@ export function UserProfileFormFields(props: UserProfileFormFieldsProps) {
|
|||||||
}
|
}
|
||||||
value={value}
|
value={value}
|
||||||
>
|
>
|
||||||
{options.options.map(option => (
|
<>
|
||||||
<option key={option} value={option}>
|
<option value="" selected disabled hidden>
|
||||||
{option}
|
{msg("selectAnOption")}
|
||||||
</option>
|
</option>
|
||||||
))}
|
{options.options.map(option => (
|
||||||
|
<option key={option} value={option}>
|
||||||
|
{option}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
</select>
|
</select>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,11 @@ const meta: ComponentMeta<any> = {
|
|||||||
export default meta;
|
export default meta;
|
||||||
|
|
||||||
export const Default = () => <PageStory />;
|
export const Default = () => <PageStory />;
|
||||||
export const WithNoMessage = () => (
|
|
||||||
|
export const WithMessage = () => (
|
||||||
<PageStory
|
<PageStory
|
||||||
kcContext={{
|
kcContext={{
|
||||||
message: undefined
|
message: { type: "success", summary: "This is a test message" }
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -74,8 +74,12 @@ export const WithPresetUsername = () => (
|
|||||||
export const WithImmutablePresetUsername = () => (
|
export const WithImmutablePresetUsername = () => (
|
||||||
<PageStory
|
<PageStory
|
||||||
kcContext={{
|
kcContext={{
|
||||||
login: { username: "max.mustermann@mail.com" },
|
auth: {
|
||||||
usernameEditDisabled: true
|
attemptedUsername: "max.mustermann@mail.com",
|
||||||
|
showUsername: true
|
||||||
|
},
|
||||||
|
usernameHidden: true,
|
||||||
|
message: { type: "info", summary: "Please re-authenticate to continue" }
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
108
test/bin/readStaticResourcesUsage.spec.ts
Normal file
108
test/bin/readStaticResourcesUsage.spec.ts
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import { readPaths } from "keycloakify/bin/keycloakify/generateTheme/readStaticResourcesUsage";
|
||||||
|
import { same } from "evt/tools/inDepth/same";
|
||||||
|
import { expect, it, describe } from "vitest";
|
||||||
|
|
||||||
|
describe("Ensure it's able to extract used Keycloak resources", () => {
|
||||||
|
const expectedPaths = {
|
||||||
|
"resourcesCommonFilePaths": [
|
||||||
|
"node_modules/patternfly/dist/css/patternfly.min.css",
|
||||||
|
"node_modules/patternfly/dist/css/patternfly-additions.min.css",
|
||||||
|
"lib/zocial/zocial.css",
|
||||||
|
"node_modules/jquery/dist/jquery.min.js"
|
||||||
|
],
|
||||||
|
"resourcesFilePaths": ["css/login.css"]
|
||||||
|
};
|
||||||
|
|
||||||
|
it("works with coding style n°1", () => {
|
||||||
|
const paths = readPaths({
|
||||||
|
"rawSourceFile": `
|
||||||
|
const { isReady } = usePrepareTemplate({
|
||||||
|
"doFetchDefaultThemeResources": doUseDefaultCss,
|
||||||
|
"styles": [
|
||||||
|
\`\${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css\`,
|
||||||
|
\`\${
|
||||||
|
url.resourcesCommonPath
|
||||||
|
}/node_modules/patternfly/dist/css/patternfly-additions.min.css\`,
|
||||||
|
\`\${resourcesCommonPath }/lib/zocial/zocial.css\`,
|
||||||
|
\`\${url.resourcesPath}/css/login.css\`
|
||||||
|
],
|
||||||
|
"htmlClassName": getClassName("kcHtmlClass"),
|
||||||
|
"bodyClassName": undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const { prLoaded, remove } = headInsert({
|
||||||
|
"type": "javascript",
|
||||||
|
"src": \`\${kcContext.url.resourcesCommonPath}/node_modules/jquery/dist/jquery.min.js\`
|
||||||
|
});
|
||||||
|
|
||||||
|
`
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(same(paths, expectedPaths)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("works with coding style n°2", () => {
|
||||||
|
const paths = readPaths({
|
||||||
|
"rawSourceFile": `
|
||||||
|
|
||||||
|
const { isReady } = usePrepareTemplate({
|
||||||
|
"doFetchDefaultThemeResources": doUseDefaultCss,
|
||||||
|
"styles": [
|
||||||
|
url.resourcesCommonPath + "/node_modules/patternfly/dist/css/patternfly.min.css",
|
||||||
|
url.resourcesCommonPath + '/node_modules/patternfly/dist/css/patternfly-additions.min.css',
|
||||||
|
url.resourcesCommonPath
|
||||||
|
+ "/lib/zocial/zocial.css",
|
||||||
|
url.resourcesPath +
|
||||||
|
'/css/login.css'
|
||||||
|
],
|
||||||
|
"htmlClassName": getClassName("kcHtmlClass"),
|
||||||
|
"bodyClassName": undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const { prLoaded, remove } = headInsert({
|
||||||
|
"type": "javascript",
|
||||||
|
"src": kcContext.url.resourcesCommonPath + "/node_modules/jquery/dist/jquery.min.js\"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(paths);
|
||||||
|
console.log(expectedPaths);
|
||||||
|
|
||||||
|
expect(same(paths, expectedPaths)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("works with coding style n°3", () => {
|
||||||
|
const paths = readPaths({
|
||||||
|
"rawSourceFile": `
|
||||||
|
|
||||||
|
const { isReady } = usePrepareTemplate({
|
||||||
|
"doFetchDefaultThemeResources": doUseDefaultCss,
|
||||||
|
"styles": [
|
||||||
|
path.join(resourcesCommonPath,"/node_modules/patternfly/dist/css/patternfly.min.css"),
|
||||||
|
path.join(url.resourcesCommonPath, '/node_modules/patternfly/dist/css/patternfly-additions.min.css'),
|
||||||
|
path.join(url.resourcesCommonPath,
|
||||||
|
"/lib/zocial/zocial.css"),
|
||||||
|
pathJoin(
|
||||||
|
url.resourcesPath,
|
||||||
|
'css/login.css'
|
||||||
|
)
|
||||||
|
],
|
||||||
|
"htmlClassName": getClassName("kcHtmlClass"),
|
||||||
|
"bodyClassName": undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const { prLoaded, remove } = headInsert({
|
||||||
|
"type": "javascript",
|
||||||
|
"src": path.join(kcContext.url.resourcesCommonPath, "/node_modules/jquery/dist/jquery.min.js")
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(same(paths, expectedPaths)).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
@ -35,10 +35,7 @@ describe("bin/js-transforms", () => {
|
|||||||
`;
|
`;
|
||||||
it("transforms standalone code properly", () => {
|
it("transforms standalone code properly", () => {
|
||||||
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
||||||
"jsCode": jsCodeUntransformed,
|
"jsCode": jsCodeUntransformed
|
||||||
"buildOptions": {
|
|
||||||
"isStandalone": true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const fixedJsCodeExpected = `
|
const fixedJsCodeExpected = `
|
||||||
@ -89,66 +86,6 @@ describe("bin/js-transforms", () => {
|
|||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
expect(isSameCode(fixedJsCode, fixedJsCodeExpected)).toBe(true);
|
|
||||||
});
|
|
||||||
it("transforms external app code properly", () => {
|
|
||||||
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
|
||||||
"jsCode": jsCodeUntransformed,
|
|
||||||
"buildOptions": {
|
|
||||||
"isStandalone": false,
|
|
||||||
"urlOrigin": "https://demo-app.keycloakify.dev"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const fixedJsCodeExpected = `
|
|
||||||
function f() {
|
|
||||||
return ("kcContext" in window ? "https://demo-app.keycloakify.dev/" : a.p) + "static/js/" + ({}[e] || e) + "." + {
|
|
||||||
3: "0664cdc0"
|
|
||||||
}[e] + ".chunk.js"
|
|
||||||
}
|
|
||||||
|
|
||||||
function sameAsF() {
|
|
||||||
return ("kcContext" in window ? "https://demo-app.keycloakify.dev/" : a.p) + "static/js/" + ({}[e] || e) + "." + {
|
|
||||||
3: "0664cdc0"
|
|
||||||
}[e] + ".chunk.js"
|
|
||||||
}
|
|
||||||
|
|
||||||
__webpack_require__[(function (){
|
|
||||||
var pd= Object.getOwnPropertyDescriptor(__webpack_require__, "p");
|
|
||||||
if( pd === undefined || pd.configurable ){
|
|
||||||
var p= "";
|
|
||||||
Object.defineProperty(__webpack_require__, "p", {
|
|
||||||
get: function() { return "kcContext" in window ? "https://demo-app.keycloakify.dev/" : p; },
|
|
||||||
set: function (value){ p = value; }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return "u";
|
|
||||||
})()] = function(e) {
|
|
||||||
return "static/js/" + e + "." + {
|
|
||||||
147: "6c5cee76",
|
|
||||||
787: "8da10fcf",
|
|
||||||
922: "be170a73"
|
|
||||||
} [e] + ".chunk.js"
|
|
||||||
}
|
|
||||||
|
|
||||||
t[(function (){
|
|
||||||
var pd= Object.getOwnPropertyDescriptor(t, "p");
|
|
||||||
if( pd === undefined || pd.configurable ){
|
|
||||||
var p= "";
|
|
||||||
Object.defineProperty(t, "p", {
|
|
||||||
get: function() { return "kcContext" in window ? "https://demo-app.keycloakify.dev/" : p; },
|
|
||||||
set: function (value){ p = value; }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return "miniCssF";
|
|
||||||
})()] = function(e) {
|
|
||||||
return "static/css/" + e + "." + {
|
|
||||||
164:"dcfd7749",
|
|
||||||
908:"67c9ed2c"
|
|
||||||
} [e] + ".chunk.css"
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
expect(isSameCode(fixedJsCode, fixedJsCodeExpected)).toBe(true);
|
expect(isSameCode(fixedJsCode, fixedJsCodeExpected)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -304,7 +241,6 @@ describe("bin/css-inline-transforms", () => {
|
|||||||
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
||||||
cssCode,
|
cssCode,
|
||||||
"buildOptions": {
|
"buildOptions": {
|
||||||
"isStandalone": true,
|
|
||||||
"urlPathname": undefined
|
"urlPathname": undefined
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -344,53 +280,6 @@ describe("bin/css-inline-transforms", () => {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
expect(isSameCode(fixedCssCode, fixedCssCodeExpected)).toBe(true);
|
|
||||||
});
|
|
||||||
it("transforms css for external app properly", () => {
|
|
||||||
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
|
||||||
cssCode,
|
|
||||||
"buildOptions": {
|
|
||||||
"isStandalone": false,
|
|
||||||
"urlOrigin": "https://demo-app.keycloakify.dev",
|
|
||||||
"urlPathname": undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const fixedCssCodeExpected = `
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/fonts/WorkSans/worksans-regular-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/fonts/WorkSans/worksans-medium-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 600;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/fonts/WorkSans/worksans-semibold-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/fonts/WorkSans/worksans-bold-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
expect(isSameCode(fixedCssCode, fixedCssCodeExpected)).toBe(true);
|
expect(isSameCode(fixedCssCode, fixedCssCodeExpected)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -430,7 +319,6 @@ describe("bin/css-inline-transforms", () => {
|
|||||||
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
||||||
cssCode,
|
cssCode,
|
||||||
"buildOptions": {
|
"buildOptions": {
|
||||||
"isStandalone": true,
|
|
||||||
"urlPathname": "/x/y/z/"
|
"urlPathname": "/x/y/z/"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -470,53 +358,6 @@ describe("bin/css-inline-transforms", () => {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
expect(isSameCode(fixedCssCode, fixedCssCodeExpected)).toBe(true);
|
|
||||||
});
|
|
||||||
it("transforms css for external app properly", () => {
|
|
||||||
const { fixedCssCode } = replaceImportsInInlineCssCode({
|
|
||||||
cssCode,
|
|
||||||
"buildOptions": {
|
|
||||||
"isStandalone": false,
|
|
||||||
"urlOrigin": "https://demo-app.keycloakify.dev",
|
|
||||||
"urlPathname": "/x/y/z/"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const fixedCssCodeExpected = `
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/x/y/z/fonts/WorkSans/worksans-regular-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/x/y/z/fonts/WorkSans/worksans-medium-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 600;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/x/y/z/fonts/WorkSans/worksans-semibold-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "Work Sans";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
font-display: swap;
|
|
||||||
src: url(https://demo-app.keycloakify.dev/x/y/z/fonts/WorkSans/worksans-bold-webfont.woff2)
|
|
||||||
format("woff2");
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
expect(isSameCode(fixedCssCode, fixedCssCodeExpected)).toBe(true);
|
expect(isSameCode(fixedCssCode, fixedCssCodeExpected)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,8 @@ export const sampleReactProjectDirPath = pathJoin(getProjectRoot(), "sample_reac
|
|||||||
async function setupSampleReactProject(destDir: string) {
|
async function setupSampleReactProject(destDir: string) {
|
||||||
await downloadAndUnzip({
|
await downloadAndUnzip({
|
||||||
"url": "https://github.com/keycloakify/keycloakify/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
|
"url": "https://github.com/keycloakify/keycloakify/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
|
||||||
"destDirPath": destDir
|
"destDirPath": destDir,
|
||||||
|
"doUseCache": false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let parsedPackageJson: Record<string, unknown> = {};
|
let parsedPackageJson: Record<string, unknown> = {};
|
||||||
@ -51,17 +52,19 @@ describe("Sample Project", () => {
|
|||||||
await setupSampleReactProject(sampleReactProjectDirPath);
|
await setupSampleReactProject(sampleReactProjectDirPath);
|
||||||
await initializeEmailTheme();
|
await initializeEmailTheme();
|
||||||
|
|
||||||
|
const projectDirPath = process.cwd();
|
||||||
|
|
||||||
const destDirPath = pathJoin(
|
const destDirPath = pathJoin(
|
||||||
readBuildOptions({
|
readBuildOptions({
|
||||||
"processArgv": ["--silent"],
|
"processArgv": ["--silent"],
|
||||||
"projectDirPath": process.cwd()
|
projectDirPath
|
||||||
}).keycloakifyBuildDirPath,
|
}).keycloakifyBuildDirPath,
|
||||||
"src",
|
"src",
|
||||||
"main",
|
"main",
|
||||||
"resources",
|
"resources",
|
||||||
"theme"
|
"theme"
|
||||||
);
|
);
|
||||||
await downloadBuiltinKeycloakTheme({ destDirPath, keycloakVersion: "11.0.3", "isSilent": false });
|
await downloadBuiltinKeycloakTheme({ destDirPath, "keycloakVersion": "11.0.3", projectDirPath });
|
||||||
},
|
},
|
||||||
{ timeout: 90000 }
|
{ timeout: 90000 }
|
||||||
);
|
);
|
||||||
@ -77,17 +80,19 @@ describe("Sample Project", () => {
|
|||||||
await setupSampleReactProject(pathJoin(sampleReactProjectDirPath, "custom_input"));
|
await setupSampleReactProject(pathJoin(sampleReactProjectDirPath, "custom_input"));
|
||||||
await initializeEmailTheme();
|
await initializeEmailTheme();
|
||||||
|
|
||||||
|
const projectDirPath = process.cwd();
|
||||||
|
|
||||||
const destDirPath = pathJoin(
|
const destDirPath = pathJoin(
|
||||||
readBuildOptions({
|
readBuildOptions({
|
||||||
"processArgv": ["--silent"],
|
"processArgv": ["--silent"],
|
||||||
"projectDirPath": process.cwd()
|
projectDirPath
|
||||||
}).keycloakifyBuildDirPath,
|
}).keycloakifyBuildDirPath,
|
||||||
"src",
|
"src",
|
||||||
"main",
|
"main",
|
||||||
"resources",
|
"resources",
|
||||||
"theme"
|
"theme"
|
||||||
);
|
);
|
||||||
await downloadBuiltinKeycloakTheme({ destDirPath, "keycloakVersion": "11.0.3", "isSilent": false });
|
await downloadBuiltinKeycloakTheme({ destDirPath, "keycloakVersion": "11.0.3", projectDirPath });
|
||||||
},
|
},
|
||||||
{ timeout: 90000 }
|
{ timeout: 90000 }
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@ import { downloadAndUnzip } from "keycloakify/bin/tools/downloadAndUnzip";
|
|||||||
export async function setupSampleReactProject(destDirPath: string) {
|
export async function setupSampleReactProject(destDirPath: string) {
|
||||||
await downloadAndUnzip({
|
await downloadAndUnzip({
|
||||||
"url": "https://github.com/keycloakify/keycloakify/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
|
"url": "https://github.com/keycloakify/keycloakify/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
|
||||||
"destDirPath": destDirPath
|
"destDirPath": destDirPath,
|
||||||
|
"doUseCache": false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
68
test/bin/tools/crawl.spec.ts
Normal file
68
test/bin/tools/crawl.spec.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import path from "path";
|
||||||
|
import { it, describe, expect, vi, beforeAll, afterAll } from "vitest";
|
||||||
|
import { crawl } from "keycloakify/bin/tools/crawl";
|
||||||
|
|
||||||
|
describe("crawl", () => {
|
||||||
|
describe("crawRec", () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
vi.mock("node:fs", async () => {
|
||||||
|
const mod = await vi.importActual<typeof import("fs")>("fs");
|
||||||
|
return {
|
||||||
|
...mod,
|
||||||
|
readdirSync: vi.fn().mockImplementation((dir_path: string) => {
|
||||||
|
switch (dir_path) {
|
||||||
|
case "root_dir":
|
||||||
|
return ["sub_1_dir", "file_1", "sub_2_dir", "file_2"];
|
||||||
|
case path.join("root_dir", "sub_1_dir"):
|
||||||
|
return ["file_3", "sub_3_dir", "file_4"];
|
||||||
|
case path.join("root_dir", "sub_1_dir", "sub_3_dir"):
|
||||||
|
return ["file_5"];
|
||||||
|
case path.join("root_dir", "sub_2_dir"):
|
||||||
|
return [];
|
||||||
|
default: {
|
||||||
|
const enoent = new Error(`ENOENT: no such file or directory, scandir '${dir_path}'`);
|
||||||
|
// @ts-ignore
|
||||||
|
enoent.code = "ENOENT";
|
||||||
|
// @ts-ignore
|
||||||
|
enoent.syscall = "open";
|
||||||
|
// @ts-ignore
|
||||||
|
enoent.path = dir_path;
|
||||||
|
throw enoent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
lstatSync: vi.fn().mockImplementation((file_path: string) => {
|
||||||
|
return { isDirectory: () => file_path.endsWith("_dir") };
|
||||||
|
})
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
afterAll(() => {
|
||||||
|
vi.resetAllMocks();
|
||||||
|
});
|
||||||
|
it("returns files under a given dir_path", async () => {
|
||||||
|
const paths = crawl({ "dirPath": "root_dir/sub_1_dir/sub_3_dir", "returnedPathsType": "absolute" });
|
||||||
|
expect(paths).toEqual(["root_dir/sub_1_dir/sub_3_dir/file_5"]);
|
||||||
|
});
|
||||||
|
it("returns files recursively under a given dir_path", async () => {
|
||||||
|
const paths = crawl({ "dirPath": "root_dir", "returnedPathsType": "absolute" });
|
||||||
|
expect(paths).toEqual([
|
||||||
|
"root_dir/sub_1_dir/file_3",
|
||||||
|
"root_dir/sub_1_dir/sub_3_dir/file_5",
|
||||||
|
"root_dir/sub_1_dir/file_4",
|
||||||
|
"root_dir/file_1",
|
||||||
|
"root_dir/file_2"
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
it("throw dir_path does not exist", async () => {
|
||||||
|
try {
|
||||||
|
crawl({ "dirPath": "404", "returnedPathsType": "absolute" });
|
||||||
|
} catch {
|
||||||
|
expect(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
124
yarn.lock
124
yarn.lock
@ -75,6 +75,16 @@
|
|||||||
"@jridgewell/trace-mapping" "^0.3.17"
|
"@jridgewell/trace-mapping" "^0.3.17"
|
||||||
jsesc "^2.5.1"
|
jsesc "^2.5.1"
|
||||||
|
|
||||||
|
"@babel/generator@^7.22.9":
|
||||||
|
version "7.22.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.9.tgz#572ecfa7a31002fa1de2a9d91621fd895da8493d"
|
||||||
|
integrity sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw==
|
||||||
|
dependencies:
|
||||||
|
"@babel/types" "^7.22.5"
|
||||||
|
"@jridgewell/gen-mapping" "^0.3.2"
|
||||||
|
"@jridgewell/trace-mapping" "^0.3.17"
|
||||||
|
jsesc "^2.5.1"
|
||||||
|
|
||||||
"@babel/helper-annotate-as-pure@^7.18.6":
|
"@babel/helper-annotate-as-pure@^7.18.6":
|
||||||
version "7.18.6"
|
version "7.18.6"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb"
|
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb"
|
||||||
@ -269,11 +279,21 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
|
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
|
||||||
integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
|
integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
|
||||||
|
|
||||||
|
"@babel/helper-string-parser@^7.22.5":
|
||||||
|
version "7.22.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f"
|
||||||
|
integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==
|
||||||
|
|
||||||
"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1":
|
"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1":
|
||||||
version "7.19.1"
|
version "7.19.1"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
|
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
|
||||||
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
|
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
|
||||||
|
|
||||||
|
"@babel/helper-validator-identifier@^7.22.5":
|
||||||
|
version "7.22.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193"
|
||||||
|
integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==
|
||||||
|
|
||||||
"@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0":
|
"@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0":
|
||||||
version "7.21.0"
|
version "7.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180"
|
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180"
|
||||||
@ -312,6 +332,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.4.tgz#94003fdfc520bbe2875d4ae557b43ddb6d880f17"
|
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.4.tgz#94003fdfc520bbe2875d4ae557b43ddb6d880f17"
|
||||||
integrity sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==
|
integrity sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==
|
||||||
|
|
||||||
|
"@babel/parser@^7.22.7":
|
||||||
|
version "7.22.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae"
|
||||||
|
integrity sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==
|
||||||
|
|
||||||
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6":
|
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6":
|
||||||
version "7.18.6"
|
version "7.18.6"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2"
|
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2"
|
||||||
@ -1120,6 +1145,15 @@
|
|||||||
debug "^4.1.0"
|
debug "^4.1.0"
|
||||||
globals "^11.1.0"
|
globals "^11.1.0"
|
||||||
|
|
||||||
|
"@babel/types@^7.0.0", "@babel/types@^7.22.5":
|
||||||
|
version "7.22.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.5.tgz#cd93eeaab025880a3a47ec881f4b096a5b786fbe"
|
||||||
|
integrity sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==
|
||||||
|
dependencies:
|
||||||
|
"@babel/helper-string-parser" "^7.22.5"
|
||||||
|
"@babel/helper-validator-identifier" "^7.22.5"
|
||||||
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@babel/types@^7.12.11", "@babel/types@^7.12.7", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.2.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.21.4", "@babel/types@^7.4.4":
|
"@babel/types@^7.12.11", "@babel/types@^7.12.7", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.2.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.21.4", "@babel/types@^7.4.4":
|
||||||
version "7.21.4"
|
version "7.21.4"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.4.tgz#2d5d6bb7908699b3b416409ffd3b5daa25b030d4"
|
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.4.tgz#2d5d6bb7908699b3b416409ffd3b5daa25b030d4"
|
||||||
@ -2763,6 +2797,13 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.1.tgz#3286741fb8f1e1580ac28784add4c7a1d49bdfbc"
|
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.1.tgz#3286741fb8f1e1580ac28784add4c7a1d49bdfbc"
|
||||||
integrity sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==
|
integrity sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==
|
||||||
|
|
||||||
|
"@types/babel__generator@^7.6.4":
|
||||||
|
version "7.6.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7"
|
||||||
|
integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==
|
||||||
|
dependencies:
|
||||||
|
"@babel/types" "^7.0.0"
|
||||||
|
|
||||||
"@types/chai-subset@^1.3.3":
|
"@types/chai-subset@^1.3.3":
|
||||||
version "1.3.3"
|
version "1.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-subset/-/chai-subset-1.3.3.tgz#97893814e92abd2c534de422cb377e0e0bdaac94"
|
resolved "https://registry.yarnpkg.com/@types/chai-subset/-/chai-subset-1.3.3.tgz#97893814e92abd2c534de422cb377e0e0bdaac94"
|
||||||
@ -3816,6 +3857,16 @@ assert@^1.1.1:
|
|||||||
object-assign "^4.1.1"
|
object-assign "^4.1.1"
|
||||||
util "0.10.3"
|
util "0.10.3"
|
||||||
|
|
||||||
|
assert@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/assert/-/assert-2.0.0.tgz#95fc1c616d48713510680f2eaf2d10dd22e02d32"
|
||||||
|
integrity sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==
|
||||||
|
dependencies:
|
||||||
|
es6-object-assign "^1.1.0"
|
||||||
|
is-nan "^1.2.1"
|
||||||
|
object-is "^1.0.1"
|
||||||
|
util "^0.12.0"
|
||||||
|
|
||||||
assertion-error@^1.1.0:
|
assertion-error@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
|
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
|
||||||
@ -3833,6 +3884,13 @@ ast-types@^0.14.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
tslib "^2.0.1"
|
tslib "^2.0.1"
|
||||||
|
|
||||||
|
ast-types@^0.16.1:
|
||||||
|
version "0.16.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.16.1.tgz#7a9da1617c9081bc121faafe91711b4c8bb81da2"
|
||||||
|
integrity sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==
|
||||||
|
dependencies:
|
||||||
|
tslib "^2.0.1"
|
||||||
|
|
||||||
astral-regex@^2.0.0:
|
astral-regex@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
|
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
|
||||||
@ -5739,6 +5797,11 @@ es6-iterator@^2.0.3:
|
|||||||
es5-ext "^0.10.35"
|
es5-ext "^0.10.35"
|
||||||
es6-symbol "^3.1.1"
|
es6-symbol "^3.1.1"
|
||||||
|
|
||||||
|
es6-object-assign@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
|
||||||
|
integrity sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==
|
||||||
|
|
||||||
es6-shim@^0.35.5:
|
es6-shim@^0.35.5:
|
||||||
version "0.35.8"
|
version "0.35.8"
|
||||||
resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.8.tgz#89216f6fbf8bacba3f897c8c0e814d2a41c05fb7"
|
resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.8.tgz#89216f6fbf8bacba3f897c8c0e814d2a41c05fb7"
|
||||||
@ -5853,7 +5916,7 @@ eslint-visitor-keys@^3.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc"
|
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc"
|
||||||
integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==
|
integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==
|
||||||
|
|
||||||
esprima@^4.0.0, esprima@^4.0.1:
|
esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0:
|
||||||
version "4.0.1"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
|
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
|
||||||
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
|
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
|
||||||
@ -7177,7 +7240,7 @@ is-alphanumerical@^1.0.0:
|
|||||||
is-alphabetical "^1.0.0"
|
is-alphabetical "^1.0.0"
|
||||||
is-decimal "^1.0.0"
|
is-decimal "^1.0.0"
|
||||||
|
|
||||||
is-arguments@^1.1.1:
|
is-arguments@^1.0.4, is-arguments@^1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b"
|
resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b"
|
||||||
integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==
|
integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==
|
||||||
@ -7351,6 +7414,13 @@ is-function@^1.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08"
|
resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08"
|
||||||
integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==
|
integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==
|
||||||
|
|
||||||
|
is-generator-function@^1.0.7:
|
||||||
|
version "1.0.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72"
|
||||||
|
integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==
|
||||||
|
dependencies:
|
||||||
|
has-tostringtag "^1.0.0"
|
||||||
|
|
||||||
is-glob@^3.0.0, is-glob@^3.1.0:
|
is-glob@^3.0.0, is-glob@^3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
|
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
|
||||||
@ -7380,6 +7450,14 @@ is-map@^2.0.1, is-map@^2.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127"
|
resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127"
|
||||||
integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==
|
integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==
|
||||||
|
|
||||||
|
is-nan@^1.2.1:
|
||||||
|
version "1.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.3.2.tgz#043a54adea31748b55b6cd4e09aadafa69bd9e1d"
|
||||||
|
integrity sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==
|
||||||
|
dependencies:
|
||||||
|
call-bind "^1.0.0"
|
||||||
|
define-properties "^1.1.3"
|
||||||
|
|
||||||
is-negative-zero@^2.0.2:
|
is-negative-zero@^2.0.2:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150"
|
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150"
|
||||||
@ -7496,6 +7574,13 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.9:
|
|||||||
gopd "^1.0.1"
|
gopd "^1.0.1"
|
||||||
has-tostringtag "^1.0.0"
|
has-tostringtag "^1.0.0"
|
||||||
|
|
||||||
|
is-typed-array@^1.1.3:
|
||||||
|
version "1.1.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a"
|
||||||
|
integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==
|
||||||
|
dependencies:
|
||||||
|
which-typed-array "^1.1.11"
|
||||||
|
|
||||||
is-typedarray@^1.0.0:
|
is-typedarray@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
|
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
|
||||||
@ -8769,7 +8854,7 @@ object-inspect@^1.12.3, object-inspect@^1.9.0:
|
|||||||
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9"
|
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9"
|
||||||
integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==
|
integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==
|
||||||
|
|
||||||
object-is@^1.1.5:
|
object-is@^1.0.1, object-is@^1.1.5:
|
||||||
version "1.1.5"
|
version "1.1.5"
|
||||||
resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac"
|
resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac"
|
||||||
integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==
|
integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==
|
||||||
@ -9916,6 +10001,17 @@ readdirp@~3.6.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
picomatch "^2.2.1"
|
picomatch "^2.2.1"
|
||||||
|
|
||||||
|
recast@^0.23.3:
|
||||||
|
version "0.23.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/recast/-/recast-0.23.3.tgz#f205d1f46b2c6f730de413ab18f96c166263d85f"
|
||||||
|
integrity sha512-HbCVFh2ANP6a09nzD4lx7XthsxMOJWKX5pIcUwtLrmeEIl3I0DwjCoVXDE0Aobk+7k/mS3H50FK4iuYArpcT6Q==
|
||||||
|
dependencies:
|
||||||
|
assert "^2.0.0"
|
||||||
|
ast-types "^0.16.1"
|
||||||
|
esprima "~4.0.0"
|
||||||
|
source-map "~0.6.1"
|
||||||
|
tslib "^2.0.1"
|
||||||
|
|
||||||
redent@^1.0.0:
|
redent@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde"
|
resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde"
|
||||||
@ -11750,6 +11846,17 @@ util@^0.11.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
inherits "2.0.3"
|
inherits "2.0.3"
|
||||||
|
|
||||||
|
util@^0.12.0:
|
||||||
|
version "0.12.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc"
|
||||||
|
integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==
|
||||||
|
dependencies:
|
||||||
|
inherits "^2.0.3"
|
||||||
|
is-arguments "^1.0.4"
|
||||||
|
is-generator-function "^1.0.7"
|
||||||
|
is-typed-array "^1.1.3"
|
||||||
|
which-typed-array "^1.1.2"
|
||||||
|
|
||||||
utila@~0.4:
|
utila@~0.4:
|
||||||
version "0.4.0"
|
version "0.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c"
|
resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c"
|
||||||
@ -12085,6 +12192,17 @@ which-pm-runs@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.1.0.tgz#35ccf7b1a0fce87bd8b92a478c9d045785d3bf35"
|
resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.1.0.tgz#35ccf7b1a0fce87bd8b92a478c9d045785d3bf35"
|
||||||
integrity sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==
|
integrity sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==
|
||||||
|
|
||||||
|
which-typed-array@^1.1.11, which-typed-array@^1.1.2:
|
||||||
|
version "1.1.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a"
|
||||||
|
integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==
|
||||||
|
dependencies:
|
||||||
|
available-typed-arrays "^1.0.5"
|
||||||
|
call-bind "^1.0.2"
|
||||||
|
for-each "^0.3.3"
|
||||||
|
gopd "^1.0.1"
|
||||||
|
has-tostringtag "^1.0.0"
|
||||||
|
|
||||||
which-typed-array@^1.1.9:
|
which-typed-array@^1.1.9:
|
||||||
version "1.1.9"
|
version "1.1.9"
|
||||||
resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6"
|
resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6"
|
||||||
|
Reference in New Issue
Block a user