one
Version:
One is a new React Framework that makes Vite serve both native and web.
73 lines (71 loc) • 2.95 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
value: true
}), mod);
var setupBuildOptions_exports = {};
__export(setupBuildOptions_exports, {
setupBuildInfo: () => setupBuildInfo
});
module.exports = __toCommonJS(setupBuildOptions_exports);
var import_constants = require("../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);
(0, import_constants.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;
}
}
}
}
}
//# sourceMappingURL=setupBuildOptions.native.js.map