one
Version:
One is a new React Framework that makes Vite serve both native and web.
45 lines (44 loc) • 1.97 kB
JavaScript
import { setCacheKey } from "../constants.native.js";
function setupBuildInfo(buildInfo) {
var _process_env;
var _buildInfo_constants, _buildInfo_oneOptions_web, _buildInfo_oneOptions;
var key = (_buildInfo_constants = buildInfo.constants) === null || _buildInfo_constants === void 0 ? void 0 : _buildInfo_constants.CACHE_KEY;
if (key) {
var _process_env1;
(_process_env1 = process.env).ONE_CACHE_KEY || (_process_env1.ONE_CACHE_KEY = key);
setCacheKey(key);
}
(_process_env = process.env).ONE_DEFAULT_RENDER_MODE || (_process_env.ONE_DEFAULT_RENDER_MODE = ((_buildInfo_oneOptions = buildInfo.oneOptions) === null || _buildInfo_oneOptions === void 0 ? void 0 : (_buildInfo_oneOptions_web = _buildInfo_oneOptions.web) === null || _buildInfo_oneOptions_web === void 0 ? void 0 : _buildInfo_oneOptions_web.defaultRenderMode) || "ssg");
var {
cssContentsByPath
} = buildInfo;
if (cssContentsByPath) {
var _iteratorNormalCompletion = true,
_didIteratorError = false,
_iteratorError = void 0;
try {
for (var _iterator = Object.values(buildInfo.routeToBuildInfo)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var route = _step.value;
route.cssContents = route.css.map(function (cssPath) {
var _cssContentsByPath_cssPath;
return (_cssContentsByPath_cssPath = cssContentsByPath[cssPath]) !== null && _cssContentsByPath_cssPath !== void 0 ? _cssContentsByPath_cssPath : "";
});
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
}
export { setupBuildInfo };
//# sourceMappingURL=setupBuildOptions.native.js.map