first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

278
node_modules/@expo/cli/build/bin/cli generated vendored Executable file
View File

@@ -0,0 +1,278 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _arg() {
const data = /*#__PURE__*/ _interop_require_default(require("arg"));
_arg = function() {
return data;
};
return data;
}
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
function _debug() {
const data = /*#__PURE__*/ _interop_require_default(require("debug"));
_debug = function() {
return data;
};
return data;
}
function _getenv() {
const data = require("getenv");
_getenv = function() {
return data;
};
return data;
}
const _events = require("../src/events");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
var _process_version;
// Setup event logger output
// NOTE: Done before any console output
(0, _events.installEventLogger)();
// Check Node.js version and issue a loud warning if it's too outdated
// This is sent to stderr (console.error) so it doesn't interfere with programmatic commands
const NODE_MIN = [
20,
19,
4
];
const nodeVersion = (_process_version = process.version) == null ? void 0 : _process_version.slice(1).split('.', 3).map(Number);
if (nodeVersion[0] < NODE_MIN[0] || nodeVersion[0] === NODE_MIN[0] && nodeVersion[1] < NODE_MIN[1]) {
console.error(_chalk().default.red`{bold Node.js (${process.version}) is outdated and unsupported.}` + _chalk().default.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\n` + _chalk().default.red`Go to: https://nodejs.org/en/download\n`);
}
// Setup before requiring `debug`.
if ((0, _getenv().boolish)('EXPO_DEBUG', false)) {
_debug().default.enable('expo:*');
} else if (_debug().default.enabled('expo:')) {
process.env.EXPO_DEBUG = '1';
}
const defaultCmd = 'start';
const commands = {
// Add a new command here
// NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.
run: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/run/index.js"))).then((i)=>i.expoRun),
'run:ios': ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/run/ios/index.js"))).then((i)=>i.expoRunIos),
'run:android': ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/run/android/index.js"))).then((i)=>i.expoRunAndroid),
start: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/start/index.js"))).then((i)=>i.expoStart),
prebuild: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/prebuild/index.js"))).then((i)=>i.expoPrebuild),
config: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/config/index.js"))).then((i)=>i.expoConfig),
export: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/export/index.js"))).then((i)=>i.expoExport),
'export:web': ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/export/web/index.js"))).then((i)=>i.expoExportWeb),
'export:embed': ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/export/embed/index.js"))).then((i)=>i.expoExportEmbed),
serve: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/serve/index.js"))).then((i)=>i.expoServe),
// Auxiliary commands
install: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/install/index.js"))).then((i)=>i.expoInstall),
add: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/install/index.js"))).then((i)=>i.expoInstall),
customize: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/customize/index.js"))).then((i)=>i.expoCustomize),
lint: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/lint/index.js"))).then((i)=>i.expoLint),
// Auth
login: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/login/index.js"))).then((i)=>i.expoLogin),
logout: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/logout/index.js"))).then((i)=>i.expoLogout),
register: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/register/index.js"))).then((i)=>i.expoRegister),
whoami: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../src/whoami/index.js"))).then((i)=>i.expoWhoami)
};
const args = (0, _arg().default)({
// Types
'--version': Boolean,
'--help': Boolean,
// NOTE(EvanBacon): This is here to silence warnings from processes that
// expect the global expo-cli.
'--non-interactive': Boolean,
// Aliases
'-v': '--version',
'-h': '--help'
}, {
permissive: true
});
if (args['--version']) {
// Version is added in the build script.
console.log("55.0.14");
process.exit(0);
}
if (args['--non-interactive']) {
console.warn(_chalk().default.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);
}
// Check if we are running `npx expo <subcommand>` or `npx expo`
const isSubcommand = Boolean(commands[args._[0]]);
// Handle `--help` flag
if (!isSubcommand && args['--help']) {
const { login, logout, whoami, register, start, install, add, export: _export, config, customize, prebuild, 'run:ios': runIos, 'run:android': runAndroid, // NOTE(EvanBacon): Don't document this command as it's a temporary
// workaround until we can use `expo export` for all production bundling.
// https://github.com/expo/expo/pull/21396/files#r1121025873
'export:embed': exportEmbed_unused, // The export:web command is deprecated. Hide it from the help prompt.
'export:web': exportWeb_unused, // Other ignored commands, these are intentially not listed in the `--help` output
run: _run, // NOTE(cedric): Still pending the migration to ESLint's flat config
lint: _lint, serve, // All other commands
...others } = commands;
console.log((0, _chalk().default)`
{bold Usage}
{dim $} npx expo <command>
{bold Commands}
${Object.keys({
start,
export: _export,
...others
}).join(', ')}
${Object.keys({
'run:ios': runIos,
'run:android': runAndroid,
prebuild
}).join(', ')}
${Object.keys({
install,
customize,
config,
serve
}).join(', ')}
{dim ${Object.keys({
login,
logout,
whoami,
register
}).join(', ')}}
{bold Options}
--version, -v Version number
--help, -h Usage info
For more info run a command with the {bold --help} flag
{dim $} npx expo start --help
`);
process.exit(0);
}
// NOTE(EvanBacon): Squat some directory names to help with migration,
// users can still use folders named "send" or "eject" by using the fully qualified `npx expo start ./send`.
if (!isSubcommand) {
const migrationMap = {
init: 'npx create-expo-app',
eject: 'npx expo prebuild',
web: 'npx expo start --web',
'start:web': 'npx expo start --web',
'build:ios': 'eas build -p ios',
'build:android': 'eas build -p android',
'client:install:ios': 'npx expo start --ios',
'client:install:android': 'npx expo start --android',
doctor: 'npx expo-doctor',
upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',
'customize:web': 'npx expo customize',
publish: 'eas update',
'publish:set': 'eas update',
'publish:rollback': 'eas update',
'publish:history': 'eas update',
'publish:details': 'eas update',
'build:web': 'npx expo export:web',
'credentials:manager': `eas credentials`,
'fetch:ios:certs': `eas credentials`,
'fetch:android:keystore': `eas credentials`,
'fetch:android:hashes': `eas credentials`,
'fetch:android:upload-cert': `eas credentials`,
'push:android:upload': `eas credentials`,
'push:android:show': `eas credentials`,
'push:android:clear': `eas credentials`,
url: `eas build:list`,
'url:ipa': `eas build:list`,
'url:apk': `eas build:list`,
webhooks: `eas webhook`,
'webhooks:add': `eas webhook:create`,
'webhooks:remove': `eas webhook:delete`,
'webhooks:update': `eas webhook:update`,
'build:status': `eas build:list`,
'upload:android': `eas submit -p android`,
'upload:ios': `eas submit -p ios`
};
// TODO: Log telemetry about invalid command used.
const subcommand = args._[0];
if (subcommand in migrationMap) {
const replacement = migrationMap[subcommand];
console.log();
const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';
console.log(_chalk().default.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`);
console.log();
process.exit(1);
}
const deprecated = [
'send',
'client:ios'
];
if (deprecated.includes(subcommand)) {
console.log();
console.log(_chalk().default.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);
console.log();
process.exit(1);
}
}
const command = isSubcommand ? args._[0] : defaultCmd;
const commandArgs = isSubcommand ? args._.slice(1) : args._;
// Push the help flag to the subcommand args.
if (args['--help']) {
commandArgs.push('--help');
}
// Install exit hooks
process.on('SIGINT', ()=>process.exit(0));
process.on('SIGTERM', ()=>process.exit(0));
commands[command]().then((exec)=>{
exec(commandArgs);
// NOTE(EvanBacon): Track some basic telemetry events indicating the command
// that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.
// We do this to determine how well deprecations are going before removing a command.
if (!(0, _getenv().boolish)('EXPO_NO_TELEMETRY', false)) {
const { recordCommand } = require('../src/utils/telemetry');
recordCommand(command);
}
});
//# sourceMappingURL=cli.map

1
node_modules/@expo/cli/build/bin/cli.map generated vendored Executable file

File diff suppressed because one or more lines are too long

608
node_modules/@expo/cli/build/metro-require/require.js generated vendored Normal file
View File

@@ -0,0 +1,608 @@
'use strict';
if (__DEV__ || !global[`${__METRO_GLOBAL_PREFIX__}__d`]) {
global.__r = metroRequire;
global[`${__METRO_GLOBAL_PREFIX__}__d`] = define;
global.__c = clear;
global.__registerSegment = registerSegment;
}
var modules = clear();
const EMPTY = {};
const CYCLE_DETECTED = {};
const { hasOwnProperty } = {};
if (__DEV__) {
global.$RefreshReg$ = global.$RefreshReg$ ?? (()=>{});
global.$RefreshSig$ = global.$RefreshSig$ ?? (()=>(type)=>type);
}
function clear() {
modules = new Map();
return modules;
}
if (__DEV__) {
var initializingModuleIds = [];
}
function define(factory, moduleId, dependencyMap) {
if (modules.has(moduleId)) {
if (__DEV__) {
const inverseDependencies = arguments[4];
if (inverseDependencies) {
global.__accept(moduleId, factory, dependencyMap, inverseDependencies);
}
}
return;
}
const mod = {
dependencyMap,
factory,
hasError: false,
importedAll: EMPTY,
importedDefault: EMPTY,
isInitialized: false,
publicModule: {
exports: {}
}
};
modules.set(moduleId, mod);
if (__DEV__) {
mod.hot = createHotReloadingObject();
const verboseName = arguments[3];
if (verboseName) {
mod.verboseName = verboseName;
}
}
}
function metroRequire(moduleId, moduleIdHint) {
if (moduleId === null) {
if (__DEV__ && typeof moduleIdHint === 'string') {
throw new Error("Cannot find module '" + moduleIdHint + "'");
}
throw new Error('Cannot find module');
}
if (__DEV__) {
const initializingIndex = initializingModuleIds.indexOf(moduleId);
if (initializingIndex !== -1) {
const cycle = initializingModuleIds.slice(initializingIndex).map((id)=>{
var _modules_get;
return ((_modules_get = modules.get(id)) == null ? void 0 : _modules_get.verboseName) ?? '[unknown]';
});
if (shouldPrintRequireCycle(cycle)) {
cycle.push(cycle[0]);
console.warn(`Require cycle: ${cycle.join(' -> ')}\n\n` + 'Require cycles are allowed, but can result in uninitialized values. ' + 'Consider refactoring to remove the need for a cycle.');
}
}
}
const module = modules.get(moduleId);
return module && module.isInitialized ? module.publicModule.exports : guardedLoadModule(moduleId, module, moduleIdHint);
}
function shouldPrintRequireCycle(modules) {
const rcip = __METRO_GLOBAL_PREFIX__ + '__requireCycleIgnorePatterns';
const regExps = globalThis[rcip] ?? global[rcip] ?? [
/(^|\/|\\)node_modules($|\/|\\)/
];
if (!Array.isArray(regExps)) {
return true;
}
const isIgnored = (module)=>module != null && regExps.some((regExp)=>regExp.test(module));
return modules.every((module)=>!isIgnored(module));
}
function metroImportDefault(moduleId) {
var _modules_get;
if (modules.has(moduleId) && ((_modules_get = modules.get(moduleId)) == null ? void 0 : _modules_get.importedDefault) !== EMPTY) {
return modules.get(moduleId).importedDefault;
}
const exports = metroRequire(moduleId);
const importedDefault = exports && exports.__esModule ? exports.default : exports;
return modules.get(moduleId).importedDefault = importedDefault;
}
metroRequire.importDefault = metroImportDefault;
function metroImportAll(moduleId) {
var _modules_get;
if (modules.has(moduleId) && ((_modules_get = modules.get(moduleId)) == null ? void 0 : _modules_get.importedAll) !== EMPTY) {
return modules.get(moduleId).importedAll;
}
const exports = metroRequire(moduleId);
let importedAll;
if (exports && exports.__esModule) {
importedAll = exports;
} else {
importedAll = {};
if (exports) {
for(const key in exports){
if (hasOwnProperty.call(exports, key)) {
importedAll[key] = exports[key];
}
}
}
importedAll.default = exports;
}
return modules.get(moduleId).importedAll = importedAll;
}
metroRequire[Symbol.for('expo.require')] = true;
metroRequire.importAll = metroImportAll;
metroRequire.context = function fallbackRequireContext() {
if (__DEV__) {
throw new Error('The experimental Metro feature `require.context` is not enabled in your project.\nThis can be enabled by setting the `transformer.unstable_allowRequireContext` property to `true` in your Metro configuration.');
}
throw new Error('The experimental Metro feature `require.context` is not enabled in your project.');
};
metroRequire.resolveWeak = function fallbackRequireResolveWeak() {
if (__DEV__) {
throw new Error('require.resolveWeak cannot be called dynamically. Ensure you are using the same version of `metro` and `metro-runtime`.');
}
throw new Error('require.resolveWeak cannot be called dynamically.');
};
metroRequire.unguarded = function requireUnguarded(moduleId, moduleIdHint) {
if (__DEV__) {
const initializingIndex = initializingModuleIds.indexOf(moduleId);
if (initializingIndex !== -1) {
const cycle = initializingModuleIds.slice(initializingIndex).map((id)=>{
var _modules_get;
return ((_modules_get = modules.get(id)) == null ? void 0 : _modules_get.verboseName) ?? '[unknown]';
});
if (shouldPrintRequireCycle(cycle)) {
cycle.push(cycle[0]);
console.warn(`Require cycle: ${cycle.join(' -> ')}\n\n` + 'Require cycles are allowed, but can result in uninitialized values. ' + 'Consider refactoring to remove the need for a cycle.');
}
}
}
const module = modules.get(moduleId);
return module && module.isInitialized ? module.publicModule.exports : loadModuleImplementation(moduleId, module, moduleIdHint);
};
let inGuard = false;
function guardedLoadModule(moduleId, module, moduleIdHint) {
if (!inGuard && global.ErrorUtils) {
inGuard = true;
let returnValue;
try {
returnValue = loadModuleImplementation(moduleId, module, moduleIdHint);
} catch (e) {
global.ErrorUtils.reportFatalError(e);
}
inGuard = false;
return returnValue;
} else {
return loadModuleImplementation(moduleId, module, moduleIdHint);
}
}
const ID_MASK_SHIFT = 16;
const LOCAL_ID_MASK = ~0 >>> ID_MASK_SHIFT;
function unpackModuleId(moduleId) {
if (typeof moduleId !== 'number') {
throw new Error('Module ID must be a number in unpackModuleId.');
}
const segmentId = moduleId >>> ID_MASK_SHIFT;
const localId = moduleId & LOCAL_ID_MASK;
return {
segmentId,
localId
};
}
metroRequire.unpackModuleId = unpackModuleId;
function packModuleId(value) {
return (value.segmentId << ID_MASK_SHIFT) + value.localId;
}
metroRequire.packModuleId = packModuleId;
const moduleDefinersBySegmentID = [];
const definingSegmentByModuleID = new Map();
function registerSegment(segmentId, moduleDefiner, moduleIds) {
moduleDefinersBySegmentID[segmentId] = moduleDefiner;
if (__DEV__) {
if (segmentId === 0 && moduleIds) {
throw new Error('registerSegment: Expected moduleIds to be null for main segment');
}
if (segmentId !== 0 && !moduleIds) {
throw new Error('registerSegment: Expected moduleIds to be passed for segment #' + segmentId);
}
}
if (moduleIds) {
moduleIds.forEach((moduleId)=>{
if (!modules.has(moduleId) && !definingSegmentByModuleID.has(moduleId)) {
definingSegmentByModuleID.set(moduleId, segmentId);
}
});
}
}
function loadModuleImplementation(moduleId, module, moduleIdHint) {
if (!module && moduleDefinersBySegmentID.length > 0) {
const segmentId = definingSegmentByModuleID.get(moduleId) ?? 0;
const definer = moduleDefinersBySegmentID[segmentId];
if (definer != null) {
definer(moduleId);
module = modules.get(moduleId);
definingSegmentByModuleID.delete(moduleId);
}
}
if (!module) {
throw unknownModuleError(moduleId, moduleIdHint);
}
if (module.hasError) {
throw module.error;
}
if (__DEV__) {
var Systrace = requireSystrace();
var Refresh = requireRefresh();
}
module.isInitialized = true;
const { factory, dependencyMap } = module;
if (__DEV__) {
initializingModuleIds.push(moduleId);
}
try {
if (__DEV__) {
Systrace.beginEvent('JS_require_' + (module.verboseName || moduleId));
}
const moduleObject = module.publicModule;
if (__DEV__) {
moduleObject.hot = module.hot;
var prevRefreshReg = global.$RefreshReg$;
var prevRefreshSig = global.$RefreshSig$;
if (Refresh != null) {
const RefreshRuntime = Refresh;
global.$RefreshReg$ = (type, id)=>{
const prefixedModuleId = __METRO_GLOBAL_PREFIX__ + ' ' + moduleId + ' ' + id;
RefreshRuntime.register(type, prefixedModuleId);
};
global.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
}
}
moduleObject.id = moduleId;
factory == null ? void 0 : factory(global, metroRequire, metroImportDefault, metroImportAll, moduleObject, moduleObject.exports, dependencyMap);
if (!__DEV__) {
module.factory = undefined;
module.dependencyMap = undefined;
}
if (__DEV__) {
Systrace.endEvent();
if (Refresh != null) {
const prefixedModuleId = __METRO_GLOBAL_PREFIX__ + ' ' + moduleId;
registerExportsForReactRefresh(Refresh, moduleObject.exports, prefixedModuleId);
}
}
return moduleObject.exports;
} catch (e) {
module.hasError = true;
module.error = e;
module.isInitialized = false;
module.publicModule.exports = undefined;
throw e;
} finally{
if (__DEV__) {
if (initializingModuleIds.pop() !== moduleId) {
throw new Error('initializingModuleIds is corrupt; something is terribly wrong');
}
global.$RefreshReg$ = prevRefreshReg;
global.$RefreshSig$ = prevRefreshSig;
}
}
}
function unknownModuleError(id, moduleIdHint) {
let message = 'Requiring unknown module "' + (id ?? moduleIdHint ?? `[unknown optional import]`) + '".';
if (__DEV__) {
message += ' If you are sure the module exists, try restarting Metro. ' + 'You may also want to run `yarn` or `npm install`.';
}
return Error(message);
}
if (__DEV__) {
metroRequire.Systrace = {
beginEvent: ()=>{},
endEvent: ()=>{}
};
metroRequire.getModules = ()=>{
return modules;
};
var createHotReloadingObject = function() {
const hot = {
_acceptCallback: null,
_disposeCallback: null,
_didAccept: false,
accept: (callback)=>{
hot._didAccept = true;
hot._acceptCallback = callback;
},
dispose: (callback)=>{
hot._disposeCallback = callback;
}
};
return hot;
};
let reactRefreshTimeout = null;
const metroHotUpdateModule = function(id, factory, dependencyMap, inverseDependencies) {
const mod = modules.get(id);
if (!mod) {
if (factory) {
return;
}
throw unknownModuleError(id);
}
if (!mod.hasError && !mod.isInitialized) {
mod.factory = factory;
mod.dependencyMap = dependencyMap;
return;
}
const Refresh = requireRefresh();
const refreshBoundaryIDs = new Set();
let didBailOut = false;
let updatedModuleIDs;
try {
updatedModuleIDs = topologicalSort([
id
], (pendingID)=>{
const pendingModule = modules.get(pendingID);
if (pendingModule == null) {
return [];
}
const pendingHot = pendingModule.hot;
if (pendingHot == null) {
throw new Error('[Refresh] Expected module.hot to always exist in DEV.');
}
let canAccept = pendingHot._didAccept;
if (!canAccept && Refresh != null) {
const isBoundary = isReactRefreshBoundary(Refresh, pendingModule.publicModule.exports);
if (isBoundary) {
canAccept = true;
refreshBoundaryIDs.add(pendingID);
}
}
if (canAccept) {
return [];
}
const parentIDs = inverseDependencies[pendingID];
if (parentIDs.length === 0) {
performFullRefresh('No root boundary', {
source: mod,
failed: pendingModule
});
didBailOut = true;
return [];
}
return parentIDs;
}, ()=>didBailOut).reverse();
} catch (e) {
if (e === CYCLE_DETECTED) {
performFullRefresh('Dependency cycle', {
source: mod
});
return;
}
throw e;
}
if (didBailOut) {
return;
}
const seenModuleIDs = new Set();
for(let i = 0; i < updatedModuleIDs.length; i++){
const updatedID = updatedModuleIDs[i];
if (seenModuleIDs.has(updatedID)) {
continue;
}
seenModuleIDs.add(updatedID);
const updatedMod = modules.get(updatedID);
if (updatedMod == null) {
throw new Error('[Refresh] Expected to find the updated module.');
}
const prevExports = updatedMod.publicModule.exports;
const didError = runUpdatedModule(updatedID, updatedID === id ? factory : undefined, updatedID === id ? dependencyMap : undefined);
const nextExports = updatedMod.publicModule.exports;
if (didError) {
return;
}
if (refreshBoundaryIDs.has(updatedID)) {
const isNoLongerABoundary = !isReactRefreshBoundary(Refresh, nextExports);
const didInvalidate = shouldInvalidateReactRefreshBoundary(Refresh, prevExports, nextExports);
if (isNoLongerABoundary || didInvalidate) {
const parentIDs = inverseDependencies[updatedID];
if (parentIDs.length === 0) {
performFullRefresh(isNoLongerABoundary ? 'No longer a boundary' : 'Invalidated boundary', {
source: mod,
failed: updatedMod
});
return;
}
for(let j = 0; j < parentIDs.length; j++){
const parentID = parentIDs[j];
const parentMod = modules.get(parentID);
if (parentMod == null) {
throw new Error('[Refresh] Expected to find parent module.');
}
const canAcceptParent = isReactRefreshBoundary(Refresh, parentMod.publicModule.exports);
if (canAcceptParent) {
refreshBoundaryIDs.add(parentID);
updatedModuleIDs.push(parentID);
} else {
performFullRefresh('Invalidated boundary', {
source: mod,
failed: parentMod
});
return;
}
}
}
}
}
if (Refresh != null) {
if (reactRefreshTimeout == null) {
reactRefreshTimeout = setTimeout(()=>{
reactRefreshTimeout = null;
Refresh.performReactRefresh();
}, 30);
}
}
};
const topologicalSort = function(roots, getEdges, earlyStop) {
const result = [];
const visited = new Set();
const stack = new Set();
function traverseDependentNodes(node) {
if (stack.has(node)) {
throw CYCLE_DETECTED;
}
if (visited.has(node)) {
return;
}
visited.add(node);
stack.add(node);
const dependentNodes = getEdges(node);
if (earlyStop(node)) {
stack.delete(node);
return;
}
dependentNodes.forEach((dependent)=>{
traverseDependentNodes(dependent);
});
stack.delete(node);
result.push(node);
}
roots.forEach((root)=>{
traverseDependentNodes(root);
});
return result;
};
const runUpdatedModule = function(id, factory, dependencyMap) {
const mod = modules.get(id);
if (mod == null) {
throw new Error('[Refresh] Expected to find the module.');
}
const { hot } = mod;
if (!hot) {
throw new Error('[Refresh] Expected module.hot to always exist in DEV.');
}
if (hot._disposeCallback) {
try {
hot._disposeCallback();
} catch (error) {
console.error(`Error while calling dispose handler for module ${id}: `, error);
}
}
if (factory) {
mod.factory = factory;
}
if (dependencyMap) {
mod.dependencyMap = dependencyMap;
}
mod.hasError = false;
mod.error = undefined;
mod.importedAll = EMPTY;
mod.importedDefault = EMPTY;
mod.isInitialized = false;
const prevExports = mod.publicModule.exports;
mod.publicModule.exports = {};
hot._didAccept = false;
hot._acceptCallback = null;
hot._disposeCallback = null;
metroRequire(id);
if (mod.hasError) {
mod.hasError = false;
mod.isInitialized = true;
mod.error = null;
mod.publicModule.exports = prevExports;
return true;
}
if (hot._acceptCallback) {
try {
hot._acceptCallback();
} catch (error) {
console.error(`Error while calling accept handler for module ${id}: `, error);
}
}
return false;
};
const performFullRefresh = (reason, modules)=>{
if (typeof window !== 'undefined' && window.location != null && typeof window.location.reload === 'function') {
window.location.reload();
} else {
const Refresh = requireRefresh();
if (Refresh != null) {
var _modules_source, _modules_failed;
const sourceName = ((_modules_source = modules.source) == null ? void 0 : _modules_source.verboseName) ?? 'unknown';
const failedName = ((_modules_failed = modules.failed) == null ? void 0 : _modules_failed.verboseName) ?? 'unknown';
Refresh.performFullRefresh(`Fast Refresh - ${reason} <${sourceName}> <${failedName}>`);
} else {
console.warn('Could not reload the application after an edit.');
}
}
};
var isSpecifierSafeToCheck = (moduleExports, key)=>{
if (moduleExports && moduleExports.__esModule) {
return true;
} else {
const desc = Object.getOwnPropertyDescriptor(moduleExports, key);
return !desc || !desc.get;
}
};
var isReactRefreshBoundary = function(Refresh, moduleExports) {
if (Refresh.isLikelyComponentType(moduleExports)) {
return true;
}
if (moduleExports == null || typeof moduleExports !== 'object') {
return false;
}
let hasExports = false;
let areAllExportsComponents = true;
for(const key in moduleExports){
hasExports = true;
if (key === '__esModule') {
continue;
} else if (!isSpecifierSafeToCheck(moduleExports, key)) {
return false;
}
const exportValue = moduleExports[key];
if (!Refresh.isLikelyComponentType(exportValue)) {
areAllExportsComponents = false;
}
}
return hasExports && areAllExportsComponents;
};
var shouldInvalidateReactRefreshBoundary = (Refresh, prevExports, nextExports)=>{
const prevSignature = getRefreshBoundarySignature(Refresh, prevExports);
const nextSignature = getRefreshBoundarySignature(Refresh, nextExports);
if (prevSignature.length !== nextSignature.length) {
return true;
}
for(let i = 0; i < nextSignature.length; i++){
if (prevSignature[i] !== nextSignature[i]) {
return true;
}
}
return false;
};
var getRefreshBoundarySignature = (Refresh, moduleExports)=>{
const signature = [];
signature.push(Refresh.getFamilyByType(moduleExports));
if (moduleExports == null || typeof moduleExports !== 'object') {
return signature;
}
for(const key in moduleExports){
if (key === '__esModule') {
continue;
} else if (!isSpecifierSafeToCheck(moduleExports, key)) {
continue;
}
const exportValue = moduleExports[key];
signature.push(key);
signature.push(Refresh.getFamilyByType(exportValue));
}
return signature;
};
var registerExportsForReactRefresh = (Refresh, moduleExports, moduleID)=>{
Refresh.register(moduleExports, moduleID + ' %exports%');
if (moduleExports == null || typeof moduleExports !== 'object') {
return;
}
for(const key in moduleExports){
if (!isSpecifierSafeToCheck(moduleExports, key)) {
continue;
}
const exportValue = moduleExports[key];
const typeID = moduleID + ' %exports% ' + key;
Refresh.register(exportValue, typeID);
}
};
global.__accept = metroHotUpdateModule;
}
if (__DEV__) {
var requireSystrace = function requireSystrace() {
return global[__METRO_GLOBAL_PREFIX__ + '__SYSTRACE'] || metroRequire.Systrace;
};
var requireRefresh = function requireRefresh() {
return global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'] || global[global.__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'] || metroRequire.Refresh;
};
}

39
node_modules/@expo/cli/build/src/api/endpoint.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getExpoApiBaseUrl: function() {
return getExpoApiBaseUrl;
},
getExpoWebsiteBaseUrl: function() {
return getExpoWebsiteBaseUrl;
}
});
const _env = require("../utils/env");
function getExpoApiBaseUrl() {
if (_env.env.EXPO_STAGING) {
return `https://staging-api.expo.dev`;
} else if (_env.env.EXPO_LOCAL) {
return `http://127.0.0.1:3000`;
} else {
return `https://api.expo.dev`;
}
}
function getExpoWebsiteBaseUrl() {
if (_env.env.EXPO_STAGING) {
return `https://staging.expo.dev`;
} else if (_env.env.EXPO_LOCAL) {
return `http://127.0.0.1:3001`;
} else {
return `https://expo.dev`;
}
}
//# sourceMappingURL=endpoint.js.map

1
node_modules/@expo/cli/build/src/api/endpoint.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/endpoint.ts"],"sourcesContent":["import { env } from '../utils/env';\n\n/** Get the URL for the expo.dev API. */\nexport function getExpoApiBaseUrl(): string {\n if (env.EXPO_STAGING) {\n return `https://staging-api.expo.dev`;\n } else if (env.EXPO_LOCAL) {\n return `http://127.0.0.1:3000`;\n } else {\n return `https://api.expo.dev`;\n }\n}\n\n/** Get the URL for the expo.dev website. */\nexport function getExpoWebsiteBaseUrl(): string {\n if (env.EXPO_STAGING) {\n return `https://staging.expo.dev`;\n } else if (env.EXPO_LOCAL) {\n return `http://127.0.0.1:3001`;\n } else {\n return `https://expo.dev`;\n }\n}\n"],"names":["getExpoApiBaseUrl","getExpoWebsiteBaseUrl","env","EXPO_STAGING","EXPO_LOCAL"],"mappings":";;;;;;;;;;;IAGgBA,iBAAiB;eAAjBA;;IAWAC,qBAAqB;eAArBA;;;qBAdI;AAGb,SAASD;IACd,IAAIE,QAAG,CAACC,YAAY,EAAE;QACpB,OAAO,CAAC,4BAA4B,CAAC;IACvC,OAAO,IAAID,QAAG,CAACE,UAAU,EAAE;QACzB,OAAO,CAAC,qBAAqB,CAAC;IAChC,OAAO;QACL,OAAO,CAAC,oBAAoB,CAAC;IAC/B;AACF;AAGO,SAASH;IACd,IAAIC,QAAG,CAACC,YAAY,EAAE;QACpB,OAAO,CAAC,wBAAwB,CAAC;IACnC,OAAO,IAAID,QAAG,CAACE,UAAU,EAAE;QACzB,OAAO,CAAC,qBAAqB,CAAC;IAChC,OAAO;QACL,OAAO,CAAC,gBAAgB,CAAC;IAC3B;AACF"}

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getExpoGoIntermediateCertificateAsync", {
enumerable: true,
get: function() {
return getExpoGoIntermediateCertificateAsync;
}
});
const _client = require("./rest/client");
const _errors = require("../utils/errors");
async function getExpoGoIntermediateCertificateAsync(easProjectId) {
const response = await (0, _client.fetchAsync)(`projects/${encodeURIComponent(easProjectId)}/development-certificates/expo-go-intermediate-certificate`, {
method: 'GET'
});
if (!response.ok) {
throw new _errors.CommandError('API', `Unexpected error from Expo servers: ${response.statusText}.`);
}
return await response.text();
}
//# sourceMappingURL=getExpoGoIntermediateCertificate.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/getExpoGoIntermediateCertificate.ts"],"sourcesContent":["import { fetchAsync } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\nexport async function getExpoGoIntermediateCertificateAsync(easProjectId: string): Promise<string> {\n const response = await fetchAsync(\n `projects/${encodeURIComponent(\n easProjectId\n )}/development-certificates/expo-go-intermediate-certificate`,\n {\n method: 'GET',\n }\n );\n if (!response.ok) {\n throw new CommandError('API', `Unexpected error from Expo servers: ${response.statusText}.`);\n }\n\n return await response.text();\n}\n"],"names":["getExpoGoIntermediateCertificateAsync","easProjectId","response","fetchAsync","encodeURIComponent","method","ok","CommandError","statusText","text"],"mappings":";;;;+BAGsBA;;;eAAAA;;;wBAHK;wBACE;AAEtB,eAAeA,sCAAsCC,YAAoB;IAC9E,MAAMC,WAAW,MAAMC,IAAAA,kBAAU,EAC/B,CAAC,SAAS,EAAEC,mBACVH,cACA,0DAA0D,CAAC,EAC7D;QACEI,QAAQ;IACV;IAEF,IAAI,CAACH,SAASI,EAAE,EAAE;QAChB,MAAM,IAAIC,oBAAY,CAAC,OAAO,CAAC,oCAAoC,EAAEL,SAASM,UAAU,CAAC,CAAC,CAAC;IAC7F;IAEA,OAAO,MAAMN,SAASO,IAAI;AAC5B"}

97
node_modules/@expo/cli/build/src/api/getExpoSchema.js generated vendored Normal file
View File

@@ -0,0 +1,97 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
_getSchemaAsync: function() {
return _getSchemaAsync;
},
getAssetSchemasAsync: function() {
return getAssetSchemasAsync;
}
});
function _schemautils() {
const data = require("@expo/schema-utils");
_schemautils = function() {
return data;
};
return data;
}
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _client = require("./rest/client");
const _env = require("../utils/env");
const _errors = require("../utils/errors");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const schemaJson = {};
async function _getSchemaAsync(sdkVersion) {
const json = await getSchemaJSONAsync(sdkVersion);
return (0, _schemautils().derefSchema)(json.schema);
}
async function getAssetSchemasAsync(sdkVersion = 'UNVERSIONED') {
// If no SDK version is available then fall back to unversioned
const schema = await _getSchemaAsync(sdkVersion);
const assetSchemas = [];
const visit = (node, fieldPath)=>{
if (node.meta && node.meta.asset) {
assetSchemas.push(fieldPath);
}
const properties = node.properties;
if (properties) {
Object.keys(properties).forEach((property)=>visit(properties[property], `${fieldPath}${fieldPath.length > 0 ? '.' : ''}${property}`));
}
};
visit(schema, '');
return assetSchemas;
}
async function getSchemaJSONAsync(sdkVersion) {
if (_env.env.EXPO_UNIVERSE_DIR) {
return JSON.parse(_fs().default.readFileSync(_path().default.join(_env.env.EXPO_UNIVERSE_DIR, 'server', 'www', 'xdl-schemas', 'UNVERSIONED-schema.json')).toString());
}
if (!schemaJson[sdkVersion]) {
try {
schemaJson[sdkVersion] = await getConfigurationSchemaAsync(sdkVersion);
} catch (e) {
if (e.code === 'INVALID_JSON') {
throw new _errors.CommandError('INVALID_JSON', `Couldn't read schema from server`);
}
throw e;
}
}
return schemaJson[sdkVersion];
}
async function getConfigurationSchemaAsync(sdkVersion) {
// Reconstruct the cached fetch since caching could be disabled.
const fetchAsync = (0, _client.createCachedFetch)({
cacheDirectory: 'schema-cache',
// We'll use a 1 week cache for versions so older versions get flushed out eventually.
ttl: 1000 * 60 * 60 * 24 * 7
});
const response = await fetchAsync(`project/configuration/schema/${sdkVersion}`);
const json = await response.json();
return (0, _client.getResponseDataOrThrow)(json);
}
//# sourceMappingURL=getExpoSchema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/getExpoSchema.ts"],"sourcesContent":["import type { JSONObject } from '@expo/json-file';\nimport { derefSchema } from '@expo/schema-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type Schema = any;\n\nexport type AssetSchema = {\n fieldPath: string;\n};\n\nconst schemaJson: { [sdkVersion: string]: Schema } = {};\n\nexport async function _getSchemaAsync(sdkVersion: string): Promise<Schema> {\n const json = await getSchemaJSONAsync(sdkVersion);\n return derefSchema(json.schema);\n}\n\n/**\n * Array of schema nodes that refer to assets along with their field path (eg. 'notification.icon')\n *\n * @param sdkVersion\n */\nexport async function getAssetSchemasAsync(sdkVersion: string = 'UNVERSIONED'): Promise<string[]> {\n // If no SDK version is available then fall back to unversioned\n const schema = await _getSchemaAsync(sdkVersion);\n const assetSchemas: string[] = [];\n const visit = (node: Schema, fieldPath: string) => {\n if (node.meta && node.meta.asset) {\n assetSchemas.push(fieldPath);\n }\n const properties = node.properties;\n if (properties) {\n Object.keys(properties).forEach((property) =>\n visit(properties[property], `${fieldPath}${fieldPath.length > 0 ? '.' : ''}${property}`)\n );\n }\n };\n visit(schema, '');\n\n return assetSchemas;\n}\n\nasync function getSchemaJSONAsync(sdkVersion: string): Promise<{ schema: Schema }> {\n if (env.EXPO_UNIVERSE_DIR) {\n return JSON.parse(\n fs\n .readFileSync(\n path.join(\n env.EXPO_UNIVERSE_DIR,\n 'server',\n 'www',\n 'xdl-schemas',\n 'UNVERSIONED-schema.json'\n )\n )\n .toString()\n );\n }\n\n if (!schemaJson[sdkVersion]) {\n try {\n schemaJson[sdkVersion] = await getConfigurationSchemaAsync(sdkVersion);\n } catch (e: any) {\n if (e.code === 'INVALID_JSON') {\n throw new CommandError('INVALID_JSON', `Couldn't read schema from server`);\n }\n\n throw e;\n }\n }\n\n return schemaJson[sdkVersion];\n}\n\nasync function getConfigurationSchemaAsync(sdkVersion: string): Promise<JSONObject> {\n // Reconstruct the cached fetch since caching could be disabled.\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'schema-cache',\n // We'll use a 1 week cache for versions so older versions get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n });\n const response = await fetchAsync(`project/configuration/schema/${sdkVersion}`);\n const json = await response.json();\n\n return getResponseDataOrThrow<JSONObject>(json);\n}\n"],"names":["_getSchemaAsync","getAssetSchemasAsync","schemaJson","sdkVersion","json","getSchemaJSONAsync","derefSchema","schema","assetSchemas","visit","node","fieldPath","meta","asset","push","properties","Object","keys","forEach","property","length","env","EXPO_UNIVERSE_DIR","JSON","parse","fs","readFileSync","path","join","toString","getConfigurationSchemaAsync","e","code","CommandError","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","getResponseDataOrThrow"],"mappings":";;;;;;;;;;;IAiBsBA,eAAe;eAAfA;;IAUAC,oBAAoB;eAApBA;;;;yBA1BM;;;;;;;gEACb;;;;;;;gEACE;;;;;;wBAEyC;qBACtC;wBACS;;;;;;AAQ7B,MAAMC,aAA+C,CAAC;AAE/C,eAAeF,gBAAgBG,UAAkB;IACtD,MAAMC,OAAO,MAAMC,mBAAmBF;IACtC,OAAOG,IAAAA,0BAAW,EAACF,KAAKG,MAAM;AAChC;AAOO,eAAeN,qBAAqBE,aAAqB,aAAa;IAC3E,+DAA+D;IAC/D,MAAMI,SAAS,MAAMP,gBAAgBG;IACrC,MAAMK,eAAyB,EAAE;IACjC,MAAMC,QAAQ,CAACC,MAAcC;QAC3B,IAAID,KAAKE,IAAI,IAAIF,KAAKE,IAAI,CAACC,KAAK,EAAE;YAChCL,aAAaM,IAAI,CAACH;QACpB;QACA,MAAMI,aAAaL,KAAKK,UAAU;QAClC,IAAIA,YAAY;YACdC,OAAOC,IAAI,CAACF,YAAYG,OAAO,CAAC,CAACC,WAC/BV,MAAMM,UAAU,CAACI,SAAS,EAAE,GAAGR,YAAYA,UAAUS,MAAM,GAAG,IAAI,MAAM,KAAKD,UAAU;QAE3F;IACF;IACAV,MAAMF,QAAQ;IAEd,OAAOC;AACT;AAEA,eAAeH,mBAAmBF,UAAkB;IAClD,IAAIkB,QAAG,CAACC,iBAAiB,EAAE;QACzB,OAAOC,KAAKC,KAAK,CACfC,aAAE,CACCC,YAAY,CACXC,eAAI,CAACC,IAAI,CACPP,QAAG,CAACC,iBAAiB,EACrB,UACA,OACA,eACA,4BAGHO,QAAQ;IAEf;IAEA,IAAI,CAAC3B,UAAU,CAACC,WAAW,EAAE;QAC3B,IAAI;YACFD,UAAU,CAACC,WAAW,GAAG,MAAM2B,4BAA4B3B;QAC7D,EAAE,OAAO4B,GAAQ;YACf,IAAIA,EAAEC,IAAI,KAAK,gBAAgB;gBAC7B,MAAM,IAAIC,oBAAY,CAAC,gBAAgB,CAAC,gCAAgC,CAAC;YAC3E;YAEA,MAAMF;QACR;IACF;IAEA,OAAO7B,UAAU,CAACC,WAAW;AAC/B;AAEA,eAAe2B,4BAA4B3B,UAAkB;IAC3D,gEAAgE;IAChE,MAAM+B,aAAaC,IAAAA,yBAAiB,EAAC;QACnCC,gBAAgB;QAChB,sFAAsF;QACtFC,KAAK,OAAO,KAAK,KAAK,KAAK;IAC7B;IACA,MAAMC,WAAW,MAAMJ,WAAW,CAAC,6BAA6B,EAAE/B,YAAY;IAC9E,MAAMC,OAAO,MAAMkC,SAASlC,IAAI;IAEhC,OAAOmC,IAAAA,8BAAsB,EAAanC;AAC5C"}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getNativeModuleVersionsAsync", {
enumerable: true,
get: function() {
return getNativeModuleVersionsAsync;
}
});
const _client = require("./rest/client");
const _errors = require("../utils/errors");
async function getNativeModuleVersionsAsync(sdkVersion) {
const fetchAsync = (0, _client.createCachedFetch)({
cacheDirectory: 'native-modules-cache',
// 1 minute cache
ttl: 1000 * 60
});
const response = await fetchAsync(`sdks/${sdkVersion}/native-modules`);
if (!response.ok) {
throw new _errors.CommandError('API', `Unexpected response when fetching version info from Expo servers: ${response.statusText}.`);
}
const json = await response.json();
const data = (0, _client.getResponseDataOrThrow)(json);
if (!data.length) {
throw new _errors.CommandError('VERSIONS', 'The bundled native module list from the Expo API is empty');
}
return fromBundledNativeModuleList(data);
}
function fromBundledNativeModuleList(list) {
return list.reduce((acc, i)=>{
acc[i.npmPackage] = i.versionRange;
return acc;
}, {});
}
//# sourceMappingURL=getNativeModuleVersions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/getNativeModuleVersions.ts"],"sourcesContent":["import { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\ninterface NativeModule {\n npmPackage: string;\n versionRange: string;\n}\ntype BundledNativeModuleList = NativeModule[];\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * The endpoint returns the list of bundled native modules for a given SDK version.\n * The data is populated by the `et sync-bundled-native-modules` script from expo/expo repo.\n * See the code for more details:\n * https://github.com/expo/expo/blob/main/tools/src/commands/SyncBundledNativeModules.ts\n *\n * Example result:\n * [\n * {\n * id: \"79285187-e5c4-47f7-b6a9-664f5d16f0db\",\n * sdkVersion: \"41.0.0\",\n * npmPackage: \"expo-camera\",\n * versionRange: \"~10.1.0\",\n * createdAt: \"2021-04-29T09:34:32.825Z\",\n * updatedAt: \"2021-04-29T09:34:32.825Z\"\n * },\n * ...\n * ]\n */\nexport async function getNativeModuleVersionsAsync(\n sdkVersion: string\n): Promise<BundledNativeModules> {\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'native-modules-cache',\n // 1 minute cache\n ttl: 1000 * 60,\n });\n const response = await fetchAsync(`sdks/${sdkVersion}/native-modules`);\n if (!response.ok) {\n throw new CommandError(\n 'API',\n `Unexpected response when fetching version info from Expo servers: ${response.statusText}.`\n );\n }\n\n const json = await response.json();\n const data = getResponseDataOrThrow<BundledNativeModuleList>(json);\n if (!data.length) {\n throw new CommandError('VERSIONS', 'The bundled native module list from the Expo API is empty');\n }\n return fromBundledNativeModuleList(data);\n}\n\nfunction fromBundledNativeModuleList(list: BundledNativeModuleList): BundledNativeModules {\n return list.reduce((acc, i) => {\n acc[i.npmPackage] = i.versionRange;\n return acc;\n }, {} as BundledNativeModules);\n}\n"],"names":["getNativeModuleVersionsAsync","sdkVersion","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","ok","CommandError","statusText","json","data","getResponseDataOrThrow","length","fromBundledNativeModuleList","list","reduce","acc","i","npmPackage","versionRange"],"mappings":";;;;+BA8BsBA;;;eAAAA;;;wBA9BoC;wBAC7B;AA6BtB,eAAeA,6BACpBC,UAAkB;IAElB,MAAMC,aAAaC,IAAAA,yBAAiB,EAAC;QACnCC,gBAAgB;QAChB,iBAAiB;QACjBC,KAAK,OAAO;IACd;IACA,MAAMC,WAAW,MAAMJ,WAAW,CAAC,KAAK,EAAED,WAAW,eAAe,CAAC;IACrE,IAAI,CAACK,SAASC,EAAE,EAAE;QAChB,MAAM,IAAIC,oBAAY,CACpB,OACA,CAAC,kEAAkE,EAAEF,SAASG,UAAU,CAAC,CAAC,CAAC;IAE/F;IAEA,MAAMC,OAAO,MAAMJ,SAASI,IAAI;IAChC,MAAMC,OAAOC,IAAAA,8BAAsB,EAA0BF;IAC7D,IAAI,CAACC,KAAKE,MAAM,EAAE;QAChB,MAAM,IAAIL,oBAAY,CAAC,YAAY;IACrC;IACA,OAAOM,4BAA4BH;AACrC;AAEA,SAASG,4BAA4BC,IAA6B;IAChE,OAAOA,KAAKC,MAAM,CAAC,CAACC,KAAKC;QACvBD,GAAG,CAACC,EAAEC,UAAU,CAAC,GAAGD,EAAEE,YAAY;QAClC,OAAOH;IACT,GAAG,CAAC;AACN"}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getProjectDevelopmentCertificateAsync", {
enumerable: true,
get: function() {
return getProjectDevelopmentCertificateAsync;
}
});
const _client = require("./rest/client");
const _errors = require("../utils/errors");
async function getProjectDevelopmentCertificateAsync(easProjectId, csrPEM) {
const response = await (0, _client.fetchAsync)(`projects/${encodeURIComponent(easProjectId)}/development-certificates`, {
method: 'POST',
body: JSON.stringify({
csrPEM
})
});
if (!response.ok) {
throw new _errors.CommandError('API', `Unexpected error from Expo servers: ${response.statusText}.`);
}
return await response.text();
}
//# sourceMappingURL=getProjectDevelopmentCertificate.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/getProjectDevelopmentCertificate.ts"],"sourcesContent":["import { fetchAsync } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\nexport async function getProjectDevelopmentCertificateAsync(\n easProjectId: string,\n csrPEM: string\n): Promise<string> {\n const response = await fetchAsync(\n `projects/${encodeURIComponent(easProjectId)}/development-certificates`,\n {\n method: 'POST',\n body: JSON.stringify({\n csrPEM,\n }),\n }\n );\n if (!response.ok) {\n throw new CommandError('API', `Unexpected error from Expo servers: ${response.statusText}.`);\n }\n return await response.text();\n}\n"],"names":["getProjectDevelopmentCertificateAsync","easProjectId","csrPEM","response","fetchAsync","encodeURIComponent","method","body","JSON","stringify","ok","CommandError","statusText","text"],"mappings":";;;;+BAGsBA;;;eAAAA;;;wBAHK;wBACE;AAEtB,eAAeA,sCACpBC,YAAoB,EACpBC,MAAc;IAEd,MAAMC,WAAW,MAAMC,IAAAA,kBAAU,EAC/B,CAAC,SAAS,EAAEC,mBAAmBJ,cAAc,yBAAyB,CAAC,EACvE;QACEK,QAAQ;QACRC,MAAMC,KAAKC,SAAS,CAAC;YACnBP;QACF;IACF;IAEF,IAAI,CAACC,SAASO,EAAE,EAAE;QAChB,MAAM,IAAIC,oBAAY,CAAC,OAAO,CAAC,oCAAoC,EAAER,SAASS,UAAU,CAAC,CAAC,CAAC;IAC7F;IACA,OAAO,MAAMT,SAASU,IAAI;AAC5B"}

29
node_modules/@expo/cli/build/src/api/getVersions.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getVersionsAsync", {
enumerable: true,
get: function() {
return getVersionsAsync;
}
});
const _client = require("./rest/client");
const _errors = require("../utils/errors");
async function getVersionsAsync({ skipCache } = {}) {
// Reconstruct the cached fetch since caching could be disabled.
const fetchAsync = (0, _client.createCachedFetch)({
skipCache,
cacheDirectory: 'versions-cache',
// We'll use a 5 minute cache to ensure we stay relatively up to date.
ttl: 1000 * 60 * 5
});
const results = await fetchAsync('versions/latest');
if (!results.ok) {
throw new _errors.CommandError('API', `Unexpected response when fetching version info from Expo servers: ${results.statusText}.`);
}
const json = await results.json();
return (0, _client.getResponseDataOrThrow)(json);
}
//# sourceMappingURL=getVersions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/getVersions.ts"],"sourcesContent":["import { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\n/** Represents version info for a particular SDK. */\nexport type SDKVersion = {\n /** @example \"2.16.1\" */\n iosVersion?: string;\n /** @example \"https://dpq5q02fu5f55.cloudfront.net/Exponent-2.17.4.tar.gz\" */\n iosClientUrl?: string;\n /** @example \"https://dev.to/expo/expo-sdk-38-is-now-available-5aa0\" */\n releaseNoteUrl?: string;\n /** @example \"2.17.4\" */\n iosClientVersion?: string;\n /** @example \"https://d1ahtucjixef4r.cloudfront.net/Exponent-2.16.1.apk\" */\n androidClientUrl?: string;\n /** @example \"2.16.1\" */\n androidClientVersion?: string;\n /** @example { \"typescript\": \"~3.9.5\" } */\n relatedPackages?: Record<string, string>;\n\n facebookReactNativeVersion: string;\n\n facebookReactVersion?: string;\n\n expoVersion?: string;\n\n beta?: boolean;\n};\n\nexport type SDKVersions = Record<string, SDKVersion>;\n\nexport type Versions = {\n androidUrl: string;\n androidVersion: string;\n iosUrl: string;\n iosVersion: string;\n sdkVersions: SDKVersions;\n};\n\n/** Get versions from remote endpoint. */\nexport async function getVersionsAsync({\n skipCache,\n}: { skipCache?: boolean } = {}): Promise<Versions> {\n // Reconstruct the cached fetch since caching could be disabled.\n const fetchAsync = createCachedFetch({\n skipCache,\n cacheDirectory: 'versions-cache',\n // We'll use a 5 minute cache to ensure we stay relatively up to date.\n ttl: 1000 * 60 * 5,\n });\n\n const results = await fetchAsync('versions/latest');\n if (!results.ok) {\n throw new CommandError(\n 'API',\n `Unexpected response when fetching version info from Expo servers: ${results.statusText}.`\n );\n }\n\n const json = await results.json();\n return getResponseDataOrThrow<Versions>(json);\n}\n"],"names":["getVersionsAsync","skipCache","fetchAsync","createCachedFetch","cacheDirectory","ttl","results","ok","CommandError","statusText","json","getResponseDataOrThrow"],"mappings":";;;;+BAwCsBA;;;eAAAA;;;wBAxCoC;wBAC7B;AAuCtB,eAAeA,iBAAiB,EACrCC,SAAS,EACe,GAAG,CAAC,CAAC;IAC7B,gEAAgE;IAChE,MAAMC,aAAaC,IAAAA,yBAAiB,EAAC;QACnCF;QACAG,gBAAgB;QAChB,sEAAsE;QACtEC,KAAK,OAAO,KAAK;IACnB;IAEA,MAAMC,UAAU,MAAMJ,WAAW;IACjC,IAAI,CAACI,QAAQC,EAAE,EAAE;QACf,MAAM,IAAIC,oBAAY,CACpB,OACA,CAAC,kEAAkE,EAAEF,QAAQG,UAAU,CAAC,CAAC,CAAC;IAE9F;IAEA,MAAMC,OAAO,MAAMJ,QAAQI,IAAI;IAC/B,OAAOC,IAAAA,8BAAsB,EAAWD;AAC1C"}

204
node_modules/@expo/cli/build/src/api/graphql/client.js generated vendored Normal file
View File

@@ -0,0 +1,204 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
UnexpectedServerData: function() {
return _client.UnexpectedServerData;
},
UnexpectedServerError: function() {
return _client.UnexpectedServerError;
},
graphql: function() {
return graphql;
},
query: function() {
return query;
}
});
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
const _fetch = require("../../utils/fetch");
const _endpoint = require("../endpoint");
const _client = require("../rest/client");
const _wrapFetchWithOffline = require("../rest/wrapFetchWithOffline");
const _wrapFetchWithUserAgent = require("../rest/wrapFetchWithUserAgent");
const _UserSettings = require("../user/UserSettings");
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
function graphql(query) {
return query.trim();
}
const query = (()=>{
const url = (0, _endpoint.getExpoApiBaseUrl)() + '/graphql';
let _fetch1;
const wrappedFetch = (...args)=>{
if (!_fetch1) {
_fetch1 = (0, _wrapFetchWithOffline.wrapFetchWithOffline)((0, _wrapFetchWithUserAgent.wrapFetchWithUserAgent)(_fetch.fetch));
}
return _fetch1(...args);
};
const randomDelay = (attemptCount)=>new Promise((resolve)=>{
setTimeout(resolve, Math.min(500 + Math.random() * 1000 * attemptCount, 4000));
});
const getFetchHeaders = ()=>{
var _getSession;
const token = (0, _UserSettings.getAccessToken)();
const headers = {
'content-type': 'application/json',
accept: 'application/graphql-response+json, application/graphql+json, application/json'
};
let sessionSecret;
if (token) {
headers.authorization = `Bearer ${token}`;
} else if (sessionSecret = (_getSession = (0, _UserSettings.getSession)()) == null ? void 0 : _getSession.sessionSecret) {
headers['expo-session'] = sessionSecret;
}
return headers;
};
// NOTE(@kitten): This only sorted keys one level deep since this is sufficient for most cases
const stringifySorted = (variables)=>JSON.stringify(Object.keys(variables).sort().reduce((acc, key)=>{
acc[key] = variables[key];
return acc;
}, {}));
let cache = {};
let cacheKey;
function resetCache() {
cache = {};
}
return async function query(query, variables, options) {
let isTransient = false;
let response;
let data;
let error;
// Pre-instantiate headers and reset the cache if they've changed
const headers = {
...getFetchHeaders(),
...options == null ? void 0 : options.headers
};
const headersKey = stringifySorted(headers);
if (!cacheKey || cacheKey !== headersKey) {
resetCache();
}
// Retrieve a cached result, if we have any via a `query => variables => Result` cache key
const variablesKey = stringifySorted(variables);
const queryCache = cache[query] || (cache[query] = new Map());
if (queryCache.has(variablesKey)) {
data = queryCache.get(variablesKey);
}
// Retry the query if it fails due to an unknown or transient error
for(let attemptCount = 0; attemptCount < 3 && !data; attemptCount++){
// Add a random delay on each subsequent attempt
if (attemptCount > 0) {
await randomDelay(attemptCount);
}
try {
response = await wrappedFetch(url, {
...options,
method: 'POST',
body: JSON.stringify({
query,
variables
}),
headers
});
} catch (networkError) {
error = networkError || error;
continue;
}
const json = await response.json();
if (typeof json === 'object' && json) {
// If we have a transient error, we retry immediately and discard the data
// Otherwise, we store the first available error and get the data
if ('errors' in json && Array.isArray(json.errors)) {
isTransient = json.errors.some((e)=>{
var _e_extensions;
return e == null ? void 0 : (_e_extensions = e.extensions) == null ? void 0 : _e_extensions.isTransient;
});
if (isTransient) {
data = undefined;
continue;
} else {
error = json.errors[0] || error;
}
}
try {
data = (0, _client.getResponseDataOrThrow)(json);
} catch (dataError) {
// We only use the data error, if we don't have an error already
if (!error) {
error = dataError || error;
}
continue;
}
}
}
// Store the data in the cache, and only return a result if we have any values
if (data) {
queryCache.set(variablesKey, data);
const keys = Object.keys(data);
if (keys.length > 0 && keys.some((key)=>data[key] != null)) {
return data;
}
}
// If we have an error, rethrow it wrapped in our custom errors
if (error) {
if (isTransient) {
_log.error(`We've encountered a transient error, please try again shortly.`);
}
const wrappedError = new _client.UnexpectedServerError('' + error.message);
wrappedError.cause = error;
throw wrappedError;
} else if (response && !response.ok) {
throw new _client.UnexpectedServerError(`Unexpected server error: ${response.statusText}`);
} else {
throw new _client.UnexpectedServerData('Unexpected server error: No returned query result');
}
};
})();
//# sourceMappingURL=client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppQuery", {
enumerable: true,
get: function() {
return AppQuery;
}
});
const _client = require("../client");
const AppQueryDocument = (0, _client.graphql)(`
query AppByIdQuery($appId: String!) {
app {
byId(appId: $appId) {
id
...AppFragment
}
}
}
fragment AppFragment on App {
id
scopeKey
ownerAccount {
id
name
}
}
`);
const AppQuery = {
async byIdAsync (projectId) {
const data = await (0, _client.query)(AppQueryDocument, {
appId: projectId
});
return data.app.byId;
}
};
//# sourceMappingURL=AppQuery.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/api/graphql/queries/AppQuery.ts"],"sourcesContent":["import { graphql, query } from '../client';\n\nexport type App = {\n id: string;\n scopeKey: string;\n ownerAccount: {\n id: string;\n name: string;\n };\n};\n\ntype AppQueryData = {\n app: {\n byId: App;\n };\n};\n\ntype AppQueryVariables = {\n appId: string;\n};\n\nconst AppQueryDocument = graphql<AppQueryData, AppQueryVariables>(`\n query AppByIdQuery($appId: String!) {\n app {\n byId(appId: $appId) {\n id\n ...AppFragment\n }\n }\n }\n\n fragment AppFragment on App {\n id\n scopeKey\n ownerAccount {\n id\n name\n }\n }\n`);\n\nexport const AppQuery = {\n async byIdAsync(projectId: string): Promise<AppQueryData['app']['byId']> {\n const data = await query(AppQueryDocument, { appId: projectId });\n return data.app.byId;\n },\n};\n"],"names":["AppQuery","AppQueryDocument","graphql","byIdAsync","projectId","data","query","appId","app","byId"],"mappings":";;;;+BAyCaA;;;eAAAA;;;wBAzCkB;AAqB/B,MAAMC,mBAAmBC,IAAAA,eAAO,EAAkC,CAAC;;;;;;;;;;;;;;;;;;AAkBnE,CAAC;AAEM,MAAMF,WAAW;IACtB,MAAMG,WAAUC,SAAiB;QAC/B,MAAMC,OAAO,MAAMC,IAAAA,aAAK,EAACL,kBAAkB;YAAEM,OAAOH;QAAU;QAC9D,OAAOC,KAAKG,GAAG,CAACC,IAAI;IACtB;AACF"}

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "UserQuery", {
enumerable: true,
get: function() {
return UserQuery;
}
});
const _client = require("../client");
const CurrentUserDocument = (0, _client.graphql)(`
query CurrentUser {
meActor {
__typename
id
... on UserActor {
primaryAccount {
id
}
username
}
... on Robot {
firstName
}
accounts {
id
users {
actor {
__typename
id
}
permissions
}
}
}
}
`);
const UserQueryDocument = (0, _client.graphql)(`
query UserQuery {
meUserActor {
id
username
}
}
`);
const UserQuery = {
async currentUserAsync () {
const data = await (0, _client.query)(CurrentUserDocument, {});
return data.meActor;
},
async meUserActorAsync (headers) {
const data = await (0, _client.query)(UserQueryDocument, {}, {
headers
});
return {
id: data.meUserActor.id,
username: data.meUserActor.username
};
}
};
//# sourceMappingURL=UserQuery.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/api/graphql/queries/UserQuery.ts"],"sourcesContent":["import { graphql, query } from '../client';\n\nexport type Permission = 'ADMIN' | 'OWN' | 'PUBLISH' | 'VIEW';\n\ntype CurrentUserDataUser = {\n permissions: Permission[];\n actor: {\n __typename: 'Robot' | 'SSOUser' | 'User';\n id: string;\n };\n};\n\ntype CurrentUserDataAccount = {\n __typename?: 'Account';\n id: string;\n users: CurrentUserDataUser[];\n};\n\nexport type Actor =\n | {\n __typename: 'Robot';\n firstName?: string | null;\n id: string;\n accounts: CurrentUserDataAccount[];\n }\n | {\n __typename: 'SSOUser' | 'User';\n id: string;\n username: string;\n primaryAccount: {\n id: string;\n };\n accounts: CurrentUserDataAccount[];\n };\n\ntype CurrentUserData = {\n meActor: Actor | null;\n};\n\nconst CurrentUserDocument = graphql<CurrentUserData>(`\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 __typename\n id\n }\n permissions\n }\n }\n }\n }\n`);\n\ntype UserQueryData = {\n meUserActor: {\n id: string;\n username: string;\n };\n};\n\nconst UserQueryDocument = graphql<UserQueryData>(`\n query UserQuery {\n meUserActor {\n id\n username\n }\n }\n`);\n\nexport const UserQuery = {\n async currentUserAsync() {\n const data = await query(CurrentUserDocument, {});\n return data.meActor;\n },\n async meUserActorAsync(headers: Record<string, string>) {\n const data = await query(UserQueryDocument, {}, { headers });\n return {\n id: data.meUserActor.id,\n username: data.meUserActor.username,\n };\n },\n};\n"],"names":["UserQuery","CurrentUserDocument","graphql","UserQueryDocument","currentUserAsync","data","query","meActor","meUserActorAsync","headers","id","meUserActor","username"],"mappings":";;;;+BAmFaA;;;eAAAA;;;wBAnFkB;AAuC/B,MAAMC,sBAAsBC,IAAAA,eAAO,EAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BtD,CAAC;AASD,MAAMC,oBAAoBD,IAAAA,eAAO,EAAgB,CAAC;;;;;;;AAOlD,CAAC;AAEM,MAAMF,YAAY;IACvB,MAAMI;QACJ,MAAMC,OAAO,MAAMC,IAAAA,aAAK,EAACL,qBAAqB,CAAC;QAC/C,OAAOI,KAAKE,OAAO;IACrB;IACA,MAAMC,kBAAiBC,OAA+B;QACpD,MAAMJ,OAAO,MAAMC,IAAAA,aAAK,EAACH,mBAAmB,CAAC,GAAG;YAAEM;QAAQ;QAC1D,OAAO;YACLC,IAAIL,KAAKM,WAAW,CAACD,EAAE;YACvBE,UAAUP,KAAKM,WAAW,CAACC,QAAQ;QACrC;IACF;AACF"}

View File

@@ -0,0 +1,184 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "FileSystemResponseCache", {
enumerable: true,
get: function() {
return FileSystemResponseCache;
}
});
function _nodecrypto() {
const data = /*#__PURE__*/ _interop_require_default(require("node:crypto"));
_nodecrypto = function() {
return data;
};
return data;
}
function _nodefs() {
const data = /*#__PURE__*/ _interop_require_default(require("node:fs"));
_nodefs = function() {
return data;
};
return data;
}
function _nodepath() {
const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
_nodepath = function() {
return data;
};
return data;
}
function _nodestream() {
const data = /*#__PURE__*/ _interop_require_wildcard(require("node:stream"));
_nodestream = function() {
return data;
};
return data;
}
const _dir = require("../../../utils/dir");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
class FileSystemResponseCache {
constructor(options){
this.cacheDirectory = options.cacheDirectory;
this.timeToLive = options.ttl;
}
getFilePaths(cacheKey) {
// Create a hash of the cache key to use as filename
const hash = _nodecrypto().default.createHash('sha256').update(cacheKey).digest('hex');
return {
info: _nodepath().default.join(this.cacheDirectory, `${hash}-info.json`),
body: _nodepath().default.join(this.cacheDirectory, `${hash}-body.bin`)
};
}
/** Retrieve the cache response, if any */ async get(cacheKey) {
const paths = this.getFilePaths(cacheKey);
if (!await (0, _dir.fileExistsAsync)(paths.info)) {
return undefined;
}
// Read and parse the info file
const infoBuffer = await _nodefs().default.promises.readFile(paths.info);
try {
const responseInfo = JSON.parse(infoBuffer.toString());
// Check if the response has expired
if (responseInfo.expiration && responseInfo.expiration < Date.now()) {
await this.remove(cacheKey);
return undefined;
}
// Remove cache-specific data from the response info
const { empty, expiration, bodyPath, ...cleanInfo } = responseInfo;
// Create response body stream
let responseBody;
if (empty) {
responseBody = _nodestream().Readable.toWeb(_nodestream().Readable.from(Buffer.alloc(0)));
} else {
const bodyBuffer = await _nodefs().default.promises.readFile(paths.body);
responseBody = _nodestream().Readable.toWeb(_nodestream().Readable.from(bodyBuffer));
}
return {
body: responseBody,
info: cleanInfo
};
} catch {
// If file doesn't exist or other errors, return undefined
return undefined;
}
}
/** Store the response for caching */ async set(cacheKey, response) {
await _nodefs().default.promises.mkdir(this.cacheDirectory, {
recursive: true
});
const paths = this.getFilePaths(cacheKey);
// Create a copy of the response info, to add cache-specific data
const responseInfo = {
...response.info
};
// Add expiration time if the "time to live" is set
if (typeof this.timeToLive === 'number') {
responseInfo.expiration = Date.now() + this.timeToLive;
}
try {
// Clone the response body stream since we need to read it twice
const [forSize, forWrite] = response.body.tee();
// Check if the body is empty by reading the first stream
const reader = forSize.getReader();
const { value } = await reader.read();
reader.releaseLock();
if (!value || value.length === 0) {
responseInfo.empty = true;
} else {
// Create write stream and pipe response body to file
const writeStream = _nodefs().default.createWriteStream(paths.body);
const nodeStream = _nodestream().Readable.fromWeb(forWrite);
nodeStream.pipe(writeStream);
// Wait for the stream to finish
await _nodestream().default.promises.finished(writeStream);
responseInfo.bodyPath = paths.body;
}
// Write info to file
await _nodefs().default.promises.writeFile(paths.info, JSON.stringify(responseInfo));
return await this.get(cacheKey);
} catch (error) {
// Clean up any partially written files
await this.remove(cacheKey);
throw error;
}
}
/** Remove the response from caching */ async remove(cacheKey) {
const paths = this.getFilePaths(cacheKey);
await removeAllAsync(paths.info, paths.body);
}
}
function removeAllAsync(...paths) {
return Promise.all(paths.map((path)=>_nodefs().default.promises.rm(path, {
recursive: true,
force: true
}).catch(()=>{})));
}
//# sourceMappingURL=FileSystemResponseCache.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,116 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getRequestBodyCacheData: function() {
return getRequestBodyCacheData;
},
getRequestCacheKey: function() {
return getRequestCacheKey;
},
getRequestInfoCacheData: function() {
return getRequestInfoCacheData;
},
getResponseInfo: function() {
return getResponseInfo;
}
});
function _crypto() {
const data = /*#__PURE__*/ _interop_require_default(require("crypto"));
_crypto = function() {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function() {
return data;
};
return data;
}
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const GLOBAL_CACHE_VERSION = 4;
function getResponseInfo(response) {
const headers = Object.fromEntries(response.headers.entries());
delete headers['set-cookie'];
return {
url: response.url,
status: response.status,
statusText: response.statusText,
headers
};
}
function getRequestCacheKey(info, init) {
const infoKeyData = getRequestInfoCacheData(info);
const initKeyData = {
body: (init == null ? void 0 : init.body) ? getRequestBodyCacheData(init.body) : undefined
};
return _crypto().default.createHash('md5').update(JSON.stringify([
infoKeyData,
initKeyData,
GLOBAL_CACHE_VERSION
])).digest('hex');
}
function getRequestInfoCacheData(info) {
if (typeof info === 'string') {
return {
url: info
};
}
if (info instanceof URL) {
return {
url: info.toString()
};
}
if (info instanceof Request) {
return {
// cache: req.cache,
credentials: info.credentials.toString(),
destination: info.destination.toString(),
headers: Object.fromEntries(info.headers.entries()),
integrity: info.integrity,
method: info.method,
redirect: info.redirect,
referrer: info.referrer,
referrerPolicy: info.referrerPolicy,
url: info.url.toString()
};
}
throw new Error('Unsupported request info type for caching: ' + typeof info);
}
function getRequestBodyCacheData(body) {
if (!body) {
return body;
}
if (typeof body === 'string') {
return body;
}
if (body instanceof URLSearchParams) {
return body.toString();
}
// Supported for legacy purposes because node-fetch uses fs.readStream
if (body instanceof _fs().ReadStream) {
return body.path;
}
if (body.toString && body.toString() === '[object FormData]') {
return new URLSearchParams(body).toString();
}
if (body instanceof Buffer) {
return body.toString();
}
throw new Error(`Unsupported request body type for caching: ${typeof body}`);
}
//# sourceMappingURL=ResponseCache.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapFetchWithCache", {
enumerable: true,
get: function() {
return wrapFetchWithCache;
}
});
function _fetchnodeshim() {
const data = require("fetch-nodeshim");
_fetchnodeshim = function() {
return data;
};
return data;
}
const _ResponseCache = require("./ResponseCache");
const debug = require('debug')('expo:fetch-cache');
function wrapFetchWithCache(fetch, cache) {
return async function cachedFetch(url, init) {
const cacheKey = (0, _ResponseCache.getRequestCacheKey)(url, init);
const cachedResponse = await cache.get(cacheKey);
if (cachedResponse) {
return new (_fetchnodeshim()).Response(cachedResponse.body, cachedResponse.info);
}
await lock(cacheKey);
try {
// Retry loading from cache, in case it was stored during the lock
let cachedResponse = await cache.get(cacheKey);
if (cachedResponse) {
return new (_fetchnodeshim()).Response(cachedResponse.body, cachedResponse.info);
}
// Execute the fetch request
const response = await fetch(url, init);
if (!response.ok || !response.body) {
return response;
}
// Cache the response
cachedResponse = await cache.set(cacheKey, {
body: response.body,
info: (0, _ResponseCache.getResponseInfo)(response)
});
// Warn through debug logs that caching failed
if (!cachedResponse) {
debug(`Failed to cache response for: ${url}`);
await cache.remove(cacheKey);
return response;
}
// Return the cached response
return new (_fetchnodeshim()).Response(cachedResponse.body, cachedResponse.info);
} finally{
unlock(cacheKey);
}
};
}
const lockPromiseForKey = {};
const unlockFunctionForKey = {};
async function lock(key) {
if (!lockPromiseForKey[key]) {
lockPromiseForKey[key] = Promise.resolve();
}
const takeLockPromise = lockPromiseForKey[key];
lockPromiseForKey[key] = takeLockPromise.then(()=>new Promise((fulfill)=>{
unlockFunctionForKey[key] = fulfill;
}));
return takeLockPromise;
}
function unlock(key) {
if (unlockFunctionForKey[key]) {
unlockFunctionForKey[key]();
delete unlockFunctionForKey[key];
}
}
//# sourceMappingURL=wrapFetchWithCache.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/api/rest/cache/wrapFetchWithCache.ts"],"sourcesContent":["import { Response, type RequestInfo, type RequestInit } from 'fetch-nodeshim';\n\nimport { getRequestCacheKey, getResponseInfo, type ResponseCache } from './ResponseCache';\nimport type { FetchLike } from '../client.types';\n\nconst debug = require('debug')('expo:fetch-cache');\n\nexport function wrapFetchWithCache(fetch: FetchLike, cache: ResponseCache): FetchLike {\n return async function cachedFetch(url: RequestInfo, init?: RequestInit) {\n const cacheKey = getRequestCacheKey(url, init);\n const cachedResponse = await cache.get(cacheKey);\n if (cachedResponse) {\n return new Response(cachedResponse.body, cachedResponse.info);\n }\n\n await lock(cacheKey);\n\n try {\n // Retry loading from cache, in case it was stored during the lock\n let cachedResponse = await cache.get(cacheKey);\n if (cachedResponse) {\n return new Response(cachedResponse.body, cachedResponse.info);\n }\n\n // Execute the fetch request\n const response = await fetch(url, init);\n if (!response.ok || !response.body) {\n return response;\n }\n\n // Cache the response\n cachedResponse = await cache.set(cacheKey, {\n body: response.body,\n info: getResponseInfo(response),\n });\n\n // Warn through debug logs that caching failed\n if (!cachedResponse) {\n debug(`Failed to cache response for: ${url}`);\n await cache.remove(cacheKey);\n return response;\n }\n\n // Return the cached response\n return new Response(cachedResponse.body, cachedResponse.info);\n } finally {\n unlock(cacheKey);\n }\n };\n}\n\nconst lockPromiseForKey: Record<string, Promise<any>> = {};\nconst unlockFunctionForKey: Record<string, any> = {};\n\nasync function lock(key: string) {\n if (!lockPromiseForKey[key]) {\n lockPromiseForKey[key] = Promise.resolve();\n }\n\n const takeLockPromise = lockPromiseForKey[key];\n lockPromiseForKey[key] = takeLockPromise.then(\n () =>\n new Promise((fulfill) => {\n unlockFunctionForKey[key] = fulfill;\n })\n );\n\n return takeLockPromise;\n}\n\nfunction unlock(key: string) {\n if (unlockFunctionForKey[key]) {\n unlockFunctionForKey[key]();\n delete unlockFunctionForKey[key];\n }\n}\n"],"names":["wrapFetchWithCache","debug","require","fetch","cache","cachedFetch","url","init","cacheKey","getRequestCacheKey","cachedResponse","get","Response","body","info","lock","response","ok","set","getResponseInfo","remove","unlock","lockPromiseForKey","unlockFunctionForKey","key","Promise","resolve","takeLockPromise","then","fulfill"],"mappings":";;;;+BAOgBA;;;eAAAA;;;;yBAP6C;;;;;;+BAEW;AAGxE,MAAMC,QAAQC,QAAQ,SAAS;AAExB,SAASF,mBAAmBG,KAAgB,EAAEC,KAAoB;IACvE,OAAO,eAAeC,YAAYC,GAAgB,EAAEC,IAAkB;QACpE,MAAMC,WAAWC,IAAAA,iCAAkB,EAACH,KAAKC;QACzC,MAAMG,iBAAiB,MAAMN,MAAMO,GAAG,CAACH;QACvC,IAAIE,gBAAgB;YAClB,OAAO,IAAIE,CAAAA,gBAAO,UAAC,CAACF,eAAeG,IAAI,EAAEH,eAAeI,IAAI;QAC9D;QAEA,MAAMC,KAAKP;QAEX,IAAI;YACF,kEAAkE;YAClE,IAAIE,iBAAiB,MAAMN,MAAMO,GAAG,CAACH;YACrC,IAAIE,gBAAgB;gBAClB,OAAO,IAAIE,CAAAA,gBAAO,UAAC,CAACF,eAAeG,IAAI,EAAEH,eAAeI,IAAI;YAC9D;YAEA,4BAA4B;YAC5B,MAAME,WAAW,MAAMb,MAAMG,KAAKC;YAClC,IAAI,CAACS,SAASC,EAAE,IAAI,CAACD,SAASH,IAAI,EAAE;gBAClC,OAAOG;YACT;YAEA,qBAAqB;YACrBN,iBAAiB,MAAMN,MAAMc,GAAG,CAACV,UAAU;gBACzCK,MAAMG,SAASH,IAAI;gBACnBC,MAAMK,IAAAA,8BAAe,EAACH;YACxB;YAEA,8CAA8C;YAC9C,IAAI,CAACN,gBAAgB;gBACnBT,MAAM,CAAC,8BAA8B,EAAEK,KAAK;gBAC5C,MAAMF,MAAMgB,MAAM,CAACZ;gBACnB,OAAOQ;YACT;YAEA,6BAA6B;YAC7B,OAAO,IAAIJ,CAAAA,gBAAO,UAAC,CAACF,eAAeG,IAAI,EAAEH,eAAeI,IAAI;QAC9D,SAAU;YACRO,OAAOb;QACT;IACF;AACF;AAEA,MAAMc,oBAAkD,CAAC;AACzD,MAAMC,uBAA4C,CAAC;AAEnD,eAAeR,KAAKS,GAAW;IAC7B,IAAI,CAACF,iBAAiB,CAACE,IAAI,EAAE;QAC3BF,iBAAiB,CAACE,IAAI,GAAGC,QAAQC,OAAO;IAC1C;IAEA,MAAMC,kBAAkBL,iBAAiB,CAACE,IAAI;IAC9CF,iBAAiB,CAACE,IAAI,GAAGG,gBAAgBC,IAAI,CAC3C,IACE,IAAIH,QAAQ,CAACI;YACXN,oBAAoB,CAACC,IAAI,GAAGK;QAC9B;IAGJ,OAAOF;AACT;AAEA,SAASN,OAAOG,GAAW;IACzB,IAAID,oBAAoB,CAACC,IAAI,EAAE;QAC7BD,oBAAoB,CAACC,IAAI;QACzB,OAAOD,oBAAoB,CAACC,IAAI;IAClC;AACF"}

168
node_modules/@expo/cli/build/src/api/rest/client.js generated vendored Normal file
View File

@@ -0,0 +1,168 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ApiV2Error: function() {
return ApiV2Error;
},
UnexpectedServerData: function() {
return UnexpectedServerData;
},
UnexpectedServerError: function() {
return UnexpectedServerError;
},
createCachedFetch: function() {
return createCachedFetch;
},
fetchAsync: function() {
return fetchAsync;
},
getResponseDataOrThrow: function() {
return getResponseDataOrThrow;
},
wrapFetchWithCredentials: function() {
return wrapFetchWithCredentials;
}
});
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _wrapFetchWithCache = require("./cache/wrapFetchWithCache");
const _wrapFetchWithBaseUrl = require("./wrapFetchWithBaseUrl");
const _wrapFetchWithOffline = require("./wrapFetchWithOffline");
const _wrapFetchWithProgress = require("./wrapFetchWithProgress");
const _wrapFetchWithUserAgent = require("./wrapFetchWithUserAgent");
const _env = require("../../utils/env");
const _errors = require("../../utils/errors");
const _fetch = require("../../utils/fetch");
const _endpoint = require("../endpoint");
const _settings = require("../settings");
const _UserSettings = require("../user/UserSettings");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class ApiV2Error extends Error {
constructor(response){
super(response.message), this.name = 'ApiV2Error';
this.code = response.code;
this.expoApiV2ErrorCode = response.code;
this.expoApiV2ErrorDetails = response.details;
this.expoApiV2ErrorServerStack = response.stack;
this.expoApiV2ErrorMetadata = response.metadata;
this.expoApiV2RequestId = response.requestId;
}
toString() {
return `${super.toString()}${_env.env.EXPO_DEBUG && this.expoApiV2RequestId ? ` (Request Id: ${this.expoApiV2RequestId})` : ''}`;
}
}
class UnexpectedServerError extends Error {
constructor(...args){
super(...args), this.name = 'UnexpectedServerError';
}
}
class UnexpectedServerData extends Error {
constructor(...args){
super(...args), this.name = 'UnexpectedServerData';
}
}
function getResponseDataOrThrow(json) {
if (!!json && typeof json === 'object' && 'data' in json) {
return json.data;
}
throw new UnexpectedServerData(!!json && typeof json === 'object' ? JSON.stringify(json) : 'Unknown data received from server.');
}
function wrapFetchWithCredentials(fetchFunction) {
return async function fetchWithCredentials(url, options = {}) {
if (Array.isArray(options.headers)) {
throw new Error('request headers must be in object form');
}
const resolvedHeaders = options.headers ?? {};
const token = (0, _UserSettings.getAccessToken)();
if (token) {
resolvedHeaders.authorization = `Bearer ${token}`;
} else {
var _getSession;
const sessionSecret = (_getSession = (0, _UserSettings.getSession)()) == null ? void 0 : _getSession.sessionSecret;
if (sessionSecret) {
resolvedHeaders['expo-session'] = sessionSecret;
}
}
try {
const response = await fetchFunction(url, {
...options,
headers: resolvedHeaders
});
// Handle expected API errors (4xx)
if (response.status >= 400 && response.status < 500) {
const body = await response.text();
try {
var _data_errors;
const data = JSON.parse(body);
if (data == null ? void 0 : (_data_errors = data.errors) == null ? void 0 : _data_errors.length) {
throw new ApiV2Error(data.errors[0]);
}
} catch (error) {
// Server returned non-json response.
if (error.message.includes('in JSON at position')) {
throw new UnexpectedServerError(body);
}
throw error;
}
}
return response;
} catch (error) {
// When running `expo start`, but wifi or internet has issues
if (isNetworkError(error) || 'cause' in error && isNetworkError(error.cause)) {
(0, _settings.disableNetwork)();
throw new _errors.CommandError('OFFLINE', 'Network connection is unreliable. Try again with the environment variable `EXPO_OFFLINE=1` to skip network requests.');
}
throw error;
}
};
}
/**
* Determine if the provided error is related to a network issue.
* When this returns true, offline mode should be enabled.
* - `ENOTFOUND` is thrown when the DNS lookup failed
* - `EAI_AGAIN` is thrown when DNS lookup failed due to a server-side error
* - `UND_ERR_CONNECT_TIMEOUT` is thrown after DNS is resolved, but server can't be reached
*
* @see https://nodejs.org/api/errors.html
* @see https://github.com/nodejs/undici#network-address-family-autoselection
*/ function isNetworkError(error) {
return 'code' in error && error.code && [
'ENOTFOUND',
'EAI_AGAIN',
'UND_ERR_CONNECT_TIMEOUT'
].includes(error.code);
}
const fetchWithOffline = (0, _wrapFetchWithOffline.wrapFetchWithOffline)((0, _wrapFetchWithUserAgent.wrapFetchWithUserAgent)(_fetch.fetch));
const fetchWithBaseUrl = (0, _wrapFetchWithBaseUrl.wrapFetchWithBaseUrl)(fetchWithOffline, (0, _endpoint.getExpoApiBaseUrl)() + '/v2/');
const fetchWithCredentials = (0, _wrapFetchWithProgress.wrapFetchWithProgress)(wrapFetchWithCredentials(fetchWithBaseUrl));
function createCachedFetch({ fetch = fetchWithCredentials, cacheDirectory, ttl, skipCache }) {
// Disable all caching in EXPO_BETA.
if (skipCache || _env.env.EXPO_BETA || _env.env.EXPO_NO_CACHE) {
return fetch;
}
const { FileSystemResponseCache } = require('./cache/FileSystemResponseCache');
return (0, _wrapFetchWithCache.wrapFetchWithCache)(fetch, new FileSystemResponseCache({
cacheDirectory: _path().default.join((0, _UserSettings.getExpoHomeDirectory)(), cacheDirectory),
ttl
}));
}
const fetchAsync = (0, _wrapFetchWithProgress.wrapFetchWithProgress)(wrapFetchWithCredentials(fetchWithBaseUrl));
//# sourceMappingURL=client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=client.types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapFetchWithBaseUrl", {
enumerable: true,
get: function() {
return wrapFetchWithBaseUrl;
}
});
function _url() {
const data = require("url");
_url = function() {
return data;
};
return data;
}
function wrapFetchWithBaseUrl(fetch, baseUrl) {
// NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.
return (url, init)=>{
if (typeof url !== 'string') {
throw new TypeError('Custom fetch function only accepts a string URL as the first parameter');
}
const parsed = new (_url()).URL(url, baseUrl);
if (init == null ? void 0 : init.searchParams) {
parsed.search = init.searchParams.toString();
}
return fetch(parsed.toString(), init);
};
}
//# sourceMappingURL=wrapFetchWithBaseUrl.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/api/rest/wrapFetchWithBaseUrl.ts"],"sourcesContent":["import { URL } from 'url';\n\nimport { FetchLike } from './client.types';\n\n// const debug = require('debug')('expo:api:fetch:base') as typeof console.log;\n\n/**\n * Wrap a fetch function with support for a predefined base URL.\n * This implementation works like the browser fetch, applying the input to a prefix base URL.\n */\nexport function wrapFetchWithBaseUrl(fetch: FetchLike, baseUrl: string): FetchLike {\n // NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.\n return (url, init) => {\n if (typeof url !== 'string') {\n throw new TypeError('Custom fetch function only accepts a string URL as the first parameter');\n }\n const parsed = new URL(url, baseUrl);\n if (init?.searchParams) {\n parsed.search = init.searchParams.toString();\n }\n return fetch(parsed.toString(), init);\n };\n}\n"],"names":["wrapFetchWithBaseUrl","fetch","baseUrl","url","init","TypeError","parsed","URL","searchParams","search","toString"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;yBAVI;;;;;;AAUb,SAASA,qBAAqBC,KAAgB,EAAEC,OAAe;IACpE,mFAAmF;IACnF,OAAO,CAACC,KAAKC;QACX,IAAI,OAAOD,QAAQ,UAAU;YAC3B,MAAM,IAAIE,UAAU;QACtB;QACA,MAAMC,SAAS,IAAIC,CAAAA,MAAE,KAAC,CAACJ,KAAKD;QAC5B,IAAIE,wBAAAA,KAAMI,YAAY,EAAE;YACtBF,OAAOG,MAAM,GAAGL,KAAKI,YAAY,CAACE,QAAQ;QAC5C;QACA,OAAOT,MAAMK,OAAOI,QAAQ,IAAIN;IAClC;AACF"}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapFetchWithOffline", {
enumerable: true,
get: function() {
return wrapFetchWithOffline;
}
});
const _env = require("../../utils/env");
const debug = require('debug')('expo:api:fetch:offline');
function wrapFetchWithOffline(fetchFunction) {
// NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.
return function fetchWithOffline(url, options = {}) {
if (_env.env.EXPO_OFFLINE) {
debug('Skipping network request: ' + url);
const abortController = new AbortController();
abortController.abort();
options.signal = abortController.signal;
}
return fetchFunction(url, options);
};
}
//# sourceMappingURL=wrapFetchWithOffline.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/api/rest/wrapFetchWithOffline.ts"],"sourcesContent":["import { FetchLike } from './client.types';\nimport { env } from '../../utils/env';\n\nconst debug = require('debug')('expo:api:fetch:offline') as typeof console.log;\n\n/** Wrap fetch with support for `EXPO_OFFLINE` to disable network requests. */\nexport function wrapFetchWithOffline(fetchFunction: FetchLike): FetchLike {\n // NOTE(EvanBacon): DO NOT RETURN AN ASYNC WRAPPER. THIS BREAKS LOADING INDICATORS.\n return function fetchWithOffline(url, options = {}) {\n if (env.EXPO_OFFLINE) {\n debug('Skipping network request: ' + url);\n const abortController = new AbortController();\n abortController.abort();\n options.signal = abortController.signal;\n }\n return fetchFunction(url, options);\n };\n}\n"],"names":["wrapFetchWithOffline","debug","require","fetchFunction","fetchWithOffline","url","options","env","EXPO_OFFLINE","abortController","AbortController","abort","signal"],"mappings":";;;;+BAMgBA;;;eAAAA;;;qBALI;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,SAASF,qBAAqBG,aAAwB;IAC3D,mFAAmF;IACnF,OAAO,SAASC,iBAAiBC,GAAG,EAAEC,UAAU,CAAC,CAAC;QAChD,IAAIC,QAAG,CAACC,YAAY,EAAE;YACpBP,MAAM,+BAA+BI;YACrC,MAAMI,kBAAkB,IAAIC;YAC5BD,gBAAgBE,KAAK;YACrBL,QAAQM,MAAM,GAAGH,gBAAgBG,MAAM;QACzC;QACA,OAAOT,cAAcE,KAAKC;IAC5B;AACF"}

View File

@@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapFetchWithProgress", {
enumerable: true,
get: function() {
return wrapFetchWithProgress;
}
});
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
const debug = require('debug')('expo:api:fetch:progress');
function wrapFetchWithProgress(fetch) {
return function fetchWithProgress(url, init) {
return fetch(url, init).then((response)=>{
const onProgress = init == null ? void 0 : init.onProgress;
// Abort if no `onProgress` is provided, the request failed, or there is no response body
if (!onProgress || !response.ok || !response.body) {
return response;
}
// Calculate total progress size
const contentLength = response.headers.get('Content-Length');
const progressTotal = Number(contentLength);
debug(`Download size: %d`, progressTotal);
// Abort if the `Content-Length` header is missing or invalid
if (!progressTotal || isNaN(progressTotal) || progressTotal < 0) {
_log.warn('Progress callback not supported for network request because "Content-Length" header missing or invalid in response from URL:', url.toString());
return response;
}
debug(`Starting progress animation for: %s`, url);
// Initialize the progression variables
let progressCurrent = 0;
const progressUpdate = ()=>{
const progress = progressCurrent / progressTotal || 0;
onProgress({
progress,
total: progressTotal,
loaded: progressCurrent
});
};
// Create a new body-wrapping stream that handles the progression methods
const bodyReader = response.body.getReader();
const bodyWithProgress = new ReadableStream({
start (controller) {
function next() {
bodyReader.read().then(({ done, value })=>{
// Close the controller once stream is done
if (done) return controller.close();
// Update the progression
progressCurrent += Buffer.byteLength(value);
progressUpdate();
// Continue the stream, and read the next chunk
controller.enqueue(value);
next();
});
}
progressUpdate();
next();
}
});
// Return the new response with the wrapped body stream
return new Response(bodyWithProgress, response);
});
};
}
//# sourceMappingURL=wrapFetchWithProgress.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/api/rest/wrapFetchWithProgress.ts"],"sourcesContent":["import { FetchLike } from './client.types';\nimport * as Log from '../../log';\n\nconst debug = require('debug')('expo:api:fetch:progress') as typeof console.log;\n\nexport function wrapFetchWithProgress(fetch: FetchLike): FetchLike {\n return function fetchWithProgress(url, init) {\n return fetch(url, init).then((response) => {\n const onProgress = init?.onProgress;\n\n // Abort if no `onProgress` is provided, the request failed, or there is no response body\n if (!onProgress || !response.ok || !response.body) {\n return response;\n }\n\n // Calculate total progress size\n const contentLength = response.headers.get('Content-Length');\n const progressTotal = Number(contentLength);\n\n debug(`Download size: %d`, progressTotal);\n\n // Abort if the `Content-Length` header is missing or invalid\n if (!progressTotal || isNaN(progressTotal) || progressTotal < 0) {\n Log.warn(\n 'Progress callback not supported for network request because \"Content-Length\" header missing or invalid in response from URL:',\n url.toString()\n );\n return response;\n }\n\n debug(`Starting progress animation for: %s`, url);\n\n // Initialize the progression variables\n let progressCurrent = 0;\n const progressUpdate = () => {\n const progress = progressCurrent / progressTotal || 0;\n onProgress({\n progress,\n total: progressTotal,\n loaded: progressCurrent,\n });\n };\n\n // Create a new body-wrapping stream that handles the progression methods\n const bodyReader = response.body.getReader();\n const bodyWithProgress = new ReadableStream({\n start(controller) {\n function next() {\n bodyReader.read().then(({ done, value }) => {\n // Close the controller once stream is done\n if (done) return controller.close();\n\n // Update the progression\n progressCurrent += Buffer.byteLength(value);\n progressUpdate();\n\n // Continue the stream, and read the next chunk\n controller.enqueue(value);\n next();\n });\n }\n\n progressUpdate();\n next();\n },\n });\n\n // Return the new response with the wrapped body stream\n return new Response(bodyWithProgress as any, response);\n });\n };\n}\n"],"names":["wrapFetchWithProgress","debug","require","fetch","fetchWithProgress","url","init","then","response","onProgress","ok","body","contentLength","headers","get","progressTotal","Number","isNaN","Log","warn","toString","progressCurrent","progressUpdate","progress","total","loaded","bodyReader","getReader","bodyWithProgress","ReadableStream","start","controller","next","read","done","value","close","Buffer","byteLength","enqueue","Response"],"mappings":";;;;+BAKgBA;;;eAAAA;;;6DAJK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMC,QAAQC,QAAQ,SAAS;AAExB,SAASF,sBAAsBG,KAAgB;IACpD,OAAO,SAASC,kBAAkBC,GAAG,EAAEC,IAAI;QACzC,OAAOH,MAAME,KAAKC,MAAMC,IAAI,CAAC,CAACC;YAC5B,MAAMC,aAAaH,wBAAAA,KAAMG,UAAU;YAEnC,yFAAyF;YACzF,IAAI,CAACA,cAAc,CAACD,SAASE,EAAE,IAAI,CAACF,SAASG,IAAI,EAAE;gBACjD,OAAOH;YACT;YAEA,gCAAgC;YAChC,MAAMI,gBAAgBJ,SAASK,OAAO,CAACC,GAAG,CAAC;YAC3C,MAAMC,gBAAgBC,OAAOJ;YAE7BX,MAAM,CAAC,iBAAiB,CAAC,EAAEc;YAE3B,6DAA6D;YAC7D,IAAI,CAACA,iBAAiBE,MAAMF,kBAAkBA,gBAAgB,GAAG;gBAC/DG,KAAIC,IAAI,CACN,gIACAd,IAAIe,QAAQ;gBAEd,OAAOZ;YACT;YAEAP,MAAM,CAAC,mCAAmC,CAAC,EAAEI;YAE7C,uCAAuC;YACvC,IAAIgB,kBAAkB;YACtB,MAAMC,iBAAiB;gBACrB,MAAMC,WAAWF,kBAAkBN,iBAAiB;gBACpDN,WAAW;oBACTc;oBACAC,OAAOT;oBACPU,QAAQJ;gBACV;YACF;YAEA,yEAAyE;YACzE,MAAMK,aAAalB,SAASG,IAAI,CAACgB,SAAS;YAC1C,MAAMC,mBAAmB,IAAIC,eAAe;gBAC1CC,OAAMC,UAAU;oBACd,SAASC;wBACPN,WAAWO,IAAI,GAAG1B,IAAI,CAAC,CAAC,EAAE2B,IAAI,EAAEC,KAAK,EAAE;4BACrC,2CAA2C;4BAC3C,IAAID,MAAM,OAAOH,WAAWK,KAAK;4BAEjC,yBAAyB;4BACzBf,mBAAmBgB,OAAOC,UAAU,CAACH;4BACrCb;4BAEA,+CAA+C;4BAC/CS,WAAWQ,OAAO,CAACJ;4BACnBH;wBACF;oBACF;oBAEAV;oBACAU;gBACF;YACF;YAEA,uDAAuD;YACvD,OAAO,IAAIQ,SAASZ,kBAAyBpB;QAC/C;IACF;AACF"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapFetchWithUserAgent", {
enumerable: true,
get: function() {
return wrapFetchWithUserAgent;
}
});
function _nodeprocess() {
const data = /*#__PURE__*/ _interop_require_default(require("node:process"));
_nodeprocess = function() {
return data;
};
return data;
}
const _fetch = require("../../utils/fetch");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function wrapFetchWithUserAgent(fetch) {
return (url, init = {})=>{
const headers = new _fetch.Headers(init.headers);
// Version is added in the build script
headers.append('User-Agent', `expo-cli/${_nodeprocess().default.env.__EXPO_VERSION}`);
init.headers = headers;
return fetch(url, init);
};
}
//# sourceMappingURL=wrapFetchWithUserAgent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/api/rest/wrapFetchWithUserAgent.ts"],"sourcesContent":["import process from 'node:process';\n\nimport { FetchLike } from './client.types';\nimport { Headers } from '../../utils/fetch';\n\nexport function wrapFetchWithUserAgent(fetch: FetchLike): FetchLike {\n return (url, init = {}) => {\n const headers = new Headers(init.headers);\n // Version is added in the build script\n headers.append('User-Agent', `expo-cli/${process.env.__EXPO_VERSION}`);\n init.headers = headers;\n return fetch(url, init);\n };\n}\n"],"names":["wrapFetchWithUserAgent","fetch","url","init","headers","Headers","append","process","env","__EXPO_VERSION"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;gEALI;;;;;;uBAGI;;;;;;AAEjB,SAASA,uBAAuBC,KAAgB;IACrD,OAAO,CAACC,KAAKC,OAAO,CAAC,CAAC;QACpB,MAAMC,UAAU,IAAIC,cAAO,CAACF,KAAKC,OAAO;QACxC,uCAAuC;QACvCA,QAAQE,MAAM,CAAC,cAAc,CAAC,SAAS,EAAEC,sBAAO,CAACC,GAAG,CAACC,cAAc,EAAE;QACrEN,KAAKC,OAAO,GAAGA;QACf,OAAOH,MAAMC,KAAKC;IACpB;AACF"}

33
node_modules/@expo/cli/build/src/api/settings.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
// This file represents temporary globals for the CLI when using the API.
// Settings should be as minimal as possible since they are globals.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "disableNetwork", {
enumerable: true,
get: function() {
return disableNetwork;
}
});
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
const _log = require("../log");
const _env = require("../utils/env");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function disableNetwork() {
if (_env.env.EXPO_OFFLINE) return;
process.env.EXPO_OFFLINE = '1';
_log.Log.log(_chalk().default.gray('Networking has been disabled'));
}
//# sourceMappingURL=settings.js.map

1
node_modules/@expo/cli/build/src/api/settings.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/settings.ts"],"sourcesContent":["// This file represents temporary globals for the CLI when using the API.\n// Settings should be as minimal as possible since they are globals.\nimport chalk from 'chalk';\n\nimport { Log } from '../log';\nimport { env } from '../utils/env';\n\nexport function disableNetwork() {\n if (env.EXPO_OFFLINE) return;\n process.env.EXPO_OFFLINE = '1';\n Log.log(chalk.gray('Networking has been disabled'));\n}\n"],"names":["disableNetwork","env","EXPO_OFFLINE","process","Log","log","chalk","gray"],"mappings":"AAAA,yEAAyE;AACzE,oEAAoE;;;;;+BAMpDA;;;eAAAA;;;;gEALE;;;;;;qBAEE;qBACA;;;;;;AAEb,SAASA;IACd,IAAIC,QAAG,CAACC,YAAY,EAAE;IACtBC,QAAQF,GAAG,CAACC,YAAY,GAAG;IAC3BE,QAAG,CAACC,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAC;AACrB"}

View File

@@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
closeDevelopmentSessionAsync: function() {
return closeDevelopmentSessionAsync;
},
createSessionInfo: function() {
return createSessionInfo;
},
updateDevelopmentSessionAsync: function() {
return updateDevelopmentSessionAsync;
}
});
function _os() {
const data = /*#__PURE__*/ _interop_require_default(require("os"));
_os = function() {
return data;
};
return data;
}
function _url() {
const data = require("url");
_url = function() {
return data;
};
return data;
}
const _client = require("./rest/client");
const _errors = require("../utils/errors");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function createSessionInfo({ exp, runtime, url }) {
return {
session: {
description: `${exp.name} on ${_os().default.hostname()}`,
hostname: _os().default.hostname(),
platform: runtime,
config: {
// TODO: if icons are specified, upload a url for them too so people can distinguish
description: exp.description,
name: exp.name,
slug: exp.slug,
primaryColor: exp.primaryColor
},
url,
source: 'desktop'
}
};
}
async function updateDevelopmentSessionAsync({ deviceIds, exp, runtime, url }) {
const searchParams = new (_url()).URLSearchParams();
deviceIds.forEach((id)=>{
searchParams.append('deviceId', id);
});
const results = await (0, _client.fetchAsync)('development-sessions/notify-alive', {
searchParams,
method: 'POST',
body: JSON.stringify({
data: createSessionInfo({
exp,
runtime,
url
})
})
});
if (!results.ok) {
throw new _errors.CommandError('API', `Unexpected response when updating the development session on Expo servers: ${results.statusText}.`);
}
}
async function closeDevelopmentSessionAsync({ deviceIds, url }) {
const searchParams = new (_url()).URLSearchParams();
deviceIds.forEach((id)=>{
searchParams.append('deviceId', id);
});
const results = await (0, _client.fetchAsync)('development-sessions/notify-close', {
searchParams,
method: 'POST',
body: JSON.stringify({
session: {
url
}
})
});
if (!results.ok) {
throw new _errors.CommandError('API', `Unexpected response when closing the development session on Expo servers: ${results.statusText}.`);
}
}
//# sourceMappingURL=updateDevelopmentSession.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/api/updateDevelopmentSession.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport os from 'os';\nimport { URLSearchParams } from 'url';\n\nimport { fetchAsync } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\n/** Create the expected session info. */\nexport function createSessionInfo({\n exp,\n runtime,\n url,\n}: {\n exp: Pick<ExpoConfig, 'name' | 'description' | 'slug' | 'primaryColor'>;\n runtime: 'native' | 'web';\n url: string;\n}) {\n return {\n session: {\n description: `${exp.name} on ${os.hostname()}`,\n hostname: os.hostname(),\n platform: runtime,\n config: {\n // TODO: if icons are specified, upload a url for them too so people can distinguish\n description: exp.description,\n name: exp.name,\n slug: exp.slug,\n primaryColor: exp.primaryColor,\n },\n url,\n source: 'desktop',\n },\n };\n}\n\n/** Send a request to Expo API to keep the 'development session' alive for the provided devices. */\nexport async function updateDevelopmentSessionAsync({\n deviceIds,\n exp,\n runtime,\n url,\n}: {\n deviceIds: string[];\n exp: Pick<ExpoConfig, 'name' | 'description' | 'slug' | 'primaryColor'>;\n runtime: 'native' | 'web';\n url: string;\n}) {\n const searchParams = new URLSearchParams();\n deviceIds.forEach((id) => {\n searchParams.append('deviceId', id);\n });\n\n const results = await fetchAsync('development-sessions/notify-alive', {\n searchParams,\n method: 'POST',\n body: JSON.stringify({\n data: createSessionInfo({ exp, runtime, url }),\n }),\n });\n\n if (!results.ok) {\n throw new CommandError(\n 'API',\n `Unexpected response when updating the development session on Expo servers: ${results.statusText}.`\n );\n }\n}\n\n/** Send a request to Expo API to close the 'development session' for the provided devices. */\nexport async function closeDevelopmentSessionAsync({\n deviceIds,\n url,\n}: {\n deviceIds: string[];\n url: string;\n}) {\n const searchParams = new URLSearchParams();\n deviceIds.forEach((id) => {\n searchParams.append('deviceId', id);\n });\n\n const results = await fetchAsync('development-sessions/notify-close', {\n searchParams,\n method: 'POST',\n body: JSON.stringify({\n session: { url },\n }),\n });\n\n if (!results.ok) {\n throw new CommandError(\n 'API',\n `Unexpected response when closing the development session on Expo servers: ${results.statusText}.`\n );\n }\n}\n"],"names":["closeDevelopmentSessionAsync","createSessionInfo","updateDevelopmentSessionAsync","exp","runtime","url","session","description","name","os","hostname","platform","config","slug","primaryColor","source","deviceIds","searchParams","URLSearchParams","forEach","id","append","results","fetchAsync","method","body","JSON","stringify","data","ok","CommandError","statusText"],"mappings":";;;;;;;;;;;IAqEsBA,4BAA4B;eAA5BA;;IA7DNC,iBAAiB;eAAjBA;;IA4BMC,6BAA6B;eAA7BA;;;;gEAnCP;;;;;;;yBACiB;;;;;;wBAEL;wBACE;;;;;;AAGtB,SAASD,kBAAkB,EAChCE,GAAG,EACHC,OAAO,EACPC,GAAG,EAKJ;IACC,OAAO;QACLC,SAAS;YACPC,aAAa,GAAGJ,IAAIK,IAAI,CAAC,IAAI,EAAEC,aAAE,CAACC,QAAQ,IAAI;YAC9CA,UAAUD,aAAE,CAACC,QAAQ;YACrBC,UAAUP;YACVQ,QAAQ;gBACN,oFAAoF;gBACpFL,aAAaJ,IAAII,WAAW;gBAC5BC,MAAML,IAAIK,IAAI;gBACdK,MAAMV,IAAIU,IAAI;gBACdC,cAAcX,IAAIW,YAAY;YAChC;YACAT;YACAU,QAAQ;QACV;IACF;AACF;AAGO,eAAeb,8BAA8B,EAClDc,SAAS,EACTb,GAAG,EACHC,OAAO,EACPC,GAAG,EAMJ;IACC,MAAMY,eAAe,IAAIC,CAAAA,MAAc,iBAAC;IACxCF,UAAUG,OAAO,CAAC,CAACC;QACjBH,aAAaI,MAAM,CAAC,YAAYD;IAClC;IAEA,MAAME,UAAU,MAAMC,IAAAA,kBAAU,EAAC,qCAAqC;QACpEN;QACAO,QAAQ;QACRC,MAAMC,KAAKC,SAAS,CAAC;YACnBC,MAAM3B,kBAAkB;gBAAEE;gBAAKC;gBAASC;YAAI;QAC9C;IACF;IAEA,IAAI,CAACiB,QAAQO,EAAE,EAAE;QACf,MAAM,IAAIC,oBAAY,CACpB,OACA,CAAC,2EAA2E,EAAER,QAAQS,UAAU,CAAC,CAAC,CAAC;IAEvG;AACF;AAGO,eAAe/B,6BAA6B,EACjDgB,SAAS,EACTX,GAAG,EAIJ;IACC,MAAMY,eAAe,IAAIC,CAAAA,MAAc,iBAAC;IACxCF,UAAUG,OAAO,CAAC,CAACC;QACjBH,aAAaI,MAAM,CAAC,YAAYD;IAClC;IAEA,MAAME,UAAU,MAAMC,IAAAA,kBAAU,EAAC,qCAAqC;QACpEN;QACAO,QAAQ;QACRC,MAAMC,KAAKC,SAAS,CAAC;YACnBrB,SAAS;gBAAED;YAAI;QACjB;IACF;IAEA,IAAI,CAACiB,QAAQO,EAAE,EAAE;QACf,MAAM,IAAIC,oBAAY,CACpB,OACA,CAAC,0EAA0E,EAAER,QAAQS,UAAU,CAAC,CAAC,CAAC;IAEtG;AACF"}

View File

@@ -0,0 +1,183 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getAccessToken: function() {
return getAccessToken;
},
getAnonymousId: function() {
return getAnonymousId;
},
getAnonymousIdAsync: function() {
return getAnonymousIdAsync;
},
getExpoHomeDirectory: function() {
return getExpoHomeDirectory;
},
getSession: function() {
return getSession;
},
getSettings: function() {
return getSettings;
},
getSettingsDirectory: function() {
return getSettingsDirectory;
},
getSettingsFilePath: function() {
return getSettingsFilePath;
},
hasCredentials: function() {
return hasCredentials;
},
setSessionAsync: function() {
return setSessionAsync;
}
});
function _jsonfile() {
const data = /*#__PURE__*/ _interop_require_default(require("@expo/json-file"));
_jsonfile = function() {
return data;
};
return data;
}
function _crypto() {
const data = /*#__PURE__*/ _interop_require_default(require("crypto"));
_crypto = function() {
return data;
};
return data;
}
function _getenv() {
const data = require("getenv");
_getenv = function() {
return data;
};
return data;
}
function _os() {
const data = require("os");
_os = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_wildcard(require("path"));
_path = function() {
return data;
};
return data;
}
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
function getExpoHomeDirectory() {
const home = (0, _os().homedir)();
if (process.env.__UNSAFE_EXPO_HOME_DIRECTORY) {
return process.env.__UNSAFE_EXPO_HOME_DIRECTORY;
} else if ((0, _getenv().boolish)('EXPO_STAGING', false)) {
return _path().join(home, '.expo-staging');
} else if ((0, _getenv().boolish)('EXPO_LOCAL', false)) {
return _path().join(home, '.expo-local');
}
return _path().join(home, '.expo');
}
function getSettingsDirectory() {
return getExpoHomeDirectory();
}
function getSettingsFilePath() {
return _path().join(getExpoHomeDirectory(), 'state.json');
}
function getSettings() {
return new (_jsonfile()).default(getSettingsFilePath(), {
ensureDir: true,
jsonParseErrorDefault: {},
// This will ensure that an error isn't thrown if the file doesn't exist.
cantReadFileDefault: {}
});
}
function getAccessToken() {
return process.env.EXPO_TOKEN ?? null;
}
function getSession() {
return getSettings().get('auth', null);
}
async function setSessionAsync(sessionData) {
await getSettings().setAsync('auth', sessionData, {
default: {},
ensureDir: true
});
}
function hasCredentials() {
return !!getAccessToken() || !!getSession();
}
async function getAnonymousIdAsync() {
const settings = getSettings();
let id = await settings.getAsync('uuid', null);
if (!id) {
id = _crypto().default.randomUUID();
await settings.setAsync('uuid', id);
}
return id;
}
function getAnonymousId() {
const settings = getSettings();
let id = settings.get('uuid', null);
if (!id) {
id = _crypto().default.randomUUID();
settings.set('uuid', id);
}
return id;
}
//# sourceMappingURL=UserSettings.js.map

File diff suppressed because one or more lines are too long

167
node_modules/@expo/cli/build/src/api/user/actions.js generated vendored Normal file
View File

@@ -0,0 +1,167 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
showLoginPromptAsync: function() {
return showLoginPromptAsync;
},
tryGetUserAsync: function() {
return tryGetUserAsync;
}
});
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
const _otp = require("./otp");
const _user = require("./user");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
const _env = require("../../utils/env");
const _errors = require("../../utils/errors");
const _link = require("../../utils/link");
const _prompts = /*#__PURE__*/ _interop_require_wildcard(require("../../utils/prompts"));
const _client = require("../rest/client");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
async function showLoginPromptAsync({ printNewLine = false, otp, ...options } = {}) {
if (_env.env.EXPO_OFFLINE) {
throw new _errors.CommandError('OFFLINE', 'Cannot authenticate in offline-mode');
}
const hasCredentials = options.username && options.password;
const sso = options.sso;
const browser = options.browser;
if (printNewLine) {
_log.log();
}
if (sso || browser) {
await (0, _user.browserLoginAsync)({
sso: !!sso
});
return;
}
_log.log(hasCredentials ? `Logging in to EAS with email or username (exit and run 'npx expo login --help' for other login options)` : `Log in to EAS with email or username (exit and run 'npx expo login --help' for other login options)`);
let username = options.username;
let password = options.password;
if (!hasCredentials) {
const resolved = await (0, _prompts.default)([
!options.username && {
type: 'text',
name: 'username',
message: 'Email or username'
},
!options.password && {
type: 'password',
name: 'password',
message: 'Password'
}
].filter(Boolean), {
nonInteractiveHelp: `Use the EXPO_TOKEN environment variable to authenticate in CI (${(0, _link.learnMore)('https://docs.expo.dev/accounts/programmatic-access/')})`
});
username ??= resolved.username;
password ??= resolved.password;
}
// This is just for the types.
(0, _assert().default)(username && password);
try {
await (0, _user.loginAsync)({
username,
password,
otp
});
} catch (e) {
if (e instanceof _client.ApiV2Error && e.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {
await (0, _otp.retryUsernamePasswordAuthWithOTPAsync)(username, password, e.expoApiV2ErrorMetadata);
} else {
throw e;
}
}
}
async function tryGetUserAsync() {
const user = await (0, _user.getUserAsync)().catch(()=>null);
if (user) {
return user;
}
const choices = [
{
title: 'Log in',
value: true
},
{
title: 'Proceed anonymously',
value: false
}
];
const value = await (0, _prompts.selectAsync)((0, _chalk().default)`\n\nIt is recommended to log in with your Expo account before proceeding. \n{dim ${(0, _link.learnMore)('https://expo.fyi/unverified-app-expo-go')}}\n`, choices, {
nonInteractiveHelp: `Use the EXPO_TOKEN environment variable to authenticate in CI (${(0, _link.learnMore)('https://docs.expo.dev/accounts/programmatic-access/')})`
});
if (value) {
await showLoginPromptAsync({
printNewLine: true
});
return await (0, _user.getUserAsync)() ?? null;
}
return null;
}
//# sourceMappingURL=actions.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,149 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getSessionUsingBrowserAuthFlowAsync", {
enumerable: true,
get: function() {
return getSessionUsingBrowserAuthFlowAsync;
}
});
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _betteropn() {
const data = /*#__PURE__*/ _interop_require_default(require("better-opn"));
_betteropn = function() {
return data;
};
return data;
}
function _http() {
const data = /*#__PURE__*/ _interop_require_default(require("http"));
_http = function() {
return data;
};
return data;
}
function _querystring() {
const data = /*#__PURE__*/ _interop_require_default(require("querystring"));
_querystring = function() {
return data;
};
return data;
}
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
async function getSessionUsingBrowserAuthFlowAsync({ expoWebsiteUrl, sso = false }) {
const scheme = 'http';
const hostname = 'localhost';
const path = '/auth/callback';
const buildExpoLoginUrl = (port, sso)=>{
const params = _querystring().default.stringify({
confirm_account: 'true',
app_redirect_uri: `${scheme}://${hostname}:${port}${path}`
});
return `${expoWebsiteUrl}${sso ? '/sso-login' : '/login'}?${params}`;
};
// Start server and begin auth flow
const executeAuthFlow = ()=>{
return new Promise(async (resolve, reject)=>{
const connections = new Set();
const server = _http().default.createServer((request, response)=>{
const redirectAndCleanup = (result)=>{
const redirectUrl = `${expoWebsiteUrl}/oauth/expo-cli?result=${result}`;
response.writeHead(302, {
Location: redirectUrl
});
response.end();
server.close();
for (const connection of connections){
connection.destroy();
}
};
try {
var _request_url;
if (!(request.method === 'GET' && ((_request_url = request.url) == null ? void 0 : _request_url.includes('/auth/callback')))) {
throw new Error('Unexpected login response.');
}
const url = new URL(request.url, `http:${request.headers.host}`);
const sessionSecret = url.searchParams.get('session_secret');
if (!sessionSecret) {
throw new Error('Request missing session_secret search parameter.');
}
resolve(sessionSecret);
redirectAndCleanup('success');
} catch (error) {
redirectAndCleanup('error');
reject(error);
}
});
server.listen(0, hostname, ()=>{
_log.log('Waiting for browser login...');
const address = server.address();
(0, _assert().default)(address !== null && typeof address === 'object', 'Server address and port should be set after listening has begun');
const port = address.port;
const authorizeUrl = buildExpoLoginUrl(port, sso);
(0, _betteropn().default)(authorizeUrl);
});
server.on('connection', (connection)=>{
connections.add(connection);
connection.on('close', ()=>{
connections.delete(connection);
});
});
});
};
return await executeAuthFlow();
}
//# sourceMappingURL=expoSsoLauncher.js.map

File diff suppressed because one or more lines are too long

177
node_modules/@expo/cli/build/src/api/user/otp.js generated vendored Normal file
View File

@@ -0,0 +1,177 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
UserSecondFactorDeviceMethod: function() {
return UserSecondFactorDeviceMethod;
},
retryUsernamePasswordAuthWithOTPAsync: function() {
return retryUsernamePasswordAuthWithOTPAsync;
}
});
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
const _user = require("./user");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
const _errors = require("../../utils/errors");
const _link = require("../../utils/link");
const _prompts = require("../../utils/prompts");
const _client = require("../rest/client");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
var UserSecondFactorDeviceMethod = /*#__PURE__*/ function(UserSecondFactorDeviceMethod) {
UserSecondFactorDeviceMethod["AUTHENTICATOR"] = "authenticator";
UserSecondFactorDeviceMethod["SMS"] = "sms";
return UserSecondFactorDeviceMethod;
}({});
const nonInteractiveHelp = `Use the EXPO_TOKEN environment variable to authenticate in CI (${(0, _link.learnMore)('https://docs.expo.dev/accounts/programmatic-access/')})`;
/**
* Prompt for an OTP with the option to cancel the question by answering empty (pressing return key).
*/ async function promptForOTPAsync(cancelBehavior) {
const enterMessage = cancelBehavior === 'cancel' ? (0, _chalk().default)`press {bold Enter} to cancel` : (0, _chalk().default)`press {bold Enter} for more options`;
const { otp } = await (0, _prompts.promptAsync)({
type: 'text',
name: 'otp',
message: `One-time password or backup code (${enterMessage}):`
}, {
nonInteractiveHelp
});
return otp || null;
}
/**
* Prompt for user to choose a backup OTP method. If selected method is SMS, a request
* for a new OTP will be sent to that method. Then, prompt for the OTP, and retry the user login.
*/ async function promptForBackupOTPAsync(username, password, secondFactorDevices) {
const nonPrimarySecondFactorDevices = secondFactorDevices.filter((device)=>!device.is_primary);
if (nonPrimarySecondFactorDevices.length === 0) {
throw new _errors.CommandError('No other second-factor devices set up. Ensure you have set up and certified a backup device.');
}
const hasAuthenticatorSecondFactorDevice = nonPrimarySecondFactorDevices.find((device)=>device.method === "authenticator");
const smsNonPrimarySecondFactorDevices = nonPrimarySecondFactorDevices.filter((device)=>device.method === "sms");
const authenticatorChoiceSentinel = -1;
const cancelChoiceSentinel = -2;
const deviceChoices = smsNonPrimarySecondFactorDevices.map((device, idx)=>({
title: device.sms_phone_number,
value: idx
}));
if (hasAuthenticatorSecondFactorDevice) {
deviceChoices.push({
title: 'Authenticator',
value: authenticatorChoiceSentinel
});
}
deviceChoices.push({
title: 'Cancel',
value: cancelChoiceSentinel
});
const selectedValue = await (0, _prompts.selectAsync)('Select a second-factor device:', deviceChoices, {
nonInteractiveHelp
});
if (selectedValue === cancelChoiceSentinel) {
return null;
} else if (selectedValue === authenticatorChoiceSentinel) {
return await promptForOTPAsync('cancel');
}
const device = smsNonPrimarySecondFactorDevices[selectedValue];
await (0, _client.fetchAsync)('auth/send-sms-otp', {
method: 'POST',
body: JSON.stringify({
username,
password,
secondFactorDeviceID: device.id
})
});
return await promptForOTPAsync('cancel');
}
async function retryUsernamePasswordAuthWithOTPAsync(username, password, metadata) {
const { secondFactorDevices, smsAutomaticallySent } = metadata;
(0, _assert().default)(secondFactorDevices !== undefined && smsAutomaticallySent !== undefined, `Malformed OTP error metadata: ${metadata}`);
const primaryDevice = secondFactorDevices.find((device)=>device.is_primary);
let otp = null;
if (smsAutomaticallySent) {
(0, _assert().default)(primaryDevice, 'OTP should only automatically be sent when there is a primary device');
_log.log(`One-time password was sent to the phone number ending in ${primaryDevice.sms_phone_number}.`);
otp = await promptForOTPAsync('menu');
}
if ((primaryDevice == null ? void 0 : primaryDevice.method) === "authenticator") {
_log.log('One-time password from authenticator required.');
otp = await promptForOTPAsync('menu');
}
// user bailed on case 1 or 2, wants to move to case 3
if (!otp) {
otp = await promptForBackupOTPAsync(username, password, secondFactorDevices);
}
if (!otp) {
throw new _errors.AbortCommandError();
}
await (0, _user.loginAsync)({
username,
password,
otp
});
}
//# sourceMappingURL=otp.js.map

1
node_modules/@expo/cli/build/src/api/user/otp.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

154
node_modules/@expo/cli/build/src/api/user/user.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ANONYMOUS_USERNAME: function() {
return ANONYMOUS_USERNAME;
},
browserLoginAsync: function() {
return browserLoginAsync;
},
getActorDisplayName: function() {
return getActorDisplayName;
},
getUserAsync: function() {
return getUserAsync;
},
loginAsync: function() {
return loginAsync;
},
logoutAsync: function() {
return logoutAsync;
}
});
function _fs() {
const data = require("fs");
_fs = function() {
return data;
};
return data;
}
const _UserSettings = require("./UserSettings");
const _expoSsoLauncher = require("./expoSsoLauncher");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
const _codesigning = require("../../utils/codesigning");
const _env = require("../../utils/env");
const _endpoint = require("../endpoint");
const _UserQuery = require("../graphql/queries/UserQuery");
const _client = require("../rest/client");
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
let currentUser;
const ANONYMOUS_USERNAME = 'anonymous';
function getActorDisplayName(user) {
switch(user == null ? void 0 : user.__typename){
case 'User':
return user.username;
case 'SSOUser':
return user.username;
case 'Robot':
return user.firstName ? `${user.firstName} (robot)` : 'robot';
default:
return ANONYMOUS_USERNAME;
}
}
async function getUserAsync() {
var _getSession;
const hasCredentials = (0, _UserSettings.getAccessToken)() || ((_getSession = (0, _UserSettings.getSession)()) == null ? void 0 : _getSession.sessionSecret);
if (!_env.env.EXPO_OFFLINE && !currentUser && hasCredentials) {
const user = await _UserQuery.UserQuery.currentUserAsync();
currentUser = user ?? undefined;
}
return currentUser;
}
async function loginAsync(credentials) {
const res = await (0, _client.fetchAsync)('auth/loginAsync', {
method: 'POST',
body: JSON.stringify(credentials)
});
const json = await res.json();
const sessionSecret = json.data.sessionSecret;
const userData = await _UserQuery.UserQuery.meUserActorAsync({
'expo-session': sessionSecret
});
await (0, _UserSettings.setSessionAsync)({
sessionSecret,
userId: userData.id,
username: userData.username,
currentConnection: 'Username-Password-Authentication'
});
}
async function browserLoginAsync({ sso = false }) {
const sessionSecret = await (0, _expoSsoLauncher.getSessionUsingBrowserAuthFlowAsync)({
expoWebsiteUrl: (0, _endpoint.getExpoWebsiteBaseUrl)(),
sso
});
const userData = await _UserQuery.UserQuery.meUserActorAsync({
'expo-session': sessionSecret
});
await (0, _UserSettings.setSessionAsync)({
sessionSecret,
userId: userData.id,
username: userData.username,
currentConnection: 'Browser-Flow-Authentication'
});
}
async function logoutAsync() {
currentUser = undefined;
await Promise.all([
_fs().promises.rm((0, _codesigning.getDevelopmentCodeSigningDirectory)(), {
recursive: true,
force: true
}),
(0, _UserSettings.setSessionAsync)(undefined)
]);
_log.log('Logged out');
}
//# sourceMappingURL=user.js.map

File diff suppressed because one or more lines are too long

180
node_modules/@expo/cli/build/src/config/configAsync.js generated vendored Normal file
View File

@@ -0,0 +1,180 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
configAsync: function() {
return configAsync;
},
logConfig: function() {
return logConfig;
}
});
function _config() {
const data = require("@expo/config");
_config = function() {
return data;
};
return data;
}
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _util() {
const data = /*#__PURE__*/ _interop_require_default(require("util"));
_util = function() {
return data;
};
return data;
}
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../log"));
const _errors = require("../utils/errors");
const _nodeEnv = require("../utils/nodeEnv");
const _profile = require("../utils/profile");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
function logConfig(config) {
const isObjStr = (str)=>/^\w+: {/g.test(str);
_log.log(_util().default.inspect(config, {
colors: true,
compact: false,
// Sort objects to the end so that smaller values aren't hidden between large objects.
sorted (a, b) {
if (isObjStr(a)) return 1;
if (isObjStr(b)) return -1;
return 0;
},
showHidden: false,
depth: null
}));
}
async function configAsync(projectRoot, options) {
const loggingFunctions = {
log: console.log,
warn: console.warn,
error: console.error
};
// Disable logging for this command if the user wants to get JSON output.
// This will ensure that only the JSON is printed to stdout.
if (options.json) {
console.log = function() {};
console.warn = function() {};
console.error = function() {};
}
(0, _nodeEnv.setNodeEnv)('development');
(0, _nodeEnv.loadEnvFiles)(projectRoot);
if (options.type) {
_assert().default.match(options.type, /^(public|prebuild|introspect)$/);
}
let config;
if (options.type === 'prebuild') {
const { getPrebuildConfigAsync } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@expo/prebuild-config")));
config = await (0, _profile.profile)(getPrebuildConfigAsync)(projectRoot, {
platforms: [
'ios',
'android'
]
});
} else if (options.type === 'introspect') {
const { getPrebuildConfigAsync } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@expo/prebuild-config")));
const { compileModsAsync } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@expo/config-plugins/build/plugins/mod-compiler.js")));
config = await (0, _profile.profile)(getPrebuildConfigAsync)(projectRoot, {
platforms: [
'ios',
'android'
]
});
await compileModsAsync(config.exp, {
projectRoot,
introspect: true,
platforms: [
'ios',
'android'
],
assertMissingModProviders: false
});
// @ts-ignore
delete config.modRequest;
// @ts-ignore
delete config.modResults;
} else if (options.type === 'public') {
config = (0, _profile.profile)(_config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true,
isPublicConfig: true
});
} else if (options.type) {
throw new _errors.CommandError(`Invalid option: --type ${options.type}. Valid options are: public, prebuild`);
} else {
config = (0, _profile.profile)(_config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true
});
}
const configOutput = options.full ? config : config.exp;
if (!options.json) {
_log.log();
logConfig(configOutput);
_log.log();
} else {
process.stdout.write(JSON.stringify(configOutput));
// Re-enable logging functions for testing.
console.log = loggingFunctions.log;
console.warn = loggingFunctions.warn;
console.error = loggingFunctions.error;
}
}
//# sourceMappingURL=configAsync.js.map

File diff suppressed because one or more lines are too long

101
node_modules/@expo/cli/build/src/config/index.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "expoConfig", {
enumerable: true,
get: function() {
return expoConfig;
}
});
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
const _args = require("../utils/args");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
const expoConfig = async (argv)=>{
const args = (0, _args.assertArgs)({
// Types
'--help': Boolean,
'--full': Boolean,
'--json': Boolean,
'--type': String,
// Aliases
'-h': '--help',
'-t': '--type'
}, argv);
if (args['--help']) {
(0, _args.printHelp)(`Show the project config`, (0, _chalk().default)`npx expo config {dim <dir>}`, [
(0, _chalk().default)`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
`--full Include all project config data`,
`--json Output in JSON format`,
`-t, --type <public|prebuild|introspect> Type of config to show`,
`-h, --help Usage info`
].join('\n'));
}
// Load modules after the help prompt so `npx expo config -h` shows as fast as possible.
const [// ./configAsync
{ configAsync }, // ../utils/errors
{ logCmdError }] = await Promise.all([
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./configAsync.js"))),
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../utils/errors.js")))
]);
return configAsync((0, _args.getProjectRoot)(args), {
// Parsed options
full: args['--full'],
json: args['--json'],
type: args['--type']
}).catch(logCmdError);
};
//# sourceMappingURL=index.js.map

1
node_modules/@expo/cli/build/src/config/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/config/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\n\nexport const expoConfig: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--full': Boolean,\n '--json': Boolean,\n '--type': String,\n // Aliases\n '-h': '--help',\n '-t': '--type',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Show the project config`,\n chalk`npx expo config {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--full Include all project config data`,\n `--json Output in JSON format`,\n `-t, --type <public|prebuild|introspect> Type of config to show`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo config -h` shows as fast as possible.\n const [\n // ./configAsync\n { configAsync },\n // ../utils/errors\n { logCmdError },\n ] = await Promise.all([import('./configAsync.js'), import('../utils/errors.js')]);\n\n return configAsync(getProjectRoot(args), {\n // Parsed options\n full: args['--full'],\n json: args['--json'],\n type: args['--type'],\n }).catch(logCmdError);\n};\n"],"names":["expoConfig","argv","args","assertArgs","Boolean","String","printHelp","chalk","join","configAsync","logCmdError","Promise","all","getProjectRoot","full","json","type","catch"],"mappings":";;;;;+BAMaA;;;eAAAA;;;;gEALK;;;;;;sBAGoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,MAAMA,aAAsB,OAAOC;IACxC,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,UAAUA;QACV,UAAUA;QACV,UAAUC;QACV,UAAU;QACV,MAAM;QACN,MAAM;IACR,GACAJ;IAGF,IAAIC,IAAI,CAAC,SAAS,EAAE;QAClBI,IAAAA,eAAS,EACP,CAAC,uBAAuB,CAAC,EACzBC,IAAAA,gBAAK,CAAA,CAAC,2BAA2B,CAAC,EAClC;YACEA,IAAAA,gBAAK,CAAA,CAAC,gHAAgH,CAAC;YACvH,CAAC,wEAAwE,CAAC;YAC1E,CAAC,8DAA8D,CAAC;YAChE,CAAC,+DAA+D,CAAC;YACjE,CAAC,mDAAmD,CAAC;SACtD,CAACC,IAAI,CAAC;IAEX;IAEA,wFAAwF;IACxF,MAAM,CACJ,gBAAgB;IAChB,EAAEC,WAAW,EAAE,EACf,kBAAkB;IAClB,EAAEC,WAAW,EAAE,CAChB,GAAG,MAAMC,QAAQC,GAAG,CAAC;QAAC,mEAAA,QAAO;QAAqB,mEAAA,QAAO;KAAsB;IAEhF,OAAOH,YAAYI,IAAAA,oBAAc,EAACX,OAAO;QACvC,iBAAiB;QACjBY,MAAMZ,IAAI,CAAC,SAAS;QACpBa,MAAMb,IAAI,CAAC,SAAS;QACpBc,MAAMd,IAAI,CAAC,SAAS;IACtB,GAAGe,KAAK,CAACP;AACX"}

View File

@@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "customizeAsync", {
enumerable: true,
get: function() {
return customizeAsync;
}
});
function _config() {
const data = require("@expo/config");
_config = function() {
return data;
};
return data;
}
const _generate = require("./generate");
const _router = require("../start/server/metro/router");
const _platformBundlers = require("../start/server/platformBundlers");
const _findUp = require("../utils/findUp");
const _nodeEnv = require("../utils/nodeEnv");
async function customizeAsync(files, options, extras) {
var _exp_web;
(0, _nodeEnv.setNodeEnv)('development');
// Locate the project root based on the process current working directory.
// This enables users to run `npx expo customize` from a subdirectory of the project.
const projectRoot = (0, _findUp.findUpProjectRootOrAssert)(process.cwd());
(0, _nodeEnv.loadEnvFiles)(projectRoot);
// Get the static path (defaults to 'web/')
// Doesn't matter if expo is installed or which mode is used.
const { exp } = (0, _config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true
});
const routerRoot = (0, _router.getRouterDirectoryModuleIdWithManifest)(projectRoot, exp);
// Create the destination resolution props which are used in both
// the query and select functions.
const props = {
webStaticPath: ((_exp_web = exp.web) == null ? void 0 : _exp_web.staticPath) ?? (0, _platformBundlers.getPlatformBundlers)(projectRoot, exp).web === 'webpack' ? 'web' : 'public',
appDirPath: routerRoot
};
// If the user provided files, we'll generate them without prompting.
if (files.length) {
return (0, _generate.queryAndGenerateAsync)(projectRoot, {
files,
props,
extras
});
}
// Otherwise, we'll prompt the user to select which files to generate.
await (0, _generate.selectAndGenerateAsync)(projectRoot, {
props,
extras
});
}
//# sourceMappingURL=customizeAsync.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/customize/customizeAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { queryAndGenerateAsync, selectAndGenerateAsync } from './generate';\nimport { Options } from './resolveOptions';\nimport { DestinationResolutionProps } from './templates';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { getPlatformBundlers } from '../start/server/platformBundlers';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function customizeAsync(files: string[], options: Options, extras: any[]) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo customize` from a subdirectory of the project.\n const projectRoot = findUpProjectRootOrAssert(process.cwd());\n\n loadEnvFiles(projectRoot);\n\n // Get the static path (defaults to 'web/')\n // Doesn't matter if expo is installed or which mode is used.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n const routerRoot = getRouterDirectoryModuleIdWithManifest(projectRoot, exp);\n\n // Create the destination resolution props which are used in both\n // the query and select functions.\n const props: DestinationResolutionProps = {\n webStaticPath:\n (exp.web?.staticPath ?? getPlatformBundlers(projectRoot, exp).web === 'webpack')\n ? 'web'\n : 'public',\n appDirPath: routerRoot,\n };\n\n // If the user provided files, we'll generate them without prompting.\n if (files.length) {\n return queryAndGenerateAsync(projectRoot, {\n files,\n props,\n extras,\n });\n }\n\n // Otherwise, we'll prompt the user to select which files to generate.\n await selectAndGenerateAsync(projectRoot, {\n props,\n extras,\n });\n}\n"],"names":["customizeAsync","files","options","extras","exp","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","loadEnvFiles","getConfig","skipSDKVersionRequirement","routerRoot","getRouterDirectoryModuleIdWithManifest","props","webStaticPath","web","staticPath","getPlatformBundlers","appDirPath","length","queryAndGenerateAsync","selectAndGenerateAsync"],"mappings":";;;;+BAUsBA;;;eAAAA;;;;yBAVI;;;;;;0BAEoC;wBAGP;kCACnB;wBACM;yBACD;AAElC,eAAeA,eAAeC,KAAe,EAAEC,OAAgB,EAAEC,MAAa;QAoB9EC;IAnBLC,IAAAA,mBAAU,EAAC;IACX,0EAA0E;IAC1E,qFAAqF;IACrF,MAAMC,cAAcC,IAAAA,iCAAyB,EAACC,QAAQC,GAAG;IAEzDC,IAAAA,qBAAY,EAACJ;IAEb,2CAA2C;IAC3C,6DAA6D;IAC7D,MAAM,EAAEF,GAAG,EAAE,GAAGO,IAAAA,mBAAS,EAACL,aAAa;QACrCM,2BAA2B;IAC7B;IAEA,MAAMC,aAAaC,IAAAA,8CAAsC,EAACR,aAAaF;IAEvE,iEAAiE;IACjE,kCAAkC;IAClC,MAAMW,QAAoC;QACxCC,eACE,AAACZ,EAAAA,WAAAA,IAAIa,GAAG,qBAAPb,SAASc,UAAU,KAAIC,IAAAA,qCAAmB,EAACb,aAAaF,KAAKa,GAAG,KAAK,YAClE,QACA;QACNG,YAAYP;IACd;IAEA,qEAAqE;IACrE,IAAIZ,MAAMoB,MAAM,EAAE;QAChB,OAAOC,IAAAA,+BAAqB,EAAChB,aAAa;YACxCL;YACAc;YACAZ;QACF;IACF;IAEA,sEAAsE;IACtE,MAAMoB,IAAAA,gCAAsB,EAACjB,aAAa;QACxCS;QACAZ;IACF;AACF"}

94
node_modules/@expo/cli/build/src/customize/generate.js generated vendored Normal file
View File

@@ -0,0 +1,94 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
queryAndGenerateAsync: function() {
return queryAndGenerateAsync;
},
selectAndGenerateAsync: function() {
return selectAndGenerateAsync;
}
});
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
function _resolvefrom() {
const data = /*#__PURE__*/ _interop_require_default(require("resolve-from"));
_resolvefrom = function() {
return data;
};
return data;
}
const _templates = require("./templates");
const _installAsync = require("../install/installAsync");
const _log = require("../log");
const _dir = require("../utils/dir");
const _errors = require("../utils/errors");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
async function queryAndGenerateAsync(projectRoot, { files, props, extras }) {
const valid = files.filter((file)=>!!_templates.TEMPLATES.find((template)=>template.destination(props) === file));
if (valid.length !== files.length) {
const diff = files.filter((file)=>!_templates.TEMPLATES.find((template)=>template.destination(props) === file));
throw new _errors.CommandError(`Invalid files: ${diff.join(', ')}. Allowed: ${_templates.TEMPLATES.map((template)=>template.destination(props)).join(', ')}`);
}
if (!valid.length) {
return;
}
_log.Log.log(`Generating: ${valid.join(', ')}`);
return generateAsync(projectRoot, {
answer: files.map((file)=>_templates.TEMPLATES.findIndex((template)=>template.destination(props) === file)),
props,
extras
});
}
async function selectAndGenerateAsync(projectRoot, { props, extras }) {
const answer = await (0, _templates.selectTemplatesAsync)(projectRoot, props);
if (!(answer == null ? void 0 : answer.length)) {
_log.Log.exit('\n\u203A Exiting with no change...', 0);
}
await generateAsync(projectRoot, {
answer,
props,
extras
});
}
async function generateAsync(projectRoot, { answer, props, extras }) {
// Copy files
await Promise.all(answer.map(async (file)=>{
const template = _templates.TEMPLATES[file];
if (template.configureAsync) {
if (await template.configureAsync(projectRoot)) {
return;
}
}
const projectFilePath = _path().default.resolve(projectRoot, template.destination(props));
// copy the file from template
return (0, _dir.copyAsync)(template.file(projectRoot), projectFilePath);
}));
// Install dependencies
const packages = answer.map((file)=>_templates.TEMPLATES[file].dependencies).flat().filter((pkg)=>!_resolvefrom().default.silent(projectRoot, pkg));
if (packages.length) {
_log.Log.debug('Installing ' + packages.join(', '));
await (0, _installAsync.installAsync)(packages, {}, [
'--dev',
...extras
]);
}
}
//# sourceMappingURL=generate.js.map

File diff suppressed because one or more lines are too long

51
node_modules/@expo/cli/build/src/customize/index.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "expoCustomize", {
enumerable: true,
get: function() {
return expoCustomize;
}
});
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
const _args = require("../utils/args");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const expoCustomize = async (argv)=>{
const args = (0, _args.assertWithOptionsArgs)({
// Other options are parsed manually.
'--help': Boolean,
// Aliases
'-h': '--help'
}, {
argv,
// Allow other options, we'll throw an error if unexpected values are passed.
permissive: true
});
if (args['--help']) {
(0, _args.printHelp)(`Generate static project files`, (0, _chalk().default)`npx expo customize {dim [files...] -- [options]}`, [
(0, _chalk().default)`[files...] List of files to generate`,
(0, _chalk().default)`[options] Options to pass to the install command`,
`-h, --help Usage info`
].join('\n'));
}
// Load modules after the help prompt so `npx expo install -h` shows as fast as possible.
const { customizeAsync } = require('./customizeAsync');
const { logCmdError } = require('../utils/errors');
const { resolveArgsAsync } = require('./resolveOptions');
const { variadic, options, extras } = await resolveArgsAsync(process.argv.slice(3)).catch(logCmdError);
return customizeAsync(variadic, options, extras).catch(logCmdError);
};
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/customize/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../utils/args';\n\nexport const expoCustomize: Command = async (argv) => {\n const args = assertWithOptionsArgs(\n {\n // Other options are parsed manually.\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n },\n {\n argv,\n // Allow other options, we'll throw an error if unexpected values are passed.\n permissive: true,\n }\n );\n\n if (args['--help']) {\n printHelp(\n `Generate static project files`,\n chalk`npx expo customize {dim [files...] -- [options]}`,\n [\n chalk`[files...] List of files to generate`,\n chalk`[options] Options to pass to the install command`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo install -h` shows as fast as possible.\n const { customizeAsync } = require('./customizeAsync') as typeof import('./customizeAsync');\n const { logCmdError } = require('../utils/errors') as typeof import('../utils/errors');\n const { resolveArgsAsync } = require('./resolveOptions') as typeof import('./resolveOptions');\n\n const { variadic, options, extras } = await resolveArgsAsync(process.argv.slice(3)).catch(\n logCmdError\n );\n return customizeAsync(variadic, options, extras).catch(logCmdError);\n};\n"],"names":["expoCustomize","argv","args","assertWithOptionsArgs","Boolean","permissive","printHelp","chalk","join","customizeAsync","require","logCmdError","resolveArgsAsync","variadic","options","extras","process","slice","catch"],"mappings":";;;;;+BAMaA;;;eAAAA;;;;gEALK;;;;;;sBAG+B;;;;;;AAE1C,MAAMA,gBAAyB,OAAOC;IAC3C,MAAMC,OAAOC,IAAAA,2BAAqB,EAChC;QACE,qCAAqC;QACrC,UAAUC;QACV,UAAU;QACV,MAAM;IACR,GACA;QACEH;QACA,6EAA6E;QAC7EI,YAAY;IACd;IAGF,IAAIH,IAAI,CAAC,SAAS,EAAE;QAClBI,IAAAA,eAAS,EACP,CAAC,6BAA6B,CAAC,EAC/BC,IAAAA,gBAAK,CAAA,CAAC,gDAAgD,CAAC,EACvD;YACEA,IAAAA,gBAAK,CAAA,CAAC,qCAAqC,CAAC;YAC5CA,IAAAA,gBAAK,CAAA,CAAC,kDAAkD,CAAC;YACzD,CAAC,sBAAsB,CAAC;SACzB,CAACC,IAAI,CAAC;IAEX;IAEA,yFAAyF;IACzF,MAAM,EAAEC,cAAc,EAAE,GAAGC,QAAQ;IACnC,MAAM,EAAEC,WAAW,EAAE,GAAGD,QAAQ;IAChC,MAAM,EAAEE,gBAAgB,EAAE,GAAGF,QAAQ;IAErC,MAAM,EAAEG,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAG,MAAMH,iBAAiBI,QAAQf,IAAI,CAACgB,KAAK,CAAC,IAAIC,KAAK,CACvFP;IAEF,OAAOF,eAAeI,UAAUC,SAASC,QAAQG,KAAK,CAACP;AACzD"}

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "resolveArgsAsync", {
enumerable: true,
get: function() {
return resolveArgsAsync;
}
});
const _variadic = require("../utils/variadic");
async function resolveArgsAsync(argv) {
const { variadic, extras, flags } = (0, _variadic.parseVariadicArguments)(argv);
(0, _variadic.assertUnexpectedObjectKeys)([], flags);
return {
// Variadic arguments like `npx expo install react react-dom` -> ['react', 'react-dom']
variadic,
options: {},
extras
};
}
//# sourceMappingURL=resolveOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/customize/resolveOptions.ts"],"sourcesContent":["import { assertUnexpectedObjectKeys, parseVariadicArguments } from '../utils/variadic';\n\nexport type Options = object;\n\nexport async function resolveArgsAsync(\n argv: string[]\n): Promise<{ variadic: string[]; options: Options; extras: string[] }> {\n const { variadic, extras, flags } = parseVariadicArguments(argv);\n\n assertUnexpectedObjectKeys([], flags);\n\n return {\n // Variadic arguments like `npx expo install react react-dom` -> ['react', 'react-dom']\n variadic,\n options: {},\n extras,\n };\n}\n"],"names":["resolveArgsAsync","argv","variadic","extras","flags","parseVariadicArguments","assertUnexpectedObjectKeys","options"],"mappings":";;;;+BAIsBA;;;eAAAA;;;0BAJ6C;AAI5D,eAAeA,iBACpBC,IAAc;IAEd,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGC,IAAAA,gCAAsB,EAACJ;IAE3DK,IAAAA,oCAA0B,EAAC,EAAE,EAAEF;IAE/B,OAAO;QACL,uFAAuF;QACvFF;QACAK,SAAS,CAAC;QACVJ;IACF;AACF"}

189
node_modules/@expo/cli/build/src/customize/templates.js generated vendored Normal file
View File

@@ -0,0 +1,189 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
TEMPLATES: function() {
return TEMPLATES;
},
selectTemplatesAsync: function() {
return selectTemplatesAsync;
}
});
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
function _resolvefrom() {
const data = /*#__PURE__*/ _interop_require_default(require("resolve-from"));
_resolvefrom = function() {
return data;
};
return data;
}
const _prompts = /*#__PURE__*/ _interop_require_default(require("../utils/prompts"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const debug = require('debug')('expo:customize:templates');
function importFromExpoWebpackConfig(projectRoot, folder, moduleId) {
try {
const filePath = (0, _resolvefrom().default)(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);
debug(`Using @expo/webpack-config template for "${moduleId}": ${filePath}`);
return filePath;
} catch {
debug(`@expo/webpack-config template for "${moduleId}" not found, falling back on @expo/cli`);
}
return importFromVendor(projectRoot, moduleId);
}
function importFromVendor(projectRoot, moduleId) {
try {
const filePath = (0, _resolvefrom().default)(projectRoot, '@expo/cli/static/template/' + moduleId);
debug(`Using @expo/cli template for "${moduleId}": ${filePath}`);
return filePath;
} catch {
// For dev mode, testing and other cases where @expo/cli is not installed
const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);
debug(`Local @expo/cli template for "${moduleId}" not found, falling back on template relative to @expo/cli: ${filePath}`);
return filePath;
}
}
const TEMPLATES = [
{
id: 'babel.config.js',
file: (projectRoot)=>importFromVendor(projectRoot, 'babel.config.js'),
destination: ()=>'babel.config.js',
dependencies: [
// Even though this is installed in `expo`, we should add it for now.
'babel-preset-expo'
]
},
{
id: 'metro.config.js',
dependencies: [
'@expo/metro-config'
],
destination: ()=>'metro.config.js',
file: (projectRoot)=>importFromVendor(projectRoot, 'metro.config.js')
},
{
// `tsconfig.json` is special-cased and doesn't follow the template.
id: 'tsconfig.json',
dependencies: [],
destination: ()=>'tsconfig.json',
file: ()=>'',
configureAsync: async (projectRoot)=>{
const { typescript } = require('./typescript');
await typescript(projectRoot);
return true;
}
},
{
id: '.eslintrc.js',
dependencies: [],
destination: ()=>'.eslintrc.js (deprecated)',
file: (projectRoot)=>importFromVendor(projectRoot, '.eslintrc.js'),
configureAsync: async (projectRoot)=>{
const { ESLintProjectPrerequisite } = require('../lint/ESlintPrerequisite');
const prerequisite = new ESLintProjectPrerequisite(projectRoot);
if (!await prerequisite.assertAsync()) {
await prerequisite.bootstrapAsync();
}
return false;
}
},
{
id: 'eslint.config.js',
dependencies: [],
destination: ()=>'eslint.config.js',
file: (projectRoot)=>importFromVendor(projectRoot, 'eslint.config.js'),
configureAsync: async (projectRoot)=>{
const { ESLintProjectPrerequisite } = require('../lint/ESlintPrerequisite');
const prerequisite = new ESLintProjectPrerequisite(projectRoot);
if (!await prerequisite.assertAsync()) {
await prerequisite.bootstrapAsync();
}
return false;
}
},
{
id: 'index.html',
file: (projectRoot)=>importFromExpoWebpackConfig(projectRoot, 'web-default', 'index.html'),
// web/index.html
destination: ({ webStaticPath })=>webStaticPath + '/index.html',
dependencies: []
},
{
id: 'webpack.config.js',
file: (projectRoot)=>importFromExpoWebpackConfig(projectRoot, 'template', 'webpack.config.js'),
destination: ()=>'webpack.config.js',
dependencies: [
'@expo/webpack-config'
]
},
{
id: '+html.tsx',
file: (projectRoot)=>importFromVendor(projectRoot, '+html.tsx'),
destination: ({ appDirPath })=>_path().default.join(appDirPath, '+html.tsx'),
dependencies: []
},
{
id: '+native-intent.ts',
file: (projectRoot)=>importFromVendor(projectRoot, '+native-intent.ts'),
destination: ({ appDirPath })=>_path().default.join(appDirPath, '+native-intent.ts'),
dependencies: []
}
];
/** Generate the prompt choices. */ function createChoices(projectRoot, props) {
return TEMPLATES.map((template, index)=>{
const destination = template.destination(props);
const localProjectFile = _path().default.resolve(projectRoot, destination);
const exists = _fs().default.existsSync(localProjectFile);
return {
title: destination,
value: index,
description: exists ? _chalk().default.red('This will overwrite the existing file') : undefined
};
});
}
async function selectTemplatesAsync(projectRoot, props) {
const options = createChoices(projectRoot, props);
const { answer } = await (0, _prompts.default)({
type: 'multiselect',
name: 'answer',
message: 'Which files would you like to generate?',
hint: '- Space to select. Return to submit',
warn: 'File already exists.',
limit: options.length,
instructions: '',
choices: options
});
return answer;
}
//# sourceMappingURL=templates.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "typescript", {
enumerable: true,
get: function() {
return typescript;
}
});
function _config() {
const data = require("@expo/config");
_config = function() {
return data;
};
return data;
}
const _log = require("../log");
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
async function typescript(projectRoot) {
const { TypeScriptProjectPrerequisite } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../start/doctor/typescript/TypeScriptProjectPrerequisite.js")));
const { MetroBundlerDevServer } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../start/server/metro/MetroBundlerDevServer.js")));
const { getPlatformBundlers } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../start/server/platformBundlers.js")));
try {
await new TypeScriptProjectPrerequisite(projectRoot).bootstrapAsync();
} catch (error) {
// Ensure the process doesn't fail if the TypeScript check fails.
// This could happen during the install.
_log.Log.log();
_log.Log.exception(error);
return;
}
const { exp } = (0, _config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true
});
await new MetroBundlerDevServer(projectRoot, getPlatformBundlers(projectRoot, exp), {
isDevClient: true
}).startTypeScriptServices();
}
//# sourceMappingURL=typescript.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/customize/typescript.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { Log } from '../log';\n\nexport async function typescript(projectRoot: string) {\n const { TypeScriptProjectPrerequisite } = await import(\n '../start/doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n const { MetroBundlerDevServer } = await import('../start/server/metro/MetroBundlerDevServer.js');\n const { getPlatformBundlers } = await import('../start/server/platformBundlers.js');\n\n try {\n await new TypeScriptProjectPrerequisite(projectRoot).bootstrapAsync();\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.exception(error);\n return;\n }\n\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n await new MetroBundlerDevServer(projectRoot, getPlatformBundlers(projectRoot, exp), {\n isDevClient: true,\n }).startTypeScriptServices();\n}\n"],"names":["typescript","projectRoot","TypeScriptProjectPrerequisite","MetroBundlerDevServer","getPlatformBundlers","bootstrapAsync","error","Log","log","exception","exp","getConfig","skipSDKVersionRequirement","isDevClient","startTypeScriptServices"],"mappings":";;;;+BAIsBA;;;eAAAA;;;;yBAJI;;;;;;qBAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,eAAeA,WAAWC,WAAmB;IAClD,MAAM,EAAEC,6BAA6B,EAAE,GAAG,MAAM,mEAAA,QAC9C;IAEF,MAAM,EAAEC,qBAAqB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAC/C,MAAM,EAAEC,mBAAmB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAE7C,IAAI;QACF,MAAM,IAAIF,8BAA8BD,aAAaI,cAAc;IACrE,EAAE,OAAOC,OAAY;QACnB,iEAAiE;QACjE,wCAAwC;QACxCC,QAAG,CAACC,GAAG;QACPD,QAAG,CAACE,SAAS,CAACH;QACd;IACF;IAEA,MAAM,EAAEI,GAAG,EAAE,GAAGC,IAAAA,mBAAS,EAACV,aAAa;QAAEW,2BAA2B;IAAK;IACzE,MAAM,IAAIT,sBAAsBF,aAAaG,oBAAoBH,aAAaS,MAAM;QAClFG,aAAa;IACf,GAAGC,uBAAuB;AAC5B"}

6
node_modules/@expo/cli/build/src/events/builder.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/* eslint-disable @typescript-eslint/no-empty-object-type */ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=builder.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/events/builder.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n\ntype obj<T> = T extends { [key: string | number]: any } ? { [K in keyof T]: T[K] } : never;\n\nexport type EmptyPayload = {\n [key: string]: never;\n _e: never;\n _t: never;\n};\n\ntype AbstractPayload = Record<string, any> & {\n _e?: never;\n _t?: never;\n};\n\nexport type Event<\n Name extends string = string,\n Payload extends AbstractPayload = EmptyPayload,\n> = obj<{ key: Name } & Payload>;\n\nexport type EventShape<Name extends string, Payload = any> = Name & {\n __payload: Payload;\n};\n\ntype getEventPayloadOfShape<Shape> =\n Shape extends EventShape<infer Name, infer Payload>\n ? Payload extends AbstractPayload\n ? { [K in Name]: Payload }\n : never\n : never;\n\ntype getEventsOfShapesRec<Shapes, Out = {}> = Shapes extends readonly [infer Shape, ...infer Rest]\n ? getEventsOfShapesRec<Rest, Out & getEventPayloadOfShape<Shape>>\n : obj<Out>;\n\ntype reduceEventLoggerEvents<EventLogger> =\n EventLogger extends EventLoggerType<infer Category, infer Events>\n ? Category extends string\n ? {\n [K in keyof Events]: K extends string\n ? obj<{ key: `${Category}:${K}` } & Events[K]>\n : never;\n }[keyof Events]\n : never\n : never;\n\ntype reduceEventLoggersRec<EventLoggers, Out = never> = EventLoggers extends readonly [\n infer EventLogger,\n ...infer Rest,\n]\n ? reduceEventLoggersRec<Rest, Out | reduceEventLoggerEvents<EventLogger>>\n : obj<Out>;\n\ninterface EventLoggerType<Category, Events> {\n category: Category;\n __eventTypes?: () => Events;\n}\n\nexport interface EventLogger<Category, Events> extends EventLoggerType<Category, Events> {\n <EventName extends keyof Events>(event: EventName, data: Events[EventName]): void;\n\n path(target: string): string;\n path(target: string | null | undefined): string | null;\n}\n\nexport interface EventBuilder {\n event<const Name extends string, const Payload extends AbstractPayload>(): EventShape<\n Name,\n Payload\n >;\n}\n\nexport interface EventLoggerBuilder {\n <const Category extends string, const Shapes extends readonly EventShape<string>[]>(\n category: Category,\n _fn: (builder: EventBuilder) => Shapes\n ): EventLogger<Category, getEventsOfShapesRec<Shapes>>;\n}\n\nexport type collectEventLoggers<EventLoggers extends [...EventLoggerType<any, any>[]]> =\n reduceEventLoggersRec<EventLoggers>;\n"],"names":[],"mappings":"AAAA,0DAA0D"}

132
node_modules/@expo/cli/build/src/events/index.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
events: function() {
return events;
},
installEventLogger: function() {
return installEventLogger;
},
isEventLoggerActive: function() {
return isEventLoggerActive;
},
rootEvent: function() {
return rootEvent;
},
shouldReduceLogs: function() {
return shouldReduceLogs;
}
});
function _nodeconsole() {
const data = require("node:console");
_nodeconsole = function() {
return data;
};
return data;
}
function _nodepath() {
const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
_nodepath = function() {
return data;
};
return data;
}
function _nodetty() {
const data = require("node:tty");
_nodetty = function() {
return data;
};
return data;
}
const _stream = require("./stream");
const _env = require("../utils/env");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
let logPath = process.cwd();
let logStream;
function parseLogTarget(env) {
let logDestination;
if (env) {
const fd = parseInt(env, 10);
if (fd > 0 && Number.isSafeInteger(fd)) {
logDestination = fd;
} else {
try {
const parsedPath = _nodepath().default.parse(env);
logDestination = _nodepath().default.format(parsedPath);
logPath = parsedPath.dir;
} catch {
logDestination = undefined;
}
}
}
return logDestination;
}
function getInitMetadata() {
return {
format: 'v0-jsonl',
// Version is added in the build script.
version: "55.0.14" ?? 'UNVERSIONED'
};
}
function installEventLogger(env = process.env.LOG_EVENTS) {
const eventLogDestination = parseLogTarget(env);
if (eventLogDestination) {
if (eventLogDestination === 1) {
const output = new (_nodetty()).WriteStream(2);
Object.defineProperty(process, 'stdout', {
get: ()=>output
});
globalThis.console = new (_nodeconsole()).Console(output, output);
} else if (eventLogDestination === 2) {
const output = new (_nodetty()).WriteStream(1);
Object.defineProperty(process, 'stderr', {
get: ()=>output
});
globalThis.console = new (_nodeconsole()).Console(output, output);
}
logStream = new _stream.LogStream(eventLogDestination);
rootEvent('init', getInitMetadata());
}
}
const isEventLoggerActive = ()=>!!(logStream == null ? void 0 : logStream.writable);
const shouldReduceLogs = ()=>!!logStream && _env.env.EXPO_UNSTABLE_HEADLESS;
const events = (category, _fn)=>{
function log(event, data) {
if (logStream) {
const _e = `${category}:${String(event)}`;
const _t = Date.now();
const payload = JSON.stringify({
_e,
_t,
...data
});
logStream._write(payload + '\n');
}
}
log.category = category;
log.path = function relativePath(target) {
try {
return target != null && _nodepath().default.isAbsolute(target) ? _nodepath().default.relative(logPath, target).replace(/\\/, '/') || '.' : target ?? null;
} catch {
return target || null;
}
};
return log;
};
const rootEvent = events('root', (t)=>[
t.event()
]);
//# sourceMappingURL=index.js.map

1
node_modules/@expo/cli/build/src/events/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

303
node_modules/@expo/cli/build/src/events/stream.js generated vendored Normal file
View File

@@ -0,0 +1,303 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "LogStream", {
enumerable: true,
get: function() {
return LogStream;
}
});
function _nodebuffer() {
const data = require("node:buffer");
_nodebuffer = function() {
return data;
};
return data;
}
function _nodeevents() {
const data = require("node:events");
_nodeevents = function() {
return data;
};
return data;
}
function _nodefs() {
const data = /*#__PURE__*/ _interop_require_default(require("node:fs"));
_nodefs = function() {
return data;
};
return data;
}
function _nodepath() {
const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
_nodepath = function() {
return data;
};
return data;
}
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const BUSY_WRITE_TIMEOUT = 100;
const HIGH_WATER_MARK = 16387; /*16KB*/
class LogStream extends _nodeevents().EventEmitter {
#fd;
#file;
#writing;
#ending;
#flushPending;
#destroyed;
#opening;
#output;
#len;
#lines;
#partialLine;
constructor(dest){
super(), this.#fd = -1, this.#file = null, this.#writing = false, this.#ending = false, this.#flushPending = false, this.#destroyed = false, this.#opening = false, this.#output = '', this.#len = 0, this.#lines = [], this.#partialLine = 0;
if (typeof dest === 'number') {
_nodefs().default.fsyncSync(dest);
this.#fd = dest;
process.nextTick(()=>this.emit('ready'));
} else if (typeof dest === 'string') {
this.#openFile(dest);
}
}
get file() {
return this.#file;
}
get fd() {
return this.#fd;
}
get writing() {
return this.#writing;
}
get writable() {
return !this.#destroyed && !this.#ending;
}
#release(error, written) {
if (error) {
if (error.code === 'EAGAIN' || error.code === 'EBUSY') {
setTimeout(()=>this.#writeLine(), BUSY_WRITE_TIMEOUT);
} else {
this.#writing = false;
this.emit('error', error);
}
} else {
this.emit('write', written);
const outputLength = _nodebuffer().Buffer.byteLength(this.#output);
if (outputLength > written) {
const output = _nodebuffer().Buffer.from(this.#output).subarray(written).toString();
this.#len -= this.#output.length - output.length;
this.#output = output;
} else {
this.#len -= this.#output.length;
this.#output = '';
}
if (this.#output || this.#lines.length > this.#partialLine) {
this.#writeLine();
} else if (this.#ending) {
this.#writing = false;
this.#close();
} else {
this.#writing = false;
this.emit('drain');
}
}
}
#openFile(file) {
this.#opening = true;
this.#writing = true;
const onOpened = (error, fd)=>{
if (error) {
this.#writing = false;
this.#opening = false;
this.emit('error', error);
} else {
this.#fd = fd;
this.#file = file;
this.#opening = false;
this.#writing = false;
this.emit('ready');
if (this.#destroyed) {
// do nothing when we're already closing the file
} else if (!this.writing && this.#lines.length > this.#partialLine || this.#flushPending) {
this.#writeLine();
}
}
};
_nodefs().default.mkdir(_nodepath().default.dirname(file), {
recursive: true
}, (err)=>{
if (err) return onOpened(err);
_nodefs().default.open(file, 'a', 438, onOpened);
});
}
#close() {
if (this.#fd === -1) {
this.once('ready', ()=>this.#close());
return;
}
this.#destroyed = true;
this.#partialLine = 0;
this.#lines.length = 0;
const onClose = (error)=>{
if (error) {
this.emit('error', error);
this.emit('close', error);
} else {
if (this.#ending && !this.#writing) this.emit('finish');
this.emit('close');
}
};
fsFsync(this.#fd, (error)=>{
if (!error && !isStdFd(this.#fd)) {
_nodefs().default.close(this.#fd, onClose);
} else {
onClose(); // Error intentionally ignored, assume closed
}
});
}
#writeLine() {
this.#writing = true;
this.#output ||= this.#lines.length > this.#partialLine ? this.#lines.shift() || '' : '';
_nodefs().default.write(this.#fd, this.#output, (err, written)=>this.#release(err, written));
}
_end() {
if (!this.#destroyed && !this.#ending) {
this.#ending = true;
if (this.#opening) {
this.once('ready', ()=>this._end());
} else if (!this.#writing && this.#fd >= 0) {
if (this.#lines.length > this.#partialLine) {
this.#writeLine();
} else {
this.#close();
}
}
}
return this;
}
end(arg1, arg2, arg3) {
const maybeCb = arg3 || arg2 || arg1;
const input = typeof arg1 !== 'function' ? arg1 : undefined;
const encoding = typeof arg2 === 'string' ? arg2 : 'utf8';
const cb = typeof maybeCb === 'function' ? maybeCb : undefined;
if (typeof input === 'string') {
this.write(input, encoding);
} else if (input != null) {
this.write(input);
}
if (cb) this.once('close', cb);
return this._end();
}
destroy() {
if (!this.#destroyed) this.#close();
}
flush(cb) {
if (this.#destroyed) {
cb == null ? void 0 : cb();
} else {
const onDrain = ()=>{
if (!this.#destroyed) {
fsFsync(this.#fd, (error)=>{
this.#flushPending = false;
if ((error == null ? void 0 : error.code) === 'EBADF') {
cb == null ? void 0 : cb(); // If fd is closed, ignore the error
} else {
cb == null ? void 0 : cb(error);
}
});
} else {
this.#flushPending = false;
cb == null ? void 0 : cb();
}
this.off('error', onError);
};
const onError = (err)=>{
this.#flushPending = false;
this.off('drain', onDrain);
cb == null ? void 0 : cb(err);
};
this.#flushPending = true;
this.once('drain', onDrain);
this.once('error', onError);
if (!this.#writing) {
if (this.#lines.length > this.#partialLine || this.#output) {
// There are complete lines or remaining output to write
this.#writeLine();
} else {
// Nothing complete to write, emit drain immediately
process.nextTick(()=>this.emit('drain'));
}
}
}
}
_write(data) {
if (this.#destroyed) {
return false;
}
this.#len += data.length;
let startIdx = 0;
let endIdx = -1;
while((endIdx = data.indexOf('\n', startIdx)) > -1){
const line = data.slice(startIdx, endIdx + 1);
if (this.#partialLine > 0) {
this.#lines[this.#lines.length - 1] += line;
} else {
this.#lines.push(line);
}
this.#partialLine = 0;
startIdx = ++endIdx;
}
if (startIdx < data.length) {
const line = data.slice(startIdx);
if (this.#partialLine > 0) {
this.#lines[this.#lines.length - 1] += line;
} else {
this.#lines.push(data.slice(startIdx));
}
this.#partialLine = 1;
}
if (!this.#writing && this.#lines.length > this.#partialLine) {
this.#writeLine();
}
return this.#len < HIGH_WATER_MARK;
}
write(input, arg2, arg3) {
const maybeCb = arg3 || arg2;
const encoding = typeof arg2 === 'string' ? arg2 : 'utf8';
const data = typeof input === 'string' ? input : _nodebuffer().Buffer.from(input).toString(encoding);
const cb = typeof maybeCb === 'function' ? maybeCb : undefined;
try {
return this._write(data);
} finally{
cb == null ? void 0 : cb();
}
}
[Symbol.dispose]() {
this.destroy();
}
}
const isStdFd = (fd)=>{
switch(fd){
case 1:
case 2:
case process.stdout.fd:
case process.stderr.fd:
return true;
default:
return false;
}
};
const fsFsync = (fd, cb)=>{
try {
_nodefs().default.fsync(fd, cb);
} catch (error) {
cb(error);
}
};
//# sourceMappingURL=stream.js.map

File diff suppressed because one or more lines are too long

6
node_modules/@expo/cli/build/src/events/types.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

1
node_modules/@expo/cli/build/src/events/types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

28
node_modules/@expo/cli/build/src/expoUpdatesExports.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
// NOTE(@kitten): These are currently only used by expo-updates (expo-updates/utols/src/createManifestForBuildAsync)
// They're re-exported via `expo/internal/cli-unstable-expo-updates-exports` to establish a valid dependency chain
// NOTE for Expo Maintainers: Do not add to this file. We want to remove this
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
createMetroServerAndBundleRequestAsync: function() {
return _exportEmbedAsync.createMetroServerAndBundleRequestAsync;
},
drawableFileTypes: function() {
return _metroAssetLocalPath.drawableFileTypes;
},
exportEmbedAssetsAsync: function() {
return _exportEmbedAsync.exportEmbedAssetsAsync;
}
});
const _metroAssetLocalPath = require("./export/metroAssetLocalPath");
const _exportEmbedAsync = require("./export/embed/exportEmbedAsync");
//# sourceMappingURL=expoUpdatesExports.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/expoUpdatesExports.ts"],"sourcesContent":["// NOTE(@kitten): These are currently only used by expo-updates (expo-updates/utols/src/createManifestForBuildAsync)\n// They're re-exported via `expo/internal/cli-unstable-expo-updates-exports` to establish a valid dependency chain\n// NOTE for Expo Maintainers: Do not add to this file. We want to remove this\nexport { drawableFileTypes } from './export/metroAssetLocalPath';\nexport {\n createMetroServerAndBundleRequestAsync,\n exportEmbedAssetsAsync,\n} from './export/embed/exportEmbedAsync';\n"],"names":["createMetroServerAndBundleRequestAsync","drawableFileTypes","exportEmbedAssetsAsync"],"mappings":"AAAA,oHAAoH;AACpH,kHAAkH;AAClH,6EAA6E;;;;;;;;;;;;IAG3EA,sCAAsC;eAAtCA,wDAAsC;;IAF/BC,iBAAiB;eAAjBA,sCAAiB;;IAGxBC,sBAAsB;eAAtBA,wCAAsB;;;qCAHU;kCAI3B"}

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createMetadataJson", {
enumerable: true,
get: function() {
return createMetadataJson;
}
});
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function createMetadataJson({ bundles, fileNames, embeddedHashSet, domComponentAssetsMetadata }) {
// Build metadata.json
return {
version: 0,
bundler: 'metro',
fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>{
if (platform === 'web') return metadata;
// Collect all of the assets and convert them to the serial format.
const assets = bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)).map((asset)=>{
var // Each asset has multiple hashes which we convert and then flatten.
_asset_fileHashes;
return (_asset_fileHashes = asset.fileHashes) == null ? void 0 : _asset_fileHashes.map((hash)=>({
path: _path().default.join('assets', hash),
ext: asset.type
}));
}).filter(Boolean).flat();
if ((domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]) != null) {
assets.push(...domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]);
}
return {
...metadata,
[platform]: {
// Get the filename for each platform's bundle.
// TODO: Add multi-bundle support to EAS Update!!
bundle: fileNames[platform][0],
assets
}
};
}, {})
};
}
//# sourceMappingURL=createMetadataJson.js.map

View File

@@ -0,0 +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":";;;;+BAcgBA;;;eAAAA;;;;gEAdC;;;;;;;;;;;AAcV,SAASA,mBAAmB,EACjCC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,0BAA0B,EAM3B;IAKC,sBAAsB;IACtB,OAAO;QACLC,SAAS;QACTC,SAAS;QACTC,cAAcC,OAAOC,OAAO,CAACR,SAASS,MAAM,CAC1C,CAACC,UAAU,CAACC,UAAUC,OAAO;YAC3B,IAAID,aAAa,OAAO,OAAOD;YAE/B,mEAAmE;YACnE,MAAMG,SAASD,OAAOC,MAAM,CACzBC,MAAM,CAAC,CAACC,QAAU,CAACb,mBAAmB,CAACA,gBAAgBc,GAAG,CAACD,MAAME,IAAI,GACrEC,GAAG,CAAC,CAACH;oBACJ,oEAAoE;gBACpEA;wBAAAA,oBAAAA,MAAMI,UAAU,qBAAhBJ,kBAAkBG,GAAG,CAAC,CAACD,OAAU,CAAA;wBAC/BG,MAAMA,eAAI,CAACC,IAAI,CAAC,UAAUJ;wBAC1BK,KAAKP,MAAMQ,IAAI;oBACjB,CAAA;eAEDT,MAAM,CAACU,SACPC,IAAI;YAEP,IAAItB,CAAAA,8CAAAA,0BAA4B,CAACQ,SAAS,KAAI,MAAM;gBAClDE,OAAOa,IAAI,IAAIvB,8CAAAA,0BAA4B,CAACQ,SAAS;YACvD;YAEA,OAAO;gBACL,GAAGD,QAAQ;gBACX,CAACC,SAAS,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,QAAQX,SAAS,CAACU,SAAS,CAAC,EAAE;oBAC9BE;gBACF;YACF;QACF,GACA,CAAC;IAEL;AACF"}

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "exportEagerAsync", {
enumerable: true,
get: function() {
return exportEagerAsync;
}
});
const _exportEmbedAsync = require("./exportEmbedAsync");
const _resolveOptions = require("./resolveOptions");
const _env = require("../../utils/env");
const debug = require('debug')('expo:eager');
async function exportEagerAsync(projectRoot, { dev, platform, // We default to resetting the cache in non-CI environments since prebundling overwrites the cache reset later.
resetCache = !_env.env.CI, assetsDest, bundleOutput }) {
const options = await (0, _resolveOptions.resolveEagerOptionsAsync)(projectRoot, {
dev,
platform,
resetCache,
assetsDest,
bundleOutput
});
debug('Starting eager export: ' + options.bundleOutput);
await (0, _exportEmbedAsync.exportEmbedInternalAsync)(projectRoot, options);
debug('Eager export complete');
return {
options,
key: (0, _resolveOptions.getExportEmbedOptionsKey)(options)
};
}
//# sourceMappingURL=exportEager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/export/embed/exportEager.ts"],"sourcesContent":["import { exportEmbedInternalAsync } from './exportEmbedAsync';\nimport { getExportEmbedOptionsKey, resolveEagerOptionsAsync } from './resolveOptions';\nimport { env } from '../../utils/env';\n\nconst debug = require('debug')('expo:eager');\n\nexport async function exportEagerAsync(\n projectRoot: string,\n {\n dev,\n platform,\n // We default to resetting the cache in non-CI environments since prebundling overwrites the cache reset later.\n resetCache = !env.CI,\n assetsDest,\n bundleOutput,\n }: {\n dev: boolean;\n platform: string;\n resetCache?: boolean;\n assetsDest?: string;\n bundleOutput?: string;\n }\n) {\n const options = await resolveEagerOptionsAsync(projectRoot, {\n dev,\n platform,\n resetCache,\n assetsDest,\n bundleOutput,\n });\n debug('Starting eager export: ' + options.bundleOutput);\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n debug('Eager export complete');\n\n return { options, key: getExportEmbedOptionsKey(options) };\n}\n"],"names":["exportEagerAsync","debug","require","projectRoot","dev","platform","resetCache","env","CI","assetsDest","bundleOutput","options","resolveEagerOptionsAsync","exportEmbedInternalAsync","key","getExportEmbedOptionsKey"],"mappings":";;;;+BAMsBA;;;eAAAA;;;kCANmB;gCAC0B;qBAC/C;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,iBACpBG,WAAmB,EACnB,EACEC,GAAG,EACHC,QAAQ,EACR,+GAA+G;AAC/GC,aAAa,CAACC,QAAG,CAACC,EAAE,EACpBC,UAAU,EACVC,YAAY,EAOb;IAED,MAAMC,UAAU,MAAMC,IAAAA,wCAAwB,EAACT,aAAa;QAC1DC;QACAC;QACAC;QACAG;QACAC;IACF;IACAT,MAAM,4BAA4BU,QAAQD,YAAY;IAEtD,MAAMG,IAAAA,0CAAwB,EAACV,aAAaQ;IAE5CV,MAAM;IAEN,OAAO;QAAEU;QAASG,KAAKC,IAAAA,wCAAwB,EAACJ;IAAS;AAC3D"}

View File

@@ -0,0 +1,454 @@
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
createMetroServerAndBundleRequestAsync: function() {
return createMetroServerAndBundleRequestAsync;
},
exportEmbedAssetsAsync: function() {
return exportEmbedAssetsAsync;
},
exportEmbedAsync: function() {
return exportEmbedAsync;
},
exportEmbedBundleAndAssetsAsync: function() {
return exportEmbedBundleAndAssetsAsync;
},
exportEmbedInternalAsync: function() {
return exportEmbedInternalAsync;
}
});
function _config() {
const data = require("@expo/config");
_config = function() {
return data;
};
return data;
}
function _Server() {
const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro/metro/Server"));
_Server = function() {
return data;
};
return data;
}
function _splitBundleOptions() {
const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro/metro/lib/splitBundleOptions"));
_splitBundleOptions = function() {
return data;
};
return data;
}
function _bundle() {
const data = /*#__PURE__*/ _interop_require_wildcard(require("@expo/metro/metro/shared/output/bundle"));
_bundle = function() {
return data;
};
return data;
}
function _getAssets() {
const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro-config/build/transform-worker/getAssets"));
_getAssets = function() {
return data;
};
return data;
}
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _glob() {
const data = require("glob");
_glob = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _resolveOptions = require("./resolveOptions");
const _xcodeCompilerLogger = require("./xcodeCompilerLogger");
const _log = require("../../log");
const _DevServerManager = require("../../start/server/DevServerManager");
const _MetroBundlerDevServer = require("../../start/server/metro/MetroBundlerDevServer");
const _instantiateMetro = require("../../start/server/metro/instantiateMetro");
const _DomComponentsMiddleware = require("../../start/server/middleware/DomComponentsMiddleware");
const _metroOptions = require("../../start/server/middleware/metroOptions");
const _ansi = require("../../utils/ansi");
const _dir = require("../../utils/dir");
const _env = require("../../utils/env");
const _nodeEnv = require("../../utils/nodeEnv");
const _exportDomComponents = require("../exportDomComponents");
const _exportHermes = require("../exportHermes");
const _persistMetroAssets = require("../persistMetroAssets");
const _publicFolder = require("../publicFolder");
const _saveAssets = require("../saveAssets");
const _exportServer = require("./exportServer");
const _exit = require("../../utils/exit");
const _filePath = require("../../utils/filePath");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
const debug = require('debug')('expo:export:embed');
function guessCopiedAppleBundlePath(bundleOutput) {
// Ensure the path is familiar before guessing.
if (!bundleOutput.match(/\/Xcode\/DerivedData\/.*\/Build\/Products\//) && !bundleOutput.match(/\/CoreSimulator\/Devices\/.*\/data\/Containers\/Bundle\/Application\//)) {
debug('Bundling to non-standard location:', bundleOutput);
return false;
}
const bundleName = _path().default.basename(bundleOutput);
const bundleParent = _path().default.dirname(bundleOutput);
const possiblePath = (0, _glob().sync)(`*.app/${bundleName}`, {
cwd: bundleParent,
absolute: true,
// bundle identifiers can start with dots.
dot: true
})[0];
debug('Possible path for previous bundle:', possiblePath);
return possiblePath;
}
async function exportEmbedAsync(projectRoot, options) {
// The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.
// By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.
if (_env.env.CI && options.resetCache) {
debug('CI environment detected, disabling automatic cache reset');
options.resetCache = false;
}
(0, _nodeEnv.setNodeEnv)(options.dev ? 'development' : 'production');
(0, _nodeEnv.loadEnvFiles)(projectRoot);
// This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.
// Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.
// This path is also used for automatically deploying server bundles to a remote host.
const eagerBundleOptions = _env.env.__EXPO_EAGER_BUNDLE_OPTIONS ? (0, _resolveOptions.deserializeEagerKey)(_env.env.__EXPO_EAGER_BUNDLE_OPTIONS) : null;
if (eagerBundleOptions) {
// Get the cache key for the current process to compare against the eager key.
const inputKey = (0, _resolveOptions.getExportEmbedOptionsKey)(options);
// If the app was bundled previously in the same process, then we should reuse the Metro cache.
options.resetCache = false;
if (eagerBundleOptions.key === inputKey) {
// Copy the eager bundleOutput and assets to the new locations.
await (0, _dir.removeAsync)(options.bundleOutput);
(0, _dir.copyAsync)(eagerBundleOptions.options.bundleOutput, options.bundleOutput);
if (eagerBundleOptions.options.assetsDest && options.assetsDest) {
(0, _dir.copyAsync)(eagerBundleOptions.options.assetsDest, options.assetsDest);
}
console.log('info: Copied output to binary:', options.bundleOutput);
return;
}
// TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.
console.log(' Eager key:', eagerBundleOptions.key);
console.log('Request key:', inputKey);
// TODO: We may want an analytic event here in the future to understand when this happens.
console.warn('warning: Eager bundle does not match new options, bundling again.');
}
await exportEmbedInternalAsync(projectRoot, options);
// Ensure the process closes after bundling
(0, _exit.ensureProcessExitsAfterDelay)();
}
async function exportEmbedInternalAsync(projectRoot, options) {
// Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.
await (0, _dir.removeAsync)(options.bundleOutput);
// The iOS bundle is copied in to the Xcode project, so we need to remove the old one
// to prevent Xcode from loading the old one after a build failure.
if (options.platform === 'ios') {
const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);
if (previousPath && _fs().default.existsSync(previousPath)) {
debug('Removing previous iOS bundle:', previousPath);
await (0, _dir.removeAsync)(previousPath);
}
}
const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);
_fs().default.mkdirSync(_path().default.dirname(options.bundleOutput), {
recursive: true,
mode: 493
});
// On Android, dom components proxy files should write to the assets directory instead of the res directory.
// We use the bundleOutput directory to get the assets directory.
const domComponentProxyOutputDir = options.platform === 'android' ? _path().default.dirname(options.bundleOutput) : options.assetsDest;
const hasDomComponents = domComponentProxyOutputDir && files.size > 0;
// Persist bundle and source maps.
await Promise.all([
_bundle().save(bundle, options, _log.Log.log),
// Write dom components proxy files.
hasDomComponents ? (0, _saveAssets.persistMetroFilesAsync)(files, domComponentProxyOutputDir) : null,
// Copy public folder for dom components only if
hasDomComponents ? (0, _publicFolder.copyPublicFolderAsync)(_path().default.resolve(projectRoot, _env.env.EXPO_PUBLIC_FOLDER), _path().default.join(domComponentProxyOutputDir, _DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR)) : null,
// NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native
// platforms when doing production embeds (unlikely).
options.assetsDest ? (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, assets, {
platform: options.platform,
outputDirectory: options.assetsDest,
iosAssetCatalogDirectory: options.assetCatalogDest
}) : null
]);
}
async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
const devServerManager = await _DevServerManager.DevServerManager.startMetroAsync(projectRoot, {
minify: options.minify,
mode: options.dev ? 'development' : 'production',
port: 8081,
isExporting: true,
location: {},
resetDevServer: options.resetCache,
maxWorkers: options.maxWorkers
});
const devServer = devServerManager.getDefaultDevServer();
(0, _assert().default)(devServer instanceof _MetroBundlerDevServer.MetroBundlerDevServer);
const { exp, pkg } = (0, _config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true
});
const isHermes = (0, _exportHermes.isEnableHermesManaged)(exp, options.platform);
let sourceMapUrl = options.sourcemapOutput;
if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {
sourceMapUrl = _path().default.basename(sourceMapUrl);
}
const files = new Map();
try {
var _exp_experiments, _exp_web, _bundles_artifacts_filter_;
const bundles = await devServer.nativeExportBundleAsync(exp, {
// TODO: Re-enable when we get bytecode chunk splitting working again.
splitChunks: false,
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, options.entryFile),
platform: options.platform,
minify: options.minify,
mode: options.dev ? 'development' : 'production',
engine: isHermes ? 'hermes' : undefined,
serializerIncludeMaps: !!sourceMapUrl,
bytecode: options.bytecode ?? false,
// source map inline
reactCompiler: !!((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.reactCompiler)
}, files, {
sourceMapUrl,
unstable_transformProfile: options.unstableTransformProfile || (isHermes ? 'hermes-stable' : 'default')
});
const apiRoutesEnabled = devServer.isReactServerComponentsEnabled || ((_exp_web = exp.web) == null ? void 0 : _exp_web.output) === 'server';
if (apiRoutesEnabled) {
await (0, _exportServer.exportStandaloneServerAsync)(projectRoot, devServer, {
exp,
pkg,
files,
options
});
}
// TODO: Remove duplicates...
const expoDomComponentReferences = bundles.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
if (expoDomComponentReferences.length > 0) {
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
expoDomComponentReferences.map(async (filePath)=>{
const { bundle } = await (0, _exportDomComponents.exportDomComponentAsync)({
filePath,
projectRoot,
dev: options.dev,
devServer,
isHermes,
includeSourceMaps: !!sourceMapUrl,
exp,
files
});
if (options.assetsDest) {
// Save assets like a typical bundler, preserving the file paths on web.
// This is saving web-style inside of a native app's binary.
await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, bundle.assets.map((asset)=>({
...asset,
httpServerLocation: _path().default.join(_DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation)
})), {
files,
platform: 'web',
outputDirectory: options.assetsDest
});
}
}));
}
return {
files,
bundle: {
code: bundles.artifacts.filter((a)=>a.type === 'js')[0].source,
// Can be optional when source maps aren't enabled.
map: (_bundles_artifacts_filter_ = bundles.artifacts.filter((a)=>a.type === 'map')[0]) == null ? void 0 : _bundles_artifacts_filter_.source.toString()
},
assets: bundles.assets
};
} catch (error) {
if (isError(error)) {
// Log using Xcode error format so the errors are picked up by xcodebuild.
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
if (options.platform === 'ios') {
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
if ('message' in error && (0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
error.message = (0, _ansi.stripAnsi)(error.message);
}
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, error);
}
}
throw error;
} finally{
devServerManager.stopAsync();
}
}
async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
const exp = (0, _config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true
}).exp;
// TODO: This is slow ~40ms
const { config } = await (0, _instantiateMetro.loadMetroConfigAsync)(projectRoot, {
// TODO: This is always enabled in the native script and there's no way to disable it.
resetCache: options.resetCache,
maxWorkers: options.maxWorkers
}, {
exp,
isExporting: true,
getMetroBundler () {
return server.getBundler().getBundler();
}
});
const isHermes = (0, _exportHermes.isEnableHermesManaged)(exp, options.platform);
let sourceMapUrl = options.sourcemapOutput;
if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {
sourceMapUrl = _path().default.basename(sourceMapUrl);
}
const directBundleOptions = (0, _metroOptions.getMetroDirectBundleOptionsForExpoConfig)(projectRoot, exp, {
splitChunks: false,
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, options.entryFile),
platform: options.platform,
minify: options.minify,
mode: options.dev ? 'development' : 'production',
engine: isHermes ? 'hermes' : undefined,
isExporting: true,
// Never output bytecode in the exported bundle since that is hardcoded in the native run script.
bytecode: false,
hosted: false
});
// TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties
const bundleRequest = {
..._Server().default.DEFAULT_BUNDLE_OPTIONS,
...directBundleOptions,
// NOTE(@kitten): Cast non-optional defaults
lazy: directBundleOptions.lazy ?? _Server().default.DEFAULT_BUNDLE_OPTIONS.lazy,
modulesOnly: directBundleOptions.modulesOnly ?? _Server().default.DEFAULT_BUNDLE_OPTIONS.modulesOnly,
runModule: directBundleOptions.runModule ?? _Server().default.DEFAULT_BUNDLE_OPTIONS.runModule,
sourceMapUrl,
unstable_transformProfile: options.unstableTransformProfile || (isHermes ? 'hermes-stable' : 'default')
};
const server = new (_Server()).default(config, {
watch: false
});
return {
server,
bundleRequest
};
}
async function exportEmbedAssetsAsync(server, bundleRequest, projectRoot, options) {
try {
const { entryFile, onProgress, resolverOptions, transformOptions } = (0, _splitBundleOptions().default)({
...bundleRequest,
// @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?
bundleType: 'todo'
});
const dependencies = await server._bundler.getDependencies([
entryFile
], transformOptions, resolverOptions, {
onProgress,
shallow: false,
lazy: false
});
const config = server._config;
return (0, _getAssets().default)(dependencies, {
processModuleFilter: config.serializer.processModuleFilter,
assetPlugins: config.transformer.assetPlugins,
platform: transformOptions.platform,
// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development
// behavior.
projectRoot: config.projectRoot,
publicPath: config.transformer.publicPath,
isHosted: false
});
} catch (error) {
if (isError(error)) {
// Log using Xcode error format so the errors are picked up by xcodebuild.
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
if (options.platform === 'ios') {
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
if ('message' in error && (0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
error.message = (0, _ansi.stripAnsi)(error.message);
}
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, error);
}
}
throw error;
}
}
function isError(error) {
return error instanceof Error;
}
//# sourceMappingURL=exportEmbedAsync.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,353 @@
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "exportStandaloneServerAsync", {
enumerable: true,
get: function() {
return exportStandaloneServerAsync;
}
});
function _config() {
const data = require("@expo/config");
_config = function() {
return data;
};
return data;
}
function _spawnasync() {
const data = /*#__PURE__*/ _interop_require_default(require("@expo/spawn-async"));
_spawnasync = function() {
return data;
};
return data;
}
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _nodechild_process() {
const data = require("node:child_process");
_nodechild_process = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _settings = require("../../api/settings");
const _log = require("../../log");
const _xcrun = require("../../start/platforms/ios/xcrun");
const _dir = require("../../utils/dir");
const _env = require("../../utils/env");
const _errors = require("../../utils/errors");
const _exportStaticAsync = require("../exportStaticAsync");
const _publicFolder = require("../publicFolder");
const _saveAssets = require("../saveAssets");
const _xcodeCompilerLogger = require("./xcodeCompilerLogger");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const debug = require('debug')('expo:export:server');
async function exportStandaloneServerAsync(projectRoot, devServer, { exp, pkg, files, options }) {
var _exp_extra_router, _exp_extra, _exp_extra1;
if (!options.eager) {
await tryRemovingGeneratedOriginAsync(projectRoot, exp);
}
(0, _xcodeCompilerLogger.logInXcode)('Exporting server');
// Store the server output in the project's .expo directory.
const serverOutput = _path().default.join(projectRoot, '.expo/server', options.platform);
// Remove the previous server output to prevent stale files.
await (0, _dir.removeAsync)(serverOutput);
// Export the API routes for server rendering the React Server Components.
await (0, _exportStaticAsync.exportApiRoutesStandaloneAsync)(devServer, {
files,
platform: 'web',
apiRoutesOnly: true
});
const publicPath = _path().default.resolve(projectRoot, _env.env.EXPO_PUBLIC_FOLDER);
// Copy over public folder items
await (0, _publicFolder.copyPublicFolderAsync)(publicPath, serverOutput);
// Copy over the server output on top of the public folder.
await (0, _saveAssets.persistMetroFilesAsync)(files, serverOutput);
[
...files.entries()
].forEach(([key, value])=>{
if (value.targetDomain === 'server') {
// Delete server resources to prevent them from being exposed in the binary.
files.delete(key);
}
});
// TODO: Deprecate this in favor of a built-in prop that users should avoid setting.
const userDefinedServerUrl = (_exp_extra = exp.extra) == null ? void 0 : (_exp_extra_router = _exp_extra.router) == null ? void 0 : _exp_extra_router.origin;
let serverUrl = userDefinedServerUrl;
const shouldSkipServerDeployment = (()=>{
if (!options.eager) {
(0, _xcodeCompilerLogger.logInXcode)('Skipping server deployment because the script is not running in eager mode.');
return true;
}
// Add an opaque flag to disable server deployment.
if (_env.env.EXPO_NO_DEPLOY) {
(0, _xcodeCompilerLogger.warnInXcode)('Skipping server deployment because environment variable EXPO_NO_DEPLOY is set.');
return true;
}
// Can't safely deploy from Xcode since the PATH isn't set up correctly. We could amend this in the future and allow users who customize the PATH to deploy from Xcode.
if ((0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
// TODO: Don't warn when the eager bundle has been run.
(0, _xcodeCompilerLogger.warnInXcode)('Skipping server deployment because the build is running from an Xcode run script. Build with Expo CLI or EAS Build to deploy the server automatically.');
return true;
}
return false;
})();
// Deploy the server output to a hosting provider.
const deployedServerUrl = shouldSkipServerDeployment ? false : await runServerDeployCommandAsync(projectRoot, {
distDirectory: serverOutput,
deployScript: getServerDeploymentScript(pkg.scripts, options.platform)
});
if (!deployedServerUrl) {
return;
}
if (serverUrl) {
(0, _xcodeCompilerLogger.logInXcode)(`Using custom server URL: ${serverUrl} (ignoring deployment URL: ${deployedServerUrl})`);
}
// If the user-defined server URL is not defined, use the deployed server URL.
// This allows for overwriting the server URL in the project's native files.
serverUrl ||= deployedServerUrl;
// If the user hasn't manually defined the server URL, write the deployed server URL to the app.json.
if (userDefinedServerUrl) {
_log.Log.log('Skip automatically linking server origin to native container');
return;
}
_log.Log.log('Writing generated server URL to app.json');
// NOTE: Is is it possible to assert that the config needs to be modifiable before building the app?
const modification = await (0, _config().modifyConfigAsync)(projectRoot, {
extra: {
...exp.extra ?? {},
router: {
...((_exp_extra1 = exp.extra) == null ? void 0 : _exp_extra1.router) ?? {},
generatedOrigin: serverUrl
}
}
}, {
skipSDKVersionRequirement: true
});
if (modification.type !== 'success') {
throw new _errors.CommandError(`Failed to write generated server origin to app.json because the file is dynamic and does not extend the static config. The client will not be able to make server requests to API routes or static files. You can disable server linking with EXPO_NO_DEPLOY=1 or by disabling server output in the app.json.`);
}
}
async function dumpDeploymentLogs(projectRoot, logs, name = 'deploy') {
const outputPath = _path().default.join(projectRoot, `.expo/logs/${name}.log`);
await _fs().default.promises.mkdir(_path().default.dirname(outputPath), {
recursive: true
});
debug('Dumping server deployment logs to: ' + outputPath);
await _fs().default.promises.writeFile(outputPath, logs);
return outputPath;
}
function getCommandBin(command) {
try {
return (0, _nodechild_process().execSync)(`command -v ${command}`, {
stdio: 'pipe'
}).toString().trim();
} catch {
return null;
}
}
async function runServerDeployCommandAsync(projectRoot, { distDirectory, deployScript }) {
const logOfflineError = ()=>{
const manualScript = deployScript ? `npm run ${deployScript.scriptName}` : `npx eas deploy --export-dir ${distDirectory}`;
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, _chalk().default.red`Running CLI in offline mode, skipping server deployment. Deploy manually with: ${manualScript}`);
};
if (_env.env.EXPO_OFFLINE) {
logOfflineError();
return false;
}
// TODO: Only allow EAS deployments when staging is enabled, this is because the feature is still staging-only.
if (!_env.env.EXPO_UNSTABLE_DEPLOY_SERVER) {
return false;
}
if (!_env.env.EAS_BUILD) {
// This check helps avoid running EAS if the user isn't a user of EAS.
// We only need to run it when building outside of EAS.
const globalBin = getCommandBin('eas');
if (!globalBin) {
// This should never happen from EAS Builds.
// Possible to happen when building locally with `npx expo run`
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, `eas-cli is not installed globally, skipping server deployment. Install EAS CLI with 'npm install -g eas-cli'.`);
return false;
}
debug('Found eas-cli:', globalBin);
}
let json;
try {
let results;
const spawnOptions = {
cwd: projectRoot,
// Ensures that errors can be caught.
stdio: 'pipe'
};
// TODO: Support absolute paths in EAS CLI
const exportDir = _path().default.relative(projectRoot, distDirectory);
if (deployScript) {
(0, _xcodeCompilerLogger.logInXcode)(`Using custom server deploy script: ${deployScript.scriptName}`);
// Amend the path to try and make the custom scripts work.
results = await (0, _spawnasync().default)('npm', [
'run',
deployScript.scriptName,
`--export-dir=${exportDir}`
], spawnOptions);
} else {
(0, _xcodeCompilerLogger.logInXcode)('Deploying server to link with client');
// results = DEPLOYMENT_SUCCESS_FIXTURE;
results = await (0, _spawnasync().default)('npx', [
'eas-cli',
'deploy',
'--non-interactive',
'--json',
`--export-dir=${exportDir}`
], spawnOptions);
debug('Server deployment stdout:', results.stdout);
// Send stderr to stderr. stdout is parsed as JSON.
if (results.stderr) {
process.stderr.write(results.stderr);
}
}
const logPath = await dumpDeploymentLogs(projectRoot, results.output.join('\n'));
try {
// {
// "dashboardUrl": "https://staging.expo.dev/projects/6460c11c-e1bc-4084-882a-fd9f57b825b1/hosting/deployments",
// "identifier": "8a1pwbv6c5",
// "url": "https://sep30--8a1pwbv6c5.staging.expo.app"
// }
json = JSON.parse(results.stdout.trim());
} catch {
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, `Failed to parse server deployment JSON output. Check the logs for more information: ${logPath}`);
return false;
}
} catch (error) {
if ((0, _xcrun.isSpawnResultError)(error)) {
const output = error.output.join('\n').trim() || error.toString();
_log.Log.log(_chalk().default.dim('An error occurred while deploying server. Logs stored at: ' + await dumpDeploymentLogs(projectRoot, output, 'deploy-error')));
// Likely a server offline or network error.
if (output.match(/ENOTFOUND/)) {
logOfflineError();
// Print the raw error message to help provide more context.
_log.Log.log(_chalk().default.dim(output));
// Prevent any other network requests (unlikely for this command).
(0, _settings.disableNetwork)();
return false;
}
(0, _xcodeCompilerLogger.logInXcode)(output);
if (output.match(/spawn eas ENOENT/)) {
// EAS not installed.
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, `Server deployment failed because eas-cli cannot be accessed from the build script's environment (ENOENT). Install EAS CLI with 'npm install -g eas-cli'.`);
return false;
}
if (error.stderr.match(/Must configure EAS project by running/)) {
// EAS not configured, this can happen when building a project locally before building in EAS.
// User must run `eas init`, `eas deploy`, or `eas build` first.
// TODO: Should we fail the build here or just warn users?
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, `Skipping server deployment because EAS is not configured. Run 'eas init' before trying again, or disable server output in the project.`);
return false;
}
}
// Throw unhandled server deployment errors.
throw error;
}
// Assert json format
assertDeploymentJsonOutput(json);
// Warn about the URL not being valid. This should never happen, but might be possible with third-parties.
if (!canParseURL(json.url)) {
(0, _xcodeCompilerLogger.warnInXcode)(`The server deployment URL is not a valid URL: ${json.url}`);
}
if (json.dashboardUrl) {
(0, _xcodeCompilerLogger.logInXcode)(`Server dashboard: ${json.dashboardUrl}`);
}
(0, _xcodeCompilerLogger.logInXcode)(`Server deployed to: ${json.url}`);
return json.url;
}
function canParseURL(url) {
try {
// eslint-disable-next-line no-new
new URL(url);
return true;
} catch {
return false;
}
}
function assertDeploymentJsonOutput(json) {
if (!json || typeof json !== 'object' || typeof json.url !== 'string') {
throw new Error('JSON output of server deployment command are not in the expected format: { url: "https://..." }');
}
}
function getServerDeploymentScript(scripts, platform) {
// Users can overwrite the default deployment script with:
// { scripts: { "native:deploy": "eas deploy --json --non-interactive" } }
// A quick search on GitHub showed that `native:deploy` is not used in any public repos yet.
// https://github.com/search?q=%22native%3Adeploy%22+path%3Apackage.json&type=code
const DEFAULT_SCRIPT_NAME = 'native:deploy';
const scriptNames = [
// DEFAULT_SCRIPT_NAME + ':' + platform,
DEFAULT_SCRIPT_NAME
];
for (const scriptName of scriptNames){
if (scripts == null ? void 0 : scripts[scriptName]) {
return {
scriptName,
script: scripts[scriptName]
};
}
}
return null;
}
/** We can try to remove the generated origin from the manifest when running outside of eager mode. Bundling is the last operation to run so the config will already be embedded with the origin. */ async function tryRemovingGeneratedOriginAsync(projectRoot, exp) {
var _exp_extra_router, _exp_extra, _exp_extra1;
if (_env.env.CI) {
// Skip in CI since nothing is committed.
return;
}
if (((_exp_extra = exp.extra) == null ? void 0 : (_exp_extra_router = _exp_extra.router) == null ? void 0 : _exp_extra_router.generatedOrigin) == null) {
debug('No generated origin needs removing');
return;
}
const modification = await (0, _config().modifyConfigAsync)(projectRoot, {
extra: {
...exp.extra ?? {},
router: {
...((_exp_extra1 = exp.extra) == null ? void 0 : _exp_extra1.router) ?? {},
generatedOrigin: undefined
}
}
}, {
skipSDKVersionRequirement: true
});
if (modification.type !== 'success') {
debug('Could not remove generated origin from manifest');
} else {
debug('Generated origin has been removed from manifest');
}
}
//# sourceMappingURL=exportServer.js.map

File diff suppressed because one or more lines are too long

156
node_modules/@expo/cli/build/src/export/embed/index.js generated vendored Normal file
View File

@@ -0,0 +1,156 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "expoExportEmbed", {
enumerable: true,
get: function() {
return expoExportEmbed;
}
});
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _args = require("../../utils/args");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
const expoExportEmbed = async (argv)=>{
const rawArgsMap = {
// Types
'--entry-file': String,
'--platform': String,
'--transformer': String,
'--bundle-output': String,
'--bundle-encoding': String,
'--max-workers': Number,
'--sourcemap-output': String,
'--sourcemap-sources-root': String,
'--assets-dest': String,
'--asset-catalog-dest': String,
'--unstable-transform-profile': String,
'--config': String,
// Hack: This is added because react-native-xcode.sh script always includes this value.
// If supplied, we'll do nothing with the value, but at least the process won't crash.
// Note that we also don't show this value in the `--help` prompt since we don't want people to use it.
'--config-cmd': String,
// New flag to guess the other flags based on the environment.
'--eager': Boolean,
// Export the bundle as Hermes bytecode bundle
'--bytecode': Boolean,
// This is here for compatibility with the `npx react-native bundle` command.
// devs should use `DEBUG=expo:*` instead.
'--verbose': Boolean,
'--help': Boolean,
// Aliases
'-h': '--help',
'-v': '--verbose'
};
const args = (0, _args.assertWithOptionsArgs)(rawArgsMap, {
argv,
permissive: true
});
if (args['--help']) {
(0, _args.printHelp)(`(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`, (0, _chalk().default)`npx expo export:embed {dim <dir>}`, [
(0, _chalk().default)`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
`--entry-file <path> Path to the root JS file, either absolute or relative to JS root`,
`--platform <string> Either "ios" or "android" (default: "ios")`,
`--transformer <string> Specify a custom transformer to be used`,
`--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,
`--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,
`--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,
`--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: "utf8")`,
`--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,
`--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,
`--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,
`--sourcemap-use-absolute-path Report SourceMapURL using its full path`,
`--assets-dest <string> Directory name where to store assets referenced in the bundle`,
`--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,
`--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,
`--reset-cache Removes cached files`,
`--eager Eagerly export the bundle with default options`,
`--bytecode Export the bundle as Hermes bytecode bundle`,
`-v, --verbose Enables debug logging`,
`--config <string> Path to the CLI configuration file`,
// This is seemingly unused.
`--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,
`-h, --help Usage info`
].join('\n'));
}
const [{ exportEmbedAsync }, { resolveOptions }, { logCmdError }, { resolveCustomBooleanArgsAsync }] = await Promise.all([
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./exportEmbedAsync.js"))),
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./resolveOptions.js"))),
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../../utils/errors.js"))),
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../../utils/resolveArgs.js")))
]);
return (async ()=>{
const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {
'--eager': Boolean,
'--bytecode': Boolean,
'--dev': Boolean,
'--minify': Boolean,
'--sourcemap-use-absolute-path': Boolean,
'--reset-cache': Boolean,
'--read-global-cache': Boolean
});
const projectRoot = _path().default.resolve(parsed.projectRoot);
return exportEmbedAsync(projectRoot, resolveOptions(projectRoot, args, parsed));
})().catch(logCmdError);
};
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,158 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
deserializeEagerKey: function() {
return deserializeEagerKey;
},
getExportEmbedOptionsKey: function() {
return getExportEmbedOptionsKey;
},
resolveEagerOptionsAsync: function() {
return resolveEagerOptionsAsync;
},
resolveOptions: function() {
return resolveOptions;
}
});
function _paths() {
const data = require("@expo/config/paths");
_paths = function() {
return data;
};
return data;
}
function _canonicalize() {
const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro/metro-core/canonicalize"));
_canonicalize = function() {
return data;
};
return data;
}
function _os() {
const data = /*#__PURE__*/ _interop_require_default(require("os"));
_os = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _env = require("../../utils/env");
const _errors = require("../../utils/errors");
const _exportHermes = require("../exportHermes");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function assertIsBoolean(val) {
if (typeof val !== 'boolean') {
throw new _errors.CommandError(`Expected boolean, got ${typeof val}`);
}
}
function getBundleEncoding(encoding) {
return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii' ? encoding : undefined;
}
function resolveOptions(projectRoot, args, parsed) {
const dev = parsed.args['--dev'] ?? true;
assertIsBoolean(dev);
const platform = args['--platform'];
if (!platform) {
throw new _errors.CommandError(`Missing required argument: --platform`);
}
const bundleOutput = args['--bundle-output'];
const commonOptions = {
entryFile: args['--entry-file'] ?? (0, _paths().resolveEntryPoint)(projectRoot, {
platform
}),
assetCatalogDest: args['--asset-catalog-dest'],
platform,
transformer: args['--transformer'],
// TODO: Support `--dev false`
// dev: false,
bundleOutput,
bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',
maxWorkers: args['--max-workers'],
sourcemapOutput: args['--sourcemap-output'],
sourcemapSourcesRoot: args['--sourcemap-sources-root'],
sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],
assetsDest: args['--assets-dest'],
unstableTransformProfile: args['--unstable-transform-profile'],
resetCache: !!parsed.args['--reset-cache'],
verbose: args['--verbose'] ?? _env.env.EXPO_DEBUG,
config: args['--config'] ? _path().default.resolve(args['--config']) : undefined,
dev,
minify: parsed.args['--minify'],
eager: !!parsed.args['--eager'],
bytecode: parsed.args['--bytecode']
};
if (commonOptions.eager) {
return resolveEagerOptionsAsync(projectRoot, commonOptions);
}
// Perform extra assertions after the eager options are resolved.
if (!bundleOutput) {
throw new _errors.CommandError(`Missing required argument: --bundle-output`);
}
const minify = parsed.args['--minify'] ?? !dev;
assertIsBoolean(minify);
return {
...commonOptions,
minify,
bundleOutput
};
}
function getTemporaryPath() {
return _path().default.join(_os().default.tmpdir(), Math.random().toString(36).substring(2));
}
function resolveEagerOptionsAsync(projectRoot, { dev, platform, assetsDest, bundleOutput, minify, ...options }) {
// If the minify prop is undefined, then check if the project is using hermes.
minify ??= !(platform === 'android' ? (0, _exportHermes.isAndroidUsingHermes)(projectRoot) : (0, _exportHermes.isIosUsingHermes)(projectRoot));
let destination;
if (!assetsDest) {
destination ??= getTemporaryPath();
assetsDest = _path().default.join(destination, 'assets');
}
if (!bundleOutput) {
destination ??= getTemporaryPath();
bundleOutput = platform === 'ios' ? _path().default.join(destination, 'main.jsbundle') : _path().default.join(destination, 'index.js');
}
return {
...options,
eager: options.eager ?? true,
bundleOutput,
assetsDest,
entryFile: options.entryFile ?? (0, _paths().resolveEntryPoint)(projectRoot, {
platform
}),
resetCache: !!options.resetCache,
platform,
minify,
dev,
bundleEncoding: 'utf8',
sourcemapUseAbsolutePath: false,
verbose: _env.env.EXPO_DEBUG
};
}
function getExportEmbedOptionsKey({ // Extract all values that won't change the Metro results.
resetCache, assetsDest, bundleOutput, verbose, maxWorkers, eager, ...options }) {
// Create a sorted key for the options, removing values that won't change the Metro results.
return JSON.stringify(options, _canonicalize().default);
}
function deserializeEagerKey(key) {
return JSON.parse(key);
}
//# sourceMappingURL=resolveOptions.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,148 @@
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getXcodeCompilerErrorMessage: function() {
return getXcodeCompilerErrorMessage;
},
isExecutingFromXcodebuild: function() {
return isExecutingFromXcodebuild;
},
isPossiblyUnableToResolveError: function() {
return isPossiblyUnableToResolveError;
},
logInXcode: function() {
return logInXcode;
},
logMetroErrorInXcode: function() {
return logMetroErrorInXcode;
},
warnInXcode: function() {
return warnInXcode;
}
});
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _log = require("../../log");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function isPossiblyUnableToResolveError(error) {
return 'message' in error && typeof error.message === 'string' && 'originModulePath' in error && typeof error.originModulePath === 'string' && 'targetModuleName' in error && typeof error.targetModuleName === 'string';
}
function isPossiblyTransformError(error) {
return 'message' in error && typeof error.message === 'string' && 'filename' in error && typeof error.filename === 'string' && 'lineNumber' in error && typeof error.lineNumber === 'number';
}
function getXcodeCompilerErrorMessage(projectRoot, error) {
const makeFilepathAbsolute = (filepath)=>filepath.startsWith('/') ? filepath : _path().default.join(projectRoot, filepath);
if (typeof error === 'string') {
return makeXcodeCompilerLog('error', error);
} else if ('message' in error) {
// Metro's `UnableToResolveError`
if (isPossiblyUnableToResolveError(error)) {
const loc = getLineNumberForStringInFile(error.originModulePath, error.targetModuleName);
return makeXcodeCompilerLog('error', error.message, {
fileName: error.originModulePath,
lineNumber: loc == null ? void 0 : loc.lineNumber,
column: loc == null ? void 0 : loc.column
});
} else if (isPossiblyTransformError(error)) {
return makeXcodeCompilerLog('error', error.message, {
// Metro generally returns the filename as relative from the project root.
fileName: makeFilepathAbsolute(error.filename),
lineNumber: error.lineNumber,
column: error.column
});
// TODO: ResourceNotFoundError, GraphNotFoundError, RevisionNotFoundError, AmbiguousModuleResolutionError
} else {
// Unknown error
return makeXcodeCompilerLog('error', error.message);
}
}
return null;
}
function logMetroErrorInXcode(projectRoot, error) {
const message = getXcodeCompilerErrorMessage(projectRoot, error);
if (message != null) {
console.error(message);
}
}
function logInXcode(message) {
_log.Log.log(makeXcodeCompilerLog('note', message));
}
function warnInXcode(message) {
_log.Log.warn(makeXcodeCompilerLog('warning', message));
}
function isExecutingFromXcodebuild() {
return !!process.env.BUILT_PRODUCTS_DIR;
}
function makeXcodeCompilerLog(type, message, { fileName, lineNumber, column } = {}) {
if (!isExecutingFromXcodebuild()) {
return message;
}
// TODO: Figure out how to support multi-line logs.
const firstLine = message.split('\n')[0];
if (fileName && !(fileName == null ? void 0 : fileName.includes(':'))) {
return `${fileName}:${lineNumber || 0}:${column != null ? column + ':' : ''} ${type}: ${firstLine}`;
}
return `${type}: ${firstLine}`;
}
// TODO: Metro doesn't expose this info even though it knows it.
function getLineNumberForStringInFile(originModulePath, targetModuleName) {
let file;
try {
file = _fs().default.readFileSync(originModulePath, 'utf8');
} catch (error) {
if (error.code === 'ENOENT' || error.code === 'EISDIR') {
// We're probably dealing with a virtualised file system where
// `this.originModulePath` doesn't actually exist on disk.
// We can't show a code frame, but there's no need to let this I/O
// error shadow the original module resolution error.
return null;
}
throw error;
}
const lines = file.split('\n');
let lineNumber = 0;
let column = -1;
for(let line = 0; line < lines.length; line++){
const columnLocation = lines[line].lastIndexOf(targetModuleName);
if (columnLocation >= 0) {
lineNumber = line;
column = columnLocation;
break;
}
}
return {
lineNumber,
column
};
}
//# sourceMappingURL=xcodeCompilerLogger.js.map

File diff suppressed because one or more lines are too long

387
node_modules/@expo/cli/build/src/export/exportApp.js generated vendored Normal file
View File

@@ -0,0 +1,387 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "exportAppAsync", {
enumerable: true,
get: function() {
return exportAppAsync;
}
});
function _config() {
const data = require("@expo/config");
_config = function() {
return data;
};
return data;
}
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _createMetadataJson = require("./createMetadataJson");
const _exportAssets = require("./exportAssets");
const _exportDomComponents = require("./exportDomComponents");
const _exportHermes = require("./exportHermes");
const _exportStaticAsync = require("./exportStaticAsync");
const _favicon = require("./favicon");
const _getPublicExpoManifest = require("./getPublicExpoManifest");
const _publicFolder = require("./publicFolder");
const _saveAssets = require("./saveAssets");
const _writeContents = require("./writeContents");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../log"));
const _WebSupportProjectPrerequisite = require("../start/doctor/web/WebSupportProjectPrerequisite");
const _DevServerManager = require("../start/server/DevServerManager");
const _MetroBundlerDevServer = require("../start/server/metro/MetroBundlerDevServer");
const _router = require("../start/server/metro/router");
const _serializeHtml = require("../start/server/metro/serializeHtml");
const _ManifestMiddleware = require("../start/server/middleware/ManifestMiddleware");
const _metroOptions = require("../start/server/middleware/metroOptions");
const _webTemplate = require("../start/server/webTemplate");
const _env = require("../utils/env");
const _errors = require("../utils/errors");
const _nodeEnv = require("../utils/nodeEnv");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, dumpAssetmap, sourceMaps, inlineSourceMaps, minify, bytecode, maxWorkers, skipSSG, hostedNative }) {
var _exp_web, _exp_web1;
// Force the environment during export and do not allow overriding it.
const environment = dev ? 'development' : 'production';
process.env.NODE_ENV = environment;
(0, _nodeEnv.setNodeEnv)(environment);
(0, _nodeEnv.loadEnvFiles)(projectRoot);
const projectConfig = (0, _config().getConfig)(projectRoot);
const exp = await (0, _getPublicExpoManifest.getPublicExpoManifestAsync)(projectRoot, {
// Web doesn't require validation.
skipValidation: platforms.length === 1 && platforms[0] === 'web'
});
if (platforms.includes('web')) {
await new _WebSupportProjectPrerequisite.WebSupportProjectPrerequisite(projectRoot).assertAsync();
}
const useServerRendering = [
'static',
'server'
].includes(((_exp_web = exp.web) == null ? void 0 : _exp_web.output) ?? '');
if (skipSSG && ((_exp_web1 = exp.web) == null ? void 0 : _exp_web1.output) !== 'server') {
throw new _errors.CommandError('--no-ssg can only be used with `web.output: server`');
}
const baseUrl = (0, _metroOptions.getBaseUrlFromExpoConfig)(exp);
if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {
_log.warn(`Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`);
}
// Print out logs
if (baseUrl) {
_log.log();
_log.log(_chalk().default.gray`Using (experimental) base path: ${baseUrl}`);
// Warn if not using an absolute path.
if (!baseUrl.startsWith('/')) {
_log.log(_chalk().default.yellow` Base path does not start with a slash. Requests will not be absolute.`);
}
}
const mode = dev ? 'development' : 'production';
const publicPath = _path().default.resolve(projectRoot, _env.env.EXPO_PUBLIC_FOLDER);
const outputPath = _path().default.resolve(projectRoot, outputDir);
// Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).
const files = new Map();
const devServerManager = await _DevServerManager.DevServerManager.startMetroAsync(projectRoot, {
minify,
mode,
port: 8081,
isExporting: true,
location: {},
resetDevServer: clear,
maxWorkers
});
const devServer = devServerManager.getDefaultDevServer();
(0, _assert().default)(devServer instanceof _MetroBundlerDevServer.MetroBundlerDevServer);
const bundles = {};
const domComponentAssetsMetadata = {};
const spaPlatforms = // TODO: Support server and static rendering for server component exports.
useServerRendering && !devServer.isReactServerComponentsEnabled ? platforms.filter((platform)=>platform !== 'web') : platforms;
try {
if (devServer.isReactServerComponentsEnabled) {
// In RSC mode, we only need these to be in the client dir.
// TODO: Merge back with other copy after we add SSR.
try {
await (0, _publicFolder.copyPublicFolderAsync)(publicPath, _path().default.join(outputPath, 'client'));
} catch (error) {
_log.error('Failed to copy public directory to dist directory');
throw error;
}
} else {
// NOTE(kitten): The public folder is currently always copied, regardless of targetDomain
// split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`
await (0, _publicFolder.copyPublicFolderAsync)(publicPath, outputPath);
}
let templateHtml;
// Can be empty during web-only SSG.
if (spaPlatforms.length) {
await Promise.all(spaPlatforms.map(async (platform)=>{
// Assert early so the user doesn't have to wait until bundling is complete to find out that
// Hermes won't be available.
const isHermes = (0, _exportHermes.isEnableHermesManaged)(exp, platform);
if (isHermes) {
await (0, _exportHermes.assertEngineMismatchAsync)(projectRoot, exp, platform);
}
let bundle;
try {
var _exp_experiments;
// Run metro bundler and create the JS bundles/source maps.
bundle = await devServer.nativeExportBundleAsync(exp, {
platform,
splitChunks: !_env.env.EXPO_NO_BUNDLE_SPLITTING && (devServer.isReactServerComponentsEnabled && !bytecode || platform === 'web'),
mainModuleName: (0, _ManifestMiddleware.getEntryWithServerRoot)(projectRoot, {
platform,
pkg: projectConfig.pkg
}),
mode: dev ? 'development' : 'production',
engine: isHermes ? 'hermes' : undefined,
serializerIncludeMaps: sourceMaps || inlineSourceMaps,
inlineSourceMap: inlineSourceMaps,
bytecode: bytecode && isHermes,
reactCompiler: !!((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.reactCompiler),
hosted: hostedNative
}, files);
} catch (error) {
_log.log('');
if (error instanceof Error) {
_log.exception(error);
} else {
_log.error('Failed to bundle the app');
_log.log(error);
}
process.exit(1);
}
bundles[platform] = bundle;
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts, {
includeSourceMaps: sourceMaps,
files,
isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative
});
// TODO: Remove duplicates...
const expoDomComponentReferences = bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
expoDomComponentReferences.map(async (filePath)=>{
const { bundle: platformDomComponentsBundle, htmlOutputName } = await (0, _exportDomComponents.exportDomComponentAsync)({
filePath,
projectRoot,
dev,
devServer,
isHermes,
includeSourceMaps: sourceMaps,
exp,
files,
useMd5Filename: true
});
// Merge the assets from the DOM component into the output assets.
bundle.assets.push(...platformDomComponentsBundle.assets);
(0, _exportDomComponents.transformNativeBundleForMd5Filename)({
domComponentReference: filePath,
nativeBundle: bundle,
files,
htmlOutputName
});
domComponentAssetsMetadata[platform] = [
...domComponentAssetsMetadata[platform] || [],
...await (0, _exportDomComponents.addDomBundleToMetadataAsync)(platformDomComponentsBundle),
...(0, _exportDomComponents.transformDomEntryForMd5Filename)({
files,
htmlOutputName
})
];
}));
if (platform === 'web') {
// TODO: Unify with exportStaticAsync
// TODO: Maybe move to the serializer.
let html = await (0, _serializeHtml.serializeHtmlWithAssets)({
isExporting: true,
resources: bundle.artifacts,
template: await (0, _webTemplate.createTemplateHtmlFromExpoConfigAsync)(projectRoot, {
scripts: [],
cssLinks: [],
exp: projectConfig.exp
}),
baseUrl
});
// Add the favicon assets to the HTML.
const modifyHtml = await (0, _favicon.getVirtualFaviconAssetsAsync)(projectRoot, {
outputDir,
baseUrl,
files,
exp: projectConfig.exp
});
if (modifyHtml) {
html = modifyHtml(html);
}
// HACK: This is used for adding SSR shims in React Server Components.
templateHtml = html;
// Generate SPA-styled HTML file.
// If web exists, then write the template HTML file.
files.set('index.html', {
contents: html,
targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client'
});
}
}));
if (devServer.isReactServerComponentsEnabled) {
const isWeb = platforms.includes('web');
await (0, _exportStaticAsync.exportApiRoutesStandaloneAsync)(devServer, {
files,
platform: 'web',
apiRoutesOnly: !isWeb,
templateHtml
});
}
// TODO: Use same asset system across platforms again.
const { assets, embeddedHashSet } = await (0, _exportAssets.exportAssetsAsync)(projectRoot, {
files,
exp,
outputDir: outputPath,
bundles,
baseUrl,
hostedNative
});
if (dumpAssetmap) {
_log.log('Creating asset map');
files.set('assetmap.json', {
contents: JSON.stringify((0, _writeContents.createAssetMap)({
assets
}))
});
}
const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';
const fileNames = Object.fromEntries(Object.entries(bundles).map(([platform, bundle])=>[
platform,
bundle.artifacts.filter((asset)=>asset.type === 'js').map((asset)=>targetDomain + asset.filename)
]));
// Generate a `metadata.json` for EAS Update.
const contents = (0, _createMetadataJson.createMetadataJson)({
bundles,
fileNames,
embeddedHashSet,
domComponentAssetsMetadata
});
files.set('metadata.json', {
contents: JSON.stringify(contents)
});
}
// Additional web-only steps...
if (platforms.includes('web') && useServerRendering) {
var _exp_web2;
const exportServer = ((_exp_web2 = exp.web) == null ? void 0 : _exp_web2.output) === 'server';
if (exportServer) {
// TODO: Remove when this is abstracted into the files map
await (0, _publicFolder.copyPublicFolderAsync)(publicPath, _path().default.resolve(outputPath, 'client'));
}
if (skipSSG) {
_log.log('Skipping static site generation');
await (0, _exportStaticAsync.exportApiRoutesStandaloneAsync)(devServer, {
files,
platform: 'web',
apiRoutesOnly: true
});
// Output a placeholder index.html if one doesn't exist in the public directory.
// This ensures native + API routes have some content at the root URL.
const placeholderIndex = _path().default.resolve(outputPath, 'client/index.html');
if (!_fs().default.existsSync(placeholderIndex)) {
files.set('index.html', {
contents: `<html><body></body></html>`,
targetDomain: 'client'
});
}
} else if (// TODO: Support static export with RSC.
!devServer.isReactServerComponentsEnabled) {
var _exp_experiments;
await (0, _exportStaticAsync.exportFromServerAsync)(projectRoot, devServer, {
mode,
files,
clear: !!clear,
outputDir: outputPath,
minify,
baseUrl,
includeSourceMaps: sourceMaps,
routerRoot: (0, _router.getRouterDirectoryModuleIdWithManifest)(projectRoot, exp),
reactCompiler: !!((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.reactCompiler),
exportServer,
maxWorkers,
isExporting: true,
exp: projectConfig.exp
});
}
}
} finally{
await devServerManager.stopAsync();
}
// Write all files at the end for unified logging.
await (0, _saveAssets.persistMetroFilesAsync)(files, outputPath);
}
//# sourceMappingURL=exportApp.js.map

File diff suppressed because one or more lines are too long

245
node_modules/@expo/cli/build/src/export/exportAssets.js generated vendored Normal file
View File

@@ -0,0 +1,245 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
assetPatternsToBeBundled: function() {
return assetPatternsToBeBundled;
},
exportAssetsAsync: function() {
return exportAssetsAsync;
},
resolveAssetPatternsToBeBundled: function() {
return resolveAssetPatternsToBeBundled;
}
});
function _fs() {
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
_fs = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
function _picomatch() {
const data = /*#__PURE__*/ _interop_require_default(require("picomatch"));
_picomatch = function() {
return data;
};
return data;
}
const _persistMetroAssets = require("./persistMetroAssets");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../log"));
const _resolveAssets = require("../start/server/middleware/resolveAssets");
const _array = require("../utils/array");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
const debug = require('debug')('expo:export:exportAssets');
function mapAssetHashToAssetString(asset, hash) {
return 'asset_' + hash + ('type' in asset && asset.type ? '.' + asset.type : '');
}
function assetPatternsToBeBundled(exp) {
var _exp_updates_assetPatternsToBeBundled, _exp_updates, _exp_extra_updates_assetPatternsToBeBundled, _exp_extra_updates, _exp_extra;
// new location for this key
if ((_exp_updates = exp.updates) == null ? void 0 : (_exp_updates_assetPatternsToBeBundled = _exp_updates.assetPatternsToBeBundled) == null ? void 0 : _exp_updates_assetPatternsToBeBundled.length) {
return exp.updates.assetPatternsToBeBundled;
}
// old, untyped location for this key. we may want to change this to throw in a few SDK versions (deprecated as of SDK 52).
if ((_exp_extra = exp.extra) == null ? void 0 : (_exp_extra_updates = _exp_extra.updates) == null ? void 0 : (_exp_extra_updates_assetPatternsToBeBundled = _exp_extra_updates.assetPatternsToBeBundled) == null ? void 0 : _exp_extra_updates_assetPatternsToBeBundled.length) {
return exp.extra.updates.assetPatternsToBeBundled;
}
return undefined;
}
/**
* Given an asset and a set of strings representing the assets to be bundled, returns true if
* the asset is part of the set to be bundled.
* @param asset Asset object
* @param bundledAssetsSet Set of strings
* @returns true if the asset should be bundled
*/ function assetShouldBeIncludedInExport(asset, bundledAssetsSet) {
if (!bundledAssetsSet) {
return true;
}
return asset.fileHashes.filter((hash)=>bundledAssetsSet.has(mapAssetHashToAssetString(asset, hash))).length > 0;
}
/**
* Computes a set of strings representing the assets to be bundled with an export, given an array of assets,
* and a set of patterns to match
* @param assets The asset array
* @param assetPatternsToBeBundled An array of strings with glob patterns to match
* @param projectRoot The project root
* @returns A set of asset strings
*/ function setOfAssetsToBeBundled(assets, assetPatternsToBeBundled, projectRoot) {
// Convert asset patterns to a list of asset strings that match them.
// Assets strings are formatted as `asset_<hash>.<type>` and represent
// the name that the file will have in the app bundle. The `asset_` prefix is
// needed because android doesn't support assets that start with numbers.
const fullPatterns = assetPatternsToBeBundled.map((p)=>_path().default.join(projectRoot, p));
logPatterns(fullPatterns);
const matches = (0, _picomatch().default)(fullPatterns);
const allBundledAssets = assets.map((asset)=>{
const shouldBundle = shouldBundleAsset(asset, matches);
if (shouldBundle) {
var _asset_files;
debug(`${shouldBundle ? 'Include' : 'Exclude'} asset ${(_asset_files = asset.files) == null ? void 0 : _asset_files[0]}`);
return asset.fileHashes.map((hash)=>mapAssetHashToAssetString(asset, hash));
}
return [];
}).flat();
// The assets returned by the RN packager has duplicates so make sure we
// only bundle each once.
return new Set(allBundledAssets);
}
function resolveAssetPatternsToBeBundled(projectRoot, exp, assets) {
const assetPatternsToBeBundledForConfig = assetPatternsToBeBundled(exp);
if (!assetPatternsToBeBundledForConfig) {
return undefined;
}
const bundledAssets = setOfAssetsToBeBundled(assets, assetPatternsToBeBundledForConfig, projectRoot);
return bundledAssets;
}
function logPatterns(patterns) {
// Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.
_log.log('\nProcessing asset bundle patterns:');
patterns.forEach((p)=>_log.log('- ' + p));
}
function shouldBundleAsset(asset, matcher) {
var _asset_files;
const file = (_asset_files = asset.files) == null ? void 0 : _asset_files[0];
return !!('__packager_asset' in asset && asset.__packager_asset && file && matcher(file));
}
async function exportAssetsAsync(projectRoot, { exp, outputDir, bundles: { web, ...bundles }, baseUrl, files = new Map(), hostedNative }) {
var _assets_;
const hostedAssets = web ? [
...web.assets
] : [];
// If the native assets should be hosted like web, then we can add them to the hosted assets to export.
if (hostedNative) {
hostedAssets.push(...Object.values(bundles).flatMap((bundle)=>bundle.assets ?? []));
}
if (hostedAssets.length) {
// Save assets like a typical bundler, preserving the file paths on web.
// TODO: Update React Native Web to support loading files from asset hashes.
await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, hostedAssets, {
files,
platform: 'web',
outputDirectory: outputDir,
baseUrl
});
}
if (hostedNative) {
// Add google services file if it exists
await (0, _resolveAssets.resolveGoogleServicesFile)(projectRoot, exp);
return {
exp,
assets: [],
embeddedHashSet: new Set(),
files
};
}
const assets = (0, _array.uniqBy)(Object.values(bundles).flatMap((bundle)=>bundle.assets), (asset)=>asset.hash);
let bundledAssetsSet = undefined;
let filteredAssets = assets;
const embeddedHashSet = new Set();
if ((_assets_ = assets[0]) == null ? void 0 : _assets_.fileHashes) {
debug(`Assets = ${JSON.stringify(assets, null, 2)}`);
// Updates the manifest to reflect additional asset bundling + configs
// Get only asset strings for assets we will save
bundledAssetsSet = resolveAssetPatternsToBeBundled(projectRoot, exp, assets);
if (bundledAssetsSet) {
debug(`Bundled assets = ${JSON.stringify([
...bundledAssetsSet
], null, 2)}`);
// Filter asset objects to only ones that include assetPatternsToBeBundled matches
filteredAssets = assets.filter((asset)=>{
const shouldInclude = assetShouldBeIncludedInExport(asset, bundledAssetsSet);
if (!shouldInclude) {
embeddedHashSet.add(asset.hash);
}
return shouldInclude;
});
debug(`Filtered assets count = ${filteredAssets.length}`);
}
const hashes = new Set();
// Add assets to copy.
filteredAssets.forEach((asset)=>{
const assetId = (0, _persistMetroAssets.getAssetIdForLogGrouping)(projectRoot, asset);
asset.files.forEach((fp, index)=>{
const hash = asset.fileHashes[index];
if (hashes.has(hash)) return;
hashes.add(hash);
files.set(_path().default.join('assets', hash), {
originFilename: _path().default.relative(projectRoot, fp),
contents: _fs().default.readFileSync(fp),
assetId
});
});
});
}
// Add google services file if it exists
await (0, _resolveAssets.resolveGoogleServicesFile)(projectRoot, exp);
return {
exp,
assets,
embeddedHashSet,
files
};
}
//# sourceMappingURL=exportAssets.js.map

File diff suppressed because one or more lines are too long

103
node_modules/@expo/cli/build/src/export/exportAsync.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "exportAsync", {
enumerable: true,
get: function() {
return exportAsync;
}
});
function _chalk() {
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
_chalk = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
const _exportApp = require("./exportApp");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../log"));
const _attachAtlas = require("../start/server/metro/debugging/attachAtlas");
const _FileNotifier = require("../utils/FileNotifier");
const _dir = require("../utils/dir");
const _errors = require("../utils/errors");
const _exit = require("../utils/exit");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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);
}
function _interop_require_wildcard(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 = {
__proto__: null
};
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;
}
async function exportAsync(projectRoot, options) {
// Ensure the output directory is created
const outputPath = _path().default.resolve(projectRoot, options.outputDir);
if (outputPath === projectRoot) {
throw new _errors.CommandError('--output-dir cannot be the same as the project directory.');
} else if (projectRoot.startsWith(outputPath)) {
throw new _errors.CommandError(`--output-dir cannot be a parent directory of the project directory.`);
}
// Delete the output directory if it exists
await (0, _dir.removeAsync)(outputPath);
// Create the output directory
await (0, _dir.ensureDirectoryAsync)(outputPath);
// Export the app
await (0, _exportApp.exportAppAsync)(projectRoot, options);
// Stop any file watchers to prevent the CLI from hanging.
_FileNotifier.FileNotifier.stopAll();
// Wait until Atlas is ready, when enabled
// NOTE(cedric): this is a workaround, remove when `process.exit` is removed
await (0, _attachAtlas.waitUntilAtlasExportIsReadyAsync)(projectRoot);
// Final notes
_log.log(_chalk().default.greenBright`Exported: ${options.outputDir}`);
// Exit the process to stop any hanging processes from reading the app.config.js or server rendering.
(0, _exit.ensureProcessExitsAfterDelay)();
}
//# sourceMappingURL=exportAsync.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { waitUntilAtlasExportIsReadyAsync } from '../start/server/metro/debugging/attachAtlas';\nimport { FileNotifier } from '../utils/FileNotifier';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\nimport { CommandError } from '../utils/errors';\nimport { ensureProcessExitsAfterDelay } from '../utils/exit';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n\n if (outputPath === projectRoot) {\n throw new CommandError('--output-dir cannot be the same as the project directory.');\n } else if (projectRoot.startsWith(outputPath)) {\n throw new CommandError(`--output-dir cannot be a parent directory of the project directory.`);\n }\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Stop any file watchers to prevent the CLI from hanging.\n FileNotifier.stopAll();\n // Wait until Atlas is ready, when enabled\n // NOTE(cedric): this is a workaround, remove when `process.exit` is removed\n await waitUntilAtlasExportIsReadyAsync(projectRoot);\n\n // Final notes\n Log.log(chalk.greenBright`Exported: ${options.outputDir}`);\n\n // Exit the process to stop any hanging processes from reading the app.config.js or server rendering.\n ensureProcessExitsAfterDelay();\n}\n"],"names":["exportAsync","projectRoot","options","outputPath","path","resolve","outputDir","CommandError","startsWith","removeAsync","ensureDirectoryAsync","exportAppAsync","FileNotifier","stopAll","waitUntilAtlasExportIsReadyAsync","Log","log","chalk","greenBright","ensureProcessExitsAfterDelay"],"mappings":";;;;+BAYsBA;;;eAAAA;;;;gEAZJ;;;;;;;gEACD;;;;;;2BAEc;6DAEV;6BAC4B;8BACpB;qBACqB;wBACrB;sBACgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,eAAeA,YAAYC,WAAmB,EAAEC,OAAgB;IACrE,yCAAyC;IACzC,MAAMC,aAAaC,eAAI,CAACC,OAAO,CAACJ,aAAaC,QAAQI,SAAS;IAE9D,IAAIH,eAAeF,aAAa;QAC9B,MAAM,IAAIM,oBAAY,CAAC;IACzB,OAAO,IAAIN,YAAYO,UAAU,CAACL,aAAa;QAC7C,MAAM,IAAII,oBAAY,CAAC,CAAC,mEAAmE,CAAC;IAC9F;IACA,2CAA2C;IAC3C,MAAME,IAAAA,gBAAW,EAACN;IAClB,8BAA8B;IAC9B,MAAMO,IAAAA,yBAAoB,EAACP;IAE3B,iBAAiB;IACjB,MAAMQ,IAAAA,yBAAc,EAACV,aAAaC;IAElC,0DAA0D;IAC1DU,0BAAY,CAACC,OAAO;IACpB,0CAA0C;IAC1C,4EAA4E;IAC5E,MAAMC,IAAAA,6CAAgC,EAACb;IAEvC,cAAc;IACdc,KAAIC,GAAG,CAACC,gBAAK,CAACC,WAAW,CAAC,UAAU,EAAEhB,QAAQI,SAAS,CAAC,CAAC;IAEzD,qGAAqG;IACrGa,IAAAA,kCAA4B;AAC9B"}

View File

@@ -0,0 +1,185 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
addDomBundleToMetadataAsync: function() {
return addDomBundleToMetadataAsync;
},
exportDomComponentAsync: function() {
return exportDomComponentAsync;
},
transformDomEntryForMd5Filename: function() {
return transformDomEntryForMd5Filename;
},
transformNativeBundleForMd5Filename: function() {
return transformNativeBundleForMd5Filename;
}
});
function _assert() {
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
_assert = function() {
return data;
};
return data;
}
function _crypto() {
const data = /*#__PURE__*/ _interop_require_default(require("crypto"));
_crypto = function() {
return data;
};
return data;
}
function _path() {
const data = /*#__PURE__*/ _interop_require_default(require("path"));
_path = function() {
return data;
};
return data;
}
function _resolvefrom() {
const data = /*#__PURE__*/ _interop_require_default(require("resolve-from"));
_resolvefrom = function() {
return data;
};
return data;
}
function _url() {
const data = /*#__PURE__*/ _interop_require_default(require("url"));
_url = function() {
return data;
};
return data;
}
const _saveAssets = require("./saveAssets");
const _serializeHtml = require("../start/server/metro/serializeHtml");
const _DomComponentsMiddleware = require("../start/server/middleware/DomComponentsMiddleware");
const _env = require("../utils/env");
const _filePath = require("../utils/filePath");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const debug = require('debug')('expo:export:exportDomComponents');
async function exportDomComponentAsync({ filePath, projectRoot, dev, devServer, isHermes, includeSourceMaps, exp, files, useMd5Filename = false }) {
var _exp_experiments;
const virtualEntry = (0, _filePath.toPosixPath)((0, _resolvefrom().default)(projectRoot, 'expo/dom/entry.js'));
debug('Bundle DOM Component:', filePath);
// MUST MATCH THE BABEL PLUGIN!
const hash = _crypto().default.createHash('md5').update(filePath).digest('hex');
const outputName = `${_DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;
const generatedEntryPath = (0, _filePath.toPosixPath)(filePath.startsWith('file://') ? _url().default.fileURLToPath(filePath) : filePath);
const baseUrl = `/${_DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}`;
// The relative import path will be used like URI so it must be POSIX.
const relativeImport = './' + _path().default.posix.relative(_path().default.dirname(virtualEntry), generatedEntryPath);
// Run metro bundler and create the JS bundles/source maps.
const bundle = await devServer.legacySinglePageExportBundleAsync({
platform: 'web',
domRoot: encodeURI(relativeImport),
splitChunks: !_env.env.EXPO_NO_BUNDLE_SPLITTING,
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, virtualEntry),
mode: dev ? 'development' : 'production',
engine: isHermes ? 'hermes' : undefined,
serializerIncludeMaps: includeSourceMaps,
bytecode: false,
reactCompiler: !!((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.reactCompiler),
baseUrl: './',
useMd5Filename,
// Minify may be false because it's skipped on native when Hermes is enabled, default to true.
minify: true
});
if (useMd5Filename) {
for (const artifact of bundle.artifacts){
const md5 = _crypto().default.createHash('md5').update(artifact.source).digest('hex');
artifact.filename = `${md5}.${artifact.type}`;
}
}
const html = await (0, _serializeHtml.serializeHtmlWithAssets)({
isExporting: true,
resources: bundle.artifacts,
template: (0, _DomComponentsMiddleware.getDomComponentHtml)(),
baseUrl: './'
});
const serialAssets = bundle.artifacts.map((a)=>{
return {
...a,
filename: _path().default.join(baseUrl, a.filename)
};
});
(0, _saveAssets.getFilesFromSerialAssets)(serialAssets, {
includeSourceMaps,
files,
platform: 'web'
});
files.set(outputName, {
contents: html
});
return {
bundle,
htmlOutputName: outputName
};
}
function addDomBundleToMetadataAsync(bundle) {
const assetsMetadata = [];
for (const artifact of bundle.artifacts){
if (artifact.type === 'map') {
continue;
}
assetsMetadata.push({
path: `${_DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`,
ext: artifact.type
});
}
return assetsMetadata;
}
function transformDomEntryForMd5Filename({ files, htmlOutputName }) {
const htmlContent = files.get(htmlOutputName);
(0, _assert().default)(htmlContent);
const htmlMd5 = _crypto().default.createHash('md5').update(htmlContent.contents.toString()).digest('hex');
const htmlMd5Filename = `${_DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${htmlMd5}.html`;
files.set(htmlMd5Filename, htmlContent);
files.delete(htmlOutputName);
return [
{
path: htmlMd5Filename,
ext: 'html'
}
];
}
function transformNativeBundleForMd5Filename({ domComponentReference, nativeBundle, files, htmlOutputName }) {
const htmlContent = files.get(htmlOutputName);
(0, _assert().default)(htmlContent);
const htmlMd5 = _crypto().default.createHash('md5').update(htmlContent.contents.toString()).digest('hex');
const hash = _crypto().default.createHash('md5').update(domComponentReference).digest('hex');
for (const artifact of nativeBundle.artifacts){
if (artifact.type !== 'js') {
continue;
}
const assetEntity = files.get(artifact.filename);
(0, _assert().default)(assetEntity);
if (Buffer.isBuffer(assetEntity.contents)) {
const searchBuffer = Buffer.from(`${hash}.html`, 'utf8');
const replaceBuffer = Buffer.from(`${htmlMd5}.html`, 'utf8');
(0, _assert().default)(searchBuffer.length === replaceBuffer.length);
let index = assetEntity.contents.indexOf(searchBuffer, 0);
while(index !== -1){
replaceBuffer.copy(assetEntity.contents, index);
index = assetEntity.contents.indexOf(searchBuffer, index + searchBuffer.length);
}
} else {
const search = `${hash}.html`;
const replace = `${htmlMd5}.html`;
(0, _assert().default)(search.length === replace.length);
assetEntity.contents = assetEntity.contents.toString().replaceAll(search, replace);
}
}
} //#endregion `npx export` for updates
//# sourceMappingURL=exportDomComponents.js.map

Some files were not shown because too many files have changed in this diff Show More