@expo/cli 56.1.13 → 56.1.15
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 +1 -1
- package/build/src/api/graphql/client.js +19 -4
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/mutations/TunnelMutation.js +31 -0
- package/build/src/api/graphql/mutations/TunnelMutation.js.map +1 -0
- package/build/src/customize/templates.js +1 -3
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/events/index.js +1 -1
- package/build/src/export/exportStaticAsync.js +2 -1
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/start/server/AsyncWsTunnel.js +120 -35
- package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +12 -2
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +2 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +11 -2
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/qr.js +2 -3
- package/build/src/utils/qr.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +14 -14
package/build/bin/cli
CHANGED
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
get graphql () {
|
|
19
19
|
return graphql;
|
|
20
20
|
},
|
|
21
|
+
get mutate () {
|
|
22
|
+
return mutate;
|
|
23
|
+
},
|
|
21
24
|
get query () {
|
|
22
25
|
return query;
|
|
23
26
|
}
|
|
@@ -73,7 +76,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
73
76
|
function graphql(query) {
|
|
74
77
|
return query.trim();
|
|
75
78
|
}
|
|
76
|
-
const query = (()=>{
|
|
79
|
+
const { query, mutate } = (()=>{
|
|
77
80
|
const url = (0, _endpoint.getExpoApiBaseUrl)() + '/graphql';
|
|
78
81
|
let _fetch1;
|
|
79
82
|
const wrappedFetch = (...args)=>{
|
|
@@ -110,7 +113,8 @@ const query = (()=>{
|
|
|
110
113
|
function resetCache() {
|
|
111
114
|
cache = {};
|
|
112
115
|
}
|
|
113
|
-
|
|
116
|
+
async function request(query, variables, options, // Mutations must never be served from (or written to) the in-memory cache.
|
|
117
|
+
useCache) {
|
|
114
118
|
let isTransient = false;
|
|
115
119
|
let response;
|
|
116
120
|
let data;
|
|
@@ -123,11 +127,12 @@ const query = (()=>{
|
|
|
123
127
|
const headersKey = stringifySorted(headers);
|
|
124
128
|
if (!cacheKey || cacheKey !== headersKey) {
|
|
125
129
|
resetCache();
|
|
130
|
+
cacheKey = headersKey;
|
|
126
131
|
}
|
|
127
132
|
// Retrieve a cached result, if we have any via a `query => variables => Result` cache key
|
|
128
133
|
const variablesKey = stringifySorted(variables);
|
|
129
134
|
const queryCache = cache[query] || (cache[query] = new Map());
|
|
130
|
-
if (queryCache.has(variablesKey)) {
|
|
135
|
+
if (useCache && queryCache.has(variablesKey)) {
|
|
131
136
|
data = queryCache.get(variablesKey);
|
|
132
137
|
}
|
|
133
138
|
// Retry the query if it fails due to an unknown or transient error
|
|
@@ -179,7 +184,9 @@ const query = (()=>{
|
|
|
179
184
|
}
|
|
180
185
|
// Store the data in the cache, and only return a result if we have any values
|
|
181
186
|
if (data) {
|
|
182
|
-
|
|
187
|
+
if (useCache) {
|
|
188
|
+
queryCache.set(variablesKey, data);
|
|
189
|
+
}
|
|
183
190
|
const keys = Object.keys(data);
|
|
184
191
|
if (keys.length > 0 && keys.some((key)=>data[key] != null)) {
|
|
185
192
|
return data;
|
|
@@ -198,6 +205,14 @@ const query = (()=>{
|
|
|
198
205
|
} else {
|
|
199
206
|
throw new _client.UnexpectedServerData('Unexpected server error: No returned query result');
|
|
200
207
|
}
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
/** Run a GraphQL query, served from the in-memory cache when possible. */ query (document, variables, options) {
|
|
211
|
+
return request(document, variables, options, /* useCache */ true);
|
|
212
|
+
},
|
|
213
|
+
/** Run a GraphQL mutation, always hitting the network and never touching the cache. */ mutate (document, variables, options) {
|
|
214
|
+
return request(document, variables, options, /* useCache */ false);
|
|
215
|
+
}
|
|
201
216
|
};
|
|
202
217
|
})();
|
|
203
218
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api/graphql/client.ts"],"sourcesContent":["import * as Log from '../../log';\nimport { fetch, type Response } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport {\n getResponseDataOrThrow,\n UnexpectedServerData,\n UnexpectedServerError,\n} from '../rest/client';\nimport type { FetchLike } from '../rest/client.types';\nimport { wrapFetchWithOffline } from '../rest/wrapFetchWithOffline';\nimport { wrapFetchWithUserAgent } from '../rest/wrapFetchWithUserAgent';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\ntype JSONObject = Record<string, unknown>;\ntype EmptyVariables = Record<string, never>;\n\nexport type StaticDocumentNode<Result extends JSONObject, Variables extends JSONObject> = string & {\n readonly __graphql: (vars: Variables) => Result;\n};\n\nexport function graphql<Result extends JSONObject, Variables extends JSONObject = EmptyVariables>(\n query: string\n): StaticDocumentNode<Result, Variables> {\n return query.trim() as StaticDocumentNode<Result, Variables>;\n}\n\nexport { UnexpectedServerError, UnexpectedServerData };\n\nexport interface QueryOptions {\n headers?: Record<string, string>;\n}\n\nexport const query = (() => {\n const url = getExpoApiBaseUrl() + '/graphql';\n\n let _fetch: FetchLike | undefined;\n const wrappedFetch: FetchLike = (...args) => {\n if (!_fetch) {\n _fetch = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n }\n return _fetch(...args);\n };\n\n const randomDelay = (attemptCount: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, Math.min(500 + Math.random() * 1000 * attemptCount, 4_000));\n });\n\n const getFetchHeaders = (): Record<string, string> => {\n const token = getAccessToken();\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n accept: 'application/graphql-response+json, application/graphql+json, application/json',\n };\n let sessionSecret: string | undefined;\n if (token) {\n headers.authorization = `Bearer ${token}`;\n } else if ((sessionSecret = getSession()?.sessionSecret)) {\n headers['expo-session'] = sessionSecret;\n }\n return headers;\n };\n\n // NOTE(@kitten): This only sorted keys one level deep since this is sufficient for most cases\n const stringifySorted = (variables: JSONObject): string =>\n JSON.stringify(\n Object.keys(variables)\n .sort()\n .reduce((acc, key) => {\n acc[key] = variables[key];\n return acc;\n }, {} as JSONObject)\n );\n\n let cache: Record<string, Map<string, unknown>> = {};\n let cacheKey: string | undefined;\n\n function resetCache() {\n cache = {};\n }\n\n return async function query<Result extends JSONObject, Variables extends JSONObject>(\n query: StaticDocumentNode<Result, Variables>,\n variables: Variables,\n options?: QueryOptions\n ): Promise<Result> {\n let isTransient = false;\n let response: Response | undefined;\n let data: Result | null | undefined;\n let error: unknown;\n\n // Pre-instantiate headers and reset the cache if they've changed\n const headers = { ...getFetchHeaders(), ...options?.headers };\n const headersKey = stringifySorted(headers);\n if (!cacheKey || cacheKey !== headersKey) {\n resetCache();\n }\n\n // Retrieve a cached result, if we have any via a `query => variables => Result` cache key\n const variablesKey = stringifySorted(variables);\n const queryCache = cache[query] || (cache[query] = new Map());\n if (queryCache.has(variablesKey)) {\n data = queryCache.get(variablesKey) as Result;\n }\n\n // Retry the query if it fails due to an unknown or transient error\n for (let attemptCount = 0; attemptCount < 3 && !data; attemptCount++) {\n // Add a random delay on each subsequent attempt\n if (attemptCount > 0) {\n await randomDelay(attemptCount);\n }\n\n try {\n response = await wrappedFetch(url, {\n ...options,\n method: 'POST',\n body: JSON.stringify({ query, variables }),\n headers,\n });\n } catch (networkError) {\n error = networkError || error;\n continue;\n }\n\n const json = await response.json();\n if (typeof json === 'object' && json) {\n // If we have a transient error, we retry immediately and discard the data\n // Otherwise, we store the first available error and get the data\n if ('errors' in json && Array.isArray(json.errors)) {\n isTransient = json.errors.some((e: any) => e?.extensions?.isTransient);\n if (isTransient) {\n data = undefined;\n continue;\n } else {\n error = json.errors[0] || error;\n }\n }\n\n try {\n data = getResponseDataOrThrow<Result | null>(json);\n } catch (dataError) {\n // We only use the data error, if we don't have an error already\n if (!error) {\n error = dataError || error;\n }\n continue;\n }\n }\n }\n\n // Store the data in the cache, and only return a result if we have any values\n if (data) {\n queryCache.set(variablesKey, data);\n const keys = Object.keys(data);\n if (keys.length > 0 && keys.some((key) => data[key as keyof typeof data] != null)) {\n return data;\n }\n }\n\n // If we have an error, rethrow it wrapped in our custom errors\n if (error) {\n if (isTransient) {\n Log.error(`We've encountered a transient error, please try again shortly.`);\n }\n const wrappedError = new UnexpectedServerError('' + (error as any).message);\n wrappedError.cause = error;\n throw wrappedError;\n } else if (response && !response.ok) {\n throw new UnexpectedServerError(`Unexpected server error: ${response.statusText}`);\n } else {\n throw new UnexpectedServerData('Unexpected server error: No returned query result');\n }\n };\n})();\n"],"names":["UnexpectedServerData","UnexpectedServerError","graphql","query","trim","url","getExpoApiBaseUrl","_fetch","wrappedFetch","args","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","randomDelay","attemptCount","Promise","resolve","setTimeout","Math","min","random","getFetchHeaders","getSession","token","getAccessToken","headers","accept","sessionSecret","authorization","stringifySorted","variables","JSON","stringify","Object","keys","sort","reduce","acc","key","cache","cacheKey","resetCache","options","isTransient","response","data","error","headersKey","variablesKey","queryCache","Map","has","get","method","body","networkError","json","Array","isArray","errors","some","e","extensions","undefined","getResponseDataOrThrow","dataError","set","length","Log","wrappedError","message","cause","ok","statusText"],"mappings":";;;;;;;;;;;QA0BgCA;eAAAA,4BAAoB;;QAA3CC;eAAAA,6BAAqB;;QANdC;eAAAA;;QAYHC;eAAAA;;;6DAhCQ;uBACgB;0BACH;wBAK3B;sCAE8B;wCACE;8BACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASpC,S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B,gEAAgE;oBAChE,IAAI,CAACnB,OAAO;wBACVA,QAAQmB,aAAanB;oBACvB;oBACA;gBACF;YACF;QACF;QAEA,8EAA8E;QAC9E,IAAID,MAAM;YACRI,WAAWiB,GAAG,CAAClB,cAAcH;YAC7B,MAAMX,OAAOD,OAAOC,IAAI,CAACW;YACzB,IAAIX,KAAKiC,MAAM,GAAG,KAAKjC,KAAK0B,IAAI,CAAC,CAACtB,MAAQO,IAAI,CAACP,IAAyB,IAAI,OAAO;gBACjF,OAAOO;YACT;QACF;QAEA,+DAA+D;QAC/D,IAAIC,OAAO;YACT,IAAIH,aAAa;gBACfyB,KAAItB,KAAK,CAAC,CAAC,8DAA8D,CAAC;YAC5E;YACA,MAAMuB,eAAe,IAAIpE,6BAAqB,CAAC,KAAK,AAAC6C,MAAcwB,OAAO;YAC1ED,aAAaE,KAAK,GAAGzB;YACrB,MAAMuB;QACR,OAAO,IAAIzB,YAAY,CAACA,SAAS4B,EAAE,EAAE;YACnC,MAAM,IAAIvE,6BAAqB,CAAC,CAAC,yBAAyB,EAAE2C,SAAS6B,UAAU,EAAE;QACnF,OAAO;YACL,MAAM,IAAIzE,4BAAoB,CAAC;QACjC;IACF;AACF,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/graphql/client.ts"],"sourcesContent":["import * as Log from '../../log';\nimport { fetch, type Response } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport {\n getResponseDataOrThrow,\n UnexpectedServerData,\n UnexpectedServerError,\n} from '../rest/client';\nimport type { FetchLike } from '../rest/client.types';\nimport { wrapFetchWithOffline } from '../rest/wrapFetchWithOffline';\nimport { wrapFetchWithUserAgent } from '../rest/wrapFetchWithUserAgent';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\ntype JSONObject = Record<string, unknown>;\ntype EmptyVariables = Record<string, never>;\n\nexport type StaticDocumentNode<Result extends JSONObject, Variables extends JSONObject> = string & {\n readonly __graphql: (vars: Variables) => Result;\n};\n\nexport function graphql<Result extends JSONObject, Variables extends JSONObject = EmptyVariables>(\n query: string\n): StaticDocumentNode<Result, Variables> {\n return query.trim() as StaticDocumentNode<Result, Variables>;\n}\n\nexport { UnexpectedServerError, UnexpectedServerData };\n\nexport interface QueryOptions {\n headers?: Record<string, string>;\n}\n\nexport const { query, mutate } = (() => {\n const url = getExpoApiBaseUrl() + '/graphql';\n\n let _fetch: FetchLike | undefined;\n const wrappedFetch: FetchLike = (...args) => {\n if (!_fetch) {\n _fetch = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n }\n return _fetch(...args);\n };\n\n const randomDelay = (attemptCount: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, Math.min(500 + Math.random() * 1000 * attemptCount, 4_000));\n });\n\n const getFetchHeaders = (): Record<string, string> => {\n const token = getAccessToken();\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n accept: 'application/graphql-response+json, application/graphql+json, application/json',\n };\n let sessionSecret: string | undefined;\n if (token) {\n headers.authorization = `Bearer ${token}`;\n } else if ((sessionSecret = getSession()?.sessionSecret)) {\n headers['expo-session'] = sessionSecret;\n }\n return headers;\n };\n\n // NOTE(@kitten): This only sorted keys one level deep since this is sufficient for most cases\n const stringifySorted = (variables: JSONObject): string =>\n JSON.stringify(\n Object.keys(variables)\n .sort()\n .reduce((acc, key) => {\n acc[key] = variables[key];\n return acc;\n }, {} as JSONObject)\n );\n\n let cache: Record<string, Map<string, unknown>> = {};\n let cacheKey: string | undefined;\n\n function resetCache() {\n cache = {};\n }\n\n async function request<Result extends JSONObject, Variables extends JSONObject>(\n query: StaticDocumentNode<Result, Variables>,\n variables: Variables,\n options: QueryOptions | undefined,\n // Mutations must never be served from (or written to) the in-memory cache.\n useCache: boolean\n ): Promise<Result> {\n let isTransient = false;\n let response: Response | undefined;\n let data: Result | null | undefined;\n let error: unknown;\n\n // Pre-instantiate headers and reset the cache if they've changed\n const headers = { ...getFetchHeaders(), ...options?.headers };\n const headersKey = stringifySorted(headers);\n if (!cacheKey || cacheKey !== headersKey) {\n resetCache();\n cacheKey = headersKey;\n }\n\n // Retrieve a cached result, if we have any via a `query => variables => Result` cache key\n const variablesKey = stringifySorted(variables);\n const queryCache = cache[query] || (cache[query] = new Map());\n if (useCache && queryCache.has(variablesKey)) {\n data = queryCache.get(variablesKey) as Result;\n }\n\n // Retry the query if it fails due to an unknown or transient error\n for (let attemptCount = 0; attemptCount < 3 && !data; attemptCount++) {\n // Add a random delay on each subsequent attempt\n if (attemptCount > 0) {\n await randomDelay(attemptCount);\n }\n\n try {\n response = await wrappedFetch(url, {\n ...options,\n method: 'POST',\n body: JSON.stringify({ query, variables }),\n headers,\n });\n } catch (networkError) {\n error = networkError || error;\n continue;\n }\n\n const json = await response.json();\n if (typeof json === 'object' && json) {\n // If we have a transient error, we retry immediately and discard the data\n // Otherwise, we store the first available error and get the data\n if ('errors' in json && Array.isArray(json.errors)) {\n isTransient = json.errors.some((e: any) => e?.extensions?.isTransient);\n if (isTransient) {\n data = undefined;\n continue;\n } else {\n error = json.errors[0] || error;\n }\n }\n\n try {\n data = getResponseDataOrThrow<Result | null>(json);\n } catch (dataError) {\n // We only use the data error, if we don't have an error already\n if (!error) {\n error = dataError || error;\n }\n continue;\n }\n }\n }\n\n // Store the data in the cache, and only return a result if we have any values\n if (data) {\n if (useCache) {\n queryCache.set(variablesKey, data);\n }\n const keys = Object.keys(data);\n if (keys.length > 0 && keys.some((key) => data[key as keyof typeof data] != null)) {\n return data;\n }\n }\n\n // If we have an error, rethrow it wrapped in our custom errors\n if (error) {\n if (isTransient) {\n Log.error(`We've encountered a transient error, please try again shortly.`);\n }\n const wrappedError = new UnexpectedServerError('' + (error as any).message);\n wrappedError.cause = error;\n throw wrappedError;\n } else if (response && !response.ok) {\n throw new UnexpectedServerError(`Unexpected server error: ${response.statusText}`);\n } else {\n throw new UnexpectedServerData('Unexpected server error: No returned query result');\n }\n }\n\n return {\n /** Run a GraphQL query, served from the in-memory cache when possible. */\n query<Result extends JSONObject, Variables extends JSONObject>(\n document: StaticDocumentNode<Result, Variables>,\n variables: Variables,\n options?: QueryOptions\n ): Promise<Result> {\n return request(document, variables, options, /* useCache */ true);\n },\n /** Run a GraphQL mutation, always hitting the network and never touching the cache. */\n mutate<Result extends JSONObject, Variables extends JSONObject>(\n document: StaticDocumentNode<Result, Variables>,\n variables: Variables,\n options?: QueryOptions\n ): Promise<Result> {\n return request(document, variables, options, /* useCache */ false);\n },\n };\n})();\n"],"names":["UnexpectedServerData","UnexpectedServerError","graphql","mutate","query","trim","url","getExpoApiBaseUrl","_fetch","wrappedFetch","args","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","randomDelay","attemptCount","Promise","resolve","setTimeout","Math","min","random","getFetchHeaders","getSession","token","getAccessToken","headers","accept","sessionSecret","authorization","stringifySorted","variables","JSON","stringify","Object","keys","sort","reduce","acc","key","cache","cacheKey","resetCache","request","options","useCache","isTransient","response","data","error","headersKey","variablesKey","queryCache","Map","has","get","method","body","networkError","json","Array","isArray","errors","some","e","extensions","undefined","getResponseDataOrThrow","dataError","set","length","Log","wrappedError","message","cause","ok","statusText","document"],"mappings":";;;;;;;;;;;QA0BgCA;eAAAA,4BAAoB;;QAA3CC;eAAAA,6BAAqB;;QANdC;eAAAA;;QAYMC;eAAAA;;QAAPC;eAAAA;;;6DAhCM;uBACgB;0BACH;wBAK3B;sCAE8B;wCACE;8BACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASpC,SAASF,QACdE,KAAa;IAEb,OAAOA,MAAMC,IAAI;AACnB;AAQO,MAAM,EAAED,KAAK,EAAED,MAAM,EAAE,GAAG,AAAC,CAAA;IAChC,MAAMG,MAAMC,IAAAA,2BAAiB,MAAK;IAElC,IAAIC;IACJ,MAAMC,eAA0B,CAAC,GAAGC;QAClC,IAAI,CAACF,SAAQ;YACXA,UAASG,IAAAA,0CAAoB,EAACC,IAAAA,8CAAsB,EAACC,YAAK;QAC5D;QACA,OAAOL,WAAUE;I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AAKmC,MAAM,GAAG,KAAKnC,KAAK4B,IAAI,CAAC,CAACxB,MAAQS,IAAI,CAACT,IAAyB,IAAI,OAAO;gBACjF,OAAOS;YACT;QACF;QAEA,+DAA+D;QAC/D,IAAIC,OAAO;YACT,IAAIH,aAAa;gBACfyB,KAAItB,KAAK,CAAC,CAAC,8DAA8D,CAAC;YAC5E;YACA,MAAMuB,eAAe,IAAIvE,6BAAqB,CAAC,KAAK,AAACgD,MAAcwB,OAAO;YAC1ED,aAAaE,KAAK,GAAGzB;YACrB,MAAMuB;QACR,OAAO,IAAIzB,YAAY,CAACA,SAAS4B,EAAE,EAAE;YACnC,MAAM,IAAI1E,6BAAqB,CAAC,CAAC,yBAAyB,EAAE8C,SAAS6B,UAAU,EAAE;QACnF,OAAO;YACL,MAAM,IAAI5E,4BAAoB,CAAC;QACjC;IACF;IAEA,OAAO;QACL,wEAAwE,GACxEI,OACEyE,QAA+C,EAC/C9C,SAAoB,EACpBa,OAAsB;YAEtB,OAAOD,QAAQkC,UAAU9C,WAAWa,SAAS,YAAY,GAAG;QAC9D;QACA,qFAAqF,GACrFzC,QACE0E,QAA+C,EAC/C9C,SAAoB,EACpBa,OAAsB;YAEtB,OAAOD,QAAQkC,UAAU9C,WAAWa,SAAS,YAAY,GAAG;QAC9D;IACF;AACF,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "TunnelMutation", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return TunnelMutation;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _client = require("../client");
|
|
12
|
+
const CreateSignedTunnelUrlDocument = (0, _client.graphql)(`
|
|
13
|
+
mutation CreateSignedTunnelUrl($accountId: ID!) {
|
|
14
|
+
tunnels {
|
|
15
|
+
createSignedTunnelUrl(accountId: $accountId) {
|
|
16
|
+
label
|
|
17
|
+
url
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`);
|
|
22
|
+
const TunnelMutation = {
|
|
23
|
+
async createSignedTunnelUrlAsync (accountId) {
|
|
24
|
+
const data = await (0, _client.mutate)(CreateSignedTunnelUrlDocument, {
|
|
25
|
+
accountId
|
|
26
|
+
});
|
|
27
|
+
return data.tunnels.createSignedTunnelUrl;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=TunnelMutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/api/graphql/mutations/TunnelMutation.ts"],"sourcesContent":["import { graphql, mutate } from '../client';\n\nexport type SignedTunnelUrl = {\n /** The unique tunnel label, used as the hostname segment of the tunnel URL. */\n label: string;\n /** The signed tunnel URL `@expo/ws-tunnel` connects to. */\n url: string;\n};\n\ntype CreateSignedTunnelUrlData = {\n tunnels: {\n createSignedTunnelUrl: SignedTunnelUrl;\n };\n};\n\ntype CreateSignedTunnelUrlVariables = {\n accountId: string;\n};\n\nconst CreateSignedTunnelUrlDocument = graphql<\n CreateSignedTunnelUrlData,\n CreateSignedTunnelUrlVariables\n>(`\n mutation CreateSignedTunnelUrl($accountId: ID!) {\n tunnels {\n createSignedTunnelUrl(accountId: $accountId) {\n label\n url\n }\n }\n }\n`);\n\nexport const TunnelMutation = {\n async createSignedTunnelUrlAsync(accountId: string): Promise<SignedTunnelUrl> {\n const data = await mutate(CreateSignedTunnelUrlDocument, { accountId });\n return data.tunnels.createSignedTunnelUrl;\n },\n};\n"],"names":["TunnelMutation","CreateSignedTunnelUrlDocument","graphql","createSignedTunnelUrlAsync","accountId","data","mutate","tunnels","createSignedTunnelUrl"],"mappings":";;;;+BAiCaA;;;eAAAA;;;wBAjCmB;AAmBhC,MAAMC,gCAAgCC,IAAAA,eAAO,EAG3C,CAAC;;;;;;;;;AASH,CAAC;AAEM,MAAMF,iBAAiB;IAC5B,MAAMG,4BAA2BC,SAAiB;QAChD,MAAMC,OAAO,MAAMC,IAAAA,cAAM,EAACL,+BAA+B;YAAEG;QAAU;QACrE,OAAOC,KAAKE,OAAO,CAACC,qBAAqB;IAC3C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/customize/templates.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport type { ExpoChoice } from '../utils/prompts';\nimport prompt from '../utils/prompts';\n\nconst debug = require('debug')('expo:customize:templates');\n\nexport type DestinationResolutionProps = {\n /** Web 'public' folder path (defaults to `/web`). This technically can be changed but shouldn't be. */\n webStaticPath: string;\n /** The Expo Router app directory. */\n appDirPath: string;\n};\n\nfunction importFromExpoWebpackConfig(projectRoot: string, folder: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);\n debug(`Using @expo/webpack-config template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n debug(`@expo/webpack-config template for \"${moduleId}\" not found, falling back on @expo/cli`);\n }\n return importFromVendor(projectRoot, moduleId);\n}\n\nfunction importFromVendor(projectRoot: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, '@expo/cli/static/template/' + moduleId);\n debug(`Using @expo/cli template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n // For dev mode, testing and other cases where @expo/cli is not installed\n const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);\n debug(\n `Local @expo/cli template for \"${moduleId}\" not found, falling back on template relative to @expo/cli: ${filePath}`\n );\n\n return filePath;\n }\n}\n\nexport const TEMPLATES: {\n /** Unique ID for easily indexing. */\n id: string;\n /** Template file path to copy into the project. */\n file: (projectRoot: string) => string;\n /** Output location for the file in the user project. */\n destination: (props: DestinationResolutionProps) => string;\n /** List of dependencies to install in the project. These are used inside of the template file. */\n dependencies: string[];\n\n /** Custom step for configuring the file. Return true to exit early. */\n configureAsync?: (projectRoot: string) => Promise<boolean>;\n}[] = [\n {\n id: 'babel.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'babel.config.js'),\n destination: () => 'babel.config.js',\n dependencies: [\n // Even though this is installed in `expo`, we should add it for now.\n 'babel-preset-expo',\n ],\n },\n {\n id: 'metro.config.js',\n dependencies: [
|
|
1
|
+
{"version":3,"sources":["../../../src/customize/templates.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport type { ExpoChoice } from '../utils/prompts';\nimport prompt from '../utils/prompts';\n\nconst debug = require('debug')('expo:customize:templates');\n\nexport type DestinationResolutionProps = {\n /** Web 'public' folder path (defaults to `/web`). This technically can be changed but shouldn't be. */\n webStaticPath: string;\n /** The Expo Router app directory. */\n appDirPath: string;\n};\n\nfunction importFromExpoWebpackConfig(projectRoot: string, folder: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);\n debug(`Using @expo/webpack-config template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n debug(`@expo/webpack-config template for \"${moduleId}\" not found, falling back on @expo/cli`);\n }\n return importFromVendor(projectRoot, moduleId);\n}\n\nfunction importFromVendor(projectRoot: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, '@expo/cli/static/template/' + moduleId);\n debug(`Using @expo/cli template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n // For dev mode, testing and other cases where @expo/cli is not installed\n const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);\n debug(\n `Local @expo/cli template for \"${moduleId}\" not found, falling back on template relative to @expo/cli: ${filePath}`\n );\n\n return filePath;\n }\n}\n\nexport const TEMPLATES: {\n /** Unique ID for easily indexing. */\n id: string;\n /** Template file path to copy into the project. */\n file: (projectRoot: string) => string;\n /** Output location for the file in the user project. */\n destination: (props: DestinationResolutionProps) => string;\n /** List of dependencies to install in the project. These are used inside of the template file. */\n dependencies: string[];\n\n /** Custom step for configuring the file. Return true to exit early. */\n configureAsync?: (projectRoot: string) => Promise<boolean>;\n}[] = [\n {\n id: 'babel.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'babel.config.js'),\n destination: () => 'babel.config.js',\n dependencies: [\n // Even though this is installed in `expo`, we should add it for now.\n 'babel-preset-expo',\n ],\n },\n {\n id: 'metro.config.js',\n dependencies: [],\n destination: () => 'metro.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'metro.config.js'),\n },\n {\n // `tsconfig.json` is special-cased and doesn't follow the template.\n id: 'tsconfig.json',\n dependencies: [],\n destination: () => 'tsconfig.json',\n file: () => '',\n configureAsync: async (projectRoot) => {\n const { typescript } = require('./typescript') as typeof import('./typescript');\n await typescript(projectRoot);\n return true;\n },\n },\n {\n id: '.eslintrc.js',\n dependencies: [],\n destination: () => '.eslintrc.js (deprecated)',\n file: (projectRoot) => importFromVendor(projectRoot, '.eslintrc.js'),\n configureAsync: async (projectRoot) => {\n const { ESLintProjectPrerequisite } =\n require('../lint/ESlintPrerequisite') as typeof import('../lint/ESlintPrerequisite.js');\n const prerequisite = new ESLintProjectPrerequisite(projectRoot);\n if (!(await prerequisite.assertAsync())) {\n await prerequisite.bootstrapAsync();\n }\n return false;\n },\n },\n {\n id: 'eslint.config.js',\n dependencies: [],\n destination: () => 'eslint.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'eslint.config.js'),\n configureAsync: async (projectRoot) => {\n const { ESLintProjectPrerequisite } =\n require('../lint/ESlintPrerequisite') as typeof import('../lint/ESlintPrerequisite.js');\n const prerequisite = new ESLintProjectPrerequisite(projectRoot);\n if (!(await prerequisite.assertAsync())) {\n await prerequisite.bootstrapAsync();\n }\n return false;\n },\n },\n {\n id: 'index.html',\n file: (projectRoot) => importFromExpoWebpackConfig(projectRoot, 'web-default', 'index.html'),\n // web/index.html\n destination: ({ webStaticPath }) => webStaticPath + '/index.html',\n dependencies: [],\n },\n {\n id: 'webpack.config.js',\n file: (projectRoot) =>\n importFromExpoWebpackConfig(projectRoot, 'template', 'webpack.config.js'),\n destination: () => 'webpack.config.js',\n dependencies: ['@expo/webpack-config'],\n },\n {\n id: '+html.tsx',\n file: (projectRoot) => importFromVendor(projectRoot, '+html.tsx'),\n destination: ({ appDirPath }) => path.join(appDirPath, '+html.tsx'),\n dependencies: [],\n },\n {\n id: '+native-intent.ts',\n file: (projectRoot) => importFromVendor(projectRoot, '+native-intent.ts'),\n destination: ({ appDirPath }) => path.join(appDirPath, '+native-intent.ts'),\n dependencies: [],\n },\n];\n\n/** Generate the prompt choices. */\nfunction createChoices(\n projectRoot: string,\n props: DestinationResolutionProps\n): ExpoChoice<number>[] {\n return TEMPLATES.map((template, index) => {\n const destination = template.destination(props);\n const localProjectFile = path.resolve(projectRoot, destination);\n const exists = fs.existsSync(localProjectFile);\n\n return {\n title: destination,\n value: index,\n description: exists ? chalk.red('This will overwrite the existing file') : undefined,\n };\n });\n}\n\n/** Prompt to select templates to add. */\nexport async function selectTemplatesAsync(projectRoot: string, props: DestinationResolutionProps) {\n const options = createChoices(projectRoot, props);\n\n const { answer } = await prompt({\n type: 'multiselect',\n name: 'answer',\n message: 'Which files would you like to generate?',\n hint: '- Space to select. Return to submit',\n warn: 'File already exists.',\n limit: options.length,\n instructions: '',\n choices: options,\n });\n return answer;\n}\n"],"names":["TEMPLATES","selectTemplatesAsync","debug","require","importFromExpoWebpackConfig","projectRoot","folder","moduleId","filePath","resolveFrom","importFromVendor","resolve","id","file","destination","dependencies","configureAsync","typescript","ESLintProjectPrerequisite","prerequisite","assertAsync","bootstrapAsync","webStaticPath","appDirPath","path","join","createChoices","props","map","template","index","localProjectFile","exists","fs","existsSync","title","value","description","chalk","red","undefined","options","answer","prompt","type","name","message","hint","warn","limit","length","instructions","choices"],"mappings":";;;;;;;;;;;QA4CaA;eAAAA;;QAqHSC;eAAAA;;;;gEAjKJ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D;AAED,iCAAiC,GACjC,SAASW,cACPrB,WAAmB,EACnBsB,KAAiC;IAEjC,OAAO3B,UAAU4B,GAAG,CAAC,CAACC,UAAUC;QAC9B,MAAMhB,cAAce,SAASf,WAAW,CAACa;QACzC,MAAMI,mBAAmBP,eAAI,CAACb,OAAO,CAACN,aAAaS;QACnD,MAAMkB,SAASC,aAAE,CAACC,UAAU,CAACH;QAE7B,OAAO;YACLI,OAAOrB;YACPsB,OAAON;YACPO,aAAaL,SAASM,gBAAK,CAACC,GAAG,CAAC,2CAA2CC;QAC7E;IACF;AACF;AAGO,eAAevC,qBAAqBI,WAAmB,EAAEsB,KAAiC;IAC/F,MAAMc,UAAUf,cAAcrB,aAAasB;IAE3C,MAAM,EAAEe,MAAM,EAAE,GAAG,MAAMC,IAAAA,gBAAM,EAAC;QAC9BC,MAAM;QACNC,MAAM;QACNC,SAAS;QACTC,MAAM;QACNC,MAAM;QACNC,OAAOR,QAAQS,MAAM;QACrBC,cAAc;QACdC,SAASX;IACX;IACA,OAAOC;AACT"}
|
|
@@ -76,7 +76,7 @@ function getInitMetadata() {
|
|
|
76
76
|
return {
|
|
77
77
|
format: 'v0-jsonl',
|
|
78
78
|
// Version is added in the build script.
|
|
79
|
-
version: "56.1.
|
|
79
|
+
version: "56.1.15" ?? 'UNVERSIONED'
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function getWellKnownTemporaryLogFile(projectRoot, command) {
|
|
@@ -353,7 +353,8 @@ async function exportFromServerAsync(projectRoot, devServer, { outputDir, baseUr
|
|
|
353
353
|
callback: (manifest)=>{
|
|
354
354
|
manifest.assets = {
|
|
355
355
|
css: cssAssets,
|
|
356
|
-
js: syncJsAssets
|
|
356
|
+
js: syncJsAssets,
|
|
357
|
+
favicon: injectFaviconTag ? `${baseUrl}/favicon.ico` : undefined
|
|
357
358
|
};
|
|
358
359
|
manifest.rendering = {
|
|
359
360
|
mode: 'ssr',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportStaticAsync.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport type { ExpoConfig } from '@expo/config';\nimport type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport type { RouteNode } from 'expo-router/build/Route';\nimport { getContextKey, stripGroupSegmentsFromPath } from 'expo-router/build/matchers';\nimport { shouldLinkExternally } from 'expo-router/build/utils/url';\nimport type { RoutesManifest } from 'expo-server/private';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { inspect } from 'util';\n\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport type { ExportAssetMap } from './saveAssets';\nimport { getFilesFromSerialAssets } from './saveAssets';\nimport { Log } from '../log';\nimport type {\n ExpoRouterRuntimeManifest,\n MetroBundlerDevServer,\n} from '../start/server/metro/MetroBundlerDevServer';\nimport { logMetroErrorAsync } from '../start/server/metro/metroErrorInterface';\nimport { getApiRoutesForDirectory, getMiddlewareForDirectory } from '../start/server/metro/router';\nimport {\n assetsRequiresSort,\n serializeHtmlWithAssets,\n sortMatchedAssetsByEntryPoints,\n} from '../start/server/metro/serializeHtml';\nimport { learnMore } from '../utils/link';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype ExtraScriptTag = {\n platform: string;\n src: string;\n};\n\ntype Options = {\n mode: 'production' | 'development';\n files?: ExportAssetMap;\n outputDir: string;\n minify: boolean;\n exportServer: boolean;\n baseUrl: string;\n includeSourceMaps: boolean;\n entryPoint?: string;\n clear: boolean;\n routerRoot: string;\n reactCompiler: boolean;\n maxWorkers?: number;\n isExporting: boolean;\n exp?: ExpoConfig;\n // <script type=\"type/expo\" data-platform=\"ios\" src=\"...\" />\n scriptTags?: ExtraScriptTag[];\n};\n\ntype HtmlRequestLocation = {\n /** The output file path name to use relative to the static folder. */\n filePath: string;\n /** The pathname to make requests to in order to fetch the HTML. */\n pathname: string;\n /** The runtime route node object, used to associate async modules with the static HTML. */\n route: RouteNode;\n};\n\nexport function injectScriptTags(html: string, scriptTags: ExtraScriptTag[]): string {\n const scriptTagsHtml = scriptTags\n .map((tag) =>\n tag.platform === 'web'\n ? `<script src=\"${tag.src}\"></script>`\n : `<script type=\"type/expo\" src=\"${tag.src}\" data-platform=\"${tag.platform}\"></script>`\n )\n .join('\\n');\n html = html.replace('</head>', `${scriptTagsHtml}\\n</head>`);\n return html;\n}\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync(\n projectRoot: string,\n {\n manifest,\n serverManifest,\n renderAsync,\n // Servers can handle group routes automatically and therefore\n // don't require the build-time generation of every possible group\n // variation.\n exportServer,\n skipHtmlPrerendering,\n // name : contents\n files = new Map(),\n }: {\n manifest: ExpoRouterRuntimeManifest;\n serverManifest: RoutesManifest;\n renderAsync: (requestLocation: HtmlRequestLocation) => Promise<string>;\n exportServer?: boolean;\n /**\n * Skip HTML pre-rendering when SSR is enabled (HTML will be rendered at runtime).\n *\n * This is separate from `exportServer` because RSC mode also uses `exportServer: true`,\n * but still needs placeholder HTML files.\n */\n skipHtmlPrerendering?: boolean;\n files?: ExportAssetMap;\n }\n): Promise<ExportAssetMap> {\n if (!exportServer && serverManifest) {\n // When we're not exporting a `server` output, we provide a `_expo/.routes.json` for\n // EAS Hosting to recognize the `headers` and `redirects` configs\n const subsetServerManifest = {\n headers: serverManifest.headers,\n redirects: serverManifest.redirects,\n };\n files.set('_expo/.routes.json', {\n contents: JSON.stringify(subsetServerManifest, null, 2),\n targetDomain: 'client',\n });\n }\n\n // Skip HTML pre-rendering in SSR mode since HTML will be rendered at runtime.\n if (skipHtmlPrerendering) {\n return files;\n }\n\n await Promise.all(\n getHtmlFiles({ manifest, includeGroupVariations: !exportServer }).map(\n async ({ route, filePath, pathname }) => {\n // Rewrite routes should not be statically generated\n if (route.type === 'rewrite') {\n return;\n }\n\n try {\n const targetDomain = exportServer ? 'server' : 'client';\n files.set(filePath, { contents: '', targetDomain });\n const data = await renderAsync({ route, filePath, pathname });\n files.set(filePath, {\n contents: data,\n routeId: pathname,\n targetDomain,\n });\n } catch (e: any) {\n await logMetroErrorAsync({ error: e, projectRoot });\n throw new Error('Failed to statically export route: ' + pathname);\n }\n }\n )\n );\n\n return files;\n}\n\nfunction modifyRouteNodeInRuntimeManifest(\n manifest: ExpoRouterRuntimeManifest,\n callback: (route: RouteNode) => any\n) {\n const iterateScreens = (screens: ExpoRouterRuntimeManifest['screens']) => {\n Object.values(screens).map((value) => {\n if (typeof value !== 'string') {\n if (value._route) callback(value._route);\n iterateScreens(value.screens);\n }\n });\n };\n\n iterateScreens(manifest.screens);\n}\n\n// TODO: Do this earlier in the process.\nfunction makeRuntimeEntryPointsAbsolute(manifest: ExpoRouterRuntimeManifest, appDir: string) {\n modifyRouteNodeInRuntimeManifest(manifest, (route) => {\n if (Array.isArray(route.entryPoints)) {\n route.entryPoints = route.entryPoints.map((entryPoint) => {\n // TODO(@hassankhan): ENG-16577\n if (shouldLinkExternally(entryPoint)) {\n return entryPoint;\n }\n\n if (entryPoint.startsWith('.')) {\n return path.resolve(appDir, entryPoint);\n } else if (!path.isAbsolute(entryPoint)) {\n return resolveFrom(appDir, entryPoint);\n }\n return entryPoint;\n });\n }\n });\n}\n\n/** Perform all fs commits */\nexport async function exportFromServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n outputDir,\n baseUrl,\n exportServer,\n includeSourceMaps,\n routerRoot,\n files = new Map(),\n exp,\n scriptTags,\n }: Options\n): Promise<ExportAssetMap> {\n const useServerRendering = exp?.extra?.router?.unstable_useServerRendering ?? false;\n\n const logOutput =\n exp?.web?.output === 'server' && useServerRendering\n ? `Server rendering is enabled. ${learnMore('https://docs.expo.dev/router/web/server-rendering/')}`\n : `Static rendering is enabled. ${learnMore('https://docs.expo.dev/router/web/static-rendering/')}`;\n Log.log(logOutput);\n\n const platform = 'web';\n const isExporting = true;\n const isExportingWithSSR =\n exportServer && useServerRendering && !devServer.isReactServerComponentsEnabled;\n const appDir = path.join(projectRoot, routerRoot);\n const injectFaviconTag = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp,\n });\n\n const [resources, { manifest, serverManifest, renderAsync, executeLoaderAsync }] =\n await Promise.all([\n devServer.getStaticResourcesAsync({\n includeSourceMaps,\n }),\n devServer.getStaticRenderFunctionAsync(),\n ]);\n\n makeRuntimeEntryPointsAbsolute(manifest, appDir);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n await getFilesToExportFromServerAsync(projectRoot, {\n files,\n manifest,\n serverManifest,\n exportServer,\n skipHtmlPrerendering: isExportingWithSSR,\n async renderAsync({ pathname, route }) {\n const normalizedPathname =\n pathname === '' ? '/' : pathname.startsWith('/') ? pathname : `/${pathname}`;\n\n const useServerLoaders = exp?.extra?.router?.unstable_useServerDataLoaders;\n let renderOpts;\n\n if (useServerLoaders) {\n const loaderResponse = await executeLoaderAsync(normalizedPathname, route);\n\n if (loaderResponse !== undefined) {\n const data = await loaderResponse.json();\n // Transforms a `route.contextKey` into a normalized path. For example,\n // `./nested/[id]/index.tsx` becomes `/nested/[id]/index`\n const loaderKey = getContextKey(route.contextKey);\n const fileSystemPath = `_expo/loaders${loaderKey}`;\n files.set(fileSystemPath, {\n contents: JSON.stringify(data, null, 2),\n targetDomain: 'client',\n loaderId: loaderKey,\n });\n\n renderOpts = { loader: { data, key: loaderKey } };\n }\n }\n\n const template = await renderAsync(normalizedPathname, route, renderOpts);\n let html = serializeHtmlWithAssets({\n isExporting,\n resources: resources.artifacts,\n template,\n baseUrl,\n route,\n hydrate: true,\n });\n\n if (injectFaviconTag) {\n html = injectFaviconTag(html);\n }\n\n if (scriptTags) {\n // Inject script tags into the HTML.\n // <script type=\"type/expo\" data-platform=\"ios\" src=\"...\" />\n html = injectScriptTags(html, scriptTags);\n }\n\n return html;\n },\n });\n\n getFilesFromSerialAssets(resources.artifacts, {\n platform,\n includeSourceMaps,\n files,\n isServerHosted: true,\n });\n\n if (resources.assets) {\n // TODO: Collect files without writing to disk.\n // NOTE(kitten): Re. above, this is now using `files` except for iOS catalog output, which isn't used here\n await persistMetroAssetsAsync(projectRoot, resources.assets, {\n files,\n platform,\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n if (exportServer) {\n const apiRoutes = await exportApiRoutesAsync({\n platform: 'web',\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n\n // Export SSR render module and add SSR configuration to routes manifest\n if (isExportingWithSSR) {\n await devServer.exportExpoRouterRenderModuleAsync({\n files,\n includeSourceMaps: true,\n platform: 'web',\n });\n\n // Export loader bundles for routes that have loader exports\n const useServerLoaders = exp?.extra?.router?.unstable_useServerDataLoaders;\n if (useServerLoaders) {\n // Get `loaderReferences` from client bundle metadata to determine which routes have loaders\n const loaderReferences = resources.artifacts?.flatMap(\n (artifact) => artifact.metadata?.loaderReferences ?? []\n );\n\n await exportLoadersAsync({\n devServer,\n serverManifest,\n appDir,\n files,\n platform: 'web',\n loaderReferences,\n });\n }\n\n const toAssetUrl = (filename: string) =>\n baseUrl ? `${baseUrl}/${filename}` : `/${filename}`;\n\n const cssAssets = resources.artifacts\n .filter((asset) => asset.type === 'css')\n .map((asset) => toAssetUrl(asset.filename));\n\n const jsArtifacts = resources.artifacts.filter((asset) => asset.type === 'js');\n const orderedJsAssets = assetsRequiresSort(jsArtifacts);\n const syncJs = orderedJsAssets.filter((asset) => !asset.metadata.isAsync);\n const asyncJs = orderedJsAssets.filter((asset) => asset.metadata.isAsync);\n\n const syncJsAssets = syncJs.map((asset) => toAssetUrl(asset.filename));\n\n const htmlRoutes = getHtmlFiles({ manifest, includeGroupVariations: false });\n\n // Build per-route async chunk assignments\n const routeAssets = new Map<string, string[]>();\n for (const { route } of htmlRoutes) {\n if (!route.entryPoints || !Array.isArray(route.entryPoints)) {\n continue;\n }\n\n const matchedChunks: SerialAsset[] = [];\n for (const asyncChunk of asyncJs) {\n if (!asyncChunk.metadata.modulePaths || !Array.isArray(asyncChunk.metadata.modulePaths)) {\n continue;\n }\n const hasRouteEntryPoint = route.entryPoints.some((entryPoint) =>\n (asyncChunk.metadata.modulePaths as string[]).includes(entryPoint)\n );\n if (hasRouteEntryPoint) {\n matchedChunks.push(asyncChunk);\n }\n }\n\n if (matchedChunks.length > 0) {\n const sorted = sortMatchedAssetsByEntryPoints(matchedChunks, route.entryPoints);\n routeAssets.set(\n route.contextKey,\n sorted.map((chunk) => toAssetUrl(chunk.filename))\n );\n }\n }\n\n // Add assets and rendering config to the routes manifest\n updateExportManifestInFiles({\n files,\n callback: (manifest) => {\n manifest.assets = { css: cssAssets, js: syncJsAssets };\n manifest.rendering = {\n mode: 'ssr',\n file: '_expo/server/render.js',\n };\n\n for (const route of manifest.htmlRoutes) {\n const asyncChunks = routeAssets.get(route.file);\n if (asyncChunks) {\n route.assets = { css: [], js: asyncChunks };\n }\n }\n },\n });\n }\n } else {\n warnPossibleInvalidExportType(appDir);\n }\n\n return files;\n}\n\nexport function getHtmlFiles({\n manifest,\n includeGroupVariations,\n}: {\n manifest: ExpoRouterRuntimeManifest;\n includeGroupVariations?: boolean;\n}): HtmlRequestLocation[] {\n const htmlFiles = new Set<Omit<HtmlRequestLocation, 'pathname'>>();\n\n function traverseScreens(\n screens: ExpoRouterRuntimeManifest['screens'],\n route: RouteNode | null,\n baseUrl = ''\n ) {\n for (const [key, value] of Object.entries(screens)) {\n let leaf: string | null = null;\n if (typeof value === 'string') {\n leaf = value;\n } else if (value.screens && Object.keys(value.screens).length === 0) {\n // Ensure the trailing index is accounted for.\n if (key === value.path + '/index') {\n leaf = key;\n } else {\n leaf = value.path;\n }\n\n route = value._route ?? null;\n }\n\n if (leaf != null) {\n let filePath = baseUrl + leaf;\n\n if (leaf === '') {\n filePath =\n baseUrl === ''\n ? 'index'\n : baseUrl.endsWith('/')\n ? baseUrl + 'index'\n : baseUrl.slice(0, -1);\n } else if (\n // If the path is a collection of group segments leading to an index route, append `/index`.\n stripGroupSegmentsFromPath(filePath) === ''\n ) {\n filePath += '/index';\n }\n\n // This should never happen, the type of `string | object` originally comes from React Navigation.\n if (!route) {\n throw new Error(\n `Internal error: Route not found for \"${filePath}\" while collecting static export paths.`\n );\n }\n\n if (includeGroupVariations) {\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath, route);\n } else {\n htmlFiles.add({\n filePath,\n route,\n });\n }\n } else if (typeof value === 'object' && value?.screens) {\n // The __root slot has no path.\n const newPath = value.path ? baseUrl + value.path + '/' : baseUrl;\n traverseScreens(value.screens, value._route ?? null, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string, route: RouteNode) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add({ filePath: variation, route });\n }\n }\n\n traverseScreens(manifest.screens, null);\n\n return uniqueBy(Array.from(htmlFiles), (value) => value.filePath).map((value) => {\n const parts = value.filePath.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part === '*not-found') {\n return `+not-found`;\n } else if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n const filePathLocation = partsWithGroups.join('/');\n const filePath = filePathLocation + '.html';\n return {\n ...value,\n filePath,\n pathname: filePathLocation.replace(/(\\/?index)?$/, ''),\n };\n });\n}\n\nfunction uniqueBy<T>(array: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const value of array) {\n const id = key(value);\n if (!seen.has(id)) {\n seen.add(id);\n result.push(value);\n }\n }\n return result;\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>();\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], current = ''): void {\n if (segments.length === 0) {\n if (current) variations.add(current);\n return;\n }\n\n const [head, ...rest] = segments;\n\n if (head && matchGroupName(head)) {\n const groups = head.slice(1, -1).split(',');\n\n if (groups.length > 1) {\n for (const group of groups) {\n // If there are multiple groups, recurse on each group.\n generateVariations([`(${group.trim()})`, ...rest], current);\n }\n return;\n } else {\n // Start a fork where this group is included\n generateVariations(rest, current ? `${current}/(${groups[0]})` : `(${groups[0]})`);\n // This code will continue and add paths without this group included`\n }\n } else if (head && current) {\n current = `${current}/${head}`;\n } else {\n current = head ?? current;\n }\n\n generateVariations(rest, current);\n }\n\n generateVariations(segments);\n\n return Array.from(variations);\n}\n\nexport async function exportApiRoutesStandaloneAsync(\n devServer: MetroBundlerDevServer,\n {\n files = new Map(),\n platform,\n apiRoutesOnly,\n templateHtml,\n }: {\n files?: ExportAssetMap;\n platform: string;\n apiRoutesOnly: boolean;\n templateHtml?: string;\n }\n) {\n const { serverManifest, htmlManifest } = await devServer.getServerManifestAsync();\n\n const apiRoutes = await exportApiRoutesAsync({\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n platform,\n apiRoutesOnly,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n\n if (templateHtml && devServer.isReactServerComponentsEnabled) {\n // TODO: Export an HTML entry for each file. This is a temporary solution until we have SSR/SSG for RSC.\n await getFilesToExportFromServerAsync(devServer.projectRoot, {\n manifest: htmlManifest,\n serverManifest,\n exportServer: true,\n files,\n renderAsync: async ({ pathname, filePath }) => {\n files.set(filePath, {\n contents: templateHtml!,\n routeId: pathname,\n targetDomain: 'server',\n });\n return templateHtml!;\n },\n });\n }\n\n return files;\n}\n\nasync function exportApiRoutesAsync({\n includeSourceMaps,\n server,\n platform,\n apiRoutesOnly,\n ...props\n}: Pick<Options, 'includeSourceMaps'> & {\n server: MetroBundlerDevServer;\n manifest: RoutesManifest<string>;\n platform: string;\n apiRoutesOnly?: boolean;\n}): Promise<ExportAssetMap> {\n const { manifest, files } = await server.exportExpoRouterApiRoutesAsync({\n outputDir: '_expo/functions',\n prerenderManifest: props.manifest,\n includeSourceMaps,\n platform,\n });\n\n // HACK: Clear out the HTML and 404 routes if we're only exporting API routes. This is used for native apps that are using API routes but haven't implemented web support yet.\n if (apiRoutesOnly) {\n manifest.htmlRoutes = [];\n manifest.notFoundRoutes = [];\n }\n\n files.set('_expo/routes.json', {\n contents: JSON.stringify(manifest, null, 2),\n targetDomain: 'server',\n });\n\n return files;\n}\n\nfunction warnPossibleInvalidExportType(appDir: string) {\n const apiRoutes = getApiRoutesForDirectory(appDir);\n if (apiRoutes.length) {\n // TODO: Allow API Routes for native-only.\n Log.warn(\n chalk.yellow`Skipping export for API routes because \\`web.output\\` is not \"server\". You may want to remove the routes: ${apiRoutes\n .map((v) => path.relative(appDir, v))\n .join(', ')}`\n );\n }\n\n const middlewareFile = getMiddlewareForDirectory(appDir);\n if (middlewareFile) {\n Log.warn(\n chalk.yellow`Skipping export for middleware because \\`web.output\\` is not \"server\". You may want to remove ${path.relative(appDir, middlewareFile)}`\n );\n }\n}\n\n/**\n * Export loader bundles for routes that have loader exports and updates routes in the manifest\n * with a `loader` property.\n */\nasync function exportLoadersAsync({\n devServer,\n serverManifest,\n appDir,\n files,\n platform,\n loaderReferences,\n}: {\n devServer: MetroBundlerDevServer;\n serverManifest: RoutesManifest<string>;\n appDir: string;\n files: ExportAssetMap;\n platform: string;\n /** File paths of modules with loader exports from client bundle metadata */\n loaderReferences: string[];\n}): Promise<void> {\n const entryPoints: { file: string; page: string }[] = [];\n\n for (const route of serverManifest.htmlRoutes) {\n // Skip generated routes\n if (route.generated) {\n continue;\n }\n\n const filePath = path.isAbsolute(route.file) ? route.file : path.join(appDir, route.file);\n\n if (loaderReferences.includes(filePath)) {\n entryPoints.push({\n file: filePath,\n page: route.page,\n });\n }\n }\n\n if (entryPoints.length === 0) {\n debug('No routes with loaders to bundle');\n return;\n }\n\n const entryPointModules = entryPoints.map((e) => e.page);\n debug('Bundling loaders for routes:', entryPointModules);\n\n await devServer.exportExpoRouterLoadersAsync({\n platform,\n entryPoints,\n files,\n outputDir: '_expo/loaders',\n includeSourceMaps: true,\n });\n\n // Update `htmlRoutes` in routes manifest for routes that have loaders\n updateExportManifestInFiles({\n files,\n callback: (manifest) => {\n const routesWithLoaders = new Set(entryPointModules);\n for (const route of manifest.htmlRoutes) {\n if (routesWithLoaders.has(route.page)) {\n route.loader = `_expo/loaders${route.page}.js`;\n }\n }\n },\n });\n\n debug('Exported loaders for routes:', entryPointModules);\n}\n\n// NOTE(@hassankhan): We should ideally persist the manifest to `files` only once instead of\n// modifying it afterwards.\nfunction updateExportManifestInFiles({\n files,\n callback,\n}: {\n files: ExportAssetMap;\n callback: (manifest: RoutesManifest<string>) => void;\n}) {\n const routesJsonEntry = files.get('_expo/routes.json');\n if (routesJsonEntry) {\n const manifest = JSON.parse(routesJsonEntry.contents as string);\n callback(manifest);\n\n files.set('_expo/routes.json', {\n ...routesJsonEntry,\n contents: JSON.stringify(manifest, null, 2),\n });\n }\n}\n"],"names":["exportApiRoutesStandaloneAsync","exportFromServerAsync","getFilesToExportFromServerAsync","getHtmlFiles","getPathVariations","injectScriptTags","debug","require","html","scriptTags","scriptTagsHtml","map","tag","platform","src","join","replace","matchGroupName","name","match","projectRoot","manifest","serverManifest","renderAsync","exportServer","skipHtmlPrerendering","files","Map","subsetServerManifest","headers","redirects","set","contents","JSON","stringify","targetDomain","Promise","all","includeGroupVariations","route","filePath","pathname","type","data","routeId","e","logMetroErrorAsync","error","Error","modifyRouteNodeInRuntimeManifest","callback","iterateScreens","screens","Object","values","value","_route","makeRuntimeEntryPointsAbsolute","appDir","Array","isArray","entryPoints","entryPoint","shouldLinkExternally","startsWith","path","resolve","isAbsolute","resolveFrom","devServer","outputDir","baseUrl","includeSourceMaps","routerRoot","exp","useServerRendering","extra","router","unstable_useServerRendering","logOutput","web","output","learnMore","Log","log","isExporting","isExportingWithSSR","isReactServerComponentsEnabled","injectFaviconTag","getVirtualFaviconAssetsAsync","resources","executeLoaderAsync","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","normalizedPathname","useServerLoaders","unstable_useServerDataLoaders","renderOpts","loaderResponse","undefined","json","loaderKey","getContextKey","contextKey","fileSystemPath","loaderId","loader","key","template","serializeHtmlWithAssets","artifacts","hydrate","getFilesFromSerialAssets","isServerHosted","assets","persistMetroAssetsAsync","outputDirectory","apiRoutes","exportApiRoutesAsync","server","exportExpoRouterRenderModuleAsync","loaderReferences","flatMap","artifact","metadata","exportLoadersAsync","toAssetUrl","filename","cssAssets","filter","asset","jsArtifacts","orderedJsAssets","assetsRequiresSort","syncJs","isAsync","asyncJs","syncJsAssets","htmlRoutes","routeAssets","matchedChunks","asyncChunk","modulePaths","hasRouteEntryPoint","some","includes","push","length","sorted","sortMatchedAssetsByEntryPoints","chunk","updateExportManifestInFiles","css","js","rendering","mode","file","asyncChunks","get","warnPossibleInvalidExportType","htmlFiles","Set","traverseScreens","entries","leaf","keys","endsWith","slice","stripGroupSegmentsFromPath","addOptionalGroups","add","newPath","variations","variation","uniqueBy","from","parts","split","partsWithGroups","part","filePathLocation","array","seen","result","id","has","routePath","segments","generateVariations","current","head","rest","groups","group","trim","apiRoutesOnly","templateHtml","htmlManifest","getServerManifestAsync","props","exportExpoRouterApiRoutesAsync","prerenderManifest","notFoundRoutes","getApiRoutesForDirectory","warn","chalk","yellow","v","relative","middlewareFile","getMiddlewareForDirectory","generated","page","entryPointModules","exportExpoRouterLoadersAsync","routesWithLoaders","routesJsonEntry","parse"],"mappings":"AAAA;;;;;C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AAC3B,SAAS9D,4BAA4B,EACnChI,KAAK,EACLwB,QAAQ,EAIT;IACC,MAAMyK,kBAAkBjM,MAAMuI,GAAG,CAAC;IAClC,IAAI0D,iBAAiB;QACnB,MAAMtM,WAAWY,KAAK2L,KAAK,CAACD,gBAAgB3L,QAAQ;QACpDkB,SAAS7B;QAETK,MAAMK,GAAG,CAAC,qBAAqB;YAC7B,GAAG4L,eAAe;YAClB3L,UAAUC,KAAKC,SAAS,CAACb,UAAU,MAAM;QAC3C;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportStaticAsync.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport type { ExpoConfig } from '@expo/config';\nimport type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport type { RouteNode } from 'expo-router/build/Route';\nimport { getContextKey, stripGroupSegmentsFromPath } from 'expo-router/build/matchers';\nimport { shouldLinkExternally } from 'expo-router/build/utils/url';\nimport type { RoutesManifest } from 'expo-server/private';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { inspect } from 'util';\n\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport type { ExportAssetMap } from './saveAssets';\nimport { getFilesFromSerialAssets } from './saveAssets';\nimport { Log } from '../log';\nimport type {\n ExpoRouterRuntimeManifest,\n MetroBundlerDevServer,\n} from '../start/server/metro/MetroBundlerDevServer';\nimport { logMetroErrorAsync } from '../start/server/metro/metroErrorInterface';\nimport { getApiRoutesForDirectory, getMiddlewareForDirectory } from '../start/server/metro/router';\nimport {\n assetsRequiresSort,\n serializeHtmlWithAssets,\n sortMatchedAssetsByEntryPoints,\n} from '../start/server/metro/serializeHtml';\nimport { learnMore } from '../utils/link';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype ExtraScriptTag = {\n platform: string;\n src: string;\n};\n\ntype Options = {\n mode: 'production' | 'development';\n files?: ExportAssetMap;\n outputDir: string;\n minify: boolean;\n exportServer: boolean;\n baseUrl: string;\n includeSourceMaps: boolean;\n entryPoint?: string;\n clear: boolean;\n routerRoot: string;\n reactCompiler: boolean;\n maxWorkers?: number;\n isExporting: boolean;\n exp?: ExpoConfig;\n // <script type=\"type/expo\" data-platform=\"ios\" src=\"...\" />\n scriptTags?: ExtraScriptTag[];\n};\n\ntype HtmlRequestLocation = {\n /** The output file path name to use relative to the static folder. */\n filePath: string;\n /** The pathname to make requests to in order to fetch the HTML. */\n pathname: string;\n /** The runtime route node object, used to associate async modules with the static HTML. */\n route: RouteNode;\n};\n\nexport function injectScriptTags(html: string, scriptTags: ExtraScriptTag[]): string {\n const scriptTagsHtml = scriptTags\n .map((tag) =>\n tag.platform === 'web'\n ? `<script src=\"${tag.src}\"></script>`\n : `<script type=\"type/expo\" src=\"${tag.src}\" data-platform=\"${tag.platform}\"></script>`\n )\n .join('\\n');\n html = html.replace('</head>', `${scriptTagsHtml}\\n</head>`);\n return html;\n}\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync(\n projectRoot: string,\n {\n manifest,\n serverManifest,\n renderAsync,\n // Servers can handle group routes automatically and therefore\n // don't require the build-time generation of every possible group\n // variation.\n exportServer,\n skipHtmlPrerendering,\n // name : contents\n files = new Map(),\n }: {\n manifest: ExpoRouterRuntimeManifest;\n serverManifest: RoutesManifest;\n renderAsync: (requestLocation: HtmlRequestLocation) => Promise<string>;\n exportServer?: boolean;\n /**\n * Skip HTML pre-rendering when SSR is enabled (HTML will be rendered at runtime).\n *\n * This is separate from `exportServer` because RSC mode also uses `exportServer: true`,\n * but still needs placeholder HTML files.\n */\n skipHtmlPrerendering?: boolean;\n files?: ExportAssetMap;\n }\n): Promise<ExportAssetMap> {\n if (!exportServer && serverManifest) {\n // When we're not exporting a `server` output, we provide a `_expo/.routes.json` for\n // EAS Hosting to recognize the `headers` and `redirects` configs\n const subsetServerManifest = {\n headers: serverManifest.headers,\n redirects: serverManifest.redirects,\n };\n files.set('_expo/.routes.json', {\n contents: JSON.stringify(subsetServerManifest, null, 2),\n targetDomain: 'client',\n });\n }\n\n // Skip HTML pre-rendering in SSR mode since HTML will be rendered at runtime.\n if (skipHtmlPrerendering) {\n return files;\n }\n\n await Promise.all(\n getHtmlFiles({ manifest, includeGroupVariations: !exportServer }).map(\n async ({ route, filePath, pathname }) => {\n // Rewrite routes should not be statically generated\n if (route.type === 'rewrite') {\n return;\n }\n\n try {\n const targetDomain = exportServer ? 'server' : 'client';\n files.set(filePath, { contents: '', targetDomain });\n const data = await renderAsync({ route, filePath, pathname });\n files.set(filePath, {\n contents: data,\n routeId: pathname,\n targetDomain,\n });\n } catch (e: any) {\n await logMetroErrorAsync({ error: e, projectRoot });\n throw new Error('Failed to statically export route: ' + pathname);\n }\n }\n )\n );\n\n return files;\n}\n\nfunction modifyRouteNodeInRuntimeManifest(\n manifest: ExpoRouterRuntimeManifest,\n callback: (route: RouteNode) => any\n) {\n const iterateScreens = (screens: ExpoRouterRuntimeManifest['screens']) => {\n Object.values(screens).map((value) => {\n if (typeof value !== 'string') {\n if (value._route) callback(value._route);\n iterateScreens(value.screens);\n }\n });\n };\n\n iterateScreens(manifest.screens);\n}\n\n// TODO: Do this earlier in the process.\nfunction makeRuntimeEntryPointsAbsolute(manifest: ExpoRouterRuntimeManifest, appDir: string) {\n modifyRouteNodeInRuntimeManifest(manifest, (route) => {\n if (Array.isArray(route.entryPoints)) {\n route.entryPoints = route.entryPoints.map((entryPoint) => {\n // TODO(@hassankhan): ENG-16577\n if (shouldLinkExternally(entryPoint)) {\n return entryPoint;\n }\n\n if (entryPoint.startsWith('.')) {\n return path.resolve(appDir, entryPoint);\n } else if (!path.isAbsolute(entryPoint)) {\n return resolveFrom(appDir, entryPoint);\n }\n return entryPoint;\n });\n }\n });\n}\n\n/** Perform all fs commits */\nexport async function exportFromServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n outputDir,\n baseUrl,\n exportServer,\n includeSourceMaps,\n routerRoot,\n files = new Map(),\n exp,\n scriptTags,\n }: Options\n): Promise<ExportAssetMap> {\n const useServerRendering = exp?.extra?.router?.unstable_useServerRendering ?? false;\n\n const logOutput =\n exp?.web?.output === 'server' && useServerRendering\n ? `Server rendering is enabled. ${learnMore('https://docs.expo.dev/router/web/server-rendering/')}`\n : `Static rendering is enabled. ${learnMore('https://docs.expo.dev/router/web/static-rendering/')}`;\n Log.log(logOutput);\n\n const platform = 'web';\n const isExporting = true;\n const isExportingWithSSR =\n exportServer && useServerRendering && !devServer.isReactServerComponentsEnabled;\n const appDir = path.join(projectRoot, routerRoot);\n const injectFaviconTag = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp,\n });\n\n const [resources, { manifest, serverManifest, renderAsync, executeLoaderAsync }] =\n await Promise.all([\n devServer.getStaticResourcesAsync({\n includeSourceMaps,\n }),\n devServer.getStaticRenderFunctionAsync(),\n ]);\n\n makeRuntimeEntryPointsAbsolute(manifest, appDir);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n await getFilesToExportFromServerAsync(projectRoot, {\n files,\n manifest,\n serverManifest,\n exportServer,\n skipHtmlPrerendering: isExportingWithSSR,\n async renderAsync({ pathname, route }) {\n const normalizedPathname =\n pathname === '' ? '/' : pathname.startsWith('/') ? pathname : `/${pathname}`;\n\n const useServerLoaders = exp?.extra?.router?.unstable_useServerDataLoaders;\n let renderOpts;\n\n if (useServerLoaders) {\n const loaderResponse = await executeLoaderAsync(normalizedPathname, route);\n\n if (loaderResponse !== undefined) {\n const data = await loaderResponse.json();\n // Transforms a `route.contextKey` into a normalized path. For example,\n // `./nested/[id]/index.tsx` becomes `/nested/[id]/index`\n const loaderKey = getContextKey(route.contextKey);\n const fileSystemPath = `_expo/loaders${loaderKey}`;\n files.set(fileSystemPath, {\n contents: JSON.stringify(data, null, 2),\n targetDomain: 'client',\n loaderId: loaderKey,\n });\n\n renderOpts = { loader: { data, key: loaderKey } };\n }\n }\n\n const template = await renderAsync(normalizedPathname, route, renderOpts);\n let html = serializeHtmlWithAssets({\n isExporting,\n resources: resources.artifacts,\n template,\n baseUrl,\n route,\n hydrate: true,\n });\n\n if (injectFaviconTag) {\n html = injectFaviconTag(html);\n }\n\n if (scriptTags) {\n // Inject script tags into the HTML.\n // <script type=\"type/expo\" data-platform=\"ios\" src=\"...\" />\n html = injectScriptTags(html, scriptTags);\n }\n\n return html;\n },\n });\n\n getFilesFromSerialAssets(resources.artifacts, {\n platform,\n includeSourceMaps,\n files,\n isServerHosted: true,\n });\n\n if (resources.assets) {\n // TODO: Collect files without writing to disk.\n // NOTE(kitten): Re. above, this is now using `files` except for iOS catalog output, which isn't used here\n await persistMetroAssetsAsync(projectRoot, resources.assets, {\n files,\n platform,\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n if (exportServer) {\n const apiRoutes = await exportApiRoutesAsync({\n platform: 'web',\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n\n // Export SSR render module and add SSR configuration to routes manifest\n if (isExportingWithSSR) {\n await devServer.exportExpoRouterRenderModuleAsync({\n files,\n includeSourceMaps: true,\n platform: 'web',\n });\n\n // Export loader bundles for routes that have loader exports\n const useServerLoaders = exp?.extra?.router?.unstable_useServerDataLoaders;\n if (useServerLoaders) {\n // Get `loaderReferences` from client bundle metadata to determine which routes have loaders\n const loaderReferences = resources.artifacts?.flatMap(\n (artifact) => artifact.metadata?.loaderReferences ?? []\n );\n\n await exportLoadersAsync({\n devServer,\n serverManifest,\n appDir,\n files,\n platform: 'web',\n loaderReferences,\n });\n }\n\n const toAssetUrl = (filename: string) =>\n baseUrl ? `${baseUrl}/${filename}` : `/${filename}`;\n\n const cssAssets = resources.artifacts\n .filter((asset) => asset.type === 'css')\n .map((asset) => toAssetUrl(asset.filename));\n\n const jsArtifacts = resources.artifacts.filter((asset) => asset.type === 'js');\n const orderedJsAssets = assetsRequiresSort(jsArtifacts);\n const syncJs = orderedJsAssets.filter((asset) => !asset.metadata.isAsync);\n const asyncJs = orderedJsAssets.filter((asset) => asset.metadata.isAsync);\n\n const syncJsAssets = syncJs.map((asset) => toAssetUrl(asset.filename));\n\n const htmlRoutes = getHtmlFiles({ manifest, includeGroupVariations: false });\n\n // Build per-route async chunk assignments\n const routeAssets = new Map<string, string[]>();\n for (const { route } of htmlRoutes) {\n if (!route.entryPoints || !Array.isArray(route.entryPoints)) {\n continue;\n }\n\n const matchedChunks: SerialAsset[] = [];\n for (const asyncChunk of asyncJs) {\n if (!asyncChunk.metadata.modulePaths || !Array.isArray(asyncChunk.metadata.modulePaths)) {\n continue;\n }\n const hasRouteEntryPoint = route.entryPoints.some((entryPoint) =>\n (asyncChunk.metadata.modulePaths as string[]).includes(entryPoint)\n );\n if (hasRouteEntryPoint) {\n matchedChunks.push(asyncChunk);\n }\n }\n\n if (matchedChunks.length > 0) {\n const sorted = sortMatchedAssetsByEntryPoints(matchedChunks, route.entryPoints);\n routeAssets.set(\n route.contextKey,\n sorted.map((chunk) => toAssetUrl(chunk.filename))\n );\n }\n }\n\n // Add assets and rendering config to the routes manifest\n updateExportManifestInFiles({\n files,\n callback: (manifest) => {\n manifest.assets = {\n css: cssAssets,\n js: syncJsAssets,\n favicon: injectFaviconTag ? `${baseUrl}/favicon.ico` : undefined,\n };\n manifest.rendering = {\n mode: 'ssr',\n file: '_expo/server/render.js',\n };\n\n for (const route of manifest.htmlRoutes) {\n const asyncChunks = routeAssets.get(route.file);\n if (asyncChunks) {\n route.assets = { css: [], js: asyncChunks };\n }\n }\n },\n });\n }\n } else {\n warnPossibleInvalidExportType(appDir);\n }\n\n return files;\n}\n\nexport function getHtmlFiles({\n manifest,\n includeGroupVariations,\n}: {\n manifest: ExpoRouterRuntimeManifest;\n includeGroupVariations?: boolean;\n}): HtmlRequestLocation[] {\n const htmlFiles = new Set<Omit<HtmlRequestLocation, 'pathname'>>();\n\n function traverseScreens(\n screens: ExpoRouterRuntimeManifest['screens'],\n route: RouteNode | null,\n baseUrl = ''\n ) {\n for (const [key, value] of Object.entries(screens)) {\n let leaf: string | null = null;\n if (typeof value === 'string') {\n leaf = value;\n } else if (value.screens && Object.keys(value.screens).length === 0) {\n // Ensure the trailing index is accounted for.\n if (key === value.path + '/index') {\n leaf = key;\n } else {\n leaf = value.path;\n }\n\n route = value._route ?? null;\n }\n\n if (leaf != null) {\n let filePath = baseUrl + leaf;\n\n if (leaf === '') {\n filePath =\n baseUrl === ''\n ? 'index'\n : baseUrl.endsWith('/')\n ? baseUrl + 'index'\n : baseUrl.slice(0, -1);\n } else if (\n // If the path is a collection of group segments leading to an index route, append `/index`.\n stripGroupSegmentsFromPath(filePath) === ''\n ) {\n filePath += '/index';\n }\n\n // This should never happen, the type of `string | object` originally comes from React Navigation.\n if (!route) {\n throw new Error(\n `Internal error: Route not found for \"${filePath}\" while collecting static export paths.`\n );\n }\n\n if (includeGroupVariations) {\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath, route);\n } else {\n htmlFiles.add({\n filePath,\n route,\n });\n }\n } else if (typeof value === 'object' && value?.screens) {\n // The __root slot has no path.\n const newPath = value.path ? baseUrl + value.path + '/' : baseUrl;\n traverseScreens(value.screens, value._route ?? null, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string, route: RouteNode) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add({ filePath: variation, route });\n }\n }\n\n traverseScreens(manifest.screens, null);\n\n return uniqueBy(Array.from(htmlFiles), (value) => value.filePath).map((value) => {\n const parts = value.filePath.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part === '*not-found') {\n return `+not-found`;\n } else if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n const filePathLocation = partsWithGroups.join('/');\n const filePath = filePathLocation + '.html';\n return {\n ...value,\n filePath,\n pathname: filePathLocation.replace(/(\\/?index)?$/, ''),\n };\n });\n}\n\nfunction uniqueBy<T>(array: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const value of array) {\n const id = key(value);\n if (!seen.has(id)) {\n seen.add(id);\n result.push(value);\n }\n }\n return result;\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>();\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], current = ''): void {\n if (segments.length === 0) {\n if (current) variations.add(current);\n return;\n }\n\n const [head, ...rest] = segments;\n\n if (head && matchGroupName(head)) {\n const groups = head.slice(1, -1).split(',');\n\n if (groups.length > 1) {\n for (const group of groups) {\n // If there are multiple groups, recurse on each group.\n generateVariations([`(${group.trim()})`, ...rest], current);\n }\n return;\n } else {\n // Start a fork where this group is included\n generateVariations(rest, current ? `${current}/(${groups[0]})` : `(${groups[0]})`);\n // This code will continue and add paths without this group included`\n }\n } else if (head && current) {\n current = `${current}/${head}`;\n } else {\n current = head ?? current;\n }\n\n generateVariations(rest, current);\n }\n\n generateVariations(segments);\n\n return Array.from(variations);\n}\n\nexport async function exportApiRoutesStandaloneAsync(\n devServer: MetroBundlerDevServer,\n {\n files = new Map(),\n platform,\n apiRoutesOnly,\n templateHtml,\n }: {\n files?: ExportAssetMap;\n platform: string;\n apiRoutesOnly: boolean;\n templateHtml?: string;\n }\n) {\n const { serverManifest, htmlManifest } = await devServer.getServerManifestAsync();\n\n const apiRoutes = await exportApiRoutesAsync({\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n platform,\n apiRoutesOnly,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n\n if (templateHtml && devServer.isReactServerComponentsEnabled) {\n // TODO: Export an HTML entry for each file. This is a temporary solution until we have SSR/SSG for RSC.\n await getFilesToExportFromServerAsync(devServer.projectRoot, {\n manifest: htmlManifest,\n serverManifest,\n exportServer: true,\n files,\n renderAsync: async ({ pathname, filePath }) => {\n files.set(filePath, {\n contents: templateHtml!,\n routeId: pathname,\n targetDomain: 'server',\n });\n return templateHtml!;\n },\n });\n }\n\n return files;\n}\n\nasync function exportApiRoutesAsync({\n includeSourceMaps,\n server,\n platform,\n apiRoutesOnly,\n ...props\n}: Pick<Options, 'includeSourceMaps'> & {\n server: MetroBundlerDevServer;\n manifest: RoutesManifest<string>;\n platform: string;\n apiRoutesOnly?: boolean;\n}): Promise<ExportAssetMap> {\n const { manifest, files } = await server.exportExpoRouterApiRoutesAsync({\n outputDir: '_expo/functions',\n prerenderManifest: props.manifest,\n includeSourceMaps,\n platform,\n });\n\n // HACK: Clear out the HTML and 404 routes if we're only exporting API routes. This is used for native apps that are using API routes but haven't implemented web support yet.\n if (apiRoutesOnly) {\n manifest.htmlRoutes = [];\n manifest.notFoundRoutes = [];\n }\n\n files.set('_expo/routes.json', {\n contents: JSON.stringify(manifest, null, 2),\n targetDomain: 'server',\n });\n\n return files;\n}\n\nfunction warnPossibleInvalidExportType(appDir: string) {\n const apiRoutes = getApiRoutesForDirectory(appDir);\n if (apiRoutes.length) {\n // TODO: Allow API Routes for native-only.\n Log.warn(\n chalk.yellow`Skipping export for API routes because \\`web.output\\` is not \"server\". You may want to remove the routes: ${apiRoutes\n .map((v) => path.relative(appDir, v))\n .join(', ')}`\n );\n }\n\n const middlewareFile = getMiddlewareForDirectory(appDir);\n if (middlewareFile) {\n Log.warn(\n chalk.yellow`Skipping export for middleware because \\`web.output\\` is not \"server\". You may want to remove ${path.relative(appDir, middlewareFile)}`\n );\n }\n}\n\n/**\n * Export loader bundles for routes that have loader exports and updates routes in the manifest\n * with a `loader` property.\n */\nasync function exportLoadersAsync({\n devServer,\n serverManifest,\n appDir,\n files,\n platform,\n loaderReferences,\n}: {\n devServer: MetroBundlerDevServer;\n serverManifest: RoutesManifest<string>;\n appDir: string;\n files: ExportAssetMap;\n platform: string;\n /** File paths of modules with loader exports from client bundle metadata */\n loaderReferences: string[];\n}): Promise<void> {\n const entryPoints: { file: string; page: string }[] = [];\n\n for (const route of serverManifest.htmlRoutes) {\n // Skip generated routes\n if (route.generated) {\n continue;\n }\n\n const filePath = path.isAbsolute(route.file) ? route.file : path.join(appDir, route.file);\n\n if (loaderReferences.includes(filePath)) {\n entryPoints.push({\n file: filePath,\n page: route.page,\n });\n }\n }\n\n if (entryPoints.length === 0) {\n debug('No routes with loaders to bundle');\n return;\n }\n\n const entryPointModules = entryPoints.map((e) => e.page);\n debug('Bundling loaders for routes:', entryPointModules);\n\n await devServer.exportExpoRouterLoadersAsync({\n platform,\n entryPoints,\n files,\n outputDir: '_expo/loaders',\n includeSourceMaps: true,\n });\n\n // Update `htmlRoutes` in routes manifest for routes that have loaders\n updateExportManifestInFiles({\n files,\n callback: (manifest) => {\n const routesWithLoaders = new Set(entryPointModules);\n for (const route of manifest.htmlRoutes) {\n if (routesWithLoaders.has(route.page)) {\n route.loader = `_expo/loaders${route.page}.js`;\n }\n }\n },\n });\n\n debug('Exported loaders for routes:', entryPointModules);\n}\n\n// NOTE(@hassankhan): We should ideally persist the manifest to `files` only once instead of\n// modifying it afterwards.\nfunction updateExportManifestInFiles({\n files,\n callback,\n}: {\n files: ExportAssetMap;\n callback: (manifest: RoutesManifest<string>) => void;\n}) {\n const routesJsonEntry = files.get('_expo/routes.json');\n if (routesJsonEntry) {\n const manifest = JSON.parse(routesJsonEntry.contents as string);\n callback(manifest);\n\n files.set('_expo/routes.json', {\n ...routesJsonEntry,\n contents: JSON.stringify(manifest, null, 2),\n });\n }\n}\n"],"names":["exportApiRoutesStandaloneAsync","exportFromServerAsync","getFilesToExportFromServerAsync","getHtmlFiles","getPathVariations","injectScriptTags","debug","require","html","scriptTags","scriptTagsHtml","map","tag","platform","src","join","replace","matchGroupName","name","match","projectRoot","manifest","serverManifest","renderAsync","exportServer","skipHtmlPrerendering","files","Map","subsetServerManifest","headers","redirects","set","contents","JSON","stringify","targetDomain","Promise","all","includeGroupVariations","route","filePath","pathname","type","data","routeId","e","logMetroErrorAsync","error","Error","modifyRouteNodeInRuntimeManifest","callback","iterateScreens","screens","Object","values","value","_route","makeRuntimeEntryPointsAbsolute","appDir","Array","isArray","entryPoints","entryPoint","shouldLinkExternally","startsWith","path","resolve","isAbsolute","resolveFrom","devServer","outputDir","baseUrl","includeSourceMaps","routerRoot","exp","useServerRendering","extra","router","unstable_useServerRendering","logOutput","web","output","learnMore","Log","log","isExporting","isExportingWithSSR","isReactServerComponentsEnabled","injectFaviconTag","getVirtualFaviconAssetsAsync","resources","executeLoaderAsync","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","normalizedPathname","useServerLoaders","unstable_useServerDataLoaders","renderOpts","loaderResponse","undefined","json","loaderKey","getContextKey","contextKey","fileSystemPath","loaderId","loader","key","template","serializeHtmlWithAssets","artifacts","hydrate","getFilesFromSerialAssets","isServerHosted","assets","persistMetroAssetsAsync","outputDirectory","apiRoutes","exportApiRoutesAsync","server","exportExpoRouterRenderModuleAsync","loaderReferences","flatMap","artifact","metadata","exportLoadersAsync","toAssetUrl","filename","cssAssets","filter","asset","jsArtifacts","orderedJsAssets","assetsRequiresSort","syncJs","isAsync","asyncJs","syncJsAssets","htmlRoutes","routeAssets","matchedChunks","asyncChunk","modulePaths","hasRouteEntryPoint","some","includes","push","length","sorted","sortMatchedAssetsByEntryPoints","chunk","updateExportManifestInFiles","css","js","favicon","rendering","mode","file","asyncChunks","get","warnPossibleInvalidExportType","htmlFiles","Set","traverseScreens","entries","leaf","keys","endsWith","slice","stripGroupSegmentsFromPath","addOptionalGroups","add","newPath","variations","variation","uniqueBy","from","parts","split","partsWithGroups","part","filePathLocation","array","seen","result","id","has","routePath","segments","generateVariations","current","head","rest","groups","group","trim","apiRoutesOnly","templateHtml","htmlManifest","getServerManifestAsync","props","exportExpoRouterApiRoutesAsync","prerenderManifest","notFoundRoutes","getApiRoutesForDirectory","warn","chalk","yellow","v","relative","middlewareFile","getMiddlewareForDirectory","generated","page","entryPointModules","exportExpoRouterLoadersAsync","routesWithLoaders","routesJsonEntry","parse"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QA0kBqBA;eAAAA;;QAxYAC;eAAAA;;QAhHAC;eAAAA;;QA2VNC;eAAAA;;QAqHAC;eAAAA;;QAjeAC;eAAAA;;;;gEA9DE;;;;;;;yBAEwC;;;;;;;yBACrB;;;;;;;gEAEpB;;;;;;;gEACO;;;;;;;yBACA;;;;;;yBAEqB;oCACL;4BAEC;qBACrB;qCAKe;wBACiC;+BAK7D;sBACmB;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AAmCxB,SAASF,iBAAiBG,IAAY,EAAEC,UAA4B;IACzE,MAAMC,iBAAiBD,WACpBE,GAAG,CAAC,CAACC,MACJA,IAAIC,QAAQ,KAAK,QACb,CAAC,aAAa,EAAED,IAAIE,GAAG,CAAC,WAAW,CAAC,GACpC,CAAC,8BAA8B,EAAEF,IAAIE,GAAG,CAAC,iBAAiB,EAAEF,IAAIC,QAAQ,CAAC,WAAW,CAAC,EAE1FE,IAAI,CAAC;IACRP,OAAOA,KAAKQ,OAAO,CAAC,WAAW,GAAGN,eAAe,SAAS,CAAC;IAC3D,OAAOF;AACT;AAEA,6BAA6B,GAC7B,SAASS,eAAeC,IAAY;QAC3BA;IAAP,QAAOA,cAAAA,KAAKC,KAAK,CAAC,sCAAXD,WAA8B,CAAC,EAAE;AAC1C;AAEO,eAAehB,gCACpBkB,WAAm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