@swipt/cli 0.1.0-nightly.78 → 0.1.0-nightly.79
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/availability.d.ts +5 -0
- package/dist/availability.js +349 -0
- package/dist/availability.js.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.js +248 -0
- package/dist/client.js.map +1 -0
- package/dist/connection.d.ts +24 -0
- package/dist/connection.js +293 -0
- package/dist/connection.js.map +1 -0
- package/dist/coredevice.d.ts +22 -0
- package/dist/coredevice.js +329 -0
- package/dist/coredevice.js.map +1 -0
- package/dist/device.d.ts +130 -0
- package/dist/device.js +539 -0
- package/dist/device.js.map +1 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.js +57 -0
- package/dist/i18n.js.map +1 -0
- package/dist/ignore.d.ts +8 -0
- package/dist/ignore.js +112 -0
- package/dist/ignore.js.map +1 -0
- package/dist/metro.d.ts +10 -0
- package/dist/metro.js +349 -0
- package/dist/metro.js.map +1 -0
- package/dist/output.d.ts +20 -0
- package/dist/output.js +116 -0
- package/dist/output.js.map +1 -0
- package/dist/project.d.ts +18 -0
- package/dist/project.js +696 -0
- package/dist/project.js.map +1 -0
- package/dist/proto/common_pb.js +34 -0
- package/dist/proto/common_pb.js.map +1 -0
- package/dist/proto/logs_pb.js +15 -0
- package/dist/proto/logs_pb.js.map +1 -0
- package/dist/proto/repl_pb.js +15 -0
- package/dist/proto/repl_pb.js.map +1 -0
- package/dist/proto/swiplets_pb.js +28 -0
- package/dist/proto/swiplets_pb.js.map +1 -0
- package/dist/proto/system_pb.js +15 -0
- package/dist/proto/system_pb.js.map +1 -0
- package/dist/sideload.d.ts +17 -0
- package/dist/sideload.js +1098 -0
- package/dist/sideload.js.map +1 -0
- package/dist/swipt.d.ts +1 -0
- package/dist/swipt.js +631 -0
- package/dist/swipt.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/package.json +21 -7
- package/availability.mjs +0 -642
- package/client.mjs +0 -375
- package/connection.mjs +0 -450
- package/coredevice.mjs +0 -464
- package/device.mjs +0 -837
- package/i18n.mjs +0 -71
- package/ignore.mjs +0 -149
- package/metro.mjs +0 -432
- package/output.mjs +0 -177
- package/project.mjs +0 -1013
- package/proto/common_pb.js +0 -98
- package/proto/logs_pb.js +0 -34
- package/proto/repl_pb.js +0 -55
- package/proto/swiplets_pb.js +0 -179
- package/proto/system_pb.js +0 -27
- package/sideload.mjs +0 -1696
- package/swipt.mjs +0 -726
- package/version.mjs +0 -16
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
// src/i18n.ts
|
|
5
|
+
const locales = new URL("../locales/", import.meta.url);
|
|
6
|
+
const languages = /* @__PURE__ */ new Set(["en", ...fs.readdirSync(locales).map((file) => path.basename(file, ".json"))]);
|
|
7
|
+
function preferredLanguages() {
|
|
8
|
+
const variable = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG;
|
|
9
|
+
if (variable) return [variable.split(/[.@]/)[0].replaceAll("_", "-")];
|
|
10
|
+
if (process.platform !== "darwin") return [];
|
|
11
|
+
try {
|
|
12
|
+
return execFileSync("defaults", [
|
|
13
|
+
"read",
|
|
14
|
+
"-g",
|
|
15
|
+
"AppleLanguages"
|
|
16
|
+
], {
|
|
17
|
+
encoding: "utf8",
|
|
18
|
+
stdio: [
|
|
19
|
+
"ignore",
|
|
20
|
+
"pipe",
|
|
21
|
+
"ignore"
|
|
22
|
+
]
|
|
23
|
+
}).match(/[A-Za-z][\w-]*/g) ?? [];
|
|
24
|
+
} catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function supportedLanguage(tag) {
|
|
29
|
+
let locale;
|
|
30
|
+
try {
|
|
31
|
+
locale = new Intl.Locale(tag).maximize();
|
|
32
|
+
} catch {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const { language, script, region } = locale;
|
|
36
|
+
const variant = {
|
|
37
|
+
es: region === "ES" ? "es" : "es-419",
|
|
38
|
+
no: "nb",
|
|
39
|
+
pt: "pt-PT"
|
|
40
|
+
}[language];
|
|
41
|
+
return [
|
|
42
|
+
`${language}-${region}`,
|
|
43
|
+
`${language}-${script}`,
|
|
44
|
+
variant,
|
|
45
|
+
language
|
|
46
|
+
].find((candidate) => languages.has(candidate));
|
|
47
|
+
}
|
|
48
|
+
const language = preferredLanguages().map(supportedLanguage).find(Boolean) ?? "en";
|
|
49
|
+
const messages = language === "en" ? {} : JSON.parse(fs.readFileSync(new URL(`${language}.json`, locales), "utf8"));
|
|
50
|
+
const pluralRules = new Intl.PluralRules(language);
|
|
51
|
+
function tr(key, values = {}) {
|
|
52
|
+
const message = messages[key] ?? key;
|
|
53
|
+
return (typeof message === "string" ? message : message[pluralRules.select(values.count)] ?? message.other).replace(/\{(\w+)\}/g, (_, name) => values[name]);
|
|
54
|
+
}
|
|
55
|
+
export { language, tr };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":[],"sources":["../src/i18n.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst locales = new URL(\"../locales/\", import.meta.url);\n\nconst languages = new Set([\n \"en\",\n ...fs.readdirSync(locales).map((file) => path.basename(file, \".json\")),\n]);\n\nfunction preferredLanguages() {\n const variable =\n process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG;\n if (variable) {\n return [variable.split(/[.@]/)[0].replaceAll(\"_\", \"-\")];\n }\n if (process.platform !== \"darwin\") {\n return [];\n }\n try {\n return (\n execFileSync(\"defaults\", [\"read\", \"-g\", \"AppleLanguages\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).match(/[A-Za-z][\\w-]*/g) ?? []\n );\n } catch {\n return [];\n }\n}\n\nfunction supportedLanguage(tag) {\n let locale;\n try {\n locale = new Intl.Locale(tag).maximize();\n } catch {\n return undefined;\n }\n const { language, script, region } = locale;\n const variant = {\n es: region === \"ES\" ? \"es\" : \"es-419\",\n no: \"nb\",\n pt: \"pt-PT\",\n }[language];\n return [\n `${language}-${region}`,\n `${language}-${script}`,\n variant,\n language,\n ].find((candidate) => languages.has(candidate));\n}\n\nexport const language =\n preferredLanguages().map(supportedLanguage).find(Boolean) ?? \"en\";\n\nconst messages =\n language === \"en\"\n ? {}\n : JSON.parse(fs.readFileSync(new URL(`${language}.json`, locales), \"utf8\"));\n\nconst pluralRules = new Intl.PluralRules(language);\n\nexport function tr(key, values: Record<string, any> = {}) {\n const message = messages[key] ?? key;\n const text =\n typeof message === \"string\"\n ? message\n : (message[pluralRules.select(values.count)] ?? message.other);\n return text.replace(/\\{(\\w+)\\}/g, (_, name) => values[name]);\n}\n"],"mappings":";;;;AAIA,MAAM,UAAU,IAAI,IAAI,eAAe,YAAY,GAAG;AAEtD,MAAM,4BAAY,IAAI,IAAI,CACxB,MACA,GAAG,GAAG,YAAY,OAAO,CAAC,CAAC,KAAK,SAAS,KAAK,SAAS,MAAM,OAAO,CAAC,CACvE,CAAC;AAED,SAAS,qBAAqB;CAC5B,MAAM,WACJ,QAAQ,IAAI,UAAU,QAAQ,IAAI,eAAe,QAAQ,IAAI;CAC/D,IAAI,UACF,OAAO,CAAC,SAAS,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,WAAW,KAAK,GAAG,CAAC;CAExD,IAAI,QAAQ,aAAa,UACvB,OAAO,CAAC;CAEV,IAAI;EACF,OACE,aAAa,YAAY;GAAC;GAAQ;GAAM;EAAgB,GAAG;GACzD,UAAU;GACV,OAAO;IAAC;IAAU;IAAQ;GAAQ;EACpC,CAAC,CAAC,CAAC,MAAM,iBAAiB,KAAK,CAAC;CAEpC,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,SAAS,kBAAkB,KAAK;CAC9B,IAAI;CACJ,IAAI;EACF,SAAS,IAAI,KAAK,OAAO,GAAG,CAAC,CAAC,SAAS;CACzC,QAAQ;EACN;CACF;CACA,MAAM,EAAE,UAAU,QAAQ,WAAW;CACrC,MAAM,UAAU;EACd,IAAI,WAAW,OAAO,OAAO;EAC7B,IAAI;EACJ,IAAI;CACN,EAAE;CACF,OAAO;EACL,GAAG,SAAS,GAAG;EACf,GAAG,SAAS,GAAG;EACf;EACA;CACF,CAAC,CAAC,MAAM,cAAc,UAAU,IAAI,SAAS,CAAC;AAChD;AAEA,MAAa,WACX,mBAAmB,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,KAAK,OAAO,KAAK;AAE/D,MAAM,WACJ,aAAa,OACT,CAAC,IACD,KAAK,MAAM,GAAG,aAAa,IAAI,IAAI,GAAG,SAAS,QAAQ,OAAO,GAAG,MAAM,CAAC;AAE9E,MAAM,cAAc,IAAI,KAAK,YAAY,QAAQ;AAEjD,SAAgB,GAAG,KAAK,SAA8B,CAAC,GAAG;CACxD,MAAM,UAAU,SAAS,QAAQ;CAKjC,QAHE,OAAO,YAAY,WACf,UACC,QAAQ,YAAY,OAAO,OAAO,KAAK,MAAM,QAAQ,MAAA,CAChD,QAAQ,eAAe,GAAG,SAAS,OAAO,KAAK;AAC7D"}
|
package/dist/ignore.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const relativePath: (root: any, name: any) => string;
|
|
2
|
+
export declare class Ignorer {
|
|
3
|
+
rules: any[];
|
|
4
|
+
constructor(root: any);
|
|
5
|
+
read(name: any, base: any): void;
|
|
6
|
+
ignored(relative: any, directory: any): any;
|
|
7
|
+
matches(relative: any, directory: any): boolean;
|
|
8
|
+
}
|
package/dist/ignore.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// src/ignore.ts
|
|
4
|
+
const excluded = (name) => name.startsWith(".") || name === "node_modules" || name === "dist";
|
|
5
|
+
const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
6
|
+
function parseRule(line) {
|
|
7
|
+
line = line.replace(/[ \t\r]+$/, "");
|
|
8
|
+
if (line === "" || line.startsWith("#")) return;
|
|
9
|
+
const rule = {
|
|
10
|
+
negated: false,
|
|
11
|
+
directory: false
|
|
12
|
+
};
|
|
13
|
+
if (line.startsWith("!")) {
|
|
14
|
+
rule.negated = true;
|
|
15
|
+
line = line.slice(1);
|
|
16
|
+
} else if (line.startsWith("\\")) line = line.slice(1);
|
|
17
|
+
if (line.endsWith("/")) {
|
|
18
|
+
rule.directory = true;
|
|
19
|
+
line = line.replace(/\/+$/, "");
|
|
20
|
+
}
|
|
21
|
+
if (line === "") return;
|
|
22
|
+
const anchored = line.includes("/");
|
|
23
|
+
line = line.replace(/^\//, "");
|
|
24
|
+
let expression = anchored ? "^" : "^(?:.*/)?";
|
|
25
|
+
for (let index = 0; index < line.length; index++) {
|
|
26
|
+
const rest = line.slice(index);
|
|
27
|
+
if (rest.startsWith("**/")) {
|
|
28
|
+
expression += "(?:.*/)?";
|
|
29
|
+
index += 2;
|
|
30
|
+
} else if (rest === "/**") {
|
|
31
|
+
expression += "/.*";
|
|
32
|
+
index += 2;
|
|
33
|
+
} else if (rest.startsWith("**")) {
|
|
34
|
+
expression += ".*";
|
|
35
|
+
index++;
|
|
36
|
+
} else if (rest[0] === "*") expression += "[^/]*";
|
|
37
|
+
else if (rest[0] === "?") expression += "[^/]";
|
|
38
|
+
else if (rest[0] === "[" && rest.indexOf("]", 1) > 1) {
|
|
39
|
+
const end = rest.indexOf("]", 1);
|
|
40
|
+
let cls = rest.slice(1, end);
|
|
41
|
+
if (cls.startsWith("!")) cls = `^${cls.slice(1)}`;
|
|
42
|
+
expression += `[${cls.replaceAll("\\", "\\\\")}]`;
|
|
43
|
+
index += end;
|
|
44
|
+
} else if (rest[0] === "\\" && rest.length > 1) {
|
|
45
|
+
expression += escape(rest[1]);
|
|
46
|
+
index++;
|
|
47
|
+
} else expression += escape(rest[0]);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
rule.pattern = new RegExp(`${expression}$`);
|
|
51
|
+
} catch {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return rule;
|
|
55
|
+
}
|
|
56
|
+
const relativePath = (root, name) => {
|
|
57
|
+
const relative = path.relative(root, name);
|
|
58
|
+
return relative === "" || relative.startsWith("..") || path.isAbsolute(relative) ? "" : relative.split(path.sep).join("/");
|
|
59
|
+
};
|
|
60
|
+
var Ignorer = class {
|
|
61
|
+
rules = [];
|
|
62
|
+
constructor(root) {
|
|
63
|
+
const walk = (directory) => {
|
|
64
|
+
const relative = relativePath(root, directory);
|
|
65
|
+
if (relative !== "" && this.ignored(relative, true)) return;
|
|
66
|
+
this.read(path.join(directory, ".gitignore"), relative);
|
|
67
|
+
let entries;
|
|
68
|
+
try {
|
|
69
|
+
entries = fs.readdirSync(directory, { withFileTypes: true });
|
|
70
|
+
} catch {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
for (const entry of entries) if (entry.isDirectory()) walk(path.join(directory, entry.name));
|
|
74
|
+
};
|
|
75
|
+
walk(root);
|
|
76
|
+
}
|
|
77
|
+
read(name, base) {
|
|
78
|
+
let text;
|
|
79
|
+
try {
|
|
80
|
+
text = fs.readFileSync(name, "utf8");
|
|
81
|
+
} catch {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
for (const line of text.split("\n")) {
|
|
85
|
+
const rule = parseRule(line);
|
|
86
|
+
if (rule) this.rules.push({
|
|
87
|
+
...rule,
|
|
88
|
+
base
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
ignored(relative, directory) {
|
|
93
|
+
const parts = relative.split("/");
|
|
94
|
+
return parts.some((part, index) => excluded(part) || this.matches(parts.slice(0, index + 1).join("/"), directory || index < parts.length - 1));
|
|
95
|
+
}
|
|
96
|
+
matches(relative, directory) {
|
|
97
|
+
let ignored = false;
|
|
98
|
+
for (const rule of this.rules) {
|
|
99
|
+
if (rule.directory && !directory) continue;
|
|
100
|
+
let local = relative;
|
|
101
|
+
if (rule.base !== "") {
|
|
102
|
+
if (!relative.startsWith(`${rule.base}/`)) continue;
|
|
103
|
+
local = relative.slice(rule.base.length + 1);
|
|
104
|
+
}
|
|
105
|
+
if (rule.pattern.test(local)) ignored = !rule.negated;
|
|
106
|
+
}
|
|
107
|
+
return ignored;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
export { Ignorer, relativePath };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.js","names":[],"sources":["../src/ignore.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst excluded = (name) =>\n name.startsWith(\".\") || name === \"node_modules\" || name === \"dist\";\n\nconst escape = (text) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\ninterface Rule {\n negated: boolean;\n directory: boolean;\n pattern?: RegExp;\n}\n\nfunction parseRule(line) {\n line = line.replace(/[ \\t\\r]+$/, \"\");\n if (line === \"\" || line.startsWith(\"#\")) {\n return undefined;\n }\n const rule: Rule = { negated: false, directory: false };\n if (line.startsWith(\"!\")) {\n rule.negated = true;\n line = line.slice(1);\n } else if (line.startsWith(\"\\\\\")) {\n line = line.slice(1);\n }\n if (line.endsWith(\"/\")) {\n rule.directory = true;\n line = line.replace(/\\/+$/, \"\");\n }\n if (line === \"\") {\n return undefined;\n }\n const anchored = line.includes(\"/\");\n line = line.replace(/^\\//, \"\");\n let expression = anchored ? \"^\" : \"^(?:.*/)?\";\n for (let index = 0; index < line.length; index++) {\n const rest = line.slice(index);\n if (rest.startsWith(\"**/\")) {\n expression += \"(?:.*/)?\";\n index += 2;\n } else if (rest === \"/**\") {\n expression += \"/.*\";\n index += 2;\n } else if (rest.startsWith(\"**\")) {\n expression += \".*\";\n index++;\n } else if (rest[0] === \"*\") {\n expression += \"[^/]*\";\n } else if (rest[0] === \"?\") {\n expression += \"[^/]\";\n } else if (rest[0] === \"[\" && rest.indexOf(\"]\", 1) > 1) {\n const end = rest.indexOf(\"]\", 1);\n let cls = rest.slice(1, end);\n if (cls.startsWith(\"!\")) {\n cls = `^${cls.slice(1)}`;\n }\n expression += `[${cls.replaceAll(\"\\\\\", \"\\\\\\\\\")}]`;\n index += end;\n } else if (rest[0] === \"\\\\\" && rest.length > 1) {\n expression += escape(rest[1]);\n index++;\n } else {\n expression += escape(rest[0]);\n }\n }\n try {\n rule.pattern = new RegExp(`${expression}$`);\n } catch {\n return undefined;\n }\n return rule;\n}\n\nexport const relativePath = (root, name) => {\n const relative = path.relative(root, name);\n return relative === \"\" ||\n relative.startsWith(\"..\") ||\n path.isAbsolute(relative)\n ? \"\"\n : relative.split(path.sep).join(\"/\");\n};\n\nexport class Ignorer {\n rules = [];\n\n constructor(root) {\n const walk = (directory) => {\n const relative = relativePath(root, directory);\n if (relative !== \"\" && this.ignored(relative, true)) {\n return;\n }\n this.read(path.join(directory, \".gitignore\"), relative);\n let entries;\n try {\n entries = fs.readdirSync(directory, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (entry.isDirectory()) {\n walk(path.join(directory, entry.name));\n }\n }\n };\n walk(root);\n }\n\n read(name, base) {\n let text;\n try {\n text = fs.readFileSync(name, \"utf8\");\n } catch {\n return;\n }\n for (const line of text.split(\"\\n\")) {\n const rule = parseRule(line);\n if (rule) {\n this.rules.push({ ...rule, base });\n }\n }\n }\n\n ignored(relative, directory) {\n const parts = relative.split(\"/\");\n return parts.some(\n (part, index) =>\n excluded(part) ||\n this.matches(\n parts.slice(0, index + 1).join(\"/\"),\n directory || index < parts.length - 1,\n ),\n );\n }\n\n matches(relative, directory) {\n let ignored = false;\n for (const rule of this.rules) {\n if (rule.directory && !directory) {\n continue;\n }\n let local = relative;\n if (rule.base !== \"\") {\n if (!relative.startsWith(`${rule.base}/`)) {\n continue;\n }\n local = relative.slice(rule.base.length + 1);\n }\n if (rule.pattern.test(local)) {\n ignored = !rule.negated;\n }\n }\n return ignored;\n }\n}\n"],"mappings":";;;AAGA,MAAM,YAAY,SAChB,KAAK,WAAW,GAAG,KAAK,SAAS,kBAAkB,SAAS;AAE9D,MAAM,UAAU,SAAS,KAAK,QAAQ,uBAAuB,MAAM;AAQnE,SAAS,UAAU,MAAM;CACvB,OAAO,KAAK,QAAQ,aAAa,EAAE;CACnC,IAAI,SAAS,MAAM,KAAK,WAAW,GAAG,GACpC;CAEF,MAAM,OAAa;EAAE,SAAS;EAAO,WAAW;CAAM;CACtD,IAAI,KAAK,WAAW,GAAG,GAAG;EACxB,KAAK,UAAU;EACf,OAAO,KAAK,MAAM,CAAC;CACrB,OAAO,IAAI,KAAK,WAAW,IAAI,GAC7B,OAAO,KAAK,MAAM,CAAC;CAErB,IAAI,KAAK,SAAS,GAAG,GAAG;EACtB,KAAK,YAAY;EACjB,OAAO,KAAK,QAAQ,QAAQ,EAAE;CAChC;CACA,IAAI,SAAS,IACX;CAEF,MAAM,WAAW,KAAK,SAAS,GAAG;CAClC,OAAO,KAAK,QAAQ,OAAO,EAAE;CAC7B,IAAI,aAAa,WAAW,MAAM;CAClC,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,MAAM,OAAO,KAAK,MAAM,KAAK;EAC7B,IAAI,KAAK,WAAW,KAAK,GAAG;GAC1B,cAAc;GACd,SAAS;EACX,OAAO,IAAI,SAAS,OAAO;GACzB,cAAc;GACd,SAAS;EACX,OAAO,IAAI,KAAK,WAAW,IAAI,GAAG;GAChC,cAAc;GACd;EACF,OAAO,IAAI,KAAK,OAAO,KACrB,cAAc;OACT,IAAI,KAAK,OA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;EACJ,IAAI;GACF,OAAO,GAAG,aAAa,MAAM,MAAM;EACrC,QAAQ;GACN;EACF;EACA,KAAK,MAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;GACnC,MAAM,OAAO,UAAU,IAAI;GAC3B,IAAI,MACF,KAAK,MAAM,KAAK;IAAE,GAAG;IAAM;GAAK,CAAC;EAErC;CACF;CAEA,QAAQ,UAAU,WAAW;EAC3B,MAAM,QAAQ,SAAS,MAAM,GAAG;EAChC,OAAO,MAAM,MACV,MAAM,UACL,SAAS,IAAI,KACb,KAAK,QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,GAClC,aAAa,QAAQ,MAAM,SAAS,CACtC,CACJ;CACF;CAEA,QAAQ,UAAU,WAAW;EAC3B,IAAI,UAAU;EACd,KAAK,MAAM,QAAQ,KAAK,OAAO;GAC7B,IAAI,KAAK,aAAa,CAAC,WACrB;GAEF,IAAI,QAAQ;GACZ,IAAI,KAAK,SAAS,IAAI;IACpB,IAAI,CAAC,SAAS,WAAW,GAAG,KAAK,KAAK,EAAE,GACtC;IAEF,QAAQ,SAAS,MAAM,KAAK,KAAK,SAAS,CAAC;GAC7C;GACA,IAAI,KAAK,QAAQ,KAAK,KAAK,GACzB,UAAU,CAAC,KAAK;EAEpB;EACA,OAAO;CACT;AACF"}
|
package/dist/metro.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function loadEnvironment(root: any): void;
|
|
2
|
+
interface MetroOptions {
|
|
3
|
+
assets?: Map<string, string>;
|
|
4
|
+
sourcemap?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function metro(root: any, { assets, sourcemap }: MetroOptions): {
|
|
7
|
+
name: string;
|
|
8
|
+
setup(build: any): void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
package/dist/metro.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { tr } from "./i18n.js";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { transformAsync } from "@babel/core";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { loadProjectEnv } from "@expo/env";
|
|
8
|
+
import { imageSize } from "image-size";
|
|
9
|
+
// src/metro.ts
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
const cliDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const sourceExtensions = [
|
|
13
|
+
"js",
|
|
14
|
+
"jsx",
|
|
15
|
+
"json",
|
|
16
|
+
"ts",
|
|
17
|
+
"tsx",
|
|
18
|
+
"cjs",
|
|
19
|
+
"mjs"
|
|
20
|
+
];
|
|
21
|
+
const assetExtensions = [
|
|
22
|
+
"bmp",
|
|
23
|
+
"gif",
|
|
24
|
+
"jpg",
|
|
25
|
+
"jpeg",
|
|
26
|
+
"png",
|
|
27
|
+
"psd",
|
|
28
|
+
"svg",
|
|
29
|
+
"webp",
|
|
30
|
+
"xml",
|
|
31
|
+
"m4v",
|
|
32
|
+
"mov",
|
|
33
|
+
"mp4",
|
|
34
|
+
"mpeg",
|
|
35
|
+
"mpg",
|
|
36
|
+
"webm",
|
|
37
|
+
"aac",
|
|
38
|
+
"aiff",
|
|
39
|
+
"caf",
|
|
40
|
+
"m4a",
|
|
41
|
+
"mp3",
|
|
42
|
+
"wav",
|
|
43
|
+
"html",
|
|
44
|
+
"pdf",
|
|
45
|
+
"yaml",
|
|
46
|
+
"yml",
|
|
47
|
+
"otf",
|
|
48
|
+
"ttf",
|
|
49
|
+
"zip",
|
|
50
|
+
"db",
|
|
51
|
+
"sqlite",
|
|
52
|
+
"sqlite3"
|
|
53
|
+
];
|
|
54
|
+
const imageExtensions = /* @__PURE__ */ new Set([
|
|
55
|
+
"png",
|
|
56
|
+
"jpg",
|
|
57
|
+
"jpeg",
|
|
58
|
+
"bmp",
|
|
59
|
+
"gif",
|
|
60
|
+
"webp",
|
|
61
|
+
"psd",
|
|
62
|
+
"svg",
|
|
63
|
+
"tiff",
|
|
64
|
+
"ktx"
|
|
65
|
+
]);
|
|
66
|
+
const babelConfigNames = [
|
|
67
|
+
".babelrc",
|
|
68
|
+
".babelrc.js",
|
|
69
|
+
".babelrc.cjs",
|
|
70
|
+
".babelrc.mjs",
|
|
71
|
+
".babelrc.json",
|
|
72
|
+
".babelrc.cts",
|
|
73
|
+
"babel.config.js",
|
|
74
|
+
"babel.config.cjs",
|
|
75
|
+
"babel.config.mjs",
|
|
76
|
+
"babel.config.json",
|
|
77
|
+
"babel.config.cts",
|
|
78
|
+
"babel.config.ts",
|
|
79
|
+
"babel.config.mts"
|
|
80
|
+
];
|
|
81
|
+
const contextModes = [
|
|
82
|
+
"sync",
|
|
83
|
+
"eager",
|
|
84
|
+
"lazy",
|
|
85
|
+
"lazy-once"
|
|
86
|
+
];
|
|
87
|
+
const scaleSuffixes = [
|
|
88
|
+
"",
|
|
89
|
+
"@1x",
|
|
90
|
+
"@1.5x",
|
|
91
|
+
"@2x",
|
|
92
|
+
"@3x",
|
|
93
|
+
"@4x"
|
|
94
|
+
];
|
|
95
|
+
const platformSuffixes = [
|
|
96
|
+
"",
|
|
97
|
+
".ios",
|
|
98
|
+
".native"
|
|
99
|
+
];
|
|
100
|
+
const platformRank = {
|
|
101
|
+
ios: 2,
|
|
102
|
+
native: 1
|
|
103
|
+
};
|
|
104
|
+
const posix = (file) => file.split(path.sep).join("/");
|
|
105
|
+
const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
106
|
+
function loadEnvironment(root) {
|
|
107
|
+
loadProjectEnv(root, {
|
|
108
|
+
mode: "production",
|
|
109
|
+
silent: true
|
|
110
|
+
});
|
|
111
|
+
process.env.BABEL_ENV ??= "production";
|
|
112
|
+
}
|
|
113
|
+
function defaultPreset(root) {
|
|
114
|
+
try {
|
|
115
|
+
return createRequire(path.join(root, "package.json")).resolve("expo/internal/babel-preset");
|
|
116
|
+
} catch {
|
|
117
|
+
return require.resolve("babel-preset-expo");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function contextFiles(directory, recursive) {
|
|
121
|
+
if (!fs.existsSync(directory)) return [];
|
|
122
|
+
const extensions = /* @__PURE__ */ new Set([...sourceExtensions, ...assetExtensions]);
|
|
123
|
+
return fs.readdirSync(directory, { recursive }).map(posix).filter((file) => extensions.has(path.extname(file).slice(1)) && fs.statSync(path.join(directory, file)).isFile()).sort();
|
|
124
|
+
}
|
|
125
|
+
function requireContext({ types: t, template }) {
|
|
126
|
+
const argument = (call, index, fallback, expected, check) => {
|
|
127
|
+
if (call.node.arguments[index] === void 0) {
|
|
128
|
+
if (fallback !== void 0) return fallback;
|
|
129
|
+
} else {
|
|
130
|
+
const { confident, value } = call.get(`arguments.${index}`).evaluate();
|
|
131
|
+
if (confident && check(value)) return value;
|
|
132
|
+
}
|
|
133
|
+
throw call.buildCodeFrameError(tr("argument {index} of require.context must be {expected}", {
|
|
134
|
+
index: index + 1,
|
|
135
|
+
expected
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
const pattern = (call, index) => {
|
|
139
|
+
const node = call.node.arguments[index];
|
|
140
|
+
if (node === void 0) return /^\.\/.*$/;
|
|
141
|
+
if (!t.isRegExpLiteral(node)) throw call.buildCodeFrameError(tr("argument {index} of require.context must be a regular expression literal", { index: index + 1 }));
|
|
142
|
+
return new RegExp(node.pattern, node.flags.replace(/[gy]/g, ""));
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
name: "swipt-require-context",
|
|
146
|
+
visitor: { CallExpression(call, state) {
|
|
147
|
+
const { callee } = call.node;
|
|
148
|
+
if (!t.isMemberExpression(callee) || !t.isIdentifier(callee.object, { name: "require" }) || call.scope.hasBinding("require") || !(callee.computed ? t.isStringLiteral(callee.property, { value: "context" }) : t.isIdentifier(callee.property, { name: "context" }))) return;
|
|
149
|
+
const from = path.dirname(state.filename);
|
|
150
|
+
const directory = path.resolve(from, argument(call, 0, void 0, tr("a string"), (value) => typeof value === "string"));
|
|
151
|
+
const recursive = argument(call, 1, true, tr("a boolean"), (value) => typeof value === "boolean");
|
|
152
|
+
const filter = pattern(call, 2);
|
|
153
|
+
const mode = argument(call, 3, "sync", tr("one of {values}", { values: contextModes.join(", ") }), (value) => contextModes.includes(value));
|
|
154
|
+
const entries = contextFiles(directory, recursive).map((file) => `./${file}`).filter((key) => filter.test(key)).map((key) => {
|
|
155
|
+
const target = posix(path.relative(from, path.join(directory, key)));
|
|
156
|
+
return `${JSON.stringify(key)}: () => require(${JSON.stringify(target.startsWith(".") ? target : `./${target}`)})`;
|
|
157
|
+
});
|
|
158
|
+
call.replaceWith(template.expression.ast(`(() => {
|
|
159
|
+
const modules = { ${entries.join(", ")} };
|
|
160
|
+
const context = key => {
|
|
161
|
+
if (!Object.prototype.hasOwnProperty.call(modules, key)) {
|
|
162
|
+
throw Object.assign(new Error("Cannot find module '" + key + "'"), { code: "MODULE_NOT_FOUND" });
|
|
163
|
+
}
|
|
164
|
+
return ${mode === "sync" ? "modules[key]()" : "Promise.resolve().then(modules[key])"};
|
|
165
|
+
};
|
|
166
|
+
context.keys = () => Object.keys(modules);
|
|
167
|
+
context.resolve = key => key;
|
|
168
|
+
context.id = ${JSON.stringify(posix(path.relative(state.cwd, directory)) || ".")};
|
|
169
|
+
return context;
|
|
170
|
+
})()`));
|
|
171
|
+
} }
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const loaderOf = (file) => {
|
|
175
|
+
const extension = path.extname(file);
|
|
176
|
+
return extension === ".tsx" ? "tsx" : [
|
|
177
|
+
".ts",
|
|
178
|
+
".mts",
|
|
179
|
+
".cts"
|
|
180
|
+
].includes(extension) ? "ts" : "jsx";
|
|
181
|
+
};
|
|
182
|
+
function archivedAsset(root, file) {
|
|
183
|
+
const relative = path.relative(root, file).split(path.sep);
|
|
184
|
+
return relative[0] === "assets" ? {
|
|
185
|
+
path: relative.slice(1).join("/"),
|
|
186
|
+
bundled: false
|
|
187
|
+
} : {
|
|
188
|
+
path: relative.map((part) => part === ".." ? "__" : part).join("/"),
|
|
189
|
+
bundled: true
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function assetVariants(resolved) {
|
|
193
|
+
const directory = path.dirname(resolved);
|
|
194
|
+
const extension = path.extname(resolved);
|
|
195
|
+
const stem = path.basename(resolved, extension).replace(/(\.(ios|native))$/, "").replace(/@[\d.]+x$/, "");
|
|
196
|
+
const pattern = new RegExp(`^${escape(stem)}(?:@([\\d.]+)x)?(?:\\.(ios|native))?${escape(extension)}$`);
|
|
197
|
+
const scales = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const name of fs.readdirSync(directory)) {
|
|
199
|
+
const match = pattern.exec(name);
|
|
200
|
+
if (match === null) continue;
|
|
201
|
+
const scale = match[1] === void 0 ? 1 : Number(match[1]);
|
|
202
|
+
const rank = platformRank[match[2]] ?? 0;
|
|
203
|
+
if (Number.isFinite(scale) && (scales.get(scale)?.rank ?? -1) < rank) scales.set(scale, {
|
|
204
|
+
rank,
|
|
205
|
+
file: path.join(directory, name)
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return [...scales].sort(([a], [b]) => a - b).map(([scale, { file }]) => ({
|
|
209
|
+
scale,
|
|
210
|
+
file
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
function assetModule(root, variants, assets) {
|
|
214
|
+
const [first] = variants;
|
|
215
|
+
const extension = path.extname(first.file).slice(1);
|
|
216
|
+
const size = imageExtensions.has(extension) ? imageSize(fs.readFileSync(first.file)) : void 0;
|
|
217
|
+
const files = variants.map(({ scale, file }) => {
|
|
218
|
+
const archived = archivedAsset(root, file);
|
|
219
|
+
if (archived.bundled) assets.set(archived.path, file);
|
|
220
|
+
return [scale, archived.path];
|
|
221
|
+
});
|
|
222
|
+
return `const { PixelRatio } = require("react-native");
|
|
223
|
+
const { assets } = require("@swipt/api/file-system");
|
|
224
|
+
const files = ${JSON.stringify(files)};
|
|
225
|
+
const ratio = PixelRatio.get();
|
|
226
|
+
const [scale, file] = files.find(([scale]) => scale >= ratio) ?? files[files.length - 1];
|
|
227
|
+
module.exports = { uri: assets.file(file).uri, scale${size ? `, width: ${size.width / first.scale}, height: ${size.height / first.scale}` : ""} };
|
|
228
|
+
`;
|
|
229
|
+
}
|
|
230
|
+
function checkWorklets(root) {
|
|
231
|
+
let plugin;
|
|
232
|
+
try {
|
|
233
|
+
plugin = require.resolve("react-native-worklets/plugin", { paths: [root] });
|
|
234
|
+
} catch {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const { version } = JSON.parse(fs.readFileSync(path.join(path.dirname(plugin), "..", "package.json"), "utf8"));
|
|
238
|
+
const { version: expected } = require("react-native-worklets/package.json");
|
|
239
|
+
if (version !== expected) throw new Error(tr("the project has react-native-worklets {version}, but Swipt runs {expected}; install react-native-worklets@{expected} or remove it", {
|
|
240
|
+
version,
|
|
241
|
+
expected
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
function metro(root, { assets, sourcemap }) {
|
|
245
|
+
checkWorklets(root);
|
|
246
|
+
const configName = babelConfigNames.find((name) => fs.existsSync(path.join(root, name)));
|
|
247
|
+
const babel = {
|
|
248
|
+
cwd: root,
|
|
249
|
+
root,
|
|
250
|
+
babelrc: false,
|
|
251
|
+
configFile: false,
|
|
252
|
+
sourceType: "unambiguous",
|
|
253
|
+
envName: "production",
|
|
254
|
+
compact: false,
|
|
255
|
+
retainLines: true,
|
|
256
|
+
sourceMaps: sourcemap ? "inline" : false,
|
|
257
|
+
...configName ? { extends: path.join(root, configName) } : { presets: [defaultPreset(root)] },
|
|
258
|
+
plugins: [requireContext]
|
|
259
|
+
};
|
|
260
|
+
const caller = {
|
|
261
|
+
name: "metro",
|
|
262
|
+
bundler: "metro",
|
|
263
|
+
platform: "ios",
|
|
264
|
+
engine: "hermes",
|
|
265
|
+
isDev: false,
|
|
266
|
+
isServer: false,
|
|
267
|
+
isReactServer: false,
|
|
268
|
+
baseUrl: "",
|
|
269
|
+
routerRoot: "app",
|
|
270
|
+
projectRoot: root,
|
|
271
|
+
isHMREnabled: true,
|
|
272
|
+
metroSourceType: "module",
|
|
273
|
+
supportsStaticESM: true
|
|
274
|
+
};
|
|
275
|
+
const internal = Symbol("internal");
|
|
276
|
+
return {
|
|
277
|
+
name: "swiplet-metro",
|
|
278
|
+
setup(build) {
|
|
279
|
+
build.onResolve({ filter: /^@babel\/runtime\// }, async (args) => {
|
|
280
|
+
if (args.pluginData === internal) return;
|
|
281
|
+
const options = {
|
|
282
|
+
kind: args.kind,
|
|
283
|
+
importer: args.importer,
|
|
284
|
+
pluginData: internal
|
|
285
|
+
};
|
|
286
|
+
const found = await build.resolve(args.path, {
|
|
287
|
+
...options,
|
|
288
|
+
resolveDir: args.resolveDir
|
|
289
|
+
});
|
|
290
|
+
return found.errors.length === 0 ? found : build.resolve(args.path, {
|
|
291
|
+
...options,
|
|
292
|
+
resolveDir: cliDirectory
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
if (assets) {
|
|
296
|
+
build.onResolve({ filter: new RegExp(`\\.(${assetExtensions.join("|")})$`) }, async (args) => {
|
|
297
|
+
if (args.pluginData === internal) return;
|
|
298
|
+
const extension = path.extname(args.path);
|
|
299
|
+
const stem = args.path.slice(0, -extension.length);
|
|
300
|
+
let first;
|
|
301
|
+
for (const scale of scaleSuffixes) for (const platform of platformSuffixes) {
|
|
302
|
+
const found = await build.resolve(`${stem}${scale}${platform}${extension}`, {
|
|
303
|
+
kind: args.kind,
|
|
304
|
+
importer: args.importer,
|
|
305
|
+
resolveDir: args.resolveDir,
|
|
306
|
+
pluginData: internal
|
|
307
|
+
});
|
|
308
|
+
if (found.errors.length === 0) return {
|
|
309
|
+
path: found.path,
|
|
310
|
+
namespace: "swiplet-asset",
|
|
311
|
+
pluginData: assetVariants(found.path)
|
|
312
|
+
};
|
|
313
|
+
first ??= found;
|
|
314
|
+
}
|
|
315
|
+
return { errors: first.errors };
|
|
316
|
+
});
|
|
317
|
+
build.onLoad({
|
|
318
|
+
filter: /.*/,
|
|
319
|
+
namespace: "swiplet-asset"
|
|
320
|
+
}, (args) => ({
|
|
321
|
+
contents: assetModule(root, args.pluginData, assets),
|
|
322
|
+
loader: "js",
|
|
323
|
+
resolveDir: root
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
build.onLoad({
|
|
327
|
+
filter: /\.[cm]?[jt]sx?$/,
|
|
328
|
+
namespace: "file"
|
|
329
|
+
}, async (args) => {
|
|
330
|
+
const result = await transformAsync(await fs.promises.readFile(args.path, "utf8"), {
|
|
331
|
+
...babel,
|
|
332
|
+
filename: args.path,
|
|
333
|
+
caller: {
|
|
334
|
+
...caller,
|
|
335
|
+
isNodeModule: args.path.includes("node_modules")
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
return result === null ? void 0 : {
|
|
339
|
+
contents: result.code,
|
|
340
|
+
loader: loaderOf(args.path),
|
|
341
|
+
resolveDir: path.dirname(args.path)
|
|
342
|
+
};
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
export { loadEnvironment, metro };
|
|
348
|
+
|
|
349
|
+
//# sourceMappingURL=metro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metro.js","names":[],"sources":["../src/metro.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { transformAsync } from \"@babel/core\";\nimport { loadProjectEnv } from \"@expo/env\";\nimport { imageSize } from \"image-size\";\n\nimport { tr } from \"./i18n\";\n\nconst require = createRequire(import.meta.url);\nconst cliDirectory = path.dirname(fileURLToPath(import.meta.url));\n\nconst sourceExtensions = [\"js\", \"jsx\", \"json\", \"ts\", \"tsx\", \"cjs\", \"mjs\"];\nconst assetExtensions = [\n \"bmp\",\n \"gif\",\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"psd\",\n \"svg\",\n \"webp\",\n \"xml\",\n \"m4v\",\n \"mov\",\n \"mp4\",\n \"mpeg\",\n \"mpg\",\n \"webm\",\n \"aac\",\n \"aiff\",\n \"caf\",\n \"m4a\",\n \"mp3\",\n \"wav\",\n \"html\",\n \"pdf\",\n \"yaml\",\n \"yml\",\n \"otf\",\n \"ttf\",\n \"zip\",\n \"db\",\n \"sqlite\",\n \"sqlite3\",\n];\nconst imageExtensions = new Set([\n \"png\",\n \"jpg\",\n \"jpeg\",\n \"bmp\",\n \"gif\",\n \"webp\",\n \"psd\",\n \"svg\",\n \"tiff\",\n \"ktx\",\n]);\nconst babelConfigNames = [\n \".babelrc\",\n \".babelrc.js\",\n \".babelrc.cjs\",\n \".babelrc.mjs\",\n \".babelrc.json\",\n \".babelrc.cts\",\n \"babel.config.js\",\n \"babel.config.cjs\",\n \"babel.config.mjs\",\n \"babel.config.json\",\n \"babel.config.cts\",\n \"babel.config.ts\",\n \"babel.config.mts\",\n];\nconst contextModes = [\"sync\", \"eager\", \"lazy\", \"lazy-once\"];\nconst scaleSuffixes = [\"\", \"@1x\", \"@1.5x\", \"@2x\", \"@3x\", \"@4x\"];\nconst platformSuffixes = [\"\", \".ios\", \".native\"];\nconst platformRank = { ios: 2, native: 1 };\n\nconst posix = (file) => file.split(path.sep).join(\"/\");\nconst escape = (text) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\nexport function loadEnvironment(root) {\n loadProjectEnv(root, { mode: \"production\", silent: true });\n process.env.BABEL_ENV ??= \"production\";\n}\n\nfunction defaultPreset(root) {\n try {\n return createRequire(path.join(root, \"package.json\")).resolve(\n \"expo/internal/babel-preset\",\n );\n } catch {\n return require.resolve(\"babel-preset-expo\");\n }\n}\n\nfunction contextFiles(directory, recursive) {\n if (!fs.existsSync(directory)) {\n return [];\n }\n const extensions = new Set([...sourceExtensions, ...assetExtensions]);\n return fs\n .readdirSync(directory, { recursive })\n .map(posix)\n .filter(\n (file) =>\n extensions.has(path.extname(file).slice(1)) &&\n fs.statSync(path.join(directory, file)).isFile(),\n )\n .sort();\n}\n\nfunction requireContext({ types: t, template }) {\n const argument = (call, index, fallback, expected, check) => {\n if (call.node.arguments[index] === undefined) {\n if (fallback !== undefined) {\n return fallback;\n }\n } else {\n const { confident, value } = call.get(`arguments.${index}`).evaluate();\n if (confident && check(value)) {\n return value;\n }\n }\n throw call.buildCodeFrameError(\n tr(\"argument {index} of require.context must be {expected}\", {\n index: index + 1,\n expected,\n }),\n );\n };\n const pattern = (call, index) => {\n const node = call.node.arguments[index];\n if (node === undefined) {\n return /^\\.\\/.*$/;\n }\n if (!t.isRegExpLiteral(node)) {\n throw call.buildCodeFrameError(\n tr(\n \"argument {index} of require.context must be a regular expression literal\",\n { index: index + 1 },\n ),\n );\n }\n return new RegExp(node.pattern, node.flags.replace(/[gy]/g, \"\"));\n };\n return {\n name: \"swipt-require-context\",\n visitor: {\n CallExpression(call, state) {\n const { callee } = call.node;\n if (\n !t.isMemberExpression(callee) ||\n !t.isIdentifier(callee.object, { name: \"require\" }) ||\n call.scope.hasBinding(\"require\") ||\n !(callee.computed\n ? t.isStringLiteral(callee.property, { value: \"context\" })\n : t.isIdentifier(callee.property, { name: \"context\" }))\n ) {\n return;\n }\n const from = path.dirname(state.filename);\n const directory = path.resolve(\n from,\n argument(\n call,\n 0,\n undefined,\n tr(\"a string\"),\n (value) => typeof value === \"string\",\n ),\n );\n const recursive = argument(\n call,\n 1,\n true,\n tr(\"a boolean\"),\n (value) => typeof value === \"boolean\",\n );\n const filter = pattern(call, 2);\n const mode = argument(\n call,\n 3,\n \"sync\",\n tr(\"one of {values}\", { values: contextModes.join(\", \") }),\n (value) => contextModes.includes(value),\n );\n const entries = contextFiles(directory, recursive)\n .map((file) => `./${file}`)\n .filter((key) => filter.test(key))\n .map((key) => {\n const target = posix(\n path.relative(from, path.join(directory, key)),\n );\n return `${JSON.stringify(key)}: () => require(${JSON.stringify(target.startsWith(\".\") ? target : `./${target}`)})`;\n });\n call.replaceWith(\n template.expression.ast(`(() => {\n const modules = { ${entries.join(\", \")} };\n const context = key => {\n if (!Object.prototype.hasOwnProperty.call(modules, key)) {\n throw Object.assign(new Error(\"Cannot find module '\" + key + \"'\"), { code: \"MODULE_NOT_FOUND\" });\n }\n return ${mode === \"sync\" ? \"modules[key]()\" : \"Promise.resolve().then(modules[key])\"};\n };\n context.keys = () => Object.keys(modules);\n context.resolve = key => key;\n context.id = ${JSON.stringify(posix(path.relative(state.cwd, directory)) || \".\")};\n return context;\n })()`),\n );\n },\n },\n };\n}\n\nconst loaderOf = (file) => {\n const extension = path.extname(file);\n return extension === \".tsx\"\n ? \"tsx\"\n : [\".ts\", \".mts\", \".cts\"].includes(extension)\n ? \"ts\"\n : \"jsx\";\n};\n\nfunction archivedAsset(root, file) {\n const relative = path.relative(root, file).split(path.sep);\n return relative[0] === \"assets\"\n ? { path: relative.slice(1).join(\"/\"), bundled: false }\n : {\n path: relative.map((part) => (part === \"..\" ? \"__\" : part)).join(\"/\"),\n bundled: true,\n };\n}\n\nfunction assetVariants(resolved) {\n const directory = path.dirname(resolved);\n const extension = path.extname(resolved);\n const stem = path\n .basename(resolved, extension)\n .replace(/(\\.(ios|native))$/, \"\")\n .replace(/@[\\d.]+x$/, \"\");\n const pattern = new RegExp(\n `^${escape(stem)}(?:@([\\\\d.]+)x)?(?:\\\\.(ios|native))?${escape(extension)}$`,\n );\n const scales = new Map();\n for (const name of fs.readdirSync(directory)) {\n const match = pattern.exec(name);\n if (match === null) {\n continue;\n }\n const scale = match[1] === undefined ? 1 : Number(match[1]);\n const rank = platformRank[match[2]] ?? 0;\n if (Number.isFinite(scale) && (scales.get(scale)?.rank ?? -1) < rank) {\n scales.set(scale, { rank, file: path.join(directory, name) });\n }\n }\n return [...scales]\n .sort(([a], [b]) => a - b)\n .map(([scale, { file }]) => ({ scale, file }));\n}\n\nfunction assetModule(root, variants, assets) {\n const [first] = variants;\n const extension = path.extname(first.file).slice(1);\n const size = imageExtensions.has(extension)\n ? imageSize(fs.readFileSync(first.file))\n : undefined;\n const files = variants.map(({ scale, file }) => {\n const archived = archivedAsset(root, file);\n if (archived.bundled) {\n assets.set(archived.path, file);\n }\n return [scale, archived.path];\n });\n return `const { PixelRatio } = require(\"react-native\");\nconst { assets } = require(\"@swipt/api/file-system\");\nconst files = ${JSON.stringify(files)};\nconst ratio = PixelRatio.get();\nconst [scale, file] = files.find(([scale]) => scale >= ratio) ?? files[files.length - 1];\nmodule.exports = { uri: assets.file(file).uri, scale${size ? `, width: ${size.width / first.scale}, height: ${size.height / first.scale}` : \"\"} };\n`;\n}\n\nfunction checkWorklets(root) {\n let plugin;\n try {\n plugin = require.resolve(\"react-native-worklets/plugin\", { paths: [root] });\n } catch {\n return;\n }\n const { version } = JSON.parse(\n fs.readFileSync(\n path.join(path.dirname(plugin), \"..\", \"package.json\"),\n \"utf8\",\n ),\n );\n const { version: expected } = require(\"react-native-worklets/package.json\");\n if (version !== expected) {\n throw new Error(\n tr(\n \"the project has react-native-worklets {version}, but Swipt runs {expected}; install react-native-worklets@{expected} or remove it\",\n { version, expected },\n ),\n );\n }\n}\n\ninterface MetroOptions {\n assets?: Map<string, string>;\n sourcemap?: boolean;\n}\n\nexport function metro(root, { assets, sourcemap }: MetroOptions) {\n checkWorklets(root);\n const configName = babelConfigNames.find((name) =>\n fs.existsSync(path.join(root, name)),\n );\n const babel = {\n cwd: root,\n root,\n babelrc: false,\n configFile: false,\n sourceType: \"unambiguous\",\n envName: \"production\",\n compact: false,\n retainLines: true,\n sourceMaps: sourcemap ? \"inline\" : false,\n ...(configName\n ? { extends: path.join(root, configName) }\n : { presets: [defaultPreset(root)] }),\n plugins: [requireContext],\n };\n const caller = {\n name: \"metro\",\n bundler: \"metro\",\n platform: \"ios\",\n engine: \"hermes\",\n isDev: false,\n isServer: false,\n isReactServer: false,\n baseUrl: \"\",\n routerRoot: \"app\",\n projectRoot: root,\n isHMREnabled: true,\n metroSourceType: \"module\",\n supportsStaticESM: true,\n };\n const internal = Symbol(\"internal\");\n return {\n name: \"swiplet-metro\",\n setup(build) {\n build.onResolve({ filter: /^@babel\\/runtime\\// }, async (args) => {\n if (args.pluginData === internal) {\n return undefined;\n }\n const options = {\n kind: args.kind,\n importer: args.importer,\n pluginData: internal,\n };\n const found = await build.resolve(args.path, {\n ...options,\n resolveDir: args.resolveDir,\n });\n return found.errors.length === 0\n ? found\n : build.resolve(args.path, { ...options, resolveDir: cliDirectory });\n });\n if (assets) {\n build.onResolve(\n { filter: new RegExp(`\\\\.(${assetExtensions.join(\"|\")})$`) },\n async (args) => {\n if (args.pluginData === internal) {\n return undefined;\n }\n const extension = path.extname(args.path);\n const stem = args.path.slice(0, -extension.length);\n let first;\n for (const scale of scaleSuffixes) {\n for (const platform of platformSuffixes) {\n const found = await build.resolve(\n `${stem}${scale}${platform}${extension}`,\n {\n kind: args.kind,\n importer: args.importer,\n resolveDir: args.resolveDir,\n pluginData: internal,\n },\n );\n if (found.errors.length === 0) {\n return {\n path: found.path,\n namespace: \"swiplet-asset\",\n pluginData: assetVariants(found.path),\n };\n }\n first ??= found;\n }\n }\n return { errors: first.errors };\n },\n );\n build.onLoad({ filter: /.*/, namespace: \"swiplet-asset\" }, (args) => ({\n contents: assetModule(root, args.pluginData, assets),\n loader: \"js\",\n resolveDir: root,\n }));\n }\n build.onLoad(\n { filter: /\\.[cm]?[jt]sx?$/, namespace: \"file\" },\n async (args) => {\n const result = await transformAsync(\n await fs.promises.readFile(args.path, \"utf8\"),\n {\n ...babel,\n filename: args.path,\n caller: {\n ...caller,\n isNodeModule: args.path.includes(\"node_modules\"),\n },\n },\n );\n return result === null\n ? undefined\n : {\n contents: result.code,\n loader: loaderOf(args.path),\n resolveDir: path.dirname(args.path),\n };\n },\n );\n },\n };\n}\n"],"mappings":";;;;;;;;;AAWA,MAAM,UAAU,cAAc,YAAY,GAAG;AAC7C,MAAM,eAAe,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAEhE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,QAAQ;KAAM,WAAW;IAAgB,IAAI,UAAU;KACpE,UAAU,YAAY,MAAM,KAAK,YAAY,MAAM;KACnD,QAAQ;KACR,YAAY;IACd,EAAE;GACJ;GACA,MAAM,OACJ;IAAE,QAAQ;IAAmB,WAAW;GAAO,GAC/C,OAAO,SAAS;IACd,MAAM,SAAS,MAAM,eACnB,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,MAAM,GAC5C;KACE,GAAG;KACH,UAAU,KAAK;KACf,QAAQ;MACN,GAAG;MACH,cAAc,KAAK,KAAK,SAAS,cAAc;KACjD;IACF,CACF;IACA,OAAO,WAAW,OACd,KAAA,IACA;KACE,UAAU,OAAO;KACjB,QAAQ,SAAS,KAAK,IAAI;KAC1B,YAAY,KAAK,QAAQ,KAAK,IAAI;IACpC;GACN,CACF;EACF;CACF;AACF"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class FalseResult extends Error {}
|
|
2
|
+
export declare const selectTheme: {
|
|
3
|
+
style: {
|
|
4
|
+
keysHelpTip: () => string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const interactive: (context: any) => boolean;
|
|
8
|
+
export declare function choose(context: any, message: any, choices: any, failure: any): Promise<unknown>;
|
|
9
|
+
export declare function step(label: any, run: any, { transient }?: {
|
|
10
|
+
transient?: boolean;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
export declare function clockTime(timestamp: any): string;
|
|
13
|
+
export declare function dateTime(timestamp: any): string;
|
|
14
|
+
export declare function columns(rows: any): any;
|
|
15
|
+
export declare const failureText: (failure: any) => string;
|
|
16
|
+
export declare function printScriptError(failure: any): FalseResult;
|
|
17
|
+
export declare function printLog(entry: any, toStdout: any): void;
|
|
18
|
+
export declare const serviceEnabledText: (enabled: any) => any;
|
|
19
|
+
export declare const serviceStatusText: (status: any) => any;
|
|
20
|
+
export declare function serviceText(_id: any, state: any): any;
|