@expo/cli 0.19.13 → 0.20.0
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 +0 -1
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +6 -17
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +4 -9
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/graphql/types/App.js +4 -9
- package/build/src/api/graphql/types/App.js.map +1 -1
- package/build/src/api/user/user.js +7 -12
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/export/createMetadataJson.js +14 -10
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +38 -95
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +32 -1
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportDomComponents.js +156 -0
- package/build/src/export/exportDomComponents.js.map +1 -0
- package/build/src/export/exportHermes.js +49 -1
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/install/installExpoPackage.js +15 -15
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +2 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +21 -5
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +2 -2
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +20 -5
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +3 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/codesigning.js +8 -8
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/exit.js +59 -2
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/filePath.js +28 -0
- package/build/src/utils/filePath.js.map +1 -0
- package/build/src/utils/ip.js +89 -1
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js +13 -13
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +5 -6
- package/build/src/export/embed/guessHermes.js +0 -69
- package/build/src/export/embed/guessHermes.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -75,7 +75,6 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
75
75
|
const graphqlClient = (0, _core().createClient)({
|
|
76
76
|
url: (0, _endpoint.getExpoApiBaseUrl)() + "/graphql",
|
|
77
77
|
exchanges: [
|
|
78
|
-
_core().dedupExchange,
|
|
79
78
|
_core().cacheExchange,
|
|
80
79
|
(0, _exchangeRetry().retryExchange)({
|
|
81
80
|
maxDelayMs: 4000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api/graphql/client.ts"],"sourcesContent":["import {\n cacheExchange,\n Client,\n CombinedError as GraphqlError,\n createClient as createUrqlClient,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/graphql/client.ts"],"sourcesContent":["import {\n cacheExchange,\n Client,\n CombinedError as GraphqlError,\n AnyVariables,\n DocumentInput,\n createClient as createUrqlClient,\n fetchExchange,\n OperationContext,\n OperationResult,\n OperationResultSource,\n} from '@urql/core';\nimport { retryExchange } from '@urql/exchange-retry';\n\nimport * as Log from '../../log';\nimport { fetch } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport { wrapFetchWithOffline } from '../rest/wrapFetchWithOffline';\nimport { wrapFetchWithProxy } from '../rest/wrapFetchWithProxy';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\ntype AccessTokenHeaders = {\n authorization: string;\n};\n\ntype SessionHeaders = {\n 'expo-session': string;\n};\n\nexport const graphqlClient = createUrqlClient({\n url: getExpoApiBaseUrl() + '/graphql',\n exchanges: [\n cacheExchange,\n retryExchange({\n maxDelayMs: 4000,\n retryIf: (err) =>\n !!(err && (err.networkError || err.graphQLErrors.some((e) => e?.extensions?.isTransient))),\n }),\n fetchExchange,\n ],\n // @ts-ignore Type 'typeof fetch' is not assignable to type '(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>'.\n fetch: wrapFetchWithOffline(wrapFetchWithProxy(fetch)),\n fetchOptions: (): { headers?: AccessTokenHeaders | SessionHeaders } => {\n const token = getAccessToken();\n if (token) {\n return {\n headers: {\n authorization: `Bearer ${token}`,\n },\n };\n }\n const sessionSecret = getSession()?.sessionSecret;\n if (sessionSecret) {\n return {\n headers: {\n 'expo-session': sessionSecret,\n },\n };\n }\n return {};\n },\n}) as StricterClient;\n\n/* Please specify additionalTypenames in your Graphql queries */\nexport interface StricterClient extends Client {\n query<Data = any, Variables extends AnyVariables = AnyVariables>(\n query: DocumentInput<Data, Variables>,\n variables: Variables,\n context: Partial<OperationContext> & { additionalTypenames: string[] }\n ): OperationResultSource<OperationResult<Data, Variables>>;\n}\n\nexport async function withErrorHandlingAsync<T>(promise: Promise<OperationResult<T>>): Promise<T> {\n const { data, error } = await promise;\n\n if (error) {\n if (error.graphQLErrors.some((e) => e?.extensions?.isTransient)) {\n Log.error(`We've encountered a transient error, please try again shortly.`);\n }\n throw error;\n }\n\n // Check for a malformed response. This only checks the root query's existence. It doesn't affect\n // returning responses with an empty result set.\n if (!data) {\n throw new Error('Returned query result data is null!');\n }\n\n return data;\n}\n\nexport { GraphqlError };\n"],"names":["graphqlClient","withErrorHandlingAsync","GraphqlError","createUrqlClient","url","getExpoApiBaseUrl","exchanges","cacheExchange","retryExchange","maxDelayMs","retryIf","err","networkError","graphQLErrors","some","e","extensions","isTransient","fetchExchange","fetch","wrapFetchWithOffline","wrapFetchWithProxy","fetchOptions","getSession","token","getAccessToken","headers","authorization","sessionSecret","promise","data","error","Log","Error"],"mappings":"AAAA;;;;;;;;;;;IA6BaA,aAAa,MAAbA,aAAa;IA2CJC,sBAAsB,MAAtBA,sBAAsB;IAmBnCC,YAAY,MAAZA,KAAY,EAAA,cAAA;;;yBAhFd,YAAY;;;;;;;yBACW,sBAAsB;;;;;;2DAE/B,WAAW;uBACV,mBAAmB;0BACP,aAAa;sCACV,8BAA8B;oCAChC,4BAA4B;8BACpB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU1D,MAAMF,aAAa,GAAGG,IAAAA,KAAgB,EAAA,aAAA,EAAC;IAC5CC,GAAG,EAAEC,IAAAA,SAAiB,kBAAA,GAAE,GAAG,UAAU;IACrCC,SAAS,EAAE;QACTC,KAAa,EAAA,cAAA;QACbC,IAAAA,cAAa,EAAA,cAAA,EAAC;YACZC,UAAU,EAAE,IAAI;YAChBC,OAAO,EAAE,CAACC,GAAG;gBACX,OAAA,CAAC,CAAC,CAACA,GAAG,IAAI,CAACA,GAAG,CAACC,YAAY,IAAID,GAAG,CAACE,aAAa,CAACC,IAAI,CAAC,CAACC,CAAC;wBAAKA,GAAa;oBAAbA,OAAAA,CAAC,QAAY,GAAbA,KAAAA,CAAa,GAAbA,CAAAA,GAAa,GAAbA,CAAC,CAAEC,UAAU,SAAA,GAAbD,KAAAA,CAAa,GAAbA,GAAa,CAAEE,WAAW,AAAb,CAAa;iBAAA,CAAC,CAAC,CAAC,CAAA;aAAA;SAC7F,CAAC;QACFC,KAAa,EAAA,cAAA;KACd;IACD,wIAAwI;IACxIC,KAAK,EAAEC,IAAAA,qBAAoB,qBAAA,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ACzD,CAAC;IAED,OAAOH,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -6,30 +6,18 @@ Object.defineProperty(exports, "AppQuery", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>AppQuery
|
|
8
8
|
});
|
|
9
|
-
function
|
|
10
|
-
const data = require("
|
|
11
|
-
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
function _graphqlTag() {
|
|
17
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("graphql-tag"));
|
|
18
|
-
_graphqlTag = function() {
|
|
9
|
+
function _core() {
|
|
10
|
+
const data = require("@urql/core");
|
|
11
|
+
_core = function() {
|
|
19
12
|
return data;
|
|
20
13
|
};
|
|
21
14
|
return data;
|
|
22
15
|
}
|
|
23
16
|
const _client = require("../client");
|
|
24
17
|
const _app = require("../types/App");
|
|
25
|
-
function _interopRequireDefault(obj) {
|
|
26
|
-
return obj && obj.__esModule ? obj : {
|
|
27
|
-
default: obj
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
18
|
const AppQuery = {
|
|
31
19
|
async byIdAsync (projectId) {
|
|
32
|
-
const data = await (0, _client.withErrorHandlingAsync)(_client.graphqlClient.query((0,
|
|
20
|
+
const data = await (0, _client.withErrorHandlingAsync)(_client.graphqlClient.query((0, _core().gql)`
|
|
33
21
|
query AppByIdQuery($appId: String!) {
|
|
34
22
|
app {
|
|
35
23
|
byId(appId: $appId) {
|
|
@@ -38,7 +26,8 @@ const AppQuery = {
|
|
|
38
26
|
}
|
|
39
27
|
}
|
|
40
28
|
}
|
|
41
|
-
|
|
29
|
+
|
|
30
|
+
${_app.AppFragmentNode}
|
|
42
31
|
`, {
|
|
43
32
|
appId: projectId
|
|
44
33
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/api/graphql/queries/AppQuery.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/api/graphql/queries/AppQuery.ts"],"sourcesContent":["import { gql } from '@urql/core';\n\nimport { AppByIdQuery } from '../../../graphql/generated';\nimport { graphqlClient, withErrorHandlingAsync } from '../client';\nimport { AppFragmentNode } from '../types/App';\n\nexport const AppQuery = {\n async byIdAsync(projectId: string): Promise<AppByIdQuery['app']['byId']> {\n const data = await withErrorHandlingAsync(\n graphqlClient\n .query<AppByIdQuery>(\n gql`\n query AppByIdQuery($appId: String!) {\n app {\n byId(appId: $appId) {\n id\n ...AppFragment\n }\n }\n }\n\n ${AppFragmentNode}\n `,\n { appId: projectId },\n {\n additionalTypenames: ['App'],\n }\n )\n .toPromise()\n );\n return data.app.byId;\n },\n};\n"],"names":["AppQuery","byIdAsync","projectId","data","withErrorHandlingAsync","graphqlClient","query","gql","AppFragmentNode","appId","additionalTypenames","toPromise","app","byId"],"mappings":"AAAA;;;;+BAMaA,UAAQ;;aAARA,QAAQ;;;yBAND,YAAY;;;;;;wBAGsB,WAAW;qBACjC,cAAc;AAEvC,MAAMA,QAAQ,GAAG;IACtB,MAAMC,SAAS,EAACC,SAAiB,EAAwC;QACvE,MAAMC,IAAI,GAAG,MAAMC,IAAAA,OAAsB,uBAAA,EACvCC,OAAa,cAAA,CACVC,KAAK,CACJC,IAAAA,KAAG,EAAA,IAAA,CAAA,CAAC;;;;;;;;;;YAUF,EAAEC,IAAe,gBAAA,CAAC;UACpB,CAAC,EACD;YAAEC,KAAK,EAAEP,SAAS;SAAE,EACpB;YACEQ,mBAAmB,EAAE;gBAAC,KAAK;aAAC;SAC7B,CACF,CACAC,SAAS,EAAE,CACf,AAAC;QACF,OAAOR,IAAI,CAACS,GAAG,CAACC,IAAI,CAAC;IACvB,CAAC;CACF,AAAC"}
|
|
@@ -6,22 +6,17 @@ Object.defineProperty(exports, "UserQuery", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>UserQuery
|
|
8
8
|
});
|
|
9
|
-
function
|
|
10
|
-
const data =
|
|
11
|
-
|
|
9
|
+
function _core() {
|
|
10
|
+
const data = require("@urql/core");
|
|
11
|
+
_core = function() {
|
|
12
12
|
return data;
|
|
13
13
|
};
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
16
|
const _client = require("../client");
|
|
17
|
-
function _interopRequireDefault(obj) {
|
|
18
|
-
return obj && obj.__esModule ? obj : {
|
|
19
|
-
default: obj
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
17
|
const UserQuery = {
|
|
23
18
|
async currentUserAsync () {
|
|
24
|
-
const data = await (0, _client.withErrorHandlingAsync)(_client.graphqlClient.query((0,
|
|
19
|
+
const data = await (0, _client.withErrorHandlingAsync)(_client.graphqlClient.query((0, _core().gql)`
|
|
25
20
|
query CurrentUser {
|
|
26
21
|
meActor {
|
|
27
22
|
__typename
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/api/graphql/queries/UserQuery.ts"],"sourcesContent":["import gql from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/api/graphql/queries/UserQuery.ts"],"sourcesContent":["import { gql } from '@urql/core';\n\nimport { CurrentUserQuery } from '../../../graphql/generated';\nimport { graphqlClient, withErrorHandlingAsync } from '../client';\n\nexport const UserQuery = {\n async currentUserAsync(): Promise<CurrentUserQuery['meActor']> {\n const data = await withErrorHandlingAsync(\n graphqlClient\n .query<CurrentUserQuery>(\n gql`\n query CurrentUser {\n meActor {\n __typename\n id\n ... on UserActor {\n primaryAccount {\n id\n }\n username\n }\n ... on Robot {\n firstName\n }\n accounts {\n id\n users {\n actor {\n id\n }\n permissions\n }\n }\n }\n }\n `,\n /* variables */ undefined,\n {\n additionalTypenames: ['User', 'SSOUser'],\n }\n )\n .toPromise()\n );\n\n return data.meActor;\n },\n};\n"],"names":["UserQuery","currentUserAsync","data","withErrorHandlingAsync","graphqlClient","query","gql","undefined","additionalTypenames","toPromise","meActor"],"mappings":"AAAA;;;;+BAKaA,WAAS;;aAATA,SAAS;;;yBALF,YAAY;;;;;;wBAGsB,WAAW;AAE1D,MAAMA,SAAS,GAAG;IACvB,MAAMC,gBAAgB,IAAyC;QAC7D,MAAMC,IAAI,GAAG,MAAMC,IAAAA,OAAsB,uBAAA,EACvCC,OAAa,cAAA,CACVC,KAAK,CACJC,IAAAA,KAAG,EAAA,IAAA,CAAA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;UAyBJ,CAAC,EACD,aAAa,GAAGC,SAAS,EACzB;YACEC,mBAAmB,EAAE;gBAAC,MAAM;gBAAE,SAAS;aAAC;SACzC,CACF,CACAC,SAAS,EAAE,CACf,AAAC;QAEF,OAAOP,IAAI,CAACQ,OAAO,CAAC;IACtB,CAAC;CACF,AAAC"}
|
|
@@ -6,19 +6,14 @@ Object.defineProperty(exports, "AppFragmentNode", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>AppFragmentNode
|
|
8
8
|
});
|
|
9
|
-
function
|
|
10
|
-
const data =
|
|
11
|
-
|
|
9
|
+
function _core() {
|
|
10
|
+
const data = require("@urql/core");
|
|
11
|
+
_core = function() {
|
|
12
12
|
return data;
|
|
13
13
|
};
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const AppFragmentNode = (0, _graphqlTag().default)`
|
|
16
|
+
const AppFragmentNode = (0, _core().gql)`
|
|
22
17
|
fragment AppFragment on App {
|
|
23
18
|
id
|
|
24
19
|
scopeKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/api/graphql/types/App.ts"],"sourcesContent":["import gql from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/api/graphql/types/App.ts"],"sourcesContent":["import { TypedDocumentNode, gql } from '@urql/core';\n\nexport const AppFragmentNode: TypedDocumentNode = gql`\n fragment AppFragment on App {\n id\n scopeKey\n ownerAccount {\n id\n }\n }\n`;\n"],"names":["AppFragmentNode","gql"],"mappings":"AAAA;;;;+BAEaA,iBAAe;;aAAfA,eAAe;;;yBAFW,YAAY;;;;;;AAE5C,MAAMA,eAAe,GAAsBC,IAAAA,KAAG,EAAA,IAAA,CAAA,CAAC;;;;;;;;AAQtD,CAAC,AAAC"}
|
|
@@ -16,16 +16,16 @@ _export(exports, {
|
|
|
16
16
|
ssoLoginAsync: ()=>ssoLoginAsync,
|
|
17
17
|
logoutAsync: ()=>logoutAsync
|
|
18
18
|
});
|
|
19
|
-
function
|
|
20
|
-
const data = require("
|
|
21
|
-
|
|
19
|
+
function _core() {
|
|
20
|
+
const data = require("@urql/core");
|
|
21
|
+
_core = function() {
|
|
22
22
|
return data;
|
|
23
23
|
};
|
|
24
24
|
return data;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const data =
|
|
28
|
-
|
|
26
|
+
function _fs() {
|
|
27
|
+
const data = require("fs");
|
|
28
|
+
_fs = function() {
|
|
29
29
|
return data;
|
|
30
30
|
};
|
|
31
31
|
return data;
|
|
@@ -39,11 +39,6 @@ const _endpoint = require("../endpoint");
|
|
|
39
39
|
const _client = require("../graphql/client");
|
|
40
40
|
const _userQuery = require("../graphql/queries/UserQuery");
|
|
41
41
|
const _client1 = require("../rest/client");
|
|
42
|
-
function _interopRequireDefault(obj) {
|
|
43
|
-
return obj && obj.__esModule ? obj : {
|
|
44
|
-
default: obj
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
42
|
function _getRequireWildcardCache(nodeInterop) {
|
|
48
43
|
if (typeof WeakMap !== "function") return null;
|
|
49
44
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -149,7 +144,7 @@ async function logoutAsync() {
|
|
|
149
144
|
_log.log("Logged out");
|
|
150
145
|
}
|
|
151
146
|
async function fetchUserAsync({ sessionSecret }) {
|
|
152
|
-
const result = await _client.graphqlClient.query((0,
|
|
147
|
+
const result = await _client.graphqlClient.query((0, _core().gql)`
|
|
153
148
|
query UserQuery {
|
|
154
149
|
meUserActor {
|
|
155
150
|
id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api/user/user.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/user/user.ts"],"sourcesContent":["import { gql } from '@urql/core';\nimport { promises as fs } from 'fs';\n\nimport { getAccessToken, getSession, setSessionAsync } from './UserSettings';\nimport { getSessionUsingBrowserAuthFlowAsync } from './expoSsoLauncher';\nimport { CurrentUserQuery } from '../../graphql/generated';\nimport * as Log from '../../log';\nimport { getDevelopmentCodeSigningDirectory } from '../../utils/codesigning';\nimport { env } from '../../utils/env';\nimport { getExpoWebsiteBaseUrl } from '../endpoint';\nimport { graphqlClient } from '../graphql/client';\nimport { UserQuery } from '../graphql/queries/UserQuery';\nimport { fetchAsync } from '../rest/client';\n\nexport type Actor = NonNullable<CurrentUserQuery['meActor']>;\n\nlet currentUser: Actor | undefined;\n\nexport const ANONYMOUS_USERNAME = 'anonymous';\n\n/**\n * Resolve the name of the actor, either normal user or robot user.\n * This should be used whenever the \"current user\" needs to be displayed.\n * The display name CANNOT be used as project owner.\n */\nexport function getActorDisplayName(user?: Actor): string {\n switch (user?.__typename) {\n case 'User':\n return user.username;\n case 'SSOUser':\n return user.username;\n case 'Robot':\n return user.firstName ? `${user.firstName} (robot)` : 'robot';\n default:\n return ANONYMOUS_USERNAME;\n }\n}\n\nexport async function getUserAsync(): Promise<Actor | undefined> {\n const hasCredentials = getAccessToken() || getSession()?.sessionSecret;\n if (!env.EXPO_OFFLINE && !currentUser && hasCredentials) {\n const user = await UserQuery.currentUserAsync();\n currentUser = user ?? undefined;\n }\n return currentUser;\n}\n\nexport async function loginAsync(credentials: {\n username: string;\n password: string;\n otp?: string;\n}): Promise<void> {\n const res = await fetchAsync('auth/loginAsync', {\n method: 'POST',\n body: JSON.stringify(credentials),\n });\n const json: any = await res.json();\n const sessionSecret = json.data.sessionSecret;\n\n const userData = await fetchUserAsync({ sessionSecret });\n\n await setSessionAsync({\n sessionSecret,\n userId: userData.id,\n username: userData.username,\n currentConnection: 'Username-Password-Authentication',\n });\n}\n\nexport async function ssoLoginAsync(): Promise<void> {\n const sessionSecret = await getSessionUsingBrowserAuthFlowAsync({\n expoWebsiteUrl: getExpoWebsiteBaseUrl(),\n });\n const userData = await fetchUserAsync({ sessionSecret });\n\n await setSessionAsync({\n sessionSecret,\n userId: userData.id,\n username: userData.username,\n currentConnection: 'Browser-Flow-Authentication',\n });\n}\n\nexport async function logoutAsync(): Promise<void> {\n currentUser = undefined;\n await Promise.all([\n fs.rm(getDevelopmentCodeSigningDirectory(), { recursive: true, force: true }),\n setSessionAsync(undefined),\n ]);\n Log.log('Logged out');\n}\n\nasync function fetchUserAsync({\n sessionSecret,\n}: {\n sessionSecret: string;\n}): Promise<{ id: string; username: string }> {\n const result = await graphqlClient\n .query(\n gql`\n query UserQuery {\n meUserActor {\n id\n username\n }\n }\n `,\n {},\n {\n fetchOptions: {\n headers: {\n 'expo-session': sessionSecret,\n },\n },\n additionalTypenames: [] /* UserQuery has immutable fields */,\n }\n )\n .toPromise();\n const { data } = result;\n return {\n id: data.meUserActor.id,\n username: data.meUserActor.username,\n };\n}\n"],"names":["ANONYMOUS_USERNAME","getActorDisplayName","getUserAsync","loginAsync","ssoLoginAsync","logoutAsync","currentUser","user","__typename","username","firstName","getSession","hasCredentials","getAccessToken","sessionSecret","env","EXPO_OFFLINE","UserQuery","currentUserAsync","undefined","credentials","res","fetchAsync","method","body","JSON","stringify","json","data","userData","fetchUserAsync","setSessionAsync","userId","id","currentConnection","getSessionUsingBrowserAuthFlowAsync","expoWebsiteUrl","getExpoWebsiteBaseUrl","Promise","all","fs","rm","getDevelopmentCodeSigningDirectory","recursive","force","Log","log","result","graphqlClient","query","gql","fetchOptions","headers","additionalTypenames","toPromise","meUserActor"],"mappings":"AAAA;;;;;;;;;;;IAkBaA,kBAAkB,MAAlBA,kBAAkB;IAOfC,mBAAmB,MAAnBA,mBAAmB;IAabC,YAAY,MAA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YAAkC,mCAAA,GAAE,EAAE;YAAEC,SAAS,EAAE,IAAI;YAAEC,KAAK,EAAE,IAAI;SAAE,CAAC;QAC7Eb,IAAAA,aAAe,gBAAA,EAACZ,SAAS,CAAC;KAC3B,CAAC,CAAC;IACH0B,IAAG,CAACC,GAAG,CAAC,YAAY,CAAC,CAAC;AACxB,CAAC;AAED,eAAehB,cAAc,CAAC,EAC5BhB,aAAa,CAAA,EAGd,EAA6C;IAC5C,MAAMiC,MAAM,GAAG,MAAMC,OAAa,cAAA,CAC/BC,KAAK,CACJC,IAAAA,KAAG,EAAA,IAAA,CAAA,CAAC;;;;;;;MAOJ,CAAC,EACD,EAAE,EACF;QACEC,YAAY,EAAE;YACZC,OAAO,EAAE;gBACP,cAAc,EAAEtC,aAAa;aAC9B;SACF;QACDuC,mBAAmB,EAAE,EAAE;KACxB,CACF,CACAC,SAAS,EAAE,AAAC;IACf,MAAM,EAAE1B,IAAI,CAAA,EAAE,GAAGmB,MAAM,AAAC;IACxB,OAAO;QACLd,EAAE,EAAEL,IAAI,CAAC2B,WAAW,CAACtB,EAAE;QACvBxB,QAAQ,EAAEmB,IAAI,CAAC2B,WAAW,CAAC9C,QAAQ;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -18,28 +18,32 @@ function _interopRequireDefault(obj) {
|
|
|
18
18
|
default: obj
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function createMetadataJson({ bundles , fileNames , embeddedHashSet }) {
|
|
21
|
+
function createMetadataJson({ bundles , fileNames , embeddedHashSet , domComponentAssetsMetadata }) {
|
|
22
22
|
// Build metadata.json
|
|
23
23
|
return {
|
|
24
24
|
version: 0,
|
|
25
25
|
bundler: "metro",
|
|
26
26
|
fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>{
|
|
27
27
|
if (platform === "web") return metadata;
|
|
28
|
+
// Collect all of the assets and convert them to the serial format.
|
|
29
|
+
const assets = bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)).map((asset)=>{
|
|
30
|
+
var // Each asset has multiple hashes which we convert and then flatten.
|
|
31
|
+
ref;
|
|
32
|
+
return (ref = asset.fileHashes) == null ? void 0 : ref.map((hash)=>({
|
|
33
|
+
path: _path().default.join("assets", hash),
|
|
34
|
+
ext: asset.type
|
|
35
|
+
}));
|
|
36
|
+
}).filter(Boolean).flat();
|
|
37
|
+
if ((domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]) != null) {
|
|
38
|
+
assets.push(...domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]);
|
|
39
|
+
}
|
|
28
40
|
return {
|
|
29
41
|
...metadata,
|
|
30
42
|
[platform]: {
|
|
31
43
|
// Get the filename for each platform's bundle.
|
|
32
44
|
// TODO: Add multi-bundle support to EAS Update!!
|
|
33
45
|
bundle: fileNames[platform][0],
|
|
34
|
-
|
|
35
|
-
assets: bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)).map((asset)=>{
|
|
36
|
-
var // Each asset has multiple hashes which we convert and then flatten.
|
|
37
|
-
ref;
|
|
38
|
-
return (ref = asset.fileHashes) == null ? void 0 : ref.map((hash)=>({
|
|
39
|
-
path: _path().default.join("assets", hash),
|
|
40
|
-
ext: asset.type
|
|
41
|
-
}));
|
|
42
|
-
}).filter(Boolean).flat()
|
|
46
|
+
assets
|
|
43
47
|
}
|
|
44
48
|
};
|
|
45
49
|
}, {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\nexport type PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n domComponentAssetsMetadata?: Record<string, PlatformMetadataAsset[]>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n // Collect all of the assets and convert them to the serial format.\n const assets = bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat();\n\n if (domComponentAssetsMetadata?.[platform] != null) {\n assets.push(...domComponentAssetsMetadata?.[platform]);\n }\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform][0],\n assets,\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","domComponentAssetsMetadata","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat","push"],"mappings":"AAAA;;;;+BAcgBA,oBAAkB;;aAAlBA,kBAAkB;;;8DAdjB,MAAM;;;;;;;;;;;AAchB,SAASA,kBAAkB,CAAC,EACjCC,OAAO,CAAA,EACPC,SAAS,CAAA,EACTC,eAAe,CAAA,EACf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A+C;oBAC/C,iDAAiD;oBACjDC,MAAM,EAAEX,SAAS,CAACU,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAC9BE,MAAM;iBACP;aACF,CAAC;QACJ,CAAC,EACD,EAAE,CACH;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -41,13 +41,6 @@ function _assert() {
|
|
|
41
41
|
};
|
|
42
42
|
return data;
|
|
43
43
|
}
|
|
44
|
-
function _crypto() {
|
|
45
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
|
|
46
|
-
_crypto = function() {
|
|
47
|
-
return data;
|
|
48
|
-
};
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
44
|
function _fs() {
|
|
52
45
|
const data = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
53
46
|
_fs = function() {
|
|
@@ -90,13 +83,6 @@ function _path() {
|
|
|
90
83
|
};
|
|
91
84
|
return data;
|
|
92
85
|
}
|
|
93
|
-
function _resolveFrom() {
|
|
94
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("resolve-from"));
|
|
95
|
-
_resolveFrom = function() {
|
|
96
|
-
return data;
|
|
97
|
-
};
|
|
98
|
-
return data;
|
|
99
|
-
}
|
|
100
86
|
const _resolveOptions = require("./resolveOptions");
|
|
101
87
|
const _xcodeCompilerLogger = require("./xcodeCompilerLogger");
|
|
102
88
|
const _log = require("../../log");
|
|
@@ -104,18 +90,20 @@ const _devServerManager = require("../../start/server/DevServerManager");
|
|
|
104
90
|
const _metroBundlerDevServer = require("../../start/server/metro/MetroBundlerDevServer");
|
|
105
91
|
const _instantiateMetro = require("../../start/server/metro/instantiateMetro");
|
|
106
92
|
const _metroPrivateServer = require("../../start/server/metro/metroPrivateServer");
|
|
107
|
-
const _serializeHtml = require("../../start/server/metro/serializeHtml");
|
|
108
93
|
const _domComponentsMiddleware = require("../../start/server/middleware/DomComponentsMiddleware");
|
|
109
94
|
const _metroOptions = require("../../start/server/middleware/metroOptions");
|
|
110
95
|
const _ansi = require("../../utils/ansi");
|
|
111
96
|
const _dir = require("../../utils/dir");
|
|
112
97
|
const _env = require("../../utils/env");
|
|
113
98
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
99
|
+
const _exportDomComponents = require("../exportDomComponents");
|
|
114
100
|
const _exportHermes = require("../exportHermes");
|
|
115
101
|
const _persistMetroAssets = require("../persistMetroAssets");
|
|
116
102
|
const _publicFolder = require("../publicFolder");
|
|
117
103
|
const _saveAssets = require("../saveAssets");
|
|
118
104
|
const _exportServer = require("./exportServer");
|
|
105
|
+
const _exit = require("../../utils/exit");
|
|
106
|
+
const _filePath = require("../../utils/filePath");
|
|
119
107
|
function _interopRequireDefault(obj) {
|
|
120
108
|
return obj && obj.__esModule ? obj : {
|
|
121
109
|
default: obj
|
|
@@ -130,7 +118,9 @@ function guessCopiedAppleBundlePath(bundleOutput) {
|
|
|
130
118
|
}
|
|
131
119
|
const bundleName = _path().default.basename(bundleOutput);
|
|
132
120
|
const bundleParent = _path().default.dirname(bundleOutput);
|
|
133
|
-
const possiblePath = (0, _glob().sync)(
|
|
121
|
+
const possiblePath = (0, _glob().sync)(`*.app/${bundleName}`, {
|
|
122
|
+
cwd: bundleParent,
|
|
123
|
+
absolute: true,
|
|
134
124
|
// bundle identifiers can start with dots.
|
|
135
125
|
dot: true
|
|
136
126
|
})[0];
|
|
@@ -171,7 +161,9 @@ async function exportEmbedAsync(projectRoot, options) {
|
|
|
171
161
|
// TODO: We may want an analytic event here in the future to understand when this happens.
|
|
172
162
|
console.warn("warning: Eager bundle does not match new options, bundling again.");
|
|
173
163
|
}
|
|
174
|
-
|
|
164
|
+
await exportEmbedInternalAsync(projectRoot, options);
|
|
165
|
+
// Ensure the process closes after bundling
|
|
166
|
+
(0, _exit.ensureProcessExitsAfterDelay)();
|
|
175
167
|
}
|
|
176
168
|
async function exportEmbedInternalAsync(projectRoot, options) {
|
|
177
169
|
// Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.
|
|
@@ -236,7 +228,7 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
236
228
|
const bundles = await devServer.nativeExportBundleAsync({
|
|
237
229
|
// TODO: Re-enable when we get bytecode chunk splitting working again.
|
|
238
230
|
splitChunks: false,
|
|
239
|
-
mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),
|
|
231
|
+
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, options.entryFile),
|
|
240
232
|
platform: options.platform,
|
|
241
233
|
minify: options.minify,
|
|
242
234
|
mode: options.dev ? "development" : "production",
|
|
@@ -261,7 +253,33 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
261
253
|
}
|
|
262
254
|
// TODO: Remove duplicates...
|
|
263
255
|
const expoDomComponentReferences = bundles.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
|
|
264
|
-
|
|
256
|
+
if (expoDomComponentReferences.length > 0) {
|
|
257
|
+
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
|
|
258
|
+
expoDomComponentReferences.map(async (filePath)=>{
|
|
259
|
+
const { bundle } = await (0, _exportDomComponents.exportDomComponentAsync)({
|
|
260
|
+
filePath,
|
|
261
|
+
projectRoot,
|
|
262
|
+
dev: options.dev,
|
|
263
|
+
devServer,
|
|
264
|
+
isHermes,
|
|
265
|
+
includeSourceMaps: !!sourceMapUrl,
|
|
266
|
+
exp,
|
|
267
|
+
files
|
|
268
|
+
});
|
|
269
|
+
if (options.assetsDest) {
|
|
270
|
+
// Save assets like a typical bundler, preserving the file paths on web.
|
|
271
|
+
// This is saving web-style inside of a native app's binary.
|
|
272
|
+
await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, bundle.assets.map((asset)=>({
|
|
273
|
+
...asset,
|
|
274
|
+
httpServerLocation: _path().default.join(_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation)
|
|
275
|
+
})), {
|
|
276
|
+
files,
|
|
277
|
+
platform: "web",
|
|
278
|
+
outputDirectory: options.assetsDest
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
265
283
|
return {
|
|
266
284
|
files,
|
|
267
285
|
bundle: {
|
|
@@ -288,70 +306,6 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
288
306
|
devServerManager.stopAsync();
|
|
289
307
|
}
|
|
290
308
|
}
|
|
291
|
-
// TODO(EvanBacon): Move this to expo export in the future when we determine how to support DOM Components with hosting.
|
|
292
|
-
async function exportDomComponentsAsync(projectRoot, expoDomComponentReferences, options, devServer, isHermes, sourceMapUrl, exp, files) {
|
|
293
|
-
if (!expoDomComponentReferences.length) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const virtualEntry = (0, _resolveFrom().default)(projectRoot, "expo/dom/entry.js");
|
|
297
|
-
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
|
|
298
|
-
expoDomComponentReferences.map(async (filePath)=>{
|
|
299
|
-
var ref;
|
|
300
|
-
debug("Bundle DOM Component:", filePath);
|
|
301
|
-
// MUST MATCH THE BABEL PLUGIN!
|
|
302
|
-
const hash = _crypto().default.createHash("sha1").update(filePath).digest("hex");
|
|
303
|
-
const outputName = `${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;
|
|
304
|
-
const generatedEntryPath = filePath.startsWith("file://") ? filePath.slice(7) : filePath;
|
|
305
|
-
const baseUrl = `/${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}`;
|
|
306
|
-
const relativeImport = "./" + _path().default.relative(_path().default.dirname(virtualEntry), generatedEntryPath);
|
|
307
|
-
// Run metro bundler and create the JS bundles/source maps.
|
|
308
|
-
const bundle = await devServer.legacySinglePageExportBundleAsync({
|
|
309
|
-
platform: "web",
|
|
310
|
-
domRoot: encodeURI(relativeImport),
|
|
311
|
-
splitChunks: !_env.env.EXPO_NO_BUNDLE_SPLITTING,
|
|
312
|
-
mainModuleName: resolveRealEntryFilePath(projectRoot, virtualEntry),
|
|
313
|
-
mode: options.dev ? "development" : "production",
|
|
314
|
-
engine: isHermes ? "hermes" : undefined,
|
|
315
|
-
serializerIncludeMaps: !!sourceMapUrl,
|
|
316
|
-
bytecode: false,
|
|
317
|
-
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler),
|
|
318
|
-
baseUrl: "./",
|
|
319
|
-
// Minify may be false because it's skipped on native when Hermes is enabled, default to true.
|
|
320
|
-
minify: true
|
|
321
|
-
});
|
|
322
|
-
const html = await (0, _serializeHtml.serializeHtmlWithAssets)({
|
|
323
|
-
isExporting: true,
|
|
324
|
-
resources: bundle.artifacts,
|
|
325
|
-
template: (0, _domComponentsMiddleware.getDomComponentHtml)(),
|
|
326
|
-
baseUrl: "./"
|
|
327
|
-
});
|
|
328
|
-
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts.map((a)=>{
|
|
329
|
-
return {
|
|
330
|
-
...a,
|
|
331
|
-
filename: _path().default.join(baseUrl, a.filename)
|
|
332
|
-
};
|
|
333
|
-
}), {
|
|
334
|
-
includeSourceMaps: !!sourceMapUrl,
|
|
335
|
-
files,
|
|
336
|
-
platform: "web"
|
|
337
|
-
});
|
|
338
|
-
files.set(outputName, {
|
|
339
|
-
contents: html
|
|
340
|
-
});
|
|
341
|
-
if (options.assetsDest) {
|
|
342
|
-
// Save assets like a typical bundler, preserving the file paths on web.
|
|
343
|
-
// This is saving web-style inside of a native app's binary.
|
|
344
|
-
await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, bundle.assets.map((asset)=>({
|
|
345
|
-
...asset,
|
|
346
|
-
httpServerLocation: _path().default.join(_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation)
|
|
347
|
-
})), {
|
|
348
|
-
files,
|
|
349
|
-
platform: "web",
|
|
350
|
-
outputDirectory: options.assetsDest
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
}));
|
|
354
|
-
}
|
|
355
309
|
async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
356
310
|
const exp = (0, _config().getConfig)(projectRoot, {
|
|
357
311
|
skipSDKVersionRequirement: true
|
|
@@ -380,7 +334,7 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
|
380
334
|
..._server().default.DEFAULT_BUNDLE_OPTIONS,
|
|
381
335
|
...(0, _metroOptions.getMetroDirectBundleOptionsForExpoConfig)(projectRoot, exp, {
|
|
382
336
|
splitChunks: false,
|
|
383
|
-
mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),
|
|
337
|
+
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, options.entryFile),
|
|
384
338
|
platform: options.platform,
|
|
385
339
|
minify: options.minify,
|
|
386
340
|
mode: options.dev ? "development" : "production",
|
|
@@ -442,16 +396,5 @@ async function exportEmbedAssetsAsync(server, bundleRequest, projectRoot, option
|
|
|
442
396
|
function isError(error) {
|
|
443
397
|
return error instanceof Error;
|
|
444
398
|
}
|
|
445
|
-
/**
|
|
446
|
-
* This is a workaround for Metro not resolving entry file paths to their real location.
|
|
447
|
-
* When running exports through `eas build --local` on macOS, the `/var/folders` path is used instead of `/private/var/folders`.
|
|
448
|
-
*
|
|
449
|
-
* See: https://github.com/expo/expo/issues/28890
|
|
450
|
-
*/ function resolveRealEntryFilePath(projectRoot, entryFile) {
|
|
451
|
-
if (projectRoot.startsWith("/private/var") && entryFile.startsWith("/var")) {
|
|
452
|
-
return _fs().default.realpathSync(entryFile);
|
|
453
|
-
}
|
|
454
|
-
return entryFile;
|
|
455
|
-
}
|
|
456
399
|
|
|
457
400
|
//# sourceMappingURL=exportEmbedAsync.js.map
|