comarkserv 0.1.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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/dist/THIRD_PARTY_LICENSES.md +932 -0
  4. package/dist/build-CsToYJrU.mjs +2 -0
  5. package/dist/build-Cv5aO0CB.mjs +205 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.mjs +894 -0
  8. package/dist/cloudflared-6f_lzz4F.mjs +181 -0
  9. package/dist/dist-B-IALNns.mjs +2 -0
  10. package/dist/dist-BK-bpLWg.mjs +2 -0
  11. package/dist/dist-BQzCbTko.mjs +1693 -0
  12. package/dist/dist-BWcWG5YB.mjs +671 -0
  13. package/dist/dist-BiVw4ojz.mjs +592 -0
  14. package/dist/dist-BnmL9jeq.mjs +538 -0
  15. package/dist/dist-BtedNLrc.mjs +276 -0
  16. package/dist/dist-BvdNTrap.mjs +2710 -0
  17. package/dist/dist-ByijHttv.mjs +69 -0
  18. package/dist/dist-C2E4zSX1.mjs +347 -0
  19. package/dist/dist-CWYRQLUT.mjs +2 -0
  20. package/dist/dist-CXQ7eTfT.mjs +417 -0
  21. package/dist/dist-CfsjQ0o8.mjs +905 -0
  22. package/dist/dist-CsTXDvwi.mjs +300 -0
  23. package/dist/dist-CtONMLh4.mjs +283 -0
  24. package/dist/dist-DMftjyxU.mjs +370 -0
  25. package/dist/dist-Dr9uTCX7.mjs +2 -0
  26. package/dist/dist-Dxvc11TH.mjs +339 -0
  27. package/dist/dist-GmbcGEAc.mjs +3 -0
  28. package/dist/dist-V1rkISnf.mjs +220 -0
  29. package/dist/dist-ZoN94PJ0.mjs +76 -0
  30. package/dist/dist-fh99cWMN.mjs +524 -0
  31. package/dist/editor-CHDyOp-8.mjs +721 -0
  32. package/dist/index.d.mts +301 -0
  33. package/dist/index.mjs +6 -0
  34. package/dist/languages-C0kEygG_.mjs +119 -0
  35. package/dist/markdown-BqKed1Vq.mjs +710 -0
  36. package/dist/markdown-DWuqfzps.mjs +2 -0
  37. package/dist/rolldown-runtime-CMFfr-1z.mjs +26 -0
  38. package/dist/server-Dkjk_D1Y.mjs +2628 -0
  39. package/dist/terminal-aKr5Xlp3.mjs +169 -0
  40. package/dist/themes-mEufQ_3e.mjs +2194 -0
  41. package/dist/twinkleplop.production-Coccf2Q9.mjs +2 -0
  42. package/dist/twinkleplop.production-DekYmX6O.mjs +4697 -0
  43. package/dist/twinkleplop.tokens-CgBUTCSg.mjs +76 -0
  44. package/package.json +133 -0
@@ -0,0 +1,181 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { tmpdir } from "node:os";
4
+ import { once } from "node:events";
5
+ import { execSync, spawn } from "node:child_process";
6
+ import https from "node:https";
7
+ //#region node_modules/.pnpm/untun@0.2.2/node_modules/untun/dist/_chunks/cloudflared.mjs
8
+ const CLOUDFLARED_VERSION = process.env.CLOUDFLARED_VERSION || "2026.7.2";
9
+ const RELEASE_BASE = "https://github.com/cloudflare/cloudflared/releases/";
10
+ const cloudflaredBinPath = path.join(tmpdir(), "node-untun", process.platform === "win32" ? `cloudflared.${CLOUDFLARED_VERSION}.exe` : `cloudflared.${CLOUDFLARED_VERSION}`);
11
+ const cloudflaredNotice = `
12
+ 🔥 Your installation of cloudflared software constitutes a symbol of your signature
13
+ indicating that you accept the terms of the Cloudflare License, Terms and Privacy Policy.
14
+
15
+ ❯ License: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/license/
16
+ ❯ Terms: https://www.cloudflare.com/terms/
17
+ ❯ Privacy Policy: https://www.cloudflare.com/privacypolicy/
18
+ `;
19
+ const connRegex = /connection[ =]([\da-z-]+)/i;
20
+ const ipRegex = /ip=([\d.]+)/;
21
+ const locationRegex = /location=([A-Z]+)/;
22
+ const indexRegex = /connIndex=(\d)/;
23
+ const LINUX_URL = {
24
+ arm64: "cloudflared-linux-arm64",
25
+ arm: "cloudflared-linux-arm",
26
+ x64: "cloudflared-linux-amd64",
27
+ ia32: "cloudflared-linux-386"
28
+ };
29
+ const MACOS_URL = {
30
+ arm64: "cloudflared-darwin-amd64.tgz",
31
+ x64: "cloudflared-darwin-amd64.tgz"
32
+ };
33
+ const WINDOWS_URL = {
34
+ x64: "cloudflared-windows-amd64.exe",
35
+ ia32: "cloudflared-windows-386.exe"
36
+ };
37
+ function resolveBase(version) {
38
+ if (version === "latest") return `${RELEASE_BASE}latest/download/`;
39
+ return `${RELEASE_BASE}download/${version}/`;
40
+ }
41
+ function installCloudflared(to = cloudflaredBinPath, version = CLOUDFLARED_VERSION) {
42
+ switch (process.platform) {
43
+ case "linux": return installLinux(to, version);
44
+ case "darwin": return installMacos(to, version);
45
+ case "win32": return installWindows(to, version);
46
+ default: throw new Error("Unsupported platform: " + process.platform);
47
+ }
48
+ }
49
+ async function installLinux(to, version = CLOUDFLARED_VERSION) {
50
+ const file = LINUX_URL[process.arch];
51
+ if (file === void 0) throw new Error("Unsupported architecture: " + process.arch);
52
+ await download(resolveBase(version) + file, to);
53
+ fs.chmodSync(to, "755");
54
+ return to;
55
+ }
56
+ async function installMacos(to, version = CLOUDFLARED_VERSION) {
57
+ const file = MACOS_URL[process.arch];
58
+ if (file === void 0) throw new Error("Unsupported architecture: " + process.arch);
59
+ await download(resolveBase(version) + file, `${to}.tgz`);
60
+ if (process.env.DEBUG) console.log(`Extracting to ${to}`);
61
+ execSync(`tar -xzf ${path.basename(`${to}.tgz`)}`, { cwd: path.dirname(to) });
62
+ fs.unlinkSync(`${to}.tgz`);
63
+ fs.renameSync(`${path.dirname(to)}/cloudflared`, to);
64
+ return to;
65
+ }
66
+ async function installWindows(to, version = CLOUDFLARED_VERSION) {
67
+ const file = WINDOWS_URL[process.arch];
68
+ if (file === void 0) throw new Error("Unsupported architecture: " + process.arch);
69
+ await download(resolveBase(version) + file, to);
70
+ return to;
71
+ }
72
+ function download(url, to, redirect = 0) {
73
+ if (redirect === 0) {
74
+ if (process.env.DEBUG) console.log(`Downloading ${url} to ${to}`);
75
+ } else if (process.env.DEBUG) console.log(`Redirecting to ${url}`);
76
+ return new Promise((resolve, reject) => {
77
+ if (!fs.existsSync(path.dirname(to))) fs.mkdirSync(path.dirname(to), { recursive: true });
78
+ let done = true;
79
+ const file = fs.createWriteStream(to);
80
+ const request = https.get(url, (res) => {
81
+ if (res.statusCode === 302 && res.headers.location !== void 0) {
82
+ const redirection = res.headers.location;
83
+ done = false;
84
+ file.close(() => resolve(download(redirection, to, redirect + 1)));
85
+ return;
86
+ }
87
+ res.pipe(file);
88
+ });
89
+ file.on("finish", () => {
90
+ if (done) file.close(() => resolve(to));
91
+ });
92
+ request.on("error", (err) => {
93
+ fs.unlink(to, () => reject(err));
94
+ });
95
+ file.on("error", (err) => {
96
+ fs.unlink(to, () => reject(err));
97
+ });
98
+ request.end();
99
+ });
100
+ }
101
+ function startCloudflaredTunnel(options = {}, extraArgs = []) {
102
+ const args = ["tunnel"];
103
+ for (const [key, value] of Object.entries(options)) if (typeof value === "string") args.push(`${key}`, value);
104
+ else if (typeof value === "number") args.push(`${key}`, value.toString());
105
+ else if (value === null) args.push(`${key}`);
106
+ if (!options["--url"]) args.push("--url", "localhost:8080");
107
+ if (Array.isArray(extraArgs)) args.push(...extraArgs);
108
+ const child = spawn(cloudflaredBinPath, args, { stdio: [
109
+ "ignore",
110
+ "pipe",
111
+ "pipe"
112
+ ] });
113
+ if (process.env.DEBUG) {
114
+ child.stdout.pipe(process.stdout);
115
+ child.stderr.pipe(process.stderr);
116
+ }
117
+ const urlRegex = /\|\s+(https?:\/\/\S+)/;
118
+ let urlResolver = () => void 0;
119
+ let urlRejector = () => void 0;
120
+ const url = new Promise((...pair) => [urlResolver, urlRejector] = pair);
121
+ url.catch(() => void 0);
122
+ const connectionResolvers = [];
123
+ const connectionRejectors = [];
124
+ const connections = [];
125
+ for (let i = 0; i < 1; i++) connections.push(new Promise((...pair) => [connectionResolvers[i], connectionRejectors[i]] = pair));
126
+ const recentOutput = [];
127
+ const parser = (data) => {
128
+ const str = data.toString();
129
+ for (const line of str.split("\n")) {
130
+ if (!line.trim()) continue;
131
+ recentOutput.push(line.trim());
132
+ if (recentOutput.length > 10) recentOutput.shift();
133
+ }
134
+ const urlMatch = str.match(urlRegex);
135
+ if (urlMatch) urlResolver(urlMatch[1]);
136
+ const connMatch = str.match(connRegex);
137
+ const ipMatch = str.match(ipRegex);
138
+ const locationMatch = str.match(locationRegex);
139
+ const indexMatch = str.match(indexRegex);
140
+ if (connMatch && ipMatch && locationMatch && indexMatch) {
141
+ const [, id] = connMatch;
142
+ const [, ip] = ipMatch;
143
+ const [, location] = locationMatch;
144
+ const [, idx] = indexMatch;
145
+ connectionResolvers[+idx]?.({
146
+ id,
147
+ ip,
148
+ location
149
+ });
150
+ }
151
+ };
152
+ child.stdout.on("data", parser).on("error", urlRejector);
153
+ child.stderr.on("data", parser).on("error", urlRejector);
154
+ child.on("error", urlRejector);
155
+ child.on("exit", (code, signal) => {
156
+ const reason = /* @__PURE__ */ new Error(`cloudflared exited (code=${code}, signal=${signal}) before URL was ready` + (recentOutput.length > 0 ? `\n\n${recentOutput.join("\n")}` : ""));
157
+ urlRejector(reason);
158
+ for (const reject of connectionRejectors) reject?.(reason);
159
+ });
160
+ const stop = async () => {
161
+ if (child.exitCode !== null || child.signalCode !== null) return;
162
+ const exited = once(child, "exit");
163
+ child.kill("SIGINT");
164
+ const killTimer = setTimeout(() => {
165
+ if (child.exitCode === null && child.signalCode === null) child.kill("SIGKILL");
166
+ }, 5e3);
167
+ try {
168
+ await exited;
169
+ } finally {
170
+ clearTimeout(killTimer);
171
+ }
172
+ };
173
+ return {
174
+ url,
175
+ connections,
176
+ child,
177
+ stop
178
+ };
179
+ }
180
+ //#endregion
181
+ export { cloudflaredBinPath, cloudflaredNotice, installCloudflared, startCloudflaredTunnel };
@@ -0,0 +1,2 @@
1
+ import { $ as ut, A as U, B as de, C as N, D as Se, E as R, F as _e, G as ge, H as et, I as _t, J as k, K as he, L as be, M as W, N as X, O as St, P as Ye, Q as rt, R as bt, S as M, T as P, U as fe, V as dt, W as ft, X as me, Y as lt, Z as pe, _ as H, at as yt, b as K, c as A, d as Ce, et as ve, f as Ct, g as G, h as F, it as ye, j as V, k as Te, l as B, m as Ee, nt as xe, o as $, ot as z, p as De, q as j, rt as xt, s as $e, tt as we, u as Be, v as I, w as Oe, x as L, y as Je, z as ct } from "./dist-BQzCbTko.mjs";
2
+ export { fe as BOOLEAN_LITERALS, me as DIVISION_KEYWORDS, M as IDENTIFIER_TERMINATORS, de as KEYWORDS, xe as MULTI_LINE_COMMENT, ye as OP_1CHAR, ve as OP_2CHAR, ge as OP_3CHAR, he as OP_4CHAR, be as OP_ALL, A as OP_ALL_OUTSIDE_MEMBER, _e as OP_SPREAD, j as PROBE_OPERATORS, k as REGEX_PRECEDING_KEYWORDS, N as SINGLE_LINE_COMMENT, pe as SPECIAL_VALUES, P as STRING_DOUBLE, Se as STRING_SINGLE, F as TEMPLATE_LITERAL, Ye as claim_property_scope, lt as class_name_promoter, Je as classify_reserved_names, Te as function_body_state, Be as function_variable_rules, St as grammar, V as js_body_common, I as js_comments, B as js_common, $e as js_frame_spec, et as js_frame_track, z as js_numbers_arg, Ce as js_numbers_top, De as js_paren_common, L as js_strings, H as js_tmpl_common, R as js_whitespace, K as keywordsLiterals, Ct as language, U as member_access, W as member_access_entry, we as member_access_paren, G as operators, Ee as paren_group_state, ut as promote_boolean_literals, dt as promote_call_site_functions, X as promote_js_const_bindings, ft as promote_js_constants, yt as promote_js_namespaces, _t as promote_js_parameters, Oe as raw_grammar, xt as reclassifiers, bt as scan_embedded_groups, ct as scan_jsdoc, rt as scan_tagged_template, $ as tokenize };
@@ -0,0 +1,2 @@
1
+ import { a as w, i as b, n as E, r as T, t as C } from "./dist-BQzCbTko.mjs";
2
+ export { w as grammar, E as language, b as raw_grammar, C as reclassifiers, T as tokenize };