@workit-dev/pi 2.22.0 → 2.22.1
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/dist/workit.js +33 -27
- package/package.json +1 -1
package/dist/workit.js
CHANGED
|
@@ -21678,26 +21678,34 @@ var normalizedUrl = (url, dir) => {
|
|
|
21678
21678
|
const value = scheme ? trimmed.slice(scheme[0].length).replace(/^[^@/]*@/, "").replace(/^([^/:]+):\d+(?=\/)/, "$1") : trimmed.replace(/^[^@/]*@/, "").replace(":", "/");
|
|
21679
21679
|
return value.toLowerCase().replace(/\/{2,}/g, "/").replace(/^www\./, "").replace(/\/+$/, "").replace(/\.git$/, "");
|
|
21680
21680
|
};
|
|
21681
|
-
var
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
|
|
21689
|
-
|
|
21690
|
-
|
|
21691
|
-
|
|
21692
|
-
|
|
21693
|
-
|
|
21694
|
-
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
const
|
|
21699
|
-
|
|
21681
|
+
var rewrite = (url, config, kind) => {
|
|
21682
|
+
let best = null;
|
|
21683
|
+
for (const [key, prefixes] of config) {
|
|
21684
|
+
if (!key.startsWith("url.") || !key.endsWith(`.${kind}`))
|
|
21685
|
+
continue;
|
|
21686
|
+
const base = key.slice(4, -(kind.length + 1));
|
|
21687
|
+
for (const prefix of prefixes)
|
|
21688
|
+
if (url.startsWith(prefix) && prefix.length > (best?.prefix.length ?? -1))
|
|
21689
|
+
best = { base, prefix };
|
|
21690
|
+
}
|
|
21691
|
+
return best ? best.base + url.slice(best.prefix.length) : null;
|
|
21692
|
+
};
|
|
21693
|
+
var rewrittenUrl = (url, config) => rewrite(url, config, "pushinsteadof") ?? rewrite(url, config, "insteadof") ?? url;
|
|
21694
|
+
var pushUrlsOf = (config, remote) => {
|
|
21695
|
+
const pushurls = config.get(`remote.${remote}.pushurl`) ?? [];
|
|
21696
|
+
if (pushurls.length)
|
|
21697
|
+
return pushurls.map((url) => rewrite(url, config, "insteadof") ?? url);
|
|
21698
|
+
const urls = config.get(`remote.${remote}.url`) ?? [remote];
|
|
21699
|
+
const aliased = urls.flatMap((url) => rewrite(url, config, "pushinsteadof") ?? []);
|
|
21700
|
+
return aliased.length ? aliased : urls.map((url) => rewrite(url, config, "insteadof") ?? url);
|
|
21701
|
+
};
|
|
21702
|
+
var singlePushUrl = (config, remote) => {
|
|
21703
|
+
if (!config.has(`remote.${remote}.url`) && !config.has(`remote.${remote}.pushurl`))
|
|
21704
|
+
return null;
|
|
21705
|
+
const urls = pushUrlsOf(config, remote);
|
|
21706
|
+
return urls.length === 1 ? urls[0] : null;
|
|
21700
21707
|
};
|
|
21708
|
+
var pushUrl = (config, remote, dir) => normalizedUrl(pushUrlsOf(config, remote).at(-1) ?? remote, dir);
|
|
21701
21709
|
var pushRemoteOf = (config, branch) => {
|
|
21702
21710
|
const remotes = new Set;
|
|
21703
21711
|
for (const key of config.keys()) {
|
|
@@ -22142,20 +22150,18 @@ var forgeRepo = (gh, named, env, config, branch, dir) => {
|
|
|
22142
22150
|
const hosted = gh ? parts.length > 2 : parts.length > 2 && parts[0].includes(".");
|
|
22143
22151
|
let url = /:\/\/|@/.test(repo) ? repo : parts.length > 1 ? `https://${hosted ? "" : `${host}/`}${repo}` : "";
|
|
22144
22152
|
if (!repo) {
|
|
22145
|
-
const
|
|
22146
|
-
|
|
22153
|
+
const pushHost = pushHostOf(config, pushRemoteOf(config, branch) ?? "origin");
|
|
22154
|
+
const remote = (gh ? ghDefaultOf(config, pushHost, dir, env) : null) ?? ["upstream", "origin"].find((name) => config.has(`remote.${name}.url`) && (name === "origin" || pushHost === null || pushHostOf(config, name) === pushHost));
|
|
22155
|
+
url = remote ? pushUrlsOf(config, remote).at(-1) ?? "" : "";
|
|
22147
22156
|
}
|
|
22148
22157
|
const key = remoteKey(url);
|
|
22149
22158
|
return key ? { remotes: [{ name: "forge", url, key }] } : Error("its repository is unknown");
|
|
22150
22159
|
};
|
|
22151
22160
|
var pushHostOf = (config, remote) => {
|
|
22152
|
-
const
|
|
22153
|
-
|
|
22154
|
-
return null;
|
|
22155
|
-
return remoteKey(rewrittenUrl(urls[0], config))?.split("/")[0] ?? null;
|
|
22161
|
+
const url = singlePushUrl(config, remote);
|
|
22162
|
+
return url === null ? null : remoteKey(url)?.split("/")[0] ?? null;
|
|
22156
22163
|
};
|
|
22157
|
-
var ghDefaultOf = (config,
|
|
22158
|
-
const pushHost = pushHostOf(config, pushRemoteOf(config, branch) ?? "origin");
|
|
22164
|
+
var ghDefaultOf = (config, pushHost, dir, env) => {
|
|
22159
22165
|
for (const [key, value] of localGhResolved(dir, env)) {
|
|
22160
22166
|
const name = key.slice(7, -12);
|
|
22161
22167
|
if (!name || value !== "base")
|