arri 0.0.6 → 0.0.9
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/chunks/index.cjs +3 -2
- package/dist/chunks/index.mjs +3 -2
- package/dist/chunks/index2.cjs +3 -2
- package/dist/chunks/index2.mjs +3 -2
- package/dist/chunks/index3.cjs +3 -2
- package/dist/chunks/index3.mjs +3 -2
- package/dist/cli.cjs +555 -71
- package/dist/cli.mjs +554 -70
- package/dist/codegen.cjs +36 -625
- package/dist/codegen.d.cts +3 -2
- package/dist/codegen.d.mts +3 -2
- package/dist/codegen.d.ts +3 -2
- package/dist/codegen.mjs +23 -612
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{arri.34695f7b.mjs → arri.0e69fc28.mjs} +617 -2
- package/dist/shared/{arri.b4c5ce27.mjs → arri.1f1b9dfc.mjs} +124 -18
- package/dist/shared/{arri.38ad6cd0.cjs → arri.835c5c3c.cjs} +632 -4
- package/dist/shared/{arri.d77f4d0e.cjs → arri.8e602d87.cjs} +127 -17
- package/package.json +5 -4
- package/dist/shared/{arri.c20aaf19.d.mts → arri.2ff96786.d.cts} +7 -7
- package/dist/shared/{arri.c20aaf19.d.ts → arri.2ff96786.d.mts} +7 -7
- package/dist/shared/{arri.c20aaf19.d.cts → arri.2ff96786.d.ts} +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import * as tty from 'node:tty';
|
|
|
3
3
|
import fs$f, { existsSync, readFileSync, realpathSync, statSync as statSync$1, Stats, promises, writeFileSync, chmodSync, constants as constants$6 } from 'node:fs';
|
|
4
4
|
import path$e, { resolve as resolve$1, join as join$1 } from 'node:path';
|
|
5
5
|
import require$$0 from 'stream';
|
|
6
|
-
import {
|
|
6
|
+
import { j as commonjsGlobal, k as getDefaultExportFromCjs, l as getAugmentedNamespace, m as destr, n as joinURL, t as toNodeListener, h as camelCase$1, E as ErrorResponse, o as isRpc, q as typebox, p as pascalCase$1, r as removeDisallowedChars, s as kebabCase$1, w as withBase, v as withQuery } from './shared/arri.1f1b9dfc.mjs';
|
|
7
7
|
import require$$0$1 from 'os';
|
|
8
8
|
import require$$0$2 from 'path';
|
|
9
9
|
import require$$0$3 from 'util';
|
|
@@ -27,7 +27,7 @@ import { builtinModules } from 'node:module';
|
|
|
27
27
|
import assert from 'node:assert';
|
|
28
28
|
import v8$1 from 'node:v8';
|
|
29
29
|
import { format as format$1, inspect, promisify as promisify$5 } from 'node:util';
|
|
30
|
-
import { f as format2 } from './shared/arri.
|
|
30
|
+
import { f as format2, a as dartClientGenerator } from './shared/arri.0e69fc28.mjs';
|
|
31
31
|
import { createServer as createServer$2 } from 'node:http';
|
|
32
32
|
import { createServer as createServer$1 } from 'node:https';
|
|
33
33
|
import { createServer } from 'node:net';
|
|
@@ -35,6 +35,7 @@ import require$$0$5 from 'http';
|
|
|
35
35
|
import require$$1 from 'https';
|
|
36
36
|
import childProcess from 'node:child_process';
|
|
37
37
|
import 'fs/promises';
|
|
38
|
+
import 'child_process';
|
|
38
39
|
|
|
39
40
|
function isObject$3(value) {
|
|
40
41
|
return value !== null && typeof value === "object";
|
|
@@ -22798,85 +22799,165 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
22798
22799
|
|
|
22799
22800
|
const unsafePorts = /* @__PURE__ */ new Set([
|
|
22800
22801
|
1,
|
|
22802
|
+
// tcpmux
|
|
22801
22803
|
7,
|
|
22804
|
+
// echo
|
|
22802
22805
|
9,
|
|
22806
|
+
// discard
|
|
22803
22807
|
11,
|
|
22808
|
+
// systat
|
|
22804
22809
|
13,
|
|
22810
|
+
// daytime
|
|
22805
22811
|
15,
|
|
22812
|
+
// netstat
|
|
22806
22813
|
17,
|
|
22814
|
+
// qotd
|
|
22807
22815
|
19,
|
|
22816
|
+
// chargen
|
|
22808
22817
|
20,
|
|
22818
|
+
// ftp data
|
|
22809
22819
|
21,
|
|
22820
|
+
// ftp access
|
|
22810
22821
|
22,
|
|
22822
|
+
// ssh
|
|
22811
22823
|
23,
|
|
22824
|
+
// telnet
|
|
22812
22825
|
25,
|
|
22826
|
+
// smtp
|
|
22813
22827
|
37,
|
|
22828
|
+
// time
|
|
22814
22829
|
42,
|
|
22830
|
+
// name
|
|
22815
22831
|
43,
|
|
22832
|
+
// nicname
|
|
22816
22833
|
53,
|
|
22834
|
+
// domain
|
|
22817
22835
|
69,
|
|
22836
|
+
// tftp
|
|
22818
22837
|
77,
|
|
22838
|
+
// priv-rjs
|
|
22819
22839
|
79,
|
|
22840
|
+
// finger
|
|
22820
22841
|
87,
|
|
22842
|
+
// ttylink
|
|
22821
22843
|
95,
|
|
22844
|
+
// supdup
|
|
22822
22845
|
101,
|
|
22846
|
+
// hostriame
|
|
22823
22847
|
102,
|
|
22848
|
+
// iso-tsap
|
|
22824
22849
|
103,
|
|
22850
|
+
// gppitnp
|
|
22825
22851
|
104,
|
|
22852
|
+
// acr-nema
|
|
22826
22853
|
109,
|
|
22854
|
+
// pop2
|
|
22827
22855
|
110,
|
|
22856
|
+
// pop3
|
|
22828
22857
|
111,
|
|
22858
|
+
// sunrpc
|
|
22829
22859
|
113,
|
|
22860
|
+
// auth
|
|
22830
22861
|
115,
|
|
22862
|
+
// sftp
|
|
22831
22863
|
117,
|
|
22864
|
+
// uucp-path
|
|
22832
22865
|
119,
|
|
22866
|
+
// nntp
|
|
22833
22867
|
123,
|
|
22868
|
+
// NTP
|
|
22834
22869
|
135,
|
|
22870
|
+
// loc-srv /epmap
|
|
22835
22871
|
137,
|
|
22872
|
+
// netbios
|
|
22836
22873
|
139,
|
|
22874
|
+
// netbios
|
|
22837
22875
|
143,
|
|
22876
|
+
// imap2
|
|
22838
22877
|
161,
|
|
22878
|
+
// snmp
|
|
22839
22879
|
179,
|
|
22880
|
+
// BGP
|
|
22840
22881
|
389,
|
|
22882
|
+
// ldap
|
|
22841
22883
|
427,
|
|
22884
|
+
// SLP (Also used by Apple Filing Protocol)
|
|
22842
22885
|
465,
|
|
22886
|
+
// smtp+ssl
|
|
22843
22887
|
512,
|
|
22888
|
+
// print / exec
|
|
22844
22889
|
513,
|
|
22890
|
+
// login
|
|
22845
22891
|
514,
|
|
22892
|
+
// shell
|
|
22846
22893
|
515,
|
|
22894
|
+
// printer
|
|
22847
22895
|
526,
|
|
22896
|
+
// tempo
|
|
22848
22897
|
530,
|
|
22898
|
+
// courier
|
|
22849
22899
|
531,
|
|
22900
|
+
// chat
|
|
22850
22901
|
532,
|
|
22902
|
+
// netnews
|
|
22851
22903
|
540,
|
|
22904
|
+
// uucp
|
|
22852
22905
|
548,
|
|
22906
|
+
// AFP (Apple Filing Protocol)
|
|
22853
22907
|
554,
|
|
22908
|
+
// rtsp
|
|
22854
22909
|
556,
|
|
22910
|
+
// remotefs
|
|
22855
22911
|
563,
|
|
22912
|
+
// nntp+ssl
|
|
22856
22913
|
587,
|
|
22914
|
+
// smtp (rfc6409)
|
|
22857
22915
|
601,
|
|
22916
|
+
// syslog-conn (rfc3195)
|
|
22858
22917
|
636,
|
|
22918
|
+
// ldap+ssl
|
|
22859
22919
|
989,
|
|
22920
|
+
// ftps-data
|
|
22860
22921
|
990,
|
|
22922
|
+
// ftps
|
|
22861
22923
|
993,
|
|
22924
|
+
// ldap+ssl
|
|
22862
22925
|
995,
|
|
22926
|
+
// pop3+ssl
|
|
22863
22927
|
1719,
|
|
22928
|
+
// h323gatestat
|
|
22864
22929
|
1720,
|
|
22930
|
+
// h323hostcall
|
|
22865
22931
|
1723,
|
|
22932
|
+
// pptp
|
|
22866
22933
|
2049,
|
|
22934
|
+
// nfs
|
|
22867
22935
|
3659,
|
|
22936
|
+
// apple-sasl / PasswordServer
|
|
22868
22937
|
4045,
|
|
22938
|
+
// lockd
|
|
22869
22939
|
5060,
|
|
22940
|
+
// sip
|
|
22870
22941
|
5061,
|
|
22942
|
+
// sips
|
|
22871
22943
|
6e3,
|
|
22944
|
+
// X11
|
|
22872
22945
|
6566,
|
|
22946
|
+
// sane-port
|
|
22873
22947
|
6665,
|
|
22948
|
+
// Alternate IRC [Apple addition]
|
|
22874
22949
|
6666,
|
|
22950
|
+
// Alternate IRC [Apple addition]
|
|
22875
22951
|
6667,
|
|
22952
|
+
// Standard IRC [Apple addition]
|
|
22876
22953
|
6668,
|
|
22954
|
+
// Alternate IRC [Apple addition]
|
|
22877
22955
|
6669,
|
|
22956
|
+
// Alternate IRC [Apple addition]
|
|
22878
22957
|
6697,
|
|
22958
|
+
// IRC + TLS
|
|
22879
22959
|
10080
|
|
22960
|
+
// Amanda
|
|
22880
22961
|
]);
|
|
22881
22962
|
function isUnsafePort(port) {
|
|
22882
22963
|
return unsafePorts.has(port);
|
|
@@ -22892,16 +22973,17 @@ async function getPort(config = {}) {
|
|
|
22892
22973
|
if (typeof config === "number" || typeof config === "string") {
|
|
22893
22974
|
config = { port: Number.parseInt(config + "") || 0 };
|
|
22894
22975
|
}
|
|
22976
|
+
const _port = Number(config.port ?? process.env.PORT ?? 3e3);
|
|
22895
22977
|
const options = {
|
|
22896
22978
|
name: "default",
|
|
22897
|
-
random:
|
|
22979
|
+
random: _port === 0,
|
|
22898
22980
|
ports: [],
|
|
22899
22981
|
portRange: [],
|
|
22900
22982
|
alternativePortRange: config.port ? [] : [3e3, 3100],
|
|
22901
22983
|
host: void 0,
|
|
22902
22984
|
verbose: false,
|
|
22903
22985
|
...config,
|
|
22904
|
-
port:
|
|
22986
|
+
port: _port
|
|
22905
22987
|
};
|
|
22906
22988
|
if (options.random) {
|
|
22907
22989
|
return getRandomPort(options.host);
|
|
@@ -52149,12 +52231,12 @@ function isDocker() {
|
|
|
52149
52231
|
return isDockerCached;
|
|
52150
52232
|
}
|
|
52151
52233
|
|
|
52152
|
-
function getNetworkInterfaces(
|
|
52234
|
+
function getNetworkInterfaces(includeIPV6) {
|
|
52153
52235
|
const addrs = /* @__PURE__ */ new Set();
|
|
52154
52236
|
for (const details of Object.values(networkInterfaces())) {
|
|
52155
52237
|
if (details) {
|
|
52156
52238
|
for (const d of details) {
|
|
52157
|
-
if (!d.internal && !(d.mac === "00:00:00:00:00:00") && !d.address.startsWith("fe80::") && !(
|
|
52239
|
+
if (!d.internal && !(d.mac === "00:00:00:00:00:00") && !d.address.startsWith("fe80::") && !(!includeIPV6 && (d.family === "IPv6" || +d.family === 6))) {
|
|
52158
52240
|
addrs.add(formatAddress(d));
|
|
52159
52241
|
}
|
|
52160
52242
|
}
|
|
@@ -52172,11 +52254,36 @@ function formatURL(url) {
|
|
|
52172
52254
|
)
|
|
52173
52255
|
);
|
|
52174
52256
|
}
|
|
52175
|
-
|
|
52257
|
+
const _localHosts = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1"]);
|
|
52258
|
+
function isLocalhost(hostname) {
|
|
52259
|
+
return hostname === void 0 ? false : _localHosts.has(hostname);
|
|
52260
|
+
}
|
|
52261
|
+
const _anyHosts = /* @__PURE__ */ new Set(["", "0.0.0.0", "::"]);
|
|
52262
|
+
function isAnyhost(hostname) {
|
|
52263
|
+
return hostname === void 0 ? false : _anyHosts.has(hostname);
|
|
52264
|
+
}
|
|
52265
|
+
function generateURL(hostname, listhenOptions, baseURL) {
|
|
52266
|
+
const proto = listhenOptions.https ? "https://" : "http://";
|
|
52267
|
+
let port = listhenOptions.port || "";
|
|
52268
|
+
if (port === 80 && proto === "http://" || port === 443 && proto === "https://") {
|
|
52269
|
+
port = "";
|
|
52270
|
+
}
|
|
52271
|
+
if (hostname[0] !== "[" && hostname.includes(":")) {
|
|
52272
|
+
hostname = `[${hostname}]`;
|
|
52273
|
+
}
|
|
52274
|
+
return proto + hostname + ":" + port + (baseURL || listhenOptions.baseURL || "");
|
|
52275
|
+
}
|
|
52276
|
+
function getPublicURL(listhenOptions, baseURL) {
|
|
52176
52277
|
if (listhenOptions.publicURL) {
|
|
52177
52278
|
return listhenOptions.publicURL;
|
|
52178
52279
|
}
|
|
52179
|
-
|
|
52280
|
+
const stackblitzURL = detectStackblitzURL(listhenOptions._entry);
|
|
52281
|
+
if (stackblitzURL) {
|
|
52282
|
+
return stackblitzURL;
|
|
52283
|
+
}
|
|
52284
|
+
if (listhenOptions.hostname && !isLocalhost(listhenOptions.hostname) && !isAnyhost(listhenOptions.hostname)) {
|
|
52285
|
+
return generateURL(listhenOptions.hostname, listhenOptions, baseURL);
|
|
52286
|
+
}
|
|
52180
52287
|
}
|
|
52181
52288
|
function detectStackblitzURL(entry) {
|
|
52182
52289
|
try {
|
|
@@ -52483,7 +52590,7 @@ async function listen(handle, _options = {}) {
|
|
|
52483
52590
|
const _isProd = _options.isProd ?? process.env.NODE_ENV === "production";
|
|
52484
52591
|
const _isTest = _options.isTest ?? process.env.NODE_ENV === "test";
|
|
52485
52592
|
const _hostname = process.env.HOST ?? _options.hostname;
|
|
52486
|
-
const _public = _options.public ?? (
|
|
52593
|
+
const _public = _options.public ?? (isLocalhost(_hostname) ? false : void 0) ?? (isAnyhost(_hostname) ? true : void 0) ?? (process.argv.includes("--host") ? true : void 0) ?? _isProd;
|
|
52487
52594
|
const listhenOptions = defu$1(_options, {
|
|
52488
52595
|
name: "",
|
|
52489
52596
|
https: false,
|
|
@@ -52498,6 +52605,24 @@ async function listen(handle, _options = {}) {
|
|
|
52498
52605
|
public: _public,
|
|
52499
52606
|
autoClose: true
|
|
52500
52607
|
});
|
|
52608
|
+
const _localhost = isLocalhost(listhenOptions.hostname);
|
|
52609
|
+
const _anyhost = isAnyhost(listhenOptions.hostname);
|
|
52610
|
+
if (listhenOptions.public && _localhost) {
|
|
52611
|
+
consola.warn(
|
|
52612
|
+
`[listhen] Trying to listhen on private host ${JSON.stringify(
|
|
52613
|
+
listhenOptions.hostname
|
|
52614
|
+
)} with public option disabled.`
|
|
52615
|
+
);
|
|
52616
|
+
listhenOptions.public = false;
|
|
52617
|
+
} else if (!listhenOptions.public && _anyhost) {
|
|
52618
|
+
consola.warn(
|
|
52619
|
+
`[listhen] Trying to listhen on public host ${JSON.stringify(
|
|
52620
|
+
listhenOptions.hostname
|
|
52621
|
+
)} with public option disabled. Using "localhost".`
|
|
52622
|
+
);
|
|
52623
|
+
listhenOptions.public = false;
|
|
52624
|
+
listhenOptions.hostname = "localhost";
|
|
52625
|
+
}
|
|
52501
52626
|
if (listhenOptions.isTest) {
|
|
52502
52627
|
listhenOptions.showURL = false;
|
|
52503
52628
|
}
|
|
@@ -52505,7 +52630,7 @@ async function listen(handle, _options = {}) {
|
|
|
52505
52630
|
listhenOptions.open = false;
|
|
52506
52631
|
listhenOptions.clipboard = false;
|
|
52507
52632
|
}
|
|
52508
|
-
const port = await getPort({
|
|
52633
|
+
const port = listhenOptions.port = await getPort({
|
|
52509
52634
|
port: Number(listhenOptions.port),
|
|
52510
52635
|
verbose: !listhenOptions.isTest,
|
|
52511
52636
|
host: listhenOptions.hostname,
|
|
@@ -52513,12 +52638,6 @@ async function listen(handle, _options = {}) {
|
|
|
52513
52638
|
...typeof listhenOptions.port === "object" && listhenOptions.port
|
|
52514
52639
|
});
|
|
52515
52640
|
let server;
|
|
52516
|
-
let addr;
|
|
52517
|
-
const getURL = (host, baseURL) => {
|
|
52518
|
-
const anyV4 = addr?.addr === "0.0.0.0";
|
|
52519
|
-
const anyV6 = addr?.addr === "[::]";
|
|
52520
|
-
return `${addr.proto}://${host || listhenOptions.hostname || (anyV4 || anyV6 ? "localhost" : addr.addr)}:${addr.port}${baseURL || listhenOptions.baseURL}`;
|
|
52521
|
-
};
|
|
52522
52641
|
let https = false;
|
|
52523
52642
|
const httpsOptions = listhenOptions.https;
|
|
52524
52643
|
if (httpsOptions) {
|
|
@@ -52527,14 +52646,15 @@ async function listen(handle, _options = {}) {
|
|
|
52527
52646
|
addShutdown(server);
|
|
52528
52647
|
await promisify$5(server.listen.bind(server))(port, listhenOptions.hostname);
|
|
52529
52648
|
const _addr = server.address();
|
|
52530
|
-
|
|
52649
|
+
listhenOptions.port = _addr.port;
|
|
52531
52650
|
} else {
|
|
52532
52651
|
server = createServer$2(handle);
|
|
52533
52652
|
addShutdown(server);
|
|
52534
52653
|
await promisify$5(server.listen.bind(server))(port, listhenOptions.hostname);
|
|
52535
52654
|
const _addr = server.address();
|
|
52536
|
-
|
|
52655
|
+
listhenOptions.port = _addr.port;
|
|
52537
52656
|
}
|
|
52657
|
+
const getURL = (host = listhenOptions.hostname, baseURL) => generateURL(host, listhenOptions, baseURL);
|
|
52538
52658
|
let tunnel;
|
|
52539
52659
|
if (listhenOptions.tunnel) {
|
|
52540
52660
|
const { startTunnel } = await import('./chunks/index.mjs');
|
|
@@ -52561,32 +52681,34 @@ async function listen(handle, _options = {}) {
|
|
|
52561
52681
|
}
|
|
52562
52682
|
const getURLs = async (getURLOptions = {}) => {
|
|
52563
52683
|
const urls = [];
|
|
52564
|
-
const
|
|
52565
|
-
|
|
52566
|
-
|
|
52567
|
-
|
|
52568
|
-
|
|
52569
|
-
|
|
52684
|
+
const _addURL = (type, url) => {
|
|
52685
|
+
if (!urls.some((u) => u.url === url)) {
|
|
52686
|
+
urls.push({
|
|
52687
|
+
url,
|
|
52688
|
+
type
|
|
52689
|
+
});
|
|
52690
|
+
}
|
|
52691
|
+
};
|
|
52692
|
+
const publicURL = getURLOptions.publicURL || getPublicURL(listhenOptions, getURLOptions.baseURL);
|
|
52570
52693
|
if (publicURL) {
|
|
52571
|
-
|
|
52572
|
-
|
|
52573
|
-
|
|
52574
|
-
|
|
52694
|
+
_addURL("network", publicURL);
|
|
52695
|
+
}
|
|
52696
|
+
if (_localhost || _anyhost) {
|
|
52697
|
+
_addURL(
|
|
52698
|
+
"local",
|
|
52699
|
+
getURL(listhenOptions.hostname || "localhost", getURLOptions.baseURL)
|
|
52700
|
+
);
|
|
52575
52701
|
}
|
|
52576
52702
|
if (tunnel) {
|
|
52577
|
-
|
|
52578
|
-
url: await tunnel.getURL(),
|
|
52579
|
-
type: "tunnel"
|
|
52580
|
-
});
|
|
52703
|
+
_addURL("tunnel", await tunnel.getURL());
|
|
52581
52704
|
}
|
|
52582
|
-
|
|
52583
|
-
|
|
52584
|
-
|
|
52585
|
-
|
|
52586
|
-
|
|
52587
|
-
|
|
52588
|
-
|
|
52589
|
-
});
|
|
52705
|
+
if (listhenOptions.public) {
|
|
52706
|
+
const _ipv6Host = listhenOptions.hostname.includes(":");
|
|
52707
|
+
for (const addr of getNetworkInterfaces(_ipv6Host)) {
|
|
52708
|
+
if (addr === publicURL) {
|
|
52709
|
+
continue;
|
|
52710
|
+
}
|
|
52711
|
+
_addURL("network", getURL(addr, getURLOptions.baseURL));
|
|
52590
52712
|
}
|
|
52591
52713
|
}
|
|
52592
52714
|
return urls;
|
|
@@ -52598,10 +52720,18 @@ async function listen(handle, _options = {}) {
|
|
|
52598
52720
|
const firstLocalUrl = urls.find((u) => u.type === "local");
|
|
52599
52721
|
const firstPublicUrl = urls.find((u) => u.type !== "local");
|
|
52600
52722
|
const showQR = (showURLOptions.qr ?? listhenOptions.qr) !== false;
|
|
52723
|
+
if (firstPublicUrl && showQR) {
|
|
52724
|
+
const space = " ".repeat(14);
|
|
52725
|
+
lines.push(" ");
|
|
52726
|
+
lines.push(
|
|
52727
|
+
...renderUnicodeCompact(firstPublicUrl.url).split("\n").map((line) => space + line)
|
|
52728
|
+
);
|
|
52729
|
+
lines.push(" ");
|
|
52730
|
+
}
|
|
52601
52731
|
const typeMap = {
|
|
52602
52732
|
local: ["Local", "green"],
|
|
52603
52733
|
tunnel: ["Tunnel", "yellow"],
|
|
52604
|
-
network: ["Network", "
|
|
52734
|
+
network: ["Network", "magenta"]
|
|
52605
52735
|
};
|
|
52606
52736
|
for (const url of urls) {
|
|
52607
52737
|
const type = typeMap[url.type];
|
|
@@ -52613,7 +52743,7 @@ async function listen(handle, _options = {}) {
|
|
|
52613
52743
|
suffix += colors.gray(" [copied to clipboard]");
|
|
52614
52744
|
}
|
|
52615
52745
|
if (url === firstPublicUrl && showQR) {
|
|
52616
|
-
suffix += colors.gray(" [QR code
|
|
52746
|
+
suffix += colors.gray(" [QR code]");
|
|
52617
52747
|
}
|
|
52618
52748
|
lines.push(`${label} ${formatURL(url.url)}${suffix}`);
|
|
52619
52749
|
}
|
|
@@ -52622,13 +52752,6 @@ async function listen(handle, _options = {}) {
|
|
|
52622
52752
|
colors.gray(` \u279C Network: use ${colors.white("--host")} to expose`)
|
|
52623
52753
|
);
|
|
52624
52754
|
}
|
|
52625
|
-
if (firstPublicUrl && showQR) {
|
|
52626
|
-
const space = " ".repeat(14);
|
|
52627
|
-
lines.push(" ");
|
|
52628
|
-
lines.push(
|
|
52629
|
-
...renderUnicodeCompact(firstPublicUrl.url).split("\n").map((line) => space + line)
|
|
52630
|
-
);
|
|
52631
|
-
}
|
|
52632
52755
|
console.log("\n" + lines.join("\n") + "\n");
|
|
52633
52756
|
};
|
|
52634
52757
|
if (listhenOptions.showURL) {
|
|
@@ -52655,26 +52778,6 @@ async function listen(handle, _options = {}) {
|
|
|
52655
52778
|
};
|
|
52656
52779
|
}
|
|
52657
52780
|
|
|
52658
|
-
const dev = defineCommand({
|
|
52659
|
-
meta: {
|
|
52660
|
-
name: "dev",
|
|
52661
|
-
description: "Start the arri dev server"
|
|
52662
|
-
},
|
|
52663
|
-
args: {
|
|
52664
|
-
config: {
|
|
52665
|
-
type: "string",
|
|
52666
|
-
description: "Path to the arri config file",
|
|
52667
|
-
alias: "c",
|
|
52668
|
-
default: "./arri.config.ts"
|
|
52669
|
-
}
|
|
52670
|
-
},
|
|
52671
|
-
run: async ({ args }) => {
|
|
52672
|
-
const config = await loadConfig({
|
|
52673
|
-
configFile: path$d.resolve(args.config)
|
|
52674
|
-
});
|
|
52675
|
-
await main$1(config.config);
|
|
52676
|
-
}
|
|
52677
|
-
});
|
|
52678
52781
|
const disallowedNameChars = "~`!@#$%^&*()-+=[]{}\\|:;\"'<>,./";
|
|
52679
52782
|
const getRpcMetaFromPath = (config, filePath) => {
|
|
52680
52783
|
if (!config.procedureDir) {
|
|
@@ -52893,10 +52996,391 @@ async function setupWorkingDir(config) {
|
|
|
52893
52996
|
}
|
|
52894
52997
|
await fs$g.mkdir(arriDir);
|
|
52895
52998
|
}
|
|
52999
|
+
const dev = defineCommand({
|
|
53000
|
+
meta: {
|
|
53001
|
+
name: "dev",
|
|
53002
|
+
description: "Start the arri dev server"
|
|
53003
|
+
},
|
|
53004
|
+
args: {
|
|
53005
|
+
config: {
|
|
53006
|
+
type: "string",
|
|
53007
|
+
description: "Path to the arri config file",
|
|
53008
|
+
alias: "c",
|
|
53009
|
+
default: "./arri.config.ts"
|
|
53010
|
+
}
|
|
53011
|
+
},
|
|
53012
|
+
async run({ args }) {
|
|
53013
|
+
const config = await loadConfig({
|
|
53014
|
+
configFile: path$d.resolve(args.config)
|
|
53015
|
+
});
|
|
53016
|
+
await main$1(config.config);
|
|
53017
|
+
}
|
|
53018
|
+
});
|
|
53019
|
+
|
|
53020
|
+
class FetchError extends Error {
|
|
53021
|
+
constructor(message, opts) {
|
|
53022
|
+
super(message, opts);
|
|
53023
|
+
this.name = "FetchError";
|
|
53024
|
+
if (opts?.cause && !this.cause) {
|
|
53025
|
+
this.cause = opts.cause;
|
|
53026
|
+
}
|
|
53027
|
+
}
|
|
53028
|
+
}
|
|
53029
|
+
function createFetchError(ctx) {
|
|
53030
|
+
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
|
53031
|
+
const method = ctx.request?.method || ctx.options?.method || "GET";
|
|
53032
|
+
const url = ctx.request?.url || String(ctx.request) || "/";
|
|
53033
|
+
const requestStr = `[${method}] ${JSON.stringify(url)}`;
|
|
53034
|
+
const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>";
|
|
53035
|
+
const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`;
|
|
53036
|
+
const fetchError = new FetchError(
|
|
53037
|
+
message,
|
|
53038
|
+
ctx.error ? { cause: ctx.error } : void 0
|
|
53039
|
+
);
|
|
53040
|
+
for (const key of ["request", "options", "response"]) {
|
|
53041
|
+
Object.defineProperty(fetchError, key, {
|
|
53042
|
+
get() {
|
|
53043
|
+
return ctx[key];
|
|
53044
|
+
}
|
|
53045
|
+
});
|
|
53046
|
+
}
|
|
53047
|
+
for (const [key, refKey] of [
|
|
53048
|
+
["data", "_data"],
|
|
53049
|
+
["status", "status"],
|
|
53050
|
+
["statusCode", "status"],
|
|
53051
|
+
["statusText", "statusText"],
|
|
53052
|
+
["statusMessage", "statusText"]
|
|
53053
|
+
]) {
|
|
53054
|
+
Object.defineProperty(fetchError, key, {
|
|
53055
|
+
get() {
|
|
53056
|
+
return ctx.response && ctx.response[refKey];
|
|
53057
|
+
}
|
|
53058
|
+
});
|
|
53059
|
+
}
|
|
53060
|
+
return fetchError;
|
|
53061
|
+
}
|
|
53062
|
+
|
|
53063
|
+
const payloadMethods = new Set(
|
|
53064
|
+
Object.freeze(["PATCH", "POST", "PUT", "DELETE"])
|
|
53065
|
+
);
|
|
53066
|
+
function isPayloadMethod(method = "GET") {
|
|
53067
|
+
return payloadMethods.has(method.toUpperCase());
|
|
53068
|
+
}
|
|
53069
|
+
function isJSONSerializable(value) {
|
|
53070
|
+
if (value === void 0) {
|
|
53071
|
+
return false;
|
|
53072
|
+
}
|
|
53073
|
+
const t = typeof value;
|
|
53074
|
+
if (t === "string" || t === "number" || t === "boolean" || t === null) {
|
|
53075
|
+
return true;
|
|
53076
|
+
}
|
|
53077
|
+
if (t !== "object") {
|
|
53078
|
+
return false;
|
|
53079
|
+
}
|
|
53080
|
+
if (Array.isArray(value)) {
|
|
53081
|
+
return true;
|
|
53082
|
+
}
|
|
53083
|
+
if (value.buffer) {
|
|
53084
|
+
return false;
|
|
53085
|
+
}
|
|
53086
|
+
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
|
53087
|
+
}
|
|
53088
|
+
const textTypes = /* @__PURE__ */ new Set([
|
|
53089
|
+
"image/svg",
|
|
53090
|
+
"application/xml",
|
|
53091
|
+
"application/xhtml",
|
|
53092
|
+
"application/html"
|
|
53093
|
+
]);
|
|
53094
|
+
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
53095
|
+
function detectResponseType(_contentType = "") {
|
|
53096
|
+
if (!_contentType) {
|
|
53097
|
+
return "json";
|
|
53098
|
+
}
|
|
53099
|
+
const contentType = _contentType.split(";").shift() || "";
|
|
53100
|
+
if (JSON_RE.test(contentType)) {
|
|
53101
|
+
return "json";
|
|
53102
|
+
}
|
|
53103
|
+
if (textTypes.has(contentType) || contentType.startsWith("text/")) {
|
|
53104
|
+
return "text";
|
|
53105
|
+
}
|
|
53106
|
+
return "blob";
|
|
53107
|
+
}
|
|
53108
|
+
function mergeFetchOptions(input, defaults, Headers = globalThis.Headers) {
|
|
53109
|
+
const merged = {
|
|
53110
|
+
...defaults,
|
|
53111
|
+
...input
|
|
53112
|
+
};
|
|
53113
|
+
if (defaults?.params && input?.params) {
|
|
53114
|
+
merged.params = {
|
|
53115
|
+
...defaults?.params,
|
|
53116
|
+
...input?.params
|
|
53117
|
+
};
|
|
53118
|
+
}
|
|
53119
|
+
if (defaults?.query && input?.query) {
|
|
53120
|
+
merged.query = {
|
|
53121
|
+
...defaults?.query,
|
|
53122
|
+
...input?.query
|
|
53123
|
+
};
|
|
53124
|
+
}
|
|
53125
|
+
if (defaults?.headers && input?.headers) {
|
|
53126
|
+
merged.headers = new Headers(defaults?.headers || {});
|
|
53127
|
+
for (const [key, value] of new Headers(input?.headers || {})) {
|
|
53128
|
+
merged.headers.set(key, value);
|
|
53129
|
+
}
|
|
53130
|
+
}
|
|
53131
|
+
return merged;
|
|
53132
|
+
}
|
|
53133
|
+
|
|
53134
|
+
const retryStatusCodes = /* @__PURE__ */ new Set([
|
|
53135
|
+
408,
|
|
53136
|
+
// Request Timeout
|
|
53137
|
+
409,
|
|
53138
|
+
// Conflict
|
|
53139
|
+
425,
|
|
53140
|
+
// Too Early
|
|
53141
|
+
429,
|
|
53142
|
+
// Too Many Requests
|
|
53143
|
+
500,
|
|
53144
|
+
// Internal Server Error
|
|
53145
|
+
502,
|
|
53146
|
+
// Bad Gateway
|
|
53147
|
+
503,
|
|
53148
|
+
// Service Unavailable
|
|
53149
|
+
504
|
|
53150
|
+
// Gateway Timeout
|
|
53151
|
+
]);
|
|
53152
|
+
const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
53153
|
+
function createFetch(globalOptions = {}) {
|
|
53154
|
+
const {
|
|
53155
|
+
fetch = globalThis.fetch,
|
|
53156
|
+
Headers = globalThis.Headers,
|
|
53157
|
+
AbortController = globalThis.AbortController
|
|
53158
|
+
} = globalOptions;
|
|
53159
|
+
async function onError(context) {
|
|
53160
|
+
const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
|
|
53161
|
+
if (context.options.retry !== false && !isAbort) {
|
|
53162
|
+
let retries;
|
|
53163
|
+
if (typeof context.options.retry === "number") {
|
|
53164
|
+
retries = context.options.retry;
|
|
53165
|
+
} else {
|
|
53166
|
+
retries = isPayloadMethod(context.options.method) ? 0 : 1;
|
|
53167
|
+
}
|
|
53168
|
+
const responseCode = context.response && context.response.status || 500;
|
|
53169
|
+
if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
|
|
53170
|
+
const retryDelay = context.options.retryDelay || 0;
|
|
53171
|
+
if (retryDelay > 0) {
|
|
53172
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
53173
|
+
}
|
|
53174
|
+
return $fetchRaw(context.request, {
|
|
53175
|
+
...context.options,
|
|
53176
|
+
retry: retries - 1,
|
|
53177
|
+
timeout: context.options.timeout
|
|
53178
|
+
});
|
|
53179
|
+
}
|
|
53180
|
+
}
|
|
53181
|
+
const error = createFetchError(context);
|
|
53182
|
+
if (Error.captureStackTrace) {
|
|
53183
|
+
Error.captureStackTrace(error, $fetchRaw);
|
|
53184
|
+
}
|
|
53185
|
+
throw error;
|
|
53186
|
+
}
|
|
53187
|
+
const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
|
|
53188
|
+
const context = {
|
|
53189
|
+
request: _request,
|
|
53190
|
+
options: mergeFetchOptions(_options, globalOptions.defaults, Headers),
|
|
53191
|
+
response: void 0,
|
|
53192
|
+
error: void 0
|
|
53193
|
+
};
|
|
53194
|
+
context.options.method = context.options.method?.toUpperCase();
|
|
53195
|
+
if (context.options.onRequest) {
|
|
53196
|
+
await context.options.onRequest(context);
|
|
53197
|
+
}
|
|
53198
|
+
if (typeof context.request === "string") {
|
|
53199
|
+
if (context.options.baseURL) {
|
|
53200
|
+
context.request = withBase(context.request, context.options.baseURL);
|
|
53201
|
+
}
|
|
53202
|
+
if (context.options.query || context.options.params) {
|
|
53203
|
+
context.request = withQuery(context.request, {
|
|
53204
|
+
...context.options.params,
|
|
53205
|
+
...context.options.query
|
|
53206
|
+
});
|
|
53207
|
+
}
|
|
53208
|
+
}
|
|
53209
|
+
if (context.options.body && isPayloadMethod(context.options.method)) {
|
|
53210
|
+
if (isJSONSerializable(context.options.body)) {
|
|
53211
|
+
context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body);
|
|
53212
|
+
context.options.headers = new Headers(context.options.headers || {});
|
|
53213
|
+
if (!context.options.headers.has("content-type")) {
|
|
53214
|
+
context.options.headers.set("content-type", "application/json");
|
|
53215
|
+
}
|
|
53216
|
+
if (!context.options.headers.has("accept")) {
|
|
53217
|
+
context.options.headers.set("accept", "application/json");
|
|
53218
|
+
}
|
|
53219
|
+
} else if (
|
|
53220
|
+
// ReadableStream Body
|
|
53221
|
+
"pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || // Node.js Stream Body
|
|
53222
|
+
typeof context.options.body.pipe === "function"
|
|
53223
|
+
) {
|
|
53224
|
+
if (!("duplex" in context.options)) {
|
|
53225
|
+
context.options.duplex = "half";
|
|
53226
|
+
}
|
|
53227
|
+
}
|
|
53228
|
+
}
|
|
53229
|
+
if (!context.options.signal && context.options.timeout) {
|
|
53230
|
+
const controller = new AbortController();
|
|
53231
|
+
setTimeout(() => controller.abort(), context.options.timeout);
|
|
53232
|
+
context.options.signal = controller.signal;
|
|
53233
|
+
}
|
|
53234
|
+
try {
|
|
53235
|
+
context.response = await fetch(
|
|
53236
|
+
context.request,
|
|
53237
|
+
context.options
|
|
53238
|
+
);
|
|
53239
|
+
} catch (error) {
|
|
53240
|
+
context.error = error;
|
|
53241
|
+
if (context.options.onRequestError) {
|
|
53242
|
+
await context.options.onRequestError(context);
|
|
53243
|
+
}
|
|
53244
|
+
return await onError(context);
|
|
53245
|
+
}
|
|
53246
|
+
const hasBody = context.response.body && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD";
|
|
53247
|
+
if (hasBody) {
|
|
53248
|
+
const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
|
|
53249
|
+
switch (responseType) {
|
|
53250
|
+
case "json": {
|
|
53251
|
+
const data = await context.response.text();
|
|
53252
|
+
const parseFunction = context.options.parseResponse || destr;
|
|
53253
|
+
context.response._data = parseFunction(data);
|
|
53254
|
+
break;
|
|
53255
|
+
}
|
|
53256
|
+
case "stream": {
|
|
53257
|
+
context.response._data = context.response.body;
|
|
53258
|
+
break;
|
|
53259
|
+
}
|
|
53260
|
+
default: {
|
|
53261
|
+
context.response._data = await context.response[responseType]();
|
|
53262
|
+
}
|
|
53263
|
+
}
|
|
53264
|
+
}
|
|
53265
|
+
if (context.options.onResponse) {
|
|
53266
|
+
await context.options.onResponse(context);
|
|
53267
|
+
}
|
|
53268
|
+
if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
|
|
53269
|
+
if (context.options.onResponseError) {
|
|
53270
|
+
await context.options.onResponseError(context);
|
|
53271
|
+
}
|
|
53272
|
+
return await onError(context);
|
|
53273
|
+
}
|
|
53274
|
+
return context.response;
|
|
53275
|
+
};
|
|
53276
|
+
const $fetch = async function $fetch2(request, options) {
|
|
53277
|
+
const r = await $fetchRaw(request, options);
|
|
53278
|
+
return r._data;
|
|
53279
|
+
};
|
|
53280
|
+
$fetch.raw = $fetchRaw;
|
|
53281
|
+
$fetch.native = (...args) => fetch(...args);
|
|
53282
|
+
$fetch.create = (defaultOptions = {}) => createFetch({
|
|
53283
|
+
...globalOptions,
|
|
53284
|
+
defaults: {
|
|
53285
|
+
...globalOptions.defaults,
|
|
53286
|
+
...defaultOptions
|
|
53287
|
+
}
|
|
53288
|
+
});
|
|
53289
|
+
return $fetch;
|
|
53290
|
+
}
|
|
53291
|
+
|
|
53292
|
+
const _globalThis = function() {
|
|
53293
|
+
if (typeof globalThis !== "undefined") {
|
|
53294
|
+
return globalThis;
|
|
53295
|
+
}
|
|
53296
|
+
if (typeof self !== "undefined") {
|
|
53297
|
+
return self;
|
|
53298
|
+
}
|
|
53299
|
+
if (typeof window !== "undefined") {
|
|
53300
|
+
return window;
|
|
53301
|
+
}
|
|
53302
|
+
if (typeof global !== "undefined") {
|
|
53303
|
+
return global;
|
|
53304
|
+
}
|
|
53305
|
+
throw new Error("unable to locate global object");
|
|
53306
|
+
}();
|
|
53307
|
+
const fetch = _globalThis.fetch || (() => Promise.reject(new Error("[ofetch] global.fetch is not supported!")));
|
|
53308
|
+
const Headers = _globalThis.Headers;
|
|
53309
|
+
const AbortController = _globalThis.AbortController;
|
|
53310
|
+
const ofetch = createFetch({ fetch, Headers, AbortController });
|
|
53311
|
+
|
|
53312
|
+
const codegenDart = defineCommand({
|
|
53313
|
+
args: {
|
|
53314
|
+
location: {
|
|
53315
|
+
type: "positional",
|
|
53316
|
+
required: true,
|
|
53317
|
+
description: "The path to an Arri definition file or a url that returns an Arri definition file."
|
|
53318
|
+
},
|
|
53319
|
+
clientName: {
|
|
53320
|
+
type: "string",
|
|
53321
|
+
alias: ["name"],
|
|
53322
|
+
required: true
|
|
53323
|
+
},
|
|
53324
|
+
outFile: {
|
|
53325
|
+
type: "string",
|
|
53326
|
+
alias: ["out", "o"],
|
|
53327
|
+
required: true
|
|
53328
|
+
}
|
|
53329
|
+
},
|
|
53330
|
+
async run({ args }) {
|
|
53331
|
+
const isUrl = args.location.startsWith("http://") || args.location.startsWith("https://");
|
|
53332
|
+
let def;
|
|
53333
|
+
if (isUrl) {
|
|
53334
|
+
const result = await ofetch(args.location);
|
|
53335
|
+
def = result;
|
|
53336
|
+
} else {
|
|
53337
|
+
if (!existsSync(args.location)) {
|
|
53338
|
+
throw new Error(`Unable to find ${args.location}`);
|
|
53339
|
+
}
|
|
53340
|
+
const jsonString = JSON.parse(
|
|
53341
|
+
readFileSync(args.location, { encoding: "utf-8" })
|
|
53342
|
+
);
|
|
53343
|
+
def = jsonString;
|
|
53344
|
+
}
|
|
53345
|
+
if (!def) {
|
|
53346
|
+
throw new Error("Unable to load ApplicationDefinition json file");
|
|
53347
|
+
}
|
|
53348
|
+
await dartClientGenerator({
|
|
53349
|
+
clientName: args.clientName,
|
|
53350
|
+
outputFile: args.outFile
|
|
53351
|
+
}).generator(def);
|
|
53352
|
+
}
|
|
53353
|
+
});
|
|
53354
|
+
const codegenTypescript = defineCommand({
|
|
53355
|
+
args: {
|
|
53356
|
+
location: {
|
|
53357
|
+
type: "positional",
|
|
53358
|
+
required: true,
|
|
53359
|
+
description: "The path to an Arri definition file or a url that returns an Arri definition file."
|
|
53360
|
+
},
|
|
53361
|
+
clientName: {
|
|
53362
|
+
type: "string",
|
|
53363
|
+
alias: ["name"],
|
|
53364
|
+
required: true
|
|
53365
|
+
},
|
|
53366
|
+
outFile: {
|
|
53367
|
+
type: "string",
|
|
53368
|
+
alias: ["out", "o"],
|
|
53369
|
+
required: true
|
|
53370
|
+
}
|
|
53371
|
+
}
|
|
53372
|
+
});
|
|
53373
|
+
const codegen = defineCommand({
|
|
53374
|
+
subCommands: {
|
|
53375
|
+
dart: codegenDart,
|
|
53376
|
+
typescript: codegenTypescript
|
|
53377
|
+
}
|
|
53378
|
+
});
|
|
52896
53379
|
|
|
52897
53380
|
const main = defineCommand({
|
|
52898
53381
|
subCommands: {
|
|
52899
|
-
dev
|
|
53382
|
+
dev,
|
|
53383
|
+
codegen
|
|
52900
53384
|
}
|
|
52901
53385
|
});
|
|
52902
53386
|
void runMain(main);
|