@expo/config 7.0.3 → 8.0.1

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.
Files changed (49) hide show
  1. package/build/Config.d.ts +1 -13
  2. package/build/Config.js +49 -369
  3. package/build/Config.js.map +1 -1
  4. package/build/Config.types.d.ts +18 -21
  5. package/build/Config.types.js +0 -5
  6. package/build/Config.types.js.map +1 -1
  7. package/build/Errors.js +3 -7
  8. package/build/Errors.js.map +1 -1
  9. package/build/Serialize.js +4 -24
  10. package/build/Serialize.js.map +1 -1
  11. package/build/evalConfig.d.ts +2 -2
  12. package/build/evalConfig.js +12 -44
  13. package/build/evalConfig.js.map +1 -1
  14. package/build/getAccountUsername.d.ts +9 -0
  15. package/build/{getFullName.js → getAccountUsername.js} +8 -21
  16. package/build/getAccountUsername.js.map +1 -0
  17. package/build/getConfig.js +2 -23
  18. package/build/getConfig.js.map +1 -1
  19. package/build/getExpoSDKVersion.d.ts +6 -0
  20. package/build/getExpoSDKVersion.js +60 -0
  21. package/build/getExpoSDKVersion.js.map +1 -0
  22. package/build/getUserState.d.ts +3 -3
  23. package/build/getUserState.js +0 -20
  24. package/build/getUserState.js.map +1 -1
  25. package/build/index.d.ts +2 -2
  26. package/build/index.js +8 -19
  27. package/build/index.js.map +1 -1
  28. package/build/paths/extensions.d.ts +1 -2
  29. package/build/paths/extensions.js +8 -35
  30. package/build/paths/extensions.js.map +1 -1
  31. package/build/paths/index.js +0 -4
  32. package/build/paths/index.js.map +1 -1
  33. package/build/paths/paths.js +37 -67
  34. package/build/paths/paths.js.map +1 -1
  35. package/build/plugins/withConfigPlugins.js +2 -13
  36. package/build/plugins/withConfigPlugins.js.map +1 -1
  37. package/build/plugins/withInternal.js +1 -8
  38. package/build/plugins/withInternal.js.map +1 -1
  39. package/build/resolvePackageJson.js +1 -21
  40. package/build/resolvePackageJson.js.map +1 -1
  41. package/package.json +5 -5
  42. package/build/Project.d.ts +0 -2
  43. package/build/Project.js +0 -64
  44. package/build/Project.js.map +0 -1
  45. package/build/getFullName.d.ts +0 -10
  46. package/build/getFullName.js.map +0 -1
  47. package/build/isLegacyImportsEnabled.d.ts +0 -7
  48. package/build/isLegacyImportsEnabled.js +0 -61
  49. package/build/isLegacyImportsEnabled.js.map +0 -1
@@ -5,59 +5,42 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.evalConfig = evalConfig;
7
7
  exports.resolveConfigExport = resolveConfigExport;
8
-
9
8
  function _fs() {
10
9
  const data = require("fs");
11
-
12
10
  _fs = function () {
13
11
  return data;
14
12
  };
15
-
16
13
  return data;
17
14
  }
18
-
19
15
  function _requireFromString() {
20
16
  const data = _interopRequireDefault(require("require-from-string"));
21
-
22
17
  _requireFromString = function () {
23
18
  return data;
24
19
  };
25
-
26
20
  return data;
27
21
  }
28
-
29
22
  function _sucrase() {
30
23
  const data = require("sucrase");
31
-
32
24
  _sucrase = function () {
33
25
  return data;
34
26
  };
35
-
36
27
  return data;
37
28
  }
38
-
39
29
  function _Errors() {
40
30
  const data = require("./Errors");
41
-
42
31
  _Errors = function () {
43
32
  return data;
44
33
  };
45
-
46
34
  return data;
47
35
  }
48
-
49
36
  function _Serialize() {
50
37
  const data = require("./Serialize");
51
-
52
38
  _Serialize = function () {
53
39
  return data;
54
40
  };
55
-
56
41
  return data;
57
42
  }
58
-
59
43
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
60
-
61
44
  /**
62
45
  * Transpile and evaluate the dynamic config object.
63
46
  * This method is shared between the standard reading method in getConfig, and the headless script.
@@ -68,7 +51,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
68
51
  function evalConfig(configFile, request) {
69
52
  const contents = (0, _fs().readFileSync)(configFile, 'utf8');
70
53
  let result;
71
-
72
54
  try {
73
55
  const {
74
56
  code
@@ -78,13 +60,13 @@ function evalConfig(configFile, request) {
78
60
  });
79
61
  result = (0, _requireFromString().default)(code, configFile);
80
62
  } catch (error) {
81
- const location = extractLocationFromSyntaxError(error); // Apply a code frame preview to the error if possible, sucrase doesn't do this by default.
63
+ const location = extractLocationFromSyntaxError(error);
82
64
 
65
+ // Apply a code frame preview to the error if possible, sucrase doesn't do this by default.
83
66
  if (location) {
84
67
  const {
85
68
  codeFrameColumns
86
69
  } = require('@babel/code-frame');
87
-
88
70
  const codeFrame = codeFrameColumns(contents, {
89
71
  start: error.loc
90
72
  }, {
@@ -94,57 +76,50 @@ function evalConfig(configFile, request) {
94
76
  error.message += `\n${codeFrame}`;
95
77
  } else {
96
78
  const importantStack = extractImportantStackFromNodeError(error);
97
-
98
79
  if (importantStack) {
99
80
  error.message += `\n${importantStack}`;
100
81
  }
101
82
  }
102
-
103
83
  throw error;
104
84
  }
105
-
106
85
  return resolveConfigExport(result, configFile, request);
107
86
  }
108
-
109
87
  function extractLocationFromSyntaxError(error) {
110
88
  // sucrase provides the `loc` object
111
89
  if (error.loc) {
112
90
  return error.loc;
113
- } // `SyntaxError`s provide the `lineNumber` and `columnNumber` properties
114
-
91
+ }
115
92
 
93
+ // `SyntaxError`s provide the `lineNumber` and `columnNumber` properties
116
94
  if ('lineNumber' in error && 'columnNumber' in error) {
117
95
  return {
118
96
  line: error.lineNumber,
119
97
  column: error.columnNumber
120
98
  };
121
99
  }
122
-
123
100
  return null;
124
- } // These kinda errors often come from syntax errors in files that were imported by the main file.
125
- // An example is a module that includes an import statement.
126
-
101
+ }
127
102
 
103
+ // These kinda errors often come from syntax errors in files that were imported by the main file.
104
+ // An example is a module that includes an import statement.
128
105
  function extractImportantStackFromNodeError(error) {
129
106
  if (isSyntaxError(error)) {
130
107
  var _error$stack;
131
-
132
108
  const traces = (_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : _error$stack.split('\n').filter(line => !line.startsWith(' at '));
133
- if (!traces) return null; // Remove redundant line
109
+ if (!traces) return null;
134
110
 
111
+ // Remove redundant line
135
112
  if (traces[traces.length - 1].startsWith('SyntaxError:')) {
136
113
  traces.pop();
137
114
  }
138
-
139
115
  return traces.join('\n');
140
116
  }
141
-
142
117
  return null;
143
118
  }
144
-
145
119
  function isSyntaxError(error) {
146
120
  return error instanceof SyntaxError || error.constructor.name === 'SyntaxError';
147
121
  }
122
+
148
123
  /**
149
124
  * - Resolve the exported contents of an Expo config (be it default or module.exports)
150
125
  * - Assert no promise exports
@@ -155,32 +130,25 @@ function isSyntaxError(error) {
155
130
  * @param configFile
156
131
  * @param request
157
132
  */
158
-
159
-
160
133
  function resolveConfigExport(result, configFile, request) {
161
134
  var _result;
162
-
163
135
  if (result.default != null) {
164
136
  result = result.default;
165
137
  }
166
-
167
138
  const exportedObjectType = typeof result;
168
-
169
139
  if (typeof result === 'function') {
170
140
  result = result(request);
171
141
  }
172
-
173
142
  if (result instanceof Promise) {
174
143
  throw new (_Errors().ConfigError)(`Config file ${configFile} cannot return a Promise.`, 'INVALID_CONFIG');
175
- } // If the expo object exists, ignore all other values.
176
-
144
+ }
177
145
 
146
+ // If the expo object exists, ignore all other values.
178
147
  if ((_result = result) !== null && _result !== void 0 && _result.expo) {
179
148
  result = (0, _Serialize().serializeSkippingMods)(result.expo);
180
149
  } else {
181
150
  result = (0, _Serialize().serializeSkippingMods)(result);
182
151
  }
183
-
184
152
  return {
185
153
  config: result,
186
154
  exportedObjectType
@@ -1 +1 @@
1
- {"version":3,"file":"evalConfig.js","names":["evalConfig","configFile","request","contents","readFileSync","result","code","transform","filePath","transforms","requireString","error","location","extractLocationFromSyntaxError","codeFrameColumns","require","codeFrame","start","loc","highlightCode","message","importantStack","extractImportantStackFromNodeError","resolveConfigExport","line","lineNumber","column","columnNumber","isSyntaxError","traces","stack","split","filter","startsWith","length","pop","join","SyntaxError","constructor","name","default","exportedObjectType","Promise","ConfigError","expo","serializeSkippingMods","config"],"sources":["../src/evalConfig.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport requireString from 'require-from-string';\nimport { transform } from 'sucrase';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { serializeSkippingMods } from './Serialize';\n\ntype RawDynamicConfig = AppJSONConfig | Partial<ExpoConfig> | null;\n\nexport type DynamicConfigResults = { config: RawDynamicConfig; exportedObjectType: string };\n\n/**\n * Transpile and evaluate the dynamic config object.\n * This method is shared between the standard reading method in getConfig, and the headless script.\n *\n * @param options configFile path to the dynamic app.config.*, request to send to the dynamic config if it exports a function.\n * @returns the serialized and evaluated config along with the exported object type (object or function).\n */\nexport function evalConfig(\n configFile: string,\n request: ConfigContext | null\n): DynamicConfigResults {\n const contents = readFileSync(configFile, 'utf8');\n let result: any;\n try {\n const { code } = transform(contents, {\n filePath: configFile,\n transforms: ['typescript', 'imports'],\n });\n\n result = requireString(code, configFile);\n } catch (error: any) {\n const location = extractLocationFromSyntaxError(error);\n\n // Apply a code frame preview to the error if possible, sucrase doesn't do this by default.\n if (location) {\n const { codeFrameColumns } = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(contents, { start: error.loc }, { highlightCode: true });\n error.codeFrame = codeFrame;\n error.message += `\\n${codeFrame}`;\n } else {\n const importantStack = extractImportantStackFromNodeError(error);\n\n if (importantStack) {\n error.message += `\\n${importantStack}`;\n }\n }\n throw error;\n }\n return resolveConfigExport(result, configFile, request);\n}\n\nfunction extractLocationFromSyntaxError(\n error: Error | any\n): { line: number; column?: number } | null {\n // sucrase provides the `loc` object\n if (error.loc) {\n return error.loc;\n }\n\n // `SyntaxError`s provide the `lineNumber` and `columnNumber` properties\n if ('lineNumber' in error && 'columnNumber' in error) {\n return { line: error.lineNumber, column: error.columnNumber };\n }\n\n return null;\n}\n\n// These kinda errors often come from syntax errors in files that were imported by the main file.\n// An example is a module that includes an import statement.\nfunction extractImportantStackFromNodeError(error: any): string | null {\n if (isSyntaxError(error)) {\n const traces = error.stack?.split('\\n').filter((line) => !line.startsWith(' at '));\n if (!traces) return null;\n\n // Remove redundant line\n if (traces[traces.length - 1].startsWith('SyntaxError:')) {\n traces.pop();\n }\n return traces.join('\\n');\n }\n return null;\n}\n\nfunction isSyntaxError(error: any): error is SyntaxError {\n return error instanceof SyntaxError || error.constructor.name === 'SyntaxError';\n}\n\n/**\n * - Resolve the exported contents of an Expo config (be it default or module.exports)\n * - Assert no promise exports\n * - Return config type\n * - Serialize config\n *\n * @param result\n * @param configFile\n * @param request\n */\nexport function resolveConfigExport(\n result: any,\n configFile: string,\n request: ConfigContext | null\n) {\n if (result.default != null) {\n result = result.default;\n }\n const exportedObjectType = typeof result;\n if (typeof result === 'function') {\n result = result(request);\n }\n\n if (result instanceof Promise) {\n throw new ConfigError(`Config file ${configFile} cannot return a Promise.`, 'INVALID_CONFIG');\n }\n\n // If the expo object exists, ignore all other values.\n if (result?.expo) {\n result = serializeSkippingMods(result.expo);\n } else {\n result = serializeSkippingMods(result);\n }\n\n return { config: result, exportedObjectType };\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,CACLC,UADK,EAELC,OAFK,EAGiB;EACtB,MAAMC,QAAQ,GAAG,IAAAC,kBAAA,EAAaH,UAAb,EAAyB,MAAzB,CAAjB;EACA,IAAII,MAAJ;;EACA,IAAI;IACF,MAAM;MAAEC;IAAF,IAAW,IAAAC,oBAAA,EAAUJ,QAAV,EAAoB;MACnCK,QAAQ,EAAEP,UADyB;MAEnCQ,UAAU,EAAE,CAAC,YAAD,EAAe,SAAf;IAFuB,CAApB,CAAjB;IAKAJ,MAAM,GAAG,IAAAK,4BAAA,EAAcJ,IAAd,EAAoBL,UAApB,CAAT;EACD,CAPD,CAOE,OAAOU,KAAP,EAAm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js","names":["evalConfig","configFile","request","contents","readFileSync","result","code","transform","filePath","transforms","requireString","error","location","extractLocationFromSyntaxError","codeFrameColumns","require","codeFrame","start","loc","highlightCode","message","importantStack","extractImportantStackFromNodeError","resolveConfigExport","line","lineNumber","column","columnNumber","isSyntaxError","traces","stack","split","filter","startsWith","length","pop","join","SyntaxError","constructor","name","default","exportedObjectType","Promise","ConfigError","expo","serializeSkippingMods","config"],"sources":["../src/evalConfig.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport requireString from 'require-from-string';\nimport { transform } from 'sucrase';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { serializeSkippingMods } from './Serialize';\n\ntype RawDynamicConfig = AppJSONConfig | Partial<ExpoConfig> | null;\n\nexport type DynamicConfigResults = { config: RawDynamicConfig; exportedObjectType: string };\n\n/**\n * Transpile and evaluate the dynamic config object.\n * This method is shared between the standard reading method in getConfig, and the headless script.\n *\n * @param options configFile path to the dynamic app.config.*, request to send to the dynamic config if it exports a function.\n * @returns the serialized and evaluated config along with the exported object type (object or function).\n */\nexport function evalConfig(\n configFile: string,\n request: ConfigContext | null\n): DynamicConfigResults {\n const contents = readFileSync(configFile, 'utf8');\n let result: any;\n try {\n const { code } = transform(contents, {\n filePath: configFile,\n transforms: ['typescript', 'imports'],\n });\n\n result = requireString(code, configFile);\n } catch (error: any) {\n const location = extractLocationFromSyntaxError(error);\n\n // Apply a code frame preview to the error if possible, sucrase doesn't do this by default.\n if (location) {\n const { codeFrameColumns } = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(contents, { start: error.loc }, { highlightCode: true });\n error.codeFrame = codeFrame;\n error.message += `\\n${codeFrame}`;\n } else {\n const importantStack = extractImportantStackFromNodeError(error);\n\n if (importantStack) {\n error.message += `\\n${importantStack}`;\n }\n }\n throw error;\n }\n return resolveConfigExport(result, configFile, request);\n}\n\nfunction extractLocationFromSyntaxError(\n error: Error | any\n): { line: number; column?: number } | null {\n // sucrase provides the `loc` object\n if (error.loc) {\n return error.loc;\n }\n\n // `SyntaxError`s provide the `lineNumber` and `columnNumber` properties\n if ('lineNumber' in error && 'columnNumber' in error) {\n return { line: error.lineNumber, column: error.columnNumber };\n }\n\n return null;\n}\n\n// These kinda errors often come from syntax errors in files that were imported by the main file.\n// An example is a module that includes an import statement.\nfunction extractImportantStackFromNodeError(error: any): string | null {\n if (isSyntaxError(error)) {\n const traces = error.stack?.split('\\n').filter((line) => !line.startsWith(' at '));\n if (!traces) return null;\n\n // Remove redundant line\n if (traces[traces.length - 1].startsWith('SyntaxError:')) {\n traces.pop();\n }\n return traces.join('\\n');\n }\n return null;\n}\n\nfunction isSyntaxError(error: any): error is SyntaxError {\n return error instanceof SyntaxError || error.constructor.name === 'SyntaxError';\n}\n\n/**\n * - Resolve the exported contents of an Expo config (be it default or module.exports)\n * - Assert no promise exports\n * - Return config type\n * - Serialize config\n *\n * @param result\n * @param configFile\n * @param request\n */\nexport function resolveConfigExport(\n result: any,\n configFile: string,\n request: ConfigContext | null\n) {\n if (result.default != null) {\n result = result.default;\n }\n const exportedObjectType = typeof result;\n if (typeof result === 'function') {\n result = result(request);\n }\n\n if (result instanceof Promise) {\n throw new ConfigError(`Config file ${configFile} cannot return a Promise.`, 'INVALID_CONFIG');\n }\n\n // If the expo object exists, ignore all other values.\n if (result?.expo) {\n result = serializeSkippingMods(result.expo);\n } else {\n result = serializeSkippingMods(result);\n }\n\n return { config: result, exportedObjectType };\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoD;AAMpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAU,CACxBC,UAAkB,EAClBC,OAA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AAC;EAC/F;;EAEA;EACA,eAAII,MAAM,oCAAN,QAAQuC,IAAI,EAAE;IAChBvC,MAAM,GAAG,IAAAwC,kCAAqB,EAACxC,MAAM,CAACuC,IAAI,CAAC;EAC7C,CAAC,MAAM;IACLvC,MAAM,GAAG,IAAAwC,kCAAqB,EAACxC,MAAM,CAAC;EACxC;EAEA,OAAO;IAAEyC,MAAM,EAAEzC,MAAM;IAAEoC;EAAmB,CAAC;AAC/C"}
@@ -0,0 +1,9 @@
1
+ import { ExpoConfig } from '@expo/config-types';
2
+ /**
3
+ * Get the owner of the project from the manifest if specified, falling back to a bunch of different things
4
+ * which may or may not be the owner of the project.
5
+ *
6
+ * @deprecated This may not actually be the owner of the project. Prefer to fetch the project owner using
7
+ * the EAS project ID, falling back to the `owner` field.
8
+ */
9
+ export declare function getAccountUsername(manifest?: Pick<ExpoConfig, 'owner'>): string;
@@ -4,43 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getAccountUsername = getAccountUsername;
7
- exports.getFullName = getFullName;
8
-
9
7
  function _getUserState() {
10
8
  const data = require("./getUserState");
11
-
12
9
  _getUserState = function () {
13
10
  return data;
14
11
  };
15
-
16
12
  return data;
17
13
  }
18
-
19
14
  const ANONYMOUS_USERNAME = 'anonymous';
15
+
20
16
  /**
21
- * Used in expo-constants to generate the `id` property statically for an app in custom managed workflow.
22
- * This `id` is used for legacy Expo services AuthSession proxy and Expo notifications device ID.
17
+ * Get the owner of the project from the manifest if specified, falling back to a bunch of different things
18
+ * which may or may not be the owner of the project.
23
19
  *
24
- * @param manifest
25
- * @returns
20
+ * @deprecated This may not actually be the owner of the project. Prefer to fetch the project owner using
21
+ * the EAS project ID, falling back to the `owner` field.
26
22
  */
27
-
28
- function getFullName(manifest) {
29
- const username = getAccountUsername(manifest);
30
- return `@${username}/${manifest.slug}`;
31
- }
32
-
33
23
  function getAccountUsername(manifest = {}) {
34
24
  var _getUserState$read$au;
35
-
36
25
  // TODO: Must match what's generated in Expo Go.
37
26
  const username = manifest.owner || process.env.EXPO_CLI_USERNAME || process.env.EAS_BUILD_USERNAME;
38
-
39
27
  if (username) {
40
28
  return username;
41
- } // Statically get the username from the global user state.
42
-
43
-
29
+ }
30
+ // Statically get the username from the global user state.
44
31
  return ((_getUserState$read$au = (0, _getUserState().getUserState)().read().auth) === null || _getUserState$read$au === void 0 ? void 0 : _getUserState$read$au.username) || ANONYMOUS_USERNAME;
45
32
  }
46
- //# sourceMappingURL=getFullName.js.map
33
+ //# sourceMappingURL=getAccountUsername.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccountUsername.js","names":["ANONYMOUS_USERNAME","getAccountUsername","manifest","username","owner","process","env","EXPO_CLI_USERNAME","EAS_BUILD_USERNAME","getUserState","read","auth"],"sources":["../src/getAccountUsername.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { getUserState } from './getUserState';\n\nconst ANONYMOUS_USERNAME = 'anonymous';\n\n/**\n * Get the owner of the project from the manifest if specified, falling back to a bunch of different things\n * which may or may not be the owner of the project.\n *\n * @deprecated This may not actually be the owner of the project. Prefer to fetch the project owner using\n * the EAS project ID, falling back to the `owner` field.\n */\nexport function getAccountUsername(manifest: Pick<ExpoConfig, 'owner'> = {}): string {\n // TODO: Must match what's generated in Expo Go.\n const username =\n manifest.owner || process.env.EXPO_CLI_USERNAME || process.env.EAS_BUILD_USERNAME;\n if (username) {\n return username;\n }\n // Statically get the username from the global user state.\n return getUserState().read().auth?.username || ANONYMOUS_USERNAME;\n}\n"],"mappings":";;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,kBAAkB,GAAG,WAAW;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkB,CAACC,QAAmC,GAAG,CAAC,CAAC,EAAU;EAAA;EACnF;EACA,MAAMC,QAAQ,GACZD,QAAQ,CAACE,KAAK,IAAIC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAIF,OAAO,CAACC,GAAG,CAACE,kBAAkB;EACnF,IAAIL,QAAQ,EAAE;IACZ,OAAOA,QAAQ;EACjB;EACA;EACA,OAAO,8BAAAM,4BAAY,GAAE,CAACC,IAAI,EAAE,CAACC,IAAI,0DAA1B,sBAA4BR,QAAQ,KAAIH,kBAAkB;AACnE"}
@@ -5,49 +5,35 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getDynamicConfig = getDynamicConfig;
7
7
  exports.getStaticConfig = getStaticConfig;
8
-
9
8
  function _jsonFile() {
10
9
  const data = _interopRequireDefault(require("@expo/json-file"));
11
-
12
10
  _jsonFile = function () {
13
11
  return data;
14
12
  };
15
-
16
13
  return data;
17
14
  }
18
-
19
15
  function _fs() {
20
16
  const data = require("fs");
21
-
22
17
  _fs = function () {
23
18
  return data;
24
19
  };
25
-
26
20
  return data;
27
21
  }
28
-
29
22
  function _Errors() {
30
23
  const data = require("./Errors");
31
-
32
24
  _Errors = function () {
33
25
  return data;
34
26
  };
35
-
36
27
  return data;
37
28
  }
38
-
39
29
  function _evalConfig() {
40
30
  const data = require("./evalConfig");
41
-
42
31
  _evalConfig = function () {
43
32
  return data;
44
33
  };
45
-
46
34
  return data;
47
35
  }
48
-
49
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
-
51
37
  // We cannot use async config resolution right now because Next.js doesn't support async configs.
52
38
  // If they don't add support for async Webpack configs then we may need to pull support for Next.js.
53
39
  function readConfigFile(configFile, context) {
@@ -55,7 +41,6 @@ function readConfigFile(configFile, context) {
55
41
  if (!(0, _fs().existsSync)(configFile)) {
56
42
  return null;
57
43
  }
58
-
59
44
  try {
60
45
  return (0, _evalConfig().evalConfig)(configFile, context);
61
46
  } catch (error) {
@@ -65,29 +50,23 @@ function readConfigFile(configFile, context) {
65
50
  throw error;
66
51
  }
67
52
  }
68
-
69
53
  function getDynamicConfig(configPath, request) {
70
54
  const config = readConfigFile(configPath, request);
71
-
72
55
  if (config) {
73
56
  // The config must be serialized and evaluated ahead of time so the spawned process can send it over.
74
57
  return config;
75
- } // TODO: It seems this is only thrown if the file cannot be found (which may never happen).
58
+ }
59
+ // TODO: It seems this is only thrown if the file cannot be found (which may never happen).
76
60
  // If so we should throw a more helpful error.
77
-
78
-
79
61
  throw new (_Errors().ConfigError)(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');
80
62
  }
81
-
82
63
  function getStaticConfig(configPath) {
83
64
  const config = _jsonFile().default.read(configPath, {
84
65
  json5: true
85
66
  });
86
-
87
67
  if (config) {
88
68
  return config;
89
69
  }
90
-
91
70
  throw new (_Errors().ConfigError)(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');
92
71
  }
93
72
  //# sourceMappingURL=getConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfig.js","names":["readConfigFile","configFile","context","existsSync","evalConfig","error","isConfigError","message","getDynamicConfig","configPath","request","config","ConfigError","getStaticConfig","JsonFile","read","json5"],"sources":["../src/getConfig.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport { existsSync } from 'fs';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { DynamicConfigResults, evalConfig } from './evalConfig';\n\n// We cannot use async config resolution right now because Next.js doesn't support async configs.\n// If they don't add support for async Webpack configs then we may need to pull support for Next.js.\nfunction readConfigFile(configFile: string, context: ConfigContext): null | DynamicConfigResults {\n // If the file doesn't exist then we should skip it and continue searching.\n if (!existsSync(configFile)) {\n return null;\n }\n try {\n return evalConfig(configFile, context);\n } catch (error: any) {\n // @ts-ignore\n error.isConfigError = true;\n error.message = `Error reading Expo config at ${configFile}:\\n\\n${error.message}`;\n throw error;\n }\n}\n\nexport function getDynamicConfig(configPath: string, request: ConfigContext): DynamicConfigResults {\n const config = readConfigFile(configPath, request);\n if (config) {\n // The config must be serialized and evaluated ahead of time so the spawned process can send it over.\n return config;\n }\n // TODO: It seems this is only thrown if the file cannot be found (which may never happen).\n // If so we should throw a more helpful error.\n throw new ConfigError(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');\n}\n\nexport function getStaticConfig(configPath: string): AppJSONConfig | ExpoConfig {\n const config = JsonFile.read(configPath, { json5: true });\n if (config) {\n return config as any;\n }\n throw new ConfigError(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AAEA;AACA;AACA,SAASA,cAAT,CAAwBC,UAAxB,EAA4CC,OAA5C,EAAiG;EAC/F;EACA,IAAI,CAAC,IAAAC,gBAAA,EAAWF,UAAX,CAAL,EAA6B;IAC3B,OAAO,IAAP;EACD;;EACD,IAAI;IACF,OAAO,IAAAG,wBAAA,EAAWH,UAAX,EAAuBC,OAAvB,CAAP;EACD,CAFD,CAEE,OAAOG,KAAP,EAAmB;IACnB;IACAA,KAAK,CAACC,aAAN,GAAsB,IAAtB;IACAD,KAAK,CAACE,OAAN,GAAiB,gCAA+BN,UAAW,QAAOI,KAAK,CAACE,OAAQ,EAAhF;IACA,MAAMF,KAAN;EACD;AACF;;AAEM,SAASG,gBAAT,CAA0BC,UAA1B,EAA8CC,OAA9C,EAA4F;EACjG,MAAMC,MAAM,GAAGX,cAAc,CAACS,UAAD,EAAaC,OAAb,CAA7B;;EACA,IAAIC,MAAJ,EAAY;IACV;IACA,OAAOA,MAAP;EACD,CALgG,CAMjG;EACA;;;EACA,MAAM,KAAIC,qBAAJ,EAAiB,6BAA4BH,UAAW,EAAxD,EAA2D,gBAA3D,CAAN;AACD;;AAEM,SAASI,eAAT,CAAyBJ,UAAzB,EAAyE;EAC9E,MAAME,MAAM,GAAGG,mBAAA,CAASC,IAAT,CAAcN,UAAd,EAA0B;IAAEO,KAAK,EAAE;EAAT,CAA1B,CAAf;;EACA,IAAIL,MAAJ,EAAY;IACV,OAAOA,MAAP;EACD;;EACD,MAAM,KAAIC,qBAAJ,EAAiB,6BAA4BH,UAAW,EAAxD,EAA2D,gBAA3D,CAAN;AACD"}
1
+ {"version":3,"file":"getConfig.js","names":["readConfigFile","configFile","context","existsSync","evalConfig","error","isConfigError","message","getDynamicConfig","configPath","request","config","ConfigError","getStaticConfig","JsonFile","read","json5"],"sources":["../src/getConfig.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport { existsSync } from 'fs';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { DynamicConfigResults, evalConfig } from './evalConfig';\n\n// We cannot use async config resolution right now because Next.js doesn't support async configs.\n// If they don't add support for async Webpack configs then we may need to pull support for Next.js.\nfunction readConfigFile(configFile: string, context: ConfigContext): null | DynamicConfigResults {\n // If the file doesn't exist then we should skip it and continue searching.\n if (!existsSync(configFile)) {\n return null;\n }\n try {\n return evalConfig(configFile, context);\n } catch (error: any) {\n // @ts-ignore\n error.isConfigError = true;\n error.message = `Error reading Expo config at ${configFile}:\\n\\n${error.message}`;\n throw error;\n }\n}\n\nexport function getDynamicConfig(configPath: string, request: ConfigContext): DynamicConfigResults {\n const config = readConfigFile(configPath, request);\n if (config) {\n // The config must be serialized and evaluated ahead of time so the spawned process can send it over.\n return config;\n }\n // TODO: It seems this is only thrown if the file cannot be found (which may never happen).\n // If so we should throw a more helpful error.\n throw new ConfigError(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');\n}\n\nexport function getStaticConfig(configPath: string): AppJSONConfig | ExpoConfig {\n const config = JsonFile.read(configPath, { json5: true });\n if (config) {\n return config as any;\n }\n throw new ConfigError(`Failed to read config at: ${configPath}`, 'INVALID_CONFIG');\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAgE;AAEhE;AACA;AACA,SAASA,cAAc,CAACC,UAAkB,EAAEC,OAAsB,EAA+B;EAC/F;EACA,IAAI,CAAC,IAAAC,gBAAU,EAACF,UAAU,CAAC,EAAE;IAC3B,OAAO,IAAI;EACb;EACA,IAAI;IACF,OAAO,IAAAG,wBAAU,EAACH,UAAU,EAAEC,OAAO,CAAC;EACxC,CAAC,CAAC,OAAOG,KAAU,EAAE;IACnB;IACAA,KAAK,CAACC,aAAa,GAAG,IAAI;IAC1BD,KAAK,CAACE,OAAO,GAAI,gCAA+BN,UAAW,QAAOI,KAAK,CAACE,OAAQ,EAAC;IACjF,MAAMF,KAAK;EACb;AACF;AAEO,SAASG,gBAAgB,CAACC,UAAkB,EAAEC,OAAsB,EAAwB;EACjG,MAAMC,MAAM,GAAGX,cAAc,CAACS,UAAU,EAAEC,OAAO,CAAC;EAClD,IAAIC,MAAM,EAAE;IACV;IACA,OAAOA,MAAM;EACf;EACA;EACA;EACA,MAAM,KAAIC,qBAAW,EAAE,6BAA4BH,UAAW,EAAC,EAAE,gBAAgB,CAAC;AACpF;AAEO,SAASI,eAAe,CAACJ,UAAkB,EAA8B;EAC9E,MAAME,MAAM,GAAGG,mBAAQ,CAACC,IAAI,CAACN,UAAU,EAAE;IAAEO,KAAK,EAAE;EAAK,CAAC,CAAC;EACzD,IAAIL,MAAM,EAAE;IACV,OAAOA,MAAM;EACf;EACA,MAAM,KAAIC,qBAAW,EAAE,6BAA4BH,UAAW,EAAC,EAAE,gBAAgB,CAAC;AACpF"}
@@ -0,0 +1,6 @@
1
+ import { ExpoConfig } from './Config.types';
2
+ /**
3
+ * Resolve the Expo SDK Version either from the input Expo config or from the installed
4
+ * version of the `expo` package.
5
+ */
6
+ export declare function getExpoSDKVersion(projectRoot: string, exp?: Pick<ExpoConfig, 'sdkVersion'>): string;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getExpoSDKVersion = getExpoSDKVersion;
7
+ function _jsonFile() {
8
+ const data = _interopRequireDefault(require("@expo/json-file"));
9
+ _jsonFile = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _resolveFrom() {
15
+ const data = _interopRequireDefault(require("resolve-from"));
16
+ _resolveFrom = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _Errors() {
22
+ const data = require("./Errors");
23
+ _Errors = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+ /**
30
+ * Resolve the Expo SDK Version either from the input Expo config or from the installed
31
+ * version of the `expo` package.
32
+ */
33
+ function getExpoSDKVersion(projectRoot, exp = {}) {
34
+ var _exp$sdkVersion;
35
+ return (_exp$sdkVersion = exp === null || exp === void 0 ? void 0 : exp.sdkVersion) !== null && _exp$sdkVersion !== void 0 ? _exp$sdkVersion : getExpoSDKVersionFromPackage(projectRoot);
36
+ }
37
+
38
+ /**
39
+ * Resolve the Expo SDK Version either from the input Expo config or from the installed
40
+ * version of the `expo` package.
41
+ */
42
+ function getExpoSDKVersionFromPackage(projectRoot) {
43
+ const packageJsonPath = _resolveFrom().default.silent(projectRoot, 'expo/package.json');
44
+ if (!packageJsonPath) {
45
+ throw new (_Errors().ConfigError)(`Cannot determine which native SDK version your project uses because the module \`expo\` is not installed. Please install it with \`yarn add expo\` and try again.`, 'MODULE_NOT_FOUND');
46
+ }
47
+ const expoPackageJson = _jsonFile().default.read(packageJsonPath, {
48
+ json5: true
49
+ });
50
+ const {
51
+ version: packageVersion
52
+ } = expoPackageJson;
53
+ if (!(typeof packageVersion === 'string')) {
54
+ // This is technically impossible.
55
+ throw new (_Errors().ConfigError)(`Cannot determine which native SDK version your project uses because the module \`expo\` has an invalid package.json (missing \`version\` field). Try reinstalling node modules and trying again.`, 'MODULE_NOT_FOUND');
56
+ }
57
+ const majorVersion = packageVersion.split('.').shift();
58
+ return `${majorVersion}.0.0`;
59
+ }
60
+ //# sourceMappingURL=getExpoSDKVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExpoSDKVersion.js","names":["getExpoSDKVersion","projectRoot","exp","sdkVersion","getExpoSDKVersionFromPackage","packageJsonPath","resolveFrom","silent","ConfigError","expoPackageJson","JsonFile","read","json5","version","packageVersion","majorVersion","split","shift"],"sources":["../src/getExpoSDKVersion.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport resolveFrom from 'resolve-from';\n\nimport { ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\n\n/**\n * Resolve the Expo SDK Version either from the input Expo config or from the installed\n * version of the `expo` package.\n */\nexport function getExpoSDKVersion(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'sdkVersion'> = {}\n): string {\n return exp?.sdkVersion ?? getExpoSDKVersionFromPackage(projectRoot);\n}\n\n/**\n * Resolve the Expo SDK Version either from the input Expo config or from the installed\n * version of the `expo` package.\n */\nfunction getExpoSDKVersionFromPackage(projectRoot: string): string {\n const packageJsonPath = resolveFrom.silent(projectRoot, 'expo/package.json');\n if (!packageJsonPath) {\n throw new ConfigError(\n `Cannot determine which native SDK version your project uses because the module \\`expo\\` is not installed. Please install it with \\`yarn add expo\\` and try again.`,\n 'MODULE_NOT_FOUND'\n );\n }\n const expoPackageJson = JsonFile.read(packageJsonPath, { json5: true });\n const { version: packageVersion } = expoPackageJson;\n\n if (!(typeof packageVersion === 'string')) {\n // This is technically impossible.\n throw new ConfigError(\n `Cannot determine which native SDK version your project uses because the module \\`expo\\` has an invalid package.json (missing \\`version\\` field). Try reinstalling node modules and trying again.`,\n 'MODULE_NOT_FOUND'\n );\n }\n\n const majorVersion = packageVersion.split('.').shift();\n return `${majorVersion}.0.0`;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuC;AAEvC;AACA;AACA;AACA;AACO,SAASA,iBAAiB,CAC/BC,WAAmB,EACnBC,GAAmC,GAAG,CAAC,CAAC,EAChC;EAAA;EACR,0BAAOA,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEC,UAAU,6DAAIC,4BAA4B,CAACH,WAAW,CAAC;AACrE;;AAEA;AACA;AACA;AACA;AACA,SAASG,4BAA4B,CAACH,WAAmB,EAAU;EACjE,MAAMI,eAAe,GAAGC,sBAAW,CAACC,MAAM,CAACN,WAAW,EAAE,mBAAmB,CAAC;EAC5E,IAAI,CAACI,eAAe,EAAE;IACpB,MAAM,KAAIG,qBAAW,EAClB,mKAAkK,EACnK,kBAAkB,CACnB;EACH;EACA,MAAMC,eAAe,GAAGC,mBAAQ,CAACC,IAAI,CAACN,eAAe,EAAE;IAAEO,KAAK,EAAE;EAAK,CAAC,CAAC;EACvE,MAAM;IAAEC,OAAO,EAAEC;EAAe,CAAC,GAAGL,eAAe;EAEnD,IAAI,EAAE,OAAOK,cAAc,KAAK,QAAQ,CAAC,EAAE;IACzC;IACA,MAAM,KAAIN,qBAAW,EAClB,kMAAiM,EAClM,kBAAkB,CACnB;EACH;EAEA,MAAMO,YAAY,GAAGD,cAAc,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,KAAK,EAAE;EACtD,OAAQ,GAAEF,YAAa,MAAK;AAC9B"}
@@ -1,5 +1,5 @@
1
1
  import JsonFile from '@expo/json-file';
2
- export declare type UserSettingsData = {
2
+ export type UserSettingsData = {
3
3
  developmentCodeSigningId?: string;
4
4
  appleId?: string;
5
5
  accessToken?: string;
@@ -10,14 +10,14 @@ export declare type UserSettingsData = {
10
10
  sendTo?: string;
11
11
  uuid?: string;
12
12
  };
13
- export declare type UserData = {
13
+ export type UserData = {
14
14
  appleId?: string;
15
15
  userId?: string;
16
16
  username?: string;
17
17
  currentConnection?: ConnectionType;
18
18
  sessionSecret?: string;
19
19
  };
20
- export declare type ConnectionType = 'Access-Token-Authentication' | 'Username-Password-Authentication' | 'facebook' | 'google-oauth2' | 'github';
20
+ export type ConnectionType = 'Access-Token-Authentication' | 'Username-Password-Authentication' | 'facebook' | 'google-oauth2' | 'github';
21
21
  export declare function getExpoHomeDirectory(): string;
22
22
  export declare function getUserStatePath(): string;
23
23
  export declare function getUserState(): JsonFile<UserSettingsData>;
@@ -6,58 +6,41 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getExpoHomeDirectory = getExpoHomeDirectory;
7
7
  exports.getUserState = getUserState;
8
8
  exports.getUserStatePath = getUserStatePath;
9
-
10
9
  function _jsonFile() {
11
10
  const data = _interopRequireDefault(require("@expo/json-file"));
12
-
13
11
  _jsonFile = function () {
14
12
  return data;
15
13
  };
16
-
17
14
  return data;
18
15
  }
19
-
20
16
  function _getenv() {
21
17
  const data = require("getenv");
22
-
23
18
  _getenv = function () {
24
19
  return data;
25
20
  };
26
-
27
21
  return data;
28
22
  }
29
-
30
23
  function _os() {
31
24
  const data = require("os");
32
-
33
25
  _os = function () {
34
26
  return data;
35
27
  };
36
-
37
28
  return data;
38
29
  }
39
-
40
30
  function path() {
41
31
  const data = _interopRequireWildcard(require("path"));
42
-
43
32
  path = function () {
44
33
  return data;
45
34
  };
46
-
47
35
  return data;
48
36
  }
49
-
50
37
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
-
52
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
53
-
54
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55
-
56
40
  // The ~/.expo directory is used to store authentication sessions,
57
41
  // which are shared between EAS CLI and Expo CLI.
58
42
  function getExpoHomeDirectory() {
59
43
  const home = (0, _os().homedir)();
60
-
61
44
  if (process.env.__UNSAFE_EXPO_HOME_DIRECTORY) {
62
45
  return process.env.__UNSAFE_EXPO_HOME_DIRECTORY;
63
46
  } else if ((0, _getenv().boolish)('EXPO_STAGING', false)) {
@@ -65,14 +48,11 @@ function getExpoHomeDirectory() {
65
48
  } else if ((0, _getenv().boolish)('EXPO_LOCAL', false)) {
66
49
  return path().join(home, '.expo-local');
67
50
  }
68
-
69
51
  return path().join(home, '.expo');
70
52
  }
71
-
72
53
  function getUserStatePath() {
73
54
  return path().join(getExpoHomeDirectory(), 'state.json');
74
55
  }
75
-
76
56
  function getUserState() {
77
57
  return new (_jsonFile().default)(getUserStatePath(), {
78
58
  jsonParseErrorDefault: {},
@@ -1 +1 @@
1
- {"version":3,"file":"getUserState.js","names":["getExpoHomeDirectory","home","homedir","process","env","__UNSAFE_EXPO_HOME_DIRECTORY","boolish","path","join","getUserStatePath","getUserState","JsonFile","jsonParseErrorDefault","cantReadFileDefault"],"sources":["../src/getUserState.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport { boolish } from 'getenv';\nimport { homedir } from 'os';\nimport * as path from 'path';\n\nexport type UserSettingsData = {\n developmentCodeSigningId?: string;\n appleId?: string;\n accessToken?: string;\n auth?: UserData | null;\n ignoreBundledBinaries?: string[];\n openDevToolsAtStartup?: boolean;\n PATH?: string;\n sendTo?: string;\n uuid?: string;\n};\n\nexport type UserData = {\n appleId?: string;\n userId?: string;\n username?: string;\n currentConnection?: ConnectionType;\n sessionSecret?: string;\n};\n\nexport type ConnectionType =\n | 'Access-Token-Authentication'\n | 'Username-Password-Authentication'\n | 'facebook'\n | 'google-oauth2'\n | 'github';\n\n// The ~/.expo directory is used to store authentication sessions,\n// which are shared between EAS CLI and Expo CLI.\nexport function getExpoHomeDirectory() {\n const home = homedir();\n\n if (process.env.__UNSAFE_EXPO_HOME_DIRECTORY) {\n return process.env.__UNSAFE_EXPO_HOME_DIRECTORY;\n } else if (boolish('EXPO_STAGING', false)) {\n return path.join(home, '.expo-staging');\n } else if (boolish('EXPO_LOCAL', false)) {\n return path.join(home, '.expo-local');\n }\n return path.join(home, '.expo');\n}\n\nexport function getUserStatePath() {\n return path.join(getExpoHomeDirectory(), 'state.json');\n}\n\nexport function getUserState() {\n return new JsonFile<UserSettingsData>(getUserStatePath(), {\n jsonParseErrorDefault: {},\n // This will ensure that an error isn't thrown if the file doesn't exist.\n cantReadFileDefault: {},\n });\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;;;AA6BA;AACA;AACO,SAASA,oBAAT,GAAgC;EACrC,MAAMC,IAAI,GAAG,IAAAC,aAAA,GAAb;;EAEA,IAAIC,OAAO,CAACC,GAAR,CAAYC,4BAAhB,EAA8C;IAC5C,OAAOF,OAAO,CAACC,GAAR,CAAYC,4BAAnB;EACD,CAFD,MAEO,IAAI,IAAAC,iBAAA,EAAQ,cAAR,EAAwB,KAAxB,CAAJ,EAAoC;IACzC,OAAOC,IAAI,GAACC,IAAL,CAAUP,IAAV,EAAgB,eAAhB,CAAP;EACD,CAFM,MAEA,IAAI,IAAAK,iBAAA,EAAQ,YAAR,EAAsB,KAAtB,CAAJ,EAAkC;IACvC,OAAOC,IAAI,GAACC,IAAL,CAAUP,IAAV,EAAgB,aAAhB,CAAP;EACD;;EACD,OAAOM,IAAI,GAACC,IAAL,CAAUP,IAAV,EAAgB,OAAhB,CAAP;AACD;;AAEM,SAASQ,gBAAT,GAA4B;EACjC,OAAOF,IAAI,GAACC,IAAL,CAAUR,oBAAoB,EAA9B,EAAkC,YAAlC,CAAP;AACD;;AAEM,SAASU,YAAT,GAAwB;EAC7B,OAAO,KAAIC,mBAAJ,EAA+BF,gBAAgB,EAA/C,EAAmD;IACxDG,qBAAqB,EAAE,EADiC;IAExD;IACAC,mBAAmB,EAAE;EAHmC,CAAnD,CAAP;AAKD"}
1
+ {"version":3,"file":"getUserState.js","names":["getExpoHomeDirectory","home","homedir","process","env","__UNSAFE_EXPO_HOME_DIRECTORY","boolish","path","join","getUserStatePath","getUserState","JsonFile","jsonParseErrorDefault","cantReadFileDefault"],"sources":["../src/getUserState.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport { boolish } from 'getenv';\nimport { homedir } from 'os';\nimport * as path from 'path';\n\nexport type UserSettingsData = {\n developmentCodeSigningId?: string;\n appleId?: string;\n accessToken?: string;\n auth?: UserData | null;\n ignoreBundledBinaries?: string[];\n openDevToolsAtStartup?: boolean;\n PATH?: string;\n sendTo?: string;\n uuid?: string;\n};\n\nexport type UserData = {\n appleId?: string;\n userId?: string;\n username?: string;\n currentConnection?: ConnectionType;\n sessionSecret?: string;\n};\n\nexport type ConnectionType =\n | 'Access-Token-Authentication'\n | 'Username-Password-Authentication'\n | 'facebook'\n | 'google-oauth2'\n | 'github';\n\n// The ~/.expo directory is used to store authentication sessions,\n// which are shared between EAS CLI and Expo CLI.\nexport function getExpoHomeDirectory() {\n const home = homedir();\n\n if (process.env.__UNSAFE_EXPO_HOME_DIRECTORY) {\n return process.env.__UNSAFE_EXPO_HOME_DIRECTORY;\n } else if (boolish('EXPO_STAGING', false)) {\n return path.join(home, '.expo-staging');\n } else if (boolish('EXPO_LOCAL', false)) {\n return path.join(home, '.expo-local');\n }\n return path.join(home, '.expo');\n}\n\nexport function getUserStatePath() {\n return path.join(getExpoHomeDirectory(), 'state.json');\n}\n\nexport function getUserState() {\n return new JsonFile<UserSettingsData>(getUserStatePath(), {\n jsonParseErrorDefault: {},\n // This will ensure that an error isn't thrown if the file doesn't exist.\n cantReadFileDefault: {},\n });\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA6B;AAAA;AAAA;AA6B7B;AACA;AACO,SAASA,oBAAoB,GAAG;EACrC,MAAMC,IAAI,GAAG,IAAAC,aAAO,GAAE;EAEtB,IAAIC,OAAO,CAACC,GAAG,CAACC,4BAA4B,EAAE;IAC5C,OAAOF,OAAO,CAACC,GAAG,CAACC,4BAA4B;EACjD,CAAC,MAAM,IAAI,IAAAC,iBAAO,EAAC,cAAc,EAAE,KAAK,CAAC,EAAE;IACzC,OAAOC,IAAI,GAACC,IAAI,CAACP,IAAI,EAAE,eAAe,CAAC;EACzC,CAAC,MAAM,IAAI,IAAAK,iBAAO,EAAC,YAAY,EAAE,KAAK,CAAC,EAAE;IACvC,OAAOC,IAAI,GAACC,IAAI,CAACP,IAAI,EAAE,aAAa,CAAC;EACvC;EACA,OAAOM,IAAI,GAACC,IAAI,CAACP,IAAI,EAAE,OAAO,CAAC;AACjC;AAEO,SAASQ,gBAAgB,GAAG;EACjC,OAAOF,IAAI,GAACC,IAAI,CAACR,oBAAoB,EAAE,EAAE,YAAY,CAAC;AACxD;AAEO,SAASU,YAAY,GAAG;EAC7B,OAAO,KAAIC,mBAAQ,EAAmBF,gBAAgB,EAAE,EAAE;IACxDG,qBAAqB,EAAE,CAAC,CAAC;IACzB;IACAC,mBAAmB,EAAE,CAAC;EACxB,CAAC,CAAC;AACJ"}
package/build/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './Config';
2
2
  export * from './Config.types';
3
- export * from './Project';
3
+ export * from './getExpoSDKVersion';
4
4
  export * from './Errors';
5
- export { getAccountUsername } from './getFullName';
5
+ export { getAccountUsername } from './getAccountUsername';