keycloakify 10.0.0-rc.16 → 10.0.0-rc.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PUBLIC_URL.js.map +1 -1
- package/account/Template.js +5 -5
- package/account/Template.js.map +1 -1
- package/account/i18n/i18n.js +37 -29
- package/account/i18n/i18n.js.map +1 -1
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.js +20 -15
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/getKcContext.js.map +1 -1
- package/account/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/account/kcContext/getKcContextFromWindow.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +148 -144
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/lib/useGetClassName.js +14 -14
- package/account/lib/useGetClassName.js.map +1 -1
- package/account/pages/Account.js +1 -1
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Password.js +7 -7
- package/account/pages/Password.js.map +1 -1
- package/account/pages/Totp.js +4 -4
- package/account/pages/Totp.js.map +1 -1
- package/bin/main.js +12232 -2467
- package/bin/shared/constants.d.ts +2 -0
- package/bin/shared/constants.js +5 -3
- package/bin/shared/constants.js.map +1 -1
- package/lib/isStorybook.js +2 -1
- package/lib/isStorybook.js.map +1 -1
- package/lib/useGetClassName.js.map +1 -1
- package/login/Template.js +13 -13
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +43 -41
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/baseMessages/ca.d.ts +1 -1
- package/login/i18n/baseMessages/ca.js +1 -1
- package/login/i18n/baseMessages/el.d.ts +0 -1
- package/login/i18n/baseMessages/el.js +0 -1
- package/login/i18n/baseMessages/el.js.map +1 -1
- package/login/i18n/baseMessages/en.d.ts +1 -1
- package/login/i18n/baseMessages/en.js +1 -1
- package/login/i18n/baseMessages/es.d.ts +1 -1
- package/login/i18n/baseMessages/es.js +1 -1
- package/login/i18n/baseMessages/fa.d.ts +0 -1
- package/login/i18n/baseMessages/fa.js +0 -1
- package/login/i18n/baseMessages/fa.js.map +1 -1
- package/login/i18n/baseMessages/hu.d.ts +1 -1
- package/login/i18n/baseMessages/hu.js +1 -1
- package/login/i18n/baseMessages/index.d.ts +1 -2
- package/login/i18n/baseMessages/zh-CN.d.ts +1 -1
- package/login/i18n/baseMessages/zh-CN.js +1 -1
- package/login/i18n/i18n.js +39 -31
- package/login/i18n/i18n.js.map +1 -1
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.js +30 -22
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/getKcContext.js.map +1 -1
- package/login/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/login/kcContext/getKcContextFromWindow.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +233 -231
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.js.map +1 -1
- package/login/lib/useGetClassName.js +112 -112
- package/login/lib/useGetClassName.js.map +1 -1
- package/login/lib/useUserProfileForm.js +181 -181
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/DeleteAccountConfirm.js +5 -1
- package/login/pages/DeleteAccountConfirm.js.map +1 -1
- package/login/pages/FrontchannelLogout.js +1 -1
- package/login/pages/FrontchannelLogout.js.map +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +11 -8
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnRegister.js +7 -7
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +230 -226
- package/src/PUBLIC_URL.ts +4 -1
- package/src/account/Template.tsx +5 -5
- package/src/account/TemplateProps.ts +4 -1
- package/src/account/i18n/i18n.tsx +40 -30
- package/src/account/kcContext/KcContext.ts +4 -1
- package/src/account/kcContext/createGetKcContext.ts +48 -22
- package/src/account/kcContext/getKcContext.ts +3 -1
- package/src/account/kcContext/getKcContextFromWindow.ts +6 -2
- package/src/account/kcContext/kcContextMocks.ts +164 -160
- package/src/account/lib/useGetClassName.ts +15 -14
- package/src/account/pages/Account.tsx +2 -2
- package/src/account/pages/Password.tsx +8 -8
- package/src/account/pages/Totp.tsx +4 -6
- package/src/bin/copy-keycloak-resources-to-public.ts +2 -2
- package/src/bin/download-keycloak-default-theme.ts +33 -7
- package/src/bin/eject-page.ts +48 -11
- package/src/bin/initialize-email-theme.ts +25 -17
- package/src/bin/keycloakify/buildJars/buildJar.ts +188 -64
- package/src/bin/keycloakify/buildJars/buildJars.ts +35 -16
- package/src/bin/keycloakify/buildJars/extensionVersions.ts +2 -1
- package/src/bin/keycloakify/buildJars/generatePom.ts +11 -3
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +33 -8
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +49 -12
- package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +29 -18
- package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +35 -12
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +3 -1
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +86 -41
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +39 -15
- package/src/bin/keycloakify/generateSrcMainResources/readExtraPageNames.ts +21 -7
- package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +34 -7
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +19 -5
- package/src/bin/keycloakify/keycloakify.ts +36 -11
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +24 -5
- package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +6 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +6 -3
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +24 -6
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +49 -11
- package/src/bin/main.ts +78 -41
- package/src/bin/shared/KeycloakVersionRange.ts +3 -1
- package/src/bin/shared/buildOptions.ts +73 -43
- package/src/bin/shared/constants.ts +6 -2
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +27 -13
- package/src/bin/shared/downloadKeycloakDefaultTheme.ts +161 -218
- package/src/bin/shared/downloadKeycloakStaticResources.ts +25 -21
- package/src/bin/shared/getJarFileBasename.ts +3 -1
- package/src/bin/shared/getThemeSrcDirPath.ts +5 -2
- package/src/bin/shared/metaInfKeycloakThemes.ts +35 -8
- package/src/bin/shared/promptKeycloakVersion.ts +33 -14
- package/src/bin/start-keycloak/index.ts +1 -0
- package/src/bin/start-keycloak/myrealm-realm-23.json +2142 -0
- package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
- package/src/bin/start-keycloak/start-keycloak.ts +467 -0
- package/src/bin/tools/SemVer.ts +32 -13
- package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
- package/src/bin/tools/crawl.ts +4 -1
- package/src/bin/tools/crc32.ts +42 -24
- package/src/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.ts +262 -0
- package/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +96 -0
- package/src/bin/tools/downloadAndExtractArchive/index.ts +1 -0
- package/src/bin/tools/extractArchive.ts +120 -0
- package/src/bin/tools/fetchProxyOptions.ts +31 -8
- package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +10 -2
- package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +50 -4
- package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +8 -2
- package/src/bin/tools/octokit-addons/listTags.ts +15 -4
- package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
- package/src/bin/tools/readThisNpmPackageVersion.ts +5 -1
- package/src/bin/tools/transformCodebase.ts +29 -10
- package/src/bin/tools/trimIndent.ts +4 -1
- package/src/lib/isStorybook.ts +3 -1
- package/src/lib/useGetClassName.ts +12 -3
- package/src/login/Template.tsx +14 -14
- package/src/login/TemplateProps.ts +4 -1
- package/src/login/UserProfileFormFields.tsx +44 -42
- package/src/login/i18n/baseMessages/ca.ts +1 -1
- package/src/login/i18n/baseMessages/el.ts +0 -1
- package/src/login/i18n/baseMessages/en.ts +1 -1
- package/src/login/i18n/baseMessages/es.ts +1 -1
- package/src/login/i18n/baseMessages/fa.ts +0 -1
- package/src/login/i18n/baseMessages/hu.ts +1 -1
- package/src/login/i18n/baseMessages/zh-CN.ts +1 -1
- package/src/login/i18n/i18n.tsx +42 -32
- package/src/login/kcContext/KcContext.ts +8 -2
- package/src/login/kcContext/createGetKcContext.ts +84 -37
- package/src/login/kcContext/getKcContext.ts +3 -1
- package/src/login/kcContext/getKcContextFromWindow.ts +6 -2
- package/src/login/kcContext/kcContextMocks.ts +339 -325
- package/src/login/lib/useDownloadTerms.ts +6 -4
- package/src/login/lib/useGetClassName.ts +119 -112
- package/src/login/lib/useUserProfileForm.tsx +219 -205
- package/src/login/pages/DeleteAccountConfirm.tsx +9 -3
- package/src/login/pages/FrontchannelLogout.tsx +1 -1
- package/src/login/pages/Login.tsx +2 -2
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +3 -3
- package/src/login/pages/LoginResetPassword.tsx +2 -2
- package/src/login/pages/LoginUsername.tsx +2 -2
- package/src/login/pages/WebauthnAuthenticate.tsx +11 -8
- package/src/login/pages/WebauthnRegister.tsx +7 -7
- package/src/tools/AndByDiscriminatingKey.ts +12 -6
- package/src/tools/Array.prototype.every.ts +4 -1
- package/src/tools/LazyOrNot.ts +3 -1
- package/src/tools/clsx.ts +7 -1
- package/src/tools/deepAssign.ts +15 -8
- package/src/tools/deepClone.ts +3 -1
- package/src/tools/formatNumber.ts +4 -1
- package/src/tools/useConstCallback.ts +3 -1
- package/src/tools/useInsertLinkTags.ts +20 -7
- package/src/tools/useInsertScriptTags.ts +7 -2
- package/src/tools/useSetClassName.ts +4 -1
- package/src/vite-plugin/vite-plugin.ts +45 -21
- package/tools/Array.prototype.every.js +2 -1
- package/tools/Array.prototype.every.js.map +1 -1
- package/tools/clsx.js.map +1 -1
- package/tools/deepAssign.js +9 -7
- package/tools/deepAssign.js.map +1 -1
- package/tools/deepClone.js.map +1 -1
- package/tools/formatNumber.js.map +1 -1
- package/tools/useConstCallback.js.map +1 -1
- package/tools/useInsertLinkTags.js +5 -4
- package/tools/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js +5 -2
- package/tools/useInsertScriptTags.js.map +1 -1
- package/tools/useSetClassName.js.map +1 -1
- package/vite-plugin/index.js +1033 -1661
- package/src/bin/shared/downloadAndUnzip.ts +0 -203
- package/src/bin/start-keycloak.ts +0 -236
- package/src/bin/tools/unzip.ts +0 -141
package/vite-plugin/index.js
CHANGED
@@ -59,40 +59,45 @@ function readBuildOptions(params) {
|
|
59
59
|
return process.cwd();
|
60
60
|
}
|
61
61
|
return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
|
62
|
-
|
63
|
-
|
62
|
+
pathIsh: cliCommandOptions.reactAppRootDirPath,
|
63
|
+
cwd: process.cwd()
|
64
64
|
});
|
65
65
|
})();
|
66
66
|
var resolvedViteConfig = (function () {
|
67
67
|
var _a;
|
68
|
-
if (fs
|
69
|
-
|
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
|
-
|
74
|
-
|
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
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
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,21 +132,24 @@ 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
|
-
|
129
|
-
|
135
|
+
pathIsh: parsedPackageJson.keycloakify.reactAppBuildDirPath,
|
136
|
+
cwd: reactAppRootDirPath
|
130
137
|
});
|
131
138
|
}
|
132
139
|
return (0, path_1.join)(reactAppRootDirPath, "build");
|
133
140
|
}
|
134
141
|
return (0, path_1.join)(reactAppRootDirPath, resolvedViteConfig.buildDir);
|
135
142
|
})();
|
136
|
-
var npmWorkspaceRootDirPath = (0, getNpmWorkspaceRootDirPath_1.getNpmWorkspaceRootDirPath)({
|
143
|
+
var npmWorkspaceRootDirPath = (0, getNpmWorkspaceRootDirPath_1.getNpmWorkspaceRootDirPath)({
|
144
|
+
reactAppRootDirPath: reactAppRootDirPath,
|
145
|
+
dependencyExpected: "keycloakify"
|
146
|
+
}).npmWorkspaceRootDirPath;
|
137
147
|
return {
|
138
|
-
|
139
|
-
|
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",
|
140
150
|
themeNames: themeNames,
|
141
|
-
|
142
|
-
|
151
|
+
extraThemeProperties: userProvidedBuildOptions.extraThemeProperties,
|
152
|
+
groupId: (function () {
|
143
153
|
var _a, _b, _c, _d, _e;
|
144
154
|
var fallbackGroupId = "".concat(themeNames[0], ".keycloak");
|
145
155
|
return ((_b = (_a = process.env.KEYCLOAKIFY_GROUP_ID) !== null && _a !== void 0 ? _a : userProvidedBuildOptions.groupId) !== null && _b !== void 0 ? _b : (parsedPackageJson.homepage === undefined
|
@@ -147,47 +157,49 @@ function readBuildOptions(params) {
|
|
147
157
|
: (_e = (_d = (_c = (0, url_1.parse)(parsedPackageJson.homepage)
|
148
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");
|
149
159
|
})(),
|
150
|
-
|
151
|
-
|
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",
|
152
162
|
reactAppRootDirPath: reactAppRootDirPath,
|
153
163
|
reactAppBuildDirPath: reactAppBuildDirPath,
|
154
|
-
|
164
|
+
keycloakifyBuildDirPath: (function () {
|
155
165
|
if (userProvidedBuildOptions.keycloakifyBuildDirPath !== undefined) {
|
156
166
|
return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
|
157
|
-
|
158
|
-
|
167
|
+
pathIsh: userProvidedBuildOptions.keycloakifyBuildDirPath,
|
168
|
+
cwd: reactAppRootDirPath
|
159
169
|
});
|
160
170
|
}
|
161
|
-
return (0, path_1.join)(reactAppRootDirPath, (resolvedViteConfig === null || resolvedViteConfig === void 0 ? void 0 : resolvedViteConfig.buildDir) === undefined
|
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"));
|
162
174
|
})(),
|
163
|
-
|
175
|
+
publicDirPath: (function () {
|
164
176
|
webpack: {
|
165
177
|
if (resolvedViteConfig !== undefined) {
|
166
178
|
break webpack;
|
167
179
|
}
|
168
180
|
if (process.env.PUBLIC_DIR_PATH !== undefined) {
|
169
181
|
return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
|
170
|
-
|
171
|
-
|
182
|
+
pathIsh: process.env.PUBLIC_DIR_PATH,
|
183
|
+
cwd: reactAppRootDirPath
|
172
184
|
});
|
173
185
|
}
|
174
186
|
return (0, path_1.join)(reactAppRootDirPath, "public");
|
175
187
|
}
|
176
188
|
return (0, path_1.join)(reactAppRootDirPath, resolvedViteConfig.publicDir);
|
177
189
|
})(),
|
178
|
-
|
190
|
+
cacheDirPath: (function () {
|
179
191
|
var cacheDirPath = (0, path_1.join)((function () {
|
180
192
|
if (process.env.XDG_CACHE_HOME !== undefined) {
|
181
193
|
return (0, getAbsoluteAndInOsFormatPath_1.getAbsoluteAndInOsFormatPath)({
|
182
|
-
|
183
|
-
|
194
|
+
pathIsh: process.env.XDG_CACHE_HOME,
|
195
|
+
cwd: process.cwd()
|
184
196
|
});
|
185
197
|
}
|
186
198
|
return (0, path_1.join)(npmWorkspaceRootDirPath, "node_modules", ".cache");
|
187
199
|
})(), "keycloakify");
|
188
200
|
return cacheDirPath;
|
189
201
|
})(),
|
190
|
-
|
202
|
+
urlPathname: (function () {
|
191
203
|
webpack: {
|
192
204
|
if (resolvedViteConfig !== undefined) {
|
193
205
|
break webpack;
|
@@ -205,7 +217,7 @@ function readBuildOptions(params) {
|
|
205
217
|
}
|
206
218
|
return resolvedViteConfig.urlPathname;
|
207
219
|
})(),
|
208
|
-
|
220
|
+
assetsDirPath: (function () {
|
209
221
|
webpack: {
|
210
222
|
if (resolvedViteConfig !== undefined) {
|
211
223
|
break webpack;
|
@@ -228,7 +240,7 @@ exports.readBuildOptions = readBuildOptions;
|
|
228
240
|
"use strict";
|
229
241
|
|
230
242
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
231
|
-
exports.accountThemePageIds = exports.loginThemePageIds = 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;
|
232
244
|
exports.nameOfTheGlobal = "kcContext";
|
233
245
|
exports.keycloak_resources = "keycloak-resources";
|
234
246
|
exports.resources_common = "resources-common";
|
@@ -237,9 +249,10 @@ exports.basenameOfTheKeycloakifyResourcesDir = "build";
|
|
237
249
|
exports.themeTypes = ["login", "account"];
|
238
250
|
exports.accountV1ThemeName = "account-v1";
|
239
251
|
exports.vitePluginSubScriptEnvNames = {
|
240
|
-
|
241
|
-
|
252
|
+
runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
|
253
|
+
resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
|
242
254
|
};
|
255
|
+
exports.skipBuildJarsEnvName = "KEYCLOAKIFY_SKIP_BUILD_JAR";
|
243
256
|
exports.loginThemePageIds = [
|
244
257
|
"login.ftl",
|
245
258
|
"login-username.ftl",
|
@@ -285,6 +298,7 @@ exports.accountThemePageIds = [
|
|
285
298
|
"log.ftl",
|
286
299
|
"federatedIdentity.ftl"
|
287
300
|
];
|
301
|
+
exports.containerName = "keycloak-keycloakify";
|
288
302
|
//# sourceMappingURL=constants.js.map
|
289
303
|
|
290
304
|
/***/ }),
|
@@ -386,31 +400,33 @@ function copyKeycloakResourcesToPublic(params) {
|
|
386
400
|
keycloakifyBuildinfoFilePath = (0, path_1.join)(destDirPath, "keycloakify.buildinfo");
|
387
401
|
keycloakifyBuildinfoRaw = JSON.stringify({
|
388
402
|
destDirPath: destDirPath,
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
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)
|
394
408
|
}
|
395
409
|
}, null, 2);
|
396
410
|
skip_if_already_done: {
|
397
411
|
if (!fs.existsSync(keycloakifyBuildinfoFilePath)) {
|
398
412
|
break skip_if_already_done;
|
399
413
|
}
|
400
|
-
keycloakifyBuildinfoRaw_previousRun = fs
|
414
|
+
keycloakifyBuildinfoRaw_previousRun = fs
|
415
|
+
.readFileSync(keycloakifyBuildinfoFilePath)
|
416
|
+
.toString("utf8");
|
401
417
|
if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
|
402
418
|
break skip_if_already_done;
|
403
419
|
}
|
404
420
|
return [2 /*return*/];
|
405
421
|
}
|
406
|
-
(0, fs_rmSync_1.rmSync)(destDirPath, {
|
407
|
-
fs.mkdirSync(destDirPath, {
|
422
|
+
(0, fs_rmSync_1.rmSync)(destDirPath, { force: true, recursive: true });
|
423
|
+
fs.mkdirSync(destDirPath, { recursive: true });
|
408
424
|
fs.writeFileSync((0, path_1.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
409
425
|
_loop_1 = function (themeType) {
|
410
426
|
return __generator(this, function (_c) {
|
411
427
|
switch (_c.label) {
|
412
428
|
case 0: return [4 /*yield*/, (0, downloadKeycloakStaticResources_1.downloadKeycloakStaticResources)({
|
413
|
-
|
429
|
+
keycloakVersion: (function () {
|
414
430
|
switch (themeType) {
|
415
431
|
case "login":
|
416
432
|
return buildOptions.loginThemeResourcesFromKeycloakVersion;
|
@@ -419,7 +435,7 @@ function copyKeycloakResourcesToPublic(params) {
|
|
419
435
|
}
|
420
436
|
})(),
|
421
437
|
themeType: themeType,
|
422
|
-
|
438
|
+
themeDirPath: destDirPath,
|
423
439
|
buildOptions: buildOptions
|
424
440
|
})];
|
425
441
|
case 1:
|
@@ -473,296 +489,11 @@ exports.copyKeycloakResourcesToPublic = copyKeycloakResourcesToPublic;
|
|
473
489
|
|
474
490
|
/***/ }),
|
475
491
|
|
476
|
-
/***/ 8469:
|
477
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
478
|
-
|
479
|
-
"use strict";
|
480
|
-
|
481
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
482
|
-
if (k2 === undefined) k2 = k;
|
483
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
484
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
485
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
486
|
-
}
|
487
|
-
Object.defineProperty(o, k2, desc);
|
488
|
-
}) : (function(o, m, k, k2) {
|
489
|
-
if (k2 === undefined) k2 = k;
|
490
|
-
o[k2] = m[k];
|
491
|
-
}));
|
492
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
493
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
494
|
-
}) : function(o, v) {
|
495
|
-
o["default"] = v;
|
496
|
-
});
|
497
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
498
|
-
if (mod && mod.__esModule) return mod;
|
499
|
-
var result = {};
|
500
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
501
|
-
__setModuleDefault(result, mod);
|
502
|
-
return result;
|
503
|
-
};
|
504
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
505
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
506
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
507
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
508
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
509
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
510
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
511
|
-
});
|
512
|
-
};
|
513
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
514
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
515
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
516
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
517
|
-
function step(op) {
|
518
|
-
if (f) throw new TypeError("Generator is already executing.");
|
519
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
520
|
-
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;
|
521
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
522
|
-
switch (op[0]) {
|
523
|
-
case 0: case 1: t = op; break;
|
524
|
-
case 4: _.label++; return { value: op[1], done: false };
|
525
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
526
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
527
|
-
default:
|
528
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
529
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
530
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
531
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
532
|
-
if (t[2]) _.ops.pop();
|
533
|
-
_.trys.pop(); continue;
|
534
|
-
}
|
535
|
-
op = body.call(thisArg, _);
|
536
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
537
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
538
|
-
}
|
539
|
-
};
|
540
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
541
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
542
|
-
};
|
543
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
544
|
-
exports.downloadAndUnzip = void 0;
|
545
|
-
var crypto_1 = __nccwpck_require__(6113);
|
546
|
-
var promises_1 = __nccwpck_require__(3292);
|
547
|
-
var make_fetch_happen_1 = __importDefault(__nccwpck_require__(9525));
|
548
|
-
var path_1 = __nccwpck_require__(1017);
|
549
|
-
var assert_1 = __nccwpck_require__(8078);
|
550
|
-
var transformCodebase_1 = __nccwpck_require__(332);
|
551
|
-
var unzip_1 = __nccwpck_require__(4131);
|
552
|
-
var fs_rm_1 = __nccwpck_require__(8699);
|
553
|
-
var child_process = __importStar(__nccwpck_require__(2081));
|
554
|
-
var fs_existsAsync_1 = __nccwpck_require__(3765);
|
555
|
-
var fetchProxyOptions_1 = __nccwpck_require__(47);
|
556
|
-
(0, assert_1.assert)();
|
557
|
-
function downloadAndUnzip(params) {
|
558
|
-
return __awaiter(this, void 0, void 0, function () {
|
559
|
-
var url, destDirPath, specificDirsToExtract, preCacheTransform, buildOptions, _a, extractDirPath, zipFilePath, _b, response, isFromRemoteCache, error_1, githubToken;
|
560
|
-
var _this = this;
|
561
|
-
var _c;
|
562
|
-
return __generator(this, function (_d) {
|
563
|
-
switch (_d.label) {
|
564
|
-
case 0:
|
565
|
-
url = params.url, destDirPath = params.destDirPath, specificDirsToExtract = params.specificDirsToExtract, preCacheTransform = params.preCacheTransform, buildOptions = params.buildOptions;
|
566
|
-
_a = (function () {
|
567
|
-
var zipFileBasenameWithoutExt = generateFileNameFromURL({
|
568
|
-
url: url,
|
569
|
-
"preCacheTransform": preCacheTransform === undefined
|
570
|
-
? undefined
|
571
|
-
: {
|
572
|
-
"actionCacheId": preCacheTransform.actionCacheId,
|
573
|
-
"actionFootprint": preCacheTransform.action.toString()
|
574
|
-
}
|
575
|
-
});
|
576
|
-
var zipFilePath = (0, path_1.join)(buildOptions.cacheDirPath, "".concat(zipFileBasenameWithoutExt, ".zip"));
|
577
|
-
var extractDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "tmp_unzip_".concat(zipFileBasenameWithoutExt));
|
578
|
-
return { zipFilePath: zipFilePath, extractDirPath: extractDirPath };
|
579
|
-
})(), extractDirPath = _a.extractDirPath, zipFilePath = _a.zipFilePath;
|
580
|
-
return [4 /*yield*/, (0, fs_existsAsync_1.existsAsync)(zipFilePath)];
|
581
|
-
case 1:
|
582
|
-
if (_d.sent()) {
|
583
|
-
return [3 /*break*/, 14];
|
584
|
-
}
|
585
|
-
return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
|
586
|
-
var proxyFetchOptions, response, _a;
|
587
|
-
var _b;
|
588
|
-
return __generator(this, function (_c) {
|
589
|
-
switch (_c.label) {
|
590
|
-
case 0: return [4 /*yield*/, (0, fetchProxyOptions_1.getProxyFetchOptions)({
|
591
|
-
"npmWorkspaceRootDirPath": buildOptions.npmWorkspaceRootDirPath
|
592
|
-
})];
|
593
|
-
case 1:
|
594
|
-
proxyFetchOptions = _c.sent();
|
595
|
-
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)];
|
596
|
-
case 2:
|
597
|
-
response = _c.sent();
|
598
|
-
if (response.status === 200) {
|
599
|
-
return [2 /*return*/, {
|
600
|
-
response: response,
|
601
|
-
"isFromRemoteCache": true
|
602
|
-
}];
|
603
|
-
}
|
604
|
-
_b = {};
|
605
|
-
_a = "response";
|
606
|
-
return [4 /*yield*/, (0, make_fetch_happen_1.default)(url, proxyFetchOptions)];
|
607
|
-
case 3: return [2 /*return*/, (_b[_a] = _c.sent(),
|
608
|
-
_b["isFromRemoteCache"] = false,
|
609
|
-
_b)];
|
610
|
-
}
|
611
|
-
});
|
612
|
-
}); })()];
|
613
|
-
case 2:
|
614
|
-
_b = _d.sent(), response = _b.response, isFromRemoteCache = _b.isFromRemoteCache;
|
615
|
-
return [4 /*yield*/, (0, promises_1.mkdir)((0, path_1.dirname)(zipFilePath), { "recursive": true })];
|
616
|
-
case 3:
|
617
|
-
_d.sent();
|
618
|
-
/**
|
619
|
-
* The correct way to fix this is to upgrade node-fetch beyond 3.2.5
|
620
|
-
* (see https://github.com/node-fetch/node-fetch/issues/1295#issuecomment-1144061991.)
|
621
|
-
* Unfortunately, octokit (a dependency of keycloakify) also uses node-fetch, and
|
622
|
-
* does not support node-fetch 3.x. So we stick around with this band-aid until
|
623
|
-
* octokit upgrades.
|
624
|
-
*/
|
625
|
-
(_c = response.body) === null || _c === void 0 ? void 0 : _c.setMaxListeners(Number.MAX_VALUE);
|
626
|
-
(0, assert_1.assert)(typeof response.body !== "undefined" && response.body != null);
|
627
|
-
return [4 /*yield*/, (0, promises_1.writeFile)(zipFilePath, response.body)];
|
628
|
-
case 4:
|
629
|
-
_d.sent();
|
630
|
-
if (isFromRemoteCache) {
|
631
|
-
return [3 /*break*/, 14];
|
632
|
-
}
|
633
|
-
if (specificDirsToExtract === undefined && preCacheTransform === undefined) {
|
634
|
-
return [3 /*break*/, 14];
|
635
|
-
}
|
636
|
-
return [4 /*yield*/, (0, unzip_1.unzip)(zipFilePath, extractDirPath, specificDirsToExtract)];
|
637
|
-
case 5:
|
638
|
-
_d.sent();
|
639
|
-
_d.label = 6;
|
640
|
-
case 6:
|
641
|
-
_d.trys.push([6, 8, , 10]);
|
642
|
-
return [4 /*yield*/, (preCacheTransform === null || preCacheTransform === void 0 ? void 0 : preCacheTransform.action({
|
643
|
-
"destDirPath": extractDirPath
|
644
|
-
}))];
|
645
|
-
case 7:
|
646
|
-
_d.sent();
|
647
|
-
return [3 /*break*/, 10];
|
648
|
-
case 8:
|
649
|
-
error_1 = _d.sent();
|
650
|
-
return [4 /*yield*/, Promise.all([(0, fs_rm_1.rm)(extractDirPath, { "recursive": true }), (0, promises_1.unlink)(zipFilePath)])];
|
651
|
-
case 9:
|
652
|
-
_d.sent();
|
653
|
-
throw error_1;
|
654
|
-
case 10: return [4 /*yield*/, (0, promises_1.unlink)(zipFilePath)];
|
655
|
-
case 11:
|
656
|
-
_d.sent();
|
657
|
-
return [4 /*yield*/, (0, unzip_1.zip)(extractDirPath, zipFilePath)];
|
658
|
-
case 12:
|
659
|
-
_d.sent();
|
660
|
-
return [4 /*yield*/, (0, fs_rm_1.rm)(extractDirPath, { "recursive": true })];
|
661
|
-
case 13:
|
662
|
-
_d.sent();
|
663
|
-
upload_to_remote_cache_if_admin: {
|
664
|
-
githubToken = process.env["KEYCLOAKIFY_ADMIN_GITHUB_PERSONAL_ACCESS_TOKEN"];
|
665
|
-
if (!githubToken) {
|
666
|
-
break upload_to_remote_cache_if_admin;
|
667
|
-
}
|
668
|
-
console.log("uploading to remote cache");
|
669
|
-
try {
|
670
|
-
child_process.execSync("which putasset");
|
671
|
-
}
|
672
|
-
catch (_e) {
|
673
|
-
child_process.execSync("npm install -g putasset");
|
674
|
-
}
|
675
|
-
try {
|
676
|
-
child_process.execFileSync("putasset", [
|
677
|
-
"--owner",
|
678
|
-
"keycloakify",
|
679
|
-
"--repo",
|
680
|
-
"keycloakify",
|
681
|
-
"--tag",
|
682
|
-
"v0.0.1",
|
683
|
-
"--filename",
|
684
|
-
zipFilePath,
|
685
|
-
"--token",
|
686
|
-
githubToken
|
687
|
-
]);
|
688
|
-
}
|
689
|
-
catch (_f) {
|
690
|
-
console.log("upload failed, asset probably already exists in remote cache");
|
691
|
-
}
|
692
|
-
}
|
693
|
-
_d.label = 14;
|
694
|
-
case 14: return [4 /*yield*/, (0, unzip_1.unzip)(zipFilePath, extractDirPath)];
|
695
|
-
case 15:
|
696
|
-
_d.sent();
|
697
|
-
(0, transformCodebase_1.transformCodebase)({
|
698
|
-
"srcDirPath": extractDirPath,
|
699
|
-
"destDirPath": destDirPath
|
700
|
-
});
|
701
|
-
return [4 /*yield*/, (0, fs_rm_1.rm)(extractDirPath, { "recursive": true })];
|
702
|
-
case 16:
|
703
|
-
_d.sent();
|
704
|
-
return [2 /*return*/];
|
705
|
-
}
|
706
|
-
});
|
707
|
-
});
|
708
|
-
}
|
709
|
-
exports.downloadAndUnzip = downloadAndUnzip;
|
710
|
-
function generateFileNameFromURL(params) {
|
711
|
-
var preCacheTransform = params.preCacheTransform;
|
712
|
-
// Parse the URL
|
713
|
-
var url = new URL(params.url);
|
714
|
-
// Extract pathname and remove leading slashes
|
715
|
-
var fileName = url.pathname.replace(/^\//, "").replace(/\//g, "_");
|
716
|
-
// Optionally, add query parameters replacing special characters
|
717
|
-
if (url.search) {
|
718
|
-
fileName += url.search.replace(/[&=?]/g, "-");
|
719
|
-
}
|
720
|
-
// Replace any characters that are not valid in filenames
|
721
|
-
fileName = fileName.replace(/[^a-zA-Z0-9-_]/g, "");
|
722
|
-
// Trim or pad the fileName to a specific length
|
723
|
-
fileName = fileName.substring(0, 50);
|
724
|
-
add_pre_cache_transform: {
|
725
|
-
if (preCacheTransform === undefined) {
|
726
|
-
break add_pre_cache_transform;
|
727
|
-
}
|
728
|
-
// Sanitize actionCacheId the same way as other components
|
729
|
-
var sanitizedActionCacheId = preCacheTransform.actionCacheId.replace(/[^a-zA-Z0-9-_]/g, "_");
|
730
|
-
fileName += "_".concat(sanitizedActionCacheId, "_").concat((0, crypto_1.createHash)("sha256").update(preCacheTransform.actionFootprint).digest("hex").substring(0, 5));
|
731
|
-
}
|
732
|
-
return fileName;
|
733
|
-
}
|
734
|
-
//# sourceMappingURL=downloadAndUnzip.js.map
|
735
|
-
|
736
|
-
/***/ }),
|
737
|
-
|
738
492
|
/***/ 597:
|
739
493
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
740
494
|
|
741
495
|
"use strict";
|
742
496
|
|
743
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
744
|
-
if (k2 === undefined) k2 = k;
|
745
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
746
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
747
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
748
|
-
}
|
749
|
-
Object.defineProperty(o, k2, desc);
|
750
|
-
}) : (function(o, m, k, k2) {
|
751
|
-
if (k2 === undefined) k2 = k;
|
752
|
-
o[k2] = m[k];
|
753
|
-
}));
|
754
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
755
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
756
|
-
}) : function(o, v) {
|
757
|
-
o["default"] = v;
|
758
|
-
});
|
759
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
760
|
-
if (mod && mod.__esModule) return mod;
|
761
|
-
var result = {};
|
762
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
763
|
-
__setModuleDefault(result, mod);
|
764
|
-
return result;
|
765
|
-
};
|
766
497
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
767
498
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
768
499
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -824,231 +555,181 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
824
555
|
}
|
825
556
|
return to.concat(ar || Array.prototype.slice.call(from));
|
826
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
|
+
};
|
827
569
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
828
570
|
exports.downloadKeycloakDefaultTheme = void 0;
|
829
571
|
var path_1 = __nccwpck_require__(1017);
|
830
|
-
var downloadAndUnzip_1 = __nccwpck_require__(8469);
|
831
572
|
var assert_1 = __nccwpck_require__(8078);
|
832
|
-
var child_process = __importStar(__nccwpck_require__(2081));
|
833
|
-
var fs = __importStar(__nccwpck_require__(7147));
|
834
|
-
var fs_rmSync_1 = __nccwpck_require__(9693);
|
835
573
|
var constants_1 = __nccwpck_require__(173);
|
836
|
-
var
|
574
|
+
var downloadAndExtractArchive_1 = __nccwpck_require__(8562);
|
575
|
+
var isInside_1 = __nccwpck_require__(1653);
|
837
576
|
(0, assert_1.assert)();
|
838
577
|
function downloadKeycloakDefaultTheme(params) {
|
839
578
|
return __awaiter(this, void 0, void 0, function () {
|
840
|
-
var keycloakVersion,
|
579
|
+
var keycloakVersion, buildOptions, extractedDirPath;
|
841
580
|
var _this = this;
|
842
581
|
return __generator(this, function (_a) {
|
843
582
|
switch (_a.label) {
|
844
583
|
case 0:
|
845
|
-
keycloakVersion = params.keycloakVersion,
|
846
|
-
return [4 /*yield*/, (0,
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
if (!fs.existsSync(commonResourcesDirPath)) {
|
860
|
-
break install_common_node_modules;
|
861
|
-
}
|
862
|
-
if (!fs.existsSync((0, path_1.join)(commonResourcesDirPath, "package.json"))) {
|
863
|
-
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*/];
|
864
598
|
}
|
865
|
-
|
866
|
-
|
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*/];
|
867
609
|
}
|
868
|
-
|
869
|
-
|
870
|
-
"stdio": "ignore"
|
871
|
-
});
|
872
|
-
}
|
873
|
-
repatriate_common_resources_from_base_login_theme: {
|
874
|
-
baseLoginThemeResourceDir = (0, path_1.join)(destDirPath, "base", "login", "resources");
|
875
|
-
if (!fs.existsSync(baseLoginThemeResourceDir)) {
|
876
|
-
break repatriate_common_resources_from_base_login_theme;
|
610
|
+
if (constants_1.lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
|
611
|
+
return [3 /*break*/, 4];
|
877
612
|
}
|
878
|
-
(
|
879
|
-
"
|
880
|
-
|
881
|
-
});
|
882
|
-
}
|
883
|
-
install_and_move_to_common_resources_generated_in_keycloak_v2: {
|
884
|
-
if (!fs.readFileSync((0, path_1.join)(destDirPath, "keycloak", "login", "theme.properties")).toString("utf8").includes("web_modules")) {
|
885
|
-
break install_and_move_to_common_resources_generated_in_keycloak_v2;
|
613
|
+
if (fileRelativePath !==
|
614
|
+
(0, path_1.join)("keycloak", "account", "resources", "css", "account.css")) {
|
615
|
+
return [3 /*break*/, 3];
|
886
616
|
}
|
887
|
-
|
888
|
-
|
889
|
-
|
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*/];
|
890
640
|
}
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
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;
|
895
648
|
}
|
896
|
-
|
897
|
-
|
898
|
-
|
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;
|
899
662
|
}
|
663
|
+
return [2 /*return*/];
|
900
664
|
}
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
if (!fs.existsSync(nodeModuleDirPath)) {
|
924
|
-
break remove_unused_node_modules;
|
925
|
-
}
|
926
|
-
toDeletePerfixes_1 = [
|
927
|
-
"angular",
|
928
|
-
"bootstrap",
|
929
|
-
"rcue",
|
930
|
-
"font-awesome",
|
931
|
-
"ng-file-upload",
|
932
|
-
(0, path_1.join)("patternfly", "dist", "sass"),
|
933
|
-
(0, path_1.join)("patternfly", "dist", "less"),
|
934
|
-
(0, path_1.join)("patternfly", "dist", "js"),
|
935
|
-
"d3",
|
936
|
-
(0, path_1.join)("jquery", "src"),
|
937
|
-
"c3",
|
938
|
-
"core-js",
|
939
|
-
"eonasdan-bootstrap-datetimepicker",
|
940
|
-
"moment",
|
941
|
-
"react",
|
942
|
-
"patternfly-bootstrap-treeview",
|
943
|
-
"popper.js",
|
944
|
-
"tippy.js",
|
945
|
-
"jquery-match-height",
|
946
|
-
"google-code-prettify",
|
947
|
-
"patternfly-bootstrap-combobox",
|
948
|
-
"focus-trap",
|
949
|
-
"tabbable",
|
950
|
-
"scheduler",
|
951
|
-
"@types",
|
952
|
-
"datatables.net",
|
953
|
-
"datatables.net-colreorder",
|
954
|
-
"tslib",
|
955
|
-
"prop-types",
|
956
|
-
"file-selector",
|
957
|
-
"datatables.net-colreorder-bs",
|
958
|
-
"object-assign",
|
959
|
-
"warning",
|
960
|
-
"js-tokens",
|
961
|
-
"loose-envify",
|
962
|
-
"prop-types-extra",
|
963
|
-
"attr-accept",
|
964
|
-
"datatables.net-select",
|
965
|
-
"drmonty-datatables-colvis",
|
966
|
-
"datatables.net-bs",
|
967
|
-
(0, path_1.join)("@patternfly", "react"),
|
968
|
-
(0, path_1.join)("@patternfly", "patternfly", "docs")
|
969
|
-
];
|
970
|
-
(0, transformCodebase_1.transformCodebase)({
|
971
|
-
"srcDirPath": nodeModuleDirPath,
|
972
|
-
"destDirPath": nodeModuleDirPath,
|
973
|
-
"transformSourceCode": function (_a) {
|
974
|
-
var sourceCode = _a.sourceCode, fileRelativePath = _a.fileRelativePath;
|
975
|
-
if (fileRelativePath.endsWith(".map")) {
|
976
|
-
return undefined;
|
977
|
-
}
|
978
|
-
if (toDeletePerfixes_1.find(function (prefix) { return fileRelativePath.startsWith(prefix); }) !== undefined) {
|
979
|
-
return undefined;
|
980
|
-
}
|
981
|
-
if (fileRelativePath.startsWith((0, path_1.join)("patternfly", "dist", "fonts"))) {
|
982
|
-
if (!fileRelativePath.endsWith(".woff2") &&
|
983
|
-
!fileRelativePath.endsWith(".woff") &&
|
984
|
-
!fileRelativePath.endsWith(".ttf")) {
|
985
|
-
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*/];
|
986
687
|
}
|
987
688
|
}
|
988
|
-
return { "modifiedSourceCode": sourceCode };
|
989
689
|
}
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
libDirPath = (0, path_1.join)(destDirPath, "keycloak", "common", "resources", "lib");
|
995
|
-
if (!fs.existsSync(libDirPath)) {
|
996
|
-
break remove_unused_lib;
|
997
|
-
}
|
998
|
-
toDeletePerfixes_2 = ["ui-ace", "filesaver", "fileupload", "angular", "ui-ace"];
|
999
|
-
(0, transformCodebase_1.transformCodebase)({
|
1000
|
-
"srcDirPath": libDirPath,
|
1001
|
-
"destDirPath": libDirPath,
|
1002
|
-
"transformSourceCode": function (_a) {
|
1003
|
-
var sourceCode = _a.sourceCode, fileRelativePath = _a.fileRelativePath;
|
1004
|
-
if (fileRelativePath.endsWith(".map")) {
|
1005
|
-
return undefined;
|
1006
|
-
}
|
1007
|
-
if (toDeletePerfixes_2.find(function (prefix) { return fileRelativePath.startsWith(prefix); }) !== undefined) {
|
1008
|
-
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);
|
1009
694
|
}
|
1010
|
-
|
695
|
+
finally { if (e_1) throw e_1.error; }
|
1011
696
|
}
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
fs.writeFileSync(accountCssFilePath, Buffer.from(fs.readFileSync(accountCssFilePath).toString("utf8").replace("top: -34px;", "top: -34px !important;"), "utf8"));
|
1021
|
-
}
|
1022
|
-
// Note, this is an optimization for reducing the size of the jar,
|
1023
|
-
// For this version we know exactly which resources are used.
|
1024
|
-
{
|
1025
|
-
nodeModulesDirPath = (0, path_1.join)(destDirPath, "keycloak", "common", "resources", "node_modules");
|
1026
|
-
toKeepPrefixes_1 = __spreadArray(__spreadArray([], __read(["patternfly.min.css", "patternfly-additions.min.css", "patternfly-additions.min.css"].map(function (fileBasename) {
|
1027
|
-
return (0, path_1.join)("patternfly", "dist", "css", fileBasename);
|
1028
|
-
})), false), [
|
1029
|
-
(0, path_1.join)("patternfly", "dist", "fonts")
|
1030
|
-
], false);
|
1031
|
-
(0, transformCodebase_1.transformCodebase)({
|
1032
|
-
"srcDirPath": nodeModulesDirPath,
|
1033
|
-
"destDirPath": nodeModulesDirPath,
|
1034
|
-
"transformSourceCode": function (_a) {
|
1035
|
-
var sourceCode = _a.sourceCode, fileRelativePath = _a.fileRelativePath;
|
1036
|
-
if (toKeepPrefixes_1.find(function (prefix) { return fileRelativePath.startsWith(prefix); }) === undefined) {
|
1037
|
-
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*/];
|
1038
705
|
}
|
1039
|
-
return { "modifiedSourceCode": sourceCode };
|
1040
706
|
}
|
1041
|
-
}
|
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
|
+
}
|
1042
721
|
}
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
722
|
+
return [4 /*yield*/, writeFile({ fileRelativePath: fileRelativePath })];
|
723
|
+
case 5:
|
724
|
+
_l.sent();
|
725
|
+
return [2 /*return*/];
|
726
|
+
}
|
727
|
+
});
|
728
|
+
}); }
|
1048
729
|
})];
|
1049
730
|
case 1:
|
1050
|
-
_a.sent();
|
1051
|
-
return [2 /*return
|
731
|
+
extractedDirPath = (_a.sent()).extractedDirPath;
|
732
|
+
return [2 /*return*/, { defaultThemeDirPath: extractedDirPath }];
|
1052
733
|
}
|
1053
734
|
});
|
1054
735
|
});
|
@@ -1063,29 +744,6 @@ exports.downloadKeycloakDefaultTheme = downloadKeycloakDefaultTheme;
|
|
1063
744
|
|
1064
745
|
"use strict";
|
1065
746
|
|
1066
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
1067
|
-
if (k2 === undefined) k2 = k;
|
1068
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
1069
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
1070
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
1071
|
-
}
|
1072
|
-
Object.defineProperty(o, k2, desc);
|
1073
|
-
}) : (function(o, m, k, k2) {
|
1074
|
-
if (k2 === undefined) k2 = k;
|
1075
|
-
o[k2] = m[k];
|
1076
|
-
}));
|
1077
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
1078
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
1079
|
-
}) : function(o, v) {
|
1080
|
-
o["default"] = v;
|
1081
|
-
});
|
1082
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
1083
|
-
if (mod && mod.__esModule) return mod;
|
1084
|
-
var result = {};
|
1085
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
1086
|
-
__setModuleDefault(result, mod);
|
1087
|
-
return result;
|
1088
|
-
};
|
1089
747
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1090
748
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
1091
749
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -1129,34 +787,42 @@ var path_1 = __nccwpck_require__(1017);
|
|
1129
787
|
var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(597);
|
1130
788
|
var constants_1 = __nccwpck_require__(173);
|
1131
789
|
var assert_1 = __nccwpck_require__(8078);
|
1132
|
-
var
|
1133
|
-
var fs_rmSync_1 = __nccwpck_require__(9693);
|
790
|
+
var fs_existsAsync_1 = __nccwpck_require__(3765);
|
1134
791
|
(0, assert_1.assert)();
|
1135
792
|
function downloadKeycloakStaticResources(params) {
|
1136
793
|
return __awaiter(this, void 0, void 0, function () {
|
1137
|
-
var themeType, themeDirPath, keycloakVersion, buildOptions,
|
794
|
+
var themeType, themeDirPath, keycloakVersion, buildOptions, defaultThemeDirPath, resourcesDirPath, srcDirPath;
|
1138
795
|
return __generator(this, function (_a) {
|
1139
796
|
switch (_a.label) {
|
1140
797
|
case 0:
|
1141
798
|
themeType = params.themeType, themeDirPath = params.themeDirPath, keycloakVersion = params.keycloakVersion, buildOptions = params.buildOptions;
|
1142
|
-
tmpDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "downloadKeycloakStaticResources_tmp_".concat(crypto.createHash("sha256").update("".concat(themeType, "-").concat(keycloakVersion)).digest("hex").slice(0, 8)));
|
1143
799
|
return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
|
1144
800
|
keycloakVersion: keycloakVersion,
|
1145
|
-
"destDirPath": tmpDirPath,
|
1146
801
|
buildOptions: buildOptions
|
1147
802
|
})];
|
1148
803
|
case 1:
|
1149
|
-
_a.sent();
|
1150
|
-
|
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
|
+
}
|
1151
812
|
(0, transformCodebase_1.transformCodebase)({
|
1152
|
-
|
1153
|
-
|
813
|
+
srcDirPath: srcDirPath,
|
814
|
+
destDirPath: resourcesDirPath
|
1154
815
|
});
|
816
|
+
_a.label = 3;
|
817
|
+
case 3:
|
1155
818
|
(0, transformCodebase_1.transformCodebase)({
|
1156
|
-
|
1157
|
-
|
819
|
+
srcDirPath: (0, path_1.join)(defaultThemeDirPath, "keycloak", themeType, "resources"),
|
820
|
+
destDirPath: resourcesDirPath
|
821
|
+
});
|
822
|
+
(0, transformCodebase_1.transformCodebase)({
|
823
|
+
srcDirPath: (0, path_1.join)(defaultThemeDirPath, "keycloak", "common", "resources"),
|
824
|
+
destDirPath: (0, path_1.join)(resourcesDirPath, constants_1.resources_common)
|
1158
825
|
});
|
1159
|
-
(0, fs_rmSync_1.rmSync)(tmpDirPath, { "recursive": true });
|
1160
826
|
return [2 /*return*/];
|
1161
827
|
}
|
1162
828
|
});
|
@@ -1204,17 +870,17 @@ var SemVer;
|
|
1204
870
|
if (!match) {
|
1205
871
|
throw new Error("".concat(versionStr, " is not a valid semantic version"));
|
1206
872
|
}
|
1207
|
-
var semVer = __assign({
|
873
|
+
var semVer = __assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (function () {
|
1208
874
|
var str = match[3];
|
1209
875
|
return str === undefined ? 0 : parseInt(str);
|
1210
876
|
})() }, (function () {
|
1211
877
|
var str = match[4];
|
1212
|
-
return str === undefined ? {} : {
|
878
|
+
return str === undefined ? {} : { rc: parseInt(str) };
|
1213
879
|
})());
|
1214
880
|
var initialStr = stringify(semVer);
|
1215
881
|
Object.defineProperty(semVer, "parsedFrom", {
|
1216
|
-
|
1217
|
-
|
882
|
+
enumerable: true,
|
883
|
+
get: function () {
|
1218
884
|
var currentStr = stringify(this);
|
1219
885
|
if (currentStr !== initialStr) {
|
1220
886
|
throw new Error("SemVer.parsedFrom can't be read anymore, the version have been modified from ".concat(initialStr, " to ").concat(currentStr));
|
@@ -1265,8 +931,12 @@ var SemVer;
|
|
1265
931
|
*/
|
1266
932
|
function bumpType(params) {
|
1267
933
|
var e_2, _a;
|
1268
|
-
var versionAhead = typeof params.versionAhead === "string"
|
1269
|
-
|
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;
|
1270
940
|
if (compare(versionBehind, versionAhead) === 1) {
|
1271
941
|
throw new Error("Version regression ".concat(stringify(versionBehind), " -> ").concat(stringify(versionAhead)));
|
1272
942
|
}
|
@@ -1374,21 +1044,411 @@ exports.crawl = crawl;
|
|
1374
1044
|
|
1375
1045
|
/***/ }),
|
1376
1046
|
|
1377
|
-
/***/
|
1047
|
+
/***/ 7906:
|
1378
1048
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
1379
1049
|
|
1380
1050
|
"use strict";
|
1381
1051
|
|
1382
|
-
var
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
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:
|
1438
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
1439
|
+
|
1440
|
+
"use strict";
|
1441
|
+
|
1442
|
+
var __assign = (this && this.__assign) || function () {
|
1443
|
+
__assign = Object.assign || function(t) {
|
1444
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1445
|
+
s = arguments[i];
|
1446
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
1447
|
+
t[p] = s[p];
|
1448
|
+
}
|
1449
|
+
return t;
|
1450
|
+
};
|
1451
|
+
return __assign.apply(this, arguments);
|
1392
1452
|
};
|
1393
1453
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1394
1454
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
@@ -1466,7 +1526,8 @@ function ensureSingleOrNone(arg0) {
|
|
1466
1526
|
return undefined;
|
1467
1527
|
if (arg0.length === 1)
|
1468
1528
|
return arg0[0];
|
1469
|
-
throw new Error("Illegal configuration, expected a single value but found multiple: " +
|
1529
|
+
throw new Error("Illegal configuration, expected a single value but found multiple: " +
|
1530
|
+
arg0.map(String).join(", "));
|
1470
1531
|
}
|
1471
1532
|
/**
|
1472
1533
|
* Get npm configuration as map
|
@@ -1479,7 +1540,10 @@ function getNmpConfig(params) {
|
|
1479
1540
|
case 0:
|
1480
1541
|
npmWorkspaceRootDirPath = params.npmWorkspaceRootDirPath;
|
1481
1542
|
exec = (0, util_1.promisify)(child_process_1.exec);
|
1482
|
-
return [4 /*yield*/, exec("npm config get", {
|
1543
|
+
return [4 /*yield*/, exec("npm config get", {
|
1544
|
+
encoding: "utf8",
|
1545
|
+
cwd: npmWorkspaceRootDirPath
|
1546
|
+
}).then(function (_a) {
|
1483
1547
|
var stdout = _a.stdout;
|
1484
1548
|
return stdout;
|
1485
1549
|
})];
|
@@ -1488,7 +1552,8 @@ function getNmpConfig(params) {
|
|
1488
1552
|
npmConfigReducer = function (cfg, _a) {
|
1489
1553
|
var _b, _c;
|
1490
1554
|
var _d = __read(_a, 2), key = _d[0], value = _d[1];
|
1491
|
-
return key in cfg
|
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));
|
1492
1557
|
};
|
1493
1558
|
return [2 /*return*/, stdout
|
1494
1559
|
.split("\n")
|
@@ -1528,7 +1593,9 @@ function getProxyFetchOptions(params) {
|
|
1528
1593
|
return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
|
1529
1594
|
function chunks(arr, size) {
|
1530
1595
|
if (size === void 0) { size = 2; }
|
1531
|
-
return arr
|
1596
|
+
return arr
|
1597
|
+
.map(function (_, i) { return i % size == 0 && arr.slice(i, i + size); })
|
1598
|
+
.filter(Boolean);
|
1532
1599
|
}
|
1533
1600
|
var cafileContent;
|
1534
1601
|
return __generator(this, function (_a) {
|
@@ -1543,7 +1610,13 @@ function getProxyFetchOptions(params) {
|
|
1543
1610
|
case 2:
|
1544
1611
|
_b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
|
1545
1612
|
_h.label = 3;
|
1546
|
-
case 3: return [2 /*return*/, {
|
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
|
+
}];
|
1547
1620
|
}
|
1548
1621
|
});
|
1549
1622
|
});
|
@@ -1553,6 +1626,214 @@ exports.getProxyFetchOptions = getProxyFetchOptions;
|
|
1553
1626
|
|
1554
1627
|
/***/ }),
|
1555
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
|
+
return __generator(this, function (_a) {
|
1803
|
+
switch (_a.label) {
|
1804
|
+
case 0:
|
1805
|
+
// NOTE: Skip directories
|
1806
|
+
if (entry.fileName.endsWith(path_1.sep)) {
|
1807
|
+
return [3 /*break*/, 2];
|
1808
|
+
}
|
1809
|
+
return [4 /*yield*/, onArchiveFile({
|
1810
|
+
relativeFilePathInArchive: entry.fileName.split("/").join(path_1.sep),
|
1811
|
+
readFile: function () { return readFile(entry); },
|
1812
|
+
writeFile: function (params) { return writeFile(entry, params); }
|
1813
|
+
})];
|
1814
|
+
case 1:
|
1815
|
+
_a.sent();
|
1816
|
+
_a.label = 2;
|
1817
|
+
case 2:
|
1818
|
+
zipFile.readEntry();
|
1819
|
+
return [2 /*return*/];
|
1820
|
+
}
|
1821
|
+
});
|
1822
|
+
}); });
|
1823
|
+
zipFile.readEntry();
|
1824
|
+
return [4 /*yield*/, dDone.pr];
|
1825
|
+
case 2:
|
1826
|
+
_a.sent();
|
1827
|
+
return [2 /*return*/];
|
1828
|
+
}
|
1829
|
+
});
|
1830
|
+
});
|
1831
|
+
}
|
1832
|
+
exports.extractArchive = extractArchive;
|
1833
|
+
//# sourceMappingURL=extractArchive.js.map
|
1834
|
+
|
1835
|
+
/***/ }),
|
1836
|
+
|
1556
1837
|
/***/ 3765:
|
1557
1838
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
1558
1839
|
|
@@ -1973,17 +2254,32 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
1973
2254
|
}
|
1974
2255
|
return to.concat(ar || Array.prototype.slice.call(from));
|
1975
2256
|
};
|
2257
|
+
var __values = (this && this.__values) || function(o) {
|
2258
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
2259
|
+
if (m) return m.call(o);
|
2260
|
+
if (o && typeof o.length === "number") return {
|
2261
|
+
next: function () {
|
2262
|
+
if (o && i >= o.length) o = void 0;
|
2263
|
+
return { value: o && o[i++], done: !o };
|
2264
|
+
}
|
2265
|
+
};
|
2266
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
2267
|
+
};
|
1976
2268
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1977
2269
|
exports.getNpmWorkspaceRootDirPath = void 0;
|
1978
2270
|
var child_process = __importStar(__nccwpck_require__(2081));
|
1979
2271
|
var path_1 = __nccwpck_require__(1017);
|
1980
2272
|
var assert_1 = __nccwpck_require__(8078);
|
2273
|
+
var fs = __importStar(__nccwpck_require__(7147));
|
1981
2274
|
function getNpmWorkspaceRootDirPath(params) {
|
1982
|
-
var reactAppRootDirPath = params.reactAppRootDirPath;
|
2275
|
+
var reactAppRootDirPath = params.reactAppRootDirPath, dependencyExpected = params.dependencyExpected;
|
1983
2276
|
var npmWorkspaceRootDirPath = (function callee(depth) {
|
1984
2277
|
var cwd = (0, path_1.resolve)(path_1.join.apply(void 0, __spreadArray([], __read(__spreadArray([reactAppRootDirPath], __read(Array(depth).fill("..")), false)), false)));
|
1985
2278
|
try {
|
1986
|
-
child_process.execSync("npm config get", {
|
2279
|
+
child_process.execSync("npm config get", {
|
2280
|
+
cwd: cwd,
|
2281
|
+
stdio: "ignore"
|
2282
|
+
});
|
1987
2283
|
}
|
1988
2284
|
catch (error) {
|
1989
2285
|
if (String(error).includes("ENOWORKSPACES")) {
|
@@ -1992,6 +2288,41 @@ function getNpmWorkspaceRootDirPath(params) {
|
|
1992
2288
|
}
|
1993
2289
|
throw error;
|
1994
2290
|
}
|
2291
|
+
var isExpectedDependencyFound = (function () {
|
2292
|
+
var e_1, _a;
|
2293
|
+
var packageJsonFilePath = (0, path_1.join)(cwd, "package.json");
|
2294
|
+
(0, assert_1.assert)(fs.existsSync(packageJsonFilePath));
|
2295
|
+
var parsedPackageJson = JSON.parse(fs.readFileSync(packageJsonFilePath).toString("utf8"));
|
2296
|
+
var isExpectedDependencyFound = false;
|
2297
|
+
try {
|
2298
|
+
for (var _b = __values([
|
2299
|
+
"dependencies",
|
2300
|
+
"devDependencies"
|
2301
|
+
]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
2302
|
+
var dependenciesOrDevDependencies = _c.value;
|
2303
|
+
var dependencies = parsedPackageJson[dependenciesOrDevDependencies];
|
2304
|
+
if (dependencies === undefined) {
|
2305
|
+
continue;
|
2306
|
+
}
|
2307
|
+
(0, assert_1.assert)(dependencies instanceof Object);
|
2308
|
+
if (dependencies[dependencyExpected] === undefined) {
|
2309
|
+
continue;
|
2310
|
+
}
|
2311
|
+
isExpectedDependencyFound = true;
|
2312
|
+
}
|
2313
|
+
}
|
2314
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
2315
|
+
finally {
|
2316
|
+
try {
|
2317
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
2318
|
+
}
|
2319
|
+
finally { if (e_1) throw e_1.error; }
|
2320
|
+
}
|
2321
|
+
return { isExpectedDependencyFound: isExpectedDependencyFound };
|
2322
|
+
})().isExpectedDependencyFound;
|
2323
|
+
if (!isExpectedDependencyFound) {
|
2324
|
+
return callee(depth + 1);
|
2325
|
+
}
|
1995
2326
|
return cwd;
|
1996
2327
|
})(0);
|
1997
2328
|
return { npmWorkspaceRootDirPath: npmWorkspaceRootDirPath };
|
@@ -2051,6 +2382,23 @@ exports.getThisCodebaseRootDirPath = getThisCodebaseRootDirPath;
|
|
2051
2382
|
|
2052
2383
|
/***/ }),
|
2053
2384
|
|
2385
|
+
/***/ 1653:
|
2386
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
2387
|
+
|
2388
|
+
"use strict";
|
2389
|
+
|
2390
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
2391
|
+
exports.isInside = void 0;
|
2392
|
+
var path_1 = __nccwpck_require__(1017);
|
2393
|
+
function isInside(params) {
|
2394
|
+
var dirPath = params.dirPath, filePath = params.filePath;
|
2395
|
+
return !(0, path_1.relative)(dirPath, filePath).startsWith("..");
|
2396
|
+
}
|
2397
|
+
exports.isInside = isInside;
|
2398
|
+
//# sourceMappingURL=isInside.js.map
|
2399
|
+
|
2400
|
+
/***/ }),
|
2401
|
+
|
2054
2402
|
/***/ 4795:
|
2055
2403
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
2056
2404
|
|
@@ -2086,7 +2434,9 @@ var assert_1 = __nccwpck_require__(8078);
|
|
2086
2434
|
var fs = __importStar(__nccwpck_require__(7147));
|
2087
2435
|
var path_1 = __nccwpck_require__(1017);
|
2088
2436
|
function readThisNpmPackageVersion() {
|
2089
|
-
var version = JSON.parse(fs
|
2437
|
+
var version = JSON.parse(fs
|
2438
|
+
.readFileSync((0, path_1.join)((0, getThisCodebaseRootDirPath_1.getThisCodebaseRootDirPath)(), "package.json"))
|
2439
|
+
.toString("utf8"))["version"];
|
2090
2440
|
(0, assert_1.assert)(typeof version === "string");
|
2091
2441
|
return version;
|
2092
2442
|
}
|
@@ -2149,12 +2499,17 @@ function transformCodebase(params) {
|
|
2149
2499
|
var e_1, _a;
|
2150
2500
|
var srcDirPath = params.srcDirPath, transformSourceCode = params.transformSourceCode;
|
2151
2501
|
var isTargetSameAsSource = path.relative(srcDirPath, params.destDirPath) === "";
|
2152
|
-
var destDirPath = isTargetSameAsSource
|
2502
|
+
var destDirPath = isTargetSameAsSource
|
2503
|
+
? path.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
|
2504
|
+
: params.destDirPath;
|
2153
2505
|
fs.mkdirSync(destDirPath, {
|
2154
|
-
|
2506
|
+
recursive: true
|
2155
2507
|
});
|
2156
2508
|
try {
|
2157
|
-
for (var _b = __values((0, crawl_1.crawl)({
|
2509
|
+
for (var _b = __values((0, crawl_1.crawl)({
|
2510
|
+
dirPath: srcDirPath,
|
2511
|
+
returnedPathsType: "relative to dirPath"
|
2512
|
+
})), _c = _b.next(); !_c.done; _c = _b.next()) {
|
2158
2513
|
var fileRelativePath = _c.value;
|
2159
2514
|
var filePath = path.join(srcDirPath, fileRelativePath);
|
2160
2515
|
var destFilePath = path.join(destDirPath, fileRelativePath);
|
@@ -2162,13 +2517,13 @@ function transformCodebase(params) {
|
|
2162
2517
|
// it using the lower level implementation.
|
2163
2518
|
if (transformSourceCode === undefined) {
|
2164
2519
|
fs.mkdirSync(path.dirname(destFilePath), {
|
2165
|
-
|
2520
|
+
recursive: true
|
2166
2521
|
});
|
2167
2522
|
fs.copyFileSync(filePath, destFilePath);
|
2168
2523
|
continue;
|
2169
2524
|
}
|
2170
2525
|
var transformSourceCodeResult = transformSourceCode({
|
2171
|
-
|
2526
|
+
sourceCode: fs.readFileSync(filePath),
|
2172
2527
|
filePath: filePath,
|
2173
2528
|
fileRelativePath: fileRelativePath
|
2174
2529
|
});
|
@@ -2176,7 +2531,7 @@ function transformCodebase(params) {
|
|
2176
2531
|
continue;
|
2177
2532
|
}
|
2178
2533
|
fs.mkdirSync(path.dirname(destFilePath), {
|
2179
|
-
|
2534
|
+
recursive: true
|
2180
2535
|
});
|
2181
2536
|
var newFileName = transformSourceCodeResult.newFileName, modifiedSourceCode = transformSourceCodeResult.modifiedSourceCode;
|
2182
2537
|
fs.writeFileSync(path.join(path.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : path.basename(destFilePath)), modifiedSourceCode);
|
@@ -2190,7 +2545,7 @@ function transformCodebase(params) {
|
|
2190
2545
|
finally { if (e_1) throw e_1.error; }
|
2191
2546
|
}
|
2192
2547
|
if (isTargetSameAsSource) {
|
2193
|
-
(0, fs_rmSync_1.rmSync)(srcDirPath, {
|
2548
|
+
(0, fs_rmSync_1.rmSync)(srcDirPath, { recursive: true });
|
2194
2549
|
fs.renameSync(destDirPath, srcDirPath);
|
2195
2550
|
}
|
2196
2551
|
}
|
@@ -2199,287 +2554,6 @@ exports.transformCodebase = transformCodebase;
|
|
2199
2554
|
|
2200
2555
|
/***/ }),
|
2201
2556
|
|
2202
|
-
/***/ 4131:
|
2203
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
2204
|
-
|
2205
|
-
"use strict";
|
2206
|
-
|
2207
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2208
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
2209
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
2210
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2211
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2212
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
2213
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2214
|
-
});
|
2215
|
-
};
|
2216
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
2217
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
2218
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
2219
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
2220
|
-
function step(op) {
|
2221
|
-
if (f) throw new TypeError("Generator is already executing.");
|
2222
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
2223
|
-
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;
|
2224
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
2225
|
-
switch (op[0]) {
|
2226
|
-
case 0: case 1: t = op; break;
|
2227
|
-
case 4: _.label++; return { value: op[1], done: false };
|
2228
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
2229
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
2230
|
-
default:
|
2231
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
2232
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
2233
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
2234
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
2235
|
-
if (t[2]) _.ops.pop();
|
2236
|
-
_.trys.pop(); continue;
|
2237
|
-
}
|
2238
|
-
op = body.call(thisArg, _);
|
2239
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
2240
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2241
|
-
}
|
2242
|
-
};
|
2243
|
-
var __values = (this && this.__values) || function(o) {
|
2244
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
2245
|
-
if (m) return m.call(o);
|
2246
|
-
if (o && typeof o.length === "number") return {
|
2247
|
-
next: function () {
|
2248
|
-
if (o && i >= o.length) o = void 0;
|
2249
|
-
return { value: o && o[i++], done: !o };
|
2250
|
-
}
|
2251
|
-
};
|
2252
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
2253
|
-
};
|
2254
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
2255
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
2256
|
-
};
|
2257
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
2258
|
-
exports.zip = exports.unzip = void 0;
|
2259
|
-
var promises_1 = __importDefault(__nccwpck_require__(3977));
|
2260
|
-
var fs_1 = __importDefault(__nccwpck_require__(7147));
|
2261
|
-
var node_path_1 = __importDefault(__nccwpck_require__(9411));
|
2262
|
-
var yauzl_1 = __importDefault(__nccwpck_require__(8781));
|
2263
|
-
var yazl_1 = __importDefault(__nccwpck_require__(8483));
|
2264
|
-
var node_stream_1 = __importDefault(__nccwpck_require__(4492));
|
2265
|
-
var node_util_1 = __nccwpck_require__(7261);
|
2266
|
-
var pipeline = (0, node_util_1.promisify)(node_stream_1.default.pipeline);
|
2267
|
-
function pathExists(path) {
|
2268
|
-
return __awaiter(this, void 0, void 0, function () {
|
2269
|
-
var error_1;
|
2270
|
-
return __generator(this, function (_a) {
|
2271
|
-
switch (_a.label) {
|
2272
|
-
case 0:
|
2273
|
-
_a.trys.push([0, 2, , 3]);
|
2274
|
-
return [4 /*yield*/, promises_1.default.stat(path)];
|
2275
|
-
case 1:
|
2276
|
-
_a.sent();
|
2277
|
-
return [2 /*return*/, true];
|
2278
|
-
case 2:
|
2279
|
-
error_1 = _a.sent();
|
2280
|
-
if (error_1.code === "ENOENT") {
|
2281
|
-
return [2 /*return*/, false];
|
2282
|
-
}
|
2283
|
-
throw error_1;
|
2284
|
-
case 3: return [2 /*return*/];
|
2285
|
-
}
|
2286
|
-
});
|
2287
|
-
});
|
2288
|
-
}
|
2289
|
-
// Handlings of non posix path is not implemented correctly
|
2290
|
-
// it work by coincidence. Don't have the time to fix but it should be fixed.
|
2291
|
-
function unzip(file, targetFolder, specificDirsToExtract) {
|
2292
|
-
return __awaiter(this, void 0, void 0, function () {
|
2293
|
-
var _this = this;
|
2294
|
-
return __generator(this, function (_a) {
|
2295
|
-
specificDirsToExtract = specificDirsToExtract === null || specificDirsToExtract === void 0 ? void 0 : specificDirsToExtract.map(function (dirPath) {
|
2296
|
-
if (!dirPath.endsWith("/") || !dirPath.endsWith("\\")) {
|
2297
|
-
dirPath += "/";
|
2298
|
-
}
|
2299
|
-
return dirPath;
|
2300
|
-
});
|
2301
|
-
if (!targetFolder.endsWith("/") || !targetFolder.endsWith("\\")) {
|
2302
|
-
targetFolder += "/";
|
2303
|
-
}
|
2304
|
-
if (!fs_1.default.existsSync(targetFolder)) {
|
2305
|
-
fs_1.default.mkdirSync(targetFolder, { recursive: true });
|
2306
|
-
}
|
2307
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
2308
|
-
yauzl_1.default.open(file, { lazyEntries: true }, function (err, zipfile) { return __awaiter(_this, void 0, void 0, function () {
|
2309
|
-
var _this = this;
|
2310
|
-
return __generator(this, function (_a) {
|
2311
|
-
if (err) {
|
2312
|
-
reject(err);
|
2313
|
-
return [2 /*return*/];
|
2314
|
-
}
|
2315
|
-
zipfile.readEntry();
|
2316
|
-
zipfile.on("entry", function (entry) { return __awaiter(_this, void 0, void 0, function () {
|
2317
|
-
var dirPath, target;
|
2318
|
-
var _this = this;
|
2319
|
-
return __generator(this, function (_a) {
|
2320
|
-
switch (_a.label) {
|
2321
|
-
case 0:
|
2322
|
-
if (specificDirsToExtract !== undefined) {
|
2323
|
-
dirPath = specificDirsToExtract.find(function (dirPath) { return entry.fileName.startsWith(dirPath); });
|
2324
|
-
// Skip files outside of the unzipSubPath
|
2325
|
-
if (dirPath === undefined) {
|
2326
|
-
zipfile.readEntry();
|
2327
|
-
return [2 /*return*/];
|
2328
|
-
}
|
2329
|
-
// Remove the unzipSubPath from the file name
|
2330
|
-
entry.fileName = entry.fileName.substring(dirPath.length);
|
2331
|
-
}
|
2332
|
-
target = node_path_1.default.join(targetFolder, entry.fileName);
|
2333
|
-
if (!/[\/\\]$/.test(target)) return [3 /*break*/, 2];
|
2334
|
-
return [4 /*yield*/, promises_1.default.mkdir(target, { recursive: true })];
|
2335
|
-
case 1:
|
2336
|
-
_a.sent();
|
2337
|
-
zipfile.readEntry();
|
2338
|
-
return [2 /*return*/];
|
2339
|
-
case 2: return [4 /*yield*/, pathExists(target)];
|
2340
|
-
case 3:
|
2341
|
-
// Skip existing files
|
2342
|
-
if (_a.sent()) {
|
2343
|
-
zipfile.readEntry();
|
2344
|
-
return [2 /*return*/];
|
2345
|
-
}
|
2346
|
-
zipfile.openReadStream(entry, function (err, readStream) { return __awaiter(_this, void 0, void 0, function () {
|
2347
|
-
return __generator(this, function (_a) {
|
2348
|
-
switch (_a.label) {
|
2349
|
-
case 0:
|
2350
|
-
if (err) {
|
2351
|
-
reject(err);
|
2352
|
-
return [2 /*return*/];
|
2353
|
-
}
|
2354
|
-
return [4 /*yield*/, promises_1.default.mkdir(node_path_1.default.dirname(target), { "recursive": true })];
|
2355
|
-
case 1:
|
2356
|
-
_a.sent();
|
2357
|
-
return [4 /*yield*/, pipeline(readStream, fs_1.default.createWriteStream(target))];
|
2358
|
-
case 2:
|
2359
|
-
_a.sent();
|
2360
|
-
zipfile.readEntry();
|
2361
|
-
return [2 /*return*/];
|
2362
|
-
}
|
2363
|
-
});
|
2364
|
-
}); });
|
2365
|
-
return [2 /*return*/];
|
2366
|
-
}
|
2367
|
-
});
|
2368
|
-
}); });
|
2369
|
-
zipfile.once("end", function () {
|
2370
|
-
zipfile.close();
|
2371
|
-
resolve();
|
2372
|
-
});
|
2373
|
-
return [2 /*return*/];
|
2374
|
-
});
|
2375
|
-
}); });
|
2376
|
-
})];
|
2377
|
-
});
|
2378
|
-
});
|
2379
|
-
}
|
2380
|
-
exports.unzip = unzip;
|
2381
|
-
// NOTE: This code was directly copied from ChatGPT and appears to function as expected.
|
2382
|
-
// However, confidence in its complete accuracy and robustness is limited.
|
2383
|
-
function zip(sourceFolder, targetZip) {
|
2384
|
-
return __awaiter(this, void 0, void 0, function () {
|
2385
|
-
var _this = this;
|
2386
|
-
return __generator(this, function (_a) {
|
2387
|
-
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
2388
|
-
// Recursive function to explore directories and their subdirectories
|
2389
|
-
function exploreDir(dir) {
|
2390
|
-
return __awaiter(this, void 0, void 0, function () {
|
2391
|
-
var dirContent, dirContent_1, dirContent_1_1, file, filePath, stat, e_2_1;
|
2392
|
-
var e_2, _a;
|
2393
|
-
return __generator(this, function (_b) {
|
2394
|
-
switch (_b.label) {
|
2395
|
-
case 0: return [4 /*yield*/, promises_1.default.readdir(dir)];
|
2396
|
-
case 1:
|
2397
|
-
dirContent = _b.sent();
|
2398
|
-
_b.label = 2;
|
2399
|
-
case 2:
|
2400
|
-
_b.trys.push([2, 9, 10, 11]);
|
2401
|
-
dirContent_1 = __values(dirContent), dirContent_1_1 = dirContent_1.next();
|
2402
|
-
_b.label = 3;
|
2403
|
-
case 3:
|
2404
|
-
if (!!dirContent_1_1.done) return [3 /*break*/, 8];
|
2405
|
-
file = dirContent_1_1.value;
|
2406
|
-
filePath = node_path_1.default.join(dir, file);
|
2407
|
-
return [4 /*yield*/, promises_1.default.stat(filePath)];
|
2408
|
-
case 4:
|
2409
|
-
stat = _b.sent();
|
2410
|
-
if (!stat.isDirectory()) return [3 /*break*/, 6];
|
2411
|
-
return [4 /*yield*/, exploreDir(filePath)];
|
2412
|
-
case 5:
|
2413
|
-
_b.sent();
|
2414
|
-
return [3 /*break*/, 7];
|
2415
|
-
case 6:
|
2416
|
-
if (stat.isFile()) {
|
2417
|
-
files.push(filePath);
|
2418
|
-
}
|
2419
|
-
_b.label = 7;
|
2420
|
-
case 7:
|
2421
|
-
dirContent_1_1 = dirContent_1.next();
|
2422
|
-
return [3 /*break*/, 3];
|
2423
|
-
case 8: return [3 /*break*/, 11];
|
2424
|
-
case 9:
|
2425
|
-
e_2_1 = _b.sent();
|
2426
|
-
e_2 = { error: e_2_1 };
|
2427
|
-
return [3 /*break*/, 11];
|
2428
|
-
case 10:
|
2429
|
-
try {
|
2430
|
-
if (dirContent_1_1 && !dirContent_1_1.done && (_a = dirContent_1.return)) _a.call(dirContent_1);
|
2431
|
-
}
|
2432
|
-
finally { if (e_2) throw e_2.error; }
|
2433
|
-
return [7 /*endfinally*/];
|
2434
|
-
case 11: return [2 /*return*/];
|
2435
|
-
}
|
2436
|
-
});
|
2437
|
-
});
|
2438
|
-
}
|
2439
|
-
var zipfile, files, files_1, files_1_1, file, relativePath;
|
2440
|
-
var e_1, _a;
|
2441
|
-
return __generator(this, function (_b) {
|
2442
|
-
switch (_b.label) {
|
2443
|
-
case 0:
|
2444
|
-
zipfile = new yazl_1.default.ZipFile();
|
2445
|
-
files = [];
|
2446
|
-
// Collecting all files to be zipped
|
2447
|
-
return [4 /*yield*/, exploreDir(sourceFolder)];
|
2448
|
-
case 1:
|
2449
|
-
// Collecting all files to be zipped
|
2450
|
-
_b.sent();
|
2451
|
-
try {
|
2452
|
-
// Adding files to zip
|
2453
|
-
for (files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
|
2454
|
-
file = files_1_1.value;
|
2455
|
-
relativePath = node_path_1.default.relative(sourceFolder, file);
|
2456
|
-
zipfile.addFile(file, relativePath);
|
2457
|
-
}
|
2458
|
-
}
|
2459
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
2460
|
-
finally {
|
2461
|
-
try {
|
2462
|
-
if (files_1_1 && !files_1_1.done && (_a = files_1.return)) _a.call(files_1);
|
2463
|
-
}
|
2464
|
-
finally { if (e_1) throw e_1.error; }
|
2465
|
-
}
|
2466
|
-
zipfile.outputStream
|
2467
|
-
.pipe(fs_1.default.createWriteStream(targetZip))
|
2468
|
-
.on("close", function () { return resolve(); })
|
2469
|
-
.on("error", function (err) { return reject(err); }); // Listen to error events
|
2470
|
-
zipfile.end();
|
2471
|
-
return [2 /*return*/];
|
2472
|
-
}
|
2473
|
-
});
|
2474
|
-
}); })];
|
2475
|
-
});
|
2476
|
-
});
|
2477
|
-
}
|
2478
|
-
exports.zip = zip;
|
2479
|
-
//# sourceMappingURL=unzip.js.map
|
2480
|
-
|
2481
|
-
/***/ }),
|
2482
|
-
|
2483
2557
|
/***/ 7508:
|
2484
2558
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
2485
2559
|
|
@@ -2531,8 +2605,8 @@ function keycloakify(params) {
|
|
2531
2605
|
let command = undefined;
|
2532
2606
|
let shouldGenerateSourcemap = undefined;
|
2533
2607
|
const plugin = {
|
2534
|
-
|
2535
|
-
|
2608
|
+
name: "keycloakify",
|
2609
|
+
configResolved: async (resolvedConfig) => {
|
2536
2610
|
shouldGenerateSourcemap = resolvedConfig.build.sourcemap !== false;
|
2537
2611
|
run_post_build_script_case: {
|
2538
2612
|
const envValue = process.env[constants_1.vitePluginSubScriptEnvNames.runPostBuildScript];
|
@@ -2548,7 +2622,9 @@ function keycloakify(params) {
|
|
2548
2622
|
urlPathname = (() => {
|
2549
2623
|
var _a;
|
2550
2624
|
let out = resolvedConfig.env.BASE_URL;
|
2551
|
-
if (out.startsWith(".") &&
|
2625
|
+
if (out.startsWith(".") &&
|
2626
|
+
command === "build" &&
|
2627
|
+
((_a = resolvedConfig.envPrefix) === null || _a === void 0 ? void 0 : _a.includes("STORYBOOK_")) !== true) {
|
2552
2628
|
throw new Error([
|
2553
2629
|
`BASE_URL=${out} is not supported By Keycloakify. Use an absolute path instead.`,
|
2554
2630
|
`If this is a problem, please open an issue at https://github.com/keycloakify/keycloakify/issues/new`
|
@@ -2573,23 +2649,23 @@ function keycloakify(params) {
|
|
2573
2649
|
}
|
2574
2650
|
console.log(constants_1.vitePluginSubScriptEnvNames.resolveViteConfig);
|
2575
2651
|
console.log(JSON.stringify((0, id_1.id)({
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2652
|
+
publicDir: (0, path_1.relative)(reactAppRootDirPath, resolvedConfig.publicDir),
|
2653
|
+
assetsDir: resolvedConfig.build.assetsDir,
|
2654
|
+
buildDir: resolvedConfig.build.outDir,
|
2579
2655
|
urlPathname,
|
2580
2656
|
userProvidedBuildOptions
|
2581
2657
|
})));
|
2582
2658
|
process.exit(0);
|
2583
2659
|
}
|
2584
2660
|
await (0, copyKeycloakResourcesToPublic_1.copyKeycloakResourcesToPublic)({
|
2585
|
-
|
2586
|
-
|
2661
|
+
buildOptions: (0, buildOptions_1.readBuildOptions)({
|
2662
|
+
cliCommandOptions: {
|
2587
2663
|
reactAppRootDirPath
|
2588
2664
|
}
|
2589
2665
|
})
|
2590
2666
|
});
|
2591
2667
|
},
|
2592
|
-
|
2668
|
+
transform: (code, id) => {
|
2593
2669
|
(0, assert_1.assert)(command !== undefined);
|
2594
2670
|
(0, assert_1.assert)(shouldGenerateSourcemap !== undefined);
|
2595
2671
|
if (command !== "build") {
|
@@ -2624,22 +2700,25 @@ function keycloakify(params) {
|
|
2624
2700
|
return transformedCode.toString();
|
2625
2701
|
}
|
2626
2702
|
const map = transformedCode.generateMap({
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2703
|
+
source: id,
|
2704
|
+
includeContent: true,
|
2705
|
+
hires: true
|
2630
2706
|
});
|
2631
2707
|
return {
|
2632
|
-
|
2633
|
-
|
2708
|
+
code: transformedCode.toString(),
|
2709
|
+
map: map.toString()
|
2634
2710
|
};
|
2635
2711
|
},
|
2636
|
-
|
2712
|
+
closeBundle: async () => {
|
2637
2713
|
(0, assert_1.assert)(command !== undefined);
|
2638
2714
|
if (command !== "build") {
|
2639
2715
|
return;
|
2640
2716
|
}
|
2641
2717
|
(0, assert_1.assert)(buildDirPath !== undefined);
|
2642
|
-
await (0, fs_rm_1.rm)((0, path_1.join)(buildDirPath, constants_1.keycloak_resources), {
|
2718
|
+
await (0, fs_rm_1.rm)((0, path_1.join)(buildDirPath, constants_1.keycloak_resources), {
|
2719
|
+
recursive: true,
|
2720
|
+
force: true
|
2721
|
+
});
|
2643
2722
|
}
|
2644
2723
|
};
|
2645
2724
|
return plugin;
|
@@ -14538,6 +14617,63 @@ function createError(err, code, props) {
|
|
14538
14617
|
module.exports = createError;
|
14539
14618
|
|
14540
14619
|
|
14620
|
+
/***/ }),
|
14621
|
+
|
14622
|
+
/***/ 689:
|
14623
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
14624
|
+
|
14625
|
+
"use strict";
|
14626
|
+
|
14627
|
+
var __extends = (this && this.__extends) || (function () {
|
14628
|
+
var extendStatics = function (d, b) {
|
14629
|
+
extendStatics = Object.setPrototypeOf ||
|
14630
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
14631
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
14632
|
+
return extendStatics(d, b);
|
14633
|
+
};
|
14634
|
+
return function (d, b) {
|
14635
|
+
if (typeof b !== "function" && b !== null)
|
14636
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
14637
|
+
extendStatics(d, b);
|
14638
|
+
function __() { this.constructor = d; }
|
14639
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14640
|
+
};
|
14641
|
+
})();
|
14642
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
14643
|
+
exports.VoidDeferred = exports.Deferred = void 0;
|
14644
|
+
var overwriteReadonlyProp_1 = __nccwpck_require__(7803);
|
14645
|
+
var Deferred = /** @class */ (function () {
|
14646
|
+
function Deferred() {
|
14647
|
+
var _this_1 = this;
|
14648
|
+
this.isPending = true;
|
14649
|
+
var resolve;
|
14650
|
+
var reject;
|
14651
|
+
this.pr = new Promise(function (resolve_, reject_) {
|
14652
|
+
resolve = function (value) {
|
14653
|
+
(0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
|
14654
|
+
resolve_(value);
|
14655
|
+
};
|
14656
|
+
reject = function (error) {
|
14657
|
+
(0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this_1, "isPending", false);
|
14658
|
+
reject_(error);
|
14659
|
+
};
|
14660
|
+
});
|
14661
|
+
this.resolve = resolve;
|
14662
|
+
this.reject = reject;
|
14663
|
+
}
|
14664
|
+
return Deferred;
|
14665
|
+
}());
|
14666
|
+
exports.Deferred = Deferred;
|
14667
|
+
var VoidDeferred = /** @class */ (function (_super) {
|
14668
|
+
__extends(VoidDeferred, _super);
|
14669
|
+
function VoidDeferred() {
|
14670
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
14671
|
+
}
|
14672
|
+
return VoidDeferred;
|
14673
|
+
}(Deferred));
|
14674
|
+
exports.VoidDeferred = VoidDeferred;
|
14675
|
+
//# sourceMappingURL=Deferred.js.map
|
14676
|
+
|
14541
14677
|
/***/ }),
|
14542
14678
|
|
14543
14679
|
/***/ 5010:
|
@@ -34558,762 +34694,6 @@ function defaultCallback(err) {
|
|
34558
34694
|
}
|
34559
34695
|
|
34560
34696
|
|
34561
|
-
/***/ }),
|
34562
|
-
|
34563
|
-
/***/ 8483:
|
34564
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
34565
|
-
|
34566
|
-
var fs = __nccwpck_require__(7147);
|
34567
|
-
var Transform = (__nccwpck_require__(2781).Transform);
|
34568
|
-
var PassThrough = (__nccwpck_require__(2781).PassThrough);
|
34569
|
-
var zlib = __nccwpck_require__(9796);
|
34570
|
-
var util = __nccwpck_require__(3837);
|
34571
|
-
var EventEmitter = (__nccwpck_require__(2361).EventEmitter);
|
34572
|
-
var crc32 = __nccwpck_require__(4794);
|
34573
|
-
|
34574
|
-
exports.ZipFile = ZipFile;
|
34575
|
-
exports.dateToDosDateTime = dateToDosDateTime;
|
34576
|
-
|
34577
|
-
util.inherits(ZipFile, EventEmitter);
|
34578
|
-
function ZipFile() {
|
34579
|
-
this.outputStream = new PassThrough();
|
34580
|
-
this.entries = [];
|
34581
|
-
this.outputStreamCursor = 0;
|
34582
|
-
this.ended = false; // .end() sets this
|
34583
|
-
this.allDone = false; // set when we've written the last bytes
|
34584
|
-
this.forceZip64Eocd = false; // configurable in .end()
|
34585
|
-
}
|
34586
|
-
|
34587
|
-
ZipFile.prototype.addFile = function(realPath, metadataPath, options) {
|
34588
|
-
var self = this;
|
34589
|
-
metadataPath = validateMetadataPath(metadataPath, false);
|
34590
|
-
if (options == null) options = {};
|
34591
|
-
|
34592
|
-
var entry = new Entry(metadataPath, false, options);
|
34593
|
-
self.entries.push(entry);
|
34594
|
-
fs.stat(realPath, function(err, stats) {
|
34595
|
-
if (err) return self.emit("error", err);
|
34596
|
-
if (!stats.isFile()) return self.emit("error", new Error("not a file: " + realPath));
|
34597
|
-
entry.uncompressedSize = stats.size;
|
34598
|
-
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
34599
|
-
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
34600
|
-
entry.setFileDataPumpFunction(function() {
|
34601
|
-
var readStream = fs.createReadStream(realPath);
|
34602
|
-
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
34603
|
-
readStream.on("error", function(err) {
|
34604
|
-
self.emit("error", err);
|
34605
|
-
});
|
34606
|
-
pumpFileDataReadStream(self, entry, readStream);
|
34607
|
-
});
|
34608
|
-
pumpEntries(self);
|
34609
|
-
});
|
34610
|
-
};
|
34611
|
-
|
34612
|
-
ZipFile.prototype.addReadStream = function(readStream, metadataPath, options) {
|
34613
|
-
var self = this;
|
34614
|
-
metadataPath = validateMetadataPath(metadataPath, false);
|
34615
|
-
if (options == null) options = {};
|
34616
|
-
var entry = new Entry(metadataPath, false, options);
|
34617
|
-
self.entries.push(entry);
|
34618
|
-
entry.setFileDataPumpFunction(function() {
|
34619
|
-
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
34620
|
-
pumpFileDataReadStream(self, entry, readStream);
|
34621
|
-
});
|
34622
|
-
pumpEntries(self);
|
34623
|
-
};
|
34624
|
-
|
34625
|
-
ZipFile.prototype.addBuffer = function(buffer, metadataPath, options) {
|
34626
|
-
var self = this;
|
34627
|
-
metadataPath = validateMetadataPath(metadataPath, false);
|
34628
|
-
if (buffer.length > 0x3fffffff) throw new Error("buffer too large: " + buffer.length + " > " + 0x3fffffff);
|
34629
|
-
if (options == null) options = {};
|
34630
|
-
if (options.size != null) throw new Error("options.size not allowed");
|
34631
|
-
var entry = new Entry(metadataPath, false, options);
|
34632
|
-
entry.uncompressedSize = buffer.length;
|
34633
|
-
entry.crc32 = crc32.unsigned(buffer);
|
34634
|
-
entry.crcAndFileSizeKnown = true;
|
34635
|
-
self.entries.push(entry);
|
34636
|
-
if (!entry.compress) {
|
34637
|
-
setCompressedBuffer(buffer);
|
34638
|
-
} else {
|
34639
|
-
zlib.deflateRaw(buffer, function(err, compressedBuffer) {
|
34640
|
-
setCompressedBuffer(compressedBuffer);
|
34641
|
-
});
|
34642
|
-
}
|
34643
|
-
function setCompressedBuffer(compressedBuffer) {
|
34644
|
-
entry.compressedSize = compressedBuffer.length;
|
34645
|
-
entry.setFileDataPumpFunction(function() {
|
34646
|
-
writeToOutputStream(self, compressedBuffer);
|
34647
|
-
writeToOutputStream(self, entry.getDataDescriptor());
|
34648
|
-
entry.state = Entry.FILE_DATA_DONE;
|
34649
|
-
|
34650
|
-
// don't call pumpEntries() recursively.
|
34651
|
-
// (also, don't call process.nextTick recursively.)
|
34652
|
-
setImmediate(function() {
|
34653
|
-
pumpEntries(self);
|
34654
|
-
});
|
34655
|
-
});
|
34656
|
-
pumpEntries(self);
|
34657
|
-
}
|
34658
|
-
};
|
34659
|
-
|
34660
|
-
ZipFile.prototype.addEmptyDirectory = function(metadataPath, options) {
|
34661
|
-
var self = this;
|
34662
|
-
metadataPath = validateMetadataPath(metadataPath, true);
|
34663
|
-
if (options == null) options = {};
|
34664
|
-
if (options.size != null) throw new Error("options.size not allowed");
|
34665
|
-
if (options.compress != null) throw new Error("options.compress not allowed");
|
34666
|
-
var entry = new Entry(metadataPath, true, options);
|
34667
|
-
self.entries.push(entry);
|
34668
|
-
entry.setFileDataPumpFunction(function() {
|
34669
|
-
writeToOutputStream(self, entry.getDataDescriptor());
|
34670
|
-
entry.state = Entry.FILE_DATA_DONE;
|
34671
|
-
pumpEntries(self);
|
34672
|
-
});
|
34673
|
-
pumpEntries(self);
|
34674
|
-
};
|
34675
|
-
|
34676
|
-
var eocdrSignatureBuffer = bufferFrom([0x50, 0x4b, 0x05, 0x06]);
|
34677
|
-
|
34678
|
-
ZipFile.prototype.end = function(options, finalSizeCallback) {
|
34679
|
-
if (typeof options === "function") {
|
34680
|
-
finalSizeCallback = options;
|
34681
|
-
options = null;
|
34682
|
-
}
|
34683
|
-
if (options == null) options = {};
|
34684
|
-
if (this.ended) return;
|
34685
|
-
this.ended = true;
|
34686
|
-
this.finalSizeCallback = finalSizeCallback;
|
34687
|
-
this.forceZip64Eocd = !!options.forceZip64Format;
|
34688
|
-
if (options.comment) {
|
34689
|
-
if (typeof options.comment === "string") {
|
34690
|
-
this.comment = encodeCp437(options.comment);
|
34691
|
-
} else {
|
34692
|
-
// It should be a Buffer
|
34693
|
-
this.comment = options.comment;
|
34694
|
-
}
|
34695
|
-
if (this.comment.length > 0xffff) throw new Error("comment is too large");
|
34696
|
-
// gotta check for this, because the zipfile format is actually ambiguous.
|
34697
|
-
if (bufferIncludes(this.comment, eocdrSignatureBuffer)) throw new Error("comment contains end of central directory record signature");
|
34698
|
-
} else {
|
34699
|
-
// no comment.
|
34700
|
-
this.comment = EMPTY_BUFFER;
|
34701
|
-
}
|
34702
|
-
pumpEntries(this);
|
34703
|
-
};
|
34704
|
-
|
34705
|
-
function writeToOutputStream(self, buffer) {
|
34706
|
-
self.outputStream.write(buffer);
|
34707
|
-
self.outputStreamCursor += buffer.length;
|
34708
|
-
}
|
34709
|
-
|
34710
|
-
function pumpFileDataReadStream(self, entry, readStream) {
|
34711
|
-
var crc32Watcher = new Crc32Watcher();
|
34712
|
-
var uncompressedSizeCounter = new ByteCounter();
|
34713
|
-
var compressor = entry.compress ? new zlib.DeflateRaw() : new PassThrough();
|
34714
|
-
var compressedSizeCounter = new ByteCounter();
|
34715
|
-
readStream.pipe(crc32Watcher)
|
34716
|
-
.pipe(uncompressedSizeCounter)
|
34717
|
-
.pipe(compressor)
|
34718
|
-
.pipe(compressedSizeCounter)
|
34719
|
-
.pipe(self.outputStream, {end: false});
|
34720
|
-
compressedSizeCounter.on("end", function() {
|
34721
|
-
entry.crc32 = crc32Watcher.crc32;
|
34722
|
-
if (entry.uncompressedSize == null) {
|
34723
|
-
entry.uncompressedSize = uncompressedSizeCounter.byteCount;
|
34724
|
-
} else {
|
34725
|
-
if (entry.uncompressedSize !== uncompressedSizeCounter.byteCount) return self.emit("error", new Error("file data stream has unexpected number of bytes"));
|
34726
|
-
}
|
34727
|
-
entry.compressedSize = compressedSizeCounter.byteCount;
|
34728
|
-
self.outputStreamCursor += entry.compressedSize;
|
34729
|
-
writeToOutputStream(self, entry.getDataDescriptor());
|
34730
|
-
entry.state = Entry.FILE_DATA_DONE;
|
34731
|
-
pumpEntries(self);
|
34732
|
-
});
|
34733
|
-
}
|
34734
|
-
|
34735
|
-
function pumpEntries(self) {
|
34736
|
-
if (self.allDone) return;
|
34737
|
-
// first check if finalSize is finally known
|
34738
|
-
if (self.ended && self.finalSizeCallback != null) {
|
34739
|
-
var finalSize = calculateFinalSize(self);
|
34740
|
-
if (finalSize != null) {
|
34741
|
-
// we have an answer
|
34742
|
-
self.finalSizeCallback(finalSize);
|
34743
|
-
self.finalSizeCallback = null;
|
34744
|
-
}
|
34745
|
-
}
|
34746
|
-
|
34747
|
-
// pump entries
|
34748
|
-
var entry = getFirstNotDoneEntry();
|
34749
|
-
function getFirstNotDoneEntry() {
|
34750
|
-
for (var i = 0; i < self.entries.length; i++) {
|
34751
|
-
var entry = self.entries[i];
|
34752
|
-
if (entry.state < Entry.FILE_DATA_DONE) return entry;
|
34753
|
-
}
|
34754
|
-
return null;
|
34755
|
-
}
|
34756
|
-
if (entry != null) {
|
34757
|
-
// this entry is not done yet
|
34758
|
-
if (entry.state < Entry.READY_TO_PUMP_FILE_DATA) return; // input file not open yet
|
34759
|
-
if (entry.state === Entry.FILE_DATA_IN_PROGRESS) return; // we'll get there
|
34760
|
-
// start with local file header
|
34761
|
-
entry.relativeOffsetOfLocalHeader = self.outputStreamCursor;
|
34762
|
-
var localFileHeader = entry.getLocalFileHeader();
|
34763
|
-
writeToOutputStream(self, localFileHeader);
|
34764
|
-
entry.doFileDataPump();
|
34765
|
-
} else {
|
34766
|
-
// all cought up on writing entries
|
34767
|
-
if (self.ended) {
|
34768
|
-
// head for the exit
|
34769
|
-
self.offsetOfStartOfCentralDirectory = self.outputStreamCursor;
|
34770
|
-
self.entries.forEach(function(entry) {
|
34771
|
-
var centralDirectoryRecord = entry.getCentralDirectoryRecord();
|
34772
|
-
writeToOutputStream(self, centralDirectoryRecord);
|
34773
|
-
});
|
34774
|
-
writeToOutputStream(self, getEndOfCentralDirectoryRecord(self));
|
34775
|
-
self.outputStream.end();
|
34776
|
-
self.allDone = true;
|
34777
|
-
}
|
34778
|
-
}
|
34779
|
-
}
|
34780
|
-
|
34781
|
-
function calculateFinalSize(self) {
|
34782
|
-
var pretendOutputCursor = 0;
|
34783
|
-
var centralDirectorySize = 0;
|
34784
|
-
for (var i = 0; i < self.entries.length; i++) {
|
34785
|
-
var entry = self.entries[i];
|
34786
|
-
// compression is too hard to predict
|
34787
|
-
if (entry.compress) return -1;
|
34788
|
-
if (entry.state >= Entry.READY_TO_PUMP_FILE_DATA) {
|
34789
|
-
// if addReadStream was called without providing the size, we can't predict the final size
|
34790
|
-
if (entry.uncompressedSize == null) return -1;
|
34791
|
-
} else {
|
34792
|
-
// if we're still waiting for fs.stat, we might learn the size someday
|
34793
|
-
if (entry.uncompressedSize == null) return null;
|
34794
|
-
}
|
34795
|
-
// we know this for sure, and this is important to know if we need ZIP64 format.
|
34796
|
-
entry.relativeOffsetOfLocalHeader = pretendOutputCursor;
|
34797
|
-
var useZip64Format = entry.useZip64Format();
|
34798
|
-
|
34799
|
-
pretendOutputCursor += LOCAL_FILE_HEADER_FIXED_SIZE + entry.utf8FileName.length;
|
34800
|
-
pretendOutputCursor += entry.uncompressedSize;
|
34801
|
-
if (!entry.crcAndFileSizeKnown) {
|
34802
|
-
// use a data descriptor
|
34803
|
-
if (useZip64Format) {
|
34804
|
-
pretendOutputCursor += ZIP64_DATA_DESCRIPTOR_SIZE;
|
34805
|
-
} else {
|
34806
|
-
pretendOutputCursor += DATA_DESCRIPTOR_SIZE;
|
34807
|
-
}
|
34808
|
-
}
|
34809
|
-
|
34810
|
-
centralDirectorySize += CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length + entry.fileComment.length;
|
34811
|
-
if (useZip64Format) {
|
34812
|
-
centralDirectorySize += ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE;
|
34813
|
-
}
|
34814
|
-
}
|
34815
|
-
|
34816
|
-
var endOfCentralDirectorySize = 0;
|
34817
|
-
if (self.forceZip64Eocd ||
|
34818
|
-
self.entries.length >= 0xffff ||
|
34819
|
-
centralDirectorySize >= 0xffff ||
|
34820
|
-
pretendOutputCursor >= 0xffffffff) {
|
34821
|
-
// use zip64 end of central directory stuff
|
34822
|
-
endOfCentralDirectorySize += ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE;
|
34823
|
-
}
|
34824
|
-
endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length;
|
34825
|
-
return pretendOutputCursor + centralDirectorySize + endOfCentralDirectorySize;
|
34826
|
-
}
|
34827
|
-
|
34828
|
-
var ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 56;
|
34829
|
-
var ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE = 20;
|
34830
|
-
var END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 22;
|
34831
|
-
function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe) {
|
34832
|
-
var needZip64Format = false;
|
34833
|
-
var normalEntriesLength = self.entries.length;
|
34834
|
-
if (self.forceZip64Eocd || self.entries.length >= 0xffff) {
|
34835
|
-
normalEntriesLength = 0xffff;
|
34836
|
-
needZip64Format = true;
|
34837
|
-
}
|
34838
|
-
var sizeOfCentralDirectory = self.outputStreamCursor - self.offsetOfStartOfCentralDirectory;
|
34839
|
-
var normalSizeOfCentralDirectory = sizeOfCentralDirectory;
|
34840
|
-
if (self.forceZip64Eocd || sizeOfCentralDirectory >= 0xffffffff) {
|
34841
|
-
normalSizeOfCentralDirectory = 0xffffffff;
|
34842
|
-
needZip64Format = true;
|
34843
|
-
}
|
34844
|
-
var normalOffsetOfStartOfCentralDirectory = self.offsetOfStartOfCentralDirectory;
|
34845
|
-
if (self.forceZip64Eocd || self.offsetOfStartOfCentralDirectory >= 0xffffffff) {
|
34846
|
-
normalOffsetOfStartOfCentralDirectory = 0xffffffff;
|
34847
|
-
needZip64Format = true;
|
34848
|
-
}
|
34849
|
-
if (actuallyJustTellMeHowLongItWouldBe) {
|
34850
|
-
if (needZip64Format) {
|
34851
|
-
return (
|
34852
|
-
ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE +
|
34853
|
-
ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE +
|
34854
|
-
END_OF_CENTRAL_DIRECTORY_RECORD_SIZE
|
34855
|
-
);
|
34856
|
-
} else {
|
34857
|
-
return END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
|
34858
|
-
}
|
34859
|
-
}
|
34860
|
-
|
34861
|
-
var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length);
|
34862
|
-
// end of central dir signature 4 bytes (0x06054b50)
|
34863
|
-
eocdrBuffer.writeUInt32LE(0x06054b50, 0);
|
34864
|
-
// number of this disk 2 bytes
|
34865
|
-
eocdrBuffer.writeUInt16LE(0, 4);
|
34866
|
-
// number of the disk with the start of the central directory 2 bytes
|
34867
|
-
eocdrBuffer.writeUInt16LE(0, 6);
|
34868
|
-
// total number of entries in the central directory on this disk 2 bytes
|
34869
|
-
eocdrBuffer.writeUInt16LE(normalEntriesLength, 8);
|
34870
|
-
// total number of entries in the central directory 2 bytes
|
34871
|
-
eocdrBuffer.writeUInt16LE(normalEntriesLength, 10);
|
34872
|
-
// size of the central directory 4 bytes
|
34873
|
-
eocdrBuffer.writeUInt32LE(normalSizeOfCentralDirectory, 12);
|
34874
|
-
// offset of start of central directory with respect to the starting disk number 4 bytes
|
34875
|
-
eocdrBuffer.writeUInt32LE(normalOffsetOfStartOfCentralDirectory, 16);
|
34876
|
-
// .ZIP file comment length 2 bytes
|
34877
|
-
eocdrBuffer.writeUInt16LE(self.comment.length, 20);
|
34878
|
-
// .ZIP file comment (variable size)
|
34879
|
-
self.comment.copy(eocdrBuffer, 22);
|
34880
|
-
|
34881
|
-
if (!needZip64Format) return eocdrBuffer;
|
34882
|
-
|
34883
|
-
// ZIP64 format
|
34884
|
-
// ZIP64 End of Central Directory Record
|
34885
|
-
var zip64EocdrBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE);
|
34886
|
-
// zip64 end of central dir signature 4 bytes (0x06064b50)
|
34887
|
-
zip64EocdrBuffer.writeUInt32LE(0x06064b50, 0);
|
34888
|
-
// size of zip64 end of central directory record 8 bytes
|
34889
|
-
writeUInt64LE(zip64EocdrBuffer, ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE - 12, 4);
|
34890
|
-
// version made by 2 bytes
|
34891
|
-
zip64EocdrBuffer.writeUInt16LE(VERSION_MADE_BY, 12);
|
34892
|
-
// version needed to extract 2 bytes
|
34893
|
-
zip64EocdrBuffer.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_ZIP64, 14);
|
34894
|
-
// number of this disk 4 bytes
|
34895
|
-
zip64EocdrBuffer.writeUInt32LE(0, 16);
|
34896
|
-
// number of the disk with the start of the central directory 4 bytes
|
34897
|
-
zip64EocdrBuffer.writeUInt32LE(0, 20);
|
34898
|
-
// total number of entries in the central directory on this disk 8 bytes
|
34899
|
-
writeUInt64LE(zip64EocdrBuffer, self.entries.length, 24);
|
34900
|
-
// total number of entries in the central directory 8 bytes
|
34901
|
-
writeUInt64LE(zip64EocdrBuffer, self.entries.length, 32);
|
34902
|
-
// size of the central directory 8 bytes
|
34903
|
-
writeUInt64LE(zip64EocdrBuffer, sizeOfCentralDirectory, 40);
|
34904
|
-
// offset of start of central directory with respect to the starting disk number 8 bytes
|
34905
|
-
writeUInt64LE(zip64EocdrBuffer, self.offsetOfStartOfCentralDirectory, 48);
|
34906
|
-
// zip64 extensible data sector (variable size)
|
34907
|
-
// nothing in the zip64 extensible data sector
|
34908
|
-
|
34909
|
-
|
34910
|
-
// ZIP64 End of Central Directory Locator
|
34911
|
-
var zip64EocdlBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE);
|
34912
|
-
// zip64 end of central dir locator signature 4 bytes (0x07064b50)
|
34913
|
-
zip64EocdlBuffer.writeUInt32LE(0x07064b50, 0);
|
34914
|
-
// number of the disk with the start of the zip64 end of central directory 4 bytes
|
34915
|
-
zip64EocdlBuffer.writeUInt32LE(0, 4);
|
34916
|
-
// relative offset of the zip64 end of central directory record 8 bytes
|
34917
|
-
writeUInt64LE(zip64EocdlBuffer, self.outputStreamCursor, 8);
|
34918
|
-
// total number of disks 4 bytes
|
34919
|
-
zip64EocdlBuffer.writeUInt32LE(1, 16);
|
34920
|
-
|
34921
|
-
|
34922
|
-
return Buffer.concat([
|
34923
|
-
zip64EocdrBuffer,
|
34924
|
-
zip64EocdlBuffer,
|
34925
|
-
eocdrBuffer,
|
34926
|
-
]);
|
34927
|
-
}
|
34928
|
-
|
34929
|
-
function validateMetadataPath(metadataPath, isDirectory) {
|
34930
|
-
if (metadataPath === "") throw new Error("empty metadataPath");
|
34931
|
-
metadataPath = metadataPath.replace(/\\/g, "/");
|
34932
|
-
if (/^[a-zA-Z]:/.test(metadataPath) || /^\//.test(metadataPath)) throw new Error("absolute path: " + metadataPath);
|
34933
|
-
if (metadataPath.split("/").indexOf("..") !== -1) throw new Error("invalid relative path: " + metadataPath);
|
34934
|
-
var looksLikeDirectory = /\/$/.test(metadataPath);
|
34935
|
-
if (isDirectory) {
|
34936
|
-
// append a trailing '/' if necessary.
|
34937
|
-
if (!looksLikeDirectory) metadataPath += "/";
|
34938
|
-
} else {
|
34939
|
-
if (looksLikeDirectory) throw new Error("file path cannot end with '/': " + metadataPath);
|
34940
|
-
}
|
34941
|
-
return metadataPath;
|
34942
|
-
}
|
34943
|
-
|
34944
|
-
var EMPTY_BUFFER = bufferAlloc(0);
|
34945
|
-
|
34946
|
-
// this class is not part of the public API
|
34947
|
-
function Entry(metadataPath, isDirectory, options) {
|
34948
|
-
this.utf8FileName = bufferFrom(metadataPath);
|
34949
|
-
if (this.utf8FileName.length > 0xffff) throw new Error("utf8 file name too long. " + utf8FileName.length + " > " + 0xffff);
|
34950
|
-
this.isDirectory = isDirectory;
|
34951
|
-
this.state = Entry.WAITING_FOR_METADATA;
|
34952
|
-
this.setLastModDate(options.mtime != null ? options.mtime : new Date());
|
34953
|
-
if (options.mode != null) {
|
34954
|
-
this.setFileAttributesMode(options.mode);
|
34955
|
-
} else {
|
34956
|
-
this.setFileAttributesMode(isDirectory ? 0o40775 : 0o100664);
|
34957
|
-
}
|
34958
|
-
if (isDirectory) {
|
34959
|
-
this.crcAndFileSizeKnown = true;
|
34960
|
-
this.crc32 = 0;
|
34961
|
-
this.uncompressedSize = 0;
|
34962
|
-
this.compressedSize = 0;
|
34963
|
-
} else {
|
34964
|
-
// unknown so far
|
34965
|
-
this.crcAndFileSizeKnown = false;
|
34966
|
-
this.crc32 = null;
|
34967
|
-
this.uncompressedSize = null;
|
34968
|
-
this.compressedSize = null;
|
34969
|
-
if (options.size != null) this.uncompressedSize = options.size;
|
34970
|
-
}
|
34971
|
-
if (isDirectory) {
|
34972
|
-
this.compress = false;
|
34973
|
-
} else {
|
34974
|
-
this.compress = true; // default
|
34975
|
-
if (options.compress != null) this.compress = !!options.compress;
|
34976
|
-
}
|
34977
|
-
this.forceZip64Format = !!options.forceZip64Format;
|
34978
|
-
if (options.fileComment) {
|
34979
|
-
if (typeof options.fileComment === "string") {
|
34980
|
-
this.fileComment = bufferFrom(options.fileComment, "utf-8");
|
34981
|
-
} else {
|
34982
|
-
// It should be a Buffer
|
34983
|
-
this.fileComment = options.fileComment;
|
34984
|
-
}
|
34985
|
-
if (this.fileComment.length > 0xffff) throw new Error("fileComment is too large");
|
34986
|
-
} else {
|
34987
|
-
// no comment.
|
34988
|
-
this.fileComment = EMPTY_BUFFER;
|
34989
|
-
}
|
34990
|
-
}
|
34991
|
-
Entry.WAITING_FOR_METADATA = 0;
|
34992
|
-
Entry.READY_TO_PUMP_FILE_DATA = 1;
|
34993
|
-
Entry.FILE_DATA_IN_PROGRESS = 2;
|
34994
|
-
Entry.FILE_DATA_DONE = 3;
|
34995
|
-
Entry.prototype.setLastModDate = function(date) {
|
34996
|
-
var dosDateTime = dateToDosDateTime(date);
|
34997
|
-
this.lastModFileTime = dosDateTime.time;
|
34998
|
-
this.lastModFileDate = dosDateTime.date;
|
34999
|
-
};
|
35000
|
-
Entry.prototype.setFileAttributesMode = function(mode) {
|
35001
|
-
if ((mode & 0xffff) !== mode) throw new Error("invalid mode. expected: 0 <= " + mode + " <= " + 0xffff);
|
35002
|
-
// http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute/14727#14727
|
35003
|
-
this.externalFileAttributes = (mode << 16) >>> 0;
|
35004
|
-
};
|
35005
|
-
// doFileDataPump() should not call pumpEntries() directly. see issue #9.
|
35006
|
-
Entry.prototype.setFileDataPumpFunction = function(doFileDataPump) {
|
35007
|
-
this.doFileDataPump = doFileDataPump;
|
35008
|
-
this.state = Entry.READY_TO_PUMP_FILE_DATA;
|
35009
|
-
};
|
35010
|
-
Entry.prototype.useZip64Format = function() {
|
35011
|
-
return (
|
35012
|
-
(this.forceZip64Format) ||
|
35013
|
-
(this.uncompressedSize != null && this.uncompressedSize > 0xfffffffe) ||
|
35014
|
-
(this.compressedSize != null && this.compressedSize > 0xfffffffe) ||
|
35015
|
-
(this.relativeOffsetOfLocalHeader != null && this.relativeOffsetOfLocalHeader > 0xfffffffe)
|
35016
|
-
);
|
35017
|
-
}
|
35018
|
-
var LOCAL_FILE_HEADER_FIXED_SIZE = 30;
|
35019
|
-
var VERSION_NEEDED_TO_EXTRACT_UTF8 = 20;
|
35020
|
-
var VERSION_NEEDED_TO_EXTRACT_ZIP64 = 45;
|
35021
|
-
// 3 = unix. 63 = spec version 6.3
|
35022
|
-
var VERSION_MADE_BY = (3 << 8) | 63;
|
35023
|
-
var FILE_NAME_IS_UTF8 = 1 << 11;
|
35024
|
-
var UNKNOWN_CRC32_AND_FILE_SIZES = 1 << 3;
|
35025
|
-
Entry.prototype.getLocalFileHeader = function() {
|
35026
|
-
var crc32 = 0;
|
35027
|
-
var compressedSize = 0;
|
35028
|
-
var uncompressedSize = 0;
|
35029
|
-
if (this.crcAndFileSizeKnown) {
|
35030
|
-
crc32 = this.crc32;
|
35031
|
-
compressedSize = this.compressedSize;
|
35032
|
-
uncompressedSize = this.uncompressedSize;
|
35033
|
-
}
|
35034
|
-
|
35035
|
-
var fixedSizeStuff = bufferAlloc(LOCAL_FILE_HEADER_FIXED_SIZE);
|
35036
|
-
var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
|
35037
|
-
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
|
35038
|
-
|
35039
|
-
// local file header signature 4 bytes (0x04034b50)
|
35040
|
-
fixedSizeStuff.writeUInt32LE(0x04034b50, 0);
|
35041
|
-
// version needed to extract 2 bytes
|
35042
|
-
fixedSizeStuff.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_UTF8, 4);
|
35043
|
-
// general purpose bit flag 2 bytes
|
35044
|
-
fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 6);
|
35045
|
-
// compression method 2 bytes
|
35046
|
-
fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 8);
|
35047
|
-
// last mod file time 2 bytes
|
35048
|
-
fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 10);
|
35049
|
-
// last mod file date 2 bytes
|
35050
|
-
fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 12);
|
35051
|
-
// crc-32 4 bytes
|
35052
|
-
fixedSizeStuff.writeUInt32LE(crc32, 14);
|
35053
|
-
// compressed size 4 bytes
|
35054
|
-
fixedSizeStuff.writeUInt32LE(compressedSize, 18);
|
35055
|
-
// uncompressed size 4 bytes
|
35056
|
-
fixedSizeStuff.writeUInt32LE(uncompressedSize, 22);
|
35057
|
-
// file name length 2 bytes
|
35058
|
-
fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 26);
|
35059
|
-
// extra field length 2 bytes
|
35060
|
-
fixedSizeStuff.writeUInt16LE(0, 28);
|
35061
|
-
return Buffer.concat([
|
35062
|
-
fixedSizeStuff,
|
35063
|
-
// file name (variable size)
|
35064
|
-
this.utf8FileName,
|
35065
|
-
// extra field (variable size)
|
35066
|
-
// no extra fields
|
35067
|
-
]);
|
35068
|
-
};
|
35069
|
-
var DATA_DESCRIPTOR_SIZE = 16;
|
35070
|
-
var ZIP64_DATA_DESCRIPTOR_SIZE = 24;
|
35071
|
-
Entry.prototype.getDataDescriptor = function() {
|
35072
|
-
if (this.crcAndFileSizeKnown) {
|
35073
|
-
// the Mac Archive Utility requires this not be present unless we set general purpose bit 3
|
35074
|
-
return EMPTY_BUFFER;
|
35075
|
-
}
|
35076
|
-
if (!this.useZip64Format()) {
|
35077
|
-
var buffer = bufferAlloc(DATA_DESCRIPTOR_SIZE);
|
35078
|
-
// optional signature (required according to Archive Utility)
|
35079
|
-
buffer.writeUInt32LE(0x08074b50, 0);
|
35080
|
-
// crc-32 4 bytes
|
35081
|
-
buffer.writeUInt32LE(this.crc32, 4);
|
35082
|
-
// compressed size 4 bytes
|
35083
|
-
buffer.writeUInt32LE(this.compressedSize, 8);
|
35084
|
-
// uncompressed size 4 bytes
|
35085
|
-
buffer.writeUInt32LE(this.uncompressedSize, 12);
|
35086
|
-
return buffer;
|
35087
|
-
} else {
|
35088
|
-
// ZIP64 format
|
35089
|
-
var buffer = bufferAlloc(ZIP64_DATA_DESCRIPTOR_SIZE);
|
35090
|
-
// optional signature (unknown if anyone cares about this)
|
35091
|
-
buffer.writeUInt32LE(0x08074b50, 0);
|
35092
|
-
// crc-32 4 bytes
|
35093
|
-
buffer.writeUInt32LE(this.crc32, 4);
|
35094
|
-
// compressed size 8 bytes
|
35095
|
-
writeUInt64LE(buffer, this.compressedSize, 8);
|
35096
|
-
// uncompressed size 8 bytes
|
35097
|
-
writeUInt64LE(buffer, this.uncompressedSize, 16);
|
35098
|
-
return buffer;
|
35099
|
-
}
|
35100
|
-
};
|
35101
|
-
var CENTRAL_DIRECTORY_RECORD_FIXED_SIZE = 46;
|
35102
|
-
var ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE = 28;
|
35103
|
-
Entry.prototype.getCentralDirectoryRecord = function() {
|
35104
|
-
var fixedSizeStuff = bufferAlloc(CENTRAL_DIRECTORY_RECORD_FIXED_SIZE);
|
35105
|
-
var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
|
35106
|
-
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
|
35107
|
-
|
35108
|
-
var normalCompressedSize = this.compressedSize;
|
35109
|
-
var normalUncompressedSize = this.uncompressedSize;
|
35110
|
-
var normalRelativeOffsetOfLocalHeader = this.relativeOffsetOfLocalHeader;
|
35111
|
-
var versionNeededToExtract;
|
35112
|
-
var zeiefBuffer;
|
35113
|
-
if (this.useZip64Format()) {
|
35114
|
-
normalCompressedSize = 0xffffffff;
|
35115
|
-
normalUncompressedSize = 0xffffffff;
|
35116
|
-
normalRelativeOffsetOfLocalHeader = 0xffffffff;
|
35117
|
-
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_ZIP64;
|
35118
|
-
|
35119
|
-
// ZIP64 extended information extra field
|
35120
|
-
zeiefBuffer = bufferAlloc(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE);
|
35121
|
-
// 0x0001 2 bytes Tag for this "extra" block type
|
35122
|
-
zeiefBuffer.writeUInt16LE(0x0001, 0);
|
35123
|
-
// Size 2 bytes Size of this "extra" block
|
35124
|
-
zeiefBuffer.writeUInt16LE(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE - 4, 2);
|
35125
|
-
// Original Size 8 bytes Original uncompressed file size
|
35126
|
-
writeUInt64LE(zeiefBuffer, this.uncompressedSize, 4);
|
35127
|
-
// Compressed Size 8 bytes Size of compressed data
|
35128
|
-
writeUInt64LE(zeiefBuffer, this.compressedSize, 12);
|
35129
|
-
// Relative Header Offset 8 bytes Offset of local header record
|
35130
|
-
writeUInt64LE(zeiefBuffer, this.relativeOffsetOfLocalHeader, 20);
|
35131
|
-
// Disk Start Number 4 bytes Number of the disk on which this file starts
|
35132
|
-
// (omit)
|
35133
|
-
} else {
|
35134
|
-
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_UTF8;
|
35135
|
-
zeiefBuffer = EMPTY_BUFFER;
|
35136
|
-
}
|
35137
|
-
|
35138
|
-
// central file header signature 4 bytes (0x02014b50)
|
35139
|
-
fixedSizeStuff.writeUInt32LE(0x02014b50, 0);
|
35140
|
-
// version made by 2 bytes
|
35141
|
-
fixedSizeStuff.writeUInt16LE(VERSION_MADE_BY, 4);
|
35142
|
-
// version needed to extract 2 bytes
|
35143
|
-
fixedSizeStuff.writeUInt16LE(versionNeededToExtract, 6);
|
35144
|
-
// general purpose bit flag 2 bytes
|
35145
|
-
fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 8);
|
35146
|
-
// compression method 2 bytes
|
35147
|
-
fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 10);
|
35148
|
-
// last mod file time 2 bytes
|
35149
|
-
fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 12);
|
35150
|
-
// last mod file date 2 bytes
|
35151
|
-
fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 14);
|
35152
|
-
// crc-32 4 bytes
|
35153
|
-
fixedSizeStuff.writeUInt32LE(this.crc32, 16);
|
35154
|
-
// compressed size 4 bytes
|
35155
|
-
fixedSizeStuff.writeUInt32LE(normalCompressedSize, 20);
|
35156
|
-
// uncompressed size 4 bytes
|
35157
|
-
fixedSizeStuff.writeUInt32LE(normalUncompressedSize, 24);
|
35158
|
-
// file name length 2 bytes
|
35159
|
-
fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 28);
|
35160
|
-
// extra field length 2 bytes
|
35161
|
-
fixedSizeStuff.writeUInt16LE(zeiefBuffer.length, 30);
|
35162
|
-
// file comment length 2 bytes
|
35163
|
-
fixedSizeStuff.writeUInt16LE(this.fileComment.length, 32);
|
35164
|
-
// disk number start 2 bytes
|
35165
|
-
fixedSizeStuff.writeUInt16LE(0, 34);
|
35166
|
-
// internal file attributes 2 bytes
|
35167
|
-
fixedSizeStuff.writeUInt16LE(0, 36);
|
35168
|
-
// external file attributes 4 bytes
|
35169
|
-
fixedSizeStuff.writeUInt32LE(this.externalFileAttributes, 38);
|
35170
|
-
// relative offset of local header 4 bytes
|
35171
|
-
fixedSizeStuff.writeUInt32LE(normalRelativeOffsetOfLocalHeader, 42);
|
35172
|
-
|
35173
|
-
return Buffer.concat([
|
35174
|
-
fixedSizeStuff,
|
35175
|
-
// file name (variable size)
|
35176
|
-
this.utf8FileName,
|
35177
|
-
// extra field (variable size)
|
35178
|
-
zeiefBuffer,
|
35179
|
-
// file comment (variable size)
|
35180
|
-
this.fileComment,
|
35181
|
-
]);
|
35182
|
-
};
|
35183
|
-
Entry.prototype.getCompressionMethod = function() {
|
35184
|
-
var NO_COMPRESSION = 0;
|
35185
|
-
var DEFLATE_COMPRESSION = 8;
|
35186
|
-
return this.compress ? DEFLATE_COMPRESSION : NO_COMPRESSION;
|
35187
|
-
};
|
35188
|
-
|
35189
|
-
function dateToDosDateTime(jsDate) {
|
35190
|
-
var date = 0;
|
35191
|
-
date |= jsDate.getDate() & 0x1f; // 1-31
|
35192
|
-
date |= ((jsDate.getMonth() + 1) & 0xf) << 5; // 0-11, 1-12
|
35193
|
-
date |= ((jsDate.getFullYear() - 1980) & 0x7f) << 9; // 0-128, 1980-2108
|
35194
|
-
|
35195
|
-
var time = 0;
|
35196
|
-
time |= Math.floor(jsDate.getSeconds() / 2); // 0-59, 0-29 (lose odd numbers)
|
35197
|
-
time |= (jsDate.getMinutes() & 0x3f) << 5; // 0-59
|
35198
|
-
time |= (jsDate.getHours() & 0x1f) << 11; // 0-23
|
35199
|
-
|
35200
|
-
return {date: date, time: time};
|
35201
|
-
}
|
35202
|
-
|
35203
|
-
function writeUInt64LE(buffer, n, offset) {
|
35204
|
-
// can't use bitshift here, because JavaScript only allows bitshifting on 32-bit integers.
|
35205
|
-
var high = Math.floor(n / 0x100000000);
|
35206
|
-
var low = n % 0x100000000;
|
35207
|
-
buffer.writeUInt32LE(low, offset);
|
35208
|
-
buffer.writeUInt32LE(high, offset + 4);
|
35209
|
-
}
|
35210
|
-
|
35211
|
-
function defaultCallback(err) {
|
35212
|
-
if (err) throw err;
|
35213
|
-
}
|
35214
|
-
|
35215
|
-
util.inherits(ByteCounter, Transform);
|
35216
|
-
function ByteCounter(options) {
|
35217
|
-
Transform.call(this, options);
|
35218
|
-
this.byteCount = 0;
|
35219
|
-
}
|
35220
|
-
ByteCounter.prototype._transform = function(chunk, encoding, cb) {
|
35221
|
-
this.byteCount += chunk.length;
|
35222
|
-
cb(null, chunk);
|
35223
|
-
};
|
35224
|
-
|
35225
|
-
util.inherits(Crc32Watcher, Transform);
|
35226
|
-
function Crc32Watcher(options) {
|
35227
|
-
Transform.call(this, options);
|
35228
|
-
this.crc32 = 0;
|
35229
|
-
}
|
35230
|
-
Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
|
35231
|
-
this.crc32 = crc32.unsigned(chunk, this.crc32);
|
35232
|
-
cb(null, chunk);
|
35233
|
-
};
|
35234
|
-
|
35235
|
-
var cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ';
|
35236
|
-
if (cp437.length !== 256) throw new Error("assertion failure");
|
35237
|
-
var reverseCp437 = null;
|
35238
|
-
|
35239
|
-
function encodeCp437(string) {
|
35240
|
-
if (/^[\x20-\x7e]*$/.test(string)) {
|
35241
|
-
// CP437, ASCII, and UTF-8 overlap in this range.
|
35242
|
-
return bufferFrom(string, "utf-8");
|
35243
|
-
}
|
35244
|
-
|
35245
|
-
// This is the slow path.
|
35246
|
-
if (reverseCp437 == null) {
|
35247
|
-
// cache this once
|
35248
|
-
reverseCp437 = {};
|
35249
|
-
for (var i = 0; i < cp437.length; i++) {
|
35250
|
-
reverseCp437[cp437[i]] = i;
|
35251
|
-
}
|
35252
|
-
}
|
35253
|
-
|
35254
|
-
var result = bufferAlloc(string.length);
|
35255
|
-
for (var i = 0; i < string.length; i++) {
|
35256
|
-
var b = reverseCp437[string[i]];
|
35257
|
-
if (b == null) throw new Error("character not encodable in CP437: " + JSON.stringify(string[i]));
|
35258
|
-
result[i] = b;
|
35259
|
-
}
|
35260
|
-
|
35261
|
-
return result;
|
35262
|
-
}
|
35263
|
-
|
35264
|
-
function bufferAlloc(size) {
|
35265
|
-
bufferAlloc = modern;
|
35266
|
-
try {
|
35267
|
-
return bufferAlloc(size);
|
35268
|
-
} catch (e) {
|
35269
|
-
bufferAlloc = legacy;
|
35270
|
-
return bufferAlloc(size);
|
35271
|
-
}
|
35272
|
-
function modern(size) {
|
35273
|
-
return Buffer.allocUnsafe(size);
|
35274
|
-
}
|
35275
|
-
function legacy(size) {
|
35276
|
-
return new Buffer(size);
|
35277
|
-
}
|
35278
|
-
}
|
35279
|
-
function bufferFrom(something, encoding) {
|
35280
|
-
bufferFrom = modern;
|
35281
|
-
try {
|
35282
|
-
return bufferFrom(something, encoding);
|
35283
|
-
} catch (e) {
|
35284
|
-
bufferFrom = legacy;
|
35285
|
-
return bufferFrom(something, encoding);
|
35286
|
-
}
|
35287
|
-
function modern(something, encoding) {
|
35288
|
-
return Buffer.from(something, encoding);
|
35289
|
-
}
|
35290
|
-
function legacy(something, encoding) {
|
35291
|
-
return new Buffer(something, encoding);
|
35292
|
-
}
|
35293
|
-
}
|
35294
|
-
function bufferIncludes(buffer, content) {
|
35295
|
-
bufferIncludes = modern;
|
35296
|
-
try {
|
35297
|
-
return bufferIncludes(buffer, content);
|
35298
|
-
} catch (e) {
|
35299
|
-
bufferIncludes = legacy;
|
35300
|
-
return bufferIncludes(buffer, content);
|
35301
|
-
}
|
35302
|
-
function modern(buffer, content) {
|
35303
|
-
return buffer.includes(content);
|
35304
|
-
}
|
35305
|
-
function legacy(buffer, content) {
|
35306
|
-
for (var i = 0; i <= buffer.length - content.length; i++) {
|
35307
|
-
for (var j = 0;; j++) {
|
35308
|
-
if (j === content.length) return true;
|
35309
|
-
if (buffer[i + j] !== content[j]) break;
|
35310
|
-
}
|
35311
|
-
}
|
35312
|
-
return false;
|
35313
|
-
}
|
35314
|
-
}
|
35315
|
-
|
35316
|
-
|
35317
34697
|
/***/ }),
|
35318
34698
|
|
35319
34699
|
/***/ 9892:
|
@@ -39375,14 +38755,6 @@ module.exports = require("node:url");
|
|
39375
38755
|
|
39376
38756
|
/***/ }),
|
39377
38757
|
|
39378
|
-
/***/ 7261:
|
39379
|
-
/***/ ((module) => {
|
39380
|
-
|
39381
|
-
"use strict";
|
39382
|
-
module.exports = require("node:util");
|
39383
|
-
|
39384
|
-
/***/ }),
|
39385
|
-
|
39386
38758
|
/***/ 2037:
|
39387
38759
|
/***/ ((module) => {
|
39388
38760
|
|