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.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const tty = require('node:tty');
|
|
|
5
5
|
const fs$f = require('node:fs');
|
|
6
6
|
const path$e = require('node:path');
|
|
7
7
|
const require$$0 = require('stream');
|
|
8
|
-
const index = require('./shared/arri.
|
|
8
|
+
const index = require('./shared/arri.8e602d87.cjs');
|
|
9
9
|
const require$$0$1 = require('os');
|
|
10
10
|
const require$$0$2 = require('path');
|
|
11
11
|
const require$$0$3 = require('util');
|
|
@@ -29,7 +29,7 @@ const node_module = require('node:module');
|
|
|
29
29
|
const assert = require('node:assert');
|
|
30
30
|
const v8$1 = require('node:v8');
|
|
31
31
|
const node_util = require('node:util');
|
|
32
|
-
const
|
|
32
|
+
const dart = require('./shared/arri.835c5c3c.cjs');
|
|
33
33
|
const node_http = require('node:http');
|
|
34
34
|
const https = require('node:https');
|
|
35
35
|
const node_net = require('node:net');
|
|
@@ -37,6 +37,7 @@ const require$$0$5 = require('http');
|
|
|
37
37
|
const require$$1 = require('https');
|
|
38
38
|
const childProcess = require('node:child_process');
|
|
39
39
|
require('fs/promises');
|
|
40
|
+
require('child_process');
|
|
40
41
|
|
|
41
42
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
42
43
|
|
|
@@ -22841,85 +22842,165 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
22841
22842
|
|
|
22842
22843
|
const unsafePorts = /* @__PURE__ */ new Set([
|
|
22843
22844
|
1,
|
|
22845
|
+
// tcpmux
|
|
22844
22846
|
7,
|
|
22847
|
+
// echo
|
|
22845
22848
|
9,
|
|
22849
|
+
// discard
|
|
22846
22850
|
11,
|
|
22851
|
+
// systat
|
|
22847
22852
|
13,
|
|
22853
|
+
// daytime
|
|
22848
22854
|
15,
|
|
22855
|
+
// netstat
|
|
22849
22856
|
17,
|
|
22857
|
+
// qotd
|
|
22850
22858
|
19,
|
|
22859
|
+
// chargen
|
|
22851
22860
|
20,
|
|
22861
|
+
// ftp data
|
|
22852
22862
|
21,
|
|
22863
|
+
// ftp access
|
|
22853
22864
|
22,
|
|
22865
|
+
// ssh
|
|
22854
22866
|
23,
|
|
22867
|
+
// telnet
|
|
22855
22868
|
25,
|
|
22869
|
+
// smtp
|
|
22856
22870
|
37,
|
|
22871
|
+
// time
|
|
22857
22872
|
42,
|
|
22873
|
+
// name
|
|
22858
22874
|
43,
|
|
22875
|
+
// nicname
|
|
22859
22876
|
53,
|
|
22877
|
+
// domain
|
|
22860
22878
|
69,
|
|
22879
|
+
// tftp
|
|
22861
22880
|
77,
|
|
22881
|
+
// priv-rjs
|
|
22862
22882
|
79,
|
|
22883
|
+
// finger
|
|
22863
22884
|
87,
|
|
22885
|
+
// ttylink
|
|
22864
22886
|
95,
|
|
22887
|
+
// supdup
|
|
22865
22888
|
101,
|
|
22889
|
+
// hostriame
|
|
22866
22890
|
102,
|
|
22891
|
+
// iso-tsap
|
|
22867
22892
|
103,
|
|
22893
|
+
// gppitnp
|
|
22868
22894
|
104,
|
|
22895
|
+
// acr-nema
|
|
22869
22896
|
109,
|
|
22897
|
+
// pop2
|
|
22870
22898
|
110,
|
|
22899
|
+
// pop3
|
|
22871
22900
|
111,
|
|
22901
|
+
// sunrpc
|
|
22872
22902
|
113,
|
|
22903
|
+
// auth
|
|
22873
22904
|
115,
|
|
22905
|
+
// sftp
|
|
22874
22906
|
117,
|
|
22907
|
+
// uucp-path
|
|
22875
22908
|
119,
|
|
22909
|
+
// nntp
|
|
22876
22910
|
123,
|
|
22911
|
+
// NTP
|
|
22877
22912
|
135,
|
|
22913
|
+
// loc-srv /epmap
|
|
22878
22914
|
137,
|
|
22915
|
+
// netbios
|
|
22879
22916
|
139,
|
|
22917
|
+
// netbios
|
|
22880
22918
|
143,
|
|
22919
|
+
// imap2
|
|
22881
22920
|
161,
|
|
22921
|
+
// snmp
|
|
22882
22922
|
179,
|
|
22923
|
+
// BGP
|
|
22883
22924
|
389,
|
|
22925
|
+
// ldap
|
|
22884
22926
|
427,
|
|
22927
|
+
// SLP (Also used by Apple Filing Protocol)
|
|
22885
22928
|
465,
|
|
22929
|
+
// smtp+ssl
|
|
22886
22930
|
512,
|
|
22931
|
+
// print / exec
|
|
22887
22932
|
513,
|
|
22933
|
+
// login
|
|
22888
22934
|
514,
|
|
22935
|
+
// shell
|
|
22889
22936
|
515,
|
|
22937
|
+
// printer
|
|
22890
22938
|
526,
|
|
22939
|
+
// tempo
|
|
22891
22940
|
530,
|
|
22941
|
+
// courier
|
|
22892
22942
|
531,
|
|
22943
|
+
// chat
|
|
22893
22944
|
532,
|
|
22945
|
+
// netnews
|
|
22894
22946
|
540,
|
|
22947
|
+
// uucp
|
|
22895
22948
|
548,
|
|
22949
|
+
// AFP (Apple Filing Protocol)
|
|
22896
22950
|
554,
|
|
22951
|
+
// rtsp
|
|
22897
22952
|
556,
|
|
22953
|
+
// remotefs
|
|
22898
22954
|
563,
|
|
22955
|
+
// nntp+ssl
|
|
22899
22956
|
587,
|
|
22957
|
+
// smtp (rfc6409)
|
|
22900
22958
|
601,
|
|
22959
|
+
// syslog-conn (rfc3195)
|
|
22901
22960
|
636,
|
|
22961
|
+
// ldap+ssl
|
|
22902
22962
|
989,
|
|
22963
|
+
// ftps-data
|
|
22903
22964
|
990,
|
|
22965
|
+
// ftps
|
|
22904
22966
|
993,
|
|
22967
|
+
// ldap+ssl
|
|
22905
22968
|
995,
|
|
22969
|
+
// pop3+ssl
|
|
22906
22970
|
1719,
|
|
22971
|
+
// h323gatestat
|
|
22907
22972
|
1720,
|
|
22973
|
+
// h323hostcall
|
|
22908
22974
|
1723,
|
|
22975
|
+
// pptp
|
|
22909
22976
|
2049,
|
|
22977
|
+
// nfs
|
|
22910
22978
|
3659,
|
|
22979
|
+
// apple-sasl / PasswordServer
|
|
22911
22980
|
4045,
|
|
22981
|
+
// lockd
|
|
22912
22982
|
5060,
|
|
22983
|
+
// sip
|
|
22913
22984
|
5061,
|
|
22985
|
+
// sips
|
|
22914
22986
|
6e3,
|
|
22987
|
+
// X11
|
|
22915
22988
|
6566,
|
|
22989
|
+
// sane-port
|
|
22916
22990
|
6665,
|
|
22991
|
+
// Alternate IRC [Apple addition]
|
|
22917
22992
|
6666,
|
|
22993
|
+
// Alternate IRC [Apple addition]
|
|
22918
22994
|
6667,
|
|
22995
|
+
// Standard IRC [Apple addition]
|
|
22919
22996
|
6668,
|
|
22997
|
+
// Alternate IRC [Apple addition]
|
|
22920
22998
|
6669,
|
|
22999
|
+
// Alternate IRC [Apple addition]
|
|
22921
23000
|
6697,
|
|
23001
|
+
// IRC + TLS
|
|
22922
23002
|
10080
|
|
23003
|
+
// Amanda
|
|
22923
23004
|
]);
|
|
22924
23005
|
function isUnsafePort(port) {
|
|
22925
23006
|
return unsafePorts.has(port);
|
|
@@ -22935,16 +23016,17 @@ async function getPort(config = {}) {
|
|
|
22935
23016
|
if (typeof config === "number" || typeof config === "string") {
|
|
22936
23017
|
config = { port: Number.parseInt(config + "") || 0 };
|
|
22937
23018
|
}
|
|
23019
|
+
const _port = Number(config.port ?? process.env.PORT ?? 3e3);
|
|
22938
23020
|
const options = {
|
|
22939
23021
|
name: "default",
|
|
22940
|
-
random:
|
|
23022
|
+
random: _port === 0,
|
|
22941
23023
|
ports: [],
|
|
22942
23024
|
portRange: [],
|
|
22943
23025
|
alternativePortRange: config.port ? [] : [3e3, 3100],
|
|
22944
23026
|
host: void 0,
|
|
22945
23027
|
verbose: false,
|
|
22946
23028
|
...config,
|
|
22947
|
-
port:
|
|
23029
|
+
port: _port
|
|
22948
23030
|
};
|
|
22949
23031
|
if (options.random) {
|
|
22950
23032
|
return getRandomPort(options.host);
|
|
@@ -52192,12 +52274,12 @@ function isDocker() {
|
|
|
52192
52274
|
return isDockerCached;
|
|
52193
52275
|
}
|
|
52194
52276
|
|
|
52195
|
-
function getNetworkInterfaces(
|
|
52277
|
+
function getNetworkInterfaces(includeIPV6) {
|
|
52196
52278
|
const addrs = /* @__PURE__ */ new Set();
|
|
52197
52279
|
for (const details of Object.values(os$2.networkInterfaces())) {
|
|
52198
52280
|
if (details) {
|
|
52199
52281
|
for (const d of details) {
|
|
52200
|
-
if (!d.internal && !(d.mac === "00:00:00:00:00:00") && !d.address.startsWith("fe80::") && !(
|
|
52282
|
+
if (!d.internal && !(d.mac === "00:00:00:00:00:00") && !d.address.startsWith("fe80::") && !(!includeIPV6 && (d.family === "IPv6" || +d.family === 6))) {
|
|
52201
52283
|
addrs.add(formatAddress(d));
|
|
52202
52284
|
}
|
|
52203
52285
|
}
|
|
@@ -52215,11 +52297,36 @@ function formatURL(url) {
|
|
|
52215
52297
|
)
|
|
52216
52298
|
);
|
|
52217
52299
|
}
|
|
52218
|
-
|
|
52300
|
+
const _localHosts = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1"]);
|
|
52301
|
+
function isLocalhost(hostname) {
|
|
52302
|
+
return hostname === void 0 ? false : _localHosts.has(hostname);
|
|
52303
|
+
}
|
|
52304
|
+
const _anyHosts = /* @__PURE__ */ new Set(["", "0.0.0.0", "::"]);
|
|
52305
|
+
function isAnyhost(hostname) {
|
|
52306
|
+
return hostname === void 0 ? false : _anyHosts.has(hostname);
|
|
52307
|
+
}
|
|
52308
|
+
function generateURL(hostname, listhenOptions, baseURL) {
|
|
52309
|
+
const proto = listhenOptions.https ? "https://" : "http://";
|
|
52310
|
+
let port = listhenOptions.port || "";
|
|
52311
|
+
if (port === 80 && proto === "http://" || port === 443 && proto === "https://") {
|
|
52312
|
+
port = "";
|
|
52313
|
+
}
|
|
52314
|
+
if (hostname[0] !== "[" && hostname.includes(":")) {
|
|
52315
|
+
hostname = `[${hostname}]`;
|
|
52316
|
+
}
|
|
52317
|
+
return proto + hostname + ":" + port + (baseURL || listhenOptions.baseURL || "");
|
|
52318
|
+
}
|
|
52319
|
+
function getPublicURL(listhenOptions, baseURL) {
|
|
52219
52320
|
if (listhenOptions.publicURL) {
|
|
52220
52321
|
return listhenOptions.publicURL;
|
|
52221
52322
|
}
|
|
52222
|
-
|
|
52323
|
+
const stackblitzURL = detectStackblitzURL(listhenOptions._entry);
|
|
52324
|
+
if (stackblitzURL) {
|
|
52325
|
+
return stackblitzURL;
|
|
52326
|
+
}
|
|
52327
|
+
if (listhenOptions.hostname && !isLocalhost(listhenOptions.hostname) && !isAnyhost(listhenOptions.hostname)) {
|
|
52328
|
+
return generateURL(listhenOptions.hostname, listhenOptions, baseURL);
|
|
52329
|
+
}
|
|
52223
52330
|
}
|
|
52224
52331
|
function detectStackblitzURL(entry) {
|
|
52225
52332
|
try {
|
|
@@ -52526,7 +52633,7 @@ async function listen(handle, _options = {}) {
|
|
|
52526
52633
|
const _isProd = _options.isProd ?? process.env.NODE_ENV === "production";
|
|
52527
52634
|
const _isTest = _options.isTest ?? process.env.NODE_ENV === "test";
|
|
52528
52635
|
const _hostname = process.env.HOST ?? _options.hostname;
|
|
52529
|
-
const _public = _options.public ?? (
|
|
52636
|
+
const _public = _options.public ?? (isLocalhost(_hostname) ? false : void 0) ?? (isAnyhost(_hostname) ? true : void 0) ?? (process.argv.includes("--host") ? true : void 0) ?? _isProd;
|
|
52530
52637
|
const listhenOptions = defu$1(_options, {
|
|
52531
52638
|
name: "",
|
|
52532
52639
|
https: false,
|
|
@@ -52541,6 +52648,24 @@ async function listen(handle, _options = {}) {
|
|
|
52541
52648
|
public: _public,
|
|
52542
52649
|
autoClose: true
|
|
52543
52650
|
});
|
|
52651
|
+
const _localhost = isLocalhost(listhenOptions.hostname);
|
|
52652
|
+
const _anyhost = isAnyhost(listhenOptions.hostname);
|
|
52653
|
+
if (listhenOptions.public && _localhost) {
|
|
52654
|
+
consola.warn(
|
|
52655
|
+
`[listhen] Trying to listhen on private host ${JSON.stringify(
|
|
52656
|
+
listhenOptions.hostname
|
|
52657
|
+
)} with public option disabled.`
|
|
52658
|
+
);
|
|
52659
|
+
listhenOptions.public = false;
|
|
52660
|
+
} else if (!listhenOptions.public && _anyhost) {
|
|
52661
|
+
consola.warn(
|
|
52662
|
+
`[listhen] Trying to listhen on public host ${JSON.stringify(
|
|
52663
|
+
listhenOptions.hostname
|
|
52664
|
+
)} with public option disabled. Using "localhost".`
|
|
52665
|
+
);
|
|
52666
|
+
listhenOptions.public = false;
|
|
52667
|
+
listhenOptions.hostname = "localhost";
|
|
52668
|
+
}
|
|
52544
52669
|
if (listhenOptions.isTest) {
|
|
52545
52670
|
listhenOptions.showURL = false;
|
|
52546
52671
|
}
|
|
@@ -52548,7 +52673,7 @@ async function listen(handle, _options = {}) {
|
|
|
52548
52673
|
listhenOptions.open = false;
|
|
52549
52674
|
listhenOptions.clipboard = false;
|
|
52550
52675
|
}
|
|
52551
|
-
const port = await getPort({
|
|
52676
|
+
const port = listhenOptions.port = await getPort({
|
|
52552
52677
|
port: Number(listhenOptions.port),
|
|
52553
52678
|
verbose: !listhenOptions.isTest,
|
|
52554
52679
|
host: listhenOptions.hostname,
|
|
@@ -52556,12 +52681,6 @@ async function listen(handle, _options = {}) {
|
|
|
52556
52681
|
...typeof listhenOptions.port === "object" && listhenOptions.port
|
|
52557
52682
|
});
|
|
52558
52683
|
let server;
|
|
52559
|
-
let addr;
|
|
52560
|
-
const getURL = (host, baseURL) => {
|
|
52561
|
-
const anyV4 = addr?.addr === "0.0.0.0";
|
|
52562
|
-
const anyV6 = addr?.addr === "[::]";
|
|
52563
|
-
return `${addr.proto}://${host || listhenOptions.hostname || (anyV4 || anyV6 ? "localhost" : addr.addr)}:${addr.port}${baseURL || listhenOptions.baseURL}`;
|
|
52564
|
-
};
|
|
52565
52684
|
let https$1 = false;
|
|
52566
52685
|
const httpsOptions = listhenOptions.https;
|
|
52567
52686
|
if (httpsOptions) {
|
|
@@ -52570,14 +52689,15 @@ async function listen(handle, _options = {}) {
|
|
|
52570
52689
|
addShutdown(server);
|
|
52571
52690
|
await node_util.promisify(server.listen.bind(server))(port, listhenOptions.hostname);
|
|
52572
52691
|
const _addr = server.address();
|
|
52573
|
-
|
|
52692
|
+
listhenOptions.port = _addr.port;
|
|
52574
52693
|
} else {
|
|
52575
52694
|
server = node_http.createServer(handle);
|
|
52576
52695
|
addShutdown(server);
|
|
52577
52696
|
await node_util.promisify(server.listen.bind(server))(port, listhenOptions.hostname);
|
|
52578
52697
|
const _addr = server.address();
|
|
52579
|
-
|
|
52698
|
+
listhenOptions.port = _addr.port;
|
|
52580
52699
|
}
|
|
52700
|
+
const getURL = (host = listhenOptions.hostname, baseURL) => generateURL(host, listhenOptions, baseURL);
|
|
52581
52701
|
let tunnel;
|
|
52582
52702
|
if (listhenOptions.tunnel) {
|
|
52583
52703
|
const { startTunnel } = await import('./chunks/index.cjs');
|
|
@@ -52604,32 +52724,34 @@ async function listen(handle, _options = {}) {
|
|
|
52604
52724
|
}
|
|
52605
52725
|
const getURLs = async (getURLOptions = {}) => {
|
|
52606
52726
|
const urls = [];
|
|
52607
|
-
const
|
|
52608
|
-
|
|
52609
|
-
|
|
52610
|
-
|
|
52611
|
-
|
|
52612
|
-
|
|
52727
|
+
const _addURL = (type, url) => {
|
|
52728
|
+
if (!urls.some((u) => u.url === url)) {
|
|
52729
|
+
urls.push({
|
|
52730
|
+
url,
|
|
52731
|
+
type
|
|
52732
|
+
});
|
|
52733
|
+
}
|
|
52734
|
+
};
|
|
52735
|
+
const publicURL = getURLOptions.publicURL || getPublicURL(listhenOptions, getURLOptions.baseURL);
|
|
52613
52736
|
if (publicURL) {
|
|
52614
|
-
|
|
52615
|
-
|
|
52616
|
-
|
|
52617
|
-
|
|
52737
|
+
_addURL("network", publicURL);
|
|
52738
|
+
}
|
|
52739
|
+
if (_localhost || _anyhost) {
|
|
52740
|
+
_addURL(
|
|
52741
|
+
"local",
|
|
52742
|
+
getURL(listhenOptions.hostname || "localhost", getURLOptions.baseURL)
|
|
52743
|
+
);
|
|
52618
52744
|
}
|
|
52619
52745
|
if (tunnel) {
|
|
52620
|
-
|
|
52621
|
-
url: await tunnel.getURL(),
|
|
52622
|
-
type: "tunnel"
|
|
52623
|
-
});
|
|
52746
|
+
_addURL("tunnel", await tunnel.getURL());
|
|
52624
52747
|
}
|
|
52625
|
-
|
|
52626
|
-
|
|
52627
|
-
|
|
52628
|
-
|
|
52629
|
-
|
|
52630
|
-
|
|
52631
|
-
|
|
52632
|
-
});
|
|
52748
|
+
if (listhenOptions.public) {
|
|
52749
|
+
const _ipv6Host = listhenOptions.hostname.includes(":");
|
|
52750
|
+
for (const addr of getNetworkInterfaces(_ipv6Host)) {
|
|
52751
|
+
if (addr === publicURL) {
|
|
52752
|
+
continue;
|
|
52753
|
+
}
|
|
52754
|
+
_addURL("network", getURL(addr, getURLOptions.baseURL));
|
|
52633
52755
|
}
|
|
52634
52756
|
}
|
|
52635
52757
|
return urls;
|
|
@@ -52641,10 +52763,18 @@ async function listen(handle, _options = {}) {
|
|
|
52641
52763
|
const firstLocalUrl = urls.find((u) => u.type === "local");
|
|
52642
52764
|
const firstPublicUrl = urls.find((u) => u.type !== "local");
|
|
52643
52765
|
const showQR = (showURLOptions.qr ?? listhenOptions.qr) !== false;
|
|
52766
|
+
if (firstPublicUrl && showQR) {
|
|
52767
|
+
const space = " ".repeat(14);
|
|
52768
|
+
lines.push(" ");
|
|
52769
|
+
lines.push(
|
|
52770
|
+
...renderUnicodeCompact(firstPublicUrl.url).split("\n").map((line) => space + line)
|
|
52771
|
+
);
|
|
52772
|
+
lines.push(" ");
|
|
52773
|
+
}
|
|
52644
52774
|
const typeMap = {
|
|
52645
52775
|
local: ["Local", "green"],
|
|
52646
52776
|
tunnel: ["Tunnel", "yellow"],
|
|
52647
|
-
network: ["Network", "
|
|
52777
|
+
network: ["Network", "magenta"]
|
|
52648
52778
|
};
|
|
52649
52779
|
for (const url of urls) {
|
|
52650
52780
|
const type = typeMap[url.type];
|
|
@@ -52656,7 +52786,7 @@ async function listen(handle, _options = {}) {
|
|
|
52656
52786
|
suffix += colors.gray(" [copied to clipboard]");
|
|
52657
52787
|
}
|
|
52658
52788
|
if (url === firstPublicUrl && showQR) {
|
|
52659
|
-
suffix += colors.gray(" [QR code
|
|
52789
|
+
suffix += colors.gray(" [QR code]");
|
|
52660
52790
|
}
|
|
52661
52791
|
lines.push(`${label} ${formatURL(url.url)}${suffix}`);
|
|
52662
52792
|
}
|
|
@@ -52665,13 +52795,6 @@ async function listen(handle, _options = {}) {
|
|
|
52665
52795
|
colors.gray(` \u279C Network: use ${colors.white("--host")} to expose`)
|
|
52666
52796
|
);
|
|
52667
52797
|
}
|
|
52668
|
-
if (firstPublicUrl && showQR) {
|
|
52669
|
-
const space = " ".repeat(14);
|
|
52670
|
-
lines.push(" ");
|
|
52671
|
-
lines.push(
|
|
52672
|
-
...renderUnicodeCompact(firstPublicUrl.url).split("\n").map((line) => space + line)
|
|
52673
|
-
);
|
|
52674
|
-
}
|
|
52675
52798
|
console.log("\n" + lines.join("\n") + "\n");
|
|
52676
52799
|
};
|
|
52677
52800
|
if (listhenOptions.showURL) {
|
|
@@ -52698,26 +52821,6 @@ async function listen(handle, _options = {}) {
|
|
|
52698
52821
|
};
|
|
52699
52822
|
}
|
|
52700
52823
|
|
|
52701
|
-
const dev = defineCommand({
|
|
52702
|
-
meta: {
|
|
52703
|
-
name: "dev",
|
|
52704
|
-
description: "Start the arri dev server"
|
|
52705
|
-
},
|
|
52706
|
-
args: {
|
|
52707
|
-
config: {
|
|
52708
|
-
type: "string",
|
|
52709
|
-
description: "Path to the arri config file",
|
|
52710
|
-
alias: "c",
|
|
52711
|
-
default: "./arri.config.ts"
|
|
52712
|
-
}
|
|
52713
|
-
},
|
|
52714
|
-
run: async ({ args }) => {
|
|
52715
|
-
const config = await loadConfig({
|
|
52716
|
-
configFile: path$d.resolve(args.config)
|
|
52717
|
-
});
|
|
52718
|
-
await main$1(config.config);
|
|
52719
|
-
}
|
|
52720
|
-
});
|
|
52721
52824
|
const disallowedNameChars = "~`!@#$%^&*()-+=[]{}\\|:;\"'<>,./";
|
|
52722
52825
|
const getRpcMetaFromPath = (config, filePath) => {
|
|
52723
52826
|
if (!config.procedureDir) {
|
|
@@ -52864,7 +52967,7 @@ async function generateApplicationDefinition(config) {
|
|
|
52864
52967
|
});
|
|
52865
52968
|
await fs__default$2.writeFile(
|
|
52866
52969
|
path$d.resolve(`${config.rootDir}`, ".arri/definition.ts"),
|
|
52867
|
-
await
|
|
52970
|
+
await dart.format2(
|
|
52868
52971
|
`${importParts.join("\n")}
|
|
52869
52972
|
|
|
52870
52973
|
export interface ClientDefinition {
|
|
@@ -52936,10 +53039,391 @@ async function setupWorkingDir(config) {
|
|
|
52936
53039
|
}
|
|
52937
53040
|
await fs__default$2.mkdir(arriDir);
|
|
52938
53041
|
}
|
|
53042
|
+
const dev = defineCommand({
|
|
53043
|
+
meta: {
|
|
53044
|
+
name: "dev",
|
|
53045
|
+
description: "Start the arri dev server"
|
|
53046
|
+
},
|
|
53047
|
+
args: {
|
|
53048
|
+
config: {
|
|
53049
|
+
type: "string",
|
|
53050
|
+
description: "Path to the arri config file",
|
|
53051
|
+
alias: "c",
|
|
53052
|
+
default: "./arri.config.ts"
|
|
53053
|
+
}
|
|
53054
|
+
},
|
|
53055
|
+
async run({ args }) {
|
|
53056
|
+
const config = await loadConfig({
|
|
53057
|
+
configFile: path$d.resolve(args.config)
|
|
53058
|
+
});
|
|
53059
|
+
await main$1(config.config);
|
|
53060
|
+
}
|
|
53061
|
+
});
|
|
53062
|
+
|
|
53063
|
+
class FetchError extends Error {
|
|
53064
|
+
constructor(message, opts) {
|
|
53065
|
+
super(message, opts);
|
|
53066
|
+
this.name = "FetchError";
|
|
53067
|
+
if (opts?.cause && !this.cause) {
|
|
53068
|
+
this.cause = opts.cause;
|
|
53069
|
+
}
|
|
53070
|
+
}
|
|
53071
|
+
}
|
|
53072
|
+
function createFetchError(ctx) {
|
|
53073
|
+
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
|
53074
|
+
const method = ctx.request?.method || ctx.options?.method || "GET";
|
|
53075
|
+
const url = ctx.request?.url || String(ctx.request) || "/";
|
|
53076
|
+
const requestStr = `[${method}] ${JSON.stringify(url)}`;
|
|
53077
|
+
const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>";
|
|
53078
|
+
const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`;
|
|
53079
|
+
const fetchError = new FetchError(
|
|
53080
|
+
message,
|
|
53081
|
+
ctx.error ? { cause: ctx.error } : void 0
|
|
53082
|
+
);
|
|
53083
|
+
for (const key of ["request", "options", "response"]) {
|
|
53084
|
+
Object.defineProperty(fetchError, key, {
|
|
53085
|
+
get() {
|
|
53086
|
+
return ctx[key];
|
|
53087
|
+
}
|
|
53088
|
+
});
|
|
53089
|
+
}
|
|
53090
|
+
for (const [key, refKey] of [
|
|
53091
|
+
["data", "_data"],
|
|
53092
|
+
["status", "status"],
|
|
53093
|
+
["statusCode", "status"],
|
|
53094
|
+
["statusText", "statusText"],
|
|
53095
|
+
["statusMessage", "statusText"]
|
|
53096
|
+
]) {
|
|
53097
|
+
Object.defineProperty(fetchError, key, {
|
|
53098
|
+
get() {
|
|
53099
|
+
return ctx.response && ctx.response[refKey];
|
|
53100
|
+
}
|
|
53101
|
+
});
|
|
53102
|
+
}
|
|
53103
|
+
return fetchError;
|
|
53104
|
+
}
|
|
53105
|
+
|
|
53106
|
+
const payloadMethods = new Set(
|
|
53107
|
+
Object.freeze(["PATCH", "POST", "PUT", "DELETE"])
|
|
53108
|
+
);
|
|
53109
|
+
function isPayloadMethod(method = "GET") {
|
|
53110
|
+
return payloadMethods.has(method.toUpperCase());
|
|
53111
|
+
}
|
|
53112
|
+
function isJSONSerializable(value) {
|
|
53113
|
+
if (value === void 0) {
|
|
53114
|
+
return false;
|
|
53115
|
+
}
|
|
53116
|
+
const t = typeof value;
|
|
53117
|
+
if (t === "string" || t === "number" || t === "boolean" || t === null) {
|
|
53118
|
+
return true;
|
|
53119
|
+
}
|
|
53120
|
+
if (t !== "object") {
|
|
53121
|
+
return false;
|
|
53122
|
+
}
|
|
53123
|
+
if (Array.isArray(value)) {
|
|
53124
|
+
return true;
|
|
53125
|
+
}
|
|
53126
|
+
if (value.buffer) {
|
|
53127
|
+
return false;
|
|
53128
|
+
}
|
|
53129
|
+
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
|
53130
|
+
}
|
|
53131
|
+
const textTypes = /* @__PURE__ */ new Set([
|
|
53132
|
+
"image/svg",
|
|
53133
|
+
"application/xml",
|
|
53134
|
+
"application/xhtml",
|
|
53135
|
+
"application/html"
|
|
53136
|
+
]);
|
|
53137
|
+
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
53138
|
+
function detectResponseType(_contentType = "") {
|
|
53139
|
+
if (!_contentType) {
|
|
53140
|
+
return "json";
|
|
53141
|
+
}
|
|
53142
|
+
const contentType = _contentType.split(";").shift() || "";
|
|
53143
|
+
if (JSON_RE.test(contentType)) {
|
|
53144
|
+
return "json";
|
|
53145
|
+
}
|
|
53146
|
+
if (textTypes.has(contentType) || contentType.startsWith("text/")) {
|
|
53147
|
+
return "text";
|
|
53148
|
+
}
|
|
53149
|
+
return "blob";
|
|
53150
|
+
}
|
|
53151
|
+
function mergeFetchOptions(input, defaults, Headers = globalThis.Headers) {
|
|
53152
|
+
const merged = {
|
|
53153
|
+
...defaults,
|
|
53154
|
+
...input
|
|
53155
|
+
};
|
|
53156
|
+
if (defaults?.params && input?.params) {
|
|
53157
|
+
merged.params = {
|
|
53158
|
+
...defaults?.params,
|
|
53159
|
+
...input?.params
|
|
53160
|
+
};
|
|
53161
|
+
}
|
|
53162
|
+
if (defaults?.query && input?.query) {
|
|
53163
|
+
merged.query = {
|
|
53164
|
+
...defaults?.query,
|
|
53165
|
+
...input?.query
|
|
53166
|
+
};
|
|
53167
|
+
}
|
|
53168
|
+
if (defaults?.headers && input?.headers) {
|
|
53169
|
+
merged.headers = new Headers(defaults?.headers || {});
|
|
53170
|
+
for (const [key, value] of new Headers(input?.headers || {})) {
|
|
53171
|
+
merged.headers.set(key, value);
|
|
53172
|
+
}
|
|
53173
|
+
}
|
|
53174
|
+
return merged;
|
|
53175
|
+
}
|
|
53176
|
+
|
|
53177
|
+
const retryStatusCodes = /* @__PURE__ */ new Set([
|
|
53178
|
+
408,
|
|
53179
|
+
// Request Timeout
|
|
53180
|
+
409,
|
|
53181
|
+
// Conflict
|
|
53182
|
+
425,
|
|
53183
|
+
// Too Early
|
|
53184
|
+
429,
|
|
53185
|
+
// Too Many Requests
|
|
53186
|
+
500,
|
|
53187
|
+
// Internal Server Error
|
|
53188
|
+
502,
|
|
53189
|
+
// Bad Gateway
|
|
53190
|
+
503,
|
|
53191
|
+
// Service Unavailable
|
|
53192
|
+
504
|
|
53193
|
+
// Gateway Timeout
|
|
53194
|
+
]);
|
|
53195
|
+
const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
53196
|
+
function createFetch(globalOptions = {}) {
|
|
53197
|
+
const {
|
|
53198
|
+
fetch = globalThis.fetch,
|
|
53199
|
+
Headers = globalThis.Headers,
|
|
53200
|
+
AbortController = globalThis.AbortController
|
|
53201
|
+
} = globalOptions;
|
|
53202
|
+
async function onError(context) {
|
|
53203
|
+
const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
|
|
53204
|
+
if (context.options.retry !== false && !isAbort) {
|
|
53205
|
+
let retries;
|
|
53206
|
+
if (typeof context.options.retry === "number") {
|
|
53207
|
+
retries = context.options.retry;
|
|
53208
|
+
} else {
|
|
53209
|
+
retries = isPayloadMethod(context.options.method) ? 0 : 1;
|
|
53210
|
+
}
|
|
53211
|
+
const responseCode = context.response && context.response.status || 500;
|
|
53212
|
+
if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
|
|
53213
|
+
const retryDelay = context.options.retryDelay || 0;
|
|
53214
|
+
if (retryDelay > 0) {
|
|
53215
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
53216
|
+
}
|
|
53217
|
+
return $fetchRaw(context.request, {
|
|
53218
|
+
...context.options,
|
|
53219
|
+
retry: retries - 1,
|
|
53220
|
+
timeout: context.options.timeout
|
|
53221
|
+
});
|
|
53222
|
+
}
|
|
53223
|
+
}
|
|
53224
|
+
const error = createFetchError(context);
|
|
53225
|
+
if (Error.captureStackTrace) {
|
|
53226
|
+
Error.captureStackTrace(error, $fetchRaw);
|
|
53227
|
+
}
|
|
53228
|
+
throw error;
|
|
53229
|
+
}
|
|
53230
|
+
const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
|
|
53231
|
+
const context = {
|
|
53232
|
+
request: _request,
|
|
53233
|
+
options: mergeFetchOptions(_options, globalOptions.defaults, Headers),
|
|
53234
|
+
response: void 0,
|
|
53235
|
+
error: void 0
|
|
53236
|
+
};
|
|
53237
|
+
context.options.method = context.options.method?.toUpperCase();
|
|
53238
|
+
if (context.options.onRequest) {
|
|
53239
|
+
await context.options.onRequest(context);
|
|
53240
|
+
}
|
|
53241
|
+
if (typeof context.request === "string") {
|
|
53242
|
+
if (context.options.baseURL) {
|
|
53243
|
+
context.request = index.withBase(context.request, context.options.baseURL);
|
|
53244
|
+
}
|
|
53245
|
+
if (context.options.query || context.options.params) {
|
|
53246
|
+
context.request = index.withQuery(context.request, {
|
|
53247
|
+
...context.options.params,
|
|
53248
|
+
...context.options.query
|
|
53249
|
+
});
|
|
53250
|
+
}
|
|
53251
|
+
}
|
|
53252
|
+
if (context.options.body && isPayloadMethod(context.options.method)) {
|
|
53253
|
+
if (isJSONSerializable(context.options.body)) {
|
|
53254
|
+
context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body);
|
|
53255
|
+
context.options.headers = new Headers(context.options.headers || {});
|
|
53256
|
+
if (!context.options.headers.has("content-type")) {
|
|
53257
|
+
context.options.headers.set("content-type", "application/json");
|
|
53258
|
+
}
|
|
53259
|
+
if (!context.options.headers.has("accept")) {
|
|
53260
|
+
context.options.headers.set("accept", "application/json");
|
|
53261
|
+
}
|
|
53262
|
+
} else if (
|
|
53263
|
+
// ReadableStream Body
|
|
53264
|
+
"pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || // Node.js Stream Body
|
|
53265
|
+
typeof context.options.body.pipe === "function"
|
|
53266
|
+
) {
|
|
53267
|
+
if (!("duplex" in context.options)) {
|
|
53268
|
+
context.options.duplex = "half";
|
|
53269
|
+
}
|
|
53270
|
+
}
|
|
53271
|
+
}
|
|
53272
|
+
if (!context.options.signal && context.options.timeout) {
|
|
53273
|
+
const controller = new AbortController();
|
|
53274
|
+
setTimeout(() => controller.abort(), context.options.timeout);
|
|
53275
|
+
context.options.signal = controller.signal;
|
|
53276
|
+
}
|
|
53277
|
+
try {
|
|
53278
|
+
context.response = await fetch(
|
|
53279
|
+
context.request,
|
|
53280
|
+
context.options
|
|
53281
|
+
);
|
|
53282
|
+
} catch (error) {
|
|
53283
|
+
context.error = error;
|
|
53284
|
+
if (context.options.onRequestError) {
|
|
53285
|
+
await context.options.onRequestError(context);
|
|
53286
|
+
}
|
|
53287
|
+
return await onError(context);
|
|
53288
|
+
}
|
|
53289
|
+
const hasBody = context.response.body && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD";
|
|
53290
|
+
if (hasBody) {
|
|
53291
|
+
const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
|
|
53292
|
+
switch (responseType) {
|
|
53293
|
+
case "json": {
|
|
53294
|
+
const data = await context.response.text();
|
|
53295
|
+
const parseFunction = context.options.parseResponse || index.destr;
|
|
53296
|
+
context.response._data = parseFunction(data);
|
|
53297
|
+
break;
|
|
53298
|
+
}
|
|
53299
|
+
case "stream": {
|
|
53300
|
+
context.response._data = context.response.body;
|
|
53301
|
+
break;
|
|
53302
|
+
}
|
|
53303
|
+
default: {
|
|
53304
|
+
context.response._data = await context.response[responseType]();
|
|
53305
|
+
}
|
|
53306
|
+
}
|
|
53307
|
+
}
|
|
53308
|
+
if (context.options.onResponse) {
|
|
53309
|
+
await context.options.onResponse(context);
|
|
53310
|
+
}
|
|
53311
|
+
if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
|
|
53312
|
+
if (context.options.onResponseError) {
|
|
53313
|
+
await context.options.onResponseError(context);
|
|
53314
|
+
}
|
|
53315
|
+
return await onError(context);
|
|
53316
|
+
}
|
|
53317
|
+
return context.response;
|
|
53318
|
+
};
|
|
53319
|
+
const $fetch = async function $fetch2(request, options) {
|
|
53320
|
+
const r = await $fetchRaw(request, options);
|
|
53321
|
+
return r._data;
|
|
53322
|
+
};
|
|
53323
|
+
$fetch.raw = $fetchRaw;
|
|
53324
|
+
$fetch.native = (...args) => fetch(...args);
|
|
53325
|
+
$fetch.create = (defaultOptions = {}) => createFetch({
|
|
53326
|
+
...globalOptions,
|
|
53327
|
+
defaults: {
|
|
53328
|
+
...globalOptions.defaults,
|
|
53329
|
+
...defaultOptions
|
|
53330
|
+
}
|
|
53331
|
+
});
|
|
53332
|
+
return $fetch;
|
|
53333
|
+
}
|
|
53334
|
+
|
|
53335
|
+
const _globalThis = function() {
|
|
53336
|
+
if (typeof globalThis !== "undefined") {
|
|
53337
|
+
return globalThis;
|
|
53338
|
+
}
|
|
53339
|
+
if (typeof self !== "undefined") {
|
|
53340
|
+
return self;
|
|
53341
|
+
}
|
|
53342
|
+
if (typeof window !== "undefined") {
|
|
53343
|
+
return window;
|
|
53344
|
+
}
|
|
53345
|
+
if (typeof global !== "undefined") {
|
|
53346
|
+
return global;
|
|
53347
|
+
}
|
|
53348
|
+
throw new Error("unable to locate global object");
|
|
53349
|
+
}();
|
|
53350
|
+
const fetch = _globalThis.fetch || (() => Promise.reject(new Error("[ofetch] global.fetch is not supported!")));
|
|
53351
|
+
const Headers = _globalThis.Headers;
|
|
53352
|
+
const AbortController = _globalThis.AbortController;
|
|
53353
|
+
const ofetch = createFetch({ fetch, Headers, AbortController });
|
|
53354
|
+
|
|
53355
|
+
const codegenDart = defineCommand({
|
|
53356
|
+
args: {
|
|
53357
|
+
location: {
|
|
53358
|
+
type: "positional",
|
|
53359
|
+
required: true,
|
|
53360
|
+
description: "The path to an Arri definition file or a url that returns an Arri definition file."
|
|
53361
|
+
},
|
|
53362
|
+
clientName: {
|
|
53363
|
+
type: "string",
|
|
53364
|
+
alias: ["name"],
|
|
53365
|
+
required: true
|
|
53366
|
+
},
|
|
53367
|
+
outFile: {
|
|
53368
|
+
type: "string",
|
|
53369
|
+
alias: ["out", "o"],
|
|
53370
|
+
required: true
|
|
53371
|
+
}
|
|
53372
|
+
},
|
|
53373
|
+
async run({ args }) {
|
|
53374
|
+
const isUrl = args.location.startsWith("http://") || args.location.startsWith("https://");
|
|
53375
|
+
let def;
|
|
53376
|
+
if (isUrl) {
|
|
53377
|
+
const result = await ofetch(args.location);
|
|
53378
|
+
def = result;
|
|
53379
|
+
} else {
|
|
53380
|
+
if (!fs$f.existsSync(args.location)) {
|
|
53381
|
+
throw new Error(`Unable to find ${args.location}`);
|
|
53382
|
+
}
|
|
53383
|
+
const jsonString = JSON.parse(
|
|
53384
|
+
fs$f.readFileSync(args.location, { encoding: "utf-8" })
|
|
53385
|
+
);
|
|
53386
|
+
def = jsonString;
|
|
53387
|
+
}
|
|
53388
|
+
if (!def) {
|
|
53389
|
+
throw new Error("Unable to load ApplicationDefinition json file");
|
|
53390
|
+
}
|
|
53391
|
+
await dart.dartClientGenerator({
|
|
53392
|
+
clientName: args.clientName,
|
|
53393
|
+
outputFile: args.outFile
|
|
53394
|
+
}).generator(def);
|
|
53395
|
+
}
|
|
53396
|
+
});
|
|
53397
|
+
const codegenTypescript = defineCommand({
|
|
53398
|
+
args: {
|
|
53399
|
+
location: {
|
|
53400
|
+
type: "positional",
|
|
53401
|
+
required: true,
|
|
53402
|
+
description: "The path to an Arri definition file or a url that returns an Arri definition file."
|
|
53403
|
+
},
|
|
53404
|
+
clientName: {
|
|
53405
|
+
type: "string",
|
|
53406
|
+
alias: ["name"],
|
|
53407
|
+
required: true
|
|
53408
|
+
},
|
|
53409
|
+
outFile: {
|
|
53410
|
+
type: "string",
|
|
53411
|
+
alias: ["out", "o"],
|
|
53412
|
+
required: true
|
|
53413
|
+
}
|
|
53414
|
+
}
|
|
53415
|
+
});
|
|
53416
|
+
const codegen = defineCommand({
|
|
53417
|
+
subCommands: {
|
|
53418
|
+
dart: codegenDart,
|
|
53419
|
+
typescript: codegenTypescript
|
|
53420
|
+
}
|
|
53421
|
+
});
|
|
52939
53422
|
|
|
52940
53423
|
const main = defineCommand({
|
|
52941
53424
|
subCommands: {
|
|
52942
|
-
dev
|
|
53425
|
+
dev,
|
|
53426
|
+
codegen
|
|
52943
53427
|
}
|
|
52944
53428
|
});
|
|
52945
53429
|
void runMain(main);
|