@ricsam/r5d-worker 0.0.76 → 0.0.78
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/cjs/git-process-environment.cjs +133 -0
- package/dist/cjs/main.cjs +279 -100
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/project-worktrees.cjs +72 -47
- package/dist/cjs/working-tree-mirror.cjs +2 -1
- package/dist/cjs/workspace-git-sync.cjs +67 -53
- package/dist/mjs/git-process-environment.mjs +105 -0
- package/dist/mjs/main.mjs +278 -100
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/project-worktrees.mjs +72 -47
- package/dist/mjs/working-tree-mirror.mjs +2 -1
- package/dist/mjs/workspace-git-sync.mjs +67 -53
- package/dist/types/git-process-environment.d.ts +9 -0
- package/dist/types/main.d.ts +24 -0
- package/dist/types/project-worktrees.d.ts +22 -10
- package/dist/types/workspace-git-sync.d.ts +18 -5
- package/package.json +1 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var git_process_environment_exports = {};
|
|
20
|
+
__export(git_process_environment_exports, {
|
|
21
|
+
gitCredentialHelperConfigArgs: () => gitCredentialHelperConfigArgs,
|
|
22
|
+
gitCredentialUsernameConfigKey: () => gitCredentialUsernameConfigKey,
|
|
23
|
+
gitHttpAuthorizationClearArgs: () => gitHttpAuthorizationClearArgs,
|
|
24
|
+
gitTransportSecurityArgs: () => gitTransportSecurityArgs,
|
|
25
|
+
workerGitProcessEnvironment: () => workerGitProcessEnvironment
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(git_process_environment_exports);
|
|
28
|
+
var import_node_os = require("node:os");
|
|
29
|
+
const ALLOWED_GIT_ENVIRONMENT_KEYS = [
|
|
30
|
+
"PATH",
|
|
31
|
+
"USER",
|
|
32
|
+
"LOGNAME",
|
|
33
|
+
"SHELL",
|
|
34
|
+
"TMPDIR",
|
|
35
|
+
"TMP",
|
|
36
|
+
"TEMP",
|
|
37
|
+
"TZ",
|
|
38
|
+
"LANG",
|
|
39
|
+
"LANGUAGE",
|
|
40
|
+
"LC_ALL",
|
|
41
|
+
"LC_CTYPE",
|
|
42
|
+
"LC_COLLATE",
|
|
43
|
+
"LC_MESSAGES",
|
|
44
|
+
"LC_MONETARY",
|
|
45
|
+
"LC_NUMERIC",
|
|
46
|
+
"LC_TIME",
|
|
47
|
+
"LC_ADDRESS",
|
|
48
|
+
"LC_IDENTIFICATION",
|
|
49
|
+
"LC_MEASUREMENT",
|
|
50
|
+
"LC_NAME",
|
|
51
|
+
"LC_PAPER",
|
|
52
|
+
"LC_TELEPHONE",
|
|
53
|
+
"SystemRoot",
|
|
54
|
+
"SYSTEMROOT",
|
|
55
|
+
"WINDIR",
|
|
56
|
+
"COMSPEC",
|
|
57
|
+
"PATHEXT",
|
|
58
|
+
"SSL_CERT_FILE",
|
|
59
|
+
"SSL_CERT_DIR",
|
|
60
|
+
"CURL_CA_BUNDLE",
|
|
61
|
+
"GIT_SSL_CAINFO",
|
|
62
|
+
"GIT_SSL_CAPATH",
|
|
63
|
+
"GIT_EXEC_PATH",
|
|
64
|
+
"GIT_OPTIONAL_LOCKS"
|
|
65
|
+
];
|
|
66
|
+
function workerGitProcessEnvironment(source = process.env) {
|
|
67
|
+
const environment = {
|
|
68
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
69
|
+
GIT_CONFIG_GLOBAL: import_node_os.devNull,
|
|
70
|
+
GIT_CONFIG_NOSYSTEM: "1",
|
|
71
|
+
GIT_ATTR_NOSYSTEM: "1"
|
|
72
|
+
};
|
|
73
|
+
for (const key of ALLOWED_GIT_ENVIRONMENT_KEYS) {
|
|
74
|
+
if (source[key] !== void 0) environment[key] = source[key];
|
|
75
|
+
}
|
|
76
|
+
return environment;
|
|
77
|
+
}
|
|
78
|
+
function gitHttpAuthorizationClearArgs(remoteUrl) {
|
|
79
|
+
let remote;
|
|
80
|
+
try {
|
|
81
|
+
remote = new URL(remoteUrl);
|
|
82
|
+
} catch {
|
|
83
|
+
return ["-c", "http.extraHeader="];
|
|
84
|
+
}
|
|
85
|
+
if ((remote.protocol === "https:" || remote.protocol === "http:") && (remote.username || remote.password)) {
|
|
86
|
+
throw new Error("Git credentials must not be embedded in a remote URL");
|
|
87
|
+
}
|
|
88
|
+
if (remote.protocol !== "https:" && remote.protocol !== "http:") return ["-c", "http.extraHeader="];
|
|
89
|
+
remote.hash = "";
|
|
90
|
+
remote.search = "";
|
|
91
|
+
return ["-c", "http.extraHeader=", "-c", `http.${remote.origin}/.extraHeader=`, "-c", `http.${remote.href}.extraHeader=`];
|
|
92
|
+
}
|
|
93
|
+
function gitCredentialHelperConfigArgs(credentialHelper) {
|
|
94
|
+
return [
|
|
95
|
+
"-c",
|
|
96
|
+
"credential.helper=",
|
|
97
|
+
...credentialHelper ? ["-c", `credential.helper=${credentialHelper}`] : [],
|
|
98
|
+
"-c",
|
|
99
|
+
"credential.useHttpPath=false"
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
function gitCredentialUsernameConfigKey(remoteUrl) {
|
|
103
|
+
const remote = new URL(remoteUrl);
|
|
104
|
+
if ((remote.protocol === "https:" || remote.protocol === "http:") && (remote.username || remote.password)) {
|
|
105
|
+
throw new Error("Git credentials must not be embedded in a remote URL");
|
|
106
|
+
}
|
|
107
|
+
if (remote.protocol !== "https:" && remote.protocol !== "http:") {
|
|
108
|
+
throw new Error("Git credential usernames require an HTTP remote URL");
|
|
109
|
+
}
|
|
110
|
+
remote.hash = "";
|
|
111
|
+
remote.search = "";
|
|
112
|
+
return `credential.${remote.href}.username`;
|
|
113
|
+
}
|
|
114
|
+
function gitCredentialUsernameConfigArgs(remoteUrl, credentialUsername) {
|
|
115
|
+
if (!credentialUsername) return [];
|
|
116
|
+
if (/[\0\r\n]/.test(credentialUsername)) throw new Error("Invalid Git credential username");
|
|
117
|
+
return ["-c", `${gitCredentialUsernameConfigKey(remoteUrl)}=${credentialUsername}`];
|
|
118
|
+
}
|
|
119
|
+
function gitTransportSecurityArgs(remoteUrl, credentialHelper, credentialUsername) {
|
|
120
|
+
return [
|
|
121
|
+
...gitHttpAuthorizationClearArgs(remoteUrl),
|
|
122
|
+
...gitCredentialHelperConfigArgs(credentialHelper),
|
|
123
|
+
...gitCredentialUsernameConfigArgs(remoteUrl, credentialUsername)
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
gitCredentialHelperConfigArgs,
|
|
129
|
+
gitCredentialUsernameConfigKey,
|
|
130
|
+
gitHttpAuthorizationClearArgs,
|
|
131
|
+
gitTransportSecurityArgs,
|
|
132
|
+
workerGitProcessEnvironment
|
|
133
|
+
});
|