@expo/cli 0.22.13 → 0.22.14
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/build/bin/cli
CHANGED
|
@@ -20,9 +20,30 @@ function _chalk() {
|
|
|
20
20
|
};
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const data = require("node:
|
|
25
|
-
|
|
23
|
+
function _nodeFs() {
|
|
24
|
+
const data = /*#__PURE__*/ _interopRequireWildcard(require("node:fs"));
|
|
25
|
+
_nodeFs = function() {
|
|
26
|
+
return data;
|
|
27
|
+
};
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
function _nodeOs() {
|
|
31
|
+
const data = require("node:os");
|
|
32
|
+
_nodeOs = function() {
|
|
33
|
+
return data;
|
|
34
|
+
};
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
function _nodePath() {
|
|
38
|
+
const data = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
|
|
39
|
+
_nodePath = function() {
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
function _tempDir() {
|
|
45
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("temp-dir"));
|
|
46
|
+
_tempDir = function() {
|
|
26
47
|
return data;
|
|
27
48
|
};
|
|
28
49
|
return data;
|
|
@@ -102,6 +123,22 @@ class AsyncWsTunnel {
|
|
|
102
123
|
this.serverUrl = null;
|
|
103
124
|
}
|
|
104
125
|
}
|
|
126
|
+
// Generate a base-36 string of 5 characters (from 32 bits of randomness)
|
|
127
|
+
function randomStr() {
|
|
128
|
+
return (Math.random().toString(36) + "00000").slice(2, 7);
|
|
129
|
+
}
|
|
130
|
+
function getTunnelSession() {
|
|
131
|
+
let session = randomStr() + randomStr() + randomStr();
|
|
132
|
+
if ((0, _env.envIsWebcontainer)()) {
|
|
133
|
+
const leaseId = Buffer.from((0, _nodeOs().hostname)()).toString("base64url");
|
|
134
|
+
const leaseFile = _nodePath().join(_tempDir().default, `_ws_tunnel_lease_${leaseId}`);
|
|
135
|
+
try {
|
|
136
|
+
session = _nodeFs().readFileSync(leaseFile, "utf8").trim() || session;
|
|
137
|
+
_nodeFs().writeFileSync(leaseFile, session, "utf8");
|
|
138
|
+
} catch {}
|
|
139
|
+
}
|
|
140
|
+
return session;
|
|
141
|
+
}
|
|
105
142
|
function getTunnelOptions() {
|
|
106
143
|
const userDefinedSubdomain = _env.env.EXPO_TUNNEL_SUBDOMAIN;
|
|
107
144
|
if (userDefinedSubdomain && typeof userDefinedSubdomain === "string") {
|
|
@@ -109,16 +146,12 @@ function getTunnelOptions() {
|
|
|
109
146
|
return {
|
|
110
147
|
session: userDefinedSubdomain
|
|
111
148
|
};
|
|
149
|
+
} else {
|
|
150
|
+
const session = getTunnelSession();
|
|
151
|
+
return {
|
|
152
|
+
session
|
|
153
|
+
};
|
|
112
154
|
}
|
|
113
|
-
let session;
|
|
114
|
-
do {
|
|
115
|
-
// TODO(cedric): replace this with non-random data generated from server to manage and prevent overlapping sessions
|
|
116
|
-
session = (0, _nodeCrypto().randomBytes)(12).toString("base64url");
|
|
117
|
-
}while (!/^[A-Za-z0-9]/.test(session));
|
|
118
|
-
debug("Session:", session);
|
|
119
|
-
return {
|
|
120
|
-
session
|
|
121
|
-
};
|
|
122
155
|
}
|
|
123
156
|
|
|
124
157
|
//# sourceMappingURL=AsyncWsTunnel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/AsyncWsTunnel.ts"],"sourcesContent":["import * as tunnel from '@expo/ws-tunnel';\nimport chalk from 'chalk';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/AsyncWsTunnel.ts"],"sourcesContent":["import * as tunnel from '@expo/ws-tunnel';\nimport chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport { hostname } from 'node:os';\nimport * as path from 'node:path';\nimport tempDir from 'temp-dir';\n\nimport * as Log from '../../log';\nimport { env, envIsWebcontainer } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\n\nconst debug = require('debug')('expo:start:server:ws-tunnel') as typeof console.log;\n\nexport class AsyncWsTunnel {\n /** Info about the currently running instance of tunnel. */\n private serverUrl: string | null = null;\n\n constructor(_projectRoot: string, port: number) {\n if (port !== 8081) {\n throw new CommandError(\n 'WS_TUNNEL_PORT',\n `WS-tunnel only supports tunneling over port 8081, attempted to use port ${port}`\n );\n }\n }\n\n public getActiveUrl(): string | null {\n return this.serverUrl;\n }\n\n async startAsync(): Promise<void> {\n this.serverUrl = await tunnel.startAsync({\n ...getTunnelOptions(),\n onStatusChange(status) {\n if (status === 'disconnected') {\n Log.error(\n chalk.red(\n 'Tunnel connection has been closed. This is often related to intermittent connection problems with the ws proxy servers. Restart the dev server to try connecting again.'\n ) + chalk.gray('\\nCheck the Expo status page for outages: https://status.expo.dev/')\n );\n }\n },\n });\n\n debug('Tunnel URL:', this.serverUrl);\n }\n\n async stopAsync(): Promise<void> {\n debug('Stopping Tunnel');\n await tunnel.stopAsync();\n this.serverUrl = null;\n }\n}\n\n// Generate a base-36 string of 5 characters (from 32 bits of randomness)\nfunction randomStr() {\n return (Math.random().toString(36) + '00000').slice(2, 7);\n}\n\nfunction getTunnelSession(): string {\n let session = randomStr() + randomStr() + randomStr();\n if (envIsWebcontainer()) {\n const leaseId = Buffer.from(hostname()).toString('base64url');\n const leaseFile = path.join(tempDir, `_ws_tunnel_lease_${leaseId}`);\n try {\n session = fs.readFileSync(leaseFile, 'utf8').trim() || session;\n fs.writeFileSync(leaseFile, session, 'utf8');\n } catch {}\n }\n return session;\n}\n\nfunction getTunnelOptions() {\n const userDefinedSubdomain = env.EXPO_TUNNEL_SUBDOMAIN;\n if (userDefinedSubdomain && typeof userDefinedSubdomain === 'string') {\n debug('Session:', userDefinedSubdomain);\n return { session: userDefinedSubdomain };\n } else {\n const session = getTunnelSession();\n return { session };\n }\n}\n"],"names":["AsyncWsTunnel","debug","require","serverUrl","constructor","_projectRoot","port","CommandError","getActiveUrl","startAsync","tunnel","getTunnelOptions","onStatusChange","status","Log","error","chalk","red","gray","stopAsync","randomStr","Math","random","toString","slice","getTunnelSession","session","envIsWebcontainer","leaseId","Buffer","from","hostname","leaseFile","path","join","tempDir","fs","readFileSync","trim","writeFileSync","userDefinedSubdomain","env","EXPO_TUNNEL_SUBDOMAIN"],"mappings":"AAAA;;;;+BAaaA,eAAa;;aAAbA,aAAa;;;+DAbF,iBAAiB;;;;;;;8DACvB,OAAO;;;;;;;+DACL,SAAS;;;;;;;yBACJ,SAAS;;;;;;;+DACZ,WAAW;;;;;;;8DACb,UAAU;;;;;;2DAET,WAAW;qBACO,iBAAiB;wBAC3B,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,6BAA6B,CAAC,AAAsB,AAAC;AAE7E,MAAMF,aAAa;IACxB,yDAAyD,GACzD,AAAQG,SAAS,GAAkB,IAAI,CAAC;IAExCC,YAAYC,YAAoB,EAAEC,IAAY,CAAE;QAC9C,IAAIA,IAAI,KAAK,IAAI,EAAE;YACjB,MAAM,IAAIC,OAAY,aAAA,CACpB,gBAAgB,EAChB,CAAC,wEAAwE,EAAED,IAAI,CAAC,CAAC,CAClF,CAAC;QACJ,CAAC;IACH;IAEOE,YAAY,GAAkB;QACnC,OAAO,IAAI,CAACL,SAAS,CAAC;IACxB;UAEMM,UAAU,GAAkB;QAChC,IAAI,CAACN,SAAS,GAAG,MAAMO,SAAM,EAAA,CAACD,UAAU,CAAC;YACvC,GAAGE,gBAAgB,EAAE;YACrBC,cAAc,EAACC,MAAM,EAAE;gBACrB,IAAIA,MAAM,KAAK,cAAc,EAAE;oBAC7BC,IAAG,CAACC,KAAK,CACPC,MAAK,EAAA,QAAA,CAACC,GAAG,CACP,yKAAyK,CAC1K,GAAGD,MAAK,EAAA,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AAgB,GAAG;IAC1B,MAAM6B,oBAAoB,GAAGC,IAAG,IAAA,CAACC,qBAAqB,AAAC;IACvD,IAAIF,oBAAoB,IAAI,OAAOA,oBAAoB,KAAK,QAAQ,EAAE;QACpEvC,KAAK,CAAC,UAAU,EAAEuC,oBAAoB,CAAC,CAAC;QACxC,OAAO;YAAEd,OAAO,EAAEc,oBAAoB;SAAE,CAAC;IAC3C,OAAO;QACL,MAAMd,OAAO,GAAGD,gBAAgB,EAAE,AAAC;QACnC,OAAO;YAAEC,OAAO;SAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -31,7 +31,7 @@ class FetchClient {
|
|
|
31
31
|
this.headers = {
|
|
32
32
|
accept: "application/json",
|
|
33
33
|
"content-type": "application/json",
|
|
34
|
-
"user-agent": `expo-cli/${"0.22.
|
|
34
|
+
"user-agent": `expo-cli/${"0.22.14"}`,
|
|
35
35
|
authorization: "Basic " + _nodeBuffer().Buffer.from(`${target}:`).toString("base64")
|
|
36
36
|
};
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.14",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@0no-co/graphql.web": "^1.0.8",
|
|
43
43
|
"@babel/runtime": "^7.20.0",
|
|
44
44
|
"@expo/code-signing-certificates": "^0.0.5",
|
|
45
|
-
"@expo/config": "~10.0.
|
|
45
|
+
"@expo/config": "~10.0.9",
|
|
46
46
|
"@expo/config-plugins": "~9.0.15",
|
|
47
47
|
"@expo/devcert": "^1.1.2",
|
|
48
48
|
"@expo/env": "~0.4.1",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"tree-kill": "^1.2.2",
|
|
169
169
|
"tsd": "^0.28.1"
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "265195eb66a106580b68aa960afbc6d1b1c7929b"
|
|
172
172
|
}
|