ranger-compiler 3.2.0 → 3.5.0
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/CHANGELOG.md +2463 -0
- package/LICENSE +28 -0
- package/LICENSE-MIT +21 -0
- package/README.md +1651 -1895
- package/dist/Lang.rgr +10946 -5852
- package/dist/README.md +3 -2
- package/dist/api.d.ts +1548 -27
- package/dist/api.js +70572 -38295
- package/dist/git-http.mjs +126 -0
- package/dist/lib/ACEEditor.rgr +2 -0
- package/dist/lib/Ajax.rgr +2 -0
- package/dist/lib/CmdParams.rgr +2 -0
- package/dist/lib/Crypto.rgr +2 -0
- package/dist/lib/DOMLib.rgr +2 -0
- package/dist/lib/Engine3D.rgr +2 -0
- package/dist/lib/ImmutableVector.rgr +2 -0
- package/dist/lib/IndexedDB.rgr +2 -0
- package/dist/lib/IsoDate/DateMath.rgr +2 -0
- package/dist/lib/IsoDate/IsoCalendar.rgr +2 -0
- package/dist/lib/IsoDate/IsoDateParse.rgr +2 -0
- package/dist/lib/IsoDateLib.rgr +2 -0
- package/dist/lib/JSON.rgr +4906 -48
- package/dist/lib/JinxProcess.rgr +2 -0
- package/dist/lib/RangerProcess.rgr +2 -0
- package/dist/lib/Regex/RegexMatch.rgr +2 -0
- package/dist/lib/RegexLib.rgr +2 -0
- package/dist/lib/SQL.rgr +2 -0
- package/dist/lib/ServiceLib.rgr +2 -0
- package/dist/lib/Shell.rgr +326 -0
- package/dist/lib/Storage.rgr +2 -0
- package/dist/lib/Time.rgr +2 -0
- package/dist/lib/Timers.rgr +2 -0
- package/dist/lib/TypedArrays.rgr +2 -0
- package/dist/lib/ViewLib.rgr +2 -0
- package/dist/lib/WebLib.rgr +2 -0
- package/dist/lib/WebServerLib.rgr +2 -0
- package/dist/lib/apple/AppleAppBuilder.rgr +572 -0
- package/dist/lib/apple/AppleAppSpec.rgr +201 -0
- package/dist/lib/apple/AppleDevice.rgr +295 -0
- package/dist/lib/apple/AppleDeviceDoctor.rgr +453 -0
- package/dist/lib/apple/AppleSigning.rgr +379 -0
- package/dist/lib/apple/AppleSimulator.rgr +248 -0
- package/dist/lib/apple/AppleTarget.rgr +185 -0
- package/dist/lib/apple/AppleToolchain.rgr +458 -0
- package/dist/lib/apple/README.md +311 -0
- package/dist/lib/apple/apple_test.rgr +669 -0
- package/dist/lib/core/README.md +251 -0
- package/dist/lib/core/RgBase.rgr +313 -0
- package/dist/lib/core/RgNum.rgr +653 -0
- package/dist/lib/core/RgText.rgr +680 -0
- package/dist/lib/core/RgU32.rgr +309 -0
- package/dist/lib/ranger-dir.rgr +2 -0
- package/dist/lib/shell_test.rgr +193 -0
- package/dist/lib/stdlib.rgr +1176 -665
- package/dist/lib/stdops.rgr +2 -0
- package/dist/lib/zip/Inflate.rgr +675 -0
- package/dist/lib/zip/ZipBuffer.rgr +358 -0
- package/dist/package.json +1 -1
- package/dist/rgrc.js +76333 -40647
- package/dist/stdops.rgr +2 -0
- package/package.json +1121 -339
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
//
|
|
4
|
+
// Dumb HTTPS pipe for Git smart HTTP, shipped beside rgrc. All Git framing
|
|
5
|
+
// lives in Ranger -- the pack parser, pkt-line, SHA-1 and the tree walk are
|
|
6
|
+
// compiled into the compiler itself. This file only GETs and POSTs bytes,
|
|
7
|
+
// because Node has no synchronous HTTPS and the compiler is synchronous.
|
|
8
|
+
// Public repos, no credentials.
|
|
9
|
+
|
|
10
|
+
import { request as httpsRequest } from "node:https";
|
|
11
|
+
import { request as httpRequest } from "node:http";
|
|
12
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
13
|
+
|
|
14
|
+
function toGitUrl(raw) {
|
|
15
|
+
let u = raw.trim();
|
|
16
|
+
if (u.startsWith("git@")) {
|
|
17
|
+
const rest = u.slice(4);
|
|
18
|
+
const colon = rest.indexOf(":");
|
|
19
|
+
if (colon > 0) {
|
|
20
|
+
u = "https://" + rest.slice(0, colon) + "/" + rest.slice(colon + 1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!u.endsWith(".git")) {
|
|
24
|
+
u = u + ".git";
|
|
25
|
+
}
|
|
26
|
+
if (u.endsWith("/")) {
|
|
27
|
+
u = u.slice(0, -1);
|
|
28
|
+
}
|
|
29
|
+
return u;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function fetchBytes(url, { method = "GET", body, contentType } = {}) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const go = (target, hops) => {
|
|
35
|
+
if (hops > 8) {
|
|
36
|
+
reject(new Error("too many redirects"));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const u = new URL(target);
|
|
40
|
+
const lib = u.protocol === "http:" ? httpRequest : httpsRequest;
|
|
41
|
+
const req = lib(
|
|
42
|
+
{
|
|
43
|
+
protocol: u.protocol,
|
|
44
|
+
hostname: u.hostname,
|
|
45
|
+
port: u.port || (u.protocol === "http:" ? 80 : 443),
|
|
46
|
+
path: u.pathname + u.search,
|
|
47
|
+
method,
|
|
48
|
+
headers: {
|
|
49
|
+
"User-Agent": "git/2.43.0 ranger-pkg/0.1",
|
|
50
|
+
Accept: contentType
|
|
51
|
+
? "application/x-git-upload-pack-result"
|
|
52
|
+
: "application/x-git-upload-pack-advertisement",
|
|
53
|
+
...(process.env.GIT_PROTOCOL
|
|
54
|
+
? { "Git-Protocol": process.env.GIT_PROTOCOL }
|
|
55
|
+
: {}),
|
|
56
|
+
...(body
|
|
57
|
+
? {
|
|
58
|
+
"Content-Type": contentType,
|
|
59
|
+
"Content-Length": String(body.length),
|
|
60
|
+
}
|
|
61
|
+
: {}),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
(res) => {
|
|
65
|
+
const chunks = [];
|
|
66
|
+
res.on("data", (c) => chunks.push(c));
|
|
67
|
+
res.on("end", () => {
|
|
68
|
+
const buf = Buffer.concat(chunks);
|
|
69
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
70
|
+
go(new URL(res.headers.location, target).toString(), hops + 1);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
74
|
+
reject(new Error(`HTTP ${res.statusCode} ${target}\n${buf.slice(0, 400)}`));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
resolve(buf);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
req.on("error", reject);
|
|
82
|
+
if (body) {
|
|
83
|
+
req.write(body);
|
|
84
|
+
}
|
|
85
|
+
req.end();
|
|
86
|
+
};
|
|
87
|
+
go(url, 0);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const cmd = process.argv[2];
|
|
92
|
+
const url = process.argv[3] ? toGitUrl(process.argv[3]) : "";
|
|
93
|
+
|
|
94
|
+
if (cmd === "advertise" && url) {
|
|
95
|
+
const buf = await fetchBytes(url + "/info/refs?service=git-upload-pack");
|
|
96
|
+
const out = process.argv[4];
|
|
97
|
+
if (out) {
|
|
98
|
+
writeFileSync(out, buf);
|
|
99
|
+
} else {
|
|
100
|
+
process.stdout.write(buf);
|
|
101
|
+
}
|
|
102
|
+
process.exit(0);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (cmd === "post" && url) {
|
|
106
|
+
const reqFile = process.argv[4];
|
|
107
|
+
const out = process.argv[5];
|
|
108
|
+
const body = readFileSync(reqFile);
|
|
109
|
+
const buf = await fetchBytes(url + "/git-upload-pack", {
|
|
110
|
+
method: "POST",
|
|
111
|
+
body,
|
|
112
|
+
contentType: "application/x-git-upload-pack-request",
|
|
113
|
+
});
|
|
114
|
+
if (out) {
|
|
115
|
+
writeFileSync(out, buf);
|
|
116
|
+
} else {
|
|
117
|
+
process.stdout.write(buf);
|
|
118
|
+
}
|
|
119
|
+
process.exit(0);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.error(`usage:
|
|
123
|
+
git-http.mjs advertise <git-url> [out.bin]
|
|
124
|
+
git-http.mjs post <git-url> <want.bin> [out.bin]
|
|
125
|
+
GIT_PROTOCOL=version=2 git-http.mjs …`);
|
|
126
|
+
process.exit(2);
|
package/dist/lib/ACEEditor.rgr
CHANGED
package/dist/lib/Ajax.rgr
CHANGED
package/dist/lib/CmdParams.rgr
CHANGED
package/dist/lib/Crypto.rgr
CHANGED
package/dist/lib/DOMLib.rgr
CHANGED
package/dist/lib/Engine3D.rgr
CHANGED
package/dist/lib/IndexedDB.rgr
CHANGED