keycloakify 10.0.0-rc.17 → 10.0.0-rc.19

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 (208) hide show
  1. package/PUBLIC_URL.js.map +1 -1
  2. package/account/Template.js +5 -5
  3. package/account/Template.js.map +1 -1
  4. package/account/i18n/i18n.js +37 -29
  5. package/account/i18n/i18n.js.map +1 -1
  6. package/account/kcContext/KcContext.js.map +1 -1
  7. package/account/kcContext/createGetKcContext.js +20 -15
  8. package/account/kcContext/createGetKcContext.js.map +1 -1
  9. package/account/kcContext/getKcContext.js.map +1 -1
  10. package/account/kcContext/getKcContextFromWindow.d.ts +3 -1
  11. package/account/kcContext/getKcContextFromWindow.js.map +1 -1
  12. package/account/kcContext/kcContextMocks.js +148 -144
  13. package/account/kcContext/kcContextMocks.js.map +1 -1
  14. package/account/lib/useGetClassName.js +14 -14
  15. package/account/lib/useGetClassName.js.map +1 -1
  16. package/account/pages/Account.js +1 -1
  17. package/account/pages/Account.js.map +1 -1
  18. package/account/pages/Password.js +7 -7
  19. package/account/pages/Password.js.map +1 -1
  20. package/account/pages/Totp.js +4 -4
  21. package/account/pages/Totp.js.map +1 -1
  22. package/bin/main.js +2265 -2028
  23. package/bin/shared/constants.d.ts +1 -0
  24. package/bin/shared/constants.js +4 -3
  25. package/bin/shared/constants.js.map +1 -1
  26. package/lib/isStorybook.js +2 -1
  27. package/lib/isStorybook.js.map +1 -1
  28. package/lib/useGetClassName.js.map +1 -1
  29. package/login/Template.js +13 -13
  30. package/login/Template.js.map +1 -1
  31. package/login/UserProfileFormFields.js +43 -41
  32. package/login/UserProfileFormFields.js.map +1 -1
  33. package/login/i18n/baseMessages/ca.d.ts +1 -1
  34. package/login/i18n/baseMessages/ca.js +1 -1
  35. package/login/i18n/baseMessages/el.d.ts +0 -1
  36. package/login/i18n/baseMessages/el.js +0 -1
  37. package/login/i18n/baseMessages/el.js.map +1 -1
  38. package/login/i18n/baseMessages/en.d.ts +1 -1
  39. package/login/i18n/baseMessages/en.js +1 -1
  40. package/login/i18n/baseMessages/es.d.ts +1 -1
  41. package/login/i18n/baseMessages/es.js +1 -1
  42. package/login/i18n/baseMessages/fa.d.ts +0 -1
  43. package/login/i18n/baseMessages/fa.js +0 -1
  44. package/login/i18n/baseMessages/fa.js.map +1 -1
  45. package/login/i18n/baseMessages/hu.d.ts +1 -1
  46. package/login/i18n/baseMessages/hu.js +1 -1
  47. package/login/i18n/baseMessages/index.d.ts +1 -2
  48. package/login/i18n/baseMessages/zh-CN.d.ts +1 -1
  49. package/login/i18n/baseMessages/zh-CN.js +1 -1
  50. package/login/i18n/i18n.js +39 -31
  51. package/login/i18n/i18n.js.map +1 -1
  52. package/login/kcContext/KcContext.js.map +1 -1
  53. package/login/kcContext/createGetKcContext.js +30 -22
  54. package/login/kcContext/createGetKcContext.js.map +1 -1
  55. package/login/kcContext/getKcContext.js.map +1 -1
  56. package/login/kcContext/getKcContextFromWindow.d.ts +3 -1
  57. package/login/kcContext/getKcContextFromWindow.js.map +1 -1
  58. package/login/kcContext/kcContextMocks.js +233 -231
  59. package/login/kcContext/kcContextMocks.js.map +1 -1
  60. package/login/lib/useDownloadTerms.js.map +1 -1
  61. package/login/lib/useGetClassName.js +112 -112
  62. package/login/lib/useGetClassName.js.map +1 -1
  63. package/login/lib/useUserProfileForm.js +181 -181
  64. package/login/lib/useUserProfileForm.js.map +1 -1
  65. package/login/pages/DeleteAccountConfirm.js +5 -1
  66. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  67. package/login/pages/FrontchannelLogout.js +1 -1
  68. package/login/pages/FrontchannelLogout.js.map +1 -1
  69. package/login/pages/Login.js.map +1 -1
  70. package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
  71. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  72. package/login/pages/LoginResetPassword.js.map +1 -1
  73. package/login/pages/LoginUsername.js.map +1 -1
  74. package/login/pages/WebauthnAuthenticate.js +11 -8
  75. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  76. package/login/pages/WebauthnRegister.js +7 -7
  77. package/login/pages/WebauthnRegister.js.map +1 -1
  78. package/package.json +232 -226
  79. package/src/PUBLIC_URL.ts +4 -1
  80. package/src/account/Template.tsx +5 -5
  81. package/src/account/TemplateProps.ts +4 -1
  82. package/src/account/i18n/i18n.tsx +40 -30
  83. package/src/account/kcContext/KcContext.ts +4 -1
  84. package/src/account/kcContext/createGetKcContext.ts +48 -22
  85. package/src/account/kcContext/getKcContext.ts +3 -1
  86. package/src/account/kcContext/getKcContextFromWindow.ts +6 -2
  87. package/src/account/kcContext/kcContextMocks.ts +164 -160
  88. package/src/account/lib/useGetClassName.ts +15 -14
  89. package/src/account/pages/Account.tsx +2 -2
  90. package/src/account/pages/Password.tsx +8 -8
  91. package/src/account/pages/Totp.tsx +4 -6
  92. package/src/bin/copy-keycloak-resources-to-public.ts +2 -2
  93. package/src/bin/download-keycloak-default-theme.ts +30 -8
  94. package/src/bin/eject-page.ts +48 -11
  95. package/src/bin/initialize-email-theme.ts +25 -17
  96. package/src/bin/keycloakify/buildJars/buildJar.ts +179 -104
  97. package/src/bin/keycloakify/buildJars/buildJars.ts +35 -16
  98. package/src/bin/keycloakify/buildJars/extensionVersions.ts +2 -1
  99. package/src/bin/keycloakify/buildJars/generatePom.ts +11 -3
  100. package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +33 -8
  101. package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +20 -2
  102. package/src/bin/keycloakify/generateFtl/generateFtl.ts +49 -12
  103. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +29 -18
  104. package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +35 -12
  105. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +3 -1
  106. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +86 -41
  107. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +39 -15
  108. package/src/bin/keycloakify/generateSrcMainResources/readExtraPageNames.ts +21 -7
  109. package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +34 -7
  110. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +19 -5
  111. package/src/bin/keycloakify/keycloakify.ts +28 -9
  112. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +24 -5
  113. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +6 -2
  114. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +6 -3
  115. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +24 -6
  116. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +49 -11
  117. package/src/bin/main.ts +78 -41
  118. package/src/bin/shared/KeycloakVersionRange.ts +3 -1
  119. package/src/bin/shared/buildOptions.ts +70 -43
  120. package/src/bin/shared/constants.ts +4 -2
  121. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +27 -13
  122. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +161 -218
  123. package/src/bin/shared/downloadKeycloakStaticResources.ts +25 -21
  124. package/src/bin/shared/getJarFileBasename.ts +3 -1
  125. package/src/bin/shared/getThemeSrcDirPath.ts +5 -2
  126. package/src/bin/shared/metaInfKeycloakThemes.ts +35 -8
  127. package/src/bin/shared/promptKeycloakVersion.ts +33 -14
  128. package/src/bin/start-keycloak/appBuild.ts +128 -0
  129. package/src/bin/start-keycloak/index.ts +1 -0
  130. package/src/bin/start-keycloak/keycloakifyBuild.ts +41 -0
  131. package/src/bin/start-keycloak/myrealm-realm-23.json +2142 -0
  132. package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
  133. package/src/bin/start-keycloak/start-keycloak.ts +469 -0
  134. package/src/bin/tools/SemVer.ts +32 -13
  135. package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
  136. package/src/bin/tools/crawl.ts +4 -1
  137. package/src/bin/tools/crc32.ts +42 -24
  138. package/src/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.ts +262 -0
  139. package/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +96 -0
  140. package/src/bin/tools/downloadAndExtractArchive/index.ts +1 -0
  141. package/src/bin/tools/extractArchive.ts +132 -0
  142. package/src/bin/tools/fetchProxyOptions.ts +31 -8
  143. package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +10 -2
  144. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +18 -5
  145. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +8 -2
  146. package/src/bin/tools/octokit-addons/listTags.ts +15 -4
  147. package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
  148. package/src/bin/tools/readThisNpmPackageVersion.ts +5 -1
  149. package/src/bin/tools/transformCodebase.ts +29 -10
  150. package/src/bin/tools/trimIndent.ts +4 -1
  151. package/src/lib/isStorybook.ts +3 -1
  152. package/src/lib/useGetClassName.ts +12 -3
  153. package/src/login/Template.tsx +14 -14
  154. package/src/login/TemplateProps.ts +4 -1
  155. package/src/login/UserProfileFormFields.tsx +44 -42
  156. package/src/login/i18n/baseMessages/ca.ts +1 -1
  157. package/src/login/i18n/baseMessages/el.ts +0 -1
  158. package/src/login/i18n/baseMessages/en.ts +1 -1
  159. package/src/login/i18n/baseMessages/es.ts +1 -1
  160. package/src/login/i18n/baseMessages/fa.ts +0 -1
  161. package/src/login/i18n/baseMessages/hu.ts +1 -1
  162. package/src/login/i18n/baseMessages/zh-CN.ts +1 -1
  163. package/src/login/i18n/i18n.tsx +42 -32
  164. package/src/login/kcContext/KcContext.ts +8 -2
  165. package/src/login/kcContext/createGetKcContext.ts +84 -37
  166. package/src/login/kcContext/getKcContext.ts +3 -1
  167. package/src/login/kcContext/getKcContextFromWindow.ts +6 -2
  168. package/src/login/kcContext/kcContextMocks.ts +339 -325
  169. package/src/login/lib/useDownloadTerms.ts +6 -4
  170. package/src/login/lib/useGetClassName.ts +119 -112
  171. package/src/login/lib/useUserProfileForm.tsx +219 -205
  172. package/src/login/pages/DeleteAccountConfirm.tsx +9 -3
  173. package/src/login/pages/FrontchannelLogout.tsx +1 -1
  174. package/src/login/pages/Login.tsx +2 -2
  175. package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +3 -3
  176. package/src/login/pages/LoginResetPassword.tsx +2 -2
  177. package/src/login/pages/LoginUsername.tsx +2 -2
  178. package/src/login/pages/WebauthnAuthenticate.tsx +11 -8
  179. package/src/login/pages/WebauthnRegister.tsx +7 -7
  180. package/src/tools/AndByDiscriminatingKey.ts +12 -6
  181. package/src/tools/Array.prototype.every.ts +4 -1
  182. package/src/tools/LazyOrNot.ts +3 -1
  183. package/src/tools/clsx.ts +7 -1
  184. package/src/tools/deepAssign.ts +15 -8
  185. package/src/tools/deepClone.ts +3 -1
  186. package/src/tools/formatNumber.ts +4 -1
  187. package/src/tools/useConstCallback.ts +3 -1
  188. package/src/tools/useInsertLinkTags.ts +20 -7
  189. package/src/tools/useInsertScriptTags.ts +7 -2
  190. package/src/tools/useSetClassName.ts +4 -1
  191. package/src/vite-plugin/vite-plugin.ts +45 -21
  192. package/tools/Array.prototype.every.js +2 -1
  193. package/tools/Array.prototype.every.js.map +1 -1
  194. package/tools/clsx.js.map +1 -1
  195. package/tools/deepAssign.js +9 -7
  196. package/tools/deepAssign.js.map +1 -1
  197. package/tools/deepClone.js.map +1 -1
  198. package/tools/formatNumber.js.map +1 -1
  199. package/tools/useConstCallback.js.map +1 -1
  200. package/tools/useInsertLinkTags.js +5 -4
  201. package/tools/useInsertLinkTags.js.map +1 -1
  202. package/tools/useInsertScriptTags.js +5 -2
  203. package/tools/useInsertScriptTags.js.map +1 -1
  204. package/tools/useSetClassName.js.map +1 -1
  205. package/vite-plugin/index.js +985 -1651
  206. package/src/bin/shared/downloadAndUnzip.ts +0 -203
  207. package/src/bin/start-keycloak.ts +0 -309
  208. package/src/bin/tools/unzip.ts +0 -141
@@ -59,40 +59,45 @@ function readBuildOptions(params) {
59
59
  return process.cwd();
60
60
  }
61
61
  return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
62
- "pathIsh": cliCommandOptions.reactAppRootDirPath,
63
- "cwd": process.cwd()
62
+ pathIsh: cliCommandOptions.reactAppRootDirPath,
63
+ cwd: process.cwd()
64
64
  });
65
65
  })();
66
66
  var resolvedViteConfig = (function () {
67
67
  var _a;
68
- if (fs.readdirSync(reactAppRootDirPath).find(function (fileBasename) { return fileBasename.startsWith("vite.config"); }) === undefined) {
69
- return { "resolvedViteConfig": undefined };
68
+ if (fs
69
+ .readdirSync(reactAppRootDirPath)
70
+ .find(function (fileBasename) { return fileBasename.startsWith("vite.config"); }) ===
71
+ undefined) {
72
+ return { resolvedViteConfig: undefined };
70
73
  }
71
74
  var output = child_process
72
75
  .execSync("npx vite", {
73
- "cwd": reactAppRootDirPath,
74
- "env": __assign(__assign({}, process.env), (_a = {}, _a[constants_1.vitePluginSubScriptEnvNames.resolveViteConfig] = "true", _a))
76
+ cwd: reactAppRootDirPath,
77
+ env: __assign(__assign({}, process.env), (_a = {}, _a[constants_1.vitePluginSubScriptEnvNames.resolveViteConfig] = "true", _a))
75
78
  })
76
79
  .toString("utf8");
77
80
  (0, tsafe_1.assert)(output.includes(constants_1.vitePluginSubScriptEnvNames.resolveViteConfig), "Seems like the Keycloakify's Vite plugin is not installed.");
78
- var resolvedViteConfigStr = output.split(constants_1.vitePluginSubScriptEnvNames.resolveViteConfig).reverse()[0];
81
+ var resolvedViteConfigStr = output
82
+ .split(constants_1.vitePluginSubScriptEnvNames.resolveViteConfig)
83
+ .reverse()[0];
79
84
  var resolvedViteConfig = JSON.parse(resolvedViteConfigStr);
80
85
  return { resolvedViteConfig: resolvedViteConfig };
81
86
  })().resolvedViteConfig;
82
87
  var parsedPackageJson = (function () {
83
88
  var zParsedPackageJson = zod_1.z.object({
84
- "name": zod_1.z.string(),
85
- "version": zod_1.z.string().optional(),
86
- "homepage": zod_1.z.string().optional(),
87
- "keycloakify": zod_1.z
89
+ name: zod_1.z.string(),
90
+ version: zod_1.z.string().optional(),
91
+ homepage: zod_1.z.string().optional(),
92
+ keycloakify: zod_1.z
88
93
  .object({
89
- "extraThemeProperties": zod_1.z.array(zod_1.z.string()).optional(),
90
- "artifactId": zod_1.z.string().optional(),
91
- "groupId": zod_1.z.string().optional(),
92
- "loginThemeResourcesFromKeycloakVersion": zod_1.z.string().optional(),
93
- "reactAppBuildDirPath": zod_1.z.string().optional(),
94
- "keycloakifyBuildDirPath": zod_1.z.string().optional(),
95
- "themeName": zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional()
94
+ extraThemeProperties: zod_1.z.array(zod_1.z.string()).optional(),
95
+ artifactId: zod_1.z.string().optional(),
96
+ groupId: zod_1.z.string().optional(),
97
+ loginThemeResourcesFromKeycloakVersion: zod_1.z.string().optional(),
98
+ reactAppBuildDirPath: zod_1.z.string().optional(),
99
+ keycloakifyBuildDirPath: zod_1.z.string().optional(),
100
+ themeName: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional()
96
101
  })
97
102
  .optional()
98
103
  });
@@ -100,7 +105,9 @@ function readBuildOptions(params) {
100
105
  (0, tsafe_1.assert)();
101
106
  (0, tsafe_1.assert)();
102
107
  }
103
- return zParsedPackageJson.parse(JSON.parse(fs.readFileSync((0, path_1.join)(reactAppRootDirPath, "package.json")).toString("utf8")));
108
+ return zParsedPackageJson.parse(JSON.parse(fs
109
+ .readFileSync((0, path_1.join)(reactAppRootDirPath, "package.json"))
110
+ .toString("utf8")));
104
111
  })();
105
112
  var userProvidedBuildOptions = __assign(__assign({}, parsedPackageJson.keycloakify), resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.userProvidedBuildOptions);
106
113
  var themeNames = (function () {
@@ -125,8 +132,8 @@ function readBuildOptions(params) {
125
132
  }
126
133
  if (((_a = parsedPackageJson.keycloakify) === null || _a === void 0 ? void 0 : _a.reactAppBuildDirPath) !== undefined) {
127
134
  return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
128
- "pathIsh": parsedPackageJson.keycloakify.reactAppBuildDirPath,
129
- "cwd": reactAppRootDirPath
135
+ pathIsh: parsedPackageJson.keycloakify.reactAppBuildDirPath,
136
+ cwd: reactAppRootDirPath
130
137
  });
131
138
  }
132
139
  return (0, path_1.join)(reactAppRootDirPath, "build");
@@ -135,14 +142,14 @@ function readBuildOptions(params) {
135
142
  })();
136
143
  var npmWorkspaceRootDirPath = (0, getNpmWorkspaceRootDirPath_1.getNpmWorkspaceRootDirPath)({
137
144
  reactAppRootDirPath: reactAppRootDirPath,
138
- "dependencyExpected": "keycloakify"
145
+ dependencyExpected: "keycloakify"
139
146
  }).npmWorkspaceRootDirPath;
140
147
  return {
141
- "bundler": resolvedViteConfig !== undefined ? "vite" : "webpack",
142
- "themeVersion": (_b = (_a = process.env.KEYCLOAKIFY_THEME_VERSION) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
148
+ bundler: resolvedViteConfig !== undefined ? "vite" : "webpack",
149
+ themeVersion: (_b = (_a = process.env.KEYCLOAKIFY_THEME_VERSION) !== null && _a !== void 0 ? _a : parsedPackageJson.version) !== null && _b !== void 0 ? _b : "0.0.0",
143
150
  themeNames: themeNames,
144
- "extraThemeProperties": userProvidedBuildOptions.extraThemeProperties,
145
- "groupId": (function () {
151
+ extraThemeProperties: userProvidedBuildOptions.extraThemeProperties,
152
+ groupId: (function () {
146
153
  var _a, _b, _c, _d, _e;
147
154
  var fallbackGroupId = "".concat(themeNames[0], ".keycloak");
148
155
  return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : userProvidedBuildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
@@ -150,47 +157,49 @@ function readBuildOptions(params) {
150
157
  : (_e = (_d = (_c = (0, url_1.parse)(parsedPackageJson.homepage)
151
158
  .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");
152
159
  })(),
153
- "artifactId": (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : userProvidedBuildOptions.artifactId) !== null && _d !== void 0 ? _d : "".concat(themeNames[0], "-keycloak-theme"),
154
- "loginThemeResourcesFromKeycloakVersion": (_e = userProvidedBuildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
160
+ artifactId: (_d = (_c = process.env.KEYCLOAKIFY_ARTIFACT_ID) !== null && _c !== void 0 ? _c : userProvidedBuildOptions.artifactId) !== null && _d !== void 0 ? _d : "".concat(themeNames[0], "-keycloak-theme"),
161
+ loginThemeResourcesFromKeycloakVersion: (_e = userProvidedBuildOptions.loginThemeResourcesFromKeycloakVersion) !== null && _e !== void 0 ? _e : "24.0.4",
155
162
  reactAppRootDirPath: reactAppRootDirPath,
156
163
  reactAppBuildDirPath: reactAppBuildDirPath,
157
- "keycloakifyBuildDirPath": (function () {
164
+ keycloakifyBuildDirPath: (function () {
158
165
  if (userProvidedBuildOptions.keycloakifyBuildDirPath !== undefined) {
159
166
  return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
160
- "pathIsh": userProvidedBuildOptions.keycloakifyBuildDirPath,
161
- "cwd": reactAppRootDirPath
167
+ pathIsh: userProvidedBuildOptions.keycloakifyBuildDirPath,
168
+ cwd: reactAppRootDirPath
162
169
  });
163
170
  }
164
- return (0, path_1.join)(reactAppRootDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined ? "build_keycloak" : "".concat(resolvedViteConfig.buildDir, "_keycloak"));
171
+ return (0, path_1.join)(reactAppRootDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
172
+ ? "build_keycloak"
173
+ : "".concat(resolvedViteConfig.buildDir, "_keycloak"));
165
174
  })(),
166
- "publicDirPath": (function () {
175
+ publicDirPath: (function () {
167
176
  webpack: {
168
177
  if (resolvedViteConfig !== undefined) {
169
178
  break webpack;
170
179
  }
171
180
  if (process.env.PUBLIC_DIR_PATH !== undefined) {
172
181
  return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
173
- "pathIsh": process.env.PUBLIC_DIR_PATH,
174
- "cwd": reactAppRootDirPath
182
+ pathIsh: process.env.PUBLIC_DIR_PATH,
183
+ cwd: reactAppRootDirPath
175
184
  });
176
185
  }
177
186
  return (0, path_1.join)(reactAppRootDirPath, "public");
178
187
  }
179
188
  return (0, path_1.join)(reactAppRootDirPath, resolvedViteConfig.publicDir);
180
189
  })(),
181
- "cacheDirPath": (function () {
190
+ cacheDirPath: (function () {
182
191
  var cacheDirPath = (0, path_1.join)((function () {
183
192
  if (process.env.XDG_CACHE_HOME !== undefined) {
184
193
  return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
185
- "pathIsh": process.env.XDG_CACHE_HOME,
186
- "cwd": process.cwd()
194
+ pathIsh: process.env.XDG_CACHE_HOME,
195
+ cwd: process.cwd()
187
196
  });
188
197
  }
189
198
  return (0, path_1.join)(npmWorkspaceRootDirPath, "node_modules", ".cache");
190
199
  })(), "keycloakify");
191
200
  return cacheDirPath;
192
201
  })(),
193
- "urlPathname": (function () {
202
+ urlPathname: (function () {
194
203
  webpack: {
195
204
  if (resolvedViteConfig !== undefined) {
196
205
  break webpack;
@@ -208,7 +217,7 @@ function readBuildOptions(params) {
208
217
  }
209
218
  return resolvedViteConfig.urlPathname;
210
219
  })(),
211
- "assetsDirPath": (function () {
220
+ assetsDirPath: (function () {
212
221
  webpack: {
213
222
  if (resolvedViteConfig !== undefined) {
214
223
  break webpack;
@@ -231,7 +240,7 @@ exports.readBuildOptions = readBuildOptions;
231
240
  "use strict";
232
241
 
233
242
  Object.defineProperty(exports, "__esModule", ({ value: true }));
234
- exports.accountThemePageIds = exports.loginThemePageIds = exports.skipBuildJarsEnvName = exports.vitePluginSubScriptEnvNames = exports.accountV1ThemeName = exports.themeTypes = exports.basenameOfTheKeycloakifyResourcesDir = exports.lastKeycloakVersionWithAccountV1 = exports.resources_common = exports.keycloak_resources = exports.nameOfTheGlobal = void 0;
243
+ exports.containerName = exports.accountThemePageIds = exports.loginThemePageIds = exports.skipBuildJarsEnvName = exports.vitePluginSubScriptEnvNames = exports.accountV1ThemeName = exports.themeTypes = exports.basenameOfTheKeycloakifyResourcesDir = exports.lastKeycloakVersionWithAccountV1 = exports.resources_common = exports.keycloak_resources = exports.nameOfTheGlobal = void 0;
235
244
  exports.nameOfTheGlobal = "kcContext";
236
245
  exports.keycloak_resources = "keycloak-resources";
237
246
  exports.resources_common = "resources-common";
@@ -240,8 +249,8 @@ exports.basenameOfTheKeycloakifyResourcesDir = "build";
240
249
  exports.themeTypes = ["login", "account"];
241
250
  exports.accountV1ThemeName = "account-v1";
242
251
  exports.vitePluginSubScriptEnvNames = {
243
- "runPostBuildScript": "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
244
- "resolveViteConfig": "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
252
+ runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
253
+ resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
245
254
  };
246
255
  exports.skipBuildJarsEnvName = "KEYCLOAKIFY_SKIP_BUILD_JAR";
247
256
  exports.loginThemePageIds = [
@@ -289,6 +298,7 @@ exports.accountThemePageIds = [
289
298
  "log.ftl",
290
299
  "federatedIdentity.ftl"
291
300
  ];
301
+ exports.containerName = "keycloak-keycloakify";
292
302
  //# sourceMappingURL=constants.js.map
293
303
 
294
304
  /***/ }),
@@ -390,31 +400,33 @@ function copyKeycloakResourcesToPublic(params) {
390
400
  keycloakifyBuildinfoFilePath = (0, path_1.join)(destDirPath, "keycloakify.buildinfo");
391
401
  keycloakifyBuildinfoRaw = JSON.stringify({
392
402
  destDirPath: destDirPath,
393
- "keycloakifyVersion": (0, readThisNpmPackageVersion_1.readThisNpmPackageVersion)(),
394
- "buildOptions": {
395
- "loginThemeResourcesFromKeycloakVersion": (0, readThisNpmPackageVersion_1.readThisNpmPackageVersion)(),
396
- "cacheDirPath": (0, path_1.relative)(destDirPath, buildOptions.cacheDirPath),
397
- "npmWorkspaceRootDirPath": (0, path_1.relative)(destDirPath, buildOptions.npmWorkspaceRootDirPath)
403
+ keycloakifyVersion: (0, readThisNpmPackageVersion_1.readThisNpmPackageVersion)(),
404
+ buildOptions: {
405
+ loginThemeResourcesFromKeycloakVersion: (0, readThisNpmPackageVersion_1.readThisNpmPackageVersion)(),
406
+ cacheDirPath: (0, path_1.relative)(destDirPath, buildOptions.cacheDirPath),
407
+ npmWorkspaceRootDirPath: (0, path_1.relative)(destDirPath, buildOptions.npmWorkspaceRootDirPath)
398
408
  }
399
409
  }, null, 2);
400
410
  skip_if_already_done: {
401
411
  if (!fs.existsSync(keycloakifyBuildinfoFilePath)) {
402
412
  break skip_if_already_done;
403
413
  }
404
- keycloakifyBuildinfoRaw_previousRun = fs.readFileSync(keycloakifyBuildinfoFilePath).toString("utf8");
414
+ keycloakifyBuildinfoRaw_previousRun = fs
415
+ .readFileSync(keycloakifyBuildinfoFilePath)
416
+ .toString("utf8");
405
417
  if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
406
418
  break skip_if_already_done;
407
419
  }
408
420
  return [2 /*return*/];
409
421
  }
410
- (0, fs_rmSync_1.rmSync)(destDirPath, { "force": true, "recursive": true });
411
- fs.mkdirSync(destDirPath, { "recursive": true });
422
+ (0, fs_rmSync_1.rmSync)(destDirPath, { force: true, recursive: true });
423
+ fs.mkdirSync(destDirPath, { recursive: true });
412
424
  fs.writeFileSync((0, path_1.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
413
425
  _loop_1 = function (themeType) {
414
426
  return __generator(this, function (_c) {
415
427
  switch (_c.label) {
416
428
  case 0: return [4 /*yield*/, (0, downloadKeycloakStaticResources_1.downloadKeycloakStaticResources)({
417
- "keycloakVersion": (function () {
429
+ keycloakVersion: (function () {
418
430
  switch (themeType) {
419
431
  case "login":
420
432
  return buildOptions.loginThemeResourcesFromKeycloakVersion;
@@ -423,7 +435,7 @@ function copyKeycloakResourcesToPublic(params) {
423
435
  }
424
436
  })(),
425
437
  themeType: themeType,
426
- "themeDirPath": destDirPath,
438
+ themeDirPath: destDirPath,
427
439
  buildOptions: buildOptions
428
440
  })];
429
441
  case 1:
@@ -477,296 +489,11 @@ exports.copyKeycloakResourcesToPublic = copyKeycloakResourcesToPublic;
477
489
 
478
490
  /***/ }),
479
491
 
480
- /***/ 8469:
481
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
482
-
483
- "use strict";
484
-
485
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
486
- if (k2 === undefined) k2 = k;
487
- var desc = Object.getOwnPropertyDescriptor(m, k);
488
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
489
- desc = { enumerable: true, get: function() { return m[k]; } };
490
- }
491
- Object.defineProperty(o, k2, desc);
492
- }) : (function(o, m, k, k2) {
493
- if (k2 === undefined) k2 = k;
494
- o[k2] = m[k];
495
- }));
496
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
497
- Object.defineProperty(o, "default", { enumerable: true, value: v });
498
- }) : function(o, v) {
499
- o["default"] = v;
500
- });
501
- var __importStar = (this && this.__importStar) || function (mod) {
502
- if (mod && mod.__esModule) return mod;
503
- var result = {};
504
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
505
- __setModuleDefault(result, mod);
506
- return result;
507
- };
508
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
509
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
510
- return new (P || (P = Promise))(function (resolve, reject) {
511
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
512
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
513
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
514
- step((generator = generator.apply(thisArg, _arguments || [])).next());
515
- });
516
- };
517
- var __generator = (this && this.__generator) || function (thisArg, body) {
518
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
519
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
520
- function verb(n) { return function (v) { return step([n, v]); }; }
521
- function step(op) {
522
- if (f) throw new TypeError("Generator is already executing.");
523
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
524
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
525
- if (y = 0, t) op = [op[0] & 2, t.value];
526
- switch (op[0]) {
527
- case 0: case 1: t = op; break;
528
- case 4: _.label++; return { value: op[1], done: false };
529
- case 5: _.label++; y = op[1]; op = [0]; continue;
530
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
531
- default:
532
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
533
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
534
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
535
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
536
- if (t[2]) _.ops.pop();
537
- _.trys.pop(); continue;
538
- }
539
- op = body.call(thisArg, _);
540
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
541
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
542
- }
543
- };
544
- var __importDefault = (this && this.__importDefault) || function (mod) {
545
- return (mod && mod.__esModule) ? mod : { "default": mod };
546
- };
547
- Object.defineProperty(exports, "__esModule", ({ value: true }));
548
- exports.downloadAndUnzip = void 0;
549
- var crypto_1 = __nccwpck_require__(6113);
550
- var promises_1 = __nccwpck_require__(3292);
551
- var make_fetch_happen_1 = __importDefault(__nccwpck_require__(9525));
552
- var path_1 = __nccwpck_require__(1017);
553
- var assert_1 = __nccwpck_require__(8078);
554
- var transformCodebase_1 = __nccwpck_require__(332);
555
- var unzip_1 = __nccwpck_require__(4131);
556
- var fs_rm_1 = __nccwpck_require__(8699);
557
- var child_process = __importStar(__nccwpck_require__(2081));
558
- var fs_existsAsync_1 = __nccwpck_require__(3765);
559
- var fetchProxyOptions_1 = __nccwpck_require__(47);
560
- (0, assert_1.assert)();
561
- function downloadAndUnzip(params) {
562
- return __awaiter(this, void 0, void 0, function () {
563
- var url, destDirPath, specificDirsToExtract, preCacheTransform, buildOptions, _a, extractDirPath, zipFilePath, _b, response, isFromRemoteCache, error_1, githubToken;
564
- var _this = this;
565
- var _c;
566
- return __generator(this, function (_d) {
567
- switch (_d.label) {
568
- case 0:
569
- url = params.url, destDirPath = params.destDirPath, specificDirsToExtract = params.specificDirsToExtract, preCacheTransform = params.preCacheTransform, buildOptions = params.buildOptions;
570
- _a = (function () {
571
- var zipFileBasenameWithoutExt = generateFileNameFromURL({
572
- url: url,
573
- "preCacheTransform": preCacheTransform === undefined
574
- ? undefined
575
- : {
576
- "actionCacheId": preCacheTransform.actionCacheId,
577
- "actionFootprint": preCacheTransform.action.toString()
578
- }
579
- });
580
- var zipFilePath = (0, path_1.join)(buildOptions.cacheDirPath, "".concat(zipFileBasenameWithoutExt, ".zip"));
581
- var extractDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "tmp_unzip_".concat(zipFileBasenameWithoutExt));
582
- return { zipFilePath: zipFilePath, extractDirPath: extractDirPath };
583
- })(), extractDirPath = _a.extractDirPath, zipFilePath = _a.zipFilePath;
584
- return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(zipFilePath)];
585
- case 1:
586
- if (_d.sent()) {
587
- return [3 /*break*/, 14];
588
- }
589
- return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
590
- var proxyFetchOptions, response, _a;
591
- var _b;
592
- return __generator(this, function (_c) {
593
- switch (_c.label) {
594
- case 0: return [4 /*yield*/, (0, fetchProxyOptions_1.getProxyFetchOptions)({
595
- "npmWorkspaceRootDirPath": buildOptions.npmWorkspaceRootDirPath
596
- })];
597
- case 1:
598
- proxyFetchOptions = _c.sent();
599
- return [4 /*yield*/, (0, make_fetch_happen_1.default)("https://github.com/keycloakify/keycloakify/releases/download/v0.0.1/".concat((0, path_1.basename)(zipFilePath)), proxyFetchOptions)];
600
- case 2:
601
- response = _c.sent();
602
- if (response.status === 200) {
603
- return [2 /*return*/, {
604
- response: response,
605
- "isFromRemoteCache": true
606
- }];
607
- }
608
- _b = {};
609
- _a = "response";
610
- return [4 /*yield*/, (0, make_fetch_happen_1.default)(url, proxyFetchOptions)];
611
- case 3: return [2 /*return*/, (_b[_a] = _c.sent(),
612
- _b["isFromRemoteCache"] = false,
613
- _b)];
614
- }
615
- });
616
- }); })()];
617
- case 2:
618
- _b = _d.sent(), response = _b.response, isFromRemoteCache = _b.isFromRemoteCache;
619
- return [4 /*yield*/, (0, promises_1.mkdir)((0, path_1.dirname)(zipFilePath), { "recursive": true })];
620
- case 3:
621
- _d.sent();
622
- /**
623
- * The correct way to fix this is to upgrade node-fetch beyond 3.2.5
624
- * (see https://github.com/node-fetch/node-fetch/issues/1295#issuecomment-1144061991.)
625
- * Unfortunately, octokit (a dependency of keycloakify) also uses node-fetch, and
626
- * does not support node-fetch 3.x. So we stick around with this band-aid until
627
- * octokit upgrades.
628
- */
629
- (_c = response.body) === null || _c === void 0 ? void 0 : _c.setMaxListeners(Number.MAX_VALUE);
630
- (0, assert_1.assert)(typeof response.body !== "undefined" && response.body != null);
631
- return [4 /*yield*/, (0, promises_1.writeFile)(zipFilePath, response.body)];
632
- case 4:
633
- _d.sent();
634
- if (isFromRemoteCache) {
635
- return [3 /*break*/, 14];
636
- }
637
- if (specificDirsToExtract === undefined && preCacheTransform === undefined) {
638
- return [3 /*break*/, 14];
639
- }
640
- return [4 /*yield*/, (0, unzip_1.unzip)(zipFilePath, extractDirPath, specificDirsToExtract)];
641
- case 5:
642
- _d.sent();
643
- _d.label = 6;
644
- case 6:
645
- _d.trys.push([6, 8, , 10]);
646
- return [4 /*yield*/, (preCacheTransform === null || preCacheTransform === void 0 ? void 0 : preCacheTransform.action({
647
- "destDirPath": extractDirPath
648
- }))];
649
- case 7:
650
- _d.sent();
651
- return [3 /*break*/, 10];
652
- case 8:
653
- error_1 = _d.sent();
654
- return [4 /*yield*/, Promise.all([(0, fs_rm_1.rm)(extractDirPath, { "recursive": true }), (0, promises_1.unlink)(zipFilePath)])];
655
- case 9:
656
- _d.sent();
657
- throw error_1;
658
- case 10: return [4 /*yield*/, (0, promises_1.unlink)(zipFilePath)];
659
- case 11:
660
- _d.sent();
661
- return [4 /*yield*/, (0, unzip_1.zip)(extractDirPath, zipFilePath)];
662
- case 12:
663
- _d.sent();
664
- return [4 /*yield*/, (0, fs_rm_1.rm)(extractDirPath, { "recursive": true })];
665
- case 13:
666
- _d.sent();
667
- upload_to_remote_cache_if_admin: {
668
- githubToken = process.env["KEYCLOAKIFY_ADMIN_GITHUB_PERSONAL_ACCESS_TOKEN"];
669
- if (!githubToken) {
670
- break upload_to_remote_cache_if_admin;
671
- }
672
- console.log("uploading to remote cache");
673
- try {
674
- child_process.execSync("which putasset");
675
- }
676
- catch (_e) {
677
- child_process.execSync("npm install -g putasset");
678
- }
679
- try {
680
- child_process.execFileSync("putasset", [
681
- "--owner",
682
- "keycloakify",
683
- "--repo",
684
- "keycloakify",
685
- "--tag",
686
- "v0.0.1",
687
- "--filename",
688
- zipFilePath,
689
- "--token",
690
- githubToken
691
- ]);
692
- }
693
- catch (_f) {
694
- console.log("upload failed, asset probably already exists in remote cache");
695
- }
696
- }
697
- _d.label = 14;
698
- case 14: return [4 /*yield*/, (0, unzip_1.unzip)(zipFilePath, extractDirPath)];
699
- case 15:
700
- _d.sent();
701
- (0, transformCodebase_1.transformCodebase)({
702
- "srcDirPath": extractDirPath,
703
- "destDirPath": destDirPath
704
- });
705
- return [4 /*yield*/, (0, fs_rm_1.rm)(extractDirPath, { "recursive": true })];
706
- case 16:
707
- _d.sent();
708
- return [2 /*return*/];
709
- }
710
- });
711
- });
712
- }
713
- exports.downloadAndUnzip = downloadAndUnzip;
714
- function generateFileNameFromURL(params) {
715
- var preCacheTransform = params.preCacheTransform;
716
- // Parse the URL
717
- var url = new URL(params.url);
718
- // Extract pathname and remove leading slashes
719
- var fileName = url.pathname.replace(/^\//, "").replace(/\//g, "_");
720
- // Optionally, add query parameters replacing special characters
721
- if (url.search) {
722
- fileName += url.search.replace(/[&=?]/g, "-");
723
- }
724
- // Replace any characters that are not valid in filenames
725
- fileName = fileName.replace(/[^a-zA-Z0-9-_]/g, "");
726
- // Trim or pad the fileName to a specific length
727
- fileName = fileName.substring(0, 50);
728
- add_pre_cache_transform: {
729
- if (preCacheTransform === undefined) {
730
- break add_pre_cache_transform;
731
- }
732
- // Sanitize actionCacheId the same way as other components
733
- var sanitizedActionCacheId = preCacheTransform.actionCacheId.replace(/[^a-zA-Z0-9-_]/g, "_");
734
- fileName += "_".concat(sanitizedActionCacheId, "_").concat((0, crypto_1.createHash)("sha256").update(preCacheTransform.actionFootprint).digest("hex").substring(0, 5));
735
- }
736
- return fileName;
737
- }
738
- //# sourceMappingURL=downloadAndUnzip.js.map
739
-
740
- /***/ }),
741
-
742
492
  /***/ 597:
743
493
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
744
494
 
745
495
  "use strict";
746
496
 
747
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
748
- if (k2 === undefined) k2 = k;
749
- var desc = Object.getOwnPropertyDescriptor(m, k);
750
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
751
- desc = { enumerable: true, get: function() { return m[k]; } };
752
- }
753
- Object.defineProperty(o, k2, desc);
754
- }) : (function(o, m, k, k2) {
755
- if (k2 === undefined) k2 = k;
756
- o[k2] = m[k];
757
- }));
758
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
759
- Object.defineProperty(o, "default", { enumerable: true, value: v });
760
- }) : function(o, v) {
761
- o["default"] = v;
762
- });
763
- var __importStar = (this && this.__importStar) || function (mod) {
764
- if (mod && mod.__esModule) return mod;
765
- var result = {};
766
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
767
- __setModuleDefault(result, mod);
768
- return result;
769
- };
770
497
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
771
498
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
772
499
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -828,231 +555,181 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
828
555
  }
829
556
  return to.concat(ar || Array.prototype.slice.call(from));
830
557
  };
558
+ var __values = (this && this.__values) || function(o) {
559
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
560
+ if (m) return m.call(o);
561
+ if (o && typeof o.length === "number") return {
562
+ next: function () {
563
+ if (o && i >= o.length) o = void 0;
564
+ return { value: o && o[i++], done: !o };
565
+ }
566
+ };
567
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
568
+ };
831
569
  Object.defineProperty(exports, "__esModule", ({ value: true }));
832
570
  exports.downloadKeycloakDefaultTheme = void 0;
833
571
  var path_1 = __nccwpck_require__(1017);
834
- var downloadAndUnzip_1 = __nccwpck_require__(8469);
835
572
  var assert_1 = __nccwpck_require__(8078);
836
- var child_process = __importStar(__nccwpck_require__(2081));
837
- var fs = __importStar(__nccwpck_require__(7147));
838
- var fs_rmSync_1 = __nccwpck_require__(9693);
839
573
  var constants_1 = __nccwpck_require__(173);
840
- var transformCodebase_1 = __nccwpck_require__(332);
574
+ var downloadAndExtractArchive_1 = __nccwpck_require__(8562);
575
+ var isInside_1 = __nccwpck_require__(1653);
841
576
  (0, assert_1.assert)();
842
577
  function downloadKeycloakDefaultTheme(params) {
843
578
  return __awaiter(this, void 0, void 0, function () {
844
- var keycloakVersion, destDirPath, buildOptions;
579
+ var keycloakVersion, buildOptions, extractedDirPath;
845
580
  var _this = this;
846
581
  return __generator(this, function (_a) {
847
582
  switch (_a.label) {
848
583
  case 0:
849
- keycloakVersion = params.keycloakVersion, destDirPath = params.destDirPath, buildOptions = params.buildOptions;
850
- return [4 /*yield*/, (0, downloadAndUnzip_1.downloadAndUnzip)({
851
- destDirPath: destDirPath,
852
- "url": "https://github.com/keycloak/keycloak/archive/refs/tags/".concat(keycloakVersion, ".zip"),
853
- "specificDirsToExtract": ["", "-community"].map(function (ext) { return "keycloak-".concat(keycloakVersion, "/themes/src/main/resources").concat(ext, "/theme"); }),
854
- buildOptions: buildOptions,
855
- "preCacheTransform": {
856
- "actionCacheId": "npm install and build",
857
- "action": function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
858
- var commonResourcesDirPath, baseLoginThemeResourceDir, accountV2DirSrcDirPath, packageManager, packageJsonFilePath, packageJsonRaw, parsedPackageJson, keycloakV2DirPath, nodeModuleDirPath, toDeletePerfixes_1, libDirPath, toDeletePerfixes_2, accountCssFilePath, nodeModulesDirPath, toKeepPrefixes_1;
859
- var destDirPath = _b.destDirPath;
860
- return __generator(this, function (_c) {
861
- install_common_node_modules: {
862
- commonResourcesDirPath = (0, path_1.join)(destDirPath, "keycloak", "common", "resources");
863
- if (!fs.existsSync(commonResourcesDirPath)) {
864
- break install_common_node_modules;
584
+ keycloakVersion = params.keycloakVersion, buildOptions = params.buildOptions;
585
+ return [4 /*yield*/, (0, downloadAndExtractArchive_1.downloadAndExtractArchive)({
586
+ url: "https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/".concat(keycloakVersion, "/keycloak-themes-").concat(keycloakVersion, ".jar"),
587
+ cacheDirPath: buildOptions.cacheDirPath,
588
+ npmWorkspaceRootDirPath: buildOptions.npmWorkspaceRootDirPath,
589
+ uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
590
+ onArchiveFile: function (params) { return __awaiter(_this, void 0, void 0, function () {
591
+ var readFile, writeFile, fileRelativePath, _a, _b, _c, nodeModulesDirPath_1, toKeepPrefixes, _d, _e, dirBasename, _f, _g, dirBasename;
592
+ var _h, e_1, _j, e_2, _k;
593
+ return __generator(this, function (_l) {
594
+ switch (_l.label) {
595
+ case 0:
596
+ if (!(0, isInside_1.isInside)({ dirPath: "theme", filePath: params.fileRelativePath })) {
597
+ return [2 /*return*/];
865
598
  }
866
- if (!fs.existsSync((0, path_1.join)(commonResourcesDirPath, "package.json"))) {
867
- break install_common_node_modules;
599
+ readFile = params.readFile, writeFile = params.writeFile;
600
+ fileRelativePath = (0, path_1.relative)("theme", params.fileRelativePath);
601
+ skip_keycloak_v2: {
602
+ if (!(0, isInside_1.isInside)({
603
+ dirPath: (0, path_1.join)("keycloak.v2"),
604
+ filePath: fileRelativePath
605
+ })) {
606
+ break skip_keycloak_v2;
607
+ }
608
+ return [2 /*return*/];
868
609
  }
869
- if (fs.existsSync((0, path_1.join)(commonResourcesDirPath, "node_modules"))) {
870
- break install_common_node_modules;
610
+ if (constants_1.lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
611
+ return [3 /*break*/, 4];
871
612
  }
872
- child_process.execSync("npm install --omit=dev", {
873
- "cwd": commonResourcesDirPath,
874
- "stdio": "ignore"
875
- });
876
- }
877
- repatriate_common_resources_from_base_login_theme: {
878
- baseLoginThemeResourceDir = (0, path_1.join)(destDirPath, "base", "login", "resources");
879
- if (!fs.existsSync(baseLoginThemeResourceDir)) {
880
- break repatriate_common_resources_from_base_login_theme;
613
+ if (fileRelativePath !==
614
+ (0, path_1.join)("keycloak", "account", "resources", "css", "account.css")) {
615
+ return [3 /*break*/, 3];
881
616
  }
882
- (0, transformCodebase_1.transformCodebase)({
883
- "srcDirPath": baseLoginThemeResourceDir,
884
- "destDirPath": (0, path_1.join)(destDirPath, "keycloak", "login", "resources")
885
- });
886
- }
887
- install_and_move_to_common_resources_generated_in_keycloak_v2: {
888
- if (!fs.readFileSync((0, path_1.join)(destDirPath, "keycloak", "login", "theme.properties")).toString("utf8").includes("web_modules")) {
889
- break install_and_move_to_common_resources_generated_in_keycloak_v2;
890
- }
891
- accountV2DirSrcDirPath = (0, path_1.join)(destDirPath, "keycloak.v2", "account", "src");
892
- if (!fs.existsSync(accountV2DirSrcDirPath)) {
893
- break install_and_move_to_common_resources_generated_in_keycloak_v2;
617
+ _a = writeFile;
618
+ _h = {
619
+ fileRelativePath: fileRelativePath
620
+ };
621
+ _c = (_b = Buffer).from;
622
+ return [4 /*yield*/, readFile()];
623
+ case 1: return [4 /*yield*/, _a.apply(void 0, [(_h.modifiedData = _c.apply(_b, [(_l.sent())
624
+ .toString("utf8")
625
+ .replace("top: -34px;", "top: -34px !important;"),
626
+ "utf8"]),
627
+ _h)])];
628
+ case 2:
629
+ _l.sent();
630
+ return [2 /*return*/];
631
+ case 3:
632
+ skip_web_modules: {
633
+ if (!(0, isInside_1.isInside)({
634
+ dirPath: (0, path_1.join)("keycloak", "common", "resources", "web_modules"),
635
+ filePath: fileRelativePath
636
+ })) {
637
+ break skip_web_modules;
638
+ }
639
+ return [2 /*return*/];
894
640
  }
895
- packageManager = fs.existsSync((0, path_1.join)(accountV2DirSrcDirPath, "pnpm-lock.yaml")) ? "pnpm" : "npm";
896
- if (packageManager === "pnpm") {
897
- try {
898
- child_process.execSync("which pnpm");
641
+ skip_unused_node_modules: {
642
+ nodeModulesDirPath_1 = (0, path_1.join)("keycloak", "common", "resources", "node_modules");
643
+ if (!(0, isInside_1.isInside)({
644
+ dirPath: nodeModulesDirPath_1,
645
+ filePath: fileRelativePath
646
+ })) {
647
+ break skip_unused_node_modules;
899
648
  }
900
- catch (_d) {
901
- console.log("Installing pnpm globally");
902
- child_process.execSync("npm install -g pnpm");
649
+ toKeepPrefixes = __spreadArray(__spreadArray([], __read([
650
+ "patternfly.min.css",
651
+ "patternfly-additions.min.css",
652
+ "patternfly-additions.min.css"
653
+ ].map(function (fileBasename) {
654
+ return (0, path_1.join)(nodeModulesDirPath_1, "patternfly", "dist", "css", fileBasename);
655
+ })), false), [
656
+ (0, path_1.join)(nodeModulesDirPath_1, "patternfly", "dist", "fonts")
657
+ ], false);
658
+ if (toKeepPrefixes.find(function (prefix) {
659
+ return fileRelativePath.startsWith(prefix);
660
+ }) !== undefined) {
661
+ break skip_unused_node_modules;
903
662
  }
663
+ return [2 /*return*/];
904
664
  }
905
- child_process.execSync("".concat(packageManager, " install"), { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
906
- packageJsonFilePath = (0, path_1.join)(accountV2DirSrcDirPath, "package.json");
907
- packageJsonRaw = fs.readFileSync(packageJsonFilePath);
908
- parsedPackageJson = JSON.parse(packageJsonRaw.toString("utf8"));
909
- parsedPackageJson.scripts.build = parsedPackageJson.scripts.build
910
- .replace("".concat(packageManager, " run check-types"), "true")
911
- .replace("".concat(packageManager, " run babel"), "true");
912
- fs.writeFileSync(packageJsonFilePath, Buffer.from(JSON.stringify(parsedPackageJson, null, 2), "utf8"));
913
- child_process.execSync("".concat(packageManager, " run build"), { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
914
- fs.writeFileSync(packageJsonFilePath, packageJsonRaw);
915
- fs.rmSync((0, path_1.join)(accountV2DirSrcDirPath, "node_modules"), { "recursive": true });
916
- }
917
- remove_keycloak_v2: {
918
- keycloakV2DirPath = (0, path_1.join)(destDirPath, "keycloak.v2");
919
- if (!fs.existsSync(keycloakV2DirPath)) {
920
- break remove_keycloak_v2;
921
- }
922
- (0, fs_rmSync_1.rmSync)(keycloakV2DirPath, { "recursive": true });
923
- }
924
- // Note, this is an optimization for reducing the size of the jar
925
- remove_unused_node_modules: {
926
- nodeModuleDirPath = (0, path_1.join)(destDirPath, "keycloak", "common", "resources", "node_modules");
927
- if (!fs.existsSync(nodeModuleDirPath)) {
928
- break remove_unused_node_modules;
929
- }
930
- toDeletePerfixes_1 = [
931
- "angular",
932
- "bootstrap",
933
- "rcue",
934
- "font-awesome",
935
- "ng-file-upload",
936
- (0, path_1.join)("patternfly", "dist", "sass"),
937
- (0, path_1.join)("patternfly", "dist", "less"),
938
- (0, path_1.join)("patternfly", "dist", "js"),
939
- "d3",
940
- (0, path_1.join)("jquery", "src"),
941
- "c3",
942
- "core-js",
943
- "eonasdan-bootstrap-datetimepicker",
944
- "moment",
945
- "react",
946
- "patternfly-bootstrap-treeview",
947
- "popper.js",
948
- "tippy.js",
949
- "jquery-match-height",
950
- "google-code-prettify",
951
- "patternfly-bootstrap-combobox",
952
- "focus-trap",
953
- "tabbable",
954
- "scheduler",
955
- "@types",
956
- "datatables.net",
957
- "datatables.net-colreorder",
958
- "tslib",
959
- "prop-types",
960
- "file-selector",
961
- "datatables.net-colreorder-bs",
962
- "object-assign",
963
- "warning",
964
- "js-tokens",
965
- "loose-envify",
966
- "prop-types-extra",
967
- "attr-accept",
968
- "datatables.net-select",
969
- "drmonty-datatables-colvis",
970
- "datatables.net-bs",
971
- (0, path_1.join)("@patternfly", "react"),
972
- (0, path_1.join)("@patternfly", "patternfly", "docs")
973
- ];
974
- (0, transformCodebase_1.transformCodebase)({
975
- "srcDirPath": nodeModuleDirPath,
976
- "destDirPath": nodeModuleDirPath,
977
- "transformSourceCode": function (_a) {
978
- var sourceCode = _a.sourceCode, fileRelativePath = _a.fileRelativePath;
979
- if (fileRelativePath.endsWith(".map")) {
980
- return undefined;
981
- }
982
- if (toDeletePerfixes_1.find(function (prefix) { return fileRelativePath.startsWith(prefix); }) !== undefined) {
983
- return undefined;
984
- }
985
- if (fileRelativePath.startsWith((0, path_1.join)("patternfly", "dist", "fonts"))) {
986
- if (!fileRelativePath.endsWith(".woff2") &&
987
- !fileRelativePath.endsWith(".woff") &&
988
- !fileRelativePath.endsWith(".ttf")) {
989
- return undefined;
665
+ _l.label = 4;
666
+ case 4:
667
+ skip_unused_resources: {
668
+ if (keycloakVersion !== "24.0.4") {
669
+ break skip_unused_resources;
670
+ }
671
+ try {
672
+ for (_d = __values([
673
+ "@patternfly-v5",
674
+ "@rollup",
675
+ "rollup",
676
+ "react",
677
+ "react-dom",
678
+ "shx",
679
+ ".pnpm"
680
+ ]), _e = _d.next(); !_e.done; _e = _d.next()) {
681
+ dirBasename = _e.value;
682
+ if ((0, isInside_1.isInside)({
683
+ dirPath: (0, path_1.join)("keycloak", "common", "resources", "node_modules", dirBasename),
684
+ filePath: fileRelativePath
685
+ })) {
686
+ return [2 /*return*/];
990
687
  }
991
688
  }
992
- return { "modifiedSourceCode": sourceCode };
993
689
  }
994
- });
995
- }
996
- // Just like node_modules
997
- remove_unused_lib: {
998
- libDirPath = (0, path_1.join)(destDirPath, "keycloak", "common", "resources", "lib");
999
- if (!fs.existsSync(libDirPath)) {
1000
- break remove_unused_lib;
1001
- }
1002
- toDeletePerfixes_2 = ["ui-ace", "filesaver", "fileupload", "angular", "ui-ace"];
1003
- (0, transformCodebase_1.transformCodebase)({
1004
- "srcDirPath": libDirPath,
1005
- "destDirPath": libDirPath,
1006
- "transformSourceCode": function (_a) {
1007
- var sourceCode = _a.sourceCode, fileRelativePath = _a.fileRelativePath;
1008
- if (fileRelativePath.endsWith(".map")) {
1009
- return undefined;
690
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
691
+ finally {
692
+ try {
693
+ if (_e && !_e.done && (_j = _d.return)) _j.call(_d);
1010
694
  }
1011
- if (toDeletePerfixes_2.find(function (prefix) { return fileRelativePath.startsWith(prefix); }) !== undefined) {
1012
- return undefined;
1013
- }
1014
- return { "modifiedSourceCode": sourceCode };
695
+ finally { if (e_1) throw e_1.error; }
1015
696
  }
1016
- });
1017
- }
1018
- last_account_v1_transformations: {
1019
- if (constants_1.lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
1020
- break last_account_v1_transformations;
1021
- }
1022
- {
1023
- accountCssFilePath = (0, path_1.join)(destDirPath, "keycloak", "account", "resources", "css", "account.css");
1024
- fs.writeFileSync(accountCssFilePath, Buffer.from(fs.readFileSync(accountCssFilePath).toString("utf8").replace("top: -34px;", "top: -34px !important;"), "utf8"));
1025
- }
1026
- // Note, this is an optimization for reducing the size of the jar,
1027
- // For this version we know exactly which resources are used.
1028
- {
1029
- nodeModulesDirPath = (0, path_1.join)(destDirPath, "keycloak", "common", "resources", "node_modules");
1030
- toKeepPrefixes_1 = __spreadArray(__spreadArray([], __read(["patternfly.min.css", "patternfly-additions.min.css", "patternfly-additions.min.css"].map(function (fileBasename) {
1031
- return (0, path_1.join)("patternfly", "dist", "css", fileBasename);
1032
- })), false), [
1033
- (0, path_1.join)("patternfly", "dist", "fonts")
1034
- ], false);
1035
- (0, transformCodebase_1.transformCodebase)({
1036
- "srcDirPath": nodeModulesDirPath,
1037
- "destDirPath": nodeModulesDirPath,
1038
- "transformSourceCode": function (_a) {
1039
- var sourceCode = _a.sourceCode, fileRelativePath = _a.fileRelativePath;
1040
- if (toKeepPrefixes_1.find(function (prefix) { return fileRelativePath.startsWith(prefix); }) === undefined) {
1041
- return undefined;
697
+ try {
698
+ for (_f = __values(["react", "react-dom"]), _g = _f.next(); !_g.done; _g = _f.next()) {
699
+ dirBasename = _g.value;
700
+ if ((0, isInside_1.isInside)({
701
+ dirPath: (0, path_1.join)("keycloak", "common", "resources", "vendor", dirBasename),
702
+ filePath: fileRelativePath
703
+ })) {
704
+ return [2 /*return*/];
1042
705
  }
1043
- return { "modifiedSourceCode": sourceCode };
1044
706
  }
1045
- });
707
+ }
708
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
709
+ finally {
710
+ try {
711
+ if (_g && !_g.done && (_k = _f.return)) _k.call(_f);
712
+ }
713
+ finally { if (e_2) throw e_2.error; }
714
+ }
715
+ if ((0, isInside_1.isInside)({
716
+ dirPath: (0, path_1.join)("keycloak", "common", "resources", "node_modules", "@patternfly", "react-core"),
717
+ filePath: fileRelativePath
718
+ })) {
719
+ return [2 /*return*/];
720
+ }
1046
721
  }
1047
- }
1048
- return [2 /*return*/];
1049
- });
1050
- }); }
1051
- }
722
+ return [4 /*yield*/, writeFile({ fileRelativePath: fileRelativePath })];
723
+ case 5:
724
+ _l.sent();
725
+ return [2 /*return*/];
726
+ }
727
+ });
728
+ }); }
1052
729
  })];
1053
730
  case 1:
1054
- _a.sent();
1055
- return [2 /*return*/];
731
+ extractedDirPath = (_a.sent()).extractedDirPath;
732
+ return [2 /*return*/, { defaultThemeDirPath: extractedDirPath }];
1056
733
  }
1057
734
  });
1058
735
  });
@@ -1067,29 +744,6 @@ exports.downloadKeycloakDefaultTheme = downloadKeycloakDefaultTheme;
1067
744
 
1068
745
  "use strict";
1069
746
 
1070
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1071
- if (k2 === undefined) k2 = k;
1072
- var desc = Object.getOwnPropertyDescriptor(m, k);
1073
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1074
- desc = { enumerable: true, get: function() { return m[k]; } };
1075
- }
1076
- Object.defineProperty(o, k2, desc);
1077
- }) : (function(o, m, k, k2) {
1078
- if (k2 === undefined) k2 = k;
1079
- o[k2] = m[k];
1080
- }));
1081
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
1082
- Object.defineProperty(o, "default", { enumerable: true, value: v });
1083
- }) : function(o, v) {
1084
- o["default"] = v;
1085
- });
1086
- var __importStar = (this && this.__importStar) || function (mod) {
1087
- if (mod && mod.__esModule) return mod;
1088
- var result = {};
1089
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1090
- __setModuleDefault(result, mod);
1091
- return result;
1092
- };
1093
747
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1094
748
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1095
749
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1133,34 +787,42 @@ var path_1 = __nccwpck_require__(1017);
1133
787
  var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(597);
1134
788
  var constants_1 = __nccwpck_require__(173);
1135
789
  var assert_1 = __nccwpck_require__(8078);
1136
- var crypto = __importStar(__nccwpck_require__(6113));
1137
- var fs_rmSync_1 = __nccwpck_require__(9693);
790
+ var fs_existsAsync_1 = __nccwpck_require__(3765);
1138
791
  (0, assert_1.assert)();
1139
792
  function downloadKeycloakStaticResources(params) {
1140
793
  return __awaiter(this, void 0, void 0, function () {
1141
- var themeType, themeDirPath, keycloakVersion, buildOptions, tmpDirPath, resourcesPath;
794
+ var themeType, themeDirPath, keycloakVersion, buildOptions, defaultThemeDirPath, resourcesDirPath, srcDirPath;
1142
795
  return __generator(this, function (_a) {
1143
796
  switch (_a.label) {
1144
797
  case 0:
1145
798
  themeType = params.themeType, themeDirPath = params.themeDirPath, keycloakVersion = params.keycloakVersion, buildOptions = params.buildOptions;
1146
- tmpDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "downloadKeycloakStaticResources_tmp_".concat(crypto.createHash("sha256").update("".concat(themeType, "-").concat(keycloakVersion)).digest("hex").slice(0, 8)));
1147
799
  return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
1148
800
  keycloakVersion: keycloakVersion,
1149
- "destDirPath": tmpDirPath,
1150
801
  buildOptions: buildOptions
1151
802
  })];
1152
803
  case 1:
1153
- _a.sent();
1154
- resourcesPath = (0, path_1.join)(themeDirPath, themeType, "resources");
804
+ defaultThemeDirPath = (_a.sent()).defaultThemeDirPath;
805
+ resourcesDirPath = (0, path_1.join)(themeDirPath, themeType, "resources");
806
+ srcDirPath = (0, path_1.join)(defaultThemeDirPath, "base", themeType, "resources");
807
+ return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(srcDirPath)];
808
+ case 2:
809
+ if (!(_a.sent())) {
810
+ return [3 /*break*/, 3];
811
+ }
812
+ (0, transformCodebase_1.transformCodebase)({
813
+ srcDirPath: srcDirPath,
814
+ destDirPath: resourcesDirPath
815
+ });
816
+ _a.label = 3;
817
+ case 3:
1155
818
  (0, transformCodebase_1.transformCodebase)({
1156
- "srcDirPath": (0, path_1.join)(tmpDirPath, "keycloak", themeType, "resources"),
1157
- "destDirPath": resourcesPath
819
+ srcDirPath: (0, path_1.join)(defaultThemeDirPath, "keycloak", themeType, "resources"),
820
+ destDirPath: resourcesDirPath
1158
821
  });
1159
822
  (0, transformCodebase_1.transformCodebase)({
1160
- "srcDirPath": (0, path_1.join)(tmpDirPath, "keycloak", "common", "resources"),
1161
- "destDirPath": (0, path_1.join)(resourcesPath, constants_1.resources_common)
823
+ srcDirPath: (0, path_1.join)(defaultThemeDirPath, "keycloak", "common", "resources"),
824
+ destDirPath: (0, path_1.join)(resourcesDirPath, constants_1.resources_common)
1162
825
  });
1163
- (0, fs_rmSync_1.rmSync)(tmpDirPath, { "recursive": true });
1164
826
  return [2 /*return*/];
1165
827
  }
1166
828
  });
@@ -1208,17 +870,17 @@ var SemVer;
1208
870
  if (!match) {
1209
871
  throw new Error("".concat(versionStr, " is not a valid semantic version"));
1210
872
  }
1211
- var semVer = __assign({ "major": parseInt(match[1]), "minor": parseInt(match[2]), "patch": (function () {
873
+ var semVer = __assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (function () {
1212
874
  var str = match[3];
1213
875
  return str === undefined ? 0 : parseInt(str);
1214
876
  })() }, (function () {
1215
877
  var str = match[4];
1216
- return str === undefined ? {} : { "rc": parseInt(str) };
878
+ return str === undefined ? {} : { rc: parseInt(str) };
1217
879
  })());
1218
880
  var initialStr = stringify(semVer);
1219
881
  Object.defineProperty(semVer, "parsedFrom", {
1220
- "enumerable": true,
1221
- "get": function () {
882
+ enumerable: true,
883
+ get: function () {
1222
884
  var currentStr = stringify(this);
1223
885
  if (currentStr !== initialStr) {
1224
886
  throw new Error("SemVer.parsedFrom can't be read anymore, the version have been modified from ".concat(initialStr, " to ").concat(currentStr));
@@ -1269,8 +931,12 @@ var SemVer;
1269
931
  */
1270
932
  function bumpType(params) {
1271
933
  var e_2, _a;
1272
- var versionAhead = typeof params.versionAhead === "string" ? parse(params.versionAhead) : params.versionAhead;
1273
- var versionBehind = typeof params.versionBehind === "string" ? parse(params.versionBehind) : params.versionBehind;
934
+ var versionAhead = typeof params.versionAhead === "string"
935
+ ? parse(params.versionAhead)
936
+ : params.versionAhead;
937
+ var versionBehind = typeof params.versionBehind === "string"
938
+ ? parse(params.versionBehind)
939
+ : params.versionBehind;
1274
940
  if (compare(versionBehind, versionAhead) === 1) {
1275
941
  throw new Error("Version regression ".concat(stringify(versionBehind), " -> ").concat(stringify(versionAhead)));
1276
942
  }
@@ -1378,7 +1044,397 @@ exports.crawl = crawl;
1378
1044
 
1379
1045
  /***/ }),
1380
1046
 
1381
- /***/ 47:
1047
+ /***/ 7906:
1048
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1049
+
1050
+ "use strict";
1051
+
1052
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1053
+ if (k2 === undefined) k2 = k;
1054
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1055
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1056
+ desc = { enumerable: true, get: function() { return m[k]; } };
1057
+ }
1058
+ Object.defineProperty(o, k2, desc);
1059
+ }) : (function(o, m, k, k2) {
1060
+ if (k2 === undefined) k2 = k;
1061
+ o[k2] = m[k];
1062
+ }));
1063
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
1064
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1065
+ }) : function(o, v) {
1066
+ o["default"] = v;
1067
+ });
1068
+ var __importStar = (this && this.__importStar) || function (mod) {
1069
+ if (mod && mod.__esModule) return mod;
1070
+ var result = {};
1071
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1072
+ __setModuleDefault(result, mod);
1073
+ return result;
1074
+ };
1075
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1076
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1077
+ return new (P || (P = Promise))(function (resolve, reject) {
1078
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1079
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1080
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1081
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1082
+ });
1083
+ };
1084
+ var __generator = (this && this.__generator) || function (thisArg, body) {
1085
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1086
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1087
+ function verb(n) { return function (v) { return step([n, v]); }; }
1088
+ function step(op) {
1089
+ if (f) throw new TypeError("Generator is already executing.");
1090
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
1091
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1092
+ if (y = 0, t) op = [op[0] & 2, t.value];
1093
+ switch (op[0]) {
1094
+ case 0: case 1: t = op; break;
1095
+ case 4: _.label++; return { value: op[1], done: false };
1096
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1097
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1098
+ default:
1099
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1100
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1101
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1102
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1103
+ if (t[2]) _.ops.pop();
1104
+ _.trys.pop(); continue;
1105
+ }
1106
+ op = body.call(thisArg, _);
1107
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1108
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1109
+ }
1110
+ };
1111
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1112
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1113
+ };
1114
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1115
+ exports.downloadAndExtractArchive = void 0;
1116
+ var make_fetch_happen_1 = __importDefault(__nccwpck_require__(9525));
1117
+ var promises_1 = __nccwpck_require__(3292);
1118
+ var path_1 = __nccwpck_require__(1017);
1119
+ var assert_1 = __nccwpck_require__(8078);
1120
+ var extractArchive_1 = __nccwpck_require__(9121);
1121
+ var fs_existsAsync_1 = __nccwpck_require__(3765);
1122
+ var fetchProxyOptions_1 = __nccwpck_require__(1222);
1123
+ var crypto = __importStar(__nccwpck_require__(6113));
1124
+ var fs_rm_1 = __nccwpck_require__(8699);
1125
+ function downloadAndExtractArchive(params) {
1126
+ return __awaiter(this, void 0, void 0, function () {
1127
+ var url, uniqueIdOfOnOnArchiveFile, onArchiveFile, cacheDirPath, npmWorkspaceRootDirPath, archiveFileBasename, archiveFilePath, isDownloaded, response, _a, _b, extractDirBasename, _c, _d, extractedDirPath, isExtracted;
1128
+ var _this = this;
1129
+ var _e;
1130
+ return __generator(this, function (_f) {
1131
+ switch (_f.label) {
1132
+ case 0:
1133
+ url = params.url, uniqueIdOfOnOnArchiveFile = params.uniqueIdOfOnOnArchiveFile, onArchiveFile = params.onArchiveFile, cacheDirPath = params.cacheDirPath, npmWorkspaceRootDirPath = params.npmWorkspaceRootDirPath;
1134
+ archiveFileBasename = url.split("?")[0].split("/").reverse()[0];
1135
+ archiveFilePath = (0, path_1.join)(cacheDirPath, archiveFileBasename);
1136
+ return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(archiveFilePath)];
1137
+ case 1:
1138
+ if (!_f.sent()) return [3 /*break*/, 5];
1139
+ return [4 /*yield*/, SuccessTracker.getIsDownloaded({
1140
+ cacheDirPath: cacheDirPath,
1141
+ archiveFileBasename: archiveFileBasename
1142
+ })];
1143
+ case 2:
1144
+ isDownloaded = _f.sent();
1145
+ if (isDownloaded) {
1146
+ return [3 /*break*/, 11];
1147
+ }
1148
+ return [4 /*yield*/, (0, promises_1.unlink)(archiveFilePath)];
1149
+ case 3:
1150
+ _f.sent();
1151
+ return [4 /*yield*/, SuccessTracker.removeFromDownloaded({
1152
+ cacheDirPath: cacheDirPath,
1153
+ archiveFileBasename: archiveFileBasename
1154
+ })];
1155
+ case 4:
1156
+ _f.sent();
1157
+ _f.label = 5;
1158
+ case 5: return [4 /*yield*/, (0, promises_1.mkdir)((0, path_1.dirname)(archiveFilePath), { recursive: true })];
1159
+ case 6:
1160
+ _f.sent();
1161
+ _a = make_fetch_happen_1.default;
1162
+ _b = [url];
1163
+ return [4 /*yield*/, (0, fetchProxyOptions_1.getProxyFetchOptions)({ npmWorkspaceRootDirPath: npmWorkspaceRootDirPath })];
1164
+ case 7: return [4 /*yield*/, _a.apply(void 0, _b.concat([_f.sent()]))];
1165
+ case 8:
1166
+ response = _f.sent();
1167
+ (_e = response.body) === null || _e === void 0 ? void 0 : _e.setMaxListeners(Number.MAX_VALUE);
1168
+ (0, assert_1.assert)(typeof response.body !== "undefined" && response.body != null);
1169
+ return [4 /*yield*/, (0, promises_1.writeFile)(archiveFilePath, response.body)];
1170
+ case 9:
1171
+ _f.sent();
1172
+ return [4 /*yield*/, SuccessTracker.markAsDownloaded({
1173
+ cacheDirPath: cacheDirPath,
1174
+ archiveFileBasename: archiveFileBasename
1175
+ })];
1176
+ case 10:
1177
+ _f.sent();
1178
+ _f.label = 11;
1179
+ case 11:
1180
+ extractDirBasename = "".concat(archiveFileBasename.split(".")[0], "_").concat(uniqueIdOfOnOnArchiveFile, "_").concat(crypto
1181
+ .createHash("sha256")
1182
+ .update(onArchiveFile.toString())
1183
+ .digest("hex")
1184
+ .substring(0, 5));
1185
+ _d = (_c = Promise).all;
1186
+ return [4 /*yield*/, (0, promises_1.readdir)(cacheDirPath)];
1187
+ case 12: return [4 /*yield*/, _d.apply(_c, [(_f.sent())
1188
+ .filter((function () {
1189
+ var prefix = extractDirBasename
1190
+ .split("_")
1191
+ .reverse()
1192
+ .slice(1)
1193
+ .reverse()
1194
+ .join("_");
1195
+ return function (basename) {
1196
+ return basename !== extractDirBasename && basename.startsWith(prefix);
1197
+ };
1198
+ })())
1199
+ .map(function (extractDirBasename) { return __awaiter(_this, void 0, void 0, function () {
1200
+ return __generator(this, function (_a) {
1201
+ switch (_a.label) {
1202
+ case 0: return [4 /*yield*/, (0, fs_rm_1.rm)((0, path_1.join)(cacheDirPath, extractDirBasename), { recursive: true })];
1203
+ case 1:
1204
+ _a.sent();
1205
+ return [4 /*yield*/, SuccessTracker.removeFromExtracted({
1206
+ cacheDirPath: cacheDirPath,
1207
+ extractDirBasename: extractDirBasename
1208
+ })];
1209
+ case 2:
1210
+ _a.sent();
1211
+ return [2 /*return*/];
1212
+ }
1213
+ });
1214
+ }); })])];
1215
+ case 13:
1216
+ _f.sent();
1217
+ extractedDirPath = (0, path_1.join)(cacheDirPath, extractDirBasename);
1218
+ return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(extractedDirPath)];
1219
+ case 14:
1220
+ if (!_f.sent()) return [3 /*break*/, 18];
1221
+ return [4 /*yield*/, SuccessTracker.getIsExtracted({
1222
+ cacheDirPath: cacheDirPath,
1223
+ extractDirBasename: extractDirBasename
1224
+ })];
1225
+ case 15:
1226
+ isExtracted = _f.sent();
1227
+ if (isExtracted) {
1228
+ return [3 /*break*/, 21];
1229
+ }
1230
+ return [4 /*yield*/, (0, fs_rm_1.rm)(extractedDirPath, { recursive: true })];
1231
+ case 16:
1232
+ _f.sent();
1233
+ return [4 /*yield*/, SuccessTracker.removeFromExtracted({
1234
+ cacheDirPath: cacheDirPath,
1235
+ extractDirBasename: extractDirBasename
1236
+ })];
1237
+ case 17:
1238
+ _f.sent();
1239
+ _f.label = 18;
1240
+ case 18: return [4 /*yield*/, (0, extractArchive_1.extractArchive)({
1241
+ archiveFilePath: archiveFilePath,
1242
+ onArchiveFile: function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
1243
+ var relativeFilePathInArchive = _b.relativeFilePathInArchive, readFile = _b.readFile, writeFile = _b.writeFile;
1244
+ return __generator(this, function (_c) {
1245
+ return [2 /*return*/, onArchiveFile({
1246
+ fileRelativePath: relativeFilePathInArchive,
1247
+ readFile: readFile,
1248
+ writeFile: function (_a) {
1249
+ var fileRelativePath = _a.fileRelativePath, modifiedData = _a.modifiedData;
1250
+ return writeFile({
1251
+ filePath: (0, path_1.join)(extractedDirPath, fileRelativePath),
1252
+ modifiedData: modifiedData
1253
+ });
1254
+ }
1255
+ })];
1256
+ });
1257
+ }); }
1258
+ })];
1259
+ case 19:
1260
+ _f.sent();
1261
+ return [4 /*yield*/, SuccessTracker.markAsExtracted({
1262
+ cacheDirPath: cacheDirPath,
1263
+ extractDirBasename: extractDirBasename
1264
+ })];
1265
+ case 20:
1266
+ _f.sent();
1267
+ _f.label = 21;
1268
+ case 21: return [2 /*return*/, { extractedDirPath: extractedDirPath }];
1269
+ }
1270
+ });
1271
+ });
1272
+ }
1273
+ exports.downloadAndExtractArchive = downloadAndExtractArchive;
1274
+ var SuccessTracker;
1275
+ (function (SuccessTracker) {
1276
+ function read(params) {
1277
+ return __awaiter(this, void 0, void 0, function () {
1278
+ var cacheDirPath, filePath, _a, _b;
1279
+ return __generator(this, function (_c) {
1280
+ switch (_c.label) {
1281
+ case 0:
1282
+ cacheDirPath = params.cacheDirPath;
1283
+ filePath = (0, path_1.join)(cacheDirPath, "downloadAndExtractArchive.json");
1284
+ return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(filePath)];
1285
+ case 1:
1286
+ if (!(_c.sent())) {
1287
+ return [2 /*return*/, { archiveFileBasenames: [], extractDirBasenames: [] }];
1288
+ }
1289
+ _b = (_a = JSON).parse;
1290
+ return [4 /*yield*/, (0, promises_1.readFile)(filePath)];
1291
+ case 2: return [2 /*return*/, _b.apply(_a, [(_c.sent()).toString("utf8")])];
1292
+ }
1293
+ });
1294
+ });
1295
+ }
1296
+ function write(params) {
1297
+ return __awaiter(this, void 0, void 0, function () {
1298
+ var cacheDirPath, successTracker, filePath, dirPath;
1299
+ return __generator(this, function (_a) {
1300
+ switch (_a.label) {
1301
+ case 0:
1302
+ cacheDirPath = params.cacheDirPath, successTracker = params.successTracker;
1303
+ filePath = (0, path_1.join)(cacheDirPath, "downloadAndExtractArchive.json");
1304
+ dirPath = (0, path_1.dirname)(filePath);
1305
+ return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(dirPath)];
1306
+ case 1:
1307
+ if (!!(_a.sent())) return [3 /*break*/, 3];
1308
+ return [4 /*yield*/, (0, promises_1.mkdir)(dirPath, { recursive: true })];
1309
+ case 2:
1310
+ _a.sent();
1311
+ _a.label = 3;
1312
+ case 3: return [4 /*yield*/, (0, promises_1.writeFile)(filePath, JSON.stringify(successTracker))];
1313
+ case 4:
1314
+ _a.sent();
1315
+ return [2 /*return*/];
1316
+ }
1317
+ });
1318
+ });
1319
+ }
1320
+ function markAsDownloaded(params) {
1321
+ return __awaiter(this, void 0, void 0, function () {
1322
+ var cacheDirPath, archiveFileBasename, successTracker;
1323
+ return __generator(this, function (_a) {
1324
+ switch (_a.label) {
1325
+ case 0:
1326
+ cacheDirPath = params.cacheDirPath, archiveFileBasename = params.archiveFileBasename;
1327
+ return [4 /*yield*/, read({ cacheDirPath: cacheDirPath })];
1328
+ case 1:
1329
+ successTracker = _a.sent();
1330
+ successTracker.archiveFileBasenames.push(archiveFileBasename);
1331
+ return [4 /*yield*/, write({ cacheDirPath: cacheDirPath, successTracker: successTracker })];
1332
+ case 2:
1333
+ _a.sent();
1334
+ return [2 /*return*/];
1335
+ }
1336
+ });
1337
+ });
1338
+ }
1339
+ SuccessTracker.markAsDownloaded = markAsDownloaded;
1340
+ function getIsDownloaded(params) {
1341
+ return __awaiter(this, void 0, void 0, function () {
1342
+ var cacheDirPath, archiveFileBasename, successTracker;
1343
+ return __generator(this, function (_a) {
1344
+ switch (_a.label) {
1345
+ case 0:
1346
+ cacheDirPath = params.cacheDirPath, archiveFileBasename = params.archiveFileBasename;
1347
+ return [4 /*yield*/, read({ cacheDirPath: cacheDirPath })];
1348
+ case 1:
1349
+ successTracker = _a.sent();
1350
+ return [2 /*return*/, successTracker.archiveFileBasenames.includes(archiveFileBasename)];
1351
+ }
1352
+ });
1353
+ });
1354
+ }
1355
+ SuccessTracker.getIsDownloaded = getIsDownloaded;
1356
+ function removeFromDownloaded(params) {
1357
+ return __awaiter(this, void 0, void 0, function () {
1358
+ var cacheDirPath, archiveFileBasename, successTracker;
1359
+ return __generator(this, function (_a) {
1360
+ switch (_a.label) {
1361
+ case 0:
1362
+ cacheDirPath = params.cacheDirPath, archiveFileBasename = params.archiveFileBasename;
1363
+ return [4 /*yield*/, read({ cacheDirPath: cacheDirPath })];
1364
+ case 1:
1365
+ successTracker = _a.sent();
1366
+ successTracker.archiveFileBasenames = successTracker.archiveFileBasenames.filter(function (basename) { return basename !== archiveFileBasename; });
1367
+ return [4 /*yield*/, write({ cacheDirPath: cacheDirPath, successTracker: successTracker })];
1368
+ case 2:
1369
+ _a.sent();
1370
+ return [2 /*return*/];
1371
+ }
1372
+ });
1373
+ });
1374
+ }
1375
+ SuccessTracker.removeFromDownloaded = removeFromDownloaded;
1376
+ function markAsExtracted(params) {
1377
+ return __awaiter(this, void 0, void 0, function () {
1378
+ var cacheDirPath, extractDirBasename, successTracker;
1379
+ return __generator(this, function (_a) {
1380
+ switch (_a.label) {
1381
+ case 0:
1382
+ cacheDirPath = params.cacheDirPath, extractDirBasename = params.extractDirBasename;
1383
+ return [4 /*yield*/, read({ cacheDirPath: cacheDirPath })];
1384
+ case 1:
1385
+ successTracker = _a.sent();
1386
+ successTracker.extractDirBasenames.push(extractDirBasename);
1387
+ return [4 /*yield*/, write({ cacheDirPath: cacheDirPath, successTracker: successTracker })];
1388
+ case 2:
1389
+ _a.sent();
1390
+ return [2 /*return*/];
1391
+ }
1392
+ });
1393
+ });
1394
+ }
1395
+ SuccessTracker.markAsExtracted = markAsExtracted;
1396
+ function getIsExtracted(params) {
1397
+ return __awaiter(this, void 0, void 0, function () {
1398
+ var cacheDirPath, extractDirBasename, successTracker;
1399
+ return __generator(this, function (_a) {
1400
+ switch (_a.label) {
1401
+ case 0:
1402
+ cacheDirPath = params.cacheDirPath, extractDirBasename = params.extractDirBasename;
1403
+ return [4 /*yield*/, read({ cacheDirPath: cacheDirPath })];
1404
+ case 1:
1405
+ successTracker = _a.sent();
1406
+ return [2 /*return*/, successTracker.extractDirBasenames.includes(extractDirBasename)];
1407
+ }
1408
+ });
1409
+ });
1410
+ }
1411
+ SuccessTracker.getIsExtracted = getIsExtracted;
1412
+ function removeFromExtracted(params) {
1413
+ return __awaiter(this, void 0, void 0, function () {
1414
+ var cacheDirPath, extractDirBasename, successTracker;
1415
+ return __generator(this, function (_a) {
1416
+ switch (_a.label) {
1417
+ case 0:
1418
+ cacheDirPath = params.cacheDirPath, extractDirBasename = params.extractDirBasename;
1419
+ return [4 /*yield*/, read({ cacheDirPath: cacheDirPath })];
1420
+ case 1:
1421
+ successTracker = _a.sent();
1422
+ successTracker.extractDirBasenames = successTracker.extractDirBasenames.filter(function (basename) { return basename !== extractDirBasename; });
1423
+ return [4 /*yield*/, write({ cacheDirPath: cacheDirPath, successTracker: successTracker })];
1424
+ case 2:
1425
+ _a.sent();
1426
+ return [2 /*return*/];
1427
+ }
1428
+ });
1429
+ });
1430
+ }
1431
+ SuccessTracker.removeFromExtracted = removeFromExtracted;
1432
+ })(SuccessTracker || (SuccessTracker = {}));
1433
+ //# sourceMappingURL=downloadAndExtractArchive.js.map
1434
+
1435
+ /***/ }),
1436
+
1437
+ /***/ 1222:
1382
1438
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1383
1439
 
1384
1440
  "use strict";
@@ -1470,7 +1526,8 @@ function ensureSingleOrNone(arg0) {
1470
1526
  return undefined;
1471
1527
  if (arg0.length === 1)
1472
1528
  return arg0[0];
1473
- throw new Error("Illegal configuration, expected a single value but found multiple: " + arg0.map(String).join(", "));
1529
+ throw new Error("Illegal configuration, expected a single value but found multiple: " +
1530
+ arg0.map(String).join(", "));
1474
1531
  }
1475
1532
  /**
1476
1533
  * Get npm configuration as map
@@ -1483,7 +1540,10 @@ function getNmpConfig(params) {
1483
1540
  case 0:
1484
1541
  npmWorkspaceRootDirPath = params.npmWorkspaceRootDirPath;
1485
1542
  exec = (0, util_1.promisify)(child_process_1.exec);
1486
- return [4 /*yield*/, exec("npm config get", { "encoding": "utf8", "cwd": npmWorkspaceRootDirPath }).then(function (_a) {
1543
+ return [4 /*yield*/, exec("npm config get", {
1544
+ encoding: "utf8",
1545
+ cwd: npmWorkspaceRootDirPath
1546
+ }).then(function (_a) {
1487
1547
  var stdout = _a.stdout;
1488
1548
  return stdout;
1489
1549
  })];
@@ -1492,7 +1552,8 @@ function getNmpConfig(params) {
1492
1552
  npmConfigReducer = function (cfg, _a) {
1493
1553
  var _b, _c;
1494
1554
  var _d = __read(_a, 2), key = _d[0], value = _d[1];
1495
- return key in cfg ? __assign(__assign({}, cfg), (_b = {}, _b[key] = __spreadArray(__spreadArray([], __read(ensureArray(cfg[key])), false), [value], false), _b)) : __assign(__assign({}, cfg), (_c = {}, _c[key] = value, _c));
1555
+ return key in cfg
1556
+ ? __assign(__assign({}, cfg), (_b = {}, _b[key] = __spreadArray(__spreadArray([], __read(ensureArray(cfg[key])), false), [value], false), _b)) : __assign(__assign({}, cfg), (_c = {}, _c[key] = value, _c));
1496
1557
  };
1497
1558
  return [2 /*return*/, stdout
1498
1559
  .split("\n")
@@ -1532,7 +1593,9 @@ function getProxyFetchOptions(params) {
1532
1593
  return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
1533
1594
  function chunks(arr, size) {
1534
1595
  if (size === void 0) { size = 2; }
1535
- return arr.map(function (_, i) { return i % size == 0 && arr.slice(i, i + size); }).filter(Boolean);
1596
+ return arr
1597
+ .map(function (_, i) { return i % size == 0 && arr.slice(i, i + size); })
1598
+ .filter(Boolean);
1536
1599
  }
1537
1600
  var cafileContent;
1538
1601
  return __generator(this, function (_a) {
@@ -1547,7 +1610,13 @@ function getProxyFetchOptions(params) {
1547
1610
  case 2:
1548
1611
  _b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
1549
1612
  _h.label = 3;
1550
- case 3: return [2 /*return*/, { proxy: proxy, noProxy: noProxy, strictSSL: strictSSL, cert: cert, "ca": ca.length === 0 ? undefined : ca }];
1613
+ case 3: return [2 /*return*/, {
1614
+ proxy: proxy,
1615
+ noProxy: noProxy,
1616
+ strictSSL: strictSSL,
1617
+ cert: cert,
1618
+ ca: ca.length === 0 ? undefined : ca
1619
+ }];
1551
1620
  }
1552
1621
  });
1553
1622
  });
@@ -1557,6 +1626,224 @@ exports.getProxyFetchOptions = getProxyFetchOptions;
1557
1626
 
1558
1627
  /***/ }),
1559
1628
 
1629
+ /***/ 8562:
1630
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1631
+
1632
+ "use strict";
1633
+
1634
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1635
+ if (k2 === undefined) k2 = k;
1636
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1637
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1638
+ desc = { enumerable: true, get: function() { return m[k]; } };
1639
+ }
1640
+ Object.defineProperty(o, k2, desc);
1641
+ }) : (function(o, m, k, k2) {
1642
+ if (k2 === undefined) k2 = k;
1643
+ o[k2] = m[k];
1644
+ }));
1645
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1646
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1647
+ };
1648
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1649
+ __exportStar(__nccwpck_require__(7906), exports);
1650
+ //# sourceMappingURL=index.js.map
1651
+
1652
+ /***/ }),
1653
+
1654
+ /***/ 9121:
1655
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1656
+
1657
+ "use strict";
1658
+
1659
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1660
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1661
+ return new (P || (P = Promise))(function (resolve, reject) {
1662
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1663
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1664
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1665
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1666
+ });
1667
+ };
1668
+ var __generator = (this && this.__generator) || function (thisArg, body) {
1669
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1670
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1671
+ function verb(n) { return function (v) { return step([n, v]); }; }
1672
+ function step(op) {
1673
+ if (f) throw new TypeError("Generator is already executing.");
1674
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
1675
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1676
+ if (y = 0, t) op = [op[0] & 2, t.value];
1677
+ switch (op[0]) {
1678
+ case 0: case 1: t = op; break;
1679
+ case 4: _.label++; return { value: op[1], done: false };
1680
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1681
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1682
+ default:
1683
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1684
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1685
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1686
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1687
+ if (t[2]) _.ops.pop();
1688
+ _.trys.pop(); continue;
1689
+ }
1690
+ op = body.call(thisArg, _);
1691
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1692
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1693
+ }
1694
+ };
1695
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1696
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1697
+ };
1698
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1699
+ exports.extractArchive = void 0;
1700
+ var promises_1 = __importDefault(__nccwpck_require__(3292));
1701
+ var fs_1 = __importDefault(__nccwpck_require__(7147));
1702
+ var yauzl_1 = __importDefault(__nccwpck_require__(8781));
1703
+ var stream_1 = __importDefault(__nccwpck_require__(2781));
1704
+ var Deferred_1 = __nccwpck_require__(689);
1705
+ var path_1 = __nccwpck_require__(1017);
1706
+ function extractArchive(params) {
1707
+ return __awaiter(this, void 0, void 0, function () {
1708
+ var archiveFilePath, onArchiveFile, zipFile, dDone, writeFile, readFile;
1709
+ var _this = this;
1710
+ return __generator(this, function (_a) {
1711
+ switch (_a.label) {
1712
+ case 0:
1713
+ archiveFilePath = params.archiveFilePath, onArchiveFile = params.onArchiveFile;
1714
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
1715
+ yauzl_1.default.open(archiveFilePath, { lazyEntries: true }, function (error, zipFile) { return __awaiter(_this, void 0, void 0, function () {
1716
+ return __generator(this, function (_a) {
1717
+ if (error) {
1718
+ reject(error);
1719
+ return [2 /*return*/];
1720
+ }
1721
+ resolve(zipFile);
1722
+ return [2 /*return*/];
1723
+ });
1724
+ }); });
1725
+ })];
1726
+ case 1:
1727
+ zipFile = _a.sent();
1728
+ dDone = new Deferred_1.Deferred();
1729
+ zipFile.once("end", function () {
1730
+ zipFile.close();
1731
+ dDone.resolve();
1732
+ });
1733
+ writeFile = function (entry, params) { return __awaiter(_this, void 0, void 0, function () {
1734
+ var filePath, modifiedData, readStream, dDoneWithFile;
1735
+ var _this = this;
1736
+ return __generator(this, function (_a) {
1737
+ switch (_a.label) {
1738
+ case 0:
1739
+ filePath = params.filePath, modifiedData = params.modifiedData;
1740
+ return [4 /*yield*/, promises_1.default.mkdir((0, path_1.dirname)(filePath), { recursive: true })];
1741
+ case 1:
1742
+ _a.sent();
1743
+ if (!(modifiedData !== undefined)) return [3 /*break*/, 3];
1744
+ return [4 /*yield*/, promises_1.default.writeFile(filePath, modifiedData)];
1745
+ case 2:
1746
+ _a.sent();
1747
+ return [2 /*return*/];
1748
+ case 3: return [4 /*yield*/, new Promise(function (resolve) {
1749
+ return zipFile.openReadStream(entry, function (error, readStream) { return __awaiter(_this, void 0, void 0, function () {
1750
+ return __generator(this, function (_a) {
1751
+ if (error) {
1752
+ dDone.reject(error);
1753
+ return [2 /*return*/];
1754
+ }
1755
+ resolve(readStream);
1756
+ return [2 /*return*/];
1757
+ });
1758
+ }); });
1759
+ })];
1760
+ case 4:
1761
+ readStream = _a.sent();
1762
+ dDoneWithFile = new Deferred_1.Deferred();
1763
+ stream_1.default.pipeline(readStream, fs_1.default.createWriteStream(filePath), function (error) {
1764
+ if (error) {
1765
+ dDone.reject(error);
1766
+ return;
1767
+ }
1768
+ dDoneWithFile.resolve();
1769
+ });
1770
+ return [4 /*yield*/, dDoneWithFile.pr];
1771
+ case 5:
1772
+ _a.sent();
1773
+ return [2 /*return*/];
1774
+ }
1775
+ });
1776
+ }); };
1777
+ readFile = function (entry) {
1778
+ return new Promise(function (resolve) {
1779
+ return zipFile.openReadStream(entry, function (error, readStream) { return __awaiter(_this, void 0, void 0, function () {
1780
+ var chunks;
1781
+ return __generator(this, function (_a) {
1782
+ if (error) {
1783
+ dDone.reject(error);
1784
+ return [2 /*return*/];
1785
+ }
1786
+ chunks = [];
1787
+ readStream.on("data", function (chunk) {
1788
+ chunks.push(chunk);
1789
+ });
1790
+ readStream.on("end", function () {
1791
+ resolve(Buffer.concat(chunks));
1792
+ });
1793
+ readStream.on("error", function (error) {
1794
+ dDone.reject(error);
1795
+ });
1796
+ return [2 /*return*/];
1797
+ });
1798
+ }); });
1799
+ });
1800
+ };
1801
+ zipFile.on("entry", function (entry) { return __awaiter(_this, void 0, void 0, function () {
1802
+ var hasEarlyExitBeenCalled_1;
1803
+ return __generator(this, function (_a) {
1804
+ switch (_a.label) {
1805
+ case 0:
1806
+ // NOTE: Skip directories
1807
+ if (entry.fileName.endsWith(path_1.sep)) {
1808
+ return [3 /*break*/, 2];
1809
+ }
1810
+ hasEarlyExitBeenCalled_1 = false;
1811
+ return [4 /*yield*/, onArchiveFile({
1812
+ relativeFilePathInArchive: entry.fileName.split("/").join(path_1.sep),
1813
+ readFile: function () { return readFile(entry); },
1814
+ writeFile: function (params) { return writeFile(entry, params); },
1815
+ earlyExit: function () {
1816
+ hasEarlyExitBeenCalled_1 = true;
1817
+ }
1818
+ })];
1819
+ case 1:
1820
+ _a.sent();
1821
+ if (hasEarlyExitBeenCalled_1) {
1822
+ zipFile.close();
1823
+ dDone.resolve();
1824
+ return [2 /*return*/];
1825
+ }
1826
+ _a.label = 2;
1827
+ case 2:
1828
+ zipFile.readEntry();
1829
+ return [2 /*return*/];
1830
+ }
1831
+ });
1832
+ }); });
1833
+ zipFile.readEntry();
1834
+ return [4 /*yield*/, dDone.pr];
1835
+ case 2:
1836
+ _a.sent();
1837
+ return [2 /*return*/];
1838
+ }
1839
+ });
1840
+ });
1841
+ }
1842
+ exports.extractArchive = extractArchive;
1843
+ //# sourceMappingURL=extractArchive.js.map
1844
+
1845
+ /***/ }),
1846
+
1560
1847
  /***/ 3765:
1561
1848
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1562
1849
 
@@ -1999,7 +2286,10 @@ function getNpmWorkspaceRootDirPath(params) {
1999
2286
  var npmWorkspaceRootDirPath = (function callee(depth) {
2000
2287
  var cwd = (0, path_1.resolve)(path_1.join.apply(void 0, __spreadArray([], __read(__spreadArray([reactAppRootDirPath], __read(Array(depth).fill("..")), false)), false)));
2001
2288
  try {
2002
- child_process.execSync("npm config get", { cwd: cwd, "stdio": "ignore" });
2289
+ child_process.execSync("npm config get", {
2290
+ cwd: cwd,
2291
+ stdio: "ignore"
2292
+ });
2003
2293
  }
2004
2294
  catch (error) {
2005
2295
  if (String(error).includes("ENOWORKSPACES")) {
@@ -2015,7 +2305,10 @@ function getNpmWorkspaceRootDirPath(params) {
2015
2305
  var parsedPackageJson = JSON.parse(fs.readFileSync(packageJsonFilePath).toString("utf8"));
2016
2306
  var isExpectedDependencyFound = false;
2017
2307
  try {
2018
- for (var _b = __values(["dependencies", "devDependencies"]), _c = _b.next(); !_c.done; _c = _b.next()) {
2308
+ for (var _b = __values([
2309
+ "dependencies",
2310
+ "devDependencies"
2311
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
2019
2312
  var dependenciesOrDevDependencies = _c.value;
2020
2313
  var dependencies = parsedPackageJson[dependenciesOrDevDependencies];
2021
2314
  if (dependencies === undefined) {
@@ -2099,6 +2392,23 @@ exports.getThisCodebaseRootDirPath = getThisCodebaseRootDirPath;
2099
2392
 
2100
2393
  /***/ }),
2101
2394
 
2395
+ /***/ 1653:
2396
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
2397
+
2398
+ "use strict";
2399
+
2400
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2401
+ exports.isInside = void 0;
2402
+ var path_1 = __nccwpck_require__(1017);
2403
+ function isInside(params) {
2404
+ var dirPath = params.dirPath, filePath = params.filePath;
2405
+ return !(0, path_1.relative)(dirPath, filePath).startsWith("..");
2406
+ }
2407
+ exports.isInside = isInside;
2408
+ //# sourceMappingURL=isInside.js.map
2409
+
2410
+ /***/ }),
2411
+
2102
2412
  /***/ 4795:
2103
2413
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
2104
2414
 
@@ -2134,7 +2444,9 @@ var assert_1 = __nccwpck_require__(8078);
2134
2444
  var fs = __importStar(__nccwpck_require__(7147));
2135
2445
  var path_1 = __nccwpck_require__(1017);
2136
2446
  function readThisNpmPackageVersion() {
2137
- var version = JSON.parse(fs.readFileSync((0, path_1.join)((0, getThisCodebaseRootDirPath_1.getThisCodebaseRootDirPath)(), "package.json")).toString("utf8"))["version"];
2447
+ var version = JSON.parse(fs
2448
+ .readFileSync((0, path_1.join)((0, getThisCodebaseRootDirPath_1.getThisCodebaseRootDirPath)(), "package.json"))
2449
+ .toString("utf8"))["version"];
2138
2450
  (0, assert_1.assert)(typeof version === "string");
2139
2451
  return version;
2140
2452
  }
@@ -2197,12 +2509,17 @@ function transformCodebase(params) {
2197
2509
  var e_1, _a;
2198
2510
  var srcDirPath = params.srcDirPath, transformSourceCode = params.transformSourceCode;
2199
2511
  var isTargetSameAsSource = path.relative(srcDirPath, params.destDirPath) === "";
2200
- var destDirPath = isTargetSameAsSource ? path.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs") : params.destDirPath;
2512
+ var destDirPath = isTargetSameAsSource
2513
+ ? path.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
2514
+ : params.destDirPath;
2201
2515
  fs.mkdirSync(destDirPath, {
2202
- "recursive": true
2516
+ recursive: true
2203
2517
  });
2204
2518
  try {
2205
- for (var _b = __values((0, crawl_1.crawl)({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })), _c = _b.next(); !_c.done; _c = _b.next()) {
2519
+ for (var _b = __values((0, crawl_1.crawl)({
2520
+ dirPath: srcDirPath,
2521
+ returnedPathsType: "relative to dirPath"
2522
+ })), _c = _b.next(); !_c.done; _c = _b.next()) {
2206
2523
  var fileRelativePath = _c.value;
2207
2524
  var filePath = path.join(srcDirPath, fileRelativePath);
2208
2525
  var destFilePath = path.join(destDirPath, fileRelativePath);
@@ -2210,13 +2527,13 @@ function transformCodebase(params) {
2210
2527
  // it using the lower level implementation.
2211
2528
  if (transformSourceCode === undefined) {
2212
2529
  fs.mkdirSync(path.dirname(destFilePath), {
2213
- "recursive": true
2530
+ recursive: true
2214
2531
  });
2215
2532
  fs.copyFileSync(filePath, destFilePath);
2216
2533
  continue;
2217
2534
  }
2218
2535
  var transformSourceCodeResult = transformSourceCode({
2219
- "sourceCode": fs.readFileSync(filePath),
2536
+ sourceCode: fs.readFileSync(filePath),
2220
2537
  filePath: filePath,
2221
2538
  fileRelativePath: fileRelativePath
2222
2539
  });
@@ -2224,7 +2541,7 @@ function transformCodebase(params) {
2224
2541
  continue;
2225
2542
  }
2226
2543
  fs.mkdirSync(path.dirname(destFilePath), {
2227
- "recursive": true
2544
+ recursive: true
2228
2545
  });
2229
2546
  var newFileName = transformSourceCodeResult.newFileName, modifiedSourceCode = transformSourceCodeResult.modifiedSourceCode;
2230
2547
  fs.writeFileSync(path.join(path.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : path.basename(destFilePath)), modifiedSourceCode);
@@ -2238,7 +2555,7 @@ function transformCodebase(params) {
2238
2555
  finally { if (e_1) throw e_1.error; }
2239
2556
  }
2240
2557
  if (isTargetSameAsSource) {
2241
- (0, fs_rmSync_1.rmSync)(srcDirPath, { "recursive": true });
2558
+ (0, fs_rmSync_1.rmSync)(srcDirPath, { recursive: true });
2242
2559
  fs.renameSync(destDirPath, srcDirPath);
2243
2560
  }
2244
2561
  }
@@ -2247,287 +2564,6 @@ exports.transformCodebase = transformCodebase;
2247
2564
 
2248
2565
  /***/ }),
2249
2566
 
2250
- /***/ 4131:
2251
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
2252
-
2253
- "use strict";
2254
-
2255
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2256
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2257
- return new (P || (P = Promise))(function (resolve, reject) {
2258
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2259
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2260
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2261
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2262
- });
2263
- };
2264
- var __generator = (this && this.__generator) || function (thisArg, body) {
2265
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
2266
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
2267
- function verb(n) { return function (v) { return step([n, v]); }; }
2268
- function step(op) {
2269
- if (f) throw new TypeError("Generator is already executing.");
2270
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
2271
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2272
- if (y = 0, t) op = [op[0] & 2, t.value];
2273
- switch (op[0]) {
2274
- case 0: case 1: t = op; break;
2275
- case 4: _.label++; return { value: op[1], done: false };
2276
- case 5: _.label++; y = op[1]; op = [0]; continue;
2277
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
2278
- default:
2279
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
2280
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
2281
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
2282
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
2283
- if (t[2]) _.ops.pop();
2284
- _.trys.pop(); continue;
2285
- }
2286
- op = body.call(thisArg, _);
2287
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
2288
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2289
- }
2290
- };
2291
- var __values = (this && this.__values) || function(o) {
2292
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
2293
- if (m) return m.call(o);
2294
- if (o && typeof o.length === "number") return {
2295
- next: function () {
2296
- if (o && i >= o.length) o = void 0;
2297
- return { value: o && o[i++], done: !o };
2298
- }
2299
- };
2300
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
2301
- };
2302
- var __importDefault = (this && this.__importDefault) || function (mod) {
2303
- return (mod && mod.__esModule) ? mod : { "default": mod };
2304
- };
2305
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2306
- exports.zip = exports.unzip = void 0;
2307
- var promises_1 = __importDefault(__nccwpck_require__(3977));
2308
- var fs_1 = __importDefault(__nccwpck_require__(7147));
2309
- var node_path_1 = __importDefault(__nccwpck_require__(9411));
2310
- var yauzl_1 = __importDefault(__nccwpck_require__(8781));
2311
- var yazl_1 = __importDefault(__nccwpck_require__(8483));
2312
- var node_stream_1 = __importDefault(__nccwpck_require__(4492));
2313
- var node_util_1 = __nccwpck_require__(7261);
2314
- var pipeline = (0, node_util_1.promisify)(node_stream_1.default.pipeline);
2315
- function pathExists(path) {
2316
- return __awaiter(this, void 0, void 0, function () {
2317
- var error_1;
2318
- return __generator(this, function (_a) {
2319
- switch (_a.label) {
2320
- case 0:
2321
- _a.trys.push([0, 2, , 3]);
2322
- return [4 /*yield*/, promises_1.default.stat(path)];
2323
- case 1:
2324
- _a.sent();
2325
- return [2 /*return*/, true];
2326
- case 2:
2327
- error_1 = _a.sent();
2328
- if (error_1.code === "ENOENT") {
2329
- return [2 /*return*/, false];
2330
- }
2331
- throw error_1;
2332
- case 3: return [2 /*return*/];
2333
- }
2334
- });
2335
- });
2336
- }
2337
- // Handlings of non posix path is not implemented correctly
2338
- // it work by coincidence. Don't have the time to fix but it should be fixed.
2339
- function unzip(file, targetFolder, specificDirsToExtract) {
2340
- return __awaiter(this, void 0, void 0, function () {
2341
- var _this = this;
2342
- return __generator(this, function (_a) {
2343
- specificDirsToExtract = specificDirsToExtract === null || specificDirsToExtract === void 0 ? void 0 : specificDirsToExtract.map(function (dirPath) {
2344
- if (!dirPath.endsWith("/") || !dirPath.endsWith("\\")) {
2345
- dirPath += "/";
2346
- }
2347
- return dirPath;
2348
- });
2349
- if (!targetFolder.endsWith("/") || !targetFolder.endsWith("\\")) {
2350
- targetFolder += "/";
2351
- }
2352
- if (!fs_1.default.existsSync(targetFolder)) {
2353
- fs_1.default.mkdirSync(targetFolder, { recursive: true });
2354
- }
2355
- return [2 /*return*/, new Promise(function (resolve, reject) {
2356
- yauzl_1.default.open(file, { lazyEntries: true }, function (err, zipfile) { return __awaiter(_this, void 0, void 0, function () {
2357
- var _this = this;
2358
- return __generator(this, function (_a) {
2359
- if (err) {
2360
- reject(err);
2361
- return [2 /*return*/];
2362
- }
2363
- zipfile.readEntry();
2364
- zipfile.on("entry", function (entry) { return __awaiter(_this, void 0, void 0, function () {
2365
- var dirPath, target;
2366
- var _this = this;
2367
- return __generator(this, function (_a) {
2368
- switch (_a.label) {
2369
- case 0:
2370
- if (specificDirsToExtract !== undefined) {
2371
- dirPath = specificDirsToExtract.find(function (dirPath) { return entry.fileName.startsWith(dirPath); });
2372
- // Skip files outside of the unzipSubPath
2373
- if (dirPath === undefined) {
2374
- zipfile.readEntry();
2375
- return [2 /*return*/];
2376
- }
2377
- // Remove the unzipSubPath from the file name
2378
- entry.fileName = entry.fileName.substring(dirPath.length);
2379
- }
2380
- target = node_path_1.default.join(targetFolder, entry.fileName);
2381
- if (!/[\/\\]$/.test(target)) return [3 /*break*/, 2];
2382
- return [4 /*yield*/, promises_1.default.mkdir(target, { recursive: true })];
2383
- case 1:
2384
- _a.sent();
2385
- zipfile.readEntry();
2386
- return [2 /*return*/];
2387
- case 2: return [4 /*yield*/, pathExists(target)];
2388
- case 3:
2389
- // Skip existing files
2390
- if (_a.sent()) {
2391
- zipfile.readEntry();
2392
- return [2 /*return*/];
2393
- }
2394
- zipfile.openReadStream(entry, function (err, readStream) { return __awaiter(_this, void 0, void 0, function () {
2395
- return __generator(this, function (_a) {
2396
- switch (_a.label) {
2397
- case 0:
2398
- if (err) {
2399
- reject(err);
2400
- return [2 /*return*/];
2401
- }
2402
- return [4 /*yield*/, promises_1.default.mkdir(node_path_1.default.dirname(target), { "recursive": true })];
2403
- case 1:
2404
- _a.sent();
2405
- return [4 /*yield*/, pipeline(readStream, fs_1.default.createWriteStream(target))];
2406
- case 2:
2407
- _a.sent();
2408
- zipfile.readEntry();
2409
- return [2 /*return*/];
2410
- }
2411
- });
2412
- }); });
2413
- return [2 /*return*/];
2414
- }
2415
- });
2416
- }); });
2417
- zipfile.once("end", function () {
2418
- zipfile.close();
2419
- resolve();
2420
- });
2421
- return [2 /*return*/];
2422
- });
2423
- }); });
2424
- })];
2425
- });
2426
- });
2427
- }
2428
- exports.unzip = unzip;
2429
- // NOTE: This code was directly copied from ChatGPT and appears to function as expected.
2430
- // However, confidence in its complete accuracy and robustness is limited.
2431
- function zip(sourceFolder, targetZip) {
2432
- return __awaiter(this, void 0, void 0, function () {
2433
- var _this = this;
2434
- return __generator(this, function (_a) {
2435
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
2436
- // Recursive function to explore directories and their subdirectories
2437
- function exploreDir(dir) {
2438
- return __awaiter(this, void 0, void 0, function () {
2439
- var dirContent, dirContent_1, dirContent_1_1, file, filePath, stat, e_2_1;
2440
- var e_2, _a;
2441
- return __generator(this, function (_b) {
2442
- switch (_b.label) {
2443
- case 0: return [4 /*yield*/, promises_1.default.readdir(dir)];
2444
- case 1:
2445
- dirContent = _b.sent();
2446
- _b.label = 2;
2447
- case 2:
2448
- _b.trys.push([2, 9, 10, 11]);
2449
- dirContent_1 = __values(dirContent), dirContent_1_1 = dirContent_1.next();
2450
- _b.label = 3;
2451
- case 3:
2452
- if (!!dirContent_1_1.done) return [3 /*break*/, 8];
2453
- file = dirContent_1_1.value;
2454
- filePath = node_path_1.default.join(dir, file);
2455
- return [4 /*yield*/, promises_1.default.stat(filePath)];
2456
- case 4:
2457
- stat = _b.sent();
2458
- if (!stat.isDirectory()) return [3 /*break*/, 6];
2459
- return [4 /*yield*/, exploreDir(filePath)];
2460
- case 5:
2461
- _b.sent();
2462
- return [3 /*break*/, 7];
2463
- case 6:
2464
- if (stat.isFile()) {
2465
- files.push(filePath);
2466
- }
2467
- _b.label = 7;
2468
- case 7:
2469
- dirContent_1_1 = dirContent_1.next();
2470
- return [3 /*break*/, 3];
2471
- case 8: return [3 /*break*/, 11];
2472
- case 9:
2473
- e_2_1 = _b.sent();
2474
- e_2 = { error: e_2_1 };
2475
- return [3 /*break*/, 11];
2476
- case 10:
2477
- try {
2478
- if (dirContent_1_1 && !dirContent_1_1.done && (_a = dirContent_1.return)) _a.call(dirContent_1);
2479
- }
2480
- finally { if (e_2) throw e_2.error; }
2481
- return [7 /*endfinally*/];
2482
- case 11: return [2 /*return*/];
2483
- }
2484
- });
2485
- });
2486
- }
2487
- var zipfile, files, files_1, files_1_1, file, relativePath;
2488
- var e_1, _a;
2489
- return __generator(this, function (_b) {
2490
- switch (_b.label) {
2491
- case 0:
2492
- zipfile = new yazl_1.default.ZipFile();
2493
- files = [];
2494
- // Collecting all files to be zipped
2495
- return [4 /*yield*/, exploreDir(sourceFolder)];
2496
- case 1:
2497
- // Collecting all files to be zipped
2498
- _b.sent();
2499
- try {
2500
- // Adding files to zip
2501
- for (files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
2502
- file = files_1_1.value;
2503
- relativePath = node_path_1.default.relative(sourceFolder, file);
2504
- zipfile.addFile(file, relativePath);
2505
- }
2506
- }
2507
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2508
- finally {
2509
- try {
2510
- if (files_1_1 && !files_1_1.done && (_a = files_1.return)) _a.call(files_1);
2511
- }
2512
- finally { if (e_1) throw e_1.error; }
2513
- }
2514
- zipfile.outputStream
2515
- .pipe(fs_1.default.createWriteStream(targetZip))
2516
- .on("close", function () { return resolve(); })
2517
- .on("error", function (err) { return reject(err); }); // Listen to error events
2518
- zipfile.end();
2519
- return [2 /*return*/];
2520
- }
2521
- });
2522
- }); })];
2523
- });
2524
- });
2525
- }
2526
- exports.zip = zip;
2527
- //# sourceMappingURL=unzip.js.map
2528
-
2529
- /***/ }),
2530
-
2531
2567
  /***/ 7508:
2532
2568
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
2533
2569
 
@@ -2579,8 +2615,8 @@ function keycloakify(params) {
2579
2615
  let command = undefined;
2580
2616
  let shouldGenerateSourcemap = undefined;
2581
2617
  const plugin = {
2582
- "name": "keycloakify",
2583
- "configResolved": async (resolvedConfig) => {
2618
+ name: "keycloakify",
2619
+ configResolved: async (resolvedConfig) => {
2584
2620
  shouldGenerateSourcemap = resolvedConfig.build.sourcemap !== false;
2585
2621
  run_post_build_script_case: {
2586
2622
  const envValue = process.env[constants_1.vitePluginSubScriptEnvNames.runPostBuildScript];
@@ -2596,7 +2632,9 @@ function keycloakify(params) {
2596
2632
  urlPathname = (() => {
2597
2633
  var _a;
2598
2634
  let out = resolvedConfig.env.BASE_URL;
2599
- if (out.startsWith(".") && command === "build" && ((_a = resolvedConfig.envPrefix) === null || _a === void 0 ? void 0 : _a.includes("STORYBOOK_")) !== true) {
2635
+ if (out.startsWith(".") &&
2636
+ command === "build" &&
2637
+ ((_a = resolvedConfig.envPrefix) === null || _a === void 0 ? void 0 : _a.includes("STORYBOOK_")) !== true) {
2600
2638
  throw new Error([
2601
2639
  `BASE_URL=${out} is not supported By Keycloakify. Use an absolute path instead.`,
2602
2640
  `If this is a problem, please open an issue at https://github.com/keycloakify/keycloakify/issues/new`
@@ -2621,23 +2659,23 @@ function keycloakify(params) {
2621
2659
  }
2622
2660
  console.log(constants_1.vitePluginSubScriptEnvNames.resolveViteConfig);
2623
2661
  console.log(JSON.stringify((0, id_1.id)({
2624
- "publicDir": (0, path_1.relative)(reactAppRootDirPath, resolvedConfig.publicDir),
2625
- "assetsDir": resolvedConfig.build.assetsDir,
2626
- "buildDir": resolvedConfig.build.outDir,
2662
+ publicDir: (0, path_1.relative)(reactAppRootDirPath, resolvedConfig.publicDir),
2663
+ assetsDir: resolvedConfig.build.assetsDir,
2664
+ buildDir: resolvedConfig.build.outDir,
2627
2665
  urlPathname,
2628
2666
  userProvidedBuildOptions
2629
2667
  })));
2630
2668
  process.exit(0);
2631
2669
  }
2632
2670
  await (0, copyKeycloakResourcesToPublic_1.copyKeycloakResourcesToPublic)({
2633
- "buildOptions": (0, buildOptions_1.readBuildOptions)({
2634
- "cliCommandOptions": {
2671
+ buildOptions: (0, buildOptions_1.readBuildOptions)({
2672
+ cliCommandOptions: {
2635
2673
  reactAppRootDirPath
2636
2674
  }
2637
2675
  })
2638
2676
  });
2639
2677
  },
2640
- "transform": (code, id) => {
2678
+ transform: (code, id) => {
2641
2679
  (0, assert_1.assert)(command !== undefined);
2642
2680
  (0, assert_1.assert)(shouldGenerateSourcemap !== undefined);
2643
2681
  if (command !== "build") {
@@ -2672,22 +2710,25 @@ function keycloakify(params) {
2672
2710
  return transformedCode.toString();
2673
2711
  }
2674
2712
  const map = transformedCode.generateMap({
2675
- "source": id,
2676
- "includeContent": true,
2677
- "hires": true
2713
+ source: id,
2714
+ includeContent: true,
2715
+ hires: true
2678
2716
  });
2679
2717
  return {
2680
- "code": transformedCode.toString(),
2681
- "map": map.toString()
2718
+ code: transformedCode.toString(),
2719
+ map: map.toString()
2682
2720
  };
2683
2721
  },
2684
- "closeBundle": async () => {
2722
+ closeBundle: async () => {
2685
2723
  (0, assert_1.assert)(command !== undefined);
2686
2724
  if (command !== "build") {
2687
2725
  return;
2688
2726
  }
2689
2727
  (0, assert_1.assert)(buildDirPath !== undefined);
2690
- await (0, fs_rm_1.rm)((0, path_1.join)(buildDirPath, constants_1.keycloak_resources), { "recursive": true, "force": true });
2728
+ await (0, fs_rm_1.rm)((0, path_1.join)(buildDirPath, constants_1.keycloak_resources), {
2729
+ recursive: true,
2730
+ force: true
2731
+ });
2691
2732
  }
2692
2733
  };
2693
2734
  return plugin;
@@ -14586,6 +14627,63 @@ function createError(err, code, props) {
14586
14627
  module.exports = createError;
14587
14628
 
14588
14629
 
14630
+ /***/ }),
14631
+
14632
+ /***/ 689:
14633
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
14634
+
14635
+ "use strict";
14636
+
14637
+ var __extends = (this && this.__extends) || (function () {
14638
+ var extendStatics = function (d, b) {
14639
+ extendStatics = Object.setPrototypeOf ||
14640
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14641
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
14642
+ return extendStatics(d, b);
14643
+ };
14644
+ return function (d, b) {
14645
+ if (typeof b !== "function" && b !== null)
14646
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14647
+ extendStatics(d, b);
14648
+ function __() { this.constructor = d; }
14649
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14650
+ };
14651
+ })();
14652
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
14653
+ exports.VoidDeferred = exports.Deferred = void 0;
14654
+ var overwriteReadonlyProp_1 = __nccwpck_require__(7803);
14655
+ var Deferred = /** @class */ (function () {
14656
+ function Deferred() {
14657
+ var _this_1 = this;
14658
+ this.isPending = true;
14659
+ var resolve;
14660
+ var reject;
14661
+ this.pr = new Promise(function (resolve_, reject_) {
14662
+ resolve = function (value) {
14663
+ (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
14664
+ resolve_(value);
14665
+ };
14666
+ reject = function (error) {
14667
+ (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
14668
+ reject_(error);
14669
+ };
14670
+ });
14671
+ this.resolve = resolve;
14672
+ this.reject = reject;
14673
+ }
14674
+ return Deferred;
14675
+ }());
14676
+ exports.Deferred = Deferred;
14677
+ var VoidDeferred = /** @class */ (function (_super) {
14678
+ __extends(VoidDeferred, _super);
14679
+ function VoidDeferred() {
14680
+ return _super !== null && _super.apply(this, arguments) || this;
14681
+ }
14682
+ return VoidDeferred;
14683
+ }(Deferred));
14684
+ exports.VoidDeferred = VoidDeferred;
14685
+ //# sourceMappingURL=Deferred.js.map
14686
+
14589
14687
  /***/ }),
14590
14688
 
14591
14689
  /***/ 5010:
@@ -34606,762 +34704,6 @@ function defaultCallback(err) {
34606
34704
  }
34607
34705
 
34608
34706
 
34609
- /***/ }),
34610
-
34611
- /***/ 8483:
34612
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
34613
-
34614
- var fs = __nccwpck_require__(7147);
34615
- var Transform = (__nccwpck_require__(2781).Transform);
34616
- var PassThrough = (__nccwpck_require__(2781).PassThrough);
34617
- var zlib = __nccwpck_require__(9796);
34618
- var util = __nccwpck_require__(3837);
34619
- var EventEmitter = (__nccwpck_require__(2361).EventEmitter);
34620
- var crc32 = __nccwpck_require__(4794);
34621
-
34622
- exports.ZipFile = ZipFile;
34623
- exports.dateToDosDateTime = dateToDosDateTime;
34624
-
34625
- util.inherits(ZipFile, EventEmitter);
34626
- function ZipFile() {
34627
- this.outputStream = new PassThrough();
34628
- this.entries = [];
34629
- this.outputStreamCursor = 0;
34630
- this.ended = false; // .end() sets this
34631
- this.allDone = false; // set when we've written the last bytes
34632
- this.forceZip64Eocd = false; // configurable in .end()
34633
- }
34634
-
34635
- ZipFile.prototype.addFile = function(realPath, metadataPath, options) {
34636
- var self = this;
34637
- metadataPath = validateMetadataPath(metadataPath, false);
34638
- if (options == null) options = {};
34639
-
34640
- var entry = new Entry(metadataPath, false, options);
34641
- self.entries.push(entry);
34642
- fs.stat(realPath, function(err, stats) {
34643
- if (err) return self.emit("error", err);
34644
- if (!stats.isFile()) return self.emit("error", new Error("not a file: " + realPath));
34645
- entry.uncompressedSize = stats.size;
34646
- if (options.mtime == null) entry.setLastModDate(stats.mtime);
34647
- if (options.mode == null) entry.setFileAttributesMode(stats.mode);
34648
- entry.setFileDataPumpFunction(function() {
34649
- var readStream = fs.createReadStream(realPath);
34650
- entry.state = Entry.FILE_DATA_IN_PROGRESS;
34651
- readStream.on("error", function(err) {
34652
- self.emit("error", err);
34653
- });
34654
- pumpFileDataReadStream(self, entry, readStream);
34655
- });
34656
- pumpEntries(self);
34657
- });
34658
- };
34659
-
34660
- ZipFile.prototype.addReadStream = function(readStream, metadataPath, options) {
34661
- var self = this;
34662
- metadataPath = validateMetadataPath(metadataPath, false);
34663
- if (options == null) options = {};
34664
- var entry = new Entry(metadataPath, false, options);
34665
- self.entries.push(entry);
34666
- entry.setFileDataPumpFunction(function() {
34667
- entry.state = Entry.FILE_DATA_IN_PROGRESS;
34668
- pumpFileDataReadStream(self, entry, readStream);
34669
- });
34670
- pumpEntries(self);
34671
- };
34672
-
34673
- ZipFile.prototype.addBuffer = function(buffer, metadataPath, options) {
34674
- var self = this;
34675
- metadataPath = validateMetadataPath(metadataPath, false);
34676
- if (buffer.length > 0x3fffffff) throw new Error("buffer too large: " + buffer.length + " > " + 0x3fffffff);
34677
- if (options == null) options = {};
34678
- if (options.size != null) throw new Error("options.size not allowed");
34679
- var entry = new Entry(metadataPath, false, options);
34680
- entry.uncompressedSize = buffer.length;
34681
- entry.crc32 = crc32.unsigned(buffer);
34682
- entry.crcAndFileSizeKnown = true;
34683
- self.entries.push(entry);
34684
- if (!entry.compress) {
34685
- setCompressedBuffer(buffer);
34686
- } else {
34687
- zlib.deflateRaw(buffer, function(err, compressedBuffer) {
34688
- setCompressedBuffer(compressedBuffer);
34689
- });
34690
- }
34691
- function setCompressedBuffer(compressedBuffer) {
34692
- entry.compressedSize = compressedBuffer.length;
34693
- entry.setFileDataPumpFunction(function() {
34694
- writeToOutputStream(self, compressedBuffer);
34695
- writeToOutputStream(self, entry.getDataDescriptor());
34696
- entry.state = Entry.FILE_DATA_DONE;
34697
-
34698
- // don't call pumpEntries() recursively.
34699
- // (also, don't call process.nextTick recursively.)
34700
- setImmediate(function() {
34701
- pumpEntries(self);
34702
- });
34703
- });
34704
- pumpEntries(self);
34705
- }
34706
- };
34707
-
34708
- ZipFile.prototype.addEmptyDirectory = function(metadataPath, options) {
34709
- var self = this;
34710
- metadataPath = validateMetadataPath(metadataPath, true);
34711
- if (options == null) options = {};
34712
- if (options.size != null) throw new Error("options.size not allowed");
34713
- if (options.compress != null) throw new Error("options.compress not allowed");
34714
- var entry = new Entry(metadataPath, true, options);
34715
- self.entries.push(entry);
34716
- entry.setFileDataPumpFunction(function() {
34717
- writeToOutputStream(self, entry.getDataDescriptor());
34718
- entry.state = Entry.FILE_DATA_DONE;
34719
- pumpEntries(self);
34720
- });
34721
- pumpEntries(self);
34722
- };
34723
-
34724
- var eocdrSignatureBuffer = bufferFrom([0x50, 0x4b, 0x05, 0x06]);
34725
-
34726
- ZipFile.prototype.end = function(options, finalSizeCallback) {
34727
- if (typeof options === "function") {
34728
- finalSizeCallback = options;
34729
- options = null;
34730
- }
34731
- if (options == null) options = {};
34732
- if (this.ended) return;
34733
- this.ended = true;
34734
- this.finalSizeCallback = finalSizeCallback;
34735
- this.forceZip64Eocd = !!options.forceZip64Format;
34736
- if (options.comment) {
34737
- if (typeof options.comment === "string") {
34738
- this.comment = encodeCp437(options.comment);
34739
- } else {
34740
- // It should be a Buffer
34741
- this.comment = options.comment;
34742
- }
34743
- if (this.comment.length > 0xffff) throw new Error("comment is too large");
34744
- // gotta check for this, because the zipfile format is actually ambiguous.
34745
- if (bufferIncludes(this.comment, eocdrSignatureBuffer)) throw new Error("comment contains end of central directory record signature");
34746
- } else {
34747
- // no comment.
34748
- this.comment = EMPTY_BUFFER;
34749
- }
34750
- pumpEntries(this);
34751
- };
34752
-
34753
- function writeToOutputStream(self, buffer) {
34754
- self.outputStream.write(buffer);
34755
- self.outputStreamCursor += buffer.length;
34756
- }
34757
-
34758
- function pumpFileDataReadStream(self, entry, readStream) {
34759
- var crc32Watcher = new Crc32Watcher();
34760
- var uncompressedSizeCounter = new ByteCounter();
34761
- var compressor = entry.compress ? new zlib.DeflateRaw() : new PassThrough();
34762
- var compressedSizeCounter = new ByteCounter();
34763
- readStream.pipe(crc32Watcher)
34764
- .pipe(uncompressedSizeCounter)
34765
- .pipe(compressor)
34766
- .pipe(compressedSizeCounter)
34767
- .pipe(self.outputStream, {end: false});
34768
- compressedSizeCounter.on("end", function() {
34769
- entry.crc32 = crc32Watcher.crc32;
34770
- if (entry.uncompressedSize == null) {
34771
- entry.uncompressedSize = uncompressedSizeCounter.byteCount;
34772
- } else {
34773
- if (entry.uncompressedSize !== uncompressedSizeCounter.byteCount) return self.emit("error", new Error("file data stream has unexpected number of bytes"));
34774
- }
34775
- entry.compressedSize = compressedSizeCounter.byteCount;
34776
- self.outputStreamCursor += entry.compressedSize;
34777
- writeToOutputStream(self, entry.getDataDescriptor());
34778
- entry.state = Entry.FILE_DATA_DONE;
34779
- pumpEntries(self);
34780
- });
34781
- }
34782
-
34783
- function pumpEntries(self) {
34784
- if (self.allDone) return;
34785
- // first check if finalSize is finally known
34786
- if (self.ended && self.finalSizeCallback != null) {
34787
- var finalSize = calculateFinalSize(self);
34788
- if (finalSize != null) {
34789
- // we have an answer
34790
- self.finalSizeCallback(finalSize);
34791
- self.finalSizeCallback = null;
34792
- }
34793
- }
34794
-
34795
- // pump entries
34796
- var entry = getFirstNotDoneEntry();
34797
- function getFirstNotDoneEntry() {
34798
- for (var i = 0; i < self.entries.length; i++) {
34799
- var entry = self.entries[i];
34800
- if (entry.state < Entry.FILE_DATA_DONE) return entry;
34801
- }
34802
- return null;
34803
- }
34804
- if (entry != null) {
34805
- // this entry is not done yet
34806
- if (entry.state < Entry.READY_TO_PUMP_FILE_DATA) return; // input file not open yet
34807
- if (entry.state === Entry.FILE_DATA_IN_PROGRESS) return; // we'll get there
34808
- // start with local file header
34809
- entry.relativeOffsetOfLocalHeader = self.outputStreamCursor;
34810
- var localFileHeader = entry.getLocalFileHeader();
34811
- writeToOutputStream(self, localFileHeader);
34812
- entry.doFileDataPump();
34813
- } else {
34814
- // all cought up on writing entries
34815
- if (self.ended) {
34816
- // head for the exit
34817
- self.offsetOfStartOfCentralDirectory = self.outputStreamCursor;
34818
- self.entries.forEach(function(entry) {
34819
- var centralDirectoryRecord = entry.getCentralDirectoryRecord();
34820
- writeToOutputStream(self, centralDirectoryRecord);
34821
- });
34822
- writeToOutputStream(self, getEndOfCentralDirectoryRecord(self));
34823
- self.outputStream.end();
34824
- self.allDone = true;
34825
- }
34826
- }
34827
- }
34828
-
34829
- function calculateFinalSize(self) {
34830
- var pretendOutputCursor = 0;
34831
- var centralDirectorySize = 0;
34832
- for (var i = 0; i < self.entries.length; i++) {
34833
- var entry = self.entries[i];
34834
- // compression is too hard to predict
34835
- if (entry.compress) return -1;
34836
- if (entry.state >= Entry.READY_TO_PUMP_FILE_DATA) {
34837
- // if addReadStream was called without providing the size, we can't predict the final size
34838
- if (entry.uncompressedSize == null) return -1;
34839
- } else {
34840
- // if we're still waiting for fs.stat, we might learn the size someday
34841
- if (entry.uncompressedSize == null) return null;
34842
- }
34843
- // we know this for sure, and this is important to know if we need ZIP64 format.
34844
- entry.relativeOffsetOfLocalHeader = pretendOutputCursor;
34845
- var useZip64Format = entry.useZip64Format();
34846
-
34847
- pretendOutputCursor += LOCAL_FILE_HEADER_FIXED_SIZE + entry.utf8FileName.length;
34848
- pretendOutputCursor += entry.uncompressedSize;
34849
- if (!entry.crcAndFileSizeKnown) {
34850
- // use a data descriptor
34851
- if (useZip64Format) {
34852
- pretendOutputCursor += ZIP64_DATA_DESCRIPTOR_SIZE;
34853
- } else {
34854
- pretendOutputCursor += DATA_DESCRIPTOR_SIZE;
34855
- }
34856
- }
34857
-
34858
- centralDirectorySize += CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length + entry.fileComment.length;
34859
- if (useZip64Format) {
34860
- centralDirectorySize += ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE;
34861
- }
34862
- }
34863
-
34864
- var endOfCentralDirectorySize = 0;
34865
- if (self.forceZip64Eocd ||
34866
- self.entries.length >= 0xffff ||
34867
- centralDirectorySize >= 0xffff ||
34868
- pretendOutputCursor >= 0xffffffff) {
34869
- // use zip64 end of central directory stuff
34870
- endOfCentralDirectorySize += ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE;
34871
- }
34872
- endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length;
34873
- return pretendOutputCursor + centralDirectorySize + endOfCentralDirectorySize;
34874
- }
34875
-
34876
- var ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 56;
34877
- var ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE = 20;
34878
- var END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 22;
34879
- function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe) {
34880
- var needZip64Format = false;
34881
- var normalEntriesLength = self.entries.length;
34882
- if (self.forceZip64Eocd || self.entries.length >= 0xffff) {
34883
- normalEntriesLength = 0xffff;
34884
- needZip64Format = true;
34885
- }
34886
- var sizeOfCentralDirectory = self.outputStreamCursor - self.offsetOfStartOfCentralDirectory;
34887
- var normalSizeOfCentralDirectory = sizeOfCentralDirectory;
34888
- if (self.forceZip64Eocd || sizeOfCentralDirectory >= 0xffffffff) {
34889
- normalSizeOfCentralDirectory = 0xffffffff;
34890
- needZip64Format = true;
34891
- }
34892
- var normalOffsetOfStartOfCentralDirectory = self.offsetOfStartOfCentralDirectory;
34893
- if (self.forceZip64Eocd || self.offsetOfStartOfCentralDirectory >= 0xffffffff) {
34894
- normalOffsetOfStartOfCentralDirectory = 0xffffffff;
34895
- needZip64Format = true;
34896
- }
34897
- if (actuallyJustTellMeHowLongItWouldBe) {
34898
- if (needZip64Format) {
34899
- return (
34900
- ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE +
34901
- ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE +
34902
- END_OF_CENTRAL_DIRECTORY_RECORD_SIZE
34903
- );
34904
- } else {
34905
- return END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
34906
- }
34907
- }
34908
-
34909
- var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length);
34910
- // end of central dir signature 4 bytes (0x06054b50)
34911
- eocdrBuffer.writeUInt32LE(0x06054b50, 0);
34912
- // number of this disk 2 bytes
34913
- eocdrBuffer.writeUInt16LE(0, 4);
34914
- // number of the disk with the start of the central directory 2 bytes
34915
- eocdrBuffer.writeUInt16LE(0, 6);
34916
- // total number of entries in the central directory on this disk 2 bytes
34917
- eocdrBuffer.writeUInt16LE(normalEntriesLength, 8);
34918
- // total number of entries in the central directory 2 bytes
34919
- eocdrBuffer.writeUInt16LE(normalEntriesLength, 10);
34920
- // size of the central directory 4 bytes
34921
- eocdrBuffer.writeUInt32LE(normalSizeOfCentralDirectory, 12);
34922
- // offset of start of central directory with respect to the starting disk number 4 bytes
34923
- eocdrBuffer.writeUInt32LE(normalOffsetOfStartOfCentralDirectory, 16);
34924
- // .ZIP file comment length 2 bytes
34925
- eocdrBuffer.writeUInt16LE(self.comment.length, 20);
34926
- // .ZIP file comment (variable size)
34927
- self.comment.copy(eocdrBuffer, 22);
34928
-
34929
- if (!needZip64Format) return eocdrBuffer;
34930
-
34931
- // ZIP64 format
34932
- // ZIP64 End of Central Directory Record
34933
- var zip64EocdrBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE);
34934
- // zip64 end of central dir signature 4 bytes (0x06064b50)
34935
- zip64EocdrBuffer.writeUInt32LE(0x06064b50, 0);
34936
- // size of zip64 end of central directory record 8 bytes
34937
- writeUInt64LE(zip64EocdrBuffer, ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE - 12, 4);
34938
- // version made by 2 bytes
34939
- zip64EocdrBuffer.writeUInt16LE(VERSION_MADE_BY, 12);
34940
- // version needed to extract 2 bytes
34941
- zip64EocdrBuffer.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_ZIP64, 14);
34942
- // number of this disk 4 bytes
34943
- zip64EocdrBuffer.writeUInt32LE(0, 16);
34944
- // number of the disk with the start of the central directory 4 bytes
34945
- zip64EocdrBuffer.writeUInt32LE(0, 20);
34946
- // total number of entries in the central directory on this disk 8 bytes
34947
- writeUInt64LE(zip64EocdrBuffer, self.entries.length, 24);
34948
- // total number of entries in the central directory 8 bytes
34949
- writeUInt64LE(zip64EocdrBuffer, self.entries.length, 32);
34950
- // size of the central directory 8 bytes
34951
- writeUInt64LE(zip64EocdrBuffer, sizeOfCentralDirectory, 40);
34952
- // offset of start of central directory with respect to the starting disk number 8 bytes
34953
- writeUInt64LE(zip64EocdrBuffer, self.offsetOfStartOfCentralDirectory, 48);
34954
- // zip64 extensible data sector (variable size)
34955
- // nothing in the zip64 extensible data sector
34956
-
34957
-
34958
- // ZIP64 End of Central Directory Locator
34959
- var zip64EocdlBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE);
34960
- // zip64 end of central dir locator signature 4 bytes (0x07064b50)
34961
- zip64EocdlBuffer.writeUInt32LE(0x07064b50, 0);
34962
- // number of the disk with the start of the zip64 end of central directory 4 bytes
34963
- zip64EocdlBuffer.writeUInt32LE(0, 4);
34964
- // relative offset of the zip64 end of central directory record 8 bytes
34965
- writeUInt64LE(zip64EocdlBuffer, self.outputStreamCursor, 8);
34966
- // total number of disks 4 bytes
34967
- zip64EocdlBuffer.writeUInt32LE(1, 16);
34968
-
34969
-
34970
- return Buffer.concat([
34971
- zip64EocdrBuffer,
34972
- zip64EocdlBuffer,
34973
- eocdrBuffer,
34974
- ]);
34975
- }
34976
-
34977
- function validateMetadataPath(metadataPath, isDirectory) {
34978
- if (metadataPath === "") throw new Error("empty metadataPath");
34979
- metadataPath = metadataPath.replace(/\\/g, "/");
34980
- if (/^[a-zA-Z]:/.test(metadataPath) || /^\//.test(metadataPath)) throw new Error("absolute path: " + metadataPath);
34981
- if (metadataPath.split("/").indexOf("..") !== -1) throw new Error("invalid relative path: " + metadataPath);
34982
- var looksLikeDirectory = /\/$/.test(metadataPath);
34983
- if (isDirectory) {
34984
- // append a trailing '/' if necessary.
34985
- if (!looksLikeDirectory) metadataPath += "/";
34986
- } else {
34987
- if (looksLikeDirectory) throw new Error("file path cannot end with '/': " + metadataPath);
34988
- }
34989
- return metadataPath;
34990
- }
34991
-
34992
- var EMPTY_BUFFER = bufferAlloc(0);
34993
-
34994
- // this class is not part of the public API
34995
- function Entry(metadataPath, isDirectory, options) {
34996
- this.utf8FileName = bufferFrom(metadataPath);
34997
- if (this.utf8FileName.length > 0xffff) throw new Error("utf8 file name too long. " + utf8FileName.length + " > " + 0xffff);
34998
- this.isDirectory = isDirectory;
34999
- this.state = Entry.WAITING_FOR_METADATA;
35000
- this.setLastModDate(options.mtime != null ? options.mtime : new Date());
35001
- if (options.mode != null) {
35002
- this.setFileAttributesMode(options.mode);
35003
- } else {
35004
- this.setFileAttributesMode(isDirectory ? 0o40775 : 0o100664);
35005
- }
35006
- if (isDirectory) {
35007
- this.crcAndFileSizeKnown = true;
35008
- this.crc32 = 0;
35009
- this.uncompressedSize = 0;
35010
- this.compressedSize = 0;
35011
- } else {
35012
- // unknown so far
35013
- this.crcAndFileSizeKnown = false;
35014
- this.crc32 = null;
35015
- this.uncompressedSize = null;
35016
- this.compressedSize = null;
35017
- if (options.size != null) this.uncompressedSize = options.size;
35018
- }
35019
- if (isDirectory) {
35020
- this.compress = false;
35021
- } else {
35022
- this.compress = true; // default
35023
- if (options.compress != null) this.compress = !!options.compress;
35024
- }
35025
- this.forceZip64Format = !!options.forceZip64Format;
35026
- if (options.fileComment) {
35027
- if (typeof options.fileComment === "string") {
35028
- this.fileComment = bufferFrom(options.fileComment, "utf-8");
35029
- } else {
35030
- // It should be a Buffer
35031
- this.fileComment = options.fileComment;
35032
- }
35033
- if (this.fileComment.length > 0xffff) throw new Error("fileComment is too large");
35034
- } else {
35035
- // no comment.
35036
- this.fileComment = EMPTY_BUFFER;
35037
- }
35038
- }
35039
- Entry.WAITING_FOR_METADATA = 0;
35040
- Entry.READY_TO_PUMP_FILE_DATA = 1;
35041
- Entry.FILE_DATA_IN_PROGRESS = 2;
35042
- Entry.FILE_DATA_DONE = 3;
35043
- Entry.prototype.setLastModDate = function(date) {
35044
- var dosDateTime = dateToDosDateTime(date);
35045
- this.lastModFileTime = dosDateTime.time;
35046
- this.lastModFileDate = dosDateTime.date;
35047
- };
35048
- Entry.prototype.setFileAttributesMode = function(mode) {
35049
- if ((mode & 0xffff) !== mode) throw new Error("invalid mode. expected: 0 <= " + mode + " <= " + 0xffff);
35050
- // http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute/14727#14727
35051
- this.externalFileAttributes = (mode << 16) >>> 0;
35052
- };
35053
- // doFileDataPump() should not call pumpEntries() directly. see issue #9.
35054
- Entry.prototype.setFileDataPumpFunction = function(doFileDataPump) {
35055
- this.doFileDataPump = doFileDataPump;
35056
- this.state = Entry.READY_TO_PUMP_FILE_DATA;
35057
- };
35058
- Entry.prototype.useZip64Format = function() {
35059
- return (
35060
- (this.forceZip64Format) ||
35061
- (this.uncompressedSize != null && this.uncompressedSize > 0xfffffffe) ||
35062
- (this.compressedSize != null && this.compressedSize > 0xfffffffe) ||
35063
- (this.relativeOffsetOfLocalHeader != null && this.relativeOffsetOfLocalHeader > 0xfffffffe)
35064
- );
35065
- }
35066
- var LOCAL_FILE_HEADER_FIXED_SIZE = 30;
35067
- var VERSION_NEEDED_TO_EXTRACT_UTF8 = 20;
35068
- var VERSION_NEEDED_TO_EXTRACT_ZIP64 = 45;
35069
- // 3 = unix. 63 = spec version 6.3
35070
- var VERSION_MADE_BY = (3 << 8) | 63;
35071
- var FILE_NAME_IS_UTF8 = 1 << 11;
35072
- var UNKNOWN_CRC32_AND_FILE_SIZES = 1 << 3;
35073
- Entry.prototype.getLocalFileHeader = function() {
35074
- var crc32 = 0;
35075
- var compressedSize = 0;
35076
- var uncompressedSize = 0;
35077
- if (this.crcAndFileSizeKnown) {
35078
- crc32 = this.crc32;
35079
- compressedSize = this.compressedSize;
35080
- uncompressedSize = this.uncompressedSize;
35081
- }
35082
-
35083
- var fixedSizeStuff = bufferAlloc(LOCAL_FILE_HEADER_FIXED_SIZE);
35084
- var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
35085
- if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
35086
-
35087
- // local file header signature 4 bytes (0x04034b50)
35088
- fixedSizeStuff.writeUInt32LE(0x04034b50, 0);
35089
- // version needed to extract 2 bytes
35090
- fixedSizeStuff.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_UTF8, 4);
35091
- // general purpose bit flag 2 bytes
35092
- fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 6);
35093
- // compression method 2 bytes
35094
- fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 8);
35095
- // last mod file time 2 bytes
35096
- fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 10);
35097
- // last mod file date 2 bytes
35098
- fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 12);
35099
- // crc-32 4 bytes
35100
- fixedSizeStuff.writeUInt32LE(crc32, 14);
35101
- // compressed size 4 bytes
35102
- fixedSizeStuff.writeUInt32LE(compressedSize, 18);
35103
- // uncompressed size 4 bytes
35104
- fixedSizeStuff.writeUInt32LE(uncompressedSize, 22);
35105
- // file name length 2 bytes
35106
- fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 26);
35107
- // extra field length 2 bytes
35108
- fixedSizeStuff.writeUInt16LE(0, 28);
35109
- return Buffer.concat([
35110
- fixedSizeStuff,
35111
- // file name (variable size)
35112
- this.utf8FileName,
35113
- // extra field (variable size)
35114
- // no extra fields
35115
- ]);
35116
- };
35117
- var DATA_DESCRIPTOR_SIZE = 16;
35118
- var ZIP64_DATA_DESCRIPTOR_SIZE = 24;
35119
- Entry.prototype.getDataDescriptor = function() {
35120
- if (this.crcAndFileSizeKnown) {
35121
- // the Mac Archive Utility requires this not be present unless we set general purpose bit 3
35122
- return EMPTY_BUFFER;
35123
- }
35124
- if (!this.useZip64Format()) {
35125
- var buffer = bufferAlloc(DATA_DESCRIPTOR_SIZE);
35126
- // optional signature (required according to Archive Utility)
35127
- buffer.writeUInt32LE(0x08074b50, 0);
35128
- // crc-32 4 bytes
35129
- buffer.writeUInt32LE(this.crc32, 4);
35130
- // compressed size 4 bytes
35131
- buffer.writeUInt32LE(this.compressedSize, 8);
35132
- // uncompressed size 4 bytes
35133
- buffer.writeUInt32LE(this.uncompressedSize, 12);
35134
- return buffer;
35135
- } else {
35136
- // ZIP64 format
35137
- var buffer = bufferAlloc(ZIP64_DATA_DESCRIPTOR_SIZE);
35138
- // optional signature (unknown if anyone cares about this)
35139
- buffer.writeUInt32LE(0x08074b50, 0);
35140
- // crc-32 4 bytes
35141
- buffer.writeUInt32LE(this.crc32, 4);
35142
- // compressed size 8 bytes
35143
- writeUInt64LE(buffer, this.compressedSize, 8);
35144
- // uncompressed size 8 bytes
35145
- writeUInt64LE(buffer, this.uncompressedSize, 16);
35146
- return buffer;
35147
- }
35148
- };
35149
- var CENTRAL_DIRECTORY_RECORD_FIXED_SIZE = 46;
35150
- var ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE = 28;
35151
- Entry.prototype.getCentralDirectoryRecord = function() {
35152
- var fixedSizeStuff = bufferAlloc(CENTRAL_DIRECTORY_RECORD_FIXED_SIZE);
35153
- var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
35154
- if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
35155
-
35156
- var normalCompressedSize = this.compressedSize;
35157
- var normalUncompressedSize = this.uncompressedSize;
35158
- var normalRelativeOffsetOfLocalHeader = this.relativeOffsetOfLocalHeader;
35159
- var versionNeededToExtract;
35160
- var zeiefBuffer;
35161
- if (this.useZip64Format()) {
35162
- normalCompressedSize = 0xffffffff;
35163
- normalUncompressedSize = 0xffffffff;
35164
- normalRelativeOffsetOfLocalHeader = 0xffffffff;
35165
- versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_ZIP64;
35166
-
35167
- // ZIP64 extended information extra field
35168
- zeiefBuffer = bufferAlloc(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE);
35169
- // 0x0001 2 bytes Tag for this "extra" block type
35170
- zeiefBuffer.writeUInt16LE(0x0001, 0);
35171
- // Size 2 bytes Size of this "extra" block
35172
- zeiefBuffer.writeUInt16LE(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE - 4, 2);
35173
- // Original Size 8 bytes Original uncompressed file size
35174
- writeUInt64LE(zeiefBuffer, this.uncompressedSize, 4);
35175
- // Compressed Size 8 bytes Size of compressed data
35176
- writeUInt64LE(zeiefBuffer, this.compressedSize, 12);
35177
- // Relative Header Offset 8 bytes Offset of local header record
35178
- writeUInt64LE(zeiefBuffer, this.relativeOffsetOfLocalHeader, 20);
35179
- // Disk Start Number 4 bytes Number of the disk on which this file starts
35180
- // (omit)
35181
- } else {
35182
- versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_UTF8;
35183
- zeiefBuffer = EMPTY_BUFFER;
35184
- }
35185
-
35186
- // central file header signature 4 bytes (0x02014b50)
35187
- fixedSizeStuff.writeUInt32LE(0x02014b50, 0);
35188
- // version made by 2 bytes
35189
- fixedSizeStuff.writeUInt16LE(VERSION_MADE_BY, 4);
35190
- // version needed to extract 2 bytes
35191
- fixedSizeStuff.writeUInt16LE(versionNeededToExtract, 6);
35192
- // general purpose bit flag 2 bytes
35193
- fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 8);
35194
- // compression method 2 bytes
35195
- fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 10);
35196
- // last mod file time 2 bytes
35197
- fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 12);
35198
- // last mod file date 2 bytes
35199
- fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 14);
35200
- // crc-32 4 bytes
35201
- fixedSizeStuff.writeUInt32LE(this.crc32, 16);
35202
- // compressed size 4 bytes
35203
- fixedSizeStuff.writeUInt32LE(normalCompressedSize, 20);
35204
- // uncompressed size 4 bytes
35205
- fixedSizeStuff.writeUInt32LE(normalUncompressedSize, 24);
35206
- // file name length 2 bytes
35207
- fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 28);
35208
- // extra field length 2 bytes
35209
- fixedSizeStuff.writeUInt16LE(zeiefBuffer.length, 30);
35210
- // file comment length 2 bytes
35211
- fixedSizeStuff.writeUInt16LE(this.fileComment.length, 32);
35212
- // disk number start 2 bytes
35213
- fixedSizeStuff.writeUInt16LE(0, 34);
35214
- // internal file attributes 2 bytes
35215
- fixedSizeStuff.writeUInt16LE(0, 36);
35216
- // external file attributes 4 bytes
35217
- fixedSizeStuff.writeUInt32LE(this.externalFileAttributes, 38);
35218
- // relative offset of local header 4 bytes
35219
- fixedSizeStuff.writeUInt32LE(normalRelativeOffsetOfLocalHeader, 42);
35220
-
35221
- return Buffer.concat([
35222
- fixedSizeStuff,
35223
- // file name (variable size)
35224
- this.utf8FileName,
35225
- // extra field (variable size)
35226
- zeiefBuffer,
35227
- // file comment (variable size)
35228
- this.fileComment,
35229
- ]);
35230
- };
35231
- Entry.prototype.getCompressionMethod = function() {
35232
- var NO_COMPRESSION = 0;
35233
- var DEFLATE_COMPRESSION = 8;
35234
- return this.compress ? DEFLATE_COMPRESSION : NO_COMPRESSION;
35235
- };
35236
-
35237
- function dateToDosDateTime(jsDate) {
35238
- var date = 0;
35239
- date |= jsDate.getDate() & 0x1f; // 1-31
35240
- date |= ((jsDate.getMonth() + 1) & 0xf) << 5; // 0-11, 1-12
35241
- date |= ((jsDate.getFullYear() - 1980) & 0x7f) << 9; // 0-128, 1980-2108
35242
-
35243
- var time = 0;
35244
- time |= Math.floor(jsDate.getSeconds() / 2); // 0-59, 0-29 (lose odd numbers)
35245
- time |= (jsDate.getMinutes() & 0x3f) << 5; // 0-59
35246
- time |= (jsDate.getHours() & 0x1f) << 11; // 0-23
35247
-
35248
- return {date: date, time: time};
35249
- }
35250
-
35251
- function writeUInt64LE(buffer, n, offset) {
35252
- // can't use bitshift here, because JavaScript only allows bitshifting on 32-bit integers.
35253
- var high = Math.floor(n / 0x100000000);
35254
- var low = n % 0x100000000;
35255
- buffer.writeUInt32LE(low, offset);
35256
- buffer.writeUInt32LE(high, offset + 4);
35257
- }
35258
-
35259
- function defaultCallback(err) {
35260
- if (err) throw err;
35261
- }
35262
-
35263
- util.inherits(ByteCounter, Transform);
35264
- function ByteCounter(options) {
35265
- Transform.call(this, options);
35266
- this.byteCount = 0;
35267
- }
35268
- ByteCounter.prototype._transform = function(chunk, encoding, cb) {
35269
- this.byteCount += chunk.length;
35270
- cb(null, chunk);
35271
- };
35272
-
35273
- util.inherits(Crc32Watcher, Transform);
35274
- function Crc32Watcher(options) {
35275
- Transform.call(this, options);
35276
- this.crc32 = 0;
35277
- }
35278
- Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
35279
- this.crc32 = crc32.unsigned(chunk, this.crc32);
35280
- cb(null, chunk);
35281
- };
35282
-
35283
- var cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ';
35284
- if (cp437.length !== 256) throw new Error("assertion failure");
35285
- var reverseCp437 = null;
35286
-
35287
- function encodeCp437(string) {
35288
- if (/^[\x20-\x7e]*$/.test(string)) {
35289
- // CP437, ASCII, and UTF-8 overlap in this range.
35290
- return bufferFrom(string, "utf-8");
35291
- }
35292
-
35293
- // This is the slow path.
35294
- if (reverseCp437 == null) {
35295
- // cache this once
35296
- reverseCp437 = {};
35297
- for (var i = 0; i < cp437.length; i++) {
35298
- reverseCp437[cp437[i]] = i;
35299
- }
35300
- }
35301
-
35302
- var result = bufferAlloc(string.length);
35303
- for (var i = 0; i < string.length; i++) {
35304
- var b = reverseCp437[string[i]];
35305
- if (b == null) throw new Error("character not encodable in CP437: " + JSON.stringify(string[i]));
35306
- result[i] = b;
35307
- }
35308
-
35309
- return result;
35310
- }
35311
-
35312
- function bufferAlloc(size) {
35313
- bufferAlloc = modern;
35314
- try {
35315
- return bufferAlloc(size);
35316
- } catch (e) {
35317
- bufferAlloc = legacy;
35318
- return bufferAlloc(size);
35319
- }
35320
- function modern(size) {
35321
- return Buffer.allocUnsafe(size);
35322
- }
35323
- function legacy(size) {
35324
- return new Buffer(size);
35325
- }
35326
- }
35327
- function bufferFrom(something, encoding) {
35328
- bufferFrom = modern;
35329
- try {
35330
- return bufferFrom(something, encoding);
35331
- } catch (e) {
35332
- bufferFrom = legacy;
35333
- return bufferFrom(something, encoding);
35334
- }
35335
- function modern(something, encoding) {
35336
- return Buffer.from(something, encoding);
35337
- }
35338
- function legacy(something, encoding) {
35339
- return new Buffer(something, encoding);
35340
- }
35341
- }
35342
- function bufferIncludes(buffer, content) {
35343
- bufferIncludes = modern;
35344
- try {
35345
- return bufferIncludes(buffer, content);
35346
- } catch (e) {
35347
- bufferIncludes = legacy;
35348
- return bufferIncludes(buffer, content);
35349
- }
35350
- function modern(buffer, content) {
35351
- return buffer.includes(content);
35352
- }
35353
- function legacy(buffer, content) {
35354
- for (var i = 0; i <= buffer.length - content.length; i++) {
35355
- for (var j = 0;; j++) {
35356
- if (j === content.length) return true;
35357
- if (buffer[i + j] !== content[j]) break;
35358
- }
35359
- }
35360
- return false;
35361
- }
35362
- }
35363
-
35364
-
35365
34707
  /***/ }),
35366
34708
 
35367
34709
  /***/ 9892:
@@ -39423,14 +38765,6 @@ module.exports = require("node:url");
39423
38765
 
39424
38766
  /***/ }),
39425
38767
 
39426
- /***/ 7261:
39427
- /***/ ((module) => {
39428
-
39429
- "use strict";
39430
- module.exports = require("node:util");
39431
-
39432
- /***/ }),
39433
-
39434
38768
  /***/ 2037:
39435
38769
  /***/ ((module) => {
39436
38770