@swipt/cli 0.1.0-nightly.98 → 0.1.0-nightly.99
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 +3 -1
- package/dist/availability.js +173 -151
- package/dist/availability.js.map +1 -1
- package/dist/cli/cli.js +52 -66
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/command.d.ts +9 -0
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/data/clear.js +2 -2
- package/dist/cli/commands/data/clear.js.map +1 -1
- package/dist/cli/commands/data/data.js +2 -2
- package/dist/cli/commands/data/data.js.map +1 -1
- package/dist/cli/commands/data/list.js +3 -3
- package/dist/cli/commands/data/list.js.map +1 -1
- package/dist/cli/commands/data/operand.js.map +1 -1
- package/dist/cli/commands/data/read.js +4 -7
- package/dist/cli/commands/data/read.js.map +1 -1
- package/dist/cli/commands/data/remove.js +3 -3
- package/dist/cli/commands/data/remove.js.map +1 -1
- package/dist/cli/commands/data/write.js +2 -2
- package/dist/cli/commands/data/write.js.map +1 -1
- package/dist/cli/commands/device/add.js +2 -2
- package/dist/cli/commands/device/add.js.map +1 -1
- package/dist/cli/commands/device/device.js +2 -2
- package/dist/cli/commands/device/device.js.map +1 -1
- package/dist/cli/commands/device/list.js +2 -2
- package/dist/cli/commands/device/list.js.map +1 -1
- package/dist/cli/commands/device/logs.js +44 -46
- package/dist/cli/commands/device/logs.js.map +1 -1
- package/dist/cli/commands/device/remove.js +2 -2
- package/dist/cli/commands/device/remove.js.map +1 -1
- package/dist/cli/commands/device/stop.js +3 -3
- package/dist/cli/commands/device/stop.js.map +1 -1
- package/dist/cli/commands/driver/driver.js +6 -6
- package/dist/cli/commands/driver/driver.js.map +1 -1
- package/dist/cli/commands/flags.js +9 -9
- package/dist/cli/commands/flags.js.map +1 -1
- package/dist/cli/commands/index.js +2 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/project/build.js +2 -2
- package/dist/cli/commands/project/build.js.map +1 -1
- package/dist/cli/commands/project/create.js +3 -3
- package/dist/cli/commands/project/create.js.map +1 -1
- package/dist/cli/commands/project/deploy.js +2 -2
- package/dist/cli/commands/project/deploy.js.map +1 -1
- package/dist/cli/commands/project/develop.js +19 -19
- package/dist/cli/commands/project/develop.js.map +1 -1
- package/dist/cli/commands/project/project.js +2 -2
- package/dist/cli/commands/project/project.js.map +1 -1
- package/dist/cli/commands/project/source.js +62 -37
- package/dist/cli/commands/project/source.js.map +1 -1
- package/dist/cli/commands/repl/api.js +2 -2
- package/dist/cli/commands/repl/api.js.map +1 -1
- package/dist/cli/commands/repl/repl.js +4 -4
- package/dist/cli/commands/repl/repl.js.map +1 -1
- package/dist/cli/commands/repl/reset.js +2 -2
- package/dist/cli/commands/repl/reset.js.map +1 -1
- package/dist/cli/commands/repl/run.js +5 -5
- package/dist/cli/commands/repl/run.js.map +1 -1
- package/dist/cli/commands/sideload/install.js +4 -4
- package/dist/cli/commands/sideload/install.js.map +1 -1
- package/dist/cli/commands/sideload/setup.js +3 -3
- package/dist/cli/commands/sideload/setup.js.map +1 -1
- package/dist/cli/commands/sideload/sideload.js +2 -2
- package/dist/cli/commands/sideload/sideload.js.map +1 -1
- package/dist/cli/commands/sideload/uninstall.js +2 -2
- package/dist/cli/commands/sideload/uninstall.js.map +1 -1
- package/dist/cli/commands/sideload/update.js +3 -3
- package/dist/cli/commands/sideload/update.js.map +1 -1
- package/dist/cli/commands/swiplet/call.js +6 -6
- package/dist/cli/commands/swiplet/call.js.map +1 -1
- package/dist/cli/commands/swiplet/install.js +3 -3
- package/dist/cli/commands/swiplet/install.js.map +1 -1
- package/dist/cli/commands/swiplet/list.js +8 -8
- package/dist/cli/commands/swiplet/list.js.map +1 -1
- package/dist/cli/commands/swiplet/remove.js +3 -3
- package/dist/cli/commands/swiplet/remove.js.map +1 -1
- package/dist/cli/commands/swiplet/service/disable.js +3 -3
- package/dist/cli/commands/swiplet/service/disable.js.map +1 -1
- package/dist/cli/commands/swiplet/service/enable.js +3 -3
- package/dist/cli/commands/swiplet/service/enable.js.map +1 -1
- package/dist/cli/commands/swiplet/service/service.js +2 -2
- package/dist/cli/commands/swiplet/service/service.js.map +1 -1
- package/dist/cli/commands/swiplet/service/services.js +2 -2
- package/dist/cli/commands/swiplet/service/services.js.map +1 -1
- package/dist/cli/commands/swiplet/service/watch.js +2 -2
- package/dist/cli/commands/swiplet/service/watch.js.map +1 -1
- package/dist/cli/commands/swiplet/show.js +6 -6
- package/dist/cli/commands/swiplet/show.js.map +1 -1
- package/dist/cli/commands/swiplet/swiplet.js +4 -4
- package/dist/cli/commands/swiplet/swiplet.js.map +1 -1
- package/dist/cli/commands/version/version.js +2 -2
- package/dist/cli/commands/version/version.js.map +1 -1
- package/dist/cli/deploy.js +9 -7
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/session.js.map +1 -1
- package/dist/client.d.ts +145 -7
- package/dist/client.js +20 -22
- package/dist/client.js.map +1 -1
- package/dist/connection.d.ts +292 -25
- package/dist/connection.js +36 -35
- package/dist/connection.js.map +1 -1
- package/dist/driver.d.ts +62 -23
- package/dist/driver.js +29 -33
- package/dist/driver.js.map +1 -1
- package/dist/i18n.d.ts +2 -5
- package/dist/i18n.js +15 -13
- package/dist/i18n.js.map +1 -1
- package/dist/i18next.d.ts +7 -0
- package/dist/ignore.d.ts +14 -7
- package/dist/ignore.js +13 -14
- package/dist/ignore.js.map +1 -1
- package/dist/mdns.d.ts +2 -2
- package/dist/mdns.js +1 -1
- package/dist/mdns.js.map +1 -1
- package/dist/metro.d.ts +19 -5
- package/dist/metro.js +61 -63
- package/dist/metro.js.map +1 -1
- package/dist/output.d.ts +29 -14
- package/dist/output.js +17 -15
- package/dist/output.js.map +1 -1
- package/dist/passcode.d.ts +12 -8
- package/dist/passcode.js +18 -18
- package/dist/passcode.js.map +1 -1
- package/dist/project.d.ts +20 -10
- package/dist/project.js +72 -49
- package/dist/project.js.map +1 -1
- package/dist/proto/common_pb.d.ts +240 -0
- package/dist/proto/common_pb.js +7 -2
- package/dist/proto/common_pb.js.map +1 -1
- package/dist/proto/logs_pb.d.ts +38 -0
- package/dist/proto/repl_pb.d.ts +96 -0
- package/dist/proto/swiplets_pb.d.ts +361 -0
- package/dist/proto/swiplets_pb.js +7 -2
- package/dist/proto/swiplets_pb.js.map +1 -1
- package/dist/proto/system_pb.d.ts +33 -0
- package/dist/resources.d.ts +400 -0
- package/dist/serve.d.ts +9 -1
- package/dist/serve.js +17 -16
- package/dist/serve.js.map +1 -1
- package/dist/sideload.d.ts +27 -14
- package/dist/sideload.js +102 -89
- package/dist/sideload.js.map +1 -1
- package/dist/swipt-app.d.ts +19 -9
- package/dist/swipt-app.js +1 -1
- package/dist/swipt-app.js.map +1 -1
- package/locales/ar/translation.json +413 -0
- package/locales/bg/translation.json +397 -0
- package/locales/bn/translation.json +397 -0
- package/locales/ca/translation.json +401 -0
- package/locales/cs/translation.json +405 -0
- package/locales/da/translation.json +397 -0
- package/locales/de/translation.json +397 -0
- package/locales/el/translation.json +397 -0
- package/locales/en/translation.json +397 -0
- package/locales/es/translation.json +401 -0
- package/locales/es-419/translation.json +401 -0
- package/locales/fi/translation.json +397 -0
- package/locales/fr/translation.json +401 -0
- package/locales/fr-CA/translation.json +401 -0
- package/locales/gu/translation.json +397 -0
- package/locales/he/translation.json +401 -0
- package/locales/hi/translation.json +397 -0
- package/locales/hr/translation.json +401 -0
- package/locales/hu/translation.json +397 -0
- package/locales/id/translation.json +393 -0
- package/locales/it/translation.json +401 -0
- package/locales/ja/translation.json +393 -0
- package/locales/kk/translation.json +397 -0
- package/locales/kn/translation.json +397 -0
- package/locales/ko/translation.json +393 -0
- package/locales/lt/translation.json +405 -0
- package/locales/ml/translation.json +397 -0
- package/locales/mr/translation.json +397 -0
- package/locales/ms/translation.json +393 -0
- package/locales/nb/translation.json +397 -0
- package/locales/nl/translation.json +397 -0
- package/locales/or/translation.json +397 -0
- package/locales/pa/translation.json +397 -0
- package/locales/pl/translation.json +405 -0
- package/locales/pt-BR/translation.json +401 -0
- package/locales/pt-PT/translation.json +401 -0
- package/locales/ro/translation.json +401 -0
- package/locales/ru/translation.json +405 -0
- package/locales/sk/translation.json +405 -0
- package/locales/sl/translation.json +405 -0
- package/locales/sv/translation.json +397 -0
- package/locales/ta/translation.json +397 -0
- package/locales/te/translation.json +397 -0
- package/locales/th/translation.json +393 -0
- package/locales/tr/translation.json +397 -0
- package/locales/uk/translation.json +405 -0
- package/locales/ur/translation.json +397 -0
- package/locales/vi/translation.json +397 -0
- package/locales/zh-HK/translation.json +393 -0
- package/locales/zh-Hans/translation.json +393 -0
- package/locales/zh-Hant/translation.json +393 -0
- package/package.json +14 -9
- package/locales/ar.json +0 -311
- package/locales/bg.json +0 -295
- package/locales/bn.json +0 -295
- package/locales/ca.json +0 -299
- package/locales/cs.json +0 -303
- package/locales/da.json +0 -295
- package/locales/de.json +0 -295
- package/locales/el.json +0 -295
- package/locales/es-419.json +0 -299
- package/locales/es.json +0 -299
- package/locales/fi.json +0 -295
- package/locales/fr-CA.json +0 -299
- package/locales/fr.json +0 -299
- package/locales/gu.json +0 -295
- package/locales/he.json +0 -299
- package/locales/hi.json +0 -295
- package/locales/hr.json +0 -299
- package/locales/hu.json +0 -295
- package/locales/id.json +0 -283
- package/locales/it.json +0 -299
- package/locales/ja.json +0 -283
- package/locales/kk.json +0 -295
- package/locales/kn.json +0 -295
- package/locales/ko.json +0 -283
- package/locales/lt.json +0 -303
- package/locales/ml.json +0 -295
- package/locales/mr.json +0 -295
- package/locales/ms.json +0 -283
- package/locales/nb.json +0 -295
- package/locales/nl.json +0 -295
- package/locales/or.json +0 -295
- package/locales/pa.json +0 -295
- package/locales/pl.json +0 -303
- package/locales/pt-BR.json +0 -299
- package/locales/pt-PT.json +0 -299
- package/locales/ro.json +0 -299
- package/locales/ru.json +0 -303
- package/locales/sk.json +0 -303
- package/locales/sl.json +0 -303
- package/locales/sv.json +0 -295
- package/locales/ta.json +0 -295
- package/locales/te.json +0 -295
- package/locales/th.json +0 -283
- package/locales/tr.json +0 -295
- package/locales/uk.json +0 -303
- package/locales/ur.json +0 -295
- package/locales/vi.json +0 -295
- package/locales/zh-HK.json +0 -283
- package/locales/zh-Hans.json +0 -283
- package/locales/zh-Hant.json +0 -283
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
// This file is automatically generated by i18next-cli. Do not edit manually.
|
|
2
|
+
export default interface Resources {
|
|
3
|
+
"translation": {
|
|
4
|
+
"availability": {
|
|
5
|
+
"advice": "Check these with available(), mark the code that uses them with @available, or raise \"swiplet.minimumAPILevel\" or \"swiplet.minimumIOSVersion\" in package.json.";
|
|
6
|
+
"apiLevel": "API level {{level}}";
|
|
7
|
+
"entryNeeds": "{{location}}: {{name}} is an entry of the swiplet and needs {{requirement}}; raise \"swiplet.minimumAPILevel\" or \"swiplet.minimumIOSVersion\" in package.json.";
|
|
8
|
+
"importNeeds": "{{location}}: importing {{name}} needs {{requirement}}; raise \"swiplet.minimumAPILevel\" or \"swiplet.minimumIOSVersion\" in package.json.";
|
|
9
|
+
"invalidEntry": "{{location}}: @available has \"{{entry}}\"; it takes \"apiLevel <level>\" and \"iOS <version>\", separated by commas.";
|
|
10
|
+
"needs": "{{location}}: {{name}} needs {{requirement}}.";
|
|
11
|
+
"repeatedEntry": "{{location}}: @available names {{kind}} twice.";
|
|
12
|
+
};
|
|
13
|
+
"cli": {
|
|
14
|
+
"commands": "commands:";
|
|
15
|
+
"exactArgs_one": "accepts {{count}} arg, received {{received}}";
|
|
16
|
+
"exactArgs_other": "accepts {{count}} args, received {{received}}";
|
|
17
|
+
"help": "help";
|
|
18
|
+
"helpHint": "Run \"swipt help\" for usage.";
|
|
19
|
+
"minimumArgs_one": "accepts at least {{count}} arg, received {{received}}";
|
|
20
|
+
"minimumArgs_other": "accepts at least {{count}} args, received {{received}}";
|
|
21
|
+
"missingCommand": "A command is missing.";
|
|
22
|
+
"options": "options:";
|
|
23
|
+
"rangeArgs_one": "accepts between {{least}} and {{count}} arg, received {{received}}";
|
|
24
|
+
"rangeArgs_other": "accepts between {{least}} and {{count}} args, received {{received}}";
|
|
25
|
+
"unauthenticated": "{{message}}; connect with the URL that Swipt › Developer or \"swipt driver\" shows: swipt device add {{url}}";
|
|
26
|
+
"unimplemented": "Swipt at {{url}} doesn't have this command; update Swipt.";
|
|
27
|
+
"unknownCommand": "unknown command {{name}} for {{parent}}";
|
|
28
|
+
"unknownOption": "{{option}} isn't an option of {{command}}.";
|
|
29
|
+
"unreachable": "Swipt at {{url}} is unreachable: {{message}}";
|
|
30
|
+
"usage": "usage: {{usage}}";
|
|
31
|
+
};
|
|
32
|
+
"commands": {
|
|
33
|
+
"data": {
|
|
34
|
+
"clear": {
|
|
35
|
+
"description": "Remove every data file, keeping the data directory";
|
|
36
|
+
};
|
|
37
|
+
"list": {
|
|
38
|
+
"description": "List data files";
|
|
39
|
+
"recursive": "include subdirectories";
|
|
40
|
+
};
|
|
41
|
+
"read": {
|
|
42
|
+
"description": "Read a data file or directory";
|
|
43
|
+
"output": "destination";
|
|
44
|
+
"saved_one": "saved {{count}} file to {{path}}";
|
|
45
|
+
"saved_other": "saved {{count}} files to {{path}}";
|
|
46
|
+
};
|
|
47
|
+
"remove": {
|
|
48
|
+
"description": "Remove a data file";
|
|
49
|
+
"recursive": "include directory contents";
|
|
50
|
+
};
|
|
51
|
+
"replDescription": "Manage the files in the data directory of the REPL";
|
|
52
|
+
"swipletDescription": "Manage the files in the data directory of a swiplet";
|
|
53
|
+
"write": {
|
|
54
|
+
"description": "Write a data file";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
"description": "Swipt CLI";
|
|
58
|
+
"device": {
|
|
59
|
+
"add": {
|
|
60
|
+
"description": "Add a device by its URL; needed when it's remote or requires a token";
|
|
61
|
+
};
|
|
62
|
+
"description": "Manage the devices and read their logs";
|
|
63
|
+
"list": {
|
|
64
|
+
"description": "List the devices, adding the ones found on the local network";
|
|
65
|
+
};
|
|
66
|
+
"logs": {
|
|
67
|
+
"count": "number of past entries (default 100)";
|
|
68
|
+
"description": "Print the logs";
|
|
69
|
+
"follow": "follow new entries";
|
|
70
|
+
"invalidDuration": "invalid argument {{value}} for {{option}}: it's a duration such as 30s or 1m30s";
|
|
71
|
+
"invalidLevel": "--level is error, warn, info or debug";
|
|
72
|
+
"invalidNumber": "invalid argument {{value}} for {{option}}: it's a number";
|
|
73
|
+
"level": "minimum level (default info)";
|
|
74
|
+
"since": "maximum age";
|
|
75
|
+
"swiplet": "swiplet ID";
|
|
76
|
+
};
|
|
77
|
+
"remove": {
|
|
78
|
+
"description": "Forget a device";
|
|
79
|
+
};
|
|
80
|
+
"stop": {
|
|
81
|
+
"description": "Stop serving the Swipt API";
|
|
82
|
+
"stopped": "stopped";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
"driver": {
|
|
86
|
+
"description": "Serve the Swipt API and MCP for a device from this computer";
|
|
87
|
+
"details": "Only one can control the device at a time: Swipt on it, or the driver on one computer.";
|
|
88
|
+
"passcode": "passcode to unlock the device automatically; empty turns that off";
|
|
89
|
+
"randomToken": "require a random token from API clients";
|
|
90
|
+
"token": "require this token from API clients";
|
|
91
|
+
};
|
|
92
|
+
"project": {
|
|
93
|
+
"build": {
|
|
94
|
+
"description": "Bundle the project into dist/<swiplet.id>.swiplet";
|
|
95
|
+
};
|
|
96
|
+
"create": {
|
|
97
|
+
"description": "Make a swiplet project in a new or empty directory";
|
|
98
|
+
"notEmpty": "{{directory}} isn't empty.";
|
|
99
|
+
};
|
|
100
|
+
"deploy": {
|
|
101
|
+
"description": "Build the project and install it on the device";
|
|
102
|
+
};
|
|
103
|
+
"description": "Make, build and deploy swiplet projects";
|
|
104
|
+
"develop": {
|
|
105
|
+
"deployed": "built and deployed in {{elapsed}}; watching {{directory}}";
|
|
106
|
+
"description": "Build, install and follow a swiplet project as it changes";
|
|
107
|
+
"quiet": "without logs";
|
|
108
|
+
"unchanged": "built in {{elapsed}}; nothing changed";
|
|
109
|
+
};
|
|
110
|
+
"source": {
|
|
111
|
+
"description": "Collect the built swiplets into dist/ with a swiplets.json";
|
|
112
|
+
"duplicateID": "{{id}} is both {{first}} and {{second}}";
|
|
113
|
+
"invalidIcon": "\"source.icon\" in package.json must have a symbol and may have a color.";
|
|
114
|
+
"invalidLocalizedNames": "\"source.localizedNames\" in package.json must map languages to names.";
|
|
115
|
+
"invalidURL": "\"source.url\" in package.json isn't an absolute URL.";
|
|
116
|
+
"noWorkspaces": "package.json lists no workspaces with swiplets; name the swiplets to list.";
|
|
117
|
+
"notBuilt": "{{file}} is missing; build {{directory}} first.";
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
"repl": {
|
|
121
|
+
"api": {
|
|
122
|
+
"description": "Print the TypeScript declarations of the globals and modules";
|
|
123
|
+
};
|
|
124
|
+
"dataDirectory": "{{path}} names the data directory of the REPL; save it with --output DIRECTORY";
|
|
125
|
+
"description": "Run JavaScript in the REPL session on the device";
|
|
126
|
+
"directory": "{{path}} is a directory in the data directory of the REPL; save it with --output DIRECTORY";
|
|
127
|
+
"reset": {
|
|
128
|
+
"description": "Reset the session";
|
|
129
|
+
};
|
|
130
|
+
"run": {
|
|
131
|
+
"arguments": "The first argument is FILE when it names an existing file and CODE otherwise; options go before it.";
|
|
132
|
+
"description": "Run a JavaScript expression or program on the device";
|
|
133
|
+
"details": "CODE is an expression whose value is printed. FILE, or standard input given as - or no argument, is a program, and only its console output is printed.";
|
|
134
|
+
"extraArguments": "{{argument}} isn't a file, and CODE takes no ARG.";
|
|
135
|
+
"images": "image directory (default: a new temporary directory)";
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
"sideload": {
|
|
139
|
+
"description": "Sideload Swipt";
|
|
140
|
+
"install": {
|
|
141
|
+
"description": "Install Swipt";
|
|
142
|
+
"force": "install over the same or a later build";
|
|
143
|
+
};
|
|
144
|
+
"passcode": "set up auto-unlock with this passcode";
|
|
145
|
+
"setup": {
|
|
146
|
+
"description": "Set up Swipt";
|
|
147
|
+
};
|
|
148
|
+
"uninstall": {
|
|
149
|
+
"description": "Remove Swipt";
|
|
150
|
+
};
|
|
151
|
+
"update": {
|
|
152
|
+
"description": "Update or renew Swipt";
|
|
153
|
+
"passcode": "unlock device with this passcode";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
"swiplet": {
|
|
157
|
+
"call": {
|
|
158
|
+
"description": "Call a swiplet action";
|
|
159
|
+
"input": "input JSON, @FILE or -";
|
|
160
|
+
"invalidInput": "--input isn't JSON: {{error}}";
|
|
161
|
+
};
|
|
162
|
+
"dataDirectory": "{{path}} names the data directory of {{swiplet}}; save it with --output DIRECTORY";
|
|
163
|
+
"description": "Manage the swiplets on the device";
|
|
164
|
+
"directory": "{{path}} is a directory in the data directory of {{swiplet}}; save it with --output DIRECTORY";
|
|
165
|
+
"install": {
|
|
166
|
+
"description": "Install a swiplet archive";
|
|
167
|
+
"notFound": "There is no archive at {{path}}";
|
|
168
|
+
};
|
|
169
|
+
"list": {
|
|
170
|
+
"actions": "ACTIONS";
|
|
171
|
+
"description": "List the swiplets";
|
|
172
|
+
"id": "ID";
|
|
173
|
+
"service": "SERVICE";
|
|
174
|
+
"status": "STATUS";
|
|
175
|
+
"title": "TITLE";
|
|
176
|
+
"version": "VERSION";
|
|
177
|
+
};
|
|
178
|
+
"remove": {
|
|
179
|
+
"description": "Remove a swiplet";
|
|
180
|
+
"removed": "removed {{name}}";
|
|
181
|
+
};
|
|
182
|
+
"service": {
|
|
183
|
+
"description": "Manage swiplet services";
|
|
184
|
+
"disable": {
|
|
185
|
+
"description": "Turn off a swiplet service";
|
|
186
|
+
};
|
|
187
|
+
"enable": {
|
|
188
|
+
"description": "Turn on a swiplet service";
|
|
189
|
+
};
|
|
190
|
+
"watch": {
|
|
191
|
+
"description": "Watch swiplet services";
|
|
192
|
+
};
|
|
193
|
+
"watchState": "watch the state";
|
|
194
|
+
};
|
|
195
|
+
"show": {
|
|
196
|
+
"description": "Show a swiplet";
|
|
197
|
+
"input": "input: {{schema}}";
|
|
198
|
+
"notFound": "There is no swiplet {{id}}.";
|
|
199
|
+
"output": "output: {{schema}}";
|
|
200
|
+
"service": "service: {{status}}";
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
"version": {
|
|
204
|
+
"description": "Print the version";
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
"connection": {
|
|
208
|
+
"added": "added {{device}}";
|
|
209
|
+
"ambiguous": "There is more than one device: {{devices}}; choose one with -d";
|
|
210
|
+
"driverNotStopped": "The driver on {{computer}} didn't stop.";
|
|
211
|
+
"invalidURL": "{{text}} isn't a URL.";
|
|
212
|
+
"none": "There is no device; turn on Swipt › Developer › Local Network, or connect one with \"swipt device add URL\".";
|
|
213
|
+
"noneOnNetwork": "No device publishes Swipt on the local network; turn on Swipt › Developer › Local Network, or connect one with \"swipt device add URL\".";
|
|
214
|
+
"notFound": "There is no device {{device}}.";
|
|
215
|
+
"notFoundHint": "There is no device {{device}}; \"swipt device list\" lists them.";
|
|
216
|
+
"offline": "offline";
|
|
217
|
+
"problem": {
|
|
218
|
+
"developerModeOff": "developer mode off";
|
|
219
|
+
"deviceUnsupported": "device unsupported";
|
|
220
|
+
"diskImageMissing": "disk image missing";
|
|
221
|
+
"diskImageMountFailed": "disk image mount failed";
|
|
222
|
+
"pairingRejected": "pairing rejected";
|
|
223
|
+
"screenInUse": "screen in use";
|
|
224
|
+
"unreachable": "unreachable";
|
|
225
|
+
"vpnPeerAddressMissing": "VPN peer address missing";
|
|
226
|
+
};
|
|
227
|
+
"removed": "removed {{name}}";
|
|
228
|
+
"requiresToken": "requires a token";
|
|
229
|
+
"requiresTokenHint": "{{device}} requires a token: swipt device add {{url}}";
|
|
230
|
+
"state": {
|
|
231
|
+
"connecting": "connecting";
|
|
232
|
+
"failed": "failed";
|
|
233
|
+
"preparing": "preparing";
|
|
234
|
+
"running": "running";
|
|
235
|
+
"stopped": "stopped";
|
|
236
|
+
};
|
|
237
|
+
"unsupportedURL": "{{text}} isn't an http or https URL.";
|
|
238
|
+
};
|
|
239
|
+
"deploy": {
|
|
240
|
+
"installed": "installed {{id}} {{version}}";
|
|
241
|
+
"replaced": "replaced {{id}} {{version}}";
|
|
242
|
+
};
|
|
243
|
+
"driver": {
|
|
244
|
+
"alreadyRunning": "The driver is already running on this computer; stop it first.";
|
|
245
|
+
"ambiguousName": "More than one iPhone or iPad is named {{name}}; choose one by UDID";
|
|
246
|
+
"appleMobileDeviceServiceMissing": "Apple Mobile Device Service isn't running; install Apple Devices from the Microsoft Store";
|
|
247
|
+
"chooseDevice": "Choose a device";
|
|
248
|
+
"chooseDeviceHint": "Choose a device with -d NAME|UDID";
|
|
249
|
+
"connectedDevices": "{{reason}}; connected iPhone and iPad devices:";
|
|
250
|
+
"lookingForDevices": "looking for devices";
|
|
251
|
+
"missing": "The driver is missing; install it with \"npm install -g @swipt/cli --include=optional\".";
|
|
252
|
+
"nameNotFound": "No iPhone or iPad is named {{name}}";
|
|
253
|
+
"noDevice": "No iPhone or iPad is connected to this computer or found on the local network; connect one with a USB cable and unlock it.";
|
|
254
|
+
"pairing": "pairing with {{device}}";
|
|
255
|
+
"trustPrompt": "tap Trust on {{device}} and enter its passcode to trust this computer";
|
|
256
|
+
"usbmuxdMissing": "usbmuxd isn't running; install usbmuxd and start it";
|
|
257
|
+
};
|
|
258
|
+
"error": "error: {{message}}";
|
|
259
|
+
"flags": {
|
|
260
|
+
"device": "the device to use";
|
|
261
|
+
"nightly": "use nightly build";
|
|
262
|
+
"noSetup": "don't pair Swipt, trust its developer or publish its API";
|
|
263
|
+
"noSetupAPI": "don't publish the API to the local network";
|
|
264
|
+
"noSetupPair": "don't pair Swipt";
|
|
265
|
+
"passcodeType": "pin (4 or 6 digits, default), numeric or alphanumeric";
|
|
266
|
+
"team": "team ID, required if more than one";
|
|
267
|
+
};
|
|
268
|
+
"metro": {
|
|
269
|
+
"boolean": "a Boolean";
|
|
270
|
+
"contextArgument": "Argument {{index}} of require.context must be {{expected}}";
|
|
271
|
+
"contextRegExp": "Argument {{index}} of require.context must be a regular expression literal.";
|
|
272
|
+
"oneOf": "one of {{values}}";
|
|
273
|
+
"string": "a string";
|
|
274
|
+
"workletsMismatch": "The project has react-native-worklets {{version}}, but Swipt runs {{expected}}; install react-native-worklets@{{expected}} or remove it.";
|
|
275
|
+
};
|
|
276
|
+
"noThanks": "No Thanks";
|
|
277
|
+
"output": {
|
|
278
|
+
"navigate": "navigate";
|
|
279
|
+
"select": "select";
|
|
280
|
+
"service": "{{enabled}}, {{status}}";
|
|
281
|
+
"serviceSince": "{{enabled}}, {{status}} since {{time}}";
|
|
282
|
+
"serviceStatus": {
|
|
283
|
+
"failed": "failed";
|
|
284
|
+
"running": "running";
|
|
285
|
+
"starting": "starting";
|
|
286
|
+
"stopped": "stopped";
|
|
287
|
+
"turnedOff": "turned off";
|
|
288
|
+
"turnedOn": "turned on";
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
"passcode": {
|
|
292
|
+
"alphanumeric": "Custom alphanumeric passcode";
|
|
293
|
+
"alphanumericDetail": "alphanumeric";
|
|
294
|
+
"empty": "Enter the passcode.";
|
|
295
|
+
"invalidAlphanumeric": "A passcode is up to 64 printable ASCII characters.";
|
|
296
|
+
"invalidNumeric": "A numeric passcode is digits only.";
|
|
297
|
+
"invalidPin": "A pin passcode is 4 or 6 digits; a custom one needs --passcode-type numeric or alphanumeric";
|
|
298
|
+
"invalidType": "invalid argument {{value}} for --passcode-type: it's {{types}}";
|
|
299
|
+
"masked": "[input is masked]";
|
|
300
|
+
"numeric": "Custom numeric passcode";
|
|
301
|
+
"numericDetail": "numeric";
|
|
302
|
+
"pin": "4 or 6 digit passcode";
|
|
303
|
+
"pinDetail": "4 or 6 digits";
|
|
304
|
+
"prompt": "Device passcode";
|
|
305
|
+
"setUp": "Set up auto-unlock? Swipt can then unlock this device by itself.";
|
|
306
|
+
};
|
|
307
|
+
"project": {
|
|
308
|
+
"assetConflict": "{{source}} and {{asset}} would both be assets/{{name}} in the swiplet.";
|
|
309
|
+
"conditionalActions": "The extension defines different actions depending on available(); define the same actions on every system and check available() inside run or an action.";
|
|
310
|
+
"databaseAtLoad": "The database is used while extension.js loads; use it inside run or an action.";
|
|
311
|
+
"interfaceImport": "The interface imports {{file}} at runtime; import its type with `import type`.";
|
|
312
|
+
"interfaceOnly": "{{name}} works only in the swiplet interface.";
|
|
313
|
+
"invalidExposure": "The action {{action}} can only expose itself to \"shortcuts\".";
|
|
314
|
+
"invalidExtension": "The extension's default export isn't the result of defineExtension.";
|
|
315
|
+
"invalidID": "\"swiplet.id\" in package.json must be 1 to 128 lowercase letters, digits, dots, underscores and hyphens starting with a letter or a digit.";
|
|
316
|
+
"invalidLocalizedNames": "\"swiplet.localizedNames\" in package.json must map languages to names.";
|
|
317
|
+
"invalidMinimumAPILevel": "\"swiplet.minimumAPILevel\" in package.json must be an integer from {{oldest}} to {{level}}, the API level of @swipt/api.";
|
|
318
|
+
"invalidMinimumIOSVersion": "\"swiplet.minimumIOSVersion\" in package.json must be a version number from {{version}}, the minimum iOS version of @swipt/api.";
|
|
319
|
+
"invalidName": "\"swiplet.name\" in package.json must be a nonempty string.";
|
|
320
|
+
"invalidSchema": "The {{side}} schema of the action {{action}} doesn't implement Standard JSON Schema; use a library that does, such as Zod 4.";
|
|
321
|
+
"invalidString": "\"{{field}}\" in package.json must be a string.";
|
|
322
|
+
"invalidVersionCode": "\"swiplet.versionCode\" in package.json must be a positive integer.";
|
|
323
|
+
"missingTitle": "The action {{action}} needs a title.";
|
|
324
|
+
"storageAtLoad": "The storage is used while extension.js loads; use it inside run or an action.";
|
|
325
|
+
"unprovidedModule": "Swipt doesn't provide \"{{module}}\" to extensions; bundle it into extension.js.";
|
|
326
|
+
"usedAtLoad": "{{name}} is used while extension.js loads; use it inside run or an action.";
|
|
327
|
+
};
|
|
328
|
+
"serve": {
|
|
329
|
+
"cancel": "Cancel";
|
|
330
|
+
"checking": "checking {{device}}";
|
|
331
|
+
"conflictingTokens": "--token and --random-token can't be used together.";
|
|
332
|
+
"invalidToken": "A token is one or more printable ASCII characters without spaces.";
|
|
333
|
+
"localNetwork": "Local network";
|
|
334
|
+
"noAutoUnlock": "{{device}} isn't unlocked automatically; set its passcode with --passcode. Ctrl-C stops the driver.";
|
|
335
|
+
"quitSwipt": "Quit Swipt";
|
|
336
|
+
"quittingSwipt": "quitting Swipt on {{device}}";
|
|
337
|
+
"served": "The driver on {{computer}} already serves {{device}}; stop that driver first.";
|
|
338
|
+
"servedPrompt": "The driver on {{computer}} already serves {{device}}. Stop that driver?";
|
|
339
|
+
"starting": "starting the driver for {{device}}";
|
|
340
|
+
"stopDriver": "Stop the driver on {{computer}}";
|
|
341
|
+
"stopHint": "Ctrl-C stops the driver.";
|
|
342
|
+
"stoppingDriver": "stopping the driver on {{computer}}";
|
|
343
|
+
"swiptRunning": "The driver can't control {{device}} while Swipt is running on it; quit Swipt first.";
|
|
344
|
+
"swiptRunningPrompt": "The driver can't control {{device}} while Swipt is running on it. Quit Swipt?";
|
|
345
|
+
};
|
|
346
|
+
"sideload": {
|
|
347
|
+
"ambiguousTeam": "Swipt is sideloaded on {{device}} by more than one team; choose one with --team ID:";
|
|
348
|
+
"certificateFailed": "Xcode couldn't make a development certificate for team {{team}}; add one at {{accounts}} › Manage Certificates ({{errors}}).";
|
|
349
|
+
"checking": "checking Swipt on {{device}}";
|
|
350
|
+
"checkingRelease": "checking the latest release";
|
|
351
|
+
"chooseTeam": "Choose a team";
|
|
352
|
+
"chooseTeamHint": "Choose a team with --team ID:";
|
|
353
|
+
"diskImageFailed": "couldn't prepare the Developer Disk Image on {{device}}: {{error}}";
|
|
354
|
+
"downgrade": "Downgrade";
|
|
355
|
+
"downgradePrompt": "Downgrade Swipt on {{device}} from {{version}} to {{releaseVersion}}? Swipt resets its data when the earlier version can't read it.";
|
|
356
|
+
"downgradeToStablePrompt": "Downgrade Swipt on {{device}} from nightly {{version}} to stable {{releaseVersion}}? Swipt resets its data when the earlier version can't read it.";
|
|
357
|
+
"downloading": "downloading Swipt {{version}} ({{build}}) from {{release}}";
|
|
358
|
+
"expiration": "Its signing expires {{expiration}}.";
|
|
359
|
+
"installed": "{{build}} is installed on {{device}}.";
|
|
360
|
+
"installing": "installing on {{device}}";
|
|
361
|
+
"invalidTeam": "invalid argument {{value}} for --team: it's the 10-character team ID shown in {{accounts}}";
|
|
362
|
+
"laterThanRelease": "{{build}} on {{device}} is later than {{release}} ({{releaseBuild}}).";
|
|
363
|
+
"locked": "{{device}}: {{message}}; unlock it or pass --passcode, then run this again.";
|
|
364
|
+
"looking": "looking for Swipt on the devices";
|
|
365
|
+
"needsMacOS": "Installing or updating Swipt needs macOS; install it from a Mac, then set it up here with \"swipt sideload setup\".";
|
|
366
|
+
"noAccount": "Xcode has no account; sign in at {{accounts}}, or choose a team with --team ID";
|
|
367
|
+
"noAccountForTeam": "Xcode has no account for team {{team}}; sign in to its Apple Account at {{accounts}}.";
|
|
368
|
+
"noCertificate": "Xcode has no development certificate; add one at {{accounts}} › Manage Certificates, or choose a team with --team ID";
|
|
369
|
+
"noneInstalled": "Swipt isn't sideloaded on any iPhone or iPad.";
|
|
370
|
+
"noneInstalledHint": "Swipt isn't sideloaded on any iPhone or iPad; install it with \"swipt sideload install\".";
|
|
371
|
+
"notInstalled": "Swipt isn't sideloaded on {{device}}.";
|
|
372
|
+
"notInstalledByTeam": "Swipt isn't sideloaded on {{device}} by team {{team}}.";
|
|
373
|
+
"notInstalledByTeamHint": "Swipt isn't sideloaded on {{device}} by team {{team}}; install it with \"swipt sideload install\".";
|
|
374
|
+
"notInstalledHint": "Swipt isn't sideloaded on {{device}}; install it with \"swipt sideload install\".";
|
|
375
|
+
"notOnNetwork": "{{device}} wasn't found on the local network; find its API URLs in Swipt › Developer › Local Network.";
|
|
376
|
+
"opening": "opening Swipt on {{device}}";
|
|
377
|
+
"openingSettings": "opening Settings on {{device}}";
|
|
378
|
+
"opensAfterUnlock": "It opens after {{device}} is unlocked.";
|
|
379
|
+
"pairingFailed": "Pairing failed, so Swipt pairs in Settings instead: {{error}}";
|
|
380
|
+
"preparingDiskImage": "preparing the Developer Disk Image on {{device}}";
|
|
381
|
+
"preparingSigning": "preparing signing for Swipt with team {{team}} through Xcode";
|
|
382
|
+
"removed": "removed {{build}} from {{device}}";
|
|
383
|
+
"removing": "removing Swipt from {{device}}";
|
|
384
|
+
"renewalNeedsDowngrade": "{{build}} on {{device}} needs new signing, but {{release}} ({{releaseBuild}}) is earlier; use --nightly, or downgrade with \"swipt sideload install --force\".";
|
|
385
|
+
"resigning": "re-signing Swipt";
|
|
386
|
+
"running": "{{app}} is running.";
|
|
387
|
+
"settingUpAutoUnlock": "setting up auto-unlock";
|
|
388
|
+
"trusted": "{{developer}} is trusted.";
|
|
389
|
+
"trusting": "trusting {{developer}} in Settings";
|
|
390
|
+
"unlockPrompt": "Unlock the device to continue.";
|
|
391
|
+
"unlocking": "unlocking the device";
|
|
392
|
+
"untrusted": "Its developer isn't trusted yet; trust it in the Settings page opened on {{device}}, then open Swipt.";
|
|
393
|
+
"upToDate": "{{build}} on {{device}} is already {{release}}.";
|
|
394
|
+
"updated": "{{build}} is updated on {{device}}.";
|
|
395
|
+
"waiting": "waiting for {{device}}";
|
|
396
|
+
"xcodeMissing": "xcodebuild needs Xcode; install it and select it with xcode-select";
|
|
397
|
+
"xcodebuildMissing": "xcodebuild is missing; install Xcode.";
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
}
|
package/dist/serve.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { Context } from "./cli/command.js";
|
|
2
|
+
import { PromptContext } from "./output.js";
|
|
3
|
+
import { PasscodeOptions } from "./passcode.js";
|
|
4
|
+
interface ServeOptions extends PasscodeOptions {
|
|
5
|
+
token?: string;
|
|
6
|
+
"random-token"?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function run(context: PromptContext & Pick<Context<ServeOptions>, "options">): Promise<void>;
|
|
9
|
+
export {};
|
package/dist/serve.js
CHANGED
|
@@ -2,7 +2,7 @@ import { UsageError } from "./client.js";
|
|
|
2
2
|
import { findDriver, stopDriver, withToken } from "./connection.js";
|
|
3
3
|
import { configDirectory } from "./directories.js";
|
|
4
4
|
import { appRunning, randomToken, serve, terminateApp, trustedDevice } from "./driver.js";
|
|
5
|
-
import {
|
|
5
|
+
import { t } from "./i18n.js";
|
|
6
6
|
import { FalseResult, choose, columns, interactive, step } from "./output.js";
|
|
7
7
|
import { askPasscode, passcodeOf } from "./passcode.js";
|
|
8
8
|
import { savedPasscode, swiptApps } from "./swipt-app.js";
|
|
@@ -32,7 +32,7 @@ async function confirm(context, message, action, failure) {
|
|
|
32
32
|
name: action,
|
|
33
33
|
value: true
|
|
34
34
|
}, {
|
|
35
|
-
name:
|
|
35
|
+
name: t("serve.cancel"),
|
|
36
36
|
value: false
|
|
37
37
|
}], failure)) throw new FalseResult();
|
|
38
38
|
}
|
|
@@ -45,21 +45,21 @@ async function runningApps(device) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
async function takeOver(context, device) {
|
|
48
|
-
const [{ ids, running }, driving] = await step(
|
|
48
|
+
const [{ ids, running }, driving] = await step(t("serve.checking", { device: device.name }), () => Promise.all([runningApps(device), findDriver(device.udid, context.signal)]), { transient: true });
|
|
49
49
|
if (driving !== void 0) {
|
|
50
50
|
const parameters = {
|
|
51
51
|
device: device.name,
|
|
52
52
|
computer: new URL(driving.url).hostname
|
|
53
53
|
};
|
|
54
|
-
const serves = new Error(
|
|
54
|
+
const serves = new Error(t("serve.served", parameters));
|
|
55
55
|
if (driving.authenticates) throw serves;
|
|
56
|
-
await confirm(context,
|
|
57
|
-
await step(
|
|
56
|
+
await confirm(context, t("serve.servedPrompt", parameters), t("serve.stopDriver", parameters), serves);
|
|
57
|
+
await step(t("serve.stoppingDriver", parameters), () => stopDriver(driving.url, device.udid, context.signal));
|
|
58
58
|
}
|
|
59
59
|
if (running.length > 0) {
|
|
60
60
|
const parameters = { device: device.name };
|
|
61
|
-
await confirm(context,
|
|
62
|
-
await step(
|
|
61
|
+
await confirm(context, t("serve.swiptRunningPrompt", parameters), t("serve.quitSwipt"), new Error(t("serve.swiptRunning", parameters)));
|
|
62
|
+
await step(t("serve.quittingSwipt", parameters), () => Promise.all(running.map((id) => terminateApp(device, id))));
|
|
63
63
|
}
|
|
64
64
|
return ids;
|
|
65
65
|
}
|
|
@@ -78,7 +78,7 @@ async function unlockPasscode(context, device, ids) {
|
|
|
78
78
|
}
|
|
79
79
|
const saved = loadPasscodes();
|
|
80
80
|
if (device.udid in saved) return saved[device.udid] ?? void 0;
|
|
81
|
-
let passcode = await step(
|
|
81
|
+
let passcode = await step(t("sideload.checking", { device: device.name }), () => swiptPasscode(device, ids), { transient: true });
|
|
82
82
|
if (passcode === void 0) {
|
|
83
83
|
if (!interactive(context)) return;
|
|
84
84
|
passcode = await askPasscode(context);
|
|
@@ -88,10 +88,10 @@ async function unlockPasscode(context, device, ids) {
|
|
|
88
88
|
}
|
|
89
89
|
function apiToken(options) {
|
|
90
90
|
if (options["random-token"]) {
|
|
91
|
-
if (options.token !== void 0) throw new UsageError(
|
|
91
|
+
if (options.token !== void 0) throw new UsageError(t("serve.conflictingTokens"));
|
|
92
92
|
return randomToken();
|
|
93
93
|
}
|
|
94
|
-
if (options.token !== void 0 && !/^[\x21-\x7e]+$/.test(options.token)) throw new UsageError(
|
|
94
|
+
if (options.token !== void 0 && !/^[\x21-\x7e]+$/.test(options.token)) throw new UsageError(t("serve.invalidToken"));
|
|
95
95
|
return options.token;
|
|
96
96
|
}
|
|
97
97
|
async function run(context) {
|
|
@@ -108,13 +108,14 @@ async function run(context) {
|
|
|
108
108
|
localNetwork: true,
|
|
109
109
|
signal: context.signal
|
|
110
110
|
});
|
|
111
|
-
const ready = await step(
|
|
112
|
-
|
|
111
|
+
const ready = await step(t("serve.starting", { device: device.name }), () => driven.serving, { transient: true });
|
|
112
|
+
const urls = [
|
|
113
113
|
["CLI", ready.api],
|
|
114
114
|
["MCP", ready.mcp],
|
|
115
|
-
[
|
|
116
|
-
]
|
|
117
|
-
console.
|
|
115
|
+
[t("serve.localNetwork"), ready.network]
|
|
116
|
+
];
|
|
117
|
+
console.log(`${ready.device}\n${columns(urls.flatMap(([name, url]) => url === void 0 ? [] : [[name, token ? withToken(url, token) : url]]))}`);
|
|
118
|
+
console.error(passcode === void 0 ? t("serve.noAutoUnlock", { device: ready.device }) : t("serve.stopHint"));
|
|
118
119
|
driven.stderr.pipe(process.stderr);
|
|
119
120
|
await driven.finished();
|
|
120
121
|
context.signal.throwIfAborted();
|
package/dist/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","names":[],"sources":["../src/serve.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { UsageError } from \"./client\";\nimport { findDriver, stopDriver, withToken } from \"./connection\";\nimport { configDirectory } from \"./directories\";\nimport {\n appRunning,\n randomToken,\n serve,\n terminateApp,\n trustedDevice,\n} from \"./driver\";\nimport {
|
|
1
|
+
{"version":3,"file":"serve.js","names":[],"sources":["../src/serve.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { Context } from \"./cli/command\";\nimport { UsageError } from \"./client\";\nimport { findDriver, stopDriver, withToken } from \"./connection\";\nimport { configDirectory } from \"./directories\";\nimport {\n type Device,\n appRunning,\n randomToken,\n serve,\n terminateApp,\n trustedDevice,\n} from \"./driver\";\nimport { t } from \"./i18n\";\nimport {\n FalseResult,\n type PromptContext,\n choose,\n columns,\n interactive,\n step,\n} from \"./output\";\nimport {\n type Passcode,\n type PasscodeOptions,\n askPasscode,\n passcodeOf,\n} from \"./passcode\";\nimport { savedPasscode, swiptApps } from \"./swipt-app\";\n\nconst passcodeFile = path.join(configDirectory, \"passcodes.json\");\n\ninterface ServeOptions extends PasscodeOptions {\n token?: string;\n \"random-token\"?: boolean;\n}\n\ntype Passcodes = Record<string, Passcode | null>;\n\nfunction loadPasscodes(): Passcodes {\n try {\n return JSON.parse(fs.readFileSync(passcodeFile, \"utf8\"));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return {};\n }\n throw error;\n }\n}\n\nfunction savePasscode(udid: string, passcode: Passcode | undefined) {\n const saved = loadPasscodes();\n saved[udid] = passcode ?? null;\n fs.mkdirSync(configDirectory, { recursive: true, mode: 0o700 });\n fs.writeFileSync(passcodeFile, `${JSON.stringify(saved, null, 2)}\\n`, {\n mode: 0o600,\n });\n}\n\nasync function confirm(\n context: PromptContext,\n message: string,\n action: string,\n failure: Error,\n) {\n const confirmed = await choose(\n context,\n message,\n [\n { name: action, value: true },\n { name: t(\"serve.cancel\"), value: false },\n ],\n failure,\n );\n if (!confirmed) {\n throw new FalseResult();\n }\n}\n\nasync function runningApps(device: Device) {\n const ids = (await swiptApps(device)).map((app) => app.bundleIdentifier);\n const running = await Promise.all(ids.map((id) => appRunning(device, id)));\n return { ids, running: ids.filter((_, index) => running[index]) };\n}\n\nasync function takeOver(context: PromptContext, device: Device) {\n const [{ ids, running }, driving] = await step(\n t(\"serve.checking\", { device: device.name }),\n () =>\n Promise.all([\n runningApps(device),\n findDriver(device.udid, context.signal),\n ]),\n { transient: true },\n );\n if (driving !== undefined) {\n const parameters = {\n device: device.name,\n computer: new URL(driving.url).hostname,\n };\n const serves = new Error(t(\"serve.served\", parameters));\n if (driving.authenticates) {\n throw serves;\n }\n await confirm(\n context,\n t(\"serve.servedPrompt\", parameters),\n t(\"serve.stopDriver\", parameters),\n serves,\n );\n await step(t(\"serve.stoppingDriver\", parameters), () =>\n stopDriver(driving.url, device.udid, context.signal),\n );\n }\n if (running.length > 0) {\n const parameters = { device: device.name };\n await confirm(\n context,\n t(\"serve.swiptRunningPrompt\", parameters),\n t(\"serve.quitSwipt\"),\n new Error(t(\"serve.swiptRunning\", parameters)),\n );\n await step(t(\"serve.quittingSwipt\", parameters), () =>\n Promise.all(running.map((id) => terminateApp(device, id))),\n );\n }\n return ids;\n}\n\nasync function swiptPasscode(device: Device, ids: string[]) {\n for (const id of ids) {\n try {\n const passcode = await savedPasscode(device, id);\n if (passcode !== undefined) {\n return passcode;\n }\n } catch {}\n }\n return undefined;\n}\n\nasync function unlockPasscode(\n context: PromptContext & Pick<Context<PasscodeOptions>, \"options\">,\n device: Device,\n ids: string[],\n) {\n const { options } = context;\n if (options.passcode !== undefined) {\n const passcode = passcodeOf(options);\n savePasscode(device.udid, passcode);\n return passcode;\n }\n const saved = loadPasscodes();\n if (device.udid in saved) {\n return saved[device.udid] ?? undefined;\n }\n let passcode = await step(\n t(\"sideload.checking\", { device: device.name }),\n () => swiptPasscode(device, ids),\n { transient: true },\n );\n if (passcode === undefined) {\n if (!interactive(context)) {\n return undefined;\n }\n passcode = await askPasscode(context);\n }\n savePasscode(device.udid, passcode);\n return passcode;\n}\n\nfunction apiToken(options: ServeOptions) {\n if (options[\"random-token\"]) {\n if (options.token !== undefined) {\n throw new UsageError(t(\"serve.conflictingTokens\"));\n }\n return randomToken();\n }\n if (options.token !== undefined && !/^[\\x21-\\x7e]+$/.test(options.token)) {\n throw new UsageError(t(\"serve.invalidToken\"));\n }\n return options.token;\n}\n\nexport async function run(\n context: PromptContext & Pick<Context<ServeOptions>, \"options\">,\n) {\n if (context.options[\"passcode-type\"] !== undefined) {\n passcodeOf(context.options);\n }\n const token = apiToken(context.options);\n const device = await trustedDevice(context, {\n required: false,\n virtual: false,\n });\n const ids = await takeOver(context, device);\n const passcode = await unlockPasscode(context, device, ids);\n const driven = serve(device.udid, {\n passcode,\n token,\n localNetwork: true,\n signal: context.signal,\n });\n const ready = await step(\n t(\"serve.starting\", { device: device.name }),\n () => driven.serving,\n { transient: true },\n );\n const urls: [name: string, url: string | undefined][] = [\n [\"CLI\", ready.api],\n [\"MCP\", ready.mcp],\n [t(\"serve.localNetwork\"), ready.network],\n ];\n console.log(\n `${ready.device}\\n${columns(\n urls.flatMap(([name, url]) =>\n url === undefined ? [] : [[name, token ? withToken(url, token) : url]],\n ),\n )}`,\n );\n console.error(\n passcode === undefined\n ? t(\"serve.noAutoUnlock\", { device: ready.device })\n : t(\"serve.stopHint\"),\n );\n driven.stderr.pipe(process.stderr);\n await driven.finished();\n context.signal.throwIfAborted();\n}\n"],"mappings":"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"}
|
package/dist/sideload.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
import { Context } from "./cli/command.js";
|
|
2
|
+
import { Application, Device } from "./driver.js";
|
|
3
|
+
import { PromptContext } from "./output.js";
|
|
4
|
+
import { Passcode, PasscodeOptions } from "./passcode.js";
|
|
5
|
+
interface SetupOptions {
|
|
6
|
+
"no-setup"?: boolean;
|
|
7
|
+
"no-setup-pair"?: boolean;
|
|
8
|
+
"no-setup-api"?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type SetupContext = Pick<Context<SetupOptions>, "options" | "signal">;
|
|
11
|
+
type PasscodeSetupContext = PromptContext & Pick<Context<PasscodeOptions & SetupOptions>, "options">;
|
|
12
|
+
type DeployContext = PasscodeSetupContext & Pick<Context<{
|
|
13
|
+
nightly?: boolean;
|
|
14
|
+
force?: boolean;
|
|
15
|
+
}>, "options">;
|
|
16
|
+
export declare function installPasscode(context: PasscodeSetupContext, device: Device, current: Application | undefined): Promise<Passcode | undefined>;
|
|
17
|
+
export declare function installAndOpen(context: SetupContext, { device, id, current }: {
|
|
18
|
+
device: Device;
|
|
19
|
+
id: string;
|
|
20
|
+
current: Application | undefined;
|
|
21
|
+
}, app: string, build: number, { passcode, saves }: {
|
|
22
|
+
passcode: Passcode | undefined;
|
|
11
23
|
saves?: boolean;
|
|
12
24
|
}): Promise<void>;
|
|
13
|
-
export declare function install(context:
|
|
14
|
-
export declare function update(context:
|
|
15
|
-
export declare function setup(context:
|
|
16
|
-
export declare function uninstall(context:
|
|
25
|
+
export declare function install(context: DeployContext): Promise<void>;
|
|
26
|
+
export declare function update(context: DeployContext): Promise<void>;
|
|
27
|
+
export declare function setup(context: PasscodeSetupContext): Promise<void>;
|
|
28
|
+
export declare function uninstall(context: PromptContext): Promise<void>;
|
|
29
|
+
export {};
|