1082815dcSEvan Bacon"use strict";
2082815dcSEvan Bacon
3082815dcSEvan BaconObject.defineProperty(exports, "__esModule", {
4082815dcSEvan Bacon  value: true
5082815dcSEvan Bacon});
6082815dcSEvan Baconexports.withConfigPlugins = void 0;
7082815dcSEvan Baconfunction _configPlugins() {
8082815dcSEvan Bacon  const data = require("@expo/config-plugins");
9082815dcSEvan Bacon  _configPlugins = function () {
10082815dcSEvan Bacon    return data;
11082815dcSEvan Bacon  };
12082815dcSEvan Bacon  return data;
13082815dcSEvan Bacon}
14082815dcSEvan Baconfunction _Serialize() {
15082815dcSEvan Bacon  const data = require("../Serialize");
16082815dcSEvan Bacon  _Serialize = function () {
17082815dcSEvan Bacon    return data;
18082815dcSEvan Bacon  };
19082815dcSEvan Bacon  return data;
20082815dcSEvan Bacon}
21082815dcSEvan Bacon/**
22082815dcSEvan Bacon * Resolves static plugins array as config plugin functions.
23082815dcSEvan Bacon *
24082815dcSEvan Bacon * @param config
25082815dcSEvan Bacon * @param projectRoot
26082815dcSEvan Bacon */
27082815dcSEvan Baconconst withConfigPlugins = (config, skipPlugins) => {
28082815dcSEvan Bacon  var _config$plugins;
29082815dcSEvan Bacon  // @ts-ignore: plugins not on config type yet -- TODO
30082815dcSEvan Bacon  if (!Array.isArray(config.plugins) || !((_config$plugins = config.plugins) !== null && _config$plugins !== void 0 && _config$plugins.length)) {
31082815dcSEvan Bacon    return config;
32082815dcSEvan Bacon  }
33082815dcSEvan Bacon  if (!skipPlugins) {
34082815dcSEvan Bacon    // Resolve and evaluate plugins
35082815dcSEvan Bacon    // @ts-ignore: TODO: add plugins to the config schema
36082815dcSEvan Bacon    config = (0, _configPlugins().withPlugins)(config, config.plugins);
37082815dcSEvan Bacon  } else {
38082815dcSEvan Bacon    // Delete the plugins array in case someone added functions or other values which cannot be automatically serialized.
39082815dcSEvan Bacon    delete config.plugins;
40*ae7abf6fSBartosz Kaszubowski  }
41*ae7abf6fSBartosz Kaszubowski  // plugins aren't serialized by default, serialize the plugins after resolving them.
42082815dcSEvan Bacon  return (0, _Serialize().serializeAfterStaticPlugins)(config);
43082815dcSEvan Bacon};
44082815dcSEvan Baconexports.withConfigPlugins = withConfigPlugins;
45082815dcSEvan Bacon//# sourceMappingURL=withConfigPlugins.js.map