keycloakify 10.0.0-rc.38 → 10.0.0-rc.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/bin/193.index.js +13 -13
  2. package/bin/3.index.js +86 -86
  3. package/bin/322.index.js +595 -0
  4. package/bin/453.index.js +3 -3
  5. package/bin/526.index.js +42 -633
  6. package/bin/538.index.js +68 -57
  7. package/bin/932.index.js +7 -7
  8. package/bin/944.index.js +621 -0
  9. package/bin/961.index.js +5 -5
  10. package/bin/97.index.js +3 -3
  11. package/bin/{21.index.js → 98.index.js} +59 -48
  12. package/bin/main.js +8 -8
  13. package/lib/getKcClsx.js +12 -1
  14. package/lib/getKcClsx.js.map +1 -1
  15. package/login/Fallback.d.ts +1 -0
  16. package/login/Fallback.js.map +1 -1
  17. package/login/UserProfileFormFields.d.ts +1 -0
  18. package/login/UserProfileFormFields.js +1 -3
  19. package/login/UserProfileFormFields.js.map +1 -1
  20. package/login/i18n/i18n.js +1 -1
  21. package/login/pages/IdpReviewUserProfile.d.ts +1 -0
  22. package/login/pages/IdpReviewUserProfile.js +2 -2
  23. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  24. package/login/pages/LoginUpdateProfile.d.ts +1 -0
  25. package/login/pages/LoginUpdateProfile.js +2 -2
  26. package/login/pages/LoginUpdateProfile.js.map +1 -1
  27. package/login/pages/Register.d.ts +1 -0
  28. package/login/pages/Register.js +2 -2
  29. package/login/pages/Register.js.map +1 -1
  30. package/login/pages/UpdateEmail.d.ts +1 -0
  31. package/login/pages/UpdateEmail.js +2 -2
  32. package/login/pages/UpdateEmail.js.map +1 -1
  33. package/package.json +5 -8
  34. package/src/bin/add-story.ts +3 -3
  35. package/src/bin/copy-keycloak-resources-to-public.ts +3 -3
  36. package/src/bin/download-keycloak-default-theme.ts +5 -5
  37. package/src/bin/eject-page.ts +3 -3
  38. package/src/bin/initialize-email-theme.ts +5 -5
  39. package/src/bin/keycloakify/buildJars/buildJar.ts +14 -14
  40. package/src/bin/keycloakify/buildJars/buildJars.ts +8 -8
  41. package/src/bin/keycloakify/buildJars/generatePom.ts +9 -9
  42. package/src/bin/keycloakify/generateFtl/generateFtl.ts +12 -12
  43. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +7 -7
  44. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +9 -9
  45. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +25 -25
  46. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +8 -8
  47. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +9 -9
  48. package/src/bin/keycloakify/keycloakify.ts +11 -11
  49. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +6 -6
  50. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +7 -7
  51. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +10 -10
  52. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +13 -13
  53. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +11 -11
  54. package/src/bin/main.ts +2 -2
  55. package/src/bin/shared/{buildOptions.ts → buildContext.ts} +62 -51
  56. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +12 -12
  57. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +7 -7
  58. package/src/bin/shared/downloadKeycloakStaticResources.ts +7 -7
  59. package/src/bin/shared/generateKcGenTs.ts +12 -12
  60. package/src/bin/shared/getThemeSrcDirPath.ts +3 -3
  61. package/src/bin/start-keycloak/appBuild.ts +11 -11
  62. package/src/bin/start-keycloak/keycloakifyBuild.ts +7 -7
  63. package/src/bin/start-keycloak/start-keycloak.ts +34 -22
  64. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +3 -3
  65. package/src/bin/update-kc-gen.ts +3 -3
  66. package/src/lib/getKcClsx.ts +15 -1
  67. package/src/login/Fallback.tsx +1 -0
  68. package/src/login/UserProfileFormFields.tsx +2 -4
  69. package/src/login/i18n/i18n.tsx +1 -1
  70. package/src/login/pages/IdpReviewUserProfile.tsx +8 -2
  71. package/src/login/pages/LoginUpdateProfile.tsx +8 -2
  72. package/src/login/pages/Register.tsx +8 -2
  73. package/src/login/pages/UpdateEmail.tsx +8 -2
  74. package/src/vite-plugin/vite-plugin.ts +19 -19
  75. package/vite-plugin/index.js +91 -80
  76. package/vite-plugin/vite-plugin.d.ts +3 -3
  77. package/bin/795.index.js +0 -1198
  78. package/lib/isStorybook.d.ts +0 -1
  79. package/lib/isStorybook.js +0 -3
  80. package/lib/isStorybook.js.map +0 -1
  81. package/src/lib/isStorybook.ts +0 -3
package/bin/795.index.js DELETED
@@ -1,1198 +0,0 @@
1
- "use strict";
2
- exports.id = 795;
3
- exports.ids = [795];
4
- exports.modules = {
5
-
6
- /***/ 54659:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
-
10
- // EXPORTS
11
- __webpack_require__.d(__webpack_exports__, {
12
- "d": () => (/* binding */ readBuildOptions)
13
- });
14
-
15
- // EXTERNAL MODULE: external "url"
16
- var external_url_ = __webpack_require__(57310);
17
- // EXTERNAL MODULE: external "path"
18
- var external_path_ = __webpack_require__(71017);
19
- // EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
20
- var getAbsoluteAndInOsFormatPath = __webpack_require__(86644);
21
- // EXTERNAL MODULE: external "child_process"
22
- var external_child_process_ = __webpack_require__(32081);
23
- // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
24
- var assert = __webpack_require__(88078);
25
- // EXTERNAL MODULE: external "fs"
26
- var external_fs_ = __webpack_require__(57147);
27
- ;// CONCATENATED MODULE: ./dist/bin/tools/getNpmWorkspaceRootDirPath.js
28
-
29
-
30
-
31
-
32
- function getNpmWorkspaceRootDirPath(params) {
33
- const { reactAppRootDirPath, dependencyExpected } = params;
34
- const npmWorkspaceRootDirPath = (function callee(depth) {
35
- const cwd = (0,external_path_.resolve)((0,external_path_.join)(...[reactAppRootDirPath, ...Array(depth).fill("..")]));
36
- (0,assert.assert)(cwd !== external_path_.sep, "NPM workspace not found");
37
- try {
38
- external_child_process_.execSync("npm config get", {
39
- cwd,
40
- stdio: "ignore"
41
- });
42
- }
43
- catch (error) {
44
- if (String(error).includes("ENOWORKSPACES")) {
45
- return callee(depth + 1);
46
- }
47
- throw error;
48
- }
49
- const packageJsonFilePath = (0,external_path_.join)(cwd, "package.json");
50
- if (!external_fs_.existsSync(packageJsonFilePath)) {
51
- return callee(depth + 1);
52
- }
53
- (0,assert.assert)(external_fs_.existsSync(packageJsonFilePath));
54
- const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
55
- let isExpectedDependencyFound = false;
56
- for (const dependenciesOrDevDependencies of [
57
- "dependencies",
58
- "devDependencies"
59
- ]) {
60
- const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
61
- if (dependencies === undefined) {
62
- continue;
63
- }
64
- (0,assert.assert)(dependencies instanceof Object);
65
- if (dependencies[dependencyExpected] === undefined) {
66
- continue;
67
- }
68
- isExpectedDependencyFound = true;
69
- }
70
- if (!isExpectedDependencyFound && parsedPackageJson.name !== dependencyExpected) {
71
- return callee(depth + 1);
72
- }
73
- return cwd;
74
- })(0);
75
- return { npmWorkspaceRootDirPath };
76
- }
77
- //# sourceMappingURL=getNpmWorkspaceRootDirPath.js.map
78
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
79
- var lib = __webpack_require__(52300);
80
- // EXTERNAL MODULE: ./node_modules/tsafe/index.js
81
- var tsafe = __webpack_require__(1666);
82
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
83
- var constants = __webpack_require__(173);
84
- ;// CONCATENATED MODULE: ./dist/bin/shared/buildOptions.js
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
- function readBuildOptions(params) {
95
- var _a, _b, _c, _d, _e, _f;
96
- const { cliCommandOptions } = params;
97
- const reactAppRootDirPath = (() => {
98
- if (cliCommandOptions.reactAppRootDirPath === undefined) {
99
- return process.cwd();
100
- }
101
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
102
- pathIsh: cliCommandOptions.reactAppRootDirPath,
103
- cwd: process.cwd()
104
- });
105
- })();
106
- const { resolvedViteConfig } = (() => {
107
- if (external_fs_.readdirSync(reactAppRootDirPath)
108
- .find(fileBasename => fileBasename.startsWith("vite.config")) ===
109
- undefined) {
110
- return { resolvedViteConfig: undefined };
111
- }
112
- const output = external_child_process_.execSync("npx vite", {
113
- cwd: reactAppRootDirPath,
114
- env: Object.assign(Object.assign({}, process.env), { [constants/* vitePluginSubScriptEnvNames.resolveViteConfig */.fe.resolveViteConfig]: "true" })
115
- })
116
- .toString("utf8");
117
- (0,tsafe.assert)(output.includes(constants/* vitePluginSubScriptEnvNames.resolveViteConfig */.fe.resolveViteConfig), "Seems like the Keycloakify's Vite plugin is not installed.");
118
- const resolvedViteConfigStr = output
119
- .split(constants/* vitePluginSubScriptEnvNames.resolveViteConfig */.fe.resolveViteConfig)
120
- .reverse()[0];
121
- const resolvedViteConfig = JSON.parse(resolvedViteConfigStr);
122
- return { resolvedViteConfig };
123
- })();
124
- const parsedPackageJson = (() => {
125
- const zParsedPackageJson = lib.z.object({
126
- name: lib.z.string(),
127
- version: lib.z.string().optional(),
128
- homepage: lib.z.string().optional(),
129
- keycloakify: lib.z.object({
130
- extraThemeProperties: lib.z.array(lib.z.string()).optional(),
131
- artifactId: lib.z.string().optional(),
132
- groupId: lib.z.string().optional(),
133
- loginThemeResourcesFromKeycloakVersion: lib.z.string().optional(),
134
- reactAppBuildDirPath: lib.z.string().optional(),
135
- keycloakifyBuildDirPath: lib.z.string().optional(),
136
- themeName: lib.z.union([lib.z.string(), lib.z.array(lib.z.string())]).optional()
137
- })
138
- .optional()
139
- });
140
- {
141
- (0,tsafe.assert)();
142
- (0,tsafe.assert)();
143
- }
144
- return zParsedPackageJson.parse(JSON.parse(external_fs_.readFileSync((0,external_path_.join)(reactAppRootDirPath, "package.json"))
145
- .toString("utf8")));
146
- })();
147
- const userProvidedBuildOptions = Object.assign(Object.assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.userProvidedBuildOptions);
148
- const themeNames = (() => {
149
- if (userProvidedBuildOptions.themeName === undefined) {
150
- return [
151
- parsedPackageJson.name
152
- .replace(/^@(.*)/, "$1")
153
- .split("/")
154
- .join("-")
155
- ];
156
- }
157
- if (typeof userProvidedBuildOptions.themeName === "string") {
158
- return [userProvidedBuildOptions.themeName];
159
- }
160
- return userProvidedBuildOptions.themeName;
161
- })();
162
- const reactAppBuildDirPath = (() => {
163
- var _a;
164
- webpack: {
165
- if (resolvedViteConfig !== undefined) {
166
- break webpack;
167
- }
168
- if (((_a = parsedPackageJson.keycloakify) === null || _a === void 0 ? void 0 : _a.reactAppBuildDirPath) !== undefined) {
169
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
170
- pathIsh: parsedPackageJson.keycloakify.reactAppBuildDirPath,
171
- cwd: reactAppRootDirPath
172
- });
173
- }
174
- return (0,external_path_.join)(reactAppRootDirPath, "build");
175
- }
176
- return (0,external_path_.join)(reactAppRootDirPath, resolvedViteConfig.buildDir);
177
- })();
178
- const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
179
- reactAppRootDirPath,
180
- dependencyExpected: "keycloakify"
181
- });
182
- return {
183
- bundler: resolvedViteConfig !== undefined ? "vite" : "webpack",
184
- themeVersion: (_b = (_a = process.env.KEYCLOAKIFY_THEME_VERSION) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
185
- themeNames,
186
- extraThemeProperties: userProvidedBuildOptions.extraThemeProperties,
187
- groupId: (() => {
188
- var _a, _b, _c, _d, _e;
189
- const fallbackGroupId = `${themeNames[0]}.keycloak`;
190
- return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : userProvidedBuildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
191
- ? fallbackGroupId
192
- : (_e = (_d = (_c = (0,external_url_.parse)(parsedPackageJson.homepage)
193
- .host) === null || _c === void 0 ? void 0 : _c.replace(/:[0-9]+$/, "")) === null || _d === void 0 ? void 0 : _d.split(".").reverse().join(".")) !== null && _e !== void 0 ? _e : fallbackGroupId) + ".keycloak");
194
- })(),
195
- artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : userProvidedBuildOptions.artifactId) !== null && _d !== void 0 ? _d : `${themeNames[0]}-keycloak-theme`,
196
- loginThemeResourcesFromKeycloakVersion: (_e = userProvidedBuildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
197
- reactAppRootDirPath,
198
- reactAppBuildDirPath,
199
- keycloakifyBuildDirPath: (() => {
200
- if (userProvidedBuildOptions.keycloakifyBuildDirPath !== undefined) {
201
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
202
- pathIsh: userProvidedBuildOptions.keycloakifyBuildDirPath,
203
- cwd: reactAppRootDirPath
204
- });
205
- }
206
- return (0,external_path_.join)(reactAppRootDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
207
- ? "build_keycloak"
208
- : `${resolvedViteConfig.buildDir}_keycloak`);
209
- })(),
210
- publicDirPath: (() => {
211
- webpack: {
212
- if (resolvedViteConfig !== undefined) {
213
- break webpack;
214
- }
215
- if (process.env.PUBLIC_DIR_PATH !== undefined) {
216
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
217
- pathIsh: process.env.PUBLIC_DIR_PATH,
218
- cwd: reactAppRootDirPath
219
- });
220
- }
221
- return (0,external_path_.join)(reactAppRootDirPath, "public");
222
- }
223
- return (0,external_path_.join)(reactAppRootDirPath, resolvedViteConfig.publicDir);
224
- })(),
225
- cacheDirPath: (() => {
226
- const cacheDirPath = (0,external_path_.join)((() => {
227
- if (process.env.XDG_CACHE_HOME !== undefined) {
228
- return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
229
- pathIsh: process.env.XDG_CACHE_HOME,
230
- cwd: process.cwd()
231
- });
232
- }
233
- return (0,external_path_.join)(npmWorkspaceRootDirPath, "node_modules", ".cache");
234
- })(), "keycloakify");
235
- return cacheDirPath;
236
- })(),
237
- urlPathname: (() => {
238
- webpack: {
239
- if (resolvedViteConfig !== undefined) {
240
- break webpack;
241
- }
242
- const { homepage } = parsedPackageJson;
243
- let url = undefined;
244
- if (homepage !== undefined) {
245
- url = new URL(homepage);
246
- }
247
- if (url === undefined) {
248
- return undefined;
249
- }
250
- const out = url.pathname.replace(/([^/])$/, "$1/");
251
- return out === "/" ? undefined : out;
252
- }
253
- return resolvedViteConfig.urlPathname;
254
- })(),
255
- assetsDirPath: (() => {
256
- webpack: {
257
- if (resolvedViteConfig !== undefined) {
258
- break webpack;
259
- }
260
- return (0,external_path_.join)(reactAppBuildDirPath, "static");
261
- }
262
- return (0,external_path_.join)(reactAppBuildDirPath, resolvedViteConfig.assetsDir);
263
- })(),
264
- npmWorkspaceRootDirPath,
265
- kcContextExclusionsFtlCode: userProvidedBuildOptions.kcContextExclusionsFtlCode,
266
- environmentVariables: (_f = userProvidedBuildOptions.environmentVariables) !== null && _f !== void 0 ? _f : []
267
- };
268
- }
269
- //# sourceMappingURL=buildOptions.js.map
270
-
271
- /***/ }),
272
-
273
- /***/ 173:
274
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
275
-
276
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
277
- /* harmony export */ "M": () => (/* binding */ basenameOfTheKeycloakifyResourcesDir),
278
- /* harmony export */ "N$": () => (/* binding */ keycloak_resources),
279
- /* harmony export */ "UX": () => (/* binding */ accountThemePageIds),
280
- /* harmony export */ "X4": () => (/* binding */ nameOfTheGlobal),
281
- /* harmony export */ "fe": () => (/* binding */ vitePluginSubScriptEnvNames),
282
- /* harmony export */ "h6": () => (/* binding */ containerName),
283
- /* harmony export */ "lg": () => (/* binding */ nameOfTheLocalizationRealmOverridesUserProfileProperty),
284
- /* harmony export */ "rO": () => (/* binding */ themeTypes),
285
- /* harmony export */ "sj": () => (/* binding */ loginThemePageIds),
286
- /* harmony export */ "uo": () => (/* binding */ skipBuildJarsEnvName),
287
- /* harmony export */ "v$": () => (/* binding */ lastKeycloakVersionWithAccountV1),
288
- /* harmony export */ "y_": () => (/* binding */ accountV1ThemeName),
289
- /* harmony export */ "z0": () => (/* binding */ resources_common)
290
- /* harmony export */ });
291
- const nameOfTheGlobal = "kcContext";
292
- const nameOfTheLocalizationRealmOverridesUserProfileProperty = "__localizationRealmOverridesUserProfile";
293
- const keycloak_resources = "keycloak-resources";
294
- const resources_common = "resources-common";
295
- const lastKeycloakVersionWithAccountV1 = "21.1.2";
296
- const basenameOfTheKeycloakifyResourcesDir = "build";
297
- const themeTypes = ["login", "account"];
298
- const accountV1ThemeName = "account-v1";
299
- const vitePluginSubScriptEnvNames = {
300
- runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
301
- resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
302
- };
303
- const skipBuildJarsEnvName = "KEYCLOAKIFY_SKIP_BUILD_JAR";
304
- const loginThemePageIds = [
305
- "login.ftl",
306
- "login-username.ftl",
307
- "login-password.ftl",
308
- "webauthn-authenticate.ftl",
309
- "webauthn-register.ftl",
310
- "register.ftl",
311
- "info.ftl",
312
- "error.ftl",
313
- "login-reset-password.ftl",
314
- "login-verify-email.ftl",
315
- "terms.ftl",
316
- "login-oauth2-device-verify-user-code.ftl",
317
- "login-oauth-grant.ftl",
318
- "login-otp.ftl",
319
- "login-update-profile.ftl",
320
- "login-update-password.ftl",
321
- "login-idp-link-confirm.ftl",
322
- "login-idp-link-email.ftl",
323
- "login-page-expired.ftl",
324
- "login-config-totp.ftl",
325
- "logout-confirm.ftl",
326
- "idp-review-user-profile.ftl",
327
- "update-email.ftl",
328
- "select-authenticator.ftl",
329
- "saml-post-form.ftl",
330
- "delete-credential.ftl",
331
- "code.ftl",
332
- "delete-account-confirm.ftl",
333
- "frontchannel-logout.ftl",
334
- "login-recovery-authn-code-config.ftl",
335
- "login-recovery-authn-code-input.ftl",
336
- "login-reset-otp.ftl",
337
- "login-x509-info.ftl",
338
- "webauthn-error.ftl"
339
- ];
340
- const accountThemePageIds = [
341
- "password.ftl",
342
- "account.ftl",
343
- "sessions.ftl",
344
- "totp.ftl",
345
- "applications.ftl",
346
- "log.ftl",
347
- "federatedIdentity.ftl"
348
- ];
349
- const containerName = "keycloak-keycloakify";
350
- //# sourceMappingURL=constants.js.map
351
-
352
- /***/ }),
353
-
354
- /***/ 61804:
355
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
356
-
357
-
358
- // EXPORTS
359
- __webpack_require__.d(__webpack_exports__, {
360
- "x": () => (/* binding */ downloadKeycloakDefaultTheme)
361
- });
362
-
363
- // EXTERNAL MODULE: external "path"
364
- var external_path_ = __webpack_require__(71017);
365
- // EXTERNAL MODULE: ./node_modules/tsafe/assert.js
366
- var assert = __webpack_require__(88078);
367
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
368
- var constants = __webpack_require__(173);
369
- // EXTERNAL MODULE: ./node_modules/make-fetch-happen/lib/index.js
370
- var lib = __webpack_require__(9525);
371
- var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
372
- // EXTERNAL MODULE: external "fs/promises"
373
- var promises_ = __webpack_require__(73292);
374
- // EXTERNAL MODULE: ./dist/bin/tools/extractArchive.js
375
- var extractArchive = __webpack_require__(29121);
376
- // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
377
- var fs_existsAsync = __webpack_require__(43765);
378
- // EXTERNAL MODULE: external "child_process"
379
- var external_child_process_ = __webpack_require__(32081);
380
- // EXTERNAL MODULE: external "util"
381
- var external_util_ = __webpack_require__(73837);
382
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/fetchProxyOptions.js
383
-
384
-
385
-
386
- function ensureArray(arg0) {
387
- return Array.isArray(arg0) ? arg0 : typeof arg0 === "undefined" ? [] : [arg0];
388
- }
389
- function ensureSingleOrNone(arg0) {
390
- if (!Array.isArray(arg0))
391
- return arg0;
392
- if (arg0.length === 0)
393
- return undefined;
394
- if (arg0.length === 1)
395
- return arg0[0];
396
- throw new Error("Illegal configuration, expected a single value but found multiple: " +
397
- arg0.map(String).join(", "));
398
- }
399
- /**
400
- * Get npm configuration as map
401
- */
402
- async function getNmpConfig(params) {
403
- const { npmWorkspaceRootDirPath } = params;
404
- const exec = (0,external_util_.promisify)(external_child_process_.exec);
405
- const stdout = await exec("npm config get", {
406
- encoding: "utf8",
407
- cwd: npmWorkspaceRootDirPath
408
- }).then(({ stdout }) => stdout);
409
- const npmConfigReducer = (cfg, [key, value]) => key in cfg
410
- ? Object.assign(Object.assign({}, cfg), { [key]: [...ensureArray(cfg[key]), value] }) : Object.assign(Object.assign({}, cfg), { [key]: value });
411
- return stdout
412
- .split("\n")
413
- .filter(line => !line.startsWith(";"))
414
- .map(line => line.trim())
415
- .map(line => line.split("=", 2))
416
- .reduce(npmConfigReducer, {});
417
- }
418
- async function getProxyFetchOptions(params) {
419
- var _a, _b, _c;
420
- const { npmWorkspaceRootDirPath } = params;
421
- const cfg = await getNmpConfig({ npmWorkspaceRootDirPath });
422
- const proxy = ensureSingleOrNone((_a = cfg["https-proxy"]) !== null && _a !== void 0 ? _a : cfg["proxy"]);
423
- const noProxy = (_b = cfg["noproxy"]) !== null && _b !== void 0 ? _b : cfg["no-proxy"];
424
- function maybeBoolean(arg0) {
425
- return typeof arg0 === "undefined" ? undefined : Boolean(arg0);
426
- }
427
- const strictSSL = maybeBoolean(ensureSingleOrNone(cfg["strict-ssl"]));
428
- const cert = cfg["cert"];
429
- const ca = ensureArray((_c = cfg["ca"]) !== null && _c !== void 0 ? _c : cfg["ca[]"]);
430
- const cafile = ensureSingleOrNone(cfg["cafile"]);
431
- if (typeof cafile !== "undefined" && cafile !== "null") {
432
- ca.push(...(await (async () => {
433
- function chunks(arr, size = 2) {
434
- return arr
435
- .map((_, i) => i % size == 0 && arr.slice(i, i + size))
436
- .filter(Boolean);
437
- }
438
- const cafileContent = await (0,promises_.readFile)(cafile, "utf-8");
439
- return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map(ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n"));
440
- })()));
441
- }
442
- return {
443
- proxy,
444
- noProxy,
445
- strictSSL,
446
- cert,
447
- ca: ca.length === 0 ? undefined : ca
448
- };
449
- }
450
- //# sourceMappingURL=fetchProxyOptions.js.map
451
- // EXTERNAL MODULE: external "crypto"
452
- var external_crypto_ = __webpack_require__(6113);
453
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
454
- var SemVer = __webpack_require__(12171);
455
- ;// CONCATENATED MODULE: ./dist/bin/tools/fs.rm.js
456
-
457
-
458
-
459
- /**
460
- * Polyfill of fs.rm(dirPath, { "recursive": true })
461
- * For older version of Node
462
- */
463
- async function rm(dirPath, options) {
464
- if (SemVer/* SemVer.compare */.h.compare(SemVer/* SemVer.parse */.h.parse(process.version), SemVer/* SemVer.parse */.h.parse("14.14.0")) > 0) {
465
- return promises_.rm(dirPath, options);
466
- }
467
- const { force = true } = options;
468
- if (force && !(await checkDirExists(dirPath))) {
469
- return;
470
- }
471
- const removeDir_rec = async (dirPath) => Promise.all((await promises_.readdir(dirPath)).map(async (basename) => {
472
- const fileOrDirpath = (0,external_path_.join)(dirPath, basename);
473
- if ((await promises_.lstat(fileOrDirpath)).isDirectory()) {
474
- await removeDir_rec(fileOrDirpath);
475
- }
476
- else {
477
- await promises_.unlink(fileOrDirpath);
478
- }
479
- }));
480
- await removeDir_rec(dirPath);
481
- }
482
- async function checkDirExists(dirPath) {
483
- try {
484
- await promises_.access(dirPath, promises_.constants.F_OK);
485
- return true;
486
- }
487
- catch (_a) {
488
- return false;
489
- }
490
- }
491
- //# sourceMappingURL=fs.rm.js.map
492
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.js
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
- async function downloadAndExtractArchive(params) {
503
- var _a;
504
- const { url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, npmWorkspaceRootDirPath } = params;
505
- const archiveFileBasename = url.split("?")[0].split("/").reverse()[0];
506
- const archiveFilePath = (0,external_path_.join)(cacheDirPath, archiveFileBasename);
507
- download: {
508
- if (await (0,fs_existsAsync/* existsAsync */.o)(archiveFilePath)) {
509
- const isDownloaded = await SuccessTracker.getIsDownloaded({
510
- cacheDirPath,
511
- archiveFileBasename
512
- });
513
- if (isDownloaded) {
514
- break download;
515
- }
516
- await (0,promises_.unlink)(archiveFilePath);
517
- await SuccessTracker.removeFromDownloaded({
518
- cacheDirPath,
519
- archiveFileBasename
520
- });
521
- }
522
- await (0,promises_.mkdir)((0,external_path_.dirname)(archiveFilePath), { recursive: true });
523
- const response = await lib_default()(url, await getProxyFetchOptions({ npmWorkspaceRootDirPath }));
524
- (_a = response.body) === null || _a === void 0 ? void 0 : _a.setMaxListeners(Number.MAX_VALUE);
525
- (0,assert.assert)(typeof response.body !== "undefined" && response.body != null);
526
- await (0,promises_.writeFile)(archiveFilePath, response.body);
527
- await SuccessTracker.markAsDownloaded({
528
- cacheDirPath,
529
- archiveFileBasename
530
- });
531
- }
532
- const extractDirBasename = `${archiveFileBasename.split(".")[0]}_${uniqueIdOfOnOnArchiveFile}_${external_crypto_.createHash("sha256")
533
- .update(onArchiveFile.toString())
534
- .digest("hex")
535
- .substring(0, 5)}`;
536
- await Promise.all((await (0,promises_.readdir)(cacheDirPath))
537
- .filter((() => {
538
- const prefix = extractDirBasename
539
- .split("_")
540
- .reverse()
541
- .slice(1)
542
- .reverse()
543
- .join("_");
544
- return basename => basename !== extractDirBasename && basename.startsWith(prefix);
545
- })())
546
- .map(async (extractDirBasename) => {
547
- await rm((0,external_path_.join)(cacheDirPath, extractDirBasename), { recursive: true });
548
- await SuccessTracker.removeFromExtracted({
549
- cacheDirPath,
550
- extractDirBasename
551
- });
552
- }));
553
- const extractedDirPath = (0,external_path_.join)(cacheDirPath, extractDirBasename);
554
- extract_and_transform: {
555
- if (await (0,fs_existsAsync/* existsAsync */.o)(extractedDirPath)) {
556
- const isExtracted = await SuccessTracker.getIsExtracted({
557
- cacheDirPath,
558
- extractDirBasename
559
- });
560
- if (isExtracted) {
561
- break extract_and_transform;
562
- }
563
- await rm(extractedDirPath, { recursive: true });
564
- await SuccessTracker.removeFromExtracted({
565
- cacheDirPath,
566
- extractDirBasename
567
- });
568
- }
569
- await (0,extractArchive/* extractArchive */.N)({
570
- archiveFilePath,
571
- onArchiveFile: async ({ relativeFilePathInArchive, readFile, writeFile }) => onArchiveFile({
572
- fileRelativePath: relativeFilePathInArchive,
573
- readFile,
574
- writeFile: ({ fileRelativePath, modifiedData }) => writeFile({
575
- filePath: (0,external_path_.join)(extractedDirPath, fileRelativePath),
576
- modifiedData
577
- })
578
- })
579
- });
580
- await SuccessTracker.markAsExtracted({
581
- cacheDirPath,
582
- extractDirBasename
583
- });
584
- }
585
- return { extractedDirPath };
586
- }
587
- var SuccessTracker;
588
- (function (SuccessTracker) {
589
- async function read(params) {
590
- const { cacheDirPath } = params;
591
- const filePath = (0,external_path_.join)(cacheDirPath, "downloadAndExtractArchive.json");
592
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(filePath))) {
593
- return { archiveFileBasenames: [], extractDirBasenames: [] };
594
- }
595
- return JSON.parse((await (0,promises_.readFile)(filePath)).toString("utf8"));
596
- }
597
- async function write(params) {
598
- const { cacheDirPath, successTracker } = params;
599
- const filePath = (0,external_path_.join)(cacheDirPath, "downloadAndExtractArchive.json");
600
- {
601
- const dirPath = (0,external_path_.dirname)(filePath);
602
- if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
603
- await (0,promises_.mkdir)(dirPath, { recursive: true });
604
- }
605
- }
606
- await (0,promises_.writeFile)(filePath, JSON.stringify(successTracker));
607
- }
608
- async function markAsDownloaded(params) {
609
- const { cacheDirPath, archiveFileBasename } = params;
610
- const successTracker = await read({ cacheDirPath });
611
- successTracker.archiveFileBasenames.push(archiveFileBasename);
612
- await write({ cacheDirPath, successTracker });
613
- }
614
- SuccessTracker.markAsDownloaded = markAsDownloaded;
615
- async function getIsDownloaded(params) {
616
- const { cacheDirPath, archiveFileBasename } = params;
617
- const successTracker = await read({ cacheDirPath });
618
- return successTracker.archiveFileBasenames.includes(archiveFileBasename);
619
- }
620
- SuccessTracker.getIsDownloaded = getIsDownloaded;
621
- async function removeFromDownloaded(params) {
622
- const { cacheDirPath, archiveFileBasename } = params;
623
- const successTracker = await read({ cacheDirPath });
624
- successTracker.archiveFileBasenames = successTracker.archiveFileBasenames.filter(basename => basename !== archiveFileBasename);
625
- await write({ cacheDirPath, successTracker });
626
- }
627
- SuccessTracker.removeFromDownloaded = removeFromDownloaded;
628
- async function markAsExtracted(params) {
629
- const { cacheDirPath, extractDirBasename } = params;
630
- const successTracker = await read({ cacheDirPath });
631
- successTracker.extractDirBasenames.push(extractDirBasename);
632
- await write({ cacheDirPath, successTracker });
633
- }
634
- SuccessTracker.markAsExtracted = markAsExtracted;
635
- async function getIsExtracted(params) {
636
- const { cacheDirPath, extractDirBasename } = params;
637
- const successTracker = await read({ cacheDirPath });
638
- return successTracker.extractDirBasenames.includes(extractDirBasename);
639
- }
640
- SuccessTracker.getIsExtracted = getIsExtracted;
641
- async function removeFromExtracted(params) {
642
- const { cacheDirPath, extractDirBasename } = params;
643
- const successTracker = await read({ cacheDirPath });
644
- successTracker.extractDirBasenames = successTracker.extractDirBasenames.filter(basename => basename !== extractDirBasename);
645
- await write({ cacheDirPath, successTracker });
646
- }
647
- SuccessTracker.removeFromExtracted = removeFromExtracted;
648
- })(SuccessTracker || (SuccessTracker = {}));
649
- //# sourceMappingURL=downloadAndExtractArchive.js.map
650
- ;// CONCATENATED MODULE: ./dist/bin/tools/downloadAndExtractArchive/index.js
651
-
652
- //# sourceMappingURL=index.js.map
653
- // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
654
- var isInside = __webpack_require__(90665);
655
- ;// CONCATENATED MODULE: ./dist/bin/shared/downloadKeycloakDefaultTheme.js
656
-
657
-
658
-
659
-
660
-
661
- (0,assert.assert)();
662
- async function downloadKeycloakDefaultTheme(params) {
663
- const { keycloakVersion, buildOptions } = params;
664
- const { extractedDirPath } = await downloadAndExtractArchive({
665
- url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
666
- cacheDirPath: buildOptions.cacheDirPath,
667
- npmWorkspaceRootDirPath: buildOptions.npmWorkspaceRootDirPath,
668
- uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
669
- onArchiveFile: async (params) => {
670
- if (!(0,isInside/* isInside */.V)({ dirPath: "theme", filePath: params.fileRelativePath })) {
671
- return;
672
- }
673
- const { readFile, writeFile } = params;
674
- const fileRelativePath = (0,external_path_.relative)("theme", params.fileRelativePath);
675
- skip_keycloak_v2: {
676
- if (!(0,isInside/* isInside */.V)({
677
- dirPath: (0,external_path_.join)("keycloak.v2"),
678
- filePath: fileRelativePath
679
- })) {
680
- break skip_keycloak_v2;
681
- }
682
- return;
683
- }
684
- last_account_v1_transformations: {
685
- if (constants/* lastKeycloakVersionWithAccountV1 */.v$ !== keycloakVersion) {
686
- break last_account_v1_transformations;
687
- }
688
- patch_account_css: {
689
- if (fileRelativePath !==
690
- (0,external_path_.join)("keycloak", "account", "resources", "css", "account.css")) {
691
- break patch_account_css;
692
- }
693
- await writeFile({
694
- fileRelativePath,
695
- modifiedData: Buffer.from((await readFile())
696
- .toString("utf8")
697
- .replace("top: -34px;", "top: -34px !important;"), "utf8")
698
- });
699
- return;
700
- }
701
- skip_web_modules: {
702
- if (!(0,isInside/* isInside */.V)({
703
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "web_modules"),
704
- filePath: fileRelativePath
705
- })) {
706
- break skip_web_modules;
707
- }
708
- return;
709
- }
710
- skip_unused_node_modules: {
711
- const nodeModulesDirPath = (0,external_path_.join)("keycloak", "common", "resources", "node_modules");
712
- if (!(0,isInside/* isInside */.V)({
713
- dirPath: nodeModulesDirPath,
714
- filePath: fileRelativePath
715
- })) {
716
- break skip_unused_node_modules;
717
- }
718
- const toKeepPrefixes = [
719
- ...[
720
- "patternfly.min.css",
721
- "patternfly-additions.min.css",
722
- "patternfly-additions.min.css"
723
- ].map(fileBasename => (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "css", fileBasename)),
724
- (0,external_path_.join)(nodeModulesDirPath, "patternfly", "dist", "fonts")
725
- ];
726
- if (toKeepPrefixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
727
- break skip_unused_node_modules;
728
- }
729
- return;
730
- }
731
- }
732
- skip_unused_resources: {
733
- if (keycloakVersion !== "24.0.4") {
734
- break skip_unused_resources;
735
- }
736
- for (const dirBasename of [
737
- "@patternfly-v5",
738
- "@rollup",
739
- "rollup",
740
- "react",
741
- "react-dom",
742
- "shx",
743
- ".pnpm"
744
- ]) {
745
- if ((0,isInside/* isInside */.V)({
746
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", dirBasename),
747
- filePath: fileRelativePath
748
- })) {
749
- return;
750
- }
751
- }
752
- for (const dirBasename of ["react", "react-dom"]) {
753
- if ((0,isInside/* isInside */.V)({
754
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "vendor", dirBasename),
755
- filePath: fileRelativePath
756
- })) {
757
- return;
758
- }
759
- }
760
- if ((0,isInside/* isInside */.V)({
761
- dirPath: (0,external_path_.join)("keycloak", "common", "resources", "node_modules", "@patternfly", "react-core"),
762
- filePath: fileRelativePath
763
- })) {
764
- return;
765
- }
766
- }
767
- await writeFile({ fileRelativePath });
768
- }
769
- });
770
- return { defaultThemeDirPath: extractedDirPath };
771
- }
772
- //# sourceMappingURL=downloadKeycloakDefaultTheme.js.map
773
-
774
- /***/ }),
775
-
776
- /***/ 12171:
777
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
778
-
779
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
780
- /* harmony export */ "h": () => (/* binding */ SemVer)
781
- /* harmony export */ });
782
- var SemVer;
783
- (function (SemVer) {
784
- const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
785
- function parse(versionStr) {
786
- const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
787
- if (!match) {
788
- throw new Error(`${versionStr} is not a valid semantic version`);
789
- }
790
- const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
791
- const str = match[3];
792
- return str === undefined ? 0 : parseInt(str);
793
- })() }, (() => {
794
- const str = match[4];
795
- return str === undefined ? {} : { rc: parseInt(str) };
796
- })());
797
- const initialStr = stringify(semVer);
798
- Object.defineProperty(semVer, "parsedFrom", {
799
- enumerable: true,
800
- get: function () {
801
- const currentStr = stringify(this);
802
- if (currentStr !== initialStr) {
803
- throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
804
- }
805
- return versionStr;
806
- }
807
- });
808
- return semVer;
809
- }
810
- SemVer.parse = parse;
811
- function stringify(v) {
812
- return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
813
- }
814
- SemVer.stringify = stringify;
815
- /**
816
- *
817
- * v1 < v2 => -1
818
- * v1 === v2 => 0
819
- * v1 > v2 => 1
820
- *
821
- */
822
- function compare(v1, v2) {
823
- const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
824
- const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
825
- for (const level of ["major", "minor", "patch", "rc"]) {
826
- if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
827
- return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
828
- }
829
- }
830
- return 0;
831
- }
832
- SemVer.compare = compare;
833
- /*
834
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
835
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
836
- console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
837
- */
838
- function bumpType(params) {
839
- const versionAhead = typeof params.versionAhead === "string"
840
- ? parse(params.versionAhead)
841
- : params.versionAhead;
842
- const versionBehind = typeof params.versionBehind === "string"
843
- ? parse(params.versionBehind)
844
- : params.versionBehind;
845
- if (compare(versionBehind, versionAhead) === 1) {
846
- throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
847
- }
848
- for (const level of ["major", "minor", "patch", "rc"]) {
849
- if (versionBehind[level] !== versionAhead[level]) {
850
- return level;
851
- }
852
- }
853
- return "no bump";
854
- }
855
- SemVer.bumpType = bumpType;
856
- })(SemVer || (SemVer = {}));
857
- //# sourceMappingURL=SemVer.js.map
858
-
859
- /***/ }),
860
-
861
- /***/ 73036:
862
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
863
-
864
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
865
- /* harmony export */ "J": () => (/* binding */ crawl)
866
- /* harmony export */ });
867
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
868
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
869
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
870
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
871
-
872
-
873
- const crawlRec = (dirPath, filePaths) => {
874
- for (const basename of fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath)) {
875
- const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
876
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
877
- crawlRec(fileOrDirPath, filePaths);
878
- continue;
879
- }
880
- filePaths.push(fileOrDirPath);
881
- }
882
- };
883
- /** List all files in a given directory return paths relative to the dir_path */
884
- function crawl(params) {
885
- const { dirPath, returnedPathsType } = params;
886
- const filePaths = [];
887
- crawlRec(dirPath, filePaths);
888
- switch (returnedPathsType) {
889
- case "absolute":
890
- return filePaths;
891
- case "relative to dirPath":
892
- return filePaths.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(dirPath, filePath));
893
- }
894
- }
895
- //# sourceMappingURL=crawl.js.map
896
-
897
- /***/ }),
898
-
899
- /***/ 29121:
900
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
901
-
902
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
903
- /* harmony export */ "N": () => (/* binding */ extractArchive)
904
- /* harmony export */ });
905
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
906
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
907
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57147);
908
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
909
- /* harmony import */ var yauzl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78781);
910
- /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12781);
911
- /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(stream__WEBPACK_IMPORTED_MODULE_3__);
912
- /* harmony import */ var evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50689);
913
- /* harmony import */ var evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_4__);
914
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71017);
915
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_5__);
916
- /* harmony import */ var _fs_existsAsync__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(43765);
917
-
918
-
919
-
920
-
921
-
922
-
923
-
924
- async function extractArchive(params) {
925
- const { archiveFilePath, onArchiveFile } = params;
926
- const zipFile = await new Promise((resolve, reject) => {
927
- yauzl__WEBPACK_IMPORTED_MODULE_2__.open(archiveFilePath, { lazyEntries: true }, async (error, zipFile) => {
928
- if (error) {
929
- reject(error);
930
- return;
931
- }
932
- resolve(zipFile);
933
- });
934
- });
935
- const dDone = new evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_4__.Deferred();
936
- zipFile.once("end", () => {
937
- zipFile.close();
938
- dDone.resolve();
939
- });
940
- const writeFile = async (entry, params) => {
941
- const { filePath, modifiedData } = params;
942
- {
943
- const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_5__.dirname)(filePath);
944
- if (!(await (0,_fs_existsAsync__WEBPACK_IMPORTED_MODULE_6__/* .existsAsync */ .o)(dirPath))) {
945
- await fs_promises__WEBPACK_IMPORTED_MODULE_0___default().mkdir(dirPath, { recursive: true });
946
- }
947
- }
948
- if (modifiedData !== undefined) {
949
- await fs_promises__WEBPACK_IMPORTED_MODULE_0___default().writeFile(filePath, modifiedData);
950
- return;
951
- }
952
- const readStream = await new Promise(resolve => zipFile.openReadStream(entry, async (error, readStream) => {
953
- if (error) {
954
- dDone.reject(error);
955
- return;
956
- }
957
- resolve(readStream);
958
- }));
959
- const dDoneWithFile = new evt_tools_Deferred__WEBPACK_IMPORTED_MODULE_4__.Deferred();
960
- stream__WEBPACK_IMPORTED_MODULE_3___default().pipeline(readStream, fs__WEBPACK_IMPORTED_MODULE_1___default().createWriteStream(filePath), error => {
961
- if (error) {
962
- dDone.reject(error);
963
- return;
964
- }
965
- dDoneWithFile.resolve();
966
- });
967
- await dDoneWithFile.pr;
968
- };
969
- const readFile = (entry) => new Promise(resolve => zipFile.openReadStream(entry, async (error, readStream) => {
970
- if (error) {
971
- dDone.reject(error);
972
- return;
973
- }
974
- const chunks = [];
975
- readStream.on("data", chunk => {
976
- chunks.push(chunk);
977
- });
978
- readStream.on("end", () => {
979
- resolve(Buffer.concat(chunks));
980
- });
981
- readStream.on("error", error => {
982
- dDone.reject(error);
983
- });
984
- }));
985
- zipFile.on("entry", async (entry) => {
986
- handle_file: {
987
- // NOTE: Skip directories
988
- if (entry.fileName.endsWith(path__WEBPACK_IMPORTED_MODULE_5__.sep)) {
989
- break handle_file;
990
- }
991
- let hasEarlyExitBeenCalled = false;
992
- await onArchiveFile({
993
- relativeFilePathInArchive: entry.fileName.split("/").join(path__WEBPACK_IMPORTED_MODULE_5__.sep),
994
- readFile: () => readFile(entry),
995
- writeFile: params => writeFile(entry, params),
996
- earlyExit: () => {
997
- hasEarlyExitBeenCalled = true;
998
- }
999
- });
1000
- if (hasEarlyExitBeenCalled) {
1001
- zipFile.close();
1002
- dDone.resolve();
1003
- return;
1004
- }
1005
- }
1006
- zipFile.readEntry();
1007
- });
1008
- zipFile.readEntry();
1009
- await dDone.pr;
1010
- }
1011
- //# sourceMappingURL=extractArchive.js.map
1012
-
1013
- /***/ }),
1014
-
1015
- /***/ 43765:
1016
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1017
-
1018
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1019
- /* harmony export */ "o": () => (/* binding */ existsAsync)
1020
- /* harmony export */ });
1021
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
1022
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
1023
-
1024
- async function existsAsync(path) {
1025
- try {
1026
- await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
1027
- return true;
1028
- }
1029
- catch (error) {
1030
- if (error.code === "ENOENT")
1031
- return false;
1032
- throw error;
1033
- }
1034
- }
1035
- //# sourceMappingURL=fs.existsAsync.js.map
1036
-
1037
- /***/ }),
1038
-
1039
- /***/ 89693:
1040
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1041
-
1042
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1043
- /* harmony export */ "a": () => (/* binding */ rmSync)
1044
- /* harmony export */ });
1045
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
1046
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
1047
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
1048
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
1049
- /* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
1050
-
1051
-
1052
-
1053
- /**
1054
- * Polyfill of fs.rmSync(dirPath, { "recursive": true })
1055
- * For older version of Node
1056
- */
1057
- function rmSync(dirPath, options) {
1058
- if (_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.compare */ .h.compare(_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse(process.version), _SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse("14.14.0")) > 0) {
1059
- fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
1060
- return;
1061
- }
1062
- const { force = true } = options;
1063
- if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
1064
- return;
1065
- }
1066
- const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
1067
- const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
1068
- if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
1069
- removeDir_rec(fileOrDirPath);
1070
- return;
1071
- }
1072
- else {
1073
- fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
1074
- }
1075
- });
1076
- removeDir_rec(dirPath);
1077
- }
1078
- //# sourceMappingURL=fs.rmSync.js.map
1079
-
1080
- /***/ }),
1081
-
1082
- /***/ 86644:
1083
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1084
-
1085
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1086
- /* harmony export */ "c": () => (/* binding */ getAbsoluteAndInOsFormatPath)
1087
- /* harmony export */ });
1088
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1089
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1090
- /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22037);
1091
- /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
1092
-
1093
-
1094
- function getAbsoluteAndInOsFormatPath(params) {
1095
- const { pathIsh, cwd } = params;
1096
- let pathOut = pathIsh;
1097
- pathOut = pathOut.replace(/\//g, path__WEBPACK_IMPORTED_MODULE_0__.sep);
1098
- if (pathOut.startsWith("~")) {
1099
- pathOut = pathOut.replace("~", os__WEBPACK_IMPORTED_MODULE_1__.homedir());
1100
- }
1101
- pathOut = pathOut.endsWith(path__WEBPACK_IMPORTED_MODULE_0__.sep) ? pathOut.slice(0, -1) : pathOut;
1102
- if (!(0,path__WEBPACK_IMPORTED_MODULE_0__.isAbsolute)(pathOut)) {
1103
- pathOut = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(cwd, pathOut);
1104
- }
1105
- pathOut = (0,path__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathOut);
1106
- return pathOut;
1107
- }
1108
- //# sourceMappingURL=getAbsoluteAndInOsFormatPath.js.map
1109
-
1110
- /***/ }),
1111
-
1112
- /***/ 90665:
1113
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1114
-
1115
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1116
- /* harmony export */ "V": () => (/* binding */ isInside)
1117
- /* harmony export */ });
1118
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
1119
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
1120
-
1121
- function isInside(params) {
1122
- const { dirPath, filePath } = params;
1123
- return !(0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(dirPath, filePath).startsWith("..");
1124
- }
1125
- //# sourceMappingURL=isInside.js.map
1126
-
1127
- /***/ }),
1128
-
1129
- /***/ 60332:
1130
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1131
-
1132
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1133
- /* harmony export */ "N": () => (/* binding */ transformCodebase)
1134
- /* harmony export */ });
1135
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
1136
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
1137
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
1138
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
1139
- /* harmony import */ var _crawl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73036);
1140
- /* harmony import */ var _tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(89693);
1141
-
1142
-
1143
-
1144
-
1145
- /**
1146
- * Apply a transformation function to every file of directory
1147
- * If source and destination are the same this function can be used to apply the transformation in place
1148
- * like filtering out some files or modifying them.
1149
- * */
1150
- function transformCodebase(params) {
1151
- const { srcDirPath, transformSourceCode } = params;
1152
- const isTargetSameAsSource = path__WEBPACK_IMPORTED_MODULE_1__.relative(srcDirPath, params.destDirPath) === "";
1153
- const destDirPath = isTargetSameAsSource
1154
- ? path__WEBPACK_IMPORTED_MODULE_1__.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
1155
- : params.destDirPath;
1156
- fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(destDirPath, {
1157
- recursive: true
1158
- });
1159
- for (const fileRelativePath of (0,_crawl__WEBPACK_IMPORTED_MODULE_2__/* .crawl */ .J)({
1160
- dirPath: srcDirPath,
1161
- returnedPathsType: "relative to dirPath"
1162
- })) {
1163
- const filePath = path__WEBPACK_IMPORTED_MODULE_1__.join(srcDirPath, fileRelativePath);
1164
- const destFilePath = path__WEBPACK_IMPORTED_MODULE_1__.join(destDirPath, fileRelativePath);
1165
- // NOTE: Optimization, if we don't need to transform the file, just copy
1166
- // it using the lower level implementation.
1167
- if (transformSourceCode === undefined) {
1168
- fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(path__WEBPACK_IMPORTED_MODULE_1__.dirname(destFilePath), {
1169
- recursive: true
1170
- });
1171
- fs__WEBPACK_IMPORTED_MODULE_0__.copyFileSync(filePath, destFilePath);
1172
- continue;
1173
- }
1174
- const transformSourceCodeResult = transformSourceCode({
1175
- sourceCode: fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath),
1176
- filePath,
1177
- fileRelativePath
1178
- });
1179
- if (transformSourceCodeResult === undefined) {
1180
- continue;
1181
- }
1182
- fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(path__WEBPACK_IMPORTED_MODULE_1__.dirname(destFilePath), {
1183
- recursive: true
1184
- });
1185
- const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
1186
- fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(path__WEBPACK_IMPORTED_MODULE_1__.join(path__WEBPACK_IMPORTED_MODULE_1__.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : path__WEBPACK_IMPORTED_MODULE_1__.basename(destFilePath)), modifiedSourceCode);
1187
- }
1188
- if (isTargetSameAsSource) {
1189
- (0,_tools_fs_rmSync__WEBPACK_IMPORTED_MODULE_3__/* .rmSync */ .a)(srcDirPath, { recursive: true });
1190
- fs__WEBPACK_IMPORTED_MODULE_0__.renameSync(destDirPath, srcDirPath);
1191
- }
1192
- }
1193
- //# sourceMappingURL=transformCodebase.js.map
1194
-
1195
- /***/ })
1196
-
1197
- };
1198
- ;